]>
git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
c2c7736aa88f06d3a4a8218d3067f3b40ad752f1
2 Reset System Library functions for OVMF
4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #include <Library/BaseLib.h>
12 #include <Library/DebugLib.h>
13 #include <Library/IoLib.h>
14 #include <Library/TimerLib.h>
15 #include <OvmfPlatforms.h>
17 #include <OvmfPlatforms.h>
24 UINT16 AcpiPmBaseAddress
;
25 UINT16 HostBridgeDevId
;
27 ASSERT (SuspendType
< 6);
29 AcpiPmBaseAddress
= 0;
30 HostBridgeDevId
= PciRead16 (OVMF_HOSTBRIDGE_DID
);
31 switch (HostBridgeDevId
) {
32 case INTEL_82441_DEVICE_ID
:
33 AcpiPmBaseAddress
= PIIX4_PMBA_VALUE
;
35 case INTEL_Q35_MCH_DEVICE_ID
:
36 AcpiPmBaseAddress
= ICH9_PMBASE_VALUE
;
43 IoBitFieldWrite16 (AcpiPmBaseAddress
+ 4, 10, 13, (UINT16
) SuspendType
);
44 IoOr16 (AcpiPmBaseAddress
+ 4, BIT13
);
49 Calling this function causes a system-wide reset. This sets
50 all circuitry within the system to its initial state. This type of reset
51 is asynchronous to system operation and operates without regard to
54 System reset should not return, if it returns, it means the system does
55 not support cold reset.
63 IoWrite8 (0xCF9, BIT2
| BIT1
); // 1st choice: PIIX3 RCR, RCPU|SRST
64 MicroSecondDelay (50);
66 IoWrite8 (0x64, 0xfe); // 2nd choice: keyboard controller
71 Calling this function causes a system-wide initialization. The processors
72 are set to their initial state, and pending cycles are not corrupted.
74 System reset should not return, if it returns, it means the system does
75 not support warm reset.
83 IoWrite8 (0x64, 0xfe);
88 Calling this function causes the system to enter a power state equivalent
89 to the ACPI G2/S5 or G3 states.
91 System shutdown should not return, if it returns, it means the system does
92 not support shut down reset.
106 Calling this function causes the system to enter a power state for capsule
109 Reset update should not return, if it returns, it means the system does
110 not support capsule update.
115 EnterS3WithImmediateWake (
124 This function causes a systemwide reset. The exact type of the reset is
125 defined by the EFI_GUID that follows the Null-terminated Unicode string passed
126 into ResetData. If the platform does not recognize the EFI_GUID in ResetData
127 the platform must pick a supported reset type to perform.The platform may
128 optionally log the parameters from any non-normal reset that occurs.
130 @param[in] DataSize The size, in bytes, of ResetData.
131 @param[in] ResetData The data buffer starts with a Null-terminated string,
132 followed by the EFI_GUID.
136 ResetPlatformSpecific (