1 | /** @file
|
---|
2 | Reset System Library functions for OVMF
|
---|
3 |
|
---|
4 | Copyright (c) 2006 - 2011, 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
|
---|
9 |
|
---|
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.
|
---|
12 |
|
---|
13 | **/
|
---|
14 |
|
---|
15 | #include <Base.h>
|
---|
16 |
|
---|
17 | #include <Library/BaseLib.h>
|
---|
18 | #include <Library/DebugLib.h>
|
---|
19 | #include <Library/IoLib.h>
|
---|
20 |
|
---|
21 | VOID
|
---|
22 | AcpiPmControl (
|
---|
23 | UINTN SuspendType
|
---|
24 | )
|
---|
25 | {
|
---|
26 | ASSERT (SuspendType < 6);
|
---|
27 |
|
---|
28 | IoAndThenOr16 (0x404, (UINT16) ~0x3c00, (UINT16) (SuspendType << 10));
|
---|
29 | IoOr16 (0x404, BIT13);
|
---|
30 | CpuDeadLoop ();
|
---|
31 | }
|
---|
32 |
|
---|
33 | /**
|
---|
34 | Calling this function causes a system-wide reset. This sets
|
---|
35 | all circuitry within the system to its initial state. This type of reset
|
---|
36 | is asynchronous to system operation and operates without regard to
|
---|
37 | cycle boundaries.
|
---|
38 |
|
---|
39 | System reset should not return, if it returns, it means the system does
|
---|
40 | not support cold reset.
|
---|
41 | **/
|
---|
42 | VOID
|
---|
43 | EFIAPI
|
---|
44 | ResetCold (
|
---|
45 | VOID
|
---|
46 | )
|
---|
47 | {
|
---|
48 | IoWrite8 (0x64, 0xfe);
|
---|
49 | }
|
---|
50 |
|
---|
51 | /**
|
---|
52 | Calling this function causes a system-wide initialization. The processors
|
---|
53 | are set to their initial state, and pending cycles are not corrupted.
|
---|
54 |
|
---|
55 | System reset should not return, if it returns, it means the system does
|
---|
56 | not support warm reset.
|
---|
57 | **/
|
---|
58 | VOID
|
---|
59 | EFIAPI
|
---|
60 | ResetWarm (
|
---|
61 | VOID
|
---|
62 | )
|
---|
63 | {
|
---|
64 | IoWrite8 (0x64, 0xfe);
|
---|
65 | }
|
---|
66 |
|
---|
67 | /**
|
---|
68 | Calling this function causes the system to enter a power state equivalent
|
---|
69 | to the ACPI G2/S5 or G3 states.
|
---|
70 |
|
---|
71 | System shutdown should not return, if it returns, it means the system does
|
---|
72 | not support shut down reset.
|
---|
73 | **/
|
---|
74 | VOID
|
---|
75 | EFIAPI
|
---|
76 | ResetShutdown (
|
---|
77 | VOID
|
---|
78 | )
|
---|
79 | {
|
---|
80 | AcpiPmControl (0);
|
---|
81 | ASSERT (FALSE);
|
---|
82 | }
|
---|
83 |
|
---|
84 |
|
---|
85 | /**
|
---|
86 | Calling this function causes the system to enter a power state for capsule
|
---|
87 | update.
|
---|
88 |
|
---|
89 | Reset update should not return, if it returns, it means the system does
|
---|
90 | not support capsule update.
|
---|
91 |
|
---|
92 | **/
|
---|
93 | VOID
|
---|
94 | EFIAPI
|
---|
95 | EnterS3WithImmediateWake (
|
---|
96 | VOID
|
---|
97 | )
|
---|
98 | {
|
---|
99 | AcpiPmControl (1);
|
---|
100 | ASSERT (FALSE);
|
---|
101 | }
|
---|