]> git.proxmox.com Git - mirror_edk2.git/blob - PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.c
PcAtChipsetPkg: remove EnterS3WithImmediateWake () from ResetSystemLib
[mirror_edk2.git] / PcAtChipsetPkg / Library / ResetSystemLib / ResetSystemLib.c
1 /** @file
2 Reset System Library functions for PCAT platforms
3
4 Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include <Base.h>
10
11 #include <Uefi/UefiBaseType.h>
12 #include <Uefi/UefiMultiPhase.h>
13
14 #include <Library/DebugLib.h>
15 #include <Library/IoLib.h>
16
17 /**
18 Calling this function causes a system-wide reset. This sets
19 all circuitry within the system to its initial state. This type of reset
20 is asynchronous to system operation and operates without regard to
21 cycle boundaries.
22
23 System reset should not return, if it returns, it means the system does
24 not support cold reset.
25 **/
26 VOID
27 EFIAPI
28 ResetCold (
29 VOID
30 )
31 {
32 IoWrite8 ((UINTN) PcdGet64 (PcdResetControlRegister), PcdGet8 (PcdResetControlValueColdReset));
33 }
34
35 /**
36 Calling this function causes a system-wide initialization. The processors
37 are set to their initial state, and pending cycles are not corrupted.
38
39 System reset should not return, if it returns, it means the system does
40 not support warm reset.
41 **/
42 VOID
43 EFIAPI
44 ResetWarm (
45 VOID
46 )
47 {
48 IoWrite8 ((UINTN) PcdGet64 (PcdResetControlRegister), PcdGet8 (PcdResetControlValueColdReset));
49 }
50
51 /**
52 Calling this function causes the system to enter a power state equivalent
53 to the ACPI G2/S5 or G3 states.
54
55 System shutdown should not return, if it returns, it means the system does
56 not support shut down reset.
57 **/
58 VOID
59 EFIAPI
60 ResetShutdown (
61 VOID
62 )
63 {
64 ASSERT (FALSE);
65 }
66
67
68 /**
69 This function causes a systemwide reset. The exact type of the reset is
70 defined by the EFI_GUID that follows the Null-terminated Unicode string passed
71 into ResetData. If the platform does not recognize the EFI_GUID in ResetData
72 the platform must pick a supported reset type to perform.The platform may
73 optionally log the parameters from any non-normal reset that occurs.
74
75 @param[in] DataSize The size, in bytes, of ResetData.
76 @param[in] ResetData The data buffer starts with a Null-terminated string,
77 followed by the EFI_GUID.
78 **/
79 VOID
80 EFIAPI
81 ResetPlatformSpecific (
82 IN UINTN DataSize,
83 IN VOID *ResetData
84 )
85 {
86 ResetCold ();
87 }
88
89 /**
90 The ResetSystem function resets the entire platform.
91
92 @param[in] ResetType The type of reset to perform.
93 @param[in] ResetStatus The status code for the reset.
94 @param[in] DataSize The size, in bytes, of ResetData.
95 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
96 the data buffer starts with a Null-terminated string, optionally
97 followed by additional binary data. The string is a description
98 that the caller may use to further indicate the reason for the
99 system reset.
100 **/
101 VOID
102 EFIAPI
103 ResetSystem (
104 IN EFI_RESET_TYPE ResetType,
105 IN EFI_STATUS ResetStatus,
106 IN UINTN DataSize,
107 IN VOID *ResetData OPTIONAL
108 )
109 {
110 switch (ResetType) {
111 case EfiResetWarm:
112 ResetWarm ();
113 break;
114
115 case EfiResetCold:
116 ResetCold ();
117 break;
118
119 case EfiResetShutdown:
120 ResetShutdown ();
121 return;
122
123 case EfiResetPlatformSpecific:
124 ResetPlatformSpecific (DataSize, ResetData);
125 return;
126
127 default:
128 return;
129 }
130 }