aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/pci_link.c
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2005-09-30 19:03:00 -0400
committerLen Brown <len.brown@intel.com>2005-12-10 00:20:25 -0500
commit50eca3eb89d73d9f0aa070b126c7ee6a616016ab (patch)
treeb2d06d21b34b9bd17eea4c53cff1f3866fa1b21d /drivers/acpi/pci_link.c
parent3d5271f9883cba7b54762bc4fe027d4172f06db7 (diff)
[ACPI] ACPICA 20050930
Completed a major overhaul of the Resource Manager code - specifically, optimizations in the area of the AML/internal resource conversion code. The code has been optimized to simplify and eliminate duplicated code, CPU stack use has been decreased by optimizing function parameters and local variables, and naming conventions across the manager have been standardized for clarity and ease of maintenance (this includes function, parameter, variable, and struct/typedef names.) All Resource Manager dispatch and information tables have been moved to a single location for clarity and ease of maintenance. One new file was created, named "rsinfo.c". The ACPI return macros (return_ACPI_STATUS, etc.) have been modified to guarantee that the argument is not evaluated twice, making them less prone to macro side-effects. However, since there exists the possibility of additional stack use if a particular compiler cannot optimize them (such as in the debug generation case), the original macros are optionally available. Note that some invocations of the return_VALUE macro may now cause size mismatch warnings; the return_UINT8 and return_UINT32 macros are provided to eliminate these. (From Randy Dunlap) Implemented a new mechanism to enable debug tracing for individual control methods. A new external interface, acpi_debug_trace(), is provided to enable this mechanism. The intent is to allow the host OS to easily enable and disable tracing for problematic control methods. This interface can be easily exposed to a user or debugger interface if desired. See the file psxface.c for details. acpi_ut_callocate() will now return a valid pointer if a length of zero is specified - a length of one is used and a warning is issued. This matches the behavior of acpi_ut_allocate(). Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/pci_link.c')
-rw-r--r--drivers/acpi/pci_link.c92
1 files changed, 46 insertions, 46 deletions
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index d8956c0bf143..492170373494 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -70,8 +70,8 @@ static struct acpi_driver acpi_pci_link_driver = {
70 */ 70 */
71struct acpi_pci_link_irq { 71struct acpi_pci_link_irq {
72 u8 active; /* Current IRQ */ 72 u8 active; /* Current IRQ */
73 u8 edge_level; /* All IRQs */ 73 u8 triggering; /* All IRQs */
74 u8 active_high_low; /* All IRQs */ 74 u8 polarity; /* All IRQs */
75 u8 resource_type; 75 u8 resource_type;
76 u8 possible_count; 76 u8 possible_count;
77 u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; 77 u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE];
@@ -109,18 +109,18 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context)
109 ACPI_FUNCTION_TRACE("acpi_pci_link_check_possible"); 109 ACPI_FUNCTION_TRACE("acpi_pci_link_check_possible");
110 110
111 switch (resource->type) { 111 switch (resource->type) {
112 case ACPI_RSTYPE_START_DPF: 112 case ACPI_RESOURCE_TYPE_START_DEPENDENT:
113 return_ACPI_STATUS(AE_OK); 113 return_ACPI_STATUS(AE_OK);
114 case ACPI_RSTYPE_IRQ: 114 case ACPI_RESOURCE_TYPE_IRQ:
115 { 115 {
116 struct acpi_resource_irq *p = &resource->data.irq; 116 struct acpi_resource_irq *p = &resource->data.irq;
117 if (!p || !p->number_of_interrupts) { 117 if (!p || !p->interrupt_count) {
118 ACPI_DEBUG_PRINT((ACPI_DB_WARN, 118 ACPI_DEBUG_PRINT((ACPI_DB_WARN,
119 "Blank IRQ resource\n")); 119 "Blank IRQ resource\n"));
120 return_ACPI_STATUS(AE_OK); 120 return_ACPI_STATUS(AE_OK);
121 } 121 }
122 for (i = 0; 122 for (i = 0;
123 (i < p->number_of_interrupts 123 (i < p->interrupt_count
124 && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { 124 && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) {
125 if (!p->interrupts[i]) { 125 if (!p->interrupts[i]) {
126 ACPI_DEBUG_PRINT((ACPI_DB_WARN, 126 ACPI_DEBUG_PRINT((ACPI_DB_WARN,
@@ -131,22 +131,22 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context)
131 link->irq.possible[i] = p->interrupts[i]; 131 link->irq.possible[i] = p->interrupts[i];
132 link->irq.possible_count++; 132 link->irq.possible_count++;
133 } 133 }
134 link->irq.edge_level = p->edge_level; 134 link->irq.triggering = p->triggering;
135 link->irq.active_high_low = p->active_high_low; 135 link->irq.polarity = p->polarity;
136 link->irq.resource_type = ACPI_RSTYPE_IRQ; 136 link->irq.resource_type = ACPI_RESOURCE_TYPE_IRQ;
137 break; 137 break;
138 } 138 }
139 case ACPI_RSTYPE_EXT_IRQ: 139 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
140 { 140 {
141 struct acpi_resource_ext_irq *p = 141 struct acpi_resource_extended_irq *p =
142 &resource->data.extended_irq; 142 &resource->data.extended_irq;
143 if (!p || !p->number_of_interrupts) { 143 if (!p || !p->interrupt_count) {
144 ACPI_DEBUG_PRINT((ACPI_DB_WARN, 144 ACPI_DEBUG_PRINT((ACPI_DB_WARN,
145 "Blank EXT IRQ resource\n")); 145 "Blank EXT IRQ resource\n"));
146 return_ACPI_STATUS(AE_OK); 146 return_ACPI_STATUS(AE_OK);
147 } 147 }
148 for (i = 0; 148 for (i = 0;
149 (i < p->number_of_interrupts 149 (i < p->interrupt_count
150 && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { 150 && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) {
151 if (!p->interrupts[i]) { 151 if (!p->interrupts[i]) {
152 ACPI_DEBUG_PRINT((ACPI_DB_WARN, 152 ACPI_DEBUG_PRINT((ACPI_DB_WARN,
@@ -157,9 +157,9 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context)
157 link->irq.possible[i] = p->interrupts[i]; 157 link->irq.possible[i] = p->interrupts[i];
158 link->irq.possible_count++; 158 link->irq.possible_count++;
159 } 159 }
160 link->irq.edge_level = p->edge_level; 160 link->irq.triggering = p->triggering;
161 link->irq.active_high_low = p->active_high_low; 161 link->irq.polarity = p->polarity;
162 link->irq.resource_type = ACPI_RSTYPE_EXT_IRQ; 162 link->irq.resource_type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ;
163 break; 163 break;
164 } 164 }
165 default: 165 default:
@@ -202,10 +202,10 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context)
202 ACPI_FUNCTION_TRACE("acpi_pci_link_check_current"); 202 ACPI_FUNCTION_TRACE("acpi_pci_link_check_current");
203 203
204 switch (resource->type) { 204 switch (resource->type) {
205 case ACPI_RSTYPE_IRQ: 205 case ACPI_RESOURCE_TYPE_IRQ:
206 { 206 {
207 struct acpi_resource_irq *p = &resource->data.irq; 207 struct acpi_resource_irq *p = &resource->data.irq;
208 if (!p || !p->number_of_interrupts) { 208 if (!p || !p->interrupt_count) {
209 /* 209 /*
210 * IRQ descriptors may have no IRQ# bits set, 210 * IRQ descriptors may have no IRQ# bits set,
211 * particularly those those w/ _STA disabled 211 * particularly those those w/ _STA disabled
@@ -217,11 +217,11 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context)
217 *irq = p->interrupts[0]; 217 *irq = p->interrupts[0];
218 break; 218 break;
219 } 219 }
220 case ACPI_RSTYPE_EXT_IRQ: 220 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
221 { 221 {
222 struct acpi_resource_ext_irq *p = 222 struct acpi_resource_extended_irq *p =
223 &resource->data.extended_irq; 223 &resource->data.extended_irq;
224 if (!p || !p->number_of_interrupts) { 224 if (!p || !p->interrupt_count) {
225 /* 225 /*
226 * extended IRQ descriptors must 226 * extended IRQ descriptors must
227 * return at least 1 IRQ 227 * return at least 1 IRQ
@@ -325,36 +325,36 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
325 buffer.pointer = resource; 325 buffer.pointer = resource;
326 326
327 switch (link->irq.resource_type) { 327 switch (link->irq.resource_type) {
328 case ACPI_RSTYPE_IRQ: 328 case ACPI_RESOURCE_TYPE_IRQ:
329 resource->res.type = ACPI_RSTYPE_IRQ; 329 resource->res.type = ACPI_RESOURCE_TYPE_IRQ;
330 resource->res.length = sizeof(struct acpi_resource); 330 resource->res.length = sizeof(struct acpi_resource);
331 resource->res.data.irq.edge_level = link->irq.edge_level; 331 resource->res.data.irq.triggering = link->irq.triggering;
332 resource->res.data.irq.active_high_low = 332 resource->res.data.irq.polarity =
333 link->irq.active_high_low; 333 link->irq.polarity;
334 if (link->irq.edge_level == ACPI_EDGE_SENSITIVE) 334 if (link->irq.triggering == ACPI_EDGE_SENSITIVE)
335 resource->res.data.irq.shared_exclusive = 335 resource->res.data.irq.sharable =
336 ACPI_EXCLUSIVE; 336 ACPI_EXCLUSIVE;
337 else 337 else
338 resource->res.data.irq.shared_exclusive = ACPI_SHARED; 338 resource->res.data.irq.sharable = ACPI_SHARED;
339 resource->res.data.irq.number_of_interrupts = 1; 339 resource->res.data.irq.interrupt_count = 1;
340 resource->res.data.irq.interrupts[0] = irq; 340 resource->res.data.irq.interrupts[0] = irq;
341 break; 341 break;
342 342
343 case ACPI_RSTYPE_EXT_IRQ: 343 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
344 resource->res.type = ACPI_RSTYPE_EXT_IRQ; 344 resource->res.type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ;
345 resource->res.length = sizeof(struct acpi_resource); 345 resource->res.length = sizeof(struct acpi_resource);
346 resource->res.data.extended_irq.producer_consumer = 346 resource->res.data.extended_irq.producer_consumer =
347 ACPI_CONSUMER; 347 ACPI_CONSUMER;
348 resource->res.data.extended_irq.edge_level = 348 resource->res.data.extended_irq.triggering =
349 link->irq.edge_level; 349 link->irq.triggering;
350 resource->res.data.extended_irq.active_high_low = 350 resource->res.data.extended_irq.polarity =
351 link->irq.active_high_low; 351 link->irq.polarity;
352 if (link->irq.edge_level == ACPI_EDGE_SENSITIVE) 352 if (link->irq.triggering == ACPI_EDGE_SENSITIVE)
353 resource->res.data.irq.shared_exclusive = 353 resource->res.data.irq.sharable =
354 ACPI_EXCLUSIVE; 354 ACPI_EXCLUSIVE;
355 else 355 else
356 resource->res.data.irq.shared_exclusive = ACPI_SHARED; 356 resource->res.data.irq.sharable = ACPI_SHARED;
357 resource->res.data.extended_irq.number_of_interrupts = 1; 357 resource->res.data.extended_irq.interrupt_count = 1;
358 resource->res.data.extended_irq.interrupts[0] = irq; 358 resource->res.data.extended_irq.interrupts[0] = irq;
359 /* ignore resource_source, it's optional */ 359 /* ignore resource_source, it's optional */
360 break; 360 break;
@@ -364,7 +364,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
364 goto end; 364 goto end;
365 365
366 } 366 }
367 resource->end.type = ACPI_RSTYPE_END_TAG; 367 resource->end.type = ACPI_RESOURCE_TYPE_END_TAG;
368 368
369 /* Attempt to set the resource */ 369 /* Attempt to set the resource */
370 status = acpi_set_current_resources(link->handle, &buffer); 370 status = acpi_set_current_resources(link->handle, &buffer);
@@ -613,7 +613,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
613int 613int
614acpi_pci_link_allocate_irq(acpi_handle handle, 614acpi_pci_link_allocate_irq(acpi_handle handle,
615 int index, 615 int index,
616 int *edge_level, int *active_high_low, char **name) 616 int *triggering, int *polarity, char **name)
617{ 617{
618 int result = 0; 618 int result = 0;
619 struct acpi_device *device = NULL; 619 struct acpi_device *device = NULL;
@@ -653,10 +653,10 @@ acpi_pci_link_allocate_irq(acpi_handle handle,
653 link->refcnt++; 653 link->refcnt++;
654 up(&acpi_link_lock); 654 up(&acpi_link_lock);
655 655
656 if (edge_level) 656 if (triggering)
657 *edge_level = link->irq.edge_level; 657 *triggering = link->irq.triggering;
658 if (active_high_low) 658 if (polarity)
659 *active_high_low = link->irq.active_high_low; 659 *polarity = link->irq.polarity;
660 if (name) 660 if (name)
661 *name = acpi_device_bid(link->device); 661 *name = acpi_device_bid(link->device);
662 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 662 ACPI_DEBUG_PRINT((ACPI_DB_INFO,