Small update to SYS_IRQCTL -> setting an interrupt policy now allows the caller

to provide an index (0 .. 31) that is passed in the HARD_INT message when an
interrupt occurs. The NOTIFY_ARG field contains a bitmap with all indexes for
which an interrupt occured.
This commit is contained in:
Jorrit Herder
2005-07-29 12:44:42 +00:00
parent bd8762263a
commit d62e515660
13 changed files with 45 additions and 10 deletions

View File

@@ -475,6 +475,7 @@ PRIVATE int w_identify()
/* Everything looks OK; register IRQ so we can stop polling. */
wn->irq = w_drive < 2 ? AT_WINI_0_IRQ : AT_WINI_1_IRQ;
wn->irq_hook_id = wn->irq; /* id to be returned if interrupt occurs */
if ((s=sys_irqsetpolicy(wn->irq, IRQ_REENABLE, &wn->irq_hook_id)) != OK)
panic(w_name(), "coudn't set IRQ policy", s);
if ((s=sys_irqenable(&wn->irq_hook_id)) != OK)

View File

@@ -49,6 +49,12 @@
** +------------+---------+---------+---------------+
**
** $Log$
** Revision 1.4 2005/07/29 12:44:41 jnherder
** Small update to SYS_IRQCTL -> setting an interrupt policy now allows the caller
** to provide an index (0 .. 31) that is passed in the HARD_INT message when an
** interrupt occurs. The NOTIFY_ARG field contains a bitmap with all indexes for
** which an interrupt occured.
**
** Revision 1.3 2005/07/20 15:28:04 jnherder
** Kernel sends SIGKSTOP just before shutdown. Drivers do clean up and exit.
**
@@ -267,7 +273,10 @@ static void do_first_init(dpeth_t *dep, dp_conf_t *dcp)
/* Device specific initialization */
(*dep->de_initf) (dep);
/* Set the interrupt handler policy */
/* Set the interrupt handler policy. Request interrupts to be reenabled
* automatically. Return the IRQ line number when an interrupt occurs.
*/
dep->de_hook = dep->de_irq;
sys_irqsetpolicy(dep->de_irq, IRQ_REENABLE, &dep->de_hook);
sys_irqenable(&dep->de_hook);

View File

@@ -300,7 +300,10 @@ PUBLIC void main()
tmr_inittimer(&fp->fl_tmr_stop);
}
/* Set IRQ policy, only request notifications. */
/* Set IRQ policy, only request notifications, do not automatically
* reenable interrupts. ID return on interrupt is the IRQ line number.
*/
irq_hook_id = FLOPPY_IRQ;
if ((s=sys_irqsetpolicy(FLOPPY_IRQ, 0, &irq_hook_id )) != OK)
panic("FLOPPY", "Couldn't set IRQ policy", s);
if ((s=sys_irqenable(&irq_hook_id)) != OK)

View File

@@ -736,7 +736,10 @@ fxp_t *fp;
fp->fxp_flags = FF_EMPTY;
fp->fxp_flags |= FF_ENABLED;
/* set the interrupt handler */
/* Set the interrupt handler and policy. Do not automatically
* reenable interrupts. Return the IRQ line number on interrupts.
*/
fp->fxp_hook = fp->fxp_irq;
r= sys_irqsetpolicy(fp->fxp_irq, 0, &fp->fxp_hook);
if (r != OK)
panic("FXP","sys_irqsetpolicy failed", r);

View File

@@ -340,6 +340,7 @@ PRIVATE void do_initialize()
tickdelay(1); /* easily satisfies Centronics minimum */
/* was 2 millisecs; now is ~17 millisecs */
sys_outb(port_base + 2, PR_SELECT);
irq_hook_id = 0;
sys_irqsetpolicy(PRINTER_IRQ, 0, &irq_hook_id);
sys_irqenable(&irq_hook_id);

View File

@@ -747,8 +747,11 @@ re_t *rep;
rep->re_flags = REF_EMPTY;
rep->re_flags |= REF_ENABLED;
/* set the interrupt handler */
/* only send HARD_INT notifications */
/* Set the interrupt handler. The policy is to only send HARD_INT
* notifications. Don't reenable interrupts automatically. The id
* that is passed back is the interrupt line number.
*/
rep->re_hook_id = rep->re_irq;
if ((s=sys_irqsetpolicy(rep->re_irq, 0, &rep->re_hook_id)) != OK)
printf("RTL8139: error, couldn't set IRQ policy: %d\n", s);

View File

@@ -401,6 +401,7 @@ tty_t *tp;
}
/* Set interrupt handler and enable keyboard IRQ. */
irq_hook_id = KEYBOARD_IRQ; /* id to be returned on interrupt */
if ((i=sys_irqsetpolicy(KEYBOARD_IRQ, IRQ_REENABLE, &irq_hook_id)) != OK)
panic("TTY", "Couldn't set keyboard IRQ policy", i);
if ((i=sys_irqenable(&irq_hook_id)) != OK)

View File

@@ -210,12 +210,15 @@ PUBLIC void main(void)
}
case SYS_EVENT: { /* new kernel message is available */
sigset_t sigset = (sigset_t) tty_mess.NOTIFY_ARG;
if (sigismember(&sigset, SIGKSTOP)) {
cons_stop(); /* switch to primary console */
#if DEAD_CODE
if (irq_hook_id != -1) {
sys_irqdisable(&irq_hook_id);
sys_irqrmpolicy(KEYBOARD_IRQ, &irq_hook_id);
}
#endif
}
if (sigismember(&sigset, SIGTERM)) cons_stop();
if (sigismember(&sigset, SIGKMESS)) do_new_kmess(&tty_mess);