diff options
author | Bob Moore <robert.moore@intel.com> | 2009-06-29 01:39:29 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-08-27 10:17:15 -0400 |
commit | 15b8dd53f5ffaf8e2d9095c423f713423f576c0f (patch) | |
tree | 773f09435b14a810372642502352d46c29b6f148 | |
parent | 9c61b34cf7078da72cce276ff8cfae5d6e9955bc (diff) |
ACPICA: Major update for acpi_get_object_info external interface
Completed a major update for the acpi_get_object_info external interface.
Changes include:
- Support for variable, unlimited length HID, UID, and CID strings
- Support Processor objects the same as Devices (HID,UID,CID,ADR,STA, etc.)
- Call the _SxW power methods on behalf of a device object
- Determine if a device is a PCI root bridge
- Change the ACPI_BUFFER parameter to ACPI_DEVICE_INFO.
These changes will require an update to all callers of this interface.
See the ACPICA Programmer Reference for details.
Also, update all invocations of acpi_get_object_info interface
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>
28 files changed, 901 insertions, 630 deletions
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c index 8cfb001092ab..674a8374c6d9 100644 --- a/arch/ia64/hp/common/sba_iommu.c +++ b/arch/ia64/hp/common/sba_iommu.c | |||
@@ -2026,24 +2026,21 @@ acpi_sba_ioc_add(struct acpi_device *device) | |||
2026 | struct ioc *ioc; | 2026 | struct ioc *ioc; |
2027 | acpi_status status; | 2027 | acpi_status status; |
2028 | u64 hpa, length; | 2028 | u64 hpa, length; |
2029 | struct acpi_buffer buffer; | ||
2030 | struct acpi_device_info *dev_info; | 2029 | struct acpi_device_info *dev_info; |
2031 | 2030 | ||
2032 | status = hp_acpi_csr_space(device->handle, &hpa, &length); | 2031 | status = hp_acpi_csr_space(device->handle, &hpa, &length); |
2033 | if (ACPI_FAILURE(status)) | 2032 | if (ACPI_FAILURE(status)) |
2034 | return 1; | 2033 | return 1; |
2035 | 2034 | ||
2036 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; | 2035 | status = acpi_get_object_info(device->handle, &dev_info); |
2037 | status = acpi_get_object_info(device->handle, &buffer); | ||
2038 | if (ACPI_FAILURE(status)) | 2036 | if (ACPI_FAILURE(status)) |
2039 | return 1; | 2037 | return 1; |
2040 | dev_info = buffer.pointer; | ||
2041 | 2038 | ||
2042 | /* | 2039 | /* |
2043 | * For HWP0001, only SBA appears in ACPI namespace. It encloses the PCI | 2040 | * For HWP0001, only SBA appears in ACPI namespace. It encloses the PCI |
2044 | * root bridges, and its CSR space includes the IOC function. | 2041 | * root bridges, and its CSR space includes the IOC function. |
2045 | */ | 2042 | */ |
2046 | if (strncmp("HWP0001", dev_info->hardware_id.value, 7) == 0) { | 2043 | if (strncmp("HWP0001", dev_info->hardware_id.string, 7) == 0) { |
2047 | hpa += ZX1_IOC_OFFSET; | 2044 | hpa += ZX1_IOC_OFFSET; |
2048 | /* zx1 based systems default to kernel page size iommu pages */ | 2045 | /* zx1 based systems default to kernel page size iommu pages */ |
2049 | if (!iovp_shift) | 2046 | if (!iovp_shift) |
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 9a62224cc278..80eacbe157e2 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c | |||
@@ -481,26 +481,23 @@ static acpi_status is_memory_device(acpi_handle handle) | |||
481 | { | 481 | { |
482 | char *hardware_id; | 482 | char *hardware_id; |
483 | acpi_status status; | 483 | acpi_status status; |
484 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
485 | struct acpi_device_info *info; | 484 | struct acpi_device_info *info; |
486 | 485 | ||
487 | 486 | status = acpi_get_object_info(handle, &info); | |
488 | status = acpi_get_object_info(handle, &buffer); | ||
489 | if (ACPI_FAILURE(status)) | 487 | if (ACPI_FAILURE(status)) |
490 | return status; | 488 | return status; |
491 | 489 | ||
492 | info = buffer.pointer; | ||
493 | if (!(info->valid & ACPI_VALID_HID)) { | 490 | if (!(info->valid & ACPI_VALID_HID)) { |
494 | kfree(buffer.pointer); | 491 | kfree(info); |
495 | return AE_ERROR; | 492 | return AE_ERROR; |
496 | } | 493 | } |
497 | 494 | ||
498 | hardware_id = info->hardware_id.value; | 495 | hardware_id = info->hardware_id.string; |
499 | if ((hardware_id == NULL) || | 496 | if ((hardware_id == NULL) || |
500 | (strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID))) | 497 | (strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID))) |
501 | status = AE_ERROR; | 498 | status = AE_ERROR; |
502 | 499 | ||
503 | kfree(buffer.pointer); | 500 | kfree(info); |
504 | return status; | 501 | return status; |
505 | } | 502 | } |
506 | 503 | ||
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile index 72ac28da14e3..0e7d56185f6d 100644 --- a/drivers/acpi/acpica/Makefile +++ b/drivers/acpi/acpica/Makefile | |||
@@ -44,4 +44,4 @@ acpi-y += tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o tbxfroot.o | |||
44 | 44 | ||
45 | acpi-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ | 45 | acpi-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ |
46 | utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ | 46 | utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ |
47 | utstate.o utmutex.o utobject.o utresrc.o utlock.o | 47 | utstate.o utmutex.o utobject.o utresrc.o utlock.o utids.o |
diff --git a/drivers/acpi/acpica/acconfig.h b/drivers/acpi/acpica/acconfig.h index e6777fb883d2..6c1fb2d9f4d5 100644 --- a/drivers/acpi/acpica/acconfig.h +++ b/drivers/acpi/acpica/acconfig.h | |||
@@ -203,6 +203,11 @@ | |||
203 | 203 | ||
204 | #define ACPI_SMBUS_BUFFER_SIZE 34 | 204 | #define ACPI_SMBUS_BUFFER_SIZE 34 |
205 | 205 | ||
206 | /* _sx_d and _sx_w control methods */ | ||
207 | |||
208 | #define ACPI_NUM_sx_d_METHODS 4 | ||
209 | #define ACPI_NUM_sx_w_METHODS 5 | ||
210 | |||
206 | /****************************************************************************** | 211 | /****************************************************************************** |
207 | * | 212 | * |
208 | * ACPI AML Debugger | 213 | * ACPI AML Debugger |
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index 0b73b31c1b53..6389f7c1de59 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h | |||
@@ -265,7 +265,8 @@ ACPI_EXTERN u8 acpi_gbl_osi_data; | |||
265 | extern u8 acpi_gbl_shutdown; | 265 | extern u8 acpi_gbl_shutdown; |
266 | extern u32 acpi_gbl_startup_flags; | 266 | extern u32 acpi_gbl_startup_flags; |
267 | extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT]; | 267 | extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT]; |
268 | extern const char *acpi_gbl_highest_dstate_names[4]; | 268 | extern const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS]; |
269 | extern const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS]; | ||
269 | extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; | 270 | extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; |
270 | extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; | 271 | extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; |
271 | 272 | ||
diff --git a/drivers/acpi/acpica/acinterp.h b/drivers/acpi/acpica/acinterp.h index e8db7a3143a5..5db9f2916f7c 100644 --- a/drivers/acpi/acpica/acinterp.h +++ b/drivers/acpi/acpica/acinterp.h | |||
@@ -461,9 +461,9 @@ void acpi_ex_acquire_global_lock(u32 rule); | |||
461 | 461 | ||
462 | void acpi_ex_release_global_lock(u32 rule); | 462 | void acpi_ex_release_global_lock(u32 rule); |
463 | 463 | ||
464 | void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string); | 464 | void acpi_ex_eisa_id_to_string(char *dest, acpi_integer compressed_id); |
465 | 465 | ||
466 | void acpi_ex_unsigned_integer_to_string(acpi_integer value, char *out_string); | 466 | void acpi_ex_integer_to_string(char *dest, acpi_integer value); |
467 | 467 | ||
468 | /* | 468 | /* |
469 | * exregion - default op_region handlers | 469 | * exregion - default op_region handlers |
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h index 897810ba0ccc..b0add85de308 100644 --- a/drivers/acpi/acpica/acutils.h +++ b/drivers/acpi/acpica/acutils.h | |||
@@ -324,26 +324,30 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
324 | acpi_status | 324 | acpi_status |
325 | acpi_ut_evaluate_numeric_object(char *object_name, | 325 | acpi_ut_evaluate_numeric_object(char *object_name, |
326 | struct acpi_namespace_node *device_node, | 326 | struct acpi_namespace_node *device_node, |
327 | acpi_integer * address); | 327 | acpi_integer *value); |
328 | 328 | ||
329 | acpi_status | 329 | acpi_status |
330 | acpi_ut_execute_HID(struct acpi_namespace_node *device_node, | 330 | acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 *status_flags); |
331 | struct acpica_device_id *hid); | ||
332 | 331 | ||
333 | acpi_status | 332 | acpi_status |
334 | acpi_ut_execute_CID(struct acpi_namespace_node *device_node, | 333 | acpi_ut_execute_power_methods(struct acpi_namespace_node *device_node, |
335 | struct acpi_compatible_id_list **return_cid_list); | 334 | const char **method_names, |
335 | u8 method_count, u8 *out_values); | ||
336 | 336 | ||
337 | /* | ||
338 | * utids - device ID support | ||
339 | */ | ||
337 | acpi_status | 340 | acpi_status |
338 | acpi_ut_execute_STA(struct acpi_namespace_node *device_node, | 341 | acpi_ut_execute_HID(struct acpi_namespace_node *device_node, |
339 | u32 * status_flags); | 342 | struct acpica_device_id **return_id); |
340 | 343 | ||
341 | acpi_status | 344 | acpi_status |
342 | acpi_ut_execute_UID(struct acpi_namespace_node *device_node, | 345 | acpi_ut_execute_UID(struct acpi_namespace_node *device_node, |
343 | struct acpica_device_id *uid); | 346 | struct acpica_device_id **return_id); |
344 | 347 | ||
345 | acpi_status | 348 | acpi_status |
346 | acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest); | 349 | acpi_ut_execute_CID(struct acpi_namespace_node *device_node, |
350 | struct acpica_device_id_list **return_cid_list); | ||
347 | 351 | ||
348 | /* | 352 | /* |
349 | * utlock - reader/writer locks | 353 | * utlock - reader/writer locks |
@@ -445,6 +449,8 @@ acpi_ut_short_divide(acpi_integer in_dividend, | |||
445 | */ | 449 | */ |
446 | const char *acpi_ut_validate_exception(acpi_status status); | 450 | const char *acpi_ut_validate_exception(acpi_status status); |
447 | 451 | ||
452 | u8 acpi_ut_is_pci_root_bridge(char *id); | ||
453 | |||
448 | u8 acpi_ut_is_aml_table(struct acpi_table_header *table); | 454 | u8 acpi_ut_is_aml_table(struct acpi_table_header *table); |
449 | 455 | ||
450 | acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id); | 456 | acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id); |
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c index 284a7becbe96..cf29c4953028 100644 --- a/drivers/acpi/acpica/evrgnini.c +++ b/drivers/acpi/acpica/evrgnini.c | |||
@@ -50,8 +50,6 @@ | |||
50 | ACPI_MODULE_NAME("evrgnini") | 50 | ACPI_MODULE_NAME("evrgnini") |
51 | 51 | ||
52 | /* Local prototypes */ | 52 | /* Local prototypes */ |
53 | static u8 acpi_ev_match_pci_root_bridge(char *id); | ||
54 | |||
55 | static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node); | 53 | static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node); |
56 | 54 | ||
57 | /******************************************************************************* | 55 | /******************************************************************************* |
@@ -332,37 +330,6 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
332 | 330 | ||
333 | /******************************************************************************* | 331 | /******************************************************************************* |
334 | * | 332 | * |
335 | * FUNCTION: acpi_ev_match_pci_root_bridge | ||
336 | * | ||
337 | * PARAMETERS: Id - The HID/CID in string format | ||
338 | * | ||
339 | * RETURN: TRUE if the Id is a match for a PCI/PCI-Express Root Bridge | ||
340 | * | ||
341 | * DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID. | ||
342 | * | ||
343 | ******************************************************************************/ | ||
344 | |||
345 | static u8 acpi_ev_match_pci_root_bridge(char *id) | ||
346 | { | ||
347 | |||
348 | /* | ||
349 | * Check if this is a PCI root. | ||
350 | * ACPI 3.0+: check for a PCI Express root also. | ||
351 | */ | ||
352 | if (!(ACPI_STRNCMP(id, | ||
353 | PCI_ROOT_HID_STRING, | ||
354 | sizeof(PCI_ROOT_HID_STRING))) || | ||
355 | !(ACPI_STRNCMP(id, | ||
356 | PCI_EXPRESS_ROOT_HID_STRING, | ||
357 | sizeof(PCI_EXPRESS_ROOT_HID_STRING)))) { | ||
358 | return (TRUE); | ||
359 | } | ||
360 | |||
361 | return (FALSE); | ||
362 | } | ||
363 | |||
364 | /******************************************************************************* | ||
365 | * | ||
366 | * FUNCTION: acpi_ev_is_pci_root_bridge | 333 | * FUNCTION: acpi_ev_is_pci_root_bridge |
367 | * | 334 | * |
368 | * PARAMETERS: Node - Device node being examined | 335 | * PARAMETERS: Node - Device node being examined |
@@ -377,9 +344,10 @@ static u8 acpi_ev_match_pci_root_bridge(char *id) | |||
377 | static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node) | 344 | static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node) |
378 | { | 345 | { |
379 | acpi_status status; | 346 | acpi_status status; |
380 | struct acpica_device_id hid; | 347 | struct acpica_device_id *hid; |
381 | struct acpi_compatible_id_list *cid; | 348 | struct acpica_device_id_list *cid; |
382 | u32 i; | 349 | u32 i; |
350 | u8 match; | ||
383 | 351 | ||
384 | /* Get the _HID and check for a PCI Root Bridge */ | 352 | /* Get the _HID and check for a PCI Root Bridge */ |
385 | 353 | ||
@@ -388,7 +356,10 @@ static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node) | |||
388 | return (FALSE); | 356 | return (FALSE); |
389 | } | 357 | } |
390 | 358 | ||
391 | if (acpi_ev_match_pci_root_bridge(hid.value)) { | 359 | match = acpi_ut_is_pci_root_bridge(hid->string); |
360 | ACPI_FREE(hid); | ||
361 | |||
362 | if (match) { | ||
392 | return (TRUE); | 363 | return (TRUE); |
393 | } | 364 | } |
394 | 365 | ||
@@ -402,7 +373,7 @@ static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node) | |||
402 | /* Check all _CIDs in the returned list */ | 373 | /* Check all _CIDs in the returned list */ |
403 | 374 | ||
404 | for (i = 0; i < cid->count; i++) { | 375 | for (i = 0; i < cid->count; i++) { |
405 | if (acpi_ev_match_pci_root_bridge(cid->id[i].value)) { | 376 | if (acpi_ut_is_pci_root_bridge(cid->ids[i].string)) { |
406 | ACPI_FREE(cid); | 377 | ACPI_FREE(cid); |
407 | return (TRUE); | 378 | return (TRUE); |
408 | } | 379 | } |
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c index 87730e944132..7d41f99f7052 100644 --- a/drivers/acpi/acpica/exutils.c +++ b/drivers/acpi/acpica/exutils.c | |||
@@ -358,50 +358,67 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base) | |||
358 | * | 358 | * |
359 | * FUNCTION: acpi_ex_eisa_id_to_string | 359 | * FUNCTION: acpi_ex_eisa_id_to_string |
360 | * | 360 | * |
361 | * PARAMETERS: numeric_id - EISA ID to be converted | 361 | * PARAMETERS: compressed_id - EISAID to be converted |
362 | * out_string - Where to put the converted string (8 bytes) | 362 | * out_string - Where to put the converted string (8 bytes) |
363 | * | 363 | * |
364 | * RETURN: None | 364 | * RETURN: None |
365 | * | 365 | * |
366 | * DESCRIPTION: Convert a numeric EISA ID to string representation | 366 | * DESCRIPTION: Convert a numeric EISAID to string representation. Return |
367 | * buffer must be large enough to hold the string. The string | ||
368 | * returned is always exactly of length ACPI_EISAID_STRING_SIZE | ||
369 | * (includes null terminator). The EISAID is always 32 bits. | ||
367 | * | 370 | * |
368 | ******************************************************************************/ | 371 | ******************************************************************************/ |
369 | 372 | ||
370 | void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string) | 373 | void acpi_ex_eisa_id_to_string(char *out_string, acpi_integer compressed_id) |
371 | { | 374 | { |
372 | u32 eisa_id; | 375 | u32 swapped_id; |
373 | 376 | ||
374 | ACPI_FUNCTION_ENTRY(); | 377 | ACPI_FUNCTION_ENTRY(); |
375 | 378 | ||
379 | /* The EISAID should be a 32-bit integer */ | ||
380 | |||
381 | if (compressed_id > ACPI_UINT32_MAX) { | ||
382 | ACPI_WARNING((AE_INFO, | ||
383 | "Expected EISAID is larger than 32 bits: 0x%8.8X%8.8X, truncating", | ||
384 | ACPI_FORMAT_UINT64(compressed_id))); | ||
385 | } | ||
386 | |||
376 | /* Swap ID to big-endian to get contiguous bits */ | 387 | /* Swap ID to big-endian to get contiguous bits */ |
377 | 388 | ||
378 | eisa_id = acpi_ut_dword_byte_swap(numeric_id); | 389 | swapped_id = acpi_ut_dword_byte_swap((u32)compressed_id); |
379 | 390 | ||
380 | out_string[0] = (char)('@' + (((unsigned long)eisa_id >> 26) & 0x1f)); | 391 | /* First 3 bytes are uppercase letters. Next 4 bytes are hexadecimal */ |
381 | out_string[1] = (char)('@' + ((eisa_id >> 21) & 0x1f)); | 392 | |
382 | out_string[2] = (char)('@' + ((eisa_id >> 16) & 0x1f)); | 393 | out_string[0] = |
383 | out_string[3] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 12); | 394 | (char)(0x40 + (((unsigned long)swapped_id >> 26) & 0x1F)); |
384 | out_string[4] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 8); | 395 | out_string[1] = (char)(0x40 + ((swapped_id >> 21) & 0x1F)); |
385 | out_string[5] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 4); | 396 | out_string[2] = (char)(0x40 + ((swapped_id >> 16) & 0x1F)); |
386 | out_string[6] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 0); | 397 | out_string[3] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 12); |
398 | out_string[4] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 8); | ||
399 | out_string[5] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 4); | ||
400 | out_string[6] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 0); | ||
387 | out_string[7] = 0; | 401 | out_string[7] = 0; |
388 | } | 402 | } |
389 | 403 | ||
390 | /******************************************************************************* | 404 | /******************************************************************************* |
391 | * | 405 | * |
392 | * FUNCTION: acpi_ex_unsigned_integer_to_string | 406 | * FUNCTION: acpi_ex_integer_to_string |
393 | * | 407 | * |
394 | * PARAMETERS: Value - Value to be converted | 408 | * PARAMETERS: out_string - Where to put the converted string. At least |
395 | * out_string - Where to put the converted string (8 bytes) | 409 | * 21 bytes are needed to hold the largest |
410 | * possible 64-bit integer. | ||
411 | * Value - Value to be converted | ||
396 | * | 412 | * |
397 | * RETURN: None, string | 413 | * RETURN: None, string |
398 | * | 414 | * |
399 | * DESCRIPTION: Convert a number to string representation. Assumes string | 415 | * DESCRIPTION: Convert a 64-bit integer to decimal string representation. |
400 | * buffer is large enough to hold the string. | 416 | * Assumes string buffer is large enough to hold the string. The |
417 | * largest string is (ACPI_MAX64_DECIMAL_DIGITS + 1). | ||
401 | * | 418 | * |
402 | ******************************************************************************/ | 419 | ******************************************************************************/ |
403 | 420 | ||
404 | void acpi_ex_unsigned_integer_to_string(acpi_integer value, char *out_string) | 421 | void acpi_ex_integer_to_string(char *out_string, acpi_integer value) |
405 | { | 422 | { |
406 | u32 count; | 423 | u32 count; |
407 | u32 digits_needed; | 424 | u32 digits_needed; |
diff --git a/drivers/acpi/acpica/nsdumpdv.c b/drivers/acpi/acpica/nsdumpdv.c index 41994fe7fbb8..0fe87f1aef16 100644 --- a/drivers/acpi/acpica/nsdumpdv.c +++ b/drivers/acpi/acpica/nsdumpdv.c | |||
@@ -70,7 +70,6 @@ static acpi_status | |||
70 | acpi_ns_dump_one_device(acpi_handle obj_handle, | 70 | acpi_ns_dump_one_device(acpi_handle obj_handle, |
71 | u32 level, void *context, void **return_value) | 71 | u32 level, void *context, void **return_value) |
72 | { | 72 | { |
73 | struct acpi_buffer buffer; | ||
74 | struct acpi_device_info *info; | 73 | struct acpi_device_info *info; |
75 | acpi_status status; | 74 | acpi_status status; |
76 | u32 i; | 75 | u32 i; |
@@ -80,17 +79,15 @@ acpi_ns_dump_one_device(acpi_handle obj_handle, | |||
80 | status = | 79 | status = |
81 | acpi_ns_dump_one_object(obj_handle, level, context, return_value); | 80 | acpi_ns_dump_one_object(obj_handle, level, context, return_value); |
82 | 81 | ||
83 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; | 82 | status = acpi_get_object_info(obj_handle, &info); |
84 | status = acpi_get_object_info(obj_handle, &buffer); | ||
85 | if (ACPI_SUCCESS(status)) { | 83 | if (ACPI_SUCCESS(status)) { |
86 | info = buffer.pointer; | ||
87 | for (i = 0; i < level; i++) { | 84 | for (i = 0; i < level; i++) { |
88 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, " ")); | 85 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, " ")); |
89 | } | 86 | } |
90 | 87 | ||
91 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, | 88 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, |
92 | " HID: %s, ADR: %8.8X%8.8X, Status: %X\n", | 89 | " HID: %s, ADR: %8.8X%8.8X, Status: %X\n", |
93 | info->hardware_id.value, | 90 | info->hardware_id.string, |
94 | ACPI_FORMAT_UINT64(info->address), | 91 | ACPI_FORMAT_UINT64(info->address), |
95 | info->current_status)); | 92 | info->current_status)); |
96 | ACPI_FREE(info); | 93 | ACPI_FREE(info); |
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c index daf4ad37896d..4929dbdbc8f0 100644 --- a/drivers/acpi/acpica/nsxfeval.c +++ b/drivers/acpi/acpica/nsxfeval.c | |||
@@ -535,10 +535,11 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
535 | acpi_status status; | 535 | acpi_status status; |
536 | struct acpi_namespace_node *node; | 536 | struct acpi_namespace_node *node; |
537 | u32 flags; | 537 | u32 flags; |
538 | struct acpica_device_id hid; | 538 | struct acpica_device_id *hid; |
539 | struct acpi_compatible_id_list *cid; | 539 | struct acpica_device_id_list *cid; |
540 | u32 i; | 540 | u32 i; |
541 | int found; | 541 | u8 found; |
542 | int no_match; | ||
542 | 543 | ||
543 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 544 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
544 | if (ACPI_FAILURE(status)) { | 545 | if (ACPI_FAILURE(status)) { |
@@ -582,10 +583,14 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
582 | return (AE_CTRL_DEPTH); | 583 | return (AE_CTRL_DEPTH); |
583 | } | 584 | } |
584 | 585 | ||
585 | if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) { | 586 | no_match = ACPI_STRCMP(hid->string, info->hid); |
586 | 587 | ACPI_FREE(hid); | |
587 | /* Get the list of Compatible IDs */ | ||
588 | 588 | ||
589 | if (no_match) { | ||
590 | /* | ||
591 | * HID does not match, attempt match within the | ||
592 | * list of Compatible IDs (CIDs) | ||
593 | */ | ||
589 | status = acpi_ut_execute_CID(node, &cid); | 594 | status = acpi_ut_execute_CID(node, &cid); |
590 | if (status == AE_NOT_FOUND) { | 595 | if (status == AE_NOT_FOUND) { |
591 | return (AE_OK); | 596 | return (AE_OK); |
@@ -597,10 +602,8 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
597 | 602 | ||
598 | found = 0; | 603 | found = 0; |
599 | for (i = 0; i < cid->count; i++) { | 604 | for (i = 0; i < cid->count; i++) { |
600 | if (ACPI_STRNCMP(cid->id[i].value, info->hid, | 605 | if (ACPI_STRCMP(cid->ids[i].string, info->hid) |
601 | sizeof(struct | 606 | == 0) { |
602 | acpi_compatible_id)) == | ||
603 | 0) { | ||
604 | found = 1; | 607 | found = 1; |
605 | break; | 608 | break; |
606 | } | 609 | } |
diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c index f23593d6add4..ddc84af6336e 100644 --- a/drivers/acpi/acpica/nsxfname.c +++ b/drivers/acpi/acpica/nsxfname.c | |||
@@ -51,6 +51,11 @@ | |||
51 | #define _COMPONENT ACPI_NAMESPACE | 51 | #define _COMPONENT ACPI_NAMESPACE |
52 | ACPI_MODULE_NAME("nsxfname") | 52 | ACPI_MODULE_NAME("nsxfname") |
53 | 53 | ||
54 | /* Local prototypes */ | ||
55 | static char *acpi_ns_copy_device_id(struct acpica_device_id *dest, | ||
56 | struct acpica_device_id *source, | ||
57 | char *string_area); | ||
58 | |||
54 | /****************************************************************************** | 59 | /****************************************************************************** |
55 | * | 60 | * |
56 | * FUNCTION: acpi_get_handle | 61 | * FUNCTION: acpi_get_handle |
@@ -68,6 +73,7 @@ ACPI_MODULE_NAME("nsxfname") | |||
68 | * namespace handle. | 73 | * namespace handle. |
69 | * | 74 | * |
70 | ******************************************************************************/ | 75 | ******************************************************************************/ |
76 | |||
71 | acpi_status | 77 | acpi_status |
72 | acpi_get_handle(acpi_handle parent, | 78 | acpi_get_handle(acpi_handle parent, |
73 | acpi_string pathname, acpi_handle * ret_handle) | 79 | acpi_string pathname, acpi_handle * ret_handle) |
@@ -210,10 +216,38 @@ ACPI_EXPORT_SYMBOL(acpi_get_name) | |||
210 | 216 | ||
211 | /****************************************************************************** | 217 | /****************************************************************************** |
212 | * | 218 | * |
219 | * FUNCTION: acpi_ns_copy_device_id | ||
220 | * | ||
221 | * PARAMETERS: Dest - Pointer to the destination DEVICE_ID | ||
222 | * Source - Pointer to the source DEVICE_ID | ||
223 | * string_area - Pointer to where to copy the dest string | ||
224 | * | ||
225 | * RETURN: Pointer to the next string area | ||
226 | * | ||
227 | * DESCRIPTION: Copy a single DEVICE_ID, including the string data. | ||
228 | * | ||
229 | ******************************************************************************/ | ||
230 | static char *acpi_ns_copy_device_id(struct acpica_device_id *dest, | ||
231 | struct acpica_device_id *source, | ||
232 | char *string_area) | ||
233 | { | ||
234 | /* Create the destination DEVICE_ID */ | ||
235 | |||
236 | dest->string = string_area; | ||
237 | dest->length = source->length; | ||
238 | |||
239 | /* Copy actual string and return a pointer to the next string area */ | ||
240 | |||
241 | ACPI_MEMCPY(string_area, source->string, source->length); | ||
242 | return (string_area + source->length); | ||
243 | } | ||
244 | |||
245 | /****************************************************************************** | ||
246 | * | ||
213 | * FUNCTION: acpi_get_object_info | 247 | * FUNCTION: acpi_get_object_info |
214 | * | 248 | * |
215 | * PARAMETERS: Handle - Object Handle | 249 | * PARAMETERS: Handle - Object Handle |
216 | * Buffer - Where the info is returned | 250 | * return_buffer - Where the info is returned |
217 | * | 251 | * |
218 | * RETURN: Status | 252 | * RETURN: Status |
219 | * | 253 | * |
@@ -221,33 +255,37 @@ ACPI_EXPORT_SYMBOL(acpi_get_name) | |||
221 | * namespace node and possibly by running several standard | 255 | * namespace node and possibly by running several standard |
222 | * control methods (Such as in the case of a device.) | 256 | * control methods (Such as in the case of a device.) |
223 | * | 257 | * |
258 | * For Device and Processor objects, run the Device _HID, _UID, _CID, _STA, | ||
259 | * _ADR, _sx_w, and _sx_d methods. | ||
260 | * | ||
261 | * Note: Allocates the return buffer, must be freed by the caller. | ||
262 | * | ||
224 | ******************************************************************************/ | 263 | ******************************************************************************/ |
264 | |||
225 | acpi_status | 265 | acpi_status |
226 | acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) | 266 | acpi_get_object_info(acpi_handle handle, |
267 | struct acpi_device_info **return_buffer) | ||
227 | { | 268 | { |
228 | acpi_status status; | ||
229 | struct acpi_namespace_node *node; | 269 | struct acpi_namespace_node *node; |
230 | struct acpi_device_info *info; | 270 | struct acpi_device_info *info; |
231 | struct acpi_device_info *return_info; | 271 | struct acpica_device_id_list *cid_list = NULL; |
232 | struct acpi_compatible_id_list *cid_list = NULL; | 272 | struct acpica_device_id *hid = NULL; |
233 | acpi_size size; | 273 | struct acpica_device_id *uid = NULL; |
274 | char *next_id_string; | ||
275 | acpi_object_type type; | ||
276 | acpi_name name; | ||
277 | u8 param_count = 0; | ||
278 | u8 valid = 0; | ||
279 | u32 info_size; | ||
280 | u32 i; | ||
281 | acpi_status status; | ||
234 | 282 | ||
235 | /* Parameter validation */ | 283 | /* Parameter validation */ |
236 | 284 | ||
237 | if (!handle || !buffer) { | 285 | if (!handle || !return_buffer) { |
238 | return (AE_BAD_PARAMETER); | 286 | return (AE_BAD_PARAMETER); |
239 | } | 287 | } |
240 | 288 | ||
241 | status = acpi_ut_validate_buffer(buffer); | ||
242 | if (ACPI_FAILURE(status)) { | ||
243 | return (status); | ||
244 | } | ||
245 | |||
246 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_device_info)); | ||
247 | if (!info) { | ||
248 | return (AE_NO_MEMORY); | ||
249 | } | ||
250 | |||
251 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 289 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
252 | if (ACPI_FAILURE(status)) { | 290 | if (ACPI_FAILURE(status)) { |
253 | goto cleanup; | 291 | goto cleanup; |
@@ -256,66 +294,91 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) | |||
256 | node = acpi_ns_map_handle_to_node(handle); | 294 | node = acpi_ns_map_handle_to_node(handle); |
257 | if (!node) { | 295 | if (!node) { |
258 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 296 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
259 | status = AE_BAD_PARAMETER; | 297 | return (AE_BAD_PARAMETER); |
260 | goto cleanup; | ||
261 | } | 298 | } |
262 | 299 | ||
263 | /* Init return structure */ | 300 | /* Get the namespace node data while the namespace is locked */ |
264 | |||
265 | size = sizeof(struct acpi_device_info); | ||
266 | 301 | ||
267 | info->type = node->type; | 302 | info_size = sizeof(struct acpi_device_info); |
268 | info->name = node->name.integer; | 303 | type = node->type; |
269 | info->valid = 0; | 304 | name = node->name.integer; |
270 | 305 | ||
271 | if (node->type == ACPI_TYPE_METHOD) { | 306 | if (node->type == ACPI_TYPE_METHOD) { |
272 | info->param_count = node->object->method.param_count; | 307 | param_count = node->object->method.param_count; |
273 | } | 308 | } |
274 | 309 | ||
275 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 310 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
276 | if (ACPI_FAILURE(status)) { | 311 | if (ACPI_FAILURE(status)) { |
277 | goto cleanup; | 312 | return (status); |
278 | } | 313 | } |
279 | 314 | ||
280 | /* If not a device, we are all done */ | 315 | if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) { |
281 | |||
282 | if (info->type == ACPI_TYPE_DEVICE) { | ||
283 | /* | 316 | /* |
284 | * Get extra info for ACPI Devices objects only: | 317 | * Get extra info for ACPI Device/Processor objects only: |
285 | * Run the Device _HID, _UID, _CID, _STA, _ADR and _sx_d methods. | 318 | * Run the Device _HID, _UID, and _CID methods. |
286 | * | 319 | * |
287 | * Note: none of these methods are required, so they may or may | 320 | * Note: none of these methods are required, so they may or may |
288 | * not be present for this device. The Info->Valid bitfield is used | 321 | * not be present for this device. The Info->Valid bitfield is used |
289 | * to indicate which methods were found and ran successfully. | 322 | * to indicate which methods were found and run successfully. |
290 | */ | 323 | */ |
291 | 324 | ||
292 | /* Execute the Device._HID method */ | 325 | /* Execute the Device._HID method */ |
293 | 326 | ||
294 | status = acpi_ut_execute_HID(node, &info->hardware_id); | 327 | status = acpi_ut_execute_HID(node, &hid); |
295 | if (ACPI_SUCCESS(status)) { | 328 | if (ACPI_SUCCESS(status)) { |
296 | info->valid |= ACPI_VALID_HID; | 329 | info_size += hid->length; |
330 | valid |= ACPI_VALID_HID; | ||
297 | } | 331 | } |
298 | 332 | ||
299 | /* Execute the Device._UID method */ | 333 | /* Execute the Device._UID method */ |
300 | 334 | ||
301 | status = acpi_ut_execute_UID(node, &info->unique_id); | 335 | status = acpi_ut_execute_UID(node, &uid); |
302 | if (ACPI_SUCCESS(status)) { | 336 | if (ACPI_SUCCESS(status)) { |
303 | info->valid |= ACPI_VALID_UID; | 337 | info_size += uid->length; |
338 | valid |= ACPI_VALID_UID; | ||
304 | } | 339 | } |
305 | 340 | ||
306 | /* Execute the Device._CID method */ | 341 | /* Execute the Device._CID method */ |
307 | 342 | ||
308 | status = acpi_ut_execute_CID(node, &cid_list); | 343 | status = acpi_ut_execute_CID(node, &cid_list); |
309 | if (ACPI_SUCCESS(status)) { | 344 | if (ACPI_SUCCESS(status)) { |
310 | size += cid_list->size; | 345 | |
311 | info->valid |= ACPI_VALID_CID; | 346 | /* Add size of CID strings and CID pointer array */ |
347 | |||
348 | info_size += | ||
349 | (cid_list->list_size - | ||
350 | sizeof(struct acpica_device_id_list)); | ||
351 | valid |= ACPI_VALID_CID; | ||
312 | } | 352 | } |
353 | } | ||
354 | |||
355 | /* | ||
356 | * Now that we have the variable-length data, we can allocate the | ||
357 | * return buffer | ||
358 | */ | ||
359 | info = ACPI_ALLOCATE_ZEROED(info_size); | ||
360 | if (!info) { | ||
361 | status = AE_NO_MEMORY; | ||
362 | goto cleanup; | ||
363 | } | ||
364 | |||
365 | /* Get the fixed-length data */ | ||
366 | |||
367 | if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) { | ||
368 | /* | ||
369 | * Get extra info for ACPI Device/Processor objects only: | ||
370 | * Run the _STA, _ADR and, sx_w, and _sx_d methods. | ||
371 | * | ||
372 | * Note: none of these methods are required, so they may or may | ||
373 | * not be present for this device. The Info->Valid bitfield is used | ||
374 | * to indicate which methods were found and run successfully. | ||
375 | */ | ||
313 | 376 | ||
314 | /* Execute the Device._STA method */ | 377 | /* Execute the Device._STA method */ |
315 | 378 | ||
316 | status = acpi_ut_execute_STA(node, &info->current_status); | 379 | status = acpi_ut_execute_STA(node, &info->current_status); |
317 | if (ACPI_SUCCESS(status)) { | 380 | if (ACPI_SUCCESS(status)) { |
318 | info->valid |= ACPI_VALID_STA; | 381 | valid |= ACPI_VALID_STA; |
319 | } | 382 | } |
320 | 383 | ||
321 | /* Execute the Device._ADR method */ | 384 | /* Execute the Device._ADR method */ |
@@ -323,36 +386,100 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) | |||
323 | status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, node, | 386 | status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, node, |
324 | &info->address); | 387 | &info->address); |
325 | if (ACPI_SUCCESS(status)) { | 388 | if (ACPI_SUCCESS(status)) { |
326 | info->valid |= ACPI_VALID_ADR; | 389 | valid |= ACPI_VALID_ADR; |
390 | } | ||
391 | |||
392 | /* Execute the Device._sx_w methods */ | ||
393 | |||
394 | status = acpi_ut_execute_power_methods(node, | ||
395 | acpi_gbl_lowest_dstate_names, | ||
396 | ACPI_NUM_sx_w_METHODS, | ||
397 | info->lowest_dstates); | ||
398 | if (ACPI_SUCCESS(status)) { | ||
399 | valid |= ACPI_VALID_SXWS; | ||
327 | } | 400 | } |
328 | 401 | ||
329 | /* Execute the Device._sx_d methods */ | 402 | /* Execute the Device._sx_d methods */ |
330 | 403 | ||
331 | status = acpi_ut_execute_sxds(node, info->highest_dstates); | 404 | status = acpi_ut_execute_power_methods(node, |
405 | acpi_gbl_highest_dstate_names, | ||
406 | ACPI_NUM_sx_d_METHODS, | ||
407 | info->highest_dstates); | ||
332 | if (ACPI_SUCCESS(status)) { | 408 | if (ACPI_SUCCESS(status)) { |
333 | info->valid |= ACPI_VALID_SXDS; | 409 | valid |= ACPI_VALID_SXDS; |
334 | } | 410 | } |
335 | } | 411 | } |
336 | 412 | ||
337 | /* Validate/Allocate/Clear caller buffer */ | 413 | /* |
414 | * Create a pointer to the string area of the return buffer. | ||
415 | * Point to the end of the base struct acpi_device_info structure. | ||
416 | */ | ||
417 | next_id_string = ACPI_CAST_PTR(char, info->compatible_id_list.ids); | ||
418 | if (cid_list) { | ||
338 | 419 | ||
339 | status = acpi_ut_initialize_buffer(buffer, size); | 420 | /* Point past the CID DEVICE_ID array */ |
340 | if (ACPI_FAILURE(status)) { | 421 | |
341 | goto cleanup; | 422 | next_id_string += |
423 | ((acpi_size) cid_list->count * | ||
424 | sizeof(struct acpica_device_id)); | ||
342 | } | 425 | } |
343 | 426 | ||
344 | /* Populate the return buffer */ | 427 | /* |
428 | * Copy the HID, UID, and CIDs to the return buffer. The variable-length | ||
429 | * strings are copied to the reserved area at the end of the buffer. | ||
430 | * | ||
431 | * For HID and CID, check if the ID is a PCI Root Bridge. | ||
432 | */ | ||
433 | if (hid) { | ||
434 | next_id_string = acpi_ns_copy_device_id(&info->hardware_id, | ||
435 | hid, next_id_string); | ||
436 | |||
437 | if (acpi_ut_is_pci_root_bridge(hid->string)) { | ||
438 | info->flags |= ACPI_PCI_ROOT_BRIDGE; | ||
439 | } | ||
440 | } | ||
345 | 441 | ||
346 | return_info = buffer->pointer; | 442 | if (uid) { |
347 | ACPI_MEMCPY(return_info, info, sizeof(struct acpi_device_info)); | 443 | next_id_string = acpi_ns_copy_device_id(&info->unique_id, |
444 | uid, next_id_string); | ||
445 | } | ||
348 | 446 | ||
349 | if (cid_list) { | 447 | if (cid_list) { |
350 | ACPI_MEMCPY(&return_info->compatibility_id, cid_list, | 448 | info->compatible_id_list.count = cid_list->count; |
351 | cid_list->size); | 449 | info->compatible_id_list.list_size = cid_list->list_size; |
450 | |||
451 | /* Copy each CID */ | ||
452 | |||
453 | for (i = 0; i < cid_list->count; i++) { | ||
454 | next_id_string = | ||
455 | acpi_ns_copy_device_id(&info->compatible_id_list. | ||
456 | ids[i], &cid_list->ids[i], | ||
457 | next_id_string); | ||
458 | |||
459 | if (acpi_ut_is_pci_root_bridge(cid_list->ids[i].string)) { | ||
460 | info->flags |= ACPI_PCI_ROOT_BRIDGE; | ||
461 | } | ||
462 | } | ||
352 | } | 463 | } |
353 | 464 | ||
465 | /* Copy the fixed-length data */ | ||
466 | |||
467 | info->info_size = info_size; | ||
468 | info->type = type; | ||
469 | info->name = name; | ||
470 | info->param_count = param_count; | ||
471 | info->valid = valid; | ||
472 | |||
473 | *return_buffer = info; | ||
474 | status = AE_OK; | ||
475 | |||
354 | cleanup: | 476 | cleanup: |
355 | ACPI_FREE(info); | 477 | if (hid) { |
478 | ACPI_FREE(hid); | ||
479 | } | ||
480 | if (uid) { | ||
481 | ACPI_FREE(uid); | ||
482 | } | ||
356 | if (cid_list) { | 483 | if (cid_list) { |
357 | ACPI_FREE(cid_list); | 484 | ACPI_FREE(cid_list); |
358 | } | 485 | } |
diff --git a/drivers/acpi/acpica/uteval.c b/drivers/acpi/acpica/uteval.c index 006b16c26017..5503307b8bb7 100644 --- a/drivers/acpi/acpica/uteval.c +++ b/drivers/acpi/acpica/uteval.c | |||
@@ -44,19 +44,10 @@ | |||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include "accommon.h" | 45 | #include "accommon.h" |
46 | #include "acnamesp.h" | 46 | #include "acnamesp.h" |
47 | #include "acinterp.h" | ||
48 | 47 | ||
49 | #define _COMPONENT ACPI_UTILITIES | 48 | #define _COMPONENT ACPI_UTILITIES |
50 | ACPI_MODULE_NAME("uteval") | 49 | ACPI_MODULE_NAME("uteval") |
51 | 50 | ||
52 | /* Local prototypes */ | ||
53 | static void | ||
54 | acpi_ut_copy_id_string(char *destination, char *source, acpi_size max_length); | ||
55 | |||
56 | static acpi_status | ||
57 | acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, | ||
58 | struct acpi_compatible_id *one_cid); | ||
59 | |||
60 | /* | 51 | /* |
61 | * Strings supported by the _OSI predefined (internal) method. | 52 | * Strings supported by the _OSI predefined (internal) method. |
62 | * | 53 | * |
@@ -213,7 +204,7 @@ acpi_status acpi_osi_invalidate(char *interface) | |||
213 | * RETURN: Status | 204 | * RETURN: Status |
214 | * | 205 | * |
215 | * DESCRIPTION: Evaluates a namespace object and verifies the type of the | 206 | * DESCRIPTION: Evaluates a namespace object and verifies the type of the |
216 | * return object. Common code that simplifies accessing objects | 207 | * return object. Common code that simplifies accessing objects |
217 | * that have required return objects of fixed types. | 208 | * that have required return objects of fixed types. |
218 | * | 209 | * |
219 | * NOTE: Internal function, no parameter validation | 210 | * NOTE: Internal function, no parameter validation |
@@ -298,7 +289,7 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
298 | 289 | ||
299 | if ((acpi_gbl_enable_interpreter_slack) && (!expected_return_btypes)) { | 290 | if ((acpi_gbl_enable_interpreter_slack) && (!expected_return_btypes)) { |
300 | /* | 291 | /* |
301 | * We received a return object, but one was not expected. This can | 292 | * We received a return object, but one was not expected. This can |
302 | * happen frequently if the "implicit return" feature is enabled. | 293 | * happen frequently if the "implicit return" feature is enabled. |
303 | * Just delete the return object and return AE_OK. | 294 | * Just delete the return object and return AE_OK. |
304 | */ | 295 | */ |
@@ -340,12 +331,12 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
340 | * | 331 | * |
341 | * PARAMETERS: object_name - Object name to be evaluated | 332 | * PARAMETERS: object_name - Object name to be evaluated |
342 | * device_node - Node for the device | 333 | * device_node - Node for the device |
343 | * Address - Where the value is returned | 334 | * Value - Where the value is returned |
344 | * | 335 | * |
345 | * RETURN: Status | 336 | * RETURN: Status |
346 | * | 337 | * |
347 | * DESCRIPTION: Evaluates a numeric namespace object for a selected device | 338 | * DESCRIPTION: Evaluates a numeric namespace object for a selected device |
348 | * and stores result in *Address. | 339 | * and stores result in *Value. |
349 | * | 340 | * |
350 | * NOTE: Internal function, no parameter validation | 341 | * NOTE: Internal function, no parameter validation |
351 | * | 342 | * |
@@ -354,7 +345,7 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
354 | acpi_status | 345 | acpi_status |
355 | acpi_ut_evaluate_numeric_object(char *object_name, | 346 | acpi_ut_evaluate_numeric_object(char *object_name, |
356 | struct acpi_namespace_node *device_node, | 347 | struct acpi_namespace_node *device_node, |
357 | acpi_integer * address) | 348 | acpi_integer *value) |
358 | { | 349 | { |
359 | union acpi_operand_object *obj_desc; | 350 | union acpi_operand_object *obj_desc; |
360 | acpi_status status; | 351 | acpi_status status; |
@@ -369,295 +360,7 @@ acpi_ut_evaluate_numeric_object(char *object_name, | |||
369 | 360 | ||
370 | /* Get the returned Integer */ | 361 | /* Get the returned Integer */ |
371 | 362 | ||
372 | *address = obj_desc->integer.value; | 363 | *value = obj_desc->integer.value; |
373 | |||
374 | /* On exit, we must delete the return object */ | ||
375 | |||
376 | acpi_ut_remove_reference(obj_desc); | ||
377 | return_ACPI_STATUS(status); | ||
378 | } | ||
379 | |||
380 | /******************************************************************************* | ||
381 | * | ||
382 | * FUNCTION: acpi_ut_copy_id_string | ||
383 | * | ||
384 | * PARAMETERS: Destination - Where to copy the string | ||
385 | * Source - Source string | ||
386 | * max_length - Length of the destination buffer | ||
387 | * | ||
388 | * RETURN: None | ||
389 | * | ||
390 | * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods. | ||
391 | * Performs removal of a leading asterisk if present -- workaround | ||
392 | * for a known issue on a bunch of machines. | ||
393 | * | ||
394 | ******************************************************************************/ | ||
395 | |||
396 | static void | ||
397 | acpi_ut_copy_id_string(char *destination, char *source, acpi_size max_length) | ||
398 | { | ||
399 | |||
400 | /* | ||
401 | * Workaround for ID strings that have a leading asterisk. This construct | ||
402 | * is not allowed by the ACPI specification (ID strings must be | ||
403 | * alphanumeric), but enough existing machines have this embedded in their | ||
404 | * ID strings that the following code is useful. | ||
405 | */ | ||
406 | if (*source == '*') { | ||
407 | source++; | ||
408 | } | ||
409 | |||
410 | /* Do the actual copy */ | ||
411 | |||
412 | ACPI_STRNCPY(destination, source, max_length); | ||
413 | } | ||
414 | |||
415 | /******************************************************************************* | ||
416 | * | ||
417 | * FUNCTION: acpi_ut_execute_HID | ||
418 | * | ||
419 | * PARAMETERS: device_node - Node for the device | ||
420 | * Hid - Where the HID is returned | ||
421 | * | ||
422 | * RETURN: Status | ||
423 | * | ||
424 | * DESCRIPTION: Executes the _HID control method that returns the hardware | ||
425 | * ID of the device. | ||
426 | * | ||
427 | * NOTE: Internal function, no parameter validation | ||
428 | * | ||
429 | ******************************************************************************/ | ||
430 | |||
431 | acpi_status | ||
432 | acpi_ut_execute_HID(struct acpi_namespace_node *device_node, | ||
433 | struct acpica_device_id *hid) | ||
434 | { | ||
435 | union acpi_operand_object *obj_desc; | ||
436 | acpi_status status; | ||
437 | |||
438 | ACPI_FUNCTION_TRACE(ut_execute_HID); | ||
439 | |||
440 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID, | ||
441 | ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, | ||
442 | &obj_desc); | ||
443 | if (ACPI_FAILURE(status)) { | ||
444 | return_ACPI_STATUS(status); | ||
445 | } | ||
446 | |||
447 | if (obj_desc->common.type == ACPI_TYPE_INTEGER) { | ||
448 | |||
449 | /* Convert the Numeric HID to string */ | ||
450 | |||
451 | acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value, | ||
452 | hid->value); | ||
453 | } else { | ||
454 | /* Copy the String HID from the returned object */ | ||
455 | |||
456 | acpi_ut_copy_id_string(hid->value, obj_desc->string.pointer, | ||
457 | sizeof(hid->value)); | ||
458 | } | ||
459 | |||
460 | /* On exit, we must delete the return object */ | ||
461 | |||
462 | acpi_ut_remove_reference(obj_desc); | ||
463 | return_ACPI_STATUS(status); | ||
464 | } | ||
465 | |||
466 | /******************************************************************************* | ||
467 | * | ||
468 | * FUNCTION: acpi_ut_translate_one_cid | ||
469 | * | ||
470 | * PARAMETERS: obj_desc - _CID object, must be integer or string | ||
471 | * one_cid - Where the CID string is returned | ||
472 | * | ||
473 | * RETURN: Status | ||
474 | * | ||
475 | * DESCRIPTION: Return a numeric or string _CID value as a string. | ||
476 | * (Compatible ID) | ||
477 | * | ||
478 | * NOTE: Assumes a maximum _CID string length of | ||
479 | * ACPI_MAX_CID_LENGTH. | ||
480 | * | ||
481 | ******************************************************************************/ | ||
482 | |||
483 | static acpi_status | ||
484 | acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, | ||
485 | struct acpi_compatible_id *one_cid) | ||
486 | { | ||
487 | |||
488 | switch (obj_desc->common.type) { | ||
489 | case ACPI_TYPE_INTEGER: | ||
490 | |||
491 | /* Convert the Numeric CID to string */ | ||
492 | |||
493 | acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value, | ||
494 | one_cid->value); | ||
495 | return (AE_OK); | ||
496 | |||
497 | case ACPI_TYPE_STRING: | ||
498 | |||
499 | if (obj_desc->string.length > ACPI_MAX_CID_LENGTH) { | ||
500 | return (AE_AML_STRING_LIMIT); | ||
501 | } | ||
502 | |||
503 | /* Copy the String CID from the returned object */ | ||
504 | |||
505 | acpi_ut_copy_id_string(one_cid->value, obj_desc->string.pointer, | ||
506 | ACPI_MAX_CID_LENGTH); | ||
507 | return (AE_OK); | ||
508 | |||
509 | default: | ||
510 | |||
511 | return (AE_TYPE); | ||
512 | } | ||
513 | } | ||
514 | |||
515 | /******************************************************************************* | ||
516 | * | ||
517 | * FUNCTION: acpi_ut_execute_CID | ||
518 | * | ||
519 | * PARAMETERS: device_node - Node for the device | ||
520 | * return_cid_list - Where the CID list is returned | ||
521 | * | ||
522 | * RETURN: Status | ||
523 | * | ||
524 | * DESCRIPTION: Executes the _CID control method that returns one or more | ||
525 | * compatible hardware IDs for the device. | ||
526 | * | ||
527 | * NOTE: Internal function, no parameter validation | ||
528 | * | ||
529 | ******************************************************************************/ | ||
530 | |||
531 | acpi_status | ||
532 | acpi_ut_execute_CID(struct acpi_namespace_node * device_node, | ||
533 | struct acpi_compatible_id_list ** return_cid_list) | ||
534 | { | ||
535 | union acpi_operand_object *obj_desc; | ||
536 | acpi_status status; | ||
537 | u32 count; | ||
538 | u32 size; | ||
539 | struct acpi_compatible_id_list *cid_list; | ||
540 | u32 i; | ||
541 | |||
542 | ACPI_FUNCTION_TRACE(ut_execute_CID); | ||
543 | |||
544 | /* Evaluate the _CID method for this device */ | ||
545 | |||
546 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__CID, | ||
547 | ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ||
548 | | ACPI_BTYPE_PACKAGE, &obj_desc); | ||
549 | if (ACPI_FAILURE(status)) { | ||
550 | return_ACPI_STATUS(status); | ||
551 | } | ||
552 | |||
553 | /* Get the number of _CIDs returned */ | ||
554 | |||
555 | count = 1; | ||
556 | if (obj_desc->common.type == ACPI_TYPE_PACKAGE) { | ||
557 | count = obj_desc->package.count; | ||
558 | } | ||
559 | |||
560 | /* Allocate a worst-case buffer for the _CIDs */ | ||
561 | |||
562 | size = (((count - 1) * sizeof(struct acpi_compatible_id)) + | ||
563 | sizeof(struct acpi_compatible_id_list)); | ||
564 | |||
565 | cid_list = ACPI_ALLOCATE_ZEROED((acpi_size) size); | ||
566 | if (!cid_list) { | ||
567 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
568 | } | ||
569 | |||
570 | /* Init CID list */ | ||
571 | |||
572 | cid_list->count = count; | ||
573 | cid_list->size = size; | ||
574 | |||
575 | /* | ||
576 | * A _CID can return either a single compatible ID or a package of | ||
577 | * compatible IDs. Each compatible ID can be one of the following: | ||
578 | * 1) Integer (32 bit compressed EISA ID) or | ||
579 | * 2) String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss") | ||
580 | */ | ||
581 | |||
582 | /* The _CID object can be either a single CID or a package (list) of CIDs */ | ||
583 | |||
584 | if (obj_desc->common.type == ACPI_TYPE_PACKAGE) { | ||
585 | |||
586 | /* Translate each package element */ | ||
587 | |||
588 | for (i = 0; i < count; i++) { | ||
589 | status = | ||
590 | acpi_ut_translate_one_cid(obj_desc->package. | ||
591 | elements[i], | ||
592 | &cid_list->id[i]); | ||
593 | if (ACPI_FAILURE(status)) { | ||
594 | break; | ||
595 | } | ||
596 | } | ||
597 | } else { | ||
598 | /* Only one CID, translate to a string */ | ||
599 | |||
600 | status = acpi_ut_translate_one_cid(obj_desc, cid_list->id); | ||
601 | } | ||
602 | |||
603 | /* Cleanup on error */ | ||
604 | |||
605 | if (ACPI_FAILURE(status)) { | ||
606 | ACPI_FREE(cid_list); | ||
607 | } else { | ||
608 | *return_cid_list = cid_list; | ||
609 | } | ||
610 | |||
611 | /* On exit, we must delete the _CID return object */ | ||
612 | |||
613 | acpi_ut_remove_reference(obj_desc); | ||
614 | return_ACPI_STATUS(status); | ||
615 | } | ||
616 | |||
617 | /******************************************************************************* | ||
618 | * | ||
619 | * FUNCTION: acpi_ut_execute_UID | ||
620 | * | ||
621 | * PARAMETERS: device_node - Node for the device | ||
622 | * Uid - Where the UID is returned | ||
623 | * | ||
624 | * RETURN: Status | ||
625 | * | ||
626 | * DESCRIPTION: Executes the _UID control method that returns the hardware | ||
627 | * ID of the device. | ||
628 | * | ||
629 | * NOTE: Internal function, no parameter validation | ||
630 | * | ||
631 | ******************************************************************************/ | ||
632 | |||
633 | acpi_status | ||
634 | acpi_ut_execute_UID(struct acpi_namespace_node *device_node, | ||
635 | struct acpica_device_id *uid) | ||
636 | { | ||
637 | union acpi_operand_object *obj_desc; | ||
638 | acpi_status status; | ||
639 | |||
640 | ACPI_FUNCTION_TRACE(ut_execute_UID); | ||
641 | |||
642 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID, | ||
643 | ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, | ||
644 | &obj_desc); | ||
645 | if (ACPI_FAILURE(status)) { | ||
646 | return_ACPI_STATUS(status); | ||
647 | } | ||
648 | |||
649 | if (obj_desc->common.type == ACPI_TYPE_INTEGER) { | ||
650 | |||
651 | /* Convert the Numeric UID to string */ | ||
652 | |||
653 | acpi_ex_unsigned_integer_to_string(obj_desc->integer.value, | ||
654 | uid->value); | ||
655 | } else { | ||
656 | /* Copy the String UID from the returned object */ | ||
657 | |||
658 | acpi_ut_copy_id_string(uid->value, obj_desc->string.pointer, | ||
659 | sizeof(uid->value)); | ||
660 | } | ||
661 | 364 | ||
662 | /* On exit, we must delete the return object */ | 365 | /* On exit, we must delete the return object */ |
663 | 366 | ||
@@ -716,60 +419,64 @@ acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 * flags) | |||
716 | 419 | ||
717 | /******************************************************************************* | 420 | /******************************************************************************* |
718 | * | 421 | * |
719 | * FUNCTION: acpi_ut_execute_Sxds | 422 | * FUNCTION: acpi_ut_execute_power_methods |
720 | * | 423 | * |
721 | * PARAMETERS: device_node - Node for the device | 424 | * PARAMETERS: device_node - Node for the device |
722 | * Flags - Where the status flags are returned | 425 | * method_names - Array of power method names |
426 | * method_count - Number of methods to execute | ||
427 | * out_values - Where the power method values are returned | ||
723 | * | 428 | * |
724 | * RETURN: Status | 429 | * RETURN: Status, out_values |
725 | * | 430 | * |
726 | * DESCRIPTION: Executes _STA for selected device and stores results in | 431 | * DESCRIPTION: Executes the specified power methods for the device and returns |
727 | * *Flags. | 432 | * the result(s). |
728 | * | 433 | * |
729 | * NOTE: Internal function, no parameter validation | 434 | * NOTE: Internal function, no parameter validation |
730 | * | 435 | * |
731 | ******************************************************************************/ | 436 | ******************************************************************************/ |
732 | 437 | ||
733 | acpi_status | 438 | acpi_status |
734 | acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest) | 439 | acpi_ut_execute_power_methods(struct acpi_namespace_node *device_node, |
440 | const char **method_names, | ||
441 | u8 method_count, u8 *out_values) | ||
735 | { | 442 | { |
736 | union acpi_operand_object *obj_desc; | 443 | union acpi_operand_object *obj_desc; |
737 | acpi_status status; | 444 | acpi_status status; |
445 | acpi_status final_status = AE_NOT_FOUND; | ||
738 | u32 i; | 446 | u32 i; |
739 | 447 | ||
740 | ACPI_FUNCTION_TRACE(ut_execute_sxds); | 448 | ACPI_FUNCTION_TRACE(ut_execute_power_methods); |
741 | 449 | ||
742 | for (i = 0; i < 4; i++) { | 450 | for (i = 0; i < method_count; i++) { |
743 | highest[i] = 0xFF; | 451 | /* |
452 | * Execute the power method (_sx_d or _sx_w). The only allowable | ||
453 | * return type is an Integer. | ||
454 | */ | ||
744 | status = acpi_ut_evaluate_object(device_node, | 455 | status = acpi_ut_evaluate_object(device_node, |
745 | ACPI_CAST_PTR(char, | 456 | ACPI_CAST_PTR(char, |
746 | acpi_gbl_highest_dstate_names | 457 | method_names[i]), |
747 | [i]), | ||
748 | ACPI_BTYPE_INTEGER, &obj_desc); | 458 | ACPI_BTYPE_INTEGER, &obj_desc); |
749 | if (ACPI_FAILURE(status)) { | 459 | if (ACPI_SUCCESS(status)) { |
750 | if (status != AE_NOT_FOUND) { | 460 | out_values[i] = (u8)obj_desc->integer.value; |
751 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
752 | "%s on Device %4.4s, %s\n", | ||
753 | ACPI_CAST_PTR(char, | ||
754 | acpi_gbl_highest_dstate_names | ||
755 | [i]), | ||
756 | acpi_ut_get_node_name | ||
757 | (device_node), | ||
758 | acpi_format_exception | ||
759 | (status))); | ||
760 | |||
761 | return_ACPI_STATUS(status); | ||
762 | } | ||
763 | } else { | ||
764 | /* Extract the Dstate value */ | ||
765 | |||
766 | highest[i] = (u8) obj_desc->integer.value; | ||
767 | 461 | ||
768 | /* Delete the return object */ | 462 | /* Delete the return object */ |
769 | 463 | ||
770 | acpi_ut_remove_reference(obj_desc); | 464 | acpi_ut_remove_reference(obj_desc); |
465 | final_status = AE_OK; /* At least one value is valid */ | ||
466 | continue; | ||
771 | } | 467 | } |
468 | |||
469 | out_values[i] = ACPI_UINT8_MAX; | ||
470 | if (status == AE_NOT_FOUND) { | ||
471 | continue; /* Ignore if not found */ | ||
472 | } | ||
473 | |||
474 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
475 | "Failed %s on Device %4.4s, %s\n", | ||
476 | ACPI_CAST_PTR(char, method_names[i]), | ||
477 | acpi_ut_get_node_name(device_node), | ||
478 | acpi_format_exception(status))); | ||
772 | } | 479 | } |
773 | 480 | ||
774 | return_ACPI_STATUS(AE_OK); | 481 | return_ACPI_STATUS(final_status); |
775 | } | 482 | } |
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c index 59e46f257c02..ed7a33c67fbe 100644 --- a/drivers/acpi/acpica/utglobal.c +++ b/drivers/acpi/acpica/utglobal.c | |||
@@ -90,7 +90,15 @@ const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = { | |||
90 | "\\_S5_" | 90 | "\\_S5_" |
91 | }; | 91 | }; |
92 | 92 | ||
93 | const char *acpi_gbl_highest_dstate_names[4] = { | 93 | const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS] = { |
94 | "_S0W", | ||
95 | "_S1W", | ||
96 | "_S2W", | ||
97 | "_S3W", | ||
98 | "_S4W" | ||
99 | }; | ||
100 | |||
101 | const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS] = { | ||
94 | "_S1D", | 102 | "_S1D", |
95 | "_S2D", | 103 | "_S2D", |
96 | "_S3D", | 104 | "_S3D", |
diff --git a/drivers/acpi/acpica/utids.c b/drivers/acpi/acpica/utids.c new file mode 100644 index 000000000000..52eaae404554 --- /dev/null +++ b/drivers/acpi/acpica/utids.c | |||
@@ -0,0 +1,382 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Module Name: utids - support for device IDs - HID, UID, CID | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2009, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <acpi/acpi.h> | ||
45 | #include "accommon.h" | ||
46 | #include "acinterp.h" | ||
47 | |||
48 | #define _COMPONENT ACPI_UTILITIES | ||
49 | ACPI_MODULE_NAME("utids") | ||
50 | |||
51 | /* Local prototypes */ | ||
52 | static void acpi_ut_copy_id_string(char *destination, char *source); | ||
53 | |||
54 | /******************************************************************************* | ||
55 | * | ||
56 | * FUNCTION: acpi_ut_copy_id_string | ||
57 | * | ||
58 | * PARAMETERS: Destination - Where to copy the string | ||
59 | * Source - Source string | ||
60 | * | ||
61 | * RETURN: None | ||
62 | * | ||
63 | * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods. | ||
64 | * Performs removal of a leading asterisk if present -- workaround | ||
65 | * for a known issue on a bunch of machines. | ||
66 | * | ||
67 | ******************************************************************************/ | ||
68 | |||
69 | static void acpi_ut_copy_id_string(char *destination, char *source) | ||
70 | { | ||
71 | |||
72 | /* | ||
73 | * Workaround for ID strings that have a leading asterisk. This construct | ||
74 | * is not allowed by the ACPI specification (ID strings must be | ||
75 | * alphanumeric), but enough existing machines have this embedded in their | ||
76 | * ID strings that the following code is useful. | ||
77 | */ | ||
78 | if (*source == '*') { | ||
79 | source++; | ||
80 | } | ||
81 | |||
82 | /* Do the actual copy */ | ||
83 | |||
84 | ACPI_STRCPY(destination, source); | ||
85 | } | ||
86 | |||
87 | /******************************************************************************* | ||
88 | * | ||
89 | * FUNCTION: acpi_ut_execute_HID | ||
90 | * | ||
91 | * PARAMETERS: device_node - Node for the device | ||
92 | * return_id - Where the string HID is returned | ||
93 | * | ||
94 | * RETURN: Status | ||
95 | * | ||
96 | * DESCRIPTION: Executes the _HID control method that returns the hardware | ||
97 | * ID of the device. The HID is either an 32-bit encoded EISAID | ||
98 | * Integer or a String. A string is always returned. An EISAID | ||
99 | * is converted to a string. | ||
100 | * | ||
101 | * NOTE: Internal function, no parameter validation | ||
102 | * | ||
103 | ******************************************************************************/ | ||
104 | |||
105 | acpi_status | ||
106 | acpi_ut_execute_HID(struct acpi_namespace_node *device_node, | ||
107 | struct acpica_device_id **return_id) | ||
108 | { | ||
109 | union acpi_operand_object *obj_desc; | ||
110 | struct acpica_device_id *hid; | ||
111 | u32 length; | ||
112 | acpi_status status; | ||
113 | |||
114 | ACPI_FUNCTION_TRACE(ut_execute_HID); | ||
115 | |||
116 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID, | ||
117 | ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, | ||
118 | &obj_desc); | ||
119 | if (ACPI_FAILURE(status)) { | ||
120 | return_ACPI_STATUS(status); | ||
121 | } | ||
122 | |||
123 | /* Get the size of the String to be returned, includes null terminator */ | ||
124 | |||
125 | if (obj_desc->common.type == ACPI_TYPE_INTEGER) { | ||
126 | length = ACPI_EISAID_STRING_SIZE; | ||
127 | } else { | ||
128 | length = obj_desc->string.length + 1; | ||
129 | } | ||
130 | |||
131 | /* Allocate a buffer for the HID */ | ||
132 | |||
133 | hid = | ||
134 | ACPI_ALLOCATE_ZEROED(sizeof(struct acpica_device_id) + | ||
135 | (acpi_size) length); | ||
136 | if (!hid) { | ||
137 | status = AE_NO_MEMORY; | ||
138 | goto cleanup; | ||
139 | } | ||
140 | |||
141 | /* Area for the string starts after DEVICE_ID struct */ | ||
142 | |||
143 | hid->string = ACPI_ADD_PTR(char, hid, sizeof(struct acpica_device_id)); | ||
144 | |||
145 | /* Convert EISAID to a string or simply copy existing string */ | ||
146 | |||
147 | if (obj_desc->common.type == ACPI_TYPE_INTEGER) { | ||
148 | acpi_ex_eisa_id_to_string(hid->string, obj_desc->integer.value); | ||
149 | } else { | ||
150 | acpi_ut_copy_id_string(hid->string, obj_desc->string.pointer); | ||
151 | } | ||
152 | |||
153 | hid->length = length; | ||
154 | *return_id = hid; | ||
155 | |||
156 | cleanup: | ||
157 | |||
158 | /* On exit, we must delete the return object */ | ||
159 | |||
160 | acpi_ut_remove_reference(obj_desc); | ||
161 | return_ACPI_STATUS(status); | ||
162 | } | ||
163 | |||
164 | /******************************************************************************* | ||
165 | * | ||
166 | * FUNCTION: acpi_ut_execute_UID | ||
167 | * | ||
168 | * PARAMETERS: device_node - Node for the device | ||
169 | * return_id - Where the string UID is returned | ||
170 | * | ||
171 | * RETURN: Status | ||
172 | * | ||
173 | * DESCRIPTION: Executes the _UID control method that returns the unique | ||
174 | * ID of the device. The UID is either a 64-bit Integer (NOT an | ||
175 | * EISAID) or a string. Always returns a string. A 64-bit integer | ||
176 | * is converted to a decimal string. | ||
177 | * | ||
178 | * NOTE: Internal function, no parameter validation | ||
179 | * | ||
180 | ******************************************************************************/ | ||
181 | |||
182 | acpi_status | ||
183 | acpi_ut_execute_UID(struct acpi_namespace_node *device_node, | ||
184 | struct acpica_device_id **return_id) | ||
185 | { | ||
186 | union acpi_operand_object *obj_desc; | ||
187 | struct acpica_device_id *uid; | ||
188 | u32 length; | ||
189 | acpi_status status; | ||
190 | |||
191 | ACPI_FUNCTION_TRACE(ut_execute_UID); | ||
192 | |||
193 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID, | ||
194 | ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, | ||
195 | &obj_desc); | ||
196 | if (ACPI_FAILURE(status)) { | ||
197 | return_ACPI_STATUS(status); | ||
198 | } | ||
199 | |||
200 | /* Get the size of the String to be returned, includes null terminator */ | ||
201 | |||
202 | if (obj_desc->common.type == ACPI_TYPE_INTEGER) { | ||
203 | length = ACPI_MAX64_DECIMAL_DIGITS + 1; | ||
204 | } else { | ||
205 | length = obj_desc->string.length + 1; | ||
206 | } | ||
207 | |||
208 | /* Allocate a buffer for the UID */ | ||
209 | |||
210 | uid = | ||
211 | ACPI_ALLOCATE_ZEROED(sizeof(struct acpica_device_id) + | ||
212 | (acpi_size) length); | ||
213 | if (!uid) { | ||
214 | status = AE_NO_MEMORY; | ||
215 | goto cleanup; | ||
216 | } | ||
217 | |||
218 | /* Area for the string starts after DEVICE_ID struct */ | ||
219 | |||
220 | uid->string = ACPI_ADD_PTR(char, uid, sizeof(struct acpica_device_id)); | ||
221 | |||
222 | /* Convert an Integer to string, or just copy an existing string */ | ||
223 | |||
224 | if (obj_desc->common.type == ACPI_TYPE_INTEGER) { | ||
225 | acpi_ex_integer_to_string(uid->string, obj_desc->integer.value); | ||
226 | } else { | ||
227 | acpi_ut_copy_id_string(uid->string, obj_desc->string.pointer); | ||
228 | } | ||
229 | |||
230 | uid->length = length; | ||
231 | *return_id = uid; | ||
232 | |||
233 | cleanup: | ||
234 | |||
235 | /* On exit, we must delete the return object */ | ||
236 | |||
237 | acpi_ut_remove_reference(obj_desc); | ||
238 | return_ACPI_STATUS(status); | ||
239 | } | ||
240 | |||
241 | /******************************************************************************* | ||
242 | * | ||
243 | * FUNCTION: acpi_ut_execute_CID | ||
244 | * | ||
245 | * PARAMETERS: device_node - Node for the device | ||
246 | * return_cid_list - Where the CID list is returned | ||
247 | * | ||
248 | * RETURN: Status, list of CID strings | ||
249 | * | ||
250 | * DESCRIPTION: Executes the _CID control method that returns one or more | ||
251 | * compatible hardware IDs for the device. | ||
252 | * | ||
253 | * NOTE: Internal function, no parameter validation | ||
254 | * | ||
255 | * A _CID method can return either a single compatible ID or a package of | ||
256 | * compatible IDs. Each compatible ID can be one of the following: | ||
257 | * 1) Integer (32 bit compressed EISA ID) or | ||
258 | * 2) String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss") | ||
259 | * | ||
260 | * The Integer CIDs are converted to string format by this function. | ||
261 | * | ||
262 | ******************************************************************************/ | ||
263 | |||
264 | acpi_status | ||
265 | acpi_ut_execute_CID(struct acpi_namespace_node *device_node, | ||
266 | struct acpica_device_id_list **return_cid_list) | ||
267 | { | ||
268 | union acpi_operand_object **cid_objects; | ||
269 | union acpi_operand_object *obj_desc; | ||
270 | struct acpica_device_id_list *cid_list; | ||
271 | char *next_id_string; | ||
272 | u32 string_area_size; | ||
273 | u32 length; | ||
274 | u32 cid_list_size; | ||
275 | acpi_status status; | ||
276 | u32 count; | ||
277 | u32 i; | ||
278 | |||
279 | ACPI_FUNCTION_TRACE(ut_execute_CID); | ||
280 | |||
281 | /* Evaluate the _CID method for this device */ | ||
282 | |||
283 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__CID, | ||
284 | ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ||
285 | | ACPI_BTYPE_PACKAGE, &obj_desc); | ||
286 | if (ACPI_FAILURE(status)) { | ||
287 | return_ACPI_STATUS(status); | ||
288 | } | ||
289 | |||
290 | /* | ||
291 | * Get the count and size of the returned _CIDs. _CID can return either | ||
292 | * a Package of Integers/Strings or a single Integer or String. | ||
293 | * Note: This section also validates that all CID elements are of the | ||
294 | * correct type (Integer or String). | ||
295 | */ | ||
296 | if (obj_desc->common.type == ACPI_TYPE_PACKAGE) { | ||
297 | count = obj_desc->package.count; | ||
298 | cid_objects = obj_desc->package.elements; | ||
299 | } else { /* Single Integer or String CID */ | ||
300 | |||
301 | count = 1; | ||
302 | cid_objects = &obj_desc; | ||
303 | } | ||
304 | |||
305 | string_area_size = 0; | ||
306 | for (i = 0; i < count; i++) { | ||
307 | |||
308 | /* String lengths include null terminator */ | ||
309 | |||
310 | switch (cid_objects[i]->common.type) { | ||
311 | case ACPI_TYPE_INTEGER: | ||
312 | string_area_size += ACPI_EISAID_STRING_SIZE; | ||
313 | break; | ||
314 | |||
315 | case ACPI_TYPE_STRING: | ||
316 | string_area_size += cid_objects[i]->string.length + 1; | ||
317 | break; | ||
318 | |||
319 | default: | ||
320 | status = AE_TYPE; | ||
321 | goto cleanup; | ||
322 | } | ||
323 | } | ||
324 | |||
325 | /* | ||
326 | * Now that we know the length of the CIDs, allocate return buffer: | ||
327 | * 1) Size of the base structure + | ||
328 | * 2) Size of the CID DEVICE_ID array + | ||
329 | * 3) Size of the actual CID strings | ||
330 | */ | ||
331 | cid_list_size = sizeof(struct acpica_device_id_list) + | ||
332 | ((count - 1) * sizeof(struct acpica_device_id)) + string_area_size; | ||
333 | |||
334 | cid_list = ACPI_ALLOCATE_ZEROED(cid_list_size); | ||
335 | if (!cid_list) { | ||
336 | status = AE_NO_MEMORY; | ||
337 | goto cleanup; | ||
338 | } | ||
339 | |||
340 | /* Area for CID strings starts after the CID DEVICE_ID array */ | ||
341 | |||
342 | next_id_string = ACPI_CAST_PTR(char, cid_list->ids) + | ||
343 | ((acpi_size) count * sizeof(struct acpica_device_id)); | ||
344 | |||
345 | /* Copy/convert the CIDs to the return buffer */ | ||
346 | |||
347 | for (i = 0; i < count; i++) { | ||
348 | if (cid_objects[i]->common.type == ACPI_TYPE_INTEGER) { | ||
349 | |||
350 | /* Convert the Integer (EISAID) CID to a string */ | ||
351 | |||
352 | acpi_ex_eisa_id_to_string(next_id_string, | ||
353 | cid_objects[i]->integer. | ||
354 | value); | ||
355 | length = ACPI_EISAID_STRING_SIZE; | ||
356 | } else { /* ACPI_TYPE_STRING */ | ||
357 | |||
358 | /* Copy the String CID from the returned object */ | ||
359 | |||
360 | acpi_ut_copy_id_string(next_id_string, | ||
361 | cid_objects[i]->string.pointer); | ||
362 | length = cid_objects[i]->string.length + 1; | ||
363 | } | ||
364 | |||
365 | cid_list->ids[i].string = next_id_string; | ||
366 | cid_list->ids[i].length = length; | ||
367 | next_id_string += length; | ||
368 | } | ||
369 | |||
370 | /* Finish the CID list */ | ||
371 | |||
372 | cid_list->count = count; | ||
373 | cid_list->list_size = cid_list_size; | ||
374 | *return_cid_list = cid_list; | ||
375 | |||
376 | cleanup: | ||
377 | |||
378 | /* On exit, we must delete the _CID return object */ | ||
379 | |||
380 | acpi_ut_remove_reference(obj_desc); | ||
381 | return_ACPI_STATUS(status); | ||
382 | } | ||
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c index fbe782348b0b..9cd65334ca75 100644 --- a/drivers/acpi/acpica/utmisc.c +++ b/drivers/acpi/acpica/utmisc.c | |||
@@ -120,6 +120,34 @@ const char *acpi_ut_validate_exception(acpi_status status) | |||
120 | 120 | ||
121 | /******************************************************************************* | 121 | /******************************************************************************* |
122 | * | 122 | * |
123 | * FUNCTION: acpi_ut_is_pci_root_bridge | ||
124 | * | ||
125 | * PARAMETERS: Id - The HID/CID in string format | ||
126 | * | ||
127 | * RETURN: TRUE if the Id is a match for a PCI/PCI-Express Root Bridge | ||
128 | * | ||
129 | * DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID. | ||
130 | * | ||
131 | ******************************************************************************/ | ||
132 | |||
133 | u8 acpi_ut_is_pci_root_bridge(char *id) | ||
134 | { | ||
135 | |||
136 | /* | ||
137 | * Check if this is a PCI root bridge. | ||
138 | * ACPI 3.0+: check for a PCI Express root also. | ||
139 | */ | ||
140 | if (!(ACPI_STRCMP(id, | ||
141 | PCI_ROOT_HID_STRING)) || | ||
142 | !(ACPI_STRCMP(id, PCI_EXPRESS_ROOT_HID_STRING))) { | ||
143 | return (TRUE); | ||
144 | } | ||
145 | |||
146 | return (FALSE); | ||
147 | } | ||
148 | |||
149 | /******************************************************************************* | ||
150 | * | ||
123 | * FUNCTION: acpi_ut_is_aml_table | 151 | * FUNCTION: acpi_ut_is_aml_table |
124 | * | 152 | * |
125 | * PARAMETERS: Table - An ACPI table | 153 | * PARAMETERS: Table - An ACPI table |
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index fe0cdf83641a..2aee8c24dc56 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c | |||
@@ -200,20 +200,17 @@ container_walk_namespace_cb(acpi_handle handle, | |||
200 | u32 lvl, void *context, void **rv) | 200 | u32 lvl, void *context, void **rv) |
201 | { | 201 | { |
202 | char *hid = NULL; | 202 | char *hid = NULL; |
203 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
204 | struct acpi_device_info *info; | 203 | struct acpi_device_info *info; |
205 | acpi_status status; | 204 | acpi_status status; |
206 | int *action = context; | 205 | int *action = context; |
207 | 206 | ||
208 | 207 | status = acpi_get_object_info(handle, &info); | |
209 | status = acpi_get_object_info(handle, &buffer); | 208 | if (ACPI_FAILURE(status)) { |
210 | if (ACPI_FAILURE(status) || !buffer.pointer) { | ||
211 | return AE_OK; | 209 | return AE_OK; |
212 | } | 210 | } |
213 | 211 | ||
214 | info = buffer.pointer; | ||
215 | if (info->valid & ACPI_VALID_HID) | 212 | if (info->valid & ACPI_VALID_HID) |
216 | hid = info->hardware_id.value; | 213 | hid = info->hardware_id.string; |
217 | 214 | ||
218 | if (hid == NULL) { | 215 | if (hid == NULL) { |
219 | goto end; | 216 | goto end; |
@@ -240,7 +237,7 @@ container_walk_namespace_cb(acpi_handle handle, | |||
240 | } | 237 | } |
241 | 238 | ||
242 | end: | 239 | end: |
243 | kfree(buffer.pointer); | 240 | kfree(info); |
244 | 241 | ||
245 | return AE_OK; | 242 | return AE_OK; |
246 | } | 243 | } |
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index efb959d6c8a9..39536b80bce7 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
@@ -231,18 +231,16 @@ static int is_ata(acpi_handle handle) | |||
231 | static int is_battery(acpi_handle handle) | 231 | static int is_battery(acpi_handle handle) |
232 | { | 232 | { |
233 | struct acpi_device_info *info; | 233 | struct acpi_device_info *info; |
234 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | ||
235 | int ret = 1; | 234 | int ret = 1; |
236 | 235 | ||
237 | if (!ACPI_SUCCESS(acpi_get_object_info(handle, &buffer))) | 236 | if (!ACPI_SUCCESS(acpi_get_object_info(handle, &info))) |
238 | return 0; | 237 | return 0; |
239 | info = buffer.pointer; | ||
240 | if (!(info->valid & ACPI_VALID_HID)) | 238 | if (!(info->valid & ACPI_VALID_HID)) |
241 | ret = 0; | 239 | ret = 0; |
242 | else | 240 | else |
243 | ret = !strcmp("PNP0C0A", info->hardware_id.value); | 241 | ret = !strcmp("PNP0C0A", info->hardware_id.string); |
244 | 242 | ||
245 | kfree(buffer.pointer); | 243 | kfree(info); |
246 | return ret; | 244 | return ret; |
247 | } | 245 | } |
248 | 246 | ||
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index a8a5c29958c8..27a7072347ea 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
@@ -93,15 +93,13 @@ do_acpi_find_child(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
93 | { | 93 | { |
94 | acpi_status status; | 94 | acpi_status status; |
95 | struct acpi_device_info *info; | 95 | struct acpi_device_info *info; |
96 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
97 | struct acpi_find_child *find = context; | 96 | struct acpi_find_child *find = context; |
98 | 97 | ||
99 | status = acpi_get_object_info(handle, &buffer); | 98 | status = acpi_get_object_info(handle, &info); |
100 | if (ACPI_SUCCESS(status)) { | 99 | if (ACPI_SUCCESS(status)) { |
101 | info = buffer.pointer; | ||
102 | if (info->address == find->address) | 100 | if (info->address == find->address) |
103 | find->handle = handle; | 101 | find->handle = handle; |
104 | kfree(buffer.pointer); | 102 | kfree(info); |
105 | } | 103 | } |
106 | return AE_OK; | 104 | return AE_OK; |
107 | } | 105 | } |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 781435d7e369..0ab526de7c55 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -60,13 +60,13 @@ static int create_modalias(struct acpi_device *acpi_dev, char *modalias, | |||
60 | } | 60 | } |
61 | 61 | ||
62 | if (acpi_dev->flags.compatible_ids) { | 62 | if (acpi_dev->flags.compatible_ids) { |
63 | struct acpi_compatible_id_list *cid_list; | 63 | struct acpica_device_id_list *cid_list; |
64 | int i; | 64 | int i; |
65 | 65 | ||
66 | cid_list = acpi_dev->pnp.cid_list; | 66 | cid_list = acpi_dev->pnp.cid_list; |
67 | for (i = 0; i < cid_list->count; i++) { | 67 | for (i = 0; i < cid_list->count; i++) { |
68 | count = snprintf(&modalias[len], size, "%s:", | 68 | count = snprintf(&modalias[len], size, "%s:", |
69 | cid_list->id[i].value); | 69 | cid_list->ids[i].string); |
70 | if (count < 0 || count >= size) { | 70 | if (count < 0 || count >= size) { |
71 | printk(KERN_ERR PREFIX "%s cid[%i] exceeds event buffer size", | 71 | printk(KERN_ERR PREFIX "%s cid[%i] exceeds event buffer size", |
72 | acpi_dev->pnp.device_name, i); | 72 | acpi_dev->pnp.device_name, i); |
@@ -287,14 +287,14 @@ int acpi_match_device_ids(struct acpi_device *device, | |||
287 | } | 287 | } |
288 | 288 | ||
289 | if (device->flags.compatible_ids) { | 289 | if (device->flags.compatible_ids) { |
290 | struct acpi_compatible_id_list *cid_list = device->pnp.cid_list; | 290 | struct acpica_device_id_list *cid_list = device->pnp.cid_list; |
291 | int i; | 291 | int i; |
292 | 292 | ||
293 | for (id = ids; id->id[0]; id++) { | 293 | for (id = ids; id->id[0]; id++) { |
294 | /* compare multiple _CID entries against driver ids */ | 294 | /* compare multiple _CID entries against driver ids */ |
295 | for (i = 0; i < cid_list->count; i++) { | 295 | for (i = 0; i < cid_list->count; i++) { |
296 | if (!strcmp((char*)id->id, | 296 | if (!strcmp((char*)id->id, |
297 | cid_list->id[i].value)) | 297 | cid_list->ids[i].string)) |
298 | return 0; | 298 | return 0; |
299 | } | 299 | } |
300 | } | 300 | } |
@@ -999,33 +999,89 @@ static int acpi_dock_match(struct acpi_device *device) | |||
999 | return acpi_get_handle(device->handle, "_DCK", &tmp); | 999 | return acpi_get_handle(device->handle, "_DCK", &tmp); |
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | static struct acpica_device_id_list* | ||
1003 | acpi_add_cid( | ||
1004 | struct acpi_device_info *info, | ||
1005 | struct acpica_device_id *new_cid) | ||
1006 | { | ||
1007 | struct acpica_device_id_list *cid; | ||
1008 | char *next_id_string; | ||
1009 | acpi_size cid_length; | ||
1010 | acpi_size new_cid_length; | ||
1011 | u32 i; | ||
1012 | |||
1013 | |||
1014 | /* Allocate new CID list with room for the new CID */ | ||
1015 | |||
1016 | if (!new_cid) | ||
1017 | new_cid_length = info->compatible_id_list.list_size; | ||
1018 | else if (info->compatible_id_list.list_size) | ||
1019 | new_cid_length = info->compatible_id_list.list_size + | ||
1020 | new_cid->length + sizeof(struct acpica_device_id); | ||
1021 | else | ||
1022 | new_cid_length = sizeof(struct acpica_device_id_list) + new_cid->length; | ||
1023 | |||
1024 | cid = ACPI_ALLOCATE_ZEROED(new_cid_length); | ||
1025 | if (!cid) { | ||
1026 | return NULL; | ||
1027 | } | ||
1028 | |||
1029 | cid->list_size = new_cid_length; | ||
1030 | cid->count = info->compatible_id_list.count; | ||
1031 | if (new_cid) | ||
1032 | cid->count++; | ||
1033 | next_id_string = (char *) cid->ids + (cid->count * sizeof(struct acpica_device_id)); | ||
1034 | |||
1035 | /* Copy all existing CIDs */ | ||
1036 | |||
1037 | for (i = 0; i < info->compatible_id_list.count; i++) { | ||
1038 | cid_length = info->compatible_id_list.ids[i].length; | ||
1039 | cid->ids[i].string = next_id_string; | ||
1040 | cid->ids[i].length = cid_length; | ||
1041 | |||
1042 | ACPI_MEMCPY(next_id_string, info->compatible_id_list.ids[i].string, | ||
1043 | cid_length); | ||
1044 | |||
1045 | next_id_string += cid_length; | ||
1046 | } | ||
1047 | |||
1048 | /* Append the new CID */ | ||
1049 | |||
1050 | if (new_cid) { | ||
1051 | cid->ids[i].string = next_id_string; | ||
1052 | cid->ids[i].length = new_cid->length; | ||
1053 | |||
1054 | ACPI_MEMCPY(next_id_string, new_cid->string, new_cid->length); | ||
1055 | } | ||
1056 | |||
1057 | return cid; | ||
1058 | } | ||
1059 | |||
1002 | static void acpi_device_set_id(struct acpi_device *device, | 1060 | static void acpi_device_set_id(struct acpi_device *device, |
1003 | struct acpi_device *parent, acpi_handle handle, | 1061 | struct acpi_device *parent, acpi_handle handle, |
1004 | int type) | 1062 | int type) |
1005 | { | 1063 | { |
1006 | struct acpi_device_info *info; | 1064 | struct acpi_device_info *info = NULL; |
1007 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
1008 | char *hid = NULL; | 1065 | char *hid = NULL; |
1009 | char *uid = NULL; | 1066 | char *uid = NULL; |
1010 | struct acpi_compatible_id_list *cid_list = NULL; | 1067 | struct acpica_device_id_list *cid_list = NULL; |
1011 | const char *cid_add = NULL; | 1068 | char *cid_add = NULL; |
1012 | acpi_status status; | 1069 | acpi_status status; |
1013 | 1070 | ||
1014 | switch (type) { | 1071 | switch (type) { |
1015 | case ACPI_BUS_TYPE_DEVICE: | 1072 | case ACPI_BUS_TYPE_DEVICE: |
1016 | status = acpi_get_object_info(handle, &buffer); | 1073 | status = acpi_get_object_info(handle, &info); |
1017 | if (ACPI_FAILURE(status)) { | 1074 | if (ACPI_FAILURE(status)) { |
1018 | printk(KERN_ERR PREFIX "%s: Error reading device info\n", __func__); | 1075 | printk(KERN_ERR PREFIX "%s: Error reading device info\n", __func__); |
1019 | return; | 1076 | return; |
1020 | } | 1077 | } |
1021 | 1078 | ||
1022 | info = buffer.pointer; | ||
1023 | if (info->valid & ACPI_VALID_HID) | 1079 | if (info->valid & ACPI_VALID_HID) |
1024 | hid = info->hardware_id.value; | 1080 | hid = info->hardware_id.string; |
1025 | if (info->valid & ACPI_VALID_UID) | 1081 | if (info->valid & ACPI_VALID_UID) |
1026 | uid = info->unique_id.value; | 1082 | uid = info->unique_id.string; |
1027 | if (info->valid & ACPI_VALID_CID) | 1083 | if (info->valid & ACPI_VALID_CID) |
1028 | cid_list = &info->compatibility_id; | 1084 | cid_list = &info->compatible_id_list; |
1029 | if (info->valid & ACPI_VALID_ADR) { | 1085 | if (info->valid & ACPI_VALID_ADR) { |
1030 | device->pnp.bus_address = info->address; | 1086 | device->pnp.bus_address = info->address; |
1031 | device->flags.bus_address = 1; | 1087 | device->flags.bus_address = 1; |
@@ -1076,55 +1132,44 @@ static void acpi_device_set_id(struct acpi_device *device, | |||
1076 | } | 1132 | } |
1077 | 1133 | ||
1078 | if (hid) { | 1134 | if (hid) { |
1079 | strcpy(device->pnp.hardware_id, hid); | 1135 | device->pnp.hardware_id = ACPI_ALLOCATE_ZEROED(strlen (hid) + 1); |
1080 | device->flags.hardware_id = 1; | 1136 | if (device->pnp.hardware_id) { |
1081 | } | 1137 | strcpy(device->pnp.hardware_id, hid); |
1138 | device->flags.hardware_id = 1; | ||
1139 | } | ||
1140 | } else | ||
1141 | device->pnp.hardware_id = NULL; | ||
1142 | |||
1082 | if (uid) { | 1143 | if (uid) { |
1083 | strcpy(device->pnp.unique_id, uid); | 1144 | device->pnp.unique_id = ACPI_ALLOCATE_ZEROED(strlen (uid) + 1); |
1084 | device->flags.unique_id = 1; | 1145 | if (device->pnp.unique_id) { |
1085 | } | 1146 | strcpy(device->pnp.unique_id, uid); |
1147 | device->flags.unique_id = 1; | ||
1148 | } | ||
1149 | } else | ||
1150 | device->pnp.unique_id = NULL; | ||
1151 | |||
1086 | if (cid_list || cid_add) { | 1152 | if (cid_list || cid_add) { |
1087 | struct acpi_compatible_id_list *list; | 1153 | struct acpica_device_id_list *list; |
1088 | int size = 0; | 1154 | |
1089 | int count = 0; | 1155 | if (cid_add) { |
1090 | 1156 | struct acpica_device_id cid; | |
1091 | if (cid_list) { | 1157 | cid.length = strlen (cid_add) + 1; |
1092 | size = cid_list->size; | 1158 | cid.string = cid_add; |
1093 | } else if (cid_add) { | 1159 | |
1094 | size = sizeof(struct acpi_compatible_id_list); | 1160 | list = acpi_add_cid(info, &cid); |
1095 | cid_list = ACPI_ALLOCATE_ZEROED((acpi_size) size); | 1161 | } else { |
1096 | if (!cid_list) { | 1162 | list = acpi_add_cid(info, NULL); |
1097 | printk(KERN_ERR "Memory allocation error\n"); | ||
1098 | kfree(buffer.pointer); | ||
1099 | return; | ||
1100 | } else { | ||
1101 | cid_list->count = 0; | ||
1102 | cid_list->size = size; | ||
1103 | } | ||
1104 | } | 1163 | } |
1105 | if (cid_add) | ||
1106 | size += sizeof(struct acpi_compatible_id); | ||
1107 | list = kmalloc(size, GFP_KERNEL); | ||
1108 | 1164 | ||
1109 | if (list) { | 1165 | if (list) { |
1110 | if (cid_list) { | ||
1111 | memcpy(list, cid_list, cid_list->size); | ||
1112 | count = cid_list->count; | ||
1113 | } | ||
1114 | if (cid_add) { | ||
1115 | strncpy(list->id[count].value, cid_add, | ||
1116 | ACPI_MAX_CID_LENGTH); | ||
1117 | count++; | ||
1118 | device->flags.compatible_ids = 1; | ||
1119 | } | ||
1120 | list->size = size; | ||
1121 | list->count = count; | ||
1122 | device->pnp.cid_list = list; | 1166 | device->pnp.cid_list = list; |
1123 | } else | 1167 | if (cid_add) |
1124 | printk(KERN_ERR PREFIX "Memory allocation error\n"); | 1168 | device->flags.compatible_ids = 1; |
1169 | } | ||
1125 | } | 1170 | } |
1126 | 1171 | ||
1127 | kfree(buffer.pointer); | 1172 | kfree(info); |
1128 | } | 1173 | } |
1129 | 1174 | ||
1130 | static int acpi_device_set_context(struct acpi_device *device, int type) | 1175 | static int acpi_device_set_context(struct acpi_device *device, int type) |
diff --git a/drivers/char/agp/hp-agp.c b/drivers/char/agp/hp-agp.c index 8f3d4c184914..7bead4c816ca 100644 --- a/drivers/char/agp/hp-agp.c +++ b/drivers/char/agp/hp-agp.c | |||
@@ -478,7 +478,6 @@ zx1_gart_probe (acpi_handle obj, u32 depth, void *context, void **ret) | |||
478 | { | 478 | { |
479 | acpi_handle handle, parent; | 479 | acpi_handle handle, parent; |
480 | acpi_status status; | 480 | acpi_status status; |
481 | struct acpi_buffer buffer; | ||
482 | struct acpi_device_info *info; | 481 | struct acpi_device_info *info; |
483 | u64 lba_hpa, sba_hpa, length; | 482 | u64 lba_hpa, sba_hpa, length; |
484 | int match; | 483 | int match; |
@@ -490,13 +489,11 @@ zx1_gart_probe (acpi_handle obj, u32 depth, void *context, void **ret) | |||
490 | /* Look for an enclosing IOC scope and find its CSR space */ | 489 | /* Look for an enclosing IOC scope and find its CSR space */ |
491 | handle = obj; | 490 | handle = obj; |
492 | do { | 491 | do { |
493 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; | 492 | status = acpi_get_object_info(handle, &info); |
494 | status = acpi_get_object_info(handle, &buffer); | ||
495 | if (ACPI_SUCCESS(status)) { | 493 | if (ACPI_SUCCESS(status)) { |
496 | /* TBD check _CID also */ | 494 | /* TBD check _CID also */ |
497 | info = buffer.pointer; | 495 | info->hardware_id.string[sizeof(info->hardware_id.length)-1] = '\0'; |
498 | info->hardware_id.value[sizeof(info->hardware_id)-1] = '\0'; | 496 | match = (strcmp(info->hardware_id.string, "HWP0001") == 0); |
499 | match = (strcmp(info->hardware_id.value, "HWP0001") == 0); | ||
500 | kfree(info); | 497 | kfree(info); |
501 | if (match) { | 498 | if (match) { |
502 | status = hp_acpi_csr_space(handle, &sba_hpa, &length); | 499 | status = hp_acpi_csr_space(handle, &sba_hpa, &length); |
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index c509c9916464..c0cf45a11b93 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c | |||
@@ -114,8 +114,6 @@ static int ide_get_dev_handle(struct device *dev, acpi_handle *handle, | |||
114 | unsigned int bus, devnum, func; | 114 | unsigned int bus, devnum, func; |
115 | acpi_integer addr; | 115 | acpi_integer addr; |
116 | acpi_handle dev_handle; | 116 | acpi_handle dev_handle; |
117 | struct acpi_buffer buffer = {.length = ACPI_ALLOCATE_BUFFER, | ||
118 | .pointer = NULL}; | ||
119 | acpi_status status; | 117 | acpi_status status; |
120 | struct acpi_device_info *dinfo = NULL; | 118 | struct acpi_device_info *dinfo = NULL; |
121 | int ret = -ENODEV; | 119 | int ret = -ENODEV; |
@@ -134,12 +132,11 @@ static int ide_get_dev_handle(struct device *dev, acpi_handle *handle, | |||
134 | goto err; | 132 | goto err; |
135 | } | 133 | } |
136 | 134 | ||
137 | status = acpi_get_object_info(dev_handle, &buffer); | 135 | status = acpi_get_object_info(dev_handle, &dinfo); |
138 | if (ACPI_FAILURE(status)) { | 136 | if (ACPI_FAILURE(status)) { |
139 | DEBPRINT("get_object_info for device failed\n"); | 137 | DEBPRINT("get_object_info for device failed\n"); |
140 | goto err; | 138 | goto err; |
141 | } | 139 | } |
142 | dinfo = buffer.pointer; | ||
143 | if (dinfo && (dinfo->valid & ACPI_VALID_ADR) && | 140 | if (dinfo && (dinfo->valid & ACPI_VALID_ADR) && |
144 | dinfo->address == addr) { | 141 | dinfo->address == addr) { |
145 | *pcidevfn = addr; | 142 | *pcidevfn = addr; |
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c index 5befa7e379b7..a9d926b7d805 100644 --- a/drivers/pci/hotplug/acpiphp_ibm.c +++ b/drivers/pci/hotplug/acpiphp_ibm.c | |||
@@ -398,23 +398,21 @@ static acpi_status __init ibm_find_acpi_device(acpi_handle handle, | |||
398 | acpi_handle *phandle = (acpi_handle *)context; | 398 | acpi_handle *phandle = (acpi_handle *)context; |
399 | acpi_status status; | 399 | acpi_status status; |
400 | struct acpi_device_info *info; | 400 | struct acpi_device_info *info; |
401 | struct acpi_buffer info_buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
402 | int retval = 0; | 401 | int retval = 0; |
403 | 402 | ||
404 | status = acpi_get_object_info(handle, &info_buffer); | 403 | status = acpi_get_object_info(handle, &info); |
405 | if (ACPI_FAILURE(status)) { | 404 | if (ACPI_FAILURE(status)) { |
406 | err("%s: Failed to get device information status=0x%x\n", | 405 | err("%s: Failed to get device information status=0x%x\n", |
407 | __func__, status); | 406 | __func__, status); |
408 | return retval; | 407 | return retval; |
409 | } | 408 | } |
410 | info = info_buffer.pointer; | 409 | info->hardware_id.string[sizeof(info->hardware_id.length) - 1] = '\0'; |
411 | info->hardware_id.value[sizeof(info->hardware_id.value) - 1] = '\0'; | ||
412 | 410 | ||
413 | if (info->current_status && (info->valid & ACPI_VALID_HID) && | 411 | if (info->current_status && (info->valid & ACPI_VALID_HID) && |
414 | (!strcmp(info->hardware_id.value, IBM_HARDWARE_ID1) || | 412 | (!strcmp(info->hardware_id.string, IBM_HARDWARE_ID1) || |
415 | !strcmp(info->hardware_id.value, IBM_HARDWARE_ID2))) { | 413 | !strcmp(info->hardware_id.string, IBM_HARDWARE_ID2))) { |
416 | dbg("found hardware: %s, handle: %p\n", | 414 | dbg("found hardware: %s, handle: %p\n", |
417 | info->hardware_id.value, handle); | 415 | info->hardware_id.string, handle); |
418 | *phandle = handle; | 416 | *phandle = handle; |
419 | /* returning non-zero causes the search to stop | 417 | /* returning non-zero causes the search to stop |
420 | * and returns this value to the caller of | 418 | * and returns this value to the caller of |
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index dafaa4a92df5..f9f68e0e7344 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
@@ -976,15 +976,12 @@ static acpi_status sony_walk_callback(acpi_handle handle, u32 level, | |||
976 | void *context, void **return_value) | 976 | void *context, void **return_value) |
977 | { | 977 | { |
978 | struct acpi_device_info *info; | 978 | struct acpi_device_info *info; |
979 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | ||
980 | |||
981 | if (ACPI_SUCCESS(acpi_get_object_info(handle, &buffer))) { | ||
982 | info = buffer.pointer; | ||
983 | 979 | ||
980 | if (ACPI_SUCCESS(acpi_get_object_info(handle, &info))) { | ||
984 | printk(KERN_WARNING DRV_PFX "method: name: %4.4s, args %X\n", | 981 | printk(KERN_WARNING DRV_PFX "method: name: %4.4s, args %X\n", |
985 | (char *)&info->name, info->param_count); | 982 | (char *)&info->name, info->param_count); |
986 | 983 | ||
987 | kfree(buffer.pointer); | 984 | kfree(info); |
988 | } | 985 | } |
989 | 986 | ||
990 | return AE_OK; | 987 | return AE_OK; |
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index 9496494f340e..c07fdb94d665 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c | |||
@@ -194,13 +194,13 @@ static int __init pnpacpi_add_device(struct acpi_device *device) | |||
194 | pnpacpi_parse_resource_option_data(dev); | 194 | pnpacpi_parse_resource_option_data(dev); |
195 | 195 | ||
196 | if (device->flags.compatible_ids) { | 196 | if (device->flags.compatible_ids) { |
197 | struct acpi_compatible_id_list *cid_list = device->pnp.cid_list; | 197 | struct acpica_device_id_list *cid_list = device->pnp.cid_list; |
198 | int i; | 198 | int i; |
199 | 199 | ||
200 | for (i = 0; i < cid_list->count; i++) { | 200 | for (i = 0; i < cid_list->count; i++) { |
201 | if (!ispnpidacpi(cid_list->id[i].value)) | 201 | if (!ispnpidacpi(cid_list->ids[i].string)) |
202 | continue; | 202 | continue; |
203 | pnp_add_id(dev, cid_list->id[i].value); | 203 | pnp_add_id(dev, cid_list->ids[i].string); |
204 | } | 204 | } |
205 | } | 205 | } |
206 | 206 | ||
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index c65e4ce6c3af..b91420b52c6f 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -173,17 +173,15 @@ struct acpi_device_dir { | |||
173 | 173 | ||
174 | typedef char acpi_bus_id[8]; | 174 | typedef char acpi_bus_id[8]; |
175 | typedef unsigned long acpi_bus_address; | 175 | typedef unsigned long acpi_bus_address; |
176 | typedef char acpi_hardware_id[15]; | ||
177 | typedef char acpi_unique_id[9]; | ||
178 | typedef char acpi_device_name[40]; | 176 | typedef char acpi_device_name[40]; |
179 | typedef char acpi_device_class[20]; | 177 | typedef char acpi_device_class[20]; |
180 | 178 | ||
181 | struct acpi_device_pnp { | 179 | struct acpi_device_pnp { |
182 | acpi_bus_id bus_id; /* Object name */ | 180 | acpi_bus_id bus_id; /* Object name */ |
183 | acpi_bus_address bus_address; /* _ADR */ | 181 | acpi_bus_address bus_address; /* _ADR */ |
184 | acpi_hardware_id hardware_id; /* _HID */ | 182 | char *hardware_id; /* _HID */ |
185 | struct acpi_compatible_id_list *cid_list; /* _CIDs */ | 183 | struct acpica_device_id_list *cid_list; /* _CIDs */ |
186 | acpi_unique_id unique_id; /* _UID */ | 184 | char *unique_id; /* _UID */ |
187 | acpi_device_name device_name; /* Driver-determined */ | 185 | acpi_device_name device_name; /* Driver-determined */ |
188 | acpi_device_class device_class; /* " */ | 186 | acpi_device_class device_class; /* " */ |
189 | }; | 187 | }; |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index b450a195319a..04904c7f1aa1 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -200,7 +200,8 @@ acpi_evaluate_object_typed(acpi_handle object, | |||
200 | acpi_object_type return_type); | 200 | acpi_object_type return_type); |
201 | 201 | ||
202 | acpi_status | 202 | acpi_status |
203 | acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer); | 203 | acpi_get_object_info(acpi_handle handle, |
204 | struct acpi_device_info **return_buffer); | ||
204 | 205 | ||
205 | acpi_status acpi_install_method(u8 *buffer); | 206 | acpi_status acpi_install_method(u8 *buffer); |
206 | 207 | ||
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 37ba576d06e8..7a4ff79e238c 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
@@ -338,7 +338,7 @@ typedef u32 acpi_physical_address; | |||
338 | 338 | ||
339 | /* PM Timer ticks per second (HZ) */ | 339 | /* PM Timer ticks per second (HZ) */ |
340 | 340 | ||
341 | #define PM_TIMER_FREQUENCY 3579545 | 341 | #define PM_TIMER_FREQUENCY 3579545 |
342 | 342 | ||
343 | /******************************************************************************* | 343 | /******************************************************************************* |
344 | * | 344 | * |
@@ -969,38 +969,60 @@ acpi_status(*acpi_walk_callback) (acpi_handle obj_handle, | |||
969 | #define ACPI_INTERRUPT_NOT_HANDLED 0x00 | 969 | #define ACPI_INTERRUPT_NOT_HANDLED 0x00 |
970 | #define ACPI_INTERRUPT_HANDLED 0x01 | 970 | #define ACPI_INTERRUPT_HANDLED 0x01 |
971 | 971 | ||
972 | /* Length of _HID, _UID, _CID, and UUID values */ | 972 | /* Length of 32-bit EISAID values when converted back to a string */ |
973 | |||
974 | #define ACPI_EISAID_STRING_SIZE 8 /* Includes null terminator */ | ||
975 | |||
976 | /* Length of UUID (string) values */ | ||
973 | 977 | ||
974 | #define ACPI_DEVICE_ID_LENGTH 0x09 | ||
975 | #define ACPI_MAX_CID_LENGTH 48 | ||
976 | #define ACPI_UUID_LENGTH 16 | 978 | #define ACPI_UUID_LENGTH 16 |
977 | 979 | ||
978 | /* Common string version of device HIDs and UIDs */ | 980 | /* Structures used for device/processor HID, UID, CID */ |
979 | 981 | ||
980 | struct acpica_device_id { | 982 | struct acpica_device_id { |
981 | char value[ACPI_DEVICE_ID_LENGTH]; | 983 | u32 length; /* Length of string + null */ |
984 | char *string; | ||
982 | }; | 985 | }; |
983 | 986 | ||
984 | /* Common string version of device CIDs */ | 987 | struct acpica_device_id_list { |
985 | 988 | u32 count; /* Number of IDs in Ids array */ | |
986 | struct acpi_compatible_id { | 989 | u32 list_size; /* Size of list, including ID strings */ |
987 | char value[ACPI_MAX_CID_LENGTH]; | 990 | struct acpica_device_id ids[1]; /* ID array */ |
988 | }; | 991 | }; |
989 | 992 | ||
990 | struct acpi_compatible_id_list { | 993 | /* |
991 | u32 count; | 994 | * Structure returned from acpi_get_object_info. |
992 | u32 size; | 995 | * Optimized for both 32- and 64-bit builds |
993 | struct acpi_compatible_id id[1]; | 996 | */ |
997 | struct acpi_device_info { | ||
998 | u32 info_size; /* Size of info, including ID strings */ | ||
999 | u32 name; /* ACPI object Name */ | ||
1000 | acpi_object_type type; /* ACPI object Type */ | ||
1001 | u8 param_count; /* If a method, required parameter count */ | ||
1002 | u8 valid; /* Indicates which optional fields are valid */ | ||
1003 | u8 flags; /* Miscellaneous info */ | ||
1004 | u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */ | ||
1005 | u8 lowest_dstates[5]; /* _sx_w values: 0xFF indicates not valid */ | ||
1006 | u32 current_status; /* _STA value */ | ||
1007 | acpi_integer address; /* _ADR value */ | ||
1008 | struct acpica_device_id hardware_id; /* _HID value */ | ||
1009 | struct acpica_device_id unique_id; /* _UID value */ | ||
1010 | struct acpica_device_id_list compatible_id_list; /* _CID list <must be last> */ | ||
994 | }; | 1011 | }; |
995 | 1012 | ||
996 | /* Structure and flags for acpi_get_object_info */ | 1013 | /* Values for Flags field above (acpi_get_object_info) */ |
1014 | |||
1015 | #define ACPI_PCI_ROOT_BRIDGE 0x01 | ||
997 | 1016 | ||
998 | #define ACPI_VALID_STA 0x0001 | 1017 | /* Flags for Valid field above (acpi_get_object_info) */ |
999 | #define ACPI_VALID_ADR 0x0002 | 1018 | |
1000 | #define ACPI_VALID_HID 0x0004 | 1019 | #define ACPI_VALID_STA 0x01 |
1001 | #define ACPI_VALID_UID 0x0008 | 1020 | #define ACPI_VALID_ADR 0x02 |
1002 | #define ACPI_VALID_CID 0x0010 | 1021 | #define ACPI_VALID_HID 0x04 |
1003 | #define ACPI_VALID_SXDS 0x0020 | 1022 | #define ACPI_VALID_UID 0x08 |
1023 | #define ACPI_VALID_CID 0x10 | ||
1024 | #define ACPI_VALID_SXDS 0x20 | ||
1025 | #define ACPI_VALID_SXWS 0x40 | ||
1004 | 1026 | ||
1005 | /* Flags for _STA method */ | 1027 | /* Flags for _STA method */ |
1006 | 1028 | ||
@@ -1011,29 +1033,6 @@ struct acpi_compatible_id_list { | |||
1011 | #define ACPI_STA_DEVICE_OK 0x08 /* Synonym */ | 1033 | #define ACPI_STA_DEVICE_OK 0x08 /* Synonym */ |
1012 | #define ACPI_STA_BATTERY_PRESENT 0x10 | 1034 | #define ACPI_STA_BATTERY_PRESENT 0x10 |
1013 | 1035 | ||
1014 | #define ACPI_COMMON_OBJ_INFO \ | ||
1015 | acpi_object_type type; /* ACPI object type */ \ | ||
1016 | acpi_name name /* ACPI object Name */ | ||
1017 | |||
1018 | struct acpi_obj_info_header { | ||
1019 | ACPI_COMMON_OBJ_INFO; | ||
1020 | }; | ||
1021 | |||
1022 | /* Structure returned from Get Object Info */ | ||
1023 | |||
1024 | struct acpi_device_info { | ||
1025 | ACPI_COMMON_OBJ_INFO; | ||
1026 | |||
1027 | u32 param_count; /* If a method, required parameter count */ | ||
1028 | u32 valid; /* Indicates which fields below are valid */ | ||
1029 | u32 current_status; /* _STA value */ | ||
1030 | acpi_integer address; /* _ADR value if any */ | ||
1031 | struct acpica_device_id hardware_id; /* _HID value if any */ | ||
1032 | struct acpica_device_id unique_id; /* _UID value if any */ | ||
1033 | u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */ | ||
1034 | struct acpi_compatible_id_list compatibility_id; /* List of _CIDs if any */ | ||
1035 | }; | ||
1036 | |||
1037 | /* Context structs for address space handlers */ | 1036 | /* Context structs for address space handlers */ |
1038 | 1037 | ||
1039 | struct acpi_pci_id { | 1038 | struct acpi_pci_id { |