Index: netboot/3c509.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/3c509.c,v retrieving revision 1.4 diff -u -r1.4 3c509.c --- netboot/3c509.c 2 Jan 2002 21:56:40 -0000 1.4 +++ netboot/3c509.c 1 Sep 2002 03:13:42 -0000 @@ -1,3 +1,6 @@ +#ifdef ALLMULTI +#error multicast support is not yet implemented +#endif /************************************************************************** ETHERBOOT - BOOTP/TFTP Bootstrap Program @@ -606,6 +609,9 @@ nic->poll = t509_poll; nic->transmit = t509_transmit; nic->disable = t509_disable; + /* Based on PnP ISA map */ + nic->devid.vendor_id = htons(GENERIC_ISAPNP_VENDOR); + nic->devid.device_id = htons(0x80f7); return nic; no3c509: printf("(probe fail)"); Index: netboot/3c595.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/3c595.c,v retrieving revision 1.2 diff -u -r1.2 3c595.c --- netboot/3c595.c 2 Jan 2002 21:56:40 -0000 1.2 +++ netboot/3c595.c 1 Sep 2002 03:13:42 -0000 @@ -1,3 +1,6 @@ +#ifdef ALLMULTI +#error multicast support is not yet implemented +#endif /* * 3c595.c -- 3COM 3C595 Fast Etherlink III PCI driver for etherboot * Index: netboot/3c90x.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/3c90x.c,v retrieving revision 1.4 diff -u -r1.4 3c90x.c --- netboot/3c90x.c 2 Jan 2002 21:56:40 -0000 1.4 +++ netboot/3c90x.c 1 Sep 2002 03:13:42 -0000 @@ -1,3 +1,6 @@ +#ifdef ALLMULTI +#error multicast support is not yet implemented +#endif /* * 3c90x.c -- This file implements the 3c90x driver for etherboot. Written * by Greg Beeley, address@hidden Modified by Steve Smith, @@ -684,6 +687,7 @@ unsigned int cfg; unsigned int mopt; unsigned short linktype; +#define HWADDR_OFFSET 10 if (probeaddrs == 0 || probeaddrs[0] == 0) return 0; @@ -756,30 +760,37 @@ "Copyright 1999 LightSys Technology Services, Inc.\n" "Portions Copyright 1999 Steve Smith\n"); printf("Provided with ABSOLUTELY NO WARRANTY.\n"); +#ifdef CFG_3C90X_BOOTROM_FIX + if (INF_3C90X.isBrev) + { + printf("NOTE: 3c905b bootrom fix enabled; has side " + "effects. See 3c90x.txt for info.\n"); + } +#endif printf("-------------------------------------------------------" "------------------------\n"); /** Retrieve the Hardware address and print it on the screen. **/ - INF_3C90X.HWAddr[0] = eeprom[0]>>8; - INF_3C90X.HWAddr[1] = eeprom[0]&0xFF; - INF_3C90X.HWAddr[2] = eeprom[1]>>8; - INF_3C90X.HWAddr[3] = eeprom[1]&0xFF; - INF_3C90X.HWAddr[4] = eeprom[2]>>8; - INF_3C90X.HWAddr[5] = eeprom[2]&0xFF; + INF_3C90X.HWAddr[0] = eeprom[HWADDR_OFFSET + 0]>>8; + INF_3C90X.HWAddr[1] = eeprom[HWADDR_OFFSET + 0]&0xFF; + INF_3C90X.HWAddr[2] = eeprom[HWADDR_OFFSET + 1]>>8; + INF_3C90X.HWAddr[3] = eeprom[HWADDR_OFFSET + 1]&0xFF; + INF_3C90X.HWAddr[4] = eeprom[HWADDR_OFFSET + 2]>>8; + INF_3C90X.HWAddr[5] = eeprom[HWADDR_OFFSET + 2]&0xFF; printf("MAC Address = %!\n", INF_3C90X.HWAddr); /** Program the MAC address into the station address registers **/ a3c90x_internal_SetWindow(INF_3C90X.IOAddr, winAddressing2); - outw(htons(eeprom[0]), INF_3C90X.IOAddr + regStationAddress_2_3w); - outw(htons(eeprom[1]), INF_3C90X.IOAddr + regStationAddress_2_3w+2); - outw(htons(eeprom[2]), INF_3C90X.IOAddr + regStationAddress_2_3w+4); + outw(htons(eeprom[HWADDR_OFFSET + 0]), INF_3C90X.IOAddr + regStationAddress_2_3w); + outw(htons(eeprom[HWADDR_OFFSET + 1]), INF_3C90X.IOAddr + regStationAddress_2_3w+2); + outw(htons(eeprom[HWADDR_OFFSET + 2]), INF_3C90X.IOAddr + regStationAddress_2_3w+4); outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+0); outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+2); outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+4); /** Fill in our entry in the etherboot arp table **/ for(i=0;inode_addr[i] = (eeprom[i/2] >> (8*((i&1)^1))) & 0xff; + nic->node_addr[i] = (eeprom[HWADDR_OFFSET + i/2] >> (8*((i&1)^1))) & 0xff; /** Read the media options register, print a message and set default ** xcvr. Index: netboot/cards.h =================================================================== RCS file: /cvsroot/grub/grub/netboot/cards.h,v retrieving revision 1.3 diff -u -r1.3 cards.h --- netboot/cards.h 2 Jan 2002 21:56:40 -0000 1.3 +++ netboot/cards.h 1 Sep 2002 03:13:42 -0000 @@ -55,6 +55,11 @@ PCI_ARG(struct pci_device *)); #endif +#ifdef INCLUDE_3C515 +extern struct nic *t515_probe(struct nic *, unsigned short * + PCI_ARG(struct pci_device *)); +#endif + #ifdef INCLUDE_3C595 extern struct nic *t595_probe(struct nic *, unsigned short * PCI_ARG(struct pci_device *)); @@ -75,6 +80,11 @@ PCI_ARG(struct pci_device *)); #endif +#ifdef INCLUDE_E1000 +extern struct nic *e1000_probe(struct nic *, unsigned short * + PCI_ARG(struct pci_device *)); +#endif + #ifdef INCLUDE_EPIC100 extern struct nic *epic100_probe(struct nic *, unsigned short * PCI_ARG(struct pci_device *)); @@ -175,8 +185,23 @@ PCI_ARG(struct pci_device *)); #endif +#ifdef INCLUDE_FA311 +extern struct nic *fa311_probe(struct nic *, unsigned short * + PCI_ARG(struct pci_device *)); +#endif + #ifdef INCLUDE_TLAN extern struct nic *tlan_probe(struct nic *, unsigned short * + PCI_ARG(struct pci_device *)); +#endif + +#ifdef INCLUDE_PRISM2_PLX +extern struct nic *prism2_plx_probe(struct nic *, unsigned short * + PCI_ARG(struct pci_device *)); +#endif + +#ifdef INCLUDE_PRISM2_PCI +extern struct nic *prism2_pci_probe(struct nic *, unsigned short * PCI_ARG(struct pci_device *)); #endif Index: netboot/config.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/config.c,v retrieving revision 1.12 diff -u -r1.12 config.c --- netboot/config.c 20 Apr 2002 00:43:10 -0000 1.12 +++ netboot/config.c 1 Sep 2002 03:13:42 -0000 @@ -31,328 +31,286 @@ #include #undef INCLUDE_PCI -#if defined(INCLUDE_NS8390) || defined(INCLUDE_EEPRO100) || defined(INCLUDE_LANCE) || defined(INCLUDE_EPIC100) || defined(INCLUDE_TULIP) || defined(INCLUDE_OTULIP) || defined(INCLUDE_3C90X) || defined(INCLUDE_3C595) || defined(INCLUDE_RTL8139) || defined(INCLUDE_VIA_RHINE) || defined(INCLUDE_W89C840) || defined(INCLUDE_DAVICOM) || defined(INCLUDE_SIS900) || defined(INCLUDE_NATSEMI) || defined(INCLUDE_TLAN) +#if defined(INCLUDE_NS8390) || defined(INCLUDE_EEPRO100) || defined(INCLUDE_E1000) || defined(INCLUDE_LANCE) || defined(INCLUDE_EPIC100) || defined(INCLUDE_TULIP) || defined(INCLUDE_OTULIP) || defined(INCLUDE_3C90X) || defined(INCLUDE_3C595) || defined(INCLUDE_RTL8139) || defined(INCLUDE_VIA_RHINE) || defined(INCLUDE_W89C840) || defined(INCLUDE_DAVICOM) || defined(INCLUDE_SIS900) || defined(INCLUDE_NATSEMI) || defined(INCLUDE_FA311) || defined(INCLUDE_TLAN) || defined(INCLUDE_PRISM2_PLX) || defined(INCLUDE_PRISM2_PCI) /* || others later */ # define INCLUDE_PCI # include -static unsigned short pci_ioaddrs[16]; -static struct pci_device pci_nic_list[] = -{ +#define PCI_NIC(strname, probe, list) { strname, probe, list, sizeof(list)/sizeof(list[0]) } + #ifdef INCLUDE_NS8390 +static struct pci_id nepci_nics[] = +{ { PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8029, - "Realtek 8029", 0, 0, 0, 0}, + "Realtek 8029"}, + { PCI_VENDOR_ID_DLINK, 0x0300, + "DE-528" }, { PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_89C940, - "Winbond NE2000-PCI", 0, 0, 0, 0}, + "Winbond NE2000-PCI" }, { PCI_VENDOR_ID_COMPEX, PCI_DEVICE_ID_COMPEX_RL2000, - "Compex ReadyLink 2000", 0, 0, 0, 0}, + "Compex ReadyLink 2000"}, { PCI_VENDOR_ID_KTI, PCI_DEVICE_ID_KTI_ET32P2, - "KTI ET32P2", 0, 0, 0, 0}, + "KTI ET32P2" }, { PCI_VENDOR_ID_NETVIN, PCI_DEVICE_ID_NETVIN_NV5000SC, - "NetVin NV5000SC", 0, 0, 0, 0}, + "NetVin NV5000SC"}, { PCI_VENDOR_ID_HOLTEK, PCI_DEVICE_ID_HOLTEK_HT80232, - "Holtek HT80232", 0, 0, 0, 0}, + "Holtek HT80232" }, +}; #endif #ifdef INCLUDE_3C90X +static struct pci_id a3c90x_nics[] = { { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C900TPO, - "3Com900-TPO", 0, 0, 0, 0}, + "3Com900-TPO"}, { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C900COMBO, - "3Com900-Combo", 0, 0, 0, 0}, + "3Com900-Combo" }, { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C905TX, - "3Com905-TX", 0, 0, 0, 0}, + "3Com905-TX" }, { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C905T4, - "3Com905-T4", 0, 0, 0, 0}, + "3Com905-T4" }, { PCI_VENDOR_ID_3COM, 0x9004, - "3Com900B-TPO", 0, 0, 0, 0}, + "3Com900B-TPO" }, { PCI_VENDOR_ID_3COM, 0x9005, - "3Com900B-Combo", 0, 0, 0, 0}, + "3Com900B-Combo" }, { PCI_VENDOR_ID_3COM, 0x9006, - "3Com900B-2/T", 0, 0, 0, 0}, + "3Com900B-2/T" }, { PCI_VENDOR_ID_3COM, 0x900A, - "3Com900B-FL", 0, 0, 0, 0}, + "3Com900B-FL" }, { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C905B_TX, - "3Com905B-TX", 0, 0, 0, 0}, + "3Com905B-TX" }, { PCI_VENDOR_ID_3COM, 0x9056, - "3Com905B-T4", 0, 0, 0, 0}, + "3Com905B-T4" }, + { PCI_VENDOR_ID_3COM, 0x9058, + "3Com905B-9058"}, { PCI_VENDOR_ID_3COM, 0x905A, - "3Com905B-FL", 0, 0, 0, 0}, + "3Com905B-FL" }, { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C905C_TXM, - "3Com905C-TXM", 0, 0, 0, 0}, + "3Com905C-TXM" }, { PCI_VENDOR_ID_3COM, 0x9800, - "3Com980-Cyclone", 0, 0, 0, 0}, + "3Com980-Cyclone" }, { PCI_VENDOR_ID_3COM, 0x9805, - "3Com9805", 0, 0, 0, 0}, + "3Com9805" }, { PCI_VENDOR_ID_3COM, 0x7646, - "3CSOHO100-TX", 0, 0, 0, 0}, + "3CSOHO100-TX" }, +}; #endif #ifdef INCLUDE_3C595 +static struct pci_id t595_nics[] = { { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C590, - "3Com590", 0, 0, 0, 0}, + "3Com590" }, { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C595, - "3Com595", 0, 0, 0, 0}, + "3Com595" }, { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C595_1, - "3Com595", 0, 0, 0, 0}, + "3Com595" }, { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C595_2, - "3Com595", 0, 0, 0, 0}, + "3Com595" }, { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C900TPO, - "3Com900-TPO", 0, 0, 0, 0}, + "3Com900-TPO" }, { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C900COMBO, - "3Com900-Combo", 0, 0, 0, 0}, + "3Com900-Combo" }, { PCI_VENDOR_ID_3COM, 0x9004, - "3Com900B-TPO", 0, 0, 0, 0}, + "3Com900B-TPO" }, { PCI_VENDOR_ID_3COM, 0x9005, - "3Com900B-Combo", 0, 0, 0, 0}, + "3Com900B-Combo" }, { PCI_VENDOR_ID_3COM, 0x9006, - "3Com900B-2/T", 0, 0, 0, 0}, + "3Com900B-2/T" }, { PCI_VENDOR_ID_3COM, 0x900A, - "3Com900B-FL", 0, 0, 0, 0}, + "3Com900B-FL" }, { PCI_VENDOR_ID_3COM, 0x9800, - "3Com980-Cyclone", 0, 0, 0, 0}, + "3Com980-Cyclone" }, { PCI_VENDOR_ID_3COM, 0x9805, - "3Com9805", 0, 0, 0, 0}, + "3Com9805" }, { PCI_VENDOR_ID_3COM, 0x7646, - "3CSOHO100-TX", 0, 0, 0, 0}, + "3CSOHO100-TX" }, +}; #endif #ifdef INCLUDE_EEPRO100 +static struct pci_id eepro100_nics[] = { { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82557, - "Intel EtherExpressPro100", 0, 0, 0, 0}, + "Intel EtherExpressPro100" }, { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82559ER, - "Intel EtherExpressPro100 82559ER", 0, 0, 0, 0}, + "Intel EtherExpressPro100 82559ER" }, { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ID1029, - "Intel EtherExpressPro100 ID1029", 0, 0, 0, 0}, + "Intel EtherExpressPro100 ID1029" }, { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ID1030, - "Intel Corporation 82559 InBusiness 10/100", 0, 0, 0, 0}, + "Intel Corporation 82559 InBusiness 10/100" }, { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82562, - "Intel EtherExpressPro100 82562EM", 0, 0, 0, 0}, + "Intel EtherExpressPro100 82562EM" }, + { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ID1038, + "Intel(R) PRO/100 VM Network Connection" }, + { PCI_VENDOR_ID_INTEL, 0x1039, + "Intel PRO100 VE 82562ET" }, +}; +#endif +#ifdef INCLUDE_E1000 +static struct pci_id e1000_nics[] = { + { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82542, + "Intel EtherExpressPro1000" }, + { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82543GC_FIBER, + "Intel EtherExpressPro1000 82543GC Fiber" }, + { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82543GC_COPPER, + "Intel EtherExpressPro1000 82543GC Copper" }, + { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82544EI_COPPER, + "Intel EtherExpressPro1000 82544EI Copper" }, + { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82544GC_CREB, + "Intel EtherExpressPro1000 82544GC Creb" }, +}; #endif + #ifdef INCLUDE_EPIC100 +static struct pci_id epic100_nics[] = { { PCI_VENDOR_ID_SMC, PCI_DEVICE_ID_SMC_EPIC100, - "SMC EtherPowerII", 0, 0, 0, 0}, + "SMC EtherPowerII" }, +}; #endif #ifdef INCLUDE_LANCE +static struct pci_id lance_nics[] = { { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LANCE, - "AMD Lance/PCI", 0, 0, 0, 0}, + "AMD Lance/PCI" }, { PCI_VENDOR_ID_AMD_HOMEPNA, PCI_DEVICE_ID_AMD_HOMEPNA, - "AMD Lance/HomePNA", 0, 0, 0, 0}, + "AMD Lance/HomePNA" }, +}; #endif #ifdef INCLUDE_RTL8139 +static struct pci_id rtl8139_nics[] = { { PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8139, - "Realtek 8139", 0, 0, 0, 0}, + "Realtek 8139" }, { PCI_VENDOR_ID_DLINK, PCI_DEVICE_ID_DFE530TXP, - "DFE530TX+/DFE538TX", 0, 0, 0, 0}, + "DFE530TX+/DFE538TX" }, { PCI_VENDOR_ID_SMC_1211, PCI_DEVICE_ID_SMC_1211, - "SMC EZ10/100", 0, 0, 0, 0}, + "SMC EZ10/100" }, +}; #endif #ifdef INCLUDE_OTULIP +static struct pci_id otulip_nics[] = { { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP, - "Digital Tulip", 0, 0, 0, 0}, + "Digital Tulip" }, { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_FAST, - "Digital Tulip Fast", 0, 0, 0, 0}, + "Digital Tulip Fast" }, { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_PLUS, - "Digital Tulip+", 0, 0, 0, 0}, + "Digital Tulip+" }, { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21142, - "Digital Tulip 21142", 0, 0, 0, 0}, + "Digital Tulip 21142" }, +}; #endif #ifdef INCLUDE_TULIP +static struct pci_id tulip_nics[] = { { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP, - "Digital Tulip", 0, 0, 0, 0}, + "Digital Tulip" }, { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_FAST, - "Digital Tulip Fast", 0, 0, 0, 0}, + "Digital Tulip Fast" }, { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_PLUS, - "Digital Tulip+", 0, 0, 0, 0}, + "Digital Tulip+" }, { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21142, - "Digital Tulip 21142", 0, 0, 0, 0}, + "Digital Tulip 21142" }, { PCI_VENDOR_ID_MACRONIX, PCI_DEVICE_ID_MX987x5, - "Macronix MX987x5", 0, 0, 0, 0}, + "Macronix MX987x5" }, { PCI_VENDOR_ID_LINKSYS, PCI_DEVICE_ID_LC82C115, - "LinkSys LNE100TX", 0, 0, 0, 0}, + "LinkSys LNE100TX" }, { PCI_VENDOR_ID_LINKSYS, PCI_DEVICE_ID_DEC_TULIP, - "Netgear FA310TX", 0, 0, 0, 0}, + "Netgear FA310TX" }, { PCI_VENDOR_ID_DAVICOM, PCI_DEVICE_ID_DM9102, - "Davicom 9102", 0, 0, 0, 0}, + "Davicom 9102" }, { PCI_VENDOR_ID_DAVICOM, PCI_DEVICE_ID_DM9009, - "Davicom 9009", 0, 0, 0, 0}, + "Davicom 9009" }, { PCI_VENDOR_ID_ADMTEK, PCI_DEVICE_ID_ADMTEK_0985, - "ADMtek Centaur-P", 0, 0, 0, 0}, + "ADMtek Centaur-P" }, { PCI_VENDOR_ID_ADMTEK, 0x0981, - "ADMtek AN981 Comet", 0, 0, 0, 0}, + "ADMtek AN981 Comet" }, + { PCI_VENDOR_ID_SMC_1211, 0x1216, + "ADMTek AN983 Comet" }, { 0x125B, 0x1400, - "ASIX AX88140", 0, 0, 0, 0 }, + "ASIX AX88140" }, { 0x11F6, 0x9881, - "Compex RL100-TX", 0, 0, 0, 0 }, + "Compex RL100-TX" }, +}; #endif #ifdef INCLUDE_DAVICOM +static struct pci_id davicom_nics[] = { { PCI_VENDOR_ID_DAVICOM, PCI_DEVICE_ID_DM9102, - "Davicom 9102", 0, 0, 0, 0}, + "Davicom 9102" }, { PCI_VENDOR_ID_DAVICOM, PCI_DEVICE_ID_DM9009, - "Davicom 9009", 0, 0, 0, 0}, + "Davicom 9009" }, +}; #endif #ifdef INCLUDE_VIA_RHINE +static struct pci_id rhine_nics[] = { { PCI_VENDOR_ID_VIATEC, PCI_DEVICE_ID_VIA_VT6102, - "VIA 6102", 0, 0, 0, 0}, + "VIA 6102" }, { PCI_VENDOR_ID_VIATEC, PCI_DEVICE_ID_VIA_RHINE_I, - "VIA 3043", 0, 0, 0, 0}, + "VIA 3043" }, { PCI_VENDOR_ID_VIATEC, PCI_DEVICE_ID_VIA_86C100A, - "VIA 86C100A", 0, 0, 0, 0}, + "VIA 86C100A" }, +}; #endif #ifdef INCLUDE_W89C840 +static struct pci_id w89c840_nics[] = { { PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_89C840, - "Winbond W89C840F", 0, 0, 0, 0}, + "Winbond W89C840F" }, { PCI_VENDOR_ID_COMPEX, PCI_DEVICE_ID_COMPEX_RL100ATX, - "Compex RL100ATX", 0, 0, 0, 0}, + "Compex RL100ATX" }, +}; #endif #ifdef INCLUDE_SIS900 +static struct pci_id sis900_nics[] = { { PCI_VENDOR_ID_SIS, PCI_DEVICE_ID_SIS900, - "SIS900", 0, 0, 0, 0}, + "SIS900" }, { PCI_VENDOR_ID_SIS, PCI_DEVICE_ID_SIS7016, - "SIS7016", 0, 0, 0, 0}, + "SIS7016" }, +}; #endif #ifdef INCLUDE_NATSEMI +static struct pci_id natsemi_nics[] = { { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_DP83815, - "DP83815", 0, 0, 0, 0}, + "DP83815" }, +}; #endif - + +#ifdef INCLUDE_FA311 +static struct pci_id fa311_nics[] = { + { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_DP83815, + "DP83815" }, +}; +#endif + #ifdef INCLUDE_TLAN +static struct pci_id tlan_nics[] = { { PCI_VENDOR_ID_OLICOM, PCI_DEVICE_ID_OLICOM_OC2326, - "OC2326", 0, 0, 0, 0}, + "OC2326" }, +}; #endif - /* other PCI NICs go here */ - {0, 0, NULL, 0, 0, 0, 0} +#ifdef INCLUDE_PRISM2_PLX +static struct pci_id prism2_plx_nics[] = { + { PCI_VENDOR_ID_NETGEAR, PCI_DEVICE_ID_NETGEAR_MA301, + "Netgear MA301" }, }; -#endif /* INCLUDE_*PCI */ - -#include +#endif -#ifdef INCLUDE_PCI -struct pci_dispatch_table -{ - unsigned short vendor; - unsigned short dev_id; - struct nic *(*eth_probe) (struct nic *, unsigned short *, - struct pci_device *); +#ifdef INCLUDE_PRISM2_PCI +static struct pci_id prism2_pci_nics[] = { + { PCI_VENDOR_ID_HARRIS, PCI_DEVICE_ID_HARRIS_PRISM2, + "Harris Semiconductor Prism2.5 clone" }, }; +#endif -static struct pci_dispatch_table PCI_NIC[] = -{ -# ifdef INCLUDE_NS8390 - { PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8029, nepci_probe }, - { PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_89C940, nepci_probe }, - { PCI_VENDOR_ID_COMPEX, PCI_DEVICE_ID_COMPEX_RL2000, nepci_probe }, - { PCI_VENDOR_ID_KTI, PCI_DEVICE_ID_KTI_ET32P2, nepci_probe }, - { PCI_VENDOR_ID_NETVIN, PCI_DEVICE_ID_NETVIN_NV5000SC, nepci_probe }, - { PCI_VENDOR_ID_HOLTEK, PCI_DEVICE_ID_HOLTEK_HT80232, nepci_probe }, -# endif /* INCLUDE_NS8390 */ -# ifdef INCLUDE_3C90X - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C900TPO, a3c90x_probe }, - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C900COMBO, a3c90x_probe }, - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C905TX, a3c90x_probe }, - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C905T4, a3c90x_probe }, - { PCI_VENDOR_ID_3COM, 0x9004, a3c90x_probe }, - { PCI_VENDOR_ID_3COM, 0x9005, a3c90x_probe }, - { PCI_VENDOR_ID_3COM, 0x9006, a3c90x_probe }, - { PCI_VENDOR_ID_3COM, 0x900A, a3c90x_probe }, - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C905B_TX, a3c90x_probe }, - { PCI_VENDOR_ID_3COM, 0x9056, a3c90x_probe }, - { PCI_VENDOR_ID_3COM, 0x905A, a3c90x_probe }, - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C905C_TXM, a3c90x_probe }, - { PCI_VENDOR_ID_3COM, 0x9800, a3c90x_probe }, - { PCI_VENDOR_ID_3COM, 0x9805, a3c90x_probe }, - { PCI_VENDOR_ID_3COM, 0x7646, a3c90x_probe }, -# endif /* INCLUDE_3C90X */ -# ifdef INCLUDE_3C595 - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C590, t595_probe }, - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C595, t595_probe }, - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C595_1, t595_probe }, - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C595_2, t595_probe }, - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C900TPO, t595_probe }, - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C900COMBO, t595_probe }, - { PCI_VENDOR_ID_3COM, 0x9004, t595_probe }, - { PCI_VENDOR_ID_3COM, 0x9005, t595_probe }, - { PCI_VENDOR_ID_3COM, 0x9006, t595_probe }, - { PCI_VENDOR_ID_3COM, 0x900A, t595_probe }, - { PCI_VENDOR_ID_3COM, 0x9800, t595_probe }, - { PCI_VENDOR_ID_3COM, 0x9805, t595_probe }, - { PCI_VENDOR_ID_3COM, 0x7646, t595_probe }, -# endif /* INCLUDE_3C595 */ -# ifdef INCLUDE_EEPRO100 - { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82557, eepro100_probe }, - { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82559ER, eepro100_probe }, - { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ID1029, eepro100_probe }, - { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ID1030, eepro100_probe }, - { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82562, eepro100_probe }, -# endif /* INCLUDE_EEPRO100 */ -# ifdef INCLUDE_EPIC100 - { PCI_VENDOR_ID_SMC, PCI_DEVICE_ID_SMC_EPIC100, epic100_probe }, -# endif /* INCLUDE_EPIC100 */ -# ifdef INCLUDE_LANCE - { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LANCE, lancepci_probe }, - { PCI_VENDOR_ID_AMD_HOMEPNA, PCI_DEVICE_ID_AMD_HOMEPNA, lancepci_probe }, -# endif /* INCLUDE_LANCE */ -# ifdef INCLUDE_RTL8139 - { PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8139, rtl8139_probe }, - { PCI_VENDOR_ID_DLINK, PCI_DEVICE_ID_DFE530TXP, rtl8139_probe }, - { PCI_VENDOR_ID_SMC_1211, PCI_DEVICE_ID_SMC_1211, rtl8139_probe }, -# endif /* INCLUDE_RTL8139 */ -# ifdef INCLUDE_OTULIP - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP, otulip_probe }, - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_FAST, otulip_probe }, - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_PLUS, otulip_probe }, - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21142, otulip_probe }, -# endif /* INCLUDE_OTULIP */ -# ifdef INCLUDE_TULIP - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP, tulip_probe }, - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_FAST, tulip_probe }, - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_PLUS, tulip_probe }, - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21142, tulip_probe }, - { PCI_VENDOR_ID_MACRONIX, PCI_DEVICE_ID_MX987x5, tulip_probe }, - { PCI_VENDOR_ID_LINKSYS, PCI_DEVICE_ID_LC82C115, tulip_probe }, - { PCI_VENDOR_ID_LINKSYS, PCI_DEVICE_ID_DEC_TULIP, tulip_probe }, - { PCI_VENDOR_ID_DAVICOM, PCI_DEVICE_ID_DM9102, tulip_probe }, - { PCI_VENDOR_ID_DAVICOM, PCI_DEVICE_ID_DM9009, tulip_probe }, - { PCI_VENDOR_ID_ADMTEK, PCI_DEVICE_ID_ADMTEK_0985, tulip_probe }, - { PCI_VENDOR_ID_ADMTEK, 0x0981, tulip_probe }, - { 0x125B, 0x1400, tulip_probe }, - { 0x11F6, 0x9881, tulip_probe }, -# endif /* INCLUDE_TULIP */ -# ifdef INCLUDE_DAVICOM - { PCI_VENDOR_ID_DAVICOM, PCI_DEVICE_ID_DM9102, davicom_probe }, - { PCI_VENDOR_ID_DAVICOM, PCI_DEVICE_ID_DM9009, davicom_probe }, -# endif /* INCLUDE_DAVICOM */ -# ifdef INCLUDE_VIA_RHINE - { PCI_VENDOR_ID_VIATEC, PCI_DEVICE_ID_VIA_VT6102, rhine_probe }, - { PCI_VENDOR_ID_VIATEC, PCI_DEVICE_ID_VIA_RHINE_I, rhine_probe }, - { PCI_VENDOR_ID_VIATEC, PCI_DEVICE_ID_VIA_86C100A, rhine_probe }, -# endif /* INCLUDE_VIA_RHINE */ -# ifdef INCLUDE_W89C840 - { PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_89C840, w89c840_probe }, - { PCI_VENDOR_ID_COMPEX, PCI_DEVICE_ID_COMPEX_RL100ATX, w89c840_probe }, -# endif /* INCLUDE_W89C840 */ -# ifdef INCLUDE_SIS900 - { PCI_VENDOR_ID_SIS, PCI_DEVICE_ID_SIS900, sis900_probe }, - { PCI_VENDOR_ID_SIS, PCI_DEVICE_ID_SIS7016, sis900_probe }, -# endif /* INCLUDE_SIS900 */ -# ifdef INCLUDE_NATSEMI - { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_DP83815, natsemi_probe }, -# endif /* INCLUDE_NATSEMI */ -# ifdef INCLUDE_TLAN - { PCI_VENDOR_ID_OLICOM, PCI_DEVICE_ID_OLICOM_OC2326, tlan_probe }, -# endif /* INCLUDE_TLAN */ - { 0, 0, 0 } -}; -#endif /* GRUB && INCLUDE_PCI */ +/* other PCI NICs go here */ +#endif /* INCLUDE_*PCI */ + +#include struct dispatch_table { - const char *nic_name; -#ifdef INCLUDE_PCI - struct nic *(*eth_probe) (struct nic *, unsigned short *, - struct pci_device *); + const char *nic_name; +#ifdef INCLUDE_PCI + struct nic *(*eth_probe)(struct nic *, unsigned short *, + struct pci_device *); + struct pci_id *pci_ids; + int pci_id_count; #else - struct nic *(*eth_probe) (struct nic *, unsigned short *); -#endif /* INCLUDE_PCI */ - unsigned short *probe_ioaddrs; /* for probe overrides */ + struct nic *(*eth_probe)(struct nic *, unsigned short *); + unsigned short *probe_ioaddrs; /* for probe overrides */ +#endif /* INCLUDE_PCI */ }; /* @@ -360,16 +318,19 @@ * If for some reason you want to change the order, * just rearrange the entries (bracketed by the #ifdef/#endif) */ -static struct dispatch_table NIC[] = +static const struct dispatch_table NIC[] = { #ifdef INCLUDE_RTL8139 - { "RTL8139", rtl8139_probe, pci_ioaddrs }, + PCI_NIC( "RTL8139", rtl8139_probe, rtl8139_nics ), #endif #ifdef INCLUDE_SIS900 - { "SIS900", sis900_probe, pci_ioaddrs }, + PCI_NIC( "SIS900", sis900_probe, sis900_nics ), #endif #ifdef INCLUDE_NATSEMI - { "NATSEMI", natsemi_probe, pci_ioaddrs }, + PCI_NIC( "NATSEMI", natsemi_probe, natsemi_nics ), +#endif +#ifdef INCLUDE_FA311 + PCI_NIC("FA311", fa311_probe, fa311_nics), #endif #ifdef INCLUDE_WD { "WD", wd_probe, 0 }, @@ -386,29 +347,35 @@ #ifdef INCLUDE_3C529 { "3C5x9", t529_probe, 0 }, #endif +#ifdef INCLUDE_3C515 + { "3C515", t515_probe, 0 }, +#endif #ifdef INCLUDE_3C595 - { "3C595", t595_probe, pci_ioaddrs }, + PCI_NIC("3C595", t595_probe, t595_nics), #endif #ifdef INCLUDE_3C90X - { "3C90X", a3c90x_probe, pci_ioaddrs }, + PCI_NIC("3C90X", a3c90x_probe, a3c90x_nics), #endif #ifdef INCLUDE_EEPRO { "EEPRO", eepro_probe, 0 }, #endif #ifdef INCLUDE_EEPRO100 - { "EEPRO100", eepro100_probe, pci_ioaddrs }, + PCI_NIC( "EEPRO100", eepro100_probe, eepro100_nics), +#endif +#ifdef INCLUDE_E1000 + PCI_NIC( "E1000", e1000_probe, e1000_nics), #endif #ifdef INCLUDE_EPIC100 - { "EPIC100", epic100_probe, pci_ioaddrs }, + PCI_NIC( "EPIC100", epic100_probe, epic100_nics), #endif #ifdef INCLUDE_OTULIP - { "OTulip", otulip_probe, pci_ioaddrs }, + PCI_NIC( "OTulip", otulip_probe, otulip_nics), #endif #ifdef INCLUDE_TULIP - { "Tulip", tulip_probe, pci_ioaddrs }, + PCI_NIC( "Tulip", tulip_probe, tulip_nics), #endif #ifdef INCLUDE_DAVICOM - { "DAVICOM", davicom_probe, pci_ioaddrs }, + PCI_NIC( "DAVICOM", davicom_probe, davicom_nics), #endif #ifdef INCLUDE_CS89X0 { "CS89x0", cs89x0_probe, 0 }, @@ -444,22 +411,32 @@ { "DEPCA", depca_probe, 0 }, #endif #ifdef INCLUDE_NS8390 - { "NE2000/PCI", nepci_probe, pci_ioaddrs }, + PCI_NIC( "NE2000/PCI", nepci_probe, nepci_nics), #endif #ifdef INCLUDE_LANCE - { "LANCE/PCI", lancepci_probe, pci_ioaddrs }, + PCI_NIC( "LANCE/PCI", lancepci_probe, lance_nics), #endif #ifdef INCLUDE_VIA_RHINE - { "VIA 86C100", rhine_probe, pci_ioaddrs }, + PCI_NIC( "VIA 86C100", rhine_probe, rhine_nics), #endif #ifdef INCLUDE_W89C840 - { "W89C840F", w89c840_probe, pci_ioaddrs }, + PCI_NIC( "W89C840F", w89c840_probe, w89c840_nics), #endif #ifdef INCLUDE_TLAN - { "Olicom 2326", tlan_probe, pci_ioaddrs }, + PCI_NIC( "Olicom 2326", tlan_probe, tlan_nics), +#endif +#ifdef INCLUDE_PRISM2_PLX + PCI_NIC( "Prism2_PLX", prism2_plx_probe, prism2_plx_nics), +#endif +#ifdef INCLUDE_PRISM2_PCI + PCI_NIC( "Prism2_PCI", prism2_pci_probe, prism2_pci_nics), #endif /* this entry must always be last to mark the end of list */ +#ifdef INCLUDE_PCI + { 0, 0, 0, 0 } +#else { 0, 0, 0 } +#endif }; #define NIC_TABLE_SIZE (sizeof (NIC) / sizeof (NIC[0])) @@ -489,6 +466,14 @@ arptable[ARP_CLIENT].node, /* node_addr */ packet, /* packet */ 0, /* packetlen */ + { + NIC_ID_SIZE-1, + RFC1533_VENDOR_NIC_DEV_ID, + 5, + PCI_BUS_TYPE, + 0, + 0 + }, /* devid */ 0, /* priv_data */ }; @@ -498,83 +483,61 @@ (*nic.reset) (&nic); } -int -eth_probe (void) +int eth_probe(int last_adapter) { - struct pci_device *p; - const struct dispatch_table *t; - static int probed = 0; - - /* If already probed, don't try to probe it any longer. */ - if (probed) - return 1; - - /* Clear the ready flag. */ - network_ready = 0; - /* Clear the ARP table. */ - grub_memset ((char *) arptable, 0, - MAX_ARP * sizeof (struct arptable_t)); - - p = 0; - +#ifdef INCLUDE_PCI + static unsigned short pci_ioaddrs[2]; + static struct pci_device dev; +#endif + static const struct dispatch_table *t = NIC; + +#ifndef TRY_ALL_DEVICES + /* Force a reset of the list every time... */ + last_adapter = -1; +#endif + if (last_adapter == -1) { + t = NIC; #ifdef INCLUDE_PCI + dev.probe_id = 0; + dev.bus = 0; + dev.devfn = 0; /* In GRUB, the ROM info is initialized here. */ - rom = *((struct rom_info *) ROM_INFO_LOCATION); + rom = *((struct rom_info *) ROM_INFO_LOCATION); - eth_pci_init(pci_nic_list); - pci_ioaddrs[0] = 0; - pci_ioaddrs[1] = 0; - /* at this point we have a list of possible PCI candidates - we just pick the first one with a non-zero ioaddr */ - for (p = pci_nic_list; p->vendor != 0; ++p) - { - if (p->ioaddr != 0) - { - pci_ioaddrs[0] = p->ioaddr; - break; - } - } #endif + } etherboot_printf("Probing..."); -#ifdef INCLUDE_PCI - if (p->vendor) - { - struct pci_dispatch_table *pt; - - for (pt = PCI_NIC; pt->eth_probe != 0; pt++) - if (p->vendor == pt->vendor && p->dev_id == pt->dev_id) - { - etherboot_printf ("[%s]", p->name); - if ((pt->eth_probe) (&nic, pci_ioaddrs, p)) - { - probed = 1; - return 1; - } - } - } -#endif /* INCLUDE_PCI */ - for (t = NIC; t->nic_name != 0; ++t) { etherboot_printf("[%s]", t->nic_name); #ifdef INCLUDE_PCI - if ((*t->eth_probe) (&nic, t->probe_ioaddrs, p)) - { - probed = 1; - return 1; - } + eth_find_pci(t->pci_ids, t->pci_id_count, &dev); + if (dev.probe_id == 0) { + continue; + } +#if 0 + if (dev.romaddr != ((unsigned long) rom.rom_segment << 4)) { + continue; + } +#endif + pci_ioaddrs[0] = dev.ioaddr; + pci_ioaddrs[1] = 0; + nic.devid.bus_type = PCI_BUS_TYPE; + nic.devid.vendor_id = htons(dev.vendor); + nic.devid.device_id = htons(dev.dev_id); + if ((*t->eth_probe)(&nic, pci_ioaddrs, &dev)) + return (0); #else - if ((*t->eth_probe) (&nic, t->probe_ioaddrs)) - { - probed = 1; - return 1; - } + nic.devid.bus_type = ISA_BUS_TYPE; + /* driver will fill in vendor and device IDs */ + if ((*t->eth_probe)(&nic, t->probe_ioaddrs)) + return (0); #endif /* INCLUDE_PCI */ } - return 0; + return -1; } int Index: netboot/cs89x0.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/cs89x0.c,v retrieving revision 1.5 diff -u -r1.5 cs89x0.c --- netboot/cs89x0.c 2 Jan 2002 21:56:40 -0000 1.5 +++ netboot/cs89x0.c 1 Sep 2002 03:13:42 -0000 @@ -1,3 +1,6 @@ +#ifdef ALLMULTI +#error multicast support is not yet implemented +#endif /* cs89x0.c: A Crystal Semiconductor CS89[02]0 driver for etherboot. */ /* Permission is granted to distribute the enclosed cs89x0.[ch] driver @@ -648,6 +651,9 @@ nic->poll = cs89x0_poll; nic->transmit = cs89x0_transmit; nic->disable = cs89x0_disable; + /* Based on PnP ISA map */ + nic->devid.vendor_id = htons(ISAPNP_VENDOR('C','S','C')); + nic->devid.device_id = htons(0x0007); return (nic); } Index: netboot/cs89x0.h =================================================================== RCS file: /cvsroot/grub/grub/netboot/cs89x0.h,v retrieving revision 1.3 diff -u -r1.3 cs89x0.h --- netboot/cs89x0.h 22 Apr 2000 01:17:09 -0000 1.3 +++ netboot/cs89x0.h 1 Sep 2002 03:13:42 -0000 @@ -319,7 +319,7 @@ #define TX_CMD_PORT 0x0004 #define TX_NOW 0x0000 /* Tx packet after 5 bytes copied */ #define TX_AFTER_381 0x0020 /* Tx packet after 381 bytes copied */ -#define TX_AFTER_ALL 0x0060 /* Tx packet after all bytes copied */ +#define TX_AFTER_ALL 0x00C0 /* Tx packet after all bytes copied */ #define TX_LEN_PORT 0x0006 #define ISQ_PORT 0x0008 #define ADD_PORT 0x000A Index: netboot/davicom.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/davicom.c,v retrieving revision 1.1 diff -u -r1.1 davicom.c --- netboot/davicom.c 2 Jan 2002 21:56:40 -0000 1.1 +++ netboot/davicom.c 1 Sep 2002 03:13:42 -0000 @@ -1,3 +1,6 @@ +#ifdef ALLMULTI +#error multicast support is not yet implemented +#endif /* DAVICOM DM9009/DM9102/DM9102A Etherboot Driver V1.00 Index: netboot/depca.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/depca.c,v retrieving revision 1.3 diff -u -r1.3 depca.c --- netboot/depca.c 2 Jan 2002 21:56:40 -0000 1.3 +++ netboot/depca.c 1 Sep 2002 03:13:43 -0000 @@ -1,3 +1,6 @@ +#ifdef ALLMULTI +#error multicast support is not yet implemented +#endif /* Etherboot: depca.h merged, comments from Linux driver retained */ /* depca.c: A DIGITAL DEPCA & EtherWORKS ethernet driver for linux. @@ -748,5 +751,8 @@ nic->poll = depca_poll; nic->transmit = depca_transmit; nic->disable = depca_disable; + /* Based on PnP ISA map */ + nic->devid.vendor_id = htons(GENERIC_ISAPNP_VENDOR); + nic->devid.device_id = htons(0x80f7); return (nic); } Index: netboot/eepro.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/eepro.c,v retrieving revision 1.1 diff -u -r1.1 eepro.c --- netboot/eepro.c 2 Jan 2002 21:56:40 -0000 1.1 +++ netboot/eepro.c 1 Sep 2002 03:13:43 -0000 @@ -1,3 +1,6 @@ +#ifdef ALLMULTI +#error multicast support is not yet implemented +#endif /************************************************************************** Etherboot - BOOTP/TFTP Bootstrap Program Intel EEPRO/10 NIC driver for Etherboot @@ -582,5 +585,8 @@ nic->poll = eepro_poll; nic->transmit = eepro_transmit; nic->disable = eepro_disable; + /* Based on PnP ISA map */ + nic->devid.vendor_id = htons(GENERIC_ISAPNP_VENDOR); + nic->devid.device_id = htons(0x828a); return (nic); } Index: netboot/eepro100.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/eepro100.c,v retrieving revision 1.5 diff -u -r1.5 eepro100.c --- netboot/eepro100.c 25 Mar 2002 22:01:17 -0000 1.5 +++ netboot/eepro100.c 1 Sep 2002 03:13:43 -0000 @@ -80,8 +80,8 @@ * * Caveats: * - * The etherboot framework moves the code to the 32k segment from - * 0x98000 to 0xa0000. There is just a little room between the end of + * The Etherboot framework moves the code to the 48k segment from + * 0x94000 to 0xa0000. There is just a little room between the end of * this driver and the 0xa0000 address. If you compile in too many * features, this will overflow. * The number under "hex" in the output of size that scrolls by while Index: netboot/epic100.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/epic100.c,v retrieving revision 1.5 diff -u -r1.5 epic100.c --- netboot/epic100.c 2 Jan 2002 21:56:40 -0000 1.5 +++ netboot/epic100.c 1 Sep 2002 03:13:43 -0000 @@ -1,3 +1,6 @@ +#ifdef ALLMULTI +#error multicast support is not yet implemented +#endif /* epic100.c: A SMC 83c170 EPIC/100 fast ethernet driver for Etherboot */ #define LINUX_OUT_MACROS Index: netboot/etherboot.h =================================================================== RCS file: /cvsroot/grub/grub/netboot/etherboot.h,v retrieving revision 1.12 diff -u -r1.12 etherboot.h --- netboot/etherboot.h 8 May 2002 07:12:29 -0000 1.12 +++ netboot/etherboot.h 1 Sep 2002 03:13:43 -0000 @@ -73,6 +73,9 @@ /* Inter-packet retry in ticks */ #define TIMEOUT (10 * TICKS_PER_SEC) +/* Max interval between IGMP packets */ +#define IGMP_INTERVAL (10*TICKS_PER_SEC) + /* These settings have sense only if compiled with -DCONGESTED */ /* total retransmission timeout in ticks */ #define TFTP_TIMEOUT (30 * TICKS_PER_SEC) @@ -95,9 +98,7 @@ #define ETH_ALEN 6 /* Size of Ethernet address */ #define ETH_HLEN 14 /* Size of ethernet header */ #define ETH_ZLEN 60 /* Minimum packet */ -/*#define ETH_MIN_PACKET 64*/ #define ETH_FRAME_LEN 1514 /* Maximum packet */ -/*#define ETH_MAX_PACKET 1518*/ /* Because some DHCP/BOOTP servers don't treat the maximum length the same as Etherboot, subtract the size of an IP header and that of an UDP header. */ @@ -108,9 +109,10 @@ #define ARP_CLIENT 0 #define ARP_SERVER 1 #define ARP_GATEWAY 2 -#define ARP_ROOTSERVER 3 -#define ARP_SWAPSERVER 4 -#define MAX_ARP ARP_SWAPSERVER+1 +#define MAX_ARP ARP_GATEWAY+1 + +#define IGMP_SERVER 0 +#define MAX_IGMP IGMP_SERVER+1 #define RARP_REQUEST 3 #define RARP_REPLY 4 @@ -124,10 +126,16 @@ #define TFTP_PORT 69 #define SUNRPC_PORT 111 +#define IP_ICMP 1 +#define IP_IGMP 2 #define IP_UDP 17 + /* Same after going through htonl */ #define IP_BROADCAST 0xFFFFFFFF +#define MULTICAST_MASK 0xF0000000 +#define MULTICAST_NETWORK 0xE0000000 + #define ARP_REQUEST 1 #define ARP_REPLY 2 @@ -205,7 +213,9 @@ #define RFC1533_VENDOR_MAGIC 128 #define RFC1533_VENDOR_ADDPARM 129 +#define RFC1533_VENDOR_ETHERBOOT_ENCAP 150 #define RFC1533_VENDOR_MNUOPTS 160 +#define RFC1533_VENDOR_NIC_DEV_ID 175 #define RFC1533_VENDOR_SELECTION 176 #define RFC1533_VENDOR_MOTD 184 #define RFC1533_VENDOR_NUMOFMOTD 8 @@ -243,17 +253,28 @@ #define AWAIT_RARP 3 #define AWAIT_RPC 4 #define AWAIT_QDRAIN 5 /* drain queue, process ARP requests */ +#ifdef FREEBSD_PXEEMU +#define AWAIT_UDP 6 +#endif + +/* Helper macros used to identify when DHCP options are valid/invalid in/outside of encapsulation */ +#define NON_ENCAP_OPT in_encapsulated_options == 0 && +#ifdef ALLOW_ONLY_ENCAPSULATED +#define ENCAP_OPT in_encapsulated_options == 1 && +#else +#define ENCAP_OPT +#endif typedef struct { - unsigned long s_addr; + uint32_t s_addr; } in_addr; struct arptable_t { in_addr ipaddr; - unsigned char node[6]; + uint8_t node[6]; }; /* @@ -262,60 +283,72 @@ */ struct arprequest { - unsigned short hwtype; - unsigned short protocol; - char hwlen; - char protolen; - unsigned short opcode; - char shwaddr[6]; - char sipaddr[4]; - char thwaddr[6]; - char tipaddr[4]; + uint16_t hwtype; + uint16_t protocol; + uint8_t hwlen; + uint8_t protolen; + uint16_t opcode; + uint8_t shwaddr[6]; + uint8_t sipaddr[4]; + uint8_t thwaddr[6]; + uint8_t tipaddr[4]; }; struct iphdr { - char verhdrlen; - char service; - unsigned short len; - unsigned short ident; - unsigned short frags; - char ttl; - char protocol; - unsigned short chksum; + uint8_t verhdrlen; + uint8_t service; + uint16_t len; + uint16_t ident; + uint16_t frags; + uint8_t ttl; + uint8_t protocol; + uint16_t chksum; in_addr src; in_addr dest; }; struct udphdr { - unsigned short src; - unsigned short dest; - unsigned short len; - unsigned short chksum; -}; + uint16_t src; + uint16_t dest; + uint16_t len; + uint16_t chksum; +}; + +struct igmp { + struct iphdr ip; + uint8_t type_ver; + uint8_t dummy; + uint16_t chksum; + in_addr group; +}; + +#define IGMP_QUERY 0x11 +#define IGMP_REPORT 0x21 +#define GROUP_ALL_HOSTS 0xe0000001 /* 224.0.0.1 Host byte order */ /* Format of a bootp packet. */ struct bootp_t { - char bp_op; - char bp_htype; - char bp_hlen; - char bp_hops; - unsigned long bp_xid; - unsigned short bp_secs; - unsigned short unused; + uint8_t bp_op; + uint8_t bp_htype; + uint8_t bp_hlen; + uint8_t bp_hops; + uint32_t bp_xid; + uint16_t bp_secs; + uint16_t unused; in_addr bp_ciaddr; in_addr bp_yiaddr; in_addr bp_siaddr; in_addr bp_giaddr; - char bp_hwaddr[16]; - char bp_sname[64]; - char bp_file[128]; + uint8_t bp_hwaddr[16]; + uint8_t bp_sname[64]; + char bp_file[128]; #ifdef NO_DHCP_SUPPORT - char bp_vend[BOOTP_VENDOR_LEN]; + uint8_t bp_vend[BOOTP_VENDOR_LEN]; #else - char bp_vend[DHCP_OPT_LEN]; + uint8_t bp_vend[DHCP_OPT_LEN]; #endif /* NO_DHCP_SUPPORT */ }; @@ -331,7 +364,7 @@ struct bootpd_t { struct bootp_t bootp_reply; - unsigned char bootp_extension[MAX_BOOTP_EXTLEN]; + uint8_t bootp_extension[MAX_BOOTP_EXTLEN]; }; struct tftp_t @@ -341,31 +374,31 @@ unsigned short opcode; union { - char rrq[TFTP_DEFAULTSIZE_PACKET]; + uint8_t rrq[TFTP_DEFAULTSIZE_PACKET]; struct { - unsigned short block; - char download[TFTP_MAX_PACKET]; + uint16_t block; + uint8_t download[TFTP_MAX_PACKET]; } data; struct { - unsigned short block; + uint16_t block; } ack; struct { - unsigned short errcode; - char errmsg[TFTP_DEFAULTSIZE_PACKET]; + uint16_t errcode; + uint8_t errmsg[TFTP_DEFAULTSIZE_PACKET]; } err; struct { - char data[TFTP_DEFAULTSIZE_PACKET+2]; + uint8_t data[TFTP_DEFAULTSIZE_PACKET+2]; } oack; } @@ -378,21 +411,21 @@ { struct iphdr ip; struct udphdr udp; - unsigned short opcode; + uint16_t opcode; union { - char rrq[512]; + uint8_t rrq[512]; struct { - unsigned short block; + uint16_t block; } ack; struct { - unsigned short errcode; - char errmsg[512-2]; + uint16_t errcode; + uint8_t errmsg[512-2]; } err; } @@ -407,29 +440,29 @@ struct udphdr udp; union { - char data[300]; /* longest RPC call must fit!!!! */ + uint8_t data[300]; /* longest RPC call must fit!!!! */ struct { - long id; - long type; - long rpcvers; - long prog; - long vers; - long proc; - long data[1]; + uint32_t id; + uint32_t type; + uint32_t rpcvers; + uint32_t prog; + uint32_t vers; + uint32_t proc; + uint32_t data[1]; } call; struct { - long id; - long type; - long rstatus; - long verifier; - long v2; - long astatus; - long data[1]; + uint32_t id; + uint32_t type; + uint32_t rstatus; + uint32_t verifier; + uint32_t v2; + uint32_t astatus; + uint32_t data[1]; } reply; } @@ -490,6 +523,18 @@ unsigned short flags; /* Bit flags */ }; +#ifdef FREEBSD_PXEEMU +static __inline u_int min(u_int a, u_int b) { return (a < b ? a : b); } + +#define UDP_MAX_PAYLOAD (ETH_FRAME_LEN - ETH_HLEN - sizeof(struct iphdr) \ + - sizeof(struct udphdr)) +struct udppacket_t { + struct iphdr ip; + struct udphdr udp; + char payload[UDP_MAX_PAYLOAD]; +}; +#endif + /*************************************************************************** External prototypes ***************************************************************************/ @@ -509,7 +554,7 @@ /* config.c */ extern void print_config (void); extern void eth_reset (void); -extern int eth_probe (void); +extern int eth_probe (int adapter); extern int eth_poll (void); extern void eth_transmit (const char *d, unsigned int t, unsigned int s, const void *p); @@ -518,10 +563,10 @@ /* misc.c */ extern void twiddle (void); extern void sleep (int secs); -extern int getdec (char **s); +extern int getdec (const char **s); extern void etherboot_printf (const char *, ...); extern int etherboot_sprintf (char *, const char *, ...); -extern int inet_aton (char *p, in_addr *i); +extern int inet_aton (const char *p, in_addr *i); /*************************************************************************** External variables Index: netboot/fa311.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/fa311.c,v retrieving revision 1.1 diff -u -r1.1 fa311.c --- netboot/fa311.c 2 Jan 2002 21:56:40 -0000 1.1 +++ netboot/fa311.c 1 Sep 2002 03:13:43 -0000 @@ -1,3 +1,6 @@ +#ifdef ALLMULTI +#error multicast support is not yet implemented +#endif /* Driver for the National Semiconductor DP83810 Ethernet controller. @@ -136,7 +139,7 @@ memset(dev, 0, sizeof(*dev)); dev->vendor = pci->vendor; dev->device = pci->dev_id; - dev->ioaddr = pci->membase; + dev->ioaddr = pci->addr1; /* Work around the dropped serial bit. */ prev_eedata = eeprom_read(dev->ioaddr, 6); Index: netboot/i82586.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/i82586.c,v retrieving revision 1.4 diff -u -r1.4 i82586.c --- netboot/i82586.c 2 Jan 2002 21:56:40 -0000 1.4 +++ netboot/i82586.c 1 Sep 2002 03:13:43 -0000 @@ -1,3 +1,6 @@ +#ifdef ALLMULTI +#error multicast support is not yet implemented +#endif /************************************************************************** Etherboot - BOOTP/TFTP Bootstrap Program i82586 NIC driver for Etherboot @@ -571,6 +574,9 @@ nic->poll = i82586_poll; nic->transmit = i82586_transmit; nic->disable = i82586_disable; + /* Based on PnP ISA map */ + nic->devid.vendor_id = htons(GENERIC_ISAPNP_VENDOR); + nic->devid.device_id = htons(0x80f6); return nic; } /* else */ Index: netboot/lance.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/lance.c,v retrieving revision 1.5 diff -u -r1.5 lance.c --- netboot/lance.c 2 Jan 2002 21:56:40 -0000 1.5 +++ netboot/lance.c 1 Sep 2002 03:13:43 -0000 @@ -1,3 +1,6 @@ +#ifdef ALLMULTI +#error multicast support is not yet implemented +#endif /************************************************************************** Etherboot - BOOTP/TFTP Bootstrap Program LANCE NIC driver for Etherboot @@ -244,8 +247,6 @@ #ifdef DEBUG printf("media changed to %d\n", media) ; #endif - media &= ~3 ; - media |= 1 ; outw(49, ioaddr+0x12) ; outw(media, ioaddr+0x16) ; outw(49, ioaddr+0x12) ; @@ -556,6 +557,14 @@ nic->poll = lance_poll; nic->transmit = lance_transmit; nic->disable = lance_disable; + /* Based on PnP ISA map */ + nic->devid.vendor_id = htons(GENERIC_ISAPNP_VENDOR); +#ifdef INCLUDE_NE2100 + nic->devid.device_id = htons(0x80d8); +#endif +#ifdef INCLUDE_NI6510 + nic->devid.device_id = htons(0x8113); +#endif return nic; } Index: netboot/linux-asm-string.h =================================================================== RCS file: /cvsroot/grub/grub/netboot/linux-asm-string.h,v retrieving revision 1.4 diff -u -r1.4 linux-asm-string.h --- netboot/linux-asm-string.h 2 Jan 2002 21:56:40 -0000 1.4 +++ netboot/linux-asm-string.h 1 Sep 2002 03:13:43 -0000 @@ -19,7 +19,9 @@ * consider these trivial functions to be PD. */ +#ifndef FREEBSD_PXEEMU typedef int size_t; +#endif extern void *__memcpy(void * to, const void * from, size_t n); extern void *__constant_memcpy(void * to, const void * from, size_t n); Index: netboot/main.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/main.c,v retrieving revision 1.15 diff -u -r1.15 main.c --- netboot/main.c 12 Jun 2002 08:58:21 -0000 1.15 +++ netboot/main.c 1 Sep 2002 03:13:43 -0000 @@ -64,6 +64,7 @@ /* ?Eth */ static unsigned char vendorext_magic[] = {0xE4, 0x45, 0x74, 0x68}; static const unsigned char broadcast[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; +static const in_addr zeroIP = { 0L }; #ifdef NO_DHCP_SUPPORT @@ -113,7 +114,7 @@ void print_network_configuration (void) { - if (! eth_probe ()) + if (eth_probe (-1) < 0) grub_printf ("No ethernet card found.\n"); else if (! network_ready) grub_printf ("Not initialized yet.\n"); @@ -375,7 +376,7 @@ if (tr->opcode == ntohs (TFTP_OACK)) { - char *p = tr->u.oack.data, *e; + const char *p = tr->u.oack.data, *e; /* Shouldn't happen. */ if (prevblock) @@ -438,7 +439,7 @@ /* Neither TFTP_OACK nor TFTP_DATA. */ break; - if ((block || bcounter) && (block != prevblock + 1)) + if ((block || bcounter) && (block != (unsigned short)(prevblock + 1))) /* Block order should be continuous */ tp.u.ack.block = htons (block = prevblock); @@ -482,7 +483,7 @@ struct arprequest rarpreq; /* Make sure that an ethernet is probed. */ - if (! eth_probe ()) + if ((eth_probe (-1)) < 0) return 0; /* Clear the ready flag. */ @@ -539,7 +540,7 @@ unsigned long starttime; /* Make sure that an ethernet is probed. */ - if (! eth_probe ()) + if (eth_probe (-1) < 0) return 0; /* Clear the ready flag. */ @@ -778,8 +779,8 @@ arpreply = (struct arprequest *) &nic.packet[ETH_HLEN]; if (arpreply->opcode == htons (ARP_REPLY) - && ! grub_memcmp (arpreply->sipaddr, ptr, sizeof (in_addr)) - && type == AWAIT_ARP) + && type == AWAIT_ARP + && ! grub_memcmp (arpreply->sipaddr, ptr, sizeof (in_addr))) { grub_memmove ((char *) arptable[ival].node, arpreply->shwaddr, @@ -963,7 +964,8 @@ static unsigned char *extdata = NULL, *extend = NULL; unsigned char *extpath = NULL; unsigned char *endp; - + static unsigned char in_encapsulated_options = 0; + if (block == 0) { end_of_rfc1533 = NULL; @@ -976,6 +978,11 @@ p += 4; endp = p + len; } + else if (block == -1) + { + /* Encapsulated option block */ + endp = p + len; + } else { if (block == 1) @@ -1023,11 +1030,11 @@ end_of_rfc1533 = endp = p; continue; } - else if (c == RFC1533_NETMASK) + else if (NON_ENCAP_OPT c == RFC1533_NETMASK) { grub_memmove ((char *) &netmask, p + 2, sizeof (in_addr)); } - else if (c == RFC1533_GATEWAY) + else if (NON_ENCAP_OPT c == RFC1533_GATEWAY) { /* This is a little simplistic, but it will usually be sufficient. @@ -1039,11 +1046,11 @@ else if (c == RFC1533_EXTENSIONPATH) extpath = p; #ifndef NO_DHCP_SUPPORT - else if (c == RFC2132_MSG_TYPE) + else if (NON_ENCAP_OPT c == RFC2132_MSG_TYPE) { dhcp_reply = *(p + 2); } - else if (c == RFC2132_SRV_ID) + else if (NON_ENCAP_OPT c == RFC2132_SRV_ID) { grub_memmove ((char *) &dhcp_server, p + 2, sizeof (in_addr)); #ifdef DEBUG @@ -1051,7 +1058,7 @@ #endif } #endif /* ! NO_DHCP_SUPPORT */ - else if (c == RFC1533_VENDOR_MAGIC + else if (ENCAP_OPT c == RFC1533_VENDOR_MAGIC && TAG_LEN(p) >= 6 && ! grub_memcmp (p + 2, vendorext_magic, 4) && p[6] == RFC1533_VENDOR_MAJOR) @@ -1080,7 +1087,7 @@ /* Perhaps we can eliminate this because we doesn't require so much information, but I leave this alone. */ - if (block == 0 && extpath != NULL) + if (block <= 0 && extpath != NULL) { char fname[64]; int fnamelen = TAG_LEN (extpath); Index: netboot/misc.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/misc.c,v retrieving revision 1.7 diff -u -r1.7 misc.c --- netboot/misc.c 4 Feb 2002 23:01:38 -0000 1.7 +++ netboot/misc.c 1 Sep 2002 03:13:43 -0000 @@ -34,11 +34,18 @@ void twiddle (void) { +#ifdef BAR_PROGRESS static unsigned long lastticks = 0; static int count = 0; static const char tiddles[]="-\\|/"; unsigned long ticks; +#ifdef FREEBSD_PXEEMU + extern char pxeemu_nbp_active; + if(pxeemu_nbp_active != 0) + return; +#endif + if (debug) { if ((ticks = currticks ()) == lastticks) @@ -48,6 +55,14 @@ grub_putchar (tiddles[(count++) & 3]); grub_putchar ('\b'); } +#else +#ifdef FREEBSD_PXEEMU + extern char pxeemu_nbp_active; + if(pxeemu_nbp_active != 0) + return; +#endif + putchar('.'); +#endif /* BAR_PROGRESS */ } /* Because Etherboot uses its own formats for the printf family, @@ -221,8 +236,9 @@ } int -inet_aton (char *p, in_addr *addr) +inet_aton (const char *start, in_addr *addr) { + const char *p; unsigned long ip = 0; int val; int i; @@ -242,13 +258,13 @@ addr->s_addr = htonl (ip); - return 1; + return p - start; } int -getdec (char **ptr) +getdec (const char **ptr) { - char *p = *ptr; + const char *p = *ptr; int ret = 0; if (*p < '0' || *p > '9') Index: netboot/natsemi.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/natsemi.c,v retrieving revision 1.1 diff -u -r1.1 natsemi.c --- netboot/natsemi.c 15 Jan 2002 10:32:22 -0000 1.1 +++ netboot/natsemi.c 1 Sep 2002 03:13:43 -0000 @@ -1,3 +1,6 @@ +#ifdef ALLMULTI +#error multicast support is not yet implemented +#endif /* -*- Mode:C; c-basic-offset:4; -*- */ /* Index: netboot/ni5010.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/ni5010.c,v retrieving revision 1.1 diff -u -r1.1 ni5010.c --- netboot/ni5010.c 2 Jan 2002 21:56:40 -0000 1.1 +++ netboot/ni5010.c 1 Sep 2002 03:13:43 -0000 @@ -1,3 +1,6 @@ +#ifdef ALLMULTI +#error multicast support is not yet implemented +#endif /************************************************************************** Etherboot - BOOTP/TFTP Bootstrap Program Driver for NI5010. Index: netboot/nic.h =================================================================== RCS file: /cvsroot/grub/grub/netboot/nic.h,v retrieving revision 1.4 diff -u -r1.4 nic.h --- netboot/nic.h 2 Jan 2002 21:56:40 -0000 1.4 +++ netboot/nic.h 1 Sep 2002 03:13:43 -0000 @@ -8,6 +8,28 @@ #ifndef NIC_H #define NIC_H +#define ISAPNP_VENDOR(a,b,c) (((((a)-'A'+1)&0x3f)<<2)|\ + ((((b)-'A'+1)&0x18)>>3)|((((b)-'A'+1)&7)<<13)|\ + ((((c)-'A'+1)&0x1f)<<8)) + +#define GENERIC_ISAPNP_VENDOR ISAPNP_VENDOR('P','N','P') + +/* Need to check the packing of this struct if Etherboot is ported */ +struct nic_id +{ + uint8_t encap_len; + uint8_t tag; + uint8_t len; + uint8_t bus_type; +#define PCI_BUS_TYPE 1 +#define ISA_BUS_TYPE 2 + uint16_t vendor_id; + uint16_t device_id; +}; + +/* Dont use sizeof, that will include the padding */ +#define NIC_ID_SIZE 8 + /* * Structure returned from eth_probe and passed to other driver * functions. @@ -25,6 +47,7 @@ unsigned char *node_addr; char *packet; unsigned int packetlen; + struct nic_id devid; /* NIC device ID string (sent to DHCP server) */ void *priv_data; /* driver can hang private data here */ }; Index: netboot/ns8390.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/ns8390.c,v retrieving revision 1.5 diff -u -r1.5 ns8390.c --- netboot/ns8390.c 2 Jan 2002 21:56:40 -0000 1.5 +++ netboot/ns8390.c 1 Sep 2002 03:13:44 -0000 @@ -1,3 +1,6 @@ +#ifdef ALLMULTI +#error multicast support is not yet implemented +#endif /************************************************************************** ETHERBOOT - BOOTP/TFTP Bootstrap Program @@ -18,6 +21,8 @@ 3c503 PIO support added by Jim Hague (address@hidden) on 2/17/98 RX overrun by Klaus Espenlaub (address@hidden) on 3/10/99 parts taken from the Linux 8390 driver (by Donald Becker and Paul Gortmaker) +SMC8416 PIO support added by Andrew Bettison (address@hidden) on 4/3/02 + based on the Linux 8390 driver (by Donald Becker and Paul Gortmaker) **************************************************************************/ @@ -66,6 +71,7 @@ #endif #if defined(INCLUDE_WD) +#define ASIC_PIO WD_IAR #define eth_probe wd_probe #if defined(INCLUDE_3C503) || defined(INCLUDE_NE) || defined(INCLUDE_NS8390) Error you must only define one of INCLUDE_WD, INCLUDE_3C503, INCLUDE_NE, INCLUDE_NS8390 @@ -101,13 +107,16 @@ #endif #endif -#if defined(INCLUDE_NE) || defined(INCLUDE_NS8390) || (defined(INCLUDE_3C503) && !defined(T503_SHMEM)) +#if defined(INCLUDE_NE) || defined(INCLUDE_NS8390) || (defined(INCLUDE_3C503) && !defined(T503_SHMEM)) || (defined(INCLUDE_WD) && defined(WD_790_PIO)) /************************************************************************** ETH_PIO_READ - Read a frame via Programmed I/O **************************************************************************/ static void eth_pio_read(unsigned int src, unsigned char *dst, unsigned int cnt) { - if (eth_flags & FLAG_16BIT) { ++cnt; cnt &= ~1; } +#ifdef INCLUDE_WD + outb(src & 0xff, eth_asic_base + WD_GP2); + outb(src >> 8, eth_asic_base + WD_GP2); +#else outb(D8390_COMMAND_RD2 | D8390_COMMAND_STA, eth_nic_base + D8390_P0_COMMAND); outb(cnt, eth_nic_base + D8390_P0_RBCR0); @@ -122,9 +131,10 @@ outb(src >> 8, eth_asic_base + _3COM_DAMSB); outb(t503_output | _3COM_CR_START, eth_asic_base + _3COM_CR); #endif +#endif if (eth_flags & FLAG_16BIT) - cnt >>= 1; + cnt = (cnt + 1) >> 1; while(cnt--) { #ifdef INCLUDE_3C503 @@ -153,7 +163,10 @@ #ifdef COMPEX_RL2000_FIX unsigned int x; #endif /* COMPEX_RL2000_FIX */ - if (eth_flags & FLAG_16BIT) { ++cnt; cnt &= ~1; } +#ifdef INCLUDE_WD + outb(dst & 0xff, eth_asic_base + WD_GP2); + outb(dst >> 8, eth_asic_base + WD_GP2); +#else outb(D8390_COMMAND_RD2 | D8390_COMMAND_STA, eth_nic_base + D8390_P0_COMMAND); outb(D8390_ISR_RDC, eth_nic_base + D8390_P0_ISR); @@ -170,9 +183,10 @@ outb(t503_output | _3COM_CR_DDIR | _3COM_CR_START, eth_asic_base + _3COM_CR); #endif +#endif if (eth_flags & FLAG_16BIT) - cnt >>= 1; + cnt = (cnt + 1) >> 1; while(cnt--) { @@ -201,9 +215,11 @@ if (x >= COMPEX_RL2000_TRIES) printf("Warning: Compex RL2000 aborted wait!\n"); #endif /* COMPEX_RL2000_FIX */ +#ifndef INCLUDE_WD while((inb(eth_nic_base + D8390_P0_ISR) & D8390_ISR_RDC) != D8390_ISR_RDC); #endif +#endif } #else /************************************************************************** @@ -238,7 +254,14 @@ outb(eth_tx_start, eth_nic_base+D8390_P0_TPSR); outb(eth_rx_start, eth_nic_base+D8390_P0_PSTART); #ifdef INCLUDE_WD - if (eth_flags & FLAG_790) outb(0, eth_nic_base + 0x09); + if (eth_flags & FLAG_790) { +#ifdef WD_790_PIO + outb(0x10, eth_asic_base + 0x06); /* disable interrupts, enable PIO */ + outb(0x01, eth_nic_base + 0x09); /* enable ring read auto-wrap */ +#else + outb(0, eth_nic_base + 0x09); +#endif + } #endif outb(eth_memsize, eth_nic_base+D8390_P0_PSTOP); outb(eth_memsize - 1, eth_nic_base+D8390_P0_BOUND); @@ -266,8 +289,8 @@ outb(D8390_COMMAND_PS0 | D8390_COMMAND_RD2 | D8390_COMMAND_STA, eth_nic_base+D8390_P0_COMMAND); outb(0xFF, eth_nic_base+D8390_P0_ISR); - outb(0, eth_nic_base+D8390_P0_TCR); - outb(4, eth_nic_base+D8390_P0_RCR); /* allow broadcast frames */ + outb(0, eth_nic_base+D8390_P0_TCR); /* transmitter on */ + outb(4, eth_nic_base+D8390_P0_RCR); /* allow rx broadcast frames */ #ifdef INCLUDE_3C503 /* @@ -357,11 +380,12 @@ #endif #ifdef INCLUDE_WD - /* Memory interface */ if (eth_flags & FLAG_16BIT) { outb(eth_laar | WD_LAAR_M16EN, eth_asic_base + WD_LAAR); inb(0x84); } +#ifndef WD_790_PIO + /* Memory interface */ if (eth_flags & FLAG_790) { outb(WD_MSR_MENB, eth_asic_base + WD_MSR); inb(0x84); @@ -378,16 +402,16 @@ outb(0, eth_asic_base + WD_MSR); inb(0x84); } - if (eth_flags & FLAG_16BIT) { - outb(eth_laar & ~WD_LAAR_M16EN, eth_asic_base + WD_LAAR); - inb(0x84); - } +#else + inb(0x84); +#endif #endif #if defined(INCLUDE_3C503) - if (eth_flags & FLAG_PIO) { + if (eth_flags & FLAG_PIO) #endif -#if defined(INCLUDE_NE) || defined(INCLUDE_NS8390) || (defined(INCLUDE_3C503) && !defined(T503_SHMEM)) +#if defined(INCLUDE_NE) || defined(INCLUDE_NS8390) || (defined(INCLUDE_3C503) && !defined(T503_SHMEM)) || (defined(INCLUDE_WD) && defined(WD_790_PIO)) + { /* Programmed I/O */ unsigned short type; type = (t >> 8) | (t << 8); @@ -398,12 +422,16 @@ eth_pio_write(p, (eth_tx_start<<8)+ETH_HLEN, s); s += ETH_HLEN; if (s < ETH_ZLEN) s = ETH_ZLEN; + } #endif #if defined(INCLUDE_3C503) - } #endif #ifdef INCLUDE_WD + if (eth_flags & FLAG_16BIT) { + outb(eth_laar & ~WD_LAAR_M16EN, eth_asic_base + WD_LAAR); + inb(0x84); + } if (eth_flags & FLAG_790) outb(D8390_COMMAND_PS0 | D8390_COMMAND_STA, eth_nic_base+D8390_P0_COMMAND); @@ -458,10 +486,12 @@ outb(eth_laar | WD_LAAR_M16EN, eth_asic_base + WD_LAAR); inb(0x84); } +#ifndef WD_790_PIO if (eth_flags & FLAG_790) { outb(WD_MSR_MENB, eth_asic_base + WD_MSR); inb(0x84); } +#endif inb(0x84); #endif pktoff = next << 8; @@ -499,10 +529,12 @@ ret = 1; } #ifdef INCLUDE_WD +#ifndef WD_790_PIO if (eth_flags & FLAG_790) { outb(0, eth_asic_base + WD_MSR); inb(0x84); } +#endif if (eth_flags & FLAG_16BIT) { outb(eth_laar & ~WD_LAAR_M16EN, eth_asic_base + WD_LAAR); inb(0x84); @@ -592,9 +624,15 @@ for (i=0; inode_addr[i] = inb(i+eth_asic_base+WD_LAR); } - printf("\n%s base %#hx, memory %#hx, addr %!\n", - brd->name, eth_asic_base, eth_bmem, nic->node_addr); + printf("\n%s base %#hx", brd->name, eth_asic_base); if (eth_flags & FLAG_790) { +#ifdef WD_790_PIO + printf(", PIO mode, addr %!\n", nic->node_addr); + eth_bmem = 0; + eth_flags |= FLAG_PIO; /* force PIO mode */ + outb(0, eth_asic_base+WD_MSR); +#else + printf(", memory %#hx, addr %!\n", eth_bmem, nic->node_addr); outb(WD_MSR_MENB, eth_asic_base+WD_MSR); outb((inb(eth_asic_base+0x04) | 0x80), eth_asic_base+0x04); @@ -603,7 +641,9 @@ (inb(eth_asic_base+0x0B) & 0xB0), eth_asic_base+0x0B); outb((inb(eth_asic_base+0x04) & ~0x80), eth_asic_base+0x04); +#endif } else { + printf(", memory %#hx, addr %!\n", eth_bmem, nic->node_addr); outb((((unsigned)eth_bmem >> 13) & 0x3F) | 0x40, eth_asic_base+WD_MSR); } if (eth_flags & FLAG_16BIT) { @@ -824,6 +864,19 @@ nic->poll = ns8390_poll; nic->transmit = ns8390_transmit; nic->disable = ns8390_disable; + /* Based on PnP ISA map */ +#ifdef INCLUDE_WD + nic->devid.vendor_id = htons(GENERIC_ISAPNP_VENDOR); + nic->devid.device_id = htons(0x812a); +#endif +#ifdef INCLUDE_3C503 + nic->devid.vendor_id = htons(GENERIC_ISAPNP_VENDOR); + nic->devid.device_id = htons(0x80f3); +#endif +#ifdef INCLUDE_NE + nic->devid.vendor_id = htons(GENERIC_ISAPNP_VENDOR); + nic->devid.device_id = htons(0x80d6); +#endif return(nic); } Index: netboot/osdep.h =================================================================== RCS file: /cvsroot/grub/grub/netboot/osdep.h,v retrieving revision 1.4 diff -u -r1.4 osdep.h --- netboot/osdep.h 2 Jan 2002 21:56:40 -0000 1.4 +++ netboot/osdep.h 1 Sep 2002 03:13:44 -0000 @@ -74,7 +74,18 @@ #define swap32(x) __swap32(x) #define swap16(x) __swap16(x) +#ifdef FREEBSD_PXEEMU +#undef htonl +#undef htons +#undef ntohl +#undef ntohs +#include +#include "/sys/boot/i386/libi386/pxe.h" +#include "/sys/boot/i386/btx/lib/btxv86.h" +#endif + #include "linux-asm-io.h" +#include "stdint.h" typedef unsigned long Address; Index: netboot/pci.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/pci.c,v retrieving revision 1.6 diff -u -r1.6 pci.c --- netboot/pci.c 2 Jan 2002 21:56:40 -0000 1.6 +++ netboot/pci.c 1 Sep 2002 03:13:44 -0000 @@ -396,24 +396,37 @@ } #endif /* CONFIG_PCI_DIRECT not defined*/ -static void scan_bus(struct pci_device *pcidev) +static void scan_bus(struct pci_id *id, int ids, struct pci_device *dev) { + unsigned int first_bus, first_devfn, first_i; unsigned int devfn, l, bus, buses; unsigned char hdr_type = 0; unsigned short vendor, device; - unsigned int membase, ioaddr, romaddr; + unsigned int addr0, addr1, romaddr; int i, reg; unsigned int pci_ioaddr = 0; + first_bus = 0; + first_devfn = 0; + first_i = 0; + if (dev->probe_id) { + first_bus = dev->bus; + first_devfn = dev->devfn; + first_i = dev->probe_id - id +1; + dev->probe_id = 0; + dev->bus = 0; + dev->devfn = 0; + } + /* Scan all PCI buses, until we find our card. - * We could be smart only scan the required busses but that + * We could be smart only scan the required buses but that * is error prone, and tricky. - * By scanning all possible pci busses in order we should find + * By scanning all possible pci buses in order we should find * our card eventually. */ buses=256; - for (bus = 0; bus < buses; ++bus) { - for (devfn = 0; devfn < 0xff; ++devfn) { + for (bus = first_bus; bus < buses; ++bus) { + for (devfn = first_devfn; devfn < 0xff; ++devfn) { if (PCI_FUNC (devfn) == 0) pcibios_read_config_byte(bus, devfn, PCI_HEADER_TYPE, &hdr_type); else if (!(hdr_type & 0x80)) /* not a multi-function device */ @@ -431,49 +444,67 @@ printf("bus %hhX, function %hhX, vendor %hX, device %hX\n", bus, devfn, vendor, device); #endif - for (i = 0; pcidev[i].vendor != 0; i++) { - if (vendor != pcidev[i].vendor - || device != pcidev[i].dev_id) + for (i = first_i; i < ids; i++) { + if (vendor != id[i].vendor) + continue; + if (device != id[i].dev_id) continue; - pcidev[i].devfn = devfn; - pcidev[i].bus = bus; - for (reg = PCI_BASE_ADDRESS_0; reg <= PCI_BASE_ADDRESS_5; reg += 4) { - pcibios_read_config_dword(bus, devfn, reg, &ioaddr); - if ((ioaddr & PCI_BASE_ADDRESS_IO_MASK) == 0 || (ioaddr & PCI_BASE_ADDRESS_SPACE_IO) == 0) + dev->devfn = devfn; + dev->bus = bus; + dev->vendor = id[i].vendor; + dev->dev_id = id[i].dev_id; + dev->name = id[i].name; + dev->probe_id = &id[i]; + + + /* Get the ROM base address */ + pcibios_read_config_dword(bus, devfn, PCI_ROM_ADDRESS, &romaddr); + romaddr >>= 10; + dev->romaddr = romaddr; + + /* Get addr1 */ + pcibios_read_config_dword(bus, devfn, + PCI_BASE_ADDRESS_1, &addr1); + dev->addr1 = addr1; + + /* Get the addr0 */ + for (reg = PCI_BASE_ADDRESS_0; reg <= PCI_BASE_ADDRESS_5; reg += 4) { + pcibios_read_config_dword(bus, devfn, reg, &addr0); + if ((addr0 & PCI_BASE_ADDRESS_IO_MASK) == 0 || (addr0 & PCI_BASE_ADDRESS_SPACE_IO) == 0) continue; + + /* Strip the I/O address out of the returned value */ - ioaddr &= PCI_BASE_ADDRESS_IO_MASK; - /* Get the memory base address */ - pcibios_read_config_dword(bus, devfn, - PCI_BASE_ADDRESS_1, &membase); - /* Get the ROM base address */ - pcibios_read_config_dword(bus, devfn, PCI_ROM_ADDRESS, &romaddr); - romaddr >>= 10; - printf("Found %s at %#hx, ROM address %#hx\n", - pcidev[i].name, ioaddr, romaddr); + addr0 &= PCI_BASE_ADDRESS_IO_MASK; + /* Take the first one or the one that matches in boot ROM address */ - if (pci_ioaddr == 0 || romaddr == ((unsigned long) rom.rom_segment << 4)) { - pcidev[i].membase = membase; - pcidev[i].ioaddr = ioaddr; - return; - } + dev->ioaddr = addr0; } + printf("Found %s ROM address %#hx\n", + dev->name, romaddr); + return; + } + first_i = 0; } + first_devfn = 0; } + first_bus = 0; } -void eth_pci_init(struct pci_device *pcidev) +void eth_find_pci(struct pci_id *idlist, int ids, struct pci_device *dev) { #ifndef CONFIG_PCI_DIRECT - pcibios_init(); + if (!pcibios_entry) { + pcibios_init(); + } if (!pcibios_entry) { printf("pci_init: no BIOS32 detected\n"); return; } #endif - scan_bus(pcidev); + scan_bus(idlist, ids, dev); /* return values are in pcidev structures */ } Index: netboot/pci.h =================================================================== RCS file: /cvsroot/grub/grub/netboot/pci.h,v retrieving revision 1.8 diff -u -r1.8 pci.h --- netboot/pci.h 2 Jan 2002 21:56:40 -0000 1.8 +++ netboot/pci.h 1 Sep 2002 03:13:44 -0000 @@ -25,6 +25,8 @@ #define PCI_COMMAND_MEM 0x2 /* Enable response in mem space */ #define PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */ #define PCI_LATENCY_TIMER 0x0d /* 8 bits */ +#define PCI_COMMAND_SPECIAL 0x8 /* Enable response to special cycles */ +#define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */ #define PCIBIOS_PCI_FUNCTION_ID 0xb1XX #define PCIBIOS_PCI_BIOS_PRESENT 0xb101 @@ -57,6 +59,9 @@ #ifndef PCI_BASE_ADDRESS_IO_MASK #define PCI_BASE_ADDRESS_IO_MASK (~0x03) #endif +#ifndef PCI_BASE_ADDRESS_MEM_MASK +#define PCI_BASE_ADDRESS_MEM_MASK (~0x0f) +#endif #define PCI_BASE_ADDRESS_SPACE_IO 0x01 #define PCI_ROM_ADDRESS 0x30 /* 32 bits */ #define PCI_ROM_ADDRESS_ENABLE 0x01 /* Write 1 to enable ROM, @@ -100,6 +105,7 @@ #define PCI_DEVICE_ID_ADMTEK_0985 0x0985 #define PCI_VENDOR_ID_REALTEK 0x10ec #define PCI_DEVICE_ID_REALTEK_8029 0x8029 +#define PCI_DEVICE_ID_REALTEK_8129 0x8129 #define PCI_DEVICE_ID_REALTEK_8139 0x8139 #define PCI_VENDOR_ID_WINBOND2 0x1050 #define PCI_DEVICE_ID_WINBOND2_89C940 0x0940 @@ -129,7 +135,13 @@ #define PCI_DEVICE_ID_INTEL_82559ER 0x1209 #define PCI_DEVICE_ID_INTEL_ID1029 0x1029 #define PCI_DEVICE_ID_INTEL_ID1030 0x1030 +#define PCI_DEVICE_ID_INTEL_ID1038 0x1038 #define PCI_DEVICE_ID_INTEL_82562 0x2449 +#define PCI_DEVICE_ID_INTEL_82542 0x1000 +#define PCI_DEVICE_ID_INTEL_82543GC_FIBER 0x1001 +#define PCI_DEVICE_ID_INTEL_82543GC_COPPER 0x1004 +#define PCI_DEVICE_ID_INTEL_82544EI_COPPER 0x1008 +#define PCI_DEVICE_ID_INTEL_82544GC_CREB 0x100D #define PCI_VENDOR_ID_AMD 0x1022 #define PCI_DEVICE_ID_AMD_LANCE 0x2000 #define PCI_VENDOR_ID_AMD_HOMEPNA 0x1022 @@ -146,6 +158,7 @@ # define PCI_DEVICE_ID_SMC_EPIC100 0x0005 #endif #define PCI_VENDOR_ID_MACRONIX 0x10d9 +#define PCI_DEVICE_ID_MX987x3 0x0512 #define PCI_DEVICE_ID_MX987x5 0x0531 #define PCI_VENDOR_ID_LINKSYS 0x11AD #define PCI_DEVICE_ID_LC82C115 0xC115 @@ -170,17 +183,29 @@ #define PCI_DEVICE_ID_OLICOM_OC2183 0x0013 #define PCI_DEVICE_ID_OLICOM_OC2326 0x0014 #define PCI_DEVICE_ID_OLICOM_OC6151 0x0021 +#define PCI_VENDOR_ID_NETGEAR 0x1385 +#define PCI_DEVICE_ID_NETGEAR_MA301 0x4100 +#define PCI_VENDOR_ID_HARRIS 0x1260 +#define PCI_DEVICE_ID_HARRIS_PRISM2 0x3873 + +struct pci_id { + unsigned short vendor, dev_id; + const char *name; +}; struct pci_device { unsigned short vendor, dev_id; const char *name; - unsigned int membase; - unsigned short ioaddr; + /* ioaddr is silly and deprecated */ + unsigned int ioaddr; + unsigned int addr1; unsigned char devfn; unsigned char bus; + struct pci_id * probe_id; + unsigned int romaddr; }; -extern void eth_pci_init(struct pci_device *); +extern void eth_find_pci(struct pci_id *idlist, int ids, struct pci_device *dev); extern int pcibios_read_config_byte(unsigned int bus, unsigned int device_fn, unsigned int where, unsigned char *value); extern int pcibios_write_config_byte (unsigned int bus, unsigned int device_fn, unsigned int where, unsigned char value); Index: netboot/rtl8139.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/rtl8139.c,v retrieving revision 1.4 diff -u -r1.4 rtl8139.c --- netboot/rtl8139.c 2 Jan 2002 21:56:40 -0000 1.4 +++ netboot/rtl8139.c 1 Sep 2002 03:13:44 -0000 @@ -1,3 +1,6 @@ +#ifdef ALLMULTI +#error multicast support is not yet implemented +#endif /* rtl8139.c - etherboot driver for the Realtek 8139 chipset ported from the linux driver written by Donald Becker @@ -173,7 +176,7 @@ struct nic *rtl8139_probe(struct nic *nic, unsigned short *probeaddrs, struct pci_device *pci); -static int read_eeprom(int location); +static int read_eeprom(int location, int addr_len); static void rtl_reset(struct nic *nic); static void rtl_transmit(struct nic *nic, const char *destaddr, unsigned int type, unsigned int len, const char *data); @@ -186,6 +189,8 @@ { int i; int speed10, fullduplex; + int addr_len; + unsigned short *ap = (unsigned short*)nic->node_addr; /* There are enough "RTL8139" strings on the console already, so * be brief and concentrate on the interesting pieces of info... */ @@ -199,15 +204,9 @@ /* Bring the chip out of low-power mode. */ outb(0x00, ioaddr + Config1); - if (read_eeprom(0) != 0xffff) { - unsigned short *ap = (unsigned short*)nic->node_addr; - for (i = 0; i < 3; i++) - *ap++ = read_eeprom(i + 7); - } else { - unsigned char *ap = (unsigned char*)nic->node_addr; - for (i = 0; i < ETH_ALEN; i++) - *ap++ = inb(ioaddr + MAC0 + i); - } + addr_len = read_eeprom(0,8) == 0x8129 ? 8 : 6; + for (i = 0; i < 3; i++) + *ap++ = read_eeprom(i + 7,addr_len); speed10 = inb(ioaddr + MediaStatus) & MSRSpeed10; fullduplex = inw(ioaddr + MII_BMCR) & BMCRDuplex; @@ -217,6 +216,11 @@ rtl_reset(nic); + if (inb(ioaddr + MediaStatus) & MSRLinkFail) { + printf("Cable not connected or other link failure\n"); + return(0); + } + nic->reset = rtl_reset; nic->poll = rtl_poll; nic->transmit = rtl_transmit; @@ -244,22 +248,23 @@ #define eeprom_delay() inl(ee_addr) /* The EEPROM commands include the alway-set leading bit. */ -#define EE_WRITE_CMD (5 << 6) -#define EE_READ_CMD (6 << 6) -#define EE_ERASE_CMD (7 << 6) +#define EE_WRITE_CMD (5) +#define EE_READ_CMD (6) +#define EE_ERASE_CMD (7) -static int read_eeprom(int location) +static int read_eeprom(int location, int addr_len) { int i; unsigned int retval = 0; long ee_addr = ioaddr + Cfg9346; - int read_cmd = location | EE_READ_CMD; + int read_cmd = location | (EE_READ_CMD << addr_len); outb(EE_ENB & ~EE_CS, ee_addr); outb(EE_ENB, ee_addr); + eeprom_delay(); /* Shift the read command bits out. */ - for (i = 10; i >= 0; i--) { + for (i = 4 + addr_len; i >= 0; i--) { int dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0; outb(EE_ENB | dataval, ee_addr); eeprom_delay(); @@ -279,6 +284,7 @@ /* Terminate the EEPROM access. */ outb(~EE_CS, ee_addr); + eeprom_delay(); return retval; } @@ -337,10 +343,11 @@ unsigned int status, to, nstype; unsigned long txstatus; + /* nstype assignment moved up here to avoid gcc 3.0.3 compiler bug */ + nstype = htons(type); memcpy(tx_buffer, destaddr, ETH_ALEN); memcpy(tx_buffer + ETH_ALEN, nic->node_addr, ETH_ALEN); - nstype = htons(type); - memcpy(tx_buffer + 2 * ETH_ALEN, (char*)&nstype, 2); + memcpy(tx_buffer + 2 * ETH_ALEN, &nstype, 2); memcpy(tx_buffer + ETH_HLEN, data, len); len += ETH_HLEN; Index: netboot/sis900.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/sis900.c,v retrieving revision 1.1 diff -u -r1.1 sis900.c --- netboot/sis900.c 2 Jan 2002 21:56:40 -0000 1.1 +++ netboot/sis900.c 1 Sep 2002 03:13:44 -0000 @@ -1,3 +1,6 @@ +#ifdef ALLMULTI +#error multicast support is not yet implemented +#endif /* -*- Mode:C; c-basic-offset:4; -*- */ /* @@ -27,6 +30,9 @@ /* Revision History */ /* + 04 Jan 2002 Chien-Yu Chen, Doug Ambrisko, Marty Connor Patch to Etherboot 5.0.5 + Added support for the SiS 630ET plus various bug fixes from linux kernel + source 2.4.17. 01 March 2001 mdc 1.0 Initial Release. Tested with PCI based sis900 card and ThinkNIC computer. @@ -51,6 +57,7 @@ static unsigned short vendor, dev_id; static unsigned long ioaddr; +static u8 pci_revision; static unsigned int cur_phy; @@ -108,10 +115,9 @@ // PCI to ISA bridge for SIS640E access -static struct pci_device pci_isa_bridge_list[] = { +static struct pci_id pci_isa_bridge_list[] = { { 0x1039, 0x0008, - "SIS 85C503/5513 PCI to ISA bridge", 0, 0, 0, 0}, - {0, 0, NULL, 0, 0, 0, 0} + "SIS 85C503/5513 PCI to ISA bridge"}, }; /* Function Prototypes */ @@ -181,13 +187,15 @@ { u8 reg; int i; - struct pci_device *p; - - // find PCI to ISA bridge - eth_pci_init(pci_isa_bridge_list); + struct pci_device p[1]; - /* the firts entry in this list should contain bus/devfn */ - p = pci_isa_bridge_list; + /* find PCI to ISA bridge */ + eth_find_pci(pci_isa_bridge_list, + sizeof(pci_isa_bridge_list)/sizeof(pci_isa_bridge_list[0]), p); + + /* error on failure */ + if (!p->probe_id) + return 0; pcibios_read_config_byte(p->bus,p->devfn, 0x48, ®); pcibios_write_config_byte(p->bus,p->devfn, 0x48, reg | 0x40); @@ -201,6 +209,41 @@ return 1; } + +/** + * sis630e_get_mac_addr: - Get MAC address for SiS630E model + * @pci_dev: the sis900 pci device + * @net_dev: the net device to get address for + * + * SiS630E model, use APC CMOS RAM to store MAC address. + * APC CMOS RAM is accessed through ISA bridge. + * MAC address is read into @net_dev->dev_addr. + */ + +static int sis635_get_mac_addr(struct pci_device * pci_dev, struct nic *nic) +{ + u32 rfcrSave; + u32 i; + + rfcrSave = inl(rfcr + ioaddr); + + outl(rfcrSave | RELOAD, ioaddr + cr); + outl(0, ioaddr + cr); + + /* disable packet filtering before setting filter */ + outl(rfcrSave & ~RFEN, rfcr + ioaddr); + + /* load MAC addr to filter data register */ + for (i = 0 ; i < 3 ; i++) { + outl((i << RFADDR_shift), ioaddr + rfcr); + *( ((u16 *)nic->node_addr) + i) = inw(ioaddr + rfdr); + } + + /* enable packet filitering */ + outl(rfcrSave | RFEN, rfcr + ioaddr); + + return 1; +} /* * Function: sis900_probe @@ -240,10 +283,14 @@ /* get MAC address */ ret = 0; pcibios_read_config_byte(pci->bus,pci->devfn, PCI_REVISION, &revision); - if (revision == SIS630E_900_REV || revision == SIS630EA1_900_REV) - ret = sis630e_get_mac_addr(pci, nic); - else if (revision == SIS630S_900_REV) + + /* save for use later in sis900_reset() */ + pci_revision = revision; + + if (revision == SIS630E_900_REV) ret = sis630e_get_mac_addr(pci, nic); + else if ((revision > 0x81) && (revision <= 0x90)) + ret = sis635_get_mac_addr(pci, nic); else ret = sis900_get_mac_addr(pci, nic); @@ -253,6 +300,10 @@ return NULL; } + /* 630ET : set the mii access mode as software-mode */ + if (revision == SIS630ET_900_REV) + outl(ACCESSMODE | inl(ioaddr + cr), ioaddr + cr); + printf("\nsis900_probe: MAC addr %! at ioaddr %#hX\n", nic->node_addr, ioaddr); printf("sis900_probe: Vendor:%#hX Device:%#hX\n", vendor, dev_id); @@ -264,7 +315,7 @@ for (phy_addr = 0; phy_addr < 32; phy_addr++) { u16 mii_status; u16 phy_id0, phy_id1; - + mii_status = sis900_mdio_read(phy_addr, MII_STATUS); if (mii_status == 0xffff || mii_status == 0x0000) /* the mii is not accessable, try next one */ @@ -272,7 +323,7 @@ phy_id0 = sis900_mdio_read(phy_addr, MII_PHY_ID0); phy_id1 = sis900_mdio_read(phy_addr, MII_PHY_ID1); - + /* search our mii table for the current mii */ for (i = 0; mii_chip_table[i].phy_id1; i++) { @@ -432,6 +483,7 @@ outl(MDC, mdio_addr); sis900_mdio_delay(); } + outl(0x00, mdio_addr); return retval; } @@ -471,6 +523,7 @@ outb(MDC, mdio_addr); sis900_mdio_delay(); } + outl(0x00, mdio_addr); return; } @@ -500,7 +553,7 @@ sis900_check_mode(nic); - outl(RxENA, ioaddr + cr); + outl(RxENA| inl(ioaddr + cr), ioaddr + cr); } @@ -519,18 +572,23 @@ { int i = 0; u32 status = TxRCMP | RxRCMP; + u8 revision; outl(0, ioaddr + ier); outl(0, ioaddr + imr); outl(0, ioaddr + rfcr); - outl(RxRESET | TxRESET | RESET, ioaddr + cr); - + outl(RxRESET | TxRESET | RESET | inl(ioaddr + cr), ioaddr + cr); + /* Check that the chip has finished the reset. */ while (status && (i++ < 1000)) { status ^= (inl(isr + ioaddr) & status); } - outl(PESEL, ioaddr + cfg); + + if( (pci_revision == SIS635A_900_REV) || (pci_revision == SIS900B_900_REV) ) + outl(PESEL | RND_CNT, ioaddr + cfg); + else + outl(PESEL, ioaddr + cfg); } @@ -552,7 +610,7 @@ rfcrSave = inl(rfcr + ioaddr); /* disable packet filtering before setting filter */ - outl(rfcrSave & ~RFEN, rfcr); + outl(rfcrSave & ~RFEN, rfcr + ioaddr); /* load MAC addr to filter data register */ for (i = 0 ; i < 3 ; i++) { @@ -674,15 +732,21 @@ */ static void -sis900_check_mode (struct nic *nic) +sis900_check_mode(struct nic *nic) { int speed, duplex; u32 tx_flags = 0, rx_flags = 0; mii.chip_info->read_mode(nic, cur_phy, &speed, &duplex); - tx_flags = TxATP | (TX_DMA_BURST << TxMXDMA_shift) | (TX_FILL_THRESH << TxFILLT_shift); - rx_flags = RX_DMA_BURST << RxMXDMA_shift; + if( inl(ioaddr + cfg) & EDB_MASTER_EN ) { + tx_flags = TxATP | (DMA_BURST_64 << TxMXDMA_shift) | (TX_FILL_THRESH << TxFILLT_shift); + rx_flags = DMA_BURST_64 << RxMXDMA_shift; + } + else { + tx_flags = TxATP | (DMA_BURST_512 << TxMXDMA_shift) | (TX_FILL_THRESH << TxFILLT_shift); + rx_flags = DMA_BURST_512 << RxMXDMA_shift; + } if (speed == HW_SPEED_HOME || speed == HW_SPEED_10_MBPS) { rx_flags |= (RxDRNT_10 << RxDRNT_shift); @@ -718,20 +782,29 @@ { int i = 0; u32 status; + u16 phy_id0, phy_id1; /* STSOUT register is Latched on Transition, read operation updates it */ while (i++ < 2) status = sis900_mdio_read(phy_addr, MII_STSOUT); - if (status & MII_STSOUT_SPD) - *speed = HW_SPEED_100_MBPS; - else - *speed = HW_SPEED_10_MBPS; - - if (status & MII_STSOUT_DPLX) - *duplex = FDX_CAPABLE_FULL_SELECTED; - else - *duplex = FDX_CAPABLE_HALF_SELECTED; + *speed = HW_SPEED_10_MBPS; + *duplex = FDX_CAPABLE_HALF_SELECTED; + + if (status & (MII_NWAY_TX | MII_NWAY_TX_FDX)) + *speed = HW_SPEED_100_MBPS; + if (status & ( MII_NWAY_TX_FDX | MII_NWAY_T_FDX)) + *duplex = FDX_CAPABLE_FULL_SELECTED; + + /* Workaround for Realtek RTL8201 PHY issue */ + phy_id0 = sis900_mdio_read(phy_addr, MII_PHY_ID0); + phy_id1 = sis900_mdio_read(phy_addr, MII_PHY_ID1); + if((phy_id0 == 0x0000) && ((phy_id1 & 0xFFF0) == 0x8200)){ + if(sis900_mdio_read(phy_addr, MII_CONTROL) & MII_CNTL_FDX) + *duplex = FDX_CAPABLE_FULL_SELECTED; + if(sis900_mdio_read(phy_addr, 0x0019) & 0x01) + *speed = HW_SPEED_100_MBPS; + } if (status & MII_STSOUT_LINK_FAIL) printf("sis900_read_mode: Media Link Off\n"); @@ -878,7 +951,7 @@ *duplex == FDX_CAPABLE_FULL_SELECTED ? "full" : "half"); else - printf("rtl9201_read_config_mode: Media Link Off\n"); + printf("rtl8201_read_config_mode: Media Link Off\n"); } /* Function: sis900_transmit @@ -904,7 +977,7 @@ u32 tx_status; /* Stop the transmitter */ - outl(TxDIS, ioaddr + cr); + outl(TxDIS | inl(ioaddr + cr), ioaddr + cr); /* load Transmit Descriptor Register */ outl((u32) &txd, ioaddr + txdp); @@ -933,7 +1006,7 @@ txd.cmdsts = (u32) OWN | s; /* restart the transmitter */ - outl(TxENA, ioaddr + cr); + outl(TxENA | inl(ioaddr + cr), ioaddr + cr); if (sis900_debug > 1) printf("sis900_transmit: Queued Tx packet size %d.\n", (int) s); @@ -1007,7 +1080,7 @@ cur_rx = 0; /* re-enable the potentially idle receive state machine */ - outl(RxENA , ioaddr + cr); + outl(RxENA | inl(ioaddr + cr), ioaddr + cr); return retstat; } @@ -1030,5 +1103,5 @@ outl(0, ioaddr + ier); /* Stop the chip's Tx and Rx Status Machine */ - outl(RxDIS | TxDIS, ioaddr + cr); + outl(RxDIS | TxDIS | inl(ioaddr + cr), ioaddr + cr); } Index: netboot/sis900.h =================================================================== RCS file: /cvsroot/grub/grub/netboot/sis900.h,v retrieving revision 1.1 diff -u -r1.1 sis900.h --- netboot/sis900.h 2 Jan 2002 21:56:40 -0000 1.1 +++ netboot/sis900.h 1 Sep 2002 03:13:44 -0000 @@ -39,14 +39,16 @@ /* Symbolic names for bits in various registers */ enum sis900_command_register_bits { - RESET = 0x00000100, - SWI = 0x00000080, - RxRESET = 0x00000020, - TxRESET = 0x00000010, - RxDIS = 0x00000008, - RxENA = 0x00000004, - TxDIS = 0x00000002, - TxENA = 0x00000001 + RELOAD = 0x00000400, + ACCESSMODE = 0x00000200, + RESET = 0x00000100, + SWI = 0x00000080, + RxRESET = 0x00000020, + TxRESET = 0x00000010, + RxDIS = 0x00000008, + RxENA = 0x00000004, + TxDIS = 0x00000002, + TxENA = 0x00000001 }; enum sis900_configuration_register_bits { @@ -57,7 +59,10 @@ EXD = 0x00000010, PESEL = 0x00000008, LPM = 0x00000004, - BEM = 0x00000001 + BEM = 0x00000001, + RND_CNT = 0x00000400, + FAIR_BACKOFF = 0x00000200, + EDB_MASTER_EN = 0x00002000 }; enum sis900_eeprom_access_reigster_bits { @@ -108,6 +113,10 @@ #define TX_DMA_BURST 0 #define RX_DMA_BURST 0 +enum sis900_tx_rx_dma{ + DMA_BURST_512 = 0, DMA_BURST_64 = 5 +}; + /* transmit FIFO threshholds */ #define TX_FILL_THRESH 16 /* 1/4 FIFO size */ #define TxFILLT_shift 8 @@ -172,6 +181,7 @@ EEeraseAll = 0x0120, EEwriteAll = 0x0110, EEaddrMask = 0x013F, + EEcmdShift = 16 }; /* Manamgement Data I/O (mdio) frame */ @@ -236,7 +246,8 @@ MII_CONFIG1 = 0x0010, MII_CONFIG2 = 0x0011, MII_STSOUT = 0x0012, - MII_MASK = 0x0013 + MII_MASK = 0x0013, + MII_RESV = 0x0014 }; /* mii registers specific to AMD 79C901 */ @@ -320,7 +331,9 @@ enum sis900_revision_id { SIS630A_900_REV = 0x80, SIS630E_900_REV = 0x81, - SIS630S_900_REV = 0x82, SIS630EA1_900_REV = 0x83 + SIS630S_900_REV = 0x82, SIS630EA1_900_REV = 0x83, + SIS630ET_900_REV = 0x84, SIS635A_900_REV = 0x90, + SIS900B_900_REV = 0x03 }; enum sis630_revision_id { Index: netboot/sk_g16.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/sk_g16.c,v retrieving revision 1.4 diff -u -r1.4 sk_g16.c --- netboot/sk_g16.c 2 Jan 2002 21:56:40 -0000 1.4 +++ netboot/sk_g16.c 1 Sep 2002 03:13:44 -0000 @@ -1,3 +1,6 @@ +#ifdef ALLMULTI +#error multicast support is not yet implemented +#endif /************************************************************************** Etherboot - BOOTP/TFTP Bootstrap Program Schneider & Koch G16 NIC driver for Etherboot Index: netboot/smc9000.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/smc9000.c,v retrieving revision 1.3 diff -u -r1.3 smc9000.c --- netboot/smc9000.c 2 Jan 2002 21:56:40 -0000 1.3 +++ netboot/smc9000.c 1 Sep 2002 03:13:44 -0000 @@ -1,3 +1,6 @@ +#ifdef ALLMULTI +#error multicast support is not yet implemented +#endif /*------------------------------------------------------------------------ * smc9000.c * This is a Etherboot driver for SMC's 9000 series of Ethernet cards. @@ -505,7 +508,9 @@ nic->poll = smc9000_poll; nic->transmit = smc9000_transmit; nic->disable = smc9000_disable; - + /* Based on PnP ISA map */ + nic->devid.vendor_id = htons(GENERIC_ISAPNP_VENDOR); + nic->devid.device_id = htons(0x8228); return nic; Index: netboot/tiara.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/tiara.c,v retrieving revision 1.4 diff -u -r1.4 tiara.c --- netboot/tiara.c 2 Jan 2002 21:56:40 -0000 1.4 +++ netboot/tiara.c 1 Sep 2002 03:13:44 -0000 @@ -1,3 +1,6 @@ +#ifdef ALLMULTI +#error multicast support is not yet implemented +#endif /************************************************************************** Etherboot - BOOTP/TFTP Bootstrap Program Index: netboot/tlan.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/tlan.c,v retrieving revision 1.1 diff -u -r1.1 tlan.c --- netboot/tlan.c 2 Jan 2002 21:56:40 -0000 1.1 +++ netboot/tlan.c 1 Sep 2002 03:13:44 -0000 @@ -1649,7 +1649,7 @@ #include -#include "tlan.h" +/*#include "tlan.h"*/ #include #include Index: netboot/tulip.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/tulip.c,v retrieving revision 1.5 diff -u -r1.5 tulip.c --- netboot/tulip.c 2 Jan 2002 21:56:40 -0000 1.5 +++ netboot/tulip.c 1 Sep 2002 03:13:45 -0000 @@ -1,3 +1,6 @@ +#ifdef ALLMULTI +#error multicast support is not yet implemented +#endif /* -*- Mode:C; c-basic-offset:4; -*- */ /* @@ -211,6 +214,8 @@ { "Lite-On LC82C115 PNIC-II", { 0xc11511AD, 0xffffffff, 0, 0, 0, 0 }, TULIP_IOTYPE, 256, PNIC2 }, { "ADMtek AN981 Comet", { 0x09811317, 0xffffffff, 0, 0, 0, 0 }, + TULIP_IOTYPE, 256, COMET }, + { "ADMTek AN983 Comet", { 0x12161113, 0xffffffff, 0, 0, 0, 0 }, TULIP_IOTYPE, 256, COMET }, { "ADMtek Centaur-P", { 0x09851317, 0xffffffff, 0, 0, 0, 0 }, TULIP_IOTYPE, 256, COMET }, Index: netboot/via-rhine.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/via-rhine.c,v retrieving revision 1.3 diff -u -r1.3 via-rhine.c --- netboot/via-rhine.c 2 Jan 2002 21:56:40 -0000 1.3 +++ netboot/via-rhine.c 1 Sep 2002 03:13:45 -0000 @@ -1,3 +1,6 @@ +#ifdef ALLMULTI +#error multicast support is not yet implemented +#endif /* rhine.c:Fast Ethernet driver for Linux. */ /* Adapted 09-jan-2000 by Paolo Marini (address@hidden) @@ -1170,6 +1173,9 @@ /*printf("td4=[%X]",inl(dwCurrentTDSE3)); */ outb (CR1bak, byCR1); + /* Wait until transmit is finished */ + while (tp->tx_ring[entry].tx_status.bits.own_bit != 0) + ; tp->cur_tx++; /*outw(IMRShadow,byIMR0); */ Index: netboot/w89c840.c =================================================================== RCS file: /cvsroot/grub/grub/netboot/w89c840.c,v retrieving revision 1.1 diff -u -r1.1 w89c840.c --- netboot/w89c840.c 2 Jan 2002 21:56:40 -0000 1.1 +++ netboot/w89c840.c 1 Sep 2002 03:13:45 -0000 @@ -1,3 +1,6 @@ +#ifdef ALLMULTI +#error multicast support is not yet implemented +#endif /* * Etherboot - BOOTP/TFTP Bootstrap Program * Index: stage2/builtins.c =================================================================== RCS file: /cvsroot/grub/grub/stage2/builtins.c,v retrieving revision 1.137 diff -u -r1.137 builtins.c --- stage2/builtins.c 5 Jul 2002 22:15:57 -0000 1.137 +++ stage2/builtins.c 1 Sep 2002 03:13:45 -0000 @@ -1597,7 +1597,7 @@ { char *svr = 0, *ip = 0, *gw = 0, *sm = 0; - if (! eth_probe ()) + if (eth_probe (-1) < 0) { grub_printf ("No ethernet card found.\n"); errnum = ERR_DEV_VALUES; --- /dev/null 1969-12-31 19:00:00.000000000 -0500 +++ netboot/stdint.h 2002-08-31 22:58:13.000000000 -0400 @@ -0,0 +1,14 @@ +#ifndef STDINT_H +#define STDINT_H + +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned long uint32_t; +typedef unsigned long long uint64_t; + +typedef signed char int8_t; +typedef signed short int16_t; +typedef signed long int32_t; +typedef signed long long int64_t; + +#endif /* STDINT_H */