From 43eac0394591a4f662d2793e8405226c3c69fdc4 Mon Sep 17 00:00:00 2001 From: Carl-Daniel Hailfinger Date: Wed, 5 Mar 2014 00:16:16 +0000 Subject: Clean up physmap, fix unaligned mapping problems Convert all physmaps in dmi.c to use aligned readonly maps. Convert all physmaps in cbtable.c to use unaligned readonly maps. Make physunmap() a generic architecture-independent wrapper. Add physunmap_unaligned() to complement physmap*_unaligned(). Corresponding to flashrom svn r1765. Signed-off-by: Carl-Daniel Hailfinger Acked-by: Stefan Tauner --- cbtable.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'cbtable.c') diff --git a/cbtable.c b/cbtable.c index e5bcb45..c100bbb 100644 --- a/cbtable.c +++ b/cbtable.c @@ -261,7 +261,7 @@ int cb_parse_table(const char **vendor, const char **model) #else start = 0x0; #endif - table_area = physmap_ro("low megabyte", start, BYTES_TO_MAP - start); + table_area = physmap_ro_unaligned("low megabyte", start, BYTES_TO_MAP - start); if (ERROR_PTR == table_area) { msg_perr("Failed getting access to coreboot low tables.\n"); return -1; @@ -276,8 +276,9 @@ int cb_parse_table(const char **vendor, const char **model) if (forward->tag == LB_TAG_FORWARD) { start = forward->forward; start &= ~(getpagesize() - 1); - physunmap(table_area, BYTES_TO_MAP); - table_area = physmap_ro("high tables", start, BYTES_TO_MAP); + physunmap_unaligned(table_area, BYTES_TO_MAP); + // FIXME: table_area is never unmapped below, nor is it unmapped above in the no-forward case + table_area = physmap_ro_unaligned("high tables", start, BYTES_TO_MAP); if (ERROR_PTR == table_area) { msg_perr("Failed getting access to coreboot high tables.\n"); return -1; -- cgit v1.1