]>
git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
2 Reset System Library functions for OVMF
4 Copyright (c) 2006 - 2016, 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
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.
17 #include <Library/BaseLib.h>
18 #include <Library/DebugLib.h>
19 #include <Library/IoLib.h>
20 #include <Library/TimerLib.h>
21 #include <OvmfPlatforms.h>
23 #include <OvmfPlatforms.h>
30 UINT16 AcpiPmBaseAddress
;
31 UINT16 HostBridgeDevId
;
33 ASSERT (SuspendType
< 6);
35 AcpiPmBaseAddress
= 0;
36 HostBridgeDevId
= PciRead16 (OVMF_HOSTBRIDGE_DID
);
37 switch (HostBridgeDevId
) {
38 case INTEL_82441_DEVICE_ID
:
39 AcpiPmBaseAddress
= PIIX4_PMBA_VALUE
;
41 case INTEL_Q35_MCH_DEVICE_ID
:
42 AcpiPmBaseAddress
= ICH9_PMBASE_VALUE
;
49 IoBitFieldWrite16 (AcpiPmBaseAddress
+ 4, 10, 13, (UINT16
) SuspendType
);
50 IoOr16 (AcpiPmBaseAddress
+ 4, BIT13
);
55 Calling this function causes a system-wide reset. This sets
56 all circuitry within the system to its initial state. This type of reset
57 is asynchronous to system operation and operates without regard to
60 System reset should not return, if it returns, it means the system does
61 not support cold reset.
69 IoWrite8 (0xCF9, BIT2
| BIT1
); // 1st choice: PIIX3 RCR, RCPU|SRST
70 MicroSecondDelay (50);
72 IoWrite8 (0x64, 0xfe); // 2nd choice: keyboard controller
77 Calling this function causes a system-wide initialization. The processors
78 are set to their initial state, and pending cycles are not corrupted.
80 System reset should not return, if it returns, it means the system does
81 not support warm reset.
89 IoWrite8 (0x64, 0xfe);
94 Calling this function causes the system to enter a power state equivalent
95 to the ACPI G2/S5 or G3 states.
97 System shutdown should not return, if it returns, it means the system does
98 not support shut down reset.
112 Calling this function causes the system to enter a power state for capsule
115 Reset update should not return, if it returns, it means the system does
116 not support capsule update.
121 EnterS3WithImmediateWake (
130 This function causes a systemwide reset. The exact type of the reset is
131 defined by the EFI_GUID that follows the Null-terminated Unicode string passed
132 into ResetData. If the platform does not recognize the EFI_GUID in ResetData
133 the platform must pick a supported reset type to perform.The platform may
134 optionally log the parameters from any non-normal reset that occurs.
136 @param[in] DataSize The size, in bytes, of ResetData.
137 @param[in] ResetData The data buffer starts with a Null-terminated string,
138 followed by the EFI_GUID.
142 ResetPlatformSpecific (