mirror of https://github.com/acidanthera/audk.git
Nt32Pkg: Add the ResetSystemLib in Nt32 Platform.
Signed-off-by: Huajing Li <huajing.li@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
This commit is contained in:
parent
ac79ee2942
commit
00beb2abe7
|
@ -0,0 +1,98 @@
|
||||||
|
/** @file
|
||||||
|
|
||||||
|
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
|
This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
#include <Uefi.h>
|
||||||
|
#include <Library/DebugLib.h>
|
||||||
|
#include <Library/WinNtLib.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
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.
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
ResetCold (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
gWinNt->ExitProcess (0);
|
||||||
|
ASSERT (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
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.
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
ResetWarm (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
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 shut down reset.
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
ResetShutdown (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ResetCold ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
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
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ResetCold ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
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
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ResetCold ();
|
||||||
|
}
|
|
@ -1,8 +1,6 @@
|
||||||
## @file
|
## @file
|
||||||
# NT Emulation Reset Architectural Protocol Driver as defined in TIANO
|
#
|
||||||
#
|
# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
# This Reset module simulates system reset by process exit on NT.
|
|
||||||
# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
@ -11,17 +9,15 @@
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
#
|
|
||||||
##
|
##
|
||||||
|
|
||||||
[Defines]
|
[Defines]
|
||||||
INF_VERSION = 0x00010005
|
INF_VERSION = 0x00010005
|
||||||
BASE_NAME = Reset
|
BASE_NAME = Nt32ResetSystemLib
|
||||||
FILE_GUID = BA929954-35B0-4dd3-90CD-9634BD7E1CF1
|
FILE_GUID = A7EBA1F6-5505-4fba-8895-386EE02B2FAC
|
||||||
MODULE_TYPE = DXE_DRIVER
|
MODULE_TYPE = BASE
|
||||||
VERSION_STRING = 1.0
|
VERSION_STRING = 1.0
|
||||||
|
LIBRARY_CLASS = ResetSystemLib
|
||||||
ENTRY_POINT = InitializeNtReset
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# The following information is for reference only and not required by the build tools.
|
# The following information is for reference only and not required by the build tools.
|
||||||
|
@ -30,21 +26,12 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
[Sources]
|
[Sources]
|
||||||
reset.c
|
ResetSystemLib.c
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
Nt32Pkg/Nt32Pkg.dec
|
Nt32Pkg/Nt32Pkg.dec
|
||||||
|
|
||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
UefiBootServicesTableLib
|
|
||||||
WinNtLib
|
WinNtLib
|
||||||
UefiDriverEntryPoint
|
|
||||||
DebugLib
|
DebugLib
|
||||||
|
|
||||||
[Protocols]
|
|
||||||
gEfiResetArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED
|
|
||||||
|
|
||||||
[Depex]
|
|
||||||
TRUE
|
|
||||||
|
|
|
@ -167,6 +167,7 @@
|
||||||
CpuExceptionHandlerLib|MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.inf
|
CpuExceptionHandlerLib|MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.inf
|
||||||
LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf
|
LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf
|
||||||
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
|
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
|
||||||
|
ResetSystemLib|Nt32Pkg/Library/ResetSystemLib/ResetSystemLib.inf
|
||||||
!if $(TLS_ENABLE) == TRUE
|
!if $(TLS_ENABLE) == TRUE
|
||||||
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
|
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
|
||||||
!else
|
!else
|
||||||
|
@ -394,7 +395,7 @@
|
||||||
}
|
}
|
||||||
Nt32Pkg/MetronomeDxe/MetronomeDxe.inf
|
Nt32Pkg/MetronomeDxe/MetronomeDxe.inf
|
||||||
Nt32Pkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
|
Nt32Pkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
|
||||||
Nt32Pkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
|
MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
|
||||||
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
||||||
Nt32Pkg/FvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
|
Nt32Pkg/FvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
|
||||||
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {
|
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {
|
||||||
|
|
|
@ -200,7 +200,7 @@ INF MdeModulePkg/Core/Dxe/DxeMain.inf
|
||||||
INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
|
INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
|
||||||
INF Nt32Pkg/MetronomeDxe/MetronomeDxe.inf
|
INF Nt32Pkg/MetronomeDxe/MetronomeDxe.inf
|
||||||
INF Nt32Pkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
|
INF Nt32Pkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
|
||||||
INF Nt32Pkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
|
INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
|
||||||
INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
||||||
INF Nt32Pkg/FvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
|
INF Nt32Pkg/FvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
|
||||||
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
|
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
|
||||||
|
|
|
@ -1,126 +0,0 @@
|
||||||
/**@file
|
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
|
||||||
This program and the accompanying materials
|
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
|
||||||
http://opensource.org/licenses/bsd-license.php
|
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
Reset.c
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
Reset Architectural Protocol as defined in Tiano under NT Emulation
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include <Uefi.h>
|
|
||||||
#include <WinNtDxe.h>
|
|
||||||
#include <Protocol/Reset.h>
|
|
||||||
#include <Library/DebugLib.h>
|
|
||||||
#include <Library/UefiDriverEntryPoint.h>
|
|
||||||
#include <Library/WinNtLib.h>
|
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
InitializeNtReset (
|
|
||||||
IN EFI_HANDLE ImageHandle,
|
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
WinNtResetSystem (
|
|
||||||
IN EFI_RESET_TYPE ResetType,
|
|
||||||
IN EFI_STATUS ResetStatus,
|
|
||||||
IN UINTN DataSize,
|
|
||||||
IN VOID *ResetData OPTIONAL
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
InitializeNtReset (
|
|
||||||
IN EFI_HANDLE ImageHandle,
|
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
|
||||||
)
|
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
ImageHandle of the loaded driver
|
|
||||||
Pointer to the System Table
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
Status
|
|
||||||
--*/
|
|
||||||
// TODO: SystemTable - add argument and description to function comment
|
|
||||||
{
|
|
||||||
EFI_STATUS Status;
|
|
||||||
EFI_HANDLE Handle;
|
|
||||||
|
|
||||||
SystemTable->RuntimeServices->ResetSystem = WinNtResetSystem;
|
|
||||||
|
|
||||||
Handle = NULL;
|
|
||||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
|
||||||
&Handle,
|
|
||||||
&gEfiResetArchProtocolGuid,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
WinNtResetSystem (
|
|
||||||
IN EFI_RESET_TYPE ResetType,
|
|
||||||
IN EFI_STATUS ResetStatus,
|
|
||||||
IN UINTN DataSize,
|
|
||||||
IN VOID *ResetData OPTIONAL
|
|
||||||
)
|
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
TODO: Add function description
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
ResetType - TODO: add argument description
|
|
||||||
ResetStatus - TODO: add argument description
|
|
||||||
DataSize - TODO: add argument description
|
|
||||||
ResetData - TODO: add argument description
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - TODO: Add description for return value
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// BUGBUG Need to kill all console windows later
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Discard ResetType, always return 0 as exit code
|
|
||||||
//
|
|
||||||
gWinNt->ExitProcess (0);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Should never go here
|
|
||||||
//
|
|
||||||
ASSERT (FALSE);
|
|
||||||
}
|
|
Loading…
Reference in New Issue