diff options
Diffstat (limited to 'drivers/acpi/utils.c')
-rw-r--r-- | drivers/acpi/utils.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index b002a471c5d4..adbbc1c80a26 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -382,3 +382,33 @@ acpi_evaluate_reference(acpi_handle handle, | |||
382 | } | 382 | } |
383 | 383 | ||
384 | EXPORT_SYMBOL(acpi_evaluate_reference); | 384 | EXPORT_SYMBOL(acpi_evaluate_reference); |
385 | |||
386 | acpi_status | ||
387 | acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld *pld) | ||
388 | { | ||
389 | acpi_status status; | ||
390 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
391 | union acpi_object *output; | ||
392 | |||
393 | status = acpi_evaluate_object(handle, "_PLD", NULL, &buffer); | ||
394 | |||
395 | if (ACPI_FAILURE(status)) | ||
396 | return status; | ||
397 | |||
398 | output = buffer.pointer; | ||
399 | |||
400 | if (!output || output->type != ACPI_TYPE_PACKAGE | ||
401 | || !output->package.count | ||
402 | || output->package.elements[0].type != ACPI_TYPE_BUFFER | ||
403 | || output->package.elements[0].buffer.length > sizeof(*pld)) { | ||
404 | status = AE_TYPE; | ||
405 | goto out; | ||
406 | } | ||
407 | |||
408 | memcpy(pld, output->package.elements[0].buffer.pointer, | ||
409 | output->package.elements[0].buffer.length); | ||
410 | out: | ||
411 | kfree(buffer.pointer); | ||
412 | return status; | ||
413 | } | ||
414 | EXPORT_SYMBOL(acpi_get_physical_device_location); | ||