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

From: Ian Campbell
Date: Sat Jan 19 2008 - 11:09:22 EST


Extracted from an earlier patch by Eric Biederman.

Signed-off-by: Ian Campbell <ijc@xxxxxxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: H. Peter Anvin <hpa@xxxxxxxxx>
CC: James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>
Cc: Eric W. Biederman <ebiederm@xxxxxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/