aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resources
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/resources')
-rw-r--r--drivers/acpi/resources/rscalc.c2
-rw-r--r--drivers/acpi/resources/rscreate.c7
-rw-r--r--drivers/acpi/resources/rslist.c110
-rw-r--r--drivers/acpi/resources/rsxface.c4
4 files changed, 47 insertions, 76 deletions
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c
index 8e406d992f3b..dd5caa2c8fdd 100644
--- a/drivers/acpi/resources/rscalc.c
+++ b/drivers/acpi/resources/rscalc.c
@@ -456,7 +456,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
456 *size_needed += buffer_size; 456 *size_needed += buffer_size;
457 457
458 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, 458 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
459 "Type %.2X, Aml %.2X internal %.2X\n", 459 "Type %.2X, aml_length %.2X internal_length %.2X\n",
460 acpi_ut_get_resource_type(aml_buffer), 460 acpi_ut_get_resource_type(aml_buffer),
461 acpi_ut_get_descriptor_length(aml_buffer), 461 acpi_ut_get_descriptor_length(aml_buffer),
462 buffer_size)); 462 buffer_size));
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c
index 67c052af7bbe..01488cfc9bae 100644
--- a/drivers/acpi/resources/rscreate.c
+++ b/drivers/acpi/resources/rscreate.c
@@ -75,6 +75,7 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
75 u8 *aml_start; 75 u8 *aml_start;
76 acpi_size list_size_needed = 0; 76 acpi_size list_size_needed = 0;
77 u32 aml_buffer_length; 77 u32 aml_buffer_length;
78 void *resource;
78 79
79 ACPI_FUNCTION_TRACE("rs_create_resource_list"); 80 ACPI_FUNCTION_TRACE("rs_create_resource_list");
80 81
@@ -107,8 +108,10 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
107 108
108 /* Do the conversion */ 109 /* Do the conversion */
109 110
110 status = acpi_rs_convert_aml_to_resources(aml_start, aml_buffer_length, 111 resource = output_buffer->pointer;
111 output_buffer->pointer); 112 status = acpi_ut_walk_aml_resources(aml_start, aml_buffer_length,
113 acpi_rs_convert_aml_to_resources,
114 &resource);
112 if (ACPI_FAILURE(status)) { 115 if (ACPI_FAILURE(status)) {
113 return_ACPI_STATUS(status); 116 return_ACPI_STATUS(status);
114 } 117 }
diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c
index 6f2d8de39523..50bbb19bf4ae 100644
--- a/drivers/acpi/resources/rslist.c
+++ b/drivers/acpi/resources/rslist.c
@@ -51,92 +51,60 @@ ACPI_MODULE_NAME("rslist")
51 * 51 *
52 * FUNCTION: acpi_rs_convert_aml_to_resources 52 * FUNCTION: acpi_rs_convert_aml_to_resources
53 * 53 *
54 * PARAMETERS: Aml - Pointer to the resource byte stream 54 * PARAMETERS: acpi_walk_aml_callback
55 * aml_length - Length of Aml 55 * resource_ptr - Pointer to the buffer that will
56 * output_buffer - Pointer to the buffer that will 56 * contain the output structures
57 * contain the output structures
58 * 57 *
59 * RETURN: Status 58 * RETURN: Status
60 * 59 *
61 * DESCRIPTION: Takes the resource byte stream and parses it, creating a 60 * DESCRIPTION: Convert an AML resource to an internal representation of the
62 * linked list of resources in the caller's output buffer 61 * resource that is aligned and easier to access.
63 * 62 *
64 ******************************************************************************/ 63 ******************************************************************************/
65acpi_status 64acpi_status
66acpi_rs_convert_aml_to_resources(u8 * aml, u32 aml_length, u8 * output_buffer) 65acpi_rs_convert_aml_to_resources(u8 * aml,
66 u32 length,
67 u32 offset,
68 u8 resource_index, void **resource_ptr)
67{ 69{
68 struct acpi_resource *resource = (void *)output_buffer; 70 struct acpi_resource *resource = *resource_ptr;
69 acpi_status status; 71 acpi_status status;
70 u8 resource_index;
71 u8 *end_aml;
72 72
73 ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources"); 73 ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources");
74 74
75 end_aml = aml + aml_length; 75 /*
76 76 * Check that the input buffer and all subsequent pointers into it
77 /* Loop until end-of-buffer or an end_tag is found */ 77 * are aligned on a native word boundary. Most important on IA64
78 78 */
79 while (aml < end_aml) { 79 if (ACPI_IS_MISALIGNED(resource)) {
80 /* 80 ACPI_WARNING((AE_INFO,
81 * Check that the input buffer and all subsequent pointers into it 81 "Misaligned resource pointer %p", resource));
82 * are aligned on a native word boundary. Most important on IA64 82 }
83 */
84 if (ACPI_IS_MISALIGNED(resource)) {
85 ACPI_WARNING((AE_INFO,
86 "Misaligned resource pointer %p",
87 resource));
88 }
89
90 /* Validate the Resource Type and Resource Length */
91
92 status = acpi_ut_validate_resource(aml, &resource_index);
93 if (ACPI_FAILURE(status)) {
94 return_ACPI_STATUS(status);
95 }
96
97 /* Convert the AML byte stream resource to a local resource struct */
98
99 status =
100 acpi_rs_convert_aml_to_resource(resource,
101 ACPI_CAST_PTR(union
102 aml_resource,
103 aml),
104 acpi_gbl_get_resource_dispatch
105 [resource_index]);
106 if (ACPI_FAILURE(status)) {
107 ACPI_EXCEPTION((AE_INFO, status,
108 "Could not convert AML resource (Type %X)",
109 *aml));
110 return_ACPI_STATUS(status);
111 }
112
113 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
114 "Type %.2X, Aml %.2X internal %.2X\n",
115 acpi_ut_get_resource_type(aml),
116 acpi_ut_get_descriptor_length(aml),
117 resource->length));
118
119 /* Normal exit on completion of an end_tag resource descriptor */
120
121 if (acpi_ut_get_resource_type(aml) ==
122 ACPI_RESOURCE_NAME_END_TAG) {
123 return_ACPI_STATUS(AE_OK);
124 }
125
126 /* Point to the next input AML resource */
127
128 aml += acpi_ut_get_descriptor_length(aml);
129
130 /* Point to the next structure in the output buffer */
131 83
132 resource = 84 /* Convert the AML byte stream resource to a local resource struct */
133 ACPI_ADD_PTR(struct acpi_resource, resource, 85
134 resource->length); 86 status =
87 acpi_rs_convert_aml_to_resource(resource,
88 ACPI_CAST_PTR(union aml_resource,
89 aml),
90 acpi_gbl_get_resource_dispatch
91 [resource_index]);
92 if (ACPI_FAILURE(status)) {
93 ACPI_EXCEPTION((AE_INFO, status,
94 "Could not convert AML resource (Type %X)",
95 *aml));
96 return_ACPI_STATUS(status);
135 } 97 }
136 98
137 /* Did not find an end_tag resource descriptor */ 99 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
100 "Type %.2X, aml_length %.2X internal_length %.2X\n",
101 acpi_ut_get_resource_type(aml), length,
102 resource->length));
138 103
139 return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); 104 /* Point to the next structure in the output buffer */
105
106 *resource_ptr = ACPI_ADD_PTR(void, resource, resource->length);
107 return_ACPI_STATUS(AE_OK);
140} 108}
141 109
142/******************************************************************************* 110/*******************************************************************************
diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c
index b3feebbd8ca2..1d00d285a5a3 100644
--- a/drivers/acpi/resources/rsxface.c
+++ b/drivers/acpi/resources/rsxface.c
@@ -242,7 +242,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_possible_resources)
242acpi_status 242acpi_status
243acpi_walk_resources(acpi_handle device_handle, 243acpi_walk_resources(acpi_handle device_handle,
244 char *name, 244 char *name,
245 ACPI_WALK_RESOURCE_CALLBACK user_function, void *context) 245 acpi_walk_resource_callback user_function, void *context)
246{ 246{
247 acpi_status status; 247 acpi_status status;
248 struct acpi_buffer buffer; 248 struct acpi_buffer buffer;
@@ -469,7 +469,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_vendor_resource)
469 * 469 *
470 * FUNCTION: acpi_rs_match_vendor_resource 470 * FUNCTION: acpi_rs_match_vendor_resource
471 * 471 *
472 * PARAMETERS: ACPI_WALK_RESOURCE_CALLBACK 472 * PARAMETERS: acpi_walk_resource_callback
473 * 473 *
474 * RETURN: Status 474 * RETURN: Status
475 * 475 *