iPXE
prism2_plx.c
Go to the documentation of this file.
1/**************************************************************************
2Etherboot - BOOTP/TFTP Bootstrap Program
3Prism2 NIC driver for Etherboot
4Wrapper for prism2_plx
5
6Written 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 of the
14 * License, or (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * 02110-1301, USA.
25 */
26
27FILE_LICENCE ( GPL2_OR_LATER );
28
29#include <ipxe/pci.h>
30#include <nic.h>
31
32#define WLAN_HOSTIF WLAN_PLX
33#include "prism2.c"
34
35/*
36 * Find PLX card. Prints out information strings from PCMCIA CIS as visual
37 * confirmation of presence of card.
38 *
39 * Arguments:
40 * hw device structure to be filled in
41 * p PCI device structure
42 *
43 * Returns:
44 * 1 Success
45 */
46static int prism2_find_plx ( hfa384x_t *hw, struct pci_device *p )
47{
48 int found = 0;
49 uint32_t plx_lcr = 0; /* PLX9052 Local Configuration Register Base (I/O) */
50 uint32_t attr_mem = 0; /* Prism2 Attribute Memory Base */
51 uint32_t iobase = 0; /* Prism2 I/O Base */
52 unsigned char *cis_tpl = NULL;
53 unsigned char *cis_string;
54
55 /* Obtain all memory and IO base addresses */
61
62 /* Fill out hw structure */
63 hw->iobase = iobase;
64 printf ( "PLX9052 has local config registers at %#x\n", plx_lcr );
65 printf ( "Prism2 has attribute memory at %#x and I/O base at %#x\n", attr_mem, iobase );
66
67 /* Search for CIS strings */
68 printf ( "Searching for PCMCIA card...\n" );
69 cis_tpl = bus_to_virt(attr_mem);
70 while ( *cis_tpl != CISTPL_END ) {
71 if ( *cis_tpl == CISTPL_VERS_1 ) {
72 /* CISTPL_VERS_1 contains some nice text strings */
73 printf ( "...found " );
74 found = 1;
75 cis_string = cis_tpl + CISTPL_VERS_1_STR_OFF;
76 while ( ! ( ( *cis_string == 0 ) && ( *(cis_string+CIS_STEP) == 0 ) ) ) {
77 printf ( "%c", *cis_string == 0 ? ' ' : *cis_string );
78 cis_string += CIS_STEP;
79 }
80 printf ( "\n" );
81 }
82 /* printf ( "CIS tuple type %#hhx, length %#hhx\n", *cis_tpl, *(cis_tpl+CISTPL_LEN_OFF) ); */
83 cis_tpl += CISTPL_HEADER_LEN + CIS_STEP * ( *(cis_tpl+CISTPL_LEN_OFF) );
84 }
85 if ( found == 0 ) {
86 printf ( "...nothing found\n" );
87 }
88 ((unsigned char *)bus_to_virt(attr_mem))[COR_OFFSET] = COR_VALUE; /* Write COR to enable PC card */
89 return found;
90}
91
92static int prism2_plx_probe ( struct nic *nic, struct pci_device *pci ) {
94
95 /* Find and intialise PLX Prism2 card */
96 if ( ! prism2_find_plx ( hw, pci ) ) return 0;
97 nic->ioaddr = hw->iobase;
98 nic->irqno = 0;
99 return prism2_probe ( nic, hw );
100}
101
102static void prism2_plx_disable ( struct nic *nic, void *hwdev __unused ) {
104}
105
107PCI_ROM(0x10b7, 0x7770, "3c-airconnect", "3Com AirConnect", 0),
108PCI_ROM(0x111a, 0x1023, "ss1023", "Siemens SpeedStream SS1023", 0),
109PCI_ROM(0x126c, 0x8030, "emobility", "Nortel emobility", 0),
110PCI_ROM(0x1385, 0x4100, "ma301", "Netgear MA301", 0),
111PCI_ROM(0x15e8, 0x0130, "correga", "Correga", 0),
112PCI_ROM(0x1638, 0x1100, "smc2602w", "SMC EZConnect SMC2602W", 0), /* or Eumitcom PCI WL11000, Addtron AWA-100 */
113PCI_ROM(0x16ab, 0x1100, "gl24110p", "Global Sun Tech GL24110P", 0),
114PCI_ROM(0x16ab, 0x1101, "16ab-1101", "Unknown", 0),
115PCI_ROM(0x16ab, 0x1102, "wdt11", "Linksys WDT11", 0),
116PCI_ROM(0x16ec, 0x3685, "usr2415", "USR 2415", 0),
117PCI_ROM(0xec80, 0xec00, "f5d6000", "Belkin F5D6000", 0),
118};
119
120PCI_DRIVER ( prism2_plx_driver, prism2_plx_nics, PCI_NO_CLASS );
121
122DRIVER ( "Prism2/PLX", nic_driver, pci_driver, prism2_plx_driver,
124
125/*
126 * Local variables:
127 * c-basic-offset: 8
128 * c-indent-level: 8
129 * tab-width: 8
130 * End:
131 */
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
unsigned int uint32_t
Definition stdint.h:12
#define __unused
Declare a variable or data structure as unused.
Definition compiler.h:573
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
static __always_inline void * bus_to_virt(unsigned long bus_addr)
Convert bus address to a virtual address.
Definition io.h:196
int pci_read_config_dword(struct pci_device *pci, unsigned int where, uint32_t *value)
Read 32-bit dword from PCI configuration space.
#define DRIVER(_name_text, _unused2, _unused3, _name, _probe, _disable, _fake_bss)
Definition nic.h:220
#define PCI_DRIVER(_name, _ids, _class)
Definition nic.h:105
struct @002057171240057303273132130141036221271355330106 no_fake_bss
PCI bus.
#define PCI_ROM(_vendor, _device, _name, _description, _data)
Definition pci.h:308
#define PCI_BASE_ADDRESS_IO_MASK
I/O BAR mask.
Definition pci.h:70
#define CISTPL_HEADER_LEN
Definition prism2.c:112
#define COR_OFFSET
Definition prism2.c:121
#define CISTPL_VERS_1
Definition prism2.c:108
#define CISTPL_LEN_OFF
Definition prism2.c:113
#define PLX_LOCAL_CONFIG_REGISTER_BASE
Definition prism2.c:92
static int prism2_probe(struct nic *nic, hfa384x_t *hw)
Definition prism2.c:769
static hfa384x_t hw_global
Definition prism2.c:143
#define CIS_STEP
Definition prism2.c:111
#define COR_VALUE
Definition prism2.c:122
static void prism2_disable(struct nic *nic __unused)
Definition prism2.c:736
#define PRISM2_PLX_ATTR_MEM_BASE
Definition prism2.c:98
struct hfa384x hfa384x_t
#define CISTPL_END
Definition prism2.c:109
#define PRISM2_PLX_IO_BASE
Definition prism2.c:99
#define CISTPL_VERS_1_STR_OFF
Definition prism2.c:114
static struct pci_device_id prism2_plx_nics[]
Definition prism2_plx.c:106
static int prism2_find_plx(hfa384x_t *hw, struct pci_device *p)
Definition prism2_plx.c:46
static int prism2_plx_probe(struct nic *nic, struct pci_device *pci)
Definition prism2_plx.c:92
static void prism2_plx_disable(struct nic *nic, void *hwdev __unused)
Definition prism2_plx.c:102
Definition hw.c:16
Definition nic.h:49
unsigned char irqno
Definition nic.h:56
unsigned int ioaddr
Definition nic.h:55
A PCI device ID list entry.
Definition pci.h:175
A PCI device.
Definition pci.h:211
A PCI driver.
Definition pci.h:252
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition vsprintf.c:465