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
This commit is contained in:
committed by
Stefan Reinauer
parent
a18501dae8
commit
8924fdd22b
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user