Subject: MI soft interupts
To: None <tech-kern@NetBSD.ORG>
From: Ignatios Souvatzis <ignatios@cs.uni-bonn.de>
List: tech-kern
Date: 04/06/1996 20:22:45
Hello,
I started making the core of if_bah.c (the SMC chipset ARCnet driver
for NetBSD/Amiga) MI, and to write an ISA frontend for it. I noticed
that it would be VERY NICE to have a MI version of softint callbacks.
I'd propose just to adopt the Amiga interface, but cgd convinced me
that it should be modified... I summarize a proposal for an interface:
/*
* interface to interested parties, e.g. drivers
*/
typedef void (*sicb_func_t)(void *p);
struct sicb {
sicb_func_t f;
void *p;
TAILQ_ENTRY(sicb) tq;
};
int add_sicallback __P((struct sicb *));
/*
* add_sicallback enters its parameter into si_queue.
* after that, a soft int is generated (e.g., using the force bit for
* IPL 1 on Amiga or DraCo), which will be executed when no other
* interupts are pending anymore.
* this interupt will call call_sicallback(), which will call all
* entries on the list and remove them.
* Note that be might get away with a LIST_ENTRY, at the cost of
* calling the functions LIFO.
*/
/*
* some internal stuff
*/
TAILQ_HEAD(sicb) si_queue;
/*
* Is called at lowest spl when no other interrupts are pending.
* Dequeues and executes each entry it finds in turn as follows:
* p->si_func(p->si_par);
*/
call_sicallback __P((void));
---
We can actually implement most of this MI, given a MD initialization
callback, which will register call_sicallback with the interupt
machinery, and a setsoftcback() function (macro?), which will do the
right thing to make call_sicallback be called eventually.
Hm, low effort implementation would just call call_sicallback directly
on setsoftcback(); you wouldn't get the benefits of calling the stuff
at low priority without blocking ohter interrupts, but code using it
would at least run.
One last remark: I've the impression, that we could either implement
this through the soft network queue mechanism, or use it to
reimplement the latter in a machine-independent way.
Regards,
Ignatios Souvatzis