I noticed the EmbeddedPkg has PCDs to set the gEfiMemoryTypeInformationGuid HOB 
(EFI_MEMORY_TYPE_INFORMATION array) default values. Given this is something 
that needs to get tuned per platform it seems like we should have PCD values. I 
noticed some ARM platforms use PCD values, but a lot of platforms just have a 
global. 

Seems like the MdeModulePkg should have these PCDs, and it could also contain a 
library to produce the HOB based on the PCDs

For those not familiar with the gEfiMemoryTypeInformationGuid HOB it has 2 
functions:
1) Keep the runtime memory allocations constant across S4 reboots. You do this 
by having PcdMemoryTypeEfiACPIReclaimMemory, PcdMemoryTypeEfiACPIMemoryNVS, 
PcdMemoryTypeEfiReservedMemoryType, PcdMemoryTypeEfiRuntimeServicesData, and  
PcdMemoryTypeEfiRuntimeServicesCode first in the list and make sure you 
allocate a few more pages than needed for each type.
2) Defragment the EFI memory map. The boot service memory types all get freed 
back to the OS, but having the “buckets” for them reduces the number of EFI 
memory map entires. 

~/work/src/edk2(master)>git grep PcdMemoryTypeEfiACPIReclaimMemory -- *.dec
EmbeddedPkg/EmbeddedPkg.dec:107:  
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0|UINT32|0x00000012

https://svn.code.sf.net/p/edk2/code/trunk/edk2/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c
VOID
BuildMemoryTypeInformationHob (
  VOID
  )
{
  EFI_MEMORY_TYPE_INFORMATION   Info[10];

  Info[0].Type          = EfiACPIReclaimMemory;
  Info[0].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiACPIReclaimMemory);
  Info[1].Type          = EfiACPIMemoryNVS;
  Info[1].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiACPIMemoryNVS);
  Info[2].Type          = EfiReservedMemoryType;
  Info[2].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiReservedMemoryType);
  Info[3].Type          = EfiRuntimeServicesData;
  Info[3].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiRuntimeServicesData);
  Info[4].Type          = EfiRuntimeServicesCode;
  Info[4].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiRuntimeServicesCode);
  Info[5].Type          = EfiBootServicesCode;
  Info[5].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiBootServicesCode);
  Info[6].Type          = EfiBootServicesData;
  Info[6].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiBootServicesData);
  Info[7].Type          = EfiLoaderCode;
  Info[7].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiLoaderCode);
  Info[8].Type          = EfiLoaderData;
  Info[8].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiLoaderData);

  // Terminator for the list
  Info[9].Type          = EfiMaxMemoryType;
  Info[9].NumberOfPages = 0;

  BuildGuidDataHob (&gEfiMemoryTypeInformationGuid, &Info, sizeof (Info));
}

vs.

https://svn.code.sf.net/p/edk2/code/trunk/edk2/Vlv2TbltDevicePkg/PlatformInitPei/MemoryPeim.c
EFI_MEMORY_TYPE_INFORMATION mDefaultMemoryTypeInformation[] = {
  { EfiACPIReclaimMemory,       0x40  },    // 0x40 pages = 256k for ASL
  { EfiACPIMemoryNVS,           0x100 },    // 0x100 pages = 1 MB for S3, SMM, 
HII, etc
  { EfiReservedMemoryType,      0x600 },    // 48k for BIOS Reserved
  { EfiMemoryMappedIO,          0     },
  { EfiMemoryMappedIOPortSpace, 0     },
  { EfiPalCode,                 0     },
  { EfiRuntimeServicesCode,     0x200 },
  { EfiRuntimeServicesData,     0x100 },
  { EfiLoaderCode,              0x100 },
  { EfiLoaderData,              0x100 },
  { EfiBootServicesCode,        0x800 },
  { EfiBootServicesData,        0x2500},
  { EfiConventionalMemory,      0     },
  { EfiUnusableMemory,          0     },
  { EfiMaxMemoryType,           0     }
};


Thanks,

Andrew Fish
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to