Port-m68k archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: diffs around makeiplcookie()
I wrote:
> I prefer:
> 1) make makeiplcookie() inline (and export ipl2psl_table[])
> 2) use ipl2psl_table[] (including hp300 and mac68k)
> 3) put conversion into makeiplcookie(),
> but also put PSL_S into ipl2psl_table[]
> 4) use uint16_t (rather than u_short)
> 5) use _psl
Here is a diff for hp300, news68k and sun68ks:
(though -current hp300 and news68k kernels without DIAGNOSTIC get panic
in pmap_ptpage_addref() even without this patch)
---
Index: arch/hp300/dev/dma.c
===================================================================
RCS file: /cvsroot/src/sys/arch/hp300/dev/dma.c,v
retrieving revision 1.40
diff -u -r1.40 dma.c
--- arch/hp300/dev/dma.c 28 Apr 2008 20:23:19 -0000 1.40
+++ arch/hp300/dev/dma.c 14 Jun 2008 02:31:13 -0000
@@ -272,7 +272,7 @@
* Our interrupt level must be as high as the highest
* device using DMA (i.e. splbio).
*/
- sc->sc_ipl = PSLTOIPL(hp300_ipl2psl[IPL_BIO]);
+ sc->sc_ipl = PSLTOIPL(ipl2psl_table[IPL_BIO]);
sc->sc_ih = intr_establish(dmaintr, sc, sc->sc_ipl, IPL_BIO);
}
Index: arch/hp300/hp300/intr.c
===================================================================
RCS file: /cvsroot/src/sys/arch/hp300/hp300/intr.c,v
retrieving revision 1.34
diff -u -r1.34 intr.c
--- arch/hp300/hp300/intr.c 28 Apr 2008 20:23:19 -0000 1.34
+++ arch/hp300/hp300/intr.c 14 Jun 2008 02:31:13 -0000
@@ -66,7 +66,7 @@
"nmi",
};
-u_short hp300_ipl2psl[NIPL];
+uint16_t ipl2psl_table[NIPL];
volatile uint8_t ssir;
int idepth;
@@ -88,14 +88,14 @@
}
/* Default interrupt priorities. */
- hp300_ipl2psl[IPL_NONE] = 0;
- hp300_ipl2psl[IPL_SOFTCLOCK] = PSL_S|PSL_IPL1;
- hp300_ipl2psl[IPL_SOFTNET] = PSL_S|PSL_IPL1;
- hp300_ipl2psl[IPL_SOFTSERIAL] = PSL_S|PSL_IPL1;
- hp300_ipl2psl[IPL_SOFTBIO] = PSL_S|PSL_IPL1;
- hp300_ipl2psl[IPL_VM] = PSL_S|PSL_IPL3;
- hp300_ipl2psl[IPL_SCHED] = PSL_S|PSL_IPL6;
- hp300_ipl2psl[IPL_HIGH] = PSL_S|PSL_IPL7;
+ ipl2psl_table[IPL_NONE] = 0;
+ ipl2psl_table[IPL_SOFTCLOCK] = PSL_S|PSL_IPL1;
+ ipl2psl_table[IPL_SOFTNET] = PSL_S|PSL_IPL1;
+ ipl2psl_table[IPL_SOFTSERIAL] = PSL_S|PSL_IPL1;
+ ipl2psl_table[IPL_SOFTBIO] = PSL_S|PSL_IPL1;
+ ipl2psl_table[IPL_VM] = PSL_S|PSL_IPL3;
+ ipl2psl_table[IPL_SCHED] = PSL_S|PSL_IPL6;
+ ipl2psl_table[IPL_HIGH] = PSL_S|PSL_IPL7;
}
/*
@@ -109,7 +109,7 @@
int ipl;
/* Start with low values. */
- hp300_ipl2psl[IPL_VM] = PSL_S|PSL_IPL3;
+ ipl2psl_table[IPL_VM] = PSL_S|PSL_IPL3;
for (ipl = 0; ipl < NISR; ipl++) {
for (ih = LIST_FIRST(&hp300_intr_list[ipl].hi_q); ih != NULL;
@@ -120,8 +120,8 @@
*/
switch (ih->ih_priority) {
case IPL_VM:
- if (ipl > PSLTOIPL(hp300_ipl2psl[IPL_VM]))
- hp300_ipl2psl[IPL_VM] = IPLTOPSL(ipl);
+ if (ipl > PSLTOIPL(ipl2psl_table[IPL_VM]))
+ ipl2psl_table[IPL_VM] = IPLTOPSL(ipl);
break;
default:
printf("priority = %d\n", ih->ih_priority);
@@ -136,7 +136,7 @@
{
printf("interrupt levels: vm = %d\n",
- PSLTOIPL(hp300_ipl2psl[IPL_VM]));
+ PSLTOIPL(ipl2psl_table[IPL_VM]));
}
/*
Index: arch/hp300/include/intr.h
===================================================================
RCS file: /cvsroot/src/sys/arch/hp300/include/intr.h,v
retrieving revision 1.28
diff -u -r1.28 intr.h
--- arch/hp300/include/intr.h 28 Apr 2008 20:23:19 -0000 1.28
+++ arch/hp300/include/intr.h 14 Jun 2008 02:31:13 -0000
@@ -63,7 +63,7 @@
#define IPLTOPSL(x) ((((x) & 0xf) << 8) | PSL_S)
extern int idepth;
-extern u_short hp300_ipl2psl[];
+extern uint16_t ipl2psl_table[NIPL];
typedef int ipl_t;
typedef struct {
@@ -74,7 +74,7 @@
makeiplcookie(ipl_t ipl)
{
- return (ipl_cookie_t){._psl = hp300_ipl2psl[ipl]};
+ return (ipl_cookie_t){._psl = ipl2psl_table[ipl]};
}
static inline int
@@ -94,7 +94,7 @@
#define splsoftclock() splraise1()
#define splsoftnet() splraise1()
#define splsoftserial() splraise1()
-#define splvm() _splraise(hp300_ipl2psl[IPL_VM])
+#define splvm() _splraise(ipl2psl_table[IPL_VM])
#define splsched() spl6()
#define splhigh() spl7()
Index: arch/news68k/include/intr.h
===================================================================
RCS file: /cvsroot/src/sys/arch/news68k/include/intr.h,v
retrieving revision 1.21
diff -u -r1.21 intr.h
--- arch/news68k/include/intr.h 30 Apr 2008 08:13:24 -0000 1.21
+++ arch/news68k/include/intr.h 14 Jun 2008 02:31:13 -0000
@@ -44,17 +44,23 @@
#define IPL_SOFTSERIAL 4
#define IPL_VM 5
#define IPL_SCHED 6
-#define IPL_HIGH 6
-#define NIPL 7
+#define IPL_HIGH 7
+#define NIPL 8
extern int idepth;
+extern const uint16_t ipl2psl_table[NIPL];
typedef int ipl_t;
typedef struct {
uint16_t _psl;
} ipl_cookie_t;
-ipl_cookie_t makeiplcookie(ipl_t);
+static inline ipl_cookie_t
+makeiplcookie(ipl_t ipl)
+{
+
+ return (ipl_cookie_t){._psl = ipl2psl_table[ipl]};
+}
static inline int
splraiseipl(ipl_cookie_t icookie)
Index: arch/news68k/news68k/isr.c
===================================================================
RCS file: /cvsroot/src/sys/arch/news68k/news68k/isr.c,v
retrieving revision 1.17
diff -u -r1.17 isr.c
--- arch/news68k/news68k/isr.c 28 Apr 2008 20:23:30 -0000 1.17
+++ arch/news68k/news68k/isr.c 14 Jun 2008 02:31:13 -0000
@@ -304,19 +304,13 @@
return (void *)vectab[entry];
}
-static const int ipl2psl_table[] = {
- [IPL_NONE] = PSL_IPL0,
- [IPL_SOFTBIO] = PSL_IPL2,
- [IPL_SOFTCLOCK] = PSL_IPL2,
- [IPL_SOFTNET] = PSL_IPL2,
- [IPL_SOFTSERIAL] = PSL_IPL2,
- [IPL_VM] = PSL_IPL5,
- [IPL_SCHED] = PSL_IPL7,
+const uint16_t ipl2psl_table[NIPL] = {
+ [IPL_NONE] = PSL_S | PSL_IPL0,
+ [IPL_SOFTCLOCK] = PSL_S | PSL_IPL2,
+ [IPL_SOFTBIO] = PSL_S | PSL_IPL2,
+ [IPL_SOFTNET] = PSL_S | PSL_IPL2,
+ [IPL_SOFTSERIAL] = PSL_S | PSL_IPL2,
+ [IPL_VM] = PSL_S | PSL_IPL5,
+ [IPL_SCHED] = PSL_S | PSL_IPL7,
+ [IPL_HIGH] = PSL_S | PSL_IPL7,
};
-
-ipl_cookie_t
-makeiplcookie(ipl_t ipl)
-{
-
- return (ipl_cookie_t){._psl = ipl2psl_table[ipl] | PSL_S};
-}
Index: arch/sun68k/include/intr.h
===================================================================
RCS file: /cvsroot/src/sys/arch/sun68k/include/intr.h,v
retrieving revision 1.18
diff -u -r1.18 intr.h
--- arch/sun68k/include/intr.h 26 Jan 2008 14:02:54 -0000 1.18
+++ arch/sun68k/include/intr.h 14 Jun 2008 02:31:13 -0000
@@ -47,6 +47,7 @@
#define IPL_VM 5
#define IPL_SCHED 6
#define IPL_HIGH 7
+#define NIPL 8
#define _IPL_SOFT_LEVEL1 1
#define _IPL_SOFT_LEVEL2 2
@@ -57,13 +58,19 @@
#ifdef _KERNEL
extern int idepth;
+extern const uint16_t ipl2psl_table[NIPL];
typedef int ipl_t;
typedef struct {
uint16_t _psl;
} ipl_cookie_t;
-ipl_cookie_t makeiplcookie(ipl_t ipl);
+static inline ipl_cookie_t
+makeiplcookie(ipl_t ipl)
+{
+
+ return (ipl_cookie_t){._psl = ipl2psl_table[ipl]};
+}
static inline int
splraiseipl(ipl_cookie_t icookie)
Index: arch/sun68k/sun68k/isr.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sun68k/sun68k/isr.c,v
retrieving revision 1.21
diff -u -r1.21 isr.c
--- arch/sun68k/sun68k/isr.c 28 Apr 2008 20:23:39 -0000 1.21
+++ arch/sun68k/sun68k/isr.c 14 Jun 2008 02:31:13 -0000
@@ -258,20 +258,13 @@
return (void *)vector_table[entry];
}
-static const int ipl2psl_table[] = {
- [IPL_NONE] = PSL_IPL0,
- [IPL_SOFTBIO] = PSL_IPL1,
- [IPL_SOFTCLOCK] = PSL_IPL1,
- [IPL_SOFTNET] = PSL_IPL1,
- [IPL_SOFTSERIAL] = PSL_IPL3,
- [IPL_VM] = PSL_IPL4,
- [IPL_SCHED] = PSL_IPL6,
- [IPL_HIGH] = PSL_IPL7,
+const uint16_t ipl2psl_table[NIPL] = {
+ [IPL_NONE] = PSL_S | PSL_IPL0,
+ [IPL_SOFTBIO] = PSL_S | PSL_IPL1,
+ [IPL_SOFTCLOCK] = PSL_S | PSL_IPL1,
+ [IPL_SOFTNET] = PSL_S | PSL_IPL1,
+ [IPL_SOFTSERIAL] = PSL_S | PSL_IPL3,
+ [IPL_VM] = PSL_S | PSL_IPL4,
+ [IPL_SCHED] = PSL_S | PSL_IPL6,
+ [IPL_HIGH] = PSL_S | PSL_IPL7,
};
-
-ipl_cookie_t
-makeiplcookie(ipl_t ipl)
-{
-
- return (ipl_cookie_t){._psl = ipl2psl_table[ipl] | PSL_S};
-}
---
Izumi Tsutsui
Home |
Main Index |
Thread Index |
Old Index