aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resources/rsmemory.c
diff options
context:
space:
mode:
authorRobert Moore <Robert.Moore@intel.com>2005-09-16 16:51:15 -0400
committerLen Brown <len.brown@intel.com>2005-09-21 23:51:39 -0400
commitbda663d36b94c723153246a4231bbc0f1cd1836e (patch)
treecc9f75c1d010d1b99d29f13acd600b21eda5eec5 /drivers/acpi/resources/rsmemory.c
parentefb0372bbaf5b829ff8c39db372779928af542a7 (diff)
[ACPI] ACPICA 20050916
Fixed a problem within the Resource Manager where support for the Generic Register descriptor was not fully implemented. This descriptor is now fully recognized, parsed, disassembled, and displayed. Restructured the Resource Manager code to utilize table-driven dispatch and lookup, eliminating many of the large switch() statements. This reduces overall subsystem code size and code complexity. Affects the resource parsing and construction, disassembly, and debug dump output. Cleaned up and restructured the debug dump output for all resource descriptors. Improved readability of the output and reduced code size. Fixed a problem where changes to internal data structures caused the optional ACPI_MUTEX_DEBUG code to fail compilation if specified. Signed-off-by: Robert Moore <Robert.Moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/resources/rsmemory.c')
-rw-r--r--drivers/acpi/resources/rsmemory.c68
1 files changed, 30 insertions, 38 deletions
diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c
index daba1a1ed46d..418f1afb10a3 100644
--- a/drivers/acpi/resources/rsmemory.c
+++ b/drivers/acpi/resources/rsmemory.c
@@ -84,11 +84,11 @@ acpi_rs_memory24_resource(u8 * byte_stream_buffer,
84 /* Point past the Descriptor to get the number of bytes consumed */ 84 /* Point past the Descriptor to get the number of bytes consumed */
85 85
86 buffer += 1; 86 buffer += 1;
87
88 ACPI_MOVE_16_TO_16(&temp16, buffer); 87 ACPI_MOVE_16_TO_16(&temp16, buffer);
88
89 buffer += 2; 89 buffer += 2;
90 *bytes_consumed = (acpi_size) temp16 + 3; 90 *bytes_consumed = (acpi_size) temp16 + 3;
91 output_struct->id = ACPI_RSTYPE_MEM24; 91 output_struct->type = ACPI_RSTYPE_MEM24;
92 92
93 /* Check Byte 3 the Read/Write bit */ 93 /* Check Byte 3 the Read/Write bit */
94 94
@@ -133,7 +133,7 @@ acpi_rs_memory24_resource(u8 * byte_stream_buffer,
133 * 133 *
134 * FUNCTION: acpi_rs_memory24_stream 134 * FUNCTION: acpi_rs_memory24_stream
135 * 135 *
136 * PARAMETERS: linked_list - Pointer to the resource linked list 136 * PARAMETERS: Resource - Pointer to the resource linked list
137 * output_buffer - Pointer to the user's return buffer 137 * output_buffer - Pointer to the user's return buffer
138 * bytes_consumed - Pointer to where the number of bytes 138 * bytes_consumed - Pointer to where the number of bytes
139 * used in the output_buffer is returned 139 * used in the output_buffer is returned
@@ -146,7 +146,7 @@ acpi_rs_memory24_resource(u8 * byte_stream_buffer,
146 ******************************************************************************/ 146 ******************************************************************************/
147 147
148acpi_status 148acpi_status
149acpi_rs_memory24_stream(struct acpi_resource *linked_list, 149acpi_rs_memory24_stream(struct acpi_resource *resource,
150 u8 ** output_buffer, acpi_size * bytes_consumed) 150 u8 ** output_buffer, acpi_size * bytes_consumed)
151{ 151{
152 u8 *buffer = *output_buffer; 152 u8 *buffer = *output_buffer;
@@ -155,9 +155,9 @@ acpi_rs_memory24_stream(struct acpi_resource *linked_list,
155 155
156 ACPI_FUNCTION_TRACE("rs_memory24_stream"); 156 ACPI_FUNCTION_TRACE("rs_memory24_stream");
157 157
158 /* The descriptor field is static */ 158 /* The Descriptor Type field is static */
159 159
160 *buffer = 0x81; 160 *buffer = ACPI_RDESC_TYPE_MEMORY_24;
161 buffer += 1; 161 buffer += 1;
162 162
163 /* The length field is static */ 163 /* The length field is static */
@@ -168,30 +168,28 @@ acpi_rs_memory24_stream(struct acpi_resource *linked_list,
168 168
169 /* Set the Information Byte */ 169 /* Set the Information Byte */
170 170
171 temp8 = (u8) (linked_list->data.memory24.read_write_attribute & 0x01); 171 temp8 = (u8) (resource->data.memory24.read_write_attribute & 0x01);
172 *buffer = temp8; 172 *buffer = temp8;
173 buffer += 1; 173 buffer += 1;
174 174
175 /* Set the Range minimum base address */ 175 /* Set the Range minimum base address */
176 176
177 ACPI_MOVE_32_TO_16(buffer, 177 ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.min_base_address);
178 &linked_list->data.memory24.min_base_address);
179 buffer += 2; 178 buffer += 2;
180 179
181 /* Set the Range maximum base address */ 180 /* Set the Range maximum base address */
182 181
183 ACPI_MOVE_32_TO_16(buffer, 182 ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.max_base_address);
184 &linked_list->data.memory24.max_base_address);
185 buffer += 2; 183 buffer += 2;
186 184
187 /* Set the base alignment */ 185 /* Set the base alignment */
188 186
189 ACPI_MOVE_32_TO_16(buffer, &linked_list->data.memory24.alignment); 187 ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.alignment);
190 buffer += 2; 188 buffer += 2;
191 189
192 /* Set the range length */ 190 /* Set the range length */
193 191
194 ACPI_MOVE_32_TO_16(buffer, &linked_list->data.memory24.range_length); 192 ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.range_length);
195 buffer += 2; 193 buffer += 2;
196 194
197 /* Return the number of bytes consumed in this operation */ 195 /* Return the number of bytes consumed in this operation */
@@ -238,12 +236,11 @@ acpi_rs_memory32_range_resource(u8 * byte_stream_buffer,
238 /* Point past the Descriptor to get the number of bytes consumed */ 236 /* Point past the Descriptor to get the number of bytes consumed */
239 237
240 buffer += 1; 238 buffer += 1;
241
242 ACPI_MOVE_16_TO_16(&temp16, buffer); 239 ACPI_MOVE_16_TO_16(&temp16, buffer);
240
243 buffer += 2; 241 buffer += 2;
244 *bytes_consumed = (acpi_size) temp16 + 3; 242 *bytes_consumed = (acpi_size) temp16 + 3;
245 243 output_struct->type = ACPI_RSTYPE_MEM32;
246 output_struct->id = ACPI_RSTYPE_MEM32;
247 244
248 /* 245 /*
249 * Point to the place in the output buffer where the data portion will 246 * Point to the place in the output buffer where the data portion will
@@ -335,8 +332,7 @@ acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer,
335 332
336 buffer += 2; 333 buffer += 2;
337 *bytes_consumed = (acpi_size) temp16 + 3; 334 *bytes_consumed = (acpi_size) temp16 + 3;
338 335 output_struct->type = ACPI_RSTYPE_FIXED_MEM32;
339 output_struct->id = ACPI_RSTYPE_FIXED_MEM32;
340 336
341 /* Check Byte 3 the Read/Write bit */ 337 /* Check Byte 3 the Read/Write bit */
342 338
@@ -369,7 +365,7 @@ acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer,
369 * 365 *
370 * FUNCTION: acpi_rs_memory32_range_stream 366 * FUNCTION: acpi_rs_memory32_range_stream
371 * 367 *
372 * PARAMETERS: linked_list - Pointer to the resource linked list 368 * PARAMETERS: Resource - Pointer to the resource linked list
373 * output_buffer - Pointer to the user's return buffer 369 * output_buffer - Pointer to the user's return buffer
374 * bytes_consumed - Pointer to where the number of bytes 370 * bytes_consumed - Pointer to where the number of bytes
375 * used in the output_buffer is returned 371 * used in the output_buffer is returned
@@ -382,7 +378,7 @@ acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer,
382 ******************************************************************************/ 378 ******************************************************************************/
383 379
384acpi_status 380acpi_status
385acpi_rs_memory32_range_stream(struct acpi_resource *linked_list, 381acpi_rs_memory32_range_stream(struct acpi_resource *resource,
386 u8 ** output_buffer, acpi_size * bytes_consumed) 382 u8 ** output_buffer, acpi_size * bytes_consumed)
387{ 383{
388 u8 *buffer = *output_buffer; 384 u8 *buffer = *output_buffer;
@@ -391,9 +387,9 @@ acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
391 387
392 ACPI_FUNCTION_TRACE("rs_memory32_range_stream"); 388 ACPI_FUNCTION_TRACE("rs_memory32_range_stream");
393 389
394 /* The descriptor field is static */ 390 /* The Descriptor Type field is static */
395 391
396 *buffer = 0x85; 392 *buffer = ACPI_RDESC_TYPE_MEMORY_32;
397 buffer += 1; 393 buffer += 1;
398 394
399 /* The length field is static */ 395 /* The length field is static */
@@ -405,30 +401,28 @@ acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
405 401
406 /* Set the Information Byte */ 402 /* Set the Information Byte */
407 403
408 temp8 = (u8) (linked_list->data.memory32.read_write_attribute & 0x01); 404 temp8 = (u8) (resource->data.memory32.read_write_attribute & 0x01);
409 *buffer = temp8; 405 *buffer = temp8;
410 buffer += 1; 406 buffer += 1;
411 407
412 /* Set the Range minimum base address */ 408 /* Set the Range minimum base address */
413 409
414 ACPI_MOVE_32_TO_32(buffer, 410 ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.min_base_address);
415 &linked_list->data.memory32.min_base_address);
416 buffer += 4; 411 buffer += 4;
417 412
418 /* Set the Range maximum base address */ 413 /* Set the Range maximum base address */
419 414
420 ACPI_MOVE_32_TO_32(buffer, 415 ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.max_base_address);
421 &linked_list->data.memory32.max_base_address);
422 buffer += 4; 416 buffer += 4;
423 417
424 /* Set the base alignment */ 418 /* Set the base alignment */
425 419
426 ACPI_MOVE_32_TO_32(buffer, &linked_list->data.memory32.alignment); 420 ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.alignment);
427 buffer += 4; 421 buffer += 4;
428 422
429 /* Set the range length */ 423 /* Set the range length */
430 424
431 ACPI_MOVE_32_TO_32(buffer, &linked_list->data.memory32.range_length); 425 ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.range_length);
432 buffer += 4; 426 buffer += 4;
433 427
434 /* Return the number of bytes consumed in this operation */ 428 /* Return the number of bytes consumed in this operation */
@@ -441,7 +435,7 @@ acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
441 * 435 *
442 * FUNCTION: acpi_rs_fixed_memory32_stream 436 * FUNCTION: acpi_rs_fixed_memory32_stream
443 * 437 *
444 * PARAMETERS: linked_list - Pointer to the resource linked list 438 * PARAMETERS: Resource - Pointer to the resource linked list
445 * output_buffer - Pointer to the user's return buffer 439 * output_buffer - Pointer to the user's return buffer
446 * bytes_consumed - Pointer to where the number of bytes 440 * bytes_consumed - Pointer to where the number of bytes
447 * used in the output_buffer is returned 441 * used in the output_buffer is returned
@@ -454,7 +448,7 @@ acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
454 ******************************************************************************/ 448 ******************************************************************************/
455 449
456acpi_status 450acpi_status
457acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list, 451acpi_rs_fixed_memory32_stream(struct acpi_resource *resource,
458 u8 ** output_buffer, acpi_size * bytes_consumed) 452 u8 ** output_buffer, acpi_size * bytes_consumed)
459{ 453{
460 u8 *buffer = *output_buffer; 454 u8 *buffer = *output_buffer;
@@ -463,9 +457,9 @@ acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list,
463 457
464 ACPI_FUNCTION_TRACE("rs_fixed_memory32_stream"); 458 ACPI_FUNCTION_TRACE("rs_fixed_memory32_stream");
465 459
466 /* The descriptor field is static */ 460 /* The Descriptor Type field is static */
467 461
468 *buffer = 0x86; 462 *buffer = ACPI_RDESC_TYPE_FIXED_MEMORY_32;
469 buffer += 1; 463 buffer += 1;
470 464
471 /* The length field is static */ 465 /* The length field is static */
@@ -478,21 +472,19 @@ acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list,
478 /* Set the Information Byte */ 472 /* Set the Information Byte */
479 473
480 temp8 = 474 temp8 =
481 (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01); 475 (u8) (resource->data.fixed_memory32.read_write_attribute & 0x01);
482 *buffer = temp8; 476 *buffer = temp8;
483 buffer += 1; 477 buffer += 1;
484 478
485 /* Set the Range base address */ 479 /* Set the Range base address */
486 480
487 ACPI_MOVE_32_TO_32(buffer, 481 ACPI_MOVE_32_TO_32(buffer,
488 &linked_list->data.fixed_memory32. 482 &resource->data.fixed_memory32.range_base_address);
489 range_base_address);
490 buffer += 4; 483 buffer += 4;
491 484
492 /* Set the range length */ 485 /* Set the range length */
493 486
494 ACPI_MOVE_32_TO_32(buffer, 487 ACPI_MOVE_32_TO_32(buffer, &resource->data.fixed_memory32.range_length);
495 &linked_list->data.fixed_memory32.range_length);
496 buffer += 4; 488 buffer += 4;
497 489
498 /* Return the number of bytes consumed in this operation */ 490 /* Return the number of bytes consumed in this operation */