diff options
author | Bob Moore <robert.moore@intel.com> | 2011-11-16 01:51:01 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2012-01-17 03:36:31 -0500 |
commit | 0e243178047c0219b3367dd44f81040826b7ea83 (patch) | |
tree | dcf5bbcbfae157a072a94ced21e949fd7de7ba90 /drivers/acpi | |
parent | a91cdde20a870bd773d605c764ed211539bf3020 (diff) |
ACPI 5.0: New interface, acpi_buffer_to_resource
This interface converts an AML buffer to an internal ACPI_RESOURCE.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpica/rscreate.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c index f61285d5edc3..06264e8b58d9 100644 --- a/drivers/acpi/acpica/rscreate.c +++ b/drivers/acpi/acpica/rscreate.c | |||
@@ -51,6 +51,70 @@ ACPI_MODULE_NAME("rscreate") | |||
51 | 51 | ||
52 | /******************************************************************************* | 52 | /******************************************************************************* |
53 | * | 53 | * |
54 | * FUNCTION: acpi_buffer_to_resource | ||
55 | * | ||
56 | * PARAMETERS: aml_buffer - Pointer to the resource byte stream | ||
57 | * aml_buffer_length - Length of the aml_buffer | ||
58 | * resource_ptr - Where the converted resource is returned | ||
59 | * | ||
60 | * RETURN: Status | ||
61 | * | ||
62 | * DESCRIPTION: Convert a raw AML buffer to a resource list | ||
63 | * | ||
64 | ******************************************************************************/ | ||
65 | acpi_status | ||
66 | acpi_buffer_to_resource(u8 *aml_buffer, | ||
67 | u16 aml_buffer_length, | ||
68 | struct acpi_resource **resource_ptr) | ||
69 | { | ||
70 | acpi_status status; | ||
71 | acpi_size list_size_needed; | ||
72 | void *resource; | ||
73 | void *current_resource_ptr; | ||
74 | |||
75 | /* | ||
76 | * Note: we allow AE_AML_NO_RESOURCE_END_TAG, since an end tag | ||
77 | * is not required here. | ||
78 | */ | ||
79 | |||
80 | /* Get the required length for the converted resource */ | ||
81 | |||
82 | status = acpi_rs_get_list_length(aml_buffer, aml_buffer_length, | ||
83 | &list_size_needed); | ||
84 | if (status == AE_AML_NO_RESOURCE_END_TAG) { | ||
85 | status = AE_OK; | ||
86 | } | ||
87 | if (ACPI_FAILURE(status)) { | ||
88 | return (status); | ||
89 | } | ||
90 | |||
91 | /* Allocate a buffer for the converted resource */ | ||
92 | |||
93 | resource = ACPI_ALLOCATE_ZEROED(list_size_needed); | ||
94 | current_resource_ptr = resource; | ||
95 | if (!resource) { | ||
96 | return (AE_NO_MEMORY); | ||
97 | } | ||
98 | |||
99 | /* Perform the AML-to-Resource conversion */ | ||
100 | |||
101 | status = acpi_ut_walk_aml_resources(aml_buffer, aml_buffer_length, | ||
102 | acpi_rs_convert_aml_to_resources, | ||
103 | ¤t_resource_ptr); | ||
104 | if (status == AE_AML_NO_RESOURCE_END_TAG) { | ||
105 | status = AE_OK; | ||
106 | } | ||
107 | if (ACPI_FAILURE(status)) { | ||
108 | ACPI_FREE(resource); | ||
109 | } else { | ||
110 | *resource_ptr = resource; | ||
111 | } | ||
112 | |||
113 | return (status); | ||
114 | } | ||
115 | |||
116 | /******************************************************************************* | ||
117 | * | ||
54 | * FUNCTION: acpi_rs_create_resource_list | 118 | * FUNCTION: acpi_rs_create_resource_list |
55 | * | 119 | * |
56 | * PARAMETERS: aml_buffer - Pointer to the resource byte stream | 120 | * PARAMETERS: aml_buffer - Pointer to the resource byte stream |