Subject: [PATCH] Don't use dummy set_virtual_address_map
Date: Mon, 19 Feb 2007 15:28:02 +0900
From: Simon Horman <horms@verge.net.au>

Instead of relying on purgatory to set up a dummy
set_virtual_address_map(), which requires purgatory
to know how to do __va() opperations, just test to see
if efi has already been mapped at boot time.

Signed-off-by: Simon Horman <horms@verge.net.au>

Index: linux-2.6/arch/ia64/kernel/efi.c
===================================================================
--- linux-2.6.orig/arch/ia64/kernel/efi.c	2007-02-19 15:28:02.000000000 +0900
+++ linux-2.6/arch/ia64/kernel/efi.c	2007-02-19 18:08:35.000000000 +0900
@@ -586,15 +586,28 @@
 		}
 	}
 
-	status = efi_call_phys(__va(runtime->set_virtual_address_map),
-			       ia64_boot_param->efi_memmap_size,
-			       efi_desc_size, ia64_boot_param->efi_memdesc_version,
-			       ia64_boot_param->efi_memmap);
-	if (status != EFI_SUCCESS) {
-		printk(KERN_WARNING "warning: unable to switch EFI into virtual mode "
-		       "(status=%lu)\n", status);
+	if ((unsigned long)__va(runtime->set_virtual_address_map) ==
+	    runtime->set_virtual_address_map) {
+		printk(KERN_WARNING "warning: EFI is already mapped "
+		       "in the right place\n");
+	}
+	else if (runtime->set_virtual_address_map & (0xfUL << 60)) {
+		printk(KERN_WARNING "warning: EFI is already mapped "
+		       "in the wrong place\n");
 		return;
 	}
+	else {
+		status = efi_call_phys(__va(runtime->set_virtual_address_map),
+				       ia64_boot_param->efi_memmap_size,
+				       efi_desc_size,
+				       ia64_boot_param->efi_memdesc_version,
+				       ia64_boot_param->efi_memmap);
+		if (status != EFI_SUCCESS) {
+			printk(KERN_WARNING "warning: unable to switch EFI "
+			       "into virtual mode (status=%lu)\n", status);
+			return;
+		}
+	}
 
 	/*
 	 * Now that EFI is in virtual mode, we call the EFI functions more efficiently:
