[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH for-4.5 V6 09/14] Add efi_arch_memory() for arch specific memory setup



This patch adds efi_arch_memory() to allow each architecture a hook
to use for do memory setup.  x86 uses this for trampoline memory setup
and some pagetable setup.

Signed-off-by: Roy Franz <roy.franz@xxxxxxxxxx>
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/efi/efi-boot.h | 35 +++++++++++++++++++++++++++++++++++
 xen/common/efi/boot.c       | 29 +----------------------------
 2 files changed, 36 insertions(+), 28 deletions(-)

diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 7f8a603..32fc950 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -532,3 +532,38 @@ static void __init 
efi_arch_video_init(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop,
             (gop->Mode->FrameBufferSize + 0xffff) >> 16;
     }
 }
+
+static void __init efi_arch_memory_setup(void)
+{
+    unsigned int i;
+    EFI_STATUS status;
+
+    /* Allocate space for trampoline (in first Mb). */
+    cfg.addr = 0x100000;
+    cfg.size = trampoline_end - trampoline_start;
+    status = efi_bs->AllocatePages(AllocateMaxAddress, EfiLoaderData,
+                                   PFN_UP(cfg.size), &cfg.addr);
+    if ( status == EFI_SUCCESS )
+        relocate_trampoline(cfg.addr);
+    else
+    {
+        cfg.addr = 0;
+        PrintStr(L"Trampoline space cannot be allocated; will try 
fallback.\r\n");
+    }
+
+    /* Initialise L2 identity-map and boot-map page table entries (16MB). */
+    for ( i = 0; i < 8; ++i )
+    {
+        unsigned int slot = (xen_phys_start >> L2_PAGETABLE_SHIFT) + i;
+        paddr_t addr = slot << L2_PAGETABLE_SHIFT;
+
+        l2_identmap[slot] = l2e_from_paddr(addr, PAGE_HYPERVISOR|_PAGE_PSE);
+        slot &= L2_PAGETABLE_ENTRIES - 1;
+        l2_bootmap[slot] = l2e_from_paddr(addr, __PAGE_HYPERVISOR|_PAGE_PSE);
+    }
+    /* Initialise L3 boot-map page directory entries. */
+    l3_bootmap[l3_table_offset(xen_phys_start)] =
+        l3e_from_paddr((UINTN)l2_bootmap, __PAGE_HYPERVISOR);
+    l3_bootmap[l3_table_offset(xen_phys_start + (8 << L2_PAGETABLE_SHIFT) - 
1)] =
+        l3e_from_paddr((UINTN)l2_bootmap, __PAGE_HYPERVISOR);
+}
diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 3893311..596c16f 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -991,34 +991,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE 
*SystemTable)
         PrintStr(newline);
     }
 
-    /* Allocate space for trampoline (in first Mb). */
-    cfg.addr = 0x100000;
-    cfg.size = trampoline_end - trampoline_start;
-    status = efi_bs->AllocatePages(AllocateMaxAddress, EfiLoaderData,
-                                   PFN_UP(cfg.size), &cfg.addr);
-    if ( status == EFI_SUCCESS )
-        relocate_trampoline(cfg.addr);
-    else
-    {
-        cfg.addr = 0;
-        PrintStr(L"Trampoline space cannot be allocated; will try 
fallback.\r\n");
-    }
-
-    /* Initialise L2 identity-map and boot-map page table entries (16MB). */
-    for ( i = 0; i < 8; ++i )
-    {
-        unsigned int slot = (xen_phys_start >> L2_PAGETABLE_SHIFT) + i;
-        paddr_t addr = slot << L2_PAGETABLE_SHIFT;
-
-        l2_identmap[slot] = l2e_from_paddr(addr, PAGE_HYPERVISOR|_PAGE_PSE);
-        slot &= L2_PAGETABLE_ENTRIES - 1;
-        l2_bootmap[slot] = l2e_from_paddr(addr, __PAGE_HYPERVISOR|_PAGE_PSE);
-    }
-    /* Initialise L3 boot-map page directory entries. */
-    l3_bootmap[l3_table_offset(xen_phys_start)] =
-        l3e_from_paddr((UINTN)l2_bootmap, __PAGE_HYPERVISOR);
-    l3_bootmap[l3_table_offset(xen_phys_start + (8 << L2_PAGETABLE_SHIFT) - 
1)] =
-        l3e_from_paddr((UINTN)l2_bootmap, __PAGE_HYPERVISOR);
+    efi_arch_memory_setup();
 
     if ( gop )
     {
-- 
2.1.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.