You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

base.h 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*-
  2. * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting
  3. * All rights reserved.
  4. *
  5. * Modified for gPXE, July 2009, by Joshua Oreman <oremanj@rwcr.net>
  6. * Original from Linux kernel 2.6.30.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions
  10. * are met:
  11. * 1. Redistributions of source code must retain the above copyright
  12. * notice, this list of conditions and the following disclaimer,
  13. * without modification.
  14. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  15. * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
  16. * redistribution must be conditioned upon including a substantially
  17. * similar Disclaimer requirement for further binary redistribution.
  18. * 3. Neither the names of the above-listed copyright holders nor the names
  19. * of any contributors may be used to endorse or promote products derived
  20. * from this software without specific prior written permission.
  21. *
  22. * Alternatively, this software may be distributed under the terms of the
  23. * GNU General Public License ("GPL") version 2 as published by the Free
  24. * Software Foundation.
  25. *
  26. * NO WARRANTY
  27. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  28. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  29. * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
  30. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  31. * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
  32. * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  33. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  34. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  35. * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  36. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  37. * THE POSSIBILITY OF SUCH DAMAGES.
  38. *
  39. */
  40. /*
  41. * Defintions for the Atheros Wireless LAN controller driver.
  42. */
  43. #ifndef _DEV_ATH_ATHVAR_H
  44. #define _DEV_ATH_ATHVAR_H
  45. FILE_LICENCE ( BSD3 );
  46. #include "ath5k.h"
  47. #include <gpxe/iobuf.h>
  48. #define ATH_RXBUF 16 /* number of RX buffers */
  49. #define ATH_TXBUF 16 /* number of TX buffers */
  50. struct ath5k_buf {
  51. struct list_head list;
  52. unsigned int flags; /* rx descriptor flags */
  53. struct ath5k_desc *desc; /* virtual addr of desc */
  54. u32 daddr; /* physical addr of desc */
  55. struct io_buffer *iob; /* I/O buffer for buf */
  56. u32 iobaddr;/* physical addr of iob data */
  57. };
  58. /*
  59. * Data transmit queue state. One of these exists for each
  60. * hardware transmit queue. Packets sent to us from above
  61. * are assigned to queues based on their priority. Not all
  62. * devices support a complete set of hardware transmit queues.
  63. * For those devices the array sc_ac2q will map multiple
  64. * priorities to fewer hardware queues (typically all to one
  65. * hardware queue).
  66. */
  67. struct ath5k_txq {
  68. unsigned int qnum; /* hardware q number */
  69. u32 *link; /* link ptr in last TX desc */
  70. struct list_head q; /* transmit queue */
  71. int setup;
  72. };
  73. #if CHAN_DEBUG
  74. #define ATH_CHAN_MAX (26+26+26+200+200)
  75. #else
  76. #define ATH_CHAN_MAX (14+14+14+252+20)
  77. #endif
  78. /* Software Carrier, keeps track of the driver state
  79. * associated with an instance of a device */
  80. struct ath5k_softc {
  81. struct pci_device *pdev; /* for dma mapping */
  82. void *iobase; /* address of the device */
  83. struct net80211_device *dev; /* IEEE 802.11 common */
  84. struct ath5k_hw *ah; /* Atheros HW */
  85. struct net80211_hw_info *hwinfo;
  86. int curband;
  87. int irq_ena; /* interrupts enabled */
  88. struct ath5k_buf *bufptr; /* allocated buffer ptr */
  89. struct ath5k_desc *desc; /* TX/RX descriptors */
  90. u32 desc_daddr; /* DMA (physical) address */
  91. size_t desc_len; /* size of TX/RX descriptors */
  92. u16 cachelsz; /* cache line size */
  93. int status;
  94. #define ATH_STAT_INVALID 0x01 /* disable hardware accesses */
  95. #define ATH_STAT_MRRETRY 0x02 /* multi-rate retry support */
  96. #define ATH_STAT_PROMISC 0x04
  97. #define ATH_STAT_LEDSOFT 0x08 /* enable LED gpio status */
  98. #define ATH_STAT_STARTED 0x10 /* opened & irqs enabled */
  99. unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */
  100. unsigned int curmode; /* current phy mode */
  101. struct net80211_channel *curchan; /* current h/w channel */
  102. enum ath5k_int imask; /* interrupt mask copy */
  103. u8 bssidmask[ETH_ALEN];
  104. unsigned int rxbufsize; /* rx size based on mtu */
  105. struct list_head rxbuf; /* receive buffer */
  106. u32 *rxlink; /* link ptr in last RX desc */
  107. struct list_head txbuf; /* transmit buffer */
  108. unsigned int txbuf_len; /* buf count in txbuf list */
  109. struct ath5k_txq txq; /* tx queue */
  110. struct {
  111. u16 gpio;
  112. unsigned polarity;
  113. } rf_kill;
  114. int last_calib_ticks;
  115. int power_level; /* Requested tx power in dbm */
  116. int assoc; /* assocate state */
  117. int hw_rate; /* Hardware tx rate code */
  118. int hw_rtscts_rate; /* Hardware rts/cts rate code */
  119. };
  120. #define ath5k_hw_hasbssidmask(_ah) \
  121. (ath5k_hw_get_capability(_ah, AR5K_CAP_BSSIDMASK, 0, NULL) == 0)
  122. #define ath5k_hw_hasveol(_ah) \
  123. (ath5k_hw_get_capability(_ah, AR5K_CAP_VEOL, 0, NULL) == 0)
  124. #endif