OpenCores
URL https://opencores.org/ocsvn/test_project/test_project/trunk

Subversion Repositories test_project

[/] [test_project/] [trunk/] [linux_sd_driver/] [drivers/] [net/] [wireless/] [prism54/] [islpci_dev.h] - Blame information for rev 62

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.