Hi Ard,

OK, I will make adjustments according to your suggestions and submit the V5 today.


Thanks,
Chao
On 2024/4/29 14:56, Ard Biesheuvel wrote:
On Mon, 29 Apr 2024 at 03:17, Chao Li <lichao@loongson.cn> wrote:
Hi Ard and Gerd and other maintainers,

Could you review this version and give your suggestions?

This looks ok to me now, modulo a few minor tweaks (see below) that I
will apply when merging.

I also changed the type signatures to

extern
VOID
(EFIAPI *InternalQemuFwCfgReadBytes) (
  IN UINTN  Size,
  IN VOID   *Buffer  OPTIONAL
  );

Note that the EFIAPI applies to the function itself, not the pointer
so it needs to be inside the ()



--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioPei.c
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioPei.c
@@ -104,7 +104,6 @@ QemuFwCfgInitialize (
   UINT64                FwCfgDmaAddress;
   UINT64                FwCfgDmaSize;
   QEMU_FW_CFG_RESOURCE  *FwCfgResource;
-  VOID                  *Buffer;

   //
   // Check whether the Qemu firmware configure resources HOB has been created,
@@ -125,11 +124,8 @@ QemuFwCfgInitialize (
   //
   // Create resouce memory
   //
-  Buffer = AllocatePages(EFI_SIZE_TO_PAGES (sizeof (QEMU_FW_CFG_RESOURCE)));
-  ASSERT (Buffer != NULL);
-  ZeroMem (Buffer, sizeof (QEMU_FW_CFG_RESOURCE));
-
-  FwCfgResource = (QEMU_FW_CFG_RESOURCE *)Buffer;
+  FwCfgResource = AllocateZeroPool (sizeof (QEMU_FW_CFG_RESOURCE));
+  ASSERT (FwCfgResource != NULL);

   for (Prev = 0; ; Prev = Node) {
     Node = fdt_next_node (DeviceTreeBase, Prev, NULL);
@@ -141,7 +137,7 @@ QemuFwCfgInitialize (
     // Check for memory node
     //
     Type = fdt_getprop (DeviceTreeBase, Node, "compatible", &Len);
-    if ((Type) &&
+    if ((Type != NULL) &&
         (AsciiStrnCmp (Type, "qemu,fw-cfg-mmio", Len) == 0))
     {
       //




_._,_._,_

Groups.io Links:

You receive all messages sent to this group.

View/Reply Online (#118377) | | Mute This Topic | New Topic
Your Subscription | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_