summaryrefslogtreecommitdiffstats
path: root/sharplhf00l04.c
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@coresystems.de>2007-05-24 08:48:10 +0000
committerStefan Reinauer <stefan.reinauer@coreboot.org>2007-05-24 08:48:10 +0000
commitff4f197a24d2b06162e062004874ac915ee353ac (patch)
treef0892c97e2f71c31bab955384efebffd8fb1621a /sharplhf00l04.c
parent7c1402f2208f3240de9f28f6ac48a24f526c430d (diff)
downloadast2050-flashrom-ff4f197a24d2b06162e062004874ac915ee353ac.zip
ast2050-flashrom-ff4f197a24d2b06162e062004874ac915ee353ac.tar.gz
Factor out register mapping code
Corresponding to flashrom svn r113 and coreboot v2 svn r2691. Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Stefan Reinauer <stepan@coresystems.de>
Diffstat (limited to 'sharplhf00l04.c')
-rw-r--r--sharplhf00l04.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/sharplhf00l04.c b/sharplhf00l04.c
index a4d086e..1caedd0 100644
--- a/sharplhf00l04.c
+++ b/sharplhf00l04.c
@@ -48,7 +48,6 @@ void print_lhf00l04_status(uint8_t status)
int probe_lhf00l04(struct flashchip *flash)
{
volatile uint8_t *bios = flash->virtual_memory;
- volatile uint8_t *registers;
uint8_t id1, id2;
#if 0
@@ -75,24 +74,12 @@ int probe_lhf00l04(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;
- // 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);
- }
-
- flash->virtual_registers = registers;
- printf("bios %p, *bios 0x%x, bios[1] 0x%x\n", bios, *bios,
- bios[1]);
- return 1;
- }
+ if (id1 != flash->manufacture_id || id2 != flash->model_id)
+ return 0;
+
+ map_flash_registers(flash);
- return 0;
+ return 1;
}
uint8_t wait_lhf00l04(volatile uint8_t *bios)
OpenPOWER on IntegriCloud