2 Reset Architectural Protocol implementation
4 Copyright (c) 2006 - 2010, 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 Reset system for capsule update.
71 @param[in] CapsuleDataPtr Pointer to the capsule block descriptors.
76 IN UINTN CapsuleDataPtr
80 // This implementation assumes that we're using a variable
81 // to indicate capsule updates.
84 EFI_CAPSULE_VARIABLE_NAME
,
85 &gEfiCapsuleVendorGuid
,
86 EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_RUNTIME_ACCESS
| EFI_VARIABLE_BOOTSERVICE_ACCESS
,
88 (VOID
*) &CapsuleDataPtr
91 EnterS3WithImmediateWake ();
100 Put the system into S3 power state.
107 EnterS3WithImmediateWake ();
116 Resets the entire platform.
118 @param[in] ResetType The type of reset to perform.
119 @param[in] ResetStatus The status code for the reset.
120 @param[in] DataSize The size, in bytes, of WatchdogData.
121 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or
122 EfiResetShutdown the data buffer starts with a Null-terminated
123 string, optionally followed by additional binary data.
129 IN EFI_RESET_TYPE ResetType
,
130 IN EFI_STATUS ResetStatus
,
132 IN VOID
*ResetData OPTIONAL
137 UINTN CapsuleDataPtr
;
143 //Check if there are pending capsules to process
145 Size
= sizeof (CapsuleDataPtr
);
146 Status
= EfiGetVariable (
147 EFI_CAPSULE_VARIABLE_NAME
,
148 &gEfiCapsuleVendorGuid
,
151 (VOID
*) &CapsuleDataPtr
154 if (Status
== EFI_SUCCESS
) {
156 //Process capsules across a system reset.
169 case EfiResetShutdown
:
178 // Given we should have reset getting here would be bad