Small cleanups around PlatformInitPei.
Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Theo Jehl <theojehl76@gmail.com>
---
.../QemuOpenBoardPkg/PlatformInitPei/Cpu.c | 2 +-
.../QemuOpenBoardPkg/PlatformInitPei/Memory.c | 9 ++----
.../PlatformInitPei/PlatformInit.h | 28 ++++++++++++++-----
3 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Cpu.c b/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Cpu.c
index e203b2654226..2fc62a0a3e77 100644
--- a/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Cpu.c
+++ b/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Cpu.c
@@ -20,7 +20,7 @@
/**
Probe Qemu FW CFG device for current CPU count and report to MpInitLib.
- @return EFI_SUCCESS Detection was successful.
+ @retval EFI_SUCCESS Detection was successful.
@retval EFI_UNSUPPORTED QEMU FW CFG device is not present.
*/
EFI_STATUS
diff --git a/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Memory.c b/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Memory.c
index 4f312c36016e..223cace0ca98 100644
--- a/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Memory.c
+++ b/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Memory.c
@@ -86,8 +86,8 @@ GetTopNonHoleAddr (
STATIC
VOID
ReserveMmioRegion (
- EFI_PHYSICAL_ADDRESS Start,
- UINT64 Length
+ IN EFI_PHYSICAL_ADDRESS Start,
+ IN UINT64 Length
)
{
EFI_RESOURCE_TYPE ResourceType;
@@ -121,7 +121,6 @@ InstallMemory (
)
{
EFI_STATUS Status;
- CONST EFI_PEI_SERVICES **PeiServicesTable;
EFI_E820_ENTRY64 E820Entry;
EFI_E820_ENTRY64 LargestE820Entry;
QEMU_FW_CFG_FILE FwCfgFile;
@@ -250,9 +249,7 @@ InstallMemory (
LargestE820Entry.BaseAddr + LargestE820Entry.Length - 1
));
- PeiServicesTable = GetPeiServicesTablePointer ();
-
- Status = (*PeiServices)->InstallPeiMemory (PeiServicesTable, LargestE820Entry.BaseAddr, LargestE820Entry.Length);
+ Status = (*PeiServices)->InstallPeiMemory (PeiServices, LargestE820Entry.BaseAddr, LargestE820Entry.Length);
ASSERT_EFI_ERROR (Status);
diff --git a/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/PlatformInit.h b/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/PlatformInit.h
index f4044df3dbf5..f17df707188a 100644
--- a/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/PlatformInit.h
+++ b/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/PlatformInit.h
@@ -20,19 +20,27 @@
#define PCI_MMIO_TOP_ADDRESS 0xFC000000
-EFI_STATUS
-EFIAPI
-PlatformInit (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
- );
+/**
+ Return the memory size below 4GB.
+ @return Size of memory below 4GB, in bytes.
+**/
UINT32
EFIAPI
GetMemoryBelow4Gb (
VOID
);
+/**
+ Install EFI memory by probing QEMU FW CFG devices for valid E820 entries.
+ It also reserves space for MMIO regions such as VGA, BIOS and APIC.
+
+ @param[in] PeiServices PEI Services pointer.
+
+ @retval EFI_SUCCESS Memory initialization succeded.
+ @retval EFI_UNSUPPORTED Installation failed (etc/e820 file was not found).
+ @retval EFI_NOT_FOUND QEMU FW CFG device is not present.
+**/
EFI_STATUS
EFIAPI
InstallMemory (
@@ -58,6 +66,12 @@ InitializePci (
QEMU_PLATFORM Platform
);
+/**
+ Probe Qemu FW CFG device for current CPU count and report to MpInitLib.
+
+ @retval EFI_SUCCESS Detection was successful.
+ @retval EFI_UNSUPPORTED QEMU FW CFG device is not present.
+ */
EFI_STATUS
EFIAPI
MaxCpuInit (
@@ -74,4 +88,4 @@ GetTopNonHoleAddr (
VOID
);
-#endif //QEMU_OPEN_BOARD_PKG_PLATFORM_INIT_H_
+#endif // QEMU_OPEN_BOARD_PKG_PLATFORM_INIT_H_
--
2.39.0