2 Reset Architectural Protocol implementation
4 Copyright (c) 2006 - 2017, 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 driver's entry point.
21 It initializes the Reset Architectural Protocol.
23 @param[in] ImageHandle The firmware allocated handle for the EFI image.
24 @param[in] SystemTable A pointer to the EFI System Table.
26 @retval EFI_SUCCESS The entry point is executed successfully.
27 @retval other Cannot install ResetArch protocol.
32 InitializeResetSystem (
33 IN EFI_HANDLE ImageHandle
,
34 IN EFI_SYSTEM_TABLE
*SystemTable
41 // Make sure the Reset Architectural Protocol is not already installed in the system
43 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiResetArchProtocolGuid
);
46 // Hook the runtime service table
48 gRT
->ResetSystem
= ResetSystem
;
51 // Now install the Reset RT AP on a new handle
54 Status
= gBS
->InstallMultipleProtocolInterfaces (
56 &gEfiResetArchProtocolGuid
,
60 ASSERT_EFI_ERROR (Status
);
66 Put the system into S3 power state.
73 EnterS3WithImmediateWake ();
82 Resets the entire platform.
84 @param[in] ResetType The type of reset to perform.
85 @param[in] ResetStatus The status code for the reset.
86 @param[in] DataSize The size, in bytes, of ResetData.
87 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or
88 EfiResetShutdown the data buffer starts with a Null-terminated
89 string, optionally followed by additional binary data.
90 The string is a description that the caller may use to further
91 indicate the reason for the system reset. ResetData is only
92 valid if ResetStatus is something other than EFI_SUCCESS
93 unless the ResetType is EfiResetPlatformSpecific
94 where a minimum amount of ResetData is always required.
99 IN EFI_RESET_TYPE ResetType
,
100 IN EFI_STATUS ResetStatus
,
102 IN VOID
*ResetData OPTIONAL
107 UINTN CapsuleDataPtr
;
110 // Indicate reset system runtime service is called.
112 REPORT_STATUS_CODE (EFI_PROGRESS_CODE
, (EFI_SOFTWARE_EFI_RUNTIME_SERVICE
| EFI_SW_RS_PC_RESET_SYSTEM
));
118 //Check if there are pending capsules to process
120 Size
= sizeof (CapsuleDataPtr
);
121 Status
= EfiGetVariable (
122 EFI_CAPSULE_VARIABLE_NAME
,
123 &gEfiCapsuleVendorGuid
,
126 (VOID
*) &CapsuleDataPtr
129 if (Status
== EFI_SUCCESS
) {
131 //Process capsules across a system reset.
144 case EfiResetShutdown
:
148 case EfiResetPlatformSpecific
:
149 ResetPlatformSpecific (DataSize
, ResetData
);
157 // Given we should have reset getting here would be bad