1*6e778a7eSPedro F. Giffuni /*- 2*6e778a7eSPedro F. Giffuni * SPDX-License-Identifier: ISC 3*6e778a7eSPedro F. Giffuni * 414779705SSam Leffler * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 514779705SSam Leffler * Copyright (c) 2002-2008 Atheros Communications, Inc. 614779705SSam Leffler * 714779705SSam Leffler * Permission to use, copy, modify, and/or distribute this software for any 814779705SSam Leffler * purpose with or without fee is hereby granted, provided that the above 914779705SSam Leffler * copyright notice and this permission notice appear in all copies. 1014779705SSam Leffler * 1114779705SSam Leffler * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 1214779705SSam Leffler * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 1314779705SSam Leffler * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 1414779705SSam Leffler * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 1514779705SSam Leffler * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 1614779705SSam Leffler * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 1714779705SSam Leffler * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1814779705SSam Leffler */ 1914779705SSam Leffler #ifndef _ATH_AR5212_DESC_H_ 2014779705SSam Leffler #define _ATH_AR5212_DESC_H_ 2114779705SSam Leffler 2214779705SSam Leffler /* 2314779705SSam Leffler * Hardware-specific descriptor structures. 2414779705SSam Leffler */ 2514779705SSam Leffler 2614779705SSam Leffler /* 2714779705SSam Leffler * AR5212-specific tx/rx descriptor definition. 2814779705SSam Leffler */ 2914779705SSam Leffler struct ar5212_desc { 3014779705SSam Leffler uint32_t ds_link; /* link pointer */ 3114779705SSam Leffler uint32_t ds_data; /* data buffer pointer */ 3214779705SSam Leffler uint32_t ds_ctl0; /* DMA control 0 */ 3314779705SSam Leffler uint32_t ds_ctl1; /* DMA control 1 */ 3414779705SSam Leffler union { 3514779705SSam Leffler struct { /* xmit format */ 3614779705SSam Leffler uint32_t ctl2; /* DMA control 2 */ 3714779705SSam Leffler uint32_t ctl3; /* DMA control 3 */ 3814779705SSam Leffler uint32_t status0;/* DMA status 0 */ 3914779705SSam Leffler uint32_t status1;/* DMA status 1 */ 4014779705SSam Leffler } tx; 4114779705SSam Leffler struct { /* recv format */ 4214779705SSam Leffler uint32_t status0;/* DMA status 0 */ 4314779705SSam Leffler uint32_t status1;/* DMA status 1 */ 4414779705SSam Leffler } rx; 4514779705SSam Leffler } u; 4614779705SSam Leffler } __packed; 4714779705SSam Leffler #define AR5212DESC(_ds) ((struct ar5212_desc *)(_ds)) 4814779705SSam Leffler #define AR5212DESC_CONST(_ds) ((const struct ar5212_desc *)(_ds)) 4914779705SSam Leffler 5014779705SSam Leffler #define ds_ctl2 u.tx.ctl2 5114779705SSam Leffler #define ds_ctl3 u.tx.ctl3 5214779705SSam Leffler #define ds_txstatus0 u.tx.status0 5314779705SSam Leffler #define ds_txstatus1 u.tx.status1 5414779705SSam Leffler #define ds_rxstatus0 u.rx.status0 5514779705SSam Leffler #define ds_rxstatus1 u.rx.status1 5614779705SSam Leffler 5714779705SSam Leffler /* TX ds_ctl0 */ 5814779705SSam Leffler #define AR_FrameLen 0x00000fff /* frame length */ 5914779705SSam Leffler /* bits 12-15 are reserved */ 6014779705SSam Leffler #define AR_XmitPower 0x003f0000 /* transmit power control */ 6114779705SSam Leffler #define AR_XmitPower_S 16 6214779705SSam Leffler #define AR_RTSCTSEnable 0x00400000 /* RTS/CTS protocol enable */ 6314779705SSam Leffler #define AR_VEOL 0x00800000 /* virtual end-of-list */ 6414779705SSam Leffler #define AR_ClearDestMask 0x01000000 /* Clear destination mask bit */ 6514779705SSam Leffler #define AR_AntModeXmit 0x1e000000 /* TX antenna seslection */ 6614779705SSam Leffler #define AR_AntModeXmit_S 25 6714779705SSam Leffler #define AR_TxInterReq 0x20000000 /* TX interrupt request */ 6814779705SSam Leffler #define AR_DestIdxValid 0x40000000 /* destination index valid */ 6914779705SSam Leffler #define AR_CTSEnable 0x80000000 /* precede frame with CTS */ 7014779705SSam Leffler 7114779705SSam Leffler /* TX ds_ctl1 */ 7214779705SSam Leffler #define AR_BufLen 0x00000fff /* data buffer length */ 7314779705SSam Leffler #define AR_More 0x00001000 /* more desc in this frame */ 7414779705SSam Leffler #define AR_DestIdx 0x000fe000 /* destination table index */ 7514779705SSam Leffler #define AR_DestIdx_S 13 7614779705SSam Leffler #define AR_FrmType 0x00f00000 /* frame type indication */ 7714779705SSam Leffler #define AR_FrmType_S 20 7814779705SSam Leffler #define AR_NoAck 0x01000000 /* No ACK flag */ 7914779705SSam Leffler #define AR_CompProc 0x06000000 /* compression processing */ 8014779705SSam Leffler #define AR_CompProc_S 25 8114779705SSam Leffler #define AR_CompIVLen 0x18000000 /* length of frame IV */ 8214779705SSam Leffler #define AR_CompIVLen_S 27 8314779705SSam Leffler #define AR_CompICVLen 0x60000000 /* length of frame ICV */ 8414779705SSam Leffler #define AR_CompICVLen_S 29 8514779705SSam Leffler /* bit 31 is reserved */ 8614779705SSam Leffler 8714779705SSam Leffler /* TX ds_ctl2 */ 8814779705SSam Leffler #define AR_RTSCTSDuration 0x00007fff /* RTS/CTS duration */ 8914779705SSam Leffler #define AR_RTSCTSDuration_S 0 9014779705SSam Leffler #define AR_DurUpdateEna 0x00008000 /* frame duration update ctl */ 9114779705SSam Leffler #define AR_XmitDataTries0 0x000f0000 /* series 0 max attempts */ 9214779705SSam Leffler #define AR_XmitDataTries0_S 16 9314779705SSam Leffler #define AR_XmitDataTries1 0x00f00000 /* series 1 max attempts */ 9414779705SSam Leffler #define AR_XmitDataTries1_S 20 9514779705SSam Leffler #define AR_XmitDataTries2 0x0f000000 /* series 2 max attempts */ 9614779705SSam Leffler #define AR_XmitDataTries2_S 24 9714779705SSam Leffler #define AR_XmitDataTries3 0xf0000000 /* series 3 max attempts */ 9814779705SSam Leffler #define AR_XmitDataTries3_S 28 9914779705SSam Leffler 10014779705SSam Leffler /* TX ds_ctl3 */ 10114779705SSam Leffler #define AR_XmitRate0 0x0000001f /* series 0 tx rate */ 10214779705SSam Leffler #define AR_XmitRate0_S 0 10314779705SSam Leffler #define AR_XmitRate1 0x000003e0 /* series 1 tx rate */ 10414779705SSam Leffler #define AR_XmitRate1_S 5 10514779705SSam Leffler #define AR_XmitRate2 0x00007c00 /* series 2 tx rate */ 10614779705SSam Leffler #define AR_XmitRate2_S 10 10714779705SSam Leffler #define AR_XmitRate3 0x000f8000 /* series 3 tx rate */ 10814779705SSam Leffler #define AR_XmitRate3_S 15 10914779705SSam Leffler #define AR_RTSCTSRate 0x01f00000 /* RTS or CTS rate */ 11014779705SSam Leffler #define AR_RTSCTSRate_S 20 11114779705SSam Leffler /* bits 25-31 are reserved */ 11214779705SSam Leffler 11314779705SSam Leffler /* RX ds_ctl1 */ 11414779705SSam Leffler /* AR_BufLen 0x00000fff data buffer length */ 11514779705SSam Leffler /* bit 12 is reserved */ 11614779705SSam Leffler #define AR_RxInterReq 0x00002000 /* RX interrupt request */ 11714779705SSam Leffler /* bits 14-31 are reserved */ 11814779705SSam Leffler 11914779705SSam Leffler /* TX ds_txstatus0 */ 12014779705SSam Leffler #define AR_FrmXmitOK 0x00000001 /* TX success */ 12114779705SSam Leffler #define AR_ExcessiveRetries 0x00000002 /* excessive retries */ 12214779705SSam Leffler #define AR_FIFOUnderrun 0x00000004 /* TX FIFO underrun */ 12314779705SSam Leffler #define AR_Filtered 0x00000008 /* TX filter indication */ 12414779705SSam Leffler #define AR_RTSFailCnt 0x000000f0 /* RTS failure count */ 12514779705SSam Leffler #define AR_RTSFailCnt_S 4 12614779705SSam Leffler #define AR_DataFailCnt 0x00000f00 /* Data failure count */ 12714779705SSam Leffler #define AR_DataFailCnt_S 8 12814779705SSam Leffler #define AR_VirtCollCnt 0x0000f000 /* virtual collision count */ 12914779705SSam Leffler #define AR_VirtCollCnt_S 12 13014779705SSam Leffler #define AR_SendTimestamp 0xffff0000 /* TX timestamp */ 13114779705SSam Leffler #define AR_SendTimestamp_S 16 13214779705SSam Leffler 13314779705SSam Leffler /* RX ds_rxstatus0 */ 13414779705SSam Leffler #define AR_DataLen 0x00000fff /* RX data length */ 13514779705SSam Leffler /* AR_More 0x00001000 more desc in this frame */ 13614779705SSam Leffler #define AR_DecompCRCErr 0x00002000 /* decompression CRC error */ 13714779705SSam Leffler /* bit 14 is reserved */ 13814779705SSam Leffler #define AR_RcvRate 0x000f8000 /* reception rate */ 13914779705SSam Leffler #define AR_RcvRate_S 15 14014779705SSam Leffler #define AR_RcvSigStrength 0x0ff00000 /* receive signal strength */ 14114779705SSam Leffler #define AR_RcvSigStrength_S 20 14214779705SSam Leffler #define AR_RcvAntenna 0xf0000000 /* receive antenaa */ 14314779705SSam Leffler #define AR_RcvAntenna_S 28 14414779705SSam Leffler 14514779705SSam Leffler /* TX ds_txstatus1 */ 14614779705SSam Leffler #define AR_Done 0x00000001 /* descripter complete */ 14714779705SSam Leffler #define AR_SeqNum 0x00001ffe /* TX sequence number */ 14814779705SSam Leffler #define AR_SeqNum_S 1 14914779705SSam Leffler #define AR_AckSigStrength 0x001fe000 /* strength of ACK */ 15014779705SSam Leffler #define AR_AckSigStrength_S 13 15114779705SSam Leffler #define AR_FinalTSIndex 0x00600000 /* final TX attempt series ix */ 15214779705SSam Leffler #define AR_FinalTSIndex_S 21 15314779705SSam Leffler #define AR_CompSuccess 0x00800000 /* compression status */ 15414779705SSam Leffler #define AR_XmitAtenna 0x01000000 /* transmit antenna */ 15514779705SSam Leffler /* bits 25-31 are reserved */ 15614779705SSam Leffler 15714779705SSam Leffler /* RX ds_rxstatus1 */ 15814779705SSam Leffler /* AR_Done 0x00000001 descripter complete */ 15914779705SSam Leffler #define AR_FrmRcvOK 0x00000002 /* frame reception success */ 16014779705SSam Leffler #define AR_CRCErr 0x00000004 /* CRC error */ 16114779705SSam Leffler #define AR_DecryptCRCErr 0x00000008 /* Decryption CRC fiailure */ 16214779705SSam Leffler #define AR_PHYErr 0x00000010 /* PHY error */ 16314779705SSam Leffler #define AR_MichaelErr 0x00000020 /* Michae MIC decrypt error */ 16414779705SSam Leffler /* bits 6-7 are reserved */ 16514779705SSam Leffler #define AR_KeyIdxValid 0x00000100 /* decryption key index valid */ 16614779705SSam Leffler #define AR_KeyIdx 0x0000fe00 /* Decryption key index */ 16714779705SSam Leffler #define AR_KeyIdx_S 9 16814779705SSam Leffler #define AR_RcvTimestamp 0x7fff0000 /* timestamp */ 16914779705SSam Leffler #define AR_RcvTimestamp_S 16 17014779705SSam Leffler #define AR_KeyCacheMiss 0x80000000 /* key cache miss indication */ 17114779705SSam Leffler 17214779705SSam Leffler /* NB: phy error code overlays key index and valid fields */ 17314779705SSam Leffler #define AR_PHYErrCode 0x0000ff00 /* PHY error code */ 17414779705SSam Leffler #define AR_PHYErrCode_S 8 17514779705SSam Leffler 17614779705SSam Leffler #endif /* _ATH_AR5212_DESC_H_ */ 177