Subject: Dont use dummy set_virtual_address_map
Date: Fri, 17 Aug 2007 16:32:59 +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: kexec-tools-unstable/purgatory/arch/ia64/entry.S
===================================================================
--- kexec-tools-unstable.orig/purgatory/arch/ia64/entry.S	2007-05-09 19:25:45.000000000 +0900
+++ kexec-tools-unstable/purgatory/arch/ia64/entry.S	2007-05-15 17:55:32.000000000 +0900
@@ -21,16 +21,6 @@
 .size	name, 8;	\
 name:	data8 0x0
 
-.global __dummy_efi_function
-.align  32
-.proc  __dummy_efi_function
-__dummy_efi_function:
-	mov r8=r0;;
-	br.ret.sptk.many rp;;
-.global __dummy_efi_function_end
-__dummy_efi_function_end:
-.endp 	__dummy_efi_function
-
 .global purgatory_start
 .align  32
 .proc   purgatory_start
Index: kexec-tools-unstable/purgatory/arch/ia64/purgatory-ia64.c
===================================================================
--- kexec-tools-unstable.orig/purgatory/arch/ia64/purgatory-ia64.c	2007-05-09 19:25:45.000000000 +0900
+++ kexec-tools-unstable/purgatory/arch/ia64/purgatory-ia64.c	2007-05-15 17:58:24.000000000 +0900
@@ -21,8 +21,6 @@
 #include <string.h>
 #include "purgatory-ia64.h"
 
-#define PAGE_OFFSET             0xe000000000000000UL
-
 #define EFI_PAGE_SHIFT          12
 #define EFI_PAGE_SIZE		(1UL<<EFI_PAGE_SHIFT)
 #define EFI_PAGE_ALIGN(x)	((x + EFI_PAGE_SIZE - 1)&~(EFI_PAGE_SIZE-1))
@@ -145,11 +143,6 @@ setup_arch(void)
 	reset_vga();
 }
 
-inline unsigned long PA(unsigned long addr)
-{
-	return addr - PAGE_OFFSET;
-}
-
 void
 patch_efi_memmap(struct kexec_boot_params *params,
 		struct ia64_boot_param *boot_param)
@@ -229,9 +222,6 @@ flush_icache_range(char *start, unsigned
 	asm volatile ("srlz.i":::"memory");
 }
 
-extern char __dummy_efi_function[], __dummy_efi_function_end[];
-
-
 void
 ia64_env_setup(struct ia64_boot_param *boot_param,
 	struct kexec_boot_params *params)
@@ -245,32 +235,7 @@ ia64_env_setup(struct ia64_boot_param *b
 	struct ia64_boot_param *new_boot_param =
 	(struct ia64_boot_param *) params->boot_param_base;
 	memcpy(new_boot_param, boot_param, 4096);
-
-	/*
-	 * patch efi_runtime->set_virtual_address_map to a dummy function
-	 *
-	 * The EFI specification mandates that set_virtual_address_map only
-	 * takes effect the first time that it is called, and that
-	 * subsequent calls will return error.  By replacing it with a
-	 * dummy function the new OS can think it is calling it again
-	 * without either the OS or any buggy EFI implementations getting
-	 * upset.
-	 *
-	 * Note: as the EFI specification says that set_virtual_address_map
-	 * will only take affect the first time it is called, the mapping
-	 * can't be updated, and thus mapping of the old and new OS really
-	 * needs to be the same.
-	 */
-	len = __dummy_efi_function_end - __dummy_efi_function;
-	memcpy(command_line + command_line_len,
-		__dummy_efi_function, len);
-	systab = (efi_system_table_t *)new_boot_param->efi_systab;
-	runtime = (efi_runtime_services_t *)PA(systab->runtime);
-	set_virtual_address_map =
-		(unsigned long *)PA(runtime->set_virtual_address_map);
-	*(set_virtual_address_map) =
-		(unsigned long)(command_line + command_line_len);
-	flush_icache_range(command_line + command_line_len, len);
+	//XXX: 4096 -> params->efi_memmap_size ?
 
 	patch_efi_memmap(params, new_boot_param);
 
