Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * pci_link.c - ACPI PCI Interrupt Link Device Driver ($Revision: 34 $) | |
3 | * | |
4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> | |
5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | |
6 | * Copyright (C) 2002 Dominik Brodowski <devel@brodo.de> | |
b5bd0269 | 7 | * Copyright (c) 2015, The Linux Foundation. All rights reserved. |
1da177e4 LT |
8 | * |
9 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
10 | * | |
11 | * This program is free software; you can redistribute it and/or modify | |
12 | * it under the terms of the GNU General Public License as published by | |
13 | * the Free Software Foundation; either version 2 of the License, or (at | |
14 | * your option) any later version. | |
15 | * | |
16 | * This program is distributed in the hope that it will be useful, but | |
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
19 | * General Public License for more details. | |
20 | * | |
1da177e4 LT |
21 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
22 | * | |
23 | * TBD: | |
24 | * 1. Support more than one IRQ resource entry per link device (index). | |
25 | * 2. Implement start/stop mechanism and use ACPI Bus Driver facilities | |
26 | * for IRQ management (e.g. start()->_SRS). | |
27 | */ | |
28 | ||
c3146df2 | 29 | #include <linux/syscore_ops.h> |
1da177e4 LT |
30 | #include <linux/kernel.h> |
31 | #include <linux/module.h> | |
32 | #include <linux/init.h> | |
33 | #include <linux/types.h> | |
1da177e4 LT |
34 | #include <linux/spinlock.h> |
35 | #include <linux/pm.h> | |
36 | #include <linux/pci.h> | |
36e43095 | 37 | #include <linux/mutex.h> |
5a0e3ad6 | 38 | #include <linux/slab.h> |
8b48463f | 39 | #include <linux/acpi.h> |
1da177e4 | 40 | |
c071b604 R |
41 | #include "internal.h" |
42 | ||
1c9ca3a7 | 43 | #define _COMPONENT ACPI_PCI_COMPONENT |
f52fd66d | 44 | ACPI_MODULE_NAME("pci_link"); |
1da177e4 | 45 | #define ACPI_PCI_LINK_CLASS "pci_irq_routing" |
1da177e4 LT |
46 | #define ACPI_PCI_LINK_DEVICE_NAME "PCI Interrupt Link" |
47 | #define ACPI_PCI_LINK_FILE_INFO "info" | |
48 | #define ACPI_PCI_LINK_FILE_STATUS "state" | |
1c9ca3a7 BH |
49 | #define ACPI_PCI_LINK_MAX_POSSIBLE 16 |
50 | ||
4daeaf68 RW |
51 | static int acpi_pci_link_add(struct acpi_device *device, |
52 | const struct acpi_device_id *not_used); | |
53 | static void acpi_pci_link_remove(struct acpi_device *device); | |
1da177e4 | 54 | |
c97adf9e | 55 | static const struct acpi_device_id link_device_ids[] = { |
1ba90e3a TR |
56 | {"PNP0C0F", 0}, |
57 | {"", 0}, | |
58 | }; | |
1ba90e3a | 59 | |
4daeaf68 | 60 | static struct acpi_scan_handler pci_link_handler = { |
1ba90e3a | 61 | .ids = link_device_ids, |
4daeaf68 RW |
62 | .attach = acpi_pci_link_add, |
63 | .detach = acpi_pci_link_remove, | |
1da177e4 LT |
64 | }; |
65 | ||
87bec66b DSL |
66 | /* |
67 | * If a link is initialized, we never change its active and initialized | |
68 | * later even the link is disable. Instead, we just repick the active irq | |
69 | */ | |
1da177e4 | 70 | struct acpi_pci_link_irq { |
4be44fcd | 71 | u8 active; /* Current IRQ */ |
50eca3eb | 72 | u8 triggering; /* All IRQs */ |
1c9ca3a7 | 73 | u8 polarity; /* All IRQs */ |
4be44fcd LB |
74 | u8 resource_type; |
75 | u8 possible_count; | |
76 | u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; | |
77 | u8 initialized:1; | |
78 | u8 reserved:7; | |
1da177e4 LT |
79 | }; |
80 | ||
81 | struct acpi_pci_link { | |
5f0dccaa | 82 | struct list_head list; |
1c9ca3a7 BH |
83 | struct acpi_device *device; |
84 | struct acpi_pci_link_irq irq; | |
85 | int refcnt; | |
1da177e4 LT |
86 | }; |
87 | ||
5f0dccaa | 88 | static LIST_HEAD(acpi_link_list); |
e5685b9d | 89 | static DEFINE_MUTEX(acpi_link_lock); |
1da177e4 | 90 | |
1da177e4 LT |
91 | /* -------------------------------------------------------------------------- |
92 | PCI Link Device Management | |
93 | -------------------------------------------------------------------------- */ | |
94 | ||
95 | /* | |
96 | * set context (link) possible list from resource list | |
97 | */ | |
1c9ca3a7 BH |
98 | static acpi_status acpi_pci_link_check_possible(struct acpi_resource *resource, |
99 | void *context) | |
1da177e4 | 100 | { |
50dd0969 | 101 | struct acpi_pci_link *link = context; |
c9d62443 | 102 | u32 i; |
1da177e4 | 103 | |
eca008c8 | 104 | switch (resource->type) { |
50eca3eb | 105 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: |
4a5e3638 | 106 | case ACPI_RESOURCE_TYPE_END_TAG: |
d550d98d | 107 | return AE_OK; |
50eca3eb | 108 | case ACPI_RESOURCE_TYPE_IRQ: |
4be44fcd LB |
109 | { |
110 | struct acpi_resource_irq *p = &resource->data.irq; | |
50eca3eb | 111 | if (!p || !p->interrupt_count) { |
4a5e3638 BH |
112 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
113 | "Blank _PRS IRQ resource\n")); | |
d550d98d | 114 | return AE_OK; |
1da177e4 | 115 | } |
4be44fcd | 116 | for (i = 0; |
50eca3eb | 117 | (i < p->interrupt_count |
4be44fcd LB |
118 | && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { |
119 | if (!p->interrupts[i]) { | |
4a5e3638 BH |
120 | printk(KERN_WARNING PREFIX |
121 | "Invalid _PRS IRQ %d\n", | |
122 | p->interrupts[i]); | |
4be44fcd LB |
123 | continue; |
124 | } | |
125 | link->irq.possible[i] = p->interrupts[i]; | |
126 | link->irq.possible_count++; | |
127 | } | |
50eca3eb BM |
128 | link->irq.triggering = p->triggering; |
129 | link->irq.polarity = p->polarity; | |
130 | link->irq.resource_type = ACPI_RESOURCE_TYPE_IRQ; | |
4be44fcd | 131 | break; |
1da177e4 | 132 | } |
50eca3eb | 133 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
4be44fcd | 134 | { |
50eca3eb | 135 | struct acpi_resource_extended_irq *p = |
4be44fcd | 136 | &resource->data.extended_irq; |
50eca3eb | 137 | if (!p || !p->interrupt_count) { |
cece9296 | 138 | printk(KERN_WARNING PREFIX |
4a5e3638 | 139 | "Blank _PRS EXT IRQ resource\n"); |
d550d98d | 140 | return AE_OK; |
4be44fcd LB |
141 | } |
142 | for (i = 0; | |
50eca3eb | 143 | (i < p->interrupt_count |
4be44fcd LB |
144 | && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { |
145 | if (!p->interrupts[i]) { | |
4a5e3638 BH |
146 | printk(KERN_WARNING PREFIX |
147 | "Invalid _PRS IRQ %d\n", | |
148 | p->interrupts[i]); | |
4be44fcd LB |
149 | continue; |
150 | } | |
151 | link->irq.possible[i] = p->interrupts[i]; | |
152 | link->irq.possible_count++; | |
1da177e4 | 153 | } |
50eca3eb BM |
154 | link->irq.triggering = p->triggering; |
155 | link->irq.polarity = p->polarity; | |
156 | link->irq.resource_type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; | |
4be44fcd | 157 | break; |
1da177e4 | 158 | } |
1da177e4 | 159 | default: |
4a5e3638 BH |
160 | printk(KERN_ERR PREFIX "_PRS resource type 0x%x isn't an IRQ\n", |
161 | resource->type); | |
d550d98d | 162 | return AE_OK; |
1da177e4 LT |
163 | } |
164 | ||
d550d98d | 165 | return AE_CTRL_TERMINATE; |
1da177e4 LT |
166 | } |
167 | ||
4be44fcd | 168 | static int acpi_pci_link_get_possible(struct acpi_pci_link *link) |
1da177e4 | 169 | { |
4be44fcd | 170 | acpi_status status; |
1da177e4 | 171 | |
67a71365 | 172 | status = acpi_walk_resources(link->device->handle, METHOD_NAME__PRS, |
4be44fcd | 173 | acpi_pci_link_check_possible, link); |
1da177e4 | 174 | if (ACPI_FAILURE(status)) { |
a6fc6720 | 175 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRS")); |
d550d98d | 176 | return -ENODEV; |
1da177e4 LT |
177 | } |
178 | ||
4be44fcd LB |
179 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
180 | "Found %d possible IRQs\n", | |
181 | link->irq.possible_count)); | |
1da177e4 | 182 | |
d550d98d | 183 | return 0; |
1da177e4 LT |
184 | } |
185 | ||
1c9ca3a7 BH |
186 | static acpi_status acpi_pci_link_check_current(struct acpi_resource *resource, |
187 | void *context) | |
1da177e4 | 188 | { |
c9d62443 | 189 | int *irq = context; |
1da177e4 | 190 | |
eca008c8 | 191 | switch (resource->type) { |
4a5e3638 BH |
192 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: |
193 | case ACPI_RESOURCE_TYPE_END_TAG: | |
194 | return AE_OK; | |
50eca3eb | 195 | case ACPI_RESOURCE_TYPE_IRQ: |
4be44fcd LB |
196 | { |
197 | struct acpi_resource_irq *p = &resource->data.irq; | |
50eca3eb | 198 | if (!p || !p->interrupt_count) { |
4be44fcd LB |
199 | /* |
200 | * IRQ descriptors may have no IRQ# bits set, | |
201 | * particularly those those w/ _STA disabled | |
202 | */ | |
203 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | |
4a5e3638 | 204 | "Blank _CRS IRQ resource\n")); |
d550d98d | 205 | return AE_OK; |
4be44fcd LB |
206 | } |
207 | *irq = p->interrupts[0]; | |
208 | break; | |
1da177e4 | 209 | } |
50eca3eb | 210 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
4be44fcd | 211 | { |
50eca3eb | 212 | struct acpi_resource_extended_irq *p = |
4be44fcd | 213 | &resource->data.extended_irq; |
50eca3eb | 214 | if (!p || !p->interrupt_count) { |
4be44fcd LB |
215 | /* |
216 | * extended IRQ descriptors must | |
217 | * return at least 1 IRQ | |
218 | */ | |
cece9296 | 219 | printk(KERN_WARNING PREFIX |
4a5e3638 | 220 | "Blank _CRS EXT IRQ resource\n"); |
d550d98d | 221 | return AE_OK; |
4be44fcd LB |
222 | } |
223 | *irq = p->interrupts[0]; | |
224 | break; | |
1da177e4 | 225 | } |
d4ec6c7c | 226 | break; |
1da177e4 | 227 | default: |
4a5e3638 BH |
228 | printk(KERN_ERR PREFIX "_CRS resource type 0x%x isn't an IRQ\n", |
229 | resource->type); | |
d550d98d | 230 | return AE_OK; |
1da177e4 | 231 | } |
4a5e3638 | 232 | |
d550d98d | 233 | return AE_CTRL_TERMINATE; |
1da177e4 LT |
234 | } |
235 | ||
236 | /* | |
237 | * Run _CRS and set link->irq.active | |
238 | * | |
239 | * return value: | |
240 | * 0 - success | |
241 | * !0 - failure | |
242 | */ | |
4be44fcd | 243 | static int acpi_pci_link_get_current(struct acpi_pci_link *link) |
1da177e4 | 244 | { |
4be44fcd | 245 | int result = 0; |
c9d62443 | 246 | acpi_status status; |
4be44fcd | 247 | int irq = 0; |
1da177e4 | 248 | |
1da177e4 LT |
249 | link->irq.active = 0; |
250 | ||
251 | /* in practice, status disabled is meaningless, ignore it */ | |
252 | if (acpi_strict) { | |
253 | /* Query _STA, set link->device->status */ | |
254 | result = acpi_bus_get_status(link->device); | |
255 | if (result) { | |
6468463a | 256 | printk(KERN_ERR PREFIX "Unable to read status\n"); |
1da177e4 LT |
257 | goto end; |
258 | } | |
259 | ||
260 | if (!link->device->status.enabled) { | |
261 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link disabled\n")); | |
d550d98d | 262 | return 0; |
1da177e4 LT |
263 | } |
264 | } | |
265 | ||
266 | /* | |
267 | * Query and parse _CRS to get the current IRQ assignment. | |
268 | */ | |
269 | ||
67a71365 | 270 | status = acpi_walk_resources(link->device->handle, METHOD_NAME__CRS, |
4be44fcd | 271 | acpi_pci_link_check_current, &irq); |
1da177e4 | 272 | if (ACPI_FAILURE(status)) { |
a6fc6720 | 273 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _CRS")); |
1da177e4 LT |
274 | result = -ENODEV; |
275 | goto end; | |
276 | } | |
277 | ||
278 | if (acpi_strict && !irq) { | |
6468463a | 279 | printk(KERN_ERR PREFIX "_CRS returned 0\n"); |
1da177e4 LT |
280 | result = -ENODEV; |
281 | } | |
282 | ||
283 | link->irq.active = irq; | |
284 | ||
285 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link at IRQ %d \n", link->irq.active)); | |
286 | ||
4be44fcd | 287 | end: |
d550d98d | 288 | return result; |
1da177e4 LT |
289 | } |
290 | ||
4be44fcd | 291 | static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) |
1da177e4 | 292 | { |
c9d62443 BH |
293 | int result; |
294 | acpi_status status; | |
1da177e4 | 295 | struct { |
4be44fcd LB |
296 | struct acpi_resource res; |
297 | struct acpi_resource end; | |
298 | } *resource; | |
299 | struct acpi_buffer buffer = { 0, NULL }; | |
1da177e4 | 300 | |
6eca4b4c | 301 | if (!irq) |
d550d98d | 302 | return -EINVAL; |
1da177e4 | 303 | |
36bcbec7 | 304 | resource = kzalloc(sizeof(*resource) + 1, irqs_disabled() ? GFP_ATOMIC: GFP_KERNEL); |
4be44fcd | 305 | if (!resource) |
d550d98d | 306 | return -ENOMEM; |
1da177e4 | 307 | |
4be44fcd | 308 | buffer.length = sizeof(*resource) + 1; |
1da177e4 LT |
309 | buffer.pointer = resource; |
310 | ||
4be44fcd | 311 | switch (link->irq.resource_type) { |
50eca3eb BM |
312 | case ACPI_RESOURCE_TYPE_IRQ: |
313 | resource->res.type = ACPI_RESOURCE_TYPE_IRQ; | |
1da177e4 | 314 | resource->res.length = sizeof(struct acpi_resource); |
50eca3eb BM |
315 | resource->res.data.irq.triggering = link->irq.triggering; |
316 | resource->res.data.irq.polarity = | |
317 | link->irq.polarity; | |
318 | if (link->irq.triggering == ACPI_EDGE_SENSITIVE) | |
319 | resource->res.data.irq.sharable = | |
4be44fcd | 320 | ACPI_EXCLUSIVE; |
1da177e4 | 321 | else |
50eca3eb BM |
322 | resource->res.data.irq.sharable = ACPI_SHARED; |
323 | resource->res.data.irq.interrupt_count = 1; | |
1da177e4 LT |
324 | resource->res.data.irq.interrupts[0] = irq; |
325 | break; | |
4be44fcd | 326 | |
50eca3eb BM |
327 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
328 | resource->res.type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; | |
1da177e4 | 329 | resource->res.length = sizeof(struct acpi_resource); |
4be44fcd LB |
330 | resource->res.data.extended_irq.producer_consumer = |
331 | ACPI_CONSUMER; | |
50eca3eb BM |
332 | resource->res.data.extended_irq.triggering = |
333 | link->irq.triggering; | |
334 | resource->res.data.extended_irq.polarity = | |
335 | link->irq.polarity; | |
336 | if (link->irq.triggering == ACPI_EDGE_SENSITIVE) | |
337 | resource->res.data.irq.sharable = | |
4be44fcd | 338 | ACPI_EXCLUSIVE; |
1da177e4 | 339 | else |
50eca3eb BM |
340 | resource->res.data.irq.sharable = ACPI_SHARED; |
341 | resource->res.data.extended_irq.interrupt_count = 1; | |
1da177e4 LT |
342 | resource->res.data.extended_irq.interrupts[0] = irq; |
343 | /* ignore resource_source, it's optional */ | |
344 | break; | |
345 | default: | |
6468463a | 346 | printk(KERN_ERR PREFIX "Invalid Resource_type %d\n", link->irq.resource_type); |
1da177e4 LT |
347 | result = -EINVAL; |
348 | goto end; | |
349 | ||
350 | } | |
50eca3eb | 351 | resource->end.type = ACPI_RESOURCE_TYPE_END_TAG; |
f084dbb9 | 352 | resource->end.length = sizeof(struct acpi_resource); |
1da177e4 LT |
353 | |
354 | /* Attempt to set the resource */ | |
67a71365 | 355 | status = acpi_set_current_resources(link->device->handle, &buffer); |
1da177e4 LT |
356 | |
357 | /* check for total failure */ | |
358 | if (ACPI_FAILURE(status)) { | |
a6fc6720 | 359 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _SRS")); |
1da177e4 LT |
360 | result = -ENODEV; |
361 | goto end; | |
362 | } | |
363 | ||
364 | /* Query _STA, set device->status */ | |
365 | result = acpi_bus_get_status(link->device); | |
366 | if (result) { | |
6468463a | 367 | printk(KERN_ERR PREFIX "Unable to read status\n"); |
1da177e4 LT |
368 | goto end; |
369 | } | |
370 | if (!link->device->status.enabled) { | |
cece9296 LB |
371 | printk(KERN_WARNING PREFIX |
372 | "%s [%s] disabled and referenced, BIOS bug\n", | |
a6fc6720 | 373 | acpi_device_name(link->device), |
cece9296 | 374 | acpi_device_bid(link->device)); |
1da177e4 LT |
375 | } |
376 | ||
377 | /* Query _CRS, set link->irq.active */ | |
378 | result = acpi_pci_link_get_current(link); | |
379 | if (result) { | |
380 | goto end; | |
381 | } | |
382 | ||
383 | /* | |
384 | * Is current setting not what we set? | |
385 | * set link->irq.active | |
386 | */ | |
387 | if (link->irq.active != irq) { | |
388 | /* | |
389 | * policy: when _CRS doesn't return what we just _SRS | |
390 | * assume _SRS worked and override _CRS value. | |
391 | */ | |
cece9296 LB |
392 | printk(KERN_WARNING PREFIX |
393 | "%s [%s] BIOS reported IRQ %d, using IRQ %d\n", | |
a6fc6720 | 394 | acpi_device_name(link->device), |
cece9296 | 395 | acpi_device_bid(link->device), link->irq.active, irq); |
1da177e4 LT |
396 | link->irq.active = irq; |
397 | } | |
398 | ||
399 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Set IRQ %d\n", link->irq.active)); | |
4be44fcd LB |
400 | |
401 | end: | |
1da177e4 | 402 | kfree(resource); |
d550d98d | 403 | return result; |
1da177e4 LT |
404 | } |
405 | ||
1da177e4 LT |
406 | /* -------------------------------------------------------------------------- |
407 | PCI Link IRQ Management | |
408 | -------------------------------------------------------------------------- */ | |
409 | ||
410 | /* | |
411 | * "acpi_irq_balance" (default in APIC mode) enables ACPI to use PIC Interrupt | |
412 | * Link Devices to move the PIRQs around to minimize sharing. | |
413 | * | |
414 | * "acpi_irq_nobalance" (default in PIC mode) tells ACPI not to move any PIC IRQs | |
415 | * that the BIOS has already set to active. This is necessary because | |
416 | * ACPI has no automatic means of knowing what ISA IRQs are used. Note that | |
417 | * if the BIOS doesn't set a Link Device active, ACPI needs to program it | |
418 | * even if acpi_irq_nobalance is set. | |
419 | * | |
420 | * A tables of penalties avoids directing PCI interrupts to well known | |
421 | * ISA IRQs. Boot params are available to over-ride the default table: | |
422 | * | |
423 | * List interrupts that are free for PCI use. | |
424 | * acpi_irq_pci=n[,m] | |
425 | * | |
426 | * List interrupts that should not be used for PCI: | |
427 | * acpi_irq_isa=n[,m] | |
428 | * | |
429 | * Note that PCI IRQ routers have a list of possible IRQs, | |
430 | * which may not include the IRQs this table says are available. | |
431 | * | |
432 | * Since this heuristic can't tell the difference between a link | |
433 | * that no device will attach to, vs. a link which may be shared | |
434 | * by multiple active devices -- it is not optimal. | |
435 | * | |
436 | * If interrupt performance is that important, get an IO-APIC system | |
437 | * with a pin dedicated to each device. Or for that matter, an MSI | |
438 | * enabled system. | |
439 | */ | |
440 | ||
1da177e4 LT |
441 | #define ACPI_MAX_ISA_IRQ 16 |
442 | ||
443 | #define PIRQ_PENALTY_PCI_AVAILABLE (0) | |
444 | #define PIRQ_PENALTY_PCI_POSSIBLE (16*16) | |
445 | #define PIRQ_PENALTY_PCI_USING (16*16*16) | |
446 | #define PIRQ_PENALTY_ISA_TYPICAL (16*16*16*16) | |
447 | #define PIRQ_PENALTY_ISA_USED (16*16*16*16*16) | |
448 | #define PIRQ_PENALTY_ISA_ALWAYS (16*16*16*16*16*16) | |
449 | ||
b5bd0269 | 450 | static int acpi_irq_isa_penalty[ACPI_MAX_ISA_IRQ] = { |
1da177e4 LT |
451 | PIRQ_PENALTY_ISA_ALWAYS, /* IRQ0 timer */ |
452 | PIRQ_PENALTY_ISA_ALWAYS, /* IRQ1 keyboard */ | |
453 | PIRQ_PENALTY_ISA_ALWAYS, /* IRQ2 cascade */ | |
4be44fcd LB |
454 | PIRQ_PENALTY_ISA_TYPICAL, /* IRQ3 serial */ |
455 | PIRQ_PENALTY_ISA_TYPICAL, /* IRQ4 serial */ | |
1da177e4 LT |
456 | PIRQ_PENALTY_ISA_TYPICAL, /* IRQ5 sometimes SoundBlaster */ |
457 | PIRQ_PENALTY_ISA_TYPICAL, /* IRQ6 */ | |
458 | PIRQ_PENALTY_ISA_TYPICAL, /* IRQ7 parallel, spurious */ | |
459 | PIRQ_PENALTY_ISA_TYPICAL, /* IRQ8 rtc, sometimes */ | |
460 | PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ9 PCI, often acpi */ | |
461 | PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ10 PCI */ | |
462 | PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ11 PCI */ | |
1c9ca3a7 BH |
463 | PIRQ_PENALTY_ISA_USED, /* IRQ12 mouse */ |
464 | PIRQ_PENALTY_ISA_USED, /* IRQ13 fpe, sometimes */ | |
465 | PIRQ_PENALTY_ISA_USED, /* IRQ14 ide0 */ | |
466 | PIRQ_PENALTY_ISA_USED, /* IRQ15 ide1 */ | |
1da177e4 LT |
467 | }; |
468 | ||
b5bd0269 SK |
469 | struct irq_penalty_info { |
470 | int irq; | |
471 | int penalty; | |
472 | struct list_head node; | |
473 | }; | |
474 | ||
475 | static LIST_HEAD(acpi_irq_penalty_list); | |
476 | ||
477 | static int acpi_irq_get_penalty(int irq) | |
478 | { | |
479 | struct irq_penalty_info *irq_info; | |
480 | ||
481 | if (irq < ACPI_MAX_ISA_IRQ) | |
482 | return acpi_irq_isa_penalty[irq]; | |
483 | ||
484 | list_for_each_entry(irq_info, &acpi_irq_penalty_list, node) { | |
485 | if (irq_info->irq == irq) | |
486 | return irq_info->penalty; | |
487 | } | |
488 | ||
489 | return 0; | |
490 | } | |
491 | ||
492 | static int acpi_irq_set_penalty(int irq, int new_penalty) | |
493 | { | |
494 | struct irq_penalty_info *irq_info; | |
495 | ||
496 | /* see if this is a ISA IRQ */ | |
497 | if (irq < ACPI_MAX_ISA_IRQ) { | |
498 | acpi_irq_isa_penalty[irq] = new_penalty; | |
499 | return 0; | |
500 | } | |
501 | ||
502 | /* next, try to locate from the dynamic list */ | |
503 | list_for_each_entry(irq_info, &acpi_irq_penalty_list, node) { | |
504 | if (irq_info->irq == irq) { | |
505 | irq_info->penalty = new_penalty; | |
506 | return 0; | |
507 | } | |
508 | } | |
509 | ||
510 | /* nope, let's allocate a slot for this IRQ */ | |
511 | irq_info = kzalloc(sizeof(*irq_info), GFP_KERNEL); | |
512 | if (!irq_info) | |
513 | return -ENOMEM; | |
514 | ||
515 | irq_info->irq = irq; | |
516 | irq_info->penalty = new_penalty; | |
517 | list_add_tail(&irq_info->node, &acpi_irq_penalty_list); | |
518 | ||
519 | return 0; | |
520 | } | |
521 | ||
522 | static void acpi_irq_add_penalty(int irq, int penalty) | |
523 | { | |
524 | int curpen = acpi_irq_get_penalty(irq); | |
525 | ||
526 | acpi_irq_set_penalty(irq, curpen + penalty); | |
527 | } | |
528 | ||
4be44fcd | 529 | int __init acpi_irq_penalty_init(void) |
1da177e4 | 530 | { |
c9d62443 BH |
531 | struct acpi_pci_link *link; |
532 | int i; | |
1da177e4 | 533 | |
1da177e4 LT |
534 | /* |
535 | * Update penalties to facilitate IRQ balancing. | |
536 | */ | |
5f0dccaa | 537 | list_for_each_entry(link, &acpi_link_list, list) { |
1da177e4 LT |
538 | |
539 | /* | |
540 | * reflect the possible and active irqs in the penalty table -- | |
541 | * useful for breaking ties. | |
542 | */ | |
543 | if (link->irq.possible_count) { | |
4be44fcd LB |
544 | int penalty = |
545 | PIRQ_PENALTY_PCI_POSSIBLE / | |
546 | link->irq.possible_count; | |
1da177e4 LT |
547 | |
548 | for (i = 0; i < link->irq.possible_count; i++) { | |
b5bd0269 SK |
549 | if (link->irq.possible[i] < ACPI_MAX_ISA_IRQ) { |
550 | int irqpos = link->irq.possible[i]; | |
551 | ||
552 | acpi_irq_add_penalty(irqpos, penalty); | |
553 | } | |
1da177e4 LT |
554 | } |
555 | ||
556 | } else if (link->irq.active) { | |
b5bd0269 SK |
557 | acpi_irq_add_penalty(link->irq.active, |
558 | PIRQ_PENALTY_PCI_POSSIBLE); | |
1da177e4 LT |
559 | } |
560 | } | |
d323efc7 | 561 | |
d550d98d | 562 | return 0; |
1da177e4 LT |
563 | } |
564 | ||
32836259 | 565 | static int acpi_irq_balance = -1; /* 0: static, 1: balance */ |
1da177e4 | 566 | |
4be44fcd | 567 | static int acpi_pci_link_allocate(struct acpi_pci_link *link) |
1da177e4 | 568 | { |
4be44fcd LB |
569 | int irq; |
570 | int i; | |
1da177e4 | 571 | |
87bec66b DSL |
572 | if (link->irq.initialized) { |
573 | if (link->refcnt == 0) | |
574 | /* This means the link is disabled but initialized */ | |
575 | acpi_pci_link_set(link, link->irq.active); | |
d550d98d | 576 | return 0; |
87bec66b | 577 | } |
1da177e4 LT |
578 | |
579 | /* | |
580 | * search for active IRQ in list of possible IRQs. | |
581 | */ | |
582 | for (i = 0; i < link->irq.possible_count; ++i) { | |
583 | if (link->irq.active == link->irq.possible[i]) | |
584 | break; | |
585 | } | |
586 | /* | |
587 | * forget active IRQ that is not in possible list | |
588 | */ | |
589 | if (i == link->irq.possible_count) { | |
590 | if (acpi_strict) | |
cece9296 LB |
591 | printk(KERN_WARNING PREFIX "_CRS %d not found" |
592 | " in _PRS\n", link->irq.active); | |
1da177e4 LT |
593 | link->irq.active = 0; |
594 | } | |
595 | ||
596 | /* | |
597 | * if active found, use it; else pick entry from end of possible list. | |
598 | */ | |
1c9ca3a7 | 599 | if (link->irq.active) |
1da177e4 | 600 | irq = link->irq.active; |
1c9ca3a7 | 601 | else |
1da177e4 | 602 | irq = link->irq.possible[link->irq.possible_count - 1]; |
1da177e4 LT |
603 | |
604 | if (acpi_irq_balance || !link->irq.active) { | |
605 | /* | |
606 | * Select the best IRQ. This is done in reverse to promote | |
607 | * the use of IRQs 9, 10, 11, and >15. | |
608 | */ | |
609 | for (i = (link->irq.possible_count - 1); i >= 0; i--) { | |
b5bd0269 SK |
610 | if (acpi_irq_get_penalty(irq) > |
611 | acpi_irq_get_penalty(link->irq.possible[i])) | |
1da177e4 LT |
612 | irq = link->irq.possible[i]; |
613 | } | |
614 | } | |
b5bd0269 | 615 | if (acpi_irq_get_penalty(irq) >= PIRQ_PENALTY_ISA_ALWAYS) { |
5ebc7603 JL |
616 | printk(KERN_ERR PREFIX "No IRQ available for %s [%s]. " |
617 | "Try pci=noacpi or acpi=off\n", | |
618 | acpi_device_name(link->device), | |
619 | acpi_device_bid(link->device)); | |
620 | return -ENODEV; | |
621 | } | |
1da177e4 LT |
622 | |
623 | /* Attempt to enable the link device at this IRQ. */ | |
624 | if (acpi_pci_link_set(link, irq)) { | |
6468463a LB |
625 | printk(KERN_ERR PREFIX "Unable to set IRQ for %s [%s]. " |
626 | "Try pci=noacpi or acpi=off\n", | |
a6fc6720 | 627 | acpi_device_name(link->device), |
6468463a | 628 | acpi_device_bid(link->device)); |
d550d98d | 629 | return -ENODEV; |
1da177e4 | 630 | } else { |
b5bd0269 SK |
631 | acpi_irq_add_penalty(link->irq.active, PIRQ_PENALTY_PCI_USING); |
632 | ||
4d939155 | 633 | printk(KERN_WARNING PREFIX "%s [%s] enabled at IRQ %d\n", |
4be44fcd LB |
634 | acpi_device_name(link->device), |
635 | acpi_device_bid(link->device), link->irq.active); | |
1da177e4 LT |
636 | } |
637 | ||
638 | link->irq.initialized = 1; | |
d550d98d | 639 | return 0; |
1da177e4 LT |
640 | } |
641 | ||
642 | /* | |
87bec66b | 643 | * acpi_pci_link_allocate_irq |
1da177e4 LT |
644 | * success: return IRQ >= 0 |
645 | * failure: return -1 | |
646 | */ | |
1c9ca3a7 BH |
647 | int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *triggering, |
648 | int *polarity, char **name) | |
1da177e4 | 649 | { |
c9d62443 BH |
650 | int result; |
651 | struct acpi_device *device; | |
652 | struct acpi_pci_link *link; | |
1da177e4 | 653 | |
1da177e4 LT |
654 | result = acpi_bus_get_device(handle, &device); |
655 | if (result) { | |
6468463a | 656 | printk(KERN_ERR PREFIX "Invalid link device\n"); |
d550d98d | 657 | return -1; |
1da177e4 LT |
658 | } |
659 | ||
50dd0969 | 660 | link = acpi_driver_data(device); |
1da177e4 | 661 | if (!link) { |
6468463a | 662 | printk(KERN_ERR PREFIX "Invalid link context\n"); |
d550d98d | 663 | return -1; |
1da177e4 LT |
664 | } |
665 | ||
666 | /* TBD: Support multiple index (IRQ) entries per Link Device */ | |
667 | if (index) { | |
6468463a | 668 | printk(KERN_ERR PREFIX "Invalid index %d\n", index); |
d550d98d | 669 | return -1; |
1da177e4 LT |
670 | } |
671 | ||
36e43095 | 672 | mutex_lock(&acpi_link_lock); |
87bec66b | 673 | if (acpi_pci_link_allocate(link)) { |
36e43095 | 674 | mutex_unlock(&acpi_link_lock); |
d550d98d | 675 | return -1; |
87bec66b | 676 | } |
4be44fcd | 677 | |
1da177e4 | 678 | if (!link->irq.active) { |
36e43095 | 679 | mutex_unlock(&acpi_link_lock); |
6468463a | 680 | printk(KERN_ERR PREFIX "Link active IRQ is 0!\n"); |
d550d98d | 681 | return -1; |
1da177e4 | 682 | } |
4be44fcd | 683 | link->refcnt++; |
36e43095 | 684 | mutex_unlock(&acpi_link_lock); |
1da177e4 | 685 | |
50eca3eb BM |
686 | if (triggering) |
687 | *triggering = link->irq.triggering; | |
688 | if (polarity) | |
689 | *polarity = link->irq.polarity; | |
4be44fcd LB |
690 | if (name) |
691 | *name = acpi_device_bid(link->device); | |
87bec66b | 692 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
4be44fcd LB |
693 | "Link %s is referenced\n", |
694 | acpi_device_bid(link->device))); | |
d550d98d | 695 | return (link->irq.active); |
1da177e4 LT |
696 | } |
697 | ||
87bec66b DSL |
698 | /* |
699 | * We don't change link's irq information here. After it is reenabled, we | |
700 | * continue use the info | |
701 | */ | |
4be44fcd | 702 | int acpi_pci_link_free_irq(acpi_handle handle) |
87bec66b | 703 | { |
c9d62443 BH |
704 | struct acpi_device *device; |
705 | struct acpi_pci_link *link; | |
4be44fcd | 706 | acpi_status result; |
87bec66b | 707 | |
87bec66b DSL |
708 | result = acpi_bus_get_device(handle, &device); |
709 | if (result) { | |
6468463a | 710 | printk(KERN_ERR PREFIX "Invalid link device\n"); |
d550d98d | 711 | return -1; |
87bec66b | 712 | } |
1da177e4 | 713 | |
50dd0969 | 714 | link = acpi_driver_data(device); |
87bec66b | 715 | if (!link) { |
6468463a | 716 | printk(KERN_ERR PREFIX "Invalid link context\n"); |
d550d98d | 717 | return -1; |
87bec66b DSL |
718 | } |
719 | ||
36e43095 | 720 | mutex_lock(&acpi_link_lock); |
87bec66b | 721 | if (!link->irq.initialized) { |
36e43095 | 722 | mutex_unlock(&acpi_link_lock); |
6468463a | 723 | printk(KERN_ERR PREFIX "Link isn't initialized\n"); |
d550d98d | 724 | return -1; |
87bec66b | 725 | } |
ecc21ebe DSL |
726 | #ifdef FUTURE_USE |
727 | /* | |
728 | * The Link reference count allows us to _DISable an unused link | |
729 | * and suspend time, and set it again on resume. | |
730 | * However, 2.6.12 still has irq_router.resume | |
731 | * which blindly restores the link state. | |
732 | * So we disable the reference count method | |
733 | * to prevent duplicate acpi_pci_link_set() | |
734 | * which would harm some systems | |
735 | */ | |
4be44fcd | 736 | link->refcnt--; |
ecc21ebe | 737 | #endif |
87bec66b | 738 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
4be44fcd LB |
739 | "Link %s is dereferenced\n", |
740 | acpi_device_bid(link->device))); | |
87bec66b | 741 | |
1c9ca3a7 | 742 | if (link->refcnt == 0) |
383d7a11 | 743 | acpi_evaluate_object(link->device->handle, "_DIS", NULL, NULL); |
1c9ca3a7 | 744 | |
36e43095 | 745 | mutex_unlock(&acpi_link_lock); |
d550d98d | 746 | return (link->irq.active); |
87bec66b | 747 | } |
4be44fcd | 748 | |
1da177e4 LT |
749 | /* -------------------------------------------------------------------------- |
750 | Driver Interface | |
751 | -------------------------------------------------------------------------- */ | |
752 | ||
4daeaf68 RW |
753 | static int acpi_pci_link_add(struct acpi_device *device, |
754 | const struct acpi_device_id *not_used) | |
1da177e4 | 755 | { |
c9d62443 BH |
756 | int result; |
757 | struct acpi_pci_link *link; | |
758 | int i; | |
4be44fcd | 759 | int found = 0; |
1da177e4 | 760 | |
36bcbec7 | 761 | link = kzalloc(sizeof(struct acpi_pci_link), GFP_KERNEL); |
1da177e4 | 762 | if (!link) |
d550d98d | 763 | return -ENOMEM; |
1da177e4 LT |
764 | |
765 | link->device = device; | |
1da177e4 LT |
766 | strcpy(acpi_device_name(device), ACPI_PCI_LINK_DEVICE_NAME); |
767 | strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS); | |
db89b4f0 | 768 | device->driver_data = link; |
1da177e4 | 769 | |
36e43095 | 770 | mutex_lock(&acpi_link_lock); |
1da177e4 LT |
771 | result = acpi_pci_link_get_possible(link); |
772 | if (result) | |
773 | goto end; | |
774 | ||
775 | /* query and set link->irq.active */ | |
776 | acpi_pci_link_get_current(link); | |
777 | ||
0dc070bb | 778 | printk(KERN_INFO PREFIX "%s [%s] (IRQs", acpi_device_name(device), |
4be44fcd | 779 | acpi_device_bid(device)); |
1da177e4 LT |
780 | for (i = 0; i < link->irq.possible_count; i++) { |
781 | if (link->irq.active == link->irq.possible[i]) { | |
be96447e | 782 | printk(KERN_CONT " *%d", link->irq.possible[i]); |
1da177e4 | 783 | found = 1; |
4be44fcd | 784 | } else |
be96447e | 785 | printk(KERN_CONT " %d", link->irq.possible[i]); |
1da177e4 LT |
786 | } |
787 | ||
be96447e | 788 | printk(KERN_CONT ")"); |
1da177e4 LT |
789 | |
790 | if (!found) | |
be96447e | 791 | printk(KERN_CONT " *%d", link->irq.active); |
1da177e4 | 792 | |
4be44fcd | 793 | if (!link->device->status.enabled) |
be96447e | 794 | printk(KERN_CONT ", disabled."); |
1da177e4 | 795 | |
be96447e | 796 | printk(KERN_CONT "\n"); |
1da177e4 | 797 | |
5f0dccaa | 798 | list_add_tail(&link->list, &acpi_link_list); |
1da177e4 | 799 | |
4be44fcd | 800 | end: |
1da177e4 | 801 | /* disable all links -- to be activated on use */ |
383d7a11 | 802 | acpi_evaluate_object(device->handle, "_DIS", NULL, NULL); |
36e43095 | 803 | mutex_unlock(&acpi_link_lock); |
1da177e4 LT |
804 | |
805 | if (result) | |
806 | kfree(link); | |
807 | ||
4daeaf68 | 808 | return result < 0 ? result : 1; |
1da177e4 LT |
809 | } |
810 | ||
4be44fcd | 811 | static int acpi_pci_link_resume(struct acpi_pci_link *link) |
697a2d63 | 812 | { |
697a2d63 | 813 | if (link->refcnt && link->irq.active && link->irq.initialized) |
d550d98d | 814 | return (acpi_pci_link_set(link, link->irq.active)); |
1c9ca3a7 BH |
815 | |
816 | return 0; | |
697a2d63 LT |
817 | } |
818 | ||
c3146df2 | 819 | static void irqrouter_resume(void) |
1da177e4 | 820 | { |
c9d62443 | 821 | struct acpi_pci_link *link; |
1da177e4 | 822 | |
5f0dccaa | 823 | list_for_each_entry(link, &acpi_link_list, list) { |
697a2d63 | 824 | acpi_pci_link_resume(link); |
1da177e4 | 825 | } |
1da177e4 LT |
826 | } |
827 | ||
4daeaf68 | 828 | static void acpi_pci_link_remove(struct acpi_device *device) |
1da177e4 | 829 | { |
c9d62443 | 830 | struct acpi_pci_link *link; |
1da177e4 | 831 | |
50dd0969 | 832 | link = acpi_driver_data(device); |
1da177e4 | 833 | |
36e43095 | 834 | mutex_lock(&acpi_link_lock); |
5f0dccaa | 835 | list_del(&link->list); |
36e43095 | 836 | mutex_unlock(&acpi_link_lock); |
1da177e4 LT |
837 | |
838 | kfree(link); | |
1da177e4 LT |
839 | } |
840 | ||
841 | /* | |
b5bd0269 | 842 | * modify penalty from cmdline |
1da177e4 LT |
843 | */ |
844 | static int __init acpi_irq_penalty_update(char *str, int used) | |
845 | { | |
846 | int i; | |
847 | ||
848 | for (i = 0; i < 16; i++) { | |
849 | int retval; | |
850 | int irq; | |
851 | ||
4be44fcd | 852 | retval = get_option(&str, &irq); |
1da177e4 LT |
853 | |
854 | if (!retval) | |
855 | break; /* no number found */ | |
856 | ||
857 | if (irq < 0) | |
858 | continue; | |
4be44fcd | 859 | |
1da177e4 | 860 | if (used) |
b5bd0269 | 861 | acpi_irq_add_penalty(irq, PIRQ_PENALTY_ISA_USED); |
1da177e4 | 862 | else |
b5bd0269 | 863 | acpi_irq_set_penalty(irq, PIRQ_PENALTY_PCI_AVAILABLE); |
1da177e4 LT |
864 | |
865 | if (retval != 2) /* no next number */ | |
866 | break; | |
867 | } | |
868 | return 1; | |
869 | } | |
870 | ||
871 | /* | |
872 | * We'd like PNP to call this routine for the | |
873 | * single ISA_USED value for each legacy device. | |
874 | * But instead it calls us with each POSSIBLE setting. | |
875 | * There is no ISA_POSSIBLE weight, so we simply use | |
876 | * the (small) PCI_USING penalty. | |
877 | */ | |
c9c3e457 | 878 | void acpi_penalize_isa_irq(int irq, int active) |
1da177e4 | 879 | { |
b5bd0269 SK |
880 | int penalty; |
881 | ||
882 | if (irq < 0) | |
883 | return; | |
884 | ||
885 | if (active) | |
886 | penalty = PIRQ_PENALTY_ISA_USED; | |
887 | else | |
888 | penalty = PIRQ_PENALTY_PCI_USING; | |
889 | ||
890 | acpi_irq_add_penalty(irq, penalty); | |
1da177e4 LT |
891 | } |
892 | ||
5ebc7603 JL |
893 | bool acpi_isa_irq_available(int irq) |
894 | { | |
b5bd0269 SK |
895 | return irq >= 0 && |
896 | (acpi_irq_get_penalty(irq) < PIRQ_PENALTY_ISA_ALWAYS); | |
5ebc7603 JL |
897 | } |
898 | ||
5d0ddfeb JL |
899 | /* |
900 | * Penalize IRQ used by ACPI SCI. If ACPI SCI pin attributes conflict with | |
901 | * PCI IRQ attributes, mark ACPI SCI as ISA_ALWAYS so it won't be use for | |
902 | * PCI IRQs. | |
903 | */ | |
904 | void acpi_penalize_sci_irq(int irq, int trigger, int polarity) | |
905 | { | |
b5bd0269 SK |
906 | int penalty; |
907 | ||
908 | if (irq < 0) | |
909 | return; | |
910 | ||
911 | if (trigger != ACPI_MADT_TRIGGER_LEVEL || | |
912 | polarity != ACPI_MADT_POLARITY_ACTIVE_LOW) | |
913 | penalty = PIRQ_PENALTY_ISA_ALWAYS; | |
914 | else | |
915 | penalty = PIRQ_PENALTY_PCI_USING; | |
916 | ||
917 | acpi_irq_add_penalty(irq, penalty); | |
5d0ddfeb JL |
918 | } |
919 | ||
1da177e4 LT |
920 | /* |
921 | * Over-ride default table to reserve additional IRQs for use by ISA | |
922 | * e.g. acpi_irq_isa=5 | |
923 | * Useful for telling ACPI how not to interfere with your ISA sound card. | |
924 | */ | |
925 | static int __init acpi_irq_isa(char *str) | |
926 | { | |
927 | return acpi_irq_penalty_update(str, 1); | |
928 | } | |
4be44fcd | 929 | |
1da177e4 LT |
930 | __setup("acpi_irq_isa=", acpi_irq_isa); |
931 | ||
932 | /* | |
933 | * Over-ride default table to free additional IRQs for use by PCI | |
934 | * e.g. acpi_irq_pci=7,15 | |
935 | * Used for acpi_irq_balance to free up IRQs to reduce PCI IRQ sharing. | |
936 | */ | |
937 | static int __init acpi_irq_pci(char *str) | |
938 | { | |
939 | return acpi_irq_penalty_update(str, 0); | |
940 | } | |
4be44fcd | 941 | |
1da177e4 LT |
942 | __setup("acpi_irq_pci=", acpi_irq_pci); |
943 | ||
944 | static int __init acpi_irq_nobalance_set(char *str) | |
945 | { | |
946 | acpi_irq_balance = 0; | |
947 | return 1; | |
948 | } | |
4be44fcd | 949 | |
1da177e4 LT |
950 | __setup("acpi_irq_nobalance", acpi_irq_nobalance_set); |
951 | ||
8a383ef0 | 952 | static int __init acpi_irq_balance_set(char *str) |
1da177e4 LT |
953 | { |
954 | acpi_irq_balance = 1; | |
955 | return 1; | |
956 | } | |
1da177e4 | 957 | |
4be44fcd | 958 | __setup("acpi_irq_balance", acpi_irq_balance_set); |
1da177e4 | 959 | |
c3146df2 | 960 | static struct syscore_ops irqrouter_syscore_ops = { |
4be44fcd | 961 | .resume = irqrouter_resume, |
1da177e4 LT |
962 | }; |
963 | ||
4daeaf68 | 964 | void __init acpi_pci_link_init(void) |
1da177e4 | 965 | { |
1da177e4 | 966 | if (acpi_noirq) |
4daeaf68 | 967 | return; |
1da177e4 | 968 | |
32836259 BH |
969 | if (acpi_irq_balance == -1) { |
970 | /* no command line switch: enable balancing in IOAPIC mode */ | |
971 | if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) | |
972 | acpi_irq_balance = 1; | |
973 | else | |
974 | acpi_irq_balance = 0; | |
975 | } | |
4daeaf68 RW |
976 | register_syscore_ops(&irqrouter_syscore_ops); |
977 | acpi_scan_add_handler(&pci_link_handler); | |
1da177e4 | 978 | } |