xref: /linux/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h (revision 9410645520e9b820069761f3450ef6661418e279)
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);
8431343230SArend van Spriel static inline
brcmf_fil_cmd_int_set(struct brcmf_if * ifp,u32 cmd,u32 data)8531343230SArend van Spriel s32 brcmf_fil_cmd_int_set(struct brcmf_if *ifp, u32 cmd, u32 data)
8631343230SArend van Spriel {
8731343230SArend van Spriel 	s32 err;
8831343230SArend van Spriel 	__le32 data_le = cpu_to_le32(data);
8905491d2cSKalle Valo 
9031343230SArend van Spriel 	brcmf_dbg(FIL, "ifidx=%d, cmd=%d, value=%d\n", ifp->ifidx, cmd, data);
9131343230SArend van Spriel 	err = brcmf_fil_cmd_data_set(ifp, cmd, &data_le, sizeof(data_le));
9231343230SArend van Spriel 
9331343230SArend van Spriel 	return err;
9431343230SArend van Spriel }
9531343230SArend van Spriel static inline
brcmf_fil_cmd_int_get(struct brcmf_if * ifp,u32 cmd,u32 * data)9631343230SArend van Spriel s32 brcmf_fil_cmd_int_get(struct brcmf_if *ifp, u32 cmd, u32 *data)
9731343230SArend van Spriel {
9831343230SArend van Spriel 	s32 err;
9931343230SArend van Spriel 
100*c6002b6cSArend van Spriel 	err = brcmf_fil_cmd_data_get(ifp, cmd, data, sizeof(*data));
10131343230SArend van Spriel 	if (err == 0)
102*c6002b6cSArend van Spriel 		*data = le32_to_cpu(*(__le32 *)data);
10331343230SArend van Spriel 	brcmf_dbg(FIL, "ifidx=%d, cmd=%d, value=%d\n", ifp->ifidx, cmd, *data);
10431343230SArend van Spriel 
10531343230SArend van Spriel 	return err;
10631343230SArend van Spriel }
107*c6002b6cSArend van Spriel static inline
brcmf_fil_cmd_int_query(struct brcmf_if * ifp,u32 cmd,u32 * data)108*c6002b6cSArend van Spriel s32 brcmf_fil_cmd_int_query(struct brcmf_if *ifp, u32 cmd, u32 *data)
109*c6002b6cSArend van Spriel {
110*c6002b6cSArend van Spriel 	__le32 *data_le = (__le32 *)data;
111*c6002b6cSArend van Spriel 
112*c6002b6cSArend van Spriel 	*data_le = cpu_to_le32(*data);
113*c6002b6cSArend van Spriel 	return brcmf_fil_cmd_int_get(ifp, cmd, data);
114*c6002b6cSArend van Spriel }
11531343230SArend van Spriel 
11631343230SArend van Spriel s32 brcmf_fil_iovar_data_set(struct brcmf_if *ifp, const char *name,
11731343230SArend van Spriel 			     const void *data, u32 len);
118e7191182SHector Martin s32 brcmf_fil_iovar_data_get(struct brcmf_if *ifp, const char *name, void *data,
11905491d2cSKalle Valo 			     u32 len);
12031343230SArend van Spriel static inline
brcmf_fil_iovar_int_set(struct brcmf_if * ifp,const char * name,u32 data)12131343230SArend van Spriel s32 brcmf_fil_iovar_int_set(struct brcmf_if *ifp, const char *name, u32 data)
12231343230SArend van Spriel {
12331343230SArend van Spriel 	__le32 data_le = cpu_to_le32(data);
12405491d2cSKalle Valo 
12531343230SArend van Spriel 	return brcmf_fil_iovar_data_set(ifp, name, &data_le, sizeof(data_le));
12631343230SArend van Spriel }
12731343230SArend van Spriel static inline
brcmf_fil_iovar_int_get(struct brcmf_if * ifp,const char * name,u32 * data)12831343230SArend van Spriel s32 brcmf_fil_iovar_int_get(struct brcmf_if *ifp, const char *name, u32 *data)
12931343230SArend van Spriel {
13031343230SArend van Spriel 	s32 err;
13131343230SArend van Spriel 
132*c6002b6cSArend van Spriel 	err = brcmf_fil_iovar_data_get(ifp, name, data, sizeof(*data));
13331343230SArend van Spriel 	if (err == 0)
134*c6002b6cSArend van Spriel 		*data = le32_to_cpu(*(__le32 *)data);
13531343230SArend van Spriel 	return err;
13631343230SArend van Spriel }
137*c6002b6cSArend van Spriel static inline
brcmf_fil_iovar_int_query(struct brcmf_if * ifp,const char * name,u32 * data)138*c6002b6cSArend van Spriel s32 brcmf_fil_iovar_int_query(struct brcmf_if *ifp, const char *name, u32 *data)
139*c6002b6cSArend van Spriel {
140*c6002b6cSArend van Spriel 	__le32 *data_le = (__le32 *)data;
141*c6002b6cSArend van Spriel 
142*c6002b6cSArend van Spriel 	*data_le = cpu_to_le32(*data);
143*c6002b6cSArend van Spriel 	return brcmf_fil_iovar_int_get(ifp, name, data);
144*c6002b6cSArend van Spriel }
14531343230SArend van Spriel 
14631343230SArend van Spriel 
14731343230SArend van Spriel s32 brcmf_fil_bsscfg_data_set(struct brcmf_if *ifp, const char *name,
14831343230SArend van Spriel 			      void *data, u32 len);
14931343230SArend van Spriel s32 brcmf_fil_bsscfg_data_get(struct brcmf_if *ifp, const char *name,
15031343230SArend van Spriel 			      void *data, u32 len);
15131343230SArend van Spriel static inline
brcmf_fil_bsscfg_int_set(struct brcmf_if * ifp,const char * name,u32 data)15231343230SArend van Spriel s32 brcmf_fil_bsscfg_int_set(struct brcmf_if *ifp, const char *name, u32 data)
15331343230SArend van Spriel {
15431343230SArend van Spriel 	__le32 data_le = cpu_to_le32(data);
15531343230SArend van Spriel 
15631343230SArend van Spriel 	return brcmf_fil_bsscfg_data_set(ifp, name, &data_le,
15731343230SArend van Spriel 					 sizeof(data_le));
15831343230SArend van Spriel }
15931343230SArend van Spriel static inline
brcmf_fil_bsscfg_int_get(struct brcmf_if * ifp,const char * name,u32 * data)16031343230SArend van Spriel s32 brcmf_fil_bsscfg_int_get(struct brcmf_if *ifp, const char *name, u32 *data)
16131343230SArend van Spriel {
16231343230SArend van Spriel 	s32 err;
16331343230SArend van Spriel 
164*c6002b6cSArend van Spriel 	err = brcmf_fil_bsscfg_data_get(ifp, name, data, sizeof(*data));
16531343230SArend van Spriel 	if (err == 0)
166*c6002b6cSArend van Spriel 		*data = le32_to_cpu(*(__le32 *)data);
16731343230SArend van Spriel 	return err;
16831343230SArend van Spriel }
169*c6002b6cSArend van Spriel static inline
brcmf_fil_bsscfg_int_query(struct brcmf_if * ifp,const char * name,u32 * data)170*c6002b6cSArend van Spriel s32 brcmf_fil_bsscfg_int_query(struct brcmf_if *ifp, const char *name, u32 *data)
171*c6002b6cSArend van Spriel {
172*c6002b6cSArend van Spriel 	__le32 *data_le = (__le32 *)data;
173*c6002b6cSArend van Spriel 
174*c6002b6cSArend van Spriel 	*data_le = cpu_to_le32(*data);
175*c6002b6cSArend van Spriel 	return brcmf_fil_bsscfg_int_get(ifp, name, data);
176*c6002b6cSArend van Spriel }
17731343230SArend van Spriel 
178e7191182SHector Martin s32 brcmf_fil_xtlv_data_set(struct brcmf_if *ifp, const char *name, u16 id,
179a7dd0ac9SArend van Spriel 			    void *data, u32 len);
180e7191182SHector Martin s32 brcmf_fil_xtlv_data_get(struct brcmf_if *ifp, const char *name, u16 id,
181a7dd0ac9SArend van Spriel 			    void *data, u32 len);
18231343230SArend van Spriel static inline
brcmf_fil_xtlv_int_set(struct brcmf_if * ifp,const char * name,u16 id,u32 data)18331343230SArend van Spriel s32 brcmf_fil_xtlv_int_set(struct brcmf_if *ifp, const char *name, u16 id,
18431343230SArend van Spriel 			   u32 data)
18531343230SArend van Spriel {
18631343230SArend van Spriel 	__le32 data_le = cpu_to_le32(data);
18731343230SArend van Spriel 
18831343230SArend van Spriel 	return brcmf_fil_xtlv_data_set(ifp, name, id, &data_le,
18931343230SArend van Spriel 					 sizeof(data_le));
19031343230SArend van Spriel }
19131343230SArend van Spriel static inline
brcmf_fil_xtlv_int_get(struct brcmf_if * ifp,const char * name,u16 id,u32 * data)19231343230SArend van Spriel s32 brcmf_fil_xtlv_int_get(struct brcmf_if *ifp, const char *name, u16 id,
19331343230SArend van Spriel 			   u32 *data)
19431343230SArend van Spriel {
19531343230SArend van Spriel 	__le32 data_le = cpu_to_le32(*data);
19631343230SArend van Spriel 	s32 err;
19731343230SArend van Spriel 
19831343230SArend van Spriel 	err = brcmf_fil_xtlv_data_get(ifp, name, id, &data_le, sizeof(data_le));
19931343230SArend van Spriel 	if (err == 0)
20031343230SArend van Spriel 		*data = le32_to_cpu(data_le);
20131343230SArend van Spriel 	return err;
20231343230SArend van Spriel }
20331343230SArend van Spriel static inline
brcmf_fil_xtlv_int8_get(struct brcmf_if * ifp,const char * name,u16 id,u8 * data)20431343230SArend van Spriel s32 brcmf_fil_xtlv_int8_get(struct brcmf_if *ifp, const char *name, u16 id,
20531343230SArend van Spriel 			    u8 *data)
20631343230SArend van Spriel {
20731343230SArend van Spriel 	return brcmf_fil_xtlv_data_get(ifp, name, id, data, sizeof(*data));
20831343230SArend van Spriel }
20931343230SArend van Spriel static inline
brcmf_fil_xtlv_int16_get(struct brcmf_if * ifp,const char * name,u16 id,u16 * data)21031343230SArend van Spriel s32 brcmf_fil_xtlv_int16_get(struct brcmf_if *ifp, const char *name, u16 id,
21131343230SArend van Spriel 			     u16 *data)
21231343230SArend van Spriel {
21331343230SArend van Spriel 	__le16 data_le = cpu_to_le16(*data);
21431343230SArend van Spriel 	s32 err;
21531343230SArend van Spriel 
21631343230SArend van Spriel 	err = brcmf_fil_xtlv_data_get(ifp, name, id, &data_le, sizeof(data_le));
21731343230SArend van Spriel 	if (err == 0)
21831343230SArend van Spriel 		*data = le16_to_cpu(data_le);
21931343230SArend van Spriel 	return err;
22031343230SArend van Spriel }
22105491d2cSKalle Valo 
22205491d2cSKalle Valo #endif /* _fwil_h_ */
223