diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/net/wireless/prism54/islpci_dev.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'drivers/net/wireless/prism54/islpci_dev.h')
-rw-r--r-- | drivers/net/wireless/prism54/islpci_dev.h | 216 |
1 files changed, 216 insertions, 0 deletions
diff --git a/drivers/net/wireless/prism54/islpci_dev.h b/drivers/net/wireless/prism54/islpci_dev.h new file mode 100644 index 000000000000..32a1019f1b36 --- /dev/null +++ b/drivers/net/wireless/prism54/islpci_dev.h | |||
@@ -0,0 +1,216 @@ | |||
1 | /* | ||
2 | * | ||
3 | * Copyright (C) 2002 Intersil Americas Inc. | ||
4 | * Copyright (C) 2003 Herbert Valerio Riedel <hvr@gnu.org> | ||
5 | * Copyright (C) 2003 Luis R. Rodriguez <mcgrof@ruslug.rutgers.edu> | ||
6 | * Copyright (C) 2003 Aurelien Alleaume <slts@free.fr> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #ifndef _ISLPCI_DEV_H | ||
24 | #define _ISLPCI_DEV_H | ||
25 | |||
26 | #include <linux/version.h> | ||
27 | #include <linux/netdevice.h> | ||
28 | #include <linux/wireless.h> | ||
29 | #include <net/iw_handler.h> | ||
30 | #include <linux/list.h> | ||
31 | |||
32 | #include "isl_38xx.h" | ||
33 | #include "isl_oid.h" | ||
34 | #include "islpci_mgt.h" | ||
35 | |||
36 | /* some states might not be superflous and may be removed when | ||
37 | design is finalized (hvr) */ | ||
38 | typedef enum { | ||
39 | PRV_STATE_OFF = 0, /* this means hw_unavailable is != 0 */ | ||
40 | PRV_STATE_PREBOOT, /* we are in a pre-boot state (empty RAM) */ | ||
41 | PRV_STATE_BOOT, /* boot state (fw upload, run fw) */ | ||
42 | PRV_STATE_POSTBOOT, /* after boot state, need reset now */ | ||
43 | PRV_STATE_PREINIT, /* pre-init state */ | ||
44 | PRV_STATE_INIT, /* init state (restore MIB backup to device) */ | ||
45 | PRV_STATE_READY, /* driver&device are in operational state */ | ||
46 | PRV_STATE_SLEEP /* device in sleep mode */ | ||
47 | } islpci_state_t; | ||
48 | |||
49 | /* ACL using MAC address */ | ||
50 | struct mac_entry { | ||
51 | struct list_head _list; | ||
52 | char addr[ETH_ALEN]; | ||
53 | }; | ||
54 | |||
55 | struct islpci_acl { | ||
56 | enum { MAC_POLICY_OPEN=0, MAC_POLICY_ACCEPT=1, MAC_POLICY_REJECT=2 } policy; | ||
57 | struct list_head mac_list; /* a list of mac_entry */ | ||
58 | int size; /* size of queue */ | ||
59 | struct semaphore sem; /* accessed in ioctls and trap_work */ | ||
60 | }; | ||
61 | |||
62 | struct islpci_membuf { | ||
63 | int size; /* size of memory */ | ||
64 | void *mem; /* address of memory as seen by CPU */ | ||
65 | dma_addr_t pci_addr; /* address of memory as seen by device */ | ||
66 | }; | ||
67 | |||
68 | #define MAX_BSS_WPA_IE_COUNT 64 | ||
69 | #define MAX_WPA_IE_LEN 64 | ||
70 | struct islpci_bss_wpa_ie { | ||
71 | struct list_head list; | ||
72 | unsigned long last_update; | ||
73 | u8 bssid[ETH_ALEN]; | ||
74 | u8 wpa_ie[MAX_WPA_IE_LEN]; | ||
75 | size_t wpa_ie_len; | ||
76 | |||
77 | }; | ||
78 | |||
79 | typedef struct { | ||
80 | spinlock_t slock; /* generic spinlock; */ | ||
81 | |||
82 | u32 priv_oid; | ||
83 | |||
84 | /* our mib cache */ | ||
85 | u32 iw_mode; | ||
86 | struct rw_semaphore mib_sem; | ||
87 | void **mib; | ||
88 | char nickname[IW_ESSID_MAX_SIZE+1]; | ||
89 | |||
90 | /* Take care of the wireless stats */ | ||
91 | struct work_struct stats_work; | ||
92 | struct semaphore stats_sem; | ||
93 | /* remember when we last updated the stats */ | ||
94 | unsigned long stats_timestamp; | ||
95 | /* The first is accessed under semaphore locking. | ||
96 | * The second is the clean one we return to iwconfig. | ||
97 | */ | ||
98 | struct iw_statistics local_iwstatistics; | ||
99 | struct iw_statistics iwstatistics; | ||
100 | |||
101 | struct iw_spy_data spy_data; /* iwspy support */ | ||
102 | |||
103 | #if WIRELESS_EXT > 16 | ||
104 | struct iw_public_data wireless_data; | ||
105 | #endif /* WIRELESS_EXT > 16 */ | ||
106 | |||
107 | int monitor_type; /* ARPHRD_IEEE80211 or ARPHRD_IEEE80211_PRISM */ | ||
108 | |||
109 | struct islpci_acl acl; | ||
110 | |||
111 | /* PCI bus allocation & configuration members */ | ||
112 | struct pci_dev *pdev; /* PCI structure information */ | ||
113 | char firmware[33]; | ||
114 | |||
115 | void __iomem *device_base; /* ioremapped device base address */ | ||
116 | |||
117 | /* consistent DMA region */ | ||
118 | void *driver_mem_address; /* base DMA address */ | ||
119 | dma_addr_t device_host_address; /* base DMA address (bus address) */ | ||
120 | dma_addr_t device_psm_buffer; /* host memory for PSM buffering (bus address) */ | ||
121 | |||
122 | /* our network_device structure */ | ||
123 | struct net_device *ndev; | ||
124 | |||
125 | /* device queue interface members */ | ||
126 | struct isl38xx_cb *control_block; /* device control block | ||
127 | (== driver_mem_address!) */ | ||
128 | |||
129 | /* Each queue has three indexes: | ||
130 | * free/index_mgmt/data_rx/tx (called index, see below), | ||
131 | * driver_curr_frag, and device_curr_frag (in the control block) | ||
132 | * All indexes are ever-increasing, but interpreted modulo the | ||
133 | * device queue size when used. | ||
134 | * index <= device_curr_frag <= driver_curr_frag at all times | ||
135 | * For rx queues, [index, device_curr_frag) contains fragments | ||
136 | * that the interrupt processing needs to handle (owned by driver). | ||
137 | * [device_curr_frag, driver_curr_frag) is the free space in the | ||
138 | * rx queue, waiting for data (owned by device). The driver | ||
139 | * increments driver_curr_frag to indicate to the device that more | ||
140 | * buffers are available. | ||
141 | * If device_curr_frag == driver_curr_frag, no more rx buffers are | ||
142 | * available, and the rx DMA engine of the device is halted. | ||
143 | * For tx queues, [index, device_curr_frag) contains fragments | ||
144 | * where tx is done; they need to be freed (owned by driver). | ||
145 | * [device_curr_frag, driver_curr_frag) contains the frames | ||
146 | * that are being transferred (owned by device). The driver | ||
147 | * increments driver_curr_frag to indicate that more tx work | ||
148 | * needs to be done. | ||
149 | */ | ||
150 | u32 index_mgmt_rx; /* real index mgmt rx queue */ | ||
151 | u32 index_mgmt_tx; /* read index mgmt tx queue */ | ||
152 | u32 free_data_rx; /* free pointer data rx queue */ | ||
153 | u32 free_data_tx; /* free pointer data tx queue */ | ||
154 | u32 data_low_tx_full; /* full detected flag */ | ||
155 | |||
156 | /* frame memory buffers for the device queues */ | ||
157 | struct islpci_membuf mgmt_tx[ISL38XX_CB_MGMT_QSIZE]; | ||
158 | struct islpci_membuf mgmt_rx[ISL38XX_CB_MGMT_QSIZE]; | ||
159 | struct sk_buff *data_low_tx[ISL38XX_CB_TX_QSIZE]; | ||
160 | struct sk_buff *data_low_rx[ISL38XX_CB_RX_QSIZE]; | ||
161 | dma_addr_t pci_map_tx_address[ISL38XX_CB_TX_QSIZE]; | ||
162 | dma_addr_t pci_map_rx_address[ISL38XX_CB_RX_QSIZE]; | ||
163 | |||
164 | /* driver network interface members */ | ||
165 | struct net_device_stats statistics; | ||
166 | |||
167 | /* wait for a reset interrupt */ | ||
168 | wait_queue_head_t reset_done; | ||
169 | |||
170 | /* used by islpci_mgt_transaction */ | ||
171 | struct semaphore mgmt_sem; /* serialize access to mailbox and wqueue */ | ||
172 | struct islpci_mgmtframe *mgmt_received; /* mbox for incoming frame */ | ||
173 | wait_queue_head_t mgmt_wqueue; /* waitqueue for mbox */ | ||
174 | |||
175 | /* state machine */ | ||
176 | islpci_state_t state; | ||
177 | int state_off; /* enumeration of off-state, if 0 then | ||
178 | * we're not in any off-state */ | ||
179 | |||
180 | /* WPA stuff */ | ||
181 | int wpa; /* WPA mode enabled */ | ||
182 | struct list_head bss_wpa_list; | ||
183 | int num_bss_wpa; | ||
184 | struct semaphore wpa_sem; | ||
185 | |||
186 | struct work_struct reset_task; | ||
187 | int reset_task_pending; | ||
188 | } islpci_private; | ||
189 | |||
190 | static inline islpci_state_t | ||
191 | islpci_get_state(islpci_private *priv) | ||
192 | { | ||
193 | /* lock */ | ||
194 | return priv->state; | ||
195 | /* unlock */ | ||
196 | } | ||
197 | |||
198 | islpci_state_t islpci_set_state(islpci_private *priv, islpci_state_t new_state); | ||
199 | |||
200 | #define ISLPCI_TX_TIMEOUT (2*HZ) | ||
201 | |||
202 | irqreturn_t islpci_interrupt(int, void *, struct pt_regs *); | ||
203 | |||
204 | int prism54_post_setup(islpci_private *, int); | ||
205 | int islpci_reset(islpci_private *, int); | ||
206 | |||
207 | static inline void | ||
208 | islpci_trigger(islpci_private *priv) | ||
209 | { | ||
210 | isl38xx_trigger_device(islpci_get_state(priv) == PRV_STATE_SLEEP, | ||
211 | priv->device_base); | ||
212 | } | ||
213 | |||
214 | int islpci_free_memory(islpci_private *); | ||
215 | struct net_device *islpci_setup(struct pci_dev *); | ||
216 | #endif /* _ISLPCI_DEV_H */ | ||