Move data structures to softintr.c. Remove an unneeded if. Fix a typo.
This commit is contained in:
parent
6fbc543513
commit
040b0bc071
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: softintr.h,v 1.1 2004/03/24 23:39:39 matt Exp $ */
|
||||
/* $NetBSD: softintr.h,v 1.2 2004/03/25 18:46:27 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2004 The NetBSD Foundation, Inc.
|
||||
@ -41,20 +41,11 @@
|
||||
#ifdef _KERNEL
|
||||
#include <sys/queue.h>
|
||||
|
||||
SIMPLEQ_HEAD(softintr_qh, softintr);
|
||||
|
||||
struct softintr {
|
||||
SIMPLEQ_ENTRY(softintr) si_link;
|
||||
void (*si_func)(void *); /* callback */
|
||||
void *si_arg; /* argument to si_func */
|
||||
int si_ipl; /* IPL_SOFT* */
|
||||
int si_refs; /* either 1 or 2 */
|
||||
};
|
||||
|
||||
/*
|
||||
* Override the standard schednetisr and have one softintr per netisr.
|
||||
* Note that this allows for eventually doing dynamic registration of netisr's.
|
||||
*/
|
||||
struct softintr;
|
||||
extern struct softintr *softnet_handlers[];
|
||||
#define schednetisr(an_isr) softintr_schedule(softnet_handlers[(an_isr)])
|
||||
|
||||
@ -62,9 +53,11 @@ void *softintr_establish(int, void (*)(void *), void *);
|
||||
void softintr_disestablish(void *);
|
||||
void softintr_schedule(void *);
|
||||
|
||||
void softintr__init(void);
|
||||
void softintr__run(int);
|
||||
|
||||
/*
|
||||
* These are *not* part of API.
|
||||
*/
|
||||
void softintr__init(void); /* initialize the softintr framework */
|
||||
void softintr__run(int); /* run the softintr list for an IPL */
|
||||
#endif
|
||||
|
||||
#endif /* __POWERPC_SOFTINTR_H_ */
|
||||
|
@ -34,7 +34,7 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: softintr.c,v 1.1 2004/03/24 23:39:39 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: softintr.c,v 1.2 2004/03/25 18:46:27 matt Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <lib/libkern/libkern.h>
|
||||
@ -42,6 +42,16 @@ __KERNEL_RCSID(0, "$NetBSD: softintr.c,v 1.1 2004/03/24 23:39:39 matt Exp $");
|
||||
#include <machine/intr.h>
|
||||
#include <net/netisr.h>
|
||||
|
||||
SIMPLEQ_HEAD(softintr_qh, softintr);
|
||||
|
||||
struct softintr {
|
||||
SIMPLEQ_ENTRY(softintr) si_link;
|
||||
void (*si_func)(void *); /* callback */
|
||||
void *si_arg; /* argument to si_func */
|
||||
int si_ipl; /* IPL_SOFT* */
|
||||
int si_refs; /* either 1 or 2 */
|
||||
};
|
||||
|
||||
static struct softintr_qh
|
||||
#ifdef IPL_SOFTI2C
|
||||
softintr_softi2c = SIMPLEQ_HEAD_INITIALIZER(softintr_softi2c),
|
||||
@ -50,7 +60,7 @@ static struct softintr_qh
|
||||
softintr_softclock = SIMPLEQ_HEAD_INITIALIZER(softintr_softclock),
|
||||
softintr_softserial = SIMPLEQ_HEAD_INITIALIZER(softintr_softserial);
|
||||
|
||||
static struct pool softintr_pool;
|
||||
struct pool softintr_pool;
|
||||
struct softintr *softnet_handlers[32];
|
||||
|
||||
static __inline struct softintr_qh *
|
||||
@ -138,7 +148,7 @@ softintr_schedule(void *cookie)
|
||||
case IPL_SOFTCLOCK: setsoftclock(); break;
|
||||
case IPL_SOFTNET: setsoftnet(); break;
|
||||
#ifdef IPL_SOFTI2C
|
||||
case IPL_SOFTNET: setsofti2c(); break;
|
||||
case IPL_SOFTI2C: setsofti2c(); break;
|
||||
#endif
|
||||
}
|
||||
splx(s);
|
||||
@ -157,13 +167,12 @@ softintr_establish(int ipl, void (*func)(void *), void *arg)
|
||||
s = splvm();
|
||||
si = pool_get(&softintr_pool, PR_WAITOK);
|
||||
splx(s);
|
||||
if (si == NULL)
|
||||
return NULL;
|
||||
|
||||
si->si_ipl = ipl;
|
||||
si->si_func = func;
|
||||
si->si_arg = arg;
|
||||
si->si_refs = 1;
|
||||
|
||||
return si;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user