aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/pci_link.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/pci_link.c')
-rw-r--r--drivers/acpi/pci_link.c100
1 files changed, 51 insertions, 49 deletions
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index 78927c0f1551..07bc6dfe662b 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];
@@ -108,19 +108,19 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context)
108 108
109 ACPI_FUNCTION_TRACE("acpi_pci_link_check_possible"); 109 ACPI_FUNCTION_TRACE("acpi_pci_link_check_possible");
110 110
111 switch (resource->id) { 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:
@@ -201,11 +201,11 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context)
201 201
202 ACPI_FUNCTION_TRACE("acpi_pci_link_check_current"); 202 ACPI_FUNCTION_TRACE("acpi_pci_link_check_current");
203 203
204 switch (resource->id) { 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
@@ -233,8 +233,10 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context)
233 *irq = p->interrupts[0]; 233 *irq = p->interrupts[0];
234 break; 234 break;
235 } 235 }
236 break;
236 default: 237 default:
237 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Resource isn't an IRQ\n")); 238 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Resource %d isn't an IRQ\n", resource->type));
239 case ACPI_RESOURCE_TYPE_END_TAG:
238 return_ACPI_STATUS(AE_OK); 240 return_ACPI_STATUS(AE_OK);
239 } 241 }
240 return_ACPI_STATUS(AE_CTRL_TERMINATE); 242 return_ACPI_STATUS(AE_CTRL_TERMINATE);
@@ -325,36 +327,36 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
325 buffer.pointer = resource; 327 buffer.pointer = resource;
326 328
327 switch (link->irq.resource_type) { 329 switch (link->irq.resource_type) {
328 case ACPI_RSTYPE_IRQ: 330 case ACPI_RESOURCE_TYPE_IRQ:
329 resource->res.id = ACPI_RSTYPE_IRQ; 331 resource->res.type = ACPI_RESOURCE_TYPE_IRQ;
330 resource->res.length = sizeof(struct acpi_resource); 332 resource->res.length = sizeof(struct acpi_resource);
331 resource->res.data.irq.edge_level = link->irq.edge_level; 333 resource->res.data.irq.triggering = link->irq.triggering;
332 resource->res.data.irq.active_high_low = 334 resource->res.data.irq.polarity =
333 link->irq.active_high_low; 335 link->irq.polarity;
334 if (link->irq.edge_level == ACPI_EDGE_SENSITIVE) 336 if (link->irq.triggering == ACPI_EDGE_SENSITIVE)
335 resource->res.data.irq.shared_exclusive = 337 resource->res.data.irq.sharable =
336 ACPI_EXCLUSIVE; 338 ACPI_EXCLUSIVE;
337 else 339 else
338 resource->res.data.irq.shared_exclusive = ACPI_SHARED; 340 resource->res.data.irq.sharable = ACPI_SHARED;
339 resource->res.data.irq.number_of_interrupts = 1; 341 resource->res.data.irq.interrupt_count = 1;
340 resource->res.data.irq.interrupts[0] = irq; 342 resource->res.data.irq.interrupts[0] = irq;
341 break; 343 break;
342 344
343 case ACPI_RSTYPE_EXT_IRQ: 345 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
344 resource->res.id = ACPI_RSTYPE_EXT_IRQ; 346 resource->res.type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ;
345 resource->res.length = sizeof(struct acpi_resource); 347 resource->res.length = sizeof(struct acpi_resource);
346 resource->res.data.extended_irq.producer_consumer = 348 resource->res.data.extended_irq.producer_consumer =
347 ACPI_CONSUMER; 349 ACPI_CONSUMER;
348 resource->res.data.extended_irq.edge_level = 350 resource->res.data.extended_irq.triggering =
349 link->irq.edge_level; 351 link->irq.triggering;
350 resource->res.data.extended_irq.active_high_low = 352 resource->res.data.extended_irq.polarity =
351 link->irq.active_high_low; 353 link->irq.polarity;
352 if (link->irq.edge_level == ACPI_EDGE_SENSITIVE) 354 if (link->irq.triggering == ACPI_EDGE_SENSITIVE)
353 resource->res.data.irq.shared_exclusive = 355 resource->res.data.irq.sharable =
354 ACPI_EXCLUSIVE; 356 ACPI_EXCLUSIVE;
355 else 357 else
356 resource->res.data.irq.shared_exclusive = ACPI_SHARED; 358 resource->res.data.irq.sharable = ACPI_SHARED;
357 resource->res.data.extended_irq.number_of_interrupts = 1; 359 resource->res.data.extended_irq.interrupt_count = 1;
358 resource->res.data.extended_irq.interrupts[0] = irq; 360 resource->res.data.extended_irq.interrupts[0] = irq;
359 /* ignore resource_source, it's optional */ 361 /* ignore resource_source, it's optional */
360 break; 362 break;
@@ -364,7 +366,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
364 goto end; 366 goto end;
365 367
366 } 368 }
367 resource->end.id = ACPI_RSTYPE_END_TAG; 369 resource->end.type = ACPI_RESOURCE_TYPE_END_TAG;
368 370
369 /* Attempt to set the resource */ 371 /* Attempt to set the resource */
370 status = acpi_set_current_resources(link->handle, &buffer); 372 status = acpi_set_current_resources(link->handle, &buffer);
@@ -613,7 +615,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
613int 615int
614acpi_pci_link_allocate_irq(acpi_handle handle, 616acpi_pci_link_allocate_irq(acpi_handle handle,
615 int index, 617 int index,
616 int *edge_level, int *active_high_low, char **name) 618 int *triggering, int *polarity, char **name)
617{ 619{
618 int result = 0; 620 int result = 0;
619 struct acpi_device *device = NULL; 621 struct acpi_device *device = NULL;
@@ -653,10 +655,10 @@ acpi_pci_link_allocate_irq(acpi_handle handle,
653 link->refcnt++; 655 link->refcnt++;
654 up(&acpi_link_lock); 656 up(&acpi_link_lock);
655 657
656 if (edge_level) 658 if (triggering)
657 *edge_level = link->irq.edge_level; 659 *triggering = link->irq.triggering;
658 if (active_high_low) 660 if (polarity)
659 *active_high_low = link->irq.active_high_low; 661 *polarity = link->irq.polarity;
660 if (name) 662 if (name)
661 *name = acpi_device_bid(link->device); 663 *name = acpi_device_bid(link->device);
662 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 664 ACPI_DEBUG_PRINT((ACPI_DB_INFO,