summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroger <roger@FreeBSD.org>1999-03-10 15:00:54 +0000
committerroger <roger@FreeBSD.org>1999-03-10 15:00:54 +0000
commit6559ff40470c06ff38dedb173bbc3b2a7233a294 (patch)
tree194c615656851671d111fd08fd39f721b5f5dd2d
parent51e8dc78ebe5b4a53ce64ecb8d065cdb345c56f0 (diff)
downloadFreeBSD-src-6559ff40470c06ff38dedb173bbc3b2a7233a294.zip
FreeBSD-src-6559ff40470c06ff38dedb173bbc3b2a7233a294.tar.gz
Updated to use new APIC (SMP) safe interrupt register/unregister
functions. Posted for review to -smp and -mobile and -hackers with no objections. Reviewed by: Nate
-rw-r--r--sys/pccard/pccard.c7
-rw-r--r--sys/pccard/pcic.c48
2 files changed, 48 insertions, 7 deletions
diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c
index dd76c24..7d416a9 100644
--- a/sys/pccard/pccard.c
+++ b/sys/pccard/pccard.c
@@ -28,7 +28,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: pccard.c,v 1.71 1999/02/13 11:31:59 kuriyama Exp $
+ * $Id: pccard.c,v 1.72 1999/02/14 20:41:01 guido Exp $
*/
#include "opt_devfs.h"
@@ -60,6 +60,7 @@
#include <pccard/cardinfo.h>
#include <pccard/driver.h>
+#include <pccard/pcic.h>
#include <pccard/slot.h>
#include <machine/md_var.h>
@@ -339,7 +340,7 @@ unregister_device_interrupt(struct pccard_devinfo *devi)
printf("Return IRQ=%d\n",slt->irq);
slt->ctrl->mapirq(slt, 0);
INTRDIS(1<<slt->irq);
- unregister_intr(slt->irq, slot_irq_handler);
+ unregister_pcic_intr(slt->irq, slot_irq_handler);
if (devi->drv->imask)
INTRUNMASK(*devi->drv->imask,(1<<slt->irq));
/* Remove from the PCIC controller imask */
@@ -526,7 +527,7 @@ pccard_alloc_intr(u_int imask, inthand2_t *hand, int unit,
if (!(mask & imask))
continue;
INTRMASK(*maskp, mask);
- if (register_intr(irq, 0, 0, hand, maskp, unit) == 0) {
+ if (register_pcic_intr(irq, 0, 0, hand, maskp, unit) == 0) {
/* add this to the PCIC controller's mask */
if (pcic_imask)
INTRMASK(*pcic_imask, (1 << irq));
diff --git a/sys/pccard/pcic.c b/sys/pccard/pcic.c
index 651c1d5..c087239 100644
--- a/sys/pccard/pcic.c
+++ b/sys/pccard/pcic.c
@@ -53,6 +53,11 @@
#include <pccard/cardinfo.h>
#include <pccard/driver.h>
#include <pccard/slot.h>
+#include <pccard/pcic.h>
+
+#ifdef APIC_IO
+#include <machine/smp.h>
+#endif
/*
* Prototypes for interrupt handler.
@@ -159,6 +164,41 @@ putw(struct pcic_slot *sp, int reg, unsigned short word)
/*
+ * Gerneral functions for registering and unregistering interrupts.
+ * isa_to_apic() is used to map the ISA IRQ onto the APIC IRQ to
+ * check if the APIC IRQ is used or free.
+ */
+#ifdef APIC_IO
+int register_pcic_intr(int intr, int device_id, u_int flags,
+ inthand2_t handler, u_int *maskptr, int unit){
+ int apic_intr;
+ apic_intr = isa_apic_irq(intr);
+ if (apic_intr <0) return -1;
+ else return register_intr(apic_intr, device_id, flags, handler,
+ maskptr, unit);
+}
+
+int unregister_pcic_intr(int intr, inthand2_t handler){
+ int apic_intr;
+ apic_intr = isa_apic_irq(intr);
+ return unregister_intr(apic_intr, handler);
+}
+
+#else /* Not APIC_IO */
+
+static int register_pcic_intr(int intr, int device_id, u_int flags,
+ inthand2_t handler, u_int *maskptr, int unit){
+ return register_intr(intr, device_id, flags, handler, maskptr, unit);
+}
+
+static int unregister_pcic_intr(int intr, inthand2_t handler){
+ return unregister_intr(intr, handler);
+}
+
+#endif /* APIC_IO */
+
+
+/*
* Loadable kernel module interface.
*/
@@ -228,7 +268,7 @@ pcic_unload()
if (sp->slt)
sp->putb(sp, PCIC_STAT_INT, 0);
}
- unregister_intr(pcic_irq, pcicintr);
+ unregister_pcic_intr(pcic_irq, pcicintr);
}
pccard_remove_controller(&cinfo);
return(0);
@@ -282,12 +322,12 @@ build_freelist(u_int pcic_mask)
*/
mask = 1 << irq;
if (!(mask & pcic_mask)) continue;
-
+
/* See if the IRQ is free. */
- if (register_intr(irq, 0, 0, nullfunc, NULL, irq) == 0) {
+ if (register_pcic_intr(irq, 0, 0, nullfunc, NULL, irq) == 0) {
/* Give it back, but add it to the mask */
INTRMASK(freemask, mask);
- unregister_intr(irq, nullfunc);
+ unregister_pcic_intr(irq, nullfunc);
}
}
#ifdef PCIC_DEBUG
OpenPOWER on IntegriCloud