1 /* Copyright (c) 2014 Broadcom Corporation
2  *
3  * Permission to use, copy, modify, and/or distribute this software for any
4  * purpose with or without fee is hereby granted, provided that the above
5  * copyright notice and this permission notice appear in all copies.
6  *
7  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14  */
15 #ifndef BRCMFMAC_MSGBUF_H
16 #define BRCMFMAC_MSGBUF_H
17 
18 #ifdef CONFIG_BRCMFMAC_PROTO_MSGBUF
19 
20 #define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM	64
21 #define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM	512
22 #define BRCMF_D2H_MSGRING_CONTROL_COMPLETE_MAX_ITEM	64
23 #define BRCMF_D2H_MSGRING_TX_COMPLETE_MAX_ITEM		1024
24 #define BRCMF_D2H_MSGRING_RX_COMPLETE_MAX_ITEM		512
25 #define BRCMF_H2D_TXFLOWRING_MAX_ITEM			512
26 
27 #define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_ITEMSIZE	40
28 #define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_ITEMSIZE	32
29 #define BRCMF_D2H_MSGRING_CONTROL_COMPLETE_ITEMSIZE	24
30 #define BRCMF_D2H_MSGRING_TX_COMPLETE_ITEMSIZE_PRE_V7	16
31 #define BRCMF_D2H_MSGRING_TX_COMPLETE_ITEMSIZE		24
32 #define BRCMF_D2H_MSGRING_RX_COMPLETE_ITEMSIZE_PRE_V7	32
33 #define BRCMF_D2H_MSGRING_RX_COMPLETE_ITEMSIZE		40
34 #define BRCMF_H2D_TXFLOWRING_ITEMSIZE			48
35 
36 struct msgbuf_buf_addr {
37 	__le32		low_addr;
38 	__le32		high_addr;
39 };
40 
41 int brcmf_proto_msgbuf_rx_trigger(struct device *dev);
42 void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid);
43 int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr);
44 void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr);
45 #else
46 static inline int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)
47 {
48 	return 0;
49 }
50 static inline void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr) {}
51 #endif
52 
53 #endif /* BRCMFMAC_MSGBUF_H */
54