mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
ArmPkg/CpuDxe: Fix error handling in driver initialization
Failure to install the CPU arch protocol is a fatal error, so treat it as such, rather than ignore it, even though we won't get very far if this driver fails to dispatch - at least, we will get an error in a DEBUG build rather than a mysterious failure due to unsatisfied DEPEXes. Failure to install the idle loop event handler is not a fatal error, and it should not cause the driver to exit with an error, as this will unload the driver and keep the installed CPU arch protocol pointer dangling. So keep the ASSERT() on the return value, but return EFI_SUCCESS once we're past the point where the CPU arch protocol has been installed. Since the protocol is never uninstalled, make the CPU handle function local, as there is no point in keeping its value around. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
parent
b64f735867
commit
afdae789cd
@ -206,8 +206,7 @@ IdleLoopEventCallback (
|
||||
//
|
||||
// Globals used to initialize the protocol
|
||||
//
|
||||
EFI_HANDLE mCpuHandle = NULL;
|
||||
EFI_CPU_ARCH_PROTOCOL mCpu = {
|
||||
EFI_CPU_ARCH_PROTOCOL mCpu = {
|
||||
CpuFlushCpuDataCache,
|
||||
CpuEnableInterrupt,
|
||||
CpuDisableInterrupt,
|
||||
@ -308,6 +307,7 @@ CpuDxeInitialize (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_EVENT IdleLoopEvent;
|
||||
EFI_HANDLE CpuHandle;
|
||||
|
||||
InitializeExceptions (&mCpu);
|
||||
|
||||
@ -327,14 +327,20 @@ CpuDxeInitialize (
|
||||
RemapUnusedMemoryNx ();
|
||||
}
|
||||
|
||||
CpuHandle = NULL;
|
||||
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&mCpuHandle,
|
||||
&CpuHandle,
|
||||
&gEfiCpuArchProtocolGuid,
|
||||
&mCpu,
|
||||
&gEfiMemoryAttributeProtocolGuid,
|
||||
&mMemoryAttribute,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Make sure GCD and MMU settings match. This API calls gDS->SetMemorySpaceAttributes ()
|
||||
@ -358,5 +364,5 @@ CpuDxeInitialize (
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return Status;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user