summaryrefslogtreecommitdiff
path: root/sst49lfxxxc.c
diff options
context:
space:
mode:
authorstepan <stepan@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2007-05-24 08:48:10 +0000
committerstepan <stepan@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2007-05-24 08:48:10 +0000
commit15e04c51e034fa430faa2ddeeabf6c32b6501527 (patch)
treef0892c97e2f71c31bab955384efebffd8fb1621a /sst49lfxxxc.c
parente46aee0927d0efd08d2c0119123546ee12d1cb87 (diff)
downloadflashrom-15e04c51e034fa430faa2ddeeabf6c32b6501527.tar.gz
Original v2 revision: 2691
factor out register mapping code (trivial) Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@113 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'sst49lfxxxc.c')
-rw-r--r--sst49lfxxxc.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/sst49lfxxxc.c b/sst49lfxxxc.c
index b8f4b84..16f84df 100644
--- a/sst49lfxxxc.c
+++ b/sst49lfxxxc.c
@@ -133,10 +133,8 @@ static __inline__ int write_sector_49lfxxxc(volatile uint8_t *bios,
int probe_49lfxxxc(struct flashchip *flash)
{
volatile uint8_t *bios = flash->virtual_memory;
- volatile uint8_t *registers;
uint8_t id1, id2;
- size_t size = flash->total_size * 1024;
*bios = RESET;
@@ -147,17 +145,12 @@ int probe_49lfxxxc(struct flashchip *flash)
*bios = RESET;
printf_debug("%s: id1 0x%x, id2 0x%x\n", __FUNCTION__, id1, id2);
+
if (!(id1 == flash->manufacture_id && id2 == flash->model_id))
return 0;
- registers = mmap(0, size, PROT_WRITE | PROT_READ, MAP_SHARED,
- fd_mem, (off_t) (0xFFFFFFFF - 0x400000 - size + 1));
- if (registers == MAP_FAILED) {
- // it's this part but we can't map it ...
- perror("Can't mmap memory using " MEM_DEV);
- exit(1);
- }
- flash->virtual_registers = registers;
+ map_flash_registers(flash);
+
return 1;
}