1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-02 06:23:18 +02:00

Abstract mmap() in physmap.c and only open /dev/mem on the first physmap() call

Corresponding to flashrom svn r397 and coreboot v2 svn r3903.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Peter Stuge <peter@stuge.se>
This commit is contained in:
Stefan Reinauer
2009-01-26 01:10:48 +00:00
committed by Peter Stuge
parent 776d2021fd
commit 0593f21f10
6 changed files with 71 additions and 88 deletions

View File

@ -188,13 +188,7 @@ int coreboot_init(void)
struct lb_header *lb_table;
struct lb_record *rec, *last;
low_1MB = mmap(0, 1024 * 1024, PROT_READ, MAP_SHARED, fd_mem,
0x00000000);
if (low_1MB == MAP_FAILED) {
perror("Can't mmap memory using " MEM_DEV);
mmap_errmsg();
exit(-2);
}
low_1MB = physmap("low megabyte", 0x0, 1024*1024);
lb_table = find_lb_table(low_1MB, 0x00000, 0x1000);
if (!lb_table)
lb_table = find_lb_table(low_1MB, 0xf0000, 1024*1024);