diff options
author | qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-11-28 07:59:59 +0000 |
---|---|---|
committer | qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-11-28 07:59:59 +0000 |
commit | 657d3918fe7831c1a7722869b025478746540657 (patch) | |
tree | 3b53c398cc5fd798c91219eabebebd1ad0d96b0b /EdkModulePkg | |
parent | 2109b16ef8007fd4033041065318fb199227628a (diff) | |
download | edk2-platforms-657d3918fe7831c1a7722869b025478746540657.tar.xz |
• Set the default value of PcdDxeIplSwitchToLongMode to TRUE.
• Make access to PcdDxeIplSwitchToLongMode to Ia32 specific code.
• Introduce another feature flag named PcdDxeIplBuildShareCodeHobs to define whether to build hobs to DXE core to share code.
• Remove the #progma bug
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2026 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkModulePkg')
-rw-r--r-- | EdkModulePkg/Core/DxeIplPeim/DxeIpl.h | 55 | ||||
-rw-r--r-- | EdkModulePkg/Core/DxeIplPeim/DxeIpl.msa | 16 | ||||
-rw-r--r-- | EdkModulePkg/Core/DxeIplPeim/DxeLoad.c | 137 | ||||
-rw-r--r-- | EdkModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c | 121 | ||||
-rw-r--r-- | EdkModulePkg/Core/DxeIplPeim/Ipf/DxeLoadFunc.c | 105 | ||||
-rw-r--r-- | EdkModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c | 52 | ||||
-rw-r--r-- | EdkModulePkg/EdkModulePkg.fpd | 32 | ||||
-rw-r--r-- | EdkModulePkg/EdkModulePkg.spd | 13 |
8 files changed, 236 insertions, 295 deletions
diff --git a/EdkModulePkg/Core/DxeIplPeim/DxeIpl.h b/EdkModulePkg/Core/DxeIplPeim/DxeIpl.h index f8fd8766ab..af570d3c4d 100644 --- a/EdkModulePkg/Core/DxeIplPeim/DxeIpl.h +++ b/EdkModulePkg/Core/DxeIplPeim/DxeIpl.h @@ -27,38 +27,6 @@ Abstract: extern BOOLEAN gInMemory;
-/**
- Transfers control to a function starting with a new stack.
-
- Transfers control to the function specified by EntryPoint using the new stack
- specified by NewStack and passing in the parameters specified by Context1 and
- Context2. Context1 and Context2 are optional and may be NULL. The function
- EntryPoint must never return.
-
- If EntryPoint is NULL, then ASSERT().
- If NewStack is NULL, then ASSERT().
-
- @param EntryPoint A pointer to function to call with the new stack.
- @param Context1 A pointer to the context to pass into the EntryPoint
- function.
- @param Context2 A pointer to the context to pass into the EntryPoint
- function.
- @param NewStack A pointer to the new stack to use for the EntryPoint
- function.
- @param NewBsp A pointer to the new BSP for the EntryPoint on IPF. It's
- Reserved on other architectures.
-
-**/
-VOID
-EFIAPI
-SwitchIplStacks (
- IN SWITCH_STACK_ENTRY_POINT EntryPoint,
- IN VOID *Context1, OPTIONAL
- IN VOID *Context2, OPTIONAL
- IN VOID *NewStack,
- IN VOID *NewBsp
- );
-
EFI_STATUS
PeiFindFile (
IN UINT8 Type,
@@ -80,12 +48,6 @@ PeiLoadFile ( EFI_STATUS
-CreateArchSpecificHobs (
- OUT EFI_PHYSICAL_ADDRESS *BspStore
- )
-;
-
-EFI_STATUS
GetImageReadFunction (
IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
)
@@ -124,6 +86,12 @@ DxeLoadCore ( IN EFI_PEI_HOB_POINTERS HobList
);
+VOID
+HandOffToDxeCore (
+ IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,
+ IN EFI_PEI_HOB_POINTERS HobList
+ );
+
EFI_STATUS
PeiProcessFile (
IN UINT16 SectionType,
@@ -139,17 +107,6 @@ PeimInitializeDxeIpl ( IN EFI_PEI_SERVICES **PeiServices
);
-EFI_STATUS
-PeiLoadx64File (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *PeiEfiPeiPeCoffLoader,
- IN VOID *Pe32Data,
- IN EFI_MEMORY_TYPE MemoryType,
- OUT EFI_PHYSICAL_ADDRESS *ImageAddress,
- OUT UINT64 *ImageSize,
- OUT EFI_PHYSICAL_ADDRESS *EntryPoint
- )
-;
-
EFI_PHYSICAL_ADDRESS
CreateIdentityMappingPageTables (
IN UINT32 NumberOfProcessorPhysicalAddressBits
diff --git a/EdkModulePkg/Core/DxeIplPeim/DxeIpl.msa b/EdkModulePkg/Core/DxeIplPeim/DxeIpl.msa index 31b7b358ee..bbf6cf1f44 100644 --- a/EdkModulePkg/Core/DxeIplPeim/DxeIpl.msa +++ b/EdkModulePkg/Core/DxeIplPeim/DxeIpl.msa @@ -75,19 +75,15 @@ <Filename>DxeLoad.c</Filename>
<Filename>DxeIpl.h</Filename>
<Filename>DxeIpl.dxs</Filename>
- <Filename SupArchList="IA32">Ia32/ImageRead.c</Filename>
+ <Filename SupArchList="IA32 X64 EBC">Ia32/ImageRead.c</Filename>
<Filename SupArchList="IA32">Ia32/DxeLoadFunc.c</Filename>
<Filename SupArchList="IA32">Ia32/LongMode.asm</Filename>
<Filename ToolChainFamily="GCC" SupArchList="IA32">Ia32/LongMode.S</Filename>
<Filename SupArchList="IA32">Ia32/VirtualMemory.c</Filename>
<Filename SupArchList="IA32">Ia32/VirtualMemory.h</Filename>
- <Filename SupArchList="X64">Ia32/ImageRead.c</Filename>
- <Filename SupArchList="X64">Ia32/DxeLoadFunc.c</Filename>
+ <Filename SupArchList="X64 EBC">X64/DxeLoadFunc.c</Filename>
<Filename SupArchList="IPF">ipf/ImageRead.c</Filename>
<Filename SupArchList="IPF">ipf/DxeLoadFunc.c</Filename>
- <Filename SupArchList="EBC">Ia32/ImageRead.c</Filename>
- <Filename SupArchList="EBC">Ia32/DxeLoadFunc.c</Filename>
- <Filename SupArchList="X64 IPF EBC">Non-existing.c</Filename>
</SourceFiles>
<PackageDependencies>
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
@@ -143,10 +139,16 @@ <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">
<C_Name>PcdDxeIplSwitchToLongMode</C_Name>
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DefaultValue>FALSE</DefaultValue>
+ <DefaultValue>TRUE</DefaultValue>
<HelpText>If this feature is enabled, then the DXE IPL will load a 64-bit DxeCore.</HelpText>
</PcdEntry>
<PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">
+ <C_Name>PcdDxeIplBuildShareCodeHobs</C_Name>
+ <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
+ <DefaultValue>TRUE</DefaultValue>
+ <HelpText>If this feature is enabled, DXE IPL will build a series of HOBs to share code with DXE Core.</HelpText>
+ </PcdEntry>
+ <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">
<C_Name>PcdDxeIplSupportEfiDecompress</C_Name>
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DefaultValue>TRUE</DefaultValue>
diff --git a/EdkModulePkg/Core/DxeIplPeim/DxeLoad.c b/EdkModulePkg/Core/DxeIplPeim/DxeLoad.c index 8c3de0522d..3b04ed1b10 100644 --- a/EdkModulePkg/Core/DxeIplPeim/DxeLoad.c +++ b/EdkModulePkg/Core/DxeIplPeim/DxeLoad.c @@ -22,10 +22,6 @@ Abstract: #include "DxeIpl.h"
-#ifndef __GNUC__
-#pragma warning( disable : 4305 )
-#endif
-
BOOLEAN gInMemory = FALSE;
//
@@ -151,9 +147,6 @@ Returns: --*/
{
EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS TopOfStack;
- EFI_PHYSICAL_ADDRESS BaseOfStack;
- EFI_PHYSICAL_ADDRESS BspStore;
EFI_GUID DxeCoreFileName;
EFI_GUID FirmwareFileName;
VOID *Pe32Data;
@@ -165,13 +158,8 @@ Returns: EFI_BOOT_MODE BootMode;
EFI_PEI_RECOVERY_MODULE_PPI *PeiRecovery;
EFI_PEI_S3_RESUME_PPI *S3Resume;
- EFI_PHYSICAL_ADDRESS PageTables;
// PERF_START (PeiServices, L"DxeIpl", NULL, 0);
- TopOfStack = 0;
- BaseOfStack = 0;
- BspStore = 0;
- PageTables = 0;
//
// if in S3 Resume, restore configure
@@ -217,17 +205,6 @@ Returns: PeiEfiPeiPeCoffLoader = (EFI_PEI_PE_COFF_LOADER_PROTOCOL *)GetPeCoffLoaderProtocol ();
ASSERT (PeiEfiPeiPeCoffLoader != NULL);
- //
- // Allocate 128KB for the Stack
- //
- PeiServicesAllocatePages (EfiBootServicesData, EFI_SIZE_TO_PAGES (STACK_SIZE), &BaseOfStack);
- ASSERT (BaseOfStack != 0);
-
- //
- // Add architecture-specifc HOBs (including the BspStore HOB)
- //
- Status = CreateArchSpecificHobs (&BspStore);
- ASSERT_EFI_ERROR (Status);
//
// Find the EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE type compressed Firmware Volume file
@@ -290,70 +267,37 @@ Returns: EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_CORE_PC_HANDOFF_TO_NEXT
);
- DEBUG ((EFI_D_INFO, "DXE Core Entry\n"));
- if (FeaturePcdGet(PcdDxeIplSwitchToLongMode)) {
- //
- // Compute the top of the stack we were allocated, which is used to load X64 dxe core.
- // Pre-allocate a 32 bytes which confroms to x64 calling convention.
- //
- // The first four parameters to a function are passed in rcx, rdx, r8 and r9.
- // Any further parameters are pushed on the stack. Furthermore, space (4 * 8bytes) for the
- // register parameters is reserved on the stack, in case the called function
- // wants to spill them; this is important if the function is variadic.
- //
- TopOfStack = BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - 32;
-
- //
- // X64 Calling Conventions requires that the stack must be aligned to 16 bytes
- //
- TopOfStack = (EFI_PHYSICAL_ADDRESS) (UINTN) ALIGN_POINTER (TopOfStack, 16);
- //
- // Load the GDT of Go64. Since the GDT of 32-bit Tiano locates in the BS_DATA
- // memory, it may be corrupted when copying FV to high-end memory
- //
- LoadGo64Gdt();
- //
- // Limit to 36 bits of addressing for debug. Should get it from CPU
- //
- PageTables = CreateIdentityMappingPageTables (36);
- //
- // Go to Long Mode. Interrupts will not get turned on until the CPU AP is loaded.
- // Call x64 drivers passing in single argument, a pointer to the HOBs.
- //
- ActivateLongMode (
- PageTables,
- (EFI_PHYSICAL_ADDRESS)(UINTN)(HobList.Raw),
- TopOfStack,
- 0x00000000,
- DxeCoreEntryPoint
- );
- } else {
- //
- // Add HOB for the EFI Decompress Protocol
- //
- BuildGuidDataHob (
- &gEfiDecompressProtocolGuid,
- (VOID *)&gEfiDecompress,
- sizeof (gEfiDecompress)
- );
-
- //
- // Add HOB for the Tiano Decompress Protocol
- //
- BuildGuidDataHob (
- &gEfiTianoDecompressProtocolGuid,
- (VOID *)&gTianoDecompress,
- sizeof (gTianoDecompress)
- );
-
- //
- // Add HOB for the user customized Decompress Protocol
- //
- BuildGuidDataHob (
- &gEfiCustomizedDecompressProtocolGuid,
- (VOID *)&gCustomDecompress,
- sizeof (gCustomDecompress)
- );
+ if (FeaturePcdGet (PcdDxeIplBuildShareCodeHobs)) {
+ if (FeaturePcdGet (PcdDxeIplSupportEfiDecompress)) {
+ //
+ // Add HOB for the EFI Decompress Protocol
+ //
+ BuildGuidDataHob (
+ &gEfiDecompressProtocolGuid,
+ (VOID *)&gEfiDecompress,
+ sizeof (gEfiDecompress)
+ );
+ }
+ if (FeaturePcdGet (PcdDxeIplSupportTianoDecompress)) {
+ //
+ // Add HOB for the Tiano Decompress Protocol
+ //
+ BuildGuidDataHob (
+ &gEfiTianoDecompressProtocolGuid,
+ (VOID *)&gTianoDecompress,
+ sizeof (gTianoDecompress)
+ );
+ }
+ if (FeaturePcdGet (PcdDxeIplSupportCustomDecompress)) {
+ //
+ // Add HOB for the user customized Decompress Protocol
+ //
+ BuildGuidDataHob (
+ &gEfiCustomizedDecompressProtocolGuid,
+ (VOID *)&gCustomDecompress,
+ sizeof (gCustomDecompress)
+ );
+ }
//
// Add HOB for the PE/COFF Loader Protocol
@@ -363,21 +307,10 @@ Returns: (VOID *)&PeiEfiPeiPeCoffLoader,
sizeof (VOID *)
);
- //
- // Compute the top of the stack we were allocated. Pre-allocate a UINTN
- // for safety.
- //
- TopOfStack = BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - CPU_STACK_ALIGNMENT;
- TopOfStack = (EFI_PHYSICAL_ADDRESS) (UINTN) ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);
-
- SwitchIplStacks (
- (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint,
- HobList.Raw,
- NULL,
- (VOID *) (UINTN) TopOfStack,
- (VOID *) (UINTN) BspStore
- );
- }
+ }
+
+ DEBUG ((EFI_D_INFO, "DXE Core Entry\n"));
+ HandOffToDxeCore (DxeCoreEntryPoint, HobList);
//
// If we get here, then the DXE Core returned. This is an error
// Dxe Core should not return.
diff --git a/EdkModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c b/EdkModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c index 28e980517a..6b61086cf2 100644 --- a/EdkModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c +++ b/EdkModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c @@ -21,66 +21,69 @@ Abstract: #include "DxeIpl.h"
-EFI_STATUS
-CreateArchSpecificHobs (
- OUT EFI_PHYSICAL_ADDRESS *BspStore
- )
-/*++
-
-Routine Description:
-
- Creates architecture-specific HOBs.
-
- Note: New parameters should NOT be added for any HOBs that are added to this
- function. BspStore is a special case because it is required for the
- call to SwitchStacks() in DxeLoad().
-
-Arguments:
-
- BspStore - The address of the BSP Store for those architectures that need
- it. Otherwise 0.
-
-Returns:
-
- EFI_SUCCESS - The HOBs were created successfully.
-
---*/
-{
- *BspStore = 0;
- return EFI_SUCCESS;
-}
-
-/**
- Transfers control to a function starting with a new stack.
-
- Transfers control to the function specified by EntryPoint using the new stack
- specified by NewStack and passing in the parameters specified by Context1 and
- Context2. Context1 and Context2 are optional and may be NULL. The function
- EntryPoint must never return.
-
- If EntryPoint is NULL, then ASSERT().
- If NewStack is NULL, then ASSERT().
-
- @param EntryPoint A pointer to function to call with the new stack.
- @param Context1 A pointer to the context to pass into the EntryPoint
- function.
- @param Context2 A pointer to the context to pass into the EntryPoint
- function.
- @param NewStack A pointer to the new stack to use for the EntryPoint
- function.
- @param NewBsp A pointer to the new BSP for the EntryPoint on IPF. It's
- Reserved on other architectures.
-
-**/
VOID
-EFIAPI
-SwitchIplStacks (
- IN SWITCH_STACK_ENTRY_POINT EntryPoint,
- IN VOID *Context1, OPTIONAL
- IN VOID *Context2, OPTIONAL
- IN VOID *NewStack,
- IN VOID *NewBsp
+HandOffToDxeCore (
+ IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,
+ IN EFI_PEI_HOB_POINTERS HobList
)
{
- SwitchStack (EntryPoint, Context1, Context2, NewStack);
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS BaseOfStack;
+ EFI_PHYSICAL_ADDRESS TopOfStack;
+ EFI_PHYSICAL_ADDRESS PageTables;
+
+ Status = PeiServicesAllocatePages (EfiBootServicesData, EFI_SIZE_TO_PAGES (STACK_SIZE), &BaseOfStack);
+ ASSERT_EFI_ERROR (Status);
+
+ if (FeaturePcdGet(PcdDxeIplSwitchToLongMode)) {
+ //
+ // Compute the top of the stack we were allocated, which is used to load X64 dxe core.
+ // Pre-allocate a 32 bytes which confroms to x64 calling convention.
+ //
+ // The first four parameters to a function are passed in rcx, rdx, r8 and r9.
+ // Any further parameters are pushed on the stack. Furthermore, space (4 * 8bytes) for the
+ // register parameters is reserved on the stack, in case the called function
+ // wants to spill them; this is important if the function is variadic.
+ //
+ TopOfStack = BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - 32;
+
+ //
+ // X64 Calling Conventions requires that the stack must be aligned to 16 bytes
+ //
+ TopOfStack = (EFI_PHYSICAL_ADDRESS) (UINTN) ALIGN_POINTER (TopOfStack, 16);
+ //
+ // Load the GDT of Go64. Since the GDT of 32-bit Tiano locates in the BS_DATA
+ // memory, it may be corrupted when copying FV to high-end memory
+ //
+ LoadGo64Gdt();
+ //
+ // Limit to 36 bits of addressing for debug. Should get it from CPU
+ //
+ PageTables = CreateIdentityMappingPageTables (36);
+ //
+ // Go to Long Mode. Interrupts will not get turned on until the CPU AP is loaded.
+ // Call x64 drivers passing in single argument, a pointer to the HOBs.
+ //
+ ActivateLongMode (
+ PageTables,
+ (EFI_PHYSICAL_ADDRESS)(UINTN)(HobList.Raw),
+ TopOfStack,
+ 0x00000000,
+ DxeCoreEntryPoint
+ );
+ } else {
+ //
+ // Compute the top of the stack we were allocated. Pre-allocate a UINTN
+ // for safety.
+ //
+ TopOfStack = BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - CPU_STACK_ALIGNMENT;
+ TopOfStack = (EFI_PHYSICAL_ADDRESS) (UINTN) ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);
+
+ SwitchStack (
+ (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint,
+ HobList.Raw,
+ NULL,
+ (VOID *) (UINTN) TopOfStack
+ );
+ }
}
diff --git a/EdkModulePkg/Core/DxeIplPeim/Ipf/DxeLoadFunc.c b/EdkModulePkg/Core/DxeIplPeim/Ipf/DxeLoadFunc.c index 079ae924da..e53f708fd4 100644 --- a/EdkModulePkg/Core/DxeIplPeim/Ipf/DxeLoadFunc.c +++ b/EdkModulePkg/Core/DxeIplPeim/Ipf/DxeLoadFunc.c @@ -21,91 +21,44 @@ Abstract: #include "DxeIpl.h"
-EFI_STATUS
-CreateArchSpecificHobs (
- OUT EFI_PHYSICAL_ADDRESS *BspStore
+VOID
+HandOffToDxeCore (
+ IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,
+ IN EFI_PEI_HOB_POINTERS HobList
)
-/*++
-
-Routine Description:
-
- Creates architecture-specific HOBs.
-
- Note: New parameters should NOT be added for any HOBs that are added to this
- function. BspStore is a special case because it is required for the
- call to SwitchStacks() in DxeLoad().
-
-Arguments:
-
- BspStore - The address of the BSP Store for those architectures that need
- it. Otherwise 0.
-
-Returns:
-
- EFI_SUCCESS - The HOBs were created successfully.
-
---*/
{
- EFI_STATUS Status;
+ VOID *BaseOfStack;
+ VOID *TopOfStack;
+ VOID *BspStore;
- Status = EFI_SUCCESS;
-
- ASSERT (NULL != BspStore);
+ //
+ // Allocate 128KB for the Stack
+ //
+ BaseOfStack = AllocatePages (EFI_SIZE_TO_PAGES (STACK_SIZE));
+ ASSERT (BaseOfStack != NULL);
//
// Allocate 16KB for the BspStore
//
- Status = PeiServicesAllocatePages (EfiBootServicesData, EFI_SIZE_TO_PAGES (BSP_STORE_SIZE), BspStore);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- BuildBspStoreHob (
- *BspStore,
- BSP_STORE_SIZE,
- EfiBootServicesData
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Transfers control to a function starting with a new stack.
-
- Transfers control to the function specified by EntryPoint using the new stack
- specified by NewStack and passing in the parameters specified by Context1 and
- Context2. Context1 and Context2 are optional and may be NULL. The function
- EntryPoint must never return.
-
- If EntryPoint is NULL, then ASSERT().
- If NewStack is NULL, then ASSERT().
+ BspStore = AllocatePages (EFI_SIZE_TO_PAGES (BSP_STORE_SIZE));
+ ASSERT (BspStore != NULL);
+ //
+ // Build BspStoreHob
+ //
+ BuildBspStoreHob ((EFI_PHYSICAL_ADDRESS) (UINTN) BspStore, BSP_STORE_SIZE, EfiBootServicesData);
- @param EntryPoint A pointer to function to call with the new stack.
- @param Context1 A pointer to the context to pass into the EntryPoint
- function.
- @param Context2 A pointer to the context to pass into the EntryPoint
- function.
- @param NewStack A pointer to the new stack to use for the EntryPoint
- function.
- @param NewBsp A pointer to the new BSP for the EntryPoint on IPF. It's
- Reserved on other architectures.
+ //
+ // Compute the top of the stack we were allocated. Pre-allocate a UINTN
+ // for safety.
+ //
+ TopOfStack = (VOID *) ((UINTN) BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - CPU_STACK_ALIGNMENT);
+ TopOfStack = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);
-**/
-VOID
-EFIAPI
-SwitchIplStacks (
- IN SWITCH_STACK_ENTRY_POINT EntryPoint,
- IN VOID *Context1, OPTIONAL
- IN VOID *Context2, OPTIONAL
- IN VOID *NewStack,
- IN VOID *NewBsp
- )
-{
AsmSwitchStackAndBackingStore (
- EntryPoint,
- Context1,
- Context2,
- NewStack,
- NewBsp
+ (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint,
+ HobList.Raw,
+ NULL,
+ TopOfStack,
+ BspStore
);
}
diff --git a/EdkModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c b/EdkModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c new file mode 100644 index 0000000000..02de14987f --- /dev/null +++ b/EdkModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c @@ -0,0 +1,52 @@ +/*++
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. 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.
+
+Module Name:
+
+ DxeLoadFunc.c
+
+Abstract:
+
+ Ia32-specifc functionality for DxeLoad.
+
+--*/
+
+#include "DxeIpl.h"
+
+VOID
+HandOffToDxeCore (
+ IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,
+ IN EFI_PEI_HOB_POINTERS HobList
+ )
+{
+ VOID *BaseOfStack;
+ VOID *TopOfStack;
+
+ //
+ // Allocate 128KB for the Stack
+ //
+ BaseOfStack = AllocatePages (EFI_SIZE_TO_PAGES (STACK_SIZE));
+ ASSERT (BaseOfStack != NULL);
+
+ //
+ // Compute the top of the stack we were allocated. Pre-allocate a UINTN
+ // for safety.
+ //
+ TopOfStack = (VOID *) ((UINTN) BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - CPU_STACK_ALIGNMENT);
+ TopOfStack = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);
+
+ SwitchStack (
+ (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint,
+ HobList.Raw,
+ NULL,
+ TopOfStack
+ );
+}
diff --git a/EdkModulePkg/EdkModulePkg.fpd b/EdkModulePkg/EdkModulePkg.fpd index 47b9a7fd35..c953fc360e 100644 --- a/EdkModulePkg/EdkModulePkg.fpd +++ b/EdkModulePkg/EdkModulePkg.fpd @@ -1018,6 +1018,14 @@ <MaxDatumSize>1</MaxDatumSize>
<Value>TRUE</Value>
</PcdData>
+ <PcdData ItemType="FEATURE_FLAG">
+ <C_Name>PcdDxeIplBuildShareCodeHobs</C_Name>
+ <Token>0x0001003c</Token>
+ <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
+ <DatumType>BOOLEAN</DatumType>
+ <MaxDatumSize>1</MaxDatumSize>
+ <Value>TRUE</Value>
+ </PcdData>
</PcdBuildDefinition>
<ModuleSaBuildOptions>
<FvBinding>NULL</FvBinding>
@@ -6684,6 +6692,14 @@ <MaxDatumSize>1</MaxDatumSize>
<Value>TRUE</Value>
</PcdData>
+ <PcdData ItemType="FEATURE_FLAG">
+ <C_Name>PcdDxeIplBuildShareCodeHobs</C_Name>
+ <Token>0x0001003c</Token>
+ <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
+ <DatumType>BOOLEAN</DatumType>
+ <MaxDatumSize>1</MaxDatumSize>
+ <Value>TRUE</Value>
+ </PcdData>
</PcdBuildDefinition>
<ModuleSaBuildOptions>
<FvBinding>NULL</FvBinding>
@@ -11131,6 +11147,14 @@ <MaxDatumSize>1</MaxDatumSize>
<Value>TRUE</Value>
</PcdData>
+ <PcdData ItemType="FEATURE_FLAG">
+ <C_Name>PcdDxeIplBuildShareCodeHobs</C_Name>
+ <Token>0x0001003c</Token>
+ <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
+ <DatumType>BOOLEAN</DatumType>
+ <MaxDatumSize>1</MaxDatumSize>
+ <Value>TRUE</Value>
+ </PcdData>
</PcdBuildDefinition>
<ModuleSaBuildOptions>
<FvBinding>NULL</FvBinding>
@@ -15582,6 +15606,14 @@ <MaxDatumSize>1</MaxDatumSize>
<Value>TRUE</Value>
</PcdData>
+ <PcdData ItemType="FEATURE_FLAG">
+ <C_Name>PcdDxeIplBuildShareCodeHobs</C_Name>
+ <Token>0x0001003c</Token>
+ <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
+ <DatumType>BOOLEAN</DatumType>
+ <MaxDatumSize>1</MaxDatumSize>
+ <Value>TRUE</Value>
+ </PcdData>
</PcdBuildDefinition>
<ModuleSaBuildOptions>
<FvBinding>NULL</FvBinding>
diff --git a/EdkModulePkg/EdkModulePkg.spd b/EdkModulePkg/EdkModulePkg.spd index 9e083f93b1..0472f2d66f 100644 --- a/EdkModulePkg/EdkModulePkg.spd +++ b/EdkModulePkg/EdkModulePkg.spd @@ -1247,14 +1247,23 @@ <DefaultValue>FALSE</DefaultValue>
<HelpText>Whether VGA decoding is enabled on this platform so we should avoid those aliased resources</HelpText>
</PcdEntry>
- <PcdEntry>
+ <PcdEntry SupArchList="IA32">
<C_Name>PcdDxeIplSwitchToLongMode</C_Name>
<Token>0x0001003b</Token>
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>BOOLEAN</DatumType>
<ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>FALSE</DefaultValue>
+ <DefaultValue>TRUE</DefaultValue>
<HelpText>If this feature is enabled, then the DXE IPL will load a 64-bit DxeCore.</HelpText>
</PcdEntry>
+ <PcdEntry>
+ <C_Name>PcdDxeIplBuildShareCodeHobs</C_Name>
+ <Token>0x0001003c</Token>
+ <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
+ <DatumType>BOOLEAN</DatumType>
+ <ValidUsage>FEATURE_FLAG</ValidUsage>
+ <DefaultValue>FALSE</DefaultValue>
+ <HelpText>If this feature is enabled, DXE IPL will build a series of HOBs to share code with DXE Core.</HelpText>
+ </PcdEntry>
</PcdDeclarations>
</PackageSurfaceArea>
\ No newline at end of file |