various cleanup, move setsoft* and spl* into intr.h.

This commit is contained in:
cgd 1996-07-09 00:33:20 +00:00
parent 29a40482db
commit 04294813bd
3 changed files with 44 additions and 43 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.8 1996/06/14 20:40:49 cgd Exp $ */ /* $NetBSD: cpu.h,v 1.9 1996/07/09 00:33:20 cgd Exp $ */
/* /*
* Copyright (c) 1988 University of Utah. * Copyright (c) 1988 University of Utah.
@ -65,8 +65,10 @@
struct clockframe { struct clockframe {
struct trapframe cf_tf; struct trapframe cf_tf;
}; };
#define CLKF_USERMODE(framep) (((framep)->cf_tf.tf_ps & PSL_U) != 0) #define CLKF_USERMODE(framep) \
#define CLKF_BASEPRI(framep) (((framep)->cf_tf.tf_ps & PSL_IPL) == 0) (((framep)->cf_tf.tf_ps & ALPHA_PSL_USERMODE) != 0)
#define CLKF_BASEPRI(framep) \
(((framep)->cf_tf.tf_ps & ALPHA_PSL_IPL_MASK) == 0)
#define CLKF_PC(framep) ((framep)->cf_tf.tf_pc) #define CLKF_PC(framep) ((framep)->cf_tf.tf_pc)
/* /*
* XXX No way to accurately tell if we were in interrupt mode before taking * XXX No way to accurately tell if we were in interrupt mode before taking
@ -99,18 +101,6 @@ u_int64_t astpending; /* need to trap before returning to user mode */
u_int64_t want_resched; /* resched() was called */ u_int64_t want_resched; /* resched() was called */
/*
* simulated software interrupt register
*/
extern u_int64_t ssir;
#define SIR_NET 0x1
#define SIR_CLOCK 0x2
#define siroff(x) ssir &= ~(x)
#define setsoftnet() ssir |= SIR_NET
#define setsoftclock() ssir |= SIR_CLOCK
/* /*
* CTL_MACHDEP definitions. * CTL_MACHDEP definitions.
*/ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.h,v 1.1 1996/04/12 01:42:17 cgd Exp $ */ /* $NetBSD: intr.h,v 1.2 1996/07/09 00:33:25 cgd Exp $ */
/* /*
* Copyright (c) 1996 Carnegie-Mellon University. * Copyright (c) 1996 Carnegie-Mellon University.
@ -27,6 +27,9 @@
* rights to redistribute these changes. * rights to redistribute these changes.
*/ */
#ifndef _ALPHA_INTR_H_
#define _ALPHA_INTR_H_
#define IPL_NONE 0 /* disable only this interrupt */ #define IPL_NONE 0 /* disable only this interrupt */
#define IPL_BIO 1 /* disable block I/O interrupts */ #define IPL_BIO 1 /* disable block I/O interrupts */
#define IPL_NET 2 /* disable network interrupts */ #define IPL_NET 2 /* disable network interrupts */
@ -38,3 +41,30 @@
#define IST_PULSE 1 /* pulsed */ #define IST_PULSE 1 /* pulsed */
#define IST_EDGE 2 /* edge-triggered */ #define IST_EDGE 2 /* edge-triggered */
#define IST_LEVEL 3 /* level-triggered */ #define IST_LEVEL 3 /* level-triggered */
#define splx(s) \
(s == ALPHA_PSL_IPL_0 ? spl0() : alpha_pal_swpipl(s))
#define splsoft() alpha_pal_swpipl(ALPHA_PSL_IPL_SOFT)
#define splsoftclock() splsoft()
#define splsoftnet() splsoft()
#define splnet() alpha_pal_swpipl(ALPHA_PSL_IPL_IO)
#define splbio() alpha_pal_swpipl(ALPHA_PSL_IPL_IO)
#define splimp() alpha_pal_swpipl(ALPHA_PSL_IPL_IO)
#define spltty() alpha_pal_swpipl(ALPHA_PSL_IPL_IO)
#define splclock() alpha_pal_swpipl(ALPHA_PSL_IPL_CLOCK)
#define splstatclock() alpha_pal_swpipl(ALPHA_PSL_IPL_CLOCK)
#define splhigh() alpha_pal_swpipl(ALPHA_PSL_IPL_HIGH)
/*
* simulated software interrupt register
*/
extern u_int64_t ssir;
#define SIR_NET 0x1
#define SIR_CLOCK 0x2
#define siroff(x) ssir &= ~(x)
#define setsoftnet() ssir |= SIR_NET
#define setsoftclock() ssir |= SIR_CLOCK
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: param.h,v 1.12 1996/03/04 05:04:10 cgd Exp $ */ /* $NetBSD: param.h,v 1.13 1996/07/09 00:33:23 cgd Exp $ */
/* /*
* Copyright (c) 1988 University of Utah. * Copyright (c) 1988 University of Utah.
@ -51,9 +51,7 @@
#define MACHINE_ARCH "alpha" #define MACHINE_ARCH "alpha"
#define MID_MACHINE MID_ALPHA #define MID_MACHINE MID_ALPHA
#ifdef _KERNEL /* XXX */ #include <machine/alpha_cpu.h>
#include <machine/cpu.h> /* XXX */
#endif /* XXX */
/* /*
* Round p (pointer or byte index) up to a correctly-aligned value for all * Round p (pointer or byte index) up to a correctly-aligned value for all
@ -63,9 +61,9 @@
#define ALIGNBYTES 7 #define ALIGNBYTES 7
#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) &~ ALIGNBYTES) #define ALIGN(p) (((u_long)(p) + ALIGNBYTES) &~ ALIGNBYTES)
#define NBPG 8192 /* bytes/page */ #define NBPG (1 << ALPHA_PGSHIFT) /* bytes/page */
#define PGOFSET (NBPG-1) /* byte off. into pg */ #define PGOFSET (NBPG-1) /* byte off. into pg */
#define PGSHIFT 13 /* LOG2(NBPG) */ #define PGSHIFT ALPHA_PGSHIFT /* LOG2(NBPG) */
#define NPTEPG (1 << (PGSHIFT-PTESHIFT)) /* pte's/page */ #define NPTEPG (1 << (PGSHIFT-PTESHIFT)) /* pte's/page */
#define SEGSHIFT (PGSHIFT + (PGSHIFT-PTESHIFT)) /* LOG2(NBSEG) */ #define SEGSHIFT (PGSHIFT + (PGSHIFT-PTESHIFT)) /* LOG2(NBSEG) */
@ -144,34 +142,17 @@
#define alpha_btop(x) ((unsigned long)(x) >> PGSHIFT) #define alpha_btop(x) ((unsigned long)(x) >> PGSHIFT)
#define alpha_ptob(x) ((unsigned long)(x) << PGSHIFT) #define alpha_ptob(x) ((unsigned long)(x) << PGSHIFT)
#include <machine/psl.h> #include <machine/intr.h>
#define splx(s) (s == PSL_IPL_0 ? spl0() : pal_swpipl(s))
#define splsoft() pal_swpipl(PSL_IPL_SOFT)
#define splsoftclock() splsoft()
#define splsoftnet() splsoft()
#define splnet() pal_swpipl(PSL_IPL_IO)
#define splbio() pal_swpipl(PSL_IPL_IO)
#define splimp() pal_swpipl(PSL_IPL_IO)
#define spltty() pal_swpipl(PSL_IPL_IO)
#define splclock() pal_swpipl(PSL_IPL_CLOCK)
#define splstatclock() pal_swpipl(PSL_IPL_CLOCK)
#define splhigh() pal_swpipl(PSL_IPL_HIGH)
#ifdef _KERNEL #ifdef _KERNEL
#ifndef _LOCORE #ifndef _LOCORE
/* This was calibrated empirically */ void delay __P((unsigned long));
extern u_int64_t cycles_per_usec;
int delay __P((int));
#define DELAY(n) delay(n) #define DELAY(n) delay(n)
/* XXX ALL OF THE FOLLOWING BELONG IN INTR.H */
int spl0 __P((void)); /* drop ipl to zero */ int spl0 __P((void)); /* drop ipl to zero */
/* XXX END INTR.H */
#endif #endif
#endif /* !_KERNEL */ #endif /* !_KERNEL */
int prtloc;
extern int ticks;
#define LOC() do { if (prtloc) printf("(%ld:%ld) %s: %d\n", curproc ? curproc->p_pid : -1, (long)ticks, __FILE__, __LINE__); } while (0)
#define PLOC(str) panic("XXX: (%ld:%ld) %s at %s: %d\n", curproc ? curproc->p_pid : -1, (long)ticks, str, __FILE__, __LINE__);