summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h
blob: 31e080e4da6697a99238927cae7091c246935476 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
// SPDX-License-Identifier: ISC
/*
 * Copyright (c) 2012 Broadcom Corporation
 */

#ifndef _fwil_h_
#define _fwil_h_

/*******************************************************************************
 * Dongle command codes that are interpreted by firmware
 ******************************************************************************/
#define BRCMF_C_GET_VERSION			1
#define BRCMF_C_UP				2
#define BRCMF_C_DOWN				3
#define BRCMF_C_SET_PROMISC			10
#define BRCMF_C_GET_RATE			12
#define BRCMF_C_GET_INFRA			19
#define BRCMF_C_SET_INFRA			20
#define BRCMF_C_GET_AUTH			21
#define BRCMF_C_SET_AUTH			22
#define BRCMF_C_GET_BSSID			23
#define BRCMF_C_GET_SSID			25
#define BRCMF_C_SET_SSID			26
#define BRCMF_C_TERMINATED			28
#define BRCMF_C_GET_CHANNEL			29
#define BRCMF_C_SET_CHANNEL			30
#define BRCMF_C_GET_SRL				31
#define BRCMF_C_SET_SRL				32
#define BRCMF_C_GET_LRL				33
#define BRCMF_C_SET_LRL				34
#define BRCMF_C_GET_RADIO			37
#define BRCMF_C_SET_RADIO			38
#define BRCMF_C_GET_PHYTYPE			39
#define BRCMF_C_SET_KEY				45
#define BRCMF_C_GET_REGULATORY			46
#define BRCMF_C_SET_REGULATORY			47
#define BRCMF_C_SET_PASSIVE_SCAN		49
#define BRCMF_C_SCAN				50
#define BRCMF_C_SCAN_RESULTS			51
#define BRCMF_C_DISASSOC			52
#define BRCMF_C_REASSOC				53
#define BRCMF_C_SET_ROAM_TRIGGER		55
#define BRCMF_C_SET_ROAM_DELTA			57
#define BRCMF_C_GET_BCNPRD			75
#define BRCMF_C_SET_BCNPRD			76
#define BRCMF_C_GET_DTIMPRD			77
#define BRCMF_C_SET_DTIMPRD			78
#define BRCMF_C_SET_COUNTRY			84
#define BRCMF_C_GET_PM				85
#define BRCMF_C_SET_PM				86
#define BRCMF_C_GET_REVINFO			98
#define BRCMF_C_GET_MONITOR			107
#define BRCMF_C_SET_MONITOR			108
#define BRCMF_C_GET_CURR_RATESET		114
#define BRCMF_C_GET_AP				117
#define BRCMF_C_SET_AP				118
#define BRCMF_C_SET_SCB_AUTHORIZE		121
#define BRCMF_C_SET_SCB_DEAUTHORIZE		122
#define BRCMF_C_GET_RSSI			127
#define BRCMF_C_GET_WSEC			133
#define BRCMF_C_SET_WSEC			134
#define BRCMF_C_GET_PHY_NOISE			135
#define BRCMF_C_GET_BSS_INFO			136
#define BRCMF_C_GET_GET_PKTCNTS			137
#define BRCMF_C_GET_BANDLIST			140
#define BRCMF_C_SET_SCB_TIMEOUT			158
#define BRCMF_C_GET_ASSOCLIST			159
#define BRCMF_C_GET_PHYLIST			180
#define BRCMF_C_SET_SCAN_CHANNEL_TIME		185
#define BRCMF_C_SET_SCAN_UNASSOC_TIME		187
#define BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON	201
#define BRCMF_C_SET_ASSOC_PREFER		205
#define BRCMF_C_GET_VALID_CHANNELS		217
#define BRCMF_C_SET_FAKEFRAG			219
#define BRCMF_C_GET_KEY_PRIMARY			235
#define BRCMF_C_SET_KEY_PRIMARY			236
#define BRCMF_C_SET_SCAN_PASSIVE_TIME		258
#define BRCMF_C_GET_VAR				262
#define BRCMF_C_SET_VAR				263
#define BRCMF_C_SET_WSEC_PMK			268

s32 brcmf_fil_cmd_data_set(struct brcmf_if *ifp, u32 cmd, void *data, u32 len);
s32 brcmf_fil_cmd_data_get(struct brcmf_if *ifp, u32 cmd, void *data, u32 len);
static inline
s32 brcmf_fil_cmd_int_set(struct brcmf_if *ifp, u32 cmd, u32 data)
{
	s32 err;
	__le32 data_le = cpu_to_le32(data);

	brcmf_dbg(FIL, "ifidx=%d, cmd=%d, value=%d\n", ifp->ifidx, cmd, data);
	err = brcmf_fil_cmd_data_set(ifp, cmd, &data_le, sizeof(data_le));

	return err;
}
static inline
s32 brcmf_fil_cmd_int_get(struct brcmf_if *ifp, u32 cmd, u32 *data)
{
	s32 err;

	err = brcmf_fil_cmd_data_get(ifp, cmd, data, sizeof(*data));
	if (err == 0)
		*data = le32_to_cpu(*(__le32 *)data);
	brcmf_dbg(FIL, "ifidx=%d, cmd=%d, value=%d\n", ifp->ifidx, cmd, *data);

	return err;
}
static inline
s32 brcmf_fil_cmd_int_query(struct brcmf_if *ifp, u32 cmd, u32 *data)
{
	__le32 *data_le = (__le32 *)data;

	*data_le = cpu_to_le32(*data);
	return brcmf_fil_cmd_int_get(ifp, cmd, data);
}

s32 brcmf_fil_iovar_data_set(struct brcmf_if *ifp, const char *name,
			     const void *data, u32 len);
s32 brcmf_fil_iovar_data_get(struct brcmf_if *ifp, const char *name, void *data,
			     u32 len);
static inline
s32 brcmf_fil_iovar_int_set(struct brcmf_if *ifp, const char *name, u32 data)
{
	__le32 data_le = cpu_to_le32(data);

	return brcmf_fil_iovar_data_set(ifp, name, &data_le, sizeof(data_le));
}
static inline
s32 brcmf_fil_iovar_int_get(struct brcmf_if *ifp, const char *name, u32 *data)
{
	s32 err;

	err = brcmf_fil_iovar_data_get(ifp, name, data, sizeof(*data));
	if (err == 0)
		*data = le32_to_cpu(*(__le32 *)data);
	return err;
}
static inline
s32 brcmf_fil_iovar_int_query(struct brcmf_if *ifp, const char *name, u32 *data)
{
	__le32 *data_le = (__le32 *)data;

	*data_le = cpu_to_le32(*data);
	return brcmf_fil_iovar_int_get(ifp, name, data);
}


s32 brcmf_fil_bsscfg_data_set(struct brcmf_if *ifp, const char *name,
			      void *data, u32 len);
s32 brcmf_fil_bsscfg_data_get(struct brcmf_if *ifp, const char *name,
			      void *data, u32 len);
static inline
s32 brcmf_fil_bsscfg_int_set(struct brcmf_if *ifp, const char *name, u32 data)
{
	__le32 data_le = cpu_to_le32(data);

	return brcmf_fil_bsscfg_data_set(ifp, name, &data_le,
					 sizeof(data_le));
}
static inline
s32 brcmf_fil_bsscfg_int_get(struct brcmf_if *ifp, const char *name, u32 *data)
{
	s32 err;

	err = brcmf_fil_bsscfg_data_get(ifp, name, data, sizeof(*data));
	if (err == 0)
		*data = le32_to_cpu(*(__le32 *)data);
	return err;
}
static inline
s32 brcmf_fil_bsscfg_int_query(struct brcmf_if *ifp, const char *name, u32 *data)
{
	__le32 *data_le = (__le32 *)data;

	*data_le = cpu_to_le32(*data);
	return brcmf_fil_bsscfg_int_get(ifp, name, data);
}

s32 brcmf_fil_xtlv_data_set(struct brcmf_if *ifp, const char *name, u16 id,
			    void *data, u32 len);
s32 brcmf_fil_xtlv_data_get(struct brcmf_if *ifp, const char *name, u16 id,
			    void *data, u32 len);
static inline
s32 brcmf_fil_xtlv_int_set(struct brcmf_if *ifp, const char *name, u16 id,
			   u32 data)
{
	__le32 data_le = cpu_to_le32(data);

	return brcmf_fil_xtlv_data_set(ifp, name, id, &data_le,
					 sizeof(data_le));
}
static inline
s32 brcmf_fil_xtlv_int_get(struct brcmf_if *ifp, const char *name, u16 id,
			   u32 *data)
{
	__le32 data_le = cpu_to_le32(*data);
	s32 err;

	err = brcmf_fil_xtlv_data_get(ifp, name, id, &data_le, sizeof(data_le));
	if (err == 0)
		*data = le32_to_cpu(data_le);
	return err;
}
static inline
s32 brcmf_fil_xtlv_int8_get(struct brcmf_if *ifp, const char *name, u16 id,
			    u8 *data)
{
	return brcmf_fil_xtlv_data_get(ifp, name, id, data, sizeof(*data));
}
static inline
s32 brcmf_fil_xtlv_int16_get(struct brcmf_if *ifp, const char *name, u16 id,
			     u16 *data)
{
	__le16 data_le = cpu_to_le16(*data);
	s32 err;

	err = brcmf_fil_xtlv_data_get(ifp, name, id, &data_le, sizeof(data_le));
	if (err == 0)
		*data = le16_to_cpu(data_le);
	return err;
}

#endif /* _fwil_h_ */