2 * pci_link.c - ACPI PCI Interrupt Link Device Driver ($Revision: 34 $)
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>
8 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or (at
13 * your option) any later version.
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
24 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27 * 1. Support more than one IRQ resource entry per link device (index).
28 * 2. Implement start/stop mechanism and use ACPI Bus Driver facilities
29 * for IRQ management (e.g. start()->_SRS).
32 #include <linux/sysdev.h>
33 #include <linux/kernel.h>
34 #include <linux/module.h>
35 #include <linux/init.h>
36 #include <linux/types.h>
37 #include <linux/proc_fs.h>
38 #include <linux/spinlock.h>
40 #include <linux/pci.h>
41 #include <linux/mutex.h>
43 #include <acpi/acpi_bus.h>
44 #include <acpi/acpi_drivers.h>
46 #define _COMPONENT ACPI_PCI_COMPONENT
47 ACPI_MODULE_NAME("pci_link")
48 #define ACPI_PCI_LINK_CLASS "pci_irq_routing"
49 #define ACPI_PCI_LINK_HID "PNP0C0F"
50 #define ACPI_PCI_LINK_DRIVER_NAME "ACPI PCI Interrupt Link Driver"
51 #define ACPI_PCI_LINK_DEVICE_NAME "PCI Interrupt Link"
52 #define ACPI_PCI_LINK_FILE_INFO "info"
53 #define ACPI_PCI_LINK_FILE_STATUS "state"
54 #define ACPI_PCI_LINK_MAX_POSSIBLE 16
55 static int acpi_pci_link_add(struct acpi_device *device);
56 static int acpi_pci_link_remove(struct acpi_device *device, int type);
58 static struct acpi_driver acpi_pci_link_driver = {
59 .name = ACPI_PCI_LINK_DRIVER_NAME,
60 .class = ACPI_PCI_LINK_CLASS,
61 .ids = ACPI_PCI_LINK_HID,
63 .add = acpi_pci_link_add,
64 .remove = acpi_pci_link_remove,
69 * If a link is initialized, we never change its active and initialized
70 * later even the link is disable. Instead, we just repick the active irq
72 struct acpi_pci_link_irq {
73 u8 active; /* Current IRQ */
74 u8 triggering; /* All IRQs */
75 u8 polarity; /* All IRQs */
78 u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE];
83 struct acpi_pci_link {
84 struct list_head node;
85 struct acpi_device *device;
86 struct acpi_pci_link_irq irq;
92 struct list_head entries;
94 DEFINE_MUTEX(acpi_link_lock);
96 /* --------------------------------------------------------------------------
97 PCI Link Device Management
98 -------------------------------------------------------------------------- */
101 * set context (link) possible list from resource list
104 acpi_pci_link_check_possible(struct acpi_resource *resource, void *context)
106 struct acpi_pci_link *link = (struct acpi_pci_link *)context;
110 switch (resource->type) {
111 case ACPI_RESOURCE_TYPE_START_DEPENDENT:
113 case ACPI_RESOURCE_TYPE_IRQ:
115 struct acpi_resource_irq *p = &resource->data.irq;
116 if (!p || !p->interrupt_count) {
117 printk(KERN_WARNING PREFIX "Blank IRQ resource\n");
121 (i < p->interrupt_count
122 && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) {
123 if (!p->interrupts[i]) {
124 printk(KERN_WARNING PREFIX "Invalid IRQ %d\n",
128 link->irq.possible[i] = p->interrupts[i];
129 link->irq.possible_count++;
131 link->irq.triggering = p->triggering;
132 link->irq.polarity = p->polarity;
133 link->irq.resource_type = ACPI_RESOURCE_TYPE_IRQ;
136 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
138 struct acpi_resource_extended_irq *p =
139 &resource->data.extended_irq;
140 if (!p || !p->interrupt_count) {
141 printk(KERN_WARNING PREFIX
142 "Blank EXT IRQ resource\n");
146 (i < p->interrupt_count
147 && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) {
148 if (!p->interrupts[i]) {
149 printk(KERN_WARNING PREFIX "Invalid IRQ %d\n",
153 link->irq.possible[i] = p->interrupts[i];
154 link->irq.possible_count++;
156 link->irq.triggering = p->triggering;
157 link->irq.polarity = p->polarity;
158 link->irq.resource_type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ;
162 printk(KERN_ERR PREFIX "Resource is not an IRQ entry\n");
166 return AE_CTRL_TERMINATE;
169 static int acpi_pci_link_get_possible(struct acpi_pci_link *link)
177 status = acpi_walk_resources(link->device->handle, METHOD_NAME__PRS,
178 acpi_pci_link_check_possible, link);
179 if (ACPI_FAILURE(status)) {
180 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRS"));
184 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
185 "Found %d possible IRQs\n",
186 link->irq.possible_count));
192 acpi_pci_link_check_current(struct acpi_resource *resource, void *context)
194 int *irq = (int *)context;
197 switch (resource->type) {
198 case ACPI_RESOURCE_TYPE_IRQ:
200 struct acpi_resource_irq *p = &resource->data.irq;
201 if (!p || !p->interrupt_count) {
203 * IRQ descriptors may have no IRQ# bits set,
204 * particularly those those w/ _STA disabled
206 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
207 "Blank IRQ resource\n"));
210 *irq = p->interrupts[0];
213 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
215 struct acpi_resource_extended_irq *p =
216 &resource->data.extended_irq;
217 if (!p || !p->interrupt_count) {
219 * extended IRQ descriptors must
220 * return at least 1 IRQ
222 printk(KERN_WARNING PREFIX
223 "Blank EXT IRQ resource\n");
226 *irq = p->interrupts[0];
231 printk(KERN_ERR PREFIX "Resource %d isn't an IRQ\n", resource->type);
232 case ACPI_RESOURCE_TYPE_END_TAG:
235 return AE_CTRL_TERMINATE;
239 * Run _CRS and set link->irq.active
245 static int acpi_pci_link_get_current(struct acpi_pci_link *link)
248 acpi_status status = AE_OK;
254 link->irq.active = 0;
256 /* in practice, status disabled is meaningless, ignore it */
258 /* Query _STA, set link->device->status */
259 result = acpi_bus_get_status(link->device);
261 printk(KERN_ERR PREFIX "Unable to read status\n");
265 if (!link->device->status.enabled) {
266 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link disabled\n"));
272 * Query and parse _CRS to get the current IRQ assignment.
275 status = acpi_walk_resources(link->device->handle, METHOD_NAME__CRS,
276 acpi_pci_link_check_current, &irq);
277 if (ACPI_FAILURE(status)) {
278 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _CRS"));
283 if (acpi_strict && !irq) {
284 printk(KERN_ERR PREFIX "_CRS returned 0\n");
288 link->irq.active = irq;
290 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link at IRQ %d \n", link->irq.active));
296 static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
299 acpi_status status = AE_OK;
301 struct acpi_resource res;
302 struct acpi_resource end;
304 struct acpi_buffer buffer = { 0, NULL };
310 resource = kmalloc(sizeof(*resource) + 1, GFP_ATOMIC);
314 memset(resource, 0, sizeof(*resource) + 1);
315 buffer.length = sizeof(*resource) + 1;
316 buffer.pointer = resource;
318 switch (link->irq.resource_type) {
319 case ACPI_RESOURCE_TYPE_IRQ:
320 resource->res.type = ACPI_RESOURCE_TYPE_IRQ;
321 resource->res.length = sizeof(struct acpi_resource);
322 resource->res.data.irq.triggering = link->irq.triggering;
323 resource->res.data.irq.polarity =
325 if (link->irq.triggering == ACPI_EDGE_SENSITIVE)
326 resource->res.data.irq.sharable =
329 resource->res.data.irq.sharable = ACPI_SHARED;
330 resource->res.data.irq.interrupt_count = 1;
331 resource->res.data.irq.interrupts[0] = irq;
334 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
335 resource->res.type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ;
336 resource->res.length = sizeof(struct acpi_resource);
337 resource->res.data.extended_irq.producer_consumer =
339 resource->res.data.extended_irq.triggering =
340 link->irq.triggering;
341 resource->res.data.extended_irq.polarity =
343 if (link->irq.triggering == ACPI_EDGE_SENSITIVE)
344 resource->res.data.irq.sharable =
347 resource->res.data.irq.sharable = ACPI_SHARED;
348 resource->res.data.extended_irq.interrupt_count = 1;
349 resource->res.data.extended_irq.interrupts[0] = irq;
350 /* ignore resource_source, it's optional */
353 printk(KERN_ERR PREFIX "Invalid Resource_type %d\n", link->irq.resource_type);
358 resource->end.type = ACPI_RESOURCE_TYPE_END_TAG;
360 /* Attempt to set the resource */
361 status = acpi_set_current_resources(link->device->handle, &buffer);
363 /* check for total failure */
364 if (ACPI_FAILURE(status)) {
365 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _SRS"));
370 /* Query _STA, set device->status */
371 result = acpi_bus_get_status(link->device);
373 printk(KERN_ERR PREFIX "Unable to read status\n");
376 if (!link->device->status.enabled) {
377 printk(KERN_WARNING PREFIX
378 "%s [%s] disabled and referenced, BIOS bug\n",
379 acpi_device_name(link->device),
380 acpi_device_bid(link->device));
383 /* Query _CRS, set link->irq.active */
384 result = acpi_pci_link_get_current(link);
390 * Is current setting not what we set?
391 * set link->irq.active
393 if (link->irq.active != irq) {
395 * policy: when _CRS doesn't return what we just _SRS
396 * assume _SRS worked and override _CRS value.
398 printk(KERN_WARNING PREFIX
399 "%s [%s] BIOS reported IRQ %d, using IRQ %d\n",
400 acpi_device_name(link->device),
401 acpi_device_bid(link->device), link->irq.active, irq);
402 link->irq.active = irq;
405 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Set IRQ %d\n", link->irq.active));
412 /* --------------------------------------------------------------------------
413 PCI Link IRQ Management
414 -------------------------------------------------------------------------- */
417 * "acpi_irq_balance" (default in APIC mode) enables ACPI to use PIC Interrupt
418 * Link Devices to move the PIRQs around to minimize sharing.
420 * "acpi_irq_nobalance" (default in PIC mode) tells ACPI not to move any PIC IRQs
421 * that the BIOS has already set to active. This is necessary because
422 * ACPI has no automatic means of knowing what ISA IRQs are used. Note that
423 * if the BIOS doesn't set a Link Device active, ACPI needs to program it
424 * even if acpi_irq_nobalance is set.
426 * A tables of penalties avoids directing PCI interrupts to well known
427 * ISA IRQs. Boot params are available to over-ride the default table:
429 * List interrupts that are free for PCI use.
432 * List interrupts that should not be used for PCI:
435 * Note that PCI IRQ routers have a list of possible IRQs,
436 * which may not include the IRQs this table says are available.
438 * Since this heuristic can't tell the difference between a link
439 * that no device will attach to, vs. a link which may be shared
440 * by multiple active devices -- it is not optimal.
442 * If interrupt performance is that important, get an IO-APIC system
443 * with a pin dedicated to each device. Or for that matter, an MSI
447 #define ACPI_MAX_IRQS 256
448 #define ACPI_MAX_ISA_IRQ 16
450 #define PIRQ_PENALTY_PCI_AVAILABLE (0)
451 #define PIRQ_PENALTY_PCI_POSSIBLE (16*16)
452 #define PIRQ_PENALTY_PCI_USING (16*16*16)
453 #define PIRQ_PENALTY_ISA_TYPICAL (16*16*16*16)
454 #define PIRQ_PENALTY_ISA_USED (16*16*16*16*16)
455 #define PIRQ_PENALTY_ISA_ALWAYS (16*16*16*16*16*16)
457 static int acpi_irq_penalty[ACPI_MAX_IRQS] = {
458 PIRQ_PENALTY_ISA_ALWAYS, /* IRQ0 timer */
459 PIRQ_PENALTY_ISA_ALWAYS, /* IRQ1 keyboard */
460 PIRQ_PENALTY_ISA_ALWAYS, /* IRQ2 cascade */
461 PIRQ_PENALTY_ISA_TYPICAL, /* IRQ3 serial */
462 PIRQ_PENALTY_ISA_TYPICAL, /* IRQ4 serial */
463 PIRQ_PENALTY_ISA_TYPICAL, /* IRQ5 sometimes SoundBlaster */
464 PIRQ_PENALTY_ISA_TYPICAL, /* IRQ6 */
465 PIRQ_PENALTY_ISA_TYPICAL, /* IRQ7 parallel, spurious */
466 PIRQ_PENALTY_ISA_TYPICAL, /* IRQ8 rtc, sometimes */
467 PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ9 PCI, often acpi */
468 PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ10 PCI */
469 PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ11 PCI */
470 PIRQ_PENALTY_ISA_USED, /* IRQ12 mouse */
471 PIRQ_PENALTY_ISA_USED, /* IRQ13 fpe, sometimes */
472 PIRQ_PENALTY_ISA_USED, /* IRQ14 ide0 */
473 PIRQ_PENALTY_ISA_USED, /* IRQ15 ide1 */
477 int __init acpi_irq_penalty_init(void)
479 struct list_head *node = NULL;
480 struct acpi_pci_link *link = NULL;
485 * Update penalties to facilitate IRQ balancing.
487 list_for_each(node, &acpi_link.entries) {
489 link = list_entry(node, struct acpi_pci_link, node);
491 printk(KERN_ERR PREFIX "Invalid link context\n");
496 * reflect the possible and active irqs in the penalty table --
497 * useful for breaking ties.
499 if (link->irq.possible_count) {
501 PIRQ_PENALTY_PCI_POSSIBLE /
502 link->irq.possible_count;
504 for (i = 0; i < link->irq.possible_count; i++) {
505 if (link->irq.possible[i] < ACPI_MAX_ISA_IRQ)
506 acpi_irq_penalty[link->irq.
511 } else if (link->irq.active) {
512 acpi_irq_penalty[link->irq.active] +=
513 PIRQ_PENALTY_PCI_POSSIBLE;
516 /* Add a penalty for the SCI */
517 acpi_irq_penalty[acpi_fadt.sci_int] += PIRQ_PENALTY_PCI_USING;
522 static int acpi_irq_balance; /* 0: static, 1: balance */
524 static int acpi_pci_link_allocate(struct acpi_pci_link *link)
530 if (link->irq.initialized) {
531 if (link->refcnt == 0)
532 /* This means the link is disabled but initialized */
533 acpi_pci_link_set(link, link->irq.active);
538 * search for active IRQ in list of possible IRQs.
540 for (i = 0; i < link->irq.possible_count; ++i) {
541 if (link->irq.active == link->irq.possible[i])
545 * forget active IRQ that is not in possible list
547 if (i == link->irq.possible_count) {
549 printk(KERN_WARNING PREFIX "_CRS %d not found"
550 " in _PRS\n", link->irq.active);
551 link->irq.active = 0;
555 * if active found, use it; else pick entry from end of possible list.
557 if (link->irq.active) {
558 irq = link->irq.active;
560 irq = link->irq.possible[link->irq.possible_count - 1];
563 if (acpi_irq_balance || !link->irq.active) {
565 * Select the best IRQ. This is done in reverse to promote
566 * the use of IRQs 9, 10, 11, and >15.
568 for (i = (link->irq.possible_count - 1); i >= 0; i--) {
569 if (acpi_irq_penalty[irq] >
570 acpi_irq_penalty[link->irq.possible[i]])
571 irq = link->irq.possible[i];
575 /* Attempt to enable the link device at this IRQ. */
576 if (acpi_pci_link_set(link, irq)) {
577 printk(KERN_ERR PREFIX "Unable to set IRQ for %s [%s]. "
578 "Try pci=noacpi or acpi=off\n",
579 acpi_device_name(link->device),
580 acpi_device_bid(link->device));
583 acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING;
584 printk(PREFIX "%s [%s] enabled at IRQ %d\n",
585 acpi_device_name(link->device),
586 acpi_device_bid(link->device), link->irq.active);
589 link->irq.initialized = 1;
595 * acpi_pci_link_allocate_irq
596 * success: return IRQ >= 0
601 acpi_pci_link_allocate_irq(acpi_handle handle,
603 int *triggering, int *polarity, char **name)
606 struct acpi_device *device = NULL;
607 struct acpi_pci_link *link = NULL;
610 result = acpi_bus_get_device(handle, &device);
612 printk(KERN_ERR PREFIX "Invalid link device\n");
616 link = (struct acpi_pci_link *)acpi_driver_data(device);
618 printk(KERN_ERR PREFIX "Invalid link context\n");
622 /* TBD: Support multiple index (IRQ) entries per Link Device */
624 printk(KERN_ERR PREFIX "Invalid index %d\n", index);
628 mutex_lock(&acpi_link_lock);
629 if (acpi_pci_link_allocate(link)) {
630 mutex_unlock(&acpi_link_lock);
634 if (!link->irq.active) {
635 mutex_unlock(&acpi_link_lock);
636 printk(KERN_ERR PREFIX "Link active IRQ is 0!\n");
640 mutex_unlock(&acpi_link_lock);
643 *triggering = link->irq.triggering;
645 *polarity = link->irq.polarity;
647 *name = acpi_device_bid(link->device);
648 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
649 "Link %s is referenced\n",
650 acpi_device_bid(link->device)));
651 return (link->irq.active);
655 * We don't change link's irq information here. After it is reenabled, we
656 * continue use the info
658 int acpi_pci_link_free_irq(acpi_handle handle)
660 struct acpi_device *device = NULL;
661 struct acpi_pci_link *link = NULL;
665 result = acpi_bus_get_device(handle, &device);
667 printk(KERN_ERR PREFIX "Invalid link device\n");
671 link = (struct acpi_pci_link *)acpi_driver_data(device);
673 printk(KERN_ERR PREFIX "Invalid link context\n");
677 mutex_lock(&acpi_link_lock);
678 if (!link->irq.initialized) {
679 mutex_unlock(&acpi_link_lock);
680 printk(KERN_ERR PREFIX "Link isn't initialized\n");
685 * The Link reference count allows us to _DISable an unused link
686 * and suspend time, and set it again on resume.
687 * However, 2.6.12 still has irq_router.resume
688 * which blindly restores the link state.
689 * So we disable the reference count method
690 * to prevent duplicate acpi_pci_link_set()
691 * which would harm some systems
695 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
696 "Link %s is dereferenced\n",
697 acpi_device_bid(link->device)));
699 if (link->refcnt == 0) {
700 acpi_ut_evaluate_object(link->device->handle, "_DIS", 0, NULL);
702 mutex_unlock(&acpi_link_lock);
703 return (link->irq.active);
706 /* --------------------------------------------------------------------------
708 -------------------------------------------------------------------------- */
710 static int acpi_pci_link_add(struct acpi_device *device)
713 struct acpi_pci_link *link = NULL;
721 link = kmalloc(sizeof(struct acpi_pci_link), GFP_KERNEL);
724 memset(link, 0, sizeof(struct acpi_pci_link));
726 link->device = device;
727 strcpy(acpi_device_name(device), ACPI_PCI_LINK_DEVICE_NAME);
728 strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS);
729 acpi_driver_data(device) = link;
731 mutex_lock(&acpi_link_lock);
732 result = acpi_pci_link_get_possible(link);
736 /* query and set link->irq.active */
737 acpi_pci_link_get_current(link);
739 printk(PREFIX "%s [%s] (IRQs", acpi_device_name(device),
740 acpi_device_bid(device));
741 for (i = 0; i < link->irq.possible_count; i++) {
742 if (link->irq.active == link->irq.possible[i]) {
743 printk(" *%d", link->irq.possible[i]);
746 printk(" %d", link->irq.possible[i]);
752 printk(" *%d", link->irq.active);
754 if (!link->device->status.enabled)
755 printk(", disabled.");
759 /* TBD: Acquire/release lock */
760 list_add_tail(&link->node, &acpi_link.entries);
764 /* disable all links -- to be activated on use */
765 acpi_ut_evaluate_object(device->handle, "_DIS", 0, NULL);
766 mutex_unlock(&acpi_link_lock);
774 static int acpi_pci_link_resume(struct acpi_pci_link *link)
777 if (link->refcnt && link->irq.active && link->irq.initialized)
778 return (acpi_pci_link_set(link, link->irq.active));
784 * FIXME: this is a workaround to avoid nasty warning. It will be removed
785 * after every device calls pci_disable_device in .resume.
788 static int irqrouter_resume(struct sys_device *dev)
790 struct list_head *node = NULL;
791 struct acpi_pci_link *link = NULL;
794 /* Make sure SCI is enabled again (Apple firmware bug?) */
795 acpi_set_register(ACPI_BITREG_SCI_ENABLE, 1, ACPI_MTX_DO_NOT_LOCK);
798 list_for_each(node, &acpi_link.entries) {
799 link = list_entry(node, struct acpi_pci_link, node);
801 printk(KERN_ERR PREFIX "Invalid link context\n");
804 acpi_pci_link_resume(link);
810 static int acpi_pci_link_remove(struct acpi_device *device, int type)
812 struct acpi_pci_link *link = NULL;
815 if (!device || !acpi_driver_data(device))
818 link = (struct acpi_pci_link *)acpi_driver_data(device);
820 mutex_lock(&acpi_link_lock);
821 list_del(&link->node);
822 mutex_unlock(&acpi_link_lock);
830 * modify acpi_irq_penalty[] from cmdline
832 static int __init acpi_irq_penalty_update(char *str, int used)
836 for (i = 0; i < 16; i++) {
840 retval = get_option(&str, &irq);
843 break; /* no number found */
848 if (irq >= ACPI_MAX_IRQS)
852 acpi_irq_penalty[irq] += PIRQ_PENALTY_ISA_USED;
854 acpi_irq_penalty[irq] = PIRQ_PENALTY_PCI_AVAILABLE;
856 if (retval != 2) /* no next number */
863 * We'd like PNP to call this routine for the
864 * single ISA_USED value for each legacy device.
865 * But instead it calls us with each POSSIBLE setting.
866 * There is no ISA_POSSIBLE weight, so we simply use
867 * the (small) PCI_USING penalty.
869 void acpi_penalize_isa_irq(int irq, int active)
872 acpi_irq_penalty[irq] += PIRQ_PENALTY_ISA_USED;
874 acpi_irq_penalty[irq] += PIRQ_PENALTY_PCI_USING;
878 * Over-ride default table to reserve additional IRQs for use by ISA
879 * e.g. acpi_irq_isa=5
880 * Useful for telling ACPI how not to interfere with your ISA sound card.
882 static int __init acpi_irq_isa(char *str)
884 return acpi_irq_penalty_update(str, 1);
887 __setup("acpi_irq_isa=", acpi_irq_isa);
890 * Over-ride default table to free additional IRQs for use by PCI
891 * e.g. acpi_irq_pci=7,15
892 * Used for acpi_irq_balance to free up IRQs to reduce PCI IRQ sharing.
894 static int __init acpi_irq_pci(char *str)
896 return acpi_irq_penalty_update(str, 0);
899 __setup("acpi_irq_pci=", acpi_irq_pci);
901 static int __init acpi_irq_nobalance_set(char *str)
903 acpi_irq_balance = 0;
907 __setup("acpi_irq_nobalance", acpi_irq_nobalance_set);
909 int __init acpi_irq_balance_set(char *str)
911 acpi_irq_balance = 1;
915 __setup("acpi_irq_balance", acpi_irq_balance_set);
917 /* FIXME: we will remove this interface after all drivers call pci_disable_device */
918 static struct sysdev_class irqrouter_sysdev_class = {
919 set_kset_name("irqrouter"),
920 .resume = irqrouter_resume,
923 static struct sys_device device_irqrouter = {
925 .cls = &irqrouter_sysdev_class,
928 static int __init irqrouter_init_sysfs(void)
933 if (acpi_disabled || acpi_noirq)
936 error = sysdev_class_register(&irqrouter_sysdev_class);
938 error = sysdev_register(&device_irqrouter);
943 device_initcall(irqrouter_init_sysfs);
945 static int __init acpi_pci_link_init(void)
952 INIT_LIST_HEAD(&acpi_link.entries);
954 if (acpi_bus_register_driver(&acpi_pci_link_driver) < 0)
960 subsys_initcall(acpi_pci_link_init);