From 88d942e2d3616e5b8147234f46fcd92aa19a5ca4 Mon Sep 17 00:00:00 2001 From: Mikhail Krichanov Date: Thu, 26 Sep 2024 14:05:05 +0300 Subject: [PATCH] Ring3: Fixed Uart bug. --- ArmVirtPkg/Library/DebugLibFdtPL011Uart/User.c | 3 +-- MdeModulePkg/Core/Dxe/SysCall/Initialization.c | 12 ++++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ArmVirtPkg/Library/DebugLibFdtPL011Uart/User.c b/ArmVirtPkg/Library/DebugLibFdtPL011Uart/User.c index 2229cffde0..6e012ee85b 100644 --- a/ArmVirtPkg/Library/DebugLibFdtPL011Uart/User.c +++ b/ArmVirtPkg/Library/DebugLibFdtPL011Uart/User.c @@ -29,11 +29,10 @@ DebugLibFdtPL011UartUserConstructor ( for (Index = 0; Index < SystemTable->NumberOfTableEntries; ++Index) { if (CompareGuid (&gEarlyPL011BaseAddressGuid, &(SystemTable->ConfigurationTable[Index].VendorGuid))) { mDebugLibFdtPL011UartAddress = (UINTN)SystemTable->ConfigurationTable[Index].VendorTable; - return EFI_SUCCESS; } } - return EFI_NOT_FOUND; + return EFI_SUCCESS; } /** diff --git a/MdeModulePkg/Core/Dxe/SysCall/Initialization.c b/MdeModulePkg/Core/Dxe/SysCall/Initialization.c index 2a2995a704..5ac1a7530b 100644 --- a/MdeModulePkg/Core/Dxe/SysCall/Initialization.c +++ b/MdeModulePkg/Core/Dxe/SysCall/Initialization.c @@ -39,6 +39,7 @@ InitializeRing3 ( UINTN Index; EFI_CONFIGURATION_TABLE *Conf; EARLY_PL011_BASE_ADDRESS *UartBase; + CONST VOID *Hob; // // Set Ring3 EntryPoint and BootServices. @@ -77,19 +78,18 @@ InitializeRing3 ( Conf->VendorTable = gRing3Data->SystemTable.ConfigurationTable[Index].VendorTable; - if (CompareGuid (&gEfiHobListGuid, &(Conf->VendorGuid))) { - UartBase = GET_GUID_HOB_DATA (Conf->VendorTable); - gUartBaseAddress = (UINTN)UartBase->DebugAddress; - } - ++Conf; } + Hob = GetFirstGuidHob (&gEarlyPL011BaseAddressGuid); + UartBase = GET_GUID_HOB_DATA (Hob); + gUartBaseAddress = (UINTN)UartBase->DebugAddress; + CopyGuid (&(Conf->VendorGuid), &gEarlyPL011BaseAddressGuid); Conf->VendorTable = (VOID *)gUartBaseAddress; ++gRing3Data->SystemTable.NumberOfTableEntries; - DEBUG ((DEBUG_ERROR, "Core: gUartBaseAddress = %p\n", gUartBaseAddress)); + DEBUG ((DEBUG_ERROR, "Core: gUartBaseAddress = 0x%p\n", gUartBaseAddress)); gRing3Data->SystemTable.ConfigurationTable = (EFI_CONFIGURATION_TABLE *)(UINTN)Physical; }