Hi,

appended is a GRUB patch that resolves two drawbacks in the current
GNU GRUB cvs release:

- PCI ethernet cards will be testet first. If a known PCI device was
  found, the belonging probe function is called _immediatly_!

- The number of the PCI bus the device resides on is passed to
  the probe function too. Some cards have to do PCI config register
  manipulations and therefore has to know the PCI bus number.
  This affects nearly all PCI ethernet cards.

I hope that you incorporate this patch. 
I've already signed an GNU assignment.

Frank
-- 
Frank Mehnert
## Dept. of Computer Science, Dresden University of Technology, Germany ##
## E-Mail: [EMAIL PROTECTED]    http://os.inf.tu-dresden.de/~fm3 ##
cvs server: Diffing .
Index: config.c
===================================================================
RCS file: /cvs/grub/netboot/config.c,v
retrieving revision 1.10
diff -u -r1.10 config.c
--- config.c	2001/02/02 12:21:18	1.10
+++ config.c	2001/07/27 09:51:20
@@ -35,112 +35,114 @@
 #if	defined(ETHERBOOT32)		/* only for 32 bit machines */
 #define	INCLUDE_PCI
 #include	"pci.h"
+#include	"cards.h"
+
 static unsigned short	pci_ioaddrs[16];
 
 static struct pci_device	pci_nic_list[] = {
 #ifdef	INCLUDE_NS8390
 	{ PCI_VENDOR_ID_REALTEK,	PCI_DEVICE_ID_REALTEK_8029,
-		"Realtek 8029", 0, 0, 0},
+		"Realtek 8029", 0, 0, 0, 0, nepci_probe},
 	{ PCI_VENDOR_ID_WINBOND2,	PCI_DEVICE_ID_WINBOND2_89C940,
-		"Winbond NE2000-PCI", 0, 0, 0},
+		"Winbond NE2000-PCI", 0, 0, 0, 0, nepci_probe},
 	{ PCI_VENDOR_ID_COMPEX,		PCI_DEVICE_ID_COMPEX_RL2000,
-		"Compex ReadyLink 2000", 0, 0, 0},
+		"Compex ReadyLink 2000", 0, 0, 0, 0, nepci_probe},
 	{ PCI_VENDOR_ID_KTI,		PCI_DEVICE_ID_KTI_ET32P2,
-		"KTI ET32P2", 0, 0, 0},
+		"KTI ET32P2", 0, 0, 0, 0, nepci_probe},
 	{ PCI_VENDOR_ID_NETVIN,		PCI_DEVICE_ID_NETVIN_NV5000SC,
-		"NetVin NV5000SC", 0, 0, 0},
+		"NetVin NV5000SC", 0, 0, 0, 0, nepci_probe},
 #endif
 #ifdef	INCLUDE_3C90X
 	{ PCI_VENDOR_ID_3COM,		PCI_DEVICE_ID_3COM_3C900TPO,
-		"3Com900-TPO", 0, 0, 0},
+		"3Com900-TPO", 0, 0, 0, 0, a3c90x_probe},
 	{ PCI_VENDOR_ID_3COM,		PCI_DEVICE_ID_3COM_3C900COMBO,
-		"3Com900-Combo", 0, 0, 0},
+		"3Com900-Combo", 0, 0, 0, 0, a3c90x_probe},
 	{ PCI_VENDOR_ID_3COM,		PCI_DEVICE_ID_3COM_3C905TX,
-		"3Com905-TX", 0, 0, 0},
+		"3Com905-TX", 0, 0, 0, 0, a3c90x_probe},
 	{ PCI_VENDOR_ID_3COM,		PCI_DEVICE_ID_3COM_3C905T4,
-		"3Com905-T4", 0, 0, 0},
+		"3Com905-T4", 0, 0, 0, 0, a3c90x_probe},
 
 	{ PCI_VENDOR_ID_3COM,		0x9004,
-		"3Com900B-TPO", 0, 0, 0},
+		"3Com900B-TPO", 0, 0, 0, 0, a3c90x_probe},
 	{ PCI_VENDOR_ID_3COM,		0x9005,
-		"3Com900B-Combo", 0, 0, 0},
+		"3Com900B-Combo", 0, 0, 0, 0, a3c90x_probe},
 	{ PCI_VENDOR_ID_3COM,		0x9006,
-		"3Com900B-2/T", 0, 0, 0},
+		"3Com900B-2/T", 0, 0, 0, 0, a3c90x_probe},
 	{ PCI_VENDOR_ID_3COM,		0x900A,
-		"3Com900B-FL", 0, 0, 0},
+		"3Com900B-FL", 0, 0, 0, 0, a3c90x_probe},
 	{ PCI_VENDOR_ID_3COM,		PCI_DEVICE_ID_3COM_3C905B_TX,
-		"3Com905B-TX", 0, 0, 0},
+		"3Com905B-TX", 0, 0, 0, 0, a3c90x_probe},
 	{ PCI_VENDOR_ID_3COM,		0x9056,
-		"3Com905B-T4", 0, 0, 0},
+		"3Com905B-T4", 0, 0, 0, 0, a3c90x_probe},
 	{ PCI_VENDOR_ID_3COM,		0x905A,
-		"3Com905B-FL", 0, 0, 0},
+		"3Com905B-FL", 0, 0, 0, 0, a3c90x_probe},
 	{ PCI_VENDOR_ID_3COM,		PCI_DEVICE_ID_3COM_3C905C_TXM,
-		"3Com905C-TXM", 0, 0, 0},
+		"3Com905C-TXM", 0, 0, 0, 0, a3c90x_probe},
 
 #endif
 #ifdef	INCLUDE_3C595
 	{ PCI_VENDOR_ID_3COM,		PCI_DEVICE_ID_3COM_3C590,
-		"3Com590", 0, 0, 0},
+		"3Com590", 0, 0, 0, 0, t595_probe},
 	{ PCI_VENDOR_ID_3COM,		PCI_DEVICE_ID_3COM_3C595,
-		"3Com595", 0, 0, 0},
+		"3Com595", 0, 0, 0, 0, t595_probe},
 	{ PCI_VENDOR_ID_3COM,		PCI_DEVICE_ID_3COM_3C595_1,
-		"3Com595", 0, 0, 0},
+		"3Com595", 0, 0, 0, 0, t595_probe},
 	{ PCI_VENDOR_ID_3COM,		PCI_DEVICE_ID_3COM_3C595_2,
-		"3Com595", 0, 0, 0},
+		"3Com595", 0, 0, 0, 0, t595_probe},
 #endif
 #ifdef	INCLUDE_EEPRO100
 	{ PCI_VENDOR_ID_INTEL,		PCI_DEVICE_ID_INTEL_82557,
-		"Intel EtherExpressPro100", 0, 0, 0},
+		"Intel EtherExpressPro100", 0, 0, 0, 0, eepro100_probe},
 #endif
 #ifdef	INCLUDE_EPIC100
 	{ PCI_VENDOR_ID_SMC,		PCI_DEVICE_ID_SMC_EPIC100,
-		"SMC EtherPowerII", 0, 0, 0},
+		"SMC EtherPowerII", 0, 0, 0, 0, epic100_probe},
 #endif
 #ifdef	INCLUDE_LANCE
 	{ PCI_VENDOR_ID_AMD,		PCI_DEVICE_ID_AMD_LANCE,
-		"AMD Lance/PCI", 0, 0, 0},
+		"AMD Lance/PCI", 0, 0, 0, 0, lancepci_probe},
 #endif
 #ifdef	INCLUDE_RTL8139
 	{ PCI_VENDOR_ID_REALTEK,	PCI_DEVICE_ID_REALTEK_8139,
-		"Realtek 8139", 0, 0, 0},
+		"Realtek 8139", 0, 0, 0, 0, rtl8139_probe},
         { PCI_VENDOR_ID_SMC_1211,       PCI_DEVICE_ID_SMC_1211,
-                "SMC EZ10/100", 0, 0, 0},
+                "SMC EZ10/100", 0, 0, 0, 0, rtl8139_probe},
 #endif
 #ifdef	INCLUDE_OTULIP
 	{ PCI_VENDOR_ID_DEC,		PCI_DEVICE_ID_DEC_TULIP,
-		"Digital Tulip", 0, 0, 0},
+		"Digital Tulip", 0, 0, 0, 0, otulip_probe},
 	{ PCI_VENDOR_ID_DEC,		PCI_DEVICE_ID_DEC_TULIP_FAST,
-		"Digital Tulip Fast", 0, 0, 0},
+		"Digital Tulip Fast", 0, 0, 0, 0, otulip_probe},
 	{ PCI_VENDOR_ID_DEC,		PCI_DEVICE_ID_DEC_TULIP_PLUS,
-		"Digital Tulip+", 0, 0, 0},
+		"Digital Tulip+", 0, 0, 0, 0, otulip_probe},
 	{ PCI_VENDOR_ID_DEC,		PCI_DEVICE_ID_DEC_21142,
-		"Digital Tulip 21142", 0, 0, 0},
+		"Digital Tulip 21142", 0, 0, 0, 0, otulip_probe},
 #endif
 #ifdef	INCLUDE_TULIP
 	{ PCI_VENDOR_ID_DEC,		PCI_DEVICE_ID_DEC_TULIP,
-		"Digital Tulip", 0, 0, 0},
+		"Digital Tulip", 0, 0, 0, 0, tulip_probe},
 	{ PCI_VENDOR_ID_DEC,		PCI_DEVICE_ID_DEC_TULIP_FAST,
-		"Digital Tulip Fast", 0, 0, 0},
+		"Digital Tulip Fast", 0, 0, 0, 0, tulip_probe},
 	{ PCI_VENDOR_ID_DEC,		PCI_DEVICE_ID_DEC_TULIP_PLUS,
-		"Digital Tulip+", 0, 0, 0},
+		"Digital Tulip+", 0, 0, 0, 0, tulip_probe},
 	{ PCI_VENDOR_ID_DEC,		PCI_DEVICE_ID_DEC_21142,
-		"Digital Tulip 21142", 0, 0, 0},
+		"Digital Tulip 21142", 0, 0, 0, 0, tulip_probe},
 	{ PCI_VENDOR_ID_MACRONIX,	PCI_DEVICE_ID_MX987x5,
-		"Macronix MX987x5", 0, 0, 0},
+		"Macronix MX987x5", 0, 0, 0, 0, tulip_probe},
 	{ PCI_VENDOR_ID_LINKSYS,	PCI_DEVICE_ID_LC82C115,
-		"LinkSys LNE100TX", 0, 0, 0},
+		"LinkSys LNE100TX", 0, 0, 0, 0, tulip_probe},
 	{ PCI_VENDOR_ID_LINKSYS,	PCI_DEVICE_ID_DEC_TULIP,
-		"Netgear FA310TX", 0, 0, 0},
+		"Netgear FA310TX", 0, 0, 0, 0, tulip_probe},
 	{ PCI_VENDOR_ID_DAVICOM, PCI_DEVICE_ID_DM9102,
-		"Davicom 9102", 0, 0, 0},
+		"Davicom 9102", 0, 0, 0, 0, tulip_probe},
 	{ PCI_VENDOR_ID_ADMTEK, PCI_DEVICE_ID_ADMTEK_0985,
-		"ADMtek Centaur-P", 0, 0, 0},
+		"ADMtek Centaur-P", 0, 0, 0, 0, tulip_probe},
 #endif
 #ifdef	INCLUDE_VIA_RHINE
 	{ PCI_VENDOR_ID_VIATEC,	PCI_DEVICE_ID_VIA_RHINE_I,
-		"VIA 3043", 0, 0, 0},
+		"VIA 3043", 0, 0, 0, 0, rhine_probe},
 	{ PCI_VENDOR_ID_VIATEC,	PCI_DEVICE_ID_VIA_86C100A,
-		"VIA 86C100A", 0, 0, 0},
+		"VIA 86C100A", 0, 0, 0, 0, rhine_probe},
 #endif
 /* other PCI NICs go here */
 	{0, 0, NULL, 0, 0, 0}
@@ -150,82 +152,6 @@
 
 #include "cards.h"
 
-#if defined(GRUB) && defined(INCLUDE_PCI)
-struct pci_dispatch_table
-{
-  unsigned short vendor;
-  unsigned short dev_id;
-  struct nic *(*eth_probe) (struct nic *, unsigned short *,
-			    struct pci_device *);
-};
-
-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 },
-# 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 },
-# 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 },
-# endif /* INCLUDE_3C595 */
-# ifdef	INCLUDE_EEPRO100
-  { PCI_VENDOR_ID_INTEL,    PCI_DEVICE_ID_INTEL_82557,     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 },
-# endif /* INCLUDE_LANCE */
-# ifdef	INCLUDE_RTL8139
-  { PCI_VENDOR_ID_REALTEK,  PCI_DEVICE_ID_REALTEK_8139,    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_ADMTEK,   PCI_DEVICE_ID_ADMTEK_0985,     tulip_probe },
-# endif /* INCLUDE_TULIP */
-# ifdef	INCLUDE_VIA_RHINE
-  { 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 */
-  { 0,                      0,                             0 }
-};
-#endif /* GRUB && INCLUDE_PCI */
-
 struct dispatch_table
 {
 	const char	*nic_name;
@@ -245,9 +171,6 @@
  */
 static struct dispatch_table	NIC[] =
 {
-#ifdef	INCLUDE_RTL8139
-	{ "RTL8139", rtl8139_probe, pci_ioaddrs },
-#endif
 #ifdef	INCLUDE_WD
 	{ "WD", wd_probe, 0 },
 #endif
@@ -263,24 +186,6 @@
 #ifdef	INCLUDE_3C529
 	{ "3C5x9", t529_probe, 0 },
 #endif
-#ifdef	INCLUDE_3C595
-	{ "3C595", t595_probe, pci_ioaddrs },
-#endif
-#ifdef	INCLUDE_3C90X
-	{ "3C90X", a3c90x_probe, pci_ioaddrs },
-#endif
-#ifdef	INCLUDE_EEPRO100
-	{ "EEPRO100", eepro100_probe, pci_ioaddrs },
-#endif
-#ifdef	INCLUDE_EPIC100
-	{ "EPIC100", epic100_probe, pci_ioaddrs },
-#endif
-#ifdef	INCLUDE_OTULIP
-	{ "OTulip", otulip_probe, pci_ioaddrs },
-#endif
-#ifdef	INCLUDE_TULIP
-	{ "Tulip", tulip_probe, pci_ioaddrs },
-#endif
 #ifdef	INCLUDE_CS89X0
 	{ "CS89x0", cs89x0_probe, 0 },
 #endif
@@ -311,15 +216,6 @@
 #ifdef	INCLUDE_DEPCA
 	{ "DEPCA", depca_probe, 0 },
 #endif
-#ifdef	INCLUDE_NS8390
-	{ "NE2000/PCI", nepci_probe, pci_ioaddrs },
-#endif
-#ifdef	INCLUDE_LANCE
-	{ "LANCE/PCI", lancepci_probe, pci_ioaddrs },
-#endif
-#ifdef	INCLUDE_VIA_RHINE
-	{ "VIA 86C100", rhine_probe, pci_ioaddrs },
-#endif
 	/* this entry must always be last to mark the end of list */
 	{ 0, 0, 0 }
 };
@@ -420,29 +316,15 @@
 	for (p = pci_nic_list; p->vendor != 0; ++p) {
 		if (p->ioaddr != 0) {
 			pci_ioaddrs[0] = p->ioaddr;
-			break;
+			if (p->eth_probe(&nic, pci_ioaddrs, p)) {
+				probed = 1;
+				return 1;
+			}
+			
 		}
 	}
 #endif
 	printf("Probing...");
-	
-#if defined(GRUB) && defined(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)
-		{
-		  printf ("[%s]", p->name);
-		  if ((pt->eth_probe) (&nic, pci_ioaddrs, p))
-		    {
-		      probed = 1;
-		      return 1;
-		    }
-		}
-	  }
-#endif /* GRUB && INCLUDE_PCI */
 	
 	for (t = NIC; t->nic_name != 0; ++t)
 	{
Index: eepro100.c
===================================================================
RCS file: /cvs/grub/netboot/eepro100.c,v
retrieving revision 1.3
diff -u -r1.3 eepro100.c
--- eepro100.c	2000/04/22 01:17:09	1.3
+++ eepro100.c	2001/07/27 09:51:21
@@ -547,7 +547,7 @@
   int options;
   int promisc;
 
-  unsigned char pci_bus = 0;
+  unsigned char pci_bus = p->busnr;
   unsigned short pci_command;
   unsigned short new_command;
   unsigned char pci_latency;
Index: lance.c
===================================================================
RCS file: /cvs/grub/netboot/lance.c,v
retrieving revision 1.4
diff -u -r1.4 lance.c
--- lance.c	2000/04/22 01:17:09	1.4
+++ lance.c	2001/07/27 09:51:22
@@ -465,10 +465,10 @@
 				break;
 #endif
 #ifdef	INCLUDE_LANCE
-		pcibios_read_config_word(0, pci->devfn, PCI_COMMAND, &pci_cmd);
+		pcibios_read_config_word(pci->busnr, pci->devfn, PCI_COMMAND, &pci_cmd);
 		if (!(pci_cmd & PCI_COMMAND_MASTER)) {
 			pci_cmd |= PCI_COMMAND_MASTER;
-			pcibios_write_config_word(0, pci->devfn, PCI_COMMAND, pci_cmd);
+			pcibios_write_config_word(pci->busnr, pci->devfn, PCI_COMMAND, pci_cmd);
 		}
 		if (lance_probe1(nic, pci) >= 0)
 			break;
Index: otulip.c
===================================================================
RCS file: /cvs/grub/netboot/otulip.c,v
retrieving revision 1.1
diff -u -r1.1 otulip.c
--- otulip.c	2000/04/22 01:17:09	1.1
+++ otulip.c	2001/07/27 09:51:22
@@ -350,7 +350,7 @@
 	membase = (unsigned int *)pci->membase;
 
         /* wakeup chip */
-        pcibios_write_config_dword(0,pci->devfn,0x40,0x00000000);
+        pcibios_write_config_dword(pci->busnr,pci->devfn,0x40,0x00000000);
 
         /* Stop the chip's Tx and Rx processes. */
         /* outl(inl(ioaddr + CSR6) & ~0x2002, ioaddr + CSR6); */
Index: pci.c
===================================================================
RCS file: /cvs/grub/netboot/pci.c,v
retrieving revision 1.5
diff -u -r1.5 pci.c
--- pci.c	2000/05/31 02:15:13	1.5
+++ pci.c	2001/07/27 09:51:22
@@ -456,6 +456,7 @@
 						pcidev[i].membase = membase;
 						pcidev[i].ioaddr = ioaddr;
 						pcidev[i].devfn = devfn;
+						pcidev[i].busnr = bus;
 
 						return;
 					}
Index: pci.h
===================================================================
RCS file: /cvs/grub/netboot/pci.h,v
retrieving revision 1.7
diff -u -r1.7 pci.h
--- pci.h	2000/07/29 19:22:54	1.7
+++ pci.h	2001/07/27 09:51:22
@@ -143,12 +143,16 @@
 #define PCI_VENDOR_ID_DAVICOM		0x1282
 #define PCI_DEVICE_ID_DM9102		0x9102
 
+struct nic;
 struct pci_device {
 	unsigned short	vendor, dev_id;
 	const char	*name;
 	unsigned int	membase;
 	unsigned short	ioaddr;
 	unsigned short	devfn;
+	unsigned short  busnr;
+	struct nic *(*eth_probe) (struct nic *, unsigned short *,
+				  struct pci_device *);
 };
 
 extern void	eth_pci_init(struct pci_device *);
Index: tulip.c
===================================================================
RCS file: /cvs/grub/netboot/tulip.c,v
retrieving revision 1.4
diff -u -r1.4 tulip.c
--- tulip.c	2000/07/29 19:22:54	1.4
+++ tulip.c	2001/07/27 09:51:23
@@ -691,7 +691,7 @@
   ioaddr  = *io_addrs;
 
   /* wakeup chip */
-  pcibios_write_config_dword(0, pci->devfn, 0x40, 0x00000000);
+  pcibios_write_config_dword(pci->busnr, pci->devfn, 0x40, 0x00000000);
 
   /* Stop the chip's Tx and Rx processes. */
   outl(inl(ioaddr + CSR6) & ~0x00002002, ioaddr + CSR6);
Index: via-rhine.c
===================================================================
RCS file: /cvs/grub/netboot/via-rhine.c,v
retrieving revision 1.2
diff -u -r1.2 via-rhine.c
--- via-rhine.c	2000/04/22 01:17:09	1.2
+++ via-rhine.c	2001/07/27 09:51:24
@@ -877,21 +877,21 @@
     if (nic)
     {
 	/* Get and check the bus-master and latency values. */
-	pcibios_read_config_word (0, pci->devfn, PCI_COMMAND, &pci_command);
+	pcibios_read_config_word (pci->busnr, pci->devfn, PCI_COMMAND, &pci_command);
 	if (!(pci_command & PCI_COMMAND_MASTER))
 	{
 	    printf ("  PCI Master Bit has not been set! Setting...\n");
 	    pci_command |= PCI_COMMAND_MASTER;
-	    pcibios_write_config_word (0, pci->devfn, PCI_COMMAND,
+	    pcibios_write_config_word (pci->busnr, pci->devfn, PCI_COMMAND,
 				       pci_command);
 	}
-	pcibios_read_config_byte (0, pci->devfn, PCI_LATENCY_TIMER,
+	pcibios_read_config_byte (pci->busnr, pci->devfn, PCI_LATENCY_TIMER,
 				  &pci_latency);
 	if (pci_latency < 10)
 	{
 	    printf ("  PCI latency timer (CFLT) is unreasonably low "
 		    "at %d.  Setting to 64 clocks.\n", pci_latency);
-	    pcibios_write_config_byte (0, pci->devfn, PCI_LATENCY_TIMER, 64);
+	    pcibios_write_config_byte (pci->busnr, pci->devfn, PCI_LATENCY_TIMER, 64);
 	}
 	else if (rhine_debug > 1)
 	    printf ("  PCI latency timer (CFLT) is %#x.\n", pci_latency);

Reply via email to