diff options
author | Bob Moore <robert.moore@intel.com> | 2008-12-29 22:04:48 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-12-31 01:14:08 -0500 |
commit | 7db5d82d0278b506441ab6025f0c6ce2f2aa3019 (patch) | |
tree | 55b54c221851c0912f9dda9958a77c3b7ccf15d3 /drivers/acpi/hardware/hwxface.c | |
parent | ecfbbc7b46f74ca48b9f42132739114c9e70f8e4 (diff) |
ACPICA: Move all public H/W interfaces to new hwxface
Move public interfaces from hwregs.c to new file, hwxface.c -
similar to the structure of the other ACPICA components.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/hardware/hwxface.c')
-rw-r--r-- | drivers/acpi/hardware/hwxface.c | 555 |
1 files changed, 555 insertions, 0 deletions
diff --git a/drivers/acpi/hardware/hwxface.c b/drivers/acpi/hardware/hwxface.c new file mode 100644 index 000000000000..b6244a0fcf4c --- /dev/null +++ b/drivers/acpi/hardware/hwxface.c | |||
@@ -0,0 +1,555 @@ | |||
1 | |||
2 | /****************************************************************************** | ||
3 | * | ||
4 | * Module Name: hwxface - Public ACPICA hardware interfaces | ||
5 | * | ||
6 | *****************************************************************************/ | ||
7 | |||
8 | /* | ||
9 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
10 | * All rights reserved. | ||
11 | * | ||
12 | * Redistribution and use in source and binary forms, with or without | ||
13 | * modification, are permitted provided that the following conditions | ||
14 | * are met: | ||
15 | * 1. Redistributions of source code must retain the above copyright | ||
16 | * notice, this list of conditions, and the following disclaimer, | ||
17 | * without modification. | ||
18 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
19 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
20 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
21 | * including a substantially similar Disclaimer requirement for further | ||
22 | * binary redistribution. | ||
23 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
24 | * of any contributors may be used to endorse or promote products derived | ||
25 | * from this software without specific prior written permission. | ||
26 | * | ||
27 | * Alternatively, this software may be distributed under the terms of the | ||
28 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
29 | * Software Foundation. | ||
30 | * | ||
31 | * NO WARRANTY | ||
32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
33 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
34 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
35 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
36 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
38 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
39 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
40 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
41 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
42 | * POSSIBILITY OF SUCH DAMAGES. | ||
43 | */ | ||
44 | |||
45 | #include <acpi/acpi.h> | ||
46 | #include <acpi/acnamesp.h> | ||
47 | |||
48 | #define _COMPONENT ACPI_HARDWARE | ||
49 | ACPI_MODULE_NAME("hwxface") | ||
50 | |||
51 | /****************************************************************************** | ||
52 | * | ||
53 | * FUNCTION: acpi_read | ||
54 | * | ||
55 | * PARAMETERS: Value - Where the value is returned | ||
56 | * Reg - GAS register structure | ||
57 | * | ||
58 | * RETURN: Status | ||
59 | * | ||
60 | * DESCRIPTION: Read from either memory or IO space. | ||
61 | * | ||
62 | ******************************************************************************/ | ||
63 | acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg) | ||
64 | { | ||
65 | u32 width; | ||
66 | u64 address; | ||
67 | acpi_status status; | ||
68 | |||
69 | ACPI_FUNCTION_NAME(acpi_read); | ||
70 | |||
71 | /* | ||
72 | * Must have a valid pointer to a GAS structure, and | ||
73 | * a non-zero address within. However, don't return an error | ||
74 | * because the PM1A/B code must not fail if B isn't present. | ||
75 | */ | ||
76 | if (!reg) { | ||
77 | return (AE_OK); | ||
78 | } | ||
79 | |||
80 | /* Get a local copy of the address. Handles possible alignment issues */ | ||
81 | |||
82 | ACPI_MOVE_64_TO_64(&address, ®->address); | ||
83 | if (!address) { | ||
84 | return (AE_OK); | ||
85 | } | ||
86 | |||
87 | /* Supported widths are 8/16/32 */ | ||
88 | |||
89 | width = reg->bit_width; | ||
90 | if ((width != 8) && (width != 16) && (width != 32)) { | ||
91 | return (AE_SUPPORT); | ||
92 | } | ||
93 | |||
94 | /* Initialize entire 32-bit return value to zero */ | ||
95 | |||
96 | *value = 0; | ||
97 | |||
98 | /* | ||
99 | * Two address spaces supported: Memory or IO. | ||
100 | * PCI_Config is not supported here because the GAS struct is insufficient | ||
101 | */ | ||
102 | switch (reg->space_id) { | ||
103 | case ACPI_ADR_SPACE_SYSTEM_MEMORY: | ||
104 | |||
105 | status = acpi_os_read_memory((acpi_physical_address) address, | ||
106 | value, width); | ||
107 | break; | ||
108 | |||
109 | case ACPI_ADR_SPACE_SYSTEM_IO: | ||
110 | |||
111 | status = | ||
112 | acpi_os_read_port((acpi_io_address) address, value, width); | ||
113 | break; | ||
114 | |||
115 | default: | ||
116 | ACPI_ERROR((AE_INFO, | ||
117 | "Unsupported address space: %X", reg->space_id)); | ||
118 | return (AE_BAD_PARAMETER); | ||
119 | } | ||
120 | |||
121 | ACPI_DEBUG_PRINT((ACPI_DB_IO, | ||
122 | "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", | ||
123 | *value, width, ACPI_FORMAT_UINT64(address), | ||
124 | acpi_ut_get_region_name(reg->space_id))); | ||
125 | |||
126 | return (status); | ||
127 | } | ||
128 | |||
129 | ACPI_EXPORT_SYMBOL(acpi_read) | ||
130 | |||
131 | /****************************************************************************** | ||
132 | * | ||
133 | * FUNCTION: acpi_write | ||
134 | * | ||
135 | * PARAMETERS: Value - To be written | ||
136 | * Reg - GAS register structure | ||
137 | * | ||
138 | * RETURN: Status | ||
139 | * | ||
140 | * DESCRIPTION: Write to either memory or IO space. | ||
141 | * | ||
142 | ******************************************************************************/ | ||
143 | acpi_status acpi_write(u32 value, struct acpi_generic_address *reg) | ||
144 | { | ||
145 | u32 width; | ||
146 | u64 address; | ||
147 | acpi_status status; | ||
148 | |||
149 | ACPI_FUNCTION_NAME(acpi_write); | ||
150 | |||
151 | /* | ||
152 | * Must have a valid pointer to a GAS structure, and | ||
153 | * a non-zero address within. However, don't return an error | ||
154 | * because the PM1A/B code must not fail if B isn't present. | ||
155 | */ | ||
156 | if (!reg) { | ||
157 | return (AE_OK); | ||
158 | } | ||
159 | |||
160 | /* Get a local copy of the address. Handles possible alignment issues */ | ||
161 | |||
162 | ACPI_MOVE_64_TO_64(&address, ®->address); | ||
163 | if (!address) { | ||
164 | return (AE_OK); | ||
165 | } | ||
166 | |||
167 | /* Supported widths are 8/16/32 */ | ||
168 | |||
169 | width = reg->bit_width; | ||
170 | if ((width != 8) && (width != 16) && (width != 32)) { | ||
171 | return (AE_SUPPORT); | ||
172 | } | ||
173 | |||
174 | /* | ||
175 | * Two address spaces supported: Memory or IO. | ||
176 | * PCI_Config is not supported here because the GAS struct is insufficient | ||
177 | */ | ||
178 | switch (reg->space_id) { | ||
179 | case ACPI_ADR_SPACE_SYSTEM_MEMORY: | ||
180 | |||
181 | status = acpi_os_write_memory((acpi_physical_address) address, | ||
182 | value, width); | ||
183 | break; | ||
184 | |||
185 | case ACPI_ADR_SPACE_SYSTEM_IO: | ||
186 | |||
187 | status = acpi_os_write_port((acpi_io_address) address, value, | ||
188 | width); | ||
189 | break; | ||
190 | |||
191 | default: | ||
192 | ACPI_ERROR((AE_INFO, | ||
193 | "Unsupported address space: %X", reg->space_id)); | ||
194 | return (AE_BAD_PARAMETER); | ||
195 | } | ||
196 | |||
197 | ACPI_DEBUG_PRINT((ACPI_DB_IO, | ||
198 | "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", | ||
199 | value, width, ACPI_FORMAT_UINT64(address), | ||
200 | acpi_ut_get_region_name(reg->space_id))); | ||
201 | |||
202 | return (status); | ||
203 | } | ||
204 | |||
205 | ACPI_EXPORT_SYMBOL(acpi_write) | ||
206 | |||
207 | /******************************************************************************* | ||
208 | * | ||
209 | * FUNCTION: acpi_get_register_unlocked | ||
210 | * | ||
211 | * PARAMETERS: register_id - ID of ACPI bit_register to access | ||
212 | * return_value - Value that was read from the register | ||
213 | * | ||
214 | * RETURN: Status and the value read from specified Register. Value | ||
215 | * returned is normalized to bit0 (is shifted all the way right) | ||
216 | * | ||
217 | * DESCRIPTION: ACPI bit_register read function. Does not acquire the HW lock. | ||
218 | * | ||
219 | ******************************************************************************/ | ||
220 | acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value) | ||
221 | { | ||
222 | u32 register_value = 0; | ||
223 | struct acpi_bit_register_info *bit_reg_info; | ||
224 | acpi_status status; | ||
225 | |||
226 | ACPI_FUNCTION_TRACE(acpi_get_register_unlocked); | ||
227 | |||
228 | /* Get the info structure corresponding to the requested ACPI Register */ | ||
229 | |||
230 | bit_reg_info = acpi_hw_get_bit_register_info(register_id); | ||
231 | if (!bit_reg_info) { | ||
232 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
233 | } | ||
234 | |||
235 | /* Read from the register */ | ||
236 | |||
237 | status = acpi_hw_register_read(bit_reg_info->parent_register, | ||
238 | ®ister_value); | ||
239 | |||
240 | if (ACPI_SUCCESS(status)) { | ||
241 | |||
242 | /* Normalize the value that was read */ | ||
243 | |||
244 | register_value = | ||
245 | ((register_value & bit_reg_info->access_bit_mask) | ||
246 | >> bit_reg_info->bit_position); | ||
247 | |||
248 | *return_value = register_value; | ||
249 | |||
250 | ACPI_DEBUG_PRINT((ACPI_DB_IO, "Read value %8.8X register %X\n", | ||
251 | register_value, | ||
252 | bit_reg_info->parent_register)); | ||
253 | } | ||
254 | |||
255 | return_ACPI_STATUS(status); | ||
256 | } | ||
257 | |||
258 | ACPI_EXPORT_SYMBOL(acpi_get_register_unlocked) | ||
259 | |||
260 | /******************************************************************************* | ||
261 | * | ||
262 | * FUNCTION: acpi_get_register | ||
263 | * | ||
264 | * PARAMETERS: register_id - ID of ACPI bit_register to access | ||
265 | * return_value - Value that was read from the register | ||
266 | * | ||
267 | * RETURN: Status and the value read from specified Register. Value | ||
268 | * returned is normalized to bit0 (is shifted all the way right) | ||
269 | * | ||
270 | * DESCRIPTION: ACPI bit_register read function. | ||
271 | * | ||
272 | ******************************************************************************/ | ||
273 | acpi_status acpi_get_register(u32 register_id, u32 *return_value) | ||
274 | { | ||
275 | acpi_status status; | ||
276 | acpi_cpu_flags flags; | ||
277 | |||
278 | flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); | ||
279 | status = acpi_get_register_unlocked(register_id, return_value); | ||
280 | acpi_os_release_lock(acpi_gbl_hardware_lock, flags); | ||
281 | |||
282 | return (status); | ||
283 | } | ||
284 | |||
285 | ACPI_EXPORT_SYMBOL(acpi_get_register) | ||
286 | |||
287 | /******************************************************************************* | ||
288 | * | ||
289 | * FUNCTION: acpi_set_register | ||
290 | * | ||
291 | * PARAMETERS: register_id - ID of ACPI bit_register to access | ||
292 | * Value - (only used on write) value to write to the | ||
293 | * Register, NOT pre-normalized to the bit pos | ||
294 | * | ||
295 | * RETURN: Status | ||
296 | * | ||
297 | * DESCRIPTION: ACPI Bit Register write function. | ||
298 | * | ||
299 | ******************************************************************************/ | ||
300 | acpi_status acpi_set_register(u32 register_id, u32 value) | ||
301 | { | ||
302 | u32 register_value = 0; | ||
303 | struct acpi_bit_register_info *bit_reg_info; | ||
304 | acpi_status status; | ||
305 | acpi_cpu_flags lock_flags; | ||
306 | |||
307 | ACPI_FUNCTION_TRACE_U32(acpi_set_register, register_id); | ||
308 | |||
309 | /* Get the info structure corresponding to the requested ACPI Register */ | ||
310 | |||
311 | bit_reg_info = acpi_hw_get_bit_register_info(register_id); | ||
312 | if (!bit_reg_info) { | ||
313 | ACPI_ERROR((AE_INFO, "Bad ACPI HW RegisterId: %X", | ||
314 | register_id)); | ||
315 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
316 | } | ||
317 | |||
318 | lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); | ||
319 | |||
320 | /* Always do a register read first so we can insert the new bits */ | ||
321 | |||
322 | status = acpi_hw_register_read(bit_reg_info->parent_register, | ||
323 | ®ister_value); | ||
324 | if (ACPI_FAILURE(status)) { | ||
325 | goto unlock_and_exit; | ||
326 | } | ||
327 | |||
328 | /* | ||
329 | * Decode the Register ID | ||
330 | * Register ID = [Register block ID] | [bit ID] | ||
331 | * | ||
332 | * Check bit ID to fine locate Register offset. | ||
333 | * Check Mask to determine Register offset, and then read-write. | ||
334 | */ | ||
335 | switch (bit_reg_info->parent_register) { | ||
336 | case ACPI_REGISTER_PM1_STATUS: | ||
337 | |||
338 | /* | ||
339 | * Status Registers are different from the rest. Clear by | ||
340 | * writing 1, and writing 0 has no effect. So, the only relevant | ||
341 | * information is the single bit we're interested in, all others should | ||
342 | * be written as 0 so they will be left unchanged. | ||
343 | */ | ||
344 | value = ACPI_REGISTER_PREPARE_BITS(value, | ||
345 | bit_reg_info->bit_position, | ||
346 | bit_reg_info-> | ||
347 | access_bit_mask); | ||
348 | if (value) { | ||
349 | status = | ||
350 | acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS, | ||
351 | (u16) value); | ||
352 | register_value = 0; | ||
353 | } | ||
354 | break; | ||
355 | |||
356 | case ACPI_REGISTER_PM1_ENABLE: | ||
357 | |||
358 | ACPI_REGISTER_INSERT_VALUE(register_value, | ||
359 | bit_reg_info->bit_position, | ||
360 | bit_reg_info->access_bit_mask, | ||
361 | value); | ||
362 | |||
363 | status = acpi_hw_register_write(ACPI_REGISTER_PM1_ENABLE, | ||
364 | (u16) register_value); | ||
365 | break; | ||
366 | |||
367 | case ACPI_REGISTER_PM1_CONTROL: | ||
368 | |||
369 | /* | ||
370 | * Write the PM1 Control register. | ||
371 | * Note that at this level, the fact that there are actually TWO | ||
372 | * registers (A and B - and B may not exist) is abstracted. | ||
373 | */ | ||
374 | ACPI_DEBUG_PRINT((ACPI_DB_IO, "PM1 control: Read %X\n", | ||
375 | register_value)); | ||
376 | |||
377 | ACPI_REGISTER_INSERT_VALUE(register_value, | ||
378 | bit_reg_info->bit_position, | ||
379 | bit_reg_info->access_bit_mask, | ||
380 | value); | ||
381 | |||
382 | status = acpi_hw_register_write(ACPI_REGISTER_PM1_CONTROL, | ||
383 | (u16) register_value); | ||
384 | break; | ||
385 | |||
386 | case ACPI_REGISTER_PM2_CONTROL: | ||
387 | |||
388 | status = acpi_hw_register_read(ACPI_REGISTER_PM2_CONTROL, | ||
389 | ®ister_value); | ||
390 | if (ACPI_FAILURE(status)) { | ||
391 | goto unlock_and_exit; | ||
392 | } | ||
393 | |||
394 | ACPI_DEBUG_PRINT((ACPI_DB_IO, | ||
395 | "PM2 control: Read %X from %8.8X%8.8X\n", | ||
396 | register_value, | ||
397 | ACPI_FORMAT_UINT64(acpi_gbl_FADT. | ||
398 | xpm2_control_block. | ||
399 | address))); | ||
400 | |||
401 | ACPI_REGISTER_INSERT_VALUE(register_value, | ||
402 | bit_reg_info->bit_position, | ||
403 | bit_reg_info->access_bit_mask, | ||
404 | value); | ||
405 | |||
406 | ACPI_DEBUG_PRINT((ACPI_DB_IO, | ||
407 | "About to write %4.4X to %8.8X%8.8X\n", | ||
408 | register_value, | ||
409 | ACPI_FORMAT_UINT64(acpi_gbl_FADT. | ||
410 | xpm2_control_block. | ||
411 | address))); | ||
412 | |||
413 | status = acpi_hw_register_write(ACPI_REGISTER_PM2_CONTROL, | ||
414 | (u8) (register_value)); | ||
415 | break; | ||
416 | |||
417 | default: | ||
418 | break; | ||
419 | } | ||
420 | |||
421 | unlock_and_exit: | ||
422 | |||
423 | acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); | ||
424 | |||
425 | /* Normalize the value that was read */ | ||
426 | |||
427 | ACPI_DEBUG_EXEC(register_value = | ||
428 | ((register_value & bit_reg_info->access_bit_mask) >> | ||
429 | bit_reg_info->bit_position)); | ||
430 | |||
431 | ACPI_DEBUG_PRINT((ACPI_DB_IO, | ||
432 | "Set bits: %8.8X actual %8.8X register %X\n", value, | ||
433 | register_value, bit_reg_info->parent_register)); | ||
434 | return_ACPI_STATUS(status); | ||
435 | } | ||
436 | |||
437 | ACPI_EXPORT_SYMBOL(acpi_set_register) | ||
438 | |||
439 | /******************************************************************************* | ||
440 | * | ||
441 | * FUNCTION: acpi_get_sleep_type_data | ||
442 | * | ||
443 | * PARAMETERS: sleep_state - Numeric sleep state | ||
444 | * *sleep_type_a - Where SLP_TYPa is returned | ||
445 | * *sleep_type_b - Where SLP_TYPb is returned | ||
446 | * | ||
447 | * RETURN: Status - ACPI status | ||
448 | * | ||
449 | * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested sleep | ||
450 | * state. | ||
451 | * | ||
452 | ******************************************************************************/ | ||
453 | acpi_status | ||
454 | acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b) | ||
455 | { | ||
456 | acpi_status status = AE_OK; | ||
457 | struct acpi_evaluate_info *info; | ||
458 | |||
459 | ACPI_FUNCTION_TRACE(acpi_get_sleep_type_data); | ||
460 | |||
461 | /* Validate parameters */ | ||
462 | |||
463 | if ((sleep_state > ACPI_S_STATES_MAX) || !sleep_type_a || !sleep_type_b) { | ||
464 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
465 | } | ||
466 | |||
467 | /* Allocate the evaluation information block */ | ||
468 | |||
469 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
470 | if (!info) { | ||
471 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
472 | } | ||
473 | |||
474 | info->pathname = | ||
475 | ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); | ||
476 | |||
477 | /* Evaluate the namespace object containing the values for this state */ | ||
478 | |||
479 | status = acpi_ns_evaluate(info); | ||
480 | if (ACPI_FAILURE(status)) { | ||
481 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
482 | "%s while evaluating SleepState [%s]\n", | ||
483 | acpi_format_exception(status), | ||
484 | info->pathname)); | ||
485 | |||
486 | goto cleanup; | ||
487 | } | ||
488 | |||
489 | /* Must have a return object */ | ||
490 | |||
491 | if (!info->return_object) { | ||
492 | ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]", | ||
493 | info->pathname)); | ||
494 | status = AE_NOT_EXIST; | ||
495 | } | ||
496 | |||
497 | /* It must be of type Package */ | ||
498 | |||
499 | else if (ACPI_GET_OBJECT_TYPE(info->return_object) != ACPI_TYPE_PACKAGE) { | ||
500 | ACPI_ERROR((AE_INFO, | ||
501 | "Sleep State return object is not a Package")); | ||
502 | status = AE_AML_OPERAND_TYPE; | ||
503 | } | ||
504 | |||
505 | /* | ||
506 | * The package must have at least two elements. NOTE (March 2005): This | ||
507 | * goes against the current ACPI spec which defines this object as a | ||
508 | * package with one encoded DWORD element. However, existing practice | ||
509 | * by BIOS vendors seems to be to have 2 or more elements, at least | ||
510 | * one per sleep type (A/B). | ||
511 | */ | ||
512 | else if (info->return_object->package.count < 2) { | ||
513 | ACPI_ERROR((AE_INFO, | ||
514 | "Sleep State return package does not have at least two elements")); | ||
515 | status = AE_AML_NO_OPERAND; | ||
516 | } | ||
517 | |||
518 | /* The first two elements must both be of type Integer */ | ||
519 | |||
520 | else if ((ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[0]) | ||
521 | != ACPI_TYPE_INTEGER) || | ||
522 | (ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[1]) | ||
523 | != ACPI_TYPE_INTEGER)) { | ||
524 | ACPI_ERROR((AE_INFO, | ||
525 | "Sleep State return package elements are not both Integers (%s, %s)", | ||
526 | acpi_ut_get_object_type_name(info->return_object-> | ||
527 | package.elements[0]), | ||
528 | acpi_ut_get_object_type_name(info->return_object-> | ||
529 | package.elements[1]))); | ||
530 | status = AE_AML_OPERAND_TYPE; | ||
531 | } else { | ||
532 | /* Valid _Sx_ package size, type, and value */ | ||
533 | |||
534 | *sleep_type_a = (u8) | ||
535 | (info->return_object->package.elements[0])->integer.value; | ||
536 | *sleep_type_b = (u8) | ||
537 | (info->return_object->package.elements[1])->integer.value; | ||
538 | } | ||
539 | |||
540 | if (ACPI_FAILURE(status)) { | ||
541 | ACPI_EXCEPTION((AE_INFO, status, | ||
542 | "While evaluating SleepState [%s], bad Sleep object %p type %s", | ||
543 | info->pathname, info->return_object, | ||
544 | acpi_ut_get_object_type_name(info-> | ||
545 | return_object))); | ||
546 | } | ||
547 | |||
548 | acpi_ut_remove_reference(info->return_object); | ||
549 | |||
550 | cleanup: | ||
551 | ACPI_FREE(info); | ||
552 | return_ACPI_STATUS(status); | ||
553 | } | ||
554 | |||
555 | ACPI_EXPORT_SYMBOL(acpi_get_sleep_type_data) | ||