Changeset c94c251 in rtems


Ignore:
Timestamp:
05/25/00 13:42:00 (23 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Children:
f3b1664f
Parents:
64bddf48
Message:

Update from Stephan Wilms <Stephan.Wilms@…> that adds autodetection.

What I implemented in this new driver version is, that the driver will
first probe for a DEC21140 card and use it if found. If not found it
will probe for a DEC21143 card and use that if found. This removes the
need for defining/undefining a macro (as was required with my previous
version). I tested the driver with my 21143 card using netdemo and it
apears to work just fine.

Here are some cases that I did not test, mainly because I do not have
the required testing hardware:

  • I did not enhance or test PPC support
  • I did not test DEC21140 support
  • I did not use other test software than netdemo
File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/libchip/network/dec21140.c

    r64bddf48 rc94c251  
    1313 * [22.05.2000,StWi/CWA] added support for the DEC/Intel 21143 chip
    1414 *
    15  * This support is (for now) only available for the __i386 target, because
    16  * that's the only testing platform I have. It should to my best knowledge
    17  * work in the same way for the "__PPC" target, but someone should test
    18  * this first before it's put into the code. Thanks go to Andrew Klossner
    19  * who provided the vital information about the Intel 21143 chip.
     15 * The 21143 support is (for now) only available for the __i386 target,
     16 * because that's the only testing platform I have. It should (to my best
     17 * knowledge) work in the same way for the "__PPC" target, but someone
     18 * should test this first before it's put into the code. Thanks go to
     19 * Andrew Klossner who provided the vital information about the
     20 * Intel 21143 chip.
     21 * (FWIW: I tested this driver using a Kingston KNE100TX with 21143PD chip)
    2022 *
    21  * (FWIW: my network card is a Kingston KNE100TX with 21143PD chip)
    22  *
    23  * The 21143 support is enabled by defining the macro
    24  * "ENABLE_21143_VARIANT" (see the "#if defined(__i386)" section right
    25  * below, just add or remove comments as needed)
     23 * The driver will automatically detect whether there is a 21140 or 21143
     24 * network card in the system and activate support accordingly. It will
     25 * look for the 21140 first. If the 21140 is not found the driver will
     26 * look for the 21143.
    2627 * ------------------------------------------------------------------------
    2728 */
     
    3738#if defined(__i386)
    3839  #define DEC21140_SUPPORTED
    39   #define ENABLE_21143_VARIANT
    4040#endif
    4141
     
    8888#define DEC_DEBUG
    8989
     90/* note: the 21143 isn't really a DEC, it's an Intel chip */
    9091#define PCI_INVALID_VENDORDEVICEID      0xffffffff
    9192#define PCI_VENDOR_ID_DEC 0x1011
    92 #if defined(ENABLE_21143_VARIANT)
    93   #define PCI_DEVICE_ID_DEC_TULIP_FAST 0x0019
    94 #else
    95   #define PCI_DEVICE_ID_DEC_TULIP_FAST 0x0009
    96 #endif
     93#define PCI_DEVICE_ID_DEC_21140 0x0009
     94#define PCI_DEVICE_ID_DEC_21143 0x0019
    9795
    9896#define IO_MASK  0x3
     
    386384
    387385#ifdef DEC_DEBUG
    388   printk("DC21140 %x:%x:%x:%x:%x:%x IRQ %d IO %x M %x .........\n",
     386  printk("DC2114x %x:%x:%x:%x:%x:%x IRQ %d IO %x M %x .........\n",
    389387         sc->arpcom.ac_enaddr[0], sc->arpcom.ac_enaddr[1],
    390388         sc->arpcom.ac_enaddr[2], sc->arpcom.ac_enaddr[3],
     
    779777        int mtu;
    780778        int i;
     779    int deviceId = PCI_DEVICE_ID_DEC_21140; /* network card device ID */
    781780       
    782781        /*
     
    793792       
    794793        /*
    795          * First, find a DEC board
     794         * Try to find the network card on the PCI bus. Probe for a DEC 21140
     795     * card first. If not found probe the bus for a DEC/Intel 21143 card.
    796796         */
    797         if ((diag = pcib_find_by_devid(PCI_VENDOR_ID_DEC,
    798                                        PCI_DEVICE_ID_DEC_TULIP_FAST,
    799                                        0,
    800                                        &signature)) != PCIB_ERR_SUCCESS)
    801           rtems_panic("DEC PCI board not found !! (%d)\n", diag);
    802         else {
    803           printk("DEC PCI Device found\n");
    804         }
     797    deviceId = PCI_DEVICE_ID_DEC_21140;
     798    diag = pcib_find_by_devid( PCI_VENDOR_ID_DEC, deviceId,
     799                               0, &signature);
     800    if ( diag == PCIB_ERR_SUCCESS)
     801      printk( "DEC 21140 PCI network card found\n" );
     802    else
     803    {
     804      deviceId = PCI_DEVICE_ID_DEC_21143;
     805      diag = pcib_find_by_devid( PCI_VENDOR_ID_DEC, deviceId,
     806                                 0, &signature);
     807      if ( diag == PCIB_ERR_SUCCESS)
     808        printk( "DEC/Intel 21143 PCI network card found\n" );
     809      else
     810        rtems_panic("DEC PCI network card not found !!\n");
     811    }
    805812#endif 
    806813#if defined(__PPC)
     
    822829              continue;
    823830            }
    824             if (ulDeviceID == ((PCI_DEVICE_ID_DEC_TULIP_FAST<<16) + PCI_VENDOR_ID_DEC))
     831            if (ulDeviceID == ((PCI_DEVICE_ID_DEC_21140<<16) + PCI_VENDOR_ID_DEC))
    825832              break;
    826833          }
    827           if (ulDeviceID == ((PCI_DEVICE_ID_DEC_TULIP_FAST<<16) + PCI_VENDOR_ID_DEC)){
     834          if (ulDeviceID == ((PCI_DEVICE_ID_DEC_21140<<16) + PCI_VENDOR_ID_DEC)){
    828835            printk("DEC Adapter found !!\n");
    829836            break;
     
    853860#if defined(__i386)
    854861
    855 #if defined(ENABLE_21143_VARIANT)
    856   /* the 21143 chip must be enabled before it can be accessed */
    857   pcib_conf_write32( signature, 0x40, 0 );
    858 #endif
     862    /* the 21143 chip must be enabled before it can be accessed */
     863    if ( deviceId == PCI_DEVICE_ID_DEC_21143 )
     864      pcib_conf_write32( signature, 0x40, 0 );
    859865
    860866        pcib_conf_read32(signature, 16, &value);
     
    950956        ether_ifattach (ifp);
    951957
    952         printk( "DEC21140 : driver has been attached\n" );
     958        printk( "DC2114x : driver has been attached\n" );
    953959        return 1;
    954960};
Note: See TracChangeset for help on using the changeset viewer.