VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c

最後變更 在這個檔案是 99404,由 vboxsync 提交於 2 年 前

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • 屬性 svn:eol-style 設為 native
檔案大小: 3.1 KB
 
1/** @file
2 Reset System Library functions for OVMF
3
4 Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7**/
8
9#include <Base.h> // BIT1
10
11#include <Library/BaseLib.h> // CpuDeadLoop()
12#include <Library/IoLib.h> // IoWrite8()
13#include <Library/ResetSystemLib.h> // ResetCold()
14#include <Library/TimerLib.h> // MicroSecondDelay()
15
16/**
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
20 cycle boundaries.
21
22 System reset should not return, if it returns, it means the system does
23 not support cold reset.
24**/
25VOID
26EFIAPI
27ResetCold (
28 VOID
29 )
30{
31 IoWrite8 (0xCF9, BIT2 | BIT1); // 1st choice: PIIX3 RCR, RCPU|SRST
32 MicroSecondDelay (50);
33
34 IoWrite8 (0x64, 0xfe); // 2nd choice: keyboard controller
35 CpuDeadLoop ();
36}
37
38/**
39 Calling this function causes a system-wide initialization. The processors
40 are set to their initial state, and pending cycles are not corrupted.
41
42 System reset should not return, if it returns, it means the system does
43 not support warm reset.
44**/
45VOID
46EFIAPI
47ResetWarm (
48 VOID
49 )
50{
51 IoWrite8 (0x64, 0xfe);
52 CpuDeadLoop ();
53}
54
55/**
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
61 occurs.
62
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.
66**/
67VOID
68EFIAPI
69ResetPlatformSpecific (
70 IN UINTN DataSize,
71 IN VOID *ResetData
72 )
73{
74 ResetCold ();
75}
76
77/**
78 The ResetSystem function resets the entire platform.
79
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.
89**/
90VOID
91EFIAPI
92ResetSystem (
93 IN EFI_RESET_TYPE ResetType,
94 IN EFI_STATUS ResetStatus,
95 IN UINTN DataSize,
96 IN VOID *ResetData OPTIONAL
97 )
98{
99 switch (ResetType) {
100 case EfiResetWarm:
101 ResetWarm ();
102 break;
103
104 case EfiResetCold:
105 ResetCold ();
106 break;
107
108 case EfiResetShutdown:
109 ResetShutdown ();
110 break;
111
112 case EfiResetPlatformSpecific:
113 ResetPlatformSpecific (DataSize, ResetData);
114 break;
115
116 default:
117 break;
118 }
119}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette