diff --git a/i825xx.c b/i825xx.c index 8ee0e2b..a68cb4c 100644 --- a/i825xx.c +++ b/i825xx.c @@ -315,20 +315,29 @@ unsigned char i825xx_detect_eeprom(struct i825xx_device_t *net_dev) { return eeprom_exists; } + +unsigned short e1000_dev_ids[] = { + 0x100e, + 0x153a, + 0x10ea +}; + struct ether_t *init_i825xx(int count) { struct pci_device *pci_dev; struct i825xx_device_t *i825xx_dev; struct ether_t *ether_dev; unsigned int i; unsigned short j; - if (!pci_find_device_by_vendor(0x8086, 0x100E, &pci_dev, count)) { - if (!pci_find_device_by_vendor(0x8086, 0x153A, &pci_dev, count)) { - if (!pci_find_device_by_vendor(0x8086, 0x10EA, &pci_dev, count)) { - return (void *)0; - } + unsigned char found = 0; + + for (int d = 0; d < 3; d++) { + if (pci_find_device_by_vendor(0x8086, e1000_dev_ids[d], &pci_dev, count)) { + found = 1; + break; } } + if (!found) return (void *)0; i825xx_dev = (struct i825xx_device_t *)malloc(sizeof(struct i825xx_device_t)); ether_dev = (struct ether_t *)malloc(sizeof(struct ether_t)); @@ -358,8 +367,12 @@ struct ether_t *init_i825xx(int count) { mmio_write(i825xx_dev, REG_CTRL, CTRL_RESET); mmio_write(i825xx_dev, REG_IMC, 0xffffffff); - i825xx_dev->have_eeprom = i825xx_detect_eeprom(i825xx_dev); - + if (pci_dev->device != 0x1502) { + i825xx_dev->have_eeprom = i825xx_detect_eeprom(i825xx_dev); + } else { + i825xx_dev->have_eeprom = 0; + } + if (i825xx_dev->have_eeprom) { unsigned short temp; temp = net_eeprom_read(i825xx_dev, 0);