tulip driver patch for 4 port adapter card
Michael Tross
MTross@compu-shack.com
Tue Aug 3 05:42:01 1999
This is a MIME message. If you are reading this text, you may want to
consider changing to a mail reader or gateway that understands how to
properly handle MIME multipart messages.
--=_1A4C865A.C2A3CE7B
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Attached is a patch (against 0.91) for our 4 port 21143 adapter card. I =
found that the tulip driver doesn't parse the EEPROM in the expected way, =
or - in other words - has a different sight of the Digital SROM spec.
Let me explain the SROM structure of our multiport adapter card. As we =
believe we are strictly following the Digital SROM Spec with this format.
Byte offset=20
in SROM Meaning
0 - 17 ID Block
18 SROM Format Version
19 Controller Count
20 - 25 MAC address
26 Controller #0 Device Number
27 - 28 Controller #0 Info Leaf Offset
29 Controller #1 Device Number
30 - 31 Controller #1 Info Leaf Offset
....
Controller Count =3D=20
"Number of controllers sharing this ROM."
Controller Device Number =3D=20
"On a multi-controller board, this field contains the DEVICE_NUMBER value. =
This is the value by which the configuration space of the n'th controller =
can be accessed on the board's secondary PCI bus. This value depends on =
the hardware routing of the board. The DEVICE_NUMBER is the 'chip select' =
line routed from the controller to the PCI-to-PCI bridge chip on board.
On a single controller board this field has no meaning and should be =
ignored by the driver."
The point is that all controllers are sharing the same SROM and the MAC =
base address, but the driver needs to adjust the MAC address for subsequent=
ports.
Please apply these patch to the tulip driver. I believe that the patch =
will not break any existing currently working configurations.
Michael
--=_1A4C865A.C2A3CE7B
Content-Type: text/plain
Content-Disposition: attachment; filename="tulip-0.91.diff"
--- tulip.0.91.c Tue Jun 15 14:21:54 1999
+++ tulip.c Tue Jun 15 16:18:18 1999
@@ -18,7 +18,9 @@
*/
#define SMP_CHECK
-static const char version[] = "tulip.c:v0.91 4/14/99 becker@cesdis.gsfc.nasa.gov\n";
+static const char version[] = "tulip.c:v0.91 4/14/99 becker@cesdis.gsfc.nasa.gov\n"
+" patched for Compu-Shack FASTline-PCI UTP Quattro 6/15/99 mtross@compu-shack.de\n"
+;
/* A few user-configurable values. */
@@ -762,7 +764,7 @@
}
for (i = 0; i < 6; i++)
- printk("%c%2.2X", i ? ':' : ' ', last_phys_addr[i] = dev->dev_addr[i]);
+ last_phys_addr[i] = dev->dev_addr[i];
printk(", IRQ %d.\n", irq);
last_irq = irq;
@@ -884,6 +886,11 @@
}
}
+ printk(KERN_INFO "%s: MAC Address is ", dev->name);
+ for (i = 0; i < 6; i++)
+ printk("%c%2.2X", i ? ':' : ' ', dev->dev_addr[i]);
+ printk("\n");
+
/* The Tulip-specific entries in the device structure. */
dev->open = &tulip_open;
dev->hard_start_xmit = &tulip_start_xmit;
@@ -1096,12 +1103,41 @@
dev->name, media_code & 15, medianame[media_code & 15]);
}
} else {
- unsigned char *p = (void *)ee_data + ee_data[27];
+ unsigned char *p = NULL;
unsigned char csr12dir = 0;
int count;
+ unsigned int n, device_number, device_offset = 0;
struct mediatable *mtable;
- u16 media = get_u16(p);
+ u16 media;
+
+ /* find info leaf corresponding to device index */
+ device_number = tp->pci_devfn >> 3;
+ count = ee_data[ 19 ];
+ for( n = 0; n < count; n ++ ) {
+ if( ee_data[ 26 + n*3 ] == device_number ) {
+ device_offset = ee_data[ 27 + n*3 ];
+ break;
+ }
+ }
+ if( device_offset == 0 ) {
+ printk(KERN_INFO "%s: invalid srom structure.\n", dev->name );
+ return;
+ }
+ printk(KERN_INFO "%s: device %d / controller %d has info leaf at offset %d.\n",
+ dev->name, device_number, n, device_offset );
+ p = (char *) ee_data + device_offset;
+
+ /* increment base address */
+ dev->dev_addr[ 5 ] += n;
+
+ if( tulip_debug > 1 ) {
+ printk(KERN_INFO " Leaf data: " );
+ for( n = 0; n < 16; n ++ )
+ printk( "%02x ", p[n] );
+ printk("\n");
+ }
+ media = get_u16(p);
p += 2;
if (tulip_tbl[tp->chip_id].flags & CSR12_IN_SROM)
csr12dir = *p++;
--=_1A4C865A.C2A3CE7B--