Experimenting with e1000 driver

This commit is contained in:
Andrew Pamment 2021-12-06 17:36:46 +10:00
parent 751c4e46c2
commit 53e9c38017

View File

@ -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,7 +367,11 @@ 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;