Ethernet driver changes for asynchronous inet.
This commit is contained in:
parent
bb659b1ad6
commit
50f81c4939
@ -398,7 +398,10 @@ static void pci_conf()
|
|||||||
for (i= 0, dep= de_table; i<DE_PORT_NR; i++, dep++)
|
for (i= 0, dep= de_table; i<DE_PORT_NR; i++, dep++)
|
||||||
{
|
{
|
||||||
if (!dep->de_pci)
|
if (!dep->de_pci)
|
||||||
|
{
|
||||||
|
printf("pci: no pci for port %d\n", i);
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if (((dep->de_pcibus | dep->de_pcidev |
|
if (((dep->de_pcibus | dep->de_pcidev |
|
||||||
dep->de_pcifunc) != 0) != h)
|
dep->de_pcifunc) != 0) != h)
|
||||||
{
|
{
|
||||||
@ -821,7 +824,7 @@ dpeth_t *dep;
|
|||||||
static void do_getstat(mp)
|
static void do_getstat(mp)
|
||||||
message *mp;
|
message *mp;
|
||||||
{
|
{
|
||||||
int port;
|
int port, r;
|
||||||
dpeth_t *dep;
|
dpeth_t *dep;
|
||||||
|
|
||||||
port = mp->DL_PORT;
|
port = mp->DL_PORT;
|
||||||
@ -833,7 +836,13 @@ message *mp;
|
|||||||
{
|
{
|
||||||
put_userdata(mp->DL_PROC, (vir_bytes) mp->DL_ADDR,
|
put_userdata(mp->DL_PROC, (vir_bytes) mp->DL_ADDR,
|
||||||
(vir_bytes) sizeof(dep->de_stat), &dep->de_stat);
|
(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;
|
return;
|
||||||
}
|
}
|
||||||
assert(dep->de_mode == DEM_ENABLED);
|
assert(dep->de_mode == DEM_ENABLED);
|
||||||
@ -845,7 +854,13 @@ message *mp;
|
|||||||
|
|
||||||
put_userdata(mp->DL_PROC, (vir_bytes) mp->DL_ADDR,
|
put_userdata(mp->DL_PROC, (vir_bytes) mp->DL_ADDR,
|
||||||
(vir_bytes) sizeof(dep->de_stat), &dep->de_stat);
|
(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)
|
static void do_getstat_s(mp)
|
||||||
message *mp;
|
message *mp;
|
||||||
{
|
{
|
||||||
int port;
|
int port, r;
|
||||||
dpeth_t *dep;
|
dpeth_t *dep;
|
||||||
|
|
||||||
port = mp->DL_PORT;
|
port = mp->DL_PORT;
|
||||||
@ -866,7 +881,13 @@ message *mp;
|
|||||||
{
|
{
|
||||||
put_userdata(mp->DL_PROC, (vir_bytes) mp->DL_ADDR,
|
put_userdata(mp->DL_PROC, (vir_bytes) mp->DL_ADDR,
|
||||||
(vir_bytes) sizeof(dep->de_stat), &dep->de_stat);
|
(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;
|
return;
|
||||||
}
|
}
|
||||||
assert(dep->de_mode == DEM_ENABLED);
|
assert(dep->de_mode == DEM_ENABLED);
|
||||||
@ -878,7 +899,13 @@ message *mp;
|
|||||||
|
|
||||||
put_userdata_s(mp->DL_PROC, mp->DL_GRANT,
|
put_userdata_s(mp->DL_PROC, mp->DL_GRANT,
|
||||||
sizeof(dep->de_stat), &dep->de_stat);
|
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);
|
r= sys_inb(port, &value);
|
||||||
if (r != OK)
|
if (r != OK)
|
||||||
|
{
|
||||||
|
printf("inb failed for port 0x%x\n", port);
|
||||||
panic("DP8390","sys_inb failed", r);
|
panic("DP8390","sys_inb failed", r);
|
||||||
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,10 +37,12 @@ PRIVATE struct pcitab
|
|||||||
};
|
};
|
||||||
|
|
||||||
_PROTOTYPE( static void rtl_init, (struct dpeth *dep) );
|
_PROTOTYPE( static void rtl_init, (struct dpeth *dep) );
|
||||||
|
#if 0
|
||||||
_PROTOTYPE( static u16_t get_ee_word, (dpeth_t *dep, int a) );
|
_PROTOTYPE( static u16_t get_ee_word, (dpeth_t *dep, int a) );
|
||||||
_PROTOTYPE( static void ee_wen, (dpeth_t *dep) );
|
_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 set_ee_word, (dpeth_t *dep, int a, U16_t w) );
|
||||||
_PROTOTYPE( static void ee_wds, (dpeth_t *dep) );
|
_PROTOTYPE( static void ee_wds, (dpeth_t *dep) );
|
||||||
|
#endif
|
||||||
_PROTOTYPE( static void micro_delay, (unsigned long usecs) );
|
_PROTOTYPE( static void micro_delay, (unsigned long usecs) );
|
||||||
|
|
||||||
PUBLIC int rtl_probe(dep)
|
PUBLIC int rtl_probe(dep)
|
||||||
@ -79,7 +81,7 @@ struct dpeth *dep;
|
|||||||
|
|
||||||
for(;;)
|
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)
|
if (pcitab[i].vid != vid)
|
||||||
continue;
|
continue;
|
||||||
@ -93,7 +95,7 @@ struct dpeth *dep;
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (pcitab[i].vid != 0)
|
if (pcitab[i].vid != 0 || pcitab[i].did != 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (just_one)
|
if (just_one)
|
||||||
@ -199,6 +201,7 @@ dpeth_t *dep;
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (getenv("RTL8029MN"))
|
if (getenv("RTL8029MN"))
|
||||||
{
|
{
|
||||||
ee_wen(dep);
|
ee_wen(dep);
|
||||||
@ -226,8 +229,10 @@ dpeth_t *dep;
|
|||||||
|
|
||||||
assert(get_ee_word(dep, 0x76/2) == 0x8029);
|
assert(get_ee_word(dep, 0x76/2) == 0x8029);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static u16_t get_ee_word(dep, a)
|
static u16_t get_ee_word(dep, a)
|
||||||
dpeth_t *dep;
|
dpeth_t *dep;
|
||||||
int a;
|
int a;
|
||||||
@ -365,6 +370,7 @@ dpeth_t *dep;
|
|||||||
outb_reg3(dep, 1, 0x00); /* back to normal */
|
outb_reg3(dep, 1, 0x00); /* back to normal */
|
||||||
outb_reg0(dep, DP_CR, CR_PS_P0); /* back to bank 0 */
|
outb_reg0(dep, DP_CR, CR_PS_P0); /* back to bank 0 */
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void micro_delay(unsigned long usecs)
|
static void micro_delay(unsigned long usecs)
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* |DL_GETSTAT_S| port nr | proc nr | | | | grant |
|
* |DL_GETSTAT_S| port nr | proc nr | | | | grant |
|
||||||
* |------------|----------|---------|----------|---------|---------|---------|
|
* |------------|----------|---------|----------|---------|---------|---------|
|
||||||
* | DL_STOP | port_nr | | | | | |
|
* | DL_STOP | port_nr | | | | | |
|
||||||
* |------------|----------|---------|----------|---------|---------|---------|
|
* |------------+----------+---------+----------+---------+---------+---------|
|
||||||
*
|
*
|
||||||
* The messages sent are:
|
* The messages sent are:
|
||||||
*
|
*
|
||||||
@ -43,6 +43,12 @@
|
|||||||
* |DL_CONF_REPLY| port nr | last port | ethernet addr |
|
* |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>
|
* 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));
|
mp->DL_PROC, D, (vir_bytes) mp->DL_ADDR, sizeof(stats));
|
||||||
if (r != OK)
|
if (r != OK)
|
||||||
panic(__FILE__,"fxp_getstat: sys_vircopy failed", r);
|
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);
|
sizeof(stats), D);
|
||||||
if (r != OK)
|
if (r != OK)
|
||||||
panic(__FILE__,"fxp_getstat_s: sys_safecopyto failed", r);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1403,7 +1403,7 @@ iovec_dat_t *iovp;
|
|||||||
static void do_getstat_s(mp)
|
static void do_getstat_s(mp)
|
||||||
message *mp;
|
message *mp;
|
||||||
{
|
{
|
||||||
int port;
|
int r, port;
|
||||||
ether_card_t *ec;
|
ether_card_t *ec;
|
||||||
|
|
||||||
port = mp->DL_PORT;
|
port = mp->DL_PORT;
|
||||||
@ -1415,7 +1415,13 @@ message *mp;
|
|||||||
|
|
||||||
put_userdata_s(mp->DL_PROC, mp->DL_GRANT,
|
put_userdata_s(mp->DL_PROC, mp->DL_GRANT,
|
||||||
&ec->eth_stat, sizeof(ec->eth_stat));
|
&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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
|
@ -33,16 +33,21 @@
|
|||||||
*
|
*
|
||||||
* The messages sent are:
|
* 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 |
|
* |DL_TASK_REPL| port nr | proc nr | rd-count | err|stat| clock |
|
||||||
* |------------|----------|---------|----------|---------|---------|
|
* |------------|----------|---------|----------|---------|---------|
|
||||||
*
|
*
|
||||||
* m_type m3_i1 m3_i2 m3_ca1
|
* m_type m3_i1 m3_i2 m3_ca1
|
||||||
* |------------+---------+-----------+---------------|
|
* |------------|---------|-----------|---------------|
|
||||||
* |DL_CONF_REPL| port nr | last port | ethernet addr |
|
* |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>
|
* Created: Aug 2003 by Philip Homburg <philip@cs.vu.nl>
|
||||||
* Changes:
|
* Changes:
|
||||||
* Aug 15, 2004 sync alarms replace watchdogs timers (Jorrit N. Herder)
|
* Aug 15, 2004 sync alarms replace watchdogs timers (Jorrit N. Herder)
|
||||||
@ -427,7 +432,7 @@ static void rtl8139_stop()
|
|||||||
continue;
|
continue;
|
||||||
rl_outb(rep->re_base_port, RL_CR, 0);
|
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 */,
|
rl_writev(&rep->re_tx_mess, TRUE /* from int */,
|
||||||
TRUE /* vectored */);
|
TRUE /* vectored */);
|
||||||
}
|
}
|
||||||
|
else if (rep->re_tx_mess.m_type == DL_WRITEV_S)
|
||||||
|
{
|
||||||
|
rl_writev_s(&rep->re_tx_mess, TRUE /* from int */);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(rep->re_tx_mess.m_type == DL_WRITE);
|
assert(rep->re_tx_mess.m_type == DL_WRITE);
|
||||||
@ -2271,7 +2280,13 @@ message *mp;
|
|||||||
(vir_bytes) mp->DL_ADDR, sizeof(stats));
|
(vir_bytes) mp->DL_ADDR, sizeof(stats));
|
||||||
if (r != OK)
|
if (r != OK)
|
||||||
panic(__FILE__, "rl_getstat: sys_datacopy failed", r);
|
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);
|
(vir_bytes) &stats, sizeof(stats), D);
|
||||||
if (r != OK)
|
if (r != OK)
|
||||||
panic(__FILE__, "rl_getstat_s: sys_safecopyto failed", r);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user