Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v3.17-rc3 590 lines 16 kB view raw
1/* 2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. 3 * All rights reserved. 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License along 16 * with this program; if not, write to the Free Software Foundation, Inc., 17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * File: desc.h 20 * 21 * Purpose:The header file of descriptor 22 * 23 * Revision History: 24 * 25 * Author: Tevin Chen 26 * 27 * Date: May 21, 1996 28 * 29 */ 30 31#ifndef __DESC_H__ 32#define __DESC_H__ 33 34#include <linux/types.h> 35#include <linux/mm.h> 36#include "ttype.h" 37#include "tether.h" 38 39#define B_OWNED_BY_CHIP 1 40#define B_OWNED_BY_HOST 0 41 42// 43// Bits in the RSR register 44// 45#define RSR_ADDRBROAD 0x80 46#define RSR_ADDRMULTI 0x40 47#define RSR_ADDRUNI 0x00 48#define RSR_IVLDTYP 0x20 49#define RSR_IVLDLEN 0x10 // invalid len (> 2312 byte) 50#define RSR_BSSIDOK 0x08 51#define RSR_CRCOK 0x04 52#define RSR_BCNSSIDOK 0x02 53#define RSR_ADDROK 0x01 54 55// 56// Bits in the new RSR register 57// 58#define NEWRSR_DECRYPTOK 0x10 59#define NEWRSR_CFPIND 0x08 60#define NEWRSR_HWUTSF 0x04 61#define NEWRSR_BCNHITAID 0x02 62#define NEWRSR_BCNHITAID0 0x01 63 64// 65// Bits in the TSR0 register 66// 67#define TSR0_PWRSTS1_2 0xC0 68#define TSR0_PWRSTS7 0x20 69#define TSR0_NCR 0x1F 70 71// 72// Bits in the TSR1 register 73// 74#define TSR1_TERR 0x80 75#define TSR1_PWRSTS4_6 0x70 76#define TSR1_RETRYTMO 0x08 77#define TSR1_TMO 0x04 78#define TSR1_PWRSTS3 0x02 79#define ACK_DATA 0x01 80 81// 82// Bits in the TCR register 83// 84#define EDMSDU 0x04 // end of sdu 85#define TCR_EDP 0x02 // end of packet 86#define TCR_STP 0x01 // start of packet 87 88// max transmit or receive buffer size 89#define CB_MAX_BUF_SIZE 2900U 90 // NOTE: must be multiple of 4 91#define CB_MAX_TX_BUF_SIZE CB_MAX_BUF_SIZE 92#define CB_MAX_RX_BUF_SIZE_NORMAL CB_MAX_BUF_SIZE 93 94#define CB_BEACON_BUF_SIZE 512U 95 96#define CB_MAX_RX_DESC 128 97#define CB_MIN_RX_DESC 16 98#define CB_MAX_TX_DESC 64 99#define CB_MIN_TX_DESC 16 100 101#define CB_MAX_RECEIVED_PACKETS 16 102 // limit our receive routine to indicating 103 // this many at a time for 2 reasons: 104 // 1. driver flow control to protocol layer 105 // 2. limit the time used in ISR routine 106 107#define CB_EXTRA_RD_NUM 32 108#define CB_RD_NUM 32 109#define CB_TD_NUM 32 110 111// max number of physical segments 112// in a single NDIS packet. Above this threshold, the packet 113// is copied into a single physically contiguous buffer 114#define CB_MAX_SEGMENT 4 115 116#define CB_MIN_MAP_REG_NUM 4 117#define CB_MAX_MAP_REG_NUM CB_MAX_TX_DESC 118 119#define CB_PROTOCOL_RESERVED_SECTION 16 120 121// if retrys excess 15 times , tx will abort, and 122// if tx fifo underflow, tx will fail 123// we should try to resend it 124#define CB_MAX_TX_ABORT_RETRY 3 125 126#ifdef __BIG_ENDIAN 127 128// WMAC definition FIFO Control 129#define FIFOCTL_AUTO_FB_1 0x0010 130#define FIFOCTL_AUTO_FB_0 0x0008 131#define FIFOCTL_GRPACK 0x0004 132#define FIFOCTL_11GA 0x0003 133#define FIFOCTL_11GB 0x0002 134#define FIFOCTL_11B 0x0001 135#define FIFOCTL_11A 0x0000 136#define FIFOCTL_RTS 0x8000 137#define FIFOCTL_ISDMA0 0x4000 138#define FIFOCTL_GENINT 0x2000 139#define FIFOCTL_TMOEN 0x1000 140#define FIFOCTL_LRETRY 0x0800 141#define FIFOCTL_CRCDIS 0x0400 142#define FIFOCTL_NEEDACK 0x0200 143#define FIFOCTL_LHEAD 0x0100 144 145//WMAC definition Frag Control 146#define FRAGCTL_AES 0x0003 147#define FRAGCTL_TKIP 0x0002 148#define FRAGCTL_LEGACY 0x0001 149#define FRAGCTL_NONENCRYPT 0x0000 150#define FRAGCTL_ENDFRAG 0x0300 151#define FRAGCTL_MIDFRAG 0x0200 152#define FRAGCTL_STAFRAG 0x0100 153#define FRAGCTL_NONFRAG 0x0000 154 155#else 156 157#define FIFOCTL_AUTO_FB_1 0x1000 158#define FIFOCTL_AUTO_FB_0 0x0800 159#define FIFOCTL_GRPACK 0x0400 160#define FIFOCTL_11GA 0x0300 161#define FIFOCTL_11GB 0x0200 162#define FIFOCTL_11B 0x0100 163#define FIFOCTL_11A 0x0000 164#define FIFOCTL_RTS 0x0080 165#define FIFOCTL_ISDMA0 0x0040 166#define FIFOCTL_GENINT 0x0020 167#define FIFOCTL_TMOEN 0x0010 168#define FIFOCTL_LRETRY 0x0008 169#define FIFOCTL_CRCDIS 0x0004 170#define FIFOCTL_NEEDACK 0x0002 171#define FIFOCTL_LHEAD 0x0001 172 173//WMAC definition Frag Control 174#define FRAGCTL_AES 0x0300 175#define FRAGCTL_TKIP 0x0200 176#define FRAGCTL_LEGACY 0x0100 177#define FRAGCTL_NONENCRYPT 0x0000 178#define FRAGCTL_ENDFRAG 0x0003 179#define FRAGCTL_MIDFRAG 0x0002 180#define FRAGCTL_STAFRAG 0x0001 181#define FRAGCTL_NONFRAG 0x0000 182 183#endif 184 185#define TYPE_TXDMA0 0 186#define TYPE_AC0DMA 1 187#define TYPE_ATIMDMA 2 188#define TYPE_SYNCDMA 3 189#define TYPE_MAXTD 2 190 191#define TYPE_BEACONDMA 4 192 193#define TYPE_RXDMA0 0 194#define TYPE_RXDMA1 1 195#define TYPE_MAXRD 2 196 197// TD_INFO flags control bit 198#define TD_FLAGS_NETIF_SKB 0x01 // check if need release skb 199#define TD_FLAGS_PRIV_SKB 0x02 // check if called from private skb(hostap) 200#define TD_FLAGS_PS_RETRY 0x04 // check if PS STA frame re-transmit 201 202// ref_sk_buff is used for mapping the skb structure between pre-built driver-obj & running kernel. 203// Since different kernel version (2.4x) may change skb structure, i.e. pre-built driver-obj 204// may link to older skb that leads error. 205 206typedef struct tagDEVICE_RD_INFO { 207 struct sk_buff *skb; 208 dma_addr_t skb_dma; 209 dma_addr_t curr_desc; 210} DEVICE_RD_INFO, *PDEVICE_RD_INFO; 211 212#ifdef __BIG_ENDIAN 213 214typedef struct tagRDES0 { 215 volatile unsigned short wResCount; 216 union { 217 volatile u16 f15Reserved; 218 struct { 219 volatile u8 f8Reserved1; 220 volatile u8 f1Owner:1; 221 volatile u8 f7Reserved:7; 222 } __attribute__ ((__packed__)); 223 } __attribute__ ((__packed__)); 224} __attribute__ ((__packed__)) 225SRDES0, *PSRDES0; 226 227#else 228 229typedef struct tagRDES0 { 230 unsigned short wResCount; 231 unsigned short f15Reserved:15; 232 unsigned short f1Owner:1; 233} __attribute__ ((__packed__)) 234SRDES0; 235 236#endif 237 238typedef struct tagRDES1 { 239 unsigned short wReqCount; 240 unsigned short wReserved; 241} __attribute__ ((__packed__)) 242SRDES1; 243 244// 245// Rx descriptor 246// 247typedef struct tagSRxDesc { 248 volatile SRDES0 m_rd0RD0; 249 volatile SRDES1 m_rd1RD1; 250 volatile u32 buff_addr; 251 volatile u32 next_desc; 252 struct tagSRxDesc *next __aligned(8); 253 volatile PDEVICE_RD_INFO pRDInfo __aligned(8); 254} __attribute__ ((__packed__)) 255SRxDesc, *PSRxDesc; 256typedef const SRxDesc *PCSRxDesc; 257 258#ifdef __BIG_ENDIAN 259 260typedef struct tagTDES0 { 261 volatile unsigned char byTSR0; 262 volatile unsigned char byTSR1; 263 union { 264 volatile u16 f15Txtime; 265 struct { 266 volatile u8 f8Reserved1; 267 volatile u8 f1Owner:1; 268 volatile u8 f7Reserved:7; 269 } __attribute__ ((__packed__)); 270 } __attribute__ ((__packed__)); 271} __attribute__ ((__packed__)) 272STDES0, PSTDES0; 273 274#else 275 276typedef struct tagTDES0 { 277 volatile unsigned char byTSR0; 278 volatile unsigned char byTSR1; 279 volatile unsigned short f15Txtime:15; 280 volatile unsigned short f1Owner:1; 281} __attribute__ ((__packed__)) 282STDES0; 283 284#endif 285 286typedef struct tagTDES1 { 287 volatile unsigned short wReqCount; 288 volatile unsigned char byTCR; 289 volatile unsigned char byReserved; 290} __attribute__ ((__packed__)) 291STDES1; 292 293typedef struct tagDEVICE_TD_INFO { 294 struct sk_buff *skb; 295 unsigned char *buf; 296 dma_addr_t skb_dma; 297 dma_addr_t buf_dma; 298 dma_addr_t curr_desc; 299 unsigned long dwReqCount; 300 unsigned long dwHeaderLength; 301 unsigned char byFlags; 302} DEVICE_TD_INFO, *PDEVICE_TD_INFO; 303 304// 305// transmit descriptor 306// 307typedef struct tagSTxDesc { 308 volatile STDES0 m_td0TD0; 309 volatile STDES1 m_td1TD1; 310 volatile u32 buff_addr; 311 volatile u32 next_desc; 312 struct tagSTxDesc *next __aligned(8); 313 volatile PDEVICE_TD_INFO pTDInfo __aligned(8); 314} __attribute__ ((__packed__)) 315STxDesc, *PSTxDesc; 316typedef const STxDesc *PCSTxDesc; 317 318typedef struct tagSTxSyncDesc { 319 volatile STDES0 m_td0TD0; 320 volatile STDES1 m_td1TD1; 321 volatile u32 buff_addr; // pointer to logical buffer 322 volatile u32 next_desc; // pointer to next logical descriptor 323 volatile unsigned short m_wFIFOCtl; 324 volatile unsigned short m_wTimeStamp; 325 struct tagSTxSyncDesc *next __aligned(8); 326 volatile PDEVICE_TD_INFO pTDInfo __aligned(8); 327} __attribute__ ((__packed__)) 328STxSyncDesc, *PSTxSyncDesc; 329typedef const STxSyncDesc *PCSTxSyncDesc; 330 331// 332// RsvTime buffer header 333// 334typedef struct tagSRrvTime_gRTS { 335 unsigned short wRTSTxRrvTime_ba; 336 unsigned short wRTSTxRrvTime_aa; 337 unsigned short wRTSTxRrvTime_bb; 338 unsigned short wReserved; 339 unsigned short wTxRrvTime_b; 340 unsigned short wTxRrvTime_a; 341} __attribute__ ((__packed__)) 342SRrvTime_gRTS, *PSRrvTime_gRTS; 343typedef const SRrvTime_gRTS *PCSRrvTime_gRTS; 344 345typedef struct tagSRrvTime_gCTS { 346 unsigned short wCTSTxRrvTime_ba; 347 unsigned short wReserved; 348 unsigned short wTxRrvTime_b; 349 unsigned short wTxRrvTime_a; 350} __attribute__ ((__packed__)) 351SRrvTime_gCTS, *PSRrvTime_gCTS; 352typedef const SRrvTime_gCTS *PCSRrvTime_gCTS; 353 354typedef struct tagSRrvTime_ab { 355 unsigned short wRTSTxRrvTime; 356 unsigned short wTxRrvTime; 357} __attribute__ ((__packed__)) 358SRrvTime_ab, *PSRrvTime_ab; 359typedef const SRrvTime_ab *PCSRrvTime_ab; 360 361typedef struct tagSRrvTime_atim { 362 unsigned short wCTSTxRrvTime_ba; 363 unsigned short wTxRrvTime_a; 364} __attribute__ ((__packed__)) 365SRrvTime_atim, *PSRrvTime_atim; 366typedef const SRrvTime_atim *PCSRrvTime_atim; 367 368// 369// RTS buffer header 370// 371typedef struct tagSRTSData { 372 unsigned short wFrameControl; 373 unsigned short wDurationID; 374 unsigned char abyRA[ETH_ALEN]; 375 unsigned char abyTA[ETH_ALEN]; 376} __attribute__ ((__packed__)) 377SRTSData, *PSRTSData; 378typedef const SRTSData *PCSRTSData; 379 380typedef struct tagSRTS_g { 381 unsigned char bySignalField_b; 382 unsigned char byServiceField_b; 383 unsigned short wTransmitLength_b; 384 unsigned char bySignalField_a; 385 unsigned char byServiceField_a; 386 unsigned short wTransmitLength_a; 387 unsigned short wDuration_ba; 388 unsigned short wDuration_aa; 389 unsigned short wDuration_bb; 390 unsigned short wReserved; 391 SRTSData Data; 392} __attribute__ ((__packed__)) 393SRTS_g, *PSRTS_g; 394typedef const SRTS_g *PCSRTS_g; 395 396typedef struct tagSRTS_g_FB { 397 unsigned char bySignalField_b; 398 unsigned char byServiceField_b; 399 unsigned short wTransmitLength_b; 400 unsigned char bySignalField_a; 401 unsigned char byServiceField_a; 402 unsigned short wTransmitLength_a; 403 unsigned short wDuration_ba; 404 unsigned short wDuration_aa; 405 unsigned short wDuration_bb; 406 unsigned short wReserved; 407 unsigned short wRTSDuration_ba_f0; 408 unsigned short wRTSDuration_aa_f0; 409 unsigned short wRTSDuration_ba_f1; 410 unsigned short wRTSDuration_aa_f1; 411 SRTSData Data; 412} __attribute__ ((__packed__)) 413SRTS_g_FB, *PSRTS_g_FB; 414typedef const SRTS_g_FB *PCSRTS_g_FB; 415 416typedef struct tagSRTS_ab { 417 unsigned char bySignalField; 418 unsigned char byServiceField; 419 unsigned short wTransmitLength; 420 unsigned short wDuration; 421 unsigned short wReserved; 422 SRTSData Data; 423} __attribute__ ((__packed__)) 424SRTS_ab, *PSRTS_ab; 425typedef const SRTS_ab *PCSRTS_ab; 426 427typedef struct tagSRTS_a_FB { 428 unsigned char bySignalField; 429 unsigned char byServiceField; 430 unsigned short wTransmitLength; 431 unsigned short wDuration; 432 unsigned short wReserved; 433 unsigned short wRTSDuration_f0; 434 unsigned short wRTSDuration_f1; 435 SRTSData Data; 436} __attribute__ ((__packed__)) 437SRTS_a_FB, *PSRTS_a_FB; 438typedef const SRTS_a_FB *PCSRTS_a_FB; 439 440// 441// CTS buffer header 442// 443typedef struct tagSCTSData { 444 unsigned short wFrameControl; 445 unsigned short wDurationID; 446 unsigned char abyRA[ETH_ALEN]; 447 unsigned short wReserved; 448} __attribute__ ((__packed__)) 449SCTSData, *PSCTSData; 450 451typedef struct tagSCTS { 452 unsigned char bySignalField_b; 453 unsigned char byServiceField_b; 454 unsigned short wTransmitLength_b; 455 unsigned short wDuration_ba; 456 unsigned short wReserved; 457 SCTSData Data; 458} __attribute__ ((__packed__)) 459SCTS, *PSCTS; 460typedef const SCTS *PCSCTS; 461 462typedef struct tagSCTS_FB { 463 unsigned char bySignalField_b; 464 unsigned char byServiceField_b; 465 unsigned short wTransmitLength_b; 466 unsigned short wDuration_ba; 467 unsigned short wReserved; 468 unsigned short wCTSDuration_ba_f0; 469 unsigned short wCTSDuration_ba_f1; 470 SCTSData Data; 471} __attribute__ ((__packed__)) 472SCTS_FB, *PSCTS_FB; 473typedef const SCTS_FB *PCSCTS_FB; 474 475// 476// Tx FIFO header 477// 478typedef struct tagSTxBufHead { 479 u32 adwTxKey[4]; 480 unsigned short wFIFOCtl; 481 unsigned short wTimeStamp; 482 unsigned short wFragCtl; 483 unsigned char byTxPower; 484 unsigned char wReserved; 485} __attribute__ ((__packed__)) 486STxBufHead, *PSTxBufHead; 487typedef const STxBufHead *PCSTxBufHead; 488 489typedef struct tagSTxShortBufHead { 490 unsigned short wFIFOCtl; 491 unsigned short wTimeStamp; 492} __attribute__ ((__packed__)) 493STxShortBufHead, *PSTxShortBufHead; 494typedef const STxShortBufHead *PCSTxShortBufHead; 495 496// 497// Tx data header 498// 499typedef struct tagSTxDataHead_g { 500 unsigned char bySignalField_b; 501 unsigned char byServiceField_b; 502 unsigned short wTransmitLength_b; 503 unsigned char bySignalField_a; 504 unsigned char byServiceField_a; 505 unsigned short wTransmitLength_a; 506 unsigned short wDuration_b; 507 unsigned short wDuration_a; 508 unsigned short wTimeStampOff_b; 509 unsigned short wTimeStampOff_a; 510} __attribute__ ((__packed__)) 511STxDataHead_g, *PSTxDataHead_g; 512typedef const STxDataHead_g *PCSTxDataHead_g; 513 514typedef struct tagSTxDataHead_g_FB { 515 unsigned char bySignalField_b; 516 unsigned char byServiceField_b; 517 unsigned short wTransmitLength_b; 518 unsigned char bySignalField_a; 519 unsigned char byServiceField_a; 520 unsigned short wTransmitLength_a; 521 unsigned short wDuration_b; 522 unsigned short wDuration_a; 523 unsigned short wDuration_a_f0; 524 unsigned short wDuration_a_f1; 525 unsigned short wTimeStampOff_b; 526 unsigned short wTimeStampOff_a; 527} __attribute__ ((__packed__)) 528STxDataHead_g_FB, *PSTxDataHead_g_FB; 529typedef const STxDataHead_g_FB *PCSTxDataHead_g_FB; 530 531typedef struct tagSTxDataHead_ab { 532 unsigned char bySignalField; 533 unsigned char byServiceField; 534 unsigned short wTransmitLength; 535 unsigned short wDuration; 536 unsigned short wTimeStampOff; 537} __attribute__ ((__packed__)) 538STxDataHead_ab, *PSTxDataHead_ab; 539typedef const STxDataHead_ab *PCSTxDataHead_ab; 540 541typedef struct tagSTxDataHead_a_FB { 542 unsigned char bySignalField; 543 unsigned char byServiceField; 544 unsigned short wTransmitLength; 545 unsigned short wDuration; 546 unsigned short wTimeStampOff; 547 unsigned short wDuration_f0; 548 unsigned short wDuration_f1; 549} __attribute__ ((__packed__)) 550STxDataHead_a_FB, *PSTxDataHead_a_FB; 551typedef const STxDataHead_a_FB *PCSTxDataHead_a_FB; 552 553// 554// MICHDR data header 555// 556typedef struct tagSMICHDRHead { 557 u32 adwHDR0[4]; 558 u32 adwHDR1[4]; 559 u32 adwHDR2[4]; 560} __attribute__ ((__packed__)) 561SMICHDRHead, *PSMICHDRHead; 562typedef const SMICHDRHead *PCSMICHDRHead; 563 564typedef struct tagSBEACONCtl { 565 u32 BufReady:1; 566 u32 TSF:15; 567 u32 BufLen:11; 568 u32 Reserved:5; 569} __attribute__ ((__packed__)) 570SBEACONCtl; 571 572typedef struct tagSSecretKey { 573 u32 dwLowDword; 574 unsigned char byHighByte; 575} __attribute__ ((__packed__)) 576SSecretKey; 577 578typedef struct tagSKeyEntry { 579 unsigned char abyAddrHi[2]; 580 unsigned short wKCTL; 581 unsigned char abyAddrLo[4]; 582 u32 dwKey0[4]; 583 u32 dwKey1[4]; 584 u32 dwKey2[4]; 585 u32 dwKey3[4]; 586 u32 dwKey4[4]; 587} __attribute__ ((__packed__)) 588SKeyEntry; 589 590#endif // __DESC_H__