ReactOS 0.4.16-dev-257-g6aa11ac
hwacpi.c File Reference
#include "acpi.h"
#include "accommon.h"
Include dependency graph for hwacpi.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_HARDWARE
 

Functions

ACPI_STATUS AcpiHwSetMode (UINT32 Mode)
 
UINT32 AcpiHwGetMode (void)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_HARDWARE

Definition at line 48 of file hwacpi.c.

Function Documentation

◆ AcpiHwGetMode()

UINT32 AcpiHwGetMode ( void  )

Definition at line 179 of file hwacpi.c.

181{
184
185
186 ACPI_FUNCTION_TRACE (HwGetMode);
187
188
189 /* If the Hardware Reduced flag is set, machine is always in acpi mode */
190
191 if (AcpiGbl_ReducedHardware)
192 {
194 }
195
196 /*
197 * ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
198 * system does not support mode transition.
199 */
200 if (!AcpiGbl_FADT.SmiCommand)
201 {
203 }
204
206 if (ACPI_FAILURE (Status))
207 {
209 }
210
211 if (Value)
212 {
214 }
215 else
216 {
218 }
219}
unsigned int UINT32
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define return_UINT32(s)
Definition: acoutput.h:501
#define ACPI_BITREG_SCI_ENABLE
Definition: actypes.h:923
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_SYS_MODE_ACPI
Definition: actypes.h:1084
#define ACPI_SYS_MODE_LEGACY
Definition: actypes.h:1085
Status
Definition: gdiplustypes.h:25
ACPI_STATUS AcpiReadBitRegister(UINT32 RegisterId, UINT32 *ReturnValue)
Definition: hwxface.c:213
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

Referenced by AcpiDisable(), AcpiEnable(), AcpiEnableSubsystem(), and AcpiHwSetMode().

◆ AcpiHwSetMode()

ACPI_STATUS AcpiHwSetMode ( UINT32  Mode)

Definition at line 66 of file hwacpi.c.

68{
69
72
73
74 ACPI_FUNCTION_TRACE (HwSetMode);
75
76
77 /* If the Hardware Reduced flag is set, machine is always in acpi mode */
78
79 if (AcpiGbl_ReducedHardware)
80 {
82 }
83
84 /*
85 * ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
86 * system does not support mode transition.
87 */
88 if (!AcpiGbl_FADT.SmiCommand)
89 {
90 ACPI_ERROR ((AE_INFO, "No SMI_CMD in FADT, mode transition failed"));
92 }
93
94 /*
95 * ACPI 2.0 clarified the meaning of ACPI_ENABLE and ACPI_DISABLE
96 * in FADT: If it is zero, enabling or disabling is not supported.
97 * As old systems may have used zero for mode transition,
98 * we make sure both the numbers are zero to determine these
99 * transitions are not supported.
100 */
101 if (!AcpiGbl_FADT.AcpiEnable && !AcpiGbl_FADT.AcpiDisable)
102 {
104 "No ACPI mode transition supported in this system "
105 "(enable/disable both zero)"));
107 }
108
109 switch (Mode)
110 {
112
113 /* BIOS should have disabled ALL fixed and GP events */
114
115 Status = AcpiHwWritePort (AcpiGbl_FADT.SmiCommand,
116 (UINT32) AcpiGbl_FADT.AcpiEnable, 8);
117 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n"));
118 break;
119
121 /*
122 * BIOS should clear all fixed status bits and restore fixed event
123 * enable bits to default
124 */
125 Status = AcpiHwWritePort (AcpiGbl_FADT.SmiCommand,
126 (UINT32) AcpiGbl_FADT.AcpiDisable, 8);
128 "Attempting to enable Legacy (non-ACPI) mode\n"));
129 break;
130
131 default:
132
134 }
135
136 if (ACPI_FAILURE (Status))
137 {
139 "Could not write ACPI mode change"));
141 }
142
143 /*
144 * Some hardware takes a LONG time to switch modes. Give them 3 sec to
145 * do so, but allow faster systems to proceed more quickly.
146 */
147 Retry = 3000;
148 while (Retry)
149 {
150 if (AcpiHwGetMode () == Mode)
151 {
153 "Mode %X successfully enabled\n", Mode));
155 }
157 Retry--;
158 }
159
160 ACPI_ERROR ((AE_INFO, "Hardware did not change modes"));
162}
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define AE_NO_HARDWARE_RESPONSE
Definition: acexcep.h:130
#define AE_OK
Definition: acexcep.h:97
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_DB_INFO
Definition: acoutput.h:153
void AcpiOsStall(UINT32 Microseconds)
Definition: osl.c:264
#define ACPI_USEC_PER_MSEC
Definition: actypes.h:470
_In_ PSCSI_REQUEST_BLOCK _Out_ NTSTATUS _Inout_ BOOLEAN * Retry
Definition: classpnp.h:312
UINT32 AcpiHwGetMode(void)
Definition: hwacpi.c:179
_In_ ULONG Mode
Definition: hubbusif.h:303
ACPI_STATUS AcpiHwWritePort(ACPI_IO_ADDRESS Address, UINT32 Value, UINT32 Width)
Definition: hwvalid.c:312

Referenced by AcpiDisable(), and AcpiEnable().