Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/walnut Overhaul the interrupt system to use hardwar...
details: https://anonhg.NetBSD.org/src/rev/279b66787d20
branches: trunk
changeset: 517228:279b66787d20
user: eeh <eeh%NetBSD.org@localhost>
date: Thu Nov 08 23:28:13 2001 +0000
description:
Overhaul the interrupt system to use hardware interrupts directly.
diffstat:
sys/arch/walnut/conf/WALNUT | 12 ++-
sys/arch/walnut/include/intr.h | 29 +++++---
sys/arch/walnut/pci/pci_machdep.c | 23 ++++--
sys/arch/walnut/walnut/clock.c | 6 +-
sys/arch/walnut/walnut/extintr.c | 128 +++++--------------------------------
sys/arch/walnut/walnut/mainbus.c | 10 +-
6 files changed, 64 insertions(+), 144 deletions(-)
diffs (truncated from 417 to 300 lines):
diff -r 36be784cae25 -r 279b66787d20 sys/arch/walnut/conf/WALNUT
--- a/sys/arch/walnut/conf/WALNUT Thu Nov 08 22:45:45 2001 +0000
+++ b/sys/arch/walnut/conf/WALNUT Thu Nov 08 23:28:13 2001 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: WALNUT,v 1.5 2001/08/29 17:37:48 briggs Exp $
+# $NetBSD: WALNUT,v 1.6 2001/11/08 23:28:13 eeh Exp $
#
# GENERIC -- everything that's currently supported
#
@@ -38,7 +38,7 @@
options DDB # in-kernel debugger
options DDB_HISTORY_SIZE=512 # enable history editing in DDB
options TRAP_PANICWAIT
-options SYMTAB_SPACE=180000 # size for embedded symbol table
+options SYMTAB_SPACE=230000 # size for embedded symbol table
makeoptions DEBUG="-g" # compile full symbol table
@@ -101,6 +101,7 @@
options IPFILTER_LOG # ipmon(8) log support
#options TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG
options NMBCLUSTERS=1024
+options NEW_PIPE
# These options enable verbose messages for several subsystems.
# Warning, these may compile large string tables into the kernel!
@@ -127,11 +128,11 @@
cpu0 at mainbus0
# UARTs
-com0 at mainbus? addr 0xef600300 irq 5 # UIC IRQ 0
-com1 at mainbus? addr 0xef600400 irq 6 # UIC IRQ 1
+com0 at mainbus? addr 0xef600300 irq 0 # UIC IRQ 0
+com1 at mainbus? addr 0xef600400 irq 1 # UIC IRQ 1
# Ethernet Media Access Controller
-emac0 at mainbus? addr 0xef600800 irq 9 # UIC IRQ 15
+emac0 at mainbus? addr 0xef600800 irq 15 # UIC IRQ 15
# RTC
dsrtc0 at mainbus? addr 0xf0000000
@@ -252,3 +253,4 @@
pseudo-device vlan # IEEE 802.1q encapsulation
pseudo-device pty # pseudo-terminals
pseudo-device rnd # /dev/random and in-kernel generator
+pseudo-device wsmux 2 # ick
diff -r 36be784cae25 -r 279b66787d20 sys/arch/walnut/include/intr.h
--- a/sys/arch/walnut/include/intr.h Thu Nov 08 22:45:45 2001 +0000
+++ b/sys/arch/walnut/include/intr.h Thu Nov 08 23:28:13 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.2 2001/11/06 01:26:47 simonb Exp $ */
+/* $NetBSD: intr.h,v 1.3 2001/11/08 23:28:14 eeh Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -157,19 +157,26 @@
#define ICU_LEN 32
#define LEGAL_IRQ(x) ((x) >= 0 && (x) < ICU_LEN)
+#define IRQ_TO_MASK(x) (0x80000000UL >> (x))
-#define SINT_NET 0x20000000
-#define SINT_CLOCK 0x40000000
-#define SINT_SERIAL 0x80000000
-#define SPL_CLOCK 0x00000001
+/*
+ * Interrupts 19-24 are not used by hardware and therefore useable
+ * by us for softints.
+ */
+#define HWINT_MASK ~0x1fc0
+
+#define CNT_SINT_NET 19
+#define CNT_SINT_CLOCK 20
+#define CNT_SINT_SERIAL 21
+#define CNT_CLOCK 22
+#define CNT_STATCLOCK 23
+
+#define SINT_NET IRQ_TO_MASK(CNT_SINT_NET)
+#define SINT_CLOCK IRQ_TO_MASK(CNT_SINT_CLOCK)
+#define SINT_SERIAL IRQ_TO_MASK(CNT_SINT_SERIAL)
+#define SPL_CLOCK IRQ_TO_MASK(CNT_CLOCK)
#define SINT_MASK (SINT_CLOCK|SINT_NET|SINT_SERIAL)
-#define CNT_SINT_NET 29
-#define CNT_SINT_CLOCK 30
-#define CNT_SINT_SERIAL 31
-#define CNT_CLOCK 0
-#define CNT_STATCLOCK 32 /* note: make sure locore.S has enough space for it */
-
#define splbio() splraise(imask[IPL_BIO])
#define splnet() splraise(imask[IPL_NET])
#define spltty() splraise(imask[IPL_TTY])
diff -r 36be784cae25 -r 279b66787d20 sys/arch/walnut/pci/pci_machdep.c
--- a/sys/arch/walnut/pci/pci_machdep.c Thu Nov 08 22:45:45 2001 +0000
+++ b/sys/arch/walnut/pci/pci_machdep.c Thu Nov 08 23:28:13 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.c,v 1.4 2001/10/29 23:38:35 thorpej Exp $ */
+/* $NetBSD: pci_machdep.c,v 1.5 2001/11/08 23:28:15 eeh Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -171,14 +171,21 @@
goto bad;
}
- switch(dev){
- case 1: *ihp = 4; break; /* Slot 3 Ext IRQ 3 */
- case 2: *ihp = 3; break; /* Slot 2 Ext IRQ 4 */
- case 3: *ihp = 2; break; /* Slot 1 Ext IRQ 5 */
- case 4: *ihp = 1; break; /* Slot 0 Ext IRQ 6 */
+ /*
+ * We need to map the interrupt pin to the interrupt bit in the UIC
+ * associated with it. This is highly machine-dependent.
+ */
+ switch(dev) {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ *ihp = 27 + dev;
+ break;
default:
- printf("Hmm.. PCI device %d should not exist on this board\n", dev);
- goto bad;
+ printf("Hmm.. PCI device %d should not exist on this board\n",
+ dev);
+ goto bad;
}
return 0;
diff -r 36be784cae25 -r 279b66787d20 sys/arch/walnut/walnut/clock.c
--- a/sys/arch/walnut/walnut/clock.c Thu Nov 08 22:45:45 2001 +0000
+++ b/sys/arch/walnut/walnut/clock.c Thu Nov 08 23:28:13 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.1 2001/06/13 06:02:00 simonb Exp $ */
+/* $NetBSD: clock.c,v 1.2 2001/11/08 23:28:15 eeh Exp $ */
/* $OpenBSD: clock.c,v 1.3 1997/10/13 13:42:53 pefo Exp $ */
/*
@@ -101,9 +101,8 @@
lasttb = tick - xticks;
intrcnt[CNT_CLOCK]++;
-
pri = splclock();
- if (pri & SPL_CLOCK){
+ if (pri & SPL_CLOCK) {
tickspending += nticks;
ticksmissed+= nticks;
} else {
@@ -131,7 +130,6 @@
void
cpu_initclocks(void)
{
-
ticks_per_intr = ticks_per_sec / hz;
stathz = profhz = ticks_per_sec / (1<<PERIOD_POWER);
printf("Setting PIT to %ld/%d = %ld\n", ticks_per_sec, hz, ticks_per_intr);
diff -r 36be784cae25 -r 279b66787d20 sys/arch/walnut/walnut/extintr.c
--- a/sys/arch/walnut/walnut/extintr.c Thu Nov 08 22:45:45 2001 +0000
+++ b/sys/arch/walnut/walnut/extintr.c Thu Nov 08 23:28:13 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: extintr.c,v 1.3 2001/11/06 01:26:48 simonb Exp $ */
+/* $NetBSD: extintr.c,v 1.4 2001/11/08 23:28:15 eeh Exp $ */
/* $OpenBSD: isabus.c,v 1.1 1997/10/11 11:53:00 pefo Exp $ */
/*
@@ -87,48 +87,6 @@
#include <powerpc/spr.h>
#include <powerpc/ibm4xx/dcr.h>
-
-#define GALAXY_INTR(x) (0x80000000U >> x)
-
-/*
- * Galaxy interrupt list
- */
-#define GALAXY_INTR_UART0 GALAXY_INTR(0)
-#define GALAXY_INTR_UART1 GALAXY_INTR(1)
-#define GALAXY_INTR_IIC GALAXY_INTR(2)
-#define GALAXY_INTR_EMI GALAXY_INTR(3)
-#define GALAXY_INTR_PCI GALAXY_INTR(4)
-#define GALAXY_INTR_DMA0 GALAXY_INTR(5)
-#define GALAXY_INTR_DMA1 GALAXY_INTR(6)
-#define GALAXY_INTR_DMA2 GALAXY_INTR(7)
-#define GALAXY_INTR_DMA3 GALAXY_INTR(8)
-#define GALAXY_INTR_EWOL GALAXY_INTR(9)
-#define GALAXY_INTR_MSERR GALAXY_INTR(10)
-#define GALAXY_INTR_MTXE GALAXY_INTR(11)
-#define GALAXY_INTR_MRXE GALAXY_INTR(12)
-#define GALAXY_INTR_MTXD GALAXY_INTR(13)
-#define GALAXY_INTR_MRXD GALAXY_INTR(14)
-#define GALAXY_INTR_ETH GALAXY_INTR(15)
-#define GALAXY_INTR_PCISERR GALAXY_INTR(16)
-#define GALAXY_INTR_ECC GALAXY_INTR(17)
-#define GALAXY_INTR_PCIPM GALAXY_INTR(18)
-
-#define GALAXY_INTR_IRQ0 GALAXY_INTR(25)
-#define GALAXY_INTR_IRQ1 GALAXY_INTR(26)
-#define GALAXY_INTR_IRQ2 GALAXY_INTR(27)
-#define GALAXY_INTR_IRQ3 GALAXY_INTR(28)
-#define GALAXY_INTR_IRQ4 GALAXY_INTR(29)
-#define GALAXY_INTR_IRQ5 GALAXY_INTR(30)
-#define GALAXY_INTR_IRQ6 GALAXY_INTR(31)
-
-#define WALNUT_INTR_FPGA GALAXY_INTR_IRQ0
-#define WALNUT_INTR_SMI GALAXY_INTR_IRQ1
-#define WALNUT_INTR_PCI_S3 GALAXY_INTR_IRQ3
-#define WALNUT_INTR_PCI_S2 GALAXY_INTR_IRQ4
-#define WALNUT_INTR_PCI_S1 GALAXY_INTR_IRQ5
-#define WALNUT_INTR_PCI_S0 GALAXY_INTR_IRQ6
-
-
static inline void galaxy_disable_irq(int irq);
static inline void galaxy_enable_irq(int irq);
static void intr_calculatemasks(void);
@@ -144,31 +102,6 @@
static int intrtype[ICU_LEN], intrmask[ICU_LEN], intrlevel[ICU_LEN];
static struct intrhand *intrhand[ICU_LEN];
-/* SW irq# -> hw interrupt bitmask */
-static unsigned int galaxy_intr_map[] = {
- ~0U, /* Reserved for clock interrupts */
- WALNUT_INTR_PCI_S0, /* PCI dev 1 irq1 */
- WALNUT_INTR_PCI_S1, /* PCI dev 2 irq2 */
- WALNUT_INTR_PCI_S2, /* PCI dev 3 irq3 */
- WALNUT_INTR_PCI_S3, /* PCI dev 4 irq4 */
- GALAXY_INTR_UART0, /* com0 irq5 */
- GALAXY_INTR_UART1, /* com1 irq6 */
- GALAXY_INTR_IIC, /* iic irq7 */
- ~0U, /* irq8 - unused */
- GALAXY_INTR_EWOL, /* emac irq9 .. 15 */
- GALAXY_INTR_MSERR,
- GALAXY_INTR_MTXE,
- GALAXY_INTR_MRXE,
- GALAXY_INTR_MTXD,
- GALAXY_INTR_MRXD,
- GALAXY_INTR_ETH,
- WALNUT_INTR_FPGA, /* keyboard irq16 */
- WALNUT_INTR_SMI /* mouse irq17 */
-};
-#define GALAXY_INTR_SIZE (sizeof (galaxy_intr_map) / sizeof (galaxy_intr_map[0]))
-
-static uint32_t hwirq_mask; /* Mask sw interrupts in use */
-static int hw2swirq[32]; /* map MSR bit into sw irq#. */
static inline int
@@ -193,18 +126,7 @@
void
intr_init(void)
{
- int i;
- hwirq_mask = 0;
- for (i = 0; i < 32; i++)
- hw2swirq[i] = -1;
-
- for (i = 0; i < GALAXY_INTR_SIZE; i++) {
- if (galaxy_intr_map[i] == ~0U)
- continue;
- hwirq_mask |= (1 << i);
- hw2swirq[31 - cntlzw(galaxy_intr_map[i])] = i;
- }
}
/*
@@ -213,7 +135,7 @@
void
ext_intr(void)
{
- int i, irq, bits_to_clear;
+ int i, bits_to_clear;
int r_imen, msr;
int pcpl;
struct intrhand *ih;
@@ -226,25 +148,19 @@
bits_to_clear = int_state;
while (int_state) {
- i = 31 - cntlzw(int_state);
- int_state &= ~(1 << i);
+ i = cntlzw(int_state);
+ int_state &= ~IRQ_TO_MASK(i);
- irq = hw2swirq[i];
- if (irq == -1) {
- printf("Unexpected interrupt %d\n",i);
- continue;
- }
-
- r_imen = 1 << irq;
+ r_imen = IRQ_TO_MASK(i);
if ((pcpl & r_imen) != 0) {
ipending |= r_imen; /* Masked! Mark this as pending */
- galaxy_disable_irq(irq);
+ galaxy_disable_irq(i);
} else {
- splraise(intrmask[irq]);
Home |
Main Index |
Thread Index |
Old Index