mirror of https://github.com/acidanthera/audk.git
ArmVirtPkg/ArmVirtPsciResetSystemLib: move to FDT client protocol
Instead of relying on VirtFdtDxe to detect the PSCI method, move our EfiResetSystemLib to the FDT client protocol to interrogate the device tree directly. Since this library is only consumed by EmbeddedPkg/ResetRuntimeDxe, and considering that the PCD is no longer set, and even removed completely in a subsequent patch, this conversion is guaranteed to be safe. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
parent
6c6ac050d9
commit
93f9a23f87
|
@ -26,9 +26,12 @@
|
|||
#include <Library/EfiResetSystemLib.h>
|
||||
#include <Library/ArmSmcLib.h>
|
||||
#include <Library/ArmHvcLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
|
||||
#include <IndustryStandard/ArmStdSmc.h>
|
||||
|
||||
#include <Protocol/FdtClient.h>
|
||||
|
||||
STATIC UINT32 mArmPsciMethod;
|
||||
|
||||
RETURN_STATUS
|
||||
|
@ -37,8 +40,30 @@ ArmPsciResetSystemLibConstructor (
|
|||
VOID
|
||||
)
|
||||
{
|
||||
mArmPsciMethod = PcdGet32 (PcdArmPsciMethod);
|
||||
return RETURN_SUCCESS;
|
||||
EFI_STATUS Status;
|
||||
FDT_CLIENT_PROTOCOL *FdtClient;
|
||||
CONST VOID *Prop;
|
||||
|
||||
Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,
|
||||
(VOID **)&FdtClient);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = FdtClient->FindCompatibleNodeProperty (FdtClient, "arm,psci-0.2",
|
||||
"method", &Prop, NULL);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (AsciiStrnCmp (Prop, "hvc", 3) == 0) {
|
||||
mArmPsciMethod = 1;
|
||||
} else if (AsciiStrnCmp (Prop, "smc", 3) == 0) {
|
||||
mArmPsciMethod = 2;
|
||||
} else {
|
||||
DEBUG ((EFI_D_ERROR, "%a: Unknown PSCI method \"%a\"\n", __FUNCTION__,
|
||||
Prop));
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
FILE_GUID = c81d76ed-66fa-44a3-ac4a-f163120187a9
|
||||
MODULE_TYPE = BASE
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = EfiResetSystemLib
|
||||
LIBRARY_CLASS = EfiResetSystemLib|DXE_DRIVER DXE_RUNTIME_DRIVER
|
||||
CONSTRUCTOR = ArmPsciResetSystemLibConstructor
|
||||
|
||||
[Sources]
|
||||
|
@ -33,10 +33,14 @@
|
|||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
DebugLib
|
||||
BaseLib
|
||||
ArmSmcLib
|
||||
ArmHvcLib
|
||||
BaseLib
|
||||
DebugLib
|
||||
UefiBootServicesTableLib
|
||||
|
||||
[Pcd]
|
||||
gArmVirtTokenSpaceGuid.PcdArmPsciMethod
|
||||
[Protocols]
|
||||
gFdtClientProtocolGuid ## CONSUMES
|
||||
|
||||
[Depex]
|
||||
gFdtClientProtocolGuid
|
||||
|
|
Loading…
Reference in New Issue