]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: Move SEC/PEI Temporary RAM from 0x70000 to 0x810000
authorJordan Justen <jordan.l.justen@intel.com>
Tue, 21 Jan 2014 19:38:43 +0000 (19:38 +0000)
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 21 Jan 2014 19:38:43 +0000 (19:38 +0000)
Note: The Temporary RAM memory size is being reduced from
      64KB to 32KB. This still appears to be more than
      adequate for OVMF's early PEI phase. We will be adding
      another 32KB range of RAM just above this range for
      use on S3 resume.

The range is declared as part of MEMFD, so it is easier
to identify the memory range.

We also now assign PCDs to the memory range.

The PCDs are used to set the initial SEC/PEI stack in
SEC's assembly code.

The PCDs are also used in the SEC C code to setup
the Temporary RAM PPI.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15147 6f19259b-4bc3-4df7-8a09-765794883524

OvmfPkg/OvmfPkg.dec
OvmfPkg/OvmfPkgIa32.fdf
OvmfPkg/OvmfPkgIa32X64.fdf
OvmfPkg/OvmfPkgX64.fdf
OvmfPkg/Sec/Ia32/SecEntry.S
OvmfPkg/Sec/Ia32/SecEntry.asm
OvmfPkg/Sec/SecMain.c
OvmfPkg/Sec/SecMain.inf
OvmfPkg/Sec/X64/SecEntry.S
OvmfPkg/Sec/X64/SecEntry.asm

index c362e5f1157cf4b6973a58c97e76754c5e40ce24..0e33b3b69c1ca9cee1e117377589af49f648ac87 100644 (file)
@@ -80,6 +80,8 @@
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFdBaseAddress|0x0|UINT32|0xf\r
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase|0x0|UINT32|0x11\r
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesSize|0x0|UINT32|0x12\r
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase|0x0|UINT32|0x13\r
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize|0x0|UINT32|0x14\r
 \r
 [PcdsDynamic, PcdsDynamicEx]\r
   gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent|0|UINT64|2\r
index 483ad85e64e07247e24430914421838392d5378f..210abdedeb6594a5f34782a535b37bc24a26e9b8 100644 (file)
@@ -138,6 +138,9 @@ NumBlocks     = 0x80
 0x000000|0x006000\r
 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesSize\r
 \r
+0x010000|0x008000\r
+gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize\r
+\r
 0x020000|0x7E0000\r
 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvSize\r
 FV = MAINFV\r
index 9a0008066f5807609985a3ee2e7b76d4f8663e49..90f44a623779382c1c5ee259caab0e31d63dca54 100644 (file)
@@ -138,6 +138,9 @@ NumBlocks     = 0x80
 0x000000|0x006000\r
 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesSize\r
 \r
+0x010000|0x008000\r
+gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize\r
+\r
 0x020000|0x7E0000\r
 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvSize\r
 FV = MAINFV\r
index 09a91c14766491d182631b9ffb26091b3d8a5814..67c7415fda0d2e4fd99eee7f5990306c76c036c1 100644 (file)
@@ -138,6 +138,9 @@ NumBlocks     = 0x80
 0x000000|0x006000\r
 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesSize\r
 \r
+0x010000|0x008000\r
+gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize\r
+\r
 0x020000|0x7E0000\r
 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvSize\r
 FV = MAINFV\r
index a1b0c0d0f0db0b96a45fef4daadbca97346c89c7..0771a874494af904af665b20388ee0a49e04f856 100644 (file)
@@ -1,55 +1,59 @@
-#      TITLE   SecEntry.asm
-#------------------------------------------------------------------------------
-#*
-#*   Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-#*   This program and the accompanying materials
-#*   are licensed and made available under the terms and conditions of the BSD License
-#*   which accompanies this distribution.  The full text of the license may be found at
-#*   http://opensource.org/licenses/bsd-license.php
-#*
-#*   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-#*   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#*
-#*    CpuAsm.asm
-#*
-#*   Abstract:
-#*
-#------------------------------------------------------------------------------
-
-
-#include <Base.h>
-
-#EXTERN ASM_PFX(SecCoreStartupWithStack)
-
-#
-# SecCore Entry Point
-#
-# Processor is in flat protected mode
-#
-# @param[in]  EAX   Initial value of the EAX register (BIST: Built-in Self Test)
-# @param[in]  DI    'BP': boot-strap processor, or 'AP': application processor
-# @param[in]  EBP   Pointer to the start of the Boot Firmware Volume
-#
-# @return     None  This routine does not return
-#
-ASM_GLOBAL ASM_PFX(_ModuleEntryPoint)
-ASM_PFX(_ModuleEntryPoint):
-
-    #
-    # Load temporary stack top at very low memory.  The C code
-    # can reload to a better address.
-    #
-    movl    $BASE_512KB, %eax 
-    movl    %eax, %esp
-    nop
-
-    #
-    # Call into C code
-    #
-    pushl   %eax
-    pushl   %ebp
-    call    ASM_PFX(SecCoreStartupWithStack)
-
-
-#END
-
+#      TITLE   SecEntry.asm\r
+#------------------------------------------------------------------------------\r
+#*\r
+#*   Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+#*   This program and the accompanying materials\r
+#*   are licensed and made available under the terms and conditions of the BSD License\r
+#*   which accompanies this distribution.  The full text of the license may be found at\r
+#*   http://opensource.org/licenses/bsd-license.php\r
+#*\r
+#*   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+#*   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#*\r
+#*    CpuAsm.asm\r
+#*\r
+#*   Abstract:\r
+#*\r
+#------------------------------------------------------------------------------\r
+\r
+\r
+#include <Base.h>\r
+\r
+#EXTERN ASM_PFX(SecCoreStartupWithStack)\r
+\r
+#\r
+# SecCore Entry Point\r
+#\r
+# Processor is in flat protected mode\r
+#\r
+# @param[in]  EAX   Initial value of the EAX register (BIST: Built-in Self Test)\r
+# @param[in]  DI    'BP': boot-strap processor, or 'AP': application processor\r
+# @param[in]  EBP   Pointer to the start of the Boot Firmware Volume\r
+#\r
+# @return     None  This routine does not return\r
+#\r
+ASM_GLOBAL ASM_PFX(_ModuleEntryPoint)\r
+ASM_PFX(_ModuleEntryPoint):\r
+\r
+    #\r
+    # Load temporary RAM stack based on PCDs\r
+    #\r
+    .set    SEC_TOP_OF_STACK, FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) + \\r
+                              FixedPcdGet32 (PcdOvmfSecPeiTempRamSize)\r
+    movl    $SEC_TOP_OF_STACK, %eax\r
+    movl    %eax, %esp\r
+    nop\r
+\r
+    #\r
+    # Setup parameters and call SecCoreStartupWithStack\r
+    #   [esp]   return address for call\r
+    #   [esp+4] BootFirmwareVolumePtr\r
+    #   [esp+8] TopOfCurrentStack\r
+    #\r
+    pushl   %eax\r
+    pushl   %ebp\r
+    call    ASM_PFX(SecCoreStartupWithStack)\r
+\r
+\r
+#END\r
+\r
index 4b0e95af48b8843feeaa953260431fc551f2d1f4..e9458adc4973cf296e8a83eaece6a5a3209b421b 100644 (file)
@@ -1,7 +1,7 @@
       TITLE   SecEntry.asm\r
 ;------------------------------------------------------------------------------\r
 ;*\r
-;*   Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+;*   Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
 ;*   This program and the accompanying materials\r
 ;*   are licensed and made available under the terms and conditions of the BSD License\r
 ;*   which accompanies this distribution.  The full text of the license may be found at\r
@@ -38,15 +38,19 @@ EXTERN SecCoreStartupWithStack:PROC
 _ModuleEntryPoint PROC PUBLIC\r
 \r
     ;\r
-    ; Load temporary stack top at very low memory.  The C code\r
-    ; can reload to a better address.\r
+    ; Load temporary RAM stack based on PCDs\r
     ;\r
-    mov     eax, BASE_512KB\r
+    SEC_TOP_OF_STACK EQU (FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) + \\r
+                          FixedPcdGet32 (PcdOvmfSecPeiTempRamSize))\r
+    mov     eax, SEC_TOP_OF_STACK\r
     mov     esp, eax\r
     nop\r
 \r
     ;\r
-    ; Call into C code\r
+    ; Setup parameters and call SecCoreStartupWithStack\r
+    ;   [esp]   return address for call\r
+    ;   [esp+4] BootFirmwareVolumePtr\r
+    ;   [esp+8] TopOfCurrentStack\r
     ;\r
     push    eax\r
     push    ebp\r
index ece1c9b517e5bef07942bb3a74aba3de0b0b3336..8bdf6e5238c5b762343578a1faaf4fbae10781cf 100644 (file)
@@ -631,12 +631,16 @@ SecCoreStartupWithStack (
   // |-------------|       <-- SecCoreData.TemporaryRamBase\r
   //\r
 \r
+  ASSERT ((UINTN) (PcdGet32 (PcdOvmfSecPeiTempRamBase) +\r
+                   PcdGet32 (PcdOvmfSecPeiTempRamSize)) ==\r
+          (UINTN) TopOfCurrentStack);\r
+\r
   //\r
   // Initialize SEC hand-off state\r
   //\r
   SecCoreData.DataSize = sizeof(EFI_SEC_PEI_HAND_OFF);\r
 \r
-  SecCoreData.TemporaryRamSize       = SIZE_64KB;\r
+  SecCoreData.TemporaryRamSize       = (UINTN) PcdGet32 (PcdOvmfSecPeiTempRamSize);\r
   SecCoreData.TemporaryRamBase       = (VOID*)((UINT8 *)TopOfCurrentStack - SecCoreData.TemporaryRamSize);\r
 \r
   SecCoreData.PeiTemporaryRamBase    = SecCoreData.TemporaryRamBase;\r
index 68dfeaaa4b1c5cecc617c76f1e231799226fb944..0b1cda83dff100279f1a4dd6c932027ce2edbe39 100644 (file)
@@ -67,3 +67,5 @@
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvBase\r
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvSize\r
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase\r
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase\r
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize\r
index de0859bcfb060d1307a1b8b849b41d1587d8cbe3..37354d9f3cbbec91b7975eaa05c94250b8eb765e 100644 (file)
@@ -1,54 +1,56 @@
-#      TITLE   SecEntry.asm
-#------------------------------------------------------------------------------
-#*
-#*   Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-#*   This program and the accompanying materials
-#*   are licensed and made available under the terms and conditions of the BSD License
-#*   which accompanies this distribution.  The full text of the license may be found at
-#*   http://opensource.org/licenses/bsd-license.php
-#*
-#*   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-#*   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#*
-#*    CpuAsm.asm
-#*
-#*   Abstract:
-#*
-#------------------------------------------------------------------------------
-
-
-#include <Base.h>
-
-#EXTERN ASM_PFX(SecCoreStartupWithStack)
-
-#
-# SecCore Entry Point
-#
-# Processor is in flat protected mode
-#
-# @param[in]  RAX   Initial value of the EAX register (BIST: Built-in Self Test)
-# @param[in]  DI    'BP': boot-strap processor, or 'AP': application processor
-# @param[in]  RBP   Pointer to the start of the Boot Firmware Volume
-#
-# @return     None  This routine does not return
-#
-ASM_GLOBAL ASM_PFX(_ModuleEntryPoint)
-ASM_PFX(_ModuleEntryPoint):
-
-    #
-    # Load temporary stack top at very low memory.  The C code
-    # can reload to a better address.
-    #
-    movq    $BASE_512KB, %rsp 
-    nop
-
-    #
-    # Setup parameters and call SecCoreStartupWithStack
-    #   rcx: BootFirmwareVolumePtr
-    #   rdx: TopOfCurrentStack
-    #
-    movq    %rbp, %rcx
-    movq    %rsp, %rdx
-    subq    $0x20, %rsp
-    call    ASM_PFX(SecCoreStartupWithStack)
-
+#      TITLE   SecEntry.asm\r
+#------------------------------------------------------------------------------\r
+#*\r
+#*   Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+#*   This program and the accompanying materials\r
+#*   are licensed and made available under the terms and conditions of the BSD License\r
+#*   which accompanies this distribution.  The full text of the license may be found at\r
+#*   http://opensource.org/licenses/bsd-license.php\r
+#*\r
+#*   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+#*   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#*\r
+#*    CpuAsm.asm\r
+#*\r
+#*   Abstract:\r
+#*\r
+#------------------------------------------------------------------------------\r
+\r
+\r
+#include <Base.h>\r
+\r
+#EXTERN ASM_PFX(SecCoreStartupWithStack)\r
+\r
+#\r
+# SecCore Entry Point\r
+#\r
+# Processor is in flat protected mode\r
+#\r
+# @param[in]  RAX   Initial value of the EAX register (BIST: Built-in Self Test)\r
+# @param[in]  DI    'BP': boot-strap processor, or 'AP': application processor\r
+# @param[in]  RBP   Pointer to the start of the Boot Firmware Volume\r
+#\r
+# @return     None  This routine does not return\r
+#\r
+ASM_GLOBAL ASM_PFX(_ModuleEntryPoint)\r
+ASM_PFX(_ModuleEntryPoint):\r
+\r
+    #\r
+    # Load temporary stack top at very low memory.  The C code\r
+    # can reload to a better address.\r
+    #\r
+    .set    SEC_TOP_OF_STACK, FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) + \\r
+                              FixedPcdGet32 (PcdOvmfSecPeiTempRamSize)\r
+    movq    $SEC_TOP_OF_STACK, %rsp \r
+    nop\r
+\r
+    #\r
+    # Setup parameters and call SecCoreStartupWithStack\r
+    #   rcx: BootFirmwareVolumePtr\r
+    #   rdx: TopOfCurrentStack\r
+    #\r
+    movq    %rbp, %rcx\r
+    movq    %rsp, %rdx\r
+    subq    $0x20, %rsp\r
+    call    ASM_PFX(SecCoreStartupWithStack)\r
+\r
index 55f5eabbfdc473242e8d3d45b8e75a7076db6cd9..4135208a3a04d95938a6e074fc5141bb621884ad 100644 (file)
@@ -1,7 +1,7 @@
       TITLE   SecEntry.asm\r
 ;------------------------------------------------------------------------------\r
 ;*\r
-;*   Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+;*   Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
 ;*   This program and the accompanying materials\r
 ;*   are licensed and made available under the terms and conditions of the BSD License\r
 ;*   which accompanies this distribution.  The full text of the license may be found at\r
@@ -36,10 +36,11 @@ EXTERN SecCoreStartupWithStack:PROC
 _ModuleEntryPoint PROC PUBLIC\r
 \r
     ;\r
-    ; Load temporary stack top at very low memory.  The C code\r
-    ; can reload to a better address.\r
+    ; Load temporary RAM stack based on PCDs\r
     ;\r
-    mov     rsp, BASE_512KB\r
+    SEC_TOP_OF_STACK EQU (FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) + \\r
+                          FixedPcdGet32 (PcdOvmfSecPeiTempRamSize))\r
+    mov     rsp, SEC_TOP_OF_STACK\r
     nop\r
 \r
     ;\r