** +------------+---------+---------+---------------+
**
** $Log$
+** Revision 1.3 2005/07/20 15:28:04 jnherder
+** Kernel sends SIGKSTOP just before shutdown. Drivers do clean up and exit.
+**
** Revision 1.2 2005/07/14 15:15:17 jnherder
** Renamed some system library functionality.
**
case DL_STOP: /* Stop device */
do_stop(&m);
break;
- case HARD_STOP: /* Shut down */
- for (rc = 0; rc < DE_PORT_NR; rc += 1) {
+ case SYS_EVENT: {
+ sigset_t sigset = m.NOTIFY_ARG;
+ if (sigismember(&sigset, SIGKSTOP)) { /* Shut down */
+ for (rc = 0; rc < DE_PORT_NR; rc += 1) {
if (de_table[rc].de_mode == DEM_ENABLED) {
m.m_type = DL_STOP;
m.DL_PORT = rc;
do_stop(&m);
}
+ }
}
- sys_exit(0);
break;
+ }
case HARD_INT: /* Interrupt from device */
for (dep = de_table; dep < &de_table[DE_PORT_NR]; dep += 1) {
/* If device is enabled and interrupt pending */
fxp_check_ints(fp);
}
break;
- case HARD_STOP: fxp_stop(); break;
+ case SYS_EVENT: {
+ sigset_t sigset = m.NOTIFY_ARG;
+ if (sigismember(&sigset, SIGKSTOP)) fxp_stop();
+ break;
+ }
case SYN_ALARM: fxp_expire_timers(); break;
default:
panic("FXP"," illegal message", m.m_type);
* the driver in some cases.
* MINIX timeouts result in a SYN_ALARM message to the
* driver and thus are handled where they should be
- * handled. Interrupt()s are faked by setting m_type to
- * HARD_INT in rl_watchdog_f when needed, so that this
- * case falls through.
+ * handled. Locally, watchdog functions are used again.
*/
rl_watchdog_f(NULL);
break;
check_int_events();
break ;
case FKEY_PRESSED: rtl8139_dump(&m); break;
- case HARD_STOP: rtl8139_stop(); break;
+ case SYS_EVENT: {
+ sigset_t sigset = m.NOTIFY_ARG;
+ if (sigismember(&sigset, SIGKSTOP)) rtl8139_stop();
+ break;
+ }
default:
panic("rtl8139","illegal message", m.m_type);
}
reply.DL_STAT = status | ((u32_t) err << 16);
reply.DL_COUNT = rep->re_read_s;
if (OK != (r = getuptime(&now)))
- panic("dp8390","getuptime() failed:", r);
+ panic("rtl8139","getuptime() failed:", r);
reply.DL_CLCK = now;
r= send(rep->re_client, &reply);
return;
}
- if (r < 0)
- panic("dp8390","send failed:", r);
+ if (r < 0) {
+ printf("RTL8139 tried sending to %d, type %d\n", rep->re_client, reply.m_type);
+ panic("rtl8139","send failed:", r);
+ }
rep->re_read_s = 0;
rep->re_flags &= ~(REF_PACK_SENT | REF_PACK_RECV);
int i;
re_t *rep;
/* Use a synchronous alarm instead of a watchdog timer. */
- sys_syncalrm(SELF, HZ, 0);
+ sys_setalarm(SELF, HZ, 0);
for (i= 0, rep = &re_table[0]; i<RE_PORT_NR; i++, rep++)
{
* The valid messages and their parameters are:
*
* HARD_INT: output has been completed or input has arrived
- * HARD_STOP: MINIX wants to shutdown; run code to cleanly stop
+ * SYS_EVENT: e.g., MINIX wants to shutdown; run code to cleanly stop
* DEV_READ: a process wants to read from a terminal
* DEV_WRITE: a process wants to write on a terminal
* DEV_IOCTL: a process wants to change a terminal's parameters
* ---------------------------------------------------------------------------
* | HARD_INT | | | | | | |
* |-------------+---------+---------+---------+---------+---------+---------|
- * | HARD_STOP | | | | | | |
+ * | SYS_EVENT | sig set | | | | | |
* |-------------+---------+---------+---------+---------+---------+---------|
* | DEV_READ |minor dev| proc nr | count | O_NONBLOCK| buf ptr |
* |-------------+---------+---------+---------+---------+---------+---------|
}
case SYS_EVENT: { /* new kernel message is available */
sigset_t sigset = (sigset_t) tty_mess.NOTIFY_ARG;
- if (sigismember(&sigset, SIGKMESS)) {
- do_new_kmess(&tty_mess);
- } else if (sigismember(&sigset, SIGTERM)) {
- cons_stop(); /* first switch to primary console */
- } else if (sigismember(&sigset, SIGKSTOP)) {
+ if (sigismember(&sigset, SIGKSTOP)) {
cons_stop(); /* switch to primary console */
- do_panic_dumps(&tty_mess);
- }
- continue;
- }
- case HARD_STOP: { /* MINIX is going down */
- static int stop = 0; /* expect two HARD_STOP messages */
- if (! stop++) {
- cons_stop(); /* first switch to primary console */
- } else {
- if(irq_hook_id != -1) {
- int r;
- r = sys_irqdisable(&irq_hook_id);
- r = sys_irqrmpolicy(KEYBOARD_IRQ, &irq_hook_id);
+#if DEAD_CODE
+ if (irq_hook_id != -1) {
+ sys_irqdisable(&irq_hook_id);
+ sys_irqrmpolicy(KEYBOARD_IRQ, &irq_hook_id);
}
- printf("[DONE]\n");
- printf("MINIX will now be shutdown.\n");
- sys_exit(0); /* then exit TTY */
- }
- continue;
+#endif
+ }
+ if (sigismember(&sigset, SIGTERM)) cons_stop();
+ if (sigismember(&sigset, SIGKMESS)) do_new_kmess(&tty_mess);
+ continue;
}
case PANIC_DUMPS: /* allow panic dumps */
cons_stop(); /* switch to primary console */