2 Reset Architectural Protocol implementation
4 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include "ResetSystem.h"
19 // The handle onto which the Reset Architectural Protocol is installed
21 EFI_HANDLE mResetHandle
= NULL
;
24 The driver's entry point.
26 It initializes the Reset Architectural Protocol.
28 @param[in] ImageHandle The firmware allocated handle for the EFI image.
29 @param[in] SystemTable A pointer to the EFI System Table.
31 @retval EFI_SUCCESS The entry point is executed successfully.
32 @retval other Cannot install ResetArch protocol.
37 InitializeResetSystem (
38 IN EFI_HANDLE ImageHandle
,
39 IN EFI_SYSTEM_TABLE
*SystemTable
45 // Make sure the Reset Architectural Protocol is not already installed in the system
47 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiResetArchProtocolGuid
);
50 // Hook the runtime service table
52 gRT
->ResetSystem
= ResetSystem
;
55 // Now install the Reset RT AP on a new handle
57 Status
= gBS
->InstallMultipleProtocolInterfaces (
59 &gEfiResetArchProtocolGuid
,
63 ASSERT_EFI_ERROR (Status
);
69 Put the system into S3 power state.
76 EnterS3WithImmediateWake ();
85 Resets the entire platform.
87 @param[in] ResetType The type of reset to perform.
88 @param[in] ResetStatus The status code for the reset.
89 @param[in] DataSize The size, in bytes, of WatchdogData.
90 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or
91 EfiResetShutdown the data buffer starts with a Null-terminated
92 string, optionally followed by additional binary data.
98 IN EFI_RESET_TYPE ResetType
,
99 IN EFI_STATUS ResetStatus
,
101 IN VOID
*ResetData OPTIONAL
106 UINTN CapsuleDataPtr
;
109 // Indicate reset system runtime service is called.
111 REPORT_STATUS_CODE (EFI_PROGRESS_CODE
, (EFI_SOFTWARE_EFI_RUNTIME_SERVICE
| EFI_SW_RS_PC_RESET_SYSTEM
));
117 //Check if there are pending capsules to process
119 Size
= sizeof (CapsuleDataPtr
);
120 Status
= EfiGetVariable (
121 EFI_CAPSULE_VARIABLE_NAME
,
122 &gEfiCapsuleVendorGuid
,
125 (VOID
*) &CapsuleDataPtr
128 if (Status
== EFI_SUCCESS
) {
130 //Process capsules across a system reset.
143 case EfiResetShutdown
:
152 // Given we should have reset getting here would be bad