mirror of https://github.com/acidanthera/audk.git
ArmVirtPkg: switch to generic ResetSystemRuntimeDxe
For obscure reasons, ARM platforms use a different implementation of the ResetSystem() runtime service call than other platforms. So let's switch all ArmVirtPkg platforms to the generic version instead. Given that all platforms use an implementation of EfiResetSystemLib [as consumed by the ResetRuntimeDxe in EmbeddedPkg that we are replacing] which is unlikely to be depended upon by out of tree platforms, let's simply modify this library into an implementation of ResetSystemLib instead [which is what the generic driver in MdeModulePkg consumes] This does mean we need to update all clients at the same time, which is why all changes are part of the same patch. As before, warm reset and platform specific reset are mapped onto cold reset (which is the only thing PSCI implements, at least the version we depend on). The new library function EnterS3WithImmediateWake() is left unimplemented, as permitted by the ResetSystemLib library class. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
parent
b2c55e7328
commit
7b1dc6c569
|
@ -101,7 +101,7 @@
|
|||
|
||||
PlatformPeiLib|ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.inf
|
||||
MemoryInitPeiLib|ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf
|
||||
EfiResetSystemLib|ArmVirtPkg/Library/ArmVirtPsciResetSystemLib/ArmVirtPsciResetSystemLib.inf
|
||||
ResetSystemLib|ArmVirtPkg/Library/ArmVirtPsciResetSystemLib/ArmVirtPsciResetSystemLib.inf
|
||||
|
||||
# ARM PL031 RTC Driver
|
||||
RealTimeClockLib|ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf
|
||||
|
|
|
@ -266,7 +266,7 @@
|
|||
MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
|
||||
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
|
||||
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
|
||||
EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
|
||||
MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
|
||||
EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf {
|
||||
<LibraryClasses>
|
||||
NULL|ArmVirtPkg/Library/ArmVirtPL031FdtClientLib/ArmVirtPL031FdtClientLib.inf
|
||||
|
|
|
@ -63,7 +63,7 @@ READ_LOCK_STATUS = TRUE
|
|||
INF SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
|
||||
!endif
|
||||
INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
|
||||
INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
|
||||
INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
|
||||
INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
|
||||
INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
|
||||
INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
|
||||
|
|
|
@ -257,7 +257,7 @@
|
|||
MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
|
||||
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
|
||||
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
|
||||
EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
|
||||
MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
|
||||
EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf {
|
||||
<LibraryClasses>
|
||||
NULL|ArmVirtPkg/Library/ArmVirtPL031FdtClientLib/ArmVirtPL031FdtClientLib.inf
|
||||
|
|
|
@ -167,7 +167,7 @@
|
|||
MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
|
||||
|
||||
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
|
||||
EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
|
||||
MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
|
||||
EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
|
||||
EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ READ_LOCK_STATUS = TRUE
|
|||
INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
|
||||
|
||||
INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
|
||||
INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
|
||||
INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
|
||||
INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
|
||||
INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
|
||||
INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/EfiResetSystemLib.h>
|
||||
#include <Library/ResetSystemLib.h>
|
||||
#include <Library/ArmSmcLib.h>
|
||||
#include <Library/ArmHvcLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
|
@ -67,48 +67,25 @@ ArmPsciResetSystemLibConstructor (
|
|||
}
|
||||
|
||||
/**
|
||||
Resets the entire platform.
|
||||
|
||||
@param ResetType The type of reset to perform.
|
||||
@param ResetStatus The status code for the reset.
|
||||
@param DataSize The size, in bytes, of WatchdogData.
|
||||
@param ResetData For a ResetType of EfiResetCold, EfiResetWarm, or
|
||||
EfiResetShutdown the data buffer starts with a Null-terminated
|
||||
Unicode string, optionally followed by additional binary data.
|
||||
This function causes a system-wide reset (cold reset), in which
|
||||
all circuitry within the system returns to its initial state. This type of reset
|
||||
is asynchronous to system operation and operates without regard to
|
||||
cycle boundaries.
|
||||
|
||||
If this function returns, it means that the system does not support cold reset.
|
||||
**/
|
||||
EFI_STATUS
|
||||
VOID
|
||||
EFIAPI
|
||||
LibResetSystem (
|
||||
IN EFI_RESET_TYPE ResetType,
|
||||
IN EFI_STATUS ResetStatus,
|
||||
IN UINTN DataSize,
|
||||
IN CHAR16 *ResetData OPTIONAL
|
||||
ResetCold (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
ARM_SMC_ARGS ArmSmcArgs;
|
||||
ARM_HVC_ARGS ArmHvcArgs;
|
||||
|
||||
switch (ResetType) {
|
||||
|
||||
case EfiResetPlatformSpecific:
|
||||
// Map the platform specific reset as reboot
|
||||
case EfiResetWarm:
|
||||
// Map a warm reset into a cold reset
|
||||
case EfiResetCold:
|
||||
// Send a PSCI 0.2 SYSTEM_RESET command
|
||||
ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET;
|
||||
ArmHvcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET;
|
||||
break;
|
||||
case EfiResetShutdown:
|
||||
// Send a PSCI 0.2 SYSTEM_OFF command
|
||||
ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_OFF;
|
||||
ArmHvcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_OFF;
|
||||
break;
|
||||
default:
|
||||
ASSERT (FALSE);
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
// Send a PSCI 0.2 SYSTEM_RESET command
|
||||
ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET;
|
||||
ArmHvcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET;
|
||||
|
||||
switch (mArmPsciMethod) {
|
||||
case 1:
|
||||
|
@ -121,30 +98,90 @@ LibResetSystem (
|
|||
|
||||
default:
|
||||
DEBUG ((EFI_D_ERROR, "%a: no PSCI method defined\n", __FUNCTION__));
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
// We should never be here
|
||||
DEBUG ((EFI_D_ERROR, "%a: PSCI Reset failed\n", __FUNCTION__));
|
||||
CpuDeadLoop ();
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Initialize any infrastructure required for LibResetSystem () to function.
|
||||
|
||||
@param ImageHandle The firmware allocated handle for the EFI image.
|
||||
@param SystemTable A pointer to the EFI System Table.
|
||||
|
||||
@retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
|
||||
This function causes a system-wide initialization (warm reset), in which all processors
|
||||
are set to their initial state. Pending cycles are not corrupted.
|
||||
|
||||
If this function returns, it means that the system does not support warm reset.
|
||||
**/
|
||||
EFI_STATUS
|
||||
VOID
|
||||
EFIAPI
|
||||
LibInitializeResetSystem (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
ResetWarm (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return EFI_SUCCESS;
|
||||
// Map a warm reset into a cold reset
|
||||
ResetCold ();
|
||||
}
|
||||
|
||||
/**
|
||||
This function causes the system to enter a power state equivalent
|
||||
to the ACPI G2/S5 or G3 states.
|
||||
|
||||
If this function returns, it means that the system does not support shutdown reset.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ResetShutdown (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
ARM_SMC_ARGS ArmSmcArgs;
|
||||
ARM_HVC_ARGS ArmHvcArgs;
|
||||
|
||||
// Send a PSCI 0.2 SYSTEM_OFF command
|
||||
ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_OFF;
|
||||
ArmHvcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_OFF;
|
||||
|
||||
switch (mArmPsciMethod) {
|
||||
case 1:
|
||||
ArmCallHvc (&ArmHvcArgs);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
ArmCallSmc (&ArmSmcArgs);
|
||||
break;
|
||||
|
||||
default:
|
||||
DEBUG ((EFI_D_ERROR, "%a: no PSCI method defined\n", __FUNCTION__));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
This function causes the system to enter S3 and then wake up immediately.
|
||||
|
||||
If this function returns, it means that the system does not support S3 feature.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
EnterS3WithImmediateWake (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
// not implemented
|
||||
}
|
||||
|
||||
/**
|
||||
This function causes a systemwide reset. The exact type of the reset is
|
||||
defined by the EFI_GUID that follows the Null-terminated Unicode string passed
|
||||
into ResetData. If the platform does not recognize the EFI_GUID in ResetData
|
||||
the platform must pick a supported reset type to perform.The platform may
|
||||
optionally log the parameters from any non-normal reset that occurs.
|
||||
|
||||
@param[in] DataSize The size, in bytes, of ResetData.
|
||||
@param[in] ResetData The data buffer starts with a Null-terminated string,
|
||||
followed by the EFI_GUID.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ResetPlatformSpecific (
|
||||
IN UINTN DataSize,
|
||||
IN VOID *ResetData
|
||||
)
|
||||
{
|
||||
// Map the platform specific reset as reboot
|
||||
ResetCold ();
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
FILE_GUID = c81d76ed-66fa-44a3-ac4a-f163120187a9
|
||||
MODULE_TYPE = BASE
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = EfiResetSystemLib|DXE_DRIVER DXE_RUNTIME_DRIVER
|
||||
LIBRARY_CLASS = ResetSystemLib|DXE_DRIVER DXE_RUNTIME_DRIVER
|
||||
CONSTRUCTOR = ArmPsciResetSystemLibConstructor
|
||||
|
||||
[Sources]
|
||||
|
@ -29,8 +29,8 @@
|
|||
[Packages]
|
||||
ArmPkg/ArmPkg.dec
|
||||
ArmVirtPkg/ArmVirtPkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
ArmSmcLib
|
||||
|
|
Loading…
Reference in New Issue