Hand-finished

This commit is contained in:
Michael Brown
2005-04-13 00:15:45 +00:00
parent 91e46ed588
commit 28590d718b

View File

@@ -180,30 +180,25 @@ static void rtl_transmit(struct nic *nic, const char *destaddr,
static int rtl_poll(struct nic *nic, int retrieve); static int rtl_poll(struct nic *nic, int retrieve);
static void rtl_disable(struct nic *nic); static void rtl_disable(struct nic *nic);
static void rtl_irq(struct nic *nic, irq_action_t action); static void rtl_irq(struct nic *nic, irq_action_t action);
static struct nic_operations rtl_operations;
static struct pci_driver rtl8139_driver;
static int rtl8139_probe ( struct dev *dev ) { static int rtl8139_probe ( struct dev *dev ) {
struct nic *nic = nic_device ( dev ); struct nic *nic = nic_device ( dev );
struct pci_device *pci = pci_device ( dev ); struct pci_device *pci = pci_device ( dev );
int i; int i;
int speed10, fullduplex; int speed10, fullduplex;
int addr_len; int addr_len;
unsigned short *ap = (unsigned short*)nic->node_addr; unsigned short *ap = (unsigned short*)nic->node_addr;
/* There are enough "RTL8139" strings on the console already, so /* Look for PCI device */
* be brief and concentrate on the interesting pieces of info... */ if ( ! find_pci_device ( pci, &rtl8139_driver ) )
printf(" - "); return 0;
/* Mask the bit that says "this is an io addr" */ /* Copy ioaddr and IRQ from PCI information */
nic->ioaddr = pci->ioaddr & ~3; nic->ioaddr = pci->ioaddr;
/* Copy IRQ from PCI information */
nic->irqno = pci->irq; nic->irqno = pci->irq;
adjust_pci_device(pci);
/* Bring the chip out of low-power mode. */ /* Bring the chip out of low-power mode. */
outb(0x00, nic->ioaddr + Config1); outb(0x00, nic->ioaddr + Config1);
@@ -211,28 +206,14 @@ static int rtl8139_probe ( struct dev *dev ) {
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
*ap++ = read_eeprom(nic,i + 7,addr_len); *ap++ = read_eeprom(nic,i + 7,addr_len);
speed10 = inb(nic->ioaddr + MediaStatus) & MSRSpeed10;
fullduplex = inw(nic->ioaddr + MII_BMCR) & BMCRDuplex;
printf("ioaddr %#hX, irq %d, addr %! %sMbps %s-duplex\n", nic->ioaddr,
nic->irqno, nic->node_addr, speed10 ? "10" : "100",
fullduplex ? "full" : "half");
rtl_reset(nic); rtl_reset(nic);
if (inb(nic->ioaddr + MediaStatus) & MSRLinkFail) { speed10 = inb(nic->ioaddr + MediaStatus) & MSRSpeed10;
printf("Cable not connected or other link failure\n"); nic->mbps = speed10 ? 10 : 100;
return(0); fullduplex = inw(nic->ioaddr + MII_BMCR) & BMCRDuplex;
} nic->duplex = fullduplex ? FULL_DUPLEX : HALF_DUPLEX;
static struct nic_operations rtl_operations;
static struct nic_operations rtl_operations = {
.connect = dummy_connect,
.poll = rtl_poll,
.transmit = rtl_transmit,
.irq = rtl_irq,
.disable = rtl_disable,
};
nic->nic_op = &rtl_operations;
nic->nic_op = &rtl_operations;
return 1; return 1;
} }
@@ -313,6 +294,14 @@ static void set_rx_mode(struct nic *nic) {
outl(mc_filter[1], nic->ioaddr + MAR0 + 4); outl(mc_filter[1], nic->ioaddr + MAR0 + 4);
} }
static int rtl_connect ( struct nic *nic ) {
if (inb(nic->ioaddr + MediaStatus) & MSRLinkFail) {
printf("Cable not connected or other link failure\n");
return 0;
}
return 1;
}
static void rtl_reset(struct nic* nic) static void rtl_reset(struct nic* nic)
{ {
int i; int i;
@@ -528,6 +517,14 @@ static void rtl_disable ( struct nic *nic ) {
/* wait */; /* wait */;
} }
static struct nic_operations rtl_operations = {
.connect = rtl_connect,
.poll = rtl_poll,
.transmit = rtl_transmit,
.irq = rtl_irq,
.disable = rtl_disable,
};
static struct pci_id rtl8139_nics[] = { static struct pci_id rtl8139_nics[] = {
PCI_ROM(0x10ec, 0x8129, "rtl8129", "Realtek 8129"), PCI_ROM(0x10ec, 0x8129, "rtl8129", "Realtek 8129"),
PCI_ROM(0x10ec, 0x8139, "rtl8139", "Realtek 8139"), PCI_ROM(0x10ec, 0x8139, "rtl8139", "Realtek 8139"),