]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Library/PeiResetSystemLib/PeiResetSystemLib.c
be5dc08c7a8188fb3f60dda189be7655e5c4f07c
[mirror_edk2.git] / MdeModulePkg / Library / PeiResetSystemLib / PeiResetSystemLib.c
1 /** @file
2 PEI Reset System Library instance that calls the ResetSystem2() PEI Service.
3
4 Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include <PiPei.h>
10 #include <Library/ResetSystemLib.h>
11 #include <Library/PeiServicesLib.h>
12
13 /**
14 This function causes a system-wide reset (cold reset), in which
15 all circuitry within the system returns to its initial state. This type of reset
16 is asynchronous to system operation and operates without regard to
17 cycle boundaries.
18
19 If this function returns, it means that the system does not support cold reset.
20 **/
21 VOID
22 EFIAPI
23 ResetCold (
24 VOID
25 )
26 {
27 PeiServicesResetSystem2 (EfiResetCold, EFI_SUCCESS, 0, NULL);
28 }
29
30 /**
31 This function causes a system-wide initialization (warm reset), in which all processors
32 are set to their initial state. Pending cycles are not corrupted.
33
34 If this function returns, it means that the system does not support warm reset.
35 **/
36 VOID
37 EFIAPI
38 ResetWarm (
39 VOID
40 )
41 {
42 PeiServicesResetSystem2 (EfiResetWarm, EFI_SUCCESS, 0, NULL);
43 }
44
45 /**
46 This function causes the system to enter a power state equivalent
47 to the ACPI G2/S5 or G3 states.
48
49 If this function returns, it means that the system does not support shut down reset.
50 **/
51 VOID
52 EFIAPI
53 ResetShutdown (
54 VOID
55 )
56 {
57 PeiServicesResetSystem2 (EfiResetShutdown, EFI_SUCCESS, 0, NULL);
58 }
59
60 /**
61 This function causes the system to enter S3 and then wake up immediately.
62
63 If this function returns, it means that the system does not support S3 feature.
64 **/
65 VOID
66 EFIAPI
67 EnterS3WithImmediateWake (
68 VOID
69 )
70 {
71 }
72
73 /**
74 This function causes a systemwide reset. The exact type of the reset is
75 defined by the EFI_GUID that follows the Null-terminated Unicode string passed
76 into ResetData. If the platform does not recognize the EFI_GUID in ResetData
77 the platform must pick a supported reset type to perform.The platform may
78 optionally log the parameters from any non-normal reset that occurs.
79
80 @param[in] DataSize The size, in bytes, of ResetData.
81 @param[in] ResetData The data buffer starts with a Null-terminated string,
82 followed by the EFI_GUID.
83 **/
84 VOID
85 EFIAPI
86 ResetPlatformSpecific (
87 IN UINTN DataSize,
88 IN VOID *ResetData
89 )
90 {
91 PeiServicesResetSystem2 (EfiResetPlatformSpecific, EFI_SUCCESS, DataSize, ResetData);
92 }
93
94 /**
95 The ResetSystem function resets the entire platform.
96
97 @param[in] ResetType The type of reset to perform.
98 @param[in] ResetStatus The status code for the reset.
99 @param[in] DataSize The size, in bytes, of ResetData.
100 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
101 the data buffer starts with a Null-terminated string, optionally
102 followed by additional binary data. The string is a description
103 that the caller may use to further indicate the reason for the
104 system reset. ResetData is only valid if ResetStatus is something
105 other than EFI_SUCCESS unless the ResetType is EfiResetPlatformSpecific
106 where a minimum amount of ResetData is always required.
107 **/
108 VOID
109 EFIAPI
110 ResetSystem (
111 IN EFI_RESET_TYPE ResetType,
112 IN EFI_STATUS ResetStatus,
113 IN UINTN DataSize,
114 IN VOID *ResetData OPTIONAL
115 )
116 {
117 PeiServicesResetSystem2 (ResetType, ResetStatus, DataSize, ResetData);
118 }