public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Pedro Falcato" <pedro.falcato@gmail.com>
To: devel@edk2.groups.io
Cc: Pedro Falcato <pedro.falcato@gmail.com>,
	Isaac Oram <isaac.w.oram@intel.com>,
	Theo Jehl <theojehl76@gmail.com>
Subject: [PATCH edk2-platforms 2/2] QemuOpenBoardPkg: Trivial code cleanup
Date: Thu, 12 Jan 2023 23:13:59 +0000	[thread overview]
Message-ID: <20230112231359.452800-3-pedro.falcato@gmail.com> (raw)
In-Reply-To: <20230112231359.452800-1-pedro.falcato@gmail.com>

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


  parent reply	other threads:[~2023-01-12 23:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-12 23:13 [PATCH edk2-platforms 0/2] QemuOpenBoardPkg: PCI rework and small fixes Pedro Falcato
2023-01-12 23:13 ` [PATCH edk2-platforms 1/2] QemuOpenBoardPkg: Redo PCI bus initialization Pedro Falcato
2023-01-13  1:46   ` Isaac Oram
2023-01-13  6:33   ` Gerd Hoffmann
2023-01-30 11:27     ` Pedro Falcato
2023-03-09  3:48       ` [edk2-devel] " Isaac Oram
2023-05-08 23:48         ` Pedro Falcato
2023-01-12 23:13 ` Pedro Falcato [this message]
2023-01-13  1:48   ` [PATCH edk2-platforms 2/2] QemuOpenBoardPkg: Trivial code cleanup Isaac Oram
2023-01-13 12:58   ` Théo Jehl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230112231359.452800-3-pedro.falcato@gmail.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox