From a18501dae89c0ede2a208f8f72449e2357d2c88b Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Wed, 23 May 2007 18:24:58 +0000 Subject: [PATCH] Unify mmap error messages in flashrom (trivial) Signed-off-by: Stefan Reinauer Acked-by: Stefan Reinauer git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2690 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- util/flashrom/82802ab.c | 2 +- util/flashrom/flashrom.c | 7 ++++--- util/flashrom/lbtable.c | 4 +--- util/flashrom/sharplhf00l04.c | 2 +- util/flashrom/sst49lfxxxc.c | 2 +- util/flashrom/sst_fwhub.c | 2 +- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/util/flashrom/82802ab.c b/util/flashrom/82802ab.c index 9512c67a4f..199cf4d7ef 100644 --- a/util/flashrom/82802ab.c +++ b/util/flashrom/82802ab.c @@ -83,7 +83,7 @@ int probe_82802ab(struct flashchip *flash) fd_mem, (off_t) (0 - 0x400000 - size)); if (registers == MAP_FAILED) { // it's this part but we can't map it ... - perror("Error MMAP memory using " MEM_DEV); + perror("Can't mmap memory using " MEM_DEV); exit(1); } diff --git a/util/flashrom/flashrom.c b/util/flashrom/flashrom.c index cd97dda0f1..a05def76b3 100644 --- a/util/flashrom/flashrom.c +++ b/util/flashrom/flashrom.c @@ -116,15 +116,16 @@ struct flashchip *probe_flash(struct flashchip *flash) #ifdef TS5300 // FIXME: Wrong place for this decision + // FIXME: This should be autodetected. It is trivial. flash_baseaddr = 0x9400000; #else flash_baseaddr = (0xffffffff - size + 1); #endif /* If getpagesize() > size -> - * `Error MMAP /dev/mem: Invalid argument' + * "Can't mmap memory using /dev/mem: Invalid argument" * This should never happen as we don't support any flash chips - * smaller than 4k or 8k yet. + * smaller than 4k or 8k (yet). */ if (getpagesize() > size) { @@ -136,7 +137,7 @@ struct flashchip *probe_flash(struct flashchip *flash) bios = mmap(0, size, PROT_WRITE | PROT_READ, MAP_SHARED, fd_mem, (off_t) flash_baseaddr); if (bios == MAP_FAILED) { - perror("Error: Can't mmap " MEM_DEV "."); + perror("Can't mmap memory using " MEM_DEV); exit(1); } flash->virtual_memory = bios; diff --git a/util/flashrom/lbtable.c b/util/flashrom/lbtable.c index d65d1a0c4d..bbee991e2f 100644 --- a/util/flashrom/lbtable.c +++ b/util/flashrom/lbtable.c @@ -161,9 +161,7 @@ int linuxbios_init(void) low_1MB = mmap(0, 1024 * 1024, PROT_READ, MAP_SHARED, fd_mem, 0x00000000); if (low_1MB == MAP_FAILED) { - fprintf(stderr, - "Can not mmap " MEM_DEV " at %08lx errno(%d):%s\n", - 0x00000000UL, errno, strerror(errno)); + perror("Can't mmap memory using " MEM_DEV); exit(-2); } lb_table = 0; diff --git a/util/flashrom/sharplhf00l04.c b/util/flashrom/sharplhf00l04.c index fd3a714202..a4d086e1ea 100644 --- a/util/flashrom/sharplhf00l04.c +++ b/util/flashrom/sharplhf00l04.c @@ -82,7 +82,7 @@ int probe_lhf00l04(struct flashchip *flash) fd_mem, (off_t) (0 - 0x400000 - size)); if (registers == MAP_FAILED) { // it's this part but we can't map it ... - perror("Error MMAP /dev/mem"); + perror("Can't mmap memory using " MEM_DEV); exit(1); } diff --git a/util/flashrom/sst49lfxxxc.c b/util/flashrom/sst49lfxxxc.c index efa2a6108d..b8f4b844e3 100644 --- a/util/flashrom/sst49lfxxxc.c +++ b/util/flashrom/sst49lfxxxc.c @@ -154,7 +154,7 @@ int probe_49lfxxxc(struct flashchip *flash) fd_mem, (off_t) (0xFFFFFFFF - 0x400000 - size + 1)); if (registers == MAP_FAILED) { // it's this part but we can't map it ... - perror("Error MMAP /dev/mem"); + perror("Can't mmap memory using " MEM_DEV); exit(1); } flash->virtual_registers = registers; diff --git a/util/flashrom/sst_fwhub.c b/util/flashrom/sst_fwhub.c index 72a84535a1..78589b1457 100644 --- a/util/flashrom/sst_fwhub.c +++ b/util/flashrom/sst_fwhub.c @@ -56,7 +56,7 @@ int probe_sst_fwhub(struct flashchip *flash) fd_mem, (off_t) (0xFFFFFFFF - 0x400000 - size + 1)); if (registers == MAP_FAILED) { // it's this part but we can't map it ... - perror("Error MMAP /dev/mem"); + perror("Can't mmap memory using " MEM_DEV); exit(1); }