Deleted Added
full compact
30c30
< __FBSDID("$FreeBSD: head/sys/dev/cs/if_cs.c 179507 2008-06-03 05:47:28Z imp $");
---
> __FBSDID("$FreeBSD: head/sys/dev/cs/if_cs.c 179532 2008-06-04 06:07:13Z imp $");
121a122,131
> static int cs8900_eeint2irq[16] = {
> 10, 11, 12, 5, 255, 255, 255, 255,
> 255, 255, 255, 255, 255, 255, 255, 255
> };
>
> static int cs8900_irq2eeint[16] = {
> 255, 255, 255, 255, 255, 3, 255, 255,
> 255, 0, 1, 2, 255, 255, 255, 255
> };
>
351c361
< if(chip_type==CS8900) {
---
> if (chip_type == CS8900) {
369c379
< * If no interrupt specified (or "?"), use what the board tells us.
---
> * If no interrupt specified, use what the board tells us.
377a388,391
> } else if (get_eeprom_data(sc,START_EEPROM_DATA,CHKSUM_LEN, eeprom_buff)<0) {
> device_printf(dev, "EEPROM read failed, assuming defaults.\n");
> } else if (get_eeprom_cksum(START_EEPROM_DATA,CHKSUM_LEN, eeprom_buff)<0) {
> device_printf(dev, "EEPROM cheksum bad, assuming defaults.\n");
379,385c393,408
< if (get_eeprom_data(sc,START_EEPROM_DATA,CHKSUM_LEN, eeprom_buff)<0) {
< device_printf(dev, "EEPROM read failed, "
< "assuming defaults.\n");
< } else {
< if (get_eeprom_cksum(START_EEPROM_DATA,CHKSUM_LEN, eeprom_buff)<0) {
< device_printf(dev, "EEPROM cheksum bad, "
< "assuming defaults.\n");
---
> sc->auto_neg_cnf = eeprom_buff[AUTO_NEG_CNF_OFFSET/2];
> sc->adapter_cnf = eeprom_buff[ADAPTER_CNF_OFFSET/2];
> sc->isa_config = eeprom_buff[ISA_CNF_OFFSET/2];
> for (i=0; i<ETHER_ADDR_LEN/2; i++) {
> sc->enaddr[i*2] = eeprom_buff[i];
> sc->enaddr[i*2+1] = eeprom_buff[i] >> 8;
> }
> /*
> * If no interrupt specified, use what the
> * board tells us.
> */
> if (error) {
> irq = sc->isa_config & INT_NO_MASK;
> error = 0;
> if (chip_type == CS8900) {
> irq = cs8900_eeint2irq[irq];
387,435c410,411
< sc->auto_neg_cnf =
< eeprom_buff[AUTO_NEG_CNF_OFFSET/2];
< sc->adapter_cnf =
< eeprom_buff[ADAPTER_CNF_OFFSET/2];
< sc->isa_config =
< eeprom_buff[ISA_CNF_OFFSET/2];
<
< for (i=0; i<ETHER_ADDR_LEN/2; i++) {
< sc->enaddr[i*2]=
< eeprom_buff[i];
< sc->enaddr[i*2+1]=
< eeprom_buff[i] >> 8;
< }
<
< /*
< * If no interrupt specified,
< * use what the board tells us.
< */
< if (error) {
< irq = sc->isa_config & INT_NO_MASK;
< error = 0;
< if (chip_type==CS8900) {
< switch(irq) {
< case 0:
< irq=10;
< break;
< case 1:
< irq=11;
< break;
< case 2:
< irq=12;
< break;
< case 3:
< irq=5;
< break;
< default:
< device_printf(dev, "invalid irq in EEPROM.\n");
< error=EINVAL;
< }
< } else {
< if (irq>CS8920_NO_INTS) {
< device_printf(dev, "invalid irq in EEPROM.\n");
< error=EINVAL;
< }
< }
< if (!error)
< bus_set_resource(dev, SYS_RES_IRQ, 0,
< irq, 1);
< }
---
> if (irq > CS8920_NO_INTS)
> irq = 255;
436a413,419
> if (irq == 255) {
> device_printf(dev, "invalid irq in EEPROM.\n");
> error = EINVAL;
> }
> if (!error)
> bus_set_resource(dev, SYS_RES_IRQ, 0,
> irq, 1);
440c423
< if (!error) {
---
> if (!error && !(sc->flags & CS_NO_IRQ)) {
442,458c425,428
< switch(irq) {
< case 5:
< irq = 3;
< break;
< case 10:
< irq = 0;
< break;
< case 11:
< irq = 1;
< break;
< case 12:
< irq = 2;
< break;
< default:
< error = EINVAL;
< break;
< }
---
> if (irq >= 0 || irq < 16)
> irq = cs8900_irq2eeint[irq];
> else
> irq = 255;
460,461c430,431
< if (irq > CS8920_NO_INTS && !(sc->flags & CS_NO_IRQ))
< error = EINVAL;
---
> if (irq > CS8920_NO_INTS)
> irq = 255;
462a433,434
> if (irq == 255)
> error = EINVAL;
486,487c458,459
< chip_type==CS8900 ? '0' : '2',
< chip_type==CS8920M ? "M" : "",
---
> chip_type == CS8900 ? '0' : '2',
> chip_type == CS8920M ? "M" : "",
1264c1236
< int error;
---
> int error = 0;
1283,1284c1255
< if ((error=enable_tp(sc)) != 0)
< break;
---
> enable_tp(sc);