aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/brcm80211/include
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/brcm80211/include')
-rw-r--r--drivers/staging/brcm80211/include/bcm_rpc.h79
-rw-r--r--drivers/staging/brcm80211/include/bcm_rpc_tp.h137
-rw-r--r--drivers/staging/brcm80211/include/bcm_xdr.h60
-rw-r--r--drivers/staging/brcm80211/include/bcmdefs.h63
-rw-r--r--drivers/staging/brcm80211/include/bcmsdbus.h6
-rw-r--r--drivers/staging/brcm80211/include/bcmsdh.h12
-rw-r--r--drivers/staging/brcm80211/include/bcmsdh_sdmmc.h6
-rw-r--r--drivers/staging/brcm80211/include/bcmsrom.h8
-rw-r--r--drivers/staging/brcm80211/include/bcmutils.h60
-rw-r--r--drivers/staging/brcm80211/include/d11.h7
-rw-r--r--drivers/staging/brcm80211/include/dbus.h353
-rw-r--r--drivers/staging/brcm80211/include/epivers.h44
-rw-r--r--drivers/staging/brcm80211/include/hnddma.h91
-rw-r--r--drivers/staging/brcm80211/include/hndpmu.h44
-rw-r--r--drivers/staging/brcm80211/include/linux_osl.h407
-rw-r--r--drivers/staging/brcm80211/include/linuxver.h38
-rw-r--r--drivers/staging/brcm80211/include/nicpci.h12
-rw-r--r--drivers/staging/brcm80211/include/osl.h209
-rw-r--r--drivers/staging/brcm80211/include/proto/ethernet.h54
-rw-r--r--drivers/staging/brcm80211/include/proto/wpa.h94
-rw-r--r--drivers/staging/brcm80211/include/rpc_osl.h2
-rw-r--r--drivers/staging/brcm80211/include/siutils.h28
-rw-r--r--drivers/staging/brcm80211/include/wlioctl.h342
23 files changed, 352 insertions, 1804 deletions
diff --git a/drivers/staging/brcm80211/include/bcm_rpc.h b/drivers/staging/brcm80211/include/bcm_rpc.h
deleted file mode 100644
index 77e5d8f7196..00000000000
--- a/drivers/staging/brcm80211/include/bcm_rpc.h
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _BCM_RPC_H_
18#define _BCM_RPC_H_
19
20#include <rpc_osl.h>
21
22typedef struct rpc_info rpc_info_t;
23typedef struct rpc_buf rpc_buf_t;
24struct rpc_transport_info;
25typedef void (*rpc_dispatch_cb_t) (void *ctx, struct rpc_buf *buf);
26typedef void (*rpc_resync_cb_t) (void *ctx);
27typedef void (*rpc_down_cb_t) (void *ctx);
28typedef void (*rpc_txdone_cb_t) (void *ctx, struct rpc_buf *buf);
29extern struct rpc_info *bcm_rpc_attach(void *pdev, osl_t *osh,
30 struct rpc_transport_info *rpc_th);
31
32extern void bcm_rpc_detach(struct rpc_info *rpc);
33extern void bcm_rpc_down(struct rpc_info *rpc);
34extern void bcm_rpc_watchdog(struct rpc_info *rpc);
35
36extern struct rpc_buf *bcm_rpc_buf_alloc(struct rpc_info *rpc, int len);
37extern void bcm_rpc_buf_free(struct rpc_info *rpc, struct rpc_buf *b);
38/* get rpc transport handle */
39extern struct rpc_transport_info *bcm_rpc_tp_get(struct rpc_info *rpc);
40
41/* callback for: data_rx, down, resync */
42extern void bcm_rpc_rxcb_init(struct rpc_info *rpc, void *ctx,
43 rpc_dispatch_cb_t cb, void *dnctx,
44 rpc_down_cb_t dncb, rpc_resync_cb_t resync_cb,
45 rpc_txdone_cb_t);
46extern void bcm_rpc_rxcb_deinit(struct rpc_info *rpci);
47
48/* HOST or CLIENT rpc call, requiring no return value */
49extern int bcm_rpc_call(struct rpc_info *rpc, struct rpc_buf *b);
50
51/* HOST rpc call, demanding return.
52 * The thread may be suspended and control returns back to OS
53 * The thread will resume(waked up) on either the return signal received or timeout
54 * The implementation details depend on OS
55 */
56extern struct rpc_buf *bcm_rpc_call_with_return(struct rpc_info *rpc,
57 struct rpc_buf *b);
58
59/* CLIENT rpc call to respond to bcm_rpc_call_with_return, requiring no return value */
60extern int bcm_rpc_call_return(struct rpc_info *rpc, struct rpc_buf *retb);
61
62extern uint bcm_rpc_buf_header_len(struct rpc_info *rpci);
63
64#define RPC_PKTLOG_SIZE 50 /* Depth of the history */
65#define RPC_PKTLOG_RD_LEN 3
66#define RPC_PKTLOG_DUMP_SIZE 150 /* dump size should be more than the product of above two */
67extern int bcm_rpc_pktlog_get(struct rpc_info *rpci, u32 *buf,
68 uint buf_size, bool send);
69extern int bcm_rpc_dump(rpc_info_t *rpci, struct bcmstrbuf *b);
70
71/* HIGH/BMAC: bit 15-8: RPC module, bit 7-0: TP module */
72#define RPC_ERROR_VAL 0x0001
73#define RPC_TRACE_VAL 0x0002
74#define RPC_PKTTRACE_VAL 0x0004
75#define RPC_PKTLOG_VAL 0x0008
76extern void bcm_rpc_msglevel_set(struct rpc_info *rpci, u16 msglevel,
77 bool high_low);
78
79#endif /* _BCM_RPC_H_ */
diff --git a/drivers/staging/brcm80211/include/bcm_rpc_tp.h b/drivers/staging/brcm80211/include/bcm_rpc_tp.h
deleted file mode 100644
index bb8dc6dd6f4..00000000000
--- a/drivers/staging/brcm80211/include/bcm_rpc_tp.h
+++ /dev/null
@@ -1,137 +0,0 @@
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _bcm_rpc_tp_h_
18#define _bcm_rpc_tp_h_
19#include <bcm_rpc.h>
20
21#define DBUS_RX_BUFFER_SIZE_RPC (2100) /* rxbufsize for dbus_attach, linux only for now */
22
23#define BCM_RPC_TP_ENCAP_LEN 4 /* TP header is 4 bytes */
24
25#define BCM_RPC_TP_HOST_AGG_MASK 0xffff0000
26#define BCM_RPC_TP_HOST_AGG_SHIFT 16
27#define BCM_RPC_TP_HOST_AGG_AMPDU 0x00010000 /* HOST->DNGL ampdu aggregation */
28#define BCM_RPC_TP_HOST_AGG_TEST 0x00100000 /* HOST->DNGL test aggregation */
29#define BCM_RPC_TP_DNGL_AGG_MASK 0x0000ffff
30#define BCM_RPC_TP_DNGL_AGG_DPC 0x00000001 /* DNGL->HOST data aggregation */
31#define BCM_RPC_TP_DNGL_AGG_FLOWCTL 0x00000002 /* DNGL->HOST tx flowcontrol agg */
32#define BCM_RPC_TP_DNGL_AGG_TEST 0x00000010 /* DNGL->HOST test agg */
33
34#define BCM_RPC_TP_DNGL_AGG_MAX_SFRAME 3 /* max agg subframes, must be <= USB_NTXD */
35#define BCM_RPC_TP_DNGL_AGG_MAX_BYTE 4000 /* max agg bytes */
36
37#define BCM_RPC_TP_HOST_AGG_MAX_SFRAME 3 /* max agg subframes, AMPDU only, 3 is enough */
38#define BCM_RPC_TP_HOST_AGG_MAX_BYTE 3400 /* max agg bytes; to fit 2+ tcp/udp pkts. Each one:
39 * 802.3pkt + 802.11 hdr + rpc hdr + tp hdr < 1700B
40 * Need to be in sync with dongle usb rx dma
41 * rxbufsize(USBBULK_RXBUF_GIANT in usbdev_sb.c)
42 */
43/* TP-DBUS pkts flowcontrol */
44#define BCM_RPC_TP_DBUS_NTXQ 50 /* queue size for TX on bulk OUT, aggregation possible */
45#define BCM_RPC_TP_DBUS_NRXQ 50 /* queue size for RX on bulk IN, aggregation possible */
46#define BCM_RPC_TP_DBUS_NRXQ_CTRL 1 /* queue size for RX on ctl EP0 */
47
48#define BCM_RPC_TP_DBUS_NRXQ_PKT (BCM_RPC_TP_DBUS_NRXQ * BCM_RPC_TP_DNGL_AGG_MAX_SFRAME)
49#define BCM_RPC_TP_DBUS_NTXQ_PKT (BCM_RPC_TP_DBUS_NTXQ * BCM_RPC_TP_HOST_AGG_MAX_SFRAME)
50
51typedef struct rpc_transport_info rpc_tp_info_t;
52
53typedef void (*rpc_tx_complete_fn_t) (void *, rpc_buf_t *, int status);
54typedef void (*rpc_rx_fn_t) (void *, rpc_buf_t *);
55
56#ifdef WLC_LOW
57typedef void (*rpc_txflowctl_cb_t) (void *ctx, bool on);
58#endif
59
60extern rpc_tp_info_t *bcm_rpc_tp_attach(osl_t *osh, void *bus);
61extern void bcm_rpc_tp_detach(rpc_tp_info_t *rpcb);
62extern void bcm_rpc_tp_down(rpc_tp_info_t *rpcb);
63extern void bcm_rpc_tp_watchdog(rpc_tp_info_t *rpcb);
64
65extern int bcm_rpc_tp_buf_send(rpc_tp_info_t *rpcb, rpc_buf_t *buf);
66
67/* callback for tx_complete, rx_pkt */
68extern void bcm_rpc_tp_register_cb(rpc_tp_info_t *rpcb,
69 rpc_tx_complete_fn_t txcmplt,
70 void *tx_context, rpc_rx_fn_t rxpkt,
71 void *rx_context, rpc_osl_t *rpc_osh);
72extern void bcm_rpc_tp_deregister_cb(rpc_tp_info_t *rpcb);
73
74/* Buffer manipulation */
75extern uint bcm_rpc_buf_tp_header_len(rpc_tp_info_t *rpcb);
76extern rpc_buf_t *bcm_rpc_tp_buf_alloc(rpc_tp_info_t *rpcb, int len);
77extern void bcm_rpc_tp_buf_free(rpc_tp_info_t *rpcb, rpc_buf_t *buf);
78extern int bcm_rpc_buf_len_get(rpc_tp_info_t *rpcb, rpc_buf_t *b);
79extern int bcm_rpc_buf_len_set(rpc_tp_info_t *rpcb, rpc_buf_t *b, uint len);
80extern rpc_buf_t *bcm_rpc_buf_next_get(rpc_tp_info_t *rpcb, rpc_buf_t *b);
81extern void bcm_rpc_buf_next_set(rpc_tp_info_t *rpcb, rpc_buf_t *b,
82 rpc_buf_t *nextb);
83extern unsigned char *bcm_rpc_buf_data(rpc_tp_info_t *rpcb, rpc_buf_t *b);
84extern unsigned char *bcm_rpc_buf_push(rpc_tp_info_t *rpcb, rpc_buf_t *b,
85 uint delta);
86extern unsigned char *bcm_rpc_buf_pull(rpc_tp_info_t *rpcb, rpc_buf_t *b,
87 uint delta);
88extern void bcm_rpc_tp_buf_release(rpc_tp_info_t *rpcb, rpc_buf_t *buf);
89extern void bcm_rpc_tp_buf_cnt_adjust(rpc_tp_info_t *rpcb, int adjust);
90/* RPC call_with_return */
91extern int bcm_rpc_tp_recv_rtn(rpc_tp_info_t *rpcb);
92extern int bcm_rpc_tp_get_device_speed(rpc_tp_info_t *rpc_th);
93#ifdef BCMDBG
94extern int bcm_rpc_tp_dump(rpc_tp_info_t *rpcb, struct bcmstrbuf *b);
95#endif
96
97#ifdef WLC_LOW
98/* intercept USB pkt to parse RPC header: USB driver rx-> wl_send -> this -> wl driver */
99extern void bcm_rpc_tp_rx_from_dnglbus(rpc_tp_info_t *rpc_th, struct lbuf *lb);
100
101/* RPC callreturn pkt, go to USB driver tx */
102extern int bcm_rpc_tp_send_callreturn(rpc_tp_info_t *rpc_th, rpc_buf_t *b);
103
104extern void bcm_rpc_tp_dump(rpc_tp_info_t *rpcb);
105extern void bcm_rpc_tp_txflowctl(rpc_tp_info_t *rpcb, bool state, int prio);
106extern void bcm_rpc_tp_txflowctlcb_init(rpc_tp_info_t *rpc_th, void *ctx,
107 rpc_txflowctl_cb_t cb);
108extern void bcm_rpc_tp_txflowctlcb_deinit(rpc_tp_info_t *rpc_th);
109extern void bcm_rpc_tp_txq_wm_set(rpc_tp_info_t *rpc_th, u8 hiwm,
110 u8 lowm);
111extern void bcm_rpc_tp_txq_wm_get(rpc_tp_info_t *rpc_th, u8 *hiwm,
112 u8 *lowm);
113#endif /* WLC_LOW */
114
115extern void bcm_rpc_tp_agg_set(rpc_tp_info_t *rpcb, u32 reason, bool set);
116extern void bcm_rpc_tp_agg_limit_set(rpc_tp_info_t *rpc_th, u8 sf,
117 u16 bytes);
118extern void bcm_rpc_tp_agg_limit_get(rpc_tp_info_t *rpc_th, u8 *sf,
119 u16 *bytes);
120
121#define BCM_RPC_TP_MSG_LEVEL_MASK 0x00ff
122/* dongle msg level */
123#define RPC_TP_MSG_DNGL_ERR_VAL 0x0001 /* DNGL TP error msg */
124#define RPC_TP_MSG_DNGL_DBG_VAL 0x0002 /* DNGL TP dbg msg */
125#define RPC_TP_MSG_DNGL_AGG_VAL 0x0004 /* DNGL TP agg msg */
126#define RPC_TP_MSG_DNGL_DEA_VAL 0x0008 /* DNGL TP deag msg */
127
128/* host msg level */
129#define RPC_TP_MSG_HOST_ERR_VAL 0x0001 /* DNGL TP error msg */
130#define RPC_TP_MSG_HOST_DBG_VAL 0x0002 /* DNGL TP dbg msg */
131#define RPC_TP_MSG_HOST_AGG_VAL 0x0004 /* DNGL TP agg msg */
132#define RPC_TP_MSG_HOST_DEA_VAL 0x0008 /* DNGL TP deag msg */
133
134extern void bcm_rpc_tp_msglevel_set(rpc_tp_info_t *rpc_th, u8 msglevel,
135 bool high_low);
136
137#endif /* _bcm_rpc_tp_h_ */
diff --git a/drivers/staging/brcm80211/include/bcm_xdr.h b/drivers/staging/brcm80211/include/bcm_xdr.h
deleted file mode 100644
index 50fbd78a880..00000000000
--- a/drivers/staging/brcm80211/include/bcm_xdr.h
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _BCM_XDR_H
18#define _BCM_XDR_H
19
20/*
21 * bcm_xdr_buf_t
22 * Structure used for bookkeeping of a buffer being packed or unpacked.
23 * Keeps a current read/write pointer and size as well as
24 * the original buffer pointer and size.
25 *
26 */
27typedef struct {
28 u8 *buf; /* pointer to current position in origbuf */
29 uint size; /* current (residual) size in bytes */
30 u8 *origbuf; /* unmodified pointer to orignal buffer */
31 uint origsize; /* unmodified orignal buffer size in bytes */
32} bcm_xdr_buf_t;
33
34void bcm_xdr_buf_init(bcm_xdr_buf_t *b, void *buf, size_t len);
35
36int bcm_xdr_pack_u32(bcm_xdr_buf_t *b, u32 val);
37int bcm_xdr_unpack_u32(bcm_xdr_buf_t *b, u32 *pval);
38int bcm_xdr_pack_s32(bcm_xdr_buf_t *b, s32 val);
39int bcm_xdr_unpack_s32(bcm_xdr_buf_t *b, s32 *pval);
40int bcm_xdr_pack_s8(bcm_xdr_buf_t *b, s8 val);
41int bcm_xdr_unpack_s8(bcm_xdr_buf_t *b, s8 *pval);
42int bcm_xdr_pack_opaque(bcm_xdr_buf_t *b, uint len, void *data);
43int bcm_xdr_unpack_opaque(bcm_xdr_buf_t *b, uint len, void **pdata);
44int bcm_xdr_unpack_opaque_cpy(bcm_xdr_buf_t *b, uint len, void *data);
45int bcm_xdr_pack_opaque_varlen(bcm_xdr_buf_t *b, uint len, void *data);
46int bcm_xdr_unpack_opaque_varlen(bcm_xdr_buf_t *b, uint *plen, void **pdata);
47int bcm_xdr_pack_string(bcm_xdr_buf_t *b, char *str);
48int bcm_xdr_unpack_string(bcm_xdr_buf_t *b, uint *plen, char **pstr);
49
50int bcm_xdr_pack_u8_vec(bcm_xdr_buf_t *, u8 *vec, u32 elems);
51int bcm_xdr_unpack_u8_vec(bcm_xdr_buf_t *, u8 *vec, u32 elems);
52int bcm_xdr_pack_u16_vec(bcm_xdr_buf_t *b, uint len, void *vec);
53int bcm_xdr_unpack_u16_vec(bcm_xdr_buf_t *b, uint len, void *vec);
54int bcm_xdr_pack_u32_vec(bcm_xdr_buf_t *b, uint len, void *vec);
55int bcm_xdr_unpack_u32_vec(bcm_xdr_buf_t *b, uint len, void *vec);
56
57int bcm_xdr_pack_opaque_raw(bcm_xdr_buf_t *b, uint len, void *data);
58int bcm_xdr_pack_opaque_pad(bcm_xdr_buf_t *b);
59
60#endif /* _BCM_XDR_H */
diff --git a/drivers/staging/brcm80211/include/bcmdefs.h b/drivers/staging/brcm80211/include/bcmdefs.h
index dc52e9dbb8b..74601fc971c 100644
--- a/drivers/staging/brcm80211/include/bcmdefs.h
+++ b/drivers/staging/brcm80211/include/bcmdefs.h
@@ -42,9 +42,6 @@
42#define BCMFASTPATH 42#define BCMFASTPATH
43#endif 43#endif
44 44
45/* Put some library data/code into ROM to reduce RAM requirements */
46#define BCMROMFN(_fn) _fn
47
48/* Bus types */ 45/* Bus types */
49#define SI_BUS 0 /* SOC Interconnect */ 46#define SI_BUS 0 /* SOC Interconnect */
50#define PCI_BUS 1 /* PCI target */ 47#define PCI_BUS 1 /* PCI target */
@@ -54,35 +51,6 @@
54#define SPI_BUS 6 /* gSPI target */ 51#define SPI_BUS 6 /* gSPI target */
55#define RPC_BUS 7 /* RPC target */ 52#define RPC_BUS 7 /* RPC target */
56 53
57/* Allows size optimization for single-bus image */
58#ifdef BCMBUSTYPE
59#define BUSTYPE(bus) (BCMBUSTYPE)
60#else
61#define BUSTYPE(bus) (bus)
62#endif
63
64/* Allows size optimization for single-backplane image */
65#ifdef BCMCHIPTYPE
66#define CHIPTYPE(bus) (BCMCHIPTYPE)
67#else
68#define CHIPTYPE(bus) (bus)
69#endif
70
71/* Allows size optimization for SPROM support */
72#define SPROMBUS (PCI_BUS)
73
74/* Allows size optimization for single-chip image */
75#ifdef BCMCHIPID
76#define CHIPID(chip) (BCMCHIPID)
77#else
78#define CHIPID(chip) (chip)
79#endif
80
81#ifdef BCMCHIPREV
82#define CHIPREV(rev) (BCMCHIPREV)
83#else
84#define CHIPREV(rev) (rev)
85#endif
86 54
87/* Defines for DMA Address Width - Shared between OSL and HNDDMA */ 55/* Defines for DMA Address Width - Shared between OSL and HNDDMA */
88#define DMADDR_MASK_32 0x0 /* Address mask for 32-bits */ 56#define DMADDR_MASK_32 0x0 /* Address mask for 32-bits */
@@ -146,31 +114,11 @@ typedef struct {
146 114
147#define BCMEXTRAHDROOM 172 115#define BCMEXTRAHDROOM 172
148 116
149/* Headroom required for dongle-to-host communication. Packets allocated
150 * locally in the dongle (e.g. for CDC ioctls or RNDIS messages) should
151 * leave this much room in front for low-level message headers which may
152 * be needed to get across the dongle bus to the host. (These messages
153 * don't go over the network, so room for the full WL header above would
154 * be a waste.).
155*/
156#define BCMDONGLEHDRSZ 12
157#define BCMDONGLEPADSZ 16
158
159#define BCMDONGLEOVERHEAD (BCMDONGLEHDRSZ + BCMDONGLEPADSZ)
160
161#ifdef BCMDBG 117#ifdef BCMDBG
162
163#define BCMDBG_ERR
164
165#ifndef BCMDBG_ASSERT 118#ifndef BCMDBG_ASSERT
166#define BCMDBG_ASSERT 119#define BCMDBG_ASSERT
167#endif /* BCMDBG_ASSERT */ 120#endif /* BCMDBG_ASSERT */
168 121#endif /* BCMDBG */
169#endif /* BCMDBG */
170
171#if defined(BCMDBG_ASSERT)
172#define BCMASSERT_SUPPORT
173#endif
174 122
175/* Macros for doing definition and get/set of bitfields 123/* Macros for doing definition and get/set of bitfields
176 * Usage example, e.g. a three-bit field (bits 4-6): 124 * Usage example, e.g. a three-bit field (bits 4-6):
@@ -190,11 +138,10 @@ typedef struct {
190 (((val) & (~(field ## _M << field ## _S))) | \ 138 (((val) & (~(field ## _M << field ## _S))) | \
191 ((unsigned)(bits) << field ## _S)) 139 ((unsigned)(bits) << field ## _S))
192 140
193/* define BCMSMALL to remove misc features for memory-constrained environments */
194#define BCMSPACE
195#define bcmspace true /* if (bcmspace) code is retained */
196
197/* Max. nvram variable table size */ 141/* Max. nvram variable table size */
198#define MAXSZ_NVRAM_VARS 4096 142#define MAXSZ_NVRAM_VARS 4096
199 143
144/* handle forward declaration */
145struct wl_info;
146
200#endif /* _bcmdefs_h_ */ 147#endif /* _bcmdefs_h_ */
diff --git a/drivers/staging/brcm80211/include/bcmsdbus.h b/drivers/staging/brcm80211/include/bcmsdbus.h
index ca99495eaa8..89059dd8088 100644
--- a/drivers/staging/brcm80211/include/bcmsdbus.h
+++ b/drivers/staging/brcm80211/include/bcmsdbus.h
@@ -46,8 +46,8 @@ typedef void (*sdioh_cb_fn_t) (void *);
46 * The handler shall be provided by all subsequent calls. No local cache 46 * The handler shall be provided by all subsequent calls. No local cache
47 * cfghdl points to the starting address of pci device mapped memory 47 * cfghdl points to the starting address of pci device mapped memory
48 */ 48 */
49extern sdioh_info_t *sdioh_attach(osl_t *osh, void *cfghdl, uint irq); 49extern sdioh_info_t *sdioh_attach(struct osl_info *osh, void *cfghdl, uint irq);
50extern SDIOH_API_RC sdioh_detach(osl_t *osh, sdioh_info_t *si); 50extern SDIOH_API_RC sdioh_detach(struct osl_info *osh, sdioh_info_t *si);
51extern SDIOH_API_RC sdioh_interrupt_register(sdioh_info_t *si, 51extern SDIOH_API_RC sdioh_interrupt_register(sdioh_info_t *si,
52 sdioh_cb_fn_t fn, void *argh); 52 sdioh_cb_fn_t fn, void *argh);
53extern SDIOH_API_RC sdioh_interrupt_deregister(sdioh_info_t *si); 53extern SDIOH_API_RC sdioh_interrupt_deregister(sdioh_info_t *si);
@@ -79,7 +79,7 @@ extern SDIOH_API_RC sdioh_request_buffer(sdioh_info_t *si, uint pio_dma,
79 uint fix_inc, uint rw, uint fnc_num, 79 uint fix_inc, uint rw, uint fnc_num,
80 u32 addr, uint regwidth, 80 u32 addr, uint regwidth,
81 u32 buflen, u8 *buffer, 81 u32 buflen, u8 *buffer,
82 void *pkt); 82 struct sk_buff *pkt);
83 83
84/* get cis data */ 84/* get cis data */
85extern SDIOH_API_RC sdioh_cis_read(sdioh_info_t *si, uint fuc, u8 *cis, 85extern SDIOH_API_RC sdioh_cis_read(sdioh_info_t *si, uint fuc, u8 *cis,
diff --git a/drivers/staging/brcm80211/include/bcmsdh.h b/drivers/staging/brcm80211/include/bcmsdh.h
index 6b80983d43c..0e1f79919c9 100644
--- a/drivers/staging/brcm80211/include/bcmsdh.h
+++ b/drivers/staging/brcm80211/include/bcmsdh.h
@@ -40,11 +40,11 @@ typedef void (*bcmsdh_cb_fn_t) (void *);
40 * implementation may maintain a single "default" handle (e.g. the first or 40 * implementation may maintain a single "default" handle (e.g. the first or
41 * most recent one) to enable single-instance implementations to pass NULL. 41 * most recent one) to enable single-instance implementations to pass NULL.
42 */ 42 */
43extern bcmsdh_info_t *bcmsdh_attach(osl_t *osh, void *cfghdl, void **regsva, 43extern bcmsdh_info_t *bcmsdh_attach(struct osl_info *osh, void *cfghdl,
44 uint irq); 44 void **regsva, uint irq);
45 45
46/* Detach - freeup resources allocated in attach */ 46/* Detach - freeup resources allocated in attach */
47extern int bcmsdh_detach(osl_t *osh, void *sdh); 47extern int bcmsdh_detach(struct osl_info *osh, void *sdh);
48 48
49/* Query if SD device interrupts are enabled */ 49/* Query if SD device interrupts are enabled */
50extern bool bcmsdh_intr_query(void *sdh); 50extern bool bcmsdh_intr_query(void *sdh);
@@ -122,7 +122,7 @@ extern int bcmsdh_send_buf(void *sdh, u32 addr, uint fn, uint flags,
122 u8 *buf, uint nbytes, void *pkt, 122 u8 *buf, uint nbytes, void *pkt,
123 bcmsdh_cmplt_fn_t complete, void *handle); 123 bcmsdh_cmplt_fn_t complete, void *handle);
124extern int bcmsdh_recv_buf(void *sdh, u32 addr, uint fn, uint flags, 124extern int bcmsdh_recv_buf(void *sdh, u32 addr, uint fn, uint flags,
125 u8 *buf, uint nbytes, void *pkt, 125 u8 *buf, uint nbytes, struct sk_buff *pkt,
126 bcmsdh_cmplt_fn_t complete, void *handle); 126 bcmsdh_cmplt_fn_t complete, void *handle);
127 127
128/* Flags bits */ 128/* Flags bits */
@@ -174,8 +174,8 @@ extern void *bcmsdh_get_sdioh(bcmsdh_info_t *sdh);
174typedef struct { 174typedef struct {
175 /* attach to device */ 175 /* attach to device */
176 void *(*attach) (u16 vend_id, u16 dev_id, u16 bus, u16 slot, 176 void *(*attach) (u16 vend_id, u16 dev_id, u16 bus, u16 slot,
177 u16 func, uint bustype, void *regsva, osl_t *osh, 177 u16 func, uint bustype, void *regsva,
178 void *param); 178 struct osl_info *osh, void *param);
179 /* detach from device */ 179 /* detach from device */
180 void (*detach) (void *ch); 180 void (*detach) (void *ch);
181} bcmsdh_driver_t; 181} bcmsdh_driver_t;
diff --git a/drivers/staging/brcm80211/include/bcmsdh_sdmmc.h b/drivers/staging/brcm80211/include/bcmsdh_sdmmc.h
index 7d5aa71a7dc..4d671ddb3af 100644
--- a/drivers/staging/brcm80211/include/bcmsdh_sdmmc.h
+++ b/drivers/staging/brcm80211/include/bcmsdh_sdmmc.h
@@ -51,7 +51,7 @@ extern void sdioh_sdmmc_osfree(sdioh_info_t *sd);
51#define CLIENT_INTR 0x100 /* Get rid of this! */ 51#define CLIENT_INTR 0x100 /* Get rid of this! */
52 52
53struct sdioh_info { 53struct sdioh_info {
54 osl_t *osh; /* osh handler */ 54 struct osl_info *osh; /* osh handler */
55 bool client_intr_enabled; /* interrupt connnected flag */ 55 bool client_intr_enabled; /* interrupt connnected flag */
56 bool intr_handler_valid; /* client driver interrupt handler valid */ 56 bool intr_handler_valid; /* client driver interrupt handler valid */
57 sdioh_cb_fn_t intr_handler; /* registered interrupt handler */ 57 sdioh_cb_fn_t intr_handler; /* registered interrupt handler */
@@ -94,8 +94,8 @@ extern void sdioh_sdmmc_devintr_off(sdioh_info_t *sd);
94 */ 94 */
95 95
96/* Register mapping routines */ 96/* Register mapping routines */
97extern u32 *sdioh_sdmmc_reg_map(osl_t *osh, s32 addr, int size); 97extern u32 *sdioh_sdmmc_reg_map(struct osl_info *osh, s32 addr, int size);
98extern void sdioh_sdmmc_reg_unmap(osl_t *osh, s32 addr, int size); 98extern void sdioh_sdmmc_reg_unmap(struct osl_info *osh, s32 addr, int size);
99 99
100/* Interrupt (de)registration routines */ 100/* Interrupt (de)registration routines */
101extern int sdioh_sdmmc_register_irq(sdioh_info_t *sd, uint irq); 101extern int sdioh_sdmmc_register_irq(sdioh_info_t *sd, uint irq);
diff --git a/drivers/staging/brcm80211/include/bcmsrom.h b/drivers/staging/brcm80211/include/bcmsrom.h
index 9d53657fdaa..cdcef746284 100644
--- a/drivers/staging/brcm80211/include/bcmsrom.h
+++ b/drivers/staging/brcm80211/include/bcmsrom.h
@@ -20,15 +20,15 @@
20#include <bcmsrom_fmt.h> 20#include <bcmsrom_fmt.h>
21 21
22/* Prototypes */ 22/* Prototypes */
23extern int srom_var_init(si_t *sih, uint bus, void *curmap, osl_t *osh, 23extern int srom_var_init(si_t *sih, uint bus, void *curmap,
24 char **vars, uint *count); 24 struct osl_info *osh, char **vars, uint *count);
25 25
26extern int srom_read(si_t *sih, uint bus, void *curmap, osl_t *osh, 26extern int srom_read(si_t *sih, uint bus, void *curmap, struct osl_info *osh,
27 uint byteoff, uint nbytes, u16 *buf, bool check_crc); 27 uint byteoff, uint nbytes, u16 *buf, bool check_crc);
28 28
29/* parse standard PCMCIA cis, normally used by SB/PCMCIA/SDIO/SPI/OTP 29/* parse standard PCMCIA cis, normally used by SB/PCMCIA/SDIO/SPI/OTP
30 * and extract from it into name=value pairs 30 * and extract from it into name=value pairs
31 */ 31 */
32extern int srom_parsecis(osl_t *osh, u8 **pcis, uint ciscnt, 32extern int srom_parsecis(struct osl_info *osh, u8 **pcis, uint ciscnt,
33 char **vars, uint *count); 33 char **vars, uint *count);
34#endif /* _bcmsrom_h_ */ 34#endif /* _bcmsrom_h_ */
diff --git a/drivers/staging/brcm80211/include/bcmutils.h b/drivers/staging/brcm80211/include/bcmutils.h
index b53315981be..a8f76d8199f 100644
--- a/drivers/staging/brcm80211/include/bcmutils.h
+++ b/drivers/staging/brcm80211/include/bcmutils.h
@@ -30,7 +30,6 @@
30 }; 30 };
31 31
32/* ** driver-only section ** */ 32/* ** driver-only section ** */
33#include <osl.h>
34 33
35#define GPIO_PIN_NOTDEFINED 0x20 /* Pin not defined */ 34#define GPIO_PIN_NOTDEFINED 0x20 /* Pin not defined */
36 35
@@ -56,10 +55,10 @@
56#endif 55#endif
57 56
58 typedef struct pktq_prec { 57 typedef struct pktq_prec {
59 void *head; /* first packet to dequeue */ 58 struct sk_buff *head; /* first packet to dequeue */
60 void *tail; /* last packet to dequeue */ 59 struct sk_buff *tail; /* last packet to dequeue */
61 u16 len; /* number of queued packets */ 60 u16 len; /* number of queued packets */
62 u16 max; /* maximum number of queued packets */ 61 u16 max; /* maximum number of queued packets */
63 } pktq_prec_t; 62 } pktq_prec_t;
64 63
65/* multi-priority pkt queue */ 64/* multi-priority pkt queue */
@@ -105,23 +104,26 @@
105#define pktq_ppeek(pq, prec) ((pq)->q[prec].head) 104#define pktq_ppeek(pq, prec) ((pq)->q[prec].head)
106#define pktq_ppeek_tail(pq, prec) ((pq)->q[prec].tail) 105#define pktq_ppeek_tail(pq, prec) ((pq)->q[prec].tail)
107 106
108 extern void *pktq_penq(struct pktq *pq, int prec, void *p); 107extern struct sk_buff *pktq_penq(struct pktq *pq, int prec,
109 extern void *pktq_penq_head(struct pktq *pq, int prec, void *p); 108 struct sk_buff *p);
110 extern void *pktq_pdeq(struct pktq *pq, int prec); 109extern struct sk_buff *pktq_penq_head(struct pktq *pq, int prec,
111 extern void *pktq_pdeq_tail(struct pktq *pq, int prec); 110 struct sk_buff *p);
111extern struct sk_buff *pktq_pdeq(struct pktq *pq, int prec);
112extern struct sk_buff *pktq_pdeq_tail(struct pktq *pq, int prec);
113
112/* Empty the queue at particular precedence level */ 114/* Empty the queue at particular precedence level */
113#ifdef BRCM_FULLMAC 115#ifdef BRCM_FULLMAC
114 extern void pktq_pflush(osl_t *osh, struct pktq *pq, int prec, 116 extern void pktq_pflush(struct osl_info *osh, struct pktq *pq, int prec,
115 bool dir); 117 bool dir);
116#else 118#else
117 extern void pktq_pflush(osl_t *osh, struct pktq *pq, int prec, 119 extern void pktq_pflush(struct osl_info *osh, struct pktq *pq, int prec,
118 bool dir, ifpkt_cb_t fn, int arg); 120 bool dir, ifpkt_cb_t fn, int arg);
119#endif /* BRCM_FULLMAC */ 121#endif /* BRCM_FULLMAC */
120 122
121/* operations on a set of precedences in packet queue */ 123/* operations on a set of precedences in packet queue */
122 124
123 extern int pktq_mlen(struct pktq *pq, uint prec_bmp); 125extern int pktq_mlen(struct pktq *pq, uint prec_bmp);
124 extern void *pktq_mdeq(struct pktq *pq, uint prec_bmp, int *prec_out); 126extern struct sk_buff *pktq_mdeq(struct pktq *pq, uint prec_bmp, int *prec_out);
125 127
126/* operations on packet queue as a whole */ 128/* operations on packet queue as a whole */
127 129
@@ -140,20 +142,19 @@
140 142
141 extern void pktq_init(struct pktq *pq, int num_prec, int max_len); 143 extern void pktq_init(struct pktq *pq, int num_prec, int max_len);
142/* prec_out may be NULL if caller is not interested in return value */ 144/* prec_out may be NULL if caller is not interested in return value */
143 extern void *pktq_peek_tail(struct pktq *pq, int *prec_out); 145 extern struct sk_buff *pktq_peek_tail(struct pktq *pq, int *prec_out);
144#ifdef BRCM_FULLMAC 146#ifdef BRCM_FULLMAC
145 extern void pktq_flush(osl_t *osh, struct pktq *pq, bool dir); 147 extern void pktq_flush(struct osl_info *osh, struct pktq *pq, bool dir);
146#else 148#else
147 extern void pktq_flush(osl_t *osh, struct pktq *pq, bool dir, 149 extern void pktq_flush(struct osl_info *osh, struct pktq *pq, bool dir,
148 ifpkt_cb_t fn, int arg); 150 ifpkt_cb_t fn, int arg);
149#endif 151#endif
150 152
151/* externs */ 153/* externs */
152/* packet */ 154/* packet */
153 extern uint pktfrombuf(osl_t *osh, void *p, uint offset, int len, 155 extern uint pktfrombuf(struct osl_info *osh, struct sk_buff *p,
154 unsigned char *buf); 156 uint offset, int len, unsigned char *buf);
155 extern uint pktsegcnt(osl_t *osh, void *p); 157 extern uint pkttotlen(struct osl_info *osh, struct sk_buff *p);
156 extern uint pkttotlen(osl_t *osh, void *p);
157 158
158/* ethernet address */ 159/* ethernet address */
159 extern int bcm_ether_atoe(char *p, struct ether_addr *ea); 160 extern int bcm_ether_atoe(char *p, struct ether_addr *ea);
@@ -166,7 +167,8 @@
166 extern char *getvar(char *vars, const char *name); 167 extern char *getvar(char *vars, const char *name);
167 extern int getintvar(char *vars, const char *name); 168 extern int getintvar(char *vars, const char *name);
168#ifdef BCMDBG 169#ifdef BCMDBG
169 extern void prpkt(const char *msg, osl_t *osh, void *p0); 170 extern void prpkt(const char *msg, struct osl_info *osh,
171 struct sk_buff *p0);
170#endif /* BCMDBG */ 172#endif /* BCMDBG */
171#define bcm_perf_enable() 173#define bcm_perf_enable()
172#define bcmstats(fmt) 174#define bcmstats(fmt)
@@ -359,7 +361,21 @@
359#define CEIL(x, y) (((x) + ((y)-1)) / (y)) 361#define CEIL(x, y) (((x) + ((y)-1)) / (y))
360#define ISPOWEROF2(x) ((((x)-1)&(x)) == 0) 362#define ISPOWEROF2(x) ((((x)-1)&(x)) == 0)
361 363
362/* bit map related macros */ 364/* map physical to virtual I/O */
365#if !defined(CONFIG_MMC_MSM7X00A)
366#define REG_MAP(pa, size) ioremap_nocache((unsigned long)(pa), \
367 (unsigned long)(size))
368#else
369#define REG_MAP(pa, size) (void *)(0)
370#endif
371
372/* Register operations */
373#define AND_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) & (v))
374#define OR_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) | (v))
375
376#define SET_REG(osh, r, mask, val) \
377 W_REG((osh), (r), ((R_REG((osh), r) & ~(mask)) | (val)))
378
363#ifndef setbit 379#ifndef setbit
364#ifndef NBBY /* the BSD family defines NBBY */ 380#ifndef NBBY /* the BSD family defines NBBY */
365#define NBBY 8 /* 8 bits per byte */ 381#define NBBY 8 /* 8 bits per byte */
diff --git a/drivers/staging/brcm80211/include/d11.h b/drivers/staging/brcm80211/include/d11.h
index c07548c70e3..be2d4970407 100644
--- a/drivers/staging/brcm80211/include/d11.h
+++ b/drivers/staging/brcm80211/include/d11.h
@@ -17,13 +17,6 @@
17#ifndef _D11_H 17#ifndef _D11_H
18#define _D11_H 18#define _D11_H
19 19
20#include <bcmdefs.h>
21#include <bcmdevs.h>
22#include <hndsoc.h>
23#include <sbhndpio.h>
24#include <sbhnddma.h>
25#include <proto/802.11.h>
26
27/* This marks the start of a packed structure section. */ 20/* This marks the start of a packed structure section. */
28#include <packed_section_start.h> 21#include <packed_section_start.h>
29 22
diff --git a/drivers/staging/brcm80211/include/dbus.h b/drivers/staging/brcm80211/include/dbus.h
deleted file mode 100644
index 81ffea79d00..00000000000
--- a/drivers/staging/brcm80211/include/dbus.h
+++ /dev/null
@@ -1,353 +0,0 @@
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef __DBUS_H__
18#define __DBUS_H__
19
20#ifdef BCMDBG
21#define DBUSERR(args) do { if (net_ratelimit()) printf args; } while (0)
22#define DBUSTRACE(args)
23#define DBUSDBGLOCK(args)
24
25#else
26#define DBUSTRACE(args)
27#define DBUSERR(args)
28#define DBUSDBGLOCK(args)
29#endif
30
31enum {
32 DBUS_OK = 0,
33 DBUS_ERR = -200,
34 DBUS_ERR_TIMEOUT,
35 DBUS_ERR_DISCONNECT,
36 DBUS_ERR_NODEVICE,
37 DBUS_ERR_UNSUPPORTED,
38 DBUS_ERR_PENDING,
39 DBUS_ERR_NOMEM,
40 DBUS_ERR_TXFAIL,
41 DBUS_ERR_TXTIMEOUT,
42 DBUS_ERR_TXDROP,
43 DBUS_ERR_RXFAIL,
44 DBUS_ERR_RXDROP,
45 DBUS_ERR_TXCTLFAIL,
46 DBUS_ERR_RXCTLFAIL,
47 DBUS_ERR_REG_PARAM,
48 DBUS_STATUS_CANCELLED
49};
50
51#define ERR_CBMASK_TXFAIL 0x00000001
52#define ERR_CBMASK_RXFAIL 0x00000002
53#define ERR_CBMASK_ALL 0xFFFFFFFF
54
55#define DBUS_CBCTL_WRITE 0
56#define DBUS_CBCTL_READ 1
57
58#define DBUS_TX_RETRY_LIMIT 3 /* retries for failed txirb */
59#define DBUS_TX_TIMEOUT_INTERVAL 250 /* timeout for txirb complete, in ms */
60
61#define DBUS_BUFFER_SIZE_TX 5000
62#define DBUS_BUFFER_SIZE_RX 5000
63
64#define DBUS_BUFFER_SIZE_TX_NOAGG 2048
65#define DBUS_BUFFER_SIZE_RX_NOAGG 2048
66
67/* DBUS types */
68enum {
69 DBUS_USB,
70 DBUS_SDIO,
71 DBUS_SPI,
72 DBUS_UNKNOWN
73};
74
75enum dbus_state {
76 DBUS_STATE_DL_PENDING,
77 DBUS_STATE_DL_DONE,
78 DBUS_STATE_UP,
79 DBUS_STATE_DOWN,
80 DBUS_STATE_PNP_FWDL,
81 DBUS_STATE_DISCONNECT
82};
83
84enum dbus_pnp_state {
85 DBUS_PNP_DISCONNECT,
86 DBUS_PNP_SLEEP,
87 DBUS_PNP_RESUME
88};
89
90typedef enum _DEVICE_SPEED {
91 INVALID_SPEED = -1,
92 LOW_SPEED = 1, /* USB 1.1: 1.5 Mbps */
93 FULL_SPEED, /* USB 1.1: 12 Mbps */
94 HIGH_SPEED, /* USB 2.0: 480 Mbps */
95 SUPER_SPEED, /* USB 3.0: 4.8 Gbps */
96} DEVICE_SPEED;
97
98typedef struct {
99 int bustype;
100 int vid;
101 int pid;
102 int devid;
103 int chiprev; /* chip revsion number */
104 int mtu;
105 int nchan; /* Data Channels */
106} dbus_attrib_t;
107
108/* FIX: Account for errors related to DBUS;
109 * Let upper layer account for packets/bytes
110 */
111typedef struct {
112 u32 rx_errors;
113 u32 tx_errors;
114 u32 rx_dropped;
115 u32 tx_dropped;
116} dbus_stats_t;
117
118/*
119 * Configurable BUS parameters
120 */
121typedef struct {
122 bool rxctl_deferrespok;
123} dbus_config_t;
124
125struct dbus_callbacks;
126struct exec_parms;
127
128typedef void *(*probe_cb_t) (void *arg, const char *desc, u32 bustype,
129 u32 hdrlen);
130typedef void (*disconnect_cb_t) (void *arg);
131typedef void *(*exec_cb_t) (struct exec_parms *args);
132
133/* Client callbacks registered during dbus_attach() */
134typedef struct dbus_callbacks {
135 void (*send_complete) (void *cbarg, void *info, int status);
136 void (*recv_buf) (void *cbarg, u8 *buf, int len);
137 void (*recv_pkt) (void *cbarg, void *pkt);
138 void (*txflowcontrol) (void *cbarg, bool onoff);
139 void (*errhandler) (void *cbarg, int err);
140 void (*ctl_complete) (void *cbarg, int type, int status);
141 void (*state_change) (void *cbarg, int state);
142 void *(*pktget) (void *cbarg, uint len, bool send);
143 void (*pktfree) (void *cbarg, void *p, bool send);
144} dbus_callbacks_t;
145
146struct dbus_pub;
147struct bcmstrbuf;
148struct dbus_irb;
149struct dbus_irb_rx;
150struct dbus_irb_tx;
151struct dbus_intf_callbacks;
152
153typedef struct {
154 void *(*attach) (struct dbus_pub *pub, void *cbarg,
155 struct dbus_intf_callbacks *cbs);
156 void (*detach) (struct dbus_pub *pub, void *bus);
157
158 int (*up) (void *bus);
159 int (*down) (void *bus);
160 int (*send_irb) (void *bus, struct dbus_irb_tx *txirb);
161 int (*recv_irb) (void *bus, struct dbus_irb_rx *rxirb);
162 int (*cancel_irb) (void *bus, struct dbus_irb_tx *txirb);
163 int (*send_ctl) (void *bus, u8 *buf, int len);
164 int (*recv_ctl) (void *bus, u8 *buf, int len);
165 int (*get_stats) (void *bus, dbus_stats_t *stats);
166 int (*get_attrib) (void *bus, dbus_attrib_t *attrib);
167
168 int (*pnp) (void *bus, int event);
169 int (*remove) (void *bus);
170 int (*resume) (void *bus);
171 int (*suspend) (void *bus);
172 int (*stop) (void *bus);
173 int (*reset) (void *bus);
174
175 /* Access to bus buffers directly */
176 void *(*pktget) (void *bus, int len);
177 void (*pktfree) (void *bus, void *pkt);
178
179 int (*iovar_op) (void *bus, const char *name, void *params, int plen,
180 void *arg, int len, bool set);
181 void (*dump) (void *bus, struct bcmstrbuf *strbuf);
182 int (*set_config) (void *bus, dbus_config_t *config);
183 int (*get_config) (void *bus, dbus_config_t *config);
184
185 bool(*device_exists) (void *bus);
186 bool(*dlneeded) (void *bus);
187 int (*dlstart) (void *bus, u8 *fw, int len);
188 int (*dlrun) (void *bus);
189 bool(*recv_needed) (void *bus);
190
191 void *(*exec_rxlock) (void *bus, exec_cb_t func,
192 struct exec_parms *args);
193 void *(*exec_txlock) (void *bus, exec_cb_t func,
194 struct exec_parms *args);
195
196 int (*tx_timer_init) (void *bus);
197 int (*tx_timer_start) (void *bus, uint timeout);
198 int (*tx_timer_stop) (void *bus);
199
200 int (*sched_dpc) (void *bus);
201 int (*lock) (void *bus);
202 int (*unlock) (void *bus);
203 int (*sched_probe_cb) (void *bus);
204
205 int (*shutdown) (void *bus);
206
207 int (*recv_stop) (void *bus);
208 int (*recv_resume) (void *bus);
209
210 /* Add from the bottom */
211} dbus_intf_t;
212
213typedef struct dbus_pub {
214 struct osl_info *osh;
215 dbus_stats_t stats;
216 dbus_attrib_t attrib;
217 enum dbus_state busstate;
218 DEVICE_SPEED device_speed;
219 int ntxq, nrxq, rxsize;
220 void *bus;
221 struct shared_info *sh;
222} dbus_pub_t;
223
224#define BUS_INFO(bus, type) (((type *) bus)->pub->bus)
225
226/*
227 * Public Bus Function Interface
228 */
229extern int dbus_register(int vid, int pid, probe_cb_t prcb,
230 disconnect_cb_t discb, void *prarg, void *param1,
231 void *param2);
232extern int dbus_deregister(void);
233
234extern const dbus_pub_t *dbus_attach(struct osl_info *osh, int rxsize, int nrxq,
235 int ntxq, void *cbarg,
236 dbus_callbacks_t *cbs,
237 struct shared_info *sh);
238extern void dbus_detach(const dbus_pub_t *pub);
239
240extern int dbus_up(const dbus_pub_t *pub);
241extern int dbus_down(const dbus_pub_t *pub);
242extern int dbus_stop(const dbus_pub_t *pub);
243extern int dbus_shutdown(const dbus_pub_t *pub);
244extern void dbus_flowctrl_rx(const dbus_pub_t *pub, bool on);
245
246extern int dbus_send_buf(const dbus_pub_t *pub, u8 *buf, int len,
247 void *info);
248extern int dbus_send_pkt(const dbus_pub_t *pub, void *pkt, void *info);
249extern int dbus_send_ctl(const dbus_pub_t *pub, u8 *buf, int len);
250extern int dbus_recv_ctl(const dbus_pub_t *pub, u8 *buf, int len);
251
252extern int dbus_get_stats(const dbus_pub_t *pub, dbus_stats_t *stats);
253extern int dbus_get_attrib(const dbus_pub_t *pub, dbus_attrib_t *attrib);
254extern int dbus_get_device_speed(const dbus_pub_t *pub);
255extern int dbus_set_config(const dbus_pub_t *pub, dbus_config_t *config);
256extern int dbus_get_config(const dbus_pub_t *pub, dbus_config_t *config);
257
258extern void *dbus_pktget(const dbus_pub_t *pub, int len);
259extern void dbus_pktfree(const dbus_pub_t *pub, void *pkt);
260
261extern int dbus_set_errmask(const dbus_pub_t *pub, u32 mask);
262extern int dbus_pnp_sleep(const dbus_pub_t *pub);
263extern int dbus_pnp_resume(const dbus_pub_t *pub, int *fw_reload);
264extern int dbus_pnp_disconnect(const dbus_pub_t *pub);
265
266extern int dbus_iovar_op(const dbus_pub_t *pub, const char *name,
267 void *params, int plen, void *arg, int len, bool set);
268#ifdef BCMDBG
269extern void dbus_hist_dump(const dbus_pub_t *pub, struct bcmstrbuf *b);
270#endif /* BCMDBG */
271/*
272 * Private Common Bus Interface
273 */
274
275/* IO Request Block (IRB) */
276typedef struct dbus_irb {
277 struct dbus_irb *next; /* it's casted from dbus_irb_tx or dbus_irb_rx struct */
278} dbus_irb_t;
279
280typedef struct dbus_irb_rx {
281 struct dbus_irb irb; /* Must be first */
282 u8 *buf;
283 int buf_len;
284 int actual_len;
285 void *pkt;
286 void *info;
287 void *arg;
288} dbus_irb_rx_t;
289
290typedef struct dbus_irb_tx {
291 struct dbus_irb irb; /* Must be first */
292 u8 *buf;
293 int len;
294 void *pkt;
295 int retry_count;
296 void *info;
297 void *arg;
298} dbus_irb_tx_t;
299
300/* DBUS interface callbacks are different from user callbacks
301 * so, internally, different info can be passed to upper layer
302 */
303typedef struct dbus_intf_callbacks {
304 void (*send_irb_timeout) (void *cbarg, dbus_irb_tx_t *txirb);
305 void (*send_irb_complete) (void *cbarg, dbus_irb_tx_t *txirb,
306 int status);
307 void (*recv_irb_complete) (void *cbarg, dbus_irb_rx_t *rxirb,
308 int status);
309 void (*errhandler) (void *cbarg, int err);
310 void (*ctl_complete) (void *cbarg, int type, int status);
311 void (*state_change) (void *cbarg, int state);
312 bool(*isr) (void *cbarg, bool *wantdpc);
313 bool(*dpc) (void *cbarg, bool bounded);
314 void (*watchdog) (void *cbarg);
315 void *(*pktget) (void *cbarg, uint len, bool send);
316 void (*pktfree) (void *cbarg, void *p, bool send);
317 struct dbus_irb *(*getirb) (void *cbarg, bool send);
318 void (*rxerr_indicate) (void *cbarg, bool on);
319} dbus_intf_callbacks_t;
320
321/*
322 * Porting: To support new bus, port these functions below
323 */
324
325/*
326 * Bus specific Interface
327 * Implemented by dbus_usb.c/dbus_sdio.c
328 */
329extern int dbus_bus_register(int vid, int pid, probe_cb_t prcb,
330 disconnect_cb_t discb, void *prarg,
331 dbus_intf_t **intf, void *param1, void *param2);
332extern int dbus_bus_deregister(void);
333
334/*
335 * Bus-specific and OS-specific Interface
336 * Implemented by dbus_usb_[linux/ndis].c/dbus_sdio_[linux/ndis].c
337 */
338extern int dbus_bus_osl_register(int vid, int pid, probe_cb_t prcb,
339 disconnect_cb_t discb, void *prarg,
340 dbus_intf_t **intf, void *param1,
341 void *param2);
342extern int dbus_bus_osl_deregister(void);
343
344/*
345 * Bus-specific, OS-specific, HW-specific Interface
346 * Mainly for SDIO Host HW controller
347 */
348extern int dbus_bus_osl_hw_register(int vid, int pid, probe_cb_t prcb,
349 disconnect_cb_t discb, void *prarg,
350 dbus_intf_t **intf);
351extern int dbus_bus_osl_hw_deregister(void);
352
353#endif /* __DBUS_H__ */
diff --git a/drivers/staging/brcm80211/include/epivers.h b/drivers/staging/brcm80211/include/epivers.h
deleted file mode 100644
index 2e6b5190ad6..00000000000
--- a/drivers/staging/brcm80211/include/epivers.h
+++ /dev/null
@@ -1,44 +0,0 @@
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _epivers_h_
18#define _epivers_h_
19
20#define EPI_MAJOR_VERSION 5
21
22#define EPI_MINOR_VERSION 75
23
24#define EPI_RC_NUMBER 11
25
26#define EPI_INCREMENTAL_NUMBER 0
27
28#define EPI_BUILD_NUMBER 1
29
30#define EPI_VERSION { 5, 75, 11, 0 }
31
32#ifdef BCMSDIO
33/* EPI_VERSION_NUM must match FW version */
34#define EPI_VERSION_NUM 0x054b0c00
35#else
36#define EPI_VERSION_NUM 0x054b0b00
37#endif
38
39#define EPI_VERSION_DEV 5.75.11
40
41/* Driver Version String, ASCII, 32 chars max */
42#define EPI_VERSION_STR "5.75.11"
43
44#endif /* _epivers_h_ */
diff --git a/drivers/staging/brcm80211/include/hnddma.h b/drivers/staging/brcm80211/include/hnddma.h
index bee4c89be23..4c5462baf11 100644
--- a/drivers/staging/brcm80211/include/hnddma.h
+++ b/drivers/staging/brcm80211/include/hnddma.h
@@ -19,7 +19,7 @@
19 19
20#ifndef _hnddma_pub_ 20#ifndef _hnddma_pub_
21#define _hnddma_pub_ 21#define _hnddma_pub_
22typedef const struct hnddma_pub hnddma_t; 22struct hnddma_pub;
23#endif /* _hnddma_pub_ */ 23#endif /* _hnddma_pub_ */
24 24
25/* range param for dma_getnexttxp() and dma_txreclaim */ 25/* range param for dma_getnexttxp() and dma_txreclaim */
@@ -30,52 +30,54 @@ typedef enum txd_range {
30} txd_range_t; 30} txd_range_t;
31 31
32/* dma function type */ 32/* dma function type */
33typedef void (*di_detach_t) (hnddma_t *dmah); 33typedef void (*di_detach_t) (struct hnddma_pub *dmah);
34typedef bool(*di_txreset_t) (hnddma_t *dmah); 34typedef bool(*di_txreset_t) (struct hnddma_pub *dmah);
35typedef bool(*di_rxreset_t) (hnddma_t *dmah); 35typedef bool(*di_rxreset_t) (struct hnddma_pub *dmah);
36typedef bool(*di_rxidle_t) (hnddma_t *dmah); 36typedef bool(*di_rxidle_t) (struct hnddma_pub *dmah);
37typedef void (*di_txinit_t) (hnddma_t *dmah); 37typedef void (*di_txinit_t) (struct hnddma_pub *dmah);
38typedef bool(*di_txenabled_t) (hnddma_t *dmah); 38typedef bool(*di_txenabled_t) (struct hnddma_pub *dmah);
39typedef void (*di_rxinit_t) (hnddma_t *dmah); 39typedef void (*di_rxinit_t) (struct hnddma_pub *dmah);
40typedef void (*di_txsuspend_t) (hnddma_t *dmah); 40typedef void (*di_txsuspend_t) (struct hnddma_pub *dmah);
41typedef void (*di_txresume_t) (hnddma_t *dmah); 41typedef void (*di_txresume_t) (struct hnddma_pub *dmah);
42typedef bool(*di_txsuspended_t) (hnddma_t *dmah); 42typedef bool(*di_txsuspended_t) (struct hnddma_pub *dmah);
43typedef bool(*di_txsuspendedidle_t) (hnddma_t *dmah); 43typedef bool(*di_txsuspendedidle_t) (struct hnddma_pub *dmah);
44typedef int (*di_txfast_t) (hnddma_t *dmah, void *p, bool commit); 44typedef int (*di_txfast_t) (struct hnddma_pub *dmah, struct sk_buff *p,
45typedef int (*di_txunframed_t) (hnddma_t *dmah, void *p, uint len, 45 bool commit);
46typedef int (*di_txunframed_t) (struct hnddma_pub *dmah, void *p, uint len,
46 bool commit); 47 bool commit);
47typedef void *(*di_getpos_t) (hnddma_t *di, bool direction); 48typedef void *(*di_getpos_t) (struct hnddma_pub *di, bool direction);
48typedef void (*di_fifoloopbackenable_t) (hnddma_t *dmah); 49typedef void (*di_fifoloopbackenable_t) (struct hnddma_pub *dmah);
49typedef bool(*di_txstopped_t) (hnddma_t *dmah); 50typedef bool(*di_txstopped_t) (struct hnddma_pub *dmah);
50typedef bool(*di_rxstopped_t) (hnddma_t *dmah); 51typedef bool(*di_rxstopped_t) (struct hnddma_pub *dmah);
51typedef bool(*di_rxenable_t) (hnddma_t *dmah); 52typedef bool(*di_rxenable_t) (struct hnddma_pub *dmah);
52typedef bool(*di_rxenabled_t) (hnddma_t *dmah); 53typedef bool(*di_rxenabled_t) (struct hnddma_pub *dmah);
53typedef void *(*di_rx_t) (hnddma_t *dmah); 54typedef void *(*di_rx_t) (struct hnddma_pub *dmah);
54typedef bool(*di_rxfill_t) (hnddma_t *dmah); 55typedef bool(*di_rxfill_t) (struct hnddma_pub *dmah);
55typedef void (*di_txreclaim_t) (hnddma_t *dmah, txd_range_t range); 56typedef void (*di_txreclaim_t) (struct hnddma_pub *dmah, txd_range_t range);
56typedef void (*di_rxreclaim_t) (hnddma_t *dmah); 57typedef void (*di_rxreclaim_t) (struct hnddma_pub *dmah);
57typedef unsigned long (*di_getvar_t) (hnddma_t *dmah, const char *name); 58typedef unsigned long (*di_getvar_t) (struct hnddma_pub *dmah,
58typedef void *(*di_getnexttxp_t) (hnddma_t *dmah, txd_range_t range); 59 const char *name);
59typedef void *(*di_getnextrxp_t) (hnddma_t *dmah, bool forceall); 60typedef void *(*di_getnexttxp_t) (struct hnddma_pub *dmah, txd_range_t range);
60typedef void *(*di_peeknexttxp_t) (hnddma_t *dmah); 61typedef void *(*di_getnextrxp_t) (struct hnddma_pub *dmah, bool forceall);
61typedef void *(*di_peeknextrxp_t) (hnddma_t *dmah); 62typedef void *(*di_peeknexttxp_t) (struct hnddma_pub *dmah);
62typedef void (*di_rxparam_get_t) (hnddma_t *dmah, u16 *rxoffset, 63typedef void *(*di_peeknextrxp_t) (struct hnddma_pub *dmah);
64typedef void (*di_rxparam_get_t) (struct hnddma_pub *dmah, u16 *rxoffset,
63 u16 *rxbufsize); 65 u16 *rxbufsize);
64typedef void (*di_txblock_t) (hnddma_t *dmah); 66typedef void (*di_txblock_t) (struct hnddma_pub *dmah);
65typedef void (*di_txunblock_t) (hnddma_t *dmah); 67typedef void (*di_txunblock_t) (struct hnddma_pub *dmah);
66typedef uint(*di_txactive_t) (hnddma_t *dmah); 68typedef uint(*di_txactive_t) (struct hnddma_pub *dmah);
67typedef void (*di_txrotate_t) (hnddma_t *dmah); 69typedef void (*di_txrotate_t) (struct hnddma_pub *dmah);
68typedef void (*di_counterreset_t) (hnddma_t *dmah); 70typedef void (*di_counterreset_t) (struct hnddma_pub *dmah);
69typedef uint(*di_ctrlflags_t) (hnddma_t *dmah, uint mask, uint flags); 71typedef uint(*di_ctrlflags_t) (struct hnddma_pub *dmah, uint mask, uint flags);
70typedef char *(*di_dump_t) (hnddma_t *dmah, struct bcmstrbuf *b, 72typedef char *(*di_dump_t) (struct hnddma_pub *dmah, struct bcmstrbuf *b,
71 bool dumpring); 73 bool dumpring);
72typedef char *(*di_dumptx_t) (hnddma_t *dmah, struct bcmstrbuf *b, 74typedef char *(*di_dumptx_t) (struct hnddma_pub *dmah, struct bcmstrbuf *b,
73 bool dumpring); 75 bool dumpring);
74typedef char *(*di_dumprx_t) (hnddma_t *dmah, struct bcmstrbuf *b, 76typedef char *(*di_dumprx_t) (struct hnddma_pub *dmah, struct bcmstrbuf *b,
75 bool dumpring); 77 bool dumpring);
76typedef uint(*di_rxactive_t) (hnddma_t *dmah); 78typedef uint(*di_rxactive_t) (struct hnddma_pub *dmah);
77typedef uint(*di_txpending_t) (hnddma_t *dmah); 79typedef uint(*di_txpending_t) (struct hnddma_pub *dmah);
78typedef uint(*di_txcommitted_t) (hnddma_t *dmah); 80typedef uint(*di_txcommitted_t) (struct hnddma_pub *dmah);
79 81
80/* dma opsvec */ 82/* dma opsvec */
81typedef struct di_fcn_s { 83typedef struct di_fcn_s {
@@ -141,7 +143,8 @@ struct hnddma_pub {
141 uint txnobuf; /* tx out of dma descriptors */ 143 uint txnobuf; /* tx out of dma descriptors */
142}; 144};
143 145
144extern hnddma_t *dma_attach(osl_t *osh, char *name, si_t *sih, 146extern struct hnddma_pub *dma_attach(struct osl_info *osh, char *name,
147 si_t *sih,
145 void *dmaregstx, void *dmaregsrx, uint ntxd, 148 void *dmaregstx, void *dmaregsrx, uint ntxd,
146 uint nrxd, uint rxbufsize, int rxextheadroom, 149 uint nrxd, uint rxbufsize, int rxextheadroom,
147 uint nrxpost, uint rxoffset, uint *msg_level); 150 uint nrxpost, uint rxoffset, uint *msg_level);
@@ -238,6 +241,6 @@ extern const di_fcn_t dma64proc;
238extern uint dma_addrwidth(si_t *sih, void *dmaregs); 241extern uint dma_addrwidth(si_t *sih, void *dmaregs);
239 242
240/* pio helpers */ 243/* pio helpers */
241extern void dma_txpioloopback(osl_t *osh, dma32regs_t *); 244extern void dma_txpioloopback(struct osl_info *osh, dma32regs_t *);
242 245
243#endif /* _hnddma_h_ */ 246#endif /* _hnddma_h_ */
diff --git a/drivers/staging/brcm80211/include/hndpmu.h b/drivers/staging/brcm80211/include/hndpmu.h
index bbcf0eecd21..a0110e4c9ac 100644
--- a/drivers/staging/brcm80211/include/hndpmu.h
+++ b/drivers/staging/brcm80211/include/hndpmu.h
@@ -28,44 +28,44 @@
28#define SET_LDO_VOLTAGE_LNLDO1 9 28#define SET_LDO_VOLTAGE_LNLDO1 9
29#define SET_LDO_VOLTAGE_LNLDO2_SEL 10 29#define SET_LDO_VOLTAGE_LNLDO2_SEL 10
30 30
31extern void si_pmu_init(si_t *sih, osl_t *osh); 31extern void si_pmu_init(si_t *sih, struct osl_info *osh);
32extern void si_pmu_chip_init(si_t *sih, osl_t *osh); 32extern void si_pmu_chip_init(si_t *sih, struct osl_info *osh);
33extern void si_pmu_pll_init(si_t *sih, osl_t *osh, u32 xtalfreq); 33extern void si_pmu_pll_init(si_t *sih, struct osl_info *osh, u32 xtalfreq);
34extern void si_pmu_res_init(si_t *sih, osl_t *osh); 34extern void si_pmu_res_init(si_t *sih, struct osl_info *osh);
35extern void si_pmu_swreg_init(si_t *sih, osl_t *osh); 35extern void si_pmu_swreg_init(si_t *sih, struct osl_info *osh);
36 36
37extern u32 si_pmu_force_ilp(si_t *sih, osl_t *osh, bool force); 37extern u32 si_pmu_force_ilp(si_t *sih, struct osl_info *osh, bool force);
38 38
39extern u32 si_pmu_si_clock(si_t *sih, osl_t *osh); 39extern u32 si_pmu_si_clock(si_t *sih, struct osl_info *osh);
40extern u32 si_pmu_cpu_clock(si_t *sih, osl_t *osh); 40extern u32 si_pmu_cpu_clock(si_t *sih, struct osl_info *osh);
41extern u32 si_pmu_mem_clock(si_t *sih, osl_t *osh); 41extern u32 si_pmu_mem_clock(si_t *sih, struct osl_info *osh);
42extern u32 si_pmu_alp_clock(si_t *sih, osl_t *osh); 42extern u32 si_pmu_alp_clock(si_t *sih, struct osl_info *osh);
43extern u32 si_pmu_ilp_clock(si_t *sih, osl_t *osh); 43extern u32 si_pmu_ilp_clock(si_t *sih, struct osl_info *osh);
44 44
45extern void si_pmu_set_switcher_voltage(si_t *sih, osl_t *osh, 45extern void si_pmu_set_switcher_voltage(si_t *sih, struct osl_info *osh,
46 u8 bb_voltage, u8 rf_voltage); 46 u8 bb_voltage, u8 rf_voltage);
47extern void si_pmu_set_ldo_voltage(si_t *sih, osl_t *osh, u8 ldo, 47extern void si_pmu_set_ldo_voltage(si_t *sih, struct osl_info *osh, u8 ldo,
48 u8 voltage); 48 u8 voltage);
49extern u16 si_pmu_fast_pwrup_delay(si_t *sih, osl_t *osh); 49extern u16 si_pmu_fast_pwrup_delay(si_t *sih, struct osl_info *osh);
50extern void si_pmu_rcal(si_t *sih, osl_t *osh); 50extern void si_pmu_rcal(si_t *sih, struct osl_info *osh);
51extern void si_pmu_pllupd(si_t *sih); 51extern void si_pmu_pllupd(si_t *sih);
52extern void si_pmu_spuravoid(si_t *sih, osl_t *osh, u8 spuravoid); 52extern void si_pmu_spuravoid(si_t *sih, struct osl_info *osh, u8 spuravoid);
53 53
54extern bool si_pmu_is_otp_powered(si_t *sih, osl_t *osh); 54extern bool si_pmu_is_otp_powered(si_t *sih, struct osl_info *osh);
55extern u32 si_pmu_measure_alpclk(si_t *sih, osl_t *osh); 55extern u32 si_pmu_measure_alpclk(si_t *sih, struct osl_info *osh);
56 56
57extern u32 si_pmu_chipcontrol(si_t *sih, uint reg, u32 mask, u32 val); 57extern u32 si_pmu_chipcontrol(si_t *sih, uint reg, u32 mask, u32 val);
58extern u32 si_pmu_regcontrol(si_t *sih, uint reg, u32 mask, u32 val); 58extern u32 si_pmu_regcontrol(si_t *sih, uint reg, u32 mask, u32 val);
59extern u32 si_pmu_pllcontrol(si_t *sih, uint reg, u32 mask, u32 val); 59extern u32 si_pmu_pllcontrol(si_t *sih, uint reg, u32 mask, u32 val);
60extern void si_pmu_pllupd(si_t *sih); 60extern void si_pmu_pllupd(si_t *sih);
61extern void si_pmu_sprom_enable(si_t *sih, osl_t *osh, bool enable); 61extern void si_pmu_sprom_enable(si_t *sih, struct osl_info *osh, bool enable);
62 62
63extern void si_pmu_radio_enable(si_t *sih, bool enable); 63extern void si_pmu_radio_enable(si_t *sih, bool enable);
64extern u32 si_pmu_waitforclk_on_backplane(si_t *sih, osl_t *osh, 64extern u32 si_pmu_waitforclk_on_backplane(si_t *sih, struct osl_info *osh,
65 u32 clk, u32 delay); 65 u32 clk, u32 delay);
66 66
67extern void si_pmu_otp_power(si_t *sih, osl_t *osh, bool on); 67extern void si_pmu_otp_power(si_t *sih, struct osl_info *osh, bool on);
68extern void si_sdiod_drive_strength_init(si_t *sih, osl_t *osh, 68extern void si_sdiod_drive_strength_init(si_t *sih, struct osl_info *osh,
69 u32 drivestrength); 69 u32 drivestrength);
70 70
71#endif /* _hndpmu_h_ */ 71#endif /* _hndpmu_h_ */
diff --git a/drivers/staging/brcm80211/include/linux_osl.h b/drivers/staging/brcm80211/include/linux_osl.h
deleted file mode 100644
index c9c860b6e47..00000000000
--- a/drivers/staging/brcm80211/include/linux_osl.h
+++ /dev/null
@@ -1,407 +0,0 @@
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _linux_osl_h_
18#define _linux_osl_h_
19
20
21/* Linux Kernel: File Operations: start */
22extern void *osl_os_open_image(char *filename);
23extern int osl_os_get_image_block(char *buf, int len, void *image);
24extern void osl_os_close_image(void *image);
25/* Linux Kernel: File Operations: end */
26
27extern osl_t *osl_attach(void *pdev, uint bustype, bool pkttag);
28extern void osl_detach(osl_t *osh);
29
30extern u32 g_assert_type;
31
32#if defined(BCMDBG_ASSERT)
33#define ASSERT(exp) \
34 do { if (!(exp)) osl_assert(#exp, __FILE__, __LINE__); } while (0)
35extern void osl_assert(char *exp, char *file, int line);
36#else
37#ifdef __GNUC__
38#define GCC_VERSION \
39 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
40#if GCC_VERSION > 30100
41#define ASSERT(exp) do {} while (0)
42#else
43 /* ASSERT could cause segmentation fault on GCC3.1, use empty instead */
44#define ASSERT(exp)
45#endif /* GCC_VERSION > 30100 */
46#endif /* __GNUC__ */
47#endif /* defined(BCMDBG_ASSERT) */
48
49/* PCI configuration space access macros */
50#define OSL_PCI_READ_CONFIG(osh, offset, size) \
51 osl_pci_read_config((osh), (offset), (size))
52#define OSL_PCI_WRITE_CONFIG(osh, offset, size, val) \
53 osl_pci_write_config((osh), (offset), (size), (val))
54extern u32 osl_pci_read_config(osl_t *osh, uint offset, uint size);
55extern void osl_pci_write_config(osl_t *osh, uint offset, uint size, uint val);
56
57/* PCI device bus # and slot # */
58#define OSL_PCI_BUS(osh) osl_pci_bus(osh)
59#define OSL_PCI_SLOT(osh) osl_pci_slot(osh)
60extern uint osl_pci_bus(osl_t *osh);
61extern uint osl_pci_slot(osl_t *osh);
62
63/* Pkttag flag should be part of public information */
64typedef struct {
65 bool pkttag;
66 uint pktalloced; /* Number of allocated packet buffers */
67 bool mmbus; /* Bus supports memory-mapped register accesses */
68 pktfree_cb_fn_t tx_fn; /* Callback function for PKTFREE */
69 void *tx_ctx; /* Context to the callback function */
70#if defined(BCMSDIO) && !defined(BRCM_FULLMAC)
71 osl_rreg_fn_t rreg_fn; /* Read Register function */
72 osl_wreg_fn_t wreg_fn; /* Write Register function */
73 void *reg_ctx; /* Context to the reg callback functions */
74#endif
75} osl_pubinfo_t;
76
77#define PKTFREESETCB(osh, _tx_fn, _tx_ctx) \
78 do { \
79 ((osl_pubinfo_t *)osh)->tx_fn = _tx_fn; \
80 ((osl_pubinfo_t *)osh)->tx_ctx = _tx_ctx; \
81 } while (0)
82
83#if defined(BCMSDIO) && !defined(BRCM_FULLMAC)
84#define REGOPSSET(osh, rreg, wreg, ctx) \
85 do { \
86 ((osl_pubinfo_t *)osh)->rreg_fn = rreg; \
87 ((osl_pubinfo_t *)osh)->wreg_fn = wreg; \
88 ((osl_pubinfo_t *)osh)->reg_ctx = ctx; \
89 } while (0)
90#endif
91
92#define BUS_SWAP32(v) (v)
93
94#define DMA_CONSISTENT_ALIGN osl_dma_consistent_align()
95extern uint osl_dma_consistent_align(void);
96extern void *osl_dma_alloc_consistent(osl_t *osh, uint size, u16 align,
97 uint *tot, unsigned long *pap);
98
99#ifdef BRCM_FULLMAC
100#define DMA_ALLOC_CONSISTENT(osh, size, pap, dmah, alignbits) \
101 osl_dma_alloc_consistent((osh), (size), (0), (tot), (pap))
102#else
103#define DMA_ALLOC_CONSISTENT(osh, size, align, tot, pap, dmah) \
104 osl_dma_alloc_consistent((osh), (size), (align), (tot), (pap))
105#endif /* BRCM_FULLMAC */
106
107#define DMA_FREE_CONSISTENT(osh, va, size, pa, dmah) \
108 osl_dma_free_consistent((osh), (void *)(va), (size), (pa))
109extern void osl_dma_free_consistent(osl_t *osh, void *va, uint size, unsigned long pa);
110
111/* map/unmap direction */
112#define DMA_TX 1 /* TX direction for DMA */
113#define DMA_RX 2 /* RX direction for DMA */
114
115/* map/unmap shared (dma-able) memory */
116#define DMA_MAP(osh, va, size, direction, p, dmah) \
117 osl_dma_map((osh), (va), (size), (direction))
118#define DMA_UNMAP(osh, pa, size, direction, p, dmah) \
119 osl_dma_unmap((osh), (pa), (size), (direction))
120extern uint osl_dma_map(osl_t *osh, void *va, uint size, int direction);
121extern void osl_dma_unmap(osl_t *osh, uint pa, uint size, int direction);
122
123/* API for DMA addressing capability */
124#define OSL_DMADDRWIDTH(osh, addrwidth) do {} while (0)
125
126/* register access macros */
127#if defined(BCMSDIO)
128#ifdef BRCM_FULLMAC
129#include <bcmsdh.h>
130#endif
131#define OSL_WRITE_REG(osh, r, v) (bcmsdh_reg_write(NULL, (unsigned long)(r), sizeof(*(r)), (v)))
132#define OSL_READ_REG(osh, r) (bcmsdh_reg_read(NULL, (unsigned long)(r), sizeof(*(r))))
133#endif
134
135#if defined(BCMSDIO)
136#define SELECT_BUS_WRITE(osh, mmap_op, bus_op) if (((osl_pubinfo_t *)(osh))->mmbus) \
137 mmap_op else bus_op
138#define SELECT_BUS_READ(osh, mmap_op, bus_op) (((osl_pubinfo_t *)(osh))->mmbus) ? \
139 mmap_op : bus_op
140#else
141#define SELECT_BUS_WRITE(osh, mmap_op, bus_op) mmap_op
142#define SELECT_BUS_READ(osh, mmap_op, bus_op) mmap_op
143#endif
144
145#define OSL_ERROR(bcmerror) osl_error(bcmerror)
146extern int osl_error(int bcmerror);
147
148/* the largest reasonable packet buffer driver uses for ethernet MTU in bytes */
149#define PKTBUFSZ 2048 /* largest reasonable packet buffer, driver uses for ethernet MTU */
150
151#define OSL_SYSUPTIME() ((u32)jiffies * (1000 / HZ))
152#define printf(fmt, args...) printk(fmt , ## args)
153#ifdef BRCM_FULLMAC
154#include <linux/kernel.h> /* for vsn/printf's */
155#include <linux/string.h> /* for mem*, str* */
156#endif
157/* bcopy's: Linux kernel doesn't provide these (anymore) */
158#define bcopy(src, dst, len) memcpy((dst), (src), (len))
159#define bcmp(b1, b2, len) memcmp((b1), (b2), (len))
160#define bzero(b, len) memset((b), '\0', (len))
161
162/* register access macros */
163#if defined(OSLREGOPS)
164#else
165#ifndef IL_BIGENDIAN
166#ifndef __mips__
167#define R_REG(osh, r) (\
168 SELECT_BUS_READ(osh, sizeof(*(r)) == sizeof(u8) ? readb((volatile u8*)(r)) : \
169 sizeof(*(r)) == sizeof(u16) ? readw((volatile u16*)(r)) : \
170 readl((volatile u32*)(r)), OSL_READ_REG(osh, r)) \
171)
172#else /* __mips__ */
173#define R_REG(osh, r) (\
174 SELECT_BUS_READ(osh, \
175 ({ \
176 __typeof(*(r)) __osl_v; \
177 __asm__ __volatile__("sync"); \
178 switch (sizeof(*(r))) { \
179 case sizeof(u8): \
180 __osl_v = readb((volatile u8*)(r)); \
181 break; \
182 case sizeof(u16): \
183 __osl_v = readw((volatile u16*)(r)); \
184 break; \
185 case sizeof(u32): \
186 __osl_v = \
187 readl((volatile u32*)(r)); \
188 break; \
189 } \
190 __asm__ __volatile__("sync"); \
191 __osl_v; \
192 }), \
193 ({ \
194 __typeof(*(r)) __osl_v; \
195 __asm__ __volatile__("sync"); \
196 __osl_v = OSL_READ_REG(osh, r); \
197 __asm__ __volatile__("sync"); \
198 __osl_v; \
199 })) \
200)
201#endif /* __mips__ */
202
203#define W_REG(osh, r, v) do { \
204 SELECT_BUS_WRITE(osh, \
205 switch (sizeof(*(r))) { \
206 case sizeof(u8): \
207 writeb((u8)(v), (volatile u8*)(r)); break; \
208 case sizeof(u16): \
209 writew((u16)(v), (volatile u16*)(r)); break; \
210 case sizeof(u32): \
211 writel((u32)(v), (volatile u32*)(r)); break; \
212 }, \
213 (OSL_WRITE_REG(osh, r, v))); \
214 } while (0)
215#else /* IL_BIGENDIAN */
216#define R_REG(osh, r) (\
217 SELECT_BUS_READ(osh, \
218 ({ \
219 __typeof(*(r)) __osl_v; \
220 switch (sizeof(*(r))) { \
221 case sizeof(u8): \
222 __osl_v = \
223 readb((volatile u8*)((r)^3)); \
224 break; \
225 case sizeof(u16): \
226 __osl_v = \
227 readw((volatile u16*)((r)^2)); \
228 break; \
229 case sizeof(u32): \
230 __osl_v = readl((volatile u32*)(r)); \
231 break; \
232 } \
233 __osl_v; \
234 }), \
235 OSL_READ_REG(osh, r)) \
236)
237#define W_REG(osh, r, v) do { \
238 SELECT_BUS_WRITE(osh, \
239 switch (sizeof(*(r))) { \
240 case sizeof(u8): \
241 writeb((u8)(v), \
242 (volatile u8*)((r)^3)); break; \
243 case sizeof(u16): \
244 writew((u16)(v), \
245 (volatile u16*)((r)^2)); break; \
246 case sizeof(u32): \
247 writel((u32)(v), \
248 (volatile u32*)(r)); break; \
249 }, \
250 (OSL_WRITE_REG(osh, r, v))); \
251 } while (0)
252#endif /* IL_BIGENDIAN */
253
254#endif /* OSLREGOPS */
255
256#define AND_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) & (v))
257#define OR_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) | (v))
258
259/* bcopy, bcmp, and bzero functions */
260#define bcopy(src, dst, len) memcpy((dst), (src), (len))
261#define bcmp(b1, b2, len) memcmp((b1), (b2), (len))
262#define bzero(b, len) memset((b), '\0', (len))
263
264/* uncached/cached virtual address */
265#ifdef __mips__
266#include <asm/addrspace.h>
267#define OSL_UNCACHED(va) ((void *)KSEG1ADDR((va)))
268#define OSL_CACHED(va) ((void *)KSEG0ADDR((va)))
269#else
270#define OSL_UNCACHED(va) ((void *)va)
271#define OSL_CACHED(va) ((void *)va)
272#endif /* mips */
273
274#if defined(mips)
275#define OSL_GETCYCLES(x) ((x) = read_c0_count() * 2)
276#elif defined(__i386__)
277#define OSL_GETCYCLES(x) rdtscl((x))
278#else
279#define OSL_GETCYCLES(x) ((x) = 0)
280#endif /* defined(mips) */
281
282/* dereference an address that may cause a bus exception */
283#ifdef mips
284#define BUSPROBE(val, addr) get_dbe((val), (addr))
285#include <asm/paccess.h>
286#else
287#define BUSPROBE(val, addr) ({ (val) = R_REG(NULL, (addr)); 0; })
288#endif /* mips */
289
290/* map/unmap physical to virtual I/O */
291#if !defined(CONFIG_MMC_MSM7X00A)
292#define REG_MAP(pa, size) ioremap_nocache((unsigned long)(pa), (unsigned long)(size))
293#else
294#define REG_MAP(pa, size) (void *)(0)
295#endif /* !defined(CONFIG_MMC_MSM7X00A */
296#define REG_UNMAP(va) iounmap((va))
297
298#define R_SM(r) (*(r))
299#define W_SM(r, v) (*(r) = (v))
300#define BZERO_SM(r, len) memset((r), '\0', (len))
301
302#ifdef BRCM_FULLMAC
303#include <linuxver.h> /* use current 2.4.x calling conventions */
304#endif
305
306/* packet primitives */
307#define PKTGET(osh, len, send) osl_pktget((osh), (len))
308#define PKTFREE(osh, skb, send) osl_pktfree((osh), (skb), (send))
309#define PKTDATA(skb) (((struct sk_buff *)(skb))->data)
310#define PKTLEN(skb) (((struct sk_buff *)(skb))->len)
311#define PKTHEADROOM(skb) (PKTDATA(skb)-(((struct sk_buff *)(skb))->head))
312#define PKTTAILROOM(skb) ((((struct sk_buff *)(skb))->end)-(((struct sk_buff *)(skb))->tail))
313#define PKTNEXT(skb) (((struct sk_buff *)(skb))->next)
314#define PKTSETNEXT(skb, x) \
315 (((struct sk_buff *)(skb))->next = (struct sk_buff *)(x))
316#define PKTSETLEN(skb, len) __skb_trim((struct sk_buff *)(skb), (len))
317#define PKTPUSH(skb, bytes) skb_push((struct sk_buff *)(skb), (bytes))
318#define PKTPULL(skb, bytes) skb_pull((struct sk_buff *)(skb), (bytes))
319#define PKTTAG(skb) ((void *)(((struct sk_buff *)(skb))->cb))
320#define PKTALLOCED(osh) (((osl_pubinfo_t *)(osh))->pktalloced)
321#define PKTSETPOOL(osh, skb, x, y) do {} while (0)
322#define PKTPOOL(osh, skb) false
323extern void *osl_pktget(osl_t *osh, uint len);
324extern void osl_pktfree(osl_t *osh, void *skb, bool send);
325
326#ifdef BRCM_FULLMAC
327extern void *osl_pktget_static(osl_t *osh, uint len);
328extern void osl_pktfree_static(osl_t *osh, void *skb, bool send);
329
330static inline void *
331osl_pkt_frmnative(osl_pubinfo_t *osh, struct sk_buff *skb)
332{
333 struct sk_buff *nskb;
334
335 if (osh->pkttag)
336 bzero((void *)skb->cb, OSL_PKTTAG_SZ);
337
338 for (nskb = skb; nskb; nskb = nskb->next)
339 osh->pktalloced++;
340
341 return (void *)skb;
342}
343#define PKTFRMNATIVE(osh, skb) \
344 osl_pkt_frmnative(((osl_pubinfo_t *)osh), (struct sk_buff*)(skb))
345
346static inline struct sk_buff *
347osl_pkt_tonative(osl_pubinfo_t *osh, void *pkt)
348{
349 struct sk_buff *nskb;
350
351 if (osh->pkttag)
352 bzero(((struct sk_buff *)pkt)->cb, OSL_PKTTAG_SZ);
353
354 for (nskb = (struct sk_buff *)pkt; nskb; nskb = nskb->next)
355 osh->pktalloced--;
356
357 return (struct sk_buff *)pkt;
358}
359#define PKTTONATIVE(osh, pkt) \
360 osl_pkt_tonative((osl_pubinfo_t *)(osh), (pkt))
361#else /* !BRCM_FULLMAC */
362#define PKTUNALLOC(osh) (((osl_pubinfo_t *)(osh))->pktalloced--)
363
364#define PKTSETSKIPCT(osh, skb)
365#define PKTCLRSKIPCT(osh, skb)
366#define PKTSKIPCT(osh, skb)
367#endif /* BRCM_FULLMAC */
368
369#define PKTLINK(skb) (((struct sk_buff *)(skb))->prev)
370#define PKTSETLINK(skb, x) (((struct sk_buff *)(skb))->prev = (struct sk_buff*)(x))
371#define PKTPRIO(skb) (((struct sk_buff *)(skb))->priority)
372#define PKTSETPRIO(skb, x) (((struct sk_buff *)(skb))->priority = (x))
373#define PKTSUMNEEDED(skb) (((struct sk_buff *)(skb))->ip_summed == CHECKSUM_PARTIAL)
374#define PKTSETSUMGOOD(skb, x) (((struct sk_buff *)(skb))->ip_summed = \
375 ((x) ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE))
376/* PKTSETSUMNEEDED and PKTSUMGOOD are not possible because skb->ip_summed is overloaded */
377#define PKTSHARED(skb) (((struct sk_buff *)(skb))->cloned)
378
379#if defined(BCMSDIO) && !defined(BRCM_FULLMAC)
380#define RPC_READ_REG(osh, r) (\
381 sizeof(*(r)) == sizeof(u8) ? osl_readb((osh), (volatile u8*)(r)) : \
382 sizeof(*(r)) == sizeof(u16) ? osl_readw((osh), (volatile u16*)(r)) : \
383 osl_readl((osh), (volatile u32*)(r)) \
384)
385#define RPC_WRITE_REG(osh, r, v) do { \
386 switch (sizeof(*(r))) { \
387 case sizeof(u8): \
388 osl_writeb((osh), (volatile u8*)(r), (u8)(v)); \
389 break; \
390 case sizeof(u16): \
391 osl_writew((osh), (volatile u16*)(r), (u16)(v)); \
392 break; \
393 case sizeof(u32): \
394 osl_writel((osh), (volatile u32*)(r), (u32)(v)); \
395 break; \
396 } \
397} while (0)
398
399extern u8 osl_readb(osl_t *osh, volatile u8 *r);
400extern u16 osl_readw(osl_t *osh, volatile u16 *r);
401extern u32 osl_readl(osl_t *osh, volatile u32 *r);
402extern void osl_writeb(osl_t *osh, volatile u8 *r, u8 v);
403extern void osl_writew(osl_t *osh, volatile u16 *r, u16 v);
404extern void osl_writel(osl_t *osh, volatile u32 *r, u32 v);
405#endif /* BCMSDIO */
406
407#endif /* _linux_osl_h_ */
diff --git a/drivers/staging/brcm80211/include/linuxver.h b/drivers/staging/brcm80211/include/linuxver.h
deleted file mode 100644
index dc721413ee2..00000000000
--- a/drivers/staging/brcm80211/include/linuxver.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _linuxver_h_
18#define _linuxver_h_
19
20#include <linux/module.h>
21#include <linux/slab.h>
22#include <linux/types.h>
23#include <linux/init.h>
24#include <linux/mm.h>
25#include <linux/string.h>
26#include <linux/pci.h>
27#include <linux/interrupt.h>
28#include <linux/netdevice.h>
29#include <linux/workqueue.h>
30#include <linux/sched.h>
31#include <linux/ieee80211.h>
32#include <linux/time.h>
33#include <linux/wait.h>
34
35#undef IP_TOS
36#include <asm/io.h>
37
38#endif /* _linuxver_h_ */
diff --git a/drivers/staging/brcm80211/include/nicpci.h b/drivers/staging/brcm80211/include/nicpci.h
index ce146e88ffd..928818daedd 100644
--- a/drivers/staging/brcm80211/include/nicpci.h
+++ b/drivers/staging/brcm80211/include/nicpci.h
@@ -45,17 +45,17 @@
45#else 45#else
46struct sbpcieregs; 46struct sbpcieregs;
47 47
48extern u8 pcicore_find_pci_capability(osl_t *osh, u8 req_cap_id, 48extern u8 pcicore_find_pci_capability(struct osl_info *osh, u8 req_cap_id,
49 unsigned char *buf, u32 *buflen); 49 unsigned char *buf, u32 *buflen);
50extern uint pcie_readreg(osl_t *osh, struct sbpcieregs *pcieregs, 50extern uint pcie_readreg(struct osl_info *osh, struct sbpcieregs *pcieregs,
51 uint addrtype, uint offset); 51 uint addrtype, uint offset);
52extern uint pcie_writereg(osl_t *osh, struct sbpcieregs *pcieregs, 52extern uint pcie_writereg(struct osl_info *osh, struct sbpcieregs *pcieregs,
53 uint addrtype, uint offset, uint val); 53 uint addrtype, uint offset, uint val);
54 54
55extern u8 pcie_clkreq(void *pch, u32 mask, u32 val); 55extern u8 pcie_clkreq(void *pch, u32 mask, u32 val);
56extern u32 pcie_lcreg(void *pch, u32 mask, u32 val); 56extern u32 pcie_lcreg(void *pch, u32 mask, u32 val);
57 57
58extern void *pcicore_init(si_t *sih, osl_t *osh, void *regs); 58extern void *pcicore_init(si_t *sih, struct osl_info *osh, void *regs);
59extern void pcicore_deinit(void *pch); 59extern void pcicore_deinit(void *pch);
60extern void pcicore_attach(void *pch, char *pvars, int state); 60extern void pcicore_attach(void *pch, char *pvars, int state);
61extern void pcicore_hwup(void *pch); 61extern void pcicore_hwup(void *pch);
@@ -70,10 +70,10 @@ extern u32 pcicore_pcieserdesreg(void *pch, u32 mdioslave, u32 offset,
70extern u32 pcicore_pciereg(void *pch, u32 offset, u32 mask, 70extern u32 pcicore_pciereg(void *pch, u32 offset, u32 mask,
71 u32 val, uint type); 71 u32 val, uint type);
72 72
73extern bool pcicore_pmecap_fast(osl_t *osh); 73extern bool pcicore_pmecap_fast(struct osl_info *osh);
74extern void pcicore_pmeen(void *pch); 74extern void pcicore_pmeen(void *pch);
75extern void pcicore_pmeclr(void *pch); 75extern void pcicore_pmeclr(void *pch);
76extern bool pcicore_pmestat(void *pch); 76extern bool pcicore_pmestat(void *pch);
77#endif /* defined(BCMSDIO) || (defined(BCMBUSTYPE) && (BCMBUSTYPE == SI_BUS)) */ 77#endif /* defined(BCMSDIO)||(defined(BCMBUSTYPE) && (BCMBUSTYPE==SI_BUS)) */
78 78
79#endif /* _NICPCI_H */ 79#endif /* _NICPCI_H */
diff --git a/drivers/staging/brcm80211/include/osl.h b/drivers/staging/brcm80211/include/osl.h
index c0ebb3d9722..b28235618d8 100644
--- a/drivers/staging/brcm80211/include/osl.h
+++ b/drivers/staging/brcm80211/include/osl.h
@@ -18,42 +18,197 @@
18#define _osl_h_ 18#define _osl_h_
19 19
20/* osl handle type forward declaration */ 20/* osl handle type forward declaration */
21typedef struct osl_info osl_t; 21struct osl_info {
22 uint pktalloced; /* Number of allocated packet buffers */
23 bool mmbus; /* Bus supports memory-mapped registers */
24 uint magic;
25 void *pdev;
26 uint bustype;
27};
28
22typedef struct osl_dmainfo osldma_t; 29typedef struct osl_dmainfo osldma_t;
23 30
24#define OSL_PKTTAG_SZ 32 /* Size of PktTag */
25 31
26/* Drivers use PKTFREESETCB to register a callback function when a packet is freed by OSL */ 32extern struct osl_info *osl_attach(void *pdev, uint bustype);
27typedef void (*pktfree_cb_fn_t) (void *ctx, void *pkt, unsigned int status); 33extern void osl_detach(struct osl_info *osh);
28 34
29#ifdef BCMSDIO 35extern u32 g_assert_type;
30/* Drivers use REGOPSSET() to register register read/write funcitons */
31typedef unsigned int (*osl_rreg_fn_t) (void *ctx, void *reg, unsigned int size);
32typedef void (*osl_wreg_fn_t) (void *ctx, void *reg, unsigned int val,
33 unsigned int size);
34#endif
35 36
36#include <linux_osl.h> 37#if defined(BCMDBG_ASSERT)
38#define ASSERT(exp) \
39 do { if (!(exp)) osl_assert(#exp, __FILE__, __LINE__); } while (0)
40extern void osl_assert(char *exp, char *file, int line);
41#else
42#define ASSERT(exp) do {} while (0)
43#endif /* defined(BCMDBG_ASSERT) */
37 44
38/* -------------------------------------------------------------------------- 45/* PCI device bus # and slot # */
39** Register manipulation macros. 46#define OSL_PCI_BUS(osh) osl_pci_bus(osh)
40*/ 47#define OSL_PCI_SLOT(osh) osl_pci_slot(osh)
48extern uint osl_pci_bus(struct osl_info *osh);
49extern uint osl_pci_slot(struct osl_info *osh);
41 50
42#define SET_REG(osh, r, mask, val) W_REG((osh), (r), ((R_REG((osh), r) & ~(mask)) | (val))) 51#define BUS_SWAP32(v) (v)
43 52
44#ifndef AND_REG 53extern void *osl_dma_alloc_consistent(struct osl_info *osh, uint size,
45#define AND_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) & (v)) 54 u16 align, uint *tot, unsigned long *pap);
46#endif /* !AND_REG */ 55
56#ifdef BRCM_FULLMAC
57#define DMA_ALLOC_CONSISTENT(osh, size, pap, dmah, alignbits) \
58 osl_dma_alloc_consistent((osh), (size), (0), (tot), (pap))
59#else
60#define DMA_ALLOC_CONSISTENT(osh, size, align, tot, pap, dmah) \
61 osl_dma_alloc_consistent((osh), (size), (align), (tot), (pap))
62#endif /* BRCM_FULLMAC */
47 63
48#ifndef OR_REG 64#define DMA_FREE_CONSISTENT(osh, va, size, pa, dmah) \
49#define OR_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) | (v)) 65 osl_dma_free_consistent((osh), (void *)(va), (size), (pa))
50#endif /* !OR_REG */ 66extern void osl_dma_free_consistent(struct osl_info *osh, void *va,
67 uint size, unsigned long pa);
68
69/* map/unmap direction */
70#define DMA_TX 1 /* TX direction for DMA */
71#define DMA_RX 2 /* RX direction for DMA */
72
73/* map/unmap shared (dma-able) memory */
74#define DMA_MAP(osh, va, size, direction, p, dmah) \
75 osl_dma_map((osh), (va), (size), (direction))
76#define DMA_UNMAP(osh, pa, size, direction, p, dmah) \
77 osl_dma_unmap((osh), (pa), (size), (direction))
78extern uint osl_dma_map(struct osl_info *osh, void *va, uint size,
79 int direction);
80extern void osl_dma_unmap(struct osl_info *osh, uint pa, uint size,
81 int direction);
82
83/* register access macros */
84#if defined(BCMSDIO)
85#ifdef BRCM_FULLMAC
86#include <bcmsdh.h>
87#endif
88#define OSL_WRITE_REG(osh, r, v) \
89 (bcmsdh_reg_write(NULL, (unsigned long)(r), sizeof(*(r)), (v)))
90#define OSL_READ_REG(osh, r) \
91 (bcmsdh_reg_read(NULL, (unsigned long)(r), sizeof(*(r))))
92#endif
51 93
52#if !defined(OSL_SYSUPTIME) 94#if defined(BCMSDIO)
53#define OSL_SYSUPTIME() (0) 95#define SELECT_BUS_WRITE(osh, mmap_op, bus_op) \
54#define OSL_SYSUPTIME_SUPPORT false 96 if ((osh)->mmbus) \
97 mmap_op else bus_op
98#define SELECT_BUS_READ(osh, mmap_op, bus_op) \
99 ((osh)->mmbus) ? mmap_op : bus_op
55#else 100#else
56#define OSL_SYSUPTIME_SUPPORT true 101#define SELECT_BUS_WRITE(osh, mmap_op, bus_op) mmap_op
57#endif /* OSL_SYSUPTIME */ 102#define SELECT_BUS_READ(osh, mmap_op, bus_op) mmap_op
103#endif
104
105/* the largest reasonable packet buffer driver uses for ethernet MTU in bytes */
106#define PKTBUFSZ 2048
107
108#define OSL_SYSUPTIME() ((u32)jiffies * (1000 / HZ))
109#define printf(fmt, args...) printk(fmt , ## args)
110#ifdef BRCM_FULLMAC
111#include <linux/kernel.h> /* for vsn/printf's */
112#include <linux/string.h> /* for mem*, str* */
113#endif
114/* bcopy's: Linux kernel doesn't provide these (anymore) */
115#define bcopy(src, dst, len) memcpy((dst), (src), (len))
116
117/* register access macros */
118#ifndef IL_BIGENDIAN
119#ifndef __mips__
120#define R_REG(osh, r) (\
121 SELECT_BUS_READ(osh, sizeof(*(r)) == sizeof(u8) ? \
122 readb((volatile u8*)(r)) : \
123 sizeof(*(r)) == sizeof(u16) ? readw((volatile u16*)(r)) : \
124 readl((volatile u32*)(r)), OSL_READ_REG(osh, r)) \
125)
126#else /* __mips__ */
127#define R_REG(osh, r) (\
128 SELECT_BUS_READ(osh, \
129 ({ \
130 __typeof(*(r)) __osl_v; \
131 __asm__ __volatile__("sync"); \
132 switch (sizeof(*(r))) { \
133 case sizeof(u8): \
134 __osl_v = readb((volatile u8*)(r)); \
135 break; \
136 case sizeof(u16): \
137 __osl_v = readw((volatile u16*)(r)); \
138 break; \
139 case sizeof(u32): \
140 __osl_v = \
141 readl((volatile u32*)(r)); \
142 break; \
143 } \
144 __asm__ __volatile__("sync"); \
145 __osl_v; \
146 }), \
147 ({ \
148 __typeof(*(r)) __osl_v; \
149 __asm__ __volatile__("sync"); \
150 __osl_v = OSL_READ_REG(osh, r); \
151 __asm__ __volatile__("sync"); \
152 __osl_v; \
153 })) \
154)
155#endif /* __mips__ */
156
157#define W_REG(osh, r, v) do { \
158 SELECT_BUS_WRITE(osh, \
159 switch (sizeof(*(r))) { \
160 case sizeof(u8): \
161 writeb((u8)(v), (volatile u8*)(r)); break; \
162 case sizeof(u16): \
163 writew((u16)(v), (volatile u16*)(r)); break; \
164 case sizeof(u32): \
165 writel((u32)(v), (volatile u32*)(r)); break; \
166 }, \
167 (OSL_WRITE_REG(osh, r, v))); \
168 } while (0)
169#else /* IL_BIGENDIAN */
170#define R_REG(osh, r) (\
171 SELECT_BUS_READ(osh, \
172 ({ \
173 __typeof(*(r)) __osl_v; \
174 switch (sizeof(*(r))) { \
175 case sizeof(u8): \
176 __osl_v = \
177 readb((volatile u8*)((r)^3)); \
178 break; \
179 case sizeof(u16): \
180 __osl_v = \
181 readw((volatile u16*)((r)^2)); \
182 break; \
183 case sizeof(u32): \
184 __osl_v = readl((volatile u32*)(r)); \
185 break; \
186 } \
187 __osl_v; \
188 }), \
189 OSL_READ_REG(osh, r)) \
190)
191#define W_REG(osh, r, v) do { \
192 SELECT_BUS_WRITE(osh, \
193 switch (sizeof(*(r))) { \
194 case sizeof(u8): \
195 writeb((u8)(v), \
196 (volatile u8*)((r)^3)); break; \
197 case sizeof(u16): \
198 writew((u16)(v), \
199 (volatile u16*)((r)^2)); break; \
200 case sizeof(u32): \
201 writel((u32)(v), \
202 (volatile u32*)(r)); break; \
203 }, \
204 (OSL_WRITE_REG(osh, r, v))); \
205 } while (0)
206#endif /* IL_BIGENDIAN */
207
208#define bcopy(src, dst, len) memcpy((dst), (src), (len))
209
210/* packet primitives */
211extern struct sk_buff *pkt_buf_get_skb(struct osl_info *osh, uint len);
212extern void pkt_buf_free_skb(struct osl_info *osh, struct sk_buff *skb, bool send);
58 213
59#endif /* _osl_h_ */ 214#endif /* _osl_h_ */
diff --git a/drivers/staging/brcm80211/include/proto/ethernet.h b/drivers/staging/brcm80211/include/proto/ethernet.h
index cc17b428dd3..567407de020 100644
--- a/drivers/staging/brcm80211/include/proto/ethernet.h
+++ b/drivers/staging/brcm80211/include/proto/ethernet.h
@@ -17,28 +17,22 @@
17#ifndef _NET_ETHERNET_H_ 17#ifndef _NET_ETHERNET_H_
18#define _NET_ETHERNET_H_ 18#define _NET_ETHERNET_H_
19 19
20#include <linux/if_ether.h>
21
20#include <packed_section_start.h> 22#include <packed_section_start.h>
21 23
22#define ETHER_ADDR_LEN 6
23#define ETHER_TYPE_LEN 2 24#define ETHER_TYPE_LEN 2
24#define ETHER_CRC_LEN 4 25#define ETHER_CRC_LEN 4
25#define ETHER_HDR_LEN (ETHER_ADDR_LEN * 2 + ETHER_TYPE_LEN)
26#define ETHER_MIN_LEN 64 26#define ETHER_MIN_LEN 64
27#define ETHER_MIN_DATA 46 27#define ETHER_MIN_DATA 46
28#define ETHER_MAX_LEN 1518 28#define ETHER_MAX_LEN 1518
29#define ETHER_MAX_DATA 1500 29#define ETHER_MAX_DATA 1500
30 30
31#define ETHER_TYPE_MIN 0x0600
32#define ETHER_TYPE_IP 0x0800
33#define ETHER_TYPE_ARP 0x0806
34#define ETHER_TYPE_8021Q 0x8100
35#define ETHER_TYPE_BRCM 0x886c 31#define ETHER_TYPE_BRCM 0x886c
36#define ETHER_TYPE_802_1X 0x888e
37#define ETHER_TYPE_802_1X_PREAUTH 0x88c7
38 32
39#define ETHER_DEST_OFFSET (0 * ETHER_ADDR_LEN) 33#define ETHER_DEST_OFFSET (0 * ETH_ALEN)
40#define ETHER_SRC_OFFSET (1 * ETHER_ADDR_LEN) 34#define ETHER_SRC_OFFSET (1 * ETH_ALEN)
41#define ETHER_TYPE_OFFSET (2 * ETHER_ADDR_LEN) 35#define ETHER_TYPE_OFFSET (2 * ETH_ALEN)
42 36
43#define ETHER_IS_VALID_LEN(foo) \ 37#define ETHER_IS_VALID_LEN(foo) \
44 ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN) 38 ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
@@ -53,50 +47,18 @@
53} 47}
54 48
55BWL_PRE_PACKED_STRUCT struct ether_header { 49BWL_PRE_PACKED_STRUCT struct ether_header {
56 u8 ether_dhost[ETHER_ADDR_LEN]; 50 u8 ether_dhost[ETH_ALEN];
57 u8 ether_shost[ETHER_ADDR_LEN]; 51 u8 ether_shost[ETH_ALEN];
58 u16 ether_type; 52 u16 ether_type;
59} BWL_POST_PACKED_STRUCT; 53} BWL_POST_PACKED_STRUCT;
60 54
61BWL_PRE_PACKED_STRUCT struct ether_addr { 55BWL_PRE_PACKED_STRUCT struct ether_addr {
62 u8 octet[ETHER_ADDR_LEN]; 56 u8 octet[ETH_ALEN];
63} BWL_POST_PACKED_STRUCT; 57} BWL_POST_PACKED_STRUCT;
64 58
65#define ETHER_SET_LOCALADDR(ea) (((u8 *)(ea))[0] = (((u8 *)(ea))[0] | 2))
66#define ETHER_IS_LOCALADDR(ea) (((u8 *)(ea))[0] & 2)
67#define ETHER_CLR_LOCALADDR(ea) (((u8 *)(ea))[0] = \
68 (((u8 *)(ea))[0] & 0xd))
69#define ETHER_TOGGLE_LOCALADDR(ea) (((u8 *)(ea))[0] = \
70 (((u8 *)(ea))[0] ^ 2))
71
72#define ETHER_SET_UNICAST(ea) (((u8 *)(ea))[0] = (((u8 *)(ea))[0] & ~1)) 59#define ETHER_SET_UNICAST(ea) (((u8 *)(ea))[0] = (((u8 *)(ea))[0] & ~1))
73 60
74#define ETHER_ISMULTI(ea) (((const u8 *)(ea))[0] & 1)
75
76#define ether_cmp(a, b) (!(((short *)a)[0] == ((short *)b)[0]) | \
77 !(((short *)a)[1] == ((short *)b)[1]) | \
78 !(((short *)a)[2] == ((short *)b)[2]))
79
80#define ether_copy(s, d) { \
81 ((short *)d)[0] = ((short *)s)[0]; \
82 ((short *)d)[1] = ((short *)s)[1]; \
83 ((short *)d)[2] = ((short *)s)[2]; }
84
85static const struct ether_addr ether_bcast = { {255, 255, 255, 255, 255, 255} }; 61static const struct ether_addr ether_bcast = { {255, 255, 255, 255, 255, 255} };
86static const struct ether_addr ether_null = { {0, 0, 0, 0, 0, 0} };
87
88#define ETHER_ISBCAST(ea) ((((u8 *)(ea))[0] & \
89 ((u8 *)(ea))[1] & \
90 ((u8 *)(ea))[2] & \
91 ((u8 *)(ea))[3] & \
92 ((u8 *)(ea))[4] & \
93 ((u8 *)(ea))[5]) == 0xff)
94#define ETHER_ISNULLADDR(ea) ((((u8 *)(ea))[0] | \
95 ((u8 *)(ea))[1] | \
96 ((u8 *)(ea))[2] | \
97 ((u8 *)(ea))[3] | \
98 ((u8 *)(ea))[4] | \
99 ((u8 *)(ea))[5]) == 0)
100 62
101#define ETHER_MOVE_HDR(d, s) \ 63#define ETHER_MOVE_HDR(d, s) \
102do { \ 64do { \
diff --git a/drivers/staging/brcm80211/include/proto/wpa.h b/drivers/staging/brcm80211/include/proto/wpa.h
index ec84c9f2b5e..10c2fb62df0 100644
--- a/drivers/staging/brcm80211/include/proto/wpa.h
+++ b/drivers/staging/brcm80211/include/proto/wpa.h
@@ -19,95 +19,7 @@
19 19
20#include <proto/ethernet.h> 20#include <proto/ethernet.h>
21 21
22#include <packed_section_start.h>
23
24#define DOT11_RC_INVALID_WPA_IE 13
25#define DOT11_RC_MIC_FAILURE 14
26#define DOT11_RC_4WH_TIMEOUT 15
27#define DOT11_RC_GTK_UPDATE_TIMEOUT 16
28#define DOT11_RC_WPA_IE_MISMATCH 17
29#define DOT11_RC_INVALID_MC_CIPHER 18
30#define DOT11_RC_INVALID_UC_CIPHER 19
31#define DOT11_RC_INVALID_AKMP 20
32#define DOT11_RC_BAD_WPA_VERSION 21
33#define DOT11_RC_INVALID_WPA_CAP 22
34#define DOT11_RC_8021X_AUTH_FAIL 23
35
36#define WPA2_PMKID_LEN 16 22#define WPA2_PMKID_LEN 16
37
38typedef BWL_PRE_PACKED_STRUCT struct {
39 u8 tag;
40 u8 length;
41 u8 oui[3];
42 u8 oui_type;
43 BWL_PRE_PACKED_STRUCT struct {
44 u8 low;
45 u8 high;
46 } BWL_POST_PACKED_STRUCT version;
47} BWL_POST_PACKED_STRUCT wpa_ie_fixed_t;
48#define WPA_IE_OUITYPE_LEN 4
49#define WPA_IE_FIXED_LEN 8
50#define WPA_IE_TAG_FIXED_LEN 6
51
52typedef BWL_PRE_PACKED_STRUCT struct {
53 u8 tag;
54 u8 length;
55 BWL_PRE_PACKED_STRUCT struct {
56 u8 low;
57 u8 high;
58 } BWL_POST_PACKED_STRUCT version;
59} BWL_POST_PACKED_STRUCT wpa_rsn_ie_fixed_t;
60#define WPA_RSN_IE_FIXED_LEN 4
61#define WPA_RSN_IE_TAG_FIXED_LEN 2
62typedef u8 wpa_pmkid_t[WPA2_PMKID_LEN];
63
64typedef BWL_PRE_PACKED_STRUCT struct {
65 u8 oui[3];
66 u8 type;
67} BWL_POST_PACKED_STRUCT wpa_suite_t, wpa_suite_mcast_t;
68#define WPA_SUITE_LEN 4
69
70typedef BWL_PRE_PACKED_STRUCT struct {
71 BWL_PRE_PACKED_STRUCT struct {
72 u8 low;
73 u8 high;
74 } BWL_POST_PACKED_STRUCT count;
75 wpa_suite_t list[1];
76} BWL_POST_PACKED_STRUCT wpa_suite_ucast_t, wpa_suite_auth_key_mgmt_t;
77#define WPA_IE_SUITE_COUNT_LEN 2
78typedef BWL_PRE_PACKED_STRUCT struct {
79 BWL_PRE_PACKED_STRUCT struct {
80 u8 low;
81 u8 high;
82 } BWL_POST_PACKED_STRUCT count;
83 wpa_pmkid_t list[1];
84} BWL_POST_PACKED_STRUCT wpa_pmkid_list_t;
85
86#define WPA_CIPHER_NONE 0
87#define WPA_CIPHER_WEP_40 1
88#define WPA_CIPHER_TKIP 2
89#define WPA_CIPHER_AES_OCB 3
90#define WPA_CIPHER_AES_CCM 4
91#define WPA_CIPHER_WEP_104 5
92
93#define IS_WPA_CIPHER(cipher) ((cipher) == WPA_CIPHER_NONE || \
94 (cipher) == WPA_CIPHER_WEP_40 || \
95 (cipher) == WPA_CIPHER_WEP_104 || \
96 (cipher) == WPA_CIPHER_TKIP || \
97 (cipher) == WPA_CIPHER_AES_OCB || \
98 (cipher) == WPA_CIPHER_AES_CCM)
99
100#define WPA_TKIP_CM_DETECT 60
101#define WPA_TKIP_CM_BLOCK 60
102
103#define RSN_CAP_LEN 2
104
105#define RSN_CAP_PREAUTH 0x0001
106#define RSN_CAP_NOPAIRWISE 0x0002
107#define RSN_CAP_PTK_REPLAY_CNTR_MASK 0x000C
108#define RSN_CAP_PTK_REPLAY_CNTR_SHIFT 2
109#define RSN_CAP_GTK_REPLAY_CNTR_MASK 0x0030
110#define RSN_CAP_GTK_REPLAY_CNTR_SHIFT 4
111#define RSN_CAP_1_REPLAY_CNTR 0 23#define RSN_CAP_1_REPLAY_CNTR 0
112#define RSN_CAP_2_REPLAY_CNTRS 1 24#define RSN_CAP_2_REPLAY_CNTRS 1
113#define RSN_CAP_4_REPLAY_CNTRS 2 25#define RSN_CAP_4_REPLAY_CNTRS 2
@@ -118,10 +30,4 @@ typedef BWL_PRE_PACKED_STRUCT struct {
118#define WPA_CAP_REPLAY_CNTR_SHIFT RSN_CAP_PTK_REPLAY_CNTR_SHIFT 30#define WPA_CAP_REPLAY_CNTR_SHIFT RSN_CAP_PTK_REPLAY_CNTR_SHIFT
119#define WPA_CAP_REPLAY_CNTR_MASK RSN_CAP_PTK_REPLAY_CNTR_MASK 31#define WPA_CAP_REPLAY_CNTR_MASK RSN_CAP_PTK_REPLAY_CNTR_MASK
120 32
121#define WPA_CAP_LEN RSN_CAP_LEN
122
123#define WPA_CAP_WPA2_PREAUTH RSN_CAP_PREAUTH
124
125#include <packed_section_end.h>
126
127#endif /* _proto_wpa_h_ */ 33#endif /* _proto_wpa_h_ */
diff --git a/drivers/staging/brcm80211/include/rpc_osl.h b/drivers/staging/brcm80211/include/rpc_osl.h
index 4a2648001bf..c59d9ed1397 100644
--- a/drivers/staging/brcm80211/include/rpc_osl.h
+++ b/drivers/staging/brcm80211/include/rpc_osl.h
@@ -18,7 +18,7 @@
18#define _rpcosl_h_ 18#define _rpcosl_h_
19 19
20typedef struct rpc_osl rpc_osl_t; 20typedef struct rpc_osl rpc_osl_t;
21extern rpc_osl_t *rpc_osl_attach(osl_t *osh); 21extern rpc_osl_t *rpc_osl_attach(struct osl_info *osh);
22extern void rpc_osl_detach(rpc_osl_t *rpc_osh); 22extern void rpc_osl_detach(rpc_osl_t *rpc_osh);
23 23
24#define RPC_OSL_LOCK(rpc_osh) rpc_osl_lock((rpc_osh)) 24#define RPC_OSL_LOCK(rpc_osh) rpc_osl_lock((rpc_osh))
diff --git a/drivers/staging/brcm80211/include/siutils.h b/drivers/staging/brcm80211/include/siutils.h
index 57c36507a04..a935092d02d 100644
--- a/drivers/staging/brcm80211/include/siutils.h
+++ b/drivers/staging/brcm80211/include/siutils.h
@@ -19,9 +19,6 @@
19 19
20#include <hndsoc.h> 20#include <hndsoc.h>
21 21
22#if !defined(WLC_LOW)
23#include "bcm_rpc.h"
24#endif
25/* 22/*
26 * Data structure to export all chip specific common variables 23 * Data structure to export all chip specific common variables
27 * public (read-only) portion of siutils handle returned by si_attach() 24 * public (read-only) portion of siutils handle returned by si_attach()
@@ -50,19 +47,12 @@ struct si_pub {
50 uint socirev; /* SOC interconnect rev */ 47 uint socirev; /* SOC interconnect rev */
51 bool pci_pr32414; 48 bool pci_pr32414;
52 49
53#if !defined(WLC_LOW)
54 rpc_info_t *rpc;
55#endif
56}; 50};
57 51
58/* for HIGH_ONLY driver, the si_t must be writable to allow states sync from BMAC to HIGH driver 52/* for HIGH_ONLY driver, the si_t must be writable to allow states sync from BMAC to HIGH driver
59 * for monolithic driver, it is readonly to prevent accident change 53 * for monolithic driver, it is readonly to prevent accident change
60 */ 54 */
61#if !defined(WLC_LOW)
62typedef struct si_pub si_t;
63#else
64typedef const struct si_pub si_t; 55typedef const struct si_pub si_t;
65#endif
66 56
67/* 57/*
68 * Many of the routines below take an 'sih' handle as their first arg. 58 * Many of the routines below take an 'sih' handle as their first arg.
@@ -128,8 +118,8 @@ typedef void (*gpio_handler_t) (u32 stat, void *arg);
128#define GPIO_CTRL_EPA_EN_MASK 0x40 118#define GPIO_CTRL_EPA_EN_MASK 0x40
129 119
130/* === exported functions === */ 120/* === exported functions === */
131extern si_t *si_attach(uint pcidev, osl_t *osh, void *regs, uint bustype, 121extern si_t *si_attach(uint pcidev, struct osl_info *osh, void *regs,
132 void *sdh, char **vars, uint *varsz); 122 uint bustype, void *sdh, char **vars, uint *varsz);
133 123
134extern void si_detach(si_t *sih); 124extern void si_detach(si_t *sih);
135extern bool si_pci_war16165(si_t *sih); 125extern bool si_pci_war16165(si_t *sih);
@@ -138,7 +128,7 @@ extern uint si_coreid(si_t *sih);
138extern uint si_flag(si_t *sih); 128extern uint si_flag(si_t *sih);
139extern uint si_coreidx(si_t *sih); 129extern uint si_coreidx(si_t *sih);
140extern uint si_corerev(si_t *sih); 130extern uint si_corerev(si_t *sih);
141extern void *si_osh(si_t *sih); 131struct osl_info *si_osh(si_t *sih);
142extern uint si_corereg(si_t *sih, uint coreidx, uint regoff, uint mask, 132extern uint si_corereg(si_t *sih, uint coreidx, uint regoff, uint mask,
143 uint val); 133 uint val);
144extern void si_write_wrapperreg(si_t *sih, u32 offset, u32 val); 134extern void si_write_wrapperreg(si_t *sih, u32 offset, u32 val);
@@ -227,7 +217,7 @@ typedef struct gpioh_item {
227/* misc si info needed by some of the routines */ 217/* misc si info needed by some of the routines */
228typedef struct si_info { 218typedef struct si_info {
229 struct si_pub pub; /* back plane public state (must be first field) */ 219 struct si_pub pub; /* back plane public state (must be first field) */
230 void *osh; /* osl os handle */ 220 struct osl_info *osh; /* osl os handle */
231 void *sdh; /* bcmsdh handle */ 221 void *sdh; /* bcmsdh handle */
232 uint dev_coreid; /* the core provides driver functions */ 222 uint dev_coreid; /* the core provides driver functions */
233 void *intr_arg; /* interrupt callback function arg */ 223 void *intr_arg; /* interrupt callback function arg */
@@ -305,9 +295,9 @@ typedef struct si_info {
305#define ILP_DIV_5MHZ 0 /* ILP = 5 MHz */ 295#define ILP_DIV_5MHZ 0 /* ILP = 5 MHz */
306#define ILP_DIV_1MHZ 4 /* ILP = 1 MHz */ 296#define ILP_DIV_1MHZ 4 /* ILP = 1 MHz */
307 297
308#define PCI(si) ((BUSTYPE((si)->pub.bustype) == PCI_BUS) && \ 298#define PCI(si) (((si)->pub.bustype == PCI_BUS) && \
309 ((si)->pub.buscoretype == PCI_CORE_ID)) 299 ((si)->pub.buscoretype == PCI_CORE_ID))
310#define PCIE(si) ((BUSTYPE((si)->pub.bustype) == PCI_BUS) && \ 300#define PCIE(si) (((si)->pub.bustype == PCI_BUS) && \
311 ((si)->pub.buscoretype == PCIE_CORE_ID)) 301 ((si)->pub.buscoretype == PCIE_CORE_ID))
312#define PCI_FORCEHT(si) \ 302#define PCI_FORCEHT(si) \
313 (PCIE(si) && (si->pub.chip == BCM4716_CHIP_ID)) 303 (PCIE(si) && (si->pub.chip == BCM4716_CHIP_ID))
@@ -344,9 +334,9 @@ extern void si_epa_4313war(si_t *sih);
344char *si_getnvramflvar(si_t *sih, const char *name); 334char *si_getnvramflvar(si_t *sih, const char *name);
345 335
346/* AMBA Interconnect exported externs */ 336/* AMBA Interconnect exported externs */
347extern si_t *ai_attach(uint pcidev, osl_t *osh, void *regs, uint bustype, 337extern si_t *ai_attach(uint pcidev, struct osl_info *osh, void *regs,
348 void *sdh, char **vars, uint *varsz); 338 uint bustype, void *sdh, char **vars, uint *varsz);
349extern si_t *ai_kattach(osl_t *osh); 339extern si_t *ai_kattach(struct osl_info *osh);
350extern void ai_scan(si_t *sih, void *regs, uint devid); 340extern void ai_scan(si_t *sih, void *regs, uint devid);
351 341
352extern uint ai_flag(si_t *sih); 342extern uint ai_flag(si_t *sih);
diff --git a/drivers/staging/brcm80211/include/wlioctl.h b/drivers/staging/brcm80211/include/wlioctl.h
index 96866fb8898..9be793c5f10 100644
--- a/drivers/staging/brcm80211/include/wlioctl.h
+++ b/drivers/staging/brcm80211/include/wlioctl.h
@@ -33,82 +33,9 @@
33#define BWL_DEFAULT_PACKING 33#define BWL_DEFAULT_PACKING
34#include <packed_section_start.h> 34#include <packed_section_start.h>
35 35
36/* Legacy structure to help keep backward compatible wl tool and tray app */
37
38#define LEGACY_WL_BSS_INFO_VERSION 107 /* older version of wl_bss_info struct */
39
40typedef struct wl_bss_info_107 {
41 u32 version; /* version field */
42 u32 length; /* byte length of data in this record,
43 * starting at version and including IEs
44 */
45 struct ether_addr BSSID;
46 u16 beacon_period; /* units are Kusec */
47 u16 capability; /* Capability information */
48 u8 SSID_len;
49 u8 SSID[32];
50 struct {
51 uint count; /* # rates in this set */
52 u8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */
53 } rateset; /* supported rates */
54 u8 channel; /* Channel no. */
55 u16 atim_window; /* units are Kusec */
56 u8 dtim_period; /* DTIM period */
57 s16 RSSI; /* receive signal strength (in dBm) */
58 s8 phy_noise; /* noise (in dBm) */
59 u32 ie_length; /* byte length of Information Elements */
60 /* variable length Information Elements */
61} wl_bss_info_107_t;
62
63/*
64 * Per-BSS information structure.
65 */
66
67#define LEGACY2_WL_BSS_INFO_VERSION 108 /* old version of wl_bss_info struct */
68
69/* BSS info structure
70 * Applications MUST CHECK ie_offset field and length field to access IEs and
71 * next bss_info structure in a vector (in wl_scan_results_t)
72 */
73typedef struct wl_bss_info_108 {
74 u32 version; /* version field */
75 u32 length; /* byte length of data in this record,
76 * starting at version and including IEs
77 */
78 struct ether_addr BSSID;
79 u16 beacon_period; /* units are Kusec */
80 u16 capability; /* Capability information */
81 u8 SSID_len;
82 u8 SSID[32];
83 struct {
84 uint count; /* # rates in this set */
85 u8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */
86 } rateset; /* supported rates */
87 chanspec_t chanspec; /* chanspec for bss */
88 u16 atim_window; /* units are Kusec */
89 u8 dtim_period; /* DTIM period */
90 s16 RSSI; /* receive signal strength (in dBm) */
91 s8 phy_noise; /* noise (in dBm) */
92
93 u8 n_cap; /* BSS is 802.11N Capable */
94 u32 nbss_cap; /* 802.11N BSS Capabilities (based on HT_CAP_*) */
95 u8 ctl_ch; /* 802.11N BSS control channel number */
96 u32 reserved32[1]; /* Reserved for expansion of BSS properties */
97 u8 flags; /* flags */
98 u8 reserved[3]; /* Reserved for expansion of BSS properties */
99 u8 basic_mcs[MCSSET_LEN]; /* 802.11N BSS required MCS set */
100
101 u16 ie_offset; /* offset at which IEs start, from beginning */
102 u32 ie_length; /* byte length of Information Elements */
103 /* Add new fields here */
104 /* variable length Information Elements */
105} wl_bss_info_108_t;
106
107#ifdef BRCM_FULLMAC 36#ifdef BRCM_FULLMAC
37
108#define WL_BSS_INFO_VERSION 108 /* current ver of wl_bss_info struct */ 38#define WL_BSS_INFO_VERSION 108 /* current ver of wl_bss_info struct */
109#else
110#define WL_BSS_INFO_VERSION 109 /* current ver of wl_bss_info struct */
111#endif
112 39
113/* BSS info structure 40/* BSS info structure
114 * Applications MUST CHECK ie_offset field and length field to access IEs and 41 * Applications MUST CHECK ie_offset field and length field to access IEs and
@@ -148,12 +75,14 @@ typedef struct wl_bss_info {
148 /* Add new fields here */ 75 /* Add new fields here */
149 /* variable length Information Elements */ 76 /* variable length Information Elements */
150} wl_bss_info_t; 77} wl_bss_info_t;
78#endif /* BRCM_FULLMAC */
151 79
152typedef struct wlc_ssid { 80typedef struct wlc_ssid {
153 u32 SSID_len; 81 u32 SSID_len;
154 unsigned char SSID[32]; 82 unsigned char SSID[32];
155} wlc_ssid_t; 83} wlc_ssid_t;
156 84
85#ifdef BRCM_FULLMAC
157typedef struct chan_scandata { 86typedef struct chan_scandata {
158 u8 txpower; 87 u8 txpower;
159 u8 pad; 88 u8 pad;
@@ -308,6 +237,7 @@ typedef struct wl_probe_params {
308 struct ether_addr bssid; 237 struct ether_addr bssid;
309 struct ether_addr mac; 238 struct ether_addr mac;
310} wl_probe_params_t; 239} wl_probe_params_t;
240#endif /* BRCM_FULLMAC */
311 241
312#define WL_NUMRATES 16 /* max # of rates in a rateset */ 242#define WL_NUMRATES 16 /* max # of rates in a rateset */
313typedef struct wl_rateset { 243typedef struct wl_rateset {
@@ -315,6 +245,7 @@ typedef struct wl_rateset {
315 u8 rates[WL_NUMRATES]; /* rates in 500kbps units w/hi bit set if basic */ 245 u8 rates[WL_NUMRATES]; /* rates in 500kbps units w/hi bit set if basic */
316} wl_rateset_t; 246} wl_rateset_t;
317 247
248#ifdef BRCM_FULLMAC
318typedef struct wl_rateset_args { 249typedef struct wl_rateset_args {
319 u32 count; /* # rates in this set */ 250 u32 count; /* # rates in this set */
320 u8 rates[WL_NUMRATES]; /* rates in 500kbps units w/hi bit set if basic */ 251 u8 rates[WL_NUMRATES]; /* rates in 500kbps units w/hi bit set if basic */
@@ -352,6 +283,8 @@ typedef struct wl_join_params {
352} wl_join_params_t; 283} wl_join_params_t;
353#define WL_JOIN_PARAMS_FIXED_SIZE (sizeof(wl_join_params_t) - sizeof(chanspec_t)) 284#define WL_JOIN_PARAMS_FIXED_SIZE (sizeof(wl_join_params_t) - sizeof(chanspec_t))
354 285
286#endif /* BRCM_FULLMAC */
287
355/* defines used by the nrate iovar */ 288/* defines used by the nrate iovar */
356#define NRATE_MCS_INUSE 0x00000080 /* MSC in use,indicates b0-6 holds an mcs */ 289#define NRATE_MCS_INUSE 0x00000080 /* MSC in use,indicates b0-6 holds an mcs */
357#define NRATE_RATE_MASK 0x0000007f /* rate/mcs value */ 290#define NRATE_RATE_MASK 0x0000007f /* rate/mcs value */
@@ -391,6 +324,7 @@ typedef struct {
391 324
392#define HIGHEST_SINGLE_STREAM_MCS 7 /* MCS values greater than this enable multiple streams */ 325#define HIGHEST_SINGLE_STREAM_MCS 7 /* MCS values greater than this enable multiple streams */
393 326
327#ifdef BRCM_FULLMAC
394#define MAX_CCA_CHANNELS 38 /* Max number of 20 Mhz wide channels */ 328#define MAX_CCA_CHANNELS 38 /* Max number of 20 Mhz wide channels */
395#define MAX_CCA_SECS 60 /* CCA keeps this many seconds history */ 329#define MAX_CCA_SECS 60 /* CCA keeps this many seconds history */
396 330
@@ -428,8 +362,11 @@ typedef struct {
428 cca_congest_t secs[1]; /* Data */ 362 cca_congest_t secs[1]; /* Data */
429} cca_congest_channel_req_t; 363} cca_congest_channel_req_t;
430 364
365#endif /* BRCM_FULLMAC */
366
431#define WLC_CNTRY_BUF_SZ 4 /* Country string is 3 bytes + NUL */ 367#define WLC_CNTRY_BUF_SZ 4 /* Country string is 3 bytes + NUL */
432 368
369#ifdef BRCM_FULLMAC
433typedef struct wl_country { 370typedef struct wl_country {
434 char country_abbrev[WLC_CNTRY_BUF_SZ]; /* nul-terminated country code used in 371 char country_abbrev[WLC_CNTRY_BUF_SZ]; /* nul-terminated country code used in
435 * the Country IE 372 * the Country IE
@@ -516,6 +453,7 @@ typedef struct wl_rm_rep {
516 wl_rm_rep_elt_t rep[1]; /* variable length block of reports */ 453 wl_rm_rep_elt_t rep[1]; /* variable length block of reports */
517} wl_rm_rep_t; 454} wl_rm_rep_t;
518#define WL_RM_REP_FIXED_LEN 8 455#define WL_RM_REP_FIXED_LEN 8
456#endif /* BRCM_FULLMAC */
519 457
520/* Enumerate crypto algorithms */ 458/* Enumerate crypto algorithms */
521#define CRYPTO_ALGO_OFF 0 459#define CRYPTO_ALGO_OFF 0
@@ -621,28 +559,6 @@ typedef struct wl_led_info {
621 u8 activehi; 559 u8 activehi;
622} wl_led_info_t; 560} wl_led_info_t;
623 561
624/* flags */
625#define WLC_ASSOC_REQ_IS_REASSOC 0x01 /* assoc req was actually a reassoc */
626
627/* srom read/write struct passed through ioctl */
628typedef struct {
629 uint byteoff; /* byte offset */
630 uint nbytes; /* number of bytes */
631 u16 buf[1];
632} srom_rw_t;
633
634/* similar cis (srom or otp) struct [iovar: may not be aligned] */
635typedef struct {
636 u32 source; /* cis source */
637 u32 byteoff; /* byte offset */
638 u32 nbytes; /* number of bytes */
639 /* data follows here */
640} cis_rw_t;
641
642#define WLC_CIS_DEFAULT 0 /* built-in default */
643#define WLC_CIS_SROM 1 /* source is sprom */
644#define WLC_CIS_OTP 2 /* source is otp */
645
646/* R_REG and W_REG struct passed through ioctl */ 562/* R_REG and W_REG struct passed through ioctl */
647typedef struct { 563typedef struct {
648 u32 byteoff; /* byte offset of the field in d11regs_t */ 564 u32 byteoff; /* byte offset of the field in d11regs_t */
@@ -651,102 +567,14 @@ typedef struct {
651 uint band; /* band (optional) */ 567 uint band; /* band (optional) */
652} rw_reg_t; 568} rw_reg_t;
653 569
654/* Structure used by GET/SET_ATTEN ioctls - it controls power in b/g-band */
655/* PCL - Power Control Loop */
656/* current gain setting is replaced by user input */
657#define WL_ATTEN_APP_INPUT_PCL_OFF 0 /* turn off PCL, apply supplied input */
658#define WL_ATTEN_PCL_ON 1 /* turn on PCL */
659/* current gain setting is maintained */
660#define WL_ATTEN_PCL_OFF 2 /* turn off PCL. */
661
662typedef struct {
663 u16 auto_ctrl; /* WL_ATTEN_XX */
664 u16 bb; /* Baseband attenuation */
665 u16 radio; /* Radio attenuation */
666 u16 txctl1; /* Radio TX_CTL1 value */
667} atten_t;
668
669/* Per-AC retry parameters */
670struct wme_tx_params_s {
671 u8 short_retry;
672 u8 short_fallback;
673 u8 long_retry;
674 u8 long_fallback;
675 u16 max_rate; /* In units of 512 Kbps */
676};
677
678typedef struct wme_tx_params_s wme_tx_params_t;
679
680#define WL_WME_TX_PARAMS_IO_BYTES (sizeof(wme_tx_params_t) * AC_COUNT)
681
682/* defines used by poweridx iovar - it controls power in a-band */
683/* current gain setting is maintained */
684#define WL_PWRIDX_PCL_OFF -2 /* turn off PCL. */
685#define WL_PWRIDX_PCL_ON -1 /* turn on PCL */
686#define WL_PWRIDX_LOWER_LIMIT -2 /* lower limit */
687#define WL_PWRIDX_UPPER_LIMIT 63 /* upper limit */
688/* value >= 0 causes
689 * - input to be set to that value
690 * - PCL to be off
691 */
692
693/* Used to get specific link/ac parameters */
694typedef struct {
695 int ac;
696 u8 val;
697 struct ether_addr ea;
698} link_val_t;
699
700#define BCM_MAC_STATUS_INDICATION (0x40010200L)
701
702typedef struct {
703 u16 ver; /* version of this struct */
704 u16 len; /* length in bytes of this structure */
705 u16 cap; /* sta's advertised capabilities */
706 u32 flags; /* flags defined below */
707 u32 idle; /* time since data pkt rx'd from sta */
708 struct ether_addr ea; /* Station address */
709 wl_rateset_t rateset; /* rateset in use */
710 u32 in; /* seconds elapsed since associated */
711 u32 listen_interval_inms; /* Min Listen interval in ms for this STA */
712 u32 tx_pkts; /* # of packets transmitted */
713 u32 tx_failures; /* # of packets failed */
714 u32 rx_ucast_pkts; /* # of unicast packets received */
715 u32 rx_mcast_pkts; /* # of multicast packets received */
716 u32 tx_rate; /* Rate of last successful tx frame */
717 u32 rx_rate; /* Rate of last successful rx frame */
718 u32 rx_decrypt_succeeds; /* # of packet decrypted successfully */
719 u32 rx_decrypt_failures; /* # of packet decrypted unsuccessfully */
720} sta_info_t;
721
722#define WL_OLD_STAINFO_SIZE offsetof(sta_info_t, tx_pkts)
723
724#define WL_STA_VER 3
725
726/* Flags for sta_info_t indicating properties of STA */
727#define WL_STA_BRCM 0x1 /* Running a Broadcom driver */
728#define WL_STA_WME 0x2 /* WMM association */
729#define WL_STA_ABCAP 0x4
730#define WL_STA_AUTHE 0x8 /* Authenticated */
731#define WL_STA_ASSOC 0x10 /* Associated */
732#define WL_STA_AUTHO 0x20 /* Authorized */
733#define WL_STA_WDS 0x40 /* Wireless Distribution System */
734#define WL_STA_WDS_LINKUP 0x80 /* WDS traffic/probes flowing properly */
735#define WL_STA_PS 0x100 /* STA is in power save mode from AP's viewpoint */
736#define WL_STA_APSD_BE 0x200 /* APSD delv/trigger for AC_BE is default enabled */
737#define WL_STA_APSD_BK 0x400 /* APSD delv/trigger for AC_BK is default enabled */
738#define WL_STA_APSD_VI 0x800 /* APSD delv/trigger for AC_VI is default enabled */
739#define WL_STA_APSD_VO 0x1000 /* APSD delv/trigger for AC_VO is default enabled */
740#define WL_STA_N_CAP 0x2000 /* STA 802.11n capable */
741#define WL_STA_SCBSTATS 0x4000 /* Per STA debug stats */
742
743#define WL_WDS_LINKUP WL_STA_WDS_LINKUP /* deprecated */
744 570
571#ifdef BRCM_FULLMAC
745/* Used to get specific STA parameters */ 572/* Used to get specific STA parameters */
746typedef struct { 573typedef struct {
747 u32 val; 574 u32 val;
748 struct ether_addr ea; 575 struct ether_addr ea;
749} scb_val_t; 576} scb_val_t;
577#endif /* BRCM_FULLMAC */
750 578
751/* channel encoding */ 579/* channel encoding */
752typedef struct channel_info { 580typedef struct channel_info {
@@ -770,6 +598,7 @@ typedef struct get_pktcnt {
770 uint rx_ocast_good_pkt; /* unicast packets destined for others */ 598 uint rx_ocast_good_pkt; /* unicast packets destined for others */
771} get_pktcnt_t; 599} get_pktcnt_t;
772 600
601#ifdef BRCM_FULLMAC
773/* Linux network driver ioctl encoding */ 602/* Linux network driver ioctl encoding */
774typedef struct wl_ioctl { 603typedef struct wl_ioctl {
775 uint cmd; /* common ioctl definition */ 604 uint cmd; /* common ioctl definition */
@@ -779,11 +608,8 @@ typedef struct wl_ioctl {
779 uint used; /* bytes read or written (optional) */ 608 uint used; /* bytes read or written (optional) */
780 uint needed; /* bytes needed (optional) */ 609 uint needed; /* bytes needed (optional) */
781} wl_ioctl_t; 610} wl_ioctl_t;
611#endif /* BRCM_FULLMAC */
782 612
783/* reference to wl_ioctl_t struct used by usermode driver */
784#define ioctl_subtype set /* subtype param */
785#define ioctl_pid used /* pid param */
786#define ioctl_status needed /* status param */
787 613
788/* 614/*
789 * Structure for passing hardware and software 615 * Structure for passing hardware and software
@@ -810,45 +636,11 @@ typedef struct wlc_rev_info {
810 636
811#define WL_REV_INFO_LEGACY_LENGTH 48 637#define WL_REV_INFO_LEGACY_LENGTH 48
812 638
813#define WL_BRAND_MAX 10
814typedef struct wl_instance_info {
815 uint instance;
816 char brand[WL_BRAND_MAX];
817} wl_instance_info_t;
818
819/* structure to change size of tx fifo */
820typedef struct wl_txfifo_sz {
821 u16 magic;
822 u16 fifo;
823 u16 size;
824} wl_txfifo_sz_t;
825/* magic pattern used for mismatch driver and wl */
826#define WL_TXFIFO_SZ_MAGIC 0xa5a5
827
828/* Transfer info about an IOVar from the driver */
829/* Max supported IOV name size in bytes, + 1 for nul termination */
830#define WLC_IOV_NAME_LEN 30
831typedef struct wlc_iov_trx_s {
832 u8 module;
833 u8 type;
834 char name[WLC_IOV_NAME_LEN];
835} wlc_iov_trx_t;
836
837/* check this magic number */
838#define WLC_IOCTL_MAGIC 0x14e46c77
839
840#define PROC_ENTRY_NAME "brcm_debug"
841/* bump this number if you change the ioctl interface */
842#define WLC_IOCTL_VERSION 1
843
844#ifdef BRCM_FULLMAC 639#ifdef BRCM_FULLMAC
845#define WLC_IOCTL_MAXLEN 8192
846#else
847#define WLC_IOCTL_MAXLEN 3072 /* max length ioctl buffer required */
848#endif
849#define WLC_IOCTL_SMLEN 256 /* "small" length ioctl buffer required */ 640#define WLC_IOCTL_SMLEN 256 /* "small" length ioctl buffer required */
850#define WLC_IOCTL_MEDLEN 1536 /* "med" length ioctl buffer required */ 641#define WLC_IOCTL_MEDLEN 1536 /* "med" length ioctl buffer required */
851#define WLC_SAMPLECOLLECT_MAXLEN 10240 /* Max Sample Collect buffer for two cores */ 642#define WLC_IOCTL_MAXLEN 8192
643#endif
852 644
853/* common ioctl definitions */ 645/* common ioctl definitions */
854#define WLC_GET_MAGIC 0 646#define WLC_GET_MAGIC 0
@@ -1399,23 +1191,6 @@ typedef struct {
1399#define WL_TX_POWER_MCS40_FIRST 28 1191#define WL_TX_POWER_MCS40_FIRST 28
1400#define WL_TX_POWER_MCS40_NUM 17 1192#define WL_TX_POWER_MCS40_NUM 17
1401 1193
1402typedef struct {
1403 u32 flags;
1404 chanspec_t chanspec; /* txpwr report for this channel */
1405 chanspec_t local_chanspec; /* channel on which we are associated */
1406 u8 local_max; /* local max according to the AP */
1407 u8 local_constraint; /* local constraint according to the AP */
1408 s8 antgain[2]; /* Ant gain for each band - from SROM */
1409 u8 rf_cores; /* count of RF Cores being reported */
1410 u8 est_Pout[4]; /* Latest tx power out estimate per RF
1411 * chain without adjustment
1412 */
1413 u8 est_Pout_cck; /* Latest CCK tx power out estimate */
1414 u8 user_limit[WL_TX_POWER_RATES_LEGACY]; /* User limit */
1415 u8 reg_limit[WL_TX_POWER_RATES_LEGACY]; /* Regulatory power limit */
1416 u8 board_limit[WL_TX_POWER_RATES_LEGACY]; /* Max power board can support (SROM) */
1417 u8 target[WL_TX_POWER_RATES_LEGACY]; /* Latest target power */
1418} tx_power_legacy2_t;
1419 1194
1420#define WL_TX_POWER_RATES 101 1195#define WL_TX_POWER_RATES 101
1421#define WL_TX_POWER_CCK_FIRST 0 1196#define WL_TX_POWER_CCK_FIRST 0
@@ -1848,63 +1623,6 @@ struct ampdu_retry_tid {
1848 u8 retry; /* retry value */ 1623 u8 retry; /* retry value */
1849}; 1624};
1850 1625
1851/* structure for addts arguments */
1852/* For ioctls that take a list of TSPEC */
1853struct tslist {
1854 int count; /* number of tspecs */
1855 struct tsinfo_arg tsinfo[1]; /* variable length array of tsinfo */
1856};
1857
1858/* structure for addts/delts arguments */
1859typedef struct tspec_arg {
1860 u16 version; /* see definition of TSPEC_ARG_VERSION */
1861 u16 length; /* length of entire structure */
1862 uint flag; /* bit field */
1863 /* TSPEC Arguments */
1864 struct tsinfo_arg tsinfo; /* TS Info bit field */
1865 u16 nom_msdu_size; /* (Nominal or fixed) MSDU Size (bytes) */
1866 u16 max_msdu_size; /* Maximum MSDU Size (bytes) */
1867 uint min_srv_interval; /* Minimum Service Interval (us) */
1868 uint max_srv_interval; /* Maximum Service Interval (us) */
1869 uint inactivity_interval; /* Inactivity Interval (us) */
1870 uint suspension_interval; /* Suspension Interval (us) */
1871 uint srv_start_time; /* Service Start Time (us) */
1872 uint min_data_rate; /* Minimum Data Rate (bps) */
1873 uint mean_data_rate; /* Mean Data Rate (bps) */
1874 uint peak_data_rate; /* Peak Data Rate (bps) */
1875 uint max_burst_size; /* Maximum Burst Size (bytes) */
1876 uint delay_bound; /* Delay Bound (us) */
1877 uint min_phy_rate; /* Minimum PHY Rate (bps) */
1878 u16 surplus_bw; /* Surplus Bandwidth Allowance (range 1.0 to 8.0) */
1879 u16 medium_time; /* Medium Time (32 us/s periods) */
1880 u8 dialog_token; /* dialog token */
1881} tspec_arg_t;
1882
1883/* tspec arg for desired station */
1884typedef struct tspec_per_sta_arg {
1885 struct ether_addr ea;
1886 struct tspec_arg ts;
1887} tspec_per_sta_arg_t;
1888
1889/* structure for max bandwidth for each access category */
1890typedef struct wme_max_bandwidth {
1891 u32 ac[AC_COUNT]; /* max bandwidth for each access category */
1892} wme_max_bandwidth_t;
1893
1894#define WL_WME_MBW_PARAMS_IO_BYTES (sizeof(wme_max_bandwidth_t))
1895
1896/* current version of wl_tspec_arg_t struct */
1897#define TSPEC_ARG_VERSION 2 /* current version of wl_tspec_arg_t struct */
1898#define TSPEC_ARG_LENGTH 55 /* argument length from tsinfo to medium_time */
1899#define TSPEC_DEFAULT_DIALOG_TOKEN 42 /* default dialog token */
1900#define TSPEC_DEFAULT_SBW_FACTOR 0x3000 /* default surplus bw */
1901
1902/* define for flag */
1903#define TSPEC_PENDING 0 /* TSPEC pending */
1904#define TSPEC_ACCEPTED 1 /* TSPEC accepted */
1905#define TSPEC_REJECTED 2 /* TSPEC rejected */
1906#define TSPEC_UNKNOWN 3 /* TSPEC unknown */
1907#define TSPEC_STATUS_MASK 7 /* TSPEC status mask */
1908 1626
1909/* Software feature flag defines used by wlfeatureflag */ 1627/* Software feature flag defines used by wlfeatureflag */
1910#define WL_SWFL_NOHWRADIO 0x0004 1628#define WL_SWFL_NOHWRADIO 0x0004
@@ -1913,16 +1631,6 @@ typedef struct wme_max_bandwidth {
1913 1631
1914#define WL_LIFETIME_MAX 0xFFFF /* Max value in ms */ 1632#define WL_LIFETIME_MAX 0xFFFF /* Max value in ms */
1915 1633
1916/*
1917 * Dongle pattern matching filter.
1918 */
1919
1920/* Packet filter types. Currently, only pattern matching is supported. */
1921typedef enum wl_pkt_filter_type {
1922 WL_PKT_FILTER_TYPE_PATTERN_MATCH /* Pattern matching filter */
1923} wl_pkt_filter_type_t;
1924
1925#define WL_PKT_FILTER_TYPE wl_pkt_filter_type_t
1926 1634
1927/* Pattern matching filter. Specifies an offset within received packets to 1635/* Pattern matching filter. Specifies an offset within received packets to
1928 * start matching, the pattern to match, the size of the pattern, and a bitmask 1636 * start matching, the pattern to match, the size of the pattern, and a bitmask
@@ -1957,20 +1665,6 @@ typedef struct wl_pkt_filter_enable {
1957 u32 enable; /* Enable/disable bool */ 1665 u32 enable; /* Enable/disable bool */
1958} wl_pkt_filter_enable_t; 1666} wl_pkt_filter_enable_t;
1959 1667
1960/* IOVAR "pkt_filter_list" parameter. Used to retrieve a list of installed filters. */
1961typedef struct wl_pkt_filter_list {
1962 u32 num; /* Number of installed packet filters */
1963 wl_pkt_filter_t filter[1]; /* Variable array of packet filters. */
1964} wl_pkt_filter_list_t;
1965
1966#define WL_PKT_FILTER_LIST_FIXED_LEN offsetof(wl_pkt_filter_list_t, filter)
1967
1968/* IOVAR "pkt_filter_stats" parameter. Used to retrieve debug statistics. */
1969typedef struct wl_pkt_filter_stats {
1970 u32 num_pkts_matched; /* # filter matches for specified filter id */
1971 u32 num_pkts_forwarded; /* # packets fwded from dongle to host for all filters */
1972 u32 num_pkts_discarded; /* # packets discarded by dongle for all filters */
1973} wl_pkt_filter_stats_t;
1974 1668
1975#define WLC_RSSI_INVALID 0 /* invalid RSSI value */ 1669#define WLC_RSSI_INVALID 0 /* invalid RSSI value */
1976 1670