diff options
Diffstat (limited to 'drivers/acpi/hardware/hwregs.c')
-rw-r--r-- | drivers/acpi/hardware/hwregs.c | 600 |
1 files changed, 290 insertions, 310 deletions
diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index 04a058565d8d..536a7aea80c9 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c | |||
@@ -50,8 +50,7 @@ | |||
50 | #include <acpi/acevents.h> | 50 | #include <acpi/acevents.h> |
51 | 51 | ||
52 | #define _COMPONENT ACPI_HARDWARE | 52 | #define _COMPONENT ACPI_HARDWARE |
53 | ACPI_MODULE_NAME ("hwregs") | 53 | ACPI_MODULE_NAME("hwregs") |
54 | |||
55 | 54 | ||
56 | /******************************************************************************* | 55 | /******************************************************************************* |
57 | * | 56 | * |
@@ -65,57 +64,52 @@ | |||
65 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED | 64 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED |
66 | * | 65 | * |
67 | ******************************************************************************/ | 66 | ******************************************************************************/ |
68 | 67 | acpi_status acpi_hw_clear_acpi_status(u32 flags) | |
69 | acpi_status | ||
70 | acpi_hw_clear_acpi_status ( | ||
71 | u32 flags) | ||
72 | { | 68 | { |
73 | acpi_status status; | 69 | acpi_status status; |
74 | |||
75 | 70 | ||
76 | ACPI_FUNCTION_TRACE ("hw_clear_acpi_status"); | 71 | ACPI_FUNCTION_TRACE("hw_clear_acpi_status"); |
77 | 72 | ||
78 | 73 | ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n", | |
79 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %04X\n", | 74 | ACPI_BITMASK_ALL_FIXED_STATUS, |
80 | ACPI_BITMASK_ALL_FIXED_STATUS, | 75 | (u16) acpi_gbl_FADT->xpm1a_evt_blk.address)); |
81 | (u16) acpi_gbl_FADT->xpm1a_evt_blk.address)); | ||
82 | 76 | ||
83 | if (flags & ACPI_MTX_LOCK) { | 77 | if (flags & ACPI_MTX_LOCK) { |
84 | status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE); | 78 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); |
85 | if (ACPI_FAILURE (status)) { | 79 | if (ACPI_FAILURE(status)) { |
86 | return_ACPI_STATUS (status); | 80 | return_ACPI_STATUS(status); |
87 | } | 81 | } |
88 | } | 82 | } |
89 | 83 | ||
90 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, | 84 | status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, |
91 | ACPI_REGISTER_PM1_STATUS, | 85 | ACPI_REGISTER_PM1_STATUS, |
92 | ACPI_BITMASK_ALL_FIXED_STATUS); | 86 | ACPI_BITMASK_ALL_FIXED_STATUS); |
93 | if (ACPI_FAILURE (status)) { | 87 | if (ACPI_FAILURE(status)) { |
94 | goto unlock_and_exit; | 88 | goto unlock_and_exit; |
95 | } | 89 | } |
96 | 90 | ||
97 | /* Clear the fixed events */ | 91 | /* Clear the fixed events */ |
98 | 92 | ||
99 | if (acpi_gbl_FADT->xpm1b_evt_blk.address) { | 93 | if (acpi_gbl_FADT->xpm1b_evt_blk.address) { |
100 | status = acpi_hw_low_level_write (16, ACPI_BITMASK_ALL_FIXED_STATUS, | 94 | status = |
101 | &acpi_gbl_FADT->xpm1b_evt_blk); | 95 | acpi_hw_low_level_write(16, ACPI_BITMASK_ALL_FIXED_STATUS, |
102 | if (ACPI_FAILURE (status)) { | 96 | &acpi_gbl_FADT->xpm1b_evt_blk); |
97 | if (ACPI_FAILURE(status)) { | ||
103 | goto unlock_and_exit; | 98 | goto unlock_and_exit; |
104 | } | 99 | } |
105 | } | 100 | } |
106 | 101 | ||
107 | /* Clear the GPE Bits in all GPE registers in all GPE blocks */ | 102 | /* Clear the GPE Bits in all GPE registers in all GPE blocks */ |
108 | 103 | ||
109 | status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block); | 104 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); |
110 | 105 | ||
111 | unlock_and_exit: | 106 | unlock_and_exit: |
112 | if (flags & ACPI_MTX_LOCK) { | 107 | if (flags & ACPI_MTX_LOCK) { |
113 | (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE); | 108 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); |
114 | } | 109 | } |
115 | return_ACPI_STATUS (status); | 110 | return_ACPI_STATUS(status); |
116 | } | 111 | } |
117 | 112 | ||
118 | |||
119 | /******************************************************************************* | 113 | /******************************************************************************* |
120 | * | 114 | * |
121 | * FUNCTION: acpi_get_sleep_type_data | 115 | * FUNCTION: acpi_get_sleep_type_data |
@@ -132,53 +126,48 @@ unlock_and_exit: | |||
132 | ******************************************************************************/ | 126 | ******************************************************************************/ |
133 | 127 | ||
134 | acpi_status | 128 | acpi_status |
135 | acpi_get_sleep_type_data ( | 129 | acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) |
136 | u8 sleep_state, | ||
137 | u8 *sleep_type_a, | ||
138 | u8 *sleep_type_b) | ||
139 | { | 130 | { |
140 | acpi_status status = AE_OK; | 131 | acpi_status status = AE_OK; |
141 | struct acpi_parameter_info info; | 132 | struct acpi_parameter_info info; |
142 | char *sleep_state_name; | 133 | char *sleep_state_name; |
143 | |||
144 | |||
145 | ACPI_FUNCTION_TRACE ("acpi_get_sleep_type_data"); | ||
146 | 134 | ||
135 | ACPI_FUNCTION_TRACE("acpi_get_sleep_type_data"); | ||
147 | 136 | ||
148 | /* Validate parameters */ | 137 | /* Validate parameters */ |
149 | 138 | ||
150 | if ((sleep_state > ACPI_S_STATES_MAX) || | 139 | if ((sleep_state > ACPI_S_STATES_MAX) || !sleep_type_a || !sleep_type_b) { |
151 | !sleep_type_a || !sleep_type_b) { | 140 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
152 | return_ACPI_STATUS (AE_BAD_PARAMETER); | ||
153 | } | 141 | } |
154 | 142 | ||
155 | /* Evaluate the namespace object containing the values for this state */ | 143 | /* Evaluate the namespace object containing the values for this state */ |
156 | 144 | ||
157 | info.parameters = NULL; | 145 | info.parameters = NULL; |
158 | info.return_object = NULL; | 146 | info.return_object = NULL; |
159 | sleep_state_name = (char *) acpi_gbl_sleep_state_names[sleep_state]; | 147 | sleep_state_name = (char *)acpi_gbl_sleep_state_names[sleep_state]; |
160 | 148 | ||
161 | status = acpi_ns_evaluate_by_name (sleep_state_name, &info); | 149 | status = acpi_ns_evaluate_by_name(sleep_state_name, &info); |
162 | if (ACPI_FAILURE (status)) { | 150 | if (ACPI_FAILURE(status)) { |
163 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 151 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
164 | "%s while evaluating sleep_state [%s]\n", | 152 | "%s while evaluating sleep_state [%s]\n", |
165 | acpi_format_exception (status), sleep_state_name)); | 153 | acpi_format_exception(status), |
154 | sleep_state_name)); | ||
166 | 155 | ||
167 | return_ACPI_STATUS (status); | 156 | return_ACPI_STATUS(status); |
168 | } | 157 | } |
169 | 158 | ||
170 | /* Must have a return object */ | 159 | /* Must have a return object */ |
171 | 160 | ||
172 | if (!info.return_object) { | 161 | if (!info.return_object) { |
173 | ACPI_REPORT_ERROR (("No Sleep State object returned from [%s]\n", | 162 | ACPI_REPORT_ERROR(("No Sleep State object returned from [%s]\n", |
174 | sleep_state_name)); | 163 | sleep_state_name)); |
175 | status = AE_NOT_EXIST; | 164 | status = AE_NOT_EXIST; |
176 | } | 165 | } |
177 | 166 | ||
178 | /* It must be of type Package */ | 167 | /* It must be of type Package */ |
179 | 168 | ||
180 | else if (ACPI_GET_OBJECT_TYPE (info.return_object) != ACPI_TYPE_PACKAGE) { | 169 | else if (ACPI_GET_OBJECT_TYPE(info.return_object) != ACPI_TYPE_PACKAGE) { |
181 | ACPI_REPORT_ERROR (("Sleep State return object is not a Package\n")); | 170 | ACPI_REPORT_ERROR(("Sleep State return object is not a Package\n")); |
182 | status = AE_AML_OPERAND_TYPE; | 171 | status = AE_AML_OPERAND_TYPE; |
183 | } | 172 | } |
184 | 173 | ||
@@ -190,45 +179,41 @@ acpi_get_sleep_type_data ( | |||
190 | * one per sleep type (A/B). | 179 | * one per sleep type (A/B). |
191 | */ | 180 | */ |
192 | else if (info.return_object->package.count < 2) { | 181 | else if (info.return_object->package.count < 2) { |
193 | ACPI_REPORT_ERROR (( | 182 | ACPI_REPORT_ERROR(("Sleep State return package does not have at least two elements\n")); |
194 | "Sleep State return package does not have at least two elements\n")); | ||
195 | status = AE_AML_NO_OPERAND; | 183 | status = AE_AML_NO_OPERAND; |
196 | } | 184 | } |
197 | 185 | ||
198 | /* The first two elements must both be of type Integer */ | 186 | /* The first two elements must both be of type Integer */ |
199 | 187 | ||
200 | else if ((ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[0]) | 188 | else if ((ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[0]) |
201 | != ACPI_TYPE_INTEGER) || | 189 | != ACPI_TYPE_INTEGER) || |
202 | (ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[1]) | 190 | (ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[1]) |
203 | != ACPI_TYPE_INTEGER)) { | 191 | != ACPI_TYPE_INTEGER)) { |
204 | ACPI_REPORT_ERROR (( | 192 | ACPI_REPORT_ERROR(("Sleep State return package elements are not both Integers (%s, %s)\n", acpi_ut_get_object_type_name(info.return_object->package.elements[0]), acpi_ut_get_object_type_name(info.return_object->package.elements[1]))); |
205 | "Sleep State return package elements are not both Integers (%s, %s)\n", | ||
206 | acpi_ut_get_object_type_name (info.return_object->package.elements[0]), | ||
207 | acpi_ut_get_object_type_name (info.return_object->package.elements[1]))); | ||
208 | status = AE_AML_OPERAND_TYPE; | 193 | status = AE_AML_OPERAND_TYPE; |
209 | } | 194 | } else { |
210 | else { | ||
211 | /* Valid _Sx_ package size, type, and value */ | 195 | /* Valid _Sx_ package size, type, and value */ |
212 | 196 | ||
213 | *sleep_type_a = (u8) | 197 | *sleep_type_a = (u8) |
214 | (info.return_object->package.elements[0])->integer.value; | 198 | (info.return_object->package.elements[0])->integer.value; |
215 | *sleep_type_b = (u8) | 199 | *sleep_type_b = (u8) |
216 | (info.return_object->package.elements[1])->integer.value; | 200 | (info.return_object->package.elements[1])->integer.value; |
217 | } | 201 | } |
218 | 202 | ||
219 | if (ACPI_FAILURE (status)) { | 203 | if (ACPI_FAILURE(status)) { |
220 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 204 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
221 | "%s While evaluating sleep_state [%s], bad Sleep object %p type %s\n", | 205 | "%s While evaluating sleep_state [%s], bad Sleep object %p type %s\n", |
222 | acpi_format_exception (status), | 206 | acpi_format_exception(status), |
223 | sleep_state_name, info.return_object, | 207 | sleep_state_name, info.return_object, |
224 | acpi_ut_get_object_type_name (info.return_object))); | 208 | acpi_ut_get_object_type_name(info. |
209 | return_object))); | ||
225 | } | 210 | } |
226 | 211 | ||
227 | acpi_ut_remove_reference (info.return_object); | 212 | acpi_ut_remove_reference(info.return_object); |
228 | return_ACPI_STATUS (status); | 213 | return_ACPI_STATUS(status); |
229 | } | 214 | } |
230 | EXPORT_SYMBOL(acpi_get_sleep_type_data); | ||
231 | 215 | ||
216 | EXPORT_SYMBOL(acpi_get_sleep_type_data); | ||
232 | 217 | ||
233 | /******************************************************************************* | 218 | /******************************************************************************* |
234 | * | 219 | * |
@@ -242,22 +227,20 @@ EXPORT_SYMBOL(acpi_get_sleep_type_data); | |||
242 | * | 227 | * |
243 | ******************************************************************************/ | 228 | ******************************************************************************/ |
244 | 229 | ||
245 | struct acpi_bit_register_info * | 230 | struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) |
246 | acpi_hw_get_bit_register_info ( | ||
247 | u32 register_id) | ||
248 | { | 231 | { |
249 | ACPI_FUNCTION_NAME ("hw_get_bit_register_info"); | 232 | ACPI_FUNCTION_NAME("hw_get_bit_register_info"); |
250 | |||
251 | 233 | ||
252 | if (register_id > ACPI_BITREG_MAX) { | 234 | if (register_id > ACPI_BITREG_MAX) { |
253 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid bit_register ID: %X\n", register_id)); | 235 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
236 | "Invalid bit_register ID: %X\n", | ||
237 | register_id)); | ||
254 | return (NULL); | 238 | return (NULL); |
255 | } | 239 | } |
256 | 240 | ||
257 | return (&acpi_gbl_bit_register_info[register_id]); | 241 | return (&acpi_gbl_bit_register_info[register_id]); |
258 | } | 242 | } |
259 | 243 | ||
260 | |||
261 | /******************************************************************************* | 244 | /******************************************************************************* |
262 | * | 245 | * |
263 | * FUNCTION: acpi_get_register | 246 | * FUNCTION: acpi_get_register |
@@ -273,59 +256,56 @@ acpi_hw_get_bit_register_info ( | |||
273 | * | 256 | * |
274 | ******************************************************************************/ | 257 | ******************************************************************************/ |
275 | 258 | ||
276 | acpi_status | 259 | acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) |
277 | acpi_get_register ( | ||
278 | u32 register_id, | ||
279 | u32 *return_value, | ||
280 | u32 flags) | ||
281 | { | 260 | { |
282 | u32 register_value = 0; | 261 | u32 register_value = 0; |
283 | struct acpi_bit_register_info *bit_reg_info; | 262 | struct acpi_bit_register_info *bit_reg_info; |
284 | acpi_status status; | 263 | acpi_status status; |
285 | |||
286 | |||
287 | ACPI_FUNCTION_TRACE ("acpi_get_register"); | ||
288 | 264 | ||
265 | ACPI_FUNCTION_TRACE("acpi_get_register"); | ||
289 | 266 | ||
290 | /* Get the info structure corresponding to the requested ACPI Register */ | 267 | /* Get the info structure corresponding to the requested ACPI Register */ |
291 | 268 | ||
292 | bit_reg_info = acpi_hw_get_bit_register_info (register_id); | 269 | bit_reg_info = acpi_hw_get_bit_register_info(register_id); |
293 | if (!bit_reg_info) { | 270 | if (!bit_reg_info) { |
294 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 271 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
295 | } | 272 | } |
296 | 273 | ||
297 | if (flags & ACPI_MTX_LOCK) { | 274 | if (flags & ACPI_MTX_LOCK) { |
298 | status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE); | 275 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); |
299 | if (ACPI_FAILURE (status)) { | 276 | if (ACPI_FAILURE(status)) { |
300 | return_ACPI_STATUS (status); | 277 | return_ACPI_STATUS(status); |
301 | } | 278 | } |
302 | } | 279 | } |
303 | 280 | ||
304 | /* Read from the register */ | 281 | /* Read from the register */ |
305 | 282 | ||
306 | status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, | 283 | status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, |
307 | bit_reg_info->parent_register, ®ister_value); | 284 | bit_reg_info->parent_register, |
285 | ®ister_value); | ||
308 | 286 | ||
309 | if (flags & ACPI_MTX_LOCK) { | 287 | if (flags & ACPI_MTX_LOCK) { |
310 | (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE); | 288 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); |
311 | } | 289 | } |
312 | 290 | ||
313 | if (ACPI_SUCCESS (status)) { | 291 | if (ACPI_SUCCESS(status)) { |
314 | /* Normalize the value that was read */ | 292 | /* Normalize the value that was read */ |
315 | 293 | ||
316 | register_value = ((register_value & bit_reg_info->access_bit_mask) | 294 | register_value = |
317 | >> bit_reg_info->bit_position); | 295 | ((register_value & bit_reg_info->access_bit_mask) |
296 | >> bit_reg_info->bit_position); | ||
318 | 297 | ||
319 | *return_value = register_value; | 298 | *return_value = register_value; |
320 | 299 | ||
321 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read value %8.8X register %X\n", | 300 | ACPI_DEBUG_PRINT((ACPI_DB_IO, "Read value %8.8X register %X\n", |
322 | register_value, bit_reg_info->parent_register)); | 301 | register_value, |
302 | bit_reg_info->parent_register)); | ||
323 | } | 303 | } |
324 | 304 | ||
325 | return_ACPI_STATUS (status); | 305 | return_ACPI_STATUS(status); |
326 | } | 306 | } |
327 | EXPORT_SYMBOL(acpi_get_register); | ||
328 | 307 | ||
308 | EXPORT_SYMBOL(acpi_get_register); | ||
329 | 309 | ||
330 | /******************************************************************************* | 310 | /******************************************************************************* |
331 | * | 311 | * |
@@ -342,40 +322,36 @@ EXPORT_SYMBOL(acpi_get_register); | |||
342 | * | 322 | * |
343 | ******************************************************************************/ | 323 | ******************************************************************************/ |
344 | 324 | ||
345 | acpi_status | 325 | acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) |
346 | acpi_set_register ( | ||
347 | u32 register_id, | ||
348 | u32 value, | ||
349 | u32 flags) | ||
350 | { | 326 | { |
351 | u32 register_value = 0; | 327 | u32 register_value = 0; |
352 | struct acpi_bit_register_info *bit_reg_info; | 328 | struct acpi_bit_register_info *bit_reg_info; |
353 | acpi_status status; | 329 | acpi_status status; |
354 | |||
355 | |||
356 | ACPI_FUNCTION_TRACE_U32 ("acpi_set_register", register_id); | ||
357 | 330 | ||
331 | ACPI_FUNCTION_TRACE_U32("acpi_set_register", register_id); | ||
358 | 332 | ||
359 | /* Get the info structure corresponding to the requested ACPI Register */ | 333 | /* Get the info structure corresponding to the requested ACPI Register */ |
360 | 334 | ||
361 | bit_reg_info = acpi_hw_get_bit_register_info (register_id); | 335 | bit_reg_info = acpi_hw_get_bit_register_info(register_id); |
362 | if (!bit_reg_info) { | 336 | if (!bit_reg_info) { |
363 | ACPI_REPORT_ERROR (("Bad ACPI HW register_id: %X\n", register_id)); | 337 | ACPI_REPORT_ERROR(("Bad ACPI HW register_id: %X\n", |
364 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 338 | register_id)); |
339 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
365 | } | 340 | } |
366 | 341 | ||
367 | if (flags & ACPI_MTX_LOCK) { | 342 | if (flags & ACPI_MTX_LOCK) { |
368 | status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE); | 343 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); |
369 | if (ACPI_FAILURE (status)) { | 344 | if (ACPI_FAILURE(status)) { |
370 | return_ACPI_STATUS (status); | 345 | return_ACPI_STATUS(status); |
371 | } | 346 | } |
372 | } | 347 | } |
373 | 348 | ||
374 | /* Always do a register read first so we can insert the new bits */ | 349 | /* Always do a register read first so we can insert the new bits */ |
375 | 350 | ||
376 | status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, | 351 | status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, |
377 | bit_reg_info->parent_register, ®ister_value); | 352 | bit_reg_info->parent_register, |
378 | if (ACPI_FAILURE (status)) { | 353 | ®ister_value); |
354 | if (ACPI_FAILURE(status)) { | ||
379 | goto unlock_and_exit; | 355 | goto unlock_and_exit; |
380 | } | 356 | } |
381 | 357 | ||
@@ -395,26 +371,30 @@ acpi_set_register ( | |||
395 | * information is the single bit we're interested in, all others should | 371 | * information is the single bit we're interested in, all others should |
396 | * be written as 0 so they will be left unchanged. | 372 | * be written as 0 so they will be left unchanged. |
397 | */ | 373 | */ |
398 | value = ACPI_REGISTER_PREPARE_BITS (value, | 374 | value = ACPI_REGISTER_PREPARE_BITS(value, |
399 | bit_reg_info->bit_position, bit_reg_info->access_bit_mask); | 375 | bit_reg_info->bit_position, |
376 | bit_reg_info-> | ||
377 | access_bit_mask); | ||
400 | if (value) { | 378 | if (value) { |
401 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, | 379 | status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, |
402 | ACPI_REGISTER_PM1_STATUS, (u16) value); | 380 | ACPI_REGISTER_PM1_STATUS, |
381 | (u16) value); | ||
403 | register_value = 0; | 382 | register_value = 0; |
404 | } | 383 | } |
405 | break; | 384 | break; |
406 | 385 | ||
407 | |||
408 | case ACPI_REGISTER_PM1_ENABLE: | 386 | case ACPI_REGISTER_PM1_ENABLE: |
409 | 387 | ||
410 | ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position, | 388 | ACPI_REGISTER_INSERT_VALUE(register_value, |
411 | bit_reg_info->access_bit_mask, value); | 389 | bit_reg_info->bit_position, |
390 | bit_reg_info->access_bit_mask, | ||
391 | value); | ||
412 | 392 | ||
413 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, | 393 | status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, |
414 | ACPI_REGISTER_PM1_ENABLE, (u16) register_value); | 394 | ACPI_REGISTER_PM1_ENABLE, |
395 | (u16) register_value); | ||
415 | break; | 396 | break; |
416 | 397 | ||
417 | |||
418 | case ACPI_REGISTER_PM1_CONTROL: | 398 | case ACPI_REGISTER_PM1_CONTROL: |
419 | 399 | ||
420 | /* | 400 | /* |
@@ -422,65 +402,73 @@ acpi_set_register ( | |||
422 | * Note that at this level, the fact that there are actually TWO | 402 | * Note that at this level, the fact that there are actually TWO |
423 | * registers (A and B - and B may not exist) is abstracted. | 403 | * registers (A and B - and B may not exist) is abstracted. |
424 | */ | 404 | */ |
425 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM1 control: Read %X\n", register_value)); | 405 | ACPI_DEBUG_PRINT((ACPI_DB_IO, "PM1 control: Read %X\n", |
406 | register_value)); | ||
426 | 407 | ||
427 | ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position, | 408 | ACPI_REGISTER_INSERT_VALUE(register_value, |
428 | bit_reg_info->access_bit_mask, value); | 409 | bit_reg_info->bit_position, |
410 | bit_reg_info->access_bit_mask, | ||
411 | value); | ||
429 | 412 | ||
430 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, | 413 | status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, |
431 | ACPI_REGISTER_PM1_CONTROL, (u16) register_value); | 414 | ACPI_REGISTER_PM1_CONTROL, |
415 | (u16) register_value); | ||
432 | break; | 416 | break; |
433 | 417 | ||
434 | |||
435 | case ACPI_REGISTER_PM2_CONTROL: | 418 | case ACPI_REGISTER_PM2_CONTROL: |
436 | 419 | ||
437 | status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, | 420 | status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, |
438 | ACPI_REGISTER_PM2_CONTROL, ®ister_value); | 421 | ACPI_REGISTER_PM2_CONTROL, |
439 | if (ACPI_FAILURE (status)) { | 422 | ®ister_value); |
423 | if (ACPI_FAILURE(status)) { | ||
440 | goto unlock_and_exit; | 424 | goto unlock_and_exit; |
441 | } | 425 | } |
442 | 426 | ||
443 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n", | 427 | ACPI_DEBUG_PRINT((ACPI_DB_IO, |
444 | register_value, | 428 | "PM2 control: Read %X from %8.8X%8.8X\n", |
445 | ACPI_FORMAT_UINT64 ( | 429 | register_value, |
446 | acpi_gbl_FADT->xpm2_cnt_blk.address))); | 430 | ACPI_FORMAT_UINT64(acpi_gbl_FADT-> |
447 | 431 | xpm2_cnt_blk.address))); | |
448 | ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position, | 432 | |
449 | bit_reg_info->access_bit_mask, value); | 433 | ACPI_REGISTER_INSERT_VALUE(register_value, |
450 | 434 | bit_reg_info->bit_position, | |
451 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n", | 435 | bit_reg_info->access_bit_mask, |
452 | register_value, | 436 | value); |
453 | ACPI_FORMAT_UINT64 ( | 437 | |
454 | acpi_gbl_FADT->xpm2_cnt_blk.address))); | 438 | ACPI_DEBUG_PRINT((ACPI_DB_IO, |
455 | 439 | "About to write %4.4X to %8.8X%8.8X\n", | |
456 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, | 440 | register_value, |
457 | ACPI_REGISTER_PM2_CONTROL, (u8) (register_value)); | 441 | ACPI_FORMAT_UINT64(acpi_gbl_FADT-> |
442 | xpm2_cnt_blk.address))); | ||
443 | |||
444 | status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, | ||
445 | ACPI_REGISTER_PM2_CONTROL, | ||
446 | (u8) (register_value)); | ||
458 | break; | 447 | break; |
459 | 448 | ||
460 | |||
461 | default: | 449 | default: |
462 | break; | 450 | break; |
463 | } | 451 | } |
464 | 452 | ||
465 | 453 | unlock_and_exit: | |
466 | unlock_and_exit: | ||
467 | 454 | ||
468 | if (flags & ACPI_MTX_LOCK) { | 455 | if (flags & ACPI_MTX_LOCK) { |
469 | (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE); | 456 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); |
470 | } | 457 | } |
471 | 458 | ||
472 | /* Normalize the value that was read */ | 459 | /* Normalize the value that was read */ |
473 | 460 | ||
474 | ACPI_DEBUG_EXEC (register_value = | 461 | ACPI_DEBUG_EXEC(register_value = |
475 | ((register_value & bit_reg_info->access_bit_mask) >> | 462 | ((register_value & bit_reg_info->access_bit_mask) >> |
476 | bit_reg_info->bit_position)); | 463 | bit_reg_info->bit_position)); |
477 | 464 | ||
478 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n", | 465 | ACPI_DEBUG_PRINT((ACPI_DB_IO, |
479 | value, register_value, bit_reg_info->parent_register)); | 466 | "Set bits: %8.8X actual %8.8X register %X\n", value, |
480 | return_ACPI_STATUS (status); | 467 | register_value, bit_reg_info->parent_register)); |
468 | return_ACPI_STATUS(status); | ||
481 | } | 469 | } |
482 | EXPORT_SYMBOL(acpi_set_register); | ||
483 | 470 | ||
471 | EXPORT_SYMBOL(acpi_set_register); | ||
484 | 472 | ||
485 | /****************************************************************************** | 473 | /****************************************************************************** |
486 | * | 474 | * |
@@ -498,103 +486,107 @@ EXPORT_SYMBOL(acpi_set_register); | |||
498 | ******************************************************************************/ | 486 | ******************************************************************************/ |
499 | 487 | ||
500 | acpi_status | 488 | acpi_status |
501 | acpi_hw_register_read ( | 489 | acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) |
502 | u8 use_lock, | ||
503 | u32 register_id, | ||
504 | u32 *return_value) | ||
505 | { | 490 | { |
506 | u32 value1 = 0; | 491 | u32 value1 = 0; |
507 | u32 value2 = 0; | 492 | u32 value2 = 0; |
508 | acpi_status status; | 493 | acpi_status status; |
509 | |||
510 | |||
511 | ACPI_FUNCTION_TRACE ("hw_register_read"); | ||
512 | 494 | ||
495 | ACPI_FUNCTION_TRACE("hw_register_read"); | ||
513 | 496 | ||
514 | if (ACPI_MTX_LOCK == use_lock) { | 497 | if (ACPI_MTX_LOCK == use_lock) { |
515 | status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE); | 498 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); |
516 | if (ACPI_FAILURE (status)) { | 499 | if (ACPI_FAILURE(status)) { |
517 | return_ACPI_STATUS (status); | 500 | return_ACPI_STATUS(status); |
518 | } | 501 | } |
519 | } | 502 | } |
520 | 503 | ||
521 | switch (register_id) { | 504 | switch (register_id) { |
522 | case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ | 505 | case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ |
523 | 506 | ||
524 | status = acpi_hw_low_level_read (16, &value1, &acpi_gbl_FADT->xpm1a_evt_blk); | 507 | status = |
525 | if (ACPI_FAILURE (status)) { | 508 | acpi_hw_low_level_read(16, &value1, |
509 | &acpi_gbl_FADT->xpm1a_evt_blk); | ||
510 | if (ACPI_FAILURE(status)) { | ||
526 | goto unlock_and_exit; | 511 | goto unlock_and_exit; |
527 | } | 512 | } |
528 | 513 | ||
529 | /* PM1B is optional */ | 514 | /* PM1B is optional */ |
530 | 515 | ||
531 | status = acpi_hw_low_level_read (16, &value2, &acpi_gbl_FADT->xpm1b_evt_blk); | 516 | status = |
517 | acpi_hw_low_level_read(16, &value2, | ||
518 | &acpi_gbl_FADT->xpm1b_evt_blk); | ||
532 | value1 |= value2; | 519 | value1 |= value2; |
533 | break; | 520 | break; |
534 | 521 | ||
522 | case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */ | ||
535 | 523 | ||
536 | case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */ | 524 | status = |
537 | 525 | acpi_hw_low_level_read(16, &value1, &acpi_gbl_xpm1a_enable); | |
538 | status = acpi_hw_low_level_read (16, &value1, &acpi_gbl_xpm1a_enable); | 526 | if (ACPI_FAILURE(status)) { |
539 | if (ACPI_FAILURE (status)) { | ||
540 | goto unlock_and_exit; | 527 | goto unlock_and_exit; |
541 | } | 528 | } |
542 | 529 | ||
543 | /* PM1B is optional */ | 530 | /* PM1B is optional */ |
544 | 531 | ||
545 | status = acpi_hw_low_level_read (16, &value2, &acpi_gbl_xpm1b_enable); | 532 | status = |
533 | acpi_hw_low_level_read(16, &value2, &acpi_gbl_xpm1b_enable); | ||
546 | value1 |= value2; | 534 | value1 |= value2; |
547 | break; | 535 | break; |
548 | 536 | ||
537 | case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ | ||
549 | 538 | ||
550 | case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ | 539 | status = |
551 | 540 | acpi_hw_low_level_read(16, &value1, | |
552 | status = acpi_hw_low_level_read (16, &value1, &acpi_gbl_FADT->xpm1a_cnt_blk); | 541 | &acpi_gbl_FADT->xpm1a_cnt_blk); |
553 | if (ACPI_FAILURE (status)) { | 542 | if (ACPI_FAILURE(status)) { |
554 | goto unlock_and_exit; | 543 | goto unlock_and_exit; |
555 | } | 544 | } |
556 | 545 | ||
557 | status = acpi_hw_low_level_read (16, &value2, &acpi_gbl_FADT->xpm1b_cnt_blk); | 546 | status = |
547 | acpi_hw_low_level_read(16, &value2, | ||
548 | &acpi_gbl_FADT->xpm1b_cnt_blk); | ||
558 | value1 |= value2; | 549 | value1 |= value2; |
559 | break; | 550 | break; |
560 | 551 | ||
552 | case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ | ||
561 | 553 | ||
562 | case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ | 554 | status = |
563 | 555 | acpi_hw_low_level_read(8, &value1, | |
564 | status = acpi_hw_low_level_read (8, &value1, &acpi_gbl_FADT->xpm2_cnt_blk); | 556 | &acpi_gbl_FADT->xpm2_cnt_blk); |
565 | break; | 557 | break; |
566 | 558 | ||
559 | case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ | ||
567 | 560 | ||
568 | case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ | 561 | status = |
569 | 562 | acpi_hw_low_level_read(32, &value1, | |
570 | status = acpi_hw_low_level_read (32, &value1, &acpi_gbl_FADT->xpm_tmr_blk); | 563 | &acpi_gbl_FADT->xpm_tmr_blk); |
571 | break; | 564 | break; |
572 | 565 | ||
573 | case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ | 566 | case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ |
574 | 567 | ||
575 | status = acpi_os_read_port (acpi_gbl_FADT->smi_cmd, &value1, 8); | 568 | status = acpi_os_read_port(acpi_gbl_FADT->smi_cmd, &value1, 8); |
576 | break; | 569 | break; |
577 | 570 | ||
578 | default: | 571 | default: |
579 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n", | 572 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown Register ID: %X\n", |
580 | register_id)); | 573 | register_id)); |
581 | status = AE_BAD_PARAMETER; | 574 | status = AE_BAD_PARAMETER; |
582 | break; | 575 | break; |
583 | } | 576 | } |
584 | 577 | ||
585 | unlock_and_exit: | 578 | unlock_and_exit: |
586 | if (ACPI_MTX_LOCK == use_lock) { | 579 | if (ACPI_MTX_LOCK == use_lock) { |
587 | (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE); | 580 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); |
588 | } | 581 | } |
589 | 582 | ||
590 | if (ACPI_SUCCESS (status)) { | 583 | if (ACPI_SUCCESS(status)) { |
591 | *return_value = value1; | 584 | *return_value = value1; |
592 | } | 585 | } |
593 | 586 | ||
594 | return_ACPI_STATUS (status); | 587 | return_ACPI_STATUS(status); |
595 | } | 588 | } |
596 | 589 | ||
597 | |||
598 | /****************************************************************************** | 590 | /****************************************************************************** |
599 | * | 591 | * |
600 | * FUNCTION: acpi_hw_register_write | 592 | * FUNCTION: acpi_hw_register_write |
@@ -610,109 +602,112 @@ unlock_and_exit: | |||
610 | * | 602 | * |
611 | ******************************************************************************/ | 603 | ******************************************************************************/ |
612 | 604 | ||
613 | acpi_status | 605 | acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) |
614 | acpi_hw_register_write ( | ||
615 | u8 use_lock, | ||
616 | u32 register_id, | ||
617 | u32 value) | ||
618 | { | 606 | { |
619 | acpi_status status; | 607 | acpi_status status; |
620 | |||
621 | |||
622 | ACPI_FUNCTION_TRACE ("hw_register_write"); | ||
623 | 608 | ||
609 | ACPI_FUNCTION_TRACE("hw_register_write"); | ||
624 | 610 | ||
625 | if (ACPI_MTX_LOCK == use_lock) { | 611 | if (ACPI_MTX_LOCK == use_lock) { |
626 | status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE); | 612 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); |
627 | if (ACPI_FAILURE (status)) { | 613 | if (ACPI_FAILURE(status)) { |
628 | return_ACPI_STATUS (status); | 614 | return_ACPI_STATUS(status); |
629 | } | 615 | } |
630 | } | 616 | } |
631 | 617 | ||
632 | switch (register_id) { | 618 | switch (register_id) { |
633 | case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ | 619 | case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ |
634 | 620 | ||
635 | status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1a_evt_blk); | 621 | status = |
636 | if (ACPI_FAILURE (status)) { | 622 | acpi_hw_low_level_write(16, value, |
623 | &acpi_gbl_FADT->xpm1a_evt_blk); | ||
624 | if (ACPI_FAILURE(status)) { | ||
637 | goto unlock_and_exit; | 625 | goto unlock_and_exit; |
638 | } | 626 | } |
639 | 627 | ||
640 | /* PM1B is optional */ | 628 | /* PM1B is optional */ |
641 | 629 | ||
642 | status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1b_evt_blk); | 630 | status = |
631 | acpi_hw_low_level_write(16, value, | ||
632 | &acpi_gbl_FADT->xpm1b_evt_blk); | ||
643 | break; | 633 | break; |
644 | 634 | ||
635 | case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */ | ||
645 | 636 | ||
646 | case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access*/ | 637 | status = |
647 | 638 | acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1a_enable); | |
648 | status = acpi_hw_low_level_write (16, value, &acpi_gbl_xpm1a_enable); | 639 | if (ACPI_FAILURE(status)) { |
649 | if (ACPI_FAILURE (status)) { | ||
650 | goto unlock_and_exit; | 640 | goto unlock_and_exit; |
651 | } | 641 | } |
652 | 642 | ||
653 | /* PM1B is optional */ | 643 | /* PM1B is optional */ |
654 | 644 | ||
655 | status = acpi_hw_low_level_write (16, value, &acpi_gbl_xpm1b_enable); | 645 | status = |
646 | acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1b_enable); | ||
656 | break; | 647 | break; |
657 | 648 | ||
649 | case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ | ||
658 | 650 | ||
659 | case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ | 651 | status = |
660 | 652 | acpi_hw_low_level_write(16, value, | |
661 | status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1a_cnt_blk); | 653 | &acpi_gbl_FADT->xpm1a_cnt_blk); |
662 | if (ACPI_FAILURE (status)) { | 654 | if (ACPI_FAILURE(status)) { |
663 | goto unlock_and_exit; | 655 | goto unlock_and_exit; |
664 | } | 656 | } |
665 | 657 | ||
666 | status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1b_cnt_blk); | 658 | status = |
659 | acpi_hw_low_level_write(16, value, | ||
660 | &acpi_gbl_FADT->xpm1b_cnt_blk); | ||
667 | break; | 661 | break; |
668 | 662 | ||
663 | case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */ | ||
669 | 664 | ||
670 | case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */ | 665 | status = |
671 | 666 | acpi_hw_low_level_write(16, value, | |
672 | status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1a_cnt_blk); | 667 | &acpi_gbl_FADT->xpm1a_cnt_blk); |
673 | break; | 668 | break; |
674 | 669 | ||
670 | case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */ | ||
675 | 671 | ||
676 | case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */ | 672 | status = |
677 | 673 | acpi_hw_low_level_write(16, value, | |
678 | status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1b_cnt_blk); | 674 | &acpi_gbl_FADT->xpm1b_cnt_blk); |
679 | break; | 675 | break; |
680 | 676 | ||
677 | case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ | ||
681 | 678 | ||
682 | case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ | 679 | status = |
683 | 680 | acpi_hw_low_level_write(8, value, | |
684 | status = acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->xpm2_cnt_blk); | 681 | &acpi_gbl_FADT->xpm2_cnt_blk); |
685 | break; | 682 | break; |
686 | 683 | ||
684 | case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ | ||
687 | 685 | ||
688 | case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ | 686 | status = |
689 | 687 | acpi_hw_low_level_write(32, value, | |
690 | status = acpi_hw_low_level_write (32, value, &acpi_gbl_FADT->xpm_tmr_blk); | 688 | &acpi_gbl_FADT->xpm_tmr_blk); |
691 | break; | 689 | break; |
692 | 690 | ||
693 | 691 | case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ | |
694 | case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ | ||
695 | 692 | ||
696 | /* SMI_CMD is currently always in IO space */ | 693 | /* SMI_CMD is currently always in IO space */ |
697 | 694 | ||
698 | status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, value, 8); | 695 | status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd, value, 8); |
699 | break; | 696 | break; |
700 | 697 | ||
701 | |||
702 | default: | 698 | default: |
703 | status = AE_BAD_PARAMETER; | 699 | status = AE_BAD_PARAMETER; |
704 | break; | 700 | break; |
705 | } | 701 | } |
706 | 702 | ||
707 | unlock_and_exit: | 703 | unlock_and_exit: |
708 | if (ACPI_MTX_LOCK == use_lock) { | 704 | if (ACPI_MTX_LOCK == use_lock) { |
709 | (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE); | 705 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); |
710 | } | 706 | } |
711 | 707 | ||
712 | return_ACPI_STATUS (status); | 708 | return_ACPI_STATUS(status); |
713 | } | 709 | } |
714 | 710 | ||
715 | |||
716 | /****************************************************************************** | 711 | /****************************************************************************** |
717 | * | 712 | * |
718 | * FUNCTION: acpi_hw_low_level_read | 713 | * FUNCTION: acpi_hw_low_level_read |
@@ -728,17 +723,12 @@ unlock_and_exit: | |||
728 | ******************************************************************************/ | 723 | ******************************************************************************/ |
729 | 724 | ||
730 | acpi_status | 725 | acpi_status |
731 | acpi_hw_low_level_read ( | 726 | acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg) |
732 | u32 width, | ||
733 | u32 *value, | ||
734 | struct acpi_generic_address *reg) | ||
735 | { | 727 | { |
736 | u64 address; | 728 | u64 address; |
737 | acpi_status status; | 729 | acpi_status status; |
738 | |||
739 | |||
740 | ACPI_FUNCTION_NAME ("hw_low_level_read"); | ||
741 | 730 | ||
731 | ACPI_FUNCTION_NAME("hw_low_level_read"); | ||
742 | 732 | ||
743 | /* | 733 | /* |
744 | * Must have a valid pointer to a GAS structure, and | 734 | * Must have a valid pointer to a GAS structure, and |
@@ -751,7 +741,7 @@ acpi_hw_low_level_read ( | |||
751 | 741 | ||
752 | /* Get a local copy of the address. Handles possible alignment issues */ | 742 | /* Get a local copy of the address. Handles possible alignment issues */ |
753 | 743 | ||
754 | ACPI_MOVE_64_TO_64 (&address, ®->address); | 744 | ACPI_MOVE_64_TO_64(&address, ®->address); |
755 | if (!address) { | 745 | if (!address) { |
756 | return (AE_OK); | 746 | return (AE_OK); |
757 | } | 747 | } |
@@ -764,35 +754,32 @@ acpi_hw_low_level_read ( | |||
764 | switch (reg->address_space_id) { | 754 | switch (reg->address_space_id) { |
765 | case ACPI_ADR_SPACE_SYSTEM_MEMORY: | 755 | case ACPI_ADR_SPACE_SYSTEM_MEMORY: |
766 | 756 | ||
767 | status = acpi_os_read_memory ( | 757 | status = acpi_os_read_memory((acpi_physical_address) address, |
768 | (acpi_physical_address) address, | 758 | value, width); |
769 | value, width); | ||
770 | break; | 759 | break; |
771 | 760 | ||
772 | |||
773 | case ACPI_ADR_SPACE_SYSTEM_IO: | 761 | case ACPI_ADR_SPACE_SYSTEM_IO: |
774 | 762 | ||
775 | status = acpi_os_read_port ((acpi_io_address) address, | 763 | status = acpi_os_read_port((acpi_io_address) address, |
776 | value, width); | 764 | value, width); |
777 | break; | 765 | break; |
778 | 766 | ||
779 | |||
780 | default: | 767 | default: |
781 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 768 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
782 | "Unsupported address space: %X\n", reg->address_space_id)); | 769 | "Unsupported address space: %X\n", |
770 | reg->address_space_id)); | ||
783 | return (AE_BAD_PARAMETER); | 771 | return (AE_BAD_PARAMETER); |
784 | } | 772 | } |
785 | 773 | ||
786 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, | 774 | ACPI_DEBUG_PRINT((ACPI_DB_IO, |
787 | "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", | 775 | "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", |
788 | *value, width, | 776 | *value, width, |
789 | ACPI_FORMAT_UINT64 (address), | 777 | ACPI_FORMAT_UINT64(address), |
790 | acpi_ut_get_region_name (reg->address_space_id))); | 778 | acpi_ut_get_region_name(reg->address_space_id))); |
791 | 779 | ||
792 | return (status); | 780 | return (status); |
793 | } | 781 | } |
794 | 782 | ||
795 | |||
796 | /****************************************************************************** | 783 | /****************************************************************************** |
797 | * | 784 | * |
798 | * FUNCTION: acpi_hw_low_level_write | 785 | * FUNCTION: acpi_hw_low_level_write |
@@ -808,17 +795,12 @@ acpi_hw_low_level_read ( | |||
808 | ******************************************************************************/ | 795 | ******************************************************************************/ |
809 | 796 | ||
810 | acpi_status | 797 | acpi_status |
811 | acpi_hw_low_level_write ( | 798 | acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg) |
812 | u32 width, | ||
813 | u32 value, | ||
814 | struct acpi_generic_address *reg) | ||
815 | { | 799 | { |
816 | u64 address; | 800 | u64 address; |
817 | acpi_status status; | 801 | acpi_status status; |
818 | |||
819 | |||
820 | ACPI_FUNCTION_NAME ("hw_low_level_write"); | ||
821 | 802 | ||
803 | ACPI_FUNCTION_NAME("hw_low_level_write"); | ||
822 | 804 | ||
823 | /* | 805 | /* |
824 | * Must have a valid pointer to a GAS structure, and | 806 | * Must have a valid pointer to a GAS structure, and |
@@ -831,7 +813,7 @@ acpi_hw_low_level_write ( | |||
831 | 813 | ||
832 | /* Get a local copy of the address. Handles possible alignment issues */ | 814 | /* Get a local copy of the address. Handles possible alignment issues */ |
833 | 815 | ||
834 | ACPI_MOVE_64_TO_64 (&address, ®->address); | 816 | ACPI_MOVE_64_TO_64(&address, ®->address); |
835 | if (!address) { | 817 | if (!address) { |
836 | return (AE_OK); | 818 | return (AE_OK); |
837 | } | 819 | } |
@@ -843,30 +825,28 @@ acpi_hw_low_level_write ( | |||
843 | switch (reg->address_space_id) { | 825 | switch (reg->address_space_id) { |
844 | case ACPI_ADR_SPACE_SYSTEM_MEMORY: | 826 | case ACPI_ADR_SPACE_SYSTEM_MEMORY: |
845 | 827 | ||
846 | status = acpi_os_write_memory ( | 828 | status = acpi_os_write_memory((acpi_physical_address) address, |
847 | (acpi_physical_address) address, | 829 | value, width); |
848 | value, width); | ||
849 | break; | 830 | break; |
850 | 831 | ||
851 | |||
852 | case ACPI_ADR_SPACE_SYSTEM_IO: | 832 | case ACPI_ADR_SPACE_SYSTEM_IO: |
853 | 833 | ||
854 | status = acpi_os_write_port ((acpi_io_address) address, | 834 | status = acpi_os_write_port((acpi_io_address) address, |
855 | value, width); | 835 | value, width); |
856 | break; | 836 | break; |
857 | 837 | ||
858 | |||
859 | default: | 838 | default: |
860 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 839 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
861 | "Unsupported address space: %X\n", reg->address_space_id)); | 840 | "Unsupported address space: %X\n", |
841 | reg->address_space_id)); | ||
862 | return (AE_BAD_PARAMETER); | 842 | return (AE_BAD_PARAMETER); |
863 | } | 843 | } |
864 | 844 | ||
865 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, | 845 | ACPI_DEBUG_PRINT((ACPI_DB_IO, |
866 | "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", | 846 | "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", |
867 | value, width, | 847 | value, width, |
868 | ACPI_FORMAT_UINT64 (address), | 848 | ACPI_FORMAT_UINT64(address), |
869 | acpi_ut_get_region_name (reg->address_space_id))); | 849 | acpi_ut_get_region_name(reg->address_space_id))); |
870 | 850 | ||
871 | return (status); | 851 | return (status); |
872 | } | 852 | } |