[vortex] Mini PCI card question

Donald Becker becker@scyld.com
Wed, 7 Mar 2001 10:11:22 -0500 (EST)


On Thu, 8 Mar 2001, Andrew Morton wrote:

> I've only used vortex-diag to write an EEPROM once, and
> I found it quite tricky to use.  But I guess you
> can't make things worse :)

The EEPROM writing functionality of the diag programs is _supposed_ to be
tricky to use.  It permanently changes the hardware state in a way that
cannot be fixed by powering off the machine.

You don't hose your EEPROM by accidentally trying to send too large of a
packet, or unplugging the network cable at the wrong time.  This guy
munged his EEPROM while trying to write a Solaris device driver.
Adding two or three lines of code to restore valid contents shouldn't be
a stretch. 

> I suggest you run `vortex-diag -p 0xNNNN -aaee' and send
> the output here.  We'll see if we can think up a command
> which will save this NIC.

Look around line 728, where set_hwaddr is used.
This section of code overwrites the OEM (non-3Com) station address.  

You can use similar code to correct on the specific EEPROM word that you
erased.
You should guard the modified code with the already existing '-E',
emergency_rewrite, option. 
Think very carefully before you do this.

-	if (set_hwaddr) {
+	if (emergency_rewrite) {
		unsigned short sum = 0;
		memcpy(new_ee_contents, eeprom_contents, eesize << 1);
-		for (i = 0; i < 3; i++)
-			new_ee_contents[ee_tbl_offset + 10 + i] =
-				(new_hwaddr[i*2]<<8) + new_hwaddr[i*2+1];
+		/* Hack to fix erased word. */
+		new_ee_contents[1] = 0x6056;

Donald Becker				becker@scyld.com
Scyld Computing Corporation		http://www.scyld.com
410 Severn Ave. Suite 210		Second Generation Beowulf Clusters
Annapolis MD 21403			410-990-9993