Move spl macros from <machine/param.h> to <machine/intr.h>
Fix botch on my part and make the IPL_* match reality on VAX. Redefine spl macro using the symbolic IPL_ instead of being hardcoded. Move schedsoftnet, schedsoftclock from <machine/cpu.h> to <machine/intr.h> Add a _setsirr macro for schedsoft*. Add softintr function and framework.
This commit is contained in:
parent
fb6a3dfb64
commit
b8cccfafd8
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: cpu.h,v 1.49 2000/05/31 23:55:52 matt Exp $ */
|
/* $NetBSD: cpu.h,v 1.50 2000/06/02 21:47:02 matt Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994 Ludd, University of Lule}, Sweden
|
* Copyright (c) 1994 Ludd, University of Lule}, Sweden
|
||||||
@ -111,9 +111,6 @@ struct cpu_info {
|
|||||||
|
|
||||||
extern int mastercpu;
|
extern int mastercpu;
|
||||||
|
|
||||||
#define setsoftnet() mtpr(12,PR_SIRR)
|
|
||||||
#define setsoftclock() mtpr(8,PR_SIRR)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Notify the current process (p) that it has a signal pending,
|
* Notify the current process (p) that it has a signal pending,
|
||||||
* process as soon as possible.
|
* process as soon as possible.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: intr.h,v 1.1 1998/08/18 23:55:00 matt Exp $ */
|
/* $NetBSD: intr.h,v 1.2 2000/06/02 21:47:02 matt Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998 Matt Thomas.
|
* Copyright (c) 1998 Matt Thomas.
|
||||||
@ -32,19 +32,33 @@
|
|||||||
#ifndef _VAX_INTR_H_
|
#ifndef _VAX_INTR_H_
|
||||||
#define _VAX_INTR_H_
|
#define _VAX_INTR_H_
|
||||||
|
|
||||||
|
#include <sys/queue.h>
|
||||||
|
|
||||||
/* Define the various Interrupt Priority Levels */
|
/* Define the various Interrupt Priority Levels */
|
||||||
|
|
||||||
/* Interrupt Priority Levels are not mutually exclusive. */
|
/* Interrupt Priority Levels are not mutually exclusive. */
|
||||||
|
|
||||||
#define IPL_BIO 0 /* block I/O */
|
/* Hardware interrupt levels are 16 (0x10) thru 31 (0x1f)
|
||||||
#define IPL_NET 1 /* network */
|
*/
|
||||||
#define IPL_TTY 2 /* terminal */
|
#define IPL_HIGH 0x1f /* high -- blocks all interrupts */
|
||||||
#define IPL_IMP 3 /* memory allocation */
|
#define IPL_CLOCK 0x18 /* clock */
|
||||||
#define IPL_AUDIO 4 /* audio */
|
#define IPL_UBA 0x17 /* unibus adapters */
|
||||||
#define IPL_CLOCK 5 /* clock */
|
#define IPL_IMP 0x17 /* memory allocation */
|
||||||
#define IPL_NONE 6
|
#define IPL_BIO 0x15 /* block I/O */
|
||||||
|
#define IPL_NET 0x15 /* network */
|
||||||
|
#define IPL_TTY 0x15 /* terminal */
|
||||||
|
#define IPL_AUDIO 0x15 /* audio */
|
||||||
|
#define IPL_CONSMEDIA 0x14 /* console media */
|
||||||
|
|
||||||
#define IPL_LEVELS 7
|
/* Software interrupt level s are 0 (0x00) thru 15 (0x0f)
|
||||||
|
*/
|
||||||
|
#define IPL_SOFTDDB 0x0f /* used by DDB on VAX */
|
||||||
|
#define IPL_SOFTSERIAL 0x0d /* soft serial */
|
||||||
|
#define IPL_SOFTNET 0x0c /* soft network */
|
||||||
|
#define IPL_SOFTCLOCK 0x08
|
||||||
|
#define IPL_NONE 0x00
|
||||||
|
|
||||||
|
#define IPL_LEVELS 32
|
||||||
|
|
||||||
#define IST_UNUSABLE -1 /* interrupt cannot be used */
|
#define IST_UNUSABLE -1 /* interrupt cannot be used */
|
||||||
#define IST_NONE 0 /* none (dummy) */
|
#define IST_NONE 0 /* none (dummy) */
|
||||||
@ -52,6 +66,97 @@
|
|||||||
#define IST_EDGE 2 /* edge-triggered */
|
#define IST_EDGE 2 /* edge-triggered */
|
||||||
#define IST_LEVEL 3 /* level-triggered */
|
#define IST_LEVEL 3 /* level-triggered */
|
||||||
|
|
||||||
#include <machine/param.h>
|
|
||||||
|
|
||||||
|
#ifdef _KERNEL
|
||||||
|
#ifndef lint
|
||||||
|
#define splx(reg) \
|
||||||
|
({ \
|
||||||
|
register int val; \
|
||||||
|
__asm __volatile ("mfpr $0x12,%0;mtpr %1,$0x12" \
|
||||||
|
: "&=g" (val) \
|
||||||
|
: "g" (reg)); \
|
||||||
|
val; \
|
||||||
|
})
|
||||||
|
|
||||||
|
#define _splraise(reg) \
|
||||||
|
({ \
|
||||||
|
register int val; \
|
||||||
|
__asm __volatile ("mfpr $0x12,%0" \
|
||||||
|
: "&=g" (val) \
|
||||||
|
: ); \
|
||||||
|
if ((reg) > val) { \
|
||||||
|
__asm __volatile ("mtpr %0,$0x12" \
|
||||||
|
: \
|
||||||
|
: "g" (reg)); \
|
||||||
|
} \
|
||||||
|
val; \
|
||||||
|
})
|
||||||
|
#define _setsirr(reg) \
|
||||||
|
({ \
|
||||||
|
__asm __volatile ("mtpr %0,$0x14" \
|
||||||
|
: \
|
||||||
|
: "g" (reg)); \
|
||||||
|
})
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define spl0() splx(IPL_NONE) /* IPL0 */
|
||||||
|
#define spllowersoftclock() splx(IPL_SOFTCLOCK) /* IPL08 */
|
||||||
|
#define splsoftclock() _splraise(IPL_SOFTCLOCK) /* IPL08 */
|
||||||
|
#define splsoftnet() _splraise(IPL_SOFTNET) /* IPL0C */
|
||||||
|
#define splsoftserial() _splraise(IPL_SOFTSERIAL) /* IPL0D */
|
||||||
|
#define splddb() _splraise(IPL_SOFTDDB) /* IPL0F */
|
||||||
|
#define splconsmedia() _splraise(IPL_CONSMEDIA) /* IPL14 */
|
||||||
|
#define splbio() _splraise(IPL_BIO) /* IPL15 */
|
||||||
|
#define splnet() _splraise(IPL_NET) /* IPL15 */
|
||||||
|
#define spltty() _splraise(IPL_TTY) /* IPL15 */
|
||||||
|
#define splimp() _splraise(IPL_IMP) /* IPL17 */
|
||||||
|
#define splclock() _splraise(IPL_CLOCK) /* IPL18 */
|
||||||
|
#define splhigh() _splraise(IPL_HIGH) /* IPL1F */
|
||||||
|
#define splstatclock() splclock()
|
||||||
|
|
||||||
|
/* These are better to use when playing with VAX buses */
|
||||||
|
#define spl4() splx(0x14)
|
||||||
|
#define spl5() splx(0x15)
|
||||||
|
#define spl6() splx(0x16)
|
||||||
|
#define spl7() splx(0x17)
|
||||||
|
|
||||||
|
/* schedule software interrupts
|
||||||
|
*/
|
||||||
|
#define setsoftddb() _setsirr(IPL_SOFTDDB)
|
||||||
|
#define setsoftserial() _setsirr(IPL_SOFTSERIAL)
|
||||||
|
#define setsoftnet() _setsirr(IPL_SOFTNET)
|
||||||
|
#define setsoftclock() _setsirr(IPL_SOFTCLOCK)
|
||||||
|
|
||||||
|
#define __GENERIC_SOFT_INTERRUPTS
|
||||||
|
|
||||||
|
#if !defined(_LOCORE)
|
||||||
|
LIST_HEAD(sh_head, softintr_handler);
|
||||||
|
|
||||||
|
struct softintr_head {
|
||||||
|
int shd_ipl;
|
||||||
|
struct sh_head shd_intrs;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct softintr_handler {
|
||||||
|
struct softintr_head *sh_head;
|
||||||
|
LIST_ENTRY(softintr_handler) sh_link;
|
||||||
|
void (*sh_func)(void *);
|
||||||
|
void *sh_arg;
|
||||||
|
int sh_pending;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern void *softintr_establish(int, void (*)(void *), void *);
|
||||||
|
extern void softintr_disestablish(void *);
|
||||||
|
|
||||||
|
static __inline void
|
||||||
|
softintr_schedule(void *arg)
|
||||||
|
{
|
||||||
|
struct softintr_handler * const sh = arg;
|
||||||
|
int s = _splraise(sh->sh_head->shd_ipl); /* movl @(r0), ... */
|
||||||
|
sh->sh_pending = 1;
|
||||||
|
_setsirr(sh->sh_head->shd_ipl);
|
||||||
|
splx(s);
|
||||||
|
}
|
||||||
|
#endif /* _LOCORE */
|
||||||
|
#endif /* _KERNEL */
|
||||||
#endif /* _VAX_INTR_H */
|
#endif /* _VAX_INTR_H */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: param.h,v 1.42 2000/03/07 00:05:59 matt Exp $ */
|
/* $NetBSD: param.h,v 1.43 2000/06/02 21:47:02 matt Exp $ */
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1990 The Regents of the University of California.
|
* Copyright (c) 1990 The Regents of the University of California.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -161,49 +161,7 @@
|
|||||||
#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
|
#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
|
||||||
|
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
#ifndef lint
|
#include <machine/intr.h>
|
||||||
#define splx(reg) \
|
|
||||||
({ \
|
|
||||||
register int val; \
|
|
||||||
__asm __volatile ("mfpr $0x12,%0;mtpr %1,$0x12" \
|
|
||||||
: "&=g" (val) \
|
|
||||||
: "g" (reg)); \
|
|
||||||
val; \
|
|
||||||
})
|
|
||||||
|
|
||||||
#define _splraise(reg) \
|
|
||||||
({ \
|
|
||||||
register int val; \
|
|
||||||
__asm __volatile ("mfpr $0x12,%0" \
|
|
||||||
: "&=g" (val) \
|
|
||||||
: ); \
|
|
||||||
if ((reg) > val) { \
|
|
||||||
__asm __volatile ("mtpr %0,$0x12" \
|
|
||||||
: \
|
|
||||||
: "g" (reg)); \
|
|
||||||
} \
|
|
||||||
val; \
|
|
||||||
})
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define spl0() splx(0) /* IPL0 */
|
|
||||||
#define spllowersoftclock() splx(8) /* IPL08 */
|
|
||||||
#define splsoftclock() _splraise(8) /* IPL08 */
|
|
||||||
#define splsoftnet() _splraise(0xc) /* IPL0C */
|
|
||||||
#define splddb() _splraise(0xf) /* IPL0F */
|
|
||||||
#define splbio() _splraise(0x15) /* IPL15 */
|
|
||||||
#define splnet() _splraise(0x15) /* IPL15 */
|
|
||||||
#define spltty() _splraise(0x15) /* IPL15 */
|
|
||||||
#define splimp() _splraise(0x17) /* IPL17 */
|
|
||||||
#define splclock() _splraise(0x18) /* IPL18 */
|
|
||||||
#define splhigh() _splraise(0x1f) /* IPL1F */
|
|
||||||
#define splstatclock() splclock()
|
|
||||||
|
|
||||||
/* These are better to use when playing with VAX buses */
|
|
||||||
#define spl4() splx(0x14)
|
|
||||||
#define spl5() splx(0x15)
|
|
||||||
#define spl6() splx(0x16)
|
|
||||||
#define spl7() splx(0x17)
|
|
||||||
|
|
||||||
/* Prototype needed for delay() */
|
/* Prototype needed for delay() */
|
||||||
#ifndef _LOCORE
|
#ifndef _LOCORE
|
||||||
|
Loading…
Reference in New Issue
Block a user