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);
57 This function causes a systemwide reset. The exact type of the reset is
58 defined by the EFI_GUID that follows the Null-terminated Unicode string
59 passed into ResetData. If the platform does not recognize the EFI_GUID in
60 ResetData the platform must pick a supported reset type to perform.The
61 platform may optionally log the parameters from any non-normal reset that
64 @param[in] DataSize The size, in bytes, of ResetData.
65 @param[in] ResetData The data buffer starts with a Null-terminated string,
66 followed by the EFI_GUID.
70 ResetPlatformSpecific (
79 The ResetSystem function resets the entire platform.
81 @param[in] ResetType The type of reset to perform.
82 @param[in] ResetStatus The status code for the reset.
83 @param[in] DataSize The size, in bytes, of ResetData.
84 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or
85 EfiResetShutdown the data buffer starts with a
86 Null-terminated string, optionally followed by
87 additional binary data. The string is a description
88 that the caller may use to further indicate the
89 reason for the system reset.
94 IN EFI_RESET_TYPE ResetType
,
95 IN EFI_STATUS ResetStatus
,
97 IN VOID
*ResetData OPTIONAL
109 case EfiResetShutdown
:
113 case EfiResetPlatformSpecific
:
114 ResetPlatformSpecific (DataSize
, ResetData
);