p54common.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  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. __le16 offset;
  219. __le16 len;
  220. u8 data[0];
  221. } __attribute__ ((packed));
  222. enum p54_rx_decrypt_status {
  223. P54_DECRYPT_NONE = 0,
  224. P54_DECRYPT_OK,
  225. P54_DECRYPT_NOKEY,
  226. P54_DECRYPT_NOMICHAEL,
  227. P54_DECRYPT_NOCKIPMIC,
  228. P54_DECRYPT_FAIL_WEP,
  229. P54_DECRYPT_FAIL_TKIP,
  230. P54_DECRYPT_FAIL_MICHAEL,
  231. P54_DECRYPT_FAIL_CKIPKP,
  232. P54_DECRYPT_FAIL_CKIPMIC,
  233. P54_DECRYPT_FAIL_AESCCMP
  234. };
  235. struct p54_rx_data {
  236. __le16 flags;
  237. __le16 len;
  238. __le16 freq;
  239. u8 antenna;
  240. u8 rate;
  241. u8 rssi;
  242. u8 quality;
  243. u8 decrypt_status;
  244. u8 rssi_raw;
  245. __le32 tsf32;
  246. __le32 unalloc0;
  247. u8 align[0];
  248. } __attribute__ ((packed));
  249. enum p54_trap_type {
  250. P54_TRAP_SCAN = 0,
  251. P54_TRAP_TIMER,
  252. P54_TRAP_BEACON_TX,
  253. P54_TRAP_FAA_RADIO_ON,
  254. P54_TRAP_FAA_RADIO_OFF,
  255. P54_TRAP_RADAR,
  256. P54_TRAP_NO_BEACON,
  257. P54_TRAP_TBTT,
  258. P54_TRAP_SCO_ENTER,
  259. P54_TRAP_SCO_EXIT
  260. };
  261. struct p54_trap {
  262. __le16 event;
  263. __le16 frequency;
  264. } __attribute__ ((packed));
  265. enum p54_frame_sent_status {
  266. P54_TX_OK = 0,
  267. P54_TX_FAILED,
  268. P54_TX_PSM,
  269. P54_TX_PSM_CANCELLED = 4
  270. };
  271. struct p54_frame_sent {
  272. u8 status;
  273. u8 tries;
  274. u8 ack_rssi;
  275. u8 quality;
  276. __le16 seq;
  277. u8 antenna;
  278. u8 padding;
  279. } __attribute__ ((packed));
  280. enum p54_tx_data_crypt {
  281. P54_CRYPTO_NONE = 0,
  282. P54_CRYPTO_WEP,
  283. P54_CRYPTO_TKIP,
  284. P54_CRYPTO_TKIPMICHAEL,
  285. P54_CRYPTO_CCX_WEPMIC,
  286. P54_CRYPTO_CCX_KPMIC,
  287. P54_CRYPTO_CCX_KP,
  288. P54_CRYPTO_AESCCMP
  289. };
  290. struct p54_tx_data {
  291. u8 rateset[8];
  292. u8 rts_rate_idx;
  293. u8 crypt_offset;
  294. u8 key_type;
  295. u8 key_len;
  296. u8 key[16];
  297. u8 hw_queue;
  298. u8 backlog;
  299. __le16 durations[4];
  300. u8 tx_antenna;
  301. u8 output_power;
  302. u8 cts_rate;
  303. u8 unalloc2[3];
  304. u8 align[0];
  305. } __attribute__ ((packed));
  306. #define P54_FILTER_TYPE_NONE 0
  307. #define P54_FILTER_TYPE_STATION BIT(0)
  308. #define P54_FILTER_TYPE_IBSS BIT(1)
  309. #define P54_FILTER_TYPE_AP BIT(2)
  310. #define P54_FILTER_TYPE_TRANSPARENT BIT(3)
  311. #define P54_FILTER_TYPE_PROMISCUOUS BIT(4)
  312. #define P54_FILTER_TYPE_HIBERNATE BIT(5)
  313. #define P54_FILTER_TYPE_NOACK BIT(6)
  314. #define P54_FILTER_TYPE_RX_DISABLED BIT(7)
  315. struct p54_setup_mac {
  316. __le16 mac_mode;
  317. u8 mac_addr[ETH_ALEN];
  318. u8 bssid[ETH_ALEN];
  319. u8 rx_antenna;
  320. u8 rx_align;
  321. union {
  322. struct {
  323. __le32 basic_rate_mask;
  324. u8 rts_rates[8];
  325. __le32 rx_addr;
  326. __le16 max_rx;
  327. __le16 rxhw;
  328. __le16 wakeup_timer;
  329. __le16 unalloc0;
  330. } v1 __attribute__ ((packed));
  331. struct {
  332. __le32 rx_addr;
  333. __le16 max_rx;
  334. __le16 rxhw;
  335. __le16 timer;
  336. __le16 truncate;
  337. __le32 basic_rate_mask;
  338. u8 sbss_offset;
  339. u8 mcast_window;
  340. u8 rx_rssi_threshold;
  341. u8 rx_ed_threshold;
  342. __le32 ref_clock;
  343. __le16 lpf_bandwidth;
  344. __le16 osc_start_delay;
  345. } v2 __attribute__ ((packed));
  346. } __attribute__ ((packed));
  347. } __attribute__ ((packed));
  348. #define P54_SETUP_V1_LEN 40
  349. #define P54_SETUP_V2_LEN (sizeof(struct p54_setup_mac))
  350. #define P54_SCAN_EXIT BIT(0)
  351. #define P54_SCAN_TRAP BIT(1)
  352. #define P54_SCAN_ACTIVE BIT(2)
  353. #define P54_SCAN_FILTER BIT(3)
  354. struct p54_scan {
  355. __le16 mode;
  356. __le16 dwell;
  357. u8 padding1[20];
  358. struct pda_iq_autocal_entry iq_autocal;
  359. u8 pa_points_per_curve;
  360. u8 val_barker;
  361. u8 val_bpsk;
  362. u8 val_qpsk;
  363. u8 val_16qam;
  364. u8 val_64qam;
  365. struct p54_pa_curve_data_sample curve_data[8];
  366. u8 dup_bpsk;
  367. u8 dup_qpsk;
  368. u8 dup_16qam;
  369. u8 dup_64qam;
  370. union {
  371. struct {
  372. __le16 rssical_mul;
  373. __le16 rssical_add;
  374. } v1 __attribute__ ((packed));
  375. struct {
  376. __le32 basic_rate_mask;
  377. u8 rts_rates[8];
  378. __le16 rssical_mul;
  379. __le16 rssical_add;
  380. } v2 __attribute__ ((packed));
  381. } __attribute__ ((packed));
  382. } __attribute__ ((packed));
  383. #define P54_SCAN_V1_LEN (sizeof(struct p54_scan)-12)
  384. #define P54_SCAN_V2_LEN (sizeof(struct p54_scan))
  385. struct p54_led {
  386. __le16 mode;
  387. __le16 led_temporary;
  388. __le16 led_permanent;
  389. __le16 duration;
  390. } __attribute__ ((packed));
  391. struct p54_edcf {
  392. u8 flags;
  393. u8 slottime;
  394. u8 sifs;
  395. u8 eofpad;
  396. struct p54_edcf_queue_param queue[8];
  397. u8 mapping[4];
  398. __le16 frameburst;
  399. __le16 round_trip_delay;
  400. } __attribute__ ((packed));
  401. struct p54_statistics {
  402. __le32 rx_success;
  403. __le32 rx_bad_fcs;
  404. __le32 rx_abort;
  405. __le32 rx_abort_phy;
  406. __le32 rts_success;
  407. __le32 rts_fail;
  408. __le32 tsf32;
  409. __le32 airtime;
  410. __le32 noise;
  411. __le32 sample_noise[8];
  412. __le32 sample_cca;
  413. __le32 sample_tx;
  414. } __attribute__ ((packed));
  415. struct p54_xbow_synth {
  416. __le16 magic1;
  417. __le16 magic2;
  418. __le16 freq;
  419. u32 padding[5];
  420. } __attribute__ ((packed));
  421. struct p54_timer {
  422. __le32 interval;
  423. } __attribute__ ((packed));
  424. struct p54_keycache {
  425. u8 entry;
  426. u8 key_id;
  427. u8 mac[ETH_ALEN];
  428. u8 padding[2];
  429. u8 key_type;
  430. u8 key_len;
  431. u8 key[24];
  432. } __attribute__ ((packed));
  433. struct p54_burst {
  434. u8 flags;
  435. u8 queue;
  436. u8 backlog;
  437. u8 pad;
  438. __le16 durations[32];
  439. } __attribute__ ((packed));
  440. struct p54_psm_interval {
  441. __le16 interval;
  442. __le16 periods;
  443. } __attribute__ ((packed));
  444. #define P54_PSM BIT(0)
  445. #define P54_PSM_DTIM BIT(1)
  446. #define P54_PSM_MCBC BIT(2)
  447. #define P54_PSM_CHECKSUM BIT(3)
  448. #define P54_PSM_SKIP_MORE_DATA BIT(4)
  449. #define P54_PSM_BEACON_TIMEOUT BIT(5)
  450. #define P54_PSM_HFOSLEEP BIT(6)
  451. #define P54_PSM_AUTOSWITCH_SLEEP BIT(7)
  452. #define P54_PSM_LPIT BIT(8)
  453. #define P54_PSM_BF_UCAST_SKIP BIT(9)
  454. #define P54_PSM_BF_MCAST_SKIP BIT(10)
  455. struct p54_psm {
  456. __le16 mode;
  457. __le16 aid;
  458. struct p54_psm_interval intervals[4];
  459. u8 beacon_rssi_skip_max;
  460. u8 rssi_delta_threshold;
  461. u8 nr;
  462. u8 exclude[1];
  463. } __attribute__ ((packed));
  464. #define MC_FILTER_ADDRESS_NUM 4
  465. struct p54_group_address_table {
  466. __le16 filter_enable;
  467. __le16 num_address;
  468. u8 mac_list[MC_FILTER_ADDRESS_NUM][ETH_ALEN];
  469. } __attribute__ ((packed));
  470. struct p54_txcancel {
  471. __le32 req_id;
  472. } __attribute__ ((packed));
  473. struct p54_sta_unlock {
  474. u8 addr[ETH_ALEN];
  475. u16 padding;
  476. } __attribute__ ((packed));
  477. #define P54_TIM_CLEAR BIT(15)
  478. struct p54_tim {
  479. u8 count;
  480. u8 padding[3];
  481. __le16 entry[8];
  482. } __attribute__ ((packed));
  483. struct p54_cce_quiet {
  484. __le32 period;
  485. } __attribute__ ((packed));
  486. struct p54_bt_balancer {
  487. __le16 prio_thresh;
  488. __le16 acl_thresh;
  489. } __attribute__ ((packed));
  490. struct p54_arp_table {
  491. __le16 filter_enable;
  492. u8 ipv4_addr[4];
  493. } __attribute__ ((packed));
  494. #endif /* P54COMMON_H */