bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Support for 3c556B network card


From: Patrick J. LoPresti
Subject: [PATCH] Support for 3c556B network card
Date: 31 Jul 2002 12:23:59 -0400

I was trying to use pxegrub to perform a diskless boot of an IBM
Thinkpad T20 laptop, but I discovered that the built-in Ethernet
hardware (3Com 3c556B Mini-PCI) was not supported by the GRUB.  I
compared the Linux 3c59x driver with the GRUB 3c90x driver, and came
up with the following simple patch to support the 3c556B.  I can vouch
that it works for me on my T20.

I tried to write the patch to be consistent with the exiting coding
style, and to make it easy to extend to support other cards.  (Judging
by the Linux driver, this will eventually be useful.)

Is this the right place to send this patch?  What do I need to do to
see it applied?  It is trivial enough that it obviously does not break
any existing drivers...

Thanks!

 - Pat


Index: netboot/3c90x.c
===================================================================
RCS file: /cvsroot/grub/grub/netboot/3c90x.c,v
retrieving revision 1.4
diff -u -1 -5 -r1.4 3c90x.c
--- netboot/3c90x.c     2 Jan 2002 21:56:40 -0000       1.4
+++ netboot/3c90x.c     31 Jul 2002 15:32:42 -0000
@@ -672,65 +672,74 @@
 
 
 
 /*** a3c90x_probe: exported routine to probe for the 3c905 card and perform
  *** initialization.  If this routine is called, the pci functions did find the
  *** card.  We just have to init it here.
  ***/
 struct nic*
 a3c90x_probe(struct nic *nic, unsigned short *probeaddrs, struct pci_device 
*pci)
     {
     int i, c;
     unsigned short eeprom[0x21];
     unsigned int cfg;
     unsigned int mopt;
     unsigned short linktype;
+    int eeprom_base = 0;
 
     if (probeaddrs == 0 || probeaddrs[0] == 0)
           return 0;
 
     adjust_pci_device(pci);
 
+    switch (pci->dev_id)
+        {
+        case 0x6056: /** 3c556 mini-PCI **/
+                eeprom_base = 0x30;
+                break;
+        }
+
     INF_3C90X.IOAddr = probeaddrs[0] & ~3;
     INF_3C90X.CurrentWindow = 255;
     switch (a3c90x_internal_ReadEeprom(INF_3C90X.IOAddr, 0x03))
        {
        case 0x9000: /** 10 Base TPO             **/
        case 0x9001: /** 10/100 T4               **/
        case 0x9050: /** 10/100 TPO              **/
        case 0x9051: /** 10 Base Combo           **/
                INF_3C90X.isBrev = 0;
                break;
 
        case 0x9004: /** 10 Base TPO             **/
        case 0x9005: /** 10 Base Combo           **/
        case 0x9006: /** 10 Base TPO and Base2   **/
        case 0x900A: /** 10 Base FL              **/
        case 0x9055: /** 10/100 TPO              **/
        case 0x9056: /** 10/100 T4               **/
        case 0x905A: /** 10 Base FX              **/
        default:
                INF_3C90X.isBrev = 1;
                break;
        }
 
     /** Load the EEPROM contents **/
     if (INF_3C90X.isBrev)
        {
        for(i=0;i<=0x20;i++)
            {
-           eeprom[i] = a3c90x_internal_ReadEeprom(INF_3C90X.IOAddr, i);
+           eeprom[i] = a3c90x_internal_ReadEeprom(INF_3C90X.IOAddr,
+                                                   eeprom_base + i);
            }
 
 #ifdef CFG_3C90X_BOOTROM_FIX
        /** Set xcvrSelect in InternalConfig in eeprom. **/
        /* only necessary for 3c905b revision cards with boot PROM bug!!! */
        a3c90x_internal_WriteEeprom(INF_3C90X.IOAddr, 0x13, 0x0160);
 #endif
 
 #ifdef CFG_3C90X_XCVR
        if (CFG_3C90X_XCVR == 255)
            {
            /** Clear the LanWorks register **/
            a3c90x_internal_WriteEeprom(INF_3C90X.IOAddr, 0x16, 0);
            }
        else
Index: netboot/config.c
===================================================================
RCS file: /cvsroot/grub/grub/netboot/config.c,v
retrieving revision 1.12
diff -u -1 -5 -r1.12 config.c
--- netboot/config.c    20 Apr 2002 00:43:10 -0000      1.12
+++ netboot/config.c    31 Jul 2002 15:32:42 -0000
@@ -72,30 +72,32 @@
     "3Com900B-FL", 0, 0, 0, 0},
   { PCI_VENDOR_ID_3COM,                PCI_DEVICE_ID_3COM_3C905B_TX,
     "3Com905B-TX", 0, 0, 0, 0},
   { PCI_VENDOR_ID_3COM,                0x9056,
     "3Com905B-T4", 0, 0, 0, 0},
   { PCI_VENDOR_ID_3COM,                0x905A,
     "3Com905B-FL", 0, 0, 0, 0},
   { PCI_VENDOR_ID_3COM,                PCI_DEVICE_ID_3COM_3C905C_TXM,
     "3Com905C-TXM", 0, 0, 0, 0},
   { PCI_VENDOR_ID_3COM,                0x9800,
     "3Com980-Cyclone", 0, 0, 0, 0},
   { PCI_VENDOR_ID_3COM,                0x9805,
     "3Com9805", 0, 0, 0, 0},
   { PCI_VENDOR_ID_3COM,                0x7646,
     "3CSOHO100-TX", 0, 0, 0, 0},
+  { PCI_VENDOR_ID_3COM,                0x6056,
+    "3Com556B", 0, 0, 0, 0},
 #endif
 #ifdef INCLUDE_3C595
   { PCI_VENDOR_ID_3COM,                PCI_DEVICE_ID_3COM_3C590,
     "3Com590", 0, 0, 0, 0},
   { PCI_VENDOR_ID_3COM,                PCI_DEVICE_ID_3COM_3C595,
     "3Com595", 0, 0, 0, 0},
   { PCI_VENDOR_ID_3COM,                PCI_DEVICE_ID_3COM_3C595_1,
     "3Com595", 0, 0, 0, 0},
   { PCI_VENDOR_ID_3COM,                PCI_DEVICE_ID_3COM_3C595_2,
     "3Com595", 0, 0, 0, 0},
   { PCI_VENDOR_ID_3COM,                PCI_DEVICE_ID_3COM_3C900TPO,
     "3Com900-TPO", 0, 0, 0, 0},
   { PCI_VENDOR_ID_3COM,                PCI_DEVICE_ID_3COM_3C900COMBO,
     "3Com900-Combo", 0, 0, 0, 0},
   { PCI_VENDOR_ID_3COM,                0x9004,
@@ -248,30 +250,31 @@
   { 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 },
+  { PCI_VENDOR_ID_3COM,     0x6056,                        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 },



reply via email to

[Prev in Thread] Current Thread [Next in Thread]