Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sgimips Use the mace interrupt handler for PCI inte...
details: https://anonhg.NetBSD.org/src/rev/29b8a7fed553
branches: trunk
changeset: 569784:29b8a7fed553
user: sekiya <sekiya%NetBSD.org@localhost>
date: Mon Sep 06 07:24:06 2004 +0000
description:
Use the mace interrupt handler for PCI interrupts.
>From KIYOHARA Takashi
diffstat:
sys/arch/sgimips/dev/crime.c | 20 ++++++++++++----
sys/arch/sgimips/dev/crimevar.h | 3 +-
sys/arch/sgimips/include/pci_machdep.h | 5 +++-
sys/arch/sgimips/mace/mace.c | 41 +++++++++++++++++++++++++++++++--
sys/arch/sgimips/mace/macevar.h | 3 +-
sys/arch/sgimips/mace/pci_mace.c | 6 +++-
sys/arch/sgimips/pci/pci_machdep.c | 8 +++---
7 files changed, 69 insertions(+), 17 deletions(-)
diffs (233 lines):
diff -r 4b9d18321896 -r 29b8a7fed553 sys/arch/sgimips/dev/crime.c
--- a/sys/arch/sgimips/dev/crime.c Sun Sep 05 21:42:43 2004 +0000
+++ b/sys/arch/sgimips/dev/crime.c Mon Sep 06 07:24:06 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crime.c,v 1.18 2004/01/18 04:06:42 sekiya Exp $ */
+/* $NetBSD: crime.c,v 1.19 2004/09/06 07:24:06 sekiya Exp $ */
/*
* Copyright (c) 2004 Christopher SEKIYA
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: crime.c,v 1.18 2004/01/18 04:06:42 sekiya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crime.c,v 1.19 2004/09/06 07:24:06 sekiya Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -183,7 +183,7 @@
void *
crime_intr_establish(int irq, int level, int (*func)(void *), void *arg)
{
- if (irq < 8)
+ if (irq < 16)
return mace_intr_establish(irq, level, func, arg);
if (crime[irq].func != NULL)
@@ -209,8 +209,8 @@
crime_intstat = bus_space_read_8(crm_iot, crm_ioh, CRIME_INTSTAT);
crime_ipending = (crime_intstat & crime_intmask);
- if (crime_ipending & 0xff)
- mace_intr(crime_ipending & 0xff);
+ if (crime_ipending & 0xffff)
+ mace_intr(crime_ipending & 0xffff);
if (crime_ipending & 0xffff0000) {
/*
@@ -256,6 +256,16 @@
}
void
+crime_intr_unmask(unsigned int intr)
+{
+ u_int64_t mask;
+
+ mask = bus_space_read_8(crm_iot, crm_ioh, CRIME_INTMASK);
+ mask &= ~(1 << intr);
+ bus_space_write_8(crm_iot, crm_ioh, CRIME_INTMASK, mask);
+}
+
+void
crime_bus_reset(void)
{
bus_space_write_8(crm_iot, crm_ioh, CRIME_CPU_ERROR_STAT, 0);
diff -r 4b9d18321896 -r 29b8a7fed553 sys/arch/sgimips/dev/crimevar.h
--- a/sys/arch/sgimips/dev/crimevar.h Sun Sep 05 21:42:43 2004 +0000
+++ b/sys/arch/sgimips/dev/crimevar.h Mon Sep 06 07:24:06 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crimevar.h,v 1.3 2004/01/18 00:54:55 sekiya Exp $ */
+/* $NetBSD: crimevar.h,v 1.4 2004/09/06 07:24:06 sekiya Exp $ */
/*
* Copyright (c) 2003 Christopher SEKIYA
@@ -39,3 +39,4 @@
};
void crime_intr_mask(unsigned int);
+void crime_intr_unmask(unsigned int);
diff -r 4b9d18321896 -r 29b8a7fed553 sys/arch/sgimips/include/pci_machdep.h
--- a/sys/arch/sgimips/include/pci_machdep.h Sun Sep 05 21:42:43 2004 +0000
+++ b/sys/arch/sgimips/include/pci_machdep.h Mon Sep 06 07:24:06 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.h,v 1.5 2004/07/29 16:55:25 drochner Exp $ */
+/* $NetBSD: pci_machdep.h,v 1.6 2004/09/06 07:24:06 sekiya Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -55,6 +55,9 @@
pcireg_t (*pc_conf_read)(pci_chipset_tag_t, pcitag_t, int);
void (*pc_conf_write)(pci_chipset_tag_t, pcitag_t, int,
pcireg_t);
+ void *(*intr_establish)(int , int, int (*)(void *), void *);
+ void (*intr_disestablish)(void *ih);
+
bus_space_tag_t iot;
bus_space_handle_t ioh;
};
diff -r 4b9d18321896 -r 29b8a7fed553 sys/arch/sgimips/mace/mace.c
--- a/sys/arch/sgimips/mace/mace.c Sun Sep 05 21:42:43 2004 +0000
+++ b/sys/arch/sgimips/mace/mace.c Mon Sep 06 07:24:06 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mace.c,v 1.4 2004/07/10 08:47:33 tsutsui Exp $ */
+/* $NetBSD: mace.c,v 1.5 2004/09/06 07:24:06 sekiya Exp $ */
/*
* Copyright (c) 2003 Christopher Sekiya
@@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mace.c,v 1.4 2004/07/10 08:47:33 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mace.c,v 1.5 2004/09/06 07:24:06 sekiya Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -267,7 +267,7 @@
{
int i;
- if (intr < 0 || intr >= 8)
+ if (intr < 0 || intr >= 16)
panic("invalid interrupt number");
for (i = 0; i < MACE_NINTR; i++)
@@ -292,6 +292,41 @@
}
void
+mace_intr_disestablish(void *cookie)
+{
+ int intr = -1, level = 0, irq = 0, i;
+
+ for (i = 0; i < MACE_NINTR; i++)
+ if (&maceintrtab[i] == cookie) {
+ evcnt_detach(&maceintrtab[i].evcnt);
+ for (intr = 0;
+ maceintrtab[i].irq == (1 << intr); intr ++);
+ level = maceintrtab[i].intrmask;
+ irq = maceintrtab[i].irq;
+
+ maceintrtab[i].irq = 0;
+ maceintrtab[i].intrmask = 0;
+ maceintrtab[i].func = NULL;
+ maceintrtab[i].arg = NULL;
+ bzero(&maceintrtab[i].evcnt, sizeof (struct evcnt));
+ bzero(&maceintrtab[i].evname,
+ sizeof (maceintrtab[i].evname));
+ break;
+ }
+ if (intr == -1)
+ panic("mace: lost maceintrtab");
+
+ /* do not do a unmask, when irq is being shared. */
+ for (i = 0; i < MACE_NINTR; i++)
+ if (&maceintrtab[i].func != NULL && maceintrtab[i].irq == irq)
+ break;
+ if (i == MACE_NINTR)
+ crime_intr_unmask(intr);
+ aprint_normal("mace: disestablished interrupt %d (level %x)\n",
+ intr, level);
+}
+
+void
mace_intr(int irqs)
{
u_int64_t isa_irq, isa_mask;
diff -r 4b9d18321896 -r 29b8a7fed553 sys/arch/sgimips/mace/macevar.h
--- a/sys/arch/sgimips/mace/macevar.h Sun Sep 05 21:42:43 2004 +0000
+++ b/sys/arch/sgimips/mace/macevar.h Mon Sep 06 07:24:06 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: macevar.h,v 1.1 2004/01/18 04:06:43 sekiya Exp $ */
+/* $NetBSD: macevar.h,v 1.2 2004/09/06 07:24:06 sekiya Exp $ */
/*
* Copyright (c) 2000 Soren S. Jorvang
@@ -44,4 +44,5 @@
};
void * mace_intr_establish(int, int, int (*)(void *), void *);
+void mace_intr_disestablish(void *);
void mace_intr(int);
diff -r 4b9d18321896 -r 29b8a7fed553 sys/arch/sgimips/mace/pci_mace.c
--- a/sys/arch/sgimips/mace/pci_mace.c Sun Sep 05 21:42:43 2004 +0000
+++ b/sys/arch/sgimips/mace/pci_mace.c Mon Sep 06 07:24:06 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_mace.c,v 1.3 2004/08/30 15:05:18 drochner Exp $ */
+/* $NetBSD: pci_mace.c,v 1.4 2004/09/06 07:24:06 sekiya Exp $ */
/*
* Copyright (c) 2001,2003 Christopher Sekiya
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_mace.c,v 1.3 2004/08/30 15:05:18 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_mace.c,v 1.4 2004/09/06 07:24:06 sekiya Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -131,6 +131,8 @@
pc->pc_conf_read = macepci_conf_read;
pc->pc_conf_write = macepci_conf_write;
+ pc->intr_establish = mace_intr_establish;
+ pc->intr_disestablish = mace_intr_disestablish;
bus_space_write_4(pc->iot, pc->ioh, MACE_PCI_ERROR_ADDR, 0);
bus_space_write_4(pc->iot, pc->ioh, MACE_PCI_ERROR_FLAGS, 0);
diff -r 4b9d18321896 -r 29b8a7fed553 sys/arch/sgimips/pci/pci_machdep.c
--- a/sys/arch/sgimips/pci/pci_machdep.c Sun Sep 05 21:42:43 2004 +0000
+++ b/sys/arch/sgimips/pci/pci_machdep.c Mon Sep 06 07:24:06 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.c,v 1.13 2004/01/18 00:50:08 sekiya Exp $ */
+/* $NetBSD: pci_machdep.c,v 1.14 2004/09/06 07:24:06 sekiya Exp $ */
/*
* Copyright (c) 2000 Soren S. Jorvang
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.13 2004/01/18 00:50:08 sekiya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.14 2004/09/06 07:24:06 sekiya Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -213,7 +213,7 @@
void *arg;
{
- return (void *)(*platform.intr_establish)(ih, 0, func, arg);
+ return (void *)(pc->intr_establish)(ih, 0, func, arg);
}
void
@@ -222,5 +222,5 @@
void *cookie;
{
- panic("pci_intr_disestablish: not implemented");
+ (pc->intr_disestablish)(cookie);
}
Home |
Main Index |
Thread Index |
Old Index