diff options
author | Bob Moore <robert.moore@intel.com> | 2005-10-21 00:00:00 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-12-10 00:22:54 -0500 |
commit | 0897831bb54eb36fd9e2a22da7f0f64be1b20d09 (patch) | |
tree | 8d77687ce8ebcfb62d6012d2d3c44f6a904b3c15 /drivers/acpi/resources/rslist.c | |
parent | 50eca3eb89d73d9f0aa070b126c7ee6a616016ab (diff) |
[ACPI] ACPICA 20051021
Implemented support for the EM64T and other x86_64
processors. This essentially entails recognizing
that these processors support non-aligned memory
transfers. Previously, all 64-bit processors were assumed
to lack hardware support for non-aligned transfers.
Completed conversion of the Resource Manager to nearly
full table-driven operation. Specifically, the resource
conversion code (convert AML to internal format and the
reverse) and the debug code to dump internal resource
descriptors are fully table-driven, reducing code and data
size and improving maintainability.
The OSL interfaces for Acquire and Release Lock now use a
64-bit flag word on 64-bit processors instead of a fixed
32-bit word. (Alexey Starikovskiy)
Implemented support within the resource conversion code
for the Type-Specific byte within the various ACPI 3.0
*WordSpace macros.
Fixed some issues within the resource conversion code for
the type-specific flags for both Memory and I/O address
resource descriptors. For Memory, implemented support
for the MTP and TTP flags. For I/O, split the TRS and TTP
flags into two separate fields.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/resources/rslist.c')
-rw-r--r-- | drivers/acpi/resources/rslist.c | 92 |
1 files changed, 47 insertions, 45 deletions
diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index f72d42e0927b..ee17ef3315f8 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c | |||
@@ -48,7 +48,8 @@ | |||
48 | ACPI_MODULE_NAME("rslist") | 48 | ACPI_MODULE_NAME("rslist") |
49 | 49 | ||
50 | /* Local prototypes */ | 50 | /* Local prototypes */ |
51 | static ACPI_GET_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type); | 51 | static struct acpi_rsconvert_info *acpi_rs_get_conversion_info(u8 |
52 | resource_type); | ||
52 | 53 | ||
53 | static acpi_status acpi_rs_validate_resource_length(union aml_resource *aml); | 54 | static acpi_status acpi_rs_validate_resource_length(union aml_resource *aml); |
54 | 55 | ||
@@ -83,7 +84,7 @@ static acpi_status acpi_rs_validate_resource_length(union aml_resource *aml) | |||
83 | return (AE_AML_INVALID_RESOURCE_TYPE); | 84 | return (AE_AML_INVALID_RESOURCE_TYPE); |
84 | } | 85 | } |
85 | 86 | ||
86 | resource_length = acpi_rs_get_resource_length(aml); | 87 | resource_length = acpi_ut_get_resource_length(aml); |
87 | minimum_aml_resource_length = | 88 | minimum_aml_resource_length = |
88 | resource_info->minimum_aml_resource_length; | 89 | resource_info->minimum_aml_resource_length; |
89 | 90 | ||
@@ -115,18 +116,17 @@ static acpi_status acpi_rs_validate_resource_length(union aml_resource *aml) | |||
115 | 116 | ||
116 | /******************************************************************************* | 117 | /******************************************************************************* |
117 | * | 118 | * |
118 | * FUNCTION: acpi_rs_get_resource_handler | 119 | * FUNCTION: acpi_rs_get_conversion_info |
119 | * | 120 | * |
120 | * PARAMETERS: resource_type - Byte 0 of a resource descriptor | 121 | * PARAMETERS: resource_type - Byte 0 of a resource descriptor |
121 | * | 122 | * |
122 | * RETURN: Pointer to the resource conversion handler | 123 | * RETURN: Pointer to the resource conversion info table |
123 | * | 124 | * |
124 | * DESCRIPTION: Extract the Resource Type/Name from the first byte of | 125 | * DESCRIPTION: Get the conversion table associated with this resource type |
125 | * a resource descriptor. | ||
126 | * | 126 | * |
127 | ******************************************************************************/ | 127 | ******************************************************************************/ |
128 | 128 | ||
129 | static ACPI_GET_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type) | 129 | static struct acpi_rsconvert_info *acpi_rs_get_conversion_info(u8 resource_type) |
130 | { | 130 | { |
131 | ACPI_FUNCTION_ENTRY(); | 131 | ACPI_FUNCTION_ENTRY(); |
132 | 132 | ||
@@ -174,33 +174,24 @@ acpi_rs_convert_aml_to_resources(u8 * aml_buffer, | |||
174 | acpi_status status; | 174 | acpi_status status; |
175 | acpi_size bytes_parsed = 0; | 175 | acpi_size bytes_parsed = 0; |
176 | struct acpi_resource *resource; | 176 | struct acpi_resource *resource; |
177 | u16 resource_length; | 177 | acpi_rsdesc_size descriptor_length; |
178 | u32 descriptor_length; | 178 | struct acpi_rsconvert_info *info; |
179 | ACPI_GET_RESOURCE_HANDLER handler; | ||
180 | 179 | ||
181 | ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources"); | 180 | ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources"); |
182 | 181 | ||
183 | /* Loop until end-of-buffer or an end_tag is found */ | 182 | /* Loop until end-of-buffer or an end_tag is found */ |
184 | 183 | ||
185 | while (bytes_parsed < aml_buffer_length) { | 184 | while (bytes_parsed < aml_buffer_length) { |
186 | /* Get the handler associated with this Descriptor Type */ | 185 | /* Get the conversion table associated with this Descriptor Type */ |
187 | 186 | ||
188 | handler = acpi_rs_get_resource_handler(*aml_buffer); | 187 | info = acpi_rs_get_conversion_info(*aml_buffer); |
189 | if (!handler) { | 188 | if (!info) { |
190 | /* No handler indicates invalid resource type */ | 189 | /* No table indicates an invalid resource type */ |
191 | 190 | ||
192 | return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); | 191 | return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); |
193 | } | 192 | } |
194 | 193 | ||
195 | resource_length = | 194 | descriptor_length = acpi_ut_get_descriptor_length(aml_buffer); |
196 | acpi_rs_get_resource_length(ACPI_CAST_PTR | ||
197 | (union aml_resource, | ||
198 | aml_buffer)); | ||
199 | |||
200 | descriptor_length = | ||
201 | acpi_rs_get_descriptor_length(ACPI_CAST_PTR | ||
202 | (union aml_resource, | ||
203 | aml_buffer)); | ||
204 | 195 | ||
205 | /* | 196 | /* |
206 | * Perform limited validation of the resource length, based upon | 197 | * Perform limited validation of the resource length, based upon |
@@ -214,11 +205,16 @@ acpi_rs_convert_aml_to_resources(u8 * aml_buffer, | |||
214 | return_ACPI_STATUS(status); | 205 | return_ACPI_STATUS(status); |
215 | } | 206 | } |
216 | 207 | ||
217 | /* Convert a byte stream resource to local resource struct */ | 208 | /* Convert the AML byte stream resource to a local resource struct */ |
218 | 209 | ||
219 | status = handler(ACPI_CAST_PTR(union aml_resource, aml_buffer), | 210 | status = |
220 | resource_length, | 211 | acpi_rs_convert_aml_to_resource(ACPI_CAST_PTR |
221 | ACPI_CAST_PTR(struct acpi_resource, buffer)); | 212 | (struct acpi_resource, |
213 | buffer), | ||
214 | ACPI_CAST_PTR(union | ||
215 | aml_resource, | ||
216 | aml_buffer), | ||
217 | info); | ||
222 | if (ACPI_FAILURE(status)) { | 218 | if (ACPI_FAILURE(status)) { |
223 | ACPI_REPORT_ERROR(("Could not convert AML resource (type %X) to resource, %s\n", *aml_buffer, acpi_format_exception(status))); | 219 | ACPI_REPORT_ERROR(("Could not convert AML resource (type %X) to resource, %s\n", *aml_buffer, acpi_format_exception(status))); |
224 | return_ACPI_STATUS(status); | 220 | return_ACPI_STATUS(status); |
@@ -232,7 +228,7 @@ acpi_rs_convert_aml_to_resources(u8 * aml_buffer, | |||
232 | 228 | ||
233 | /* Normal exit on completion of an end_tag resource descriptor */ | 229 | /* Normal exit on completion of an end_tag resource descriptor */ |
234 | 230 | ||
235 | if (acpi_rs_get_resource_type(*aml_buffer) == | 231 | if (acpi_ut_get_resource_type(aml_buffer) == |
236 | ACPI_RESOURCE_NAME_END_TAG) { | 232 | ACPI_RESOURCE_NAME_END_TAG) { |
237 | return_ACPI_STATUS(AE_OK); | 233 | return_ACPI_STATUS(AE_OK); |
238 | } | 234 | } |
@@ -276,14 +272,15 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, | |||
276 | acpi_size aml_size_needed, u8 * output_buffer) | 272 | acpi_size aml_size_needed, u8 * output_buffer) |
277 | { | 273 | { |
278 | u8 *aml_buffer = output_buffer; | 274 | u8 *aml_buffer = output_buffer; |
275 | u8 *end_aml_buffer = output_buffer + aml_size_needed; | ||
279 | acpi_status status; | 276 | acpi_status status; |
280 | 277 | ||
281 | ACPI_FUNCTION_TRACE("rs_convert_resources_to_aml"); | 278 | ACPI_FUNCTION_TRACE("rs_convert_resources_to_aml"); |
282 | 279 | ||
283 | /* Convert each resource descriptor in the list */ | 280 | /* Walk the resource descriptor list, convert each descriptor */ |
284 | 281 | ||
285 | while (1) { | 282 | while (aml_buffer < end_aml_buffer) { |
286 | /* Validate Resource Descriptor Type before dispatch */ | 283 | /* Validate the Resource Type */ |
287 | 284 | ||
288 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { | 285 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { |
289 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 286 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
@@ -292,14 +289,14 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, | |||
292 | return_ACPI_STATUS(AE_BAD_DATA); | 289 | return_ACPI_STATUS(AE_BAD_DATA); |
293 | } | 290 | } |
294 | 291 | ||
295 | /* Perform the conversion per resource type */ | 292 | /* Perform the conversion */ |
296 | 293 | ||
297 | status = | 294 | status = acpi_rs_convert_resource_to_aml(resource, |
298 | acpi_gbl_set_resource_dispatch[resource->type] (resource, | 295 | ACPI_CAST_PTR(union |
299 | ACPI_CAST_PTR | 296 | aml_resource, |
300 | (union | 297 | aml_buffer), |
301 | aml_resource, | 298 | acpi_gbl_set_resource_dispatch |
302 | aml_buffer)); | 299 | [resource->type]); |
303 | if (ACPI_FAILURE(status)) { | 300 | if (ACPI_FAILURE(status)) { |
304 | ACPI_REPORT_ERROR(("Could not convert resource (type %X) to AML, %s\n", resource->type, acpi_format_exception(status))); | 301 | ACPI_REPORT_ERROR(("Could not convert resource (type %X) to AML, %s\n", resource->type, acpi_format_exception(status))); |
305 | return_ACPI_STATUS(status); | 302 | return_ACPI_STATUS(status); |
@@ -323,18 +320,23 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, | |||
323 | return_ACPI_STATUS(AE_OK); | 320 | return_ACPI_STATUS(AE_OK); |
324 | } | 321 | } |
325 | 322 | ||
326 | /* Extract the total length of the new descriptor */ | 323 | /* |
327 | /* Set the aml_buffer to point to the next (output) resource descriptor */ | 324 | * Extract the total length of the new descriptor and set the |
328 | 325 | * aml_buffer to point to the next (output) resource descriptor | |
329 | aml_buffer += | 326 | */ |
330 | acpi_rs_get_descriptor_length(ACPI_CAST_PTR | 327 | aml_buffer += acpi_ut_get_descriptor_length(aml_buffer); |
331 | (union aml_resource, | ||
332 | aml_buffer)); | ||
333 | 328 | ||
334 | /* Point to the next input resource descriptor */ | 329 | /* Point to the next input resource descriptor */ |
335 | 330 | ||
336 | resource = | 331 | resource = |
337 | ACPI_PTR_ADD(struct acpi_resource, resource, | 332 | ACPI_PTR_ADD(struct acpi_resource, resource, |
338 | resource->length); | 333 | resource->length); |
334 | |||
335 | /* Check for end-of-list, normal exit */ | ||
336 | |||
339 | } | 337 | } |
338 | |||
339 | /* Completed buffer, but did not find an end_tag resource descriptor */ | ||
340 | |||
341 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | ||
340 | } | 342 | } |