22 #ifndef __CARL9170_SHARED_FWDESC_H
23 #define __CARL9170_SHARED_FWDESC_H
88 #define OTUS_MAGIC "OTAR"
89 #define MOTD_MAGIC "MOTD"
90 #define FIX_MAGIC "FIX\0"
91 #define DBG_MAGIC "DBG\0"
92 #define CHK_MAGIC "CHK\0"
93 #define TXSQ_MAGIC "TXSQ"
94 #define WOL_MAGIC "WOL\0"
95 #define LAST_MAGIC "LAST"
97 #define CARL9170FW_SET_DAY(d) (((d) - 1) % 31)
98 #define CARL9170FW_SET_MONTH(m) ((((m) - 1) % 12) * 31)
99 #define CARL9170FW_SET_YEAR(y) (((y) - 10) * 372)
101 #define CARL9170FW_GET_DAY(d) (((d) % 31) + 1)
102 #define CARL9170FW_GET_MONTH(m) ((((m) / 31) % 12) + 1)
103 #define CARL9170FW_GET_YEAR(y) ((y) / 372 + 10)
105 #define CARL9170FW_MAGIC_SIZE 4
113 #define CARL9170FW_DESC_HEAD_SIZE \
114 (sizeof(struct carl9170fw_desc_head))
116 #define CARL9170FW_OTUS_DESC_MIN_VER 6
117 #define CARL9170FW_OTUS_DESC_CUR_VER 7
132 #define CARL9170FW_OTUS_DESC_SIZE \
133 (sizeof(struct carl9170fw_otus_desc))
135 #define CARL9170FW_MOTD_STRING_LEN 24
136 #define CARL9170FW_MOTD_RELEASE_LEN 20
137 #define CARL9170FW_MOTD_DESC_MIN_VER 1
138 #define CARL9170FW_MOTD_DESC_CUR_VER 2
145 #define CARL9170FW_MOTD_DESC_SIZE \
146 (sizeof(struct carl9170fw_motd_desc))
148 #define CARL9170FW_FIX_DESC_MIN_VER 1
149 #define CARL9170FW_FIX_DESC_CUR_VER 2
160 #define CARL9170FW_FIX_DESC_SIZE \
161 (sizeof(struct carl9170fw_fix_desc))
163 #define CARL9170FW_DBG_DESC_MIN_VER 1
164 #define CARL9170FW_DBG_DESC_CUR_VER 3
176 #define CARL9170FW_DBG_DESC_SIZE \
177 (sizeof(struct carl9170fw_dbg_desc))
179 #define CARL9170FW_CHK_DESC_MIN_VER 1
180 #define CARL9170FW_CHK_DESC_CUR_VER 2
186 #define CARL9170FW_CHK_DESC_SIZE \
187 (sizeof(struct carl9170fw_chk_desc))
189 #define CARL9170FW_TXSQ_DESC_MIN_VER 1
190 #define CARL9170FW_TXSQ_DESC_CUR_VER 1
196 #define CARL9170FW_TXSQ_DESC_SIZE \
197 (sizeof(struct carl9170fw_txsq_desc))
199 #define CARL9170FW_WOL_DESC_MIN_VER 1
200 #define CARL9170FW_WOL_DESC_CUR_VER 1
206 #define CARL9170FW_WOL_DESC_SIZE \
207 (sizeof(struct carl9170fw_wol_desc))
209 #define CARL9170FW_LAST_DESC_MIN_VER 1
210 #define CARL9170FW_LAST_DESC_CUR_VER 2
214 #define CARL9170FW_LAST_DESC_SIZE \
215 (sizeof(struct carl9170fw_fix_desc))
217 #define CARL9170FW_DESC_MAX_LENGTH 8192
219 #define CARL9170FW_FILL_DESC(_magic, _length, _min_ver, _cur_ver) \
222 .length = cpu_to_le16(_length), \
223 .min_ver = _min_ver, \
224 .cur_ver = _cur_ver, \
241 #define carl9170fw_for_each_hdr(desc, fw_desc) \
242 for (desc = fw_desc; \
243 memcmp(desc->magic, LAST_MAGIC, CARL9170FW_MAGIC_SIZE) && \
244 le16_to_cpu(desc->length) >= CARL9170FW_DESC_HEAD_SIZE && \
245 le16_to_cpu(desc->length) < CARL9170FW_DESC_MAX_LENGTH; \
246 desc = (void *)((unsigned long)desc + le16_to_cpu(desc->length)))
248 #define CHECK_HDR_VERSION(head, _min_ver) \
249 (((head)->cur_ver < _min_ver) || ((head)->min_ver > _min_ver)) \
258 u16 min_len,
u8 compatible_revision)
260 if (descid[0] == head->
magic[0] && descid[1] == head->
magic[1] &&
261 descid[2] == head->
magic[2] && descid[3] == head->
magic[3] &&
269 #define CARL9170FW_MIN_SIZE 32
270 #define CARL9170FW_MAX_SIZE 16384
272 static inline bool carl9170fw_size_check(
unsigned int len)