Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 286466
b: refs/heads/master
c: 0e24317
h: refs/heads/master
v: v3
  • Loading branch information
Bob Moore authored and Len Brown committed Jan 17, 2012
1 parent 3a638ed commit 208d75d
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a91cdde20a870bd773d605c764ed211539bf3020
refs/heads/master: 0e243178047c0219b3367dd44f81040826b7ea83
64 changes: 64 additions & 0 deletions trunk/drivers/acpi/acpica/rscreate.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,70 @@
#define _COMPONENT ACPI_RESOURCES
ACPI_MODULE_NAME("rscreate")

/*******************************************************************************
*
* FUNCTION: acpi_buffer_to_resource
*
* PARAMETERS: aml_buffer - Pointer to the resource byte stream
* aml_buffer_length - Length of the aml_buffer
* resource_ptr - Where the converted resource is returned
*
* RETURN: Status
*
* DESCRIPTION: Convert a raw AML buffer to a resource list
*
******************************************************************************/
acpi_status
acpi_buffer_to_resource(u8 *aml_buffer,
u16 aml_buffer_length,
struct acpi_resource **resource_ptr)
{
acpi_status status;
acpi_size list_size_needed;
void *resource;
void *current_resource_ptr;

/*
* Note: we allow AE_AML_NO_RESOURCE_END_TAG, since an end tag
* is not required here.
*/

/* Get the required length for the converted resource */

status = acpi_rs_get_list_length(aml_buffer, aml_buffer_length,
&list_size_needed);
if (status == AE_AML_NO_RESOURCE_END_TAG) {
status = AE_OK;
}
if (ACPI_FAILURE(status)) {
return (status);
}

/* Allocate a buffer for the converted resource */

resource = ACPI_ALLOCATE_ZEROED(list_size_needed);
current_resource_ptr = resource;
if (!resource) {
return (AE_NO_MEMORY);
}

/* Perform the AML-to-Resource conversion */

status = acpi_ut_walk_aml_resources(aml_buffer, aml_buffer_length,
acpi_rs_convert_aml_to_resources,
&current_resource_ptr);
if (status == AE_AML_NO_RESOURCE_END_TAG) {
status = AE_OK;
}
if (ACPI_FAILURE(status)) {
ACPI_FREE(resource);
} else {
*resource_ptr = resource;
}

return (status);
}

/*******************************************************************************
*
* FUNCTION: acpi_rs_create_resource_list
Expand Down
5 changes: 5 additions & 0 deletions trunk/include/acpi/acpixf.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,11 @@ acpi_status
acpi_resource_to_address64(struct acpi_resource *resource,
struct acpi_resource_address64 *out);

acpi_status
acpi_buffer_to_resource(u8 *aml_buffer,
u16 aml_buffer_length,
struct acpi_resource **resource_ptr);

/*
* Hardware (ACPI device) interfaces
*/
Expand Down

0 comments on commit 208d75d

Please sign in to comment.