audk/ArmVirtPkg
Laszlo Ersek 5087a07736 ArmVirtPkg/FdtPL011SerialPortLib: initialize implicitly
FdtPL011SerialPortLib claims that it's usable from the DXE_CORE. That's
not correct: the DXE_CORE calls DEBUG() and ASSERT() before it calls
ProcessLibraryConstructorList(). Via the BaseDebugLibSerialPort instance,
those DEBUG() and ASSERT() calls result in SerialPortWrite() calls, before
ProcessLibraryConstructorList() called either our constructor
FdtPL011SerialPortLibInitialize(), or BaseDebugLibSerialPortConstructor().

(And even if the DXE_CORE called the latter function early enough, it
would just invoke our SerialPortInitialize() function -- which does
nothing.)

This means that the earliest DXE_CORE debug messages are lost.

Rename FdtPL011SerialPortLibInitialize() to SerialPortInitialize(), so
that the same initialization occur through the constructor and the public
SerialPortInitialize() library API.

Turn SerialPortInitialize() calls after the first one into no-ops.

Our SerialPortLib APIs already use (mSerialBaseAddress != 0) to track
initialization. Rework those checks to actually initialize the library if
that hasn't happened yet.

The following new lines appear in the log:

> CoreInitializeMemoryServices:
>   BaseAddress - 0x48000000 Length - 0xF8000000 MinimalMemorySizeNeeded - 0x38C8000
> InstallProtocolInterface: [EfiLoadedImageProtocol] 46EFC3E0
> ProtectUefiImageCommon - 0x46EFC3E0
>   - 0x0000000046EB2000 - 0x0000000000068000

(0x46EB2000 is the load address of the DXE Core.)

Reported-by: Oliver Smith-Denny <osde@linux.microsoft.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2023-10-07 13:41:27 +00:00
..
CloudHvAcpiPlatformDxe ArmVirtPkg: Update code to be more C11 compliant by using __func__ 2023-04-10 14:19:57 +00:00
CloudHvPlatformHasAcpiDtDxe ArmVirtPkg: can't find gUefiOvmfPkgTokenSpaceGuid 2023-03-28 16:27:06 +00:00
Include ArmVirtPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
KvmtoolCfgMgrDxe ArmVirtPkg: Fix KVM Guest Firmware 2022-08-02 17:07:08 +00:00
KvmtoolPlatformDxe ArmVirtPkg: Dispatch variable service if variable emulation is enabled 2023-05-29 15:14:00 +00:00
Library ArmVirtPkg/FdtPL011SerialPortLib: initialize implicitly 2023-10-07 13:41:27 +00:00
MemoryInitPei ArmVirtPkg/ArmVirtQemu: use first 128 MiB as permanent PEI memory 2022-10-26 17:28:39 +00:00
PlatformCI ArmVirtPkg: ArmVirtQemu: Add Graphics and Input 2023-09-06 09:35:59 +00:00
PrePi ArmVirtPkg/PrePi: Allocate separate stack for Dxe phase 2023-05-29 15:14:00 +00:00
XenAcpiPlatformDxe ArmVirtPkg: Update code to be more C11 compliant by using __func__ 2023-04-10 14:19:57 +00:00
XenPlatformHasAcpiDtDxe ArmVirtPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
XenioFdtDxe ArmVirtPkg: Update code to be more C11 compliant by using __func__ 2023-04-10 14:19:57 +00:00
ArmVirt.dsc.inc MdeModulePkg: Duplicate BaseRngLibTimerLib to MdeModulePkg 2023-09-08 09:48:55 +00:00
ArmVirtCloudHv.dsc ArmVirtPkg: handle virtual EL2 timer in DT 2023-09-19 20:27:55 +00:00
ArmVirtCloudHv.fdf ArmVirtPkg: remove EbcDxe from all platforms 2022-10-24 14:30:33 +00:00
ArmVirtKvmTool.dsc ArmVirtPkg: handle virtual EL2 timer in DT 2023-09-19 20:27:55 +00:00
ArmVirtKvmTool.fdf ArmVirtPkg: Kvmtool: Add RNG support using Arm TRNG interface 2022-11-06 16:32:28 +00:00
ArmVirtPkg.ci.yaml ArmVirtPkg.ci.yaml: Add debug macro exception 2023-09-19 01:20:27 +00:00
ArmVirtPkg.dec ArmVirtPkg/PlatformHasAcpiDtDxe: Move to OvmfPkg 2023-02-16 05:53:28 +00:00
ArmVirtQemu.dsc ArmVirtPkg: handle virtual EL2 timer in DT 2023-09-19 20:27:55 +00:00
ArmVirtQemu.fdf ArmVirtPkg/ArmVirtQemu: omit PCD PEIM unless TPM support is enabled 2022-10-26 17:28:39 +00:00
ArmVirtQemuFvMain.fdf.inc ArmVirt: add VirtioSerialDxe to ArmVirtQemu builds 2023-06-01 12:48:45 +00:00
ArmVirtQemuKernel.dsc ArmVirtPkg: handle virtual EL2 timer in DT 2023-09-19 20:27:55 +00:00
ArmVirtQemuKernel.fdf ArmVirtPkg: add FDF rule for self-relocating PrePi 2020-06-12 22:17:46 +00:00
ArmVirtRules.fdf.inc ArmVirtPkg: add FDF rule for self-relocating PrePi 2020-06-12 22:17:46 +00:00
ArmVirtXen.dsc ArmVirtPkg: handle virtual EL2 timer in DT 2023-09-19 20:27:55 +00:00
ArmVirtXen.fdf ArmVirtPkg: remove EbcDxe from all platforms 2022-10-24 14:30:33 +00:00
VarStore.fdf.inc ArmVirtPkg: Replace BSD License with BSD+Patent License 2019-04-09 09:10:21 -07:00