This source file includes following definitions.
- brcmf_bus_preinit
- brcmf_bus_stop
- brcmf_bus_txdata
- brcmf_bus_txctl
- brcmf_bus_rxctl
- brcmf_bus_gettxq
- brcmf_bus_wowl_config
- brcmf_bus_get_ramsize
- brcmf_bus_get_memdump
- brcmf_bus_get_fwname
- brcmf_bus_debugfs_create
- brcmf_bus_reset
1
2
3
4
5
6 #ifndef BRCMFMAC_BUS_H
7 #define BRCMFMAC_BUS_H
8
9 #include "debug.h"
10
11
12 #define BRCMF_H2D_MSGRING_CONTROL_SUBMIT 0
13 #define BRCMF_H2D_MSGRING_RXPOST_SUBMIT 1
14 #define BRCMF_H2D_MSGRING_FLOWRING_IDSTART 2
15 #define BRCMF_D2H_MSGRING_CONTROL_COMPLETE 2
16 #define BRCMF_D2H_MSGRING_TX_COMPLETE 3
17 #define BRCMF_D2H_MSGRING_RX_COMPLETE 4
18
19
20 #define BRCMF_NROF_H2D_COMMON_MSGRINGS 2
21 #define BRCMF_NROF_D2H_COMMON_MSGRINGS 3
22 #define BRCMF_NROF_COMMON_MSGRINGS (BRCMF_NROF_H2D_COMMON_MSGRINGS + \
23 BRCMF_NROF_D2H_COMMON_MSGRINGS)
24
25
26 enum brcmf_bus_state {
27 BRCMF_BUS_DOWN,
28 BRCMF_BUS_UP
29 };
30
31
32 enum brcmf_bus_protocol_type {
33 BRCMF_PROTO_BCDC,
34 BRCMF_PROTO_MSGBUF
35 };
36
37 struct brcmf_mp_device;
38
39 struct brcmf_bus_dcmd {
40 char *name;
41 char *param;
42 int param_len;
43 struct list_head list;
44 };
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70 struct brcmf_bus_ops {
71 int (*preinit)(struct device *dev);
72 void (*stop)(struct device *dev);
73 int (*txdata)(struct device *dev, struct sk_buff *skb);
74 int (*txctl)(struct device *dev, unsigned char *msg, uint len);
75 int (*rxctl)(struct device *dev, unsigned char *msg, uint len);
76 struct pktq * (*gettxq)(struct device *dev);
77 void (*wowl_config)(struct device *dev, bool enabled);
78 size_t (*get_ramsize)(struct device *dev);
79 int (*get_memdump)(struct device *dev, void *data, size_t len);
80 int (*get_fwname)(struct device *dev, const char *ext,
81 unsigned char *fw_name);
82 void (*debugfs_create)(struct device *dev);
83 int (*reset)(struct device *dev);
84 };
85
86
87
88
89
90
91
92
93
94
95
96
97
98 struct brcmf_bus_msgbuf {
99 struct brcmf_commonring *commonrings[BRCMF_NROF_COMMON_MSGRINGS];
100 struct brcmf_commonring **flowrings;
101 u32 rx_dataoffset;
102 u32 max_rxbufpost;
103 u16 max_flowrings;
104 u16 max_submissionrings;
105 u16 max_completionrings;
106 };
107
108
109
110
111
112
113
114
115 struct brcmf_bus_stats {
116 atomic_t pktcowed;
117 atomic_t pktcow_failed;
118 };
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136 struct brcmf_bus {
137 union {
138 struct brcmf_sdio_dev *sdio;
139 struct brcmf_usbdev *usb;
140 struct brcmf_pciedev *pcie;
141 } bus_priv;
142 enum brcmf_bus_protocol_type proto_type;
143 struct device *dev;
144 struct brcmf_pub *drvr;
145 enum brcmf_bus_state state;
146 struct brcmf_bus_stats stats;
147 uint maxctl;
148 u32 chip;
149 u32 chiprev;
150 bool always_use_fws_queue;
151 bool wowl_supported;
152
153 const struct brcmf_bus_ops *ops;
154 struct brcmf_bus_msgbuf *msgbuf;
155 };
156
157
158
159
160 static inline int brcmf_bus_preinit(struct brcmf_bus *bus)
161 {
162 if (!bus->ops->preinit)
163 return 0;
164 return bus->ops->preinit(bus->dev);
165 }
166
167 static inline void brcmf_bus_stop(struct brcmf_bus *bus)
168 {
169 bus->ops->stop(bus->dev);
170 }
171
172 static inline int brcmf_bus_txdata(struct brcmf_bus *bus, struct sk_buff *skb)
173 {
174 return bus->ops->txdata(bus->dev, skb);
175 }
176
177 static inline
178 int brcmf_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint len)
179 {
180 return bus->ops->txctl(bus->dev, msg, len);
181 }
182
183 static inline
184 int brcmf_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint len)
185 {
186 return bus->ops->rxctl(bus->dev, msg, len);
187 }
188
189 static inline
190 struct pktq *brcmf_bus_gettxq(struct brcmf_bus *bus)
191 {
192 if (!bus->ops->gettxq)
193 return ERR_PTR(-ENOENT);
194
195 return bus->ops->gettxq(bus->dev);
196 }
197
198 static inline
199 void brcmf_bus_wowl_config(struct brcmf_bus *bus, bool enabled)
200 {
201 if (bus->ops->wowl_config)
202 bus->ops->wowl_config(bus->dev, enabled);
203 }
204
205 static inline size_t brcmf_bus_get_ramsize(struct brcmf_bus *bus)
206 {
207 if (!bus->ops->get_ramsize)
208 return 0;
209
210 return bus->ops->get_ramsize(bus->dev);
211 }
212
213 static inline
214 int brcmf_bus_get_memdump(struct brcmf_bus *bus, void *data, size_t len)
215 {
216 if (!bus->ops->get_memdump)
217 return -EOPNOTSUPP;
218
219 return bus->ops->get_memdump(bus->dev, data, len);
220 }
221
222 static inline
223 int brcmf_bus_get_fwname(struct brcmf_bus *bus, const char *ext,
224 unsigned char *fw_name)
225 {
226 return bus->ops->get_fwname(bus->dev, ext, fw_name);
227 }
228
229 static inline
230 void brcmf_bus_debugfs_create(struct brcmf_bus *bus)
231 {
232 if (!bus->ops->debugfs_create)
233 return;
234
235 return bus->ops->debugfs_create(bus->dev);
236 }
237
238 static inline
239 int brcmf_bus_reset(struct brcmf_bus *bus)
240 {
241 if (!bus->ops->reset)
242 return -EOPNOTSUPP;
243
244 return bus->ops->reset(bus->dev);
245 }
246
247
248
249
250
251
252 void brcmf_rx_frame(struct device *dev, struct sk_buff *rxp, bool handle_event);
253
254 void brcmf_rx_event(struct device *dev, struct sk_buff *rxp);
255
256 int brcmf_alloc(struct device *dev, struct brcmf_mp_device *settings);
257
258 int brcmf_attach(struct device *dev);
259
260 void brcmf_detach(struct device *dev);
261 void brcmf_free(struct device *dev);
262
263 void brcmf_dev_reset(struct device *dev);
264
265 void brcmf_dev_coredump(struct device *dev);
266
267 void brcmf_fw_crashed(struct device *dev);
268
269
270 void brcmf_bus_change_state(struct brcmf_bus *bus, enum brcmf_bus_state state);
271
272 s32 brcmf_iovar_data_set(struct device *dev, char *name, void *data, u32 len);
273 void brcmf_bus_add_txhdrlen(struct device *dev, uint len);
274
275 #ifdef CONFIG_BRCMFMAC_SDIO
276 void brcmf_sdio_exit(void);
277 void brcmf_sdio_register(void);
278 #endif
279 #ifdef CONFIG_BRCMFMAC_USB
280 void brcmf_usb_exit(void);
281 void brcmf_usb_register(void);
282 #endif
283
284 #endif