]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Library/DxeResetSystemLib/DxeResetSystemLib.c
MdeModulePkg/DxeResetSystemLib: Avoid depending on UefiRuntimeLib
[mirror_edk2.git] / MdeModulePkg / Library / DxeResetSystemLib / DxeResetSystemLib.c
1 /** @file
2 DXE Reset System Library instance that calls gRT->ResetSystem().
3
4 Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #include <PiDxe.h>
16 #include <Library/ResetSystemLib.h>
17 #include <Library/UefiRuntimeServicesTableLib.h>
18
19 /**
20 This function causes a system-wide reset (cold reset), in which
21 all circuitry within the system returns to its initial state. This type of reset
22 is asynchronous to system operation and operates without regard to
23 cycle boundaries.
24
25 If this function returns, it means that the system does not support cold reset.
26 **/
27 VOID
28 EFIAPI
29 ResetCold (
30 VOID
31 )
32 {
33 gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
34 }
35
36 /**
37 This function causes a system-wide initialization (warm reset), in which all processors
38 are set to their initial state. Pending cycles are not corrupted.
39
40 If this function returns, it means that the system does not support warm reset.
41 **/
42 VOID
43 EFIAPI
44 ResetWarm (
45 VOID
46 )
47 {
48 gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
49 }
50
51 /**
52 This function causes the system to enter a power state equivalent
53 to the ACPI G2/S5 or G3 states.
54
55 If this function returns, it means that the system does not support shut down reset.
56 **/
57 VOID
58 EFIAPI
59 ResetShutdown (
60 VOID
61 )
62 {
63 gRT->ResetSystem (EfiResetShutdown, EFI_SUCCESS, 0, NULL);
64 }
65
66 /**
67 This function causes the system to enter S3 and then wake up immediately.
68
69 If this function returns, it means that the system does not support S3 feature.
70 **/
71 VOID
72 EFIAPI
73 EnterS3WithImmediateWake (
74 VOID
75 )
76 {
77 }
78
79 /**
80 This function causes a systemwide reset. The exact type of the reset is
81 defined by the EFI_GUID that follows the Null-terminated Unicode string passed
82 into ResetData. If the platform does not recognize the EFI_GUID in ResetData
83 the platform must pick a supported reset type to perform.The platform may
84 optionally log the parameters from any non-normal reset that occurs.
85
86 @param[in] DataSize The size, in bytes, of ResetData.
87 @param[in] ResetData The data buffer starts with a Null-terminated string,
88 followed by the EFI_GUID.
89 **/
90 VOID
91 EFIAPI
92 ResetPlatformSpecific (
93 IN UINTN DataSize,
94 IN VOID *ResetData
95 )
96 {
97 gRT->ResetSystem (EfiResetPlatformSpecific, EFI_SUCCESS, DataSize, ResetData);
98 }