1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-02 22:43:17 +02:00

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>
This commit is contained in:
Stefan Reinauer
2007-05-24 08:48:10 +00:00
committed by Stefan Reinauer
parent 7c1402f220
commit ff4f197a24
6 changed files with 31 additions and 54 deletions

View File

@ -46,21 +46,11 @@ void print_sst_fwhub_status(uint8_t status)
/* probe_jedec works fine for probing */
int probe_sst_fwhub(struct flashchip *flash)
{
volatile uint8_t *registers;
size_t size = flash->total_size * 1024;
if (probe_jedec(flash) == 0)
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);
}
map_flash_registers(flash);
flash->virtual_registers = registers;
return 1;
}