Subject: [IA64] Kexec: map EFI after paging is initilaised
From: Simon Horman <horms@verge.net.au>
Date: Thu, 16 Aug 2007 17:23:10 +0900

If the EFI region is mapped into a region within the address space usually
used by guests, then the mapping can't be made until paging is fully
initialised.  A description of why this mapping is made is included in the
patch that makes the mapping.

This is in preparation for a patch that will move the
run-time EFI regions into such a space.

It assumes that patches to allow SAL calls to run in physical
mode have been applied.

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

Index: xen-unstable.hg/xen/arch/ia64/linux-xen/efi.c
===================================================================
--- xen-unstable.hg.orig/xen/arch/ia64/linux-xen/efi.c	2007-08-07 10:03:55.000000000 +0900
+++ xen-unstable.hg/xen/arch/ia64/linux-xen/efi.c	2007-08-07 11:11:16.000000000 +0900
@@ -484,9 +484,6 @@ efi_init (void)
 	efi_char16_t *c16;
 	u64 efi_desc_size;
 	char *cp, vendor[100] = "unknown";
-#ifdef XEN
-	int phys_efi = 0;
-#endif
 	int i;
 
 	/* it's too early to be able to use the standard kernel command line support... */
@@ -502,11 +499,6 @@ efi_init (void)
 			max_addr = GRANULEROUNDDOWN(memparse(cp + 9, &cp));
 		} else if (memcmp(cp, "min_addr=", 9) == 0) {
 			min_addr = GRANULEROUNDDOWN(memparse(cp + 9, &cp));
-#ifdef XEN
-		} else if (memcmp(cp, "phys_efi", 8) == 0) {
-			phys_efi = 1;
-			cp+=8;
-#endif
 		} else {
 			while (*cp != ' ' && *cp)
 				++cp;
@@ -640,10 +632,20 @@ efi_init (void)
 #ifndef XEN
 	efi_enter_virtual_mode();
 #else
+}
+
+static unsigned int __initdata phys_efi = 0;
+integer_param("phys_efi", phys_efi); 
+
+void __init
+late_efi_init (void)
+{
 	if (phys_efi)
 		printk("Forcing EFI to stay in physical mode\n");
-	else
+	else {
+		printk("Puting EFI into virtual mode\n");
 		efi_enter_virtual_mode();
+	}
 #endif
 }
 
Index: xen-unstable.hg/xen/arch/ia64/linux-xen/setup.c
===================================================================
--- xen-unstable.hg.orig/xen/arch/ia64/linux-xen/setup.c	2007-08-07 10:03:54.000000000 +0900
+++ xen-unstable.hg/xen/arch/ia64/linux-xen/setup.c	2007-08-07 10:03:55.000000000 +0900
@@ -594,6 +594,9 @@ late_setup_arch (char **cmdline_p)
 #endif
 
 	cpu_init();	/* initialize the bootstrap CPU */
+#ifdef XEN
+	late_efi_init();
+#endif
 
 #ifdef CONFIG_ACPI_BOOT
 	acpi_boot_init();
Index: xen-unstable.hg/xen/include/asm-ia64/linux-xen/linux/efi.h
===================================================================
--- xen-unstable.hg.orig/xen/include/asm-ia64/linux-xen/linux/efi.h	2007-08-07 10:03:54.000000000 +0900
+++ xen-unstable.hg/xen/include/asm-ia64/linux-xen/linux/efi.h	2007-08-07 10:03:55.000000000 +0900
@@ -310,6 +310,7 @@ efi_guid_unparse(efi_guid_t *guid, char 
 }
 
 extern void efi_init (void);
+extern void late_efi_init (void);
 extern void *efi_get_pal_addr (void);
 extern void efi_map_pal_code (void);
 extern void efi_map_memmap(void);
