2 Reset System Library functions for OVMF
4 Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #include <Base.h> // BIT1
11 #include <Library/BaseLib.h> // CpuDeadLoop()
12 #include <Library/IoLib.h> // IoWrite8()
13 #include <Library/ResetSystemLib.h> // ResetCold()
14 #include <Library/TimerLib.h> // MicroSecondDelay()
17 Calling this function causes a system-wide reset. This sets
18 all circuitry within the system to its initial state. This type of reset
19 is asynchronous to system operation and operates without regard to
22 System reset should not return, if it returns, it means the system does
23 not support cold reset.
31 IoWrite8 (0xCF9, BIT2
| BIT1
); // 1st choice: PIIX3 RCR, RCPU|SRST
32 MicroSecondDelay (50);
34 IoWrite8 (0x64, 0xfe); // 2nd choice: keyboard controller
39 Calling this function causes a system-wide initialization. The processors
40 are set to their initial state, and pending cycles are not corrupted.
42 System reset should not return, if it returns, it means the system does
43 not support warm reset.
51 IoWrite8 (0x64, 0xfe);
56 This function causes a systemwide reset. The exact type of the reset is
57 defined by the EFI_GUID that follows the Null-terminated Unicode string
58 passed into ResetData. If the platform does not recognize the EFI_GUID in
59 ResetData the platform must pick a supported reset type to perform.The
60 platform may optionally log the parameters from any non-normal reset that
63 @param[in] DataSize The size, in bytes, of ResetData.
64 @param[in] ResetData The data buffer starts with a Null-terminated string,
65 followed by the EFI_GUID.
69 ResetPlatformSpecific (
78 The ResetSystem function resets the entire platform.
80 @param[in] ResetType The type of reset to perform.
81 @param[in] ResetStatus The status code for the reset.
82 @param[in] DataSize The size, in bytes, of ResetData.
83 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or
84 EfiResetShutdown the data buffer starts with a
85 Null-terminated string, optionally followed by
86 additional binary data. The string is a description
87 that the caller may use to further indicate the
88 reason for the system reset.
93 IN EFI_RESET_TYPE ResetType
,
94 IN EFI_STATUS ResetStatus
,
96 IN VOID
*ResetData OPTIONAL
108 case EfiResetShutdown
:
112 case EfiResetPlatformSpecific
:
113 ResetPlatformSpecific (DataSize
, ResetData
);