mirror of https://github.com/acidanthera/audk.git
Add new PCD gEfiMdeModulePkgTokenSpaceGuid.PcdMaxEfiSystemTablePointerAddress for the MdeModulePkg that allows the platform DSC file to specify the address below which the EFI_SYSTEM_TABLE_POINTER structure is allocated.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11018 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
aeeb84bab4
commit
6eea8eaeef
|
@ -147,4 +147,6 @@
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdLoadFixAddressBootTimeCodePageNumber ## SOMETIMES_CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdLoadFixAddressBootTimeCodePageNumber ## SOMETIMES_CONSUMES
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdLoadFixAddressRuntimeCodePageNumber ## SOMETIMES_CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdLoadFixAddressRuntimeCodePageNumber ## SOMETIMES_CONSUMES
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdLoadModuleAtFixAddressEnable ## CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdLoadModuleAtFixAddressEnable ## CONSUMES
|
||||||
|
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxEfiSystemTablePointerAddress ## CONSUMES
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
Support functions for managing debug image info table when loading and unloading
|
Support functions for managing debug image info table when loading and unloading
|
||||||
images.
|
images.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -24,9 +24,7 @@ EFI_DEBUG_IMAGE_INFO_TABLE_HEADER mDebugInfoTableHeader = {
|
||||||
|
|
||||||
UINTN mMaxTableEntries = 0;
|
UINTN mMaxTableEntries = 0;
|
||||||
|
|
||||||
EFI_SYSTEM_TABLE_POINTER *mDebugTable = NULL;
|
EFI_SYSTEM_TABLE_POINTER *mDebugTable = NULL;
|
||||||
|
|
||||||
#define FOUR_MEG_ALIGNMENT 0x400000
|
|
||||||
|
|
||||||
#define EFI_DEBUG_TABLE_ENTRY_SIZE (sizeof (VOID *))
|
#define EFI_DEBUG_TABLE_ENTRY_SIZE (sizeof (VOID *))
|
||||||
|
|
||||||
|
@ -40,18 +38,98 @@ CoreInitializeDebugImageInfoTable (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
UINTN Pages;
|
||||||
|
EFI_PHYSICAL_ADDRESS Memory;
|
||||||
|
UINTN AlignedMemory;
|
||||||
|
UINTN AlignmentMask;
|
||||||
|
UINTN UnalignedPages;
|
||||||
|
UINTN RealPages;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allocate 4M aligned page for the structure and fill in the data.
|
// Allocate 4M aligned page for the structure and fill in the data.
|
||||||
// Ideally we would update the CRC now as well, but the service may not yet be available.
|
// Ideally we would update the CRC now as well, but the service may not yet be available.
|
||||||
// See comments in the CoreUpdateDebugTableCrc32() function below for details.
|
// See comments in the CoreUpdateDebugTableCrc32() function below for details.
|
||||||
//
|
//
|
||||||
mDebugTable = AllocateAlignedPages (EFI_SIZE_TO_PAGES (sizeof (EFI_SYSTEM_TABLE_POINTER)), FOUR_MEG_ALIGNMENT);
|
Pages = EFI_SIZE_TO_PAGES (sizeof (EFI_SYSTEM_TABLE_POINTER));
|
||||||
|
AlignmentMask = SIZE_4MB - 1;
|
||||||
|
RealPages = Pages + EFI_SIZE_TO_PAGES (SIZE_4MB);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Attempt to allocate memory below PcdMaxEfiSystemTablePointerAddress
|
||||||
|
// If PcdMaxEfiSystemTablePointerAddress is 0, then allocate memory below
|
||||||
|
// MAX_ADDRESS
|
||||||
|
//
|
||||||
|
Memory = PcdGet64 (PcdMaxEfiSystemTablePointerAddress);
|
||||||
|
if (Memory == 0) {
|
||||||
|
Memory = MAX_ADDRESS;
|
||||||
|
}
|
||||||
|
Status = CoreAllocatePages (
|
||||||
|
AllocateMaxAddress,
|
||||||
|
EfiBootServicesData,
|
||||||
|
RealPages,
|
||||||
|
&Memory
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
if (PcdGet64 (PcdMaxEfiSystemTablePointerAddress) != 0) {
|
||||||
|
DEBUG ((EFI_D_INFO, "Allocate memory for EFI_SYSTEM_TABLE_POINTER below PcdMaxEfiSystemTablePointerAddress failed. \
|
||||||
|
Retry to allocate memroy as close to the top of memory as feasible.\n"));
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// If the initial memory allocation fails, then reattempt allocation
|
||||||
|
// as close to the top of memory as feasible.
|
||||||
|
//
|
||||||
|
Status = CoreAllocatePages (
|
||||||
|
AllocateAnyPages,
|
||||||
|
EfiBootServicesData,
|
||||||
|
RealPages,
|
||||||
|
&Memory
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Free overallocated pages
|
||||||
|
//
|
||||||
|
AlignedMemory = ((UINTN) Memory + AlignmentMask) & ~AlignmentMask;
|
||||||
|
UnalignedPages = EFI_SIZE_TO_PAGES (AlignedMemory - (UINTN)Memory);
|
||||||
|
if (UnalignedPages > 0) {
|
||||||
|
//
|
||||||
|
// Free first unaligned page(s).
|
||||||
|
//
|
||||||
|
Status = CoreFreePages (Memory, UnalignedPages);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
}
|
||||||
|
Memory = (EFI_PHYSICAL_ADDRESS)(AlignedMemory + EFI_PAGES_TO_SIZE (Pages));
|
||||||
|
UnalignedPages = RealPages - Pages - UnalignedPages;
|
||||||
|
if (UnalignedPages > 0) {
|
||||||
|
//
|
||||||
|
// Free last unaligned page(s).
|
||||||
|
//
|
||||||
|
Status = CoreFreePages (Memory, UnalignedPages);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Set mDebugTable to the 4MB aligned allocated pages
|
||||||
|
//
|
||||||
|
mDebugTable = (EFI_SYSTEM_TABLE_POINTER *)(AlignedMemory);
|
||||||
ASSERT (mDebugTable != NULL);
|
ASSERT (mDebugTable != NULL);
|
||||||
mDebugTable->Signature = EFI_SYSTEM_TABLE_SIGNATURE;
|
|
||||||
|
//
|
||||||
|
// Initialize EFI_SYSTEM_TABLE_POINTER structure
|
||||||
|
//
|
||||||
|
mDebugTable->Signature = EFI_SYSTEM_TABLE_SIGNATURE;
|
||||||
mDebugTable->EfiSystemTableBase = (EFI_PHYSICAL_ADDRESS) (UINTN) gDxeCoreST;
|
mDebugTable->EfiSystemTableBase = (EFI_PHYSICAL_ADDRESS) (UINTN) gDxeCoreST;
|
||||||
mDebugTable->Crc32 = 0;
|
mDebugTable->Crc32 = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Install the EFI_SYSTEM_TABLE_POINTER structure in the EFI System
|
||||||
|
// Configuration Table
|
||||||
|
//
|
||||||
Status = CoreInstallConfigurationTable (&gEfiDebugImageInfoTableGuid, &mDebugInfoTableHeader);
|
Status = CoreInstallConfigurationTable (&gEfiDebugImageInfoTableGuid, &mDebugInfoTableHeader);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,7 @@
|
||||||
## @libraryclass Debug Agent is used to provide soft debug capability.
|
## @libraryclass Debug Agent is used to provide soft debug capability.
|
||||||
#
|
#
|
||||||
DebugAgentLib|Include/Library/DebugAgentLib.h
|
DebugAgentLib|Include/Library/DebugAgentLib.h
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
## MdeModule package token space guid
|
## MdeModule package token space guid
|
||||||
# Include/Guid/MdeModulePkgTokenSpace.h
|
# Include/Guid/MdeModulePkgTokenSpace.h
|
||||||
|
@ -369,6 +370,17 @@
|
||||||
## RTC Update Timeout Value
|
## RTC Update Timeout Value
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdRealTimeClockUpdateTimeout|100000|UINT32|0x00010034
|
gEfiMdeModulePkgTokenSpaceGuid.PcdRealTimeClockUpdateTimeout|100000|UINT32|0x00010034
|
||||||
|
|
||||||
|
## Maximum address that the DXE Core will allocate the EFI_SYSTEM_TABLE_POINTER
|
||||||
|
# structure. The default value for this PCD is 0, which means that the DXE Core
|
||||||
|
# will allocate the buffer from the EFI_SYSTEM_TABLE_POINTER structure on a 4MB
|
||||||
|
# boundary as close to the top of memory as feasible. If this PCD is set to a
|
||||||
|
# value other than 0, then the DXE Core will first attempt to allocate the
|
||||||
|
# EFI_SYSTEM_TABLE_POINTER structure on a 4MB boundary below the address specified
|
||||||
|
# by this PCD, and if that allocation fails, retry the allocation on a 4MB
|
||||||
|
# boundary as close to the top of memory as feasible.
|
||||||
|
#
|
||||||
|
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxEfiSystemTablePointerAddress|0x0|UINT64|0x30001027
|
||||||
|
|
||||||
[PcdsPatchableInModule,PcdsDynamic]
|
[PcdsPatchableInModule,PcdsDynamic]
|
||||||
## This PCD defines the Console output column and the default value is 25 according to UEFI spec
|
## This PCD defines the Console output column and the default value is 25 according to UEFI spec
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|25|UINT32|0x40000006
|
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|25|UINT32|0x40000006
|
||||||
|
|
Loading…
Reference in New Issue