iPXE
prism2_plx.c
Go to the documentation of this file.
00001 /**************************************************************************
00002 Etherboot -  BOOTP/TFTP Bootstrap Program
00003 Prism2 NIC driver for Etherboot
00004 Wrapper for prism2_plx
00005 
00006 Written by Michael Brown of Fen Systems Ltd
00007 $Id$
00008 ***************************************************************************/
00009 
00010 /*
00011  * This program is free software; you can redistribute it and/or
00012  * modify it under the terms of the GNU General Public License as
00013  * published by the Free Software Foundation; either version 2 of the
00014  * License, or (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful, but
00017  * WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  * General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00024  * 02110-1301, USA.
00025  */
00026 
00027 FILE_LICENCE ( GPL2_OR_LATER );
00028 
00029 #include <ipxe/pci.h>
00030 #include <nic.h>
00031 
00032 #define WLAN_HOSTIF WLAN_PLX
00033 #include "prism2.c"
00034 
00035 /*
00036  * Find PLX card.  Prints out information strings from PCMCIA CIS as visual
00037  * confirmation of presence of card.
00038  *
00039  * Arguments:
00040  *      hw              device structure to be filled in
00041  *      p               PCI device structure
00042  *
00043  * Returns:
00044  *      1               Success
00045  */
00046 static int prism2_find_plx ( hfa384x_t *hw, struct pci_device *p )
00047 {
00048   int found = 0;
00049   uint32_t plx_lcr  = 0; /* PLX9052 Local Configuration Register Base (I/O) */
00050   uint32_t attr_mem = 0; /* Prism2 Attribute Memory Base */
00051   uint32_t iobase   = 0; /* Prism2 I/O Base */
00052   unsigned char *cis_tpl  = NULL;
00053   unsigned char *cis_string;
00054   
00055   /* Obtain all memory and IO base addresses */
00056   pci_read_config_dword( p, PLX_LOCAL_CONFIG_REGISTER_BASE, &plx_lcr);
00057   plx_lcr &= ~PCI_BASE_ADDRESS_IO_MASK;
00058   pci_read_config_dword( p, PRISM2_PLX_ATTR_MEM_BASE, &attr_mem);
00059   pci_read_config_dword( p, PRISM2_PLX_IO_BASE, &iobase);
00060   iobase &= ~PCI_BASE_ADDRESS_IO_MASK;
00061 
00062   /* Fill out hw structure */
00063   hw->iobase = iobase;
00064   printf ( "PLX9052 has local config registers at %#x\n", plx_lcr );
00065   printf ( "Prism2 has attribute memory at %#x and I/O base at %#x\n", attr_mem, iobase );
00066 
00067   /* Search for CIS strings */
00068   printf ( "Searching for PCMCIA card...\n" );
00069   cis_tpl = bus_to_virt(attr_mem);
00070   while ( *cis_tpl != CISTPL_END ) {
00071     if ( *cis_tpl == CISTPL_VERS_1 ) {
00072       /* CISTPL_VERS_1 contains some nice text strings */
00073       printf ( "...found " );
00074       found = 1;
00075       cis_string = cis_tpl + CISTPL_VERS_1_STR_OFF;
00076       while ( ! ( ( *cis_string == 0 ) && ( *(cis_string+CIS_STEP) == 0 ) ) ) {
00077         printf ( "%c", *cis_string == 0 ? ' ' : *cis_string );
00078         cis_string += CIS_STEP;
00079       }
00080       printf ( "\n" );
00081     }
00082     /* printf ( "CIS tuple type %#hhx, length %#hhx\n", *cis_tpl, *(cis_tpl+CISTPL_LEN_OFF) ); */
00083     cis_tpl += CISTPL_HEADER_LEN + CIS_STEP * ( *(cis_tpl+CISTPL_LEN_OFF) );
00084   }
00085   if ( found == 0 ) {
00086     printf ( "...nothing found\n" );
00087   }
00088   ((unsigned char *)bus_to_virt(attr_mem))[COR_OFFSET] = COR_VALUE; /* Write COR to enable PC card */
00089   return found;
00090 }
00091 
00092 static int prism2_plx_probe ( struct nic *nic, struct pci_device *pci ) {
00093   hfa384x_t *hw = &hw_global;
00094   
00095   /* Find and intialise PLX Prism2 card */
00096   if ( ! prism2_find_plx ( hw, pci ) ) return 0;
00097   nic->ioaddr = hw->iobase;
00098   nic->irqno  = 0;
00099   return prism2_probe ( nic, hw );
00100 }
00101 
00102 static void prism2_plx_disable ( struct nic *nic ) {
00103   prism2_disable ( nic );
00104 }
00105 
00106 static struct pci_device_id prism2_plx_nics[] = {
00107 PCI_ROM(0x1385, 0x4100, "ma301",         "Netgear MA301", 0),
00108 PCI_ROM(0x10b7, 0x7770, "3c-airconnect", "3Com AirConnect", 0),
00109 PCI_ROM(0x111a, 0x1023, "ss1023",        "Siemens SpeedStream SS1023", 0),
00110 PCI_ROM(0x15e8, 0x0130, "correga",       "Correga", 0),
00111 PCI_ROM(0x1638, 0x1100, "smc2602w",      "SMC EZConnect SMC2602W", 0),  /* or Eumitcom PCI WL11000, Addtron AWA-100 */
00112 PCI_ROM(0x16ab, 0x1100, "gl24110p",      "Global Sun Tech GL24110P", 0),
00113 PCI_ROM(0x16ab, 0x1101, "16ab-1101",     "Unknown", 0),
00114 PCI_ROM(0x16ab, 0x1102, "wdt11",         "Linksys WDT11", 0),
00115 PCI_ROM(0x16ec, 0x3685, "usr2415",       "USR 2415", 0),
00116 PCI_ROM(0xec80, 0xec00, "f5d6000",       "Belkin F5D6000", 0),
00117 PCI_ROM(0x126c, 0x8030, "emobility",     "Nortel emobility", 0),
00118 };
00119 
00120 PCI_DRIVER ( prism2_plx_driver, prism2_plx_nics, PCI_NO_CLASS );
00121 
00122 
00123 DRIVER ( "Prism2/PLX", nic_driver, pci_driver, prism2_plx_driver,
00124          prism2_plx_probe, prism2_plx_disable );
00125 
00126 /*
00127  * Local variables:
00128  *  c-basic-offset: 8
00129  *  c-indent-level: 8
00130  *  tab-width: 8
00131  * End:
00132  */