| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: intr.c,v 1.71 2011/04/03 22:29:27 dyoung Exp $ */ | | 1 | /* $NetBSD: intr.c,v 1.72 2011/08/01 10:42:24 drochner Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Andrew Doran. | | 8 | * by Andrew Doran. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -123,27 +123,27 @@ | | | @@ -123,27 +123,27 @@ |
123 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 123 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
124 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 124 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
125 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 125 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
126 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 126 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
127 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 127 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
128 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 128 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
129 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 129 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
130 | * SUCH DAMAGE. | | 130 | * SUCH DAMAGE. |
131 | * | | 131 | * |
132 | * @(#)isa.c 7.2 (Berkeley) 5/13/91 | | 132 | * @(#)isa.c 7.2 (Berkeley) 5/13/91 |
133 | */ | | 133 | */ |
134 | | | 134 | |
135 | #include <sys/cdefs.h> | | 135 | #include <sys/cdefs.h> |
136 | __KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.71 2011/04/03 22:29:27 dyoung Exp $"); | | 136 | __KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.72 2011/08/01 10:42:24 drochner Exp $"); |
137 | | | 137 | |
138 | #include "opt_intrdebug.h" | | 138 | #include "opt_intrdebug.h" |
139 | #include "opt_multiprocessor.h" | | 139 | #include "opt_multiprocessor.h" |
140 | #include "opt_acpi.h" | | 140 | #include "opt_acpi.h" |
141 | | | 141 | |
142 | #include <sys/param.h> | | 142 | #include <sys/param.h> |
143 | #include <sys/systm.h> | | 143 | #include <sys/systm.h> |
144 | #include <sys/kernel.h> | | 144 | #include <sys/kernel.h> |
145 | #include <sys/syslog.h> | | 145 | #include <sys/syslog.h> |
146 | #include <sys/device.h> | | 146 | #include <sys/device.h> |
147 | #include <sys/kmem.h> | | 147 | #include <sys/kmem.h> |
148 | #include <sys/proc.h> | | 148 | #include <sys/proc.h> |
149 | #include <sys/errno.h> | | 149 | #include <sys/errno.h> |
| @@ -470,27 +470,28 @@ intr_allocate_slot(struct pic *pic, int | | | @@ -470,27 +470,28 @@ intr_allocate_slot(struct pic *pic, int |
470 | CPU_INFO_ITERATOR cii; | | 470 | CPU_INFO_ITERATOR cii; |
471 | struct cpu_info *ci, *lci; | | 471 | struct cpu_info *ci, *lci; |
472 | struct intrsource *isp; | | 472 | struct intrsource *isp; |
473 | int slot = 0, idtvec, error; | | 473 | int slot = 0, idtvec, error; |
474 | | | 474 | |
475 | KASSERT(mutex_owned(&cpu_lock)); | | 475 | KASSERT(mutex_owned(&cpu_lock)); |
476 | | | 476 | |
477 | /* First check if this pin is already used by an interrupt vector. */ | | 477 | /* First check if this pin is already used by an interrupt vector. */ |
478 | for (CPU_INFO_FOREACH(cii, ci)) { | | 478 | for (CPU_INFO_FOREACH(cii, ci)) { |
479 | for (slot = 0 ; slot < MAX_INTR_SOURCES ; slot++) { | | 479 | for (slot = 0 ; slot < MAX_INTR_SOURCES ; slot++) { |
480 | if ((isp = ci->ci_isources[slot]) == NULL) { | | 480 | if ((isp = ci->ci_isources[slot]) == NULL) { |
481 | continue; | | 481 | continue; |
482 | } | | 482 | } |
483 | if (isp->is_pic == pic && isp->is_pin == pin) { | | 483 | if (isp->is_pic == pic && |
| | | 484 | pin != -1 && isp->is_pin == pin) { |
484 | *idt_slot = isp->is_idtvec; | | 485 | *idt_slot = isp->is_idtvec; |
485 | *index = slot; | | 486 | *index = slot; |
486 | *cip = ci; | | 487 | *cip = ci; |
487 | return 0; | | 488 | return 0; |
488 | } | | 489 | } |
489 | } | | 490 | } |
490 | } | | 491 | } |
491 | | | 492 | |
492 | /* | | 493 | /* |
493 | * The pic/pin combination doesn't have an existing mapping. | | 494 | * The pic/pin combination doesn't have an existing mapping. |
494 | * Find a slot for a new interrupt source. For the i8259 case, | | 495 | * Find a slot for a new interrupt source. For the i8259 case, |
495 | * we always use reserved slots of the primary CPU. Otherwise, | | 496 | * we always use reserved slots of the primary CPU. Otherwise, |
496 | * we make an attempt to balance the interrupt load. | | 497 | * we make an attempt to balance the interrupt load. |