device.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
  4. * All rights reserved.
  5. *
  6. * File: device.h
  7. *
  8. * Purpose: MAC Data structure
  9. *
  10. * Author: Tevin Chen
  11. *
  12. * Date: Mar 17, 1997
  13. *
  14. */
  15. #ifndef __DEVICE_H__
  16. #define __DEVICE_H__
  17. #include <linux/module.h>
  18. #include <linux/types.h>
  19. #include <linux/pci.h>
  20. #include <linux/etherdevice.h>
  21. #include <linux/skbuff.h>
  22. #include <linux/interrupt.h>
  23. #include <linux/crc32.h>
  24. #include <net/mac80211.h>
  25. /* device specific */
  26. #include "device_cfg.h"
  27. #include "card.h"
  28. #include "srom.h"
  29. #include "desc.h"
  30. #include "key.h"
  31. #include "mac.h"
  32. /*--------------------- Export Definitions -------------------------*/
  33. #define RATE_1M 0
  34. #define RATE_2M 1
  35. #define RATE_5M 2
  36. #define RATE_11M 3
  37. #define RATE_6M 4
  38. #define RATE_9M 5
  39. #define RATE_12M 6
  40. #define RATE_18M 7
  41. #define RATE_24M 8
  42. #define RATE_36M 9
  43. #define RATE_48M 10
  44. #define RATE_54M 11
  45. #define MAX_RATE 12
  46. #define AUTO_FB_NONE 0
  47. #define AUTO_FB_0 1
  48. #define AUTO_FB_1 2
  49. #define FB_RATE0 0
  50. #define FB_RATE1 1
  51. /* Antenna Mode */
  52. #define ANT_A 0
  53. #define ANT_B 1
  54. #define ANT_DIVERSITY 2
  55. #define ANT_RXD_TXA 3
  56. #define ANT_RXD_TXB 4
  57. #define ANT_UNKNOWN 0xFF
  58. #define BB_VGA_LEVEL 4
  59. #define BB_VGA_CHANGE_THRESHOLD 16
  60. #define MAKE_BEACON_RESERVED 10 /* (us) */
  61. /* BUILD OBJ mode */
  62. #define AVAIL_TD(p, q) ((p)->opts.tx_descs[(q)] - ((p)->iTDUsed[(q)]))
  63. /* 0:11A 1:11B 2:11G */
  64. #define BB_TYPE_11A 0
  65. #define BB_TYPE_11B 1
  66. #define BB_TYPE_11G 2
  67. /* 0:11a, 1:11b, 2:11gb (only CCK in BasicRate), 3:11ga (OFDM in BasicRate) */
  68. #define PK_TYPE_11A 0
  69. #define PK_TYPE_11B 1
  70. #define PK_TYPE_11GB 2
  71. #define PK_TYPE_11GA 3
  72. #define OWNED_BY_HOST 0
  73. #define OWNED_BY_NIC 1
  74. struct vnt_options {
  75. int rx_descs0; /* Number of RX descriptors0 */
  76. int rx_descs1; /* Number of RX descriptors1 */
  77. int tx_descs[2]; /* Number of TX descriptors 0, 1 */
  78. int int_works; /* interrupt limits */
  79. int short_retry;
  80. int long_retry;
  81. int bbp_type;
  82. u32 flags;
  83. };
  84. struct vnt_private {
  85. struct pci_dev *pcid;
  86. /* mac80211 */
  87. struct ieee80211_hw *hw;
  88. struct ieee80211_vif *vif;
  89. unsigned long key_entry_inuse;
  90. u32 basic_rates;
  91. u16 current_aid;
  92. int mc_list_count;
  93. u8 mac_hw;
  94. /* dma addr, rx/tx pool */
  95. dma_addr_t pool_dma;
  96. dma_addr_t rd0_pool_dma;
  97. dma_addr_t rd1_pool_dma;
  98. dma_addr_t td0_pool_dma;
  99. dma_addr_t td1_pool_dma;
  100. dma_addr_t tx_bufs_dma0;
  101. dma_addr_t tx_bufs_dma1;
  102. dma_addr_t tx_beacon_dma;
  103. unsigned char *tx0_bufs;
  104. unsigned char *tx1_bufs;
  105. unsigned char *tx_beacon_bufs;
  106. void __iomem *PortOffset;
  107. u32 memaddr;
  108. u32 ioaddr;
  109. unsigned char byRxMode;
  110. spinlock_t lock;
  111. volatile int iTDUsed[TYPE_MAXTD];
  112. struct vnt_tx_desc *apCurrTD[TYPE_MAXTD];
  113. struct vnt_tx_desc *apTailTD[TYPE_MAXTD];
  114. struct vnt_tx_desc *apTD0Rings;
  115. struct vnt_tx_desc *apTD1Rings;
  116. struct vnt_rx_desc *aRD0Ring;
  117. struct vnt_rx_desc *aRD1Ring;
  118. struct vnt_rx_desc *pCurrRD[TYPE_MAXRD];
  119. struct vnt_options opts;
  120. u32 flags;
  121. u32 rx_buf_sz;
  122. u8 rx_rate;
  123. u32 rx_bytes;
  124. /* Version control */
  125. unsigned char byLocalID;
  126. unsigned char byRFType;
  127. unsigned char byMaxPwrLevel;
  128. unsigned char byZoneType;
  129. bool bZoneRegExist;
  130. unsigned char byOriginalZonetype;
  131. unsigned char abyCurrentNetAddr[ETH_ALEN]; __aligned(2)
  132. bool bLinkPass; /* link status: OK or fail */
  133. unsigned int uCurrRSSI;
  134. unsigned char byCurrSQ;
  135. unsigned long dwTxAntennaSel;
  136. unsigned long dwRxAntennaSel;
  137. unsigned char byAntennaCount;
  138. unsigned char byRxAntennaMode;
  139. unsigned char byTxAntennaMode;
  140. bool bTxRxAntInv;
  141. unsigned char *pbyTmpBuff;
  142. unsigned int uSIFS; /* Current SIFS */
  143. unsigned int uDIFS; /* Current DIFS */
  144. unsigned int uEIFS; /* Current EIFS */
  145. unsigned int uSlot; /* Current SlotTime */
  146. unsigned int uCwMin; /* Current CwMin */
  147. unsigned int uCwMax; /* CwMax is fixed on 1023. */
  148. /* PHY parameter */
  149. unsigned char bySIFS;
  150. unsigned char byDIFS;
  151. unsigned char byEIFS;
  152. unsigned char bySlot;
  153. unsigned char byCWMaxMin;
  154. u8 byBBType; /* 0:11A, 1:11B, 2:11G */
  155. u8 byPacketType; /*
  156. * 0:11a,1:11b,2:11gb (only CCK
  157. * in BasicRate), 3:11ga (OFDM in
  158. * Basic Rate)
  159. */
  160. unsigned short wBasicRate;
  161. unsigned char byACKRate;
  162. unsigned char byTopOFDMBasicRate;
  163. unsigned char byTopCCKBasicRate;
  164. unsigned char byMinChannel;
  165. unsigned char byMaxChannel;
  166. unsigned char byPreambleType;
  167. unsigned char byShortPreamble;
  168. unsigned short wCurrentRate;
  169. unsigned char byShortRetryLimit;
  170. unsigned char byLongRetryLimit;
  171. enum nl80211_iftype op_mode;
  172. bool bBSSIDFilter;
  173. unsigned short wMaxTransmitMSDULifetime;
  174. bool bEncryptionEnable;
  175. bool bLongHeader;
  176. bool bShortSlotTime;
  177. bool bProtectMode;
  178. bool bNonERPPresent;
  179. bool bBarkerPreambleMd;
  180. bool bRadioControlOff;
  181. bool bRadioOff;
  182. bool bEnablePSMode;
  183. unsigned short wListenInterval;
  184. bool bPWBitOn;
  185. /* GPIO Radio Control */
  186. unsigned char byRadioCtl;
  187. unsigned char byGPIO;
  188. bool bHWRadioOff;
  189. bool bPrvActive4RadioOFF;
  190. bool bGPIOBlockRead;
  191. /* Beacon related */
  192. unsigned short wSeqCounter;
  193. unsigned short wBCNBufLen;
  194. bool bBeaconBufReady;
  195. bool bBeaconSent;
  196. bool bIsBeaconBufReadySet;
  197. unsigned int cbBeaconBufReadySetCnt;
  198. bool bFixRate;
  199. u16 byCurrentCh;
  200. bool bAES;
  201. unsigned char byAutoFBCtrl;
  202. /* For Update BaseBand VGA Gain Offset */
  203. bool bUpdateBBVGA;
  204. unsigned int uBBVGADiffCount;
  205. unsigned char byBBVGANew;
  206. unsigned char byBBVGACurrent;
  207. unsigned char abyBBVGA[BB_VGA_LEVEL];
  208. long ldBmThreshold[BB_VGA_LEVEL];
  209. unsigned char byBBPreEDRSSI;
  210. unsigned char byBBPreEDIndex;
  211. unsigned long dwDiagRefCount;
  212. /* For FOE Tuning */
  213. unsigned char byFOETuning;
  214. /* For RF Power table */
  215. unsigned char byCCKPwr;
  216. unsigned char byOFDMPwrG;
  217. unsigned char byCurPwr;
  218. char byCurPwrdBm;
  219. unsigned char abyCCKPwrTbl[CB_MAX_CHANNEL_24G + 1];
  220. unsigned char abyOFDMPwrTbl[CB_MAX_CHANNEL + 1];
  221. char abyCCKDefaultPwr[CB_MAX_CHANNEL_24G + 1];
  222. char abyOFDMDefaultPwr[CB_MAX_CHANNEL + 1];
  223. char abyRegPwr[CB_MAX_CHANNEL + 1];
  224. char abyLocalPwr[CB_MAX_CHANNEL + 1];
  225. /* BaseBand Loopback Use */
  226. unsigned char byBBCR4d;
  227. unsigned char byBBCRc9;
  228. unsigned char byBBCR88;
  229. unsigned char byBBCR09;
  230. unsigned char abyEEPROM[EEP_MAX_CONTEXT_SIZE]; /* unsigned long alignment */
  231. unsigned short wBeaconInterval;
  232. u16 wake_up_count;
  233. struct work_struct interrupt_work;
  234. struct ieee80211_low_level_stats low_stats;
  235. };
  236. #endif