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
@@ -99,6 +99,23 @@ struct pci_dev *pci_card_find(uint16_t vendor, uint16_t device,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int map_flash_registers(struct flashchip *flash)
|
||||
{
|
||||
volatile uint8_t *registers;
|
||||
size_t size = flash->total_size * 1024;
|
||||
|
||||
registers = mmap(0, size, PROT_WRITE | PROT_READ, MAP_SHARED,
|
||||
fd_mem, (off_t) (0xFFFFFFFF - 0x400000 - size + 1));
|
||||
|
||||
if (registers == MAP_FAILED) {
|
||||
perror("Can't mmap registers using " MEM_DEV);
|
||||
exit(1);
|
||||
}
|
||||
flash->virtual_registers = registers;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct flashchip *probe_flash(struct flashchip *flash)
|
||||
{
|
||||
volatile uint8_t *bios;
|
||||
|
Reference in New Issue
Block a user