]> Zhao Yanbai Git Server - minix.git/commitdiff
Ethernet driver changes for asynchronous inet.
authorPhilip Homburg <philip@cs.vu.nl>
Mon, 23 Apr 2007 15:38:00 +0000 (15:38 +0000)
committerPhilip Homburg <philip@cs.vu.nl>
Mon, 23 Apr 2007 15:38:00 +0000 (15:38 +0000)
drivers/dp8390/dp8390.c
drivers/dp8390/rtl8029.c
drivers/fxp/fxp.c
drivers/lance/lance.c
drivers/rtl8139/rtl8139.c

index fdf636fcdf0110e723b53b3002fd2eea51a8ca00..4f62de524696a024739063f6721e5a82dbaa9d09 100644 (file)
@@ -398,7 +398,10 @@ static void pci_conf()
                for (i= 0, dep= de_table; i<DE_PORT_NR; i++, dep++)
                {
                        if (!dep->de_pci)
+                       {
+                               printf("pci: no pci for port %d\n", i);
                                continue;
+                       }
                        if (((dep->de_pcibus | dep->de_pcidev |
                                dep->de_pcifunc) != 0) != h)
                        {
@@ -821,7 +824,7 @@ dpeth_t *dep;
 static void do_getstat(mp)
 message *mp;
 {
-       int port;
+       int port, r;
        dpeth_t *dep;
 
        port = mp->DL_PORT;
@@ -833,7 +836,13 @@ message *mp;
        {
                put_userdata(mp->DL_PROC, (vir_bytes) mp->DL_ADDR,
                        (vir_bytes) sizeof(dep->de_stat), &dep->de_stat);
-               reply(dep, OK, FALSE);
+               
+               mp->m_type= DL_STAT_REPLY;
+               mp->DL_PORT= port;
+               mp->DL_STAT= OK;
+               r= send(mp->m_source, mp);
+               if (r != OK)
+                       panic(__FILE__, "do_getstat: send failed: %d\n", r);
                return;
        }
        assert(dep->de_mode == DEM_ENABLED);
@@ -845,7 +854,13 @@ message *mp;
 
        put_userdata(mp->DL_PROC, (vir_bytes) mp->DL_ADDR,
                (vir_bytes) sizeof(dep->de_stat), &dep->de_stat);
-       reply(dep, OK, FALSE);
+
+       mp->m_type= DL_STAT_REPLY;
+       mp->DL_PORT= port;
+       mp->DL_STAT= OK;
+       r= send(mp->m_source, mp);
+       if (r != OK)
+               panic(__FILE__, "do_getstat: send failed: %d\n", r);
 }
 
 /*===========================================================================*
@@ -854,7 +869,7 @@ message *mp;
 static void do_getstat_s(mp)
 message *mp;
 {
-       int port;
+       int port, r;
        dpeth_t *dep;
 
        port = mp->DL_PORT;
@@ -866,7 +881,13 @@ message *mp;
        {
                put_userdata(mp->DL_PROC, (vir_bytes) mp->DL_ADDR,
                        (vir_bytes) sizeof(dep->de_stat), &dep->de_stat);
-               reply(dep, OK, FALSE);
+
+               mp->m_type= DL_STAT_REPLY;
+               mp->DL_PORT= port;
+               mp->DL_STAT= OK;
+               r= send(mp->m_source, mp);
+               if (r != OK)
+                       panic(__FILE__, "do_getstat: send failed: %d\n", r);
                return;
        }
        assert(dep->de_mode == DEM_ENABLED);
@@ -878,7 +899,13 @@ message *mp;
 
        put_userdata_s(mp->DL_PROC, mp->DL_GRANT,
                sizeof(dep->de_stat), &dep->de_stat);
-       reply(dep, OK, FALSE);
+
+       mp->m_type= DL_STAT_REPLY;
+       mp->DL_PORT= port;
+       mp->DL_STAT= OK;
+       r= send(mp->m_source, mp);
+       if (r != OK)
+               panic(__FILE__, "do_getstat: send failed: %d\n", r);
 }
 
 /*===========================================================================*
@@ -2714,7 +2741,10 @@ u8_t inb(port_t port)
 
        r= sys_inb(port, &value);
        if (r != OK)
+       {
+               printf("inb failed for port 0x%x\n", port);
                panic("DP8390","sys_inb failed", r);
+       }
        return value;
 }
 
index 2d31d629127662a9ce185a4c4ffc56fe003bc9ea..5772dc26358ff0f3c401c7f5c4340428bad06216 100644 (file)
@@ -37,10 +37,12 @@ PRIVATE struct pcitab
 };
 
 _PROTOTYPE( static void rtl_init, (struct dpeth *dep)                  );
+#if 0
 _PROTOTYPE( static u16_t get_ee_word, (dpeth_t *dep, int a)            );
 _PROTOTYPE( static void ee_wen, (dpeth_t *dep)                         );
 _PROTOTYPE( static void set_ee_word, (dpeth_t *dep, int a, U16_t w)    );
 _PROTOTYPE( static void ee_wds, (dpeth_t *dep)                         );
+#endif
 _PROTOTYPE( static void micro_delay, (unsigned long usecs)             );
 
 PUBLIC int rtl_probe(dep)
@@ -79,7 +81,7 @@ struct dpeth *dep;
 
        for(;;)
        {
-               for (i= 0; pcitab[i].vid != 0; i++)
+               for (i= 0; pcitab[i].vid != 0 || pcitab[i].did != 0; i++)
                {
                        if (pcitab[i].vid != vid)
                                continue;
@@ -93,7 +95,7 @@ struct dpeth *dep;
                        }
                        break;
                }
-               if (pcitab[i].vid != 0)
+               if (pcitab[i].vid != 0 || pcitab[i].did != 0)
                        break;
 
                if (just_one)
@@ -199,6 +201,7 @@ dpeth_t *dep;
        printf("\n");
 #endif
 
+#if 0
        if (getenv("RTL8029MN"))
        {
                ee_wen(dep);
@@ -226,8 +229,10 @@ dpeth_t *dep;
 
                assert(get_ee_word(dep, 0x76/2) == 0x8029);
        }
+#endif
 }
 
+#if 0
 static u16_t get_ee_word(dep, a)
 dpeth_t *dep;
 int a;
@@ -365,6 +370,7 @@ dpeth_t *dep;
        outb_reg3(dep, 1, 0x00);                /* back to normal */
        outb_reg0(dep, DP_CR, CR_PS_P0);        /* back to bank 0 */
 }
+#endif
 
 static void micro_delay(unsigned long usecs)
 {
index cb7f152afad87e01ccd748e31c4e77591b149a5e..860fda82cea228e185a45dc33d590ed5216d2a49 100644 (file)
@@ -29,7 +29,7 @@
  * |DL_GETSTAT_S| port nr  | proc nr |          |         |        |  grant  |
  * |------------|----------|---------|----------|---------|---------|---------|
  * | DL_STOP   | port_nr  |         |          |         |         |         |
- * |------------|----------|---------|----------|---------|---------|---------|
+ * |------------+----------+---------+----------+---------+---------+---------|
  *
  * The messages sent are:
  *
  * |DL_CONF_REPLY| port nr | last port | ethernet addr |
  * |-------------+---------+-----------+---------------|
  *
+ *   m_type      DL_PORT    DL_STAT       
+ * |------------|---------|-----------|
+ * |DL_STAT_REPL| port nr |   err     |
+ * |------------|---------|-----------|
+ *
+ *
  * Created:    Nov 2004 by Philip Homburg <philip@f-mnx.phicoh.com>
  */
 
@@ -1924,7 +1930,13 @@ message *mp;
                mp->DL_PROC, D, (vir_bytes) mp->DL_ADDR, sizeof(stats));
        if (r != OK)
                panic(__FILE__,"fxp_getstat: sys_vircopy failed", r);
-       reply(fp, OK, FALSE);
+
+       mp->m_type= DL_STAT_REPLY;
+       mp->DL_PORT= dl_port;
+       mp->DL_STAT= OK;
+       r= send(mp->m_source, mp);
+       if (r != OK)
+               panic(__FILE__, "fxp_getstat: send failed: %d\n", r);
 }
 
 
@@ -2002,7 +2014,13 @@ message *mp;
                sizeof(stats), D);
        if (r != OK)
                panic(__FILE__,"fxp_getstat_s: sys_safecopyto failed", r);
-       reply(fp, OK, FALSE);
+
+       mp->m_type= DL_STAT_REPLY;
+       mp->DL_PORT= dl_port;
+       mp->DL_STAT= OK;
+       r= send(mp->m_source, mp);
+       if (r != OK)
+               panic(__FILE__, "fxp_getstat_s: send failed: %d\n", r);
 }
 
 
index 9b31a326cf985a367d432842021a3cc4f1152649..1f37969e6c226546fd7ea3b19a1274e017296884 100644 (file)
@@ -1403,7 +1403,7 @@ iovec_dat_t *iovp;
 static void do_getstat_s(mp)
 message *mp;
 {
-  int port;
+  int r, port;
   ether_card_t *ec;
 
   port = mp->DL_PORT;
@@ -1415,7 +1415,13 @@ message *mp;
 
   put_userdata_s(mp->DL_PROC, mp->DL_GRANT,
                &ec->eth_stat, sizeof(ec->eth_stat));
-  reply(ec, OK, FALSE);
+
+  mp->m_type= DL_STAT_REPLY;
+  mp->DL_PORT= port;
+  mp->DL_STAT= OK;
+  r= send(mp->m_source, mp);
+  if (r != OK)
+       panic(__FILE__, "do_getstat_s: send failed: %d\n", r);
 }
 
 /*===========================================================================*
index f2571de8037dadbdc82a6ecc04deddaf15b0c64a..dbe91a549e20d0526301f8c31c0f5a9776e9d0b2 100755 (executable)
  *
  * The messages sent are:
  *
- *   m-type      DL_POR T   DL_PROC   DL_COUNT   DL_STAT   DL_CLCK
+ *   m_type      DL_PORT    DL_PROC   DL_COUNT   DL_STAT   DL_CLCK
  * |------------|----------|---------|----------|---------|---------|
  * |DL_TASK_REPL| port nr  | proc nr | rd-count | err|stat| clock   |
  * |------------|----------|---------|----------|---------|---------|
  *
  *   m_type      m3_i1     m3_i2       m3_ca1
- * |------------+---------+-----------+---------------|
+ * |------------|---------|-----------|---------------|
  * |DL_CONF_REPL| port nr | last port | ethernet addr |
  * |------------|---------|-----------|---------------|
  *
+ *   m_type      DL_PORT    DL_STAT       
+ * |------------|---------|-----------|
+ * |DL_STAT_REPL| port nr |   err     |
+ * |------------|---------|-----------|
+ *
  * Created:    Aug 2003 by Philip Homburg <philip@cs.vu.nl>
  * Changes:
  *   Aug 15, 2004   sync alarms replace watchdogs timers  (Jorrit N. Herder)
@@ -427,7 +432,7 @@ static void rtl8139_stop()
                        continue;
                rl_outb(rep->re_base_port, RL_CR, 0);
        }
-       sys_exit(0);
+       exit(0);
 }
 
 /*===========================================================================*
@@ -1877,6 +1882,10 @@ re_t *rep;
                        rl_writev(&rep->re_tx_mess, TRUE /* from int */,
                                TRUE /* vectored */);
                }
+               else if (rep->re_tx_mess.m_type == DL_WRITEV_S)
+               {
+                       rl_writev_s(&rep->re_tx_mess, TRUE /* from int */);
+               }
                else
                {
                        assert(rep->re_tx_mess.m_type == DL_WRITE);
@@ -2271,7 +2280,13 @@ message *mp;
                (vir_bytes) mp->DL_ADDR, sizeof(stats));
        if (r != OK)
                panic(__FILE__, "rl_getstat: sys_datacopy failed", r);
-       reply(rep, OK, FALSE);
+
+       mp->m_type= DL_STAT_REPLY;
+       mp->DL_PORT= port;
+       mp->DL_STAT= OK;
+       r= send(mp->m_source, mp);
+       if (r != OK)
+               panic("RTL8139", "rl_getstat: send failed: %d\n", r);
 }
 
 /*===========================================================================*
@@ -2299,7 +2314,13 @@ message *mp;
                (vir_bytes) &stats, sizeof(stats), D);
        if (r != OK)
                panic(__FILE__, "rl_getstat_s: sys_safecopyto failed", r);
-       reply(rep, OK, FALSE);
+
+       mp->m_type= DL_STAT_REPLY;
+       mp->DL_PORT= port;
+       mp->DL_STAT= OK;
+       r= send(mp->m_source, mp);
+       if (r != OK)
+               panic("RTL8139", "rl_getstat_s: send failed: %d\n", r);
 }