mirror of https://github.com/ipxe/ipxe.git
This at least compiles now. Haven't separated out the EMBEDDED code yet.
parent
1bd7b97e5c
commit
8c082aa468
|
@ -69,13 +69,10 @@
|
||||||
#include "etherboot.h"
|
#include "etherboot.h"
|
||||||
#include "nic.h"
|
#include "nic.h"
|
||||||
#include "isa.h"
|
#include "isa.h"
|
||||||
|
#include "console.h"
|
||||||
#include "cs89x0.h"
|
#include "cs89x0.h"
|
||||||
|
|
||||||
#ifndef EMBEDDED
|
|
||||||
static unsigned short eth_nic_base;
|
static unsigned short eth_nic_base;
|
||||||
#else
|
|
||||||
static unsigned long eth_nic_base;
|
|
||||||
#endif
|
|
||||||
static unsigned long eth_mem_start;
|
static unsigned long eth_mem_start;
|
||||||
static unsigned short eth_irqno;
|
static unsigned short eth_irqno;
|
||||||
static unsigned short eth_cs_type; /* one of: CS8900, CS8920, CS8920M */
|
static unsigned short eth_cs_type; /* one of: CS8900, CS8920, CS8920M */
|
||||||
|
@ -454,48 +451,46 @@ static void cs89x0_irq(struct nic *nic __unused, irq_action_t action __unused)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct nic_operations cs89x0_operations = {
|
||||||
|
.connect = dummy_connect,
|
||||||
|
.poll = cs89x0_poll,
|
||||||
|
.transmit = cs89x0_transmit,
|
||||||
|
.irq = cs89x0_irq,
|
||||||
|
.disable = cs89x0_disable,
|
||||||
|
};
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
ETH_PROBE - Look for an adapter
|
ETH_PROBE - Look for an adapter
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static int cs89x0_probe(struct dev *dev, unsigned short *probe_addrs __unused)
|
static int cs89x0_probe_addr ( uint16_t ioaddr ) {
|
||||||
{
|
|
||||||
struct nic *nic = (struct nic *)dev;
|
|
||||||
static const unsigned int netcard_portlist[] = {
|
|
||||||
#ifdef CS_SCAN
|
|
||||||
CS_SCAN,
|
|
||||||
#else /* use "conservative" default values for autoprobing */
|
|
||||||
#ifndef EMBEDDED
|
|
||||||
0x300,0x320,0x340,0x200,0x220,0x240,
|
|
||||||
0x260,0x280,0x2a0,0x2c0,0x2e0,
|
|
||||||
/* if that did not work, then be more aggressive */
|
|
||||||
0x301,0x321,0x341,0x201,0x221,0x241,
|
|
||||||
0x261,0x281,0x2a1,0x2c1,0x2e1,
|
|
||||||
#else
|
|
||||||
0x01000300,
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
0};
|
|
||||||
|
|
||||||
int i, result = -1;
|
|
||||||
unsigned rev_type = 0, ioaddr, ioidx, isa_cnf, cs_revision;
|
|
||||||
unsigned short eeprom_buff[CHKSUM_LEN];
|
|
||||||
|
|
||||||
|
|
||||||
for (ioidx = 0; (ioaddr=netcard_portlist[ioidx++]) != 0; ) {
|
|
||||||
/* if they give us an odd I/O address, then do ONE write to
|
/* if they give us an odd I/O address, then do ONE write to
|
||||||
the address port, to get it back to address zero, where we
|
the address port, to get it back to address zero, where we
|
||||||
expect to find the EISA signature word. */
|
expect to find the EISA signature word. */
|
||||||
if (ioaddr & 1) {
|
if (ioaddr & 1) {
|
||||||
ioaddr &= ~1;
|
ioaddr &= ~1;
|
||||||
if ((inw(ioaddr + ADD_PORT) & ADD_MASK) != ADD_SIG)
|
if ((inw(ioaddr + ADD_PORT) & ADD_MASK) != ADD_SIG)
|
||||||
continue;
|
return 0;
|
||||||
outw(PP_ChipID, ioaddr + ADD_PORT);
|
outw(PP_ChipID, ioaddr + ADD_PORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inw(ioaddr + DATA_PORT) != CHIP_EISA_ID_SIG)
|
if (inw(ioaddr + DATA_PORT) != CHIP_EISA_ID_SIG)
|
||||||
continue;
|
return 0;
|
||||||
eth_nic_base = ioaddr;
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int cs89x0_probe ( struct dev *dev, struct isa_device *isa ) {
|
||||||
|
struct nic *nic = nic_device ( dev );
|
||||||
|
|
||||||
|
int i, result = -1;
|
||||||
|
unsigned rev_type = 0, isa_cnf, cs_revision;
|
||||||
|
unsigned short eeprom_buff[CHKSUM_LEN];
|
||||||
|
|
||||||
|
nic->ioaddr = ( isa->ioaddr & ~1 );
|
||||||
|
nic->irqno = 0;
|
||||||
|
|
||||||
|
eth_nic_base = nic->ioaddr;
|
||||||
|
|
||||||
/* get the chip type */
|
/* get the chip type */
|
||||||
rev_type = readreg(PRODUCT_ID_ADD);
|
rev_type = readreg(PRODUCT_ID_ADD);
|
||||||
|
@ -512,17 +507,18 @@ static int cs89x0_probe(struct dev *dev, unsigned short *probe_addrs __unused)
|
||||||
if ((readreg(PP_SelfST) & EEPROM_PRESENT) == 0) {
|
if ((readreg(PP_SelfST) & EEPROM_PRESENT) == 0) {
|
||||||
printf("\ncs: no EEPROM...\n");
|
printf("\ncs: no EEPROM...\n");
|
||||||
outw(PP_ChipID, eth_nic_base + ADD_PORT);
|
outw(PP_ChipID, eth_nic_base + ADD_PORT);
|
||||||
continue; }
|
return 0;
|
||||||
else if (get_eeprom_data(START_EEPROM_DATA,CHKSUM_LEN,
|
} else if (get_eeprom_data(START_EEPROM_DATA,CHKSUM_LEN,
|
||||||
eeprom_buff) < 0) {
|
eeprom_buff) < 0) {
|
||||||
printf("\ncs: EEPROM read failed...\n");
|
printf("\ncs: EEPROM read failed...\n");
|
||||||
outw(PP_ChipID, eth_nic_base + ADD_PORT);
|
outw(PP_ChipID, eth_nic_base + ADD_PORT);
|
||||||
continue; }
|
return 0;
|
||||||
else if (get_eeprom_chksum(START_EEPROM_DATA,CHKSUM_LEN,
|
} else if (get_eeprom_chksum(START_EEPROM_DATA,CHKSUM_LEN,
|
||||||
eeprom_buff) < 0) {
|
eeprom_buff) < 0) {
|
||||||
printf("\ncs: EEPROM checksum bad...\n");
|
printf("\ncs: EEPROM checksum bad...\n");
|
||||||
outw(PP_ChipID, eth_nic_base + ADD_PORT);
|
outw(PP_ChipID, eth_nic_base + ADD_PORT);
|
||||||
continue; }
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* get transmission control word but keep the
|
/* get transmission control word but keep the
|
||||||
autonegotiation bits */
|
autonegotiation bits */
|
||||||
|
@ -605,7 +601,7 @@ static int cs89x0_probe(struct dev *dev, unsigned short *probe_addrs __unused)
|
||||||
writereg(PP_LineCTL, readreg(PP_LineCTL) &
|
writereg(PP_LineCTL, readreg(PP_LineCTL) &
|
||||||
~(SERIAL_TX_ON | SERIAL_RX_ON));
|
~(SERIAL_TX_ON | SERIAL_RX_ON));
|
||||||
outw(PP_ChipID, eth_nic_base + ADD_PORT);
|
outw(PP_ChipID, eth_nic_base + ADD_PORT);
|
||||||
continue;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Initialize the card for probing of the attached media */
|
/* Initialize the card for probing of the attached media */
|
||||||
|
@ -676,44 +672,37 @@ static int cs89x0_probe(struct dev *dev, unsigned short *probe_addrs __unused)
|
||||||
writereg(PP_LineCTL, readreg(PP_LineCTL) | SERIAL_RX_ON |
|
writereg(PP_LineCTL, readreg(PP_LineCTL) | SERIAL_RX_ON |
|
||||||
SERIAL_TX_ON);
|
SERIAL_TX_ON);
|
||||||
|
|
||||||
break;
|
return 0;
|
||||||
#ifdef EMBEDDED
|
#ifdef EMBEDDED
|
||||||
error:
|
error:
|
||||||
writereg(PP_LineCTL, readreg(PP_LineCTL) &
|
writereg(PP_LineCTL, readreg(PP_LineCTL) &
|
||||||
~(SERIAL_TX_ON | SERIAL_RX_ON));
|
~(SERIAL_TX_ON | SERIAL_RX_ON));
|
||||||
outw(PP_ChipID, eth_nic_base + ADD_PORT);
|
outw(PP_ChipID, eth_nic_base + ADD_PORT);
|
||||||
continue;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
if (ioaddr == 0)
|
|
||||||
return (0);
|
|
||||||
|
|
||||||
nic->irqno = 0;
|
|
||||||
nic->ioaddr = ioaddr;
|
|
||||||
static struct nic_operations cs89x0_operations;
|
|
||||||
static struct nic_operations cs89x0_operations = {
|
|
||||||
.connect = dummy_connect,
|
|
||||||
.poll = cs89x0_poll,
|
|
||||||
.transmit = cs89x0_transmit,
|
|
||||||
.irq = cs89x0_irq,
|
|
||||||
.disable = cs89x0_disable,
|
|
||||||
};
|
|
||||||
nic->nic_op = &cs89x0_operations;
|
nic->nic_op = &cs89x0_operations;
|
||||||
|
|
||||||
/* Based on PnP ISA map */
|
|
||||||
dev->devid.vendor_id = htons(ISAPNP_VENDOR('C','S','C'));
|
|
||||||
dev->devid.device_id = htons(0x0007);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct isa_driver cs89x0_driver __isa_driver = {
|
static struct isa_probe_addr cs89x0_probe_addrs[] = {
|
||||||
.type = NIC_DRIVER,
|
#ifndef EMBEDDED
|
||||||
.name = "CS89x0",
|
/* use "conservative" default values for autoprobing */
|
||||||
.probe = cs89x0_probe,
|
{ 0x300 }, { 0x320 }, { 0x340 }, { 0x200 }, { 0x220 }, { 0x240 },
|
||||||
.ioaddrs = 0,
|
{ 0x260 }, { 0x280 }, { 0x2a0 }, { 0x2c0 }, { 0x2e0 },
|
||||||
|
/* if that did not work, then be more aggressive */
|
||||||
|
{ 0x301 }, { 0x321 }, { 0x341 }, { 0x201 }, { 0x221 }, { 0x241 },
|
||||||
|
{ 0x261 }, { 0x281 }, { 0x2a1 }, { 0x2c1 }, { 0x2e1 },
|
||||||
|
#else
|
||||||
|
0x01000300,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
ISA_ROM("cs89x0","Crystal Semiconductor CS89x0");
|
|
||||||
|
static struct isa_driver cs89x0_driver =
|
||||||
|
ISA_DRIVER ( "CS89x0", cs89x0_probe_addrs, cs89x0_probe_addr,
|
||||||
|
ISAPNP_VENDOR('C','S','C'), 0x0007 );
|
||||||
|
|
||||||
|
ISA_ROM ( "cs89x0", "Crystal Semiconductor CS89x0" );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Local variables:
|
* Local variables:
|
||||||
|
|
Loading…
Reference in New Issue