aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resources/rscalc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/resources/rscalc.c')
-rw-r--r--drivers/acpi/resources/rscalc.c282
1 files changed, 63 insertions, 219 deletions
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c
index 2da7c6a8182e..d170dee07ce9 100644
--- a/drivers/acpi/resources/rscalc.c
+++ b/drivers/acpi/resources/rscalc.c
@@ -44,87 +44,14 @@
44#include <acpi/acpi.h> 44#include <acpi/acpi.h>
45#include <acpi/acresrc.h> 45#include <acpi/acresrc.h>
46#include <acpi/amlcode.h> 46#include <acpi/amlcode.h>
47#include <acpi/amlresrc.h>
48#include <acpi/acnamesp.h> 47#include <acpi/acnamesp.h>
49 48
50#define _COMPONENT ACPI_RESOURCES 49#define _COMPONENT ACPI_RESOURCES
51ACPI_MODULE_NAME("rscalc") 50ACPI_MODULE_NAME("rscalc")
52 51
53/*
54 * Base sizes for external resource descriptors, indexed by internal type.
55 * Includes size of the descriptor header (1 byte for small descriptors,
56 * 3 bytes for large descriptors)
57 */
58static u8 acpi_gbl_stream_sizes[] = {
59 4, /* ACPI_RSTYPE_IRQ (Byte 3 is optional, but always created) */
60 3, /* ACPI_RSTYPE_DMA */
61 2, /* ACPI_RSTYPE_START_DPF (Byte 1 is optional, but always created) */
62 1, /* ACPI_RSTYPE_END_DPF */
63 8, /* ACPI_RSTYPE_IO */
64 4, /* ACPI_RSTYPE_FIXED_IO */
65 1, /* ACPI_RSTYPE_VENDOR */
66 2, /* ACPI_RSTYPE_END_TAG */
67 12, /* ACPI_RSTYPE_MEM24 */
68 20, /* ACPI_RSTYPE_MEM32 */
69 12, /* ACPI_RSTYPE_FIXED_MEM32 */
70 16, /* ACPI_RSTYPE_ADDRESS16 */
71 26, /* ACPI_RSTYPE_ADDRESS32 */
72 46, /* ACPI_RSTYPE_ADDRESS64 */
73 9, /* ACPI_RSTYPE_EXT_IRQ */
74 15 /* ACPI_RSTYPE_GENERIC_REG */
75};
76
77/*
78 * Base sizes of resource descriptors, both the actual AML stream length and
79 * size of the internal struct representation.
80 */
81struct acpi_resource_sizes {
82 u8 minimum_stream_size;
83 u8 minimum_struct_size;
84};
85
86static struct acpi_resource_sizes acpi_gbl_sm_resource_sizes[] = {
87 {0, 0}, /* 0x00, Reserved */
88 {0, 0}, /* 0x01, Reserved */
89 {0, 0}, /* 0x02, Reserved */
90 {0, 0}, /* 0x03, Reserved */
91 {3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq)}, /* ACPI_RDESC_TYPE_IRQ_FORMAT */
92 {3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma)}, /* ACPI_RDESC_TYPE_DMA_FORMAT */
93 {1, ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dpf)}, /* ACPI_RDESC_TYPE_START_DEPENDENT */
94 {1, ACPI_RESOURCE_LENGTH}, /* ACPI_RDESC_TYPE_END_DEPENDENT */
95 {8, ACPI_SIZEOF_RESOURCE(struct acpi_resource_io)}, /* ACPI_RDESC_TYPE_IO_PORT */
96 {4, ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io)}, /* ACPI_RDESC_TYPE_FIXED_IO_PORT */
97 {0, 0}, /* 0x0A, Reserved */
98 {0, 0}, /* 0x0B, Reserved */
99 {0, 0}, /* 0x0C, Reserved */
100 {0, 0}, /* 0x0D, Reserved */
101 {1, ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)}, /* ACPI_RDESC_TYPE_SMALL_VENDOR */
102 {2, ACPI_RESOURCE_LENGTH}, /* ACPI_RDESC_TYPE_END_TAG */
103};
104
105static struct acpi_resource_sizes acpi_gbl_lg_resource_sizes[] = {
106 {0, 0}, /* 0x00, Reserved */
107 {12, ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24)}, /* ACPI_RDESC_TYPE_MEMORY_24 */
108 {15, ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_reg)}, /* ACPI_RDESC_TYPE_GENERIC_REGISTER */
109 {0, 0}, /* 0x03, Reserved */
110 {3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)}, /* ACPI_RDESC_TYPE_LARGE_VENDOR */
111 {20, ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32)}, /* ACPI_RDESC_TYPE_MEMORY_32 */
112 {12, ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_mem32)}, /* ACPI_RDESC_TYPE_FIXED_MEMORY_32 */
113 {26, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32)}, /* ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE */
114 {16, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16)}, /* ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE */
115 {9, ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq)}, /* ACPI_RDESC_TYPE_EXTENDED_XRUPT */
116 {46, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64)}, /* ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE */
117 {56, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64)}, /* ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE */
118};
119
120/* Local prototypes */ 52/* Local prototypes */
121
122static u8 acpi_rs_count_set_bits(u16 bit_field); 53static u8 acpi_rs_count_set_bits(u16 bit_field);
123 54
124static struct acpi_resource_sizes *acpi_rs_get_resource_sizes(u8 resource_type);
125
126static u16 acpi_rs_get_resource_length(u8 * resource);
127
128static acpi_size 55static acpi_size
129acpi_rs_struct_option_length(struct acpi_resource_source *resource_source); 56acpi_rs_struct_option_length(struct acpi_resource_source *resource_source);
130 57
@@ -161,90 +88,6 @@ static u8 acpi_rs_count_set_bits(u16 bit_field)
161 88
162/******************************************************************************* 89/*******************************************************************************
163 * 90 *
164 * FUNCTION: acpi_rs_get_resource_sizes
165 *
166 * PARAMETERS: resource_type - Byte 0 of a resource descriptor
167 *
168 * RETURN: Pointer to the resource conversion handler
169 *
170 * DESCRIPTION: Extract the Resource Type/Name from the first byte of
171 * a resource descriptor.
172 *
173 ******************************************************************************/
174
175static struct acpi_resource_sizes *acpi_rs_get_resource_sizes(u8 resource_type)
176{
177 struct acpi_resource_sizes *size_info;
178
179 ACPI_FUNCTION_ENTRY();
180
181 /* Determine if this is a small or large resource */
182
183 if (resource_type & ACPI_RDESC_TYPE_LARGE) {
184 /* Large Resource Type -- bits 6:0 contain the name */
185
186 if (resource_type > ACPI_RDESC_LARGE_MAX) {
187 return (NULL);
188 }
189
190 size_info = &acpi_gbl_lg_resource_sizes[(resource_type &
191 ACPI_RDESC_LARGE_MASK)];
192 } else {
193 /* Small Resource Type -- bits 6:3 contain the name */
194
195 size_info = &acpi_gbl_sm_resource_sizes[((resource_type &
196 ACPI_RDESC_SMALL_MASK)
197 >> 3)];
198 }
199
200 /* Zero entry indicates an invalid resource type */
201
202 if (!size_info->minimum_stream_size) {
203 return (NULL);
204 }
205
206 return (size_info);
207}
208
209/*******************************************************************************
210 *
211 * FUNCTION: acpi_rs_get_resource_length
212 *
213 * PARAMETERS: Resource - Pointer to the resource descriptor
214 *
215 * RETURN: Byte length of the (AML byte stream) descriptor. By definition,
216 * this does not include the size of the descriptor header and the
217 * length field itself.
218 *
219 * DESCRIPTION: Extract the length of a resource descriptor.
220 *
221 ******************************************************************************/
222
223static u16 acpi_rs_get_resource_length(u8 * resource)
224{
225 u16 resource_length;
226
227 ACPI_FUNCTION_ENTRY();
228
229 /* Determine if this is a small or large resource */
230
231 if (*resource & ACPI_RDESC_TYPE_LARGE) {
232 /* Large Resource type -- length is in bytes 1-2 */
233
234 ACPI_MOVE_16_TO_16(&resource_length, (resource + 1));
235
236 } else {
237 /* Small Resource Type -- bits 2:0 of byte 0 contain the length */
238
239 resource_length =
240 (u16) (*resource & ACPI_RDESC_SMALL_LENGTH_MASK);
241 }
242
243 return (resource_length);
244}
245
246/*******************************************************************************
247 *
248 * FUNCTION: acpi_rs_struct_option_length 91 * FUNCTION: acpi_rs_struct_option_length
249 * 92 *
250 * PARAMETERS: resource_source - Pointer to optional descriptor field 93 * PARAMETERS: resource_source - Pointer to optional descriptor field
@@ -291,10 +134,10 @@ acpi_rs_struct_option_length(struct acpi_resource_source *resource_source)
291 ******************************************************************************/ 134 ******************************************************************************/
292 135
293static u32 136static u32
294acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length) 137acpi_rs_stream_option_length(u32 resource_length,
138 u32 minimum_aml_resource_length)
295{ 139{
296 u32 string_length = 0; 140 u32 string_length = 0;
297 u32 minimum_resource_length;
298 141
299 ACPI_FUNCTION_ENTRY(); 142 ACPI_FUNCTION_ENTRY();
300 143
@@ -303,11 +146,6 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length)
303 * Large-type resource descriptors. 146 * Large-type resource descriptors.
304 */ 147 */
305 148
306 /* Compute minimum size of the data part of the resource descriptor */
307
308 minimum_resource_length =
309 minimum_total_length - sizeof(struct asl_large_header);
310
311 /* 149 /*
312 * If the length of the actual resource descriptor is greater than the ACPI 150 * If the length of the actual resource descriptor is greater than the ACPI
313 * spec-defined minimum length, it means that a resource_source_index exists 151 * spec-defined minimum length, it means that a resource_source_index exists
@@ -315,10 +153,11 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length)
315 * (including the null terminator) is the resource length minus the minimum 153 * (including the null terminator) is the resource length minus the minimum
316 * length, minus one byte for the resource_source_index itself. 154 * length, minus one byte for the resource_source_index itself.
317 */ 155 */
318 if (resource_length > minimum_resource_length) { 156 if (resource_length > minimum_aml_resource_length) {
319 /* Compute the length of the optional string */ 157 /* Compute the length of the optional string */
320 158
321 string_length = resource_length - minimum_resource_length - 1; 159 string_length =
160 resource_length - minimum_aml_resource_length - 1;
322 } 161 }
323 162
324 /* Round up length to 32 bits for internal structure alignment */ 163 /* Round up length to 32 bits for internal structure alignment */
@@ -328,7 +167,7 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length)
328 167
329/******************************************************************************* 168/*******************************************************************************
330 * 169 *
331 * FUNCTION: acpi_rs_get_byte_stream_length 170 * FUNCTION: acpi_rs_get_aml_length
332 * 171 *
333 * PARAMETERS: Resource - Pointer to the resource linked list 172 * PARAMETERS: Resource - Pointer to the resource linked list
334 * size_needed - Where the required size is returned 173 * size_needed - Where the required size is returned
@@ -342,62 +181,62 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length)
342 ******************************************************************************/ 181 ******************************************************************************/
343 182
344acpi_status 183acpi_status
345acpi_rs_get_byte_stream_length(struct acpi_resource * resource, 184acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
346 acpi_size * size_needed)
347{ 185{
348 acpi_size byte_stream_size_needed = 0; 186 acpi_size aml_size_needed = 0;
349 acpi_size segment_size; 187 acpi_size segment_size;
350 188
351 ACPI_FUNCTION_TRACE("rs_get_byte_stream_length"); 189 ACPI_FUNCTION_TRACE("rs_get_aml_length");
352 190
353 /* Traverse entire list of internal resource descriptors */ 191 /* Traverse entire list of internal resource descriptors */
354 192
355 while (resource) { 193 while (resource) {
356 /* Validate the descriptor type */ 194 /* Validate the descriptor type */
357 195
358 if (resource->type > ACPI_RSTYPE_MAX) { 196 if (resource->type > ACPI_RESOURCE_TYPE_MAX) {
359 return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); 197 return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
360 } 198 }
361 199
362 /* Get the base size of the (external stream) resource descriptor */ 200 /* Get the base size of the (external stream) resource descriptor */
363 201
364 segment_size = acpi_gbl_stream_sizes[resource->type]; 202 segment_size = acpi_gbl_aml_resource_sizes[resource->type];
365 203
366 /* 204 /*
367 * Augment the base size for descriptors with optional and/or 205 * Augment the base size for descriptors with optional and/or
368 * variable-length fields 206 * variable-length fields
369 */ 207 */
370 switch (resource->type) { 208 switch (resource->type) {
371 case ACPI_RSTYPE_VENDOR: 209 case ACPI_RESOURCE_TYPE_VENDOR:
372 /* 210 /*
373 * Vendor Defined Resource: 211 * Vendor Defined Resource:
374 * For a Vendor Specific resource, if the Length is between 1 and 7 212 * For a Vendor Specific resource, if the Length is between 1 and 7
375 * it will be created as a Small Resource data type, otherwise it 213 * it will be created as a Small Resource data type, otherwise it
376 * is a Large Resource data type. 214 * is a Large Resource data type.
377 */ 215 */
378 if (resource->data.vendor_specific.length > 7) { 216 if (resource->data.vendor.byte_length > 7) {
379 /* Base size of a Large resource descriptor */ 217 /* Base size of a Large resource descriptor */
380 218
381 segment_size = 3; 219 segment_size =
220 sizeof(struct aml_resource_large_header);
382 } 221 }
383 222
384 /* Add the size of the vendor-specific data */ 223 /* Add the size of the vendor-specific data */
385 224
386 segment_size += resource->data.vendor_specific.length; 225 segment_size += resource->data.vendor.byte_length;
387 break; 226 break;
388 227
389 case ACPI_RSTYPE_END_TAG: 228 case ACPI_RESOURCE_TYPE_END_TAG:
390 /* 229 /*
391 * End Tag: 230 * End Tag:
392 * We are done -- return the accumulated total size. 231 * We are done -- return the accumulated total size.
393 */ 232 */
394 *size_needed = byte_stream_size_needed + segment_size; 233 *size_needed = aml_size_needed + segment_size;
395 234
396 /* Normal exit */ 235 /* Normal exit */
397 236
398 return_ACPI_STATUS(AE_OK); 237 return_ACPI_STATUS(AE_OK);
399 238
400 case ACPI_RSTYPE_ADDRESS16: 239 case ACPI_RESOURCE_TYPE_ADDRESS16:
401 /* 240 /*
402 * 16-Bit Address Resource: 241 * 16-Bit Address Resource:
403 * Add the size of the optional resource_source info 242 * Add the size of the optional resource_source info
@@ -408,7 +247,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
408 resource_source); 247 resource_source);
409 break; 248 break;
410 249
411 case ACPI_RSTYPE_ADDRESS32: 250 case ACPI_RESOURCE_TYPE_ADDRESS32:
412 /* 251 /*
413 * 32-Bit Address Resource: 252 * 32-Bit Address Resource:
414 * Add the size of the optional resource_source info 253 * Add the size of the optional resource_source info
@@ -419,7 +258,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
419 resource_source); 258 resource_source);
420 break; 259 break;
421 260
422 case ACPI_RSTYPE_ADDRESS64: 261 case ACPI_RESOURCE_TYPE_ADDRESS64:
423 /* 262 /*
424 * 64-Bit Address Resource: 263 * 64-Bit Address Resource:
425 * Add the size of the optional resource_source info 264 * Add the size of the optional resource_source info
@@ -430,7 +269,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
430 resource_source); 269 resource_source);
431 break; 270 break;
432 271
433 case ACPI_RSTYPE_EXT_IRQ: 272 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
434 /* 273 /*
435 * Extended IRQ Resource: 274 * Extended IRQ Resource:
436 * Add the size of each additional optional interrupt beyond the 275 * Add the size of each additional optional interrupt beyond the
@@ -438,7 +277,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
438 */ 277 */
439 segment_size += (((acpi_size) 278 segment_size += (((acpi_size)
440 resource->data.extended_irq. 279 resource->data.extended_irq.
441 number_of_interrupts - 1) * 4); 280 interrupt_count - 1) * 4);
442 281
443 /* Add the size of the optional resource_source info */ 282 /* Add the size of the optional resource_source info */
444 283
@@ -454,7 +293,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
454 293
455 /* Update the total */ 294 /* Update the total */
456 295
457 byte_stream_size_needed += segment_size; 296 aml_size_needed += segment_size;
458 297
459 /* Point to the next object */ 298 /* Point to the next object */
460 299
@@ -471,9 +310,9 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
471 * 310 *
472 * FUNCTION: acpi_rs_get_list_length 311 * FUNCTION: acpi_rs_get_list_length
473 * 312 *
474 * PARAMETERS: byte_stream_buffer - Pointer to the resource byte stream 313 * PARAMETERS: aml_buffer - Pointer to the resource byte stream
475 * byte_stream_buffer_length - Size of byte_stream_buffer 314 * aml_buffer_length - Size of aml_buffer
476 * size_needed - Where the size needed is returned 315 * size_needed - Where the size needed is returned
477 * 316 *
478 * RETURN: Status 317 * RETURN: Status
479 * 318 *
@@ -484,11 +323,11 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
484 ******************************************************************************/ 323 ******************************************************************************/
485 324
486acpi_status 325acpi_status
487acpi_rs_get_list_length(u8 * byte_stream_buffer, 326acpi_rs_get_list_length(u8 * aml_buffer,
488 u32 byte_stream_buffer_length, acpi_size * size_needed) 327 u32 aml_buffer_length, acpi_size * size_needed)
489{ 328{
490 u8 *buffer; 329 u8 *buffer;
491 struct acpi_resource_sizes *resource_info; 330 struct acpi_resource_info *resource_info;
492 u32 buffer_size = 0; 331 u32 buffer_size = 0;
493 u32 bytes_parsed = 0; 332 u32 bytes_parsed = 0;
494 u8 resource_type; 333 u8 resource_type;
@@ -499,14 +338,14 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
499 338
500 ACPI_FUNCTION_TRACE("rs_get_list_length"); 339 ACPI_FUNCTION_TRACE("rs_get_list_length");
501 340
502 while (bytes_parsed < byte_stream_buffer_length) { 341 while (bytes_parsed < aml_buffer_length) {
503 /* The next byte in the stream is the resource descriptor type */ 342 /* The next byte in the stream is the resource descriptor type */
504 343
505 resource_type = acpi_rs_get_resource_type(*byte_stream_buffer); 344 resource_type = acpi_rs_get_resource_type(*aml_buffer);
506 345
507 /* Get the base stream size and structure sizes for the descriptor */ 346 /* Get the base stream size and structure sizes for the descriptor */
508 347
509 resource_info = acpi_rs_get_resource_sizes(resource_type); 348 resource_info = acpi_rs_get_resource_info(resource_type);
510 if (!resource_info) { 349 if (!resource_info) {
511 return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); 350 return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
512 } 351 }
@@ -514,43 +353,46 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
514 /* Get the Length field from the input resource descriptor */ 353 /* Get the Length field from the input resource descriptor */
515 354
516 resource_length = 355 resource_length =
517 acpi_rs_get_resource_length(byte_stream_buffer); 356 acpi_rs_get_resource_length(ACPI_CAST_PTR
357 (union aml_resource,
358 aml_buffer));
518 359
519 /* Augment the size for descriptors with optional fields */ 360 /* Augment the size for descriptors with optional fields */
520 361
521 extra_struct_bytes = 0; 362 extra_struct_bytes = 0;
522 363
523 if (!(resource_type & ACPI_RDESC_TYPE_LARGE)) { 364 if (!(resource_type & ACPI_RESOURCE_NAME_LARGE)) {
524 /* 365 /*
525 * Small resource descriptors 366 * Small resource descriptors
526 */ 367 */
527 header_length = 1; 368 header_length =
528 buffer = byte_stream_buffer + header_length; 369 sizeof(struct aml_resource_small_header);
370 buffer = aml_buffer + header_length;
529 371
530 switch (resource_type) { 372 switch (resource_type) {
531 case ACPI_RDESC_TYPE_IRQ_FORMAT: 373 case ACPI_RESOURCE_NAME_IRQ:
532 /* 374 /*
533 * IRQ Resource: 375 * IRQ Resource:
534 * Get the number of bits set in the IRQ word 376 * Get the number of bits set in the IRQ word
535 */ 377 */
536 ACPI_MOVE_16_TO_16(&temp16, buffer); 378 ACPI_MOVE_16_TO_16(&temp16, buffer);
537
538 extra_struct_bytes = 379 extra_struct_bytes =
539 (acpi_rs_count_set_bits(temp16) * 380 (acpi_rs_count_set_bits(temp16) *
540 sizeof(u32)); 381 sizeof(u32));
541 break; 382 break;
542 383
543 case ACPI_RDESC_TYPE_DMA_FORMAT: 384 case ACPI_RESOURCE_NAME_DMA:
544 /* 385 /*
545 * DMA Resource: 386 * DMA Resource:
546 * Get the number of bits set in the DMA channels byte 387 * Get the number of bits set in the DMA channels byte
547 */ 388 */
389 ACPI_MOVE_16_TO_16(&temp16, buffer);
548 extra_struct_bytes = 390 extra_struct_bytes =
549 (acpi_rs_count_set_bits((u16) * buffer) * 391 (acpi_rs_count_set_bits(temp16) *
550 sizeof(u32)); 392 sizeof(u32));
551 break; 393 break;
552 394
553 case ACPI_RDESC_TYPE_SMALL_VENDOR: 395 case ACPI_RESOURCE_NAME_VENDOR_SMALL:
554 /* 396 /*
555 * Vendor Specific Resource: 397 * Vendor Specific Resource:
556 * Ensure a 32-bit boundary for the structure 398 * Ensure a 32-bit boundary for the structure
@@ -559,12 +401,12 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
559 ACPI_ROUND_UP_to_32_bITS(resource_length); 401 ACPI_ROUND_UP_to_32_bITS(resource_length);
560 break; 402 break;
561 403
562 case ACPI_RDESC_TYPE_END_TAG: 404 case ACPI_RESOURCE_NAME_END_TAG:
563 /* 405 /*
564 * End Tag: 406 * End Tag:
565 * Terminate the loop now 407 * Terminate the loop now
566 */ 408 */
567 byte_stream_buffer_length = bytes_parsed; 409 aml_buffer_length = bytes_parsed;
568 break; 410 break;
569 411
570 default: 412 default:
@@ -574,11 +416,12 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
574 /* 416 /*
575 * Large resource descriptors 417 * Large resource descriptors
576 */ 418 */
577 header_length = sizeof(struct asl_large_header); 419 header_length =
578 buffer = byte_stream_buffer + header_length; 420 sizeof(struct aml_resource_large_header);
421 buffer = aml_buffer + header_length;
579 422
580 switch (resource_type) { 423 switch (resource_type) {
581 case ACPI_RDESC_TYPE_LARGE_VENDOR: 424 case ACPI_RESOURCE_NAME_VENDOR_LARGE:
582 /* 425 /*
583 * Vendor Defined Resource: 426 * Vendor Defined Resource:
584 * Add vendor data and ensure a 32-bit boundary for the structure 427 * Add vendor data and ensure a 32-bit boundary for the structure
@@ -587,8 +430,8 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
587 ACPI_ROUND_UP_to_32_bITS(resource_length); 430 ACPI_ROUND_UP_to_32_bITS(resource_length);
588 break; 431 break;
589 432
590 case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE: 433 case ACPI_RESOURCE_NAME_ADDRESS32:
591 case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE: 434 case ACPI_RESOURCE_NAME_ADDRESS16:
592 /* 435 /*
593 * 32-Bit or 16-bit Address Resource: 436 * 32-Bit or 16-bit Address Resource:
594 * Add the size of any optional data (resource_source) 437 * Add the size of any optional data (resource_source)
@@ -596,10 +439,11 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
596 extra_struct_bytes = 439 extra_struct_bytes =
597 acpi_rs_stream_option_length 440 acpi_rs_stream_option_length
598 (resource_length, 441 (resource_length,
599 resource_info->minimum_stream_size); 442 resource_info->
443 minimum_aml_resource_length);
600 break; 444 break;
601 445
602 case ACPI_RDESC_TYPE_EXTENDED_XRUPT: 446 case ACPI_RESOURCE_NAME_EXTENDED_IRQ:
603 /* 447 /*
604 * Extended IRQ: 448 * Extended IRQ:
605 * Point past the interrupt_vector_flags to get the 449 * Point past the interrupt_vector_flags to get the
@@ -622,10 +466,10 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
622 - 466 -
623 extra_struct_bytes, 467 extra_struct_bytes,
624 resource_info-> 468 resource_info->
625 minimum_stream_size); 469 minimum_aml_resource_length);
626 break; 470 break;
627 471
628 case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE: 472 case ACPI_RESOURCE_NAME_ADDRESS64:
629 /* 473 /*
630 * 64-Bit Address Resource: 474 * 64-Bit Address Resource:
631 * Add the size of any optional data (resource_source) 475 * Add the size of any optional data (resource_source)
@@ -635,7 +479,8 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
635 ACPI_ROUND_UP_to_64_bITS 479 ACPI_ROUND_UP_to_64_bITS
636 (acpi_rs_stream_option_length 480 (acpi_rs_stream_option_length
637 (resource_length, 481 (resource_length,
638 resource_info->minimum_stream_size)); 482 resource_info->
483 minimum_aml_resource_length));
639 break; 484 break;
640 485
641 default: 486 default:
@@ -646,7 +491,7 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
646 /* Update the required buffer size for the internal descriptor structs */ 491 /* Update the required buffer size for the internal descriptor structs */
647 492
648 temp16 = 493 temp16 =
649 (u16) (resource_info->minimum_struct_size + 494 (u16) (resource_info->minimum_internal_struct_length +
650 extra_struct_bytes); 495 extra_struct_bytes);
651 buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE(temp16); 496 buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE(temp16);
652 497
@@ -656,7 +501,7 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
656 */ 501 */
657 temp16 = (u16) (header_length + resource_length); 502 temp16 = (u16) (header_length + resource_length);
658 bytes_parsed += temp16; 503 bytes_parsed += temp16;
659 byte_stream_buffer += temp16; 504 aml_buffer += temp16;
660 } 505 }
661 506
662 /* This is the data the caller needs */ 507 /* This is the data the caller needs */
@@ -758,8 +603,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
758 (*sub_object_list)->string. 603 (*sub_object_list)->string.
759 length + 1); 604 length + 1);
760 } else { 605 } else {
761 temp_size_needed += 606 temp_size_needed += acpi_ns_get_pathname_length((*sub_object_list)->reference.node);
762 acpi_ns_get_pathname_length((*sub_object_list)->reference.node);
763 } 607 }
764 } else { 608 } else {
765 /* 609 /*