Subject: Re: Panic in latest -current with fxp0
To: Patrick Hartling <patrick@137.org>
From: Bill Sommerfeld <sommerfeld@orchard.arlington.ma.us>
List: current-users
Date: 11/18/1999 21:23:42
> After about a year away from NetBSD, I am returning to -current to do
> software porting.  Today, I installed the 19991113 i386 snapshot, but the
> GENERIC kernel does not boot because of a problem detecting the EEPROM size
> for my onboard Intel EtherExpress Pro 10/100 NIC.  The panic is occuring in
> fxp_get_info().  I have searched the recent mailing list postings for
> "intel", "fxp", "eeprom", etc. and for heads-up messages with no luck in
> figuring out what is wrong.  The output for the NIC just before the panic
> is:
> 
>     fxp0 at pci0 dev 6 function 0: Intel i82557 Ethernet, rev 1
>     fxp0 interrupting at irq 11
> 
> For now, I am using the GENERIC kernel from the 19990704 snapshot.  I've
> successfully updated to sources from this morning, but the kernel still
> will not boot.  Is there something I need to add to my custom kernel config
> to get things working properly?

Ok, this is running afoul of a recent change to attempt to get cardbus
fxp's working (which have a different sized EEPROM).

I tested a change from Johan Danielsson on what's really an 82559 on
my laptop, but clearly that's not the same as the real thing..

Johan -- you did the orignal change in PR8631.. could you track this
down and figure out something which works for both Patrick and for
your cardbus fxp's?

Patrick: in the meantime, could you try applying the enclosed patch to
i82557.c and rebuilding a -current kernel?

(this is edited down from the actual diff between 1.9 and 1.10 of
i82557 to just back out the part which attempts to auto-size the EEPROM).

					- Bill

Index: i82557.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/i82557.c,v
retrieving revision 1.10
retrieving revision 1.9
diff -u -r1.10 -r1.9
--- i82557.c	1999/10/30 16:07:58	1.10
+++ i82557.c	1999/10/28 19:21:51	1.9
@@ -484,34 +481,6 @@
 	DELAY(10);
 
 	/*
-	 * Figure out EEPROM size.
-	 *
-	 * Cards can have either 64-word or 256-word EEPROMs, with
-	 * addresses fed in using a bit-at-a-time protocol, MSB first.
-	 *
-	 * XXX this is probably not the best way to do this; the linux
-	 * driver does a checksum of the eeprom, but there is
-	 * (AFAIK) no on-line documentation on what this checksum
-	 * should look like (you could just steal the code from
-	 * linux, but that's cheating); for now we just use the fact
-	 * that the upper two bits of word 10 should be 01
-	 */
-	for(sc->sc_eeprom_size = 6; 
-	    sc->sc_eeprom_size <= 8; 
-	    sc->sc_eeprom_size += 2) {
-		fxp_read_eeprom(sc, &data, 10, 1);
-		if((data & 0xc000) == 0x4000)
-			break;
-	}
-	if(sc->sc_eeprom_size > 8)
-		panic("%s: failed to get EEPROM size", sc->sc_dev.dv_xname);
-#ifdef DEBUG
-	printf("%s: assuming %d word EEPROM\n", 
-	       sc->sc_dev.dv_xname, 
-	       1 << sc->sc_eeprom_size);
-#endif
-
-	/*
 	 * Get info about the primary PHY
 	 */
 	fxp_read_eeprom(sc, &data, 6, 1);
@@ -564,7 +533,7 @@
 		/*
 		 * Shift in address.
 		 */
-		for (x = sc->sc_eeprom_size; x > 0; x--) {
+		for (x = 6; x > 0; x--) {
 			if ((i + offset) & (1 << (x - 1))) {
 				reg = FXP_EEPROM_EECS | FXP_EEPROM_EEDI;
 			} else {