зеркало из https://github.com/microsoft/mu_plus.git
[CHERRY_PICK] AdvLoggerPkg: Use BootServicesData for PreMem Alloc
This is a very small portion cherry-picked from
be9a3d273f
. This fixes a breakage
for ARM64 platforms that initialize AdvLogger in PeiCore, which
has a hardcoded assumption that memory is not available at its
start (not true for ARM64 platforms) and so allocating a minimum
of 16 pages for the runtime granularity will fail. This "pre-mem"
buffer gets freed as soon as permanent memory is installed, so we
can allocate it as EfiBootServicesData (which does not use the
runtime allocation granularity of 64k). This also works on x86.
If PcdAdvancedLoggerPeiInRAM is true, we can allocate the full
amount and need the correct runtime type (I do not think this
feature works, for the reason listed above, but that is outside
the scope of this commit).
This commit is contained in:
Родитель
dd13250a79
Коммит
260349120b
|
@ -450,6 +450,7 @@ AdvancedLoggerGetLoggerInfo (
|
|||
UINTN Pages;
|
||||
CONST EFI_PEI_SERVICES **PeiServices;
|
||||
EFI_STATUS Status;
|
||||
EFI_MEMORY_TYPE Type;
|
||||
|
||||
// Try to do the minimum work at the start of this function as this
|
||||
// is called quite often.
|
||||
|
@ -513,14 +514,17 @@ AdvancedLoggerGetLoggerInfo (
|
|||
|
||||
if (FeaturePcdGet (PcdAdvancedLoggerPeiInRAM)) {
|
||||
Pages = FixedPcdGet32 (PcdAdvancedLoggerPages);
|
||||
Type = EfiRuntimeServicesData;
|
||||
} else {
|
||||
Pages = FixedPcdGet32 (PcdAdvancedLoggerPreMemPages);
|
||||
// This is to avoid the interim buffer being allocated to consume 64KB on ARM64 platforms.
|
||||
Type = EfiBootServicesData;
|
||||
}
|
||||
|
||||
BufferSize = EFI_PAGES_TO_SIZE (Pages);
|
||||
|
||||
Status = PeiServicesAllocatePages (
|
||||
EfiReservedMemoryType,
|
||||
Type,
|
||||
Pages,
|
||||
&NewLoggerInfo
|
||||
);
|
||||
|
|
Загрузка…
Ссылка в новой задаче