aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resources/rsirq.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/rsirq.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/rsirq.c')
-rw-r--r--drivers/acpi/resources/rsirq.c57
1 files changed, 28 insertions, 29 deletions
diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c
index 56043fee96cb..75df962115cc 100644
--- a/drivers/acpi/resources/rsirq.c
+++ b/drivers/acpi/resources/rsirq.c
@@ -88,7 +88,7 @@ acpi_rs_irq_resource(u8 * byte_stream_buffer,
88 */ 88 */
89 temp8 = *buffer; 89 temp8 = *buffer;
90 *bytes_consumed = (temp8 & 0x03) + 1; 90 *bytes_consumed = (temp8 & 0x03) + 1;
91 output_struct->id = ACPI_RSTYPE_IRQ; 91 output_struct->type = ACPI_RSTYPE_IRQ;
92 92
93 /* Point to the 16-bits of Bytes 1 and 2 */ 93 /* Point to the 16-bits of Bytes 1 and 2 */
94 94
@@ -177,7 +177,7 @@ acpi_rs_irq_resource(u8 * byte_stream_buffer,
177 * 177 *
178 * FUNCTION: acpi_rs_irq_stream 178 * FUNCTION: acpi_rs_irq_stream
179 * 179 *
180 * PARAMETERS: linked_list - Pointer to the resource linked list 180 * PARAMETERS: Resource - Pointer to the resource linked list
181 * output_buffer - Pointer to the user's return buffer 181 * output_buffer - Pointer to the user's return buffer
182 * bytes_consumed - Pointer to where the number of bytes 182 * bytes_consumed - Pointer to where the number of bytes
183 * used in the output_buffer is returned 183 * used in the output_buffer is returned
@@ -190,7 +190,7 @@ acpi_rs_irq_resource(u8 * byte_stream_buffer,
190 ******************************************************************************/ 190 ******************************************************************************/
191 191
192acpi_status 192acpi_status
193acpi_rs_irq_stream(struct acpi_resource *linked_list, 193acpi_rs_irq_stream(struct acpi_resource *resource,
194 u8 ** output_buffer, acpi_size * bytes_consumed) 194 u8 ** output_buffer, acpi_size * bytes_consumed)
195{ 195{
196 u8 *buffer = *output_buffer; 196 u8 *buffer = *output_buffer;
@@ -205,13 +205,13 @@ acpi_rs_irq_stream(struct acpi_resource *linked_list,
205 * The descriptor field is set based upon whether a third byte is 205 * The descriptor field is set based upon whether a third byte is
206 * needed to contain the IRQ Information. 206 * needed to contain the IRQ Information.
207 */ 207 */
208 if (ACPI_EDGE_SENSITIVE == linked_list->data.irq.edge_level && 208 if (ACPI_EDGE_SENSITIVE == resource->data.irq.edge_level &&
209 ACPI_ACTIVE_HIGH == linked_list->data.irq.active_high_low && 209 ACPI_ACTIVE_HIGH == resource->data.irq.active_high_low &&
210 ACPI_EXCLUSIVE == linked_list->data.irq.shared_exclusive) { 210 ACPI_EXCLUSIVE == resource->data.irq.shared_exclusive) {
211 *buffer = 0x22; 211 *buffer = ACPI_RDESC_TYPE_IRQ_FORMAT | 0x02;
212 IRqinfo_byte_needed = FALSE; 212 IRqinfo_byte_needed = FALSE;
213 } else { 213 } else {
214 *buffer = 0x23; 214 *buffer = ACPI_RDESC_TYPE_IRQ_FORMAT | 0x03;
215 IRqinfo_byte_needed = TRUE; 215 IRqinfo_byte_needed = TRUE;
216 } 216 }
217 217
@@ -221,8 +221,8 @@ acpi_rs_irq_stream(struct acpi_resource *linked_list,
221 /* Loop through all of the interrupts and set the mask bits */ 221 /* Loop through all of the interrupts and set the mask bits */
222 222
223 for (index = 0; 223 for (index = 0;
224 index < linked_list->data.irq.number_of_interrupts; index++) { 224 index < resource->data.irq.number_of_interrupts; index++) {
225 temp8 = (u8) linked_list->data.irq.interrupts[index]; 225 temp8 = (u8) resource->data.irq.interrupts[index];
226 temp16 |= 0x1 << temp8; 226 temp16 |= 0x1 << temp8;
227 } 227 }
228 228
@@ -233,11 +233,11 @@ acpi_rs_irq_stream(struct acpi_resource *linked_list,
233 233
234 if (IRqinfo_byte_needed) { 234 if (IRqinfo_byte_needed) {
235 temp8 = 0; 235 temp8 = 0;
236 temp8 = (u8) ((linked_list->data.irq.shared_exclusive & 236 temp8 = (u8) ((resource->data.irq.shared_exclusive &
237 0x01) << 4); 237 0x01) << 4);
238 238
239 if (ACPI_LEVEL_SENSITIVE == linked_list->data.irq.edge_level && 239 if (ACPI_LEVEL_SENSITIVE == resource->data.irq.edge_level &&
240 ACPI_ACTIVE_LOW == linked_list->data.irq.active_high_low) { 240 ACPI_ACTIVE_LOW == resource->data.irq.active_high_low) {
241 temp8 |= 0x08; 241 temp8 |= 0x08;
242 } else { 242 } else {
243 temp8 |= 0x01; 243 temp8 |= 0x01;
@@ -302,7 +302,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer,
302 } 302 }
303 303
304 *bytes_consumed = temp16 + 3; 304 *bytes_consumed = temp16 + 3;
305 output_struct->id = ACPI_RSTYPE_EXT_IRQ; 305 output_struct->type = ACPI_RSTYPE_EXT_IRQ;
306 306
307 /* Point to the Byte3 */ 307 /* Point to the Byte3 */
308 308
@@ -441,7 +441,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer,
441 * 441 *
442 * FUNCTION: acpi_rs_extended_irq_stream 442 * FUNCTION: acpi_rs_extended_irq_stream
443 * 443 *
444 * PARAMETERS: linked_list - Pointer to the resource linked list 444 * PARAMETERS: Resource - Pointer to the resource linked list
445 * output_buffer - Pointer to the user's return buffer 445 * output_buffer - Pointer to the user's return buffer
446 * bytes_consumed - Pointer to where the number of bytes 446 * bytes_consumed - Pointer to where the number of bytes
447 * used in the output_buffer is returned 447 * used in the output_buffer is returned
@@ -454,7 +454,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer,
454 ******************************************************************************/ 454 ******************************************************************************/
455 455
456acpi_status 456acpi_status
457acpi_rs_extended_irq_stream(struct acpi_resource *linked_list, 457acpi_rs_extended_irq_stream(struct acpi_resource *resource,
458 u8 ** output_buffer, acpi_size * bytes_consumed) 458 u8 ** output_buffer, acpi_size * bytes_consumed)
459{ 459{
460 u8 *buffer = *output_buffer; 460 u8 *buffer = *output_buffer;
@@ -476,9 +476,8 @@ acpi_rs_extended_irq_stream(struct acpi_resource *linked_list,
476 476
477 /* Set the Interrupt vector flags */ 477 /* Set the Interrupt vector flags */
478 478
479 temp8 = (u8) (linked_list->data.extended_irq.producer_consumer & 0x01); 479 temp8 = (u8) (resource->data.extended_irq.producer_consumer & 0x01);
480 temp8 |= 480 temp8 |= ((resource->data.extended_irq.shared_exclusive & 0x01) << 3);
481 ((linked_list->data.extended_irq.shared_exclusive & 0x01) << 3);
482 481
483 /* 482 /*
484 * Set the Interrupt Mode 483 * Set the Interrupt Mode
@@ -489,44 +488,44 @@ acpi_rs_extended_irq_stream(struct acpi_resource *linked_list,
489 * 488 *
490 * - Edge/Level are defined opposite in the table vs the headers 489 * - Edge/Level are defined opposite in the table vs the headers
491 */ 490 */
492 if (ACPI_EDGE_SENSITIVE == linked_list->data.extended_irq.edge_level) { 491 if (ACPI_EDGE_SENSITIVE == resource->data.extended_irq.edge_level) {
493 temp8 |= 0x2; 492 temp8 |= 0x2;
494 } 493 }
495 494
496 /* Set the Interrupt Polarity */ 495 /* Set the Interrupt Polarity */
497 496
498 temp8 |= ((linked_list->data.extended_irq.active_high_low & 0x1) << 2); 497 temp8 |= ((resource->data.extended_irq.active_high_low & 0x1) << 2);
499 498
500 *buffer = temp8; 499 *buffer = temp8;
501 buffer += 1; 500 buffer += 1;
502 501
503 /* Set the Interrupt table length */ 502 /* Set the Interrupt table length */
504 503
505 temp8 = (u8) linked_list->data.extended_irq.number_of_interrupts; 504 temp8 = (u8) resource->data.extended_irq.number_of_interrupts;
506 505
507 *buffer = temp8; 506 *buffer = temp8;
508 buffer += 1; 507 buffer += 1;
509 508
510 for (index = 0; 509 for (index = 0;
511 index < linked_list->data.extended_irq.number_of_interrupts; 510 index < resource->data.extended_irq.number_of_interrupts;
512 index++) { 511 index++) {
513 ACPI_MOVE_32_TO_32(buffer, 512 ACPI_MOVE_32_TO_32(buffer,
514 &linked_list->data.extended_irq. 513 &resource->data.extended_irq.
515 interrupts[index]); 514 interrupts[index]);
516 buffer += 4; 515 buffer += 4;
517 } 516 }
518 517
519 /* Resource Source Index and Resource Source are optional */ 518 /* Resource Source Index and Resource Source are optional */
520 519
521 if (0 != linked_list->data.extended_irq.resource_source.string_length) { 520 if (0 != resource->data.extended_irq.resource_source.string_length) {
522 *buffer = 521 *buffer =
523 (u8) linked_list->data.extended_irq.resource_source.index; 522 (u8) resource->data.extended_irq.resource_source.index;
524 buffer += 1; 523 buffer += 1;
525 524
526 /* Copy the string */ 525 /* Copy the string */
527 526
528 ACPI_STRCPY((char *)buffer, 527 ACPI_STRCPY((char *)buffer,
529 linked_list->data.extended_irq.resource_source. 528 resource->data.extended_irq.resource_source.
530 string_ptr); 529 string_ptr);
531 530
532 /* 531 /*
@@ -535,8 +534,8 @@ acpi_rs_extended_irq_stream(struct acpi_resource *linked_list,
535 */ 534 */
536 buffer += 535 buffer +=
537 (acpi_size) (ACPI_STRLEN 536 (acpi_size) (ACPI_STRLEN
538 (linked_list->data.extended_irq. 537 (resource->data.extended_irq.resource_source.
539 resource_source.string_ptr) + 1); 538 string_ptr) + 1);
540 } 539 }
541 540
542 /* Return the number of bytes consumed in this operation */ 541 /* Return the number of bytes consumed in this operation */