aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2008-10-14 15:32:48 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-10-31 19:00:30 -0400
commit499b1883038a7db2dcf8b64229f8533ce2c8f0fc (patch)
tree34e5682d4e7e682412c1ffb5c2ff06a991c7ecbd /drivers/net/wireless/iwlwifi/iwl-4965-hw.h
parent76eff18bdc5feaa53f1be33709b67df02f1d55e9 (diff)
iwlwifi: fix TX cmd dma unmapping
This patch: 1. fixes command DMA unmapping, this might be visible only on platforms where DMA unmapping is no noop such as PPC64 (not tested) 2. attaches correctly high memory part of the host command buffer 3. changes structure of TFD TB instead of describing transmit buffer (TB) tuple it describes single TB and makes code more readable on price of one unaligned access 4. eliminates using of IWL_GET/SET_BITs for TFD handling 5. renames TFD structures to mach the HW spec 6. reduces iwl_tx_info size by reserving first TB to the host command This patch should not have any visible effect on x86 32 This patch is rework of iwlwifi: fix DMA code and bugs from Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Cc: Johannes Berg <johannes@sipsolutions.net> Reviewed-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-4965-hw.h')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-hw.h100
1 files changed, 34 insertions, 66 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
index f4793a609443..b66dd093084d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
@@ -822,94 +822,62 @@ enum {
822#define IWL49_NUM_QUEUES 16 822#define IWL49_NUM_QUEUES 16
823#define IWL49_NUM_AMPDU_QUEUES 8 823#define IWL49_NUM_AMPDU_QUEUES 8
824 824
825#define IWL_TX_DMA_MASK (DMA_BIT_MASK(36) & ~0x3)
826#define IWL_NUM_OF_TBS 20
827
828static inline u8 iwl_get_dma_hi_addr(dma_addr_t addr)
829{
830 return (sizeof(addr) > sizeof(u32) ? (addr >> 16) >> 16 : 0) & 0xF;
831}
825/** 832/**
826 * struct iwl_tfd_frame_data 833 * struct iwl_tfd_tb transmit buffer descriptor within transmit frame descriptor
827 * 834 *
828 * Describes up to 2 buffers containing (contiguous) portions of a Tx frame. 835 * This structure contains dma address and length of transmission address
829 * Each buffer must be on dword boundary.
830 * Up to 10 iwl_tfd_frame_data structures, describing up to 20 buffers,
831 * may be filled within a TFD (iwl_tfd_frame).
832 * 836 *
833 * Bit fields in tb1_addr: 837 * @lo: low [31:0] portion of the dma address of TX buffer
834 * 31- 0: Tx buffer 1 address bits [31:0] 838 * every even is unaligned on 16 bit boundary
835 * 839 * @hi_n_len 0-3 [35:32] portion of dma
836 * Bit fields in val1: 840 * 4-16 length of the tx buffer
837 * 31-16: Tx buffer 2 address bits [15:0]
838 * 15- 4: Tx buffer 1 length (bytes)
839 * 3- 0: Tx buffer 1 address bits [32:32]
840 *
841 * Bit fields in val2:
842 * 31-20: Tx buffer 2 length (bytes)
843 * 19- 0: Tx buffer 2 address bits [35:16]
844 */ 841 */
845struct iwl_tfd_frame_data { 842struct iwl_tfd_tb {
846 __le32 tb1_addr; 843 __le32 lo;
847 844 __le16 hi_n_len;
848 __le32 val1; 845} __attribute__((packed));
849 /* __le32 ptb1_32_35:4; */
850#define IWL_tb1_addr_hi_POS 0
851#define IWL_tb1_addr_hi_LEN 4
852#define IWL_tb1_addr_hi_SYM val1
853 /* __le32 tb_len1:12; */
854#define IWL_tb1_len_POS 4
855#define IWL_tb1_len_LEN 12
856#define IWL_tb1_len_SYM val1
857 /* __le32 ptb2_0_15:16; */
858#define IWL_tb2_addr_lo16_POS 16
859#define IWL_tb2_addr_lo16_LEN 16
860#define IWL_tb2_addr_lo16_SYM val1
861
862 __le32 val2;
863 /* __le32 ptb2_16_35:20; */
864#define IWL_tb2_addr_hi20_POS 0
865#define IWL_tb2_addr_hi20_LEN 20
866#define IWL_tb2_addr_hi20_SYM val2
867 /* __le32 tb_len2:12; */
868#define IWL_tb2_len_POS 20
869#define IWL_tb2_len_LEN 12
870#define IWL_tb2_len_SYM val2
871} __attribute__ ((packed));
872
873 846
874/** 847/**
875 * struct iwl_tfd_frame 848 * struct iwl_tfd
876 * 849 *
877 * Transmit Frame Descriptor (TFD) 850 * Transmit Frame Descriptor (TFD)
878 * 851 *
879 * 4965 supports up to 16 Tx queues resident in host DRAM. 852 * @ __reserved1[3] reserved
853 * @ num_tbs 0-5 number of active tbs
854 * 6-7 padding (not used)
855 * @ tbs[20] transmit frame buffer descriptors
856 * @ __pad padding
857 *
880 * Each Tx queue uses a circular buffer of 256 TFDs stored in host DRAM. 858 * Each Tx queue uses a circular buffer of 256 TFDs stored in host DRAM.
881 * Both driver and device share these circular buffers, each of which must be 859 * Both driver and device share these circular buffers, each of which must be
882 * contiguous 256 TFDs x 128 bytes-per-TFD = 32 KBytes for 4965. 860 * contiguous 256 TFDs x 128 bytes-per-TFD = 32 KBytes
883 * 861 *
884 * Driver must indicate the physical address of the base of each 862 * Driver must indicate the physical address of the base of each
885 * circular buffer via the 4965's FH_MEM_CBBC_QUEUE registers. 863 * circular buffer via the FH_MEM_CBBC_QUEUE registers.
886 * 864 *
887 * Each TFD contains pointer/size information for up to 20 data buffers 865 * Each TFD contains pointer/size information for up to 20 data buffers
888 * in host DRAM. These buffers collectively contain the (one) frame described 866 * in host DRAM. These buffers collectively contain the (one) frame described
889 * by the TFD. Each buffer must be a single contiguous block of memory within 867 * by the TFD. Each buffer must be a single contiguous block of memory within
890 * itself, but buffers may be scattered in host DRAM. Each buffer has max size 868 * itself, but buffers may be scattered in host DRAM. Each buffer has max size
891 * of (4K - 4). The 4965 concatenates all of a TFD's buffers into a single 869 * of (4K - 4). The concatenates all of a TFD's buffers into a single
892 * Tx frame, up to 8 KBytes in size. 870 * Tx frame, up to 8 KBytes in size.
893 * 871 *
894 * Bit fields in the control dword (val0):
895 * 31-30: # dwords (0-3) of padding required at end of frame for 16-byte bound
896 * 29: reserved
897 * 28-24: # Transmit Buffer Descriptors in TFD
898 * 23- 0: reserved
899 *
900 * A maximum of 255 (not 256!) TFDs may be on a queue waiting for Tx. 872 * A maximum of 255 (not 256!) TFDs may be on a queue waiting for Tx.
873 *
874 * Bit fields in the control dword (val0):
901 */ 875 */
902struct iwl_tfd_frame { 876struct iwl_tfd {
903 __le32 val0; 877 u8 __reserved1[3];
904 /* __le32 rsvd1:24; */ 878 u8 num_tbs;
905 /* __le32 num_tbs:5; */ 879 struct iwl_tfd_tb tbs[IWL_NUM_OF_TBS];
906#define IWL_num_tbs_POS 24 880 __le32 __pad;
907#define IWL_num_tbs_LEN 5
908#define IWL_num_tbs_SYM val0
909 /* __le32 rsvd2:1; */
910 /* __le32 padding:2; */
911 struct iwl_tfd_frame_data pa[10];
912 __le32 reserved;
913} __attribute__ ((packed)); 881} __attribute__ ((packed));
914 882
915 883