]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/Core/Dxe: log memory base and length, after lib ctors again
authorLaszlo Ersek <lersek@redhat.com>
Tue, 3 Nov 2020 16:15:57 +0000 (17:15 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 6 Nov 2020 20:37:22 +0000 (20:37 +0000)
CoreInitializeMemoryServices() logs "BaseAddress" and "Length" with
DEBUG() before DxeMain() calls ProcessLibraryConstructorList()
explicitly. (Library construction is not an automatic part of the DXE
Core entry point.)

So those DEBUG()s in CoreInitializeMemoryServices() are issued against
an un-constructed DebugLib, and also against a -- possibly underlying --
un-constructed SerialPortLib.

Some DebugLib instances can deal with this (see for example commit
91a5b1365075, "OvmfPkg/PlatformDebugLibIoPort: fix port detection for
use in the DXE Core", 2018-08-06), while some others can't (see for
example the DebugLib instance
"MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf"
coupled with the SerialPortLib instance
"ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.inf").

Addressing this issue in a SerialPortLib instance that underlies
BaseDebugLibSerialPort seems wrong; either the DebugLib instance should
cope directly with being called un-constructed (see again commit
91a5b1365075), or the DXE Core should log relevant information *at
least* after library instances have been constructed. This patch
implements the latter (only for the "BaseAddress" and "Length" values
calculated by CoreInitializeMemoryServices()).

Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jeff Brasen <jbrasen@nvidia.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20201103161557.30621-1-lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c

index 5ee4cd10b4365567d8d02e0c81040a51f176adba..db21311f93529ea6ebbdb2756cdafd213525dec6 100644 (file)
@@ -298,6 +298,14 @@ DxeMain (
   PERF_CROSSMODULE_END   ("PEI");\r
   PERF_CROSSMODULE_BEGIN ("DXE");\r
 \r
+  //\r
+  // Log MemoryBaseAddress and MemoryLength again (from\r
+  // CoreInitializeMemoryServices()), now that library constructors have\r
+  // executed.\r
+  //\r
+  DEBUG ((DEBUG_INFO, "%a: MemoryBaseAddress=0x%Lx MemoryLength=0x%Lx\n",\r
+    __FUNCTION__, MemoryBaseAddress, MemoryLength));\r
+\r
   //\r
   // Report DXE Core image information to the PE/COFF Extra Action Library\r
   //\r