OvmfPkg/PlatformPei: Move global variables to PlatformInfoHob
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3863 The intention of PlatformInitLib is to extract the common function used in OvmfPkg/PlatformPei. This lib will be used not only in PEI phase but also in SEC phase. SEC phase cannot use global variables between different functions. So PlatformInfoHob is created to hold the informations shared between functions. For example, HostBridgeDevId corespond to mHostBridgeDevId in PlatformPei. In this patch we will first move below global variables to PlatformInfoHob. - mBootMode - mS3Supported - mPhysMemAddressWidth - mMaxCpuCount - mHostBridgeDevId - mQ35SmramAtDefaultSmbase - mQemuUc32Base - mS3AcpiReservedMemorySize - mS3AcpiReservedMemoryBase PlatformInfoHob also holds other information, for example, PciIoBase / PciIoSize. This is because in SEC phase, PcdSetxxx doesn't work. So we will restruct the functions which set PCDs into two, one for PlatformInfoLib, one for PlatformPei. So in this patch we first move global variables and PCDs to PlatformInfoHob. All the changes are in OvmfPkg/PlatformPei. Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Brijesh Singh <brijesh.singh@amd.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Sebastien Boeuf <sebastien.boeuf@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Min Xu <min.m.xu@intel.com>
This commit is contained in:
@@ -10,10 +10,13 @@
|
||||
#define _PLATFORM_PEI_H_INCLUDED_
|
||||
|
||||
#include <IndustryStandard/E820.h>
|
||||
#include <Library/PlatformInitLib.h>
|
||||
|
||||
extern EFI_HOB_PLATFORM_INFO mPlatformInfoHob;
|
||||
|
||||
VOID
|
||||
AddressWidthInitialization (
|
||||
VOID
|
||||
IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
|
||||
);
|
||||
|
||||
VOID
|
||||
@@ -33,17 +36,37 @@ PublishPeiMemory (
|
||||
|
||||
UINT32
|
||||
GetSystemMemorySizeBelow4gb (
|
||||
VOID
|
||||
IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob
|
||||
);
|
||||
|
||||
VOID
|
||||
QemuUc32BaseInitialization (
|
||||
VOID
|
||||
IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
|
||||
);
|
||||
|
||||
VOID
|
||||
InitializeRamRegions (
|
||||
VOID
|
||||
IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob
|
||||
);
|
||||
|
||||
VOID
|
||||
MemMapInitialization (
|
||||
IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
|
||||
);
|
||||
|
||||
VOID
|
||||
MiscInitialization (
|
||||
IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob
|
||||
);
|
||||
|
||||
VOID
|
||||
BootModeInitialization (
|
||||
IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
|
||||
);
|
||||
|
||||
VOID
|
||||
MaxCpuCountInitialization (
|
||||
IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
@@ -71,23 +94,9 @@ AmdSevInitialize (
|
||||
VOID
|
||||
);
|
||||
|
||||
extern EFI_BOOT_MODE mBootMode;
|
||||
|
||||
VOID
|
||||
SevInitializeRam (
|
||||
VOID
|
||||
);
|
||||
|
||||
extern BOOLEAN mS3Supported;
|
||||
|
||||
extern UINT8 mPhysMemAddressWidth;
|
||||
|
||||
extern UINT32 mMaxCpuCount;
|
||||
|
||||
extern UINT16 mHostBridgeDevId;
|
||||
|
||||
extern BOOLEAN mQ35SmramAtDefaultSmbase;
|
||||
|
||||
extern UINT32 mQemuUc32Base;
|
||||
|
||||
#endif // _PLATFORM_PEI_H_INCLUDED_
|
||||
|
Reference in New Issue
Block a user