[PATCH] x86/voyager: Switch voyager memory detection to early_ioremap.

Ian Campbell
2008-01-19T16:09:20Z

Extracted from an earlier patch by Eric Biederman.

Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
CC: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
---
arch/x86/mach-voyager/voyager_basic.c | 19 +++++++------------
1 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/arch/x86/mach-voyager/voyager_basic.c b/arch/x86/mach-voyager/voyager_basic.c
index 6a949e4..ed41fd8 100644
--- a/arch/x86/mach-voyager/voyager_basic.c
+++ b/arch/x86/mach-voyager/voyager_basic.c
@@ -110,8 +110,9 @@ typedef struct ClickMap {
} Entry[CLICK_ENTRIES];
} ClickMap_t;

-/* This routine is pretty much an awful hack to read the bios clickmap by
- * mapping it into page 0. There are usually three regions in the map:
+/*
+ * This routine reads the bios clickmap. There are usually three
+ * regions in the map:
* Base Memory
* Extended Memory
* zero length marker for end of map
@@ -125,7 +126,6 @@ int __init voyager_memory_detect(int region, __u32 * start, __u32 * length)
__u8 cmos[4];
ClickMap_t *map;
unsigned long map_addr;
- unsigned long old;

if (region >= CLICK_ENTRIES) {
printk("Voyager: Illegal ClickMap region %d\n", region);
@@ -138,12 +138,8 @@ int __init voyager_memory_detect(int region, __u32 * start, __u32 * length)

map_addr = *(unsigned long *)cmos;

- /* steal page 0 for this */
- old = pg0[0];
- pg0[0] = ((map_addr & PAGE_MASK) | _PAGE_RW | _PAGE_PRESENT);
- local_flush_tlb();
- /* now clear everything out but page 0 */
- map = (ClickMap_t *) (map_addr & (~PAGE_MASK));
+ /* Setup a temporary mapping for the clickmap */
+ map = early_ioremap(map_addr, sizeof(*map));

/* zero length is the end of the clickmap */
if (map->Entry[region].Length != 0) {
@@ -152,9 +148,8 @@ int __init voyager_memory_detect(int region, __u32 * start, __u32 * length)
retval = 1;
}

- /* replace the mapping */
- pg0[0] = old;
- local_flush_tlb();
+ /* undo the mapping */
+ early_iounmap(map, sizeof(*map));
return retval;
}

--
1.5.3.8