xref: /linux/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h (revision 31343230abb1683e8afb254e6b13a7a7fd01fcac)
1daeccac2SArend van Spriel // SPDX-License-Identifier: ISC
205491d2cSKalle Valo /*
305491d2cSKalle Valo  * Copyright (c) 2012 Broadcom Corporation
405491d2cSKalle Valo  */
505491d2cSKalle Valo 
605491d2cSKalle Valo #ifndef _fwil_h_
705491d2cSKalle Valo #define _fwil_h_
805491d2cSKalle Valo 
905491d2cSKalle Valo /*******************************************************************************
1005491d2cSKalle Valo  * Dongle command codes that are interpreted by firmware
1105491d2cSKalle Valo  ******************************************************************************/
1205491d2cSKalle Valo #define BRCMF_C_GET_VERSION			1
1305491d2cSKalle Valo #define BRCMF_C_UP				2
1405491d2cSKalle Valo #define BRCMF_C_DOWN				3
1505491d2cSKalle Valo #define BRCMF_C_SET_PROMISC			10
1605491d2cSKalle Valo #define BRCMF_C_GET_RATE			12
1705491d2cSKalle Valo #define BRCMF_C_GET_INFRA			19
1805491d2cSKalle Valo #define BRCMF_C_SET_INFRA			20
1905491d2cSKalle Valo #define BRCMF_C_GET_AUTH			21
2005491d2cSKalle Valo #define BRCMF_C_SET_AUTH			22
2105491d2cSKalle Valo #define BRCMF_C_GET_BSSID			23
2205491d2cSKalle Valo #define BRCMF_C_GET_SSID			25
2305491d2cSKalle Valo #define BRCMF_C_SET_SSID			26
2405491d2cSKalle Valo #define BRCMF_C_TERMINATED			28
2505491d2cSKalle Valo #define BRCMF_C_GET_CHANNEL			29
2605491d2cSKalle Valo #define BRCMF_C_SET_CHANNEL			30
2705491d2cSKalle Valo #define BRCMF_C_GET_SRL				31
2805491d2cSKalle Valo #define BRCMF_C_SET_SRL				32
2905491d2cSKalle Valo #define BRCMF_C_GET_LRL				33
3005491d2cSKalle Valo #define BRCMF_C_SET_LRL				34
3105491d2cSKalle Valo #define BRCMF_C_GET_RADIO			37
3205491d2cSKalle Valo #define BRCMF_C_SET_RADIO			38
3305491d2cSKalle Valo #define BRCMF_C_GET_PHYTYPE			39
3405491d2cSKalle Valo #define BRCMF_C_SET_KEY				45
3505491d2cSKalle Valo #define BRCMF_C_GET_REGULATORY			46
3605491d2cSKalle Valo #define BRCMF_C_SET_REGULATORY			47
3705491d2cSKalle Valo #define BRCMF_C_SET_PASSIVE_SCAN		49
3805491d2cSKalle Valo #define BRCMF_C_SCAN				50
3905491d2cSKalle Valo #define BRCMF_C_SCAN_RESULTS			51
4005491d2cSKalle Valo #define BRCMF_C_DISASSOC			52
4105491d2cSKalle Valo #define BRCMF_C_REASSOC				53
4205491d2cSKalle Valo #define BRCMF_C_SET_ROAM_TRIGGER		55
4305491d2cSKalle Valo #define BRCMF_C_SET_ROAM_DELTA			57
4405491d2cSKalle Valo #define BRCMF_C_GET_BCNPRD			75
4505491d2cSKalle Valo #define BRCMF_C_SET_BCNPRD			76
4605491d2cSKalle Valo #define BRCMF_C_GET_DTIMPRD			77
4705491d2cSKalle Valo #define BRCMF_C_SET_DTIMPRD			78
4805491d2cSKalle Valo #define BRCMF_C_SET_COUNTRY			84
4905491d2cSKalle Valo #define BRCMF_C_GET_PM				85
5005491d2cSKalle Valo #define BRCMF_C_SET_PM				86
5105491d2cSKalle Valo #define BRCMF_C_GET_REVINFO			98
5220f2c5faSRafał Miłecki #define BRCMF_C_GET_MONITOR			107
5320f2c5faSRafał Miłecki #define BRCMF_C_SET_MONITOR			108
5405491d2cSKalle Valo #define BRCMF_C_GET_CURR_RATESET		114
5505491d2cSKalle Valo #define BRCMF_C_GET_AP				117
5605491d2cSKalle Valo #define BRCMF_C_SET_AP				118
5705491d2cSKalle Valo #define BRCMF_C_SET_SCB_AUTHORIZE		121
5805491d2cSKalle Valo #define BRCMF_C_SET_SCB_DEAUTHORIZE		122
5905491d2cSKalle Valo #define BRCMF_C_GET_RSSI			127
6005491d2cSKalle Valo #define BRCMF_C_GET_WSEC			133
6105491d2cSKalle Valo #define BRCMF_C_SET_WSEC			134
6205491d2cSKalle Valo #define BRCMF_C_GET_PHY_NOISE			135
6305491d2cSKalle Valo #define BRCMF_C_GET_BSS_INFO			136
643f5893d1SHante Meuleman #define BRCMF_C_GET_GET_PKTCNTS			137
6505491d2cSKalle Valo #define BRCMF_C_GET_BANDLIST			140
6605491d2cSKalle Valo #define BRCMF_C_SET_SCB_TIMEOUT			158
6705491d2cSKalle Valo #define BRCMF_C_GET_ASSOCLIST			159
6805491d2cSKalle Valo #define BRCMF_C_GET_PHYLIST			180
6905491d2cSKalle Valo #define BRCMF_C_SET_SCAN_CHANNEL_TIME		185
7005491d2cSKalle Valo #define BRCMF_C_SET_SCAN_UNASSOC_TIME		187
7105491d2cSKalle Valo #define BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON	201
727705ba6fSArend van Spriel #define BRCMF_C_SET_ASSOC_PREFER		205
7305491d2cSKalle Valo #define BRCMF_C_GET_VALID_CHANNELS		217
74a3bdc6deSWright Feng #define BRCMF_C_SET_FAKEFRAG			219
7505491d2cSKalle Valo #define BRCMF_C_GET_KEY_PRIMARY			235
7605491d2cSKalle Valo #define BRCMF_C_SET_KEY_PRIMARY			236
7705491d2cSKalle Valo #define BRCMF_C_SET_SCAN_PASSIVE_TIME		258
7805491d2cSKalle Valo #define BRCMF_C_GET_VAR				262
7905491d2cSKalle Valo #define BRCMF_C_SET_VAR				263
80b8a64f0eSArend van Spriel #define BRCMF_C_SET_WSEC_PMK			268
8105491d2cSKalle Valo 
8205491d2cSKalle Valo s32 brcmf_fil_cmd_data_set(struct brcmf_if *ifp, u32 cmd, void *data, u32 len);
8305491d2cSKalle Valo s32 brcmf_fil_cmd_data_get(struct brcmf_if *ifp, u32 cmd, void *data, u32 len);
84*31343230SArend van Spriel static inline
85*31343230SArend van Spriel s32 brcmf_fil_cmd_int_set(struct brcmf_if *ifp, u32 cmd, u32 data)
86*31343230SArend van Spriel {
87*31343230SArend van Spriel 	s32 err;
88*31343230SArend van Spriel 	__le32 data_le = cpu_to_le32(data);
8905491d2cSKalle Valo 
90*31343230SArend van Spriel 	brcmf_dbg(FIL, "ifidx=%d, cmd=%d, value=%d\n", ifp->ifidx, cmd, data);
91*31343230SArend van Spriel 	err = brcmf_fil_cmd_data_set(ifp, cmd, &data_le, sizeof(data_le));
92*31343230SArend van Spriel 
93*31343230SArend van Spriel 	return err;
94*31343230SArend van Spriel }
95*31343230SArend van Spriel static inline
96*31343230SArend van Spriel s32 brcmf_fil_cmd_int_get(struct brcmf_if *ifp, u32 cmd, u32 *data)
97*31343230SArend van Spriel {
98*31343230SArend van Spriel 	s32 err;
99*31343230SArend van Spriel 	__le32 data_le = cpu_to_le32(*data);
100*31343230SArend van Spriel 
101*31343230SArend van Spriel 	err = brcmf_fil_cmd_data_get(ifp, cmd, &data_le, sizeof(data_le));
102*31343230SArend van Spriel 	if (err == 0)
103*31343230SArend van Spriel 		*data = le32_to_cpu(data_le);
104*31343230SArend van Spriel 	brcmf_dbg(FIL, "ifidx=%d, cmd=%d, value=%d\n", ifp->ifidx, cmd, *data);
105*31343230SArend van Spriel 
106*31343230SArend van Spriel 	return err;
107*31343230SArend van Spriel }
108*31343230SArend van Spriel 
109*31343230SArend van Spriel s32 brcmf_fil_iovar_data_set(struct brcmf_if *ifp, const char *name,
110*31343230SArend van Spriel 			     const void *data, u32 len);
111e7191182SHector Martin s32 brcmf_fil_iovar_data_get(struct brcmf_if *ifp, const char *name, void *data,
11205491d2cSKalle Valo 			     u32 len);
113*31343230SArend van Spriel static inline
114*31343230SArend van Spriel s32 brcmf_fil_iovar_int_set(struct brcmf_if *ifp, const char *name, u32 data)
115*31343230SArend van Spriel {
116*31343230SArend van Spriel 	__le32 data_le = cpu_to_le32(data);
11705491d2cSKalle Valo 
118*31343230SArend van Spriel 	return brcmf_fil_iovar_data_set(ifp, name, &data_le, sizeof(data_le));
119*31343230SArend van Spriel }
120*31343230SArend van Spriel static inline
121*31343230SArend van Spriel s32 brcmf_fil_iovar_int_get(struct brcmf_if *ifp, const char *name, u32 *data)
122*31343230SArend van Spriel {
123*31343230SArend van Spriel 	__le32 data_le = cpu_to_le32(*data);
124*31343230SArend van Spriel 	s32 err;
125*31343230SArend van Spriel 
126*31343230SArend van Spriel 	err = brcmf_fil_iovar_data_get(ifp, name, &data_le, sizeof(data_le));
127*31343230SArend van Spriel 	if (err == 0)
128*31343230SArend van Spriel 		*data = le32_to_cpu(data_le);
129*31343230SArend van Spriel 	return err;
130*31343230SArend van Spriel }
131*31343230SArend van Spriel 
132*31343230SArend van Spriel 
133*31343230SArend van Spriel s32 brcmf_fil_bsscfg_data_set(struct brcmf_if *ifp, const char *name,
134*31343230SArend van Spriel 			      void *data, u32 len);
135*31343230SArend van Spriel s32 brcmf_fil_bsscfg_data_get(struct brcmf_if *ifp, const char *name,
136*31343230SArend van Spriel 			      void *data, u32 len);
137*31343230SArend van Spriel static inline
138*31343230SArend van Spriel s32 brcmf_fil_bsscfg_int_set(struct brcmf_if *ifp, const char *name, u32 data)
139*31343230SArend van Spriel {
140*31343230SArend van Spriel 	__le32 data_le = cpu_to_le32(data);
141*31343230SArend van Spriel 
142*31343230SArend van Spriel 	return brcmf_fil_bsscfg_data_set(ifp, name, &data_le,
143*31343230SArend van Spriel 					 sizeof(data_le));
144*31343230SArend van Spriel }
145*31343230SArend van Spriel static inline
146*31343230SArend van Spriel s32 brcmf_fil_bsscfg_int_get(struct brcmf_if *ifp, const char *name, u32 *data)
147*31343230SArend van Spriel {
148*31343230SArend van Spriel 	__le32 data_le = cpu_to_le32(*data);
149*31343230SArend van Spriel 	s32 err;
150*31343230SArend van Spriel 
151*31343230SArend van Spriel 	err = brcmf_fil_bsscfg_data_get(ifp, name, &data_le,
152*31343230SArend van Spriel 					sizeof(data_le));
153*31343230SArend van Spriel 	if (err == 0)
154*31343230SArend van Spriel 		*data = le32_to_cpu(data_le);
155*31343230SArend van Spriel 	return err;
156*31343230SArend van Spriel }
157*31343230SArend van Spriel 
158e7191182SHector Martin s32 brcmf_fil_xtlv_data_set(struct brcmf_if *ifp, const char *name, u16 id,
159a7dd0ac9SArend van Spriel 			    void *data, u32 len);
160e7191182SHector Martin s32 brcmf_fil_xtlv_data_get(struct brcmf_if *ifp, const char *name, u16 id,
161a7dd0ac9SArend van Spriel 			    void *data, u32 len);
162*31343230SArend van Spriel static inline
163*31343230SArend van Spriel s32 brcmf_fil_xtlv_int_set(struct brcmf_if *ifp, const char *name, u16 id,
164*31343230SArend van Spriel 			   u32 data)
165*31343230SArend van Spriel {
166*31343230SArend van Spriel 	__le32 data_le = cpu_to_le32(data);
167*31343230SArend van Spriel 
168*31343230SArend van Spriel 	return brcmf_fil_xtlv_data_set(ifp, name, id, &data_le,
169*31343230SArend van Spriel 					 sizeof(data_le));
170*31343230SArend van Spriel }
171*31343230SArend van Spriel static inline
172*31343230SArend van Spriel s32 brcmf_fil_xtlv_int_get(struct brcmf_if *ifp, const char *name, u16 id,
173*31343230SArend van Spriel 			   u32 *data)
174*31343230SArend van Spriel {
175*31343230SArend van Spriel 	__le32 data_le = cpu_to_le32(*data);
176*31343230SArend van Spriel 	s32 err;
177*31343230SArend van Spriel 
178*31343230SArend van Spriel 	err = brcmf_fil_xtlv_data_get(ifp, name, id, &data_le, sizeof(data_le));
179*31343230SArend van Spriel 	if (err == 0)
180*31343230SArend van Spriel 		*data = le32_to_cpu(data_le);
181*31343230SArend van Spriel 	return err;
182*31343230SArend van Spriel }
183*31343230SArend van Spriel static inline
184*31343230SArend van Spriel s32 brcmf_fil_xtlv_int8_get(struct brcmf_if *ifp, const char *name, u16 id,
185*31343230SArend van Spriel 			    u8 *data)
186*31343230SArend van Spriel {
187*31343230SArend van Spriel 	return brcmf_fil_xtlv_data_get(ifp, name, id, data, sizeof(*data));
188*31343230SArend van Spriel }
189*31343230SArend van Spriel static inline
190*31343230SArend van Spriel s32 brcmf_fil_xtlv_int16_get(struct brcmf_if *ifp, const char *name, u16 id,
191*31343230SArend van Spriel 			     u16 *data)
192*31343230SArend van Spriel {
193*31343230SArend van Spriel 	__le16 data_le = cpu_to_le16(*data);
194*31343230SArend van Spriel 	s32 err;
195*31343230SArend van Spriel 
196*31343230SArend van Spriel 	err = brcmf_fil_xtlv_data_get(ifp, name, id, &data_le, sizeof(data_le));
197*31343230SArend van Spriel 	if (err == 0)
198*31343230SArend van Spriel 		*data = le16_to_cpu(data_le);
199*31343230SArend van Spriel 	return err;
200*31343230SArend van Spriel }
20105491d2cSKalle Valo 
20205491d2cSKalle Valo #endif /* _fwil_h_ */
203