p54common.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. #ifndef P54COMMON_H
  2. #define P54COMMON_H
  3. /*
  4. * Common code specific definitions for mac80211 Prism54 drivers
  5. *
  6. * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
  7. * Copyright (c) 2007, Christian Lamparter <chunkeey@web.de>
  8. *
  9. * Based on:
  10. * - the islsm (softmac prism54) driver, which is:
  11. * Copyright 2004-2006 Jean-Baptiste Note <jbnote@gmail.com>, et al.
  12. *
  13. * - LMAC API interface header file for STLC4560 (lmac_longbow.h)
  14. * Copyright (C) 2007 Conexant Systems, Inc.
  15. *
  16. * This program is free software; you can redistribute it and/or modify
  17. * it under the terms of the GNU General Public License version 2 as
  18. * published by the Free Software Foundation.
  19. */
  20. struct bootrec {
  21. __le32 code;
  22. __le32 len;
  23. u32 data[10];
  24. } __attribute__((packed));
  25. #define PDR_SYNTH_FRONTEND_MASK 0x0007
  26. #define PDR_SYNTH_IQ_CAL_MASK 0x0018
  27. #define PDR_SYNTH_IQ_CAL_PA_DETECTOR 0x0000
  28. #define PDR_SYNTH_IQ_CAL_DISABLED 0x0008
  29. #define PDR_SYNTH_IQ_CAL_ZIF 0x0010
  30. #define PDR_SYNTH_FAA_SWITCH_MASK 0x0020
  31. #define PDR_SYNTH_FAA_SWITCH_ENABLED 0x0001
  32. #define PDR_SYNTH_24_GHZ_MASK 0x0040
  33. #define PDR_SYNTH_24_GHZ_DISABLED 0x0040
  34. #define PDR_SYNTH_5_GHZ_MASK 0x0080
  35. #define PDR_SYNTH_5_GHZ_DISABLED 0x0080
  36. #define PDR_SYNTH_RX_DIV_MASK 0x0100
  37. #define PDR_SYNTH_RX_DIV_SUPPORTED 0x0100
  38. #define PDR_SYNTH_TX_DIV_MASK 0x0200
  39. #define PDR_SYNTH_TX_DIV_SUPPORTED 0x0200
  40. struct bootrec_exp_if {
  41. __le16 role;
  42. __le16 if_id;
  43. __le16 variant;
  44. __le16 btm_compat;
  45. __le16 top_compat;
  46. } __attribute__((packed));
  47. #define BR_DESC_PRIV_CAP_WEP BIT(0)
  48. #define BR_DESC_PRIV_CAP_TKIP BIT(1)
  49. #define BR_DESC_PRIV_CAP_MICHAEL BIT(2)
  50. #define BR_DESC_PRIV_CAP_CCX_CP BIT(3)
  51. #define BR_DESC_PRIV_CAP_CCX_MIC BIT(4)
  52. #define BR_DESC_PRIV_CAP_AESCCMP BIT(5)
  53. struct bootrec_desc {
  54. __le16 modes;
  55. __le16 flags;
  56. __le32 rx_start;
  57. __le32 rx_end;
  58. u8 headroom;
  59. u8 tailroom;
  60. u8 tx_queues;
  61. u8 tx_depth;
  62. u8 privacy_caps;
  63. u8 rx_keycache_size;
  64. u8 time_size;
  65. u8 padding;
  66. u8 rates[16];
  67. u8 padding2[4];
  68. __le16 rx_mtu;
  69. } __attribute__((packed));
  70. #define BR_CODE_MIN 0x80000000
  71. #define BR_CODE_COMPONENT_ID 0x80000001
  72. #define BR_CODE_COMPONENT_VERSION 0x80000002
  73. #define BR_CODE_DEPENDENT_IF 0x80000003
  74. #define BR_CODE_EXPOSED_IF 0x80000004
  75. #define BR_CODE_DESCR 0x80000101
  76. #define BR_CODE_MAX 0x8FFFFFFF
  77. #define BR_CODE_END_OF_BRA 0xFF0000FF
  78. #define LEGACY_BR_CODE_END_OF_BRA 0xFFFFFFFF
  79. #define P54_HDR_FLAG_CONTROL BIT(15)
  80. #define P54_HDR_FLAG_CONTROL_OPSET (BIT(15) + BIT(0))
  81. #define P54_HDR_FLAG_DATA_ALIGN BIT(14)
  82. #define P54_HDR_FLAG_DATA_OUT_PROMISC BIT(0)
  83. #define P54_HDR_FLAG_DATA_OUT_TIMESTAMP BIT(1)
  84. #define P54_HDR_FLAG_DATA_OUT_SEQNR BIT(2)
  85. #define P54_HDR_FLAG_DATA_OUT_BIT3 BIT(3)
  86. #define P54_HDR_FLAG_DATA_OUT_BURST BIT(4)
  87. #define P54_HDR_FLAG_DATA_OUT_NOCANCEL BIT(5)
  88. #define P54_HDR_FLAG_DATA_OUT_CLEARTIM BIT(6)
  89. #define P54_HDR_FLAG_DATA_OUT_HITCHHIKE BIT(7)
  90. #define P54_HDR_FLAG_DATA_OUT_COMPRESS BIT(8)
  91. #define P54_HDR_FLAG_DATA_OUT_CONCAT BIT(9)
  92. #define P54_HDR_FLAG_DATA_OUT_PCS_ACCEPT BIT(10)
  93. #define P54_HDR_FLAG_DATA_OUT_WAITEOSP BIT(11)
  94. #define P54_HDR_FLAG_DATA_IN_FCS_GOOD BIT(0)
  95. #define P54_HDR_FLAG_DATA_IN_MATCH_MAC BIT(1)
  96. #define P54_HDR_FLAG_DATA_IN_MCBC BIT(2)
  97. #define P54_HDR_FLAG_DATA_IN_BEACON BIT(3)
  98. #define P54_HDR_FLAG_DATA_IN_MATCH_BSS BIT(4)
  99. #define P54_HDR_FLAG_DATA_IN_BCAST_BSS BIT(5)
  100. #define P54_HDR_FLAG_DATA_IN_DATA BIT(6)
  101. #define P54_HDR_FLAG_DATA_IN_TRUNCATED BIT(7)
  102. #define P54_HDR_FLAG_DATA_IN_BIT8 BIT(8)
  103. #define P54_HDR_FLAG_DATA_IN_TRANSPARENT BIT(9)
  104. /* PDA defines are Copyright (C) 2005 Nokia Corporation (taken from islsm_pda.h) */
  105. struct pda_entry {
  106. __le16 len; /* includes both code and data */
  107. __le16 code;
  108. u8 data[0];
  109. } __attribute__ ((packed));
  110. struct eeprom_pda_wrap {
  111. __le32 magic;
  112. __le16 pad;
  113. __le16 len;
  114. __le32 arm_opcode;
  115. u8 data[0];
  116. } __attribute__ ((packed));
  117. struct pda_iq_autocal_entry {
  118. __le16 freq;
  119. __le16 iq_param[4];
  120. } __attribute__ ((packed));
  121. struct pda_channel_output_limit {
  122. __le16 freq;
  123. u8 val_bpsk;
  124. u8 val_qpsk;
  125. u8 val_16qam;
  126. u8 val_64qam;
  127. u8 rate_set_mask;
  128. u8 rate_set_size;
  129. } __attribute__ ((packed));
  130. struct pda_pa_curve_data_sample_rev0 {
  131. u8 rf_power;
  132. u8 pa_detector;
  133. u8 pcv;
  134. } __attribute__ ((packed));
  135. struct pda_pa_curve_data_sample_rev1 {
  136. u8 rf_power;
  137. u8 pa_detector;
  138. u8 data_barker;
  139. u8 data_bpsk;
  140. u8 data_qpsk;
  141. u8 data_16qam;
  142. u8 data_64qam;
  143. } __attribute__ ((packed));
  144. struct p54_pa_curve_data_sample {
  145. u8 rf_power;
  146. u8 pa_detector;
  147. u8 data_barker;
  148. u8 data_bpsk;
  149. u8 data_qpsk;
  150. u8 data_16qam;
  151. u8 data_64qam;
  152. u8 padding;
  153. } __attribute__ ((packed));
  154. struct pda_pa_curve_data {
  155. u8 cal_method_rev;
  156. u8 channels;
  157. u8 points_per_channel;
  158. u8 padding;
  159. u8 data[0];
  160. } __attribute__ ((packed));
  161. /*
  162. * this defines the PDR codes used to build PDAs as defined in document
  163. * number 553155. The current implementation mirrors version 1.1 of the
  164. * document and lists only PDRs supported by the ARM platform.
  165. */
  166. /* common and choice range (0x0000 - 0x0fff) */
  167. #define PDR_END 0x0000
  168. #define PDR_MANUFACTURING_PART_NUMBER 0x0001
  169. #define PDR_PDA_VERSION 0x0002
  170. #define PDR_NIC_SERIAL_NUMBER 0x0003
  171. #define PDR_MAC_ADDRESS 0x0101
  172. #define PDR_REGULATORY_DOMAIN_LIST 0x0103
  173. #define PDR_TEMPERATURE_TYPE 0x0107
  174. #define PDR_PRISM_PCI_IDENTIFIER 0x0402
  175. /* ARM range (0x1000 - 0x1fff) */
  176. #define PDR_COUNTRY_INFORMATION 0x1000
  177. #define PDR_INTERFACE_LIST 0x1001
  178. #define PDR_HARDWARE_PLATFORM_COMPONENT_ID 0x1002
  179. #define PDR_OEM_NAME 0x1003
  180. #define PDR_PRODUCT_NAME 0x1004
  181. #define PDR_UTF8_OEM_NAME 0x1005
  182. #define PDR_UTF8_PRODUCT_NAME 0x1006
  183. #define PDR_COUNTRY_LIST 0x1007
  184. #define PDR_DEFAULT_COUNTRY 0x1008
  185. #define PDR_ANTENNA_GAIN 0x1100
  186. #define PDR_PRISM_INDIGO_PA_CALIBRATION_DATA 0x1901
  187. #define PDR_RSSI_LINEAR_APPROXIMATION 0x1902
  188. #define PDR_PRISM_PA_CAL_OUTPUT_POWER_LIMITS 0x1903
  189. #define PDR_PRISM_PA_CAL_CURVE_DATA 0x1904
  190. #define PDR_RSSI_LINEAR_APPROXIMATION_DUAL_BAND 0x1905
  191. #define PDR_PRISM_ZIF_TX_IQ_CALIBRATION 0x1906
  192. #define PDR_REGULATORY_POWER_LIMITS 0x1907
  193. #define PDR_RSSI_LINEAR_APPROXIMATION_EXTENDED 0x1908
  194. #define PDR_RADIATED_TRANSMISSION_CORRECTION 0x1909
  195. #define PDR_PRISM_TX_IQ_CALIBRATION 0x190a
  196. /* reserved range (0x2000 - 0x7fff) */
  197. /* customer range (0x8000 - 0xffff) */
  198. #define PDR_BASEBAND_REGISTERS 0x8000
  199. #define PDR_PER_CHANNEL_BASEBAND_REGISTERS 0x8001
  200. /* PDR definitions for default country & country list */
  201. #define PDR_COUNTRY_CERT_CODE 0x80
  202. #define PDR_COUNTRY_CERT_CODE_REAL 0x00
  203. #define PDR_COUNTRY_CERT_CODE_PSEUDO 0x80
  204. #define PDR_COUNTRY_CERT_BAND 0x40
  205. #define PDR_COUNTRY_CERT_BAND_2GHZ 0x00
  206. #define PDR_COUNTRY_CERT_BAND_5GHZ 0x40
  207. #define PDR_COUNTRY_CERT_IODOOR 0x30
  208. #define PDR_COUNTRY_CERT_IODOOR_BOTH 0x00
  209. #define PDR_COUNTRY_CERT_IODOOR_INDOOR 0x20
  210. #define PDR_COUNTRY_CERT_IODOOR_OUTDOOR 0x30
  211. #define PDR_COUNTRY_CERT_INDEX 0x0F
  212. /* stored in skb->cb */
  213. struct memrecord {
  214. u32 start_addr;
  215. u32 end_addr;
  216. };
  217. struct p54_eeprom_lm86 {
  218. union {
  219. struct {
  220. __le16 offset;
  221. __le16 len;
  222. u8 data[0];
  223. } v1;
  224. struct {
  225. __le32 offset;
  226. __le16 len;
  227. u8 magic2;
  228. u8 pad;
  229. u8 magic[4];
  230. u8 data[0];
  231. } v2;
  232. } __attribute__ ((packed));
  233. } __attribute__ ((packed));
  234. enum p54_rx_decrypt_status {
  235. P54_DECRYPT_NONE = 0,
  236. P54_DECRYPT_OK,
  237. P54_DECRYPT_NOKEY,
  238. P54_DECRYPT_NOMICHAEL,
  239. P54_DECRYPT_NOCKIPMIC,
  240. P54_DECRYPT_FAIL_WEP,
  241. P54_DECRYPT_FAIL_TKIP,
  242. P54_DECRYPT_FAIL_MICHAEL,
  243. P54_DECRYPT_FAIL_CKIPKP,
  244. P54_DECRYPT_FAIL_CKIPMIC,
  245. P54_DECRYPT_FAIL_AESCCMP
  246. };
  247. struct p54_rx_data {
  248. __le16 flags;
  249. __le16 len;
  250. __le16 freq;
  251. u8 antenna;
  252. u8 rate;
  253. u8 rssi;
  254. u8 quality;
  255. u8 decrypt_status;
  256. u8 rssi_raw;
  257. __le32 tsf32;
  258. __le32 unalloc0;
  259. u8 align[0];
  260. } __attribute__ ((packed));
  261. enum p54_trap_type {
  262. P54_TRAP_SCAN = 0,
  263. P54_TRAP_TIMER,
  264. P54_TRAP_BEACON_TX,
  265. P54_TRAP_FAA_RADIO_ON,
  266. P54_TRAP_FAA_RADIO_OFF,
  267. P54_TRAP_RADAR,
  268. P54_TRAP_NO_BEACON,
  269. P54_TRAP_TBTT,
  270. P54_TRAP_SCO_ENTER,
  271. P54_TRAP_SCO_EXIT
  272. };
  273. struct p54_trap {
  274. __le16 event;
  275. __le16 frequency;
  276. } __attribute__ ((packed));
  277. enum p54_frame_sent_status {
  278. P54_TX_OK = 0,
  279. P54_TX_FAILED,
  280. P54_TX_PSM,
  281. P54_TX_PSM_CANCELLED = 4
  282. };
  283. struct p54_frame_sent {
  284. u8 status;
  285. u8 tries;
  286. u8 ack_rssi;
  287. u8 quality;
  288. __le16 seq;
  289. u8 antenna;
  290. u8 padding;
  291. } __attribute__ ((packed));
  292. enum p54_tx_data_crypt {
  293. P54_CRYPTO_NONE = 0,
  294. P54_CRYPTO_WEP,
  295. P54_CRYPTO_TKIP,
  296. P54_CRYPTO_TKIPMICHAEL,
  297. P54_CRYPTO_CCX_WEPMIC,
  298. P54_CRYPTO_CCX_KPMIC,
  299. P54_CRYPTO_CCX_KP,
  300. P54_CRYPTO_AESCCMP
  301. };
  302. struct p54_tx_data {
  303. u8 rateset[8];
  304. u8 rts_rate_idx;
  305. u8 crypt_offset;
  306. u8 key_type;
  307. u8 key_len;
  308. u8 key[16];
  309. u8 hw_queue;
  310. u8 backlog;
  311. __le16 durations[4];
  312. u8 tx_antenna;
  313. u8 output_power;
  314. u8 cts_rate;
  315. u8 unalloc2[3];
  316. u8 align[0];
  317. } __attribute__ ((packed));
  318. #define P54_FILTER_TYPE_NONE 0
  319. #define P54_FILTER_TYPE_STATION BIT(0)
  320. #define P54_FILTER_TYPE_IBSS BIT(1)
  321. #define P54_FILTER_TYPE_AP BIT(2)
  322. #define P54_FILTER_TYPE_TRANSPARENT BIT(3)
  323. #define P54_FILTER_TYPE_PROMISCUOUS BIT(4)
  324. #define P54_FILTER_TYPE_HIBERNATE BIT(5)
  325. #define P54_FILTER_TYPE_NOACK BIT(6)
  326. #define P54_FILTER_TYPE_RX_DISABLED BIT(7)
  327. struct p54_setup_mac {
  328. __le16 mac_mode;
  329. u8 mac_addr[ETH_ALEN];
  330. u8 bssid[ETH_ALEN];
  331. u8 rx_antenna;
  332. u8 rx_align;
  333. union {
  334. struct {
  335. __le32 basic_rate_mask;
  336. u8 rts_rates[8];
  337. __le32 rx_addr;
  338. __le16 max_rx;
  339. __le16 rxhw;
  340. __le16 wakeup_timer;
  341. __le16 unalloc0;
  342. } v1 __attribute__ ((packed));
  343. struct {
  344. __le32 rx_addr;
  345. __le16 max_rx;
  346. __le16 rxhw;
  347. __le16 timer;
  348. __le16 truncate;
  349. __le32 basic_rate_mask;
  350. u8 sbss_offset;
  351. u8 mcast_window;
  352. u8 rx_rssi_threshold;
  353. u8 rx_ed_threshold;
  354. __le32 ref_clock;
  355. __le16 lpf_bandwidth;
  356. __le16 osc_start_delay;
  357. } v2 __attribute__ ((packed));
  358. } __attribute__ ((packed));
  359. } __attribute__ ((packed));
  360. #define P54_SETUP_V1_LEN 40
  361. #define P54_SETUP_V2_LEN (sizeof(struct p54_setup_mac))
  362. #define P54_SCAN_EXIT BIT(0)
  363. #define P54_SCAN_TRAP BIT(1)
  364. #define P54_SCAN_ACTIVE BIT(2)
  365. #define P54_SCAN_FILTER BIT(3)
  366. struct p54_scan {
  367. __le16 mode;
  368. __le16 dwell;
  369. u8 padding1[20];
  370. struct pda_iq_autocal_entry iq_autocal;
  371. u8 pa_points_per_curve;
  372. u8 val_barker;
  373. u8 val_bpsk;
  374. u8 val_qpsk;
  375. u8 val_16qam;
  376. u8 val_64qam;
  377. struct p54_pa_curve_data_sample curve_data[8];
  378. u8 dup_bpsk;
  379. u8 dup_qpsk;
  380. u8 dup_16qam;
  381. u8 dup_64qam;
  382. union {
  383. struct {
  384. __le16 rssical_mul;
  385. __le16 rssical_add;
  386. } v1 __attribute__ ((packed));
  387. struct {
  388. __le32 basic_rate_mask;
  389. u8 rts_rates[8];
  390. __le16 rssical_mul;
  391. __le16 rssical_add;
  392. } v2 __attribute__ ((packed));
  393. } __attribute__ ((packed));
  394. } __attribute__ ((packed));
  395. #define P54_SCAN_V1_LEN (sizeof(struct p54_scan)-12)
  396. #define P54_SCAN_V2_LEN (sizeof(struct p54_scan))
  397. struct p54_led {
  398. __le16 mode;
  399. __le16 led_temporary;
  400. __le16 led_permanent;
  401. __le16 duration;
  402. } __attribute__ ((packed));
  403. struct p54_edcf {
  404. u8 flags;
  405. u8 slottime;
  406. u8 sifs;
  407. u8 eofpad;
  408. struct p54_edcf_queue_param queue[8];
  409. u8 mapping[4];
  410. __le16 frameburst;
  411. __le16 round_trip_delay;
  412. } __attribute__ ((packed));
  413. struct p54_statistics {
  414. __le32 rx_success;
  415. __le32 rx_bad_fcs;
  416. __le32 rx_abort;
  417. __le32 rx_abort_phy;
  418. __le32 rts_success;
  419. __le32 rts_fail;
  420. __le32 tsf32;
  421. __le32 airtime;
  422. __le32 noise;
  423. __le32 sample_noise[8];
  424. __le32 sample_cca;
  425. __le32 sample_tx;
  426. } __attribute__ ((packed));
  427. struct p54_xbow_synth {
  428. __le16 magic1;
  429. __le16 magic2;
  430. __le16 freq;
  431. u32 padding[5];
  432. } __attribute__ ((packed));
  433. struct p54_timer {
  434. __le32 interval;
  435. } __attribute__ ((packed));
  436. struct p54_keycache {
  437. u8 entry;
  438. u8 key_id;
  439. u8 mac[ETH_ALEN];
  440. u8 padding[2];
  441. u8 key_type;
  442. u8 key_len;
  443. u8 key[24];
  444. } __attribute__ ((packed));
  445. struct p54_burst {
  446. u8 flags;
  447. u8 queue;
  448. u8 backlog;
  449. u8 pad;
  450. __le16 durations[32];
  451. } __attribute__ ((packed));
  452. struct p54_psm_interval {
  453. __le16 interval;
  454. __le16 periods;
  455. } __attribute__ ((packed));
  456. #define P54_PSM BIT(0)
  457. #define P54_PSM_DTIM BIT(1)
  458. #define P54_PSM_MCBC BIT(2)
  459. #define P54_PSM_CHECKSUM BIT(3)
  460. #define P54_PSM_SKIP_MORE_DATA BIT(4)
  461. #define P54_PSM_BEACON_TIMEOUT BIT(5)
  462. #define P54_PSM_HFOSLEEP BIT(6)
  463. #define P54_PSM_AUTOSWITCH_SLEEP BIT(7)
  464. #define P54_PSM_LPIT BIT(8)
  465. #define P54_PSM_BF_UCAST_SKIP BIT(9)
  466. #define P54_PSM_BF_MCAST_SKIP BIT(10)
  467. struct p54_psm {
  468. __le16 mode;
  469. __le16 aid;
  470. struct p54_psm_interval intervals[4];
  471. u8 beacon_rssi_skip_max;
  472. u8 rssi_delta_threshold;
  473. u8 nr;
  474. u8 exclude[1];
  475. } __attribute__ ((packed));
  476. #define MC_FILTER_ADDRESS_NUM 4
  477. struct p54_group_address_table {
  478. __le16 filter_enable;
  479. __le16 num_address;
  480. u8 mac_list[MC_FILTER_ADDRESS_NUM][ETH_ALEN];
  481. } __attribute__ ((packed));
  482. struct p54_txcancel {
  483. __le32 req_id;
  484. } __attribute__ ((packed));
  485. struct p54_sta_unlock {
  486. u8 addr[ETH_ALEN];
  487. u16 padding;
  488. } __attribute__ ((packed));
  489. #define P54_TIM_CLEAR BIT(15)
  490. struct p54_tim {
  491. u8 count;
  492. u8 padding[3];
  493. __le16 entry[8];
  494. } __attribute__ ((packed));
  495. struct p54_cce_quiet {
  496. __le32 period;
  497. } __attribute__ ((packed));
  498. struct p54_bt_balancer {
  499. __le16 prio_thresh;
  500. __le16 acl_thresh;
  501. } __attribute__ ((packed));
  502. struct p54_arp_table {
  503. __le16 filter_enable;
  504. u8 ipv4_addr[4];
  505. } __attribute__ ((packed));
  506. #endif /* P54COMMON_H */