From 0422dd0669b9e6f50c4d07e3496a2173b8eb611f Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Wed, 29 Jan 2025 12:05:09 +0100 Subject: ArmPkg/CpuDxe: Remove rudimentary vector handoff logic There is some fossilized code in the CpuDxe driver startup code that permits a vector table to be inherited from the PEI stage, but this code is essentially dead on ARM platforms, given that the VectorInfo argument passed to InitializeCpuExceptionHandlers() is ignored, and no code appears to exist that would result in the gEfiVectorHandoffTableGuid configuration table ever being populated. Also, due to prior refactoring, the code that disables and re-enables IRQs and FIQs is completely pointless, and can simply be removed. That, in turn, allows the CPU arch protocol parameter to be dropped from the prototype of InitializeExceptions(). Signed-off-by: Ard Biesheuvel --- ArmPkg/Drivers/CpuDxe/CpuDxe.c | 2 +- ArmPkg/Drivers/CpuDxe/CpuDxe.h | 2 +- ArmPkg/Drivers/CpuDxe/Exception.c | 44 +++------------------------------------ 3 files changed, 5 insertions(+), 43 deletions(-) diff --git a/ArmPkg/Drivers/CpuDxe/CpuDxe.c b/ArmPkg/Drivers/CpuDxe/CpuDxe.c index f109a8e0cf..191eb1c20b 100644 --- a/ArmPkg/Drivers/CpuDxe/CpuDxe.c +++ b/ArmPkg/Drivers/CpuDxe/CpuDxe.c @@ -317,7 +317,7 @@ CpuDxeInitialize ( EFI_EVENT IdleLoopEvent; EFI_HANDLE CpuHandle; - InitializeExceptions (&mCpu); + InitializeExceptions (); InitializeDma (&mCpu); diff --git a/ArmPkg/Drivers/CpuDxe/CpuDxe.h b/ArmPkg/Drivers/CpuDxe/CpuDxe.h index c6613b939a..80d53e3577 100644 --- a/ArmPkg/Drivers/CpuDxe/CpuDxe.h +++ b/ArmPkg/Drivers/CpuDxe/CpuDxe.h @@ -99,7 +99,7 @@ CpuSetMemoryAttributes ( EFI_STATUS InitializeExceptions ( - IN EFI_CPU_ARCH_PROTOCOL *Cpu + VOID ); EFI_STATUS diff --git a/ArmPkg/Drivers/CpuDxe/Exception.c b/ArmPkg/Drivers/CpuDxe/Exception.c index 441f92d502..bd27f24994 100644 --- a/ArmPkg/Drivers/CpuDxe/Exception.c +++ b/ArmPkg/Drivers/CpuDxe/Exception.c @@ -13,49 +13,11 @@ EFI_STATUS InitializeExceptions ( - IN EFI_CPU_ARCH_PROTOCOL *Cpu + VOID ) { - EFI_STATUS Status; - EFI_VECTOR_HANDOFF_INFO *VectorInfoList; - EFI_VECTOR_HANDOFF_INFO *VectorInfo; - BOOLEAN IrqEnabled; - BOOLEAN FiqEnabled; - - VectorInfo = (EFI_VECTOR_HANDOFF_INFO *)NULL; - Status = EfiGetSystemConfigurationTable (&gEfiVectorHandoffTableGuid, (VOID **)&VectorInfoList); - if ((Status == EFI_SUCCESS) && (VectorInfoList != NULL)) { - VectorInfo = VectorInfoList; - } - // initialize the CpuExceptionHandlerLib so we take over the exception vector table from the DXE Core - InitializeCpuExceptionHandlers (VectorInfo); - - Status = EFI_SUCCESS; - - // - // Disable interrupts - // - Cpu->GetInterruptState (Cpu, &IrqEnabled); - Cpu->DisableInterrupt (Cpu); - - // - // EFI does not use the FIQ, but a debugger might so we must disable - // as we take over the exception vectors. - // - FiqEnabled = ArmGetFiqState (); - ArmDisableFiq (); - - if (FiqEnabled) { - ArmEnableFiq (); - } - - if (IrqEnabled) { - // - // Restore interrupt state - // - Status = Cpu->EnableInterrupt (Cpu); - } + InitializeCpuExceptionHandlers (NULL); // // On a DEBUG build, unmask SErrors so they are delivered right away rather @@ -66,7 +28,7 @@ InitializeExceptions ( ArmEnableAsynchronousAbort (); ); - return Status; + return EFI_SUCCESS; } /** -- cgit