Fix system memory map issue.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8685 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
gikidy
2009-06-30 05:47:12 +00:00
parent 5540f4aa18
commit d569cbb0d1
4 changed files with 150 additions and 25 deletions

View File

@@ -78,14 +78,16 @@ MemoryAbove1MB.PhysicalStart <--------------------------------------------------
<------------------------------+ | |
Permament Stack (0x20 Pages = 128K) | |
<- Phit.EfiMemoryTop ----------+-----------+---------------+
DxeCore |
DxeCore
DxeIpl |
<----------------------------------------------------------+
NvFV + FtwFV |
NvFV (64K) |
MMIO
BFV |
<- Top of Free Memory reported by E820 --------------------+
FtwFV (128K) |
<----------------------------------------------------------+<---------+
DxeCore | |
DxeCore |
DxeIpl | Allocated in EfiLdr
<----------------------------------------------------------+ |
BFV MMIO |
<- Top of Free Memory reported by E820 --------------------+<---------+
ACPINVS or
ACPIReclaim or
Reserved
@@ -267,11 +269,44 @@ Returns:
PrintString(" Length = ");
PrintValue64(gHob->NvFtwFvb.FvbInfo.Entries[0].Length);
PrintString("\n");
PrintString("BfvResource = ");
PrintValue64(gHob->BfvResource.PhysicalStart);
PrintString(" Length = ");
PrintValue64(gHob->BfvResource.ResourceLength);
PrintString("\n");
PrintString("NvStorageFvResource = ");
PrintValue64(gHob->NvStorageFvResource.PhysicalStart);
PrintString(" Length = ");
PrintValue64(gHob->NvStorageFvResource.ResourceLength);
PrintString("\n");
PrintString("NvStorage = ");
PrintValue64(gHob->NvStorage.FvbInfo.Entries[0].Base);
PrintString(" Length = ");
PrintValue64(gHob->NvStorage.FvbInfo.Entries[0].Length);
PrintString("\n");
PrintString("NvFtwFvResource = ");
PrintValue64(gHob->NvFtwFvResource.PhysicalStart);
PrintString(" Length = ");
PrintValue64(gHob->NvFtwFvResource.ResourceLength);
PrintString("\n");
PrintString("NvFtwWorking = ");
PrintValue64(gHob->NvFtwWorking.FvbInfo.Entries[0].Base);
PrintString(" Length = ");
PrintValue64(gHob->NvFtwWorking.FvbInfo.Entries[0].Length);
PrintString("\n");
PrintString("NvFtwSpare = ");
PrintValue64(gHob->NvFtwSpare.FvbInfo.Entries[0].Base);
PrintString(" Length = ");
PrintValue64(gHob->NvFtwSpare.FvbInfo.Entries[0].Length);
PrintString("\n");
PrintString("Stack = ");
PrintValue64(gHob->Stack.AllocDescriptor.MemoryBaseAddress);
PrintString(" StackLength = ");
PrintValue64(gHob->Stack.AllocDescriptor.MemoryLength);
PrintString("\n");
PrintString("PageTable = ");
PrintValue64((UINTN)PageTableBase);
PrintString("\n");
PrintString("MemoryFreeUnder1MB = ");
PrintValue64(gHob->MemoryFreeUnder1MB.PhysicalStart);
PrintString(" MemoryFreeUnder1MBLength = ");

View File

@@ -190,6 +190,26 @@ HOB_TEMPLATE gHobTemplate = {
EFI_DXE_FILE_GUID,
0x0 // EFI_PHYSICAL_ADDRESS of EntryPoint;
},
{ // MemoryDxeCore
{
EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, // HobType
sizeof (EFI_HOB_RESOURCE_DESCRIPTOR), // HobLength
0 // Reserved
},
{
0 // Owner Guid
},
EFI_RESOURCE_SYSTEM_MEMORY, // ResourceType
(EFI_RESOURCE_ATTRIBUTE_PRESENT |
// EFI_RESOURCE_ATTRIBUTE_TESTED | // Do not mark as TESTED, or DxeCore will find it and use it before check Allocation
EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE),
0x0, // PhysicalStart
0 // ResourceLength
},
{ // Memory Map Hints to reduce fragmentation in the memory map
{
{
@@ -453,6 +473,23 @@ HOB_TEMPLATE gHobTemplate = {
0
}
},
{ // NV Ftw FV Resource
{
EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, // HobType
sizeof (EFI_HOB_RESOURCE_DESCRIPTOR), // HobLength
0 // Reserved
},
{
0 // Owner Guid
},
EFI_RESOURCE_FIRMWARE_DEVICE, // ResourceType
(EFI_RESOURCE_ATTRIBUTE_PRESENT |
EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
EFI_RESOURCE_ATTRIBUTE_TESTED |
EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE), // ResourceAttribute
0, // PhysicalStart (Fixed later)
NV_FTW_FVB_SIZE // ResourceLength
},
{ // FVB holding FTW spaces including Working & Spare space
{
{
@@ -703,9 +740,13 @@ PrepareHobDxeCore (
UINT64 DxeCoreLength
)
{
gHob->DxeCore.MemoryAllocationHeader.MemoryBaseAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)DxeCoreImageBase;
gHob->DxeCore.MemoryAllocationHeader.MemoryBaseAddress = DxeCoreImageBase;
gHob->DxeCore.MemoryAllocationHeader.MemoryLength = DxeCoreLength;
gHob->DxeCore.EntryPoint = (EFI_PHYSICAL_ADDRESS)(UINTN)DxeCoreEntryPoint;
gHob->MemoryDxeCore.PhysicalStart = DxeCoreImageBase;
gHob->MemoryDxeCore.ResourceLength = DxeCoreLength;
}
VOID *
@@ -878,7 +919,8 @@ PrepareHobNvStorage (
// Create the FVB holding FTW spaces
//
FtwFvbBase = (EFI_PHYSICAL_ADDRESS)((UINTN) StorageFvbBase + NV_STORAGE_FVB_SIZE);
gHob->NvFtwFvb.FvbInfo.Entries[0].Base = FtwFvbBase;
gHob->NvFtwFvResource.PhysicalStart =
gHob->NvFtwFvb.FvbInfo.Entries[0].Base = FtwFvbBase;
//
// Put FTW Working in front
//

View File

@@ -1,6 +1,6 @@
/** @file
Copyright (c) 2006 - 2007, Intel Corporation
Copyright (c) 2006 - 2009, 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
@@ -84,6 +84,7 @@ typedef struct {
EFI_HOB_RESOURCE_DESCRIPTOR MemoryAbove1MB;
EFI_HOB_RESOURCE_DESCRIPTOR MemoryAbove4GB;
EFI_HOB_MEMORY_ALLOCATION_MODULE DxeCore;
EFI_HOB_RESOURCE_DESCRIPTOR MemoryDxeCore;
MEMORY_TYPE_INFORMATION_HOB MemoryTypeInfo;
TABLE_HOB Acpi;
TABLE_HOB Acpi20;
@@ -105,7 +106,8 @@ typedef struct {
FVB_HOB NvStorageFvb;
FVB_HOB NvStorage;
EFI_HOB_RESOURCE_DESCRIPTOR NvFtwFvResource;
FVB_HOB NvFtwFvb;
FVB_HOB NvFtwWorking;
FVB_HOB NvFtwSpare;