]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
OvmfPkg: introduce ICH9_PMBASE_VALUE
[mirror_edk2.git] / OvmfPkg / Library / ResetSystemLib / ResetSystemLib.c
CommitLineData
7ca30a6a 1/** @file\r
2 Reset System Library functions for OVMF\r
3\r
d52c2868 4 Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
7ca30a6a 5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include <Base.h>\r
16\r
17#include <Library/BaseLib.h>\r
18#include <Library/DebugLib.h>\r
19#include <Library/IoLib.h>\r
fb2ae5fd 20#include <Library/TimerLib.h>\r
7ca30a6a 21\r
b2f4da39
LE
22#include <OvmfPlatforms.h>\r
23\r
7ca30a6a 24VOID\r
25AcpiPmControl (\r
26 UINTN SuspendType\r
27 )\r
28{\r
29 ASSERT (SuspendType < 6);\r
30\r
b2f4da39
LE
31 IoBitFieldWrite16 (PIIX4_PMBA_VALUE + 4, 10, 13, (UINT16) SuspendType);\r
32 IoOr16 (PIIX4_PMBA_VALUE + 4, BIT13);\r
7ca30a6a 33 CpuDeadLoop ();\r
34}\r
35\r
36/**\r
37 Calling this function causes a system-wide reset. This sets\r
38 all circuitry within the system to its initial state. This type of reset\r
39 is asynchronous to system operation and operates without regard to\r
40 cycle boundaries.\r
41\r
42 System reset should not return, if it returns, it means the system does\r
43 not support cold reset.\r
44**/\r
45VOID\r
46EFIAPI\r
47ResetCold (\r
48 VOID\r
49 )\r
50{\r
cb7b12ee 51 IoWrite8 (0xCF9, BIT2 | BIT1); // 1st choice: PIIX3 RCR, RCPU|SRST\r
fb2ae5fd 52 MicroSecondDelay (50);\r
53\r
cb7b12ee 54 IoWrite8 (0x64, 0xfe); // 2nd choice: keyboard controller\r
fb2ae5fd 55 CpuDeadLoop ();\r
7ca30a6a 56}\r
57\r
58/**\r
59 Calling this function causes a system-wide initialization. The processors\r
60 are set to their initial state, and pending cycles are not corrupted.\r
61\r
62 System reset should not return, if it returns, it means the system does\r
63 not support warm reset.\r
64**/\r
65VOID\r
66EFIAPI\r
67ResetWarm (\r
68 VOID\r
69 )\r
70{\r
71 IoWrite8 (0x64, 0xfe);\r
fb2ae5fd 72 CpuDeadLoop ();\r
7ca30a6a 73}\r
74\r
75/**\r
76 Calling this function causes the system to enter a power state equivalent\r
77 to the ACPI G2/S5 or G3 states.\r
78\r
79 System shutdown should not return, if it returns, it means the system does\r
80 not support shut down reset.\r
81**/\r
82VOID\r
83EFIAPI\r
84ResetShutdown (\r
85 VOID\r
86 )\r
87{\r
88 AcpiPmControl (0);\r
89 ASSERT (FALSE);\r
90}\r
91\r
92\r
93/**\r
94 Calling this function causes the system to enter a power state for capsule\r
95 update.\r
96\r
97 Reset update should not return, if it returns, it means the system does\r
98 not support capsule update.\r
99\r
100**/\r
101VOID\r
102EFIAPI\r
103EnterS3WithImmediateWake (\r
104 VOID\r
105 )\r
106{\r
107 AcpiPmControl (1);\r
108 ASSERT (FALSE);\r
109}\r