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 <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
diff --git a/cbtable.c b/cbtable.c
index e5bcb45..c100bbb 100644
--- a/cbtable.c
+++ b/cbtable.c
@@ -261,7 +261,7 @@
#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 @@
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;