Annotation of qemu/roms/ipxe/src/drivers/net/prism2_plx.c, revision 1.1.1.1

1.1       root        1: /**************************************************************************
                      2: Etherboot -  BOOTP/TFTP Bootstrap Program
                      3: Prism2 NIC driver for Etherboot
                      4: Wrapper for prism2_plx
                      5: 
                      6: Written by Michael Brown of Fen Systems Ltd
                      7: $Id$
                      8: ***************************************************************************/
                      9: 
                     10: /*
                     11:  * This program is free software; you can redistribute it and/or
                     12:  * modify it under the terms of the GNU General Public License as
                     13:  * published by the Free Software Foundation; either version 2, or (at
                     14:  * your option) any later version.
                     15:  */
                     16: 
                     17: FILE_LICENCE ( GPL2_OR_LATER );
                     18: 
                     19: #include <ipxe/pci.h>
                     20: #include <nic.h>
                     21: 
                     22: #define WLAN_HOSTIF WLAN_PLX
                     23: #include "prism2.c"
                     24: 
                     25: /*
                     26:  * Find PLX card.  Prints out information strings from PCMCIA CIS as visual
                     27:  * confirmation of presence of card.
                     28:  *
                     29:  * Arguments:
                     30:  *     hw              device structure to be filled in
                     31:  *      p               PCI device structure
                     32:  *
                     33:  * Returns:
                     34:  *      1               Success
                     35:  */
                     36: static int prism2_find_plx ( hfa384x_t *hw, struct pci_device *p )
                     37: {
                     38:   int found = 0;
                     39:   uint32_t plx_lcr  = 0; /* PLX9052 Local Configuration Register Base (I/O) */
                     40:   uint32_t attr_mem = 0; /* Prism2 Attribute Memory Base */
                     41:   uint32_t iobase   = 0; /* Prism2 I/O Base */
                     42:   unsigned char *cis_tpl  = NULL;
                     43:   unsigned char *cis_string;
                     44:   
                     45:   /* Obtain all memory and IO base addresses */
                     46:   pci_read_config_dword( p, PLX_LOCAL_CONFIG_REGISTER_BASE, &plx_lcr);
                     47:   plx_lcr &= PCI_BASE_ADDRESS_IO_MASK;
                     48:   pci_read_config_dword( p, PRISM2_PLX_ATTR_MEM_BASE, &attr_mem);
                     49:   pci_read_config_dword( p, PRISM2_PLX_IO_BASE, &iobase);
                     50:   iobase &= PCI_BASE_ADDRESS_IO_MASK;
                     51: 
                     52:   /* Fill out hw structure */
                     53:   hw->iobase = iobase;
                     54:   printf ( "PLX9052 has local config registers at %#x\n", plx_lcr );
                     55:   printf ( "Prism2 has attribute memory at %#x and I/O base at %#x\n", attr_mem, iobase );
                     56: 
                     57:   /* Search for CIS strings */
                     58:   printf ( "Searching for PCMCIA card...\n" );
                     59:   cis_tpl = bus_to_virt(attr_mem);
                     60:   while ( *cis_tpl != CISTPL_END ) {
                     61:     if ( *cis_tpl == CISTPL_VERS_1 ) {
                     62:       /* CISTPL_VERS_1 contains some nice text strings */
                     63:       printf ( "...found " );
                     64:       found = 1;
                     65:       cis_string = cis_tpl + CISTPL_VERS_1_STR_OFF;
                     66:       while ( ! ( ( *cis_string == 0 ) && ( *(cis_string+CIS_STEP) == 0 ) ) ) {
                     67:        printf ( "%c", *cis_string == 0 ? ' ' : *cis_string );
                     68:        cis_string += CIS_STEP;
                     69:       }
                     70:       printf ( "\n" );
                     71:     }
                     72:     /* printf ( "CIS tuple type %#hhx, length %#hhx\n", *cis_tpl, *(cis_tpl+CISTPL_LEN_OFF) ); */
                     73:     cis_tpl += CISTPL_HEADER_LEN + CIS_STEP * ( *(cis_tpl+CISTPL_LEN_OFF) );
                     74:   }
                     75:   if ( found == 0 ) {
                     76:     printf ( "...nothing found\n" );
                     77:   }
                     78:   ((unsigned char *)bus_to_virt(attr_mem))[COR_OFFSET] = COR_VALUE; /* Write COR to enable PC card */
                     79:   return found;
                     80: }
                     81: 
                     82: static int prism2_plx_probe ( struct nic *nic, struct pci_device *pci ) {
                     83:   hfa384x_t *hw = &hw_global;
                     84:   
                     85:   /* Find and intialise PLX Prism2 card */
                     86:   if ( ! prism2_find_plx ( hw, pci ) ) return 0;
                     87:   nic->ioaddr = hw->iobase;
                     88:   nic->irqno  = 0;
                     89:   return prism2_probe ( nic, hw );
                     90: }
                     91: 
                     92: static void prism2_plx_disable ( struct nic *nic ) {
                     93:   prism2_disable ( nic );
                     94: }
                     95: 
                     96: static struct pci_device_id prism2_plx_nics[] = {
                     97: PCI_ROM(0x1385, 0x4100, "ma301",         "Netgear MA301", 0),
                     98: PCI_ROM(0x10b7, 0x7770, "3c-airconnect", "3Com AirConnect", 0),
                     99: PCI_ROM(0x111a, 0x1023, "ss1023",        "Siemens SpeedStream SS1023", 0),
                    100: PCI_ROM(0x15e8, 0x0130, "correga",       "Correga", 0),
                    101: PCI_ROM(0x1638, 0x1100, "smc2602w",      "SMC EZConnect SMC2602W", 0), /* or Eumitcom PCI WL11000, Addtron AWA-100 */
                    102: PCI_ROM(0x16ab, 0x1100, "gl24110p",      "Global Sun Tech GL24110P", 0),
                    103: PCI_ROM(0x16ab, 0x1101, "16ab-1101",     "Unknown", 0),
                    104: PCI_ROM(0x16ab, 0x1102, "wdt11",         "Linksys WDT11", 0),
                    105: PCI_ROM(0x16ec, 0x3685, "usr2415",       "USR 2415", 0),
                    106: PCI_ROM(0xec80, 0xec00, "f5d6000",       "Belkin F5D6000", 0),
                    107: PCI_ROM(0x126c, 0x8030, "emobility",     "Nortel emobility", 0),
                    108: };
                    109: 
                    110: PCI_DRIVER ( prism2_plx_driver, prism2_plx_nics, PCI_NO_CLASS );
                    111: 
                    112: 
                    113: DRIVER ( "Prism2/PLX", nic_driver, pci_driver, prism2_plx_driver,
                    114:         prism2_plx_probe, prism2_plx_disable );
                    115: 
                    116: /*
                    117:  * Local variables:
                    118:  *  c-basic-offset: 8
                    119:  *  c-indent-level: 8
                    120:  *  tab-width: 8
                    121:  * End:
                    122:  */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.