From: Philip Homburg Date: Mon, 23 Apr 2007 15:38:00 +0000 (+0000) Subject: Ethernet driver changes for asynchronous inet. X-Git-Tag: v3.1.4~400 X-Git-Url: http://zhaoyanbai.com/repos/README?a=commitdiff_plain;h=50f81c4939ba705ecc36d4a55855fcd78ca4bbbd;p=minix.git Ethernet driver changes for asynchronous inet. --- diff --git a/drivers/dp8390/dp8390.c b/drivers/dp8390/dp8390.c index fdf636fcd..4f62de524 100644 --- a/drivers/dp8390/dp8390.c +++ b/drivers/dp8390/dp8390.c @@ -398,7 +398,10 @@ static void pci_conf() for (i= 0, dep= de_table; ide_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; } diff --git a/drivers/dp8390/rtl8029.c b/drivers/dp8390/rtl8029.c index 2d31d6291..5772dc263 100644 --- a/drivers/dp8390/rtl8029.c +++ b/drivers/dp8390/rtl8029.c @@ -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) { diff --git a/drivers/fxp/fxp.c b/drivers/fxp/fxp.c index cb7f152af..860fda82c 100644 --- a/drivers/fxp/fxp.c +++ b/drivers/fxp/fxp.c @@ -29,7 +29,7 @@ * |DL_GETSTAT_S| port nr | proc nr | | | | grant | * |------------|----------|---------|----------|---------|---------|---------| * | DL_STOP | port_nr | | | | | | - * |------------|----------|---------|----------|---------|---------|---------| + * |------------+----------+---------+----------+---------+---------+---------| * * The messages sent are: * @@ -43,6 +43,12 @@ * |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 */ @@ -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); } diff --git a/drivers/lance/lance.c b/drivers/lance/lance.c index 9b31a326c..1f37969e6 100644 --- a/drivers/lance/lance.c +++ b/drivers/lance/lance.c @@ -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); } /*===========================================================================* diff --git a/drivers/rtl8139/rtl8139.c b/drivers/rtl8139/rtl8139.c index f2571de80..dbe91a549 100755 --- a/drivers/rtl8139/rtl8139.c +++ b/drivers/rtl8139/rtl8139.c @@ -33,16 +33,21 @@ * * 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 * 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); }