Purge warnings from prism2 drivers
[gpxe.git] / src / drivers / net / prism2_plx.c
blob074603565f88ee54b4c22a925abd336f0e7ad040
1 /**************************************************************************
2 Etherboot - BOOTP/TFTP Bootstrap Program
3 Prism2 NIC driver for Etherboot
4 Wrapper for prism2_plx
6 Written by Michael Brown of Fen Systems Ltd
7 $Id$
8 ***************************************************************************/
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.
17 #include <gpxe/pci.h>
18 #include <nic.h>
20 #define WLAN_HOSTIF WLAN_PLX
21 #include "prism2.c"
24 * Find PLX card. Prints out information strings from PCMCIA CIS as visual
25 * confirmation of presence of card.
27 * Arguments:
28 * hw device structure to be filled in
29 * p PCI device structure
31 * Returns:
32 * 1 Success
34 static int prism2_find_plx ( hfa384x_t *hw, struct pci_device *p )
36 int found = 0;
37 uint32_t plx_lcr = 0; /* PLX9052 Local Configuration Register Base (I/O) */
38 uint32_t attr_mem = 0; /* Prism2 Attribute Memory Base */
39 uint32_t iobase = 0; /* Prism2 I/O Base */
40 unsigned char *cis_tpl = NULL;
41 unsigned char *cis_string;
43 /* Obtain all memory and IO base addresses */
44 pci_read_config_dword( p, PLX_LOCAL_CONFIG_REGISTER_BASE, &plx_lcr);
45 plx_lcr &= PCI_BASE_ADDRESS_IO_MASK;
46 pci_read_config_dword( p, PRISM2_PLX_ATTR_MEM_BASE, &attr_mem);
47 pci_read_config_dword( p, PRISM2_PLX_IO_BASE, &iobase);
48 iobase &= PCI_BASE_ADDRESS_IO_MASK;
50 /* Fill out hw structure */
51 hw->membase = attr_mem;
52 hw->iobase = iobase;
53 printf ( "PLX9052 has local config registers at %#lx\n", plx_lcr );
54 printf ( "Prism2 has attribute memory at %#lx and I/O base at %#lx\n", attr_mem, iobase );
56 /* Search for CIS strings */
57 printf ( "Searching for PCMCIA card...\n" );
58 cis_tpl = bus_to_virt(attr_mem);
59 while ( *cis_tpl != CISTPL_END ) {
60 if ( *cis_tpl == CISTPL_VERS_1 ) {
61 /* CISTPL_VERS_1 contains some nice text strings */
62 printf ( "...found " );
63 found = 1;
64 cis_string = cis_tpl + CISTPL_VERS_1_STR_OFF;
65 while ( ! ( ( *cis_string == 0 ) && ( *(cis_string+CIS_STEP) == 0 ) ) ) {
66 printf ( "%c", *cis_string == 0 ? ' ' : *cis_string );
67 cis_string += CIS_STEP;
69 printf ( "\n" );
71 /* printf ( "CIS tuple type %#hhx, length %#hhx\n", *cis_tpl, *(cis_tpl+CISTPL_LEN_OFF) ); */
72 cis_tpl += CISTPL_HEADER_LEN + CIS_STEP * ( *(cis_tpl+CISTPL_LEN_OFF) );
74 if ( found == 0 ) {
75 printf ( "...nothing found\n" );
77 ((unsigned char *)bus_to_virt(attr_mem))[COR_OFFSET] = COR_VALUE; /* Write COR to enable PC card */
78 return found;
81 static int prism2_plx_probe ( struct nic *nic, struct pci_device *pci ) {
82 hfa384x_t *hw = &hw_global;
84 pci_fill_nic ( nic, pci );
86 /* Find and intialise PLX Prism2 card */
87 if ( ! prism2_find_plx ( hw, pci ) ) return 0;
88 nic->ioaddr = hw->iobase;
90 return prism2_probe ( nic, hw );
93 static void prism2_plx_disable ( struct nic *nic ) {
94 prism2_disable ( nic );
97 static struct pci_device_id prism2_plx_nics[] = {
98 PCI_ROM(0x1385, 0x4100, "ma301", "Netgear MA301"),
99 PCI_ROM(0x10b7, 0x7770, "3c-airconnect", "3Com AirConnect"),
100 PCI_ROM(0x111a, 0x1023, "ss1023", "Siemens SpeedStream SS1023"),
101 PCI_ROM(0x15e8, 0x0130, "correga", "Correga"),
102 PCI_ROM(0x1638, 0x1100, "smc2602w", "SMC EZConnect SMC2602W"), /* or Eumitcom PCI WL11000, Addtron AWA-100 */
103 PCI_ROM(0x16ab, 0x1100, "gl24110p", "Global Sun Tech GL24110P"),
104 PCI_ROM(0x16ab, 0x1101, "16ab-1101", "Unknown"),
105 PCI_ROM(0x16ab, 0x1102, "wdt11", "Linksys WDT11"),
106 PCI_ROM(0x16ec, 0x3685, "usr2415", "USR 2415"),
107 PCI_ROM(0xec80, 0xec00, "f5d6000", "Belkin F5D6000"),
108 PCI_ROM(0x126c, 0x8030, "emobility", "Nortel emobility"),
111 PCI_DRIVER ( prism2_plx_driver, prism2_plx_nics, PCI_NO_CLASS );
114 DRIVER ( "Prism2/PLX", nic_driver, pci_driver, prism2_plx_driver,
115 prism2_plx_probe, prism2_plx_disable );