Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch intr.h must not include cpu due to deadly embrace w...
details: https://anonhg.NetBSD.org/src/rev/c8e0120dc28d
branches: trunk
changeset: 766179:c8e0120dc28d
user: matt <matt%NetBSD.org@localhost>
date: Fri Jun 17 23:36:17 2011 +0000
description:
intr.h must not include cpu due to deadly embrace with SOFTINT_COUNT.
Cleanup intr.h so MD definitions can overload common definitions.
Rototill pic/intr.c. Virtual IRQs can now be reclaimed. separate virq
from hwirq from picirq. Redo intr mask calculations.
tested on pmppc and macppc (MP).
diffstat:
sys/arch/amigappc/include/intr.h | 6 +-
sys/arch/bebox/include/intr.h | 12 +-
sys/arch/evbppc/include/pmppc_intr.h | 4 +-
sys/arch/ibmnws/include/intr.h | 10 +-
sys/arch/macppc/include/intr.h | 6 +-
sys/arch/mvmeppc/include/intr.h | 14 +-
sys/arch/ofppc/include/intr.h | 10 +-
sys/arch/powerpc/include/intr.h | 28 +-
sys/arch/powerpc/pic/files.pic | 3 +-
sys/arch/powerpc/pic/intr.c | 366 ++++++++++++++--------------------
sys/arch/powerpc/pic/pic_subr.c | 49 ----
sys/arch/prep/include/intr.h | 13 +-
sys/arch/prep/pnpbus/if_we_pnpbus.c | 6 +-
sys/arch/rs6000/include/intr.h | 7 +-
sys/arch/sandpoint/include/intr.h | 3 +-
15 files changed, 207 insertions(+), 330 deletions(-)
diffs (truncated from 1022 to 300 lines):
diff -r 51fc6722d908 -r c8e0120dc28d sys/arch/amigappc/include/intr.h
--- a/sys/arch/amigappc/include/intr.h Fri Jun 17 23:15:09 2011 +0000
+++ b/sys/arch/amigappc/include/intr.h Fri Jun 17 23:36:17 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.24 2010/11/13 13:34:00 uebayasi Exp $ */
+/* $NetBSD: intr.h,v 1.25 2011/06/17 23:36:17 matt Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -44,8 +44,4 @@
#endif
#include <powerpc/intr.h>
-#ifndef _LOCORE
-#include <machine/cpu.h>
-#endif /* _LOCORE */
-
#endif /* !_AMIGAPPC_INTR_H_ */
diff -r 51fc6722d908 -r c8e0120dc28d sys/arch/bebox/include/intr.h
--- a/sys/arch/bebox/include/intr.h Fri Jun 17 23:15:09 2011 +0000
+++ b/sys/arch/bebox/include/intr.h Fri Jun 17 23:36:17 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.29 2010/04/24 09:39:56 kiyohara Exp $ */
+/* $NetBSD: intr.h,v 1.30 2011/06/17 23:36:17 matt Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -42,12 +42,12 @@
extern paddr_t bebox_mb_reg;
-#define ICU_LEN 32
-#define IRQ_SLAVE 2
-#define LEGAL_IRQ(x) ((x) >= 0 && (x) < ICU_LEN && (x) != IRQ_SLAVE)
+#define ICU_LEN 32
+#define IRQ_SLAVE 2
+#define LEGAL_HWIRQ_P(x) ((u_int)(x) < ICU_LEN && (x) != IRQ_SLAVE)
-#define BEBOX_INTR_REG 0x7ffff000
-#define INTR_VECTOR_REG 0xff0
+#define BEBOX_INTR_REG 0x7ffff000
+#define INTR_VECTOR_REG 0xff0
#endif /* !_LOCORE */
diff -r 51fc6722d908 -r c8e0120dc28d sys/arch/evbppc/include/pmppc_intr.h
--- a/sys/arch/evbppc/include/pmppc_intr.h Fri Jun 17 23:15:09 2011 +0000
+++ b/sys/arch/evbppc/include/pmppc_intr.h Fri Jun 17 23:36:17 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmppc_intr.h,v 1.3 2008/04/28 20:23:17 martin Exp $ */
+/* $NetBSD: pmppc_intr.h,v 1.4 2011/06/17 23:36:17 matt Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
#define ICU_LEN 32
#define ICU_MASK 0x1f000fc0
-#define LEGAL_IRQ(x) ((x) >= 0 && (x) <= 31 && (ICU_MASK & (0x80000000 >> (x))))
+#define LEGAL_HWIRQ_P(x) ((u_int)(x) < ICU_LEN && (ICU_MASK & (0x80000000 >> (x))))
#endif /* !_LOCORE */
diff -r 51fc6722d908 -r c8e0120dc28d sys/arch/ibmnws/include/intr.h
--- a/sys/arch/ibmnws/include/intr.h Fri Jun 17 23:15:09 2011 +0000
+++ b/sys/arch/ibmnws/include/intr.h Fri Jun 17 23:36:17 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.14 2010/11/13 14:07:07 uebayasi Exp $ */
+/* $NetBSD: intr.h,v 1.15 2011/06/17 23:36:17 matt Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -32,11 +32,7 @@
#ifndef _IBMNWS_INTR_H_
#define _IBMNWS_INTR_H_
-#include <powerpc/intr.h>
-
#ifndef _LOCORE
-#include <machine/cpu.h>
-
void init_intr_ivr(void);
void init_intr_openpic(void);
void openpic_init(unsigned char *);
@@ -49,7 +45,7 @@
#define ICU_LEN 32
#define IRQ_SLAVE 2
-#define LEGAL_IRQ(x) ((x) >= 0 && (x) < ICU_LEN && (x) != IRQ_SLAVE)
+#define LEGAL_HWIRQ_P(x) ((u_int)(x) < ICU_LEN && (x) != IRQ_SLAVE)
#define I8259_INTR_NUM 16
#define PREP_INTR_REG 0xbffff000
@@ -57,4 +53,6 @@
#endif /* !_LOCORE */
+#include <powerpc/intr.h>
+
#endif /* !_IBMNWS_INTR_H_ */
diff -r 51fc6722d908 -r c8e0120dc28d sys/arch/macppc/include/intr.h
--- a/sys/arch/macppc/include/intr.h Fri Jun 17 23:15:09 2011 +0000
+++ b/sys/arch/macppc/include/intr.h Fri Jun 17 23:36:17 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.29 2011/06/17 05:18:10 matt Exp $ */
+/* $NetBSD: intr.h,v 1.30 2011/06/17 23:36:17 matt Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -32,8 +32,6 @@
#ifndef _MACPPC_INTR_H_
#define _MACPPC_INTR_H_
-#include <powerpc/intr.h>
-
#ifdef _KERNEL_OPT
#include "opt_multiprocessor.h"
#endif
@@ -59,4 +57,6 @@
#endif
#endif /* _LOCORE */
+#include <powerpc/intr.h>
+
#endif /* _MACPPC_INTR_H_ */
diff -r 51fc6722d908 -r c8e0120dc28d sys/arch/mvmeppc/include/intr.h
--- a/sys/arch/mvmeppc/include/intr.h Fri Jun 17 23:15:09 2011 +0000
+++ b/sys/arch/mvmeppc/include/intr.h Fri Jun 17 23:36:17 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.14 2010/04/24 09:39:57 kiyohara Exp $ */
+/* $NetBSD: intr.h,v 1.15 2011/06/17 23:36:17 matt Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -32,8 +32,6 @@
#ifndef _MVMEPPC_INTR_H_
#define _MVMEPPC_INTR_H_
-#include <powerpc/intr.h>
-
#ifndef _LOCORE
void enable_intr(void);
@@ -41,13 +39,15 @@
extern vaddr_t mvmeppc_intr_reg;
-#define ICU_LEN 32
-#define IRQ_SLAVE 2
-#define LEGAL_IRQ(x) ((x) >= 0 && (x) < ICU_LEN && (x) != IRQ_SLAVE)
+#define ICU_LEN 32
+#define IRQ_SLAVE 2
+#define LEGAL_HWIRQ_P(x) ((u_int)(x) < ICU_LEN && (x) != IRQ_SLAVE)
#define MVMEPPC_INTR_REG 0xbffff000
-#define INTR_VECTOR_REG 0xff0
+#define INTR_VECTOR_REG 0xff0
#endif /* !_LOCORE */
+#include <powerpc/intr.h>
+
#endif /* !_MVMEPPC_INTR_H_ */
diff -r 51fc6722d908 -r c8e0120dc28d sys/arch/ofppc/include/intr.h
--- a/sys/arch/ofppc/include/intr.h Fri Jun 17 23:15:09 2011 +0000
+++ b/sys/arch/ofppc/include/intr.h Fri Jun 17 23:36:17 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.15 2011/06/05 16:52:24 matt Exp $ */
+/* $NetBSD: intr.h,v 1.16 2011/06/17 23:36:17 matt Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -32,21 +32,19 @@
#ifndef _OFPPC_INTR_H_
#define _OFPPC_INTR_H_
+#ifndef _LOCORE
#ifdef _KERNEL_OPT
#include "opt_multiprocessor.h"
#endif
-
-#include <powerpc/intr.h>
-
-#ifndef _LOCORE
#ifdef MULTIPROCESSOR
#include <powerpc/pic/ipivar.h>
#endif
-#include <machine/cpu.h>
#define ICU_LEN 32
#define IRQ_SLAVE 2
#endif
+#include <powerpc/intr.h>
+
#endif /* _OFPPC_INTR_H_ */
diff -r 51fc6722d908 -r c8e0120dc28d sys/arch/powerpc/include/intr.h
--- a/sys/arch/powerpc/include/intr.h Fri Jun 17 23:15:09 2011 +0000
+++ b/sys/arch/powerpc/include/intr.h Fri Jun 17 23:36:17 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.7 2011/06/17 05:15:22 matt Exp $ */
+/* $NetBSD: intr.h,v 1.8 2011/06/17 23:36:17 matt Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@@ -28,7 +28,7 @@
#ifndef _LOCORE
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.h,v 1.7 2011/06/17 05:15:22 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.h,v 1.8 2011/06/17 23:36:17 matt Exp $");
#endif
#ifndef POWERPC_INTR_MACHDEP_H
@@ -60,10 +60,6 @@
#define IST_EDGE 2 /* edge-triggered */
#define IST_LEVEL 3 /* level-triggered */
-#ifdef _LOCORE
-#define splhigh __splhigh
-#endif
-
#ifndef _LOCORE
/*
* Interrupt handler chains. intr_establish() inserts a handler into
@@ -74,7 +70,7 @@
void *ih_arg;
struct intrhand *ih_next;
int ih_ipl;
- int ih_irq;
+ int ih_virq;
};
int splraise(int);
@@ -86,16 +82,24 @@
#define softint_init_md powerpc_softint_init_md
#define softint_trigger powerpc_softint_trigger
-typedef u_int imask_t;
+#ifdef __IMASK_T
+typedef __IMASK_T imask_t;
+#else
+typedef uint32_t imask_t;
+#endif
+
extern imask_t imask[];
-#define NVIRQ 32 /* 32 virtual IRQs */
+#define NVIRQ (sizeof(imask_t)*8) /* 32 virtual IRQs */
+#ifndef NIRQ
#define NIRQ 128 /* up to 128 HW IRQs */
+#endif
-#define HWIRQ_MAX (NVIRQ - 5 - 1)
-#define HWIRQ_MASK 0x07ffffff
+#define HWIRQ_MAX (NVIRQ - 1)
+#define HWIRQ_MASK (~(imask_t)0 >> 1)
-#define MS_PENDING(p) (31 - cntlzw(p))
+#define PIC_VIRQ_TO_MASK(v) __BIT(HWIRQ_MAX - (v))
+#define PIC_VIRQ_MS_PENDING(p) __builtin_clz(p)
#define spl0() spllower(0)
diff -r 51fc6722d908 -r c8e0120dc28d sys/arch/powerpc/pic/files.pic
--- a/sys/arch/powerpc/pic/files.pic Fri Jun 17 23:15:09 2011 +0000
+++ b/sys/arch/powerpc/pic/files.pic Fri Jun 17 23:36:17 2011 +0000
@@ -1,10 +1,9 @@
#
-# $NetBSD: files.pic,v 1.6 2011/06/16 02:43:43 macallan Exp $
+# $NetBSD: files.pic,v 1.7 2011/06/17 23:36:18 matt Exp $
#
# generic PIC abstraction
file arch/powerpc/pic/intr.c
-file arch/powerpc/pic/pic_subr.c
defflag opt_pic.h PIC_DEBUG
diff -r 51fc6722d908 -r c8e0120dc28d sys/arch/powerpc/pic/intr.c
--- a/sys/arch/powerpc/pic/intr.c Fri Jun 17 23:15:09 2011 +0000
+++ b/sys/arch/powerpc/pic/intr.c Fri Jun 17 23:36:17 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.c,v 1.14 2011/06/17 05:15:23 matt Exp $ */
+/* $NetBSD: intr.c,v 1.15 2011/06/17 23:36:18 matt Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.14 2011/06/17 05:15:23 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.15 2011/06/17 23:36:18 matt Exp $");
#include "opt_multiprocessor.h"
@@ -55,29 +55,27 @@
Home |
Main Index |
Thread Index |
Old Index