diff options
Diffstat (limited to 'drivers/acpi/hardware/hwacpi.c')
-rw-r--r-- | drivers/acpi/hardware/hwacpi.c | 116 |
1 files changed, 51 insertions, 65 deletions
diff --git a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/hardware/hwacpi.c index b51001e74eea..1bb3463d7040 100644 --- a/drivers/acpi/hardware/hwacpi.c +++ b/drivers/acpi/hardware/hwacpi.c | |||
@@ -42,13 +42,10 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | 46 | ||
48 | |||
49 | #define _COMPONENT ACPI_HARDWARE | 47 | #define _COMPONENT ACPI_HARDWARE |
50 | ACPI_MODULE_NAME ("hwacpi") | 48 | ACPI_MODULE_NAME("hwacpi") |
51 | |||
52 | 49 | ||
53 | /****************************************************************************** | 50 | /****************************************************************************** |
54 | * | 51 | * |
@@ -62,36 +59,30 @@ | |||
62 | * the FADT. | 59 | * the FADT. |
63 | * | 60 | * |
64 | ******************************************************************************/ | 61 | ******************************************************************************/ |
65 | 62 | acpi_status acpi_hw_initialize(void) | |
66 | acpi_status | ||
67 | acpi_hw_initialize ( | ||
68 | void) | ||
69 | { | 63 | { |
70 | acpi_status status; | 64 | acpi_status status; |
71 | |||
72 | |||
73 | ACPI_FUNCTION_TRACE ("hw_initialize"); | ||
74 | 65 | ||
66 | ACPI_FUNCTION_TRACE("hw_initialize"); | ||
75 | 67 | ||
76 | /* We must have the ACPI tables by the time we get here */ | 68 | /* We must have the ACPI tables by the time we get here */ |
77 | 69 | ||
78 | if (!acpi_gbl_FADT) { | 70 | if (!acpi_gbl_FADT) { |
79 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No FADT is present\n")); | 71 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No FADT is present\n")); |
80 | 72 | ||
81 | return_ACPI_STATUS (AE_NO_ACPI_TABLES); | 73 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); |
82 | } | 74 | } |
83 | 75 | ||
84 | /* Sanity check the FADT for valid values */ | 76 | /* Sanity check the FADT for valid values */ |
85 | 77 | ||
86 | status = acpi_ut_validate_fadt (); | 78 | status = acpi_ut_validate_fadt(); |
87 | if (ACPI_FAILURE (status)) { | 79 | if (ACPI_FAILURE(status)) { |
88 | return_ACPI_STATUS (status); | 80 | return_ACPI_STATUS(status); |
89 | } | 81 | } |
90 | 82 | ||
91 | return_ACPI_STATUS (AE_OK); | 83 | return_ACPI_STATUS(AE_OK); |
92 | } | 84 | } |
93 | 85 | ||
94 | |||
95 | /****************************************************************************** | 86 | /****************************************************************************** |
96 | * | 87 | * |
97 | * FUNCTION: acpi_hw_set_mode | 88 | * FUNCTION: acpi_hw_set_mode |
@@ -104,24 +95,21 @@ acpi_hw_initialize ( | |||
104 | * | 95 | * |
105 | ******************************************************************************/ | 96 | ******************************************************************************/ |
106 | 97 | ||
107 | acpi_status | 98 | acpi_status acpi_hw_set_mode(u32 mode) |
108 | acpi_hw_set_mode ( | ||
109 | u32 mode) | ||
110 | { | 99 | { |
111 | 100 | ||
112 | acpi_status status; | 101 | acpi_status status; |
113 | u32 retry; | 102 | u32 retry; |
114 | |||
115 | 103 | ||
116 | ACPI_FUNCTION_TRACE ("hw_set_mode"); | 104 | ACPI_FUNCTION_TRACE("hw_set_mode"); |
117 | 105 | ||
118 | /* | 106 | /* |
119 | * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, | 107 | * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, |
120 | * system does not support mode transition. | 108 | * system does not support mode transition. |
121 | */ | 109 | */ |
122 | if (!acpi_gbl_FADT->smi_cmd) { | 110 | if (!acpi_gbl_FADT->smi_cmd) { |
123 | ACPI_REPORT_ERROR (("No SMI_CMD in FADT, mode transition failed.\n")); | 111 | ACPI_REPORT_ERROR(("No SMI_CMD in FADT, mode transition failed.\n")); |
124 | return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); | 112 | return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); |
125 | } | 113 | } |
126 | 114 | ||
127 | /* | 115 | /* |
@@ -132,9 +120,8 @@ acpi_hw_set_mode ( | |||
132 | * transitions are not supported. | 120 | * transitions are not supported. |
133 | */ | 121 | */ |
134 | if (!acpi_gbl_FADT->acpi_enable && !acpi_gbl_FADT->acpi_disable) { | 122 | if (!acpi_gbl_FADT->acpi_enable && !acpi_gbl_FADT->acpi_disable) { |
135 | ACPI_REPORT_ERROR (( | 123 | ACPI_REPORT_ERROR(("No ACPI mode transition supported in this system (enable/disable both zero)\n")); |
136 | "No ACPI mode transition supported in this system (enable/disable both zero)\n")); | 124 | return_ACPI_STATUS(AE_OK); |
137 | return_ACPI_STATUS (AE_OK); | ||
138 | } | 125 | } |
139 | 126 | ||
140 | switch (mode) { | 127 | switch (mode) { |
@@ -142,9 +129,11 @@ acpi_hw_set_mode ( | |||
142 | 129 | ||
143 | /* BIOS should have disabled ALL fixed and GP events */ | 130 | /* BIOS should have disabled ALL fixed and GP events */ |
144 | 131 | ||
145 | status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, | 132 | status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd, |
146 | (u32) acpi_gbl_FADT->acpi_enable, 8); | 133 | (u32) acpi_gbl_FADT->acpi_enable, |
147 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n")); | 134 | 8); |
135 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
136 | "Attempting to enable ACPI mode\n")); | ||
148 | break; | 137 | break; |
149 | 138 | ||
150 | case ACPI_SYS_MODE_LEGACY: | 139 | case ACPI_SYS_MODE_LEGACY: |
@@ -153,20 +142,21 @@ acpi_hw_set_mode ( | |||
153 | * BIOS should clear all fixed status bits and restore fixed event | 142 | * BIOS should clear all fixed status bits and restore fixed event |
154 | * enable bits to default | 143 | * enable bits to default |
155 | */ | 144 | */ |
156 | status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, | 145 | status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd, |
157 | (u32) acpi_gbl_FADT->acpi_disable, 8); | 146 | (u32) acpi_gbl_FADT->acpi_disable, |
158 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 147 | 8); |
159 | "Attempting to enable Legacy (non-ACPI) mode\n")); | 148 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
149 | "Attempting to enable Legacy (non-ACPI) mode\n")); | ||
160 | break; | 150 | break; |
161 | 151 | ||
162 | default: | 152 | default: |
163 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 153 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
164 | } | 154 | } |
165 | 155 | ||
166 | if (ACPI_FAILURE (status)) { | 156 | if (ACPI_FAILURE(status)) { |
167 | ACPI_REPORT_ERROR (("Could not write mode change, %s\n", | 157 | ACPI_REPORT_ERROR(("Could not write mode change, %s\n", |
168 | acpi_format_exception (status))); | 158 | acpi_format_exception(status))); |
169 | return_ACPI_STATUS (status); | 159 | return_ACPI_STATUS(status); |
170 | } | 160 | } |
171 | 161 | ||
172 | /* | 162 | /* |
@@ -176,19 +166,19 @@ acpi_hw_set_mode ( | |||
176 | retry = 3000; | 166 | retry = 3000; |
177 | while (retry) { | 167 | while (retry) { |
178 | if (acpi_hw_get_mode() == mode) { | 168 | if (acpi_hw_get_mode() == mode) { |
179 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n", | 169 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
180 | mode)); | 170 | "Mode %X successfully enabled\n", |
181 | return_ACPI_STATUS (AE_OK); | 171 | mode)); |
172 | return_ACPI_STATUS(AE_OK); | ||
182 | } | 173 | } |
183 | acpi_os_stall(1000); | 174 | acpi_os_stall(1000); |
184 | retry--; | 175 | retry--; |
185 | } | 176 | } |
186 | 177 | ||
187 | ACPI_REPORT_ERROR (("Hardware never changed modes\n")); | 178 | ACPI_REPORT_ERROR(("Hardware never changed modes\n")); |
188 | return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); | 179 | return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); |
189 | } | 180 | } |
190 | 181 | ||
191 | |||
192 | /******************************************************************************* | 182 | /******************************************************************************* |
193 | * | 183 | * |
194 | * FUNCTION: acpi_hw_get_mode | 184 | * FUNCTION: acpi_hw_get_mode |
@@ -202,34 +192,30 @@ acpi_hw_set_mode ( | |||
202 | * | 192 | * |
203 | ******************************************************************************/ | 193 | ******************************************************************************/ |
204 | 194 | ||
205 | u32 | 195 | u32 acpi_hw_get_mode(void) |
206 | acpi_hw_get_mode ( | ||
207 | void) | ||
208 | { | 196 | { |
209 | acpi_status status; | 197 | acpi_status status; |
210 | u32 value; | 198 | u32 value; |
211 | |||
212 | |||
213 | ACPI_FUNCTION_TRACE ("hw_get_mode"); | ||
214 | 199 | ||
200 | ACPI_FUNCTION_TRACE("hw_get_mode"); | ||
215 | 201 | ||
216 | /* | 202 | /* |
217 | * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, | 203 | * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, |
218 | * system does not support mode transition. | 204 | * system does not support mode transition. |
219 | */ | 205 | */ |
220 | if (!acpi_gbl_FADT->smi_cmd) { | 206 | if (!acpi_gbl_FADT->smi_cmd) { |
221 | return_VALUE (ACPI_SYS_MODE_ACPI); | 207 | return_VALUE(ACPI_SYS_MODE_ACPI); |
222 | } | 208 | } |
223 | 209 | ||
224 | status = acpi_get_register (ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK); | 210 | status = |
225 | if (ACPI_FAILURE (status)) { | 211 | acpi_get_register(ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK); |
226 | return_VALUE (ACPI_SYS_MODE_LEGACY); | 212 | if (ACPI_FAILURE(status)) { |
213 | return_VALUE(ACPI_SYS_MODE_LEGACY); | ||
227 | } | 214 | } |
228 | 215 | ||
229 | if (value) { | 216 | if (value) { |
230 | return_VALUE (ACPI_SYS_MODE_ACPI); | 217 | return_VALUE(ACPI_SYS_MODE_ACPI); |
231 | } | 218 | } else { |
232 | else { | 219 | return_VALUE(ACPI_SYS_MODE_LEGACY); |
233 | return_VALUE (ACPI_SYS_MODE_LEGACY); | ||
234 | } | 220 | } |
235 | } | 221 | } |