iPXE
base.h
Go to the documentation of this file.
1 /*-
2  * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting
3  * All rights reserved.
4  *
5  * Modified for iPXE, 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 /*
42  * Defintions for the Atheros Wireless LAN controller driver.
43  */
44 #ifndef _DEV_ATH_ATHVAR_H
45 #define _DEV_ATH_ATHVAR_H
46 
47 FILE_LICENCE ( BSD3 );
48 
49 #include "ath5k.h"
50 #include <ipxe/iobuf.h>
51 
52 #define ATH_RXBUF 16 /* number of RX buffers */
53 #define ATH_TXBUF 16 /* number of TX buffers */
54 
55 struct ath5k_buf {
56  struct list_head list;
57  unsigned int flags; /* rx descriptor flags */
58  struct ath5k_desc *desc; /* virtual addr of desc */
59  u32 daddr; /* physical addr of desc */
60  struct io_buffer *iob; /* I/O buffer for buf */
61  u32 iobaddr;/* physical addr of iob data */
62 };
63 
64 /*
65  * Data transmit queue state. One of these exists for each
66  * hardware transmit queue. Packets sent to us from above
67  * are assigned to queues based on their priority. Not all
68  * devices support a complete set of hardware transmit queues.
69  * For those devices the array sc_ac2q will map multiple
70  * priorities to fewer hardware queues (typically all to one
71  * hardware queue).
72  */
73 struct ath5k_txq {
74  unsigned int qnum; /* hardware q number */
75  u32 *link; /* link ptr in last TX desc */
76  struct list_head q; /* transmit queue */
77  int setup;
78 };
79 
80 #if CHAN_DEBUG
81 #define ATH_CHAN_MAX (26+26+26+200+200)
82 #else
83 #define ATH_CHAN_MAX (14+14+14+252+20)
84 #endif
85 
86 /* Software Carrier, keeps track of the driver state
87  * associated with an instance of a device */
88 struct ath5k_softc {
89  struct pci_device *pdev; /* for dma mapping */
90  void *iobase; /* address of the device */
91  struct net80211_device *dev; /* IEEE 802.11 common */
92  struct ath5k_hw *ah; /* Atheros HW */
94  int curband;
95  int irq_ena; /* interrupts enabled */
96 
97  struct ath5k_buf *bufptr; /* allocated buffer ptr */
98  struct ath5k_desc *desc; /* TX/RX descriptors */
99  u32 desc_daddr; /* DMA (physical) address */
100  size_t desc_len; /* size of TX/RX descriptors */
101  u16 cachelsz; /* cache line size */
102 
103  int status;
104 #define ATH_STAT_INVALID 0x01 /* disable hardware accesses */
105 #define ATH_STAT_MRRETRY 0x02 /* multi-rate retry support */
106 #define ATH_STAT_PROMISC 0x04
107 #define ATH_STAT_LEDSOFT 0x08 /* enable LED gpio status */
108 #define ATH_STAT_STARTED 0x10 /* opened & irqs enabled */
109 
110  unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */
111  unsigned int curmode; /* current phy mode */
112  struct net80211_channel *curchan; /* current h/w channel */
113 
114  enum ath5k_int imask; /* interrupt mask copy */
115 
117 
118  unsigned int rxbufsize; /* rx size based on mtu */
119  struct list_head rxbuf; /* receive buffer */
120  u32 *rxlink; /* link ptr in last RX desc */
121 
122  struct list_head txbuf; /* transmit buffer */
123  unsigned int txbuf_len; /* buf count in txbuf list */
124  struct ath5k_txq txq; /* tx queue */
125 
126  struct {
128  unsigned polarity;
129  } rf_kill;
130 
132 
133  int power_level; /* Requested tx power in dbm */
134  int assoc; /* assocate state */
135 
136  int hw_rate; /* Hardware tx rate code */
137  int hw_rtscts_rate; /* Hardware rts/cts rate code */
138 };
139 
140 #define ath5k_hw_hasbssidmask(_ah) \
141  (ath5k_hw_get_capability(_ah, AR5K_CAP_BSSIDMASK, 0, NULL) == 0)
142 #define ath5k_hw_hasveol(_ah) \
143  (ath5k_hw_get_capability(_ah, AR5K_CAP_VEOL, 0, NULL) == 0)
144 
145 #endif
struct ath5k_txq txq
Definition: base.h:124
uint16_t u16
Definition: stdint.h:21
unsigned int curmode
Definition: base.h:111
I/O buffers.
struct list_head rxbuf
Definition: base.h:119
struct ath5k_softc::@14 rf_kill
int setup
Definition: base.h:77
int irq_ena
Definition: base.h:95
int assoc
Definition: base.h:134
ath5k_hw_get_isr - Get interrupt status
Definition: ath5k.h:953
A doubly-linked list entry (or list head)
Definition: list.h:18
unsigned int txbuf_len
Definition: base.h:123
struct io_buffer * iob
Definition: base.h:60
Information on the capabilities of an 802.11 hardware device.
Definition: net80211.h:436
int curband
Definition: base.h:94
u32 * link
Definition: base.h:75
struct ath5k_buf * bufptr
Definition: base.h:97
enum ath5k_int imask
Definition: base.h:114
struct list_head q
Definition: base.h:76
u8 bssidmask[ETH_ALEN]
Definition: base.h:116
struct list_head list
Definition: base.h:56
unsigned polarity
Definition: base.h:128
Definition: base.h:73
unsigned int rxbufsize
Definition: base.h:118
u32 desc_daddr
Definition: base.h:99
A PCI device.
Definition: pci.h:187
Structure encapsulating the complete state of an 802.11 device.
Definition: net80211.h:786
size_t desc_len
Definition: base.h:100
An 802.11 RF channel.
Definition: net80211.h:385
struct net80211_channel * curchan
Definition: base.h:112
unsigned int filter_flags
Definition: base.h:110
#define ETH_ALEN
Definition: if_ether.h:8
Definition: base.h:55
u32 daddr
Definition: base.h:59
struct pci_device * pdev
Definition: base.h:89
struct ath5k_desc * desc
Definition: base.h:58
unsigned int qnum
Definition: base.h:74
int status
Definition: base.h:103
struct net80211_hw_info * hwinfo
Definition: base.h:93
u16 cachelsz
Definition: base.h:101
void * iobase
Definition: base.h:90
FILE_LICENCE(BSD3)
int power_level
Definition: base.h:133
struct net80211_device * dev
Definition: base.h:91
int hw_rtscts_rate
Definition: base.h:137
int last_calib_ticks
Definition: base.h:131
unsigned int flags
Definition: base.h:57
int hw_rate
Definition: base.h:136
struct ath5k_hw * ah
Definition: base.h:92
u32 * rxlink
Definition: base.h:120
struct list_head txbuf
Definition: base.h:122
uint8_t u8
Definition: stdint.h:19
ath5k_int
enum ath5k_int - Hardware interrupt masks helpers
Definition: ath5k.h:804
uint32_t u32
Definition: stdint.h:23
struct ath5k_desc * desc
Definition: base.h:98
u32 iobaddr
Definition: base.h:61
A persistent I/O buffer.
Definition: iobuf.h:32
u16 gpio
Definition: base.h:127