summaryrefslogtreecommitdiff
path: root/util/flashrom/82802ab.c
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@coresystems.de>2007-05-24 08:48:10 +0000
committerStefan Reinauer <stepan@openbios.org>2007-05-24 08:48:10 +0000
commit8924fdd22b2399bb09a09b4b35317202c391f858 (patch)
tree52f7f4d90736a3fa2d358bb2e8e0b4af88f85fb6 /util/flashrom/82802ab.c
parenta18501dae89c0ede2a208f8f72449e2357d2c88b (diff)
factor out register mapping code (trivial)
Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2691 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/flashrom/82802ab.c')
-rw-r--r--util/flashrom/82802ab.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/util/flashrom/82802ab.c b/util/flashrom/82802ab.c
index 199cf4d7ef..2dacfa30a1 100644
--- a/util/flashrom/82802ab.c
+++ b/util/flashrom/82802ab.c
@@ -49,7 +49,6 @@ void print_82802ab_status(uint8_t status)
int probe_82802ab(struct flashchip *flash)
{
volatile uint8_t *bios = flash->virtual_memory;
- volatile uint8_t *registers;
uint8_t id1, id2;
#if 0
@@ -75,23 +74,12 @@ int probe_82802ab(struct flashchip *flash)
printf_debug("%s: id1 0x%x, id2 0x%x\n", __FUNCTION__, id1, id2);
- if (id1 == flash->manufacture_id && id2 == flash->model_id) {
- size_t size = flash->total_size * 1024;
+ if (id1 != flash->manufacture_id || id2 != flash->model_id)
+ return 0;
- // we need to mmap the write-protect space.
- registers = mmap(0, size, PROT_WRITE | PROT_READ, MAP_SHARED,
- fd_mem, (off_t) (0 - 0x400000 - size));
- if (registers == MAP_FAILED) {
- // it's this part but we can't map it ...
- perror("Can't mmap memory using " MEM_DEV);
- exit(1);
- }
+ map_flash_registers(flash);
- flash->virtual_registers = registers;
- return 1;
- }
-
- return 0;
+ return 1;
}
uint8_t wait_82802ab(volatile uint8_t *bios)