]> Zhao Yanbai Git Server - minix.git/commitdiff
Removed macros that depend on NOTIFY_FROM from servers and drivers. They
authorTomas Hruby <tom@minix3.org>
Tue, 29 Sep 2009 18:47:56 +0000 (18:47 +0000)
committerTomas Hruby <tom@minix3.org>
Tue, 29 Sep 2009 18:47:56 +0000 (18:47 +0000)
determine the information defined by these macros from the m_source field of the
notify message.

22 files changed:
drivers/amddev/amddev.c
drivers/at_wini/at_wini.c
drivers/dp8390/dp8390.c
drivers/dpeth/dp.c
drivers/floppy/floppy.c
drivers/fxp/fxp.c
drivers/lance/lance.c
drivers/libdriver/driver.c
drivers/libdriver_asyn/driver.c
drivers/orinoco/orinoco.c
drivers/pci/main.c
drivers/printer/printer.c
drivers/rtl8139/rtl8139.c
drivers/sb16/sb16_dsp.c
drivers/tty/keyboard.c
drivers/tty/tty.c
servers/ds/main.c
servers/inet/inet.c
servers/is/main.c
servers/mfs/main.c
servers/pm/main.c
servers/rs/main.c

index 1491af5532b37422c65fa5145d6de0fc4f4ebd6e..e476551f4f699a55bbe8357981a562a48e3850dd 100644 (file)
@@ -21,6 +21,7 @@ Driver for the AMD Device Exclusion Vector (DEV)
 #include <minix/ipc.h>
 #include <minix/syslib.h>
 #include <minix/sysutil.h>
+#include <minix/endpoint.h>
 #include <ibm/pci.h>
 
 /* Offsets from capability pointer */
@@ -78,13 +79,13 @@ int main(void)
                r= receive(ANY, &m);
                if (r != OK)
                        panic(__FILE__, "receive failed", r);
-               switch(m.m_type)
-               {
-               case PROC_EVENT:
-                       do_pm_notify(&m);
-                       continue;
-
-               case IOMMU_MAP:
+               if (is_notify(m.m_type)) {
+                       if (_ENDPOINT_P(m.m_source) == PM_PROC_NR) {
+                               do_pm_notify(&m);
+                               continue;
+                       }
+               }
+               else if (m.m_type == IOMMU_MAP) {
                        r= do_add4pci(&m);
                        m.m_type= r;
                        send(m.m_source, &m);
index c4da021eccb274820269075f6fa016e18210db71..cb11f7c38b6a675418330aec3f78b0306deeea47 100644 (file)
@@ -19,6 +19,7 @@
 #include <minix/sysutil.h>
 #include <minix/keymap.h>
 #include <minix/type.h>
+#include <minix/endpoint.h>
 #include <sys/ioc_disk.h>
 #include <ibm/pci.h>
 #include <sys/mman.h>
@@ -1586,11 +1587,10 @@ struct command *cmd;            /* Command block */
        return(ERR);
   }
 
-  /* Schedule a wakeup call, some controllers are flaky. This is done with
-   * a synchronous alarm. If a timeout occurs a SYN_ALARM message is sent
-   * from HARDWARE, so that w_intr_wait() can call w_timeout() in case the
-   * controller was not able to execute the command. Leftover timeouts are
-   * simply ignored by the main loop. 
+  /* Schedule a wakeup call, some controllers are flaky. This is done with a
+   * synchronous alarm. If a timeout occurs a notify from CLOCK is sent, so that
+   * w_intr_wait() can call w_timeout() in case the controller was not able to
+   * execute the command. Leftover timeouts are simply ignored by the main loop. 
    */
   sys_setalarm(wakeup_ticks, 0);
 
@@ -1639,11 +1639,10 @@ struct command *cmd;            /* Command block */
        return(ERR);
   }
 
-  /* Schedule a wakeup call, some controllers are flaky. This is done with
-   * a synchronous alarm. If a timeout occurs a SYN_ALARM message is sent
-   * from HARDWARE, so that w_intr_wait() can call w_timeout() in case the
-   * controller was not able to execute the command. Leftover timeouts are
-   * simply ignored by the main loop. 
+  /* Schedule a wakeup call, some controllers are flaky. This is done with a
+   * synchronous alarm. If a timeout occurs a notify from CLOCK is sent, so that
+   * w_intr_wait() can call w_timeout() in case the controller was not able to
+   * execute the command. Leftover timeouts are simply ignored by the main loop. 
    */
   sys_setalarm(wakeup_ticks, 0);
 
@@ -2057,26 +2056,38 @@ PRIVATE void w_intr_wait()
                int rr;
                if((rr=receive(ANY, &m)) != OK)
                        panic("at_wini", "receive(ANY) failed", rr);
-               switch(m.m_type) {
-                 case SYN_ALARM:
-                       /* Timeout. */
-                       w_timeout();          /* a.o. set w_status */
-                       break;
-                 case HARD_INT:
-                       /* Interrupt. */
-                       r= sys_inb(w_wn->base_cmd + REG_STATUS, &w_status);
-                       if (r != 0)
-                               panic("at_wini", "sys_inb failed", r);
-                       w_wn->w_status= w_status;
-                       ack_irqs(m.NOTIFY_ARG);
-                       break;
-                 case DEV_PING:
-                       /* RS monitor ping. */
-                       notify(m.m_source);
-                       break;
-                 default:
-                       /* unhandled message.
-                        * queue it and handle it in the libdriver loop.
+               if (is_notify(m.m_type)) {
+                       switch (_ENDPOINT_P(m.m_source)) {
+                               case CLOCK:
+                                       /* Timeout. */
+                                       w_timeout(); /* a.o. set w_status */
+                                       break;
+                               case HARDWARE:
+                                       /* Interrupt. */
+                                       r= sys_inb(w_wn->base_cmd +
+                                                       REG_STATUS, &w_status);
+                                       if (r != 0)
+                                               panic("at_wini",
+                                                       "sys_inb failed", r);
+                                       w_wn->w_status= w_status;
+                                       ack_irqs(m.NOTIFY_ARG);
+                                       break;
+                               case RS_PROC_NR:
+                                       /* RS monitor ping. */
+                                       notify(m.m_source);
+                                       break;
+                               default:
+                                       /* 
+                                        * unhandled message.  queue it and
+                                        * handle it in the libdriver loop.
+                                        */
+                                       mq_queue(&m);
+                       }
+               }
+               else {
+                       /* 
+                        * unhandled message.  queue it and handle it in the
+                        * libdriver loop.
                         */
                        mq_queue(&m);
                }
index 365a16a535641bf544f79d4217081b49fd8f23e4..5caa732821e38005bcbd571164ea8b967cd13ab8 100644 (file)
@@ -56,6 +56,7 @@
 
 #include <stdlib.h>
 #include <minix/com.h>
+#include <minix/endpoint.h>
 #include <net/hton.h>
 #include <net/gen/ether.h>
 #include <net/gen/eth_io.h>
@@ -202,13 +203,42 @@ _PROTOTYPE( static void do_vir_outsb, (port_t port, int proc,
 _PROTOTYPE( static void do_vir_outsw, (port_t port, int proc,
                                        vir_bytes buf, size_t size)     );
 
+PRIVATE int handle_hw_intr(void)
+{
+       int i, r, irq;
+       dpeth_t *dep;
+
+       for (i= 0, dep= &de_table[0]; i<DE_PORT_NR; i++, dep++)
+       {
+               if (dep->de_mode != DEM_ENABLED)
+                       continue;
+               assert(dep->de_flags & DEF_ENABLED);
+               irq= dep->de_irq;
+               assert(irq >= 0 && irq < NR_IRQ_VECTORS);
+               if (dep->de_int_pending || 1)
+               {
+                       dep->de_int_pending= 0;
+                       dp_check_ints(dep);
+                       do_int(dep);
+                       r= sys_irqenable(&dep->de_hook);
+                       if (r != OK)
+                       {
+                               panic("DP8390", 
+                                       "unable enable interrupts", r);
+                       }
+               }
+       }
+
+       return r;
+}
+
 /*===========================================================================*
  *                             dpeth_task                                   *
  *===========================================================================*/
 int main(int argc, char *argv[])
 {
        message m;
-       int i, irq, r, tasknr;
+       int i, r, tasknr;
        dpeth_t *dep;
        long v;
 
@@ -243,9 +273,36 @@ int main(int argc, char *argv[])
                if ((r= receive(ANY, &m)) != OK)
                        panic("", "dp8390: receive failed", r);
 
+               if (is_notify(m.m_type)) {
+                       switch (_ENDPOINT_P(m.m_source)) {
+                               case RS_PROC_NR:
+                                       notify(m.m_source);
+                                       break;
+                               case HARDWARE:
+                                       r = handle_hw_intr();
+                                       break;
+                               case SYSTEM:
+                                       if (sigismember((sigset_t*)
+                                                       &m.NOTIFY_ARG,
+                                                       SIGKSTOP))
+                                               dp8390_stop();
+                                       break;
+                               case CLOCK:
+                                       printf("dp8390: notify from CLOCK\n");
+                                       break;
+                               case PM_PROC_NR:
+                                       break;
+                               default:
+                                       panic("", "dp8390: illegal notify from",
+                                                               m.m_source);
+                       }
+
+                       /* done, get a new message */
+                       continue;
+               }
+
                switch (m.m_type)
                {
-               case DEV_PING:  notify(m.m_source);             continue;
                case DL_WRITE:  do_vwrite(&m, FALSE, FALSE);    break;
                case DL_WRITEV: do_vwrite(&m, FALSE, TRUE);     break;
                case DL_WRITEV_S: do_vwrite_s(&m, FALSE);       break;
@@ -257,38 +314,6 @@ int main(int argc, char *argv[])
                case DL_GETSTAT_S: do_getstat_s(&m);            break;
                case DL_GETNAME: do_getname(&m);                break;
                case DL_STOP:   do_stop(&m);                    break;
-               case HARD_INT:
-                       for (i= 0, dep= &de_table[0]; i<DE_PORT_NR; i++, dep++)
-                       {
-                               if (dep->de_mode != DEM_ENABLED)
-                                       continue;
-                               assert(dep->de_flags & DEF_ENABLED);
-                               irq= dep->de_irq;
-                               assert(irq >= 0 && irq < NR_IRQ_VECTORS);
-                               if (dep->de_int_pending || 1)
-                               {
-                                       dep->de_int_pending= 0;
-                                       dp_check_ints(dep);
-                                       do_int(dep);
-                                       r= sys_irqenable(&dep->de_hook);
-                                       if (r != OK)
-                                       {
-                                               panic("DP8390", 
-                                               "unable enable interrupts", r);
-                                       }
-                               }
-                       }
-                       break;
-               case SYS_SIG:   {
-                       sigset_t sigset = m.NOTIFY_ARG;
-                       if (sigismember(&sigset, SIGKSTOP)) dp8390_stop();
-                       break;
-               }
-               case SYN_ALARM:
-                       printf("dp8390: strange, got SYN_ALARM\n");
-                       break;
-               case PROC_EVENT:
-                       break;
                default:
                        panic("", "dp8390: illegal message", m.m_type);
                }
index e569fd17a6e21ea22c09401046ad15c14bc9801b..efde4943f65e73e7a48c8652738b8a3887831ac8 100644 (file)
 **
 **    m_type       DL_PORT   DL_PROC  DL_COUNT DL_MODE DL_ADDR
 **  +------------+---------+---------+--------+-------+---------+
-**  | HARD_INT   |         |         |        |       |         | 
-**  +------------+---------+---------+--------+-------+---------+
-**  | SYN_ALARM  |         |         |        |       |         | 
+**  | NOTIFY from HARDWARE, CLOCK, TTY, RS, PM, SYSTEM          |
 **  +------------+---------+---------+--------+-------+---------+
 **  | HARD_STOP  |         |         |        |       |         | 
 **  +------------+---------+---------+--------+-------+---------+
-**  | FKEY_PRESSED         |         |        |       |         | (99)
-**  +------------+---------+---------+--------+-------+---------+
 **  | DL_WRITE   | port nr | proc nr | count  | mode  | address | (3)
 **  +------------+---------+---------+--------+-------+---------+
 **  | DL_WRITEV  | port nr | proc nr | count  | mode  | address | (4)
@@ -60,6 +56,7 @@
 
 #include "drivers.h"
 #include <minix/keymap.h>
+#include <minix/endpoint.h>
 #include <net/hton.h>
 #include <net/gen/ether.h>
 #include <net/gen/eth_io.h>
@@ -545,6 +542,39 @@ static void do_watchdog(void *message)
   return;
 }
 
+PRIVATE void handle_system_signal(message *m)
+{
+       sigset_t sigset = m->NOTIFY_ARG;
+       int port;
+
+       if (sigismember(&sigset, SIGKSTOP)) {   /* Shut down */
+               for (port = 0; port < DE_PORT_NR; port += 1) {
+                       if (de_table[port].de_mode == DEM_ENABLED) {
+                               m->m_type = DL_STOP;
+                               m->DL_PORT = port;
+                               do_stop(m);
+                       }
+               }
+       }
+}
+
+PRIVATE void handle_hw_intr(void)
+{
+       dpeth_t *dep;
+
+       for (dep = de_table; dep < &de_table[DE_PORT_NR]; dep += 1) {
+               /* If device is enabled and interrupt pending */
+               if (dep->de_mode == DEM_ENABLED) {
+                       dep->de_int_pending = TRUE;
+                       (*dep->de_interruptf) (dep);
+                       if (dep->de_flags & (DEF_ACK_SEND | DEF_ACK_RECV))
+                               reply(dep, !OK, DL_TASK_REPLY);
+                       dep->de_int_pending = FALSE;
+                       sys_irqenable(&dep->de_hook);
+               }
+       }
+}
+
 /*
 **  Name:      int dpeth_task(void)
 **  Function:  Main entry for dp task
@@ -584,10 +614,39 @@ PUBLIC int main(int argc, char **argv)
 
        DEBUG(printf("eth: got message %d, ", m.m_type));
 
-       switch (m.m_type) {
-           case DEV_PING:      /* Status request from RS */
-               notify(m.m_source);
+       if (is_notify(m.m_type)) {
+               switch(_ENDPOINT_P(m.m_source)) {
+                       case CLOCK:
+                               /* to be defined */
+                               do_watchdog(&m);
+                               break;
+                       case RS_PROC_NR:        
+                               /* Status request from RS */
+                               notify(m.m_source);
+                               break;
+                       case SYSTEM:
+                               handle_system_signal(&m);
+                               break;
+                       case HARDWARE:
+                               /* Interrupt from device */
+                               handle_hw_intr();
+                               break;
+                       case TTY_PROC_NR:
+                               /* Function key pressed */
+                               do_dump(&m);
+                               break;
+                       case PM_PROC_NR:
+                               break;
+                       default:        
+                               /* Invalid message type */
+                               panic(DevName, TypeErrMsg, m.m_type);
+                               break;
+               }
+               /* message processed, get another one */
                continue;
+       }
+
+       switch (m.m_type) {
            case DL_WRITEV_S:   /* Write message to device */
                do_vwrite_s(&m);
                break;
@@ -603,43 +662,9 @@ PUBLIC int main(int argc, char **argv)
            case DL_GETNAME:
                do_getname(&m);
                break;
-           case SYN_ALARM:     /* to be defined */
-               do_watchdog(&m);
-               break;
            case DL_STOP:       /* Stop device */
                do_stop(&m);
                break;
-           case SYS_SIG: {
-               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);
-                       }
-                   }
-               }
-               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 */
-                       if (dep->de_mode == DEM_ENABLED) {
-                               dep->de_int_pending = TRUE;
-                               (*dep->de_interruptf) (dep);
-                               if (dep->de_flags & (DEF_ACK_SEND | DEF_ACK_RECV))
-                                       reply(dep, !OK, DL_TASK_REPLY);
-                               dep->de_int_pending = FALSE;
-                               sys_irqenable(&dep->de_hook);
-                       }
-               }
-               break;
-           case FKEY_PRESSED:  /* Function key pressed */
-               do_dump(&m);
-               break;
-           case PROC_EVENT:
-               break;
            default:            /* Invalid message type */
                panic(DevName, TypeErrMsg, m.m_type);
                break;
index 5e9d9a79f5a5ef00cdd84e9039fd2c83aacc93e7..1354cfd4c88a3fbde6d5f231acdda957d1b3f0a2 100644 (file)
@@ -28,6 +28,7 @@
 #include <ibm/diskparm.h>
 #include <minix/sysutil.h>
 #include <minix/syslib.h>
+#include <minix/endpoint.h>
 
 /* I/O Ports used by floppy disk task. */
 #define DOR            0x3F2   /* motor drive control bits */
@@ -760,16 +761,25 @@ PRIVATE void start_motor()
   if (running) return;                 /* motor was already running */
 
   /* Set an alarm timer to force a timeout if the hardware does not interrupt
-   * in time. Expect HARD_INT message, but check for SYN_ALARM timeout.
+   * in time. Expect an interrupt, but check for a timeout.
    */ 
   f_set_timer(&f_tmr_timeout, f_dp->start_ms * system_hz / 1000, f_timeout);
   f_busy = BSY_IO;
   do {
        receive(ANY, &mess); 
-       if (mess.m_type == SYN_ALARM) { 
-               f_expire_tmrs(NULL, NULL);
-       } else if(mess.m_type == DEV_PING) {
-               notify(mess.m_source);
+
+       if (is_notify(mess.m_type)) {
+               switch (_ENDPOINT_P(mess.m_source)) {
+                       case CLOCK:
+                               f_expire_tmrs(NULL, NULL);
+                               break;
+                       case RS_PROC_NR:
+                               notify(mess.m_source);
+                               break;
+                       default :
+                               f_busy = BSY_IDLE;
+                               break;
+               }
        } else {
                f_busy = BSY_IDLE;
        }
@@ -844,16 +854,25 @@ PRIVATE int seek()
   /* Give head time to settle on a format, no retrying here! */
   if (f_device & FORMAT_DEV_BIT) {
        /* Set a synchronous alarm to force a timeout if the hardware does
-        * not interrupt. Expect HARD_INT, but check for SYN_ALARM timeout.
+        * not interrupt.
         */ 
        f_set_timer(&f_tmr_timeout, system_hz/30, f_timeout);
        f_busy = BSY_IO;
        do {
                receive(ANY, &mess); 
-               if (mess.m_type == SYN_ALARM) { 
-                       f_expire_tmrs(NULL, NULL);
-               } else if(mess.m_type == DEV_PING) {
-                       notify(mess.m_source);
+       
+               if (is_notify(mess.m_type)) {
+                       switch (_ENDPOINT_P(mess.m_source)) {
+                               case CLOCK:
+                                       f_expire_tmrs(NULL, NULL);
+                                       break;
+                               case RS_PROC_NR:
+                                       notify(mess.m_source);
+                                       break;
+                               default :
+                                       f_busy = BSY_IDLE;
+                                       break;
+                       }
                } else {
                        f_busy = BSY_IDLE;
                }
@@ -998,7 +1017,7 @@ int len;           /* command length */
 /* Output a command to the controller. */
 
   /* Set a synchronous alarm to force a timeout if the hardware does
-   * not interrupt. Expect HARD_INT, but check for SYN_ALARM timeout.
+   * not interrupt.
    * Note that the actual check is done by the code that issued the
    * fdc_command() call.
    */ 
@@ -1118,17 +1137,24 @@ PRIVATE void f_reset()
   if ((s=sys_voutb(byte_out, 2)) != OK)
        panic("FLOPPY", "Sys_voutb in f_reset() failed", s); 
 
-  /* A synchronous alarm timer was set in fdc_command. Expect a HARD_INT
-   * message to collect the reset interrupt, but be prepared to handle the 
-   * SYN_ALARM message on a timeout.
+  /* A synchronous alarm timer was set in fdc_command. Expect an interrupt,
+   * but be prepared to handle a timeout.
    */
   do {
        receive(ANY, &mess); 
-       if (mess.m_type == SYN_ALARM) { 
-               f_expire_tmrs(NULL, NULL);
-       } else if(mess.m_type == DEV_PING) {
-               notify(mess.m_source);
-       } else {                        /* expect HARD_INT */
+       if (is_notify(mess.m_type)) {
+               switch (_ENDPOINT_P(mess.m_source)) {
+                       case CLOCK:
+                               f_expire_tmrs(NULL, NULL);
+                               break;
+                       case RS_PROC_NR:
+                               notify(mess.m_source);
+                               break;
+                       default :
+                               f_busy = BSY_IDLE;
+                               break;
+               }
+       } else {                        /* expect hw interrupt */
                f_busy = BSY_IDLE;
        }
   } while (f_busy == BSY_IO);
@@ -1165,16 +1191,21 @@ PRIVATE int f_intr_wait()
  */
   message mess;
 
-  /* We expect a HARD_INT message from the interrupt handler, but if there is
-   * a timeout, a SYN_ALARM notification is received instead. If a timeout 
-   * occurs, report an error.
-   */
+  /* We expect an interrupt, but if a timeout, occurs, report an error. */
   do {
        receive(ANY, &mess); 
-       if (mess.m_type == SYN_ALARM) {
-               f_expire_tmrs(NULL, NULL);
-       } else if(mess.m_type == DEV_PING) {
-               notify(mess.m_source);
+       if (is_notify(mess.m_type)) {
+               switch (_ENDPOINT_P(mess.m_source)) {
+                       case CLOCK:
+                               f_expire_tmrs(NULL, NULL);
+                               break;
+                       case RS_PROC_NR:
+                               notify(mess.m_source);
+                               break;
+                       default :
+                               f_busy = BSY_IDLE;
+                               break;
+               }
        } else { 
                f_busy = BSY_IDLE;
        }
index 25f3b7c580dc3d9356333609afacd6bbe97daa10..f733aef5c6473397c33e804b9ea3145cbbd51c02 100644 (file)
@@ -60,6 +60,7 @@
 #include <net/gen/eth_io.h>
 #include <ibm/pci.h>
 #include <minix/ds.h>
+#include <minix/endpoint.h>
 
 #include <timers.h>
 
@@ -277,6 +278,29 @@ _PROTOTYPE( static void do_outl, (port_t port, u32_t v)                    );
 _PROTOTYPE( static void tell_dev, (vir_bytes start, size_t size,
                                int pci_bus, int pci_dev, int pci_func) );
 
+PRIVATE void handle_hw_intr(void)
+{
+       int i, r;
+       fxp_t *fp;
+
+       for (i= 0, fp= &fxp_table[0]; i<FXP_PORT_NR; i++, fp++) {
+               if (fp->fxp_mode != FM_ENABLED)
+                       return;
+               fxp_handler(fp);
+
+               r= sys_irqenable(&fp->fxp_hook);
+               if (r != OK) {
+                       panic("FXP", "unable enable interrupts", r);
+               }
+
+               if (!fp->fxp_got_int)
+                       return;
+               fp->fxp_got_int= 0;
+               assert(fp->fxp_flags & FF_ENABLED);
+               fxp_check_ints(fp);
+       }
+}
+
 /*===========================================================================*
  *                             main                                         *
  *===========================================================================*/
@@ -285,7 +309,6 @@ int main(int argc, char *argv[])
        message m;
        int i, r;
        u32_t tasknr;
-       fxp_t *fp;
        long v;
        vir_bytes ft = sizeof(*fxp_table)*FXP_PORT_NR;
 
@@ -322,9 +345,33 @@ int main(int argc, char *argv[])
                if ((r= receive(ANY, &m)) != OK)
                        panic("FXP","receive failed", r);
 
+               if (is_notify(m.m_type)) {
+                       switch (_ENDPOINT_P(m.m_source)) {
+                               case RS_PROC_NR:
+                                       notify(m.m_source);
+                                       break;
+                               case HARDWARE:
+                                       handle_hw_intr();
+                                       break;
+                               case SYSTEM:
+                                       if (sigismember((sigset_t *)&m.NOTIFY_ARG, SIGKSTOP))
+                                               fxp_stop();
+                                       break;
+                               case PM_PROC_NR:
+                                       break;
+                               case CLOCK:
+                                       fxp_expire_timers();
+                                       break;
+                               default:
+                                       panic("FXP"," illegal notify from", m.m_source);
+                       }
+
+                       /* get new message */
+                       continue;
+               }
+
                switch (m.m_type)
                {
-               case DEV_PING:  notify(m.m_source);             continue;
                case DL_WRITEV: fxp_writev(&m, FALSE, TRUE);    break;
                case DL_WRITE:  fxp_writev(&m, FALSE, FALSE);   break;
                case DL_WRITEV_S: fxp_writev_s(&m, FALSE);      break;
@@ -335,34 +382,6 @@ int main(int argc, char *argv[])
                case DL_GETSTAT: fxp_getstat(&m);               break;
                case DL_GETSTAT_S: fxp_getstat_s(&m);           break;
                case DL_GETNAME: fxp_getname(&m);               break;
-               case HARD_INT:
-                       for (i= 0, fp= &fxp_table[0]; i<FXP_PORT_NR; i++, fp++)
-                       {
-                               if (fp->fxp_mode != FM_ENABLED)
-                                       continue;
-                               fxp_handler(fp);
-
-                               r= sys_irqenable(&fp->fxp_hook);
-                               if (r != OK)
-                               {
-                                       panic("FXP",
-                                               "unable enable interrupts", r);
-                               }
-
-                               if (!fp->fxp_got_int)
-                                       continue;
-                               fp->fxp_got_int= 0;
-                               assert(fp->fxp_flags & FF_ENABLED);
-                               fxp_check_ints(fp);
-                       }
-                       break;
-               case SYS_SIG:   {
-                       sigset_t sigset = m.NOTIFY_ARG;
-                       if (sigismember(&sigset, SIGKSTOP)) fxp_stop();
-                       break;
-               }
-               case PROC_EVENT: break;
-               case SYN_ALARM: fxp_expire_timers();            break;
                default:
                        panic("FXP"," illegal message", m.m_type);
                }
index 4919f725b6ea8a29c467a57af817580445786e3f..3c8adea6f9da1e242092310535feb225d69f5d8f 100644 (file)
@@ -49,6 +49,7 @@
 #include <assert.h>
 
 #include <minix/syslib.h>
+#include <minix/endpoint.h>
 #include <ibm/pci.h>
 #include <minix/ds.h>
 
@@ -318,11 +319,46 @@ void main( int argc, char **argv )
          if (ec->ec_irq != 0)
             sys_irqdisable(&ec->ec_hook);
       }
+
+      if (is_notify(m.m_type)) {
+             switch(_ENDPOINT_P(m.m_source)) {
+                     case RS_PROC_NR:
+                             notify(m.m_source);
+                             break;
+                     case TTY_PROC_NR:
+                             lance_dump();
+                             break;
+                     case SYSTEM:
+                             if (sigismember((sigset_t*)&m.NOTIFY_ARG, SIGKSTOP))
+                                     lance_stop();
+                             break;
+                     case HARDWARE:
+                             for (i=0;i<EC_PORT_NR_MAX;++i)
+                             {
+                                     ec= &ec_table[i];
+                                     if (ec->mode != EC_ENABLED)
+                                             continue;
+
+                                     irq=ec->ec_irq;
+                                     {
+                                             ec->ec_int_pending = 0;
+                                             ec_check_ints(ec);
+                                             do_int(ec);
+                                     }
+                             }
+                             break;
+                     case PM_PROC_NR:
+                             break;
+                     default:
+                             panic( "lance", "illegal notify source", m.m_source);
+             }
+
+             /* get next message */
+             continue;
+      }
+  
       switch (m.m_type)
       {
-      case DEV_PING:
-         notify(m.m_source);
-         continue;
       case DL_WRITEV_S:
          do_vwrite_s(&m, FALSE);
          break;
@@ -341,32 +377,6 @@ void main( int argc, char **argv )
       case DL_GETNAME:
          do_getname(&m);
          break;
-      case FKEY_PRESSED:
-         lance_dump();
-         break;
-      case SYS_SIG:
-      {
-         sigset_t set = m.NOTIFY_ARG;
-         if ( sigismember( &set, SIGKSTOP ) )
-            lance_stop();
-      }
-      break;
-      case HARD_INT:
-         for (i=0;i<EC_PORT_NR_MAX;++i)
-         {
-            ec= &ec_table[i];
-            if (ec->mode != EC_ENABLED)
-               continue;
-            {
-               ec->ec_int_pending = 0;
-               ec_check_ints(ec);
-               do_int(ec);
-            }
-         }
-         break;
-      case PROC_EVENT:
-         /* ignore event */
-         break;
       default:
          panic( "lance", "illegal message", m.m_type);
       }
index 4a661ad1f5e9bb046d817708410ed73f48505695..079444614011c2c1270ae517803615b9fe9e1604 100644 (file)
@@ -41,6 +41,7 @@
 #include "../drivers.h"
 #include <sys/ioc_disk.h>
 #include <minix/mq.h>
+#include <minix/endpoint.h>
 #include "driver.h"
 
 /* Claim space for variables. */
@@ -94,6 +95,35 @@ struct driver *dp;   /* Device dependent entry points. */
        proc_nr = mess.IO_ENDPT;
 
        /* Now carry out the work. */
+       if (is_notify(mess.m_type)) {
+               switch (_ENDPOINT_P(mess.m_source)) {
+                       case HARDWARE:
+                               /* leftover interrupt or expired timer. */
+                               if(dp->dr_hw_int) {
+                                       (*dp->dr_hw_int)(dp, &mess);
+                               }
+                               break;
+                       case PM_PROC_NR:
+                       case SYSTEM:
+                               (*dp->dr_signal)(dp, &mess);
+                               break;
+                       case CLOCK:
+                               (*dp->dr_alarm)(dp, &mess);     
+                               break;
+                       case RS_PROC_NR:
+                               notify(mess.m_source);
+                               break;
+                       default:                
+                               if(dp->dr_other)
+                                       r = (*dp->dr_other)(dp, &mess, 0);
+                               else    
+                                       r = EINVAL;
+                               goto send_reply;
+               }
+
+               /* done, get a new message */
+               continue;
+       }
        switch(mess.m_type) {
        case DEV_OPEN:          r = (*dp->dr_open)(dp, &mess);  break;  
        case DEV_CLOSE:         r = (*dp->dr_close)(dp, &mess); break;
@@ -116,18 +146,6 @@ struct driver *dp; /* Device dependent entry points. */
        case DEV_GATHER_S: 
        case DEV_SCATTER_S:     r = do_vrdwt(dp, &mess, 1); break;
 
-       case HARD_INT:          /* leftover interrupt or expired timer. */
-                               if(dp->dr_hw_int) {
-                                       (*dp->dr_hw_int)(dp, &mess);
-                               }
-                               continue;
-       case PROC_EVENT:
-       case SYS_SIG:           (*dp->dr_signal)(dp, &mess);
-                               continue;       /* don't reply */
-       case SYN_ALARM:         (*dp->dr_alarm)(dp, &mess);     
-                               continue;       /* don't reply */
-       case DEV_PING:          notify(mess.m_source);
-                               continue;
        default:                
                if(dp->dr_other)
                        r = (*dp->dr_other)(dp, &mess, 0);
@@ -136,6 +154,7 @@ struct driver *dp;  /* Device dependent entry points. */
                break;
        }
 
+send_reply:
        /* Clean up leftover state. */
        (*dp->dr_cleanup)();
 
index c000d498676bf072e9f7ae5668b8eaf7d75f64f3..8adf5f318fc4dfe93244682f43b6928b20a7e8d3 100644 (file)
@@ -1,6 +1,7 @@
 /* This file contains device independent device driver interface.
  *
  * Changes:
+ *   Sep 25, 2009   removed all macros depending on NOTIFY_FROM() (T. Hruby)
  *   Jul 25, 2005   added SYS_SIG type for signals  (Jorrit N. Herder)
  *   Sep 15, 2004   added SYN_ALARM type for timeouts  (Jorrit N. Herder)
  *   Jul 23, 2004   removed kernel dependencies  (Jorrit N. Herder)
@@ -41,6 +42,7 @@
 #include "../drivers.h"
 #include <sys/ioc_disk.h>
 #include <minix/mq.h>
+#include <minix/endpoint.h>
 #include "driver.h"
 
 /* Claim space for variables. */
@@ -91,19 +93,6 @@ struct driver *dp;   /* Device dependent entry points. */
        device_caller = mess.m_source;
        proc_nr = mess.IO_ENDPT;
 
-#if 0
-       if (mess.m_type != SYN_ALARM && mess.m_type != DEV_PING &&
-               mess.m_type != 4105 /* notify from TTY */ &&
-               mess.m_type != DEV_SELECT &&
-               mess.m_type != DEV_READ_S &&
-               mess.m_type != DIAGNOSTICS_S &&
-               mess.m_type != CANCEL)
-       {
-               printf("libdriver_asyn`driver_task: msg %d / 0x%x from %d\n",
-                       mess.m_type, mess.m_type, mess.m_source);
-       }
-#endif
-
        if (mess.m_type == DEV_SELECT)
        {
                static int first= 1;
@@ -119,6 +108,36 @@ struct driver *dp; /* Device dependent entry points. */
        }
 
        /* Now carry out the work. */
+       if (is_notify(mess.m_type)) {
+               switch (_ENDPOINT_P(mess.m_source)) {
+                       case HARDWARE:
+                               /* leftover interrupt or expired timer. */
+                               if(dp->dr_hw_int) {
+                                       (*dp->dr_hw_int)(dp, &mess);
+                               }
+                               break;
+                       case PM_PROC_NR:
+                       case SYSTEM:
+                               (*dp->dr_signal)(dp, &mess);
+                               break;
+                       case CLOCK:
+                               (*dp->dr_alarm)(dp, &mess);     
+                               break;
+                       case RS_PROC_NR:
+                               notify(mess.m_source);
+                               break;
+                       default:                
+                               if(dp->dr_other)
+                                       r = (*dp->dr_other)(dp, &mess, 0);
+                               else    
+                                       r = EINVAL;
+                               goto send_reply;
+               }
+
+               /* done, get a new message */
+               continue;
+       }
+
        switch(mess.m_type) {
        case DEV_OPEN:          r = (*dp->dr_open)(dp, &mess);  break;  
        case DEV_CLOSE:         r = (*dp->dr_close)(dp, &mess); break;
@@ -141,18 +160,6 @@ struct driver *dp; /* Device dependent entry points. */
        case DEV_GATHER_S: 
        case DEV_SCATTER_S:     r = do_vrdwt(dp, &mess, 1); break;
 
-       case HARD_INT:          /* leftover interrupt or expired timer. */
-                               if(dp->dr_hw_int) {
-                                       (*dp->dr_hw_int)(dp, &mess);
-                               }
-                               continue;
-       case PROC_EVENT:
-       case SYS_SIG:           (*dp->dr_signal)(dp, &mess);
-                               continue;       /* don't reply */
-       case SYN_ALARM:         (*dp->dr_alarm)(dp, &mess);     
-                               continue;       /* don't reply */
-       case DEV_PING:          notify(mess.m_source);
-                               continue;
        default:                
                if(dp->dr_other)
                        r = (*dp->dr_other)(dp, &mess, 0);
@@ -161,6 +168,7 @@ struct driver *dp;  /* Device dependent entry points. */
                break;
        }
 
+send_reply:
        /* Clean up leftover state. */
        (*dp->dr_cleanup)();
 
index 48183db423f735ab8abbd3e9c7a44f42fa74eca1..2822875527be4638d4a8ecb8a9d82127693d815b 100755 (executable)
@@ -64,6 +64,7 @@
 #include       <sys/ioc_memory.h>
 #include       <ibm/pci.h>
 #include       <minix/ds.h>
+#include       <minix/endpoint.h>
 #include       "../../kernel/const.h"
 #include       "../../kernel/config.h"
 #include       "../../kernel/type.h"
@@ -225,7 +226,7 @@ _PROTOTYPE (static int or_handler, (t_or *orp));
 _PROTOTYPE (static void or_dump, (message *m));
 
 /* The message used in the main loop is made global, so that rl_watchdog_f()
- * can change its message type to fake a HARD_INT message.
+ * can change its message type to fake an interrupt message.
  */
 PRIVATE message m;
 PRIVATE int int_event_check;           /* set to TRUE if events arrived */
@@ -271,10 +272,40 @@ int main(int argc, char *argv[]) {
                if ((r = receive (ANY, &m)) != OK)
                        panic(__FILE__, "orinoco: receive failed", NO_NUM);
 
+               if (is_notify(m.m_type)) {
+                       switch (_ENDPOINT_P(m.m_source)) {
+                               case RS_PROC_NR: 
+                                       notify(m.m_source);     
+                                       break;
+                               case CLOCK:
+                                       or_watchdog_f(NULL);     
+                                       break;           
+                               case SYSTEM:
+                                       if (sigismember((sigset_t*)&m.NOTIFY_ARG,
+                                                               SIGKSTOP))
+                                               orinoco_stop();
+                                       break;
+                               case HARDWARE:
+                                       do_hard_int();
+                                       if (int_event_check)
+                                               check_int_events();
+                                       break ;
+                               case TTY_PROC_NR: 
+                                       or_dump(&m);    
+                                       break;
+                               case PM_PROC_NR:
+                                       break;
+                               default:
+                                       panic(__FILE__,
+                                               "orinoco: illegal notify from:",
+                                               m.m_source);
+                       }
+
+                       /* done, get new message */
+                       continue;
+               }
+
                switch (m.m_type) {
-               case DEV_PING: 
-                       notify(m.m_source);     
-                       break;
                case DL_WRITEV:
                        or_writev (&m, FALSE, TRUE);
                        break;
@@ -305,26 +336,6 @@ int main(int argc, char *argv[]) {
                case DL_GETNAME: 
                        or_getname(&m);
                        break;
-               case SYN_ALARM:
-                       or_watchdog_f(NULL);     
-                       break;           
-               case SYS_SIG:
-               {
-                       sigset_t sigset = m.NOTIFY_ARG;
-                       if ( sigismember( &sigset, SIGKSTOP ) )
-                               orinoco_stop();
-               }
-                       break;
-               case HARD_INT:
-                       do_hard_int();
-                       if (int_event_check)
-                               check_int_events();
-                       break ;
-               case FKEY_PRESSED: 
-                       or_dump(&m);    
-                       break;
-               case PROC_EVENT:
-                       break;
                default:
                        panic(__FILE__,"orinoco: illegal message:", m.m_type);
                }
@@ -341,8 +352,8 @@ static void check_int_events(void) {
        int i;
        t_or *orp;
 
-       /* the HARD_INT message doesn't contain information about the port, try
-         * to find it */
+       /* the interrupt message doesn't contain information about the port, try
+        * to find it */
        for (orp = or_table;
                 orp < or_table + OR_PORT_NR; orp++) {
                if (orp->or_mode != OR_M_ENABLED)
index fba9440fe4a019d71bbf37ee9fa2672663ebc766..2e2bdb06e83bf867773647ad259fd70ac8dc2c94 100644 (file)
@@ -6,6 +6,7 @@ main.c
 
 #include <ibm/pci.h>
 #include <minix/rs.h>
+#include <minix/endpoint.h>
 
 #include "pci.h"
 
@@ -55,6 +56,21 @@ int main(void)
                        printf("PCI: receive from ANY failed: %d\n", r);
                        break;
                }
+
+               if (is_notify(m.m_type)) {
+                       switch (_ENDPOINT_P(m.m_source)) {
+                               case PM_PROC_NR:
+                                       break;
+                               default:
+                                       printf("PCI: got notify from %d\n",
+                                                               m.m_source);
+                                       break;
+                       }
+
+                       /* done, get a new message */
+                       continue;
+               }
+
                switch(m.m_type)
                {
                case BUSC_PCI_INIT: do_init(&m); break;
@@ -75,7 +91,6 @@ int main(void)
                case BUSC_PCI_SLOT_NAME_S: do_slot_name_s(&m); break;
                case BUSC_PCI_SET_ACL: do_set_acl(&m); break;
                case BUSC_PCI_DEL_ACL: do_del_acl(&m); break;
-               case PROC_EVENT: break;
                default:
                        printf("PCI: got message from %d, type %d\n",
                                m.m_source, m.m_type);
index d815f0dd71d84d5231794f5bb158b93b672646eb..4dc9815f41497cf83ff44cadaa78ebeceaf54a3a 100644 (file)
@@ -32,6 +32,7 @@
  * Note: since only 1 printer is supported, minor dev is not used at present.
  */
 
+#include <minix/endpoint.h>
 #include "../drivers.h"
 
 /* Control bits (in port_base + 2).  "+" means positive logic and "-" means
@@ -133,6 +134,27 @@ PUBLIC void main(void)
   
   while (TRUE) {
        receive(ANY, &pr_mess);
+
+       if (is_notify(pr_mess.m_type)) {
+               switch (_ENDPOINT_P(pr_mess.m_source)) {
+                       case HARDWARE:
+                               do_printer_output();
+                               break;
+                       case SYSTEM:
+                               do_signal(&pr_mess);
+                               break;
+                       case RS_PROC_NR:
+                               notify(pr_mess.m_source);
+                               break;
+                       case PM_PROC_NR:
+                               break;
+                       default:
+                               reply(TASK_REPLY, pr_mess.m_source,
+                                               pr_mess.IO_ENDPT, EINVAL);
+               }
+               continue;
+       }
+
        switch(pr_mess.m_type) {
            case DEV_OPEN:
                  do_initialize();              /* initialize */
@@ -143,10 +165,6 @@ PUBLIC void main(void)
            case DEV_WRITE_S:   do_write(&pr_mess, 1);  break;
            case DEV_STATUS:    do_status(&pr_mess);    break;
            case CANCEL:        do_cancel(&pr_mess);    break;
-           case HARD_INT:      do_printer_output();    break;
-           case SYS_SIG:       do_signal(&pr_mess);    break;
-           case DEV_PING:      notify(pr_mess.m_source);       break;
-           case PROC_EVENT:    break;
            default:
                reply(TASK_REPLY, pr_mess.m_source, pr_mess.IO_ENDPT, EINVAL);
        }
@@ -385,10 +403,10 @@ PRIVATE void prepare_output()
  *===========================================================================*/
 PRIVATE void do_printer_output()
 {
-/* This function does the actual output to the printer. This is called on
- * a HARD_INT message sent from the generic interrupt handler that 'forwards'
- * interrupts to this driver. The generic handler did not reenable the 
- * printer IRQ yet! 
+/* This function does the actual output to the printer. This is called on an
+ * interrupt message sent from the generic interrupt handler that 'forwards'
+ * interrupts to this driver. The generic handler did not reenable the printer
+ * IRQ yet! 
  */
 
   unsigned long status;
index 1d8c924bbc2de6313c94fd3708228290ac8e7a2c..15e974e072c47dd68a0c50dba9180cd00f73df1e 100755 (executable)
@@ -67,6 +67,7 @@
 #include <minix/syslib.h>
 #include <minix/type.h>
 #include <minix/sysutil.h>
+#include <minix/endpoint.h>
 #include <timers.h>
 #include <net/hton.h>
 #include <net/gen/ether.h>
@@ -293,7 +294,7 @@ _PROTOTYPE( static void tell_dev, (vir_bytes start, size_t size,
                                int pci_bus, int pci_dev, int pci_func) );
 
 /* The message used in the main loop is made global, so that rl_watchdog_f()
- * can change its message type to fake a HARD_INT message.
+ * can change its message type to fake an interrupt message.
  */
 PRIVATE message m;
 PRIVATE int int_event_check;           /* set to TRUE if events arrived */
@@ -347,9 +348,53 @@ int main(int argc, char *argv[])
                if ((r= receive(ANY, &m)) != OK)
                        panic("rtl8139","receive failed", r);
 
+               if (is_notify(m.m_type)) {
+                       switch (_ENDPOINT_P(m.m_source)) {
+                               case RS_PROC_NR:
+                                       notify(m.m_source);
+                                       break;
+                               case CLOCK:
+                                       /* 
+                                        * Under MINIX, synchronous alarms are
+                                        * used instead of watchdog functions.
+                                        * The approach is very different: MINIX
+                                        * VMD timeouts are handled within the
+                                        * kernel (the watchdog is executed by
+                                        * CLOCK), and notify() 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. Locally, watchdog functions
+                                        * are used again. 
+                                        */
+                                       rl_watchdog_f(NULL);     
+                                       break;           
+                               case SYSTEM:
+                                       if (sigismember((sigset_t*)&m.NOTIFY_ARG,
+                                                               SIGKSTOP))
+                                               rtl8139_stop();
+                                       break;
+                               case HARDWARE:
+                                       do_hard_int();
+                                       if (int_event_check)
+                                               check_int_events();
+                                       break ;
+                               case TTY_PROC_NR:
+                                       rtl8139_dump(&m);
+                                       break;
+                               case PM_PROC_NR:
+                                       break;
+                               default:
+                                       panic("rtl8139","illegal notify from",
+                                                               m.m_source);
+                       }
+
+                       /* done, get nwe message */
+                       continue;
+               }
+
                switch (m.m_type)
                {
-               case DEV_PING: notify(m.m_source);              break;
                case DL_WRITE:  rl_writev(&m, FALSE, FALSE);    break;
                case DL_WRITEV: rl_writev(&m, FALSE, TRUE);     break;
                case DL_WRITEV_S: rl_writev_s(&m, FALSE);       break;
@@ -363,33 +408,6 @@ int main(int argc, char *argv[])
 #if 0
                case DL_STOP:   do_stop(&m);                    break;
 #endif
-               case SYN_ALARM:
-                       /* Under MINIX, synchronous alarms are used instead of
-                        * watchdog functions. The approach is very different:
-                        * MINIX VMD timeouts are handled within the kernel 
-                        * (the watchdog is executed by CLOCK), and notify()
-                        * 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. Locally, watchdog functions are used again. 
-                        */
-                       rl_watchdog_f(NULL);     
-                       break;           
-               case SYS_SIG:
-               {
-                       sigset_t sigset = m.NOTIFY_ARG;
-                       if ( sigismember( &sigset, SIGKSTOP ) )
-                               rtl8139_stop();
-               }
-                       break;
-               case HARD_INT:
-                       do_hard_int();
-                       if (int_event_check)
-                               check_int_events();
-                       break ;
-               case FKEY_PRESSED: rtl8139_dump(&m);            break;
-               case PROC_EVENT:
-                       break;
                default:
                        panic("rtl8139","illegal message", m.m_type);
                }
index b05be18c70ee5d0ac8ccc17b2208c6b70136f947..8932481701b423d7c52a917117f58027990c2342 100644 (file)
@@ -24,6 +24,7 @@
  *  May 20 1995                        Author: Michel R. Prevenier 
  */
 
+#include <minix/endpoint.h>
 #include "sb16.h"
 
 
@@ -97,6 +98,21 @@ PUBLIC void main()
                caller = mess.m_source;
                proc_nr = mess.IO_ENDPT;
 
+               if (is_notify(mess.m_type)) {
+                       switch (_ENDPOINT_P(mess.m_source)) {
+                               case HARDWARE:
+                                       dsp_hardware_msg();
+                                       continue; /* don't reply */
+                               case SYSTEM:
+                                       continue; /* don't reply */
+                               default:
+                                       r = EINVAL;
+                       }
+
+                       /* dont with this message */
+                       goto send_reply;
+               }
+
                /* Now carry out the work. */
                switch(mess.m_type) {
                        case DEV_OPEN:          r = dsp_open(); break;
@@ -111,11 +127,10 @@ PUBLIC void main()
 #endif
                        
                        case DEV_STATUS:        dsp_status(&mess); continue; /* don't reply */
-                       case HARD_INT:          dsp_hardware_msg(); continue; /* don't reply */
-                       case SYS_SIG:           continue; /* don't reply */
                        default:                        r = EINVAL;
                }
 
+send_reply:
                /* Finally, prepare and send the reply message. */
                reply(TASK_REPLY, caller, proc_nr, r);
        }
index bdc27770d5741f72c1170b3043831d0970df7374..db1a70614104cfd10c1b802038643989b9b661bc 100644 (file)
@@ -1176,7 +1176,6 @@ int scode;                        /* scan code for a function key */
 
   /* See if an observer is registered and send it a message. */
   if (proc_nr != NONE) { 
-      m.NOTIFY_TYPE = FKEY_PRESSED;
       notify(proc_nr);
   }
   return(TRUE);
index c87301fa3f5638fa818ba276fe5d4a9b0a6132c4..784c77ca182a0091a8da1565a23bee8044ef79bf 100644 (file)
@@ -18,8 +18,9 @@
  *
  * The valid messages and their parameters are:
  *
- *   HARD_INT:       output has been completed or input has arrived
- *   SYS_SIG:      e.g., MINIX wants to shutdown; run code to cleanly stop
+ *   notify from HARDWARE:       output has been completed or input has arrived
+ *   notify from SYSTEM  :      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
@@ -64,6 +65,7 @@
 #include <minix/sys_config.h>
 #include <minix/tty.h>
 #include <minix/keymap.h>
+#include <minix/endpoint.h>
 #include "tty.h"
 
 #include <sys/time.h>
@@ -190,32 +192,50 @@ PUBLIC int main(void)
         * request and should be handled separately. These extra functions
         * do not operate on a device, in constrast to the driver requests. 
         */
-       switch (tty_mess.m_type) { 
-       case SYN_ALARM:                 /* fall through */
-               expire_timers();        /* run watchdogs of expired timers */
-               continue;               /* contine to check for events */
-       case DEV_PING:
-               notify(tty_mess.m_source);
-               continue;
-       case HARD_INT: {                /* hardware interrupt notification */
-               if (tty_mess.NOTIFY_ARG & kbd_irq_set)
-                       kbd_interrupt(&tty_mess);/* fetch chars from keyboard */
+
+       if (is_notify(tty_mess.m_type)) {
+               switch (_ENDPOINT_P(tty_mess.m_source)) {
+                       case CLOCK:
+                               /* run watchdogs of expired timers */
+                               expire_timers();
+                               break;
+                       case RS_PROC_NR:
+                               notify(tty_mess.m_source);
+                               break;
+                       case HARDWARE: 
+                               /* hardware interrupt notification */
+                               
+                               /* fetch chars from keyboard */
+                               if (tty_mess.NOTIFY_ARG & kbd_irq_set)
+                                       kbd_interrupt(&tty_mess);
 #if NR_RS_LINES > 0
-               if (tty_mess.NOTIFY_ARG & rs_irq_set)
-                       rs_interrupt(&tty_mess);/* serial I/O */
+                               /* serial I/O */
+                               if (tty_mess.NOTIFY_ARG & rs_irq_set)
+                                       rs_interrupt(&tty_mess);
 #endif
-               expire_timers();        /* run watchdogs of expired timers */
-               continue;               /* contine to check for events */
-       }
-       case PROC_EVENT: {
-               cons_stop();            /* switch to primary console */
-               continue;
-       }
-       case SYS_SIG: {                 /* system signal */
-               sigset_t sigset = (sigset_t) tty_mess.NOTIFY_ARG;
-               if (sigismember(&sigset, SIGKMESS)) do_new_kmess(&tty_mess);
+                               /* run watchdogs of expired timers */
+                               expire_timers();
+                               break;
+                       case PM_PROC_NR:
+                               /* switch to primary console */
+                               cons_stop();
+                               break;
+                       case SYSTEM:
+                               /* system signal */
+                               if (sigismember((sigset_t*)&tty_mess.NOTIFY_ARG,
+                                                               SIGKMESS))
+                                       do_new_kmess(&tty_mess);
+                               break;
+                       default:
+                               /* do nothing */
+                               break;
+               }
+
+               /* done, get new message */
                continue;
        }
+
+       switch (tty_mess.m_type) { 
        case DIAGNOSTICS_OLD:           /* a server wants to print some */
 #if 0
                if (tty_mess.m_source != LOG_PROC_NR)
index 86faf18a5496d34bb70bd549e72feacefa1a7e8e..60bf2d51b74e2624b4bc9501d23a83177fdf212a 100644 (file)
@@ -9,9 +9,10 @@
  */
 
 #include "inc.h"       /* include master header file */
+#include <minix/endpoint.h>
 
 /* Allocate space for the global variables. */
-int who_e;             /* caller's proc number */
+endpoint_t who_e;      /* caller's proc number */
 int callnr;            /* system call number */
 int sys_panic;         /* flag to indicate system-wide panic */
 
@@ -46,10 +47,22 @@ PUBLIC int main(int argc, char **argv)
       /* Wait for incoming message, sets 'callnr' and 'who'. */
       get_work(&m);
 
+      if (is_notify(callnr)) {
+             switch (_ENDPOINT_P(who_e)) {
+                     case PM_PROC_NR:
+                             sig_handler();
+                             break;
+                     default:
+                             report("DS","warning, got illegal notify from:",
+                                                                m.m_source);
+                             result = EINVAL;
+                             goto send_reply;
+             }
+
+             /* done, get a new message */
+      }
+
       switch (callnr) {
-      case PROC_EVENT:
-         sig_handler();
-          continue;
       case DS_PUBLISH:
           result = do_publish(&m);
           break;
@@ -70,6 +83,7 @@ PUBLIC int main(int argc, char **argv)
           result = EINVAL;
       }
 
+send_reply:
       /* Finally send reply message, unless disabled. */
       if (result != EDONTREPLY) {
           m.m_type = result;           /* build reply message */
index 9ccbfad14992e758ecf894d8fec5ea3dc54f0e0d..a6a59e2c4eefc08a232343def7af73166474ed38 100644 (file)
@@ -51,6 +51,7 @@ from DL_ETH:
 #include <unistd.h>
 #include <sys/svrctl.h>
 #include <minix/ds.h>
+#include <minix/endpoint.h>
 
 #include "mq.h"
 #include "qp.h"
@@ -253,22 +254,25 @@ PUBLIC void main()
                        mq_free(mq);
                }
 #else /* Minix 3 */
-               else if (m_type == SYN_ALARM)
+               else if (is_notify(m_type))
                {
-                       clck_tick(&mq->mq_mess);
-                       mq_free(mq);
-               } 
-               else if (m_type == PROC_EVENT)
-               {
-                       /* signaled */ 
-                       /* probably SIGTERM */
-                       mq_free(mq);
-               } 
-               else if (m_type & NOTIFY_MESSAGE)
-               {
-                       /* A driver is (re)started. */
-                       eth_check_drivers(&mq->mq_mess);
-                       mq_free(mq);
+                       if (_ENDPOINT_P(source) == CLOCK)
+                       {
+                               clck_tick(&mq->mq_mess);
+                               mq_free(mq);
+                       } 
+                       else if (_ENDPOINT_P(source) == PM_PROC_NR)
+                       {
+                               /* signaled */ 
+                               /* probably SIGTERM */
+                               mq_free(mq);
+                       } 
+                       else
+                       {
+                               /* A driver is (re)started. */
+                               eth_check_drivers(&mq->mq_mess);
+                               mq_free(mq);
+                       }
                }
 #endif
                else if (m_type == DL_CONF_REPLY || m_type == DL_TASK_REPLY ||
index f36762fbf49d5cfc9b2973eb7004ba09c9d53a05..63996e502d2cfa7e6f7f4fcd7c461691c04e8eab 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include "inc.h"
+#include <minix/endpoint.h>
 
 /* Allocate space for the global variables. */
 message m_in;          /* the input message itself */
@@ -42,25 +43,28 @@ PUBLIC int main(int argc, char **argv)
       /* Wait for incoming message, sets 'callnr' and 'who'. */
       get_work();
 
-      switch (callnr) {
-      case SYS_SIG:
-         printf("got SYS_SIG message\n");
-         sigset = m_in.NOTIFY_ARG;
-         for ( result=0; result< _NSIG; result++) {
-             if (sigismember(&sigset, result))
-                 printf("signal %d found\n", result);
-         }
-         continue;
-      case PROC_EVENT:
-          result = EDONTREPLY;
-         break;
-      case FKEY_PRESSED:
-          result = do_fkey_pressed(&m_in);
-          break;
-      case DEV_PING:
-         notify(m_in.m_source);
-         continue;
-      default: 
+      if (is_notify(callnr)) {
+             switch (_ENDPOINT_P(who_e)) {
+                     case SYSTEM:
+                             printf("got message from SYSTEM\n");
+                             sigset = m_in.NOTIFY_ARG;
+                             for ( result=0; result< _NSIG; result++) {
+                                     if (sigismember(&sigset, result))
+                                             printf("signal %d found\n", result);
+                             }
+                             continue;
+                     case PM_PROC_NR:
+                             result = EDONTREPLY;
+                             break;
+                     case TTY_PROC_NR:
+                             result = do_fkey_pressed(&m_in);
+                             break;
+                     case RS_PROC_NR:
+                             notify(m_in.m_source);
+                             continue;
+             }
+      }
+      else {
           printf("IS: warning, got illegal request %d from %d\n",
                callnr, m_in.m_source);
           result = EDONTREPLY;
index 6d37a1247b7f42ac3ad611f86d8dd1a23ec8e9f1..5fba16e6c50740d1ced9fb151ad2fa5b63d8b7c8 100644 (file)
@@ -127,7 +127,7 @@ message *m_in;                              /* pointer to message */
 
        if (src != FS_PROC_NR) {
                if(src == PM_PROC_NR) {
-                       if(fs_m_in.m_type == PROC_EVENT)
+                       if(is_notify(fs_m_in.m_type))
                                srcok = 1; /* Normal exit request. */
                        else
                                printf("MFS: unexpected message from PM\n");
@@ -145,7 +145,7 @@ message *m_in;                              /* pointer to message */
    } while(!srcok);
 
    assert((src == FS_PROC_NR && !unmountdone) || 
-       (src == PM_PROC_NR && fs_m_in.m_type == PROC_EVENT));
+       (src == PM_PROC_NR && is_notify(fs_m_in.m_type)));
 }
 
 
index 586c21e4be9aff493d2a8e94612d40ee5f4f4372..80de2170762dd3934770b12488b661409624d15e 100644 (file)
@@ -67,19 +67,29 @@ PUBLIC int main()
        get_work();             /* wait for an PM system call */
 
        /* Check for system notifications first. Special cases. */
+       if (is_notify(call_nr)) {
+               switch(who_p) {
+                       case CLOCK:
+                               pm_expire_timers(m_in.NOTIFY_TIMESTAMP);
+                               result = SUSPEND;       /* don't reply */
+                               break;
+                       case SYSTEM:                    /* signals pending */
+                               sigset = m_in.NOTIFY_ARG;
+                               if (sigismember(&sigset, SIGKSIG))  {
+                                       (void) ksig_pending();
+                               } 
+                               result = SUSPEND;       /* don't reply */
+                               break;
+                       default :
+                               result = ENOSYS;
+               }
+
+               /* done, send reply and continue */
+               goto send_reply;
+       }
+
        switch(call_nr)
        {
-       case SYN_ALARM:
-               pm_expire_timers(m_in.NOTIFY_TIMESTAMP);
-               result = SUSPEND;               /* don't reply */
-               break;
-       case SYS_SIG:                           /* signals pending */
-               sigset = m_in.NOTIFY_ARG;
-               if (sigismember(&sigset, SIGKSIG))  {
-                       (void) ksig_pending();
-               } 
-               result = SUSPEND;               /* don't reply */
-               break;
        case PM_GET_WORK:
                if (who_e == FS_PROC_NR)
                {
@@ -139,6 +149,7 @@ PUBLIC int main()
                break;
        }
 
+send_reply:
        /* Send the results back to the user to indicate completion. */
        if (result != SUSPEND) setreply(who_p, result);
 
index 638065504fd3f5215d8f23131fc1d5afbf4f6df7..55d909d8538f104b34d1b2ab0feff02cf1b5dd3d 100644 (file)
@@ -64,12 +64,12 @@ PUBLIC int main(void)
       /* Notification messages are control messages and do not need a reply.
        * These include heartbeat messages and system notifications.
        */
-      if (m.m_type & NOTIFY_MESSAGE) {
-          switch (call_nr) {
-          case SYN_ALARM:
+      if (is_notify(m.m_type)) {
+          switch (who_p) {
+          case CLOCK:
              do_period(&m);                    /* check drivers status */
              continue;                         
-          case PROC_EVENT:
+          case PM_PROC_NR:
              sig_handler();
               continue;                                
          default:                              /* heartbeat notification */