p54common.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  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_DATA_ALIGN BIT(14)
  80. #define P54_HDR_FLAG_DATA_OUT_PROMISC BIT(0)
  81. #define P54_HDR_FLAG_DATA_OUT_TIMESTAMP BIT(1)
  82. #define P54_HDR_FLAG_DATA_OUT_SEQNR BIT(2)
  83. #define P54_HDR_FLAG_DATA_OUT_BIT3 BIT(3)
  84. #define P54_HDR_FLAG_DATA_OUT_BURST BIT(4)
  85. #define P54_HDR_FLAG_DATA_OUT_NOCANCEL BIT(5)
  86. #define P54_HDR_FLAG_DATA_OUT_CLEARTIM BIT(6)
  87. #define P54_HDR_FLAG_DATA_OUT_HITCHHIKE BIT(7)
  88. #define P54_HDR_FLAG_DATA_OUT_COMPRESS BIT(8)
  89. #define P54_HDR_FLAG_DATA_OUT_CONCAT BIT(9)
  90. #define P54_HDR_FLAG_DATA_OUT_PCS_ACCEPT BIT(10)
  91. #define P54_HDR_FLAG_DATA_OUT_WAITEOSP BIT(11)
  92. #define P54_HDR_FLAG_DATA_IN_FCS_GOOD BIT(0)
  93. #define P54_HDR_FLAG_DATA_IN_MATCH_MAC BIT(1)
  94. #define P54_HDR_FLAG_DATA_IN_MCBC BIT(2)
  95. #define P54_HDR_FLAG_DATA_IN_BEACON BIT(3)
  96. #define P54_HDR_FLAG_DATA_IN_MATCH_BSS BIT(4)
  97. #define P54_HDR_FLAG_DATA_IN_BCAST_BSS BIT(5)
  98. #define P54_HDR_FLAG_DATA_IN_DATA BIT(6)
  99. #define P54_HDR_FLAG_DATA_IN_TRUNCATED BIT(7)
  100. #define P54_HDR_FLAG_DATA_IN_BIT8 BIT(8)
  101. #define P54_HDR_FLAG_DATA_IN_TRANSPARENT BIT(9)
  102. /* PDA defines are Copyright (C) 2005 Nokia Corporation (taken from islsm_pda.h) */
  103. struct pda_entry {
  104. __le16 len; /* includes both code and data */
  105. __le16 code;
  106. u8 data[0];
  107. } __attribute__ ((packed));
  108. struct eeprom_pda_wrap {
  109. __le32 magic;
  110. __le16 pad;
  111. __le16 len;
  112. __le32 arm_opcode;
  113. u8 data[0];
  114. } __attribute__ ((packed));
  115. struct pda_iq_autocal_entry {
  116. __le16 freq;
  117. __le16 iq_param[4];
  118. } __attribute__ ((packed));
  119. struct pda_channel_output_limit {
  120. __le16 freq;
  121. u8 val_bpsk;
  122. u8 val_qpsk;
  123. u8 val_16qam;
  124. u8 val_64qam;
  125. u8 rate_set_mask;
  126. u8 rate_set_size;
  127. } __attribute__ ((packed));
  128. struct pda_pa_curve_data_sample_rev0 {
  129. u8 rf_power;
  130. u8 pa_detector;
  131. u8 pcv;
  132. } __attribute__ ((packed));
  133. struct pda_pa_curve_data_sample_rev1 {
  134. u8 rf_power;
  135. u8 pa_detector;
  136. u8 data_barker;
  137. u8 data_bpsk;
  138. u8 data_qpsk;
  139. u8 data_16qam;
  140. u8 data_64qam;
  141. } __attribute__ ((packed));
  142. struct p54_pa_curve_data_sample {
  143. u8 rf_power;
  144. u8 pa_detector;
  145. u8 data_barker;
  146. u8 data_bpsk;
  147. u8 data_qpsk;
  148. u8 data_16qam;
  149. u8 data_64qam;
  150. u8 padding;
  151. } __attribute__ ((packed));
  152. struct pda_pa_curve_data {
  153. u8 cal_method_rev;
  154. u8 channels;
  155. u8 points_per_channel;
  156. u8 padding;
  157. u8 data[0];
  158. } __attribute__ ((packed));
  159. struct pda_rssi_cal_entry {
  160. __le16 mul;
  161. __le16 add;
  162. } __attribute__ ((packed));
  163. /*
  164. * this defines the PDR codes used to build PDAs as defined in document
  165. * number 553155. The current implementation mirrors version 1.1 of the
  166. * document and lists only PDRs supported by the ARM platform.
  167. */
  168. /* common and choice range (0x0000 - 0x0fff) */
  169. #define PDR_END 0x0000
  170. #define PDR_MANUFACTURING_PART_NUMBER 0x0001
  171. #define PDR_PDA_VERSION 0x0002
  172. #define PDR_NIC_SERIAL_NUMBER 0x0003
  173. #define PDR_MAC_ADDRESS 0x0101
  174. #define PDR_REGULATORY_DOMAIN_LIST 0x0103
  175. #define PDR_TEMPERATURE_TYPE 0x0107
  176. #define PDR_PRISM_PCI_IDENTIFIER 0x0402
  177. /* ARM range (0x1000 - 0x1fff) */
  178. #define PDR_COUNTRY_INFORMATION 0x1000
  179. #define PDR_INTERFACE_LIST 0x1001
  180. #define PDR_HARDWARE_PLATFORM_COMPONENT_ID 0x1002
  181. #define PDR_OEM_NAME 0x1003
  182. #define PDR_PRODUCT_NAME 0x1004
  183. #define PDR_UTF8_OEM_NAME 0x1005
  184. #define PDR_UTF8_PRODUCT_NAME 0x1006
  185. #define PDR_COUNTRY_LIST 0x1007
  186. #define PDR_DEFAULT_COUNTRY 0x1008
  187. #define PDR_ANTENNA_GAIN 0x1100
  188. #define PDR_PRISM_INDIGO_PA_CALIBRATION_DATA 0x1901
  189. #define PDR_RSSI_LINEAR_APPROXIMATION 0x1902
  190. #define PDR_PRISM_PA_CAL_OUTPUT_POWER_LIMITS 0x1903
  191. #define PDR_PRISM_PA_CAL_CURVE_DATA 0x1904
  192. #define PDR_RSSI_LINEAR_APPROXIMATION_DUAL_BAND 0x1905
  193. #define PDR_PRISM_ZIF_TX_IQ_CALIBRATION 0x1906
  194. #define PDR_REGULATORY_POWER_LIMITS 0x1907
  195. #define PDR_RSSI_LINEAR_APPROXIMATION_EXTENDED 0x1908
  196. #define PDR_RADIATED_TRANSMISSION_CORRECTION 0x1909
  197. #define PDR_PRISM_TX_IQ_CALIBRATION 0x190a
  198. /* reserved range (0x2000 - 0x7fff) */
  199. /* customer range (0x8000 - 0xffff) */
  200. #define PDR_BASEBAND_REGISTERS 0x8000
  201. #define PDR_PER_CHANNEL_BASEBAND_REGISTERS 0x8001
  202. /* PDR definitions for default country & country list */
  203. #define PDR_COUNTRY_CERT_CODE 0x80
  204. #define PDR_COUNTRY_CERT_CODE_REAL 0x00
  205. #define PDR_COUNTRY_CERT_CODE_PSEUDO 0x80
  206. #define PDR_COUNTRY_CERT_BAND 0x40
  207. #define PDR_COUNTRY_CERT_BAND_2GHZ 0x00
  208. #define PDR_COUNTRY_CERT_BAND_5GHZ 0x40
  209. #define PDR_COUNTRY_CERT_IODOOR 0x30
  210. #define PDR_COUNTRY_CERT_IODOOR_BOTH 0x00
  211. #define PDR_COUNTRY_CERT_IODOOR_INDOOR 0x20
  212. #define PDR_COUNTRY_CERT_IODOOR_OUTDOOR 0x30
  213. #define PDR_COUNTRY_CERT_INDEX 0x0F
  214. /* stored in skb->cb */
  215. struct memrecord {
  216. u32 start_addr;
  217. u32 end_addr;
  218. };
  219. struct p54_eeprom_lm86 {
  220. union {
  221. struct {
  222. __le16 offset;
  223. __le16 len;
  224. u8 data[0];
  225. } v1;
  226. struct {
  227. __le32 offset;
  228. __le16 len;
  229. u8 magic2;
  230. u8 pad;
  231. u8 magic[4];
  232. u8 data[0];
  233. } v2;
  234. } __attribute__ ((packed));
  235. } __attribute__ ((packed));
  236. enum p54_rx_decrypt_status {
  237. P54_DECRYPT_NONE = 0,
  238. P54_DECRYPT_OK,
  239. P54_DECRYPT_NOKEY,
  240. P54_DECRYPT_NOMICHAEL,
  241. P54_DECRYPT_NOCKIPMIC,
  242. P54_DECRYPT_FAIL_WEP,
  243. P54_DECRYPT_FAIL_TKIP,
  244. P54_DECRYPT_FAIL_MICHAEL,
  245. P54_DECRYPT_FAIL_CKIPKP,
  246. P54_DECRYPT_FAIL_CKIPMIC,
  247. P54_DECRYPT_FAIL_AESCCMP
  248. };
  249. struct p54_rx_data {
  250. __le16 flags;
  251. __le16 len;
  252. __le16 freq;
  253. u8 antenna;
  254. u8 rate;
  255. u8 rssi;
  256. u8 quality;
  257. u8 decrypt_status;
  258. u8 rssi_raw;
  259. __le32 tsf32;
  260. __le32 unalloc0;
  261. u8 align[0];
  262. } __attribute__ ((packed));
  263. enum p54_trap_type {
  264. P54_TRAP_SCAN = 0,
  265. P54_TRAP_TIMER,
  266. P54_TRAP_BEACON_TX,
  267. P54_TRAP_FAA_RADIO_ON,
  268. P54_TRAP_FAA_RADIO_OFF,
  269. P54_TRAP_RADAR,
  270. P54_TRAP_NO_BEACON,
  271. P54_TRAP_TBTT,
  272. P54_TRAP_SCO_ENTER,
  273. P54_TRAP_SCO_EXIT
  274. };
  275. struct p54_trap {
  276. __le16 event;
  277. __le16 frequency;
  278. } __attribute__ ((packed));
  279. enum p54_frame_sent_status {
  280. P54_TX_OK = 0,
  281. P54_TX_FAILED,
  282. P54_TX_PSM,
  283. P54_TX_PSM_CANCELLED = 4
  284. };
  285. struct p54_frame_sent {
  286. u8 status;
  287. u8 tries;
  288. u8 ack_rssi;
  289. u8 quality;
  290. __le16 seq;
  291. u8 antenna;
  292. u8 padding;
  293. } __attribute__ ((packed));
  294. enum p54_tx_data_crypt {
  295. P54_CRYPTO_NONE = 0,
  296. P54_CRYPTO_WEP,
  297. P54_CRYPTO_TKIP,
  298. P54_CRYPTO_TKIPMICHAEL,
  299. P54_CRYPTO_CCX_WEPMIC,
  300. P54_CRYPTO_CCX_KPMIC,
  301. P54_CRYPTO_CCX_KP,
  302. P54_CRYPTO_AESCCMP
  303. };
  304. struct p54_tx_data {
  305. u8 rateset[8];
  306. u8 rts_rate_idx;
  307. u8 crypt_offset;
  308. u8 key_type;
  309. u8 key_len;
  310. u8 key[16];
  311. u8 hw_queue;
  312. u8 backlog;
  313. __le16 durations[4];
  314. u8 tx_antenna;
  315. u8 output_power;
  316. u8 cts_rate;
  317. u8 unalloc2[3];
  318. u8 align[0];
  319. } __attribute__ ((packed));
  320. /* unit is ms */
  321. #define P54_TX_FRAME_LIFETIME 2000
  322. #define P54_TX_TIMEOUT 4000
  323. #define P54_STATISTICS_UPDATE 5000
  324. #define P54_FILTER_TYPE_NONE 0
  325. #define P54_FILTER_TYPE_STATION BIT(0)
  326. #define P54_FILTER_TYPE_IBSS BIT(1)
  327. #define P54_FILTER_TYPE_AP BIT(2)
  328. #define P54_FILTER_TYPE_TRANSPARENT BIT(3)
  329. #define P54_FILTER_TYPE_PROMISCUOUS BIT(4)
  330. #define P54_FILTER_TYPE_HIBERNATE BIT(5)
  331. #define P54_FILTER_TYPE_NOACK BIT(6)
  332. #define P54_FILTER_TYPE_RX_DISABLED BIT(7)
  333. struct p54_setup_mac {
  334. __le16 mac_mode;
  335. u8 mac_addr[ETH_ALEN];
  336. u8 bssid[ETH_ALEN];
  337. u8 rx_antenna;
  338. u8 rx_align;
  339. union {
  340. struct {
  341. __le32 basic_rate_mask;
  342. u8 rts_rates[8];
  343. __le32 rx_addr;
  344. __le16 max_rx;
  345. __le16 rxhw;
  346. __le16 wakeup_timer;
  347. __le16 unalloc0;
  348. } v1 __attribute__ ((packed));
  349. struct {
  350. __le32 rx_addr;
  351. __le16 max_rx;
  352. __le16 rxhw;
  353. __le16 timer;
  354. __le16 truncate;
  355. __le32 basic_rate_mask;
  356. u8 sbss_offset;
  357. u8 mcast_window;
  358. u8 rx_rssi_threshold;
  359. u8 rx_ed_threshold;
  360. __le32 ref_clock;
  361. __le16 lpf_bandwidth;
  362. __le16 osc_start_delay;
  363. } v2 __attribute__ ((packed));
  364. } __attribute__ ((packed));
  365. } __attribute__ ((packed));
  366. #define P54_SETUP_V1_LEN 40
  367. #define P54_SETUP_V2_LEN (sizeof(struct p54_setup_mac))
  368. #define P54_SCAN_EXIT BIT(0)
  369. #define P54_SCAN_TRAP BIT(1)
  370. #define P54_SCAN_ACTIVE BIT(2)
  371. #define P54_SCAN_FILTER BIT(3)
  372. struct p54_scan {
  373. __le16 mode;
  374. __le16 dwell;
  375. u8 padding1[20];
  376. struct pda_iq_autocal_entry iq_autocal;
  377. u8 pa_points_per_curve;
  378. u8 val_barker;
  379. u8 val_bpsk;
  380. u8 val_qpsk;
  381. u8 val_16qam;
  382. u8 val_64qam;
  383. struct p54_pa_curve_data_sample curve_data[8];
  384. u8 dup_bpsk;
  385. u8 dup_qpsk;
  386. u8 dup_16qam;
  387. u8 dup_64qam;
  388. union {
  389. struct pda_rssi_cal_entry v1_rssi;
  390. struct {
  391. __le32 basic_rate_mask;
  392. u8 rts_rates[8];
  393. struct pda_rssi_cal_entry rssi;
  394. } v2 __attribute__ ((packed));
  395. } __attribute__ ((packed));
  396. } __attribute__ ((packed));
  397. #define P54_SCAN_V1_LEN 0x70
  398. #define P54_SCAN_V2_LEN 0x7c
  399. struct p54_led {
  400. __le16 mode;
  401. __le16 led_temporary;
  402. __le16 led_permanent;
  403. __le16 duration;
  404. } __attribute__ ((packed));
  405. struct p54_edcf {
  406. u8 flags;
  407. u8 slottime;
  408. u8 sifs;
  409. u8 eofpad;
  410. struct p54_edcf_queue_param queue[8];
  411. u8 mapping[4];
  412. __le16 frameburst;
  413. __le16 round_trip_delay;
  414. } __attribute__ ((packed));
  415. struct p54_statistics {
  416. __le32 rx_success;
  417. __le32 rx_bad_fcs;
  418. __le32 rx_abort;
  419. __le32 rx_abort_phy;
  420. __le32 rts_success;
  421. __le32 rts_fail;
  422. __le32 tsf32;
  423. __le32 airtime;
  424. __le32 noise;
  425. __le32 sample_noise[8];
  426. __le32 sample_cca;
  427. __le32 sample_tx;
  428. } __attribute__ ((packed));
  429. struct p54_xbow_synth {
  430. __le16 magic1;
  431. __le16 magic2;
  432. __le16 freq;
  433. u32 padding[5];
  434. } __attribute__ ((packed));
  435. struct p54_timer {
  436. __le32 interval;
  437. } __attribute__ ((packed));
  438. struct p54_keycache {
  439. u8 entry;
  440. u8 key_id;
  441. u8 mac[ETH_ALEN];
  442. u8 padding[2];
  443. u8 key_type;
  444. u8 key_len;
  445. u8 key[24];
  446. } __attribute__ ((packed));
  447. struct p54_burst {
  448. u8 flags;
  449. u8 queue;
  450. u8 backlog;
  451. u8 pad;
  452. __le16 durations[32];
  453. } __attribute__ ((packed));
  454. struct p54_psm_interval {
  455. __le16 interval;
  456. __le16 periods;
  457. } __attribute__ ((packed));
  458. #define P54_PSM BIT(0)
  459. #define P54_PSM_DTIM BIT(1)
  460. #define P54_PSM_MCBC BIT(2)
  461. #define P54_PSM_CHECKSUM BIT(3)
  462. #define P54_PSM_SKIP_MORE_DATA BIT(4)
  463. #define P54_PSM_BEACON_TIMEOUT BIT(5)
  464. #define P54_PSM_HFOSLEEP BIT(6)
  465. #define P54_PSM_AUTOSWITCH_SLEEP BIT(7)
  466. #define P54_PSM_LPIT BIT(8)
  467. #define P54_PSM_BF_UCAST_SKIP BIT(9)
  468. #define P54_PSM_BF_MCAST_SKIP BIT(10)
  469. struct p54_psm {
  470. __le16 mode;
  471. __le16 aid;
  472. struct p54_psm_interval intervals[4];
  473. u8 beacon_rssi_skip_max;
  474. u8 rssi_delta_threshold;
  475. u8 nr;
  476. u8 exclude[1];
  477. } __attribute__ ((packed));
  478. #define MC_FILTER_ADDRESS_NUM 4
  479. struct p54_group_address_table {
  480. __le16 filter_enable;
  481. __le16 num_address;
  482. u8 mac_list[MC_FILTER_ADDRESS_NUM][ETH_ALEN];
  483. } __attribute__ ((packed));
  484. struct p54_txcancel {
  485. __le32 req_id;
  486. } __attribute__ ((packed));
  487. struct p54_sta_unlock {
  488. u8 addr[ETH_ALEN];
  489. u16 padding;
  490. } __attribute__ ((packed));
  491. #define P54_TIM_CLEAR BIT(15)
  492. struct p54_tim {
  493. u8 count;
  494. u8 padding[3];
  495. __le16 entry[8];
  496. } __attribute__ ((packed));
  497. struct p54_cce_quiet {
  498. __le32 period;
  499. } __attribute__ ((packed));
  500. struct p54_bt_balancer {
  501. __le16 prio_thresh;
  502. __le16 acl_thresh;
  503. } __attribute__ ((packed));
  504. struct p54_arp_table {
  505. __le16 filter_enable;
  506. u8 ipv4_addr[4];
  507. } __attribute__ ((packed));
  508. #endif /* P54COMMON_H */