Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 34 → Rev 84

/shark/tags/rel_0_4/drivers/net/eth.c
20,11 → 20,11
 
/**
------------
CVS : $Id: eth.c,v 1.1.1.1 2002-03-29 14:12:50 pj Exp $
CVS : $Id: eth.c,v 1.3 2002-11-11 08:41:31 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:50 $
Revision: $Revision: 1.3 $
Last update: $Date: 2002-11-11 08:41:31 $
------------
**/
 
74,6 → 74,8
/*#include "lowlev.h"
//#include "3com.h" */
 
//#define DEBUG_ETH
 
#define ETH_PAGE 5
 
struct eth_service{
131,7 → 133,7
 
void dev_tint(struct device *dev)
{
cprintf("Warning!!!! dev_tint called!!! (Why???)\n");
printk(KERN_WARNING "Warning!!!! dev_tint called!!! (Why?)\n");
sys_abort(201);
}
145,7 → 147,7
{
//cprintf("DENTRO netif_rx, skbuf=%p\n",skb->data);
if (nettask_pid == NIL) {
cprintf("Net receives packets, but the driver doesn't exist!!!\n");
printk(KERN_CRIT "Net receives packets, but the driver doesn't exist!!!\n");
sys_abort(300);
}
200,7 → 202,7
/* formatted print of an ethernet header */
void eth_printHeader(struct eth_header *p)
{
cprintf("Dest : %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x \n",p->dest.ad[0],
cprintf("Dest : %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x \n",p->dest.ad[0],
p->dest.ad[1],
p->dest.ad[2],
p->dest.ad[3],
338,27 → 340,27
{
int p;
 
if (err != ETH_BUFFERS_FULL) cprintf("Ethernet : ");
if (err != ETH_BUFFERS_FULL) printk(KERN_ERR "Ethernet : ");
switch (err) {
case ETH_DRIVER_NOT_FOUND :
cprintf("NET PANIC --> Etherlink not found.\n");
printk(KERN_ERR "NET PANIC --> Etherlink not found.\n");
return 0;
case ETH_RXERROR :
cprintf("Receive error (vero dramma!!!).\n");
printk(KERN_ERR "Receive error (vero dramma!!!).\n");
return 0;
case ETH_TXERROR :
cprintf("Transimit error: N. Max Retry.\n");
printk(KERN_ERR "Transimit error: N. Max Retry.\n");
return 0;
case ETH_PROTOCOL_ERROR :
cprintf("Too much protocols.\n");
printk(KERN_ERR "Too much protocols.\n");
return 0;
case ETH_BUFFERS_FULL:
cprintf("Buffers full: frame lost!\n");
printk(KERN_ERR "Buffers full: frame lost!\n");
return 1;
case ETH_NULLPROTOCOL_EXC:
cprintf("Null protocol called!!!\n");
printk(KERN_ERR "Null protocol called!!!\n");
for (p = 0; p < ETH_MAX_PROTOCOLS; p++) {
cprintf("%d: %d\n", p, eth_table[p].type);
printk(KERN_ERR "%d: %d\n", p, eth_table[p].type);
}
return 0;
default :
377,7 → 379,7
int linux_found = 0;
 
if (!ethIsInstalled) {
cprintf(" Hartik Net lib\n\n");
printk(KERN_INFO "Hartik/Shark Net lib");
/* Scan the devices connected to the PCI bus */
cardtype = NONE;
 
391,24 → 393,30
soft_task_def_aperiodic(m_soft);
soft_task_def_system(m_soft);
soft_task_def_nokill(m_soft);
m = &m_soft;
m = (TASK_MODEL *)&m_soft;
}
 
nettask_pid = task_create("rxProc", net_extern_driver, m, NULL);
if (nettask_pid == NIL) {
cprintf("Can't create extern driver!!!\n");
return 0;
printk(KERN_ERR "Can't create extern driver!!!\n");
return 0;
}
task_activate(nettask_pid);
if (pci_init() == 1) {
linuxpci_init();
// pci_show();
cprintf("LF %d\n", linux_found);
#ifdef DEBUG_ETH
printk(KERN_DEBUG "LF %d\n", linux_found);
#endif
linux_found += (rtl8139_probe(&device0) == 0);
cprintf("LF %d\n", linux_found);
#ifdef DEBUG_ETH
printk(KERN_DEBUG "LF %d\n", linux_found);
#endif
linux_found += (tc59x_probe(&device0) == 0);
cprintf("LF %d\n", linux_found);
#ifdef DEBUG_ETH
printk(KERN_DEBUG "LF %d\n", linux_found);
#endif
#if 0
ndev = pci_scan_bus(pci_devs);
#ifdef __ETH_DBG__
434,7 → 442,7
} else {
lowlev_send = vortex_send_mem;
}
cprintf("PCI Ethlink card found:\n");
printk(KERN_INFO "PCI Ethlink card found:\n");
lowlev_info(r);
cardtype = VORTEX;
}
460,10 → 468,14
#else
}
if (linux_found == 0) {
linux_found += (el3_probe(&device0) == 0);
cprintf("LF %d\n", linux_found);
linux_found += (ne_probe(&device0) == 0);
cprintf("LF %d\n", linux_found);
linux_found += (el3_probe(&device0) == 0);
#ifdef DEBUG_ETH
printk(KERN_DEBUG "LF %d\n", linux_found);
#endif
linux_found += (ne_probe(&device0) == 0);
#ifdef DEBUG_ETH
printk(KERN_DEBUG "LF %d\n", linux_found);
#endif
}
 
/*
474,9 → 486,9
*/
if (linux_found) {
device0.open(&device0);
cprintf("Net card found!!!\n");
printk(KERN_INFO "Net card found!!!\n");
} else {
cprintf("No card found... \n");
printk(KERN_INFO "No card found... \n");
/* cprintf("No card found... Installing loopback device\n");
loopback_init(&device0);
device0.open(&device0);*/
497,7 → 509,7
sys_atrunlevel(eth_close,NULL,RUNLEVEL_BEFORE_EXIT);
 
} else {
cprintf("Ethernet already installed!!!\n");
printk(KERN_INFO "Ethernet already installed!!!\n");
return 0;
}
return 1;
505,10 → 517,12
 
void eth_close(void *a)
{
kern_printf("CLOSE!!!!\n");
if (ethIsInstalled == TRUE) {
device0.stop(&device0); /*This seems to break everithing...
// lowlev_close(eth_dev.BaseAddress);*/
ethIsInstalled = FALSE;
}
#ifdef DEBUG_ETH
printk(KERN_DEBUG "CLOSE!!!!\n");
#endif
if (ethIsInstalled == TRUE) {
device0.stop(&device0); /*This seems to break everithing...
// lowlev_close(eth_dev.BaseAddress);*/
ethIsInstalled = FALSE;
}
}