* [Qemu-devel] Atheros Wireless Device Emulation
[not found] <20080103220945.30015gmx1@mx083.gmx.net>
@ 2008-02-28 14:12 ` Clemens Kolbitsch
2008-02-28 23:38 ` RE : " Sylvain Petreolle
0 siblings, 1 reply; 3+ messages in thread
From: Clemens Kolbitsch @ 2008-02-28 14:12 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 2851 bytes --]
Hi!
This patch adds virtual wireless networking support to qemu-0.9.1.
Besides being funny having a wireless LAN in Qemu, I guess wireless driver
developers could use this a lot.
I have 3 screenshots here:
http://stud4.tuwien.ac.at/~e0126605/qemu_atheros/atheros_wlan_hardware.jpg
http://stud4.tuwien.ac.at/~e0126605/qemu_atheros/atheros_wlan_connecting.jpg
http://stud4.tuwien.ac.at/~e0126605/qemu_atheros/atheros_wlan_connected.jpg
Some infos about the emulation:
- We simulate an Atheros AR5212 NIC
- Additionally, we have a virutal access point that can
be used to connect to Qemu
- The code is based on ath5k reverse engineering from
about 10 months ago. I did not check what these guys
did since then.
- I added tons of hours doing reverse engineering.. but the
code is still a MESS! I'm sorry, but at least it works ;-)
- We can simulate different network card vendors. I.e.
through an additional model-name, we can specify if the
network card is identified as "Atheros XXXX" or "HP W400", etc.
---> different drivers are installed automatically by guest system
- The hardware reverse engineering still lacks some stuff. Known
problems:
* Depending on the driver, you have to use a different model
---> official windows drivers VS. madwifi Linux driver
* Newest madwifi code probably does not work
---> Use Madwifi 0.9.3. Works just fine ;-)
- The networking-code is still a *little* ugly. Outbound connections
work, but there seem to be problems for inbound connections (e.g.
tcp-redirection, etc.)
- VM Snapshots supported
Some infos about the patch:
- 2 lines added to pci.c
- added function declaration to pci.h
- patched Makefile.target (2 lines)
- added files qemu/hw/atheros_wlan_.*.[ch]
- took 2 files from wireshark to generate CRC32 checksums
- took 3 files from ath5k
---> licence people, please have a look if that is ok!!
Enabling emulation:
As I wrote above, there are still problems when using the same code for
windows and linux guests. The model parameter helps here. Using the NIC on
windows (that's how I tested):
qemu ... -net user -net nic,model=atheros_wlan_winxp_HPW400 ...
and
qemu ... -net user -net nic,model=atheros_wlan_linux_HPW400 ...
for Linux systems.
The "atheros_wlan" is the device itself, "_linux" / "_windows" is necessary
because the reverse engineering is still buggy and "_HPW400" gives the NIC
identification for the guest. HPW400 is the Hewlett-Packard W400 device, but
there are some more (see the atheros_wlan_eeprom.h for details).
I have used the device on Debian (Kubuntu) Linux. The guests were WinXP-SP2
and Kubuntu Linux, Kernel 2.6.20, MadWifi 0.9.3. My system is x86, so there
might be problems with big/little endian I am not aware of!!
Please try the patch and let me know what you think of it!!
Greets,
Clemens
[-- Attachment #2: atheros_wlan.patch --]
[-- Type: text/x-diff, Size: 337630 bytes --]
diff -Nurp qemu-0.9.1-untouched/hw/ath5k.h qemu-0.9.1/hw/ath5k.h
--- qemu-0.9.1-untouched/hw/ath5k.h 1970-01-01 01:00:00.000000000 +0100
+++ qemu-0.9.1/hw/ath5k.h 2008-02-28 14:02:51.000000000 +0100
@@ -0,0 +1,887 @@
+/*
+ * Copyright (c) 2004-2007 Reyk Floeter <reyk@openbsd.org>
+ * Copyright (c) 2006-2007 Nick Kossifidis <mickflemm@gmail.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * $Id$
+ */
+
+/*
+ * HAL interface for Atheros Wireless LAN devices.
+ *
+ * ar5k is a free replacement of the binary-only HAL used by some drivers
+ * for Atheros chipsets. While using a different ABI, it tries to be
+ * source-compatible with the original (non-free) HAL interface.
+ *
+ * Many thanks to various contributors who supported the development of
+ * ar5k with hard work and useful information. And, of course, for all the
+ * people who encouraged me to continue this work which has been based
+ * on my initial approach found on http://team.vantronix.net/ar5k/.
+ */
+
+#ifndef _AR5K_H
+#define _AR5K_H
+
+
+
+
+/*
+ * Device tracing
+ */
+
+#define AR5K_TRACE_PRINTF(_trace) AR5K_PRINTF(_trace)
+
+
+
+
+
+
+/****************************\
+ GENERIC DRIVER DEFINITIONS
+\****************************/
+
+/*
+ * C doesn't support boolean ;-(
+ * TODO: See if there is a bool definition somewere else
+ * in the kernel, we shouldn't redefine it if it does...
+ */
+#ifndef TRUE
+#define TRUE 1
+#endif
+#ifndef FALSE
+#define FALSE 0
+#endif
+typedef u_int8_t AR5K_BOOL;
+
+/*
+ * Error codes reported from HAL to the driver
+ */
+typedef enum {
+ AR5K_OK = 0, /* Everything went O.K.*/
+ AR5K_ENOMEM = 1, /* Unable to allocate memory for ath_hal*/
+ AR5K_EIO = 2, /* Hardware I/O Error*/
+ AR5K_EELOCKED = 3, /* Unable to access EEPROM*/
+ AR5K_EEBADSUM = 4, /* Invalid EEPROM checksum*/
+ AR5K_EEREAD = 5, /* Unable to get device caps from EEPROM */
+ AR5K_EEBADMAC = 6, /* Unable to read MAC address from EEPROM */
+ AR5K_EINVAL = 7, /* Invalid parameter to function */
+ AR5K_ENOTSUPP = 8, /* Hardware revision not supported */
+ AR5K_EINPROGRESS= 9, /* Unexpected error ocured during process */
+} AR5K_STATUS;
+
+/*
+ * Some tuneable values (these should be changeable by the user)
+ */
+#define AR5K_TUNE_DMA_BEACON_RESP 2
+#define AR5K_TUNE_SW_BEACON_RESP 10
+#define AR5K_TUNE_ADDITIONAL_SWBA_BACKOFF 0
+#define AR5K_TUNE_RADAR_ALERT FALSE
+#define AR5K_TUNE_MIN_TX_FIFO_THRES 1
+#define AR5K_TUNE_MAX_TX_FIFO_THRES ((MAX_PDU_LENGTH / 64) + 1)
+#define AR5K_TUNE_RSSI_THRES 1792
+#define AR5K_TUNE_REGISTER_TIMEOUT 20000
+#define AR5K_TUNE_REGISTER_DWELL_TIME 20000
+#define AR5K_TUNE_BEACON_INTERVAL 100
+#define AR5K_TUNE_AIFS 2
+#define AR5K_TUNE_AIFS_11B 2
+#define AR5K_TUNE_AIFS_XR 0
+#define AR5K_TUNE_CWMIN 15
+#define AR5K_TUNE_CWMIN_11B 31
+#define AR5K_TUNE_CWMIN_XR 3
+#define AR5K_TUNE_CWMAX 1023
+#define AR5K_TUNE_CWMAX_11B 1023
+#define AR5K_TUNE_CWMAX_XR 7
+#define AR5K_TUNE_NOISE_FLOOR -72
+#define AR5K_TUNE_MAX_TXPOWER 60
+#define AR5K_TUNE_DEFAULT_TXPOWER 30
+#define AR5K_TUNE_TPC_TXPOWER TRUE
+#define AR5K_TUNE_ANT_DIVERSITY TRUE
+#define AR5K_TUNE_HWTXTRIES 4
+
+/* token to use for aifs, cwmin, cwmax in MadWiFi */
+#define AR5K_TXQ_USEDEFAULT ((u_int32_t) -1)
+
+#define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */
+#define ETHER_ADDR_LEN 6 /* length of an Ethernet address */
+static const u_char etherbroadcastaddr[ETHER_ADDR_LEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+//#define etherbroadcastaddr 0xff
+
+
+
+
+/*****************************\
+ GENERIC CHIPSET DEFINITIONS
+\*****************************/
+
+/* MAC Chips*/
+enum ath5k_version {
+ AR5K_AR5210 = 0,
+ AR5K_AR5211 = 1,
+ AR5K_AR5212 = 2,
+};
+
+/*PHY Chips*/
+enum ath5k_radio {
+ AR5K_AR5110 = 0,
+ AR5K_AR5111 = 1,
+ AR5K_AR5112 = 2,
+};
+
+/*
+ * Common silicon revision/version values
+ */
+enum ath5k_srev_type {
+ AR5K_VERSION_VER,
+ AR5K_VERSION_REV,
+ AR5K_VERSION_RAD,
+ AR5K_VERSION_DEV
+};
+
+struct ath5k_srev_name {
+ const char *sr_name;
+ enum ath5k_srev_type sr_type;
+ u_int sr_val;
+};
+
+#define AR5K_SREV_NAME { \
+ { "5210", AR5K_VERSION_VER, AR5K_SREV_VER_AR5210 }, \
+ { "5311", AR5K_VERSION_VER, AR5K_SREV_VER_AR5311 }, \
+ { "5311a", AR5K_VERSION_VER, AR5K_SREV_VER_AR5311A },\
+ { "5311b", AR5K_VERSION_VER, AR5K_SREV_VER_AR5311B },\
+ { "5211", AR5K_VERSION_VER, AR5K_SREV_VER_AR5211 }, \
+ { "5212", AR5K_VERSION_VER, AR5K_SREV_VER_AR5212 }, \
+ { "5213", AR5K_VERSION_VER, AR5K_SREV_VER_AR5213 }, \
+ { "xxxx", AR5K_VERSION_VER, AR5K_SREV_UNKNOWN }, \
+ { "5110", AR5K_VERSION_RAD, AR5K_SREV_RAD_5110 }, \
+ { "5111", AR5K_VERSION_RAD, AR5K_SREV_RAD_5111 }, \
+ { "2111", AR5K_VERSION_RAD, AR5K_SREV_RAD_2111 }, \
+ { "5112", AR5K_VERSION_RAD, AR5K_SREV_RAD_5112 }, \
+ { "5112a", AR5K_VERSION_RAD, AR5K_SREV_RAD_5112A }, \
+ { "2112", AR5K_VERSION_RAD, AR5K_SREV_RAD_2112 }, \
+ { "2112a", AR5K_VERSION_RAD, AR5K_SREV_RAD_2112A }, \
+ { "xxxx", AR5K_VERSION_RAD, AR5K_SREV_UNKNOWN }, \
+ { "2413", AR5K_VERSION_DEV, AR5K_DEVID_AR2413 }, \
+ { "5413", AR5K_VERSION_DEV, AR5K_DEVID_AR5413 }, \
+ { "5424", AR5K_VERSION_DEV, AR5K_DEVID_AR5424 }, \
+ { "xxxx", AR5K_VERSION_DEV, AR5K_SREV_UNKNOWN } \
+}
+
+#define AR5K_SREV_UNKNOWN 0xffff
+
+#define AR5K_SREV_VER_AR5210 0x00
+#define AR5K_SREV_VER_AR5311 0x10
+#define AR5K_SREV_VER_AR5311A 0x20
+#define AR5K_SREV_VER_AR5311B 0x30
+#define AR5K_SREV_VER_AR5211 0x40
+#define AR5K_SREV_VER_AR5212 0x50
+#define AR5K_SREV_VER_AR5213 0x55
+#define AR5K_SREV_VER_UNSUPP 0x60
+
+#define AR5K_SREV_RAD_5110 0x00
+#define AR5K_SREV_RAD_5111 0x10
+#define AR5K_SREV_RAD_5111A 0x15
+#define AR5K_SREV_RAD_2111 0x20
+#define AR5K_SREV_RAD_5112 0x30
+#define AR5K_SREV_RAD_5112A 0x35
+#define AR5K_SREV_RAD_2112 0x40
+#define AR5K_SREV_RAD_2112A 0x45
+#define AR5K_SREV_RAD_UNSUPP 0x50
+
+
+
+
+/****************\
+ TX DEFINITIONS
+\****************/
+
+/*
+ * Tx Descriptor
+ */
+struct ath_tx_status {
+ u_int16_t ts_seqnum;
+ u_int16_t ts_tstamp;
+ u_int8_t ts_status;
+ u_int8_t ts_rate;
+ int8_t ts_rssi;
+ u_int8_t ts_shortretry;
+ u_int8_t ts_longretry;
+ u_int8_t ts_virtcol;
+ u_int8_t ts_antenna;
+};
+
+#define AR5K_TXSTAT_ALTRATE 0x80
+#define AR5K_TXERR_XRETRY 0x01
+#define AR5K_TXERR_FILT 0x02
+#define AR5K_TXERR_FIFO 0x04
+
+/*
+ * Queue types used to classify tx queues.
+ */
+typedef enum {
+ AR5K_TX_QUEUE_INACTIVE = 0,/*This queue is not used -see ath_hal_releasetxqueue*/
+ AR5K_TX_QUEUE_DATA, /*A normal data queue*/
+ AR5K_TX_QUEUE_XR_DATA, /*An XR-data queue*/
+ AR5K_TX_QUEUE_BEACON, /*The beacon queue*/
+ AR5K_TX_QUEUE_CAB, /*The ater-beacon queue*/
+ AR5K_TX_QUEUE_UAPSD, /*Unscheduled Automatic Power Save Delivery queue*/
+} AR5K_TX_QUEUE;
+
+#define AR5K_NUM_TX_QUEUES 10
+
+/*
+ * Queue syb-types to classify normal data queues.
+ * These are the 4 Access Categories as defined in
+ * WME spec. 0 is the lowest priority and 4 is the
+ * highest. Normal data that hasn't been classified
+ * goes to the Best Effort AC.
+ */
+typedef enum {
+ AR5K_WME_AC_BK = 0, /*Background traffic*/
+ AR5K_WME_AC_BE, /*Best-effort (normal) traffic)*/
+ AR5K_WME_AC_VI, /*Video traffic*/
+ AR5K_WME_AC_VO, /*Voice traffic*/
+} AR5K_TX_QUEUE_SUBTYPE;
+
+/*
+ * Queue ID numbers as returned by the HAL, each number
+ * represents a hw queue. If hw does not support hw queues
+ * (eg 5210/5211) all data goes in one queue. These match
+ * d80211 definitions (net80211/MadWiFi don't use them).
+ */
+typedef enum {
+ AR5K_TX_QUEUE_ID_DATA_MIN = 0, /*IEEE80211_TX_QUEUE_DATA0*/
+ AR5K_TX_QUEUE_ID_DATA_MAX = 4, /*IEEE80211_TX_QUEUE_DATA4*/
+ AR5K_TX_QUEUE_ID_DATA_SVP = 5, /*IEEE80211_TX_QUEUE_SVP - Spectralink Voice Protocol*/
+ AR5K_TX_QUEUE_ID_CAB = 6, /*IEEE80211_TX_QUEUE_AFTER_BEACON*/
+ AR5K_TX_QUEUE_ID_BEACON = 7, /*IEEE80211_TX_QUEUE_BEACON*/
+ AR5K_TX_QUEUE_ID_UAPSD = 8,
+ AR5K_TX_QUEUE_ID_XR_DATA = 9,
+} AR5K_TX_QUEUE_ID;
+
+
+/*
+ * Flags to set hw queue's parameters...
+ */
+#define AR5K_TXQ_FLAG_TXINT_ENABLE 0x0001 /* Enable TXOK and TXERR interrupts -not used- */
+#define AR5K_TXQ_FLAG_TXDESCINT_ENABLE 0x0002 /* Enable TXDESC interrupt -not implemented- */
+#define AR5K_TXQ_FLAG_BACKOFF_DISABLE 0x0004 /* Disable random post-backoff */
+#define AR5K_TXQ_FLAG_COMPRESSION_ENABLE 0x0008 /* Enable hw compression -not implemented-*/
+#define AR5K_TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE 0x0010 /* Enable ready time expiry policy (?)*/
+#define AR5K_TXQ_FLAG_FRAG_BURST_BACKOFF_ENABLE 0x0020 /* Enable backoff while bursting */
+#define AR5K_TXQ_FLAG_POST_FR_BKOFF_DIS 0x0040 /* Disable backoff while bursting */
+#define AR5K_TXQ_FLAG_TXEOLINT_ENABLE 0x0080 /* Enable TXEOL interrupt -not implemented-*/
+
+/*
+ * A struct to hold tx queue's parameters
+ */
+typedef struct {
+ AR5K_TX_QUEUE tqi_type; /* See AR5K_TX_QUEUE */
+ AR5K_TX_QUEUE_SUBTYPE tqi_subtype; /* See AR5K_TX_QUEUE_SUBTYPE */
+ u_int16_t tqi_flags; /* Tx queue flags (see above) */
+ u_int32_t tqi_aifs; /* Arbitrated Interframe Space */
+ int32_t tqi_cw_min; /* Minimum Contention Window */
+ int32_t tqi_cw_max; /* Maximum Contention Window */
+ u_int32_t tqi_cbr_period; /* Constant bit rate period */
+ u_int32_t tqi_cbr_overflow_limit;
+ u_int32_t tqi_burst_time;
+ u_int32_t tqi_ready_time; /* Not used */
+ u_int32_t tqi_comp_buffer;/* Compression Buffer's phys addr */
+} AR5K_TXQ_INFO;
+
+/*
+ * Transmit packet types.
+ * These are not fully used inside OpenHAL yet
+ */
+typedef enum {
+ AR5K_PKT_TYPE_NORMAL = 0,
+ AR5K_PKT_TYPE_ATIM = 1,
+ AR5K_PKT_TYPE_PSPOLL = 2,
+ AR5K_PKT_TYPE_BEACON = 3,
+ AR5K_PKT_TYPE_PROBE_RESP = 4,
+ AR5K_PKT_TYPE_PIFS = 5,
+} AR5K_PKT_TYPE;
+
+/*
+ * TX power and TPC settings
+ */
+#define AR5K_TXPOWER_OFDM(_r, _v) ( \
+ ((0 & 1) << ((_v) + 6)) | \
+ (((hal->ah_txpower.txp_rates[(_r)]) & 0x3f) << (_v)) \
+)
+
+#define AR5K_TXPOWER_CCK(_r, _v) ( \
+ (hal->ah_txpower.txp_rates[(_r)] & 0x3f) << (_v) \
+)
+
+/*
+ * Used to compute TX times
+ */
+#define AR5K_CCK_SIFS_TIME 10
+#define AR5K_CCK_PREAMBLE_BITS 144
+#define AR5K_CCK_PLCP_BITS 48
+
+#define AR5K_OFDM_SIFS_TIME 16
+#define AR5K_OFDM_PREAMBLE_TIME 20
+#define AR5K_OFDM_PLCP_BITS 22
+#define AR5K_OFDM_SYMBOL_TIME 4
+
+#define AR5K_TURBO_SIFS_TIME 8
+#define AR5K_TURBO_PREAMBLE_TIME 14
+#define AR5K_TURBO_PLCP_BITS 22
+#define AR5K_TURBO_SYMBOL_TIME 4
+
+#define AR5K_XR_SIFS_TIME 16
+#define AR5K_XR_PLCP_BITS 22
+#define AR5K_XR_SYMBOL_TIME 4
+
+/* CCK */
+#define AR5K_CCK_NUM_BITS(_frmlen) (_frmlen << 3)
+
+#define AR5K_CCK_PHY_TIME(_sp) (_sp ? \
+ ((AR5K_CCK_PREAMBLE_BITS + AR5K_CCK_PLCP_BITS) >> 1) : \
+ (AR5K_CCK_PREAMBLE_BITS + AR5K_CCK_PLCP_BITS))
+
+#define AR5K_CCK_TX_TIME(_kbps, _frmlen, _sp) \
+ AR5K_CCK_PHY_TIME(_sp) + \
+ ((AR5K_CCK_NUM_BITS(_frmlen) * 1000) / _kbps) + \
+ AR5K_CCK_SIFS_TIME
+
+/* OFDM */
+#define AR5K_OFDM_NUM_BITS(_frmlen) (AR5K_OFDM_PLCP_BITS + (_frmlen << 3))
+
+#define AR5K_OFDM_NUM_BITS_PER_SYM(_kbps) ((_kbps * \
+ AR5K_OFDM_SYMBOL_TIME) / 1000)
+
+#define AR5K_OFDM_NUM_BITS(_frmlen) (AR5K_OFDM_PLCP_BITS + (_frmlen << 3))
+
+#define AR5K_OFDM_NUM_SYMBOLS(_kbps, _frmlen) \
+ howmany(AR5K_OFDM_NUM_BITS(_frmlen), AR5K_OFDM_NUM_BITS_PER_SYM(_kbps))
+
+#define AR5K_OFDM_TX_TIME(_kbps, _frmlen) \
+ AR5K_OFDM_PREAMBLE_TIME + AR5K_OFDM_SIFS_TIME + \
+ (AR5K_OFDM_NUM_SYMBOLS(_kbps, _frmlen) * AR5K_OFDM_SYMBOL_TIME)
+
+/* TURBO */
+#define AR5K_TURBO_NUM_BITS(_frmlen) (AR5K_TURBO_PLCP_BITS + (_frmlen << 3))
+
+#define AR5K_TURBO_NUM_BITS_PER_SYM(_kbps) (((_kbps << 1) * \
+ AR5K_TURBO_SYMBOL_TIME) / 1000)
+
+#define AR5K_TURBO_NUM_BITS(_frmlen) (AR5K_TURBO_PLCP_BITS + (_frmlen << 3))
+
+#define AR5K_TURBO_NUM_SYMBOLS(_kbps, _frmlen) \
+ howmany(AR5K_TURBO_NUM_BITS(_frmlen), \
+ AR5K_TURBO_NUM_BITS_PER_SYM(_kbps))
+
+#define AR5K_TURBO_TX_TIME(_kbps, _frmlen) \
+ AR5K_TURBO_PREAMBLE_TIME + AR5K_TURBO_SIFS_TIME + \
+ (AR5K_TURBO_NUM_SYMBOLS(_kbps, _frmlen) * AR5K_TURBO_SYMBOL_TIME)
+
+/* eXtendent Range (?)*/
+#define AR5K_XR_PREAMBLE_TIME(_kbps) (((_kbps) < 1000) ? 173 : 76)
+
+#define AR5K_XR_NUM_BITS_PER_SYM(_kbps) ((_kbps * \
+ AR5K_XR_SYMBOL_TIME) / 1000)
+
+#define AR5K_XR_NUM_BITS(_frmlen) (AR5K_XR_PLCP_BITS + (_frmlen << 3))
+
+#define AR5K_XR_NUM_SYMBOLS(_kbps, _frmlen) \
+ howmany(AR5K_XR_NUM_BITS(_frmlen), AR5K_XR_NUM_BITS_PER_SYM(_kbps))
+
+#define AR5K_XR_TX_TIME(_kbps, _frmlen) \
+ AR5K_XR_PREAMBLE_TIME(_kbps) + AR5K_XR_SIFS_TIME + \
+ (AR5K_XR_NUM_SYMBOLS(_kbps, _frmlen) * AR5K_XR_SYMBOL_TIME)
+
+/*
+ * DMA size definitions (2^n+2)
+ */
+typedef enum {
+ AR5K_DMASIZE_4B = 0,
+ AR5K_DMASIZE_8B,
+ AR5K_DMASIZE_16B,
+ AR5K_DMASIZE_32B,
+ AR5K_DMASIZE_64B,
+ AR5K_DMASIZE_128B,
+ AR5K_DMASIZE_256B,
+ AR5K_DMASIZE_512B
+} ath5k_dmasize_t;
+
+
+
+/****************\
+ RX DEFINITIONS
+\****************/
+
+/*
+ * Rx Descriptor
+ */
+struct ath_rx_status {
+ u_int16_t rs_datalen;
+ u_int16_t rs_tstamp;
+ u_int8_t rs_status;
+ u_int8_t rs_phyerr;
+ int8_t rs_rssi;
+ u_int8_t rs_keyix;
+ u_int8_t rs_rate;
+ u_int8_t rs_antenna;
+ u_int8_t rs_more;
+};
+
+#define AR5K_RXERR_CRC 0x01
+#define AR5K_RXERR_PHY 0x02
+#define AR5K_RXERR_FIFO 0x04
+#define AR5K_RXERR_DECRYPT 0x08
+#define AR5K_RXERR_MIC 0x10
+#define AR5K_RXKEYIX_INVALID ((u_int8_t) - 1)
+#define AR5K_TXKEYIX_INVALID ((u_int32_t) - 1)
+
+/*
+ * RX filters
+ * Most of them are not yet used inside OpenHAL
+ */
+#define AR5K_RX_FILTER_UCAST 0x00000001 /* Don't filter unicast frames */
+#define AR5K_RX_FILTER_MCAST 0x00000002 /* Don't filter multicast frames */
+#define AR5K_RX_FILTER_BCAST 0x00000004 /* Don't filter broadcast frames */
+#define AR5K_RX_FILTER_CONTROL 0x00000008 /* Don't filter control frames */
+#define AR5K_RX_FILTER_BEACON 0x00000010 /* Don't filter beacon frames */
+#define AR5K_RX_FILTER_PROM 0x00000020 /* Set promiscuous mode */
+#define AR5K_RX_FILTER_XRPOLL 0x00000040 /* Don't filter XR poll frame */
+#define AR5K_RX_FILTER_PROBEREQ 0x00000080 /* Don't filter probe requests */
+#define AR5K_RX_FILTER_PHYERROR 0x00000100 /* Don't filter phy errors */
+#define AR5K_RX_FILTER_PHYRADAR 0x00000200 /* Don't filter phy radar errors*/
+
+typedef struct {
+ u_int32_t ackrcv_bad;
+ u_int32_t rts_bad;
+ u_int32_t rts_good;
+ u_int32_t fcs_bad;
+ u_int32_t beacons;
+} AR5K_MIB_STATS;
+
+
+
+
+/**************************\
+ BEACON TIMERS DEFINITIONS
+\**************************/
+
+#define AR5K_BEACON_PERIOD 0x0000ffff
+#define AR5K_BEACON_ENA 0x00800000 /*enable beacon xmit*/
+#define AR5K_BEACON_RESET_TSF 0x01000000 /*force a TSF reset*/
+
+/*
+ * Per-station beacon timer state.
+ */
+typedef struct {
+ u_int32_t bs_next_beacon;
+ u_int32_t bs_next_dtim;
+ u_int32_t bs_interval; /*in TU's -see net80211/ieee80211_var.h-
+ can also include the above flags*/
+ u_int8_t bs_dtim_period;
+ u_int8_t bs_cfp_period;
+ u_int16_t bs_cfp_max_duration; /*if non-zero hw is setup to coexist with
+ a Point Coordination Function capable AP*/
+ u_int16_t bs_cfp_du_remain;
+ u_int16_t bs_tim_offset;
+ u_int16_t bs_sleep_duration;
+ u_int16_t bs_bmiss_threshold;
+ u_int32_t bs_cfp_next;
+} AR5K_BEACON_STATE;
+
+
+
+
+/********************\
+ COMMON DEFINITIONS
+\********************/
+
+/*
+ * Atheros descriptor
+ */
+struct ath_desc {
+ u_int32_t ds_link;
+ u_int32_t ds_data;
+ u_int32_t ds_ctl0;
+ u_int32_t ds_ctl1;
+ u_int32_t ds_hw[4];
+
+ union {
+ struct ath_rx_status rx;
+ struct ath_tx_status tx;
+ } ds_us;
+
+#define ds_rxstat ds_us.rx
+#define ds_txstat ds_us.tx
+
+} __packed;
+
+#define AR5K_RXDESC_INTREQ 0x0020
+
+#define AR5K_TXDESC_CLRDMASK 0x0001
+#define AR5K_TXDESC_NOACK 0x0002
+#define AR5K_TXDESC_RTSENA 0x0004
+#define AR5K_TXDESC_CTSENA 0x0008
+#define AR5K_TXDESC_INTREQ 0x0010
+#define AR5K_TXDESC_VEOL 0x0020
+
+/*
+ * 802.11 operating modes...
+ */
+#define AR5K_MODE_11A 0x01
+#define AR5K_MODE_11B 0x02
+#define AR5K_MODE_11G 0x04
+#define AR5K_MODE_TURBO 0x08
+#define AR5K_MODE_108G 0x16
+#define AR5K_MODE_XR 0x32
+#define AR5K_MODE_ALL (AR5K_MODE_11A| \
+ AR5K_MODE_11B| \
+ AR5K_MODE_11G| \
+ AR5K_MODE_TURBO|\
+ AR5K_MODE_108G| \
+ AR5K_MODE_XR)
+
+/*
+ * Channel definitions
+ */
+typedef struct {
+ u_int16_t freq; /* setting in Mhz */
+ u_int16_t channel_flags;
+ u_int8_t private_flags; /* not used in OpenHAL yet*/
+} AR5K_CHANNEL;
+
+#define AR5K_SLOT_TIME_9 396
+#define AR5K_SLOT_TIME_20 880
+#define AR5K_SLOT_TIME_MAX 0xffff
+
+/* channel_flags */
+#define CHANNEL_CW_INT 0x0008 /* Contention Window interference detected */
+#define CHANNEL_TURBO 0x0010 /* Turbo Channel */
+#define CHANNEL_CCK 0x0020 /* CCK channel */
+#define CHANNEL_OFDM 0x0040 /* OFDM channel */
+#define CHANNEL_2GHZ 0x0080 /* 2GHz channel. */
+#define CHANNEL_5GHZ 0x0100 /* 5GHz channel */
+#define CHANNEL_PASSIVE 0x0200 /* Only passive scan allowed */
+#define CHANNEL_DYN 0x0400 /* Dynamic CCK-OFDM channel (for g operation)*/
+#define CHANNEL_XR 0x0800 /* XR channel */
+
+#define CHANNEL_A (CHANNEL_5GHZ|CHANNEL_OFDM)
+#define CHANNEL_B (CHANNEL_2GHZ|CHANNEL_CCK)
+#define CHANNEL_PUREG (CHANNEL_2GHZ|CHANNEL_OFDM)
+//#ifdef notdef
+#define CHANNEL_G (CHANNEL_2GHZ|CHANNEL_DYN)
+//#else
+//#define CHANNEL_G (CHANNEL_2GHZ|CHANNEL_OFDM)
+//#endif
+#define CHANNEL_T (CHANNEL_5GHZ|CHANNEL_OFDM|CHANNEL_TURBO)
+#define CHANNEL_TG (CHANNEL_2GHZ|CHANNEL_OFDM|CHANNEL_TURBO)
+#define CHANNEL_108A CHANNEL_T
+#define CHANNEL_108G CHANNEL_TG
+#define CHANNEL_X (CHANNEL_5GHZ|CHANNEL_OFDM|CHANNEL_XR)
+
+#define CHANNEL_ALL (CHANNEL_OFDM|CHANNEL_CCK| CHANNEL_2GHZ |\
+ CHANNEL_5GHZ | CHANNEL_TURBO)
+
+#define CHANNEL_ALL_NOTURBO (CHANNEL_ALL &~ CHANNEL_TURBO)
+#define CHANNEL_MODES CHANNEL_ALL
+
+/*
+ * Used internaly in OpenHAL (ar5211.c/ar5212.c
+ * for reset_tx_queue). Also see struct AR5K_CHANNEL.
+ */
+#define IS_CHAN_XR(_c) \
+ ((_c.channel_flags & CHANNEL_XR) != 0)
+
+#define IS_CHAN_B(_c) \
+ ((_c.channel_flags & CHANNEL_B) != 0)
+
+typedef enum {
+ AR5K_CHIP_5GHZ = CHANNEL_5GHZ,
+ AR5K_CHIP_2GHZ = CHANNEL_2GHZ,
+} AR5K_CHIP;
+
+/*
+ * The following structure will be used to map 2GHz channels to
+ * 5GHz Atheros channels.
+ */
+struct ath5k_athchan_2ghz {
+ u_int32_t a2_flags;
+ u_int16_t a2_athchan;
+};
+
+/*
+ * Rate definitions
+ */
+
+#define AR5K_MAX_RATES 32 /*max number of rates on the rate table*/
+
+typedef struct {
+ u_int8_t valid; /* Valid for rate control */
+ u_int32_t modulation;
+ u_int16_t rate_kbps;
+ u_int8_t rate_code; /* Rate mapping for h/w descriptors */
+ u_int8_t dot11_rate;
+ u_int8_t control_rate;
+ u_int16_t lp_ack_duration;/* long preamble ACK duration */
+ u_int16_t sp_ack_duration;/* short preamble ACK duration*/
+} AR5K_RATE;
+
+typedef struct {
+ u_int16_t rate_count;
+ u_int8_t rate_code_to_index[AR5K_MAX_RATES]; /* Back-mapping */
+ AR5K_RATE rates[AR5K_MAX_RATES];
+} AR5K_RATE_TABLE;
+
+/*
+ * Rate tables...
+ */
+#define AR5K_RATES_11A { 8, { \
+ 255, 255, 255, 255, 255, 255, 255, 255, 6, 4, 2, 0, \
+ 7, 5, 3, 1, 255, 255, 255, 255, 255, 255, 255, 255, \
+ 255, 255, 255, 255, 255, 255, 255, 255 }, { \
+ { 1, MODULATION_OFDM, 6000, 11, 140, 0 }, \
+ { 1, MODULATION_OFDM, 9000, 15, 18, 0 }, \
+ { 1, MODULATION_OFDM, 12000, 10, 152, 2 }, \
+ { 1, MODULATION_OFDM, 18000, 14, 36, 2 }, \
+ { 1, MODULATION_OFDM, 24000, 9, 176, 4 }, \
+ { 1, MODULATION_OFDM, 36000, 13, 72, 4 }, \
+ { 1, MODULATION_OFDM, 48000, 8, 96, 4 }, \
+ { 1, MODULATION_OFDM, 54000, 12, 108, 4 } } \
+}
+
+#define AR5K_RATES_11B { 4, { \
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, \
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, \
+ 3, 2, 1, 0, 255, 255, 255, 255 }, { \
+ { 1, MODULATION_CCK, 1000, 27, 130, 0 }, \
+ { 1, MODULATION_CCK, 2000, 26, 132, 1 }, \
+ { 1, MODULATION_CCK, 5500, 25, 139, 1 }, \
+ { 1, MODULATION_CCK, 11000, 24, 150, 1 } } \
+}
+
+#define AR5K_RATES_11G { 12, { \
+ 255, 255, 255, 255, 255, 255, 255, 255, 10, 8, 6, 4, \
+ 11, 9, 7, 5, 255, 255, 255, 255, 255, 255, 255, 255, \
+ 3, 2, 1, 0, 255, 255, 255, 255 }, { \
+ { 1, MODULATION_CCK, 1000, 27, 2, 0 }, \
+ { 1, MODULATION_CCK, 2000, 26, 4, 1 }, \
+ { 1, MODULATION_CCK, 5500, 25, 11, 1 }, \
+ { 1, MODULATION_CCK, 11000, 24, 22, 1 }, \
+ { 0, MODULATION_OFDM, 6000, 11, 12, 4 }, \
+ { 0, MODULATION_OFDM, 9000, 15, 18, 4 }, \
+ { 1, MODULATION_OFDM, 12000, 10, 24, 6 }, \
+ { 1, MODULATION_OFDM, 18000, 14, 36, 6 }, \
+ { 1, MODULATION_OFDM, 24000, 9, 48, 8 }, \
+ { 1, MODULATION_OFDM, 36000, 13, 72, 8 }, \
+ { 1, MODULATION_OFDM, 48000, 8, 96, 8 }, \
+ { 1, MODULATION_OFDM, 54000, 12, 108, 8 } } \
+}
+
+#define AR5K_RATES_TURBO { 8, { \
+ 255, 255, 255, 255, 255, 255, 255, 255, 6, 4, 2, 0, \
+ 7, 5, 3, 1, 255, 255, 255, 255, 255, 255, 255, 255, \
+ 255, 255, 255, 255, 255, 255, 255, 255 }, { \
+ { 1, MODULATION_TURBO, 6000, 11, 140, 0 }, \
+ { 1, MODULATION_TURBO, 9000, 15, 18, 0 }, \
+ { 1, MODULATION_TURBO, 12000, 10, 152, 2 }, \
+ { 1, MODULATION_TURBO, 18000, 14, 36, 2 }, \
+ { 1, MODULATION_TURBO, 24000, 9, 176, 4 }, \
+ { 1, MODULATION_TURBO, 36000, 13, 72, 4 }, \
+ { 1, MODULATION_TURBO, 48000, 8, 96, 4 }, \
+ { 1, MODULATION_TURBO, 54000, 12, 108, 4 } } \
+}
+
+#define AR5K_RATES_XR { 12, { \
+ 255, 3, 1, 255, 255, 255, 2, 0, 10, 8, 6, 4, \
+ 11, 9, 7, 5, 255, 255, 255, 255, 255, 255, 255, 255, \
+ 255, 255, 255, 255, 255, 255, 255, 255 }, { \
+ { 1, MODULATION_XR, 500, 7, 129, 0 }, \
+ { 1, MODULATION_XR, 1000, 2, 139, 1 }, \
+ { 1, MODULATION_XR, 2000, 6, 150, 2 }, \
+ { 1, MODULATION_XR, 3000, 1, 150, 3 }, \
+ { 1, MODULATION_OFDM, 6000, 11, 140, 4 }, \
+ { 1, MODULATION_OFDM, 9000, 15, 18, 4 }, \
+ { 1, MODULATION_OFDM, 12000, 10, 152, 6 }, \
+ { 1, MODULATION_OFDM, 18000, 14, 36, 6 }, \
+ { 1, MODULATION_OFDM, 24000, 9, 176, 8 }, \
+ { 1, MODULATION_OFDM, 36000, 13, 72, 8 }, \
+ { 1, MODULATION_OFDM, 48000, 8, 96, 8 }, \
+ { 1, MODULATION_OFDM, 54000, 12, 108, 8 } } \
+}
+
+/*
+ * Crypto definitions
+ */
+
+/* key types */
+typedef enum {
+ AR5K_CIPHER_WEP = 0,
+ AR5K_CIPHER_AES_OCB = 1,
+ AR5K_CIPHER_AES_CCM = 2,
+ AR5K_CIPHER_CKIP = 3,
+ AR5K_CIPHER_TKIP = 4,
+ AR5K_CIPHER_CLR = 5, /* no encryption */
+ AR5K_CIPHER_MIC = 127 /* used for Message
+ Integrity Code */
+} AR5K_CIPHER;
+
+#define AR5K_KEYVAL_LENGTH_40 5
+#define AR5K_KEYVAL_LENGTH_104 13
+#define AR5K_KEYVAL_LENGTH_128 16
+#define AR5K_KEYVAL_LENGTH_MAX AR5K_KEYVAL_LENGTH_128
+
+typedef struct {
+ int wk_len; /* key's length */
+ u_int8_t wk_key[AR5K_KEYVAL_LENGTH_MAX];
+ u_int8_t wk_type; /* see above */
+ u_int8_t wk_mic[8]; /* TKIP MIC key */
+} AR5K_KEYVAL;
+
+
+
+/***********************\
+ HW RELATED DEFINITIONS
+\***********************/
+
+/*
+ * Misc definitions
+ */
+#define AR5K_RSSI_EP_MULTIPLIER (1<<7)
+
+#define AR5K_ASSERT_ENTRY(_e, _s) do { \
+ if (_e >= _s) \
+ return (FALSE); \
+} while (0)
+
+
+typedef struct {
+ u_int32_t ns_avgbrssi; /* average beacon rssi */
+ u_int32_t ns_avgrssi; /* average data rssi */
+ u_int32_t ns_avgtxrssi; /* average tx rssi */
+} AR5K_NODE_STATS;
+
+typedef enum {
+ AR5K_ANT_VARIABLE = 0, /* variable by programming */
+ AR5K_ANT_FIXED_A = 1, /* fixed to 11a frequencies */
+ AR5K_ANT_FIXED_B = 2, /* fixed to 11b frequencies */
+ AR5K_ANT_MAX = 3,
+} AR5K_ANT_SETTING;
+
+/*
+ * HAL interrupt abstraction
+ */
+
+/*
+ * These are maped to take advantage of some common bits
+ * between the MAC chips, to be able to set intr properties
+ * easier. Some of them are not used yet inside OpenHAL.
+ */
+typedef enum {
+ AR5K_INT_RX = 0x00000001,
+ AR5K_INT_RXDESC = 0x00000002,
+ AR5K_INT_RXNOFRM = 0x00000008,
+ AR5K_INT_RXEOL = 0x00000010,
+ AR5K_INT_RXORN = 0x00000020,
+ AR5K_INT_TX = 0x00000040,
+ AR5K_INT_TXDESC = 0x00000080,
+ AR5K_INT_TXURN = 0x00000800,
+ AR5K_INT_MIB = 0x00001000,
+ AR5K_INT_RXPHY = 0x00004000,
+ AR5K_INT_RXKCM = 0x00008000,
+ AR5K_INT_SWBA = 0x00010000,
+ AR5K_INT_BMISS = 0x00040000,
+ AR5K_INT_BNR = 0x00100000,
+ AR5K_INT_GPIO = 0x01000000,
+ AR5K_INT_FATAL = 0x40000000,
+ AR5K_INT_GLOBAL = 0x80000000,
+
+ /*A sum of all the common bits*/
+ AR5K_INT_COMMON = AR5K_INT_RXNOFRM
+ | AR5K_INT_RXDESC
+ | AR5K_INT_RXEOL
+ | AR5K_INT_RXORN
+ | AR5K_INT_TXURN
+ | AR5K_INT_TXDESC
+ | AR5K_INT_MIB
+ | AR5K_INT_RXPHY
+ | AR5K_INT_RXKCM
+ | AR5K_INT_SWBA
+ | AR5K_INT_BMISS
+ | AR5K_INT_GPIO,
+ AR5K_INT_NOCARD = 0xffffffff /*Declare that the card
+ has been removed*/
+} AR5K_INT;
+
+/*
+ * Power management
+ */
+typedef enum {
+ AR5K_PM_UNDEFINED = 0,
+ AR5K_PM_AUTO,
+ AR5K_PM_AWAKE,
+ AR5K_PM_FULL_SLEEP,
+ AR5K_PM_NETWORK_SLEEP,
+} AR5K_POWER_MODE;
+
+
+/*
+ * LED states
+ */
+typedef int AR5K_LED_STATE;
+
+/*
+ * These match net80211 definitions (not used in
+ * d80211).
+ */
+#define AR5K_LED_INIT 0 /*IEEE80211_S_INIT*/
+#define AR5K_LED_SCAN 1 /*IEEE80211_S_SCAN*/
+#define AR5K_LED_AUTH 2 /*IEEE80211_S_AUTH*/
+#define AR5K_LED_ASSOC 3 /*IEEE80211_S_ASSOC*/
+#define AR5K_LED_RUN 4 /*IEEE80211_S_RUN*/
+
+/* GPIO-controlled software LED */
+#define AR5K_SOFTLED_PIN 0
+#define AR5K_SOFTLED_ON 0
+#define AR5K_SOFTLED_OFF 1
+
+/*
+ * Chipset capabilities -see ath_hal_getcapability-
+ * get_capability function is not yet fully implemented
+ * in OpenHAL so most of these don't work yet...
+ */
+typedef enum {
+ AR5K_CAP_REG_DMN = 0, /* Used to get current reg. domain id */
+ AR5K_CAP_CIPHER = 1, /* Can handle encryption */
+ AR5K_CAP_TKIP_MIC = 2, /* Can handle TKIP MIC in hardware */
+ AR5K_CAP_TKIP_SPLIT = 3, /* TKIP uses split keys */
+ AR5K_CAP_PHYCOUNTERS = 4, /* PHY error counters */
+ AR5K_CAP_DIVERSITY = 5, /* Supports fast diversity */
+ AR5K_CAP_NUM_TXQUEUES = 6, /* Used to get max number of hw txqueues */
+ AR5K_CAP_VEOL = 7, /* Supports virtual EOL */
+ AR5K_CAP_COMPRESSION = 8, /* Supports compression */
+ AR5K_CAP_BURST = 9, /* Supports packet bursting */
+ AR5K_CAP_FASTFRAME = 10, /* Supports fast frames */
+ AR5K_CAP_TXPOW = 11, /* Used to get global tx power limit */
+ AR5K_CAP_TPC = 12, /* Can do per-packet tx power control (needed for 802.11a) */
+ AR5K_CAP_BSSIDMASK = 13, /* Supports bssid mask */
+ AR5K_CAP_MCAST_KEYSRCH = 14, /* Supports multicast key search */
+ AR5K_CAP_TSF_ADJUST = 15, /* Supports beacon tsf adjust */
+ AR5K_CAP_XR = 16, /* Supports XR mode */
+ AR5K_CAP_WME_TKIPMIC = 17, /* Supports TKIP MIC when using WMM */
+ AR5K_CAP_CHAN_HALFRATE = 18, /* Supports half rate channels */
+ AR5K_CAP_CHAN_QUARTERRATE = 19, /* Supports quarter rate channels */
+ AR5K_CAP_RFSILENT = 20, /* Supports RFsilent */
+} AR5K_CAPABILITY_TYPE;
+
+
+#endif /* _AR5K_H */
diff -Nurp qemu-0.9.1-untouched/hw/ath5k_hw.h qemu-0.9.1/hw/ath5k_hw.h
--- qemu-0.9.1-untouched/hw/ath5k_hw.h 1970-01-01 01:00:00.000000000 +0100
+++ qemu-0.9.1/hw/ath5k_hw.h 2008-02-28 14:02:51.000000000 +0100
@@ -0,0 +1,1939 @@
+/*
+ * Copyright (c) 2004-2007 Reyk Floeter <reyk@openbsd.org>
+ * Copyright (c) 2006-2007 Nick Kossifidis <mickflemm@gmail.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * $Id$
+ */
+
+/*
+ * Gain settings
+ */
+
+typedef enum {
+ AR5K_RFGAIN_INACTIVE = 0,
+ AR5K_RFGAIN_READ_REQUESTED,
+ AR5K_RFGAIN_NEED_CHANGE,
+} AR5K_RFGAIN;
+
+#define AR5K_GAIN_CRN_FIX_BITS_5111 4
+#define AR5K_GAIN_CRN_FIX_BITS_5112 7
+#define AR5K_GAIN_CRN_MAX_FIX_BITS AR5K_GAIN_CRN_FIX_BITS_5112
+#define AR5K_GAIN_DYN_ADJUST_HI_MARGIN 15
+#define AR5K_GAIN_DYN_ADJUST_LO_MARGIN 20
+#define AR5K_GAIN_CCK_PROBE_CORR 5
+#define AR5K_GAIN_CCK_OFDM_GAIN_DELTA 15
+#define AR5K_GAIN_STEP_COUNT 10
+#define AR5K_GAIN_PARAM_TX_CLIP 0
+#define AR5K_GAIN_PARAM_PD_90 1
+#define AR5K_GAIN_PARAM_PD_84 2
+#define AR5K_GAIN_PARAM_GAIN_SEL 3
+#define AR5K_GAIN_PARAM_MIX_ORN 0
+#define AR5K_GAIN_PARAM_PD_138 1
+#define AR5K_GAIN_PARAM_PD_137 2
+#define AR5K_GAIN_PARAM_PD_136 3
+#define AR5K_GAIN_PARAM_PD_132 4
+#define AR5K_GAIN_PARAM_PD_131 5
+#define AR5K_GAIN_PARAM_PD_130 6
+#define AR5K_GAIN_CHECK_ADJUST(_g) \
+ ((_g)->g_current <= (_g)->g_low || (_g)->g_current >= (_g)->g_high)
+
+struct ath5k_gain_opt_step {
+ int16_t gos_param[AR5K_GAIN_CRN_MAX_FIX_BITS];
+ int32_t gos_gain;
+};
+
+struct ath5k_gain_opt {
+ u_int32_t go_default;
+ u_int32_t go_steps_count;
+ const struct ath5k_gain_opt_step go_step[AR5K_GAIN_STEP_COUNT];
+};
+
+struct ath5k_gain {
+ u_int32_t g_step_idx;
+ u_int32_t g_current;
+ u_int32_t g_target;
+ u_int32_t g_low;
+ u_int32_t g_high;
+ u_int32_t g_f_corr;
+ u_int32_t g_active;
+ const struct ath5k_gain_opt_step *g_step;
+};
+
+/*
+ * Gain optimization tables...
+ */
+#define AR5K_AR5111_GAIN_OPT { \
+ 4, \
+ 9, \
+ { \
+ { { 4, 1, 1, 1 }, 6 }, \
+ { { 4, 0, 1, 1 }, 4 }, \
+ { { 3, 1, 1, 1 }, 3 }, \
+ { { 4, 0, 0, 1 }, 1 }, \
+ { { 4, 1, 1, 0 }, 0 }, \
+ { { 4, 0, 1, 0 }, -2 }, \
+ { { 3, 1, 1, 0 }, -3 }, \
+ { { 4, 0, 0, 0 }, -4 }, \
+ { { 2, 1, 1, 0 }, -6 } \
+ } \
+}
+
+#define AR5K_AR5112_GAIN_OPT { \
+ 1, \
+ 8, \
+ { \
+ { { 3, 0, 0, 0, 0, 0, 0 }, 6 }, \
+ { { 2, 0, 0, 0, 0, 0, 0 }, 0 }, \
+ { { 1, 0, 0, 0, 0, 0, 0 }, -3 }, \
+ { { 0, 0, 0, 0, 0, 0, 0 }, -6 }, \
+ { { 0, 1, 1, 0, 0, 0, 0 }, -8 }, \
+ { { 0, 1, 1, 0, 1, 1, 0 }, -10 }, \
+ { { 0, 1, 0, 1, 1, 1, 0 }, -13 }, \
+ { { 0, 1, 0, 1, 1, 0, 1 }, -16 }, \
+ } \
+}
+
+/* Some EEPROM defines */
+#define AR5K_EEPROM_EEP_SCALE 100
+#define AR5K_EEPROM_EEP_DELTA 10
+#define AR5K_EEPROM_N_MODES 3
+#define AR5K_EEPROM_N_5GHZ_CHAN 10
+#define AR5K_EEPROM_N_2GHZ_CHAN 3
+#define AR5K_EEPROM_MAX_CHAN 10
+#define AR5K_EEPROM_N_PCDAC 11
+#define AR5K_EEPROM_N_TEST_FREQ 8
+#define AR5K_EEPROM_N_EDGES 8
+#define AR5K_EEPROM_N_INTERCEPTS 11
+#define AR5K_EEPROM_FREQ_M(_v) AR5K_EEPROM_OFF(_v, 0x7f, 0xff)
+#define AR5K_EEPROM_PCDAC_M 0x3f
+#define AR5K_EEPROM_PCDAC_START 1
+#define AR5K_EEPROM_PCDAC_STOP 63
+#define AR5K_EEPROM_PCDAC_STEP 1
+#define AR5K_EEPROM_NON_EDGE_M 0x40
+#define AR5K_EEPROM_CHANNEL_POWER 8
+#define AR5K_EEPROM_N_OBDB 4
+#define AR5K_EEPROM_OBDB_DIS 0xffff
+#define AR5K_EEPROM_CHANNEL_DIS 0xff
+#define AR5K_EEPROM_SCALE_OC_DELTA(_x) (((_x) * 2) / 10)
+#define AR5K_EEPROM_N_CTLS(_v) AR5K_EEPROM_OFF(_v, 16, 32)
+#define AR5K_EEPROM_MAX_CTLS 32
+#define AR5K_EEPROM_N_XPD_PER_CHANNEL 4
+#define AR5K_EEPROM_N_XPD0_POINTS 4
+#define AR5K_EEPROM_N_XPD3_POINTS 3
+#define AR5K_EEPROM_N_INTERCEPT_10_2GHZ 35
+#define AR5K_EEPROM_N_INTERCEPT_10_5GHZ 55
+#define AR5K_EEPROM_POWER_M 0x3f
+#define AR5K_EEPROM_POWER_MIN 0
+#define AR5K_EEPROM_POWER_MAX 3150
+#define AR5K_EEPROM_POWER_STEP 50
+#define AR5K_EEPROM_POWER_TABLE_SIZE 64
+#define AR5K_EEPROM_N_POWER_LOC_11B 4
+#define AR5K_EEPROM_N_POWER_LOC_11G 6
+#define AR5K_EEPROM_I_GAIN 10
+#define AR5K_EEPROM_CCK_OFDM_DELTA 15
+#define AR5K_EEPROM_N_IQ_CAL 2
+
+struct ath5k_eeprom_info {
+ u_int16_t ee_magic;
+ u_int16_t ee_protect;
+ u_int16_t ee_regdomain;
+ u_int16_t ee_version;
+ u_int16_t ee_header;
+ u_int16_t ee_ant_gain;
+ u_int16_t ee_misc0;
+ u_int16_t ee_misc1;
+ u_int16_t ee_cck_ofdm_gain_delta;
+ u_int16_t ee_cck_ofdm_power_delta;
+ u_int16_t ee_scaled_cck_delta;
+ u_int16_t ee_tx_clip;
+ u_int16_t ee_pwd_84;
+ u_int16_t ee_pwd_90;
+ u_int16_t ee_gain_select;
+
+ u_int16_t ee_i_cal[AR5K_EEPROM_N_MODES];
+ u_int16_t ee_q_cal[AR5K_EEPROM_N_MODES];
+ u_int16_t ee_fixed_bias[AR5K_EEPROM_N_MODES];
+ u_int16_t ee_turbo_max_power[AR5K_EEPROM_N_MODES];
+ u_int16_t ee_xr_power[AR5K_EEPROM_N_MODES];
+ u_int16_t ee_switch_settling[AR5K_EEPROM_N_MODES];
+ u_int16_t ee_ant_tx_rx[AR5K_EEPROM_N_MODES];
+ u_int16_t ee_ant_control[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_PCDAC];
+ u_int16_t ee_ob[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_OBDB];
+ u_int16_t ee_db[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_OBDB];
+ u_int16_t ee_tx_end2xlna_enable[AR5K_EEPROM_N_MODES];
+ u_int16_t ee_tx_end2xpa_disable[AR5K_EEPROM_N_MODES];
+ u_int16_t ee_tx_frm2xpa_enable[AR5K_EEPROM_N_MODES];
+ u_int16_t ee_thr_62[AR5K_EEPROM_N_MODES];
+ u_int16_t ee_xlna_gain[AR5K_EEPROM_N_MODES];
+ u_int16_t ee_xpd[AR5K_EEPROM_N_MODES];
+ u_int16_t ee_x_gain[AR5K_EEPROM_N_MODES];
+ u_int16_t ee_i_gain[AR5K_EEPROM_N_MODES];
+ u_int16_t ee_margin_tx_rx[AR5K_EEPROM_N_MODES];
+ u_int16_t ee_false_detect[AR5K_EEPROM_N_MODES];
+ u_int16_t ee_cal_pier[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_2GHZ_CHAN];
+ u_int16_t ee_channel[AR5K_EEPROM_N_MODES][AR5K_EEPROM_MAX_CHAN];
+
+ u_int16_t ee_ctls;
+ u_int16_t ee_ctl[AR5K_EEPROM_MAX_CTLS];
+
+ int16_t ee_noise_floor_thr[AR5K_EEPROM_N_MODES];
+ int8_t ee_adc_desired_size[AR5K_EEPROM_N_MODES];
+ int8_t ee_pga_desired_size[AR5K_EEPROM_N_MODES];
+};
+
+/*
+ * AR5k register access
+ */
+
+/*Swap RX/TX Descriptor for big endian archs*/
+#if BYTE_ORDER == BIG_ENDIAN
+#define AR5K_INIT_CFG ( \
+ AR5K_CFG_SWTD | AR5K_CFG_SWRD \
+)
+#else
+#define AR5K_INIT_CFG 0x00000000
+#endif
+
+#define AR5K_REG_READ(_reg) ath5k_hw_reg_read(hal, _reg)
+
+#define AR5K_REG_WRITE(_reg, _val) ath5k_hw_reg_write(hal, _val, _reg)
+
+#define AR5K_REG_SM(_val, _flags) \
+ (((_val) << _flags##_S) & (_flags))
+
+#define AR5K_REG_MS(_val, _flags) \
+ (((_val) & (_flags)) >> _flags##_S)
+
+#define AR5K_REG_WRITE_BITS(_reg, _flags, _val) \
+ AR5K_REG_WRITE(_reg, (AR5K_REG_READ(_reg) &~ (_flags)) | \
+ (((_val) << _flags##_S) & (_flags)))
+
+#define AR5K_REG_MASKED_BITS(_reg, _flags, _mask) \
+ AR5K_REG_WRITE(_reg, (AR5K_REG_READ(_reg) & (_mask)) | (_flags))
+
+#define AR5K_REG_ENABLE_BITS(_reg, _flags) \
+ AR5K_REG_WRITE(_reg, AR5K_REG_READ(_reg) | (_flags))
+
+#define AR5K_REG_DISABLE_BITS(_reg, _flags) \
+ AR5K_REG_WRITE(_reg, AR5K_REG_READ(_reg) &~ (_flags))
+
+#define AR5K_PHY_WRITE(_reg, _val) \
+ AR5K_REG_WRITE(hal->ah_phy + ((_reg) << 2), _val)
+
+#define AR5K_PHY_READ(_reg) \
+ AR5K_REG_READ(hal->ah_phy + ((_reg) << 2))
+
+#define AR5K_REG_WAIT(_i) \
+ if (_i % 64) \
+ AR5K_DELAY(1);
+
+#define AR5K_EEPROM_READ(_o, _v) { \
+ if ((ret = hal->ah_eeprom_read(hal, (_o), \
+ &(_v))) != 0) \
+ return (ret); \
+}
+
+#define AR5K_EEPROM_READ_HDR(_o, _v) \
+ AR5K_EEPROM_READ(_o, hal->ah_capabilities.cap_eeprom._v); \
+
+/* Read status of selected queue */
+#define AR5K_REG_READ_Q(_reg, _queue) \
+ (AR5K_REG_READ(_reg) & (1 << _queue)) \
+
+#define AR5K_REG_WRITE_Q(_reg, _queue) \
+ AR5K_REG_WRITE(_reg, (1 << _queue))
+
+#define AR5K_Q_ENABLE_BITS(_reg, _queue) do { \
+ _reg |= 1 << _queue; \
+} while (0)
+
+#define AR5K_Q_DISABLE_BITS(_reg, _queue) do { \
+ _reg &= ~(1 << _queue); \
+} while (0)
+
+/*
+ * Unaligned little endian access
+ */
+#define AR5K_LE_READ_2 ath5k_hw_read_unaligned_16
+#define AR5K_LE_READ_4 ath5k_hw_read_unaligned_32
+#define AR5K_LE_WRITE_2 ath5k_hw_write_unaligned_16
+#define AR5K_LE_WRITE_4 ath5k_hw_write_unaligned_32
+
+#define AR5K_LOW_ID(_a)( \
+(_a)[0] | (_a)[1] << 8 | (_a)[2] << 16 | (_a)[3] << 24 \
+)
+
+#define AR5K_HIGH_ID(_a) ((_a)[4] | (_a)[5] << 8)
+
+/*
+ * Initial register values
+ */
+
+/*
+ * Common initial register values
+ */
+#define AR5K_INIT_MODE CHANNEL_B
+
+#define AR5K_INIT_TX_LATENCY 502
+#define AR5K_INIT_USEC 39
+#define AR5K_INIT_USEC_TURBO 79
+#define AR5K_INIT_USEC_32 31
+#define AR5K_INIT_CARR_SENSE_EN 1
+#define AR5K_INIT_PROG_IFS 920
+#define AR5K_INIT_PROG_IFS_TURBO 960
+#define AR5K_INIT_EIFS 3440
+#define AR5K_INIT_EIFS_TURBO 6880
+#define AR5K_INIT_SLOT_TIME 396
+#define AR5K_INIT_SLOT_TIME_TURBO 480
+#define AR5K_INIT_ACK_CTS_TIMEOUT 1024
+#define AR5K_INIT_ACK_CTS_TIMEOUT_TURBO 0x08000800
+#define AR5K_INIT_SIFS 560
+#define AR5K_INIT_SIFS_TURBO 480
+#define AR5K_INIT_SH_RETRY 10
+#define AR5K_INIT_LG_RETRY AR5K_INIT_SH_RETRY
+#define AR5K_INIT_SSH_RETRY 32
+#define AR5K_INIT_SLG_RETRY AR5K_INIT_SSH_RETRY
+#define AR5K_INIT_TX_RETRY 10
+#define AR5K_INIT_TOPS 8
+#define AR5K_INIT_RXNOFRM 8
+#define AR5K_INIT_RPGTO 0
+#define AR5K_INIT_TXNOFRM 0
+#define AR5K_INIT_BEACON_PERIOD 65535
+#define AR5K_INIT_TIM_OFFSET 0
+#define AR5K_INIT_BEACON_EN 0
+#define AR5K_INIT_RESET_TSF 0
+
+#define AR5K_INIT_TRANSMIT_LATENCY ( \
+ (AR5K_INIT_TX_LATENCY << 14) | (AR5K_INIT_USEC_32 << 7) | \
+ (AR5K_INIT_USEC) \
+)
+#define AR5K_INIT_TRANSMIT_LATENCY_TURBO ( \
+ (AR5K_INIT_TX_LATENCY << 14) | (AR5K_INIT_USEC_32 << 7) | \
+ (AR5K_INIT_USEC_TURBO) \
+)
+#define AR5K_INIT_PROTO_TIME_CNTRL ( \
+ (AR5K_INIT_CARR_SENSE_EN << 26) | (AR5K_INIT_EIFS << 12) | \
+ (AR5K_INIT_PROG_IFS) \
+)
+#define AR5K_INIT_PROTO_TIME_CNTRL_TURBO ( \
+ (AR5K_INIT_CARR_SENSE_EN << 26) | (AR5K_INIT_EIFS_TURBO << 12) |\
+ (AR5K_INIT_PROG_IFS_TURBO) \
+)
+#define AR5K_INIT_BEACON_CONTROL ( \
+ (AR5K_INIT_RESET_TSF << 24) | (AR5K_INIT_BEACON_EN << 23) | \
+ (AR5K_INIT_TIM_OFFSET << 16) | (AR5K_INIT_BEACON_PERIOD) \
+)
+
+/*
+ * Non - common initial register values
+ */
+struct ath5k_ini {
+ u_int16_t ini_register;
+ u_int32_t ini_value;
+
+ enum {
+ AR5K_INI_WRITE = 0,
+ AR5K_INI_READ = 1,
+ } ini_mode;
+};
+
+#define AR5K_INI_VAL_11A 0
+#define AR5K_INI_VAL_11A_TURBO 1
+#define AR5K_INI_VAL_11B 2
+#define AR5K_INI_VAL_11G 3
+#define AR5K_INI_VAL_11G_TURBO 4
+#define AR5K_INI_VAL_XR 0
+#define AR5K_INI_VAL_MAX 5
+
+#define AR5K_INI_PHY_5111 0
+#define AR5K_INI_PHY_5112 1
+#define AR5K_INI_PHY_511X 1
+
+#define AR5K_AR5111_INI_RF_MAX_BANKS AR5K_MAX_RF_BANKS
+#define AR5K_AR5112_INI_RF_MAX_BANKS AR5K_MAX_RF_BANKS
+
+struct ath5k_ini_rf {
+ u_int8_t rf_bank;
+ u_int16_t rf_register;
+ u_int32_t rf_value[5];
+};
+
+#define AR5K_AR5111_INI_RF { \
+ { 0, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 0, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 0, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 0, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 0, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 0, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 0, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 0, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 0, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 0, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 0, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 0, 0x989c, \
+ { 0x00380000, 0x00380000, 0x00380000, 0x00380000, 0x00380000 } }, \
+ { 0, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 0, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 0, 0x989c, \
+ { 0x00000000, 0x00000000, 0x000000c0, 0x00000080, 0x00000080 } }, \
+ { 0, 0x989c, \
+ { 0x000400f9, 0x000400f9, 0x000400ff, 0x000400fd, 0x000400fd } }, \
+ { 0, 0x98d4, \
+ { 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x00000004 } }, \
+ { 1, 0x98d4, \
+ { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } }, \
+ { 2, 0x98d4, \
+ { 0x00000010, 0x00000014, 0x00000010, 0x00000010, 0x00000014 } }, \
+ { 3, 0x98d8, \
+ { 0x00601068, 0x00601068, 0x00601068, 0x00601068, 0x00601068 } }, \
+ { 6, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 6, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 6, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 6, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 6, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 6, 0x989c, \
+ { 0x10000000, 0x10000000, 0x10000000, 0x10000000, 0x10000000 } }, \
+ { 6, 0x989c, \
+ { 0x04000000, 0x04000000, 0x04000000, 0x04000000, 0x04000000 } }, \
+ { 6, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 6, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 6, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 6, 0x989c, \
+ { 0x00000000, 0x00000000, 0x0a000000, 0x00000000, 0x00000000 } }, \
+ { 6, 0x989c, \
+ { 0x003800c0, 0x00380080, 0x023800c0, 0x003800c0, 0x003800c0 } }, \
+ { 6, 0x989c, \
+ { 0x00020006, 0x00020006, 0x00000006, 0x00020006, 0x00020006 } }, \
+ { 6, 0x989c, \
+ { 0x00000089, 0x00000089, 0x00000089, 0x00000089, 0x00000089 } }, \
+ { 6, 0x989c, \
+ { 0x000000a0, 0x000000a0, 0x000000a0, 0x000000a0, 0x000000a0 } }, \
+ { 6, 0x989c, \
+ { 0x00040007, 0x00040007, 0x00040007, 0x00040007, 0x00040007 } }, \
+ { 6, 0x98d4, \
+ { 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a } }, \
+ { 7, 0x989c, \
+ { 0x00000040, 0x00000048, 0x00000040, 0x00000040, 0x00000040 } }, \
+ { 7, 0x989c, \
+ { 0x00000010, 0x00000010, 0x00000010, 0x00000010, 0x00000010 } }, \
+ { 7, 0x989c, \
+ { 0x00000008, 0x00000008, 0x00000008, 0x00000008, 0x00000008 } }, \
+ { 7, 0x989c, \
+ { 0x0000004f, 0x0000004f, 0x0000004f, 0x0000004f, 0x0000004f } }, \
+ { 7, 0x989c, \
+ { 0x000000f1, 0x000000f1, 0x00000061, 0x000000f1, 0x000000f1 } }, \
+ { 7, 0x989c, \
+ { 0x0000904f, 0x0000904f, 0x0000904c, 0x0000904f, 0x0000904f } }, \
+ { 7, 0x989c, \
+ { 0x0000125a, 0x0000125a, 0x0000129a, 0x0000125a, 0x0000125a } }, \
+ { 7, 0x98cc, \
+ { 0x0000000e, 0x0000000e, 0x0000000f, 0x0000000e, 0x0000000e } }, \
+}
+
+#define AR5K_AR5112_INI_RF { \
+ { 1, 0x98d4, \
+ { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } }, \
+ { 2, 0x98d0, \
+ { 0x03060408, 0x03070408, 0x03060408, 0x03060408, 0x03070408 } }, \
+ { 3, 0x98dc, \
+ { 0x00a0c0c0, 0x00a0c0c0, 0x00e0c0c0, 0x00e0c0c0, 0x00e0c0c0 } }, \
+ { 6, 0x989c, \
+ { 0x00a00000, 0x00a00000, 0x00a00000, 0x00a00000, 0x00a00000 } }, \
+ { 6, 0x989c, \
+ { 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000 } }, \
+ { 6, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 6, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 6, 0x989c, \
+ { 0x00660000, 0x00660000, 0x00660000, 0x00660000, 0x00660000 } }, \
+ { 6, 0x989c, \
+ { 0x00db0000, 0x00db0000, 0x00db0000, 0x00db0000, 0x00db0000 } }, \
+ { 6, 0x989c, \
+ { 0x00f10000, 0x00f10000, 0x00f10000, 0x00f10000, 0x00f10000 } }, \
+ { 6, 0x989c, \
+ { 0x00120000, 0x00120000, 0x00120000, 0x00120000, 0x00120000 } }, \
+ { 6, 0x989c, \
+ { 0x00120000, 0x00120000, 0x00120000, 0x00120000, 0x00120000 } }, \
+ { 6, 0x989c, \
+ { 0x00730000, 0x00730000, 0x00730000, 0x00730000, 0x00730000 } }, \
+ { 6, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 6, 0x989c, \
+ { 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000 } }, \
+ { 6, 0x989c, \
+ { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, \
+ { 6, 0x989c, \
+ { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, \
+ { 6, 0x989c, \
+ { 0x008b0000, 0x008b0000, 0x008b0000, 0x008b0000, 0x008b0000 } }, \
+ { 6, 0x989c, \
+ { 0x00600000, 0x00600000, 0x00600000, 0x00600000, 0x00600000 } }, \
+ { 6, 0x989c, \
+ { 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000 } }, \
+ { 6, 0x989c, \
+ { 0x00840000, 0x00840000, 0x00840000, 0x00840000, 0x00840000 } }, \
+ { 6, 0x989c, \
+ { 0x00640000, 0x00640000, 0x00640000, 0x00640000, 0x00640000 } }, \
+ { 6, 0x989c, \
+ { 0x00200000, 0x00200000, 0x00200000, 0x00200000, 0x00200000 } }, \
+ { 6, 0x989c, \
+ { 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0x00240000 } }, \
+ { 6, 0x989c, \
+ { 0x00250000, 0x00250000, 0x00250000, 0x00250000, 0x00250000 } }, \
+ { 6, 0x989c, \
+ { 0x00110000, 0x00110000, 0x00110000, 0x00110000, 0x00110000 } }, \
+ { 6, 0x989c, \
+ { 0x00110000, 0x00110000, 0x00110000, 0x00110000, 0x00110000 } }, \
+ { 6, 0x989c, \
+ { 0x00510000, 0x00510000, 0x00510000, 0x00510000, 0x00510000 } }, \
+ { 6, 0x989c, \
+ { 0x1c040000, 0x1c040000, 0x1c040000, 0x1c040000, 0x1c040000 } }, \
+ { 6, 0x989c, \
+ { 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000 } }, \
+ { 6, 0x989c, \
+ { 0x00a10000, 0x00a10000, 0x00a10000, 0x00a10000, 0x00a10000 } }, \
+ { 6, 0x989c, \
+ { 0x00400000, 0x00400000, 0x00400000, 0x00400000, 0x00400000 } }, \
+ { 6, 0x989c, \
+ { 0x03090000, 0x03090000, 0x03090000, 0x03090000, 0x03090000 } }, \
+ { 6, 0x989c, \
+ { 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000 } }, \
+ { 6, 0x989c, \
+ { 0x000000b0, 0x000000b0, 0x000000a8, 0x000000a8, 0x000000a8 } }, \
+ { 6, 0x989c, \
+ { 0x0000002e, 0x0000002e, 0x0000002e, 0x0000002e, 0x0000002e } }, \
+ { 6, 0x989c, \
+ { 0x006c4a41, 0x006c4a41, 0x006c4af1, 0x006c4a61, 0x006c4a61 } }, \
+ { 6, 0x989c, \
+ { 0x0050892a, 0x0050892a, 0x0050892b, 0x0050892b, 0x0050892b } }, \
+ { 6, 0x989c, \
+ { 0x00842400, 0x00842400, 0x00842400, 0x00842400, 0x00842400 } }, \
+ { 6, 0x989c, \
+ { 0x00c69200, 0x00c69200, 0x00c69200, 0x00c69200, 0x00c69200 } }, \
+ { 6, 0x98d0, \
+ { 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c } }, \
+ { 7, 0x989c, \
+ { 0x00000094, 0x00000094, 0x00000094, 0x00000094, 0x00000094 } }, \
+ { 7, 0x989c, \
+ { 0x00000091, 0x00000091, 0x00000091, 0x00000091, 0x00000091 } }, \
+ { 7, 0x989c, \
+ { 0x0000000a, 0x0000000a, 0x00000012, 0x00000012, 0x00000012 } }, \
+ { 7, 0x989c, \
+ { 0x00000080, 0x00000080, 0x00000080, 0x00000080, 0x00000080 } }, \
+ { 7, 0x989c, \
+ { 0x000000c1, 0x000000c1, 0x000000c1, 0x000000c1, 0x000000c1 } }, \
+ { 7, 0x989c, \
+ { 0x00000060, 0x00000060, 0x00000060, 0x00000060, 0x00000060 } }, \
+ { 7, 0x989c, \
+ { 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0 } }, \
+ { 7, 0x989c, \
+ { 0x00000022, 0x00000022, 0x00000022, 0x00000022, 0x00000022 } }, \
+ { 7, 0x989c, \
+ { 0x00000092, 0x00000092, 0x00000092, 0x00000092, 0x00000092 } }, \
+ { 7, 0x989c, \
+ { 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4 } }, \
+ { 7, 0x989c, \
+ { 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc } }, \
+ { 7, 0x989c, \
+ { 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c } }, \
+ { 7, 0x98c4, \
+ { 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0x00000003 } }, \
+ }
+
+#define AR5K_AR5112A_INI_RF { \
+ { 1, 0x98d4, \
+ { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } }, \
+ { 2, 0x98d0, \
+ { 0x03060408, 0x03070408, 0x03060408, 0x03060408, 0x03070408 } }, \
+ { 3, 0x98dc, \
+ { 0x00a0c0c0, 0x00a0c0c0, 0x00e0c0c0, 0x00e0c0c0, 0x00e0c0c0 } }, \
+ { 6, 0x989c, \
+ { 0x0f000000, 0x0f000000, 0x0f000000, 0x0f000000, 0x0f000000 } }, \
+ { 6, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 6, 0x989c, \
+ { 0x00800000, 0x00800000, 0x00800000, 0x00800000, 0x00800000 } }, \
+ { 6, 0x989c, \
+ { 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000 } }, \
+ { 6, 0x989c, \
+ { 0x00010000, 0x00010000, 0x00010000, 0x00010000, 0x00010000 } }, \
+ { 6, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 6, 0x989c, \
+ { 0x00180000, 0x00180000, 0x00180000, 0x00180000, 0x00180000 } }, \
+ { 6, 0x989c, \
+ { 0x00600000, 0x00600000, 0x006e0000, 0x006e0000, 0x006e0000 } }, \
+ { 6, 0x989c, \
+ { 0x00c70000, 0x00c70000, 0x00c70000, 0x00c70000, 0x00c70000 } }, \
+ { 6, 0x989c, \
+ { 0x004b0000, 0x004b0000, 0x004b0000, 0x004b0000, 0x004b0000 } }, \
+ { 6, 0x989c, \
+ { 0x04480000, 0x04480000, 0x04480000, 0x04480000, 0x04480000 } }, \
+ { 6, 0x989c, \
+ { 0x00220000, 0x00220000, 0x00220000, 0x00220000, 0x00220000 } }, \
+ { 6, 0x989c, \
+ { 0x00e40000, 0x00e40000, 0x00e40000, 0x00e40000, 0x00e40000 } }, \
+ { 6, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 6, 0x989c, \
+ { 0x00fc0000, 0x00fc0000, 0x00fc0000, 0x00fc0000, 0x00fc0000 } }, \
+ { 6, 0x989c, \
+ { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, \
+ { 6, 0x989c, \
+ { 0x043f0000, 0x043f0000, 0x043f0000, 0x043f0000, 0x043f0000 } }, \
+ { 6, 0x989c, \
+ { 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000 } }, \
+ { 6, 0x989c, \
+ { 0x00190000, 0x00190000, 0x00190000, 0x00190000, 0x00190000 } }, \
+ { 6, 0x989c, \
+ { 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0x00240000 } }, \
+ { 6, 0x989c, \
+ { 0x00b40000, 0x00b40000, 0x00b40000, 0x00b40000, 0x00b40000 } }, \
+ { 6, 0x989c, \
+ { 0x00990000, 0x00990000, 0x00990000, 0x00990000, 0x00990000 } }, \
+ { 6, 0x989c, \
+ { 0x00500000, 0x00500000, 0x00500000, 0x00500000, 0x00500000 } }, \
+ { 6, 0x989c, \
+ { 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000 } }, \
+ { 6, 0x989c, \
+ { 0x00120000, 0x00120000, 0x00120000, 0x00120000, 0x00120000 } }, \
+ { 6, 0x989c, \
+ { 0xc0320000, 0xc0320000, 0xc0320000, 0xc0320000, 0xc0320000 } }, \
+ { 6, 0x989c, \
+ { 0x01740000, 0x01740000, 0x01740000, 0x01740000, 0x01740000 } }, \
+ { 6, 0x989c, \
+ { 0x00110000, 0x00110000, 0x00110000, 0x00110000, 0x00110000 } }, \
+ { 6, 0x989c, \
+ { 0x86280000, 0x86280000, 0x86280000, 0x86280000, 0x86280000 } }, \
+ { 6, 0x989c, \
+ { 0x31840000, 0x31840000, 0x31840000, 0x31840000, 0x31840000 } }, \
+ { 6, 0x989c, \
+ { 0x00020080, 0x00020080, 0x00020080, 0x00020080, 0x00020080 } }, \
+ { 6, 0x989c, \
+ { 0x00080009, 0x00080009, 0x00080009, 0x00080009, 0x00080009 } }, \
+ { 6, 0x989c, \
+ { 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0x00000003 } }, \
+ { 6, 0x989c, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, \
+ { 6, 0x989c, \
+ { 0x000000b2, 0x000000b2, 0x000000b2, 0x000000b2, 0x000000b2 } }, \
+ { 6, 0x989c, \
+ { 0x00b02084, 0x00b02084, 0x00b02084, 0x00b02084, 0x00b02084 } }, \
+ { 6, 0x989c, \
+ { 0x004125a4, 0x004125a4, 0x004125a4, 0x004125a4, 0x004125a4 } }, \
+ { 6, 0x989c, \
+ { 0x00119220, 0x00119220, 0x00119220, 0x00119220, 0x00119220 } }, \
+ { 6, 0x989c, \
+ { 0x001a4800, 0x001a4800, 0x001a4800, 0x001a4800, 0x001a4800 } }, \
+ { 6, 0x98d8, \
+ { 0x000b0230, 0x000b0230, 0x000b0230, 0x000b0230, 0x000b0230 } }, \
+ { 7, 0x989c, \
+ { 0x00000094, 0x00000094, 0x00000094, 0x00000094, 0x00000094 } }, \
+ { 7, 0x989c, \
+ { 0x00000091, 0x00000091, 0x00000091, 0x00000091, 0x00000091 } }, \
+ { 7, 0x989c, \
+ { 0x00000012, 0x00000012, 0x00000012, 0x00000012, 0x00000012 } }, \
+ { 7, 0x989c, \
+ { 0x00000080, 0x00000080, 0x00000080, 0x00000080, 0x00000080 } }, \
+ { 7, 0x989c, \
+ { 0x000000d9, 0x000000d9, 0x000000d9, 0x000000d9, 0x000000d9 } }, \
+ { 7, 0x989c, \
+ { 0x00000060, 0x00000060, 0x00000060, 0x00000060, 0x00000060 } }, \
+ { 7, 0x989c, \
+ { 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0 } }, \
+ { 7, 0x989c, \
+ { 0x000000a2, 0x000000a2, 0x000000a2, 0x000000a2, 0x000000a2 } }, \
+ { 7, 0x989c, \
+ { 0x00000052, 0x00000052, 0x00000052, 0x00000052, 0x00000052 } }, \
+ { 7, 0x989c, \
+ { 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4 } }, \
+ { 7, 0x989c, \
+ { 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc } }, \
+ { 7, 0x989c, \
+ { 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c } }, \
+ { 7, 0x98c4, \
+ { 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0x00000003 } }, \
+}
+
+struct ath5k_ini_rfgain {
+ u_int16_t rfg_register;
+ u_int32_t rfg_value[2][2];
+
+#define AR5K_INI_RFGAIN_5GHZ 0
+#define AR5K_INI_RFGAIN_2GHZ 1
+};
+
+#define AR5K_INI_RFGAIN { \
+ { 0x9a00, { \
+ { 0x000001a9, 0x00000000 }, { 0x00000007, 0x00000007 } } }, \
+ { 0x9a04, { \
+ { 0x000001e9, 0x00000040 }, { 0x00000047, 0x00000047 } } }, \
+ { 0x9a08, { \
+ { 0x00000029, 0x00000080 }, { 0x00000087, 0x00000087 } } }, \
+ { 0x9a0c, { \
+ { 0x00000069, 0x00000150 }, { 0x000001a0, 0x000001a0 } } }, \
+ { 0x9a10, { \
+ { 0x00000199, 0x00000190 }, { 0x000001e0, 0x000001e0 } } }, \
+ { 0x9a14, { \
+ { 0x000001d9, 0x000001d0 }, { 0x00000020, 0x00000020 } } }, \
+ { 0x9a18, { \
+ { 0x00000019, 0x00000010 }, { 0x00000060, 0x00000060 } } }, \
+ { 0x9a1c, { \
+ { 0x00000059, 0x00000044 }, { 0x000001a1, 0x000001a1 } } }, \
+ { 0x9a20, { \
+ { 0x00000099, 0x00000084 }, { 0x000001e1, 0x000001e1 } } }, \
+ { 0x9a24, { \
+ { 0x000001a5, 0x00000148 }, { 0x00000021, 0x00000021 } } }, \
+ { 0x9a28, { \
+ { 0x000001e5, 0x00000188 }, { 0x00000061, 0x00000061 } } }, \
+ { 0x9a2c, { \
+ { 0x00000025, 0x000001c8 }, { 0x00000162, 0x00000162 } } }, \
+ { 0x9a30, { \
+ { 0x000001c8, 0x00000014 }, { 0x000001a2, 0x000001a2 } } }, \
+ { 0x9a34, { \
+ { 0x00000008, 0x00000042 }, { 0x000001e2, 0x000001e2 } } }, \
+ { 0x9a38, { \
+ { 0x00000048, 0x00000082 }, { 0x00000022, 0x00000022 } } }, \
+ { 0x9a3c, { \
+ { 0x00000088, 0x00000178 }, { 0x00000062, 0x00000062 } } }, \
+ { 0x9a40, { \
+ { 0x00000198, 0x000001b8 }, { 0x00000163, 0x00000163 } } }, \
+ { 0x9a44, { \
+ { 0x000001d8, 0x000001f8 }, { 0x000001a3, 0x000001a3 } } }, \
+ { 0x9a48, { \
+ { 0x00000018, 0x00000012 }, { 0x000001e3, 0x000001e3 } } }, \
+ { 0x9a4c, { \
+ { 0x00000058, 0x00000052 }, { 0x00000023, 0x00000023 } } }, \
+ { 0x9a50, { \
+ { 0x00000098, 0x00000092 }, { 0x00000063, 0x00000063 } } }, \
+ { 0x9a54, { \
+ { 0x000001a4, 0x0000017c }, { 0x00000184, 0x00000184 } } }, \
+ { 0x9a58, { \
+ { 0x000001e4, 0x000001bc }, { 0x000001c4, 0x000001c4 } } }, \
+ { 0x9a5c, { \
+ { 0x00000024, 0x000001fc }, { 0x00000004, 0x00000004 } } }, \
+ { 0x9a60, { \
+ { 0x00000064, 0x0000000a }, { 0x000001ea, 0x0000000b } } }, \
+ { 0x9a64, { \
+ { 0x000000a4, 0x0000004a }, { 0x0000002a, 0x0000004b } } }, \
+ { 0x9a68, { \
+ { 0x000000e4, 0x0000008a }, { 0x0000006a, 0x0000008b } } }, \
+ { 0x9a6c, { \
+ { 0x0000010a, 0x0000015a }, { 0x000000aa, 0x000001ac } } }, \
+ { 0x9a70, { \
+ { 0x0000014a, 0x0000019a }, { 0x000001ab, 0x000001ec } } }, \
+ { 0x9a74, { \
+ { 0x0000018a, 0x000001da }, { 0x000001eb, 0x0000002c } } }, \
+ { 0x9a78, { \
+ { 0x000001ca, 0x0000000e }, { 0x0000002b, 0x00000012 } } }, \
+ { 0x9a7c, { \
+ { 0x0000000a, 0x0000004e }, { 0x0000006b, 0x00000052 } } }, \
+ { 0x9a80, { \
+ { 0x0000004a, 0x0000008e }, { 0x000000ab, 0x00000092 } } }, \
+ { 0x9a84, { \
+ { 0x0000008a, 0x0000015e }, { 0x000001ac, 0x00000193 } } }, \
+ { 0x9a88, { \
+ { 0x000001ba, 0x0000019e }, { 0x000001ec, 0x000001d3 } } }, \
+ { 0x9a8c, { \
+ { 0x000001fa, 0x000001de }, { 0x0000002c, 0x00000013 } } }, \
+ { 0x9a90, { \
+ { 0x0000003a, 0x00000009 }, { 0x0000003a, 0x00000053 } } }, \
+ { 0x9a94, { \
+ { 0x0000007a, 0x00000049 }, { 0x0000007a, 0x00000093 } } }, \
+ { 0x9a98, { \
+ { 0x00000186, 0x00000089 }, { 0x000000ba, 0x00000194 } } }, \
+ { 0x9a9c, { \
+ { 0x000001c6, 0x00000179 }, { 0x000001bb, 0x000001d4 } } }, \
+ { 0x9aa0, { \
+ { 0x00000006, 0x000001b9 }, { 0x000001fb, 0x00000014 } } }, \
+ { 0x9aa4, { \
+ { 0x00000046, 0x000001f9 }, { 0x0000003b, 0x0000003a } } }, \
+ { 0x9aa8, { \
+ { 0x00000086, 0x00000039 }, { 0x0000007b, 0x0000007a } } }, \
+ { 0x9aac, { \
+ { 0x000000c6, 0x00000079 }, { 0x000000bb, 0x000000ba } } }, \
+ { 0x9ab0, { \
+ { 0x000000c6, 0x000000b9 }, { 0x000001bc, 0x000001bb } } }, \
+ { 0x9ab4, { \
+ { 0x000000c6, 0x000001bd }, { 0x000001fc, 0x000001fb } } }, \
+ { 0x9ab8, { \
+ { 0x000000c6, 0x000001fd }, { 0x0000003c, 0x0000003b } } }, \
+ { 0x9abc, { \
+ { 0x000000c6, 0x0000003d }, { 0x0000007c, 0x0000007b } } }, \
+ { 0x9ac0, { \
+ { 0x000000c6, 0x0000007d }, { 0x000000bc, 0x000000bb } } }, \
+ { 0x9ac4, { \
+ { 0x000000c6, 0x000000bd }, { 0x000000fc, 0x000001bc } } }, \
+ { 0x9ac8, { \
+ { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000001fc } } }, \
+ { 0x9acc, { \
+ { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x0000003c } } }, \
+ { 0x9ad0, { \
+ { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x0000007c } } }, \
+ { 0x9ad4, { \
+ { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000000bc } } }, \
+ { 0x9ad8, { \
+ { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000000fc } } }, \
+ { 0x9adc, { \
+ { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000000fc } } }, \
+ { 0x9ae0, { \
+ { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000000fc } } }, \
+ { 0x9ae4, { \
+ { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000000fc } } }, \
+ { 0x9ae8, { \
+ { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000000fc } } }, \
+ { 0x9aec, { \
+ { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000000fc } } }, \
+ { 0x9af0, { \
+ { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000000fc } } }, \
+ { 0x9af4, { \
+ { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000000fc } } }, \
+ { 0x9af8, { \
+ { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000000fc } } }, \
+ { 0x9afc, { \
+ { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000000fc } } }, \
+}
+
+#define AR5K_DESC_RX_PHY_ERROR_NONE 0x00
+#define AR5K_DESC_RX_PHY_ERROR_TIMING 0x20
+#define AR5K_DESC_RX_PHY_ERROR_PARITY 0x40
+#define AR5K_DESC_RX_PHY_ERROR_RATE 0x60
+#define AR5K_DESC_RX_PHY_ERROR_LENGTH 0x80
+#define AR5K_DESC_RX_PHY_ERROR_64QAM 0xa0
+#define AR5K_DESC_RX_PHY_ERROR_SERVICE 0xc0
+#define AR5K_DESC_RX_PHY_ERROR_TRANSMITOVR 0xe0
+
+/*
+ * Initial register values which have to be loaded into the
+ * card at boot time and after each reset.
+ */
+
+#define AR5K_AR5211_INI { \
+ { 0x000c, 0x00000000 }, \
+ { 0x0028, 0x84849c9c }, \
+ { 0x002c, 0x7c7c7c7c }, \
+ { 0x0034, 0x00000005 }, \
+ { 0x0040, 0x00000000 }, \
+ { 0x0044, 0x00000008 }, \
+ { 0x0048, 0x00000008 }, \
+ { 0x004c, 0x00000010 }, \
+ { 0x0050, 0x00000000 }, \
+ { 0x0054, 0x0000001f }, \
+ { 0x0800, 0x00000000 }, \
+ { 0x0804, 0x00000000 }, \
+ { 0x0808, 0x00000000 }, \
+ { 0x080c, 0x00000000 }, \
+ { 0x0810, 0x00000000 }, \
+ { 0x0814, 0x00000000 }, \
+ { 0x0818, 0x00000000 }, \
+ { 0x081c, 0x00000000 }, \
+ { 0x0820, 0x00000000 }, \
+ { 0x0824, 0x00000000 }, \
+ { 0x1230, 0x00000000 }, \
+ { 0x8004, 0x00000000 }, \
+ { 0x8008, 0x00000000 }, \
+ { 0x800c, 0x00000000 }, \
+ { 0x8018, 0x00000000 }, \
+ { 0x8024, 0x00000000 }, \
+ { 0x8028, 0x00000030 }, \
+ { 0x802c, 0x0007ffff }, \
+ { 0x8030, 0x01ffffff }, \
+ { 0x8034, 0x00000031 }, \
+ { 0x8038, 0x00000000 }, \
+ { 0x803c, 0x00000000 }, \
+ { 0x8040, 0x00000000 }, \
+ { 0x8044, 0x00000002 }, \
+ { 0x8048, 0x00000000 }, \
+ { 0x8054, 0x00000000 }, \
+ { 0x8058, 0x00000000 }, \
+ /* PHY registers */ \
+ { 0x9808, 0x00000000 }, \
+ { 0x980c, 0x2d849093 }, \
+ { 0x9810, 0x7d32e000 }, \
+ { 0x9814, 0x00000f6b }, \
+ { 0x981c, 0x00000000 }, \
+ { 0x982c, 0x00026ffe }, \
+ { 0x9830, 0x00000000 }, \
+ { 0x983c, 0x00020100 }, \
+ { 0x9840, 0x206a017a }, \
+ { 0x984c, 0x1284613c }, \
+ { 0x9854, 0x00000859 }, \
+ { 0x9868, 0x409a4190 }, \
+ { 0x986c, 0x050cb081 }, \
+ { 0x9870, 0x0000000f }, \
+ { 0x9874, 0x00000080 }, \
+ { 0x9878, 0x0000000c }, \
+ { 0x9900, 0x00000000 }, \
+ { 0x9904, 0x00000000 }, \
+ { 0x9908, 0x00000000 }, \
+ { 0x990c, 0x00800000 }, \
+ { 0x9910, 0x00000001 }, \
+ { 0x991c, 0x0000092a }, \
+ { 0x9920, 0x00000000 }, \
+ { 0x9924, 0x00058a05 }, \
+ { 0x9928, 0x00000001 }, \
+ { 0x992c, 0x00000000 }, \
+ { 0x9930, 0x00000000 }, \
+ { 0x9934, 0x00000000 }, \
+ { 0x9938, 0x00000000 }, \
+ { 0x993c, 0x0000003f }, \
+ { 0x9940, 0x00000004 }, \
+ { 0x9948, 0x00000000 }, \
+ { 0x994c, 0x00000000 }, \
+ { 0x9950, 0x00000000 }, \
+ { 0x9954, 0x5d50f14c }, \
+ { 0x9958, 0x00000018 }, \
+ { 0x995c, 0x004b6a8e }, \
+ { 0xa184, 0x06ff05ff }, \
+ { 0xa188, 0x07ff07ff }, \
+ { 0xa18c, 0x08ff08ff }, \
+ { 0xa190, 0x09ff09ff }, \
+ { 0xa194, 0x0aff0aff }, \
+ { 0xa198, 0x0bff0bff }, \
+ { 0xa19c, 0x0cff0cff }, \
+ { 0xa1a0, 0x0dff0dff }, \
+ { 0xa1a4, 0x0fff0eff }, \
+ { 0xa1a8, 0x12ff12ff }, \
+ { 0xa1ac, 0x14ff13ff }, \
+ { 0xa1b0, 0x16ff15ff }, \
+ { 0xa1b4, 0x19ff17ff }, \
+ { 0xa1b8, 0x1bff1aff }, \
+ { 0xa1bc, 0x1eff1dff }, \
+ { 0xa1c0, 0x23ff20ff }, \
+ { 0xa1c4, 0x27ff25ff }, \
+ { 0xa1c8, 0x2cff29ff }, \
+ { 0xa1cc, 0x31ff2fff }, \
+ { 0xa1d0, 0x37ff34ff }, \
+ { 0xa1d4, 0x3aff3aff }, \
+ { 0xa1d8, 0x3aff3aff }, \
+ { 0xa1dc, 0x3aff3aff }, \
+ { 0xa1e0, 0x3aff3aff }, \
+ { 0xa1e4, 0x3aff3aff }, \
+ { 0xa1e8, 0x3aff3aff }, \
+ { 0xa1ec, 0x3aff3aff }, \
+ { 0xa1f0, 0x3aff3aff }, \
+ { 0xa1f4, 0x3aff3aff }, \
+ { 0xa1f8, 0x3aff3aff }, \
+ { 0xa1fc, 0x3aff3aff }, \
+ /* BB gain table (64bytes) */ \
+ { 0x9b00, 0x00000000 }, \
+ { 0x9b04, 0x00000020 }, \
+ { 0x9b08, 0x00000010 }, \
+ { 0x9b0c, 0x00000030 }, \
+ { 0x9b10, 0x00000008 }, \
+ { 0x9b14, 0x00000028 }, \
+ { 0x9b18, 0x00000004 }, \
+ { 0x9b1c, 0x00000024 }, \
+ { 0x9b20, 0x00000014 }, \
+ { 0x9b24, 0x00000034 }, \
+ { 0x9b28, 0x0000000c }, \
+ { 0x9b2c, 0x0000002c }, \
+ { 0x9b30, 0x00000002 }, \
+ { 0x9b34, 0x00000022 }, \
+ { 0x9b38, 0x00000012 }, \
+ { 0x9b3c, 0x00000032 }, \
+ { 0x9b40, 0x0000000a }, \
+ { 0x9b44, 0x0000002a }, \
+ { 0x9b48, 0x00000006 }, \
+ { 0x9b4c, 0x00000026 }, \
+ { 0x9b50, 0x00000016 }, \
+ { 0x9b54, 0x00000036 }, \
+ { 0x9b58, 0x0000000e }, \
+ { 0x9b5c, 0x0000002e }, \
+ { 0x9b60, 0x00000001 }, \
+ { 0x9b64, 0x00000021 }, \
+ { 0x9b68, 0x00000011 }, \
+ { 0x9b6c, 0x00000031 }, \
+ { 0x9b70, 0x00000009 }, \
+ { 0x9b74, 0x00000029 }, \
+ { 0x9b78, 0x00000005 }, \
+ { 0x9b7c, 0x00000025 }, \
+ { 0x9b80, 0x00000015 }, \
+ { 0x9b84, 0x00000035 }, \
+ { 0x9b88, 0x0000000d }, \
+ { 0x9b8c, 0x0000002d }, \
+ { 0x9b90, 0x00000003 }, \
+ { 0x9b94, 0x00000023 }, \
+ { 0x9b98, 0x00000013 }, \
+ { 0x9b9c, 0x00000033 }, \
+ { 0x9ba0, 0x0000000b }, \
+ { 0x9ba4, 0x0000002b }, \
+ { 0x9ba8, 0x0000002b }, \
+ { 0x9bac, 0x0000002b }, \
+ { 0x9bb0, 0x0000002b }, \
+ { 0x9bb4, 0x0000002b }, \
+ { 0x9bb8, 0x0000002b }, \
+ { 0x9bbc, 0x0000002b }, \
+ { 0x9bc0, 0x0000002b }, \
+ { 0x9bc4, 0x0000002b }, \
+ { 0x9bc8, 0x0000002b }, \
+ { 0x9bcc, 0x0000002b }, \
+ { 0x9bd0, 0x0000002b }, \
+ { 0x9bd4, 0x0000002b }, \
+ { 0x9bd8, 0x0000002b }, \
+ { 0x9bdc, 0x0000002b }, \
+ { 0x9be0, 0x0000002b }, \
+ { 0x9be4, 0x0000002b }, \
+ { 0x9be8, 0x0000002b }, \
+ { 0x9bec, 0x0000002b }, \
+ { 0x9bf0, 0x0000002b }, \
+ { 0x9bf4, 0x0000002b }, \
+ { 0x9bf8, 0x00000002 }, \
+ { 0x9bfc, 0x00000016 }, \
+ /* PHY activation */ \
+ { 0x98d4, 0x00000020 }, \
+ { 0x98d8, 0x00601068 }, \
+}
+
+struct ath5k_ar5212_ini {
+ u_int8_t ini_flags;
+ u_int16_t ini_register;
+ u_int32_t ini_value;
+
+#define AR5K_INI_FLAG_511X 0x00
+#define AR5K_INI_FLAG_5111 0x01
+#define AR5K_INI_FLAG_5112 0x02
+#define AR5K_INI_FLAG_BOTH (AR5K_INI_FLAG_5111 | AR5K_INI_FLAG_5112)
+};
+
+#define AR5K_AR5212_INI { \
+ { AR5K_INI_FLAG_BOTH, 0x000c, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x0034, 0x00000005 }, \
+ { AR5K_INI_FLAG_BOTH, 0x0040, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x0044, 0x00000008 }, \
+ { AR5K_INI_FLAG_BOTH, 0x0048, 0x00000008 }, \
+ { AR5K_INI_FLAG_BOTH, 0x004c, 0x00000010 }, \
+ { AR5K_INI_FLAG_BOTH, 0x0050, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x0054, 0x0000001f }, \
+ { AR5K_INI_FLAG_BOTH, 0x0800, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x0804, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x0808, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x080c, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x0810, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x0814, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x0818, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x081c, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x0820, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x0824, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x1230, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x1270, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x1038, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x1078, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x10b8, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x10f8, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x1138, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x1178, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x11b8, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x11f8, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x1238, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x1278, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x12b8, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x12f8, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x1338, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x1378, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x13b8, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x13f8, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x1438, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x1478, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x14b8, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x14f8, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x1538, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x1578, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x15b8, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x15f8, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x1638, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x1678, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x16b8, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x16f8, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x1738, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x1778, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x17b8, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x17f8, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x103c, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x107c, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x10bc, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x10fc, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x113c, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x117c, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x11bc, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x11fc, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x123c, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x127c, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x12bc, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x12fc, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x133c, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x137c, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x13bc, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x13fc, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x143c, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x147c, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8004, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8008, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x800c, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8018, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8020, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8024, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8028, 0x00000030 }, \
+ { AR5K_INI_FLAG_BOTH, 0x802c, 0x0007ffff }, \
+ { AR5K_INI_FLAG_BOTH, 0x8030, 0x01ffffff }, \
+ { AR5K_INI_FLAG_BOTH, 0x8034, 0x00000031 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8038, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x803c, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8048, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8054, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8058, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x805c, 0xffffc7ff }, \
+ { AR5K_INI_FLAG_BOTH, 0x8080, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8084, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8088, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x808c, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8090, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8094, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8098, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x80c0, 0x2a82301a }, \
+ { AR5K_INI_FLAG_BOTH, 0x80c4, 0x05dc01e0 }, \
+ { AR5K_INI_FLAG_BOTH, 0x80c8, 0x1f402710 }, \
+ { AR5K_INI_FLAG_BOTH, 0x80cc, 0x01f40000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x80d0, 0x00001e1c }, \
+ { AR5K_INI_FLAG_BOTH, 0x80d4, 0x0002aaaa }, \
+ { AR5K_INI_FLAG_BOTH, 0x80d8, 0x02005555 }, \
+ { AR5K_INI_FLAG_BOTH, 0x80dc, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x80e0, 0xffffffff }, \
+ { AR5K_INI_FLAG_BOTH, 0x80e4, 0x0000ffff }, \
+ { AR5K_INI_FLAG_BOTH, 0x80e8, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x80ec, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x80f0, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x80f4, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x80f8, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x80fc, 0x00000088 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8700, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8704, 0x0000008c }, \
+ { AR5K_INI_FLAG_BOTH, 0x8708, 0x000000e4 }, \
+ { AR5K_INI_FLAG_BOTH, 0x870c, 0x000002d5 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8710, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8714, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8718, 0x000000a0 }, \
+ { AR5K_INI_FLAG_BOTH, 0x871c, 0x000001c9 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8720, 0x0000002c }, \
+ { AR5K_INI_FLAG_BOTH, 0x8724, 0x0000002c }, \
+ { AR5K_INI_FLAG_BOTH, 0x8728, 0x00000030 }, \
+ { AR5K_INI_FLAG_BOTH, 0x872c, 0x0000003c }, \
+ { AR5K_INI_FLAG_BOTH, 0x8730, 0x0000002c }, \
+ { AR5K_INI_FLAG_BOTH, 0x8734, 0x0000002c }, \
+ { AR5K_INI_FLAG_BOTH, 0x8738, 0x00000030 }, \
+ { AR5K_INI_FLAG_BOTH, 0x873c, 0x0000003c }, \
+ { AR5K_INI_FLAG_BOTH, 0x8740, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8744, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8748, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x874c, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8750, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8754, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8758, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x875c, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8760, 0x000000d5 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8764, 0x000000df }, \
+ { AR5K_INI_FLAG_BOTH, 0x8768, 0x00000102 }, \
+ { AR5K_INI_FLAG_BOTH, 0x876c, 0x0000013a }, \
+ { AR5K_INI_FLAG_BOTH, 0x8770, 0x00000075 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8774, 0x0000007f }, \
+ { AR5K_INI_FLAG_BOTH, 0x8778, 0x000000a2 }, \
+ { AR5K_INI_FLAG_BOTH, 0x877c, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8100, 0x00010002 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8104, 0x00000001 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8108, 0x000000c0 }, \
+ { AR5K_INI_FLAG_BOTH, 0x810c, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8110, 0x00000168 }, \
+ { AR5K_INI_FLAG_BOTH, 0x8114, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x87c0, 0x03020100 }, \
+ { AR5K_INI_FLAG_BOTH, 0x87c4, 0x07060504 }, \
+ { AR5K_INI_FLAG_BOTH, 0x87c8, 0x0b0a0908 }, \
+ { AR5K_INI_FLAG_BOTH, 0x87cc, 0x0f0e0d0c }, \
+ { AR5K_INI_FLAG_BOTH, 0x87d0, 0x13121110 }, \
+ { AR5K_INI_FLAG_BOTH, 0x87d4, 0x17161514 }, \
+ { AR5K_INI_FLAG_BOTH, 0x87d8, 0x1b1a1918 }, \
+ { AR5K_INI_FLAG_BOTH, 0x87dc, 0x1f1e1d1c }, \
+ { AR5K_INI_FLAG_BOTH, 0x87e0, 0x03020100 }, \
+ { AR5K_INI_FLAG_BOTH, 0x87e4, 0x07060504 }, \
+ { AR5K_INI_FLAG_BOTH, 0x87e8, 0x0b0a0908 }, \
+ { AR5K_INI_FLAG_BOTH, 0x87ec, 0x0f0e0d0c }, \
+ { AR5K_INI_FLAG_BOTH, 0x87f0, 0x13121110 }, \
+ { AR5K_INI_FLAG_BOTH, 0x87f4, 0x17161514 }, \
+ { AR5K_INI_FLAG_BOTH, 0x87f8, 0x1b1a1918 }, \
+ { AR5K_INI_FLAG_BOTH, 0x87fc, 0x1f1e1d1c }, \
+ /* PHY registers */ \
+ { AR5K_INI_FLAG_BOTH, 0x9808, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x980c, 0xad848e19 }, \
+ { AR5K_INI_FLAG_BOTH, 0x9810, 0x7d28e000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x9814, 0x9c0a9f6b }, \
+ { AR5K_INI_FLAG_BOTH, 0x981c, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x982c, 0x00022ffe }, \
+ { AR5K_INI_FLAG_BOTH, 0x983c, 0x00020100 }, \
+ { AR5K_INI_FLAG_BOTH, 0x9840, 0x206a017a }, \
+ { AR5K_INI_FLAG_BOTH, 0x984c, 0x1284613c }, \
+ { AR5K_INI_FLAG_BOTH, 0x9854, 0x00000859 }, \
+ { AR5K_INI_FLAG_BOTH, 0x9900, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x9904, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x9908, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x990c, 0x00800000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x9910, 0x00000001 }, \
+ { AR5K_INI_FLAG_BOTH, 0x991c, 0x0000092a }, \
+ { AR5K_INI_FLAG_BOTH, 0x9920, 0x05100000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x9928, 0x00000001 }, \
+ { AR5K_INI_FLAG_BOTH, 0x992c, 0x00000004 }, \
+ { AR5K_INI_FLAG_BOTH, 0x9934, 0x1e1f2022 }, \
+ { AR5K_INI_FLAG_BOTH, 0x9938, 0x0a0b0c0d }, \
+ { AR5K_INI_FLAG_BOTH, 0x993c, 0x0000003f }, \
+ { AR5K_INI_FLAG_BOTH, 0x9940, 0x00000004 }, \
+ { AR5K_INI_FLAG_BOTH, 0x9948, 0x9280b212 }, \
+ { AR5K_INI_FLAG_BOTH, 0x9954, 0x5d50e188 }, \
+ { AR5K_INI_FLAG_BOTH, 0x9958, 0x000000ff }, \
+ { AR5K_INI_FLAG_BOTH, 0x995c, 0x004b6a8e }, \
+ { AR5K_INI_FLAG_BOTH, 0x9968, 0x000003ce }, \
+ { AR5K_INI_FLAG_BOTH, 0x9970, 0x192fb515 }, \
+ { AR5K_INI_FLAG_BOTH, 0x9974, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x9978, 0x00000001 }, \
+ { AR5K_INI_FLAG_BOTH, 0x997c, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0xa184, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa188, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa18c, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa190, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa194, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa198, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa19c, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1a0, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1a4, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1a8, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1ac, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1b0, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1b4, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1b8, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1bc, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1c0, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1c4, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1c8, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1cc, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1d0, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1d4, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1d8, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1dc, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1e0, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1e4, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1e8, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1ec, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1f0, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1f4, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1f8, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa1fc, 0x10ff10ff }, \
+ { AR5K_INI_FLAG_BOTH, 0xa210, 0x0080a333 }, \
+ { AR5K_INI_FLAG_BOTH, 0xa214, 0x00206c10 }, \
+ { AR5K_INI_FLAG_BOTH, 0xa218, 0x009c4060 }, \
+ { AR5K_INI_FLAG_BOTH, 0xa21c, 0x1483800a }, \
+ { AR5K_INI_FLAG_BOTH, 0xa220, 0x01831061 }, \
+ { AR5K_INI_FLAG_BOTH, 0xa224, 0x00000400 }, \
+ { AR5K_INI_FLAG_BOTH, 0xa228, 0x000001b5 }, \
+ { AR5K_INI_FLAG_BOTH, 0xa22c, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0xa234, 0x20202020 }, \
+ { AR5K_INI_FLAG_BOTH, 0xa238, 0x20202020 }, \
+ { AR5K_INI_FLAG_BOTH, 0xa23c, 0x13c889af }, \
+ { AR5K_INI_FLAG_BOTH, 0xa240, 0x38490a20 }, \
+ { AR5K_INI_FLAG_BOTH, 0xa244, 0x00007bb6 }, \
+ { AR5K_INI_FLAG_BOTH, 0xa248, 0x0fff3ffc }, \
+ { AR5K_INI_FLAG_BOTH, 0x9b00, 0x00000000 }, \
+ { AR5K_INI_FLAG_BOTH, 0x9b28, 0x0000000c }, \
+ { AR5K_INI_FLAG_BOTH, 0x9b38, 0x00000012 }, \
+ { AR5K_INI_FLAG_BOTH, 0x9b64, 0x00000021 }, \
+ { AR5K_INI_FLAG_BOTH, 0x9b8c, 0x0000002d }, \
+ { AR5K_INI_FLAG_BOTH, 0x9b9c, 0x00000033 }, \
+ /* AR5111 specific */ \
+ { AR5K_INI_FLAG_5111, 0x9930, 0x00004883 }, \
+ { AR5K_INI_FLAG_5111, 0xa204, 0x00000000 }, \
+ { AR5K_INI_FLAG_5111, 0xa208, 0xd03e6788 }, \
+ { AR5K_INI_FLAG_5111, 0xa20c, 0x6448416a }, \
+ { AR5K_INI_FLAG_5111, 0x9b04, 0x00000020 }, \
+ { AR5K_INI_FLAG_5111, 0x9b08, 0x00000010 }, \
+ { AR5K_INI_FLAG_5111, 0x9b0c, 0x00000030 }, \
+ { AR5K_INI_FLAG_5111, 0x9b10, 0x00000008 }, \
+ { AR5K_INI_FLAG_5111, 0x9b14, 0x00000028 }, \
+ { AR5K_INI_FLAG_5111, 0x9b18, 0x00000004 }, \
+ { AR5K_INI_FLAG_5111, 0x9b1c, 0x00000024 }, \
+ { AR5K_INI_FLAG_5111, 0x9b20, 0x00000014 }, \
+ { AR5K_INI_FLAG_5111, 0x9b24, 0x00000034 }, \
+ { AR5K_INI_FLAG_5111, 0x9b2c, 0x0000002c }, \
+ { AR5K_INI_FLAG_5111, 0x9b30, 0x00000002 }, \
+ { AR5K_INI_FLAG_5111, 0x9b34, 0x00000022 }, \
+ { AR5K_INI_FLAG_5111, 0x9b3c, 0x00000032 }, \
+ { AR5K_INI_FLAG_5111, 0x9b40, 0x0000000a }, \
+ { AR5K_INI_FLAG_5111, 0x9b44, 0x0000002a }, \
+ { AR5K_INI_FLAG_5111, 0x9b48, 0x00000006 }, \
+ { AR5K_INI_FLAG_5111, 0x9b4c, 0x00000026 }, \
+ { AR5K_INI_FLAG_5111, 0x9b50, 0x00000016 }, \
+ { AR5K_INI_FLAG_5111, 0x9b54, 0x00000036 }, \
+ { AR5K_INI_FLAG_5111, 0x9b58, 0x0000000e }, \
+ { AR5K_INI_FLAG_5111, 0x9b5c, 0x0000002e }, \
+ { AR5K_INI_FLAG_5111, 0x9b60, 0x00000001 }, \
+ { AR5K_INI_FLAG_5111, 0x9b68, 0x00000011 }, \
+ { AR5K_INI_FLAG_5111, 0x9b6c, 0x00000031 }, \
+ { AR5K_INI_FLAG_5111, 0x9b70, 0x00000009 }, \
+ { AR5K_INI_FLAG_5111, 0x9b74, 0x00000029 }, \
+ { AR5K_INI_FLAG_5111, 0x9b78, 0x00000005 }, \
+ { AR5K_INI_FLAG_5111, 0x9b7c, 0x00000025 }, \
+ { AR5K_INI_FLAG_5111, 0x9b80, 0x00000015 }, \
+ { AR5K_INI_FLAG_5111, 0x9b84, 0x00000035 }, \
+ { AR5K_INI_FLAG_5111, 0x9b88, 0x0000000d }, \
+ { AR5K_INI_FLAG_5111, 0x9b90, 0x00000003 }, \
+ { AR5K_INI_FLAG_5111, 0x9b94, 0x00000023 }, \
+ { AR5K_INI_FLAG_5111, 0x9b98, 0x00000013 }, \
+ { AR5K_INI_FLAG_5111, 0x9ba0, 0x0000000b }, \
+ { AR5K_INI_FLAG_5111, 0x9ba4, 0x0000002b }, \
+ { AR5K_INI_FLAG_5111, 0x9ba8, 0x0000002b }, \
+ { AR5K_INI_FLAG_5111, 0x9bac, 0x0000002b }, \
+ { AR5K_INI_FLAG_5111, 0x9bb0, 0x0000002b }, \
+ { AR5K_INI_FLAG_5111, 0x9bb4, 0x0000002b }, \
+ { AR5K_INI_FLAG_5111, 0x9bb8, 0x0000002b }, \
+ { AR5K_INI_FLAG_5111, 0x9bbc, 0x0000002b }, \
+ { AR5K_INI_FLAG_5111, 0x9bc0, 0x0000002b }, \
+ { AR5K_INI_FLAG_5111, 0x9bc4, 0x0000002b }, \
+ { AR5K_INI_FLAG_5111, 0x9bc8, 0x0000002b }, \
+ { AR5K_INI_FLAG_5111, 0x9bcc, 0x0000002b }, \
+ { AR5K_INI_FLAG_5111, 0x9bd0, 0x0000002b }, \
+ { AR5K_INI_FLAG_5111, 0x9bd4, 0x0000002b }, \
+ { AR5K_INI_FLAG_5111, 0x9bd8, 0x0000002b }, \
+ { AR5K_INI_FLAG_5111, 0x9bdc, 0x0000002b }, \
+ { AR5K_INI_FLAG_5111, 0x9be0, 0x0000002b }, \
+ { AR5K_INI_FLAG_5111, 0x9be4, 0x0000002b }, \
+ { AR5K_INI_FLAG_5111, 0x9be8, 0x0000002b }, \
+ { AR5K_INI_FLAG_5111, 0x9bec, 0x0000002b }, \
+ { AR5K_INI_FLAG_5111, 0x9bf0, 0x0000002b }, \
+ { AR5K_INI_FLAG_5111, 0x9bf4, 0x0000002b }, \
+ { AR5K_INI_FLAG_5111, 0x9bf8, 0x00000002 }, \
+ { AR5K_INI_FLAG_5111, 0x9bfc, 0x00000016 }, \
+ /* AR5112 specific */ \
+ { AR5K_INI_FLAG_5112, 0x9930, 0x00004882 }, \
+ { AR5K_INI_FLAG_5112, 0x9b04, 0x00000001 }, \
+ { AR5K_INI_FLAG_5112, 0x9b08, 0x00000002 }, \
+ { AR5K_INI_FLAG_5112, 0x9b0c, 0x00000003 }, \
+ { AR5K_INI_FLAG_5112, 0x9b10, 0x00000004 }, \
+ { AR5K_INI_FLAG_5112, 0x9b14, 0x00000005 }, \
+ { AR5K_INI_FLAG_5112, 0x9b18, 0x00000008 }, \
+ { AR5K_INI_FLAG_5112, 0x9b1c, 0x00000009 }, \
+ { AR5K_INI_FLAG_5112, 0x9b20, 0x0000000a }, \
+ { AR5K_INI_FLAG_5112, 0x9b24, 0x0000000b }, \
+ { AR5K_INI_FLAG_5112, 0x9b2c, 0x0000000d }, \
+ { AR5K_INI_FLAG_5112, 0x9b30, 0x00000010 }, \
+ { AR5K_INI_FLAG_5112, 0x9b34, 0x00000011 }, \
+ { AR5K_INI_FLAG_5112, 0x9b3c, 0x00000013 }, \
+ { AR5K_INI_FLAG_5112, 0x9b40, 0x00000014 }, \
+ { AR5K_INI_FLAG_5112, 0x9b44, 0x00000015 }, \
+ { AR5K_INI_FLAG_5112, 0x9b48, 0x00000018 }, \
+ { AR5K_INI_FLAG_5112, 0x9b4c, 0x00000019 }, \
+ { AR5K_INI_FLAG_5112, 0x9b50, 0x0000001a }, \
+ { AR5K_INI_FLAG_5112, 0x9b54, 0x0000001b }, \
+ { AR5K_INI_FLAG_5112, 0x9b58, 0x0000001c }, \
+ { AR5K_INI_FLAG_5112, 0x9b5c, 0x0000001d }, \
+ { AR5K_INI_FLAG_5112, 0x9b60, 0x00000020 }, \
+ { AR5K_INI_FLAG_5112, 0x9b68, 0x00000022 }, \
+ { AR5K_INI_FLAG_5112, 0x9b6c, 0x00000023 }, \
+ { AR5K_INI_FLAG_5112, 0x9b70, 0x00000024 }, \
+ { AR5K_INI_FLAG_5112, 0x9b74, 0x00000025 }, \
+ { AR5K_INI_FLAG_5112, 0x9b78, 0x00000028 }, \
+ { AR5K_INI_FLAG_5112, 0x9b7c, 0x00000029 }, \
+ { AR5K_INI_FLAG_5112, 0x9b80, 0x0000002a }, \
+ { AR5K_INI_FLAG_5112, 0x9b84, 0x0000002b }, \
+ { AR5K_INI_FLAG_5112, 0x9b88, 0x0000002c }, \
+ { AR5K_INI_FLAG_5112, 0x9b90, 0x00000030 }, \
+ { AR5K_INI_FLAG_5112, 0x9b94, 0x00000031 }, \
+ { AR5K_INI_FLAG_5112, 0x9b98, 0x00000032 }, \
+ { AR5K_INI_FLAG_5112, 0x9ba0, 0x00000034 }, \
+ { AR5K_INI_FLAG_5112, 0x9ba4, 0x00000035 }, \
+ { AR5K_INI_FLAG_5112, 0x9ba8, 0x00000035 }, \
+ { AR5K_INI_FLAG_5112, 0x9bac, 0x00000035 }, \
+ { AR5K_INI_FLAG_5112, 0x9bb0, 0x00000035 }, \
+ { AR5K_INI_FLAG_5112, 0x9bb4, 0x00000035 }, \
+ { AR5K_INI_FLAG_5112, 0x9bb8, 0x00000035 }, \
+ { AR5K_INI_FLAG_5112, 0x9bbc, 0x00000035 }, \
+ { AR5K_INI_FLAG_5112, 0x9bc0, 0x00000035 }, \
+ { AR5K_INI_FLAG_5112, 0x9bc4, 0x00000035 }, \
+ { AR5K_INI_FLAG_5112, 0x9bc8, 0x00000035 }, \
+ { AR5K_INI_FLAG_5112, 0x9bcc, 0x00000035 }, \
+ { AR5K_INI_FLAG_5112, 0x9bd0, 0x00000035 }, \
+ { AR5K_INI_FLAG_5112, 0x9bd4, 0x00000035 }, \
+ { AR5K_INI_FLAG_5112, 0x9bd8, 0x00000035 }, \
+ { AR5K_INI_FLAG_5112, 0x9bdc, 0x00000035 }, \
+ { AR5K_INI_FLAG_5112, 0x9be0, 0x00000035 }, \
+ { AR5K_INI_FLAG_5112, 0x9be4, 0x00000035 }, \
+ { AR5K_INI_FLAG_5112, 0x9be8, 0x00000035 }, \
+ { AR5K_INI_FLAG_5112, 0x9bec, 0x00000035 }, \
+ { AR5K_INI_FLAG_5112, 0x9bf0, 0x00000035 }, \
+ { AR5K_INI_FLAG_5112, 0x9bf4, 0x00000035 }, \
+ { AR5K_INI_FLAG_5112, 0x9bf8, 0x00000010 }, \
+ { AR5K_INI_FLAG_5112, 0x9bfc, 0x0000001a }, \
+}
+
+struct ath5k_ar5211_ini_mode {
+ u_int16_t mode_register;
+ u_int32_t mode_value[4];
+};
+
+#define AR5K_AR5211_INI_MODE { \
+ { 0x0030, { 0x00000017, 0x00000017, 0x00000017, 0x00000017 } }, \
+ { 0x1040, { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, \
+ { 0x1044, { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, \
+ { 0x1048, { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, \
+ { 0x104c, { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, \
+ { 0x1050, { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, \
+ { 0x1054, { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, \
+ { 0x1058, { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, \
+ { 0x105c, { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, \
+ { 0x1060, { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, \
+ { 0x1064, { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, \
+ { 0x1070, { 0x00000168, 0x000001e0, 0x000001b8, 0x00000168 } }, \
+ { 0x1030, { 0x00000230, 0x000001e0, 0x000000b0, 0x00000230 } }, \
+ { 0x10b0, { 0x00000d98, 0x00001180, 0x00001f48, 0x00000d98 } }, \
+ { 0x10f0, { 0x0000a0e0, 0x00014068, 0x00005880, 0x0000a0e0 } }, \
+ { 0x8014, { 0x04000400, 0x08000800, 0x20003000, 0x04000400 } }, \
+ { 0x801c, { 0x0e8d8fa7, 0x0e8d8fcf, 0x01608f95, 0x0e8d8fa7 } }, \
+ { 0x9804, { 0x00000000, 0x00000003, 0x00000000, 0x00000000 } }, \
+ { 0x9820, { 0x02020200, 0x02020200, 0x02010200, 0x02020200 } }, \
+ { 0x9824, { 0x00000e0e, 0x00000e0e, 0x00000707, 0x00000e0e } }, \
+ { 0x9828, { 0x0a020001, 0x0a020001, 0x05010000, 0x0a020001 } }, \
+ { 0x9834, { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } }, \
+ { 0x9838, { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b } }, \
+ { 0x9844, { 0x1372169c, 0x137216a5, 0x137216a8, 0x1372169c } }, \
+ { 0x9848, { 0x0018ba67, 0x0018ba67, 0x0018ba69, 0x0018ba69 } }, \
+ { 0x9850, { 0x0c28b4e0, 0x0c28b4e0, 0x0c28b4e0, 0x0c28b4e0 } }, \
+ { 0x9858, { 0x7e800d2e, 0x7e800d2e, 0x7ec00d2e, 0x7e800d2e } }, \
+ { 0x985c, { 0x31375d5e, 0x31375d5e, 0x313a5d5e, 0x31375d5e } }, \
+ { 0x9860, { 0x0000bd10, 0x0000bd10, 0x0000bd38, 0x0000bd10 } }, \
+ { 0x9864, { 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 } }, \
+ { 0x9914, { 0x00002710, 0x00002710, 0x0000157c, 0x00002710 } }, \
+ { 0x9918, { 0x00000190, 0x00000190, 0x00000084, 0x00000190 } }, \
+ { 0x9944, { 0x6fe01020, 0x6fe01020, 0x6fe00920, 0x6fe01020 } }, \
+ { 0xa180, { 0x05ff14ff, 0x05ff14ff, 0x05ff14ff, 0x05ff19ff } }, \
+ { 0x98d4, { 0x00000010, 0x00000014, 0x00000010, 0x00000010 } }, \
+}
+
+struct ath5k_ar5212_ini_mode {
+ u_int16_t mode_register;
+ u_int8_t mode_flags;
+ u_int32_t mode_value[2][5];
+};
+
+#define AR5K_AR5212_INI_MODE { \
+ { 0x0030, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x00008107, 0x00008107, 0x00008107, 0x00008107, 0x00008107 } \
+ } }, \
+ { 0x1040, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } \
+ } }, \
+ { 0x1044, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } \
+ } }, \
+ { 0x1048, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } \
+ } }, \
+ { 0x104c, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } \
+ } }, \
+ { 0x1050, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } \
+ } }, \
+ { 0x1054, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } \
+ } }, \
+ { 0x1058, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } \
+ } }, \
+ { 0x105c, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } \
+ } }, \
+ { 0x1060, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } \
+ } }, \
+ { 0x1064, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } \
+ } }, \
+ { 0x1030, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x00000230, 0x000001e0, 0x000000b0, 0x00000160, 0x000001e0 } \
+ } }, \
+ { 0x1070, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x00000168, 0x000001e0, 0x000001b8, 0x0000018c, 0x000001e0 } \
+ } }, \
+ { 0x10b0, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x00000e60, 0x00001180, 0x00001f1c, 0x00003e38, 0x00001180 } \
+ } }, \
+ { 0x10f0, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x0000a0e0, 0x00014068, 0x00005880, 0x0000b0e0, 0x00014068 } \
+ } }, \
+ { 0x8014, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x03e803e8, 0x06e006e0, 0x04200420, 0x08400840, 0x06e006e0 } \
+ } }, \
+ { 0x9804, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000003 } \
+ } }, \
+ { 0x9820, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x02020200, 0x02020200, 0x02010200, 0x02020200, 0x02020200 } \
+ } }, \
+ { 0x9834, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } \
+ } }, \
+ { 0x9838, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b, 0x0000000b } \
+ } }, \
+ { 0x9844, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x1372161c, 0x13721c25, 0x13721728, 0x137216a2, 0x13721c25 } \
+ } }, \
+ { 0x9850, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } \
+ } }, \
+ { 0x9858, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x7e800d2e, 0x7e800d2e, 0x7ee84d2e, 0x7ee84d2e, 0x7e800d2e } \
+ } }, \
+ { 0x9860, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x00009d10, 0x00009d10, 0x00009d18, 0x00009d10, 0x00009d10 } \
+ } }, \
+ { 0x9864, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 } \
+ } }, \
+ { 0x9868, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190 } \
+ } }, \
+ { 0x9918, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x000001b8, 0x000001b8, 0x00000084, 0x00000108, 0x000001b8 } \
+ } }, \
+ { 0x9924, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x10058a05, 0x10058a05, 0x10058a05, 0x10058a05, 0x10058a05 } \
+ } }, \
+ { 0xa180, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x10ff14ff, 0x10ff14ff, 0x10ff10ff, 0x10ff19ff, 0x10ff19ff } \
+ } }, \
+ { 0xa230, AR5K_INI_FLAG_511X, { \
+ { 0, }, \
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000108, 0x00000000 } \
+ } }, \
+ { 0x801c, AR5K_INI_FLAG_BOTH, { \
+ { 0x128d8fa7, 0x09880fcf, 0x04e00f95, 0x128d8fab, 0x09880fcf }, \
+ { 0x128d93a7, 0x098813cf, 0x04e01395, 0x128d93ab, 0x098813cf } \
+ } }, \
+ { 0x9824, AR5K_INI_FLAG_BOTH, { \
+ { 0x00000e0e, 0x00000e0e, 0x00000707, 0x00000e0e, 0x00000e0e }, \
+ { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } \
+ } }, \
+ { 0x9828, AR5K_INI_FLAG_BOTH, { \
+ { 0x0a020001, 0x0a020001, 0x05010100, 0x0a020001, 0x0a020001 }, \
+ { 0x0a020001, 0x0a020001, 0x05020100, 0x0a020001, 0x0a020001 } \
+ } }, \
+ { 0x9848, AR5K_INI_FLAG_BOTH, { \
+ { 0x0018da5a, 0x0018da5a, 0x0018ca69, 0x0018ca69, 0x0018ca69 }, \
+ { 0x0018da6d, 0x0018da6d, 0x0018ca75, 0x0018ca75, 0x0018ca75 } \
+ } }, \
+ { 0x985c, AR5K_INI_FLAG_BOTH, { \
+ { 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e, 0x3137615e }, \
+ { 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e } \
+ } }, \
+ { 0x986c, AR5K_INI_FLAG_BOTH, { \
+ { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb080, 0x050cb080 }, \
+ { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 } \
+ } }, \
+ { 0x9914, AR5K_INI_FLAG_BOTH, { \
+ { 0x00002710, 0x00002710, 0x0000157c, 0x00002af8, 0x00002710 }, \
+ { 0x000007d0, 0x000007d0, 0x0000044c, 0x00000898, 0x000007d0 } \
+ } }, \
+ { 0x9944, AR5K_INI_FLAG_BOTH, { \
+ { 0xffb81020, 0xffb81020, 0xffb80d20, 0xffb81020, 0xffb81020 }, \
+ { 0xffb81020, 0xffb81020, 0xffb80d10, 0xffb81010, 0xffb81010 } \
+ } }, \
+ { 0xa204, AR5K_INI_FLAG_5112, { \
+ { 0, }, \
+ { 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x00000004 } \
+ } }, \
+ { 0xa208, AR5K_INI_FLAG_5112, { \
+ { 0, }, \
+ { 0xd6be6788, 0xd6be6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } \
+ } }, \
+ { 0xa20c, AR5K_INI_FLAG_5112, { \
+ { 0, }, \
+ { 0x642c0140, 0x642c0140, 0x6442c160, 0x6442c160, 0x6442c160 } \
+ } }, \
+}
+
+struct ath5k_ar5211_ini_rf {
+ u_int16_t rf_register;
+ u_int32_t rf_value[2];
+};
+
+#define AR5K_AR5211_INI_RF { \
+ { 0x0000a204, { 0x00000000, 0x00000000 } }, \
+ { 0x0000a208, { 0x503e4646, 0x503e4646 } }, \
+ { 0x0000a20c, { 0x6480416c, 0x6480416c } }, \
+ { 0x0000a210, { 0x0199a003, 0x0199a003 } }, \
+ { 0x0000a214, { 0x044cd610, 0x044cd610 } }, \
+ { 0x0000a218, { 0x13800040, 0x13800040 } }, \
+ { 0x0000a21c, { 0x1be00060, 0x1be00060 } }, \
+ { 0x0000a220, { 0x0c53800a, 0x0c53800a } }, \
+ { 0x0000a224, { 0x0014df3b, 0x0014df3b } }, \
+ { 0x0000a228, { 0x000001b5, 0x000001b5 } }, \
+ { 0x0000a22c, { 0x00000020, 0x00000020 } }, \
+ { 0x0000989c, { 0x00000000, 0x00000000 } }, \
+ { 0x0000989c, { 0x00000000, 0x00000000 } }, \
+ { 0x0000989c, { 0x00000000, 0x00000000 } }, \
+ { 0x0000989c, { 0x00000000, 0x00000000 } }, \
+ { 0x0000989c, { 0x00000000, 0x00000000 } }, \
+ { 0x0000989c, { 0x00000000, 0x00000000 } }, \
+ { 0x0000989c, { 0x00000000, 0x00000000 } }, \
+ { 0x0000989c, { 0x00000000, 0x00000000 } }, \
+ { 0x0000989c, { 0x00000000, 0x00000000 } }, \
+ { 0x0000989c, { 0x00000000, 0x00000000 } }, \
+ { 0x0000989c, { 0x00000000, 0x00000000 } }, \
+ { 0x0000989c, { 0x00380000, 0x00380000 } }, \
+ { 0x0000989c, { 0x00000000, 0x00000000 } }, \
+ { 0x0000989c, { 0x00000000, 0x00000000 } }, \
+ { 0x0000989c, { 0x00000000, 0x00000000 } }, \
+ { 0x0000989c, { 0x000400f9, 0x000400f9 } }, \
+ { 0x000098d4, { 0x00000000, 0x00000004 } }, \
+ \
+ { 0x0000989c, { 0x00000000, 0x00000000 } }, \
+ { 0x0000989c, { 0x00000000, 0x00000000 } }, \
+ { 0x0000989c, { 0x00000000, 0x00000000 } }, \
+ { 0x0000989c, { 0x00000000, 0x00000000 } }, \
+ { 0x0000989c, { 0x00000000, 0x00000000 } }, \
+ { 0x0000989c, { 0x10000000, 0x10000000 } }, \
+ { 0x0000989c, { 0x04000000, 0x04000000 } }, \
+ { 0x0000989c, { 0x00000000, 0x00000000 } }, \
+ { 0x0000989c, { 0x00000000, 0x00000000 } }, \
+ { 0x0000989c, { 0x00000000, 0x00000000 } }, \
+ { 0x0000989c, { 0x00000000, 0x0a000000 } }, \
+ { 0x0000989c, { 0x00380080, 0x02380080 } }, \
+ { 0x0000989c, { 0x00020006, 0x00000006 } }, \
+ { 0x0000989c, { 0x00000092, 0x00000092 } }, \
+ { 0x0000989c, { 0x000000a0, 0x000000a0 } }, \
+ { 0x0000989c, { 0x00040007, 0x00040007 } }, \
+ { 0x000098d4, { 0x0000001a, 0x0000001a } }, \
+ { 0x0000989c, { 0x00000048, 0x00000048 } }, \
+ { 0x0000989c, { 0x00000010, 0x00000010 } }, \
+ { 0x0000989c, { 0x00000008, 0x00000008 } }, \
+ { 0x0000989c, { 0x0000000f, 0x0000000f } }, \
+ { 0x0000989c, { 0x000000f2, 0x00000062 } }, \
+ { 0x0000989c, { 0x0000904f, 0x0000904c } }, \
+ { 0x0000989c, { 0x0000125a, 0x0000129a } }, \
+ { 0x000098cc, { 0x0000000e, 0x0000000f } }, \
+}
+
+
+
+
+/*
+ * Internal RX/TX descriptor structures
+ * (rX: reserved fields possibily used by future versions of the ar5k chipset)
+ */
+
+struct ath5k_rx_desc {
+ /*
+ * RX control word 0
+ */
+ u_int32_t rx_control_0;
+
+#define AR5K_DESC_RX_CTL0 0x00000000
+
+ /*
+ * RX control word 1
+ */
+ u_int32_t rx_control_1;
+
+#define AR5K_DESC_RX_CTL1_BUF_LEN 0x00000fff
+#define AR5K_DESC_RX_CTL1_INTREQ 0x00002000
+} __attribute__((packed));
+
+struct ath5k_ar5211_rx_status {
+ /*
+ * RX status word 0
+ */
+ u_int32_t rx_status_0;
+
+#define AR5K_AR5211_DESC_RX_STATUS0_DATA_LEN 0x00000fff
+#define AR5K_AR5211_DESC_RX_STATUS0_MORE 0x00001000
+#define AR5K_AR5211_DESC_RX_STATUS0_RECEIVE_RATE 0x00078000
+#define AR5K_AR5211_DESC_RX_STATUS0_RECEIVE_RATE_S 15
+#define AR5K_AR5211_DESC_RX_STATUS0_RECEIVE_SIGNAL 0x07f80000
+#define AR5K_AR5211_DESC_RX_STATUS0_RECEIVE_SIGNAL_S 19
+#define AR5K_AR5211_DESC_RX_STATUS0_RECEIVE_ANTENNA 0x38000000
+#define AR5K_AR5211_DESC_RX_STATUS0_RECEIVE_ANTENNA_S 27
+
+ /*
+ * RX status word 1
+ */
+ u_int32_t rx_status_1;
+
+#define AR5K_AR5211_DESC_RX_STATUS1_DONE 0x00000001
+#define AR5K_AR5211_DESC_RX_STATUS1_FRAME_RECEIVE_OK 0x00000002
+#define AR5K_AR5211_DESC_RX_STATUS1_CRC_ERROR 0x00000004
+#define AR5K_AR5211_DESC_RX_STATUS1_FIFO_OVERRUN 0x00000008
+#define AR5K_AR5211_DESC_RX_STATUS1_DECRYPT_CRC_ERROR 0x00000010
+#define AR5K_AR5211_DESC_RX_STATUS1_PHY_ERROR 0x000000e0
+#define AR5K_AR5211_DESC_RX_STATUS1_PHY_ERROR_S 5
+#define AR5K_AR5211_DESC_RX_STATUS1_KEY_INDEX_VALID 0x00000100
+#define AR5K_AR5211_DESC_RX_STATUS1_KEY_INDEX 0x00007e00
+#define AR5K_AR5211_DESC_RX_STATUS1_KEY_INDEX_S 9
+#define AR5K_AR5211_DESC_RX_STATUS1_RECEIVE_TIMESTAMP 0x0fff8000
+#define AR5K_AR5211_DESC_RX_STATUS1_RECEIVE_TIMESTAMP_S 15
+#define AR5K_AR5211_DESC_RX_STATUS1_KEY_CACHE_MISS 0x10000000
+} __attribute__((packed));
+
+struct ath5k_ar5212_rx_status {
+ /*
+ * RX status word 0
+ */
+ u_int32_t rx_status_0;
+
+#define AR5K_AR5212_DESC_RX_STATUS0_DATA_LEN 0x00000fff
+#define AR5K_AR5212_DESC_RX_STATUS0_MORE 0x00001000
+#define AR5K_AR5212_DESC_RX_STATUS0_DECOMP_CRC_ERROR 0x00002000
+#define AR5K_AR5212_DESC_RX_STATUS0_RECEIVE_RATE 0x000f8000
+#define AR5K_AR5212_DESC_RX_STATUS0_RECEIVE_RATE_S 15
+#define AR5K_AR5212_DESC_RX_STATUS0_RECEIVE_SIGNAL 0x0ff00000
+#define AR5K_AR5212_DESC_RX_STATUS0_RECEIVE_SIGNAL_S 20
+#define AR5K_AR5212_DESC_RX_STATUS0_RECEIVE_ANTENNA 0xf0000000
+#define AR5K_AR5212_DESC_RX_STATUS0_RECEIVE_ANTENNA_S 28
+
+ /*
+ * RX status word 1
+ */
+ u_int32_t rx_status_1;
+
+#define AR5K_AR5212_DESC_RX_STATUS1_DONE 0x00000001
+#define AR5K_AR5212_DESC_RX_STATUS1_FRAME_RECEIVE_OK 0x00000002
+#define AR5K_AR5212_DESC_RX_STATUS1_CRC_ERROR 0x00000004
+#define AR5K_AR5212_DESC_RX_STATUS1_DECRYPT_CRC_ERROR 0x00000008
+#define AR5K_AR5212_DESC_RX_STATUS1_PHY_ERROR 0x00000010
+#define AR5K_AR5212_DESC_RX_STATUS1_MIC_ERROR 0x00000020
+#define AR5K_AR5212_DESC_RX_STATUS1_KEY_INDEX_VALID 0x00000100
+#define AR5K_AR5212_DESC_RX_STATUS1_KEY_INDEX 0x0000fe00
+#define AR5K_AR5212_DESC_RX_STATUS1_KEY_INDEX_S 9
+#define AR5K_AR5212_DESC_RX_STATUS1_RECEIVE_TIMESTAMP 0x7fff0000
+#define AR5K_AR5212_DESC_RX_STATUS1_RECEIVE_TIMESTAMP_S 16
+#define AR5K_AR5212_DESC_RX_STATUS1_KEY_CACHE_MISS 0x80000000
+} __attribute__((packed));
+
+struct ath5k_ar5212_rx_error {
+ /*
+ * RX error word 0
+ */
+ u_int32_t rx_error_0;
+
+#define AR5K_AR5212_DESC_RX_ERROR0 0x00000000
+
+ /*
+ * RX error word 1
+ */
+ u_int32_t rx_error_1;
+
+#define AR5K_AR5212_DESC_RX_ERROR1_PHY_ERROR_CODE 0x0000ff00
+#define AR5K_AR5212_DESC_RX_ERROR1_PHY_ERROR_CODE_S 8
+} __attribute__((packed));
+
+#define AR5K_DESC_RX_PHY_ERROR_NONE 0x00
+#define AR5K_DESC_RX_PHY_ERROR_TIMING 0x20
+#define AR5K_DESC_RX_PHY_ERROR_PARITY 0x40
+#define AR5K_DESC_RX_PHY_ERROR_RATE 0x60
+#define AR5K_DESC_RX_PHY_ERROR_LENGTH 0x80
+#define AR5K_DESC_RX_PHY_ERROR_64QAM 0xa0
+#define AR5K_DESC_RX_PHY_ERROR_SERVICE 0xc0
+#define AR5K_DESC_RX_PHY_ERROR_TRANSMITOVR 0xe0
+
+struct ath5k_ar5211_tx_desc {
+ /*
+ * TX control word 0
+ */
+ u_int32_t tx_control_0;
+
+#define AR5K_AR5211_DESC_TX_CTL0_FRAME_LEN 0x00000fff
+#define AR5K_AR5211_DESC_TX_CTL0_XMIT_RATE 0x003c0000
+#define AR5K_AR5211_DESC_TX_CTL0_XMIT_RATE_S 18
+#define AR5K_AR5211_DESC_TX_CTL0_RTSENA 0x00400000
+#define AR5K_AR5211_DESC_TX_CTL0_VEOL 0x00800000
+#define AR5K_AR5211_DESC_TX_CTL0_CLRDMASK 0x01000000
+#define AR5K_AR5211_DESC_TX_CTL0_ANT_MODE_XMIT 0x1e000000
+#define AR5K_AR5211_DESC_TX_CTL0_ANT_MODE_XMIT_S 25
+#define AR5K_AR5211_DESC_TX_CTL0_INTREQ 0x20000000
+#define AR5K_AR5211_DESC_TX_CTL0_ENCRYPT_KEY_VALID 0x40000000
+
+ /*
+ * TX control word 1
+ */
+ u_int32_t tx_control_1;
+
+#define AR5K_AR5211_DESC_TX_CTL1_BUF_LEN 0x00000fff
+#define AR5K_AR5211_DESC_TX_CTL1_MORE 0x00001000
+#define AR5K_AR5211_DESC_TX_CTL1_ENCRYPT_KEY_INDEX 0x000fe000
+#define AR5K_AR5211_DESC_TX_CTL1_ENCRYPT_KEY_INDEX_S 13
+#define AR5K_AR5211_DESC_TX_CTL1_FRAME_TYPE 0x00700000
+#define AR5K_AR5211_DESC_TX_CTL1_FRAME_TYPE_S 20
+#define AR5K_AR5211_DESC_TX_CTL1_NOACK 0x00800000
+} __attribute__((packed));
+
+struct ath5k_ar5212_tx_desc {
+ /*
+ * TX control word 0
+ */
+ u_int32_t tx_control_0;
+
+#define AR5K_AR5212_DESC_TX_CTL0_FRAME_LEN 0x00000fff
+#define AR5K_AR5212_DESC_TX_CTL0_XMIT_POWER 0x003f0000
+#define AR5K_AR5212_DESC_TX_CTL0_XMIT_POWER_S 16
+#define AR5K_AR5212_DESC_TX_CTL0_RTSENA 0x00400000
+#define AR5K_AR5212_DESC_TX_CTL0_VEOL 0x00800000
+#define AR5K_AR5212_DESC_TX_CTL0_CLRDMASK 0x01000000
+#define AR5K_AR5212_DESC_TX_CTL0_ANT_MODE_XMIT 0x1e000000
+#define AR5K_AR5212_DESC_TX_CTL0_ANT_MODE_XMIT_S 25
+#define AR5K_AR5212_DESC_TX_CTL0_INTREQ 0x20000000
+#define AR5K_AR5212_DESC_TX_CTL0_ENCRYPT_KEY_VALID 0x40000000
+#define AR5K_AR5212_DESC_TX_CTL0_CTSENA 0x80000000
+
+ /*
+ * TX control word 1
+ */
+ u_int32_t tx_control_1;
+
+#define AR5K_AR5212_DESC_TX_CTL1_BUF_LEN 0x00000fff
+#define AR5K_AR5212_DESC_TX_CTL1_MORE 0x00001000
+#define AR5K_AR5212_DESC_TX_CTL1_ENCRYPT_KEY_INDEX 0x000fe000
+#define AR5K_AR5212_DESC_TX_CTL1_ENCRYPT_KEY_INDEX_S 13
+#define AR5K_AR5212_DESC_TX_CTL1_FRAME_TYPE 0x00f00000
+#define AR5K_AR5212_DESC_TX_CTL1_FRAME_TYPE_S 20
+#define AR5K_AR5212_DESC_TX_CTL1_NOACK 0x01000000
+#define AR5K_AR5212_DESC_TX_CTL1_COMP_PROC 0x06000000
+#define AR5K_AR5212_DESC_TX_CTL1_COMP_PROC_S 25
+#define AR5K_AR5212_DESC_TX_CTL1_COMP_IV_LEN 0x18000000
+#define AR5K_AR5212_DESC_TX_CTL1_COMP_IV_LEN_S 27
+#define AR5K_AR5212_DESC_TX_CTL1_COMP_ICV_LEN 0x60000000
+#define AR5K_AR5212_DESC_TX_CTL1_COMP_ICV_LEN_S 29
+
+ /*
+ * TX control word 2
+ */
+ u_int32_t tx_control_2;
+
+#define AR5K_AR5212_DESC_TX_CTL2_RTS_DURATION 0x00007fff
+#define AR5K_AR5212_DESC_TX_CTL2_DURATION_UPDATE_ENABLE 0x00008000
+#define AR5K_AR5212_DESC_TX_CTL2_XMIT_TRIES0 0x000f0000
+#define AR5K_AR5212_DESC_TX_CTL2_XMIT_TRIES0_S 16
+#define AR5K_AR5212_DESC_TX_CTL2_XMIT_TRIES1 0x00f00000
+#define AR5K_AR5212_DESC_TX_CTL2_XMIT_TRIES1_S 20
+#define AR5K_AR5212_DESC_TX_CTL2_XMIT_TRIES2 0x0f000000
+#define AR5K_AR5212_DESC_TX_CTL2_XMIT_TRIES2_S 24
+#define AR5K_AR5212_DESC_TX_CTL2_XMIT_TRIES3 0xf0000000
+#define AR5K_AR5212_DESC_TX_CTL2_XMIT_TRIES3_S 28
+
+ /*
+ * TX control word 3
+ */
+ u_int32_t tx_control_3;
+
+#define AR5K_AR5212_DESC_TX_CTL3_XMIT_RATE0 0x0000001f
+#define AR5K_AR5212_DESC_TX_CTL3_XMIT_RATE1 0x000003e0
+#define AR5K_AR5212_DESC_TX_CTL3_XMIT_RATE1_S 5
+#define AR5K_AR5212_DESC_TX_CTL3_XMIT_RATE2 0x00007c00
+#define AR5K_AR5212_DESC_TX_CTL3_XMIT_RATE2_S 10
+#define AR5K_AR5212_DESC_TX_CTL3_XMIT_RATE3 0x000f8000
+#define AR5K_AR5212_DESC_TX_CTL3_XMIT_RATE3_S 15
+#define AR5K_AR5212_DESC_TX_CTL3_RTS_CTS_RATE 0x01f00000
+#define AR5K_AR5212_DESC_TX_CTL3_RTS_CTS_RATE_S 20
+} __attribute__((packed));
+
+struct ath5k_tx_status {
+ /*
+ * TX status word 0
+ */
+ u_int32_t tx_status_0;
+
+#define AR5K_DESC_TX_STATUS0_FRAME_XMIT_OK 0x00000001
+#define AR5K_DESC_TX_STATUS0_EXCESSIVE_RETRIES 0x00000002
+#define AR5K_DESC_TX_STATUS0_FIFO_UNDERRUN 0x00000004
+#define AR5K_DESC_TX_STATUS0_FILTERED 0x00000008
+#define AR5K_DESC_TX_STATUS0_RTS_FAIL_COUNT 0x000000f0
+#define AR5K_DESC_TX_STATUS0_RTS_FAIL_COUNT_S 4
+#define AR5K_DESC_TX_STATUS0_DATA_FAIL_COUNT 0x00000f00
+#define AR5K_DESC_TX_STATUS0_DATA_FAIL_COUNT_S 8
+#define AR5K_DESC_TX_STATUS0_VIRT_COLL_COUNT 0x0000f000
+#define AR5K_DESC_TX_STATUS0_VIRT_COLL_COUNT_S 12
+#define AR5K_DESC_TX_STATUS0_SEND_TIMESTAMP 0xffff0000
+#define AR5K_DESC_TX_STATUS0_SEND_TIMESTAMP_S 16
+
+ /*
+ * TX status word 1
+ */
+ u_int32_t tx_status_1;
+
+#define AR5K_DESC_TX_STATUS1_DONE 0x00000001
+#define AR5K_DESC_TX_STATUS1_SEQ_NUM 0x00001ffe
+#define AR5K_DESC_TX_STATUS1_SEQ_NUM_S 1
+#define AR5K_DESC_TX_STATUS1_ACK_SIG_STRENGTH 0x001fe000
+#define AR5K_DESC_TX_STATUS1_ACK_SIG_STRENGTH_S 13
+#define AR5K_DESC_TX_STATUS1_FINAL_TS_INDEX 0x00600000
+#define AR5K_DESC_TX_STATUS1_FINAL_TS_INDEX_S 21
+#define AR5K_DESC_TX_STATUS1_COMP_SUCCESS 0x00800000
+#define AR5K_DESC_TX_STATUS1_XMIT_ANTENNA 0x01000000
+} __attribute__((packed));
+
diff -Nurp qemu-0.9.1-untouched/hw/ath5kreg.h qemu-0.9.1/hw/ath5kreg.h
--- qemu-0.9.1-untouched/hw/ath5kreg.h 1970-01-01 01:00:00.000000000 +0100
+++ qemu-0.9.1/hw/ath5kreg.h 2008-02-28 14:02:51.000000000 +0100
@@ -0,0 +1,1878 @@
+/*-
+ * Copyright (c) 2007 Nick Kossifidis <mickflemm@gmail.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ * redistribution must be conditioned upon including a substantially
+ * similar Disclaimer requirement for further binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+/*
+ * Register values for Atheros 5210/5211/5212 cards from OpenBSD's ar5k
+ * maintained by Reyk Floeter
+ *
+ * I tried to document those registers by looking at ar5k code, some
+ * 802.11 (802.11e mostly) papers and by reading various public available
+ * Atheros presentations and papers like these:
+ *
+ * 5210 - http://nova.stanford.edu/~bbaas/ps/isscc2002_slides.pdf
+ * http://www.it.iitb.ac.in/~janak/wifire/01222734.pdf
+ *
+ * 5211 - http://www.hotchips.org/archives/hc14/3_Tue/16_mcfarland.pdf
+ */
+
+
+#define ATH_HW_IRQ_PENDING 0x4008
+#define ATH_HW_IRQ_PENDING_FALSE 0
+#define ATH_HW_IRQ_PENDING_TRUE 1
+
+/*====MAC DMA REGISTERS====*/
+
+/*
+ * AR5210-Specific TXDP registers
+ * 5210 has only 2 transmit queues so no DCU/QCU, just
+ * 2 transmit descriptor pointers...
+ */
+#define AR5K_NOQCU_TXDP0 0x0000 /*Queue 0 - data*/
+#define AR5K_NOQCU_TXDP1 0x0004 /*Queue 1 - beacons*/
+
+/*
+ * Mac Control Register
+ */
+#define AR5K_CR 0x0008 /*Register Address*/
+#define AR5K_CR_TXE0 0x00000001 /*TX Enable for queue 0 on 5210*/
+#define AR5K_CR_TXE1 0x00000002 /*TX Enable for queue 1 on 5210*/
+#define AR5K_CR_RXE 0x00000004 /*RX Enable*/
+#define AR5K_CR_TXD0 0x00000008 /*TX Disable for queue 0 on 5210*/
+#define AR5K_CR_TXD1 0x00000010 /*TX Disable for queue 1 on 5210*/
+#define AR5K_CR_RXD 0x00000020 /*RX Disable*/
+#define AR5K_CR_SWI 0x00000040
+
+/*
+ * RX Descriptor Pointer register
+ */
+#define AR5K_RXDP 0x000c
+
+/*
+ * Configuration and status register
+ */
+#define AR5K_CFG 0x0014 /*Register Address*/
+#define AR5K_CFG_SWTD 0x00000001 /*Bitswap TX descriptor (for big endian archs)*/
+#define AR5K_CFG_SWTB 0x00000002 /*Bitswap TX buffer (?)*/
+#define AR5K_CFG_SWRD 0x00000004 /*Bitswap RX descriptor*/
+#define AR5K_CFG_SWRB 0x00000008 /*Bitswap RX buffer (?)*/
+#define AR5K_CFG_SWRG 0x00000010
+#define AR5K_CFG_ADHOC 0x00000020 /*not found on 5210*/
+#define AR5K_CFG_PHY_OK 0x00000100 /*not found on 5210*/
+#define AR5K_CFG_EEBS 0x00000200 /*EEPROM is busy*/
+#define AR5K_CFG_CLKGD 0x00000400
+#define AR5K_CFG_TXCNT 0x00007800 /*5210 only*/
+#define AR5K_CFG_TXCNT_S 11
+#define AR5K_CFG_TXFSTAT 0x00008000 /*5210 only*/
+#define AR5K_CFG_TXFSTRT 0x00010000 /*5210 only*/
+#define AR5K_CFG_PCI_THRES 0x00060000 /*not found on 5210*/
+#define AR5K_CFG_PCI_THRES_S 17
+
+/*
+ * Interrupt enable register
+ */
+#define AR5K_IER 0x0024 /*Register Address*/
+#define AR5K_IER_DISABLE 0x00000000 /*Disable card interrupts*/
+#define AR5K_IER_ENABLE 0x00000001 /*Enable card interrupts*/
+
+
+/*
+ * 0x0028 is Beacon Control Register on 5210
+ * and first RTS duration register on 5211
+ */
+
+/*
+ * Beacon control register -5210 only-
+ */
+#define AR5K_BCR 0x0028 /*Register Address*/
+#define AR5K_BCR_AP 0x00000000 /*AP mode*/
+#define AR5K_BCR_ADHOC 0x00000001 /*Ad-Hoc mode*/
+#define AR5K_BCR_BDMAE 0x00000002 /*DMA enable*/
+#define AR5K_BCR_TQ1FV 0x00000004 /*Use Queue1 for CAB traffic*/
+#define AR5K_BCR_TQ1V 0x00000008 /*Use Queue1 for Beacon traffic*/
+#define AR5K_BCR_BCGET 0x00000010
+
+/*
+ * First RTS duration register -5211 only-
+ */
+#define AR5K_RTSD0 0x0028 /*Register Address*/
+#define AR5K_RTSD0_6 0x000000ff /*6Mb RTS duration mask (?)*/
+#define AR5K_RTSD0_6_S 0 /*6Mb RTS duration shift (?)*/
+#define AR5K_RTSD0_9 0x0000ff00 /*9Mb*/
+#define AR5K_RTSD0_9_S 8
+#define AR5K_RTSD0_12 0x00ff0000 /*12Mb*/
+#define AR5K_RTSD0_12_S 16
+#define AR5K_RTSD0_18 0xff000000 /*16Mb*/
+#define AR5K_RTSD0_18_S 24
+
+
+/*
+ * 0x002c is Beacon Status Register on 5210
+ * and second RTS duration register on 5211
+ */
+
+/*
+ * Beacon status register -5210 only-
+ *
+ * As i can see in ar5k_ar5210_tx_start Reyk uses some of the values of BCR
+ * for this register, so i guess TQ1V,TQ1FV and BDMAE have the same meaning
+ * here and SNP/SNAP means "snapshot" (so this register gets synced with BCR).
+ * So SNAPPEDBCRVALID sould also stand for "snapped BCR -values- valid", so i
+ * renamed it to SNAPSHOTSVALID to make more sense. I realy have no idea what
+ * else can it be. I also renamed SNPBCMD to SNPADHOC to match BCR.
+ */
+#define AR5K_BSR 0x002c /*Register Address*/
+#define AR5K_BSR_BDLYSW 0x00000001 /*SW Beacon delay (?)*/
+#define AR5K_BSR_BDLYDMA 0x00000002 /*DMA Beacon delay (?)*/
+#define AR5K_BSR_TXQ1F 0x00000004
+#define AR5K_BSR_ATIMDLY 0x00000008 /*ATIM delay (?)*/
+#define AR5K_BSR_SNPADHOC 0x00000100 /*Ad-hoc mode set (?)*/
+#define AR5K_BSR_SNPBDMAE 0x00000200 /*Beacon DMA enabled (?)*/
+#define AR5K_BSR_SNPTQ1FV 0x00000400 /*Queue1 is used for CAB traffic (?)*/
+#define AR5K_BSR_SNPTQ1V 0x00000800 /*Queue1 is used for Beacon traffic (?)*/
+#define AR5K_BSR_SNAPSHOTSVALID 0x00001000 /*BCR snapshots are valid (?)*/
+#define AR5K_BSR_SWBA_CNT 0x00ff0000
+
+/*
+ * Second RTS duration register -5211 only-
+ */
+#define AR5K_RTSD1 0x002c /*Register Address*/
+#define AR5K_RTSD1_24 0x000000ff /*24Mb*/
+#define AR5K_RTSD1_24_S 0
+#define AR5K_RTSD1_36 0x0000ff00 /*36Mb*/
+#define AR5K_RTSD1_36_S 8
+#define AR5K_RTSD1_48 0x00ff0000 /*48Mb*/
+#define AR5K_RTSD1_48_S 16
+#define AR5K_RTSD1_54 0xff000000 /*54Mb*/
+#define AR5K_RTSD1_54_S 24
+
+
+/*
+ * Transmit configuration register
+ */
+#define AR5K_TXCFG 0x0030 /*Register Address*/
+#define AR5K_TXCFG_SDMAMR 0x00000007 /*DMA size*/
+#define AR5K_TXCFG_SDMAMR_S 0
+#define AR5K_TXCFG_B_MODE 0x00000008 /*Set b mode for 5111 (enable 2111)*/
+#define AR5K_TXCFG_TXFSTP 0x00000008 /*TX DMA Stop -5210 only-*/
+#define AR5K_TXCFG_TXFULL 0x000003f0 /*TX Triger level mask*/
+#define AR5K_TXCFG_TXFULL_S 4
+#define AR5K_TXCFG_TXFULL_0B 0x00000000
+#define AR5K_TXCFG_TXFULL_64B 0x00000010
+#define AR5K_TXCFG_TXFULL_128B 0x00000020
+#define AR5K_TXCFG_TXFULL_192B 0x00000030
+#define AR5K_TXCFG_TXFULL_256B 0x00000040
+#define AR5K_TXCFG_TXCONT_EN 0x00000080
+#define AR5K_TXCFG_DMASIZE 0x00000100 /*flag for passing DMA size -non 5210*/
+#define AR5K_TXCFG_JUMBO_TXE 0x00000400 /*enable jumbo frames transmition (?) -non 5210*/
+#define AR5K_TXCFG_RTSRND 0x00001000 /*non 5210*/
+#define AR5K_TXCFG_FRMPAD_DIS 0x00002000 /*non 5210*/
+#define AR5K_TXCFG_RDY_DIS 0x00004000 /*non 5210*/
+
+/*
+ * Receive configuration register
+ */
+#define AR5K_RXCFG 0x0034 /*Register Address*/
+#define AR5K_RXCFG_SDMAMW 0x00000007 /*DMA size*/
+#define AR5K_RXCFG_SDMAMW_S 0
+#define AR5K_RXCFG_DEF_ANTENNA 0x00000008 /*default antenna*/
+#define AR5K_RXCFG_ZLFDMA 0x00000010 /*zero-length DMA*/
+#define AR5K_RXCFG_JUMBO_RXE 0x00000020 /*enable jumbo frames recieve (?) -non 5210*/
+#define AR5K_RXCFG_JUMBO_WRAP 0x00000040 /*wrap jumbo frames (?) -non 5210*/
+
+/*
+ * Receive jumbo descriptor last address register
+ * Only found in 5211 (?)
+ */
+#define AR5K_RXJLA 0x0038
+
+/*
+ * MIB control register
+ */
+#define AR5K_MIBC 0x0040 /*Register Address*/
+#define AR5K_MIBC_COW 0x00000001
+#define AR5K_MIBC_FMC 0x00000002 /*Freeze Mib Counters (?)*/
+#define AR5K_MIBC_CMC 0x00000004 /*Clean Mib Counters (?)*/
+#define AR5K_MIBC_MCS 0x00000008
+
+/*
+ * Timeout prescale register
+ */
+#define AR5K_TOPS 0x0044
+#define AR5K_TOPS_M 0x0000ffff /*non 5210*/
+
+/*
+ * Receive timeout register (no frame received)
+ */
+#define AR5K_RXNOFRM 0x0048
+#define AR5K_RXNOFRM_M 0x000003ff /*non 5210*/
+
+/*
+ * Transmit timeout register (no frame sent)
+ */
+#define AR5K_TXNOFRM 0x004c
+#define AR5K_TXNOFRM_M 0x000003ff /*non 5210*/
+#define AR5K_TXNOFRM_QCU 0x000ffc00 /*non 5210*/
+
+/*
+ * Receive frame gap timeout register
+ */
+#define AR5K_RPGTO 0x0050
+#define AR5K_RPGTO_M 0x000003ff /*non 5210*/
+
+/*
+ * Receive frame count limit register
+ */
+#define AR5K_RFCNT 0x0054
+#define AR5K_RFCNT_M 0x0000001f /*non 5210*/
+#define AR5K_RFCNT_RFCL 0x0000000f /*5210*/
+
+/*
+ * Misc settings register
+ */
+#define AR5K_MISC 0x0058 /*Register Address*/
+#define AR5K_MISC_DMA_OBS_M 0x000001e0
+#define AR5K_MISC_DMA_OBS_S 5
+#define AR5K_MISC_MISC_OBS_M 0x00000e00
+#define AR5K_MISC_MISC_OBS_S 9
+#define AR5K_MISC_MAC_OBS_LSB_M 0x00007000
+#define AR5K_MISC_MAC_OBS_LSB_S 12
+#define AR5K_MISC_MAC_OBS_MSB_M 0x00038000
+#define AR5K_MISC_MAC_OBS_MSB_S 15
+#define AR5K_MISC_LED_DECAY 0x001c0000 /*5210*/
+#define AR5K_MISC_LED_BLINK 0x00e00000 /*5210*/
+
+/*
+ * QCU/DCU clock gating register (5311)
+ */
+#define AR5K_QCUDCU_CLKGT 0x005c /*Register Address (?)*/
+#define AR5K_QCUDCU_CLKGT_QCU 0x0000ffff /*Mask for QCU clock*/
+#define AR5K_QCUDCU_CLKGT_DCU 0x07ff0000 /*Mask for DCU clock*/
+
+/*
+ * Interrupt Status Registers
+ *
+ * For 5210 there is only one status register but for
+ * 5211/5212 we have one primary and 4 secondary registers.
+ * So we have AR5K_ISR for 5210 and AR5K_PISR /SISRx for 5211/5212.
+ * Most of these bits are common for all chipsets.
+ */
+#define AR5K_ISR 0x001c /*Register Address (5210)*/
+#define AR5K_PISR 0x0080 /*Register Address (5211/5212)*/
+#define AR5K_ISR_RXOK 0x00000001 /*Frame successfuly recieved*/
+#define AR5K_ISR_RXDESC 0x00000002 /*RX descriptor request*/
+#define AR5K_ISR_RXERR 0x00000004 /*Receive error*/
+#define AR5K_ISR_RXNOFRM 0x00000008 /*No frame received (receive timeout)*/
+#define AR5K_ISR_RXEOL 0x00000010 /*Empty RX descriptor*/
+#define AR5K_ISR_RXORN 0x00000020 /*Receive FIFO overrun*/
+#define AR5K_ISR_TXOK 0x00000040 /*Frame successfuly transmited*/
+#define AR5K_ISR_TXDESC 0x00000080 /*TX descriptor request*/
+#define AR5K_ISR_TXERR 0x00000100 /*Transmit error*/
+#define AR5K_ISR_TXNOFRM 0x00000200 /*No frame transmited (transmit timeout)*/
+#define AR5K_ISR_TXEOL 0x00000400 /*Empty TX descriptor*/
+#define AR5K_ISR_TXURN 0x00000800 /*Transmit FIFO underrun*/
+#define AR5K_ISR_MIB 0x00001000 /*Update MIB counters*/
+#define AR5K_ISR_SWI 0x00002000
+#define AR5K_ISR_RXPHY 0x00004000 /*PHY error*/
+#define AR5K_ISR_RXKCM 0x00008000
+#define AR5K_ISR_SWBA 0x00010000 /*Software beacon alert*/
+#define AR5K_ISR_BRSSI 0x00020000
+#define AR5K_ISR_BMISS 0x00040000 /*Beacon missed*/
+#define AR5K_ISR_HIUERR 0x00080000 /*Host Interface Unit error -non 5210*/
+#define AR5K_ISR_BNR 0x00100000 /*Beacon not ready -non 5210*/
+#define AR5K_ISR_MCABT 0x00100000 /*5210*/
+#define AR5K_ISR_RXCHIRP 0x00200000 /*5212 only*/
+#define AR5K_ISR_SSERR 0x00200000 /*5210 only*/
+#define AR5K_ISR_DPERR 0x00400000 /*5210 only*/
+#define AR5K_ISR_TIM 0x00800000 /*non 5210*/
+#define AR5K_ISR_BCNMISC 0x00800000 /*5212 only*/
+#define AR5K_ISR_GPIO 0x01000000 /*GPIO (rf kill)*/
+#define AR5K_ISR_QCBRORN 0x02000000 /*CBR overrun (?) -non 5210*/
+#define AR5K_ISR_QCBRURN 0x04000000 /*CBR underrun (?) -non 5210*/
+#define AR5K_ISR_QTRIG 0x08000000 /*non 5210*/
+
+/*
+ * Secondary status registers (5211/5212) (0 - 4)
+ *
+ * I guess from the names that these give the status for each
+ * queue, that's why only masks are defined here, haven't got
+ * any info about them (couldn't find them anywhere in ar5k code).
+ */
+#define AR5K_SISR0 0x0084 /*Register Address (5211/5212)*/
+#define AR5K_SISR0_QCU_TXOK 0x000003ff /*Mask for QCU_TXOK*/
+#define AR5K_SISR0_QCU_TXDESC 0x03ff0000 /*Mask for QCU_TXDESC*/
+
+#define AR5K_SISR1 0x0088 /*Register Address (5211/5212)*/
+#define AR5K_SISR1_QCU_TXERR 0x000003ff /*Mask for QCU_TXERR*/
+#define AR5K_SISR1_QCU_TXEOL 0x03ff0000 /*Mask for QCU_TXEOL*/
+
+#define AR5K_SISR2 0x008c /*Register Address (5211/5212)*/
+#define AR5K_SISR2_QCU_TXURN 0x000003ff /*Mask for QCU_TXURN*/
+#define AR5K_SISR2_MCABT 0x00100000
+#define AR5K_SISR2_SSERR 0x00200000
+#define AR5K_SISR2_DPERR 0x00400000
+#define AR5K_SISR2_TIM 0x01000000 /*5212 only*/
+#define AR5K_SISR2_CAB_END 0x02000000 /*5212 only*/
+#define AR5K_SISR2_DTIM_SYNC 0x04000000 /*5212 only*/
+#define AR5K_SISR2_BCN_TIMEOUT 0x08000000 /*5212 only*/
+#define AR5K_SISR2_CAB_TIMEOUT 0x10000000 /*5212 only*/
+#define AR5K_SISR2_DTIM 0x20000000 /*5212 only*/
+
+#define AR5K_SISR3 0x0090 /*Register Address (5211/5212)*/
+#define AR5K_SISR3_QCBRORN 0x000003ff /*Mask for QCBRORN*/
+#define AR5K_SISR3_QCBRURN 0x03ff0000 /*Mask for QCBRURN*/
+
+#define AR5K_SISR4 0x0094 /*Register Address (5211/5212)*/
+#define AR5K_SISR4_QTRIG 0x000003ff /*Mask for QTRIG*/
+
+/*
+ * Shadow read-and-clear interrupt status registers (5211/5212)
+ */
+#define AR5K_RAC_PISR 0x00c0 /*Read and clear PISR*/
+#define AR5K_RAC_SISR0 0x00c4 /*Read and clear SISR0*/
+#define AR5K_RAC_SISR1 0x00c8 /*Read and clear SISR1*/
+#define AR5K_RAC_SISR2 0x00cc /*Read and clear SISR2*/
+#define AR5K_RAC_SISR3 0x00d0 /*Read and clear SISR3*/
+#define AR5K_RAC_SISR4 0x00d4 /*Read and clear SISR4*/
+
+/*
+ * Interrupt Mask Registers
+ *
+ * As whith ISRs 5210 has one IMR (AR5K_IMR) and 5211/5212 has one primary
+ * (AR5K_PIMR) and 4 secondary IMRs (AR5K_SIMRx). Note that ISR/IMR flags match.
+ */
+#define AR5K_IMR 0x0020 /*Register Address (5210)*/
+#define AR5K_PIMR 0x00a0 /*Register Address (5211/5212)*/
+#define AR5K_IMR_RXOK 0x00000001 /*Frame successfuly recieved*/
+#define AR5K_IMR_RXDESC 0x00000002 /*RX descriptor request*/
+#define AR5K_IMR_RXERR 0x00000004 /*Receive error*/
+#define AR5K_IMR_RXNOFRM 0x00000008 /*No frame received (receive timeout)*/
+#define AR5K_IMR_RXEOL 0x00000010 /*Empty RX descriptor*/
+#define AR5K_IMR_RXORN 0x00000020 /*Receive FIFO overrun*/
+#define AR5K_IMR_TXOK 0x00000040 /*Frame successfuly transmited*/
+#define AR5K_IMR_TXDESC 0x00000080 /*TX descriptor request*/
+#define AR5K_IMR_TXERR 0x00000100 /*Transmit error*/
+#define AR5K_IMR_TXNOFRM 0x00000200 /*No frame transmited (transmit timeout)*/
+#define AR5K_IMR_TXEOL 0x00000400 /*Empty TX descriptor*/
+#define AR5K_IMR_TXURN 0x00000800 /*Transmit FIFO underrun*/
+#define AR5K_IMR_MIB 0x00001000 /*Update MIB counters*/
+#define AR5K_IMR_SWI 0x00002000
+#define AR5K_IMR_RXPHY 0x00004000 /*PHY error*/
+#define AR5K_IMR_RXKCM 0x00008000
+#define AR5K_IMR_SWBA 0x00010000 /*Software beacon alert*/
+#define AR5K_IMR_BRSSI 0x00020000
+#define AR5K_IMR_BMISS 0x00040000 /*Beacon missed*/
+#define AR5K_IMR_HIUERR 0x00080000 /*Host Interface Unit error -non 5210*/
+#define AR5K_IMR_BNR 0x00100000 /*Beacon not ready -non 5210*/
+#define AR5K_IMR_MCABT 0x00100000 /*5210*/
+#define AR5K_IMR_RXCHIRP 0x00200000 /*5212 only*/
+#define AR5K_IMR_SSERR 0x00200000 /*5210 only*/
+#define AR5K_IMR_DPERR 0x00400000 /*5210 only*/
+#define AR5K_IMR_TIM 0x00800000 /*non 5210*/
+#define AR5K_IMR_BCNMISC 0x00800000 /*5212 only*/
+#define AR5K_IMR_GPIO 0x01000000 /*GPIO (rf kill)*/
+#define AR5K_IMR_QCBRORN 0x02000000 /*CBR overrun (?) -non 5210*/
+#define AR5K_IMR_QCBRURN 0x04000000 /*CBR underrun (?) -non 5210*/
+#define AR5K_IMR_QTRIG 0x08000000 /*non 5210*/
+
+/*
+ * Secondary interrupt mask registers (5211/5212) (0 - 4)
+ */
+#define AR5K_SIMR0 0x00a4 /*Register Address (5211/5212)*/
+#define AR5K_SIMR0_QCU_TXOK 0x000003ff /*Mask for QCU_TXOK*/
+#define AR5K_SIMR0_QCU_TXOK_S 0
+#define AR5K_SIMR0_QCU_TXDESC 0x03ff0000 /*Mask for QCU_TXDESC*/
+#define AR5K_SIMR0_QCU_TXDESC_S 16
+
+#define AR5K_SIMR1 0x00a8 /*Register Address (5211/5212)*/
+#define AR5K_SIMR1_QCU_TXERR 0x000003ff /*Mask for QCU_TXERR*/
+#define AR5K_SIMR1_QCU_TXERR_S 0
+#define AR5K_SIMR1_QCU_TXEOL 0x03ff0000 /*Mask for QCU_TXEOL*/
+#define AR5K_SIMR1_QCU_TXEOL_S 16
+
+#define AR5K_SIMR2 0x00ac /*Register Address (5211/5212)*/
+#define AR5K_SIMR2_QCU_TXURN 0x000003ff /*Mask for QCU_TXURN*/
+#define AR5K_SIMR2_QCU_TXURN_S 0
+#define AR5K_SIMR2_MCABT 0x00100000
+#define AR5K_SIMR2_SSERR 0x00200000
+#define AR5K_SIMR2_DPERR 0x00400000
+#define AR5K_SIMR2_TIM 0x01000000 /*5212 only*/
+#define AR5K_SIMR2_CAB_END 0x02000000 /*5212 only*/
+#define AR5K_SIMR2_DTIM_SYNC 0x04000000 /*5212 only*/
+#define AR5K_SIMR2_BCN_TIMEOUT 0x08000000 /*5212 only*/
+#define AR5K_SIMR2_CAB_TIMEOUT 0x10000000 /*5212 only*/
+#define AR5K_SIMR2_DTIM 0x20000000 /*5212 only*/
+
+#define AR5K_SIMR3 0x00b0 /*Register Address (5211/5212)*/
+#define AR5K_SIMR3_QCBRORN 0x000003ff /*Mask for QCBRORN*/
+#define AR5K_SIMR3_QCBRORN_S 0
+#define AR5K_SIMR3_QCBRURN 0x03ff0000 /*Mask for QCBRURN*/
+#define AR5K_SIMR3_QCBRURN_S 16
+
+#define AR5K_SIMR4 0x00b4 /*Register Address (5211/5212)*/
+#define AR5K_SIMR4_QTRIG 0x000003ff /*Mask for QTRIG*/
+#define AR5K_SIMR4_QTRIG_S 0
+
+
+/*
+ * Decompression mask registers (5212)
+ */
+#define AR5K_DCM_ADDR 0x0400 /*Decompression mask address (?)*/
+#define AR5K_DCM_DATA 0x0404 /*Decompression mask data (?)*/
+
+/*
+ * Decompression configuration registers (5212)
+ */
+#define AR5K_DCCFG 0x0420
+
+/*
+ * Compression configuration registers (5212)
+ */
+#define AR5K_CCFG 0x0600
+#define AR5K_CCFG_CUP 0x0604
+
+/*
+ * Compression performance counter registers (5212)
+ */
+#define AR5K_CPC0 0x0610 /*Compression performance counter 0*/
+#define AR5K_CPC1 0x0614 /*Compression performance counter 1*/
+#define AR5K_CPC2 0x0618 /*Compression performance counter 2*/
+#define AR5K_CPC3 0x061c /*Compression performance counter 3*/
+#define AR5K_CPCORN 0x0620 /*Compression performance overrun (?)*/
+
+
+/*
+ * Queue control unit (QCU) registers (5211/5212)
+ *
+ * Card has 12 TX Queues but i see that only 0-9 are used (?)
+ * both in binary HAL (see ah.h) and ar5k. Each queue has it's own
+ * TXDP at addresses 0x0800 - 0x082c, a CBR (Constant Bit Rate)
+ * configuration register (0x08c0 - 0x08ec), a ready time configuration
+ * register (0x0900 - 0x092c), a misc configuration register (0x09c0 -
+ * 0x09ec) and a status register (0x0a00 - 0x0a2c). We also have some
+ * global registers, QCU transmit enable/disable and "one shot arm (?)"
+ * set/clear, which contain status for all queues (we shift by 1 for each
+ * queue). To access these registers easily we define some macros here
+ * that are used inside HAL. For more infos check out *_tx_queue functs.
+ *
+ * TODO: Boundary checking on macros (here?)
+ */
+
+/*
+ * Generic QCU Register access macros
+ */
+#define AR5K_QUEUE_REG(_r, _q) (((_q) << 2) + _r)
+#define AR5K_QCU_GLOBAL_READ(_r, _q) (AR5K_REG_READ(_r) & (1 << _q))
+#define AR5K_QCU_GLOBAL_WRITE(_r, _q) AR5K_REG_WRITE(_r, (1 << _q))
+
+/*
+ * QCU Transmit descriptor pointer registers
+ */
+#define AR5K_QCU_TXDP_BASE 0x0800 /*Register Address - Queue0 TXDP*/
+#define AR5K_QUEUE_TXDP(_q) AR5K_QUEUE_REG(AR5K_QCU_TXDP_BASE, _q)
+
+/*
+ * QCU Transmit enable register
+ */
+#define AR5K_QCU_TXE 0x0840
+#define AR5K_ENABLE_QUEUE(_q) AR5K_QCU_GLOBAL_WRITE(AR5K_QCU_TXE, _q)
+#define AR5K_QUEUE_ENABLED(_q) AR5K_QCU_GLOBAL_READ(AR5K_QCU_TXE, _q)
+
+/*
+ * QCU Transmit disable register
+ */
+#define AR5K_QCU_TXD 0x0880
+#define AR5K_DISABLE_QUEUE(_q) AR5K_QCU_GLOBAL_WRITE(AR5K_QCU_TXD, _q)
+#define AR5K_QUEUE_DISABLED(_q) AR5K_QCU_GLOBAL_READ(AR5K_QCU_TXD, _q)
+
+/*
+ * QCU Constant Bit Rate configuration registers
+ */
+#define AR5K_QCU_CBRCFG_BASE 0x08c0 /*Register Address - Queue0 CBRCFG*/
+#define AR5K_QCU_CBRCFG_INTVAL 0x00ffffff /*CBR Interval mask*/
+#define AR5K_QCU_CBRCFG_INTVAL_S 0
+#define AR5K_QCU_CBRCFG_ORN_THRES 0xff000000 /*CBR overrun threshold mask*/
+#define AR5K_QCU_CBRCFG_ORN_THRES_S 24
+#define AR5K_QUEUE_CBRCFG(_q) AR5K_QUEUE_REG(AR5K_QCU_CBRCFG_BASE, _q)
+
+/*
+ * QCU Ready time configuration registers
+ */
+#define AR5K_QCU_RDYTIMECFG_BASE 0x0900 /*Register Address - Queue0 RDYTIMECFG*/
+#define AR5K_QCU_RDYTIMECFG_INTVAL 0x00ffffff /*Ready time interval mask*/
+#define AR5K_QCU_RDYTIMECFG_INTVAL_S 0
+#define AR5K_QCU_RDYTIMECFG_DURATION 0x00ffffff /*Ready time duration mask*/
+#define AR5K_QCU_RDYTIMECFG_ENABLE 0x01000000 /*Ready time enable mask*/
+#define AR5K_QUEUE_RDYTIMECFG(_q) AR5K_QUEUE_REG(AR5K_QCU_RDYTIMECFG_BASE, _q)
+
+/*
+ * QCU one shot arm set registers
+ */
+#define AR5K_QCU_ONESHOTARM_SET 0x0940 /*Register Address -QCU "one shot arm set (?)"*/
+#define AR5K_QCU_ONESHOTARM_SET_M 0x0000ffff
+
+/*
+ * QCU one shot arm clear registers
+ */
+#define AR5K_QCU_ONESHOTARM_CLEAR 0x0980 /*Register Address -QCU "one shot arm clear (?)"*/
+#define AR5K_QCU_ONESHOTARM_CLEAR_M 0x0000ffff
+
+/*
+ * QCU misc registers
+ */
+#define AR5K_QCU_MISC_BASE 0x09c0 /*Register Address -Queue0 MISC*/
+#define AR5K_QCU_MISC_FRSHED_M 0x0000000f /*Frame sheduling mask*/
+#define AR5K_QCU_MISC_FRSHED_ASAP 0 /*ASAP*/
+#define AR5K_QCU_MISC_FRSHED_CBR 1 /*Constant Bit Rate*/
+#define AR5K_QCU_MISC_FRSHED_DBA_GT 2 /*DMA Beacon alert (GaTed ?)*/
+#define AR5K_QCU_MISC_FRSHED_TIM_GT 3
+#define AR5K_QCU_MISC_FRSHED_BCN_SENT_GT 4 /*Beacon sent gated (?)*/
+#define AR5K_QCU_MISC_ONESHOT_ENABLE 0x00000010 /*Oneshot enable*/
+#define AR5K_QCU_MISC_CBREXP 0x00000020 /*CBR expired (normal queue)*/
+#define AR5K_QCU_MISC_CBREXP_BCN 0x00000040 /*CBR expired (beacon queue)*/
+#define AR5K_QCU_MISC_BCN_ENABLE 0x00000080 /*Beacons enabled*/
+#define AR5K_QCU_MISC_CBR_THRES_ENABLE 0x00000100 /*CBR threshold enabled (?)*/
+#define AR5K_QCU_MISC_TXE 0x00000200 /*TXE reset when RDYTIME enalbed (?)*/
+#define AR5K_QCU_MISC_CBR 0x00000400 /*CBR threshold reset (?)*/
+#define AR5K_QCU_MISC_DCU_EARLY 0x00000800 /*DCU reset (?)*/
+#define AR5K_QUEUE_MISC(_q) AR5K_QUEUE_REG(AR5K_QCU_MISC_BASE, _q)
+
+
+/*
+ * QCU status registers
+ */
+#define AR5K_QCU_STS_BASE 0x0a00 /*Register Address - Queue0 STS*/
+#define AR5K_QCU_STS_FRMPENDCNT 0x00000003 /*Frames pending counter*/
+#define AR5K_QCU_STS_CBREXPCNT 0x0000ff00 /*CBR expired counter (?)*/
+#define AR5K_QUEUE_STATUS(_q) AR5K_QUEUE_REG(AR5K_QCU_STS_BASE, _q)
+
+/*
+ * QCU ready time shutdown register
+ */
+#define AR5K_QCU_RDYTIMESHDN 0x0a40
+#define AR5K_QCU_RDYTIMESHDN_M 0x000003ff
+
+/*
+ * QCU compression buffer base registers (5212 only)
+ */
+#define AR5K_QCU_CBB_SELECT 0x0b00
+#define AR5K_QCU_CBB_ADDR 0x0b04
+
+/*
+ * QCU compression buffer configuration register (5212 only)
+ */
+#define AR5K_QCU_CBCFG 0x0b08
+
+
+
+/*
+ * Distributed Coordination Function (DCF) control unit (DCU)
+ * registers (5211/5212)
+ *
+ * These registers control the various characteristics of each queue
+ * for 802.11e (WME) combatibility so they go together with
+ * QCU registers in pairs. For each queue we have a QCU mask register,
+ * (0x1000 - 0x102c), a local-IFS settings register (0x1040 - 0x106c),
+ * a retry limit register (0x1080 - 0x10ac), a channel time register
+ * (0x10c0 - 0x10ec), a misc-settings register (0x1100 - 0x112c) and
+ * a sequence number register (0x1140 - 0x116c). It seems that "global"
+ * registers here afect all queues (see use of DCU_GBL_IFS_SLOT in ar5k).
+ * We use the same macros here for easier register access.
+ *
+ */
+
+/*
+ * DCU QCU mask registers
+ */
+#define AR5K_DCU_QCUMASK_BASE 0x1000 /*Register Address -Queue0 DCU_QCUMASK*/
+#define AR5K_DCU_QCUMASK_M 0x000003ff
+#define AR5K_QUEUE_QCUMASK(_q) AR5K_QUEUE_REG(AR5K_DCU_QCUMASK_BASE, _q)
+
+/*
+ * DCU local Inter Frame Space settings register
+ */
+#define AR5K_DCU_LCL_IFS_BASE 0x1040 /*Register Address -Queue0 DCU_LCL_IFS*/
+#define AR5K_DCU_LCL_IFS_CW_MIN 0x000003ff /*Minimum Contention Window*/
+#define AR5K_DCU_LCL_IFS_CW_MIN_S 0
+#define AR5K_DCU_LCL_IFS_CW_MAX 0x000ffc00 /*Maximum Contention Window*/
+#define AR5K_DCU_LCL_IFS_CW_MAX_S 10
+#define AR5K_DCU_LCL_IFS_AIFS 0x0ff00000 /*Arbitrated Interframe Space*/
+#define AR5K_DCU_LCL_IFS_AIFS_S 20
+#define AR5K_QUEUE_DFS_LOCAL_IFS(_q) AR5K_QUEUE_REG(AR5K_DCU_LCL_IFS_BASE, _q)
+
+/*
+ * DCU retry limit registers
+ */
+#define AR5K_DCU_RETRY_LMT_BASE 0x1080 /*Register Address -Queue0 DCU_RETRY_LMT*/
+#define AR5K_DCU_RETRY_LMT_SH_RETRY 0x0000000f /*Short retry limit mask*/
+#define AR5K_DCU_RETRY_LMT_SH_RETRY_S 0
+#define AR5K_DCU_RETRY_LMT_LG_RETRY 0x000000f0 /*Long retry limit mask*/
+#define AR5K_DCU_RETRY_LMT_LG_RETRY_S 4
+#define AR5K_DCU_RETRY_LMT_SSH_RETRY 0x00003f00 /*Station short retry limit mask (?)*/
+#define AR5K_DCU_RETRY_LMT_SSH_RETRY_S 8
+#define AR5K_DCU_RETRY_LMT_SLG_RETRY 0x000fc000 /*Station long retry limit mask (?)*/
+#define AR5K_DCU_RETRY_LMT_SLG_RETRY_S 14
+#define AR5K_QUEUE_DFS_RETRY_LIMIT(_q) AR5K_QUEUE_REG(AR5K_DCU_RETRY_LMT_BASE, _q)
+
+/*
+ * DCU channel time registers
+ */
+#define AR5K_DCU_CHAN_TIME_BASE 0x10c0 /*Register Address -Queue0 DCU_CHAN_TIME*/
+#define AR5K_DCU_CHAN_TIME_DUR 0x000fffff /*Channel time duration*/
+#define AR5K_DCU_CHAN_TIME_DUR_S 0
+#define AR5K_DCU_CHAN_TIME_ENABLE 0x00100000 /*Enable channel time*/
+#define AR5K_QUEUE_DFS_CHANNEL_TIME(_q) AR5K_QUEUE_REG(AR5K_DCU_CHAN_TIME_BASE, _q)
+
+/*
+ * DCU misc registers
+ *
+ * For some of the registers i couldn't find in the code
+ * (only backoff stuff is there realy) i tried to match the
+ * names with 802.11e parameters etc, so i guess VIRTCOL here
+ * means Virtual Collision and HCFPOLL means Hybrid Coordination
+ * factor Poll (CF- Poll). ARBLOCK_CTL_GLOBAL is used for beacon
+ * queue and CAB queue but i couldn't find any more infos.
+ */
+#define AR5K_DCU_MISC_BASE 0x1100 /*Register Address -Queue0 DCU_MISC*/
+#define AR5K_DCU_MISC_BACKOFF 0x000007ff /*Mask for backoff setting (?)*/
+#define AR5K_DCU_MISC_BACKOFF_FRAG 0x00000200 /*Enable backoff while bursting*/
+#define AR5K_DCU_MISC_HCFPOLL_ENABLE 0x00000800 /*CF - Poll (?)*/
+#define AR5K_DCU_MISC_BACKOFF_PERSIST 0x00001000 /*Persistent backoff (?)*/
+#define AR5K_DCU_MISC_FRMPRFTCH_ENABLE 0x00002000 /*Enable frame pre-fetch (?)*/
+#define AR5K_DCU_MISC_VIRTCOL 0x0000c000 /*Mask for Virtual Collision (?)*/
+#define AR5K_DCU_MISC_VIRTCOL_NORMAL 0
+#define AR5K_DCU_MISC_VIRTCOL_MODIFIED 1
+#define AR5K_DCU_MISC_VIRTCOL_IGNORE 2
+#define AR5K_DCU_MISC_BCN_ENABLE 0x00010000 /*Beacon enable (?)*/
+#define AR5K_DCU_MISC_ARBLOCK_CTL 0x00060000
+#define AR5K_DCU_MISC_ARBLOCK_CTL_S 17
+#define AR5K_DCU_MISC_ARBLOCK_CTL_NONE 0
+#define AR5K_DCU_MISC_ARBLOCK_CTL_INTFRM 1
+#define AR5K_DCU_MISC_ARBLOCK_CTL_GLOBAL 2
+#define AR5K_DCU_MISC_ARBLOCK_IGNORE 0x00080000
+#define AR5K_DCU_MISC_SEQ_NUM_INCR_DIS 0x00100000 /*Disable sequence number increment (?)*/
+#define AR5K_DCU_MISC_POST_FR_BKOFF_DIS 0x00200000 /*Disable post-frame backoff (?)*/
+#define AR5K_DCU_MISC_VIRT_COLL_POLICY 0x00400000 /*Virtual Collision policy (?)*/
+#define AR5K_DCU_MISC_BLOWN_IFS_POLICY 0x00800000
+#define AR5K_DCU_MISC_SEQNUM_CTL 0x01000000 /*Sequence number control (?)*/
+#define AR5K_QUEUE_DFS_MISC(_q) AR5K_QUEUE_REG(AR5K_DCU_MISC_BASE, _q)
+
+/*
+ * DCU frame sequence number registers
+ */
+#define AR5K_DCU_SEQNUM_BASE 0x1140
+#define AR5K_DCU_SEQNUM_M 0x00000fff
+#define AR5K_QUEUE_DFS_SEQNUM(_q) AR5K_QUEUE_REG(AR5K_DCU_SEQNUM_BASE, _q)
+
+/*
+ * DCU global IFS SIFS registers
+ */
+#define AR5K_DCU_GBL_IFS_SIFS 0x1030
+#define AR5K_DCU_GBL_IFS_SIFS_M 0x0000ffff
+
+/*
+ * DCU global IFS slot interval registers
+ */
+#define AR5K_DCU_GBL_IFS_SLOT 0x1070
+#define AR5K_DCU_GBL_IFS_SLOT_M 0x0000ffff
+
+/*
+ * DCU global IFS EIFS registers
+ */
+#define AR5K_DCU_GBL_IFS_EIFS 0x10b0
+#define AR5K_DCU_GBL_IFS_EIFS_M 0x0000ffff
+
+/*
+ * DCU global IFS misc registers
+ */
+#define AR5K_DCU_GBL_IFS_MISC 0x10f0 /*Register Address*/
+#define AR5K_DCU_GBL_IFS_MISC_LFSR_SLICE 0x00000007
+#define AR5K_DCU_GBL_IFS_MISC_TURBO_MODE 0x00000008 /*Turbo mode (?)*/
+#define AR5K_DCU_GBL_IFS_MISC_SIFS_DUR_USEC 0x000003f0 /*SIFS Duration mask (?)*/
+#define AR5K_DCU_GBL_IFS_MISC_USEC_DUR 0x000ffc00
+#define AR5K_DCU_GBL_IFS_MISC_DCU_ARB_DELAY 0x00300000
+
+/*
+ * DCU frame prefetch control register
+ */
+#define AR5K_DCU_FP 0x1230
+
+/*
+ * DCU transmit pause control/status register
+ */
+#define AR5K_DCU_TXP 0x1270 /*Register Address*/
+#define AR5K_DCU_TXP_M 0x000003ff /*Tx pause mask (?)*/
+#define AR5K_DCU_TXP_STATUS 0x00010000 /*Tx pause status (?)*/
+
+/*
+ * DCU transmit filter register
+ */
+#define AR5K_DCU_TX_FILTER 0x1038
+
+/*
+ * DCU clear transmit filter register
+ */
+#define AR5K_DCU_TX_FILTER_CLR 0x143c
+
+/*
+ * DCU set transmit filter register
+ */
+#define AR5K_DCU_TX_FILTER_SET 0x147c
+
+/*
+ * Reset control register
+ *
+ * 4 and 8 are not used in 5211/5212 and
+ * 2 means "baseband reset" on 5211/5212.
+ */
+#define AR5K_RESET_CTL 0x4000 /*Register Address*/
+#define AR5K_RESET_CTL_PCU 0x00000001 /*Protocol Control Unit reset*/
+#define AR5K_RESET_CTL_DMA 0x00000002 /*DMA (Rx/Tx) reset -5210 only*/
+#define AR5K_RESET_CTL_BASEBAND 0x00000002 /*Baseband reset (5211/5212)*/
+#define AR5K_RESET_CTL_MAC 0x00000004 /*MAC reset (PCU+Baseband ?) -5210 only*/
+#define AR5K_RESET_CTL_PHY 0x00000008 /*PHY reset -5210 only*/
+#define AR5K_RESET_CTL_PCI 0x00000010 /*PCI Core reset (interrupts etc)*/
+#define AR5K_RESET_CTL_CHIP (AR5K_RESET_CTL_PCU | AR5K_RESET_CTL_DMA | \
+ AR5K_RESET_CTL_MAC | AR5K_RESET_CTL_PHY)
+
+/*
+ * Sleep control register
+ */
+#define AR5K_SLEEP_CTL 0x4004 /*Register Address*/
+#define AR5K_SLEEP_CTL_SLDUR 0x0000ffff /*Sleep duration mask*/
+#define AR5K_SLEEP_CTL_SLDUR_S 0
+#define AR5K_SLEEP_CTL_SLE 0x00030000 /*Sleep enable mask*/
+#define AR5K_SLEEP_CTL_SLE_S 16
+#define AR5K_SLEEP_CTL_SLE_WAKE 0x00000000 /*Force chip awake*/
+#define AR5K_SLEEP_CTL_SLE_SLP 0x00010000 /*Force chip sleep*/
+#define AR5K_SLEEP_CTL_SLE_ALLOW 0x00020000
+#define AR5K_SLEEP_CTL_SLE_UNITS 0x00000008 /*non 5210*/
+
+/*
+ * Interrupt pending register
+ */
+#define AR5K_INTPEND 0x4008
+#define AR5K_INTPEND_M 0x00000001
+
+/*
+ * Sleep force register
+ */
+#define AR5K_SFR 0x400c
+#define AR5K_SFR_M 0x00000001
+
+/*
+ * PCI configuration register
+ *
+ * (5210) = prop is also pressent at 5210 else it's only
+ * for 5211/5212. Also some props are only present at 5210.
+ */
+#define AR5K_PCICFG 0x4010 /*Register Address*/
+#define AR5K_PCICFG_EEAE 0x00000001 /*Eeprom access enable -5210 only*/
+#define AR5K_PCICFG_CLKRUNEN 0x00000004 /*CLKRUN enable*/
+#define AR5K_PCICFG_EESIZE 0x00000018 /*Mask for EEPROM size*/
+#define AR5K_PCICFG_EESIZE_S 3
+#define AR5K_PCICFG_EESIZE_4K 0 /*4K*/
+#define AR5K_PCICFG_EESIZE_8K 1 /*8K*/
+#define AR5K_PCICFG_EESIZE_16K 2 /*16K*/
+#define AR5K_PCICFG_EESIZE_FAIL 3 /*Failed to get size (?)*/
+#define AR5K_PCICFG_LED 0x00000060 /*Led status*/
+#define AR5K_PCICFG_LED_NONE 0x00000000 /*Default*/
+#define AR5K_PCICFG_LED_PEND 0x00000020 /*Scan / Auth pending (5210)*/
+#define AR5K_PCICFG_LED_ASSOC 0x00000040 /*Associated (5210)*/
+#define AR5K_PCICFG_BUS_SEL 0x00000380 /*Mask for "bus select" (?)*/
+#define AR5K_PCICFG_CBEFIX_DIS 0x00000400 /*Disable CBE fix (?)*/
+#define AR5K_PCICFG_SL_INTEN 0x00000800 /*Enable interrupts when asleep (?) (5210)*/
+#define AR5K_PCICFG_LED_BCTL 0x00001000 /*Led blink (?) -5210 only*/
+#define AR5K_PCICFG_SL_INPEN 0x00002800 /*Sleep even whith pending interrupts (?) (5210)*/
+#define AR5K_PCICFG_SPWR_DN 0x00010000 /*Mask for power status (5210)*/
+#define AR5K_PCICFG_LEDMODE 0x000e0000 /*Ledmode*/
+#define AR5K_PCICFG_LEDMODE_PROP 0x00000000 /*Blink on standard traffic*/
+#define AR5K_PCICFG_LEDMODE_PROM 0x00020000 /*Default mode (blink on any traffic)*/
+#define AR5K_PCICFG_LEDMODE_PWR 0x00040000 /*Some other blinking mode (?)*/
+#define AR5K_PCICFG_LEDMODE_RAND 0x00060000 /*Random blinking (?)*/
+#define AR5K_PCICFG_LEDBLINK 0x00700000
+#define AR5K_PCICFG_LEDBLINK_S 20
+#define AR5K_PCICFG_LEDSLOW 0x00800000 /*Slow led blink rate (?)*/
+#define AR5K_PCICFG_LEDSTATE \
+ (AR5K_PCICFG_LED | AR5K_PCICFG_LEDMODE | \
+ AR5K_PCICFG_LEDBLINK | AR5K_PCICFG_LEDSLOW)
+
+/*
+ * "General Purpose Input/Output" (GPIO) control register
+ *
+ * I'm not sure about this but after looking at the code
+ * for all chipsets here is what i got.
+ *
+ * We have 6 GPIOs (pins), each GPIO has 4 modes (2 bits)
+ * Mode 0 -> always input
+ * Mode 1 -> output when GPIODO for this GPIO is set to 0
+ * Mode 2 -> output when GPIODO for this GPIO is set to 1
+ * Mode 3 -> always output
+ *
+ * For more infos check out get_gpio/set_gpio and
+ * set_gpio_input/set_gpio_output functs.
+ * For more infos on gpio interrupt check out set_gpio_intr.
+ */
+#define AR5K_NUM_GPIO 6
+
+#define AR5K_GPIOCR 0x4014 /*Register Address*/
+#define AR5K_GPIOCR_INT_ENA 0x00008000 /*Enable GPIO interrupt*/
+#define AR5K_GPIOCR_INT_SELL 0x00000000 /*Generate interrupt when pin is off (?)*/
+#define AR5K_GPIOCR_INT_SELH 0x00010000 /*Generate interrupt when pin is on*/
+#define AR5K_GPIOCR_IN(n) (0 << ((n) * 2)) /*Mode 0 for pin n*/
+#define AR5K_GPIOCR_OUT0(n) (1 << ((n) * 2)) /*Mode 1 for pin n*/
+#define AR5K_GPIOCR_OUT1(n) (2 << ((n) * 2)) /*Mode 2 for pin n*/
+#define AR5K_GPIOCR_OUT(n) (3 << ((n) * 2)) /*Mode 3 for pin n*/
+#define AR5K_GPIOCR_INT_SEL(n) ((n) << 12) /*Interrupt for GPIO pin n*/
+
+/*
+ * "General Purpose Input/Output" (GPIO) data output register
+ */
+#define AR5K_GPIODO 0x4018
+
+/*
+ * "General Purpose Input/Output" (GPIO) data input register
+ */
+#define AR5K_GPIODI 0x401c
+#define AR5K_GPIODI_M 0x0000002f
+
+
+/*
+ * Silicon revision register
+ */
+#define AR5K_SREV 0x4020 /*Register Address*/
+#define AR5K_SREV_REV 0x0000000f /*Mask for revision*/
+#define AR5K_SREV_REV_S 0
+#define AR5K_SREV_VER 0x000000ff /*Mask for version*/
+#define AR5K_SREV_VER_S 4
+
+
+
+/*====EEPROM REGISTERS====*/
+
+/*
+ * EEPROM access registers
+ *
+ * Here we got a difference between 5210/5211-12
+ * read data register for 5210 is at 0x6800 and
+ * status register is at 0x6c00. There is also
+ * no eeprom command register on 5210 and the
+ * offsets are different.
+ *
+ * To read eeprom data for a specific offset:
+ * 5210 - enable eeprom access (AR5K_PCICFG_EEAE)
+ * read AR5K_EEPROM_BASE +(4 * offset)
+ * check the eeprom status register
+ * and read eeprom data register.
+ *
+ * 5211 - write offset to AR5K_EEPROM_BASE
+ * 5212 write AR5K_EEPROM_CMD_READ on AR5K_EEPROM_CMD
+ * check the eeprom status register
+ * and read eeprom data register.
+ *
+ * To write eeprom data for a specific offset:
+ * 5210 - enable eeprom access (AR5K_PCICFG_EEAE)
+ * write data to AR5K_EEPROM_BASE +(4 * offset)
+ * check the eeprom status register
+ * 5211 - write AR5K_EEPROM_CMD_RESET on AR5K_EEPROM_CMD
+ * 5212 write offset to AR5K_EEPROM_BASE
+ * write data to data register
+ * write AR5K_EEPROM_CMD_WRITE on AR5K_EEPROM_CMD
+ * check the eeprom status register
+ *
+ * For more infos check eeprom_* functs and the ar5k.c
+ * file posted in madwifi-devel mailing list.
+ * http://sourceforge.net/mailarchive/message.php?msg_id=8966525
+ *
+ */
+#define AR5K_EEPROM_BASE 0x6000
+
+/*
+ * Common ar5xxx EEPROM data offset (set these on AR5K_EEPROM_BASE)
+ */
+#define AR5K_EEPROM_MAGIC 0x003d
+#define AR5K_EEPROM_MAGIC_VALUE 0x5aa5
+#define AR5K_EEPROM_MAGIC_5212 0x0000145c /* 5212 */
+#define AR5K_EEPROM_MAGIC_5211 0x0000145b /* 5211 */
+#define AR5K_EEPROM_MAGIC_5210 0x0000145a /* 5210 */
+
+#define AR5K_EEPROM_PROTECT 0x003f
+#define AR5K_EEPROM_PROTECT_RD_0_31 0x0001
+#define AR5K_EEPROM_PROTECT_WR_0_31 0x0002
+#define AR5K_EEPROM_PROTECT_RD_32_63 0x0004
+#define AR5K_EEPROM_PROTECT_WR_32_63 0x0008
+#define AR5K_EEPROM_PROTECT_RD_64_127 0x0010
+#define AR5K_EEPROM_PROTECT_WR_64_127 0x0020
+#define AR5K_EEPROM_PROTECT_RD_128_191 0x0040
+#define AR5K_EEPROM_PROTECT_WR_128_191 0x0080
+#define AR5K_EEPROM_PROTECT_RD_192_207 0x0100
+#define AR5K_EEPROM_PROTECT_WR_192_207 0x0200
+#define AR5K_EEPROM_PROTECT_RD_208_223 0x0400
+#define AR5K_EEPROM_PROTECT_WR_208_223 0x0800
+#define AR5K_EEPROM_PROTECT_RD_224_239 0x1000
+#define AR5K_EEPROM_PROTECT_WR_224_239 0x2000
+#define AR5K_EEPROM_PROTECT_RD_240_255 0x4000
+#define AR5K_EEPROM_PROTECT_WR_240_255 0x8000
+#define AR5K_EEPROM_REG_DOMAIN 0x00bf
+#define AR5K_EEPROM_INFO_BASE 0x00c0
+#define AR5K_EEPROM_INFO_MAX (0x400 - AR5K_EEPROM_INFO_BASE)
+#define AR5K_EEPROM_INFO_CKSUM 0xffff
+#define AR5K_EEPROM_INFO(_n) (AR5K_EEPROM_INFO_BASE + (_n))
+
+#define AR5K_EEPROM_VERSION AR5K_EEPROM_INFO(1)
+#define AR5K_EEPROM_VERSION_3_0 0x3000
+#define AR5K_EEPROM_VERSION_3_1 0x3001
+#define AR5K_EEPROM_VERSION_3_2 0x3002
+#define AR5K_EEPROM_VERSION_3_3 0x3003
+#define AR5K_EEPROM_VERSION_3_4 0x3004
+#define AR5K_EEPROM_VERSION_4_0 0x4000
+#define AR5K_EEPROM_VERSION_4_1 0x4001
+#define AR5K_EEPROM_VERSION_4_2 0x4002
+#define AR5K_EEPROM_VERSION_4_3 0x4003
+#define AR5K_EEPROM_VERSION_4_6 0x4006
+#define AR5K_EEPROM_VERSION_4_7 0x3007
+
+#define AR5K_EEPROM_MODE_11A 0
+#define AR5K_EEPROM_MODE_11B 1
+#define AR5K_EEPROM_MODE_11G 2
+
+#define AR5K_EEPROM_HDR AR5K_EEPROM_INFO(2)
+#define AR5K_EEPROM_HDR_11A(_v) (((_v) >> AR5K_EEPROM_MODE_11A) & 0x1)
+#define AR5K_EEPROM_HDR_11B(_v) (((_v) >> AR5K_EEPROM_MODE_11B) & 0x1)
+#define AR5K_EEPROM_HDR_11G(_v) (((_v) >> AR5K_EEPROM_MODE_11G) & 0x1)
+#define AR5K_EEPROM_HDR_T_2GHZ_DIS(_v) (((_v) >> 3) & 0x1)
+#define AR5K_EEPROM_HDR_T_5GHZ_DBM(_v) (((_v) >> 4) & 0x7f)
+#define AR5K_EEPROM_HDR_DEVICE(_v) (((_v) >> 11) & 0x7)
+#define AR5K_EEPROM_HDR_T_5GHZ_DIS(_v) (((_v) >> 15) & 0x1)
+#define AR5K_EEPROM_HDR_RFKILL(_v) (((_v) >> 14) & 0x1)
+
+#define AR5K_EEPROM_RFKILL_GPIO_SEL 0x0000001c
+#define AR5K_EEPROM_RFKILL_GPIO_SEL_S 2
+#define AR5K_EEPROM_RFKILL_POLARITY 0x00000002
+#define AR5K_EEPROM_RFKILL_POLARITY_S 1
+
+/* Newer EEPROMs are using a different offset */
+#define AR5K_EEPROM_OFF(_v, _v3_0, _v3_3) \
+ (((_v) >= AR5K_EEPROM_VERSION_3_3) ? _v3_3 : _v3_0)
+
+#define AR5K_EEPROM_ANT_GAIN(_v) AR5K_EEPROM_OFF(_v, 0x00c4, 0x00c3)
+#define AR5K_EEPROM_ANT_GAIN_5GHZ(_v) ((int8_t)(((_v) >> 8) & 0xff))
+#define AR5K_EEPROM_ANT_GAIN_2GHZ(_v) ((int8_t)((_v) & 0xff))
+
+#define AR5K_EEPROM_MODES_11A(_v) AR5K_EEPROM_OFF(_v, 0x00c5, 0x00d4)
+#define AR5K_EEPROM_MODES_11B(_v) AR5K_EEPROM_OFF(_v, 0x00d0, 0x00f2)
+#define AR5K_EEPROM_MODES_11G(_v) AR5K_EEPROM_OFF(_v, 0x00da, 0x010d)
+#define AR5K_EEPROM_CTL(_v) AR5K_EEPROM_OFF(_v, 0x00e4, 0x0128)
+
+/* Since 3.1 */
+#define AR5K_EEPROM_OBDB0_2GHZ 0x00ec
+#define AR5K_EEPROM_OBDB1_2GHZ 0x00ed
+
+/* Misc values available since EEPROM 4.0 */
+#define AR5K_EEPROM_MISC0 0x00c4
+#define AR5K_EEPROM_EARSTART(_v) ((_v) & 0xfff)
+#define AR5K_EEPROM_EEMAP(_v) (((_v) >> 14) & 0x3)
+#define AR5K_EEPROM_MISC1 0x00c5
+#define AR5K_EEPROM_TARGET_PWRSTART(_v) ((_v) & 0xfff)
+#define AR5K_EEPROM_HAS32KHZCRYSTAL(_v) (((_v) >> 14) & 0x1)
+
+/*
+ * EEPROM data register
+ */
+#define AR5K_EEPROM_DATA_5211 0x6004
+#define AR5K_EEPROM_DATA_5210 0x6800
+#define AR5K_EEPROM_DATA (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_EEPROM_DATA_5210 : AR5K_EEPROM_DATA_5211)
+
+/*
+ * EEPROM command register
+ */
+#define AR5K_EEPROM_CMD 0x6008 /*Register Addres*/
+#define AR5K_EEPROM_CMD_READ 0x00000001 /*EEPROM read*/
+#define AR5K_EEPROM_CMD_WRITE 0x00000002 /*EEPROM write*/
+#define AR5K_EEPROM_CMD_RESET 0x00000004 /*EEPROM reset*/
+
+/*
+ * EEPROM status register
+ */
+#define AR5K_EEPROM_STAT_5210 0x6c00 /*Register Address -5210*/
+#define AR5K_EEPROM_STAT_5211 0x600c /*Register Address -5211/5212*/
+#define AR5K_EEPROM_STATUS (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_EEPROM_STAT_5210 : AR5K_EEPROM_STAT_5211)
+#define AR5K_EEPROM_STAT_RDERR 0x00000001 /*EEPROM read failed*/
+#define AR5K_EEPROM_STAT_RDDONE 0x00000002 /*EEPROM read successful*/
+#define AR5K_EEPROM_STAT_WRERR 0x00000004 /*EEPROM write failed*/
+#define AR5K_EEPROM_STAT_WRDONE 0x00000008 /*EEPROM write successful*/
+
+/*
+ * EEPROM config register (?)
+ */
+#define AR5K_EEPROM_CFG 0x6010
+
+
+
+/*
+ * Protocol Control Unit (PCU) registers
+ */
+/*Used for checking initial register writes during channel reset (see reset func)*/
+#define AR5K_PCU_MIN 0x8000
+#define AR5K_PCU_MAX 0x8fff
+
+/*
+ * First station id register (MAC address in lower 32 bits)
+ */
+#define AR5K_STA_ID0 0x8000
+
+/*
+ * Second station id register (MAC address in upper 16 bits)
+ */
+#define AR5K_STA_ID1 0x8004 /*Register Address*/
+#define AR5K_STA_ID1_AP 0x00010000 /*Set AP mode*/
+#define AR5K_STA_ID1_ADHOC 0x00020000 /*Set Ad-Hoc mode*/
+#define AR5K_STA_ID1_PWR_SV 0x00040000 /*Power save reporting (?)*/
+#define AR5K_STA_ID1_NO_KEYSRCH 0x00080000 /*No key search*/
+#define AR5K_STA_ID1_NO_PSPOLL 0x00100000 /*No uapsd polling -5210 only*/
+#define AR5K_STA_ID1_PCF_5211 0x00100000 /*Enable PCF on 5211/5212*/
+#define AR5K_STA_ID1_PCF_5210 0x00200000 /*Enable PCF on 5210*/
+#define AR5K_STA_ID1_PCF (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_STA_ID1_PCF_5210 : AR5K_STA_ID1_PCF_5211)
+#define AR5K_STA_ID1_DEFAULT_ANTENNA 0x00200000 /*Use default antenna on 5211/5212*/
+#define AR5K_STA_ID1_DESC_ANTENNA 0x00400000 /*Update antenna from descriptor*/
+#define AR5K_STA_ID1_RTS_DEF_ANTENNA 0x00800000 /*Use default antenna for RTS (?)*/
+#define AR5K_STA_ID1_ACKCTS_6MB 0x01000000 /*Use 6Mbit/s for ACK/CTS (?)*/
+#define AR5K_STA_ID1_BASE_RATE_11B 0x02000000 /*Use 11b base rate (for ACK/CTS ?) -non 5210*/
+
+/*
+ * First BSSID register (MAC address, lower 32bits)
+ */
+#define AR5K_BSS_ID0 0x8008
+
+/*
+ * Second BSSID register (MAC address in upper 16 bits)
+ *
+ * AID: Association ID
+ */
+#define AR5K_BSS_ID1 0x800c
+#define AR5K_BSS_ID1_AID 0xffff0000
+#define AR5K_BSS_ID1_AID_S 16
+
+/*
+ * Backoff slot time register
+ */
+#define AR5K_SLOT_TIME 0x8010
+
+/*
+ * ACK/CTS timeout register
+ */
+#define AR5K_TIME_OUT 0x8014 /*Register Address*/
+#define AR5K_TIME_OUT_ACK 0x00001fff /*ACK timeout mask*/
+#define AR5K_TIME_OUT_ACK_S 0
+#define AR5K_TIME_OUT_CTS 0x1fff0000 /*CTS timeout mask*/
+#define AR5K_TIME_OUT_CTS_S 16
+
+/*
+ * RSSI threshold register
+ */
+#define AR5K_RSSI_THR 0x8018 /*Register Address*/
+#define AR5K_RSSI_THR_M 0x000000ff /*Mask for RSSI threshold -non 5210*/
+#define AR5K_RSSI_THR_BMISS_5210 0x00000700 /*Mask for Beacon Missed threshold -5210*/
+#define AR5K_RSSI_THR_BMISS_5210_S 8
+#define AR5K_RSSI_THR_BMISS_5211 0x0000ff00 /*Mask for Beacon Missed threshold -5211/5212*/
+#define AR5K_RSSI_THR_BMISS_5211_S 8
+#define AR5K_RSSI_THR_BMISS (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_RSSI_THR_BMISS_5210 : AR5K_RSSI_THR_BMISS_5211)
+#define AR5K_RSSI_THR_BMISS_S 8
+
+/*
+ * 5210 has more PCU registers because there is no QCU/DCU
+ * so queue parameters are set here, this way a lot common
+ * registers have different address for 5210. To make things
+ * easier we define a macro based on hal->ah_version for common
+ * registers with different addresses and common flags.
+ */
+
+/*
+ * Retry limit register
+ *
+ * Retry limit register for 5210 (no QCU/DCU so it's done in PCU)
+ */
+#define AR5K_NODCU_RETRY_LMT 0x801c /*Register Address*/
+#define AR5K_NODCU_RETRY_LMT_SH_RETRY 0x0000000f /*Short retry limit mask*/
+#define AR5K_NODCU_RETRY_LMT_SH_RETRY_S 0
+#define AR5K_NODCU_RETRY_LMT_LG_RETRY 0x000000f0 /*Long retry mask*/
+#define AR5K_NODCU_RETRY_LMT_LG_RETRY_S 4
+#define AR5K_NODCU_RETRY_LMT_SSH_RETRY 0x00003f00 /*Station short retry limit mask*/
+#define AR5K_NODCU_RETRY_LMT_SSH_RETRY_S 8
+#define AR5K_NODCU_RETRY_LMT_SLG_RETRY 0x000fc000 /*Station long retry limit mask*/
+#define AR5K_NODCU_RETRY_LMT_SLG_RETRY_S 14
+#define AR5K_NODCU_RETRY_LMT_CW_MIN 0x3ff00000 /*Minimum contention window mask*/
+#define AR5K_NODCU_RETRY_LMT_CW_MIN_S 20
+
+/*
+ * Transmit latency register
+ */
+#define AR5K_USEC_5210 0x8020 /*Register Address (5210)*/
+#define AR5K_USEC_5211 0x801c /*Register Address (5211/5212)*/
+#define AR5K_USEC (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_USEC_5210 : AR5K_USEC_5211)
+#define AR5K_USEC_1 0x0000007f
+#define AR5K_USEC_1_S 0
+#define AR5K_USEC_32 0x00003f80
+#define AR5K_USEC_32_S 7
+#define AR5K_USEC_TX_LATENCY_5211 0x007fc000
+#define AR5K_USEC_TX_LATENCY_5211_S 14
+#define AR5K_USEC_RX_LATENCY_5211 0x1f800000
+#define AR5K_USEC_RX_LATENCY_5211_S 23
+#define AR5K_USEC_TX_LATENCY_5210 0x000fc000 /*also for 5311*/
+#define AR5K_USEC_TX_LATENCY_5210_S 14
+#define AR5K_USEC_RX_LATENCY_5210 0x03f00000 /*also for 5311*/
+#define AR5K_USEC_RX_LATENCY_5210_S 20
+
+/*
+ * PCU beacon control register
+ */
+#define AR5K_BEACON_5210 0x8024
+#define AR5K_BEACON_5211 0x8020
+#define AR5K_BEACON (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_BEACON_5210 : AR5K_BEACON_5211)
+#define AR5K_BEACON_PERIOD 0x0000ffff
+#define AR5K_BEACON_PERIOD_S 0
+#define AR5K_BEACON_TIM 0x007f0000
+#define AR5K_BEACON_TIM_S 16
+#define AR5K_BEACON_ENABLE 0x00800000
+#define AR5K_BEACON_RESET_TSF 0x01000000
+
+/*
+ * CFP period register
+ */
+#define AR5K_CFP_PERIOD_5210 0x8028
+#define AR5K_CFP_PERIOD_5211 0x8024
+#define AR5K_CFP_PERIOD (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_CFP_PERIOD_5210 : AR5K_CFP_PERIOD_5211)
+
+/*
+ * Next beacon time register
+ */
+#define AR5K_TIMER0_5210 0x802c
+#define AR5K_TIMER0_5211 0x8028
+#define AR5K_TIMER0 (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_TIMER0_5210 : AR5K_TIMER0_5211)
+
+/*
+ * Next DMA beacon alert register
+ */
+#define AR5K_TIMER1_5210 0x8030
+#define AR5K_TIMER1_5211 0x802c
+#define AR5K_TIMER1 (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_TIMER1_5210 : AR5K_TIMER1_5211)
+
+/*
+ * Next software beacon alert register
+ */
+#define AR5K_TIMER2_5210 0x8034
+#define AR5K_TIMER2_5211 0x8030
+#define AR5K_TIMER2 (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_TIMER2_5210 : AR5K_TIMER2_5211)
+
+/*
+ * Next ATIM window time register
+ */
+#define AR5K_TIMER3_5210 0x8038
+#define AR5K_TIMER3_5211 0x8034
+#define AR5K_TIMER3 (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_TIMER3_5210 : AR5K_TIMER3_5211)
+
+
+/*
+ * 5210 First inter frame spacing register (IFS)
+ */
+#define AR5K_IFS0 0x8040
+#define AR5K_IFS0_SIFS 0x000007ff
+#define AR5K_IFS0_SIFS_S 0
+#define AR5K_IFS0_DIFS 0x007ff800
+#define AR5K_IFS0_DIFS_S 11
+
+/*
+ * 5210 Second inter frame spacing register (IFS)
+ */
+#define AR5K_IFS1 0x8044
+#define AR5K_IFS1_PIFS 0x00000fff
+#define AR5K_IFS1_PIFS_S 0
+#define AR5K_IFS1_EIFS 0x03fff000
+#define AR5K_IFS1_EIFS_S 12
+#define AR5K_IFS1_CS_EN 0x04000000
+
+
+/*
+ * CFP duration register
+ */
+#define AR5K_CFP_DUR_5210 0x8048
+#define AR5K_CFP_DUR_5211 0x8038
+#define AR5K_CFP_DUR (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_CFP_DUR_5210 : AR5K_CFP_DUR_5211)
+
+/*
+ * Receive filter register
+ * TODO: Get these out of ar5xxx.h on ath5k
+ */
+#define AR5K_RX_FILTER_5210 0x804c /*Register Address (521)*/
+#define AR5K_RX_FILTER_5211 0x803c /*Register Address (5211/5212)*/
+#define AR5K_RX_FILTER (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_RX_FILTER_5210 : AR5K_RX_FILTER_5211)
+#define AR5K_RX_FILTER_UCAST 0x00000001 /* Don't filter unicast frames */
+#define AR5K_RX_FILTER_MCAST 0x00000002 /* Don't filter multicast frames */
+#define AR5K_RX_FILTER_BCAST 0x00000004 /* Don't filter broadcast frames */
+#define AR5K_RX_FILTER_CONTROL 0x00000008 /* Don't filter control frames */
+#define AR5K_RX_FILTER_BEACON 0x00000010 /* Don't filter beacon frames */
+#define AR5K_RX_FILTER_PROM 0x00000020 /* Set promiscuous mode */
+#define AR5K_RX_FILTER_XRPOLL 0x00000040 /* Don't filter XR poll frame -5212 only*/
+#define AR5K_RX_FILTER_PROBEREQ 0x00000080 /* Don't filter probe requests -5212 only*/
+#define AR5K_RX_FILTER_PHYERR_5212 0x00000100 /* Don't filter phy errors */
+#define AR5K_RX_FILTER_RADARERR_5212 0x00000200 /* Don't filter phy radar errors*/
+#define AR5K_RX_FILTER_PHYERR_5211 0x00000040 /*5211 only*/
+#define AR5K_RX_FILTER_RADARERR_5211 0x00000080 /*5211 only*/
+#define AR5K_RX_FILTER_PHYERR (hal->ah_version == AR5K_AR5211 ? \
+ AR5K_RX_FILTER_PHYERR_5211 : AR5K_RX_FILTER_PHYERR_5212)
+#define AR5K_RX_FILTER_RADARERR (hal->ah_version == AR5K_AR5211 ? \
+ AR5K_RX_FILTER_RADARERR_5211 : AR5K_RX_FILTER_RADARERR_5212)
+/*
+ * Multicast filter register (lower 32 bits)
+ */
+#define AR5K_MCAST_FILTER0_5210 0x8050
+#define AR5K_MCAST_FILTER0_5211 0x8040
+#define AR5K_MCAST_FILTER0 (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_MCAST_FILTER0_5210 : AR5K_MCAST_FILTER0_5211)
+
+/*
+ * Multicast filter register (higher 16 bits)
+ */
+#define AR5K_MCAST_FILTER1_5210 0x8054
+#define AR5K_MCAST_FILTER1_5211 0x8044
+#define AR5K_MCAST_FILTER1 (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_MCAST_FILTER1_5210 : AR5K_MCAST_FILTER1_5211)
+
+
+/*
+ * Transmit mask register (lower 32 bits) (5210)
+ */
+#define AR5K_TX_MASK0 0x8058
+
+/*
+ * Transmit mask register (higher 16 bits) (5210)
+ */
+#define AR5K_TX_MASK1 0x805c
+
+/*
+ * Clear transmit mask (5210)
+ */
+#define AR5K_CLR_TMASK 0x8060
+
+/*
+ * Trigger level register (before transmission) (5210)
+ */
+#define AR5K_TRIG_LVL 0x8064
+
+
+/*
+ * PCU control register
+ *
+ * Only DIS_RX is used in the code, the rest i guess are
+ * for tweaking/diagnostics.
+ */
+#define AR5K_DIAG_SW_5210 0x8068 /*Register Address (5210)*/
+#define AR5K_DIAG_SW_5211 0x8048 /*Register Address (5211/5212)*/
+#define AR5K_DIAG_SW (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_DIAG_SW_5210 : AR5K_DIAG_SW_5211)
+#define AR5K_DIAG_SW_DIS_WEP_ACK 0x00000001
+#define AR5K_DIAG_SW_DIS_ACK 0x00000002 /*Disable ACKs (?)*/
+#define AR5K_DIAG_SW_DIS_CTS 0x00000004 /*Disable CTSs (?)*/
+#define AR5K_DIAG_SW_DIS_ENC 0x00000008 /*Disable encryption (?)*/
+#define AR5K_DIAG_SW_DIS_DEC 0x00000010 /*Disable decryption (?)*/
+#define AR5K_DIAG_SW_DIS_TX 0x00000020 /*Disable transmit -5210 only*/
+#define AR5K_DIAG_SW_DIS_RX_5210 0x00000040 /*Disable recieve*/
+#define AR5K_DIAG_SW_DIS_RX_5211 0x00000020
+#define AR5K_DIAG_SW_DIS_RX (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_DIAG_SW_DIS_RX_5210 : AR5K_DIAG_SW_DIS_RX_5211)
+#define AR5K_DIAG_SW_LOOP_BACK_5210 0x00000080 /*Loopback (i guess it goes with DIS_TX) -5210 only*/
+#define AR5K_DIAG_SW_LOOP_BACK_5211 0x00000040
+#define AR5K_DIAG_SW_LOOP_BACK (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_DIAG_SW_LOOP_BACK_5210 : AR5K_DIAG_SW_LOOP_BACK_5211)
+#define AR5K_DIAG_SW_CORR_FCS_5210 0x00000100
+#define AR5K_DIAG_SW_CORR_FCS_5211 0x00000080
+#define AR5K_DIAG_SW_CORR_FCS (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_DIAG_SW_CORR_FCS_5210 : AR5K_DIAG_SW_CORR_FCS_5211)
+#define AR5K_DIAG_SW_CHAN_INFO_5210 0x00000200
+#define AR5K_DIAG_SW_CHAN_INFO_5211 0x00000100
+#define AR5K_DIAG_SW_CHAN_INFO (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_DIAG_SW_CHAN_INFO_5210 : AR5K_DIAG_SW_CHAN_INFO_5211)
+#define AR5K_DIAG_SW_EN_SCRAM_SEED_5211 0x00000200 /*Scrambler seed (?)*/
+#define AR5K_DIAG_SW_EN_SCRAM_SEED_5210 0x00000400
+#define AR5K_DIAG_SW_EN_SCRAM_SEED (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_DIAG_SW_EN_SCRAM_SEED_5210 : AR5K_DIAG_SW_EN_SCRAM_SEED_5211)
+#define AR5K_DIAG_SW_ECO_ENABLE 0x00000400 /*non 5210*/
+#define AR5K_DIAG_SW_SCVRAM_SEED 0x0003f800 /*5210 only*/
+#define AR5K_DIAG_SW_SCRAM_SEED_M 0x0001fc00 /*Scrambler seed mask (?)*/
+#define AR5K_DIAG_SW_SCRAM_SEED_S 10
+#define AR5K_DIAG_SW_DIS_SEQ_INC 0x00040000 /*Disable seqnum increment (?)-5210 only*/
+#define AR5K_DIAG_SW_FRAME_NV0_5210 0x00080000
+#define AR5K_DIAG_SW_FRAME_NV0_5211 0x00020000
+#define AR5K_DIAG_SW_FRAME_NV0 (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_DIAG_SW_FRAME_NV0_5210 : AR5K_DIAG_SW_FRAME_NV0_5211)
+#define AR5K_DIAG_SW_OBSPT_M 0x000c0000
+#define AR5K_DIAG_SW_OBSPT_S 18
+
+/*
+ * TSF (clock) register (lower 32 bits)
+ */
+#define AR5K_TSF_L32_5210 0x806c
+#define AR5K_TSF_L32_5211 0x804c
+#define AR5K_TSF_L32 (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_TSF_L32_5210 : AR5K_TSF_L32_5211)
+
+/*
+ * TSF (clock) register (higher 32 bits)
+ */
+#define AR5K_TSF_U32_5210 0x8070
+#define AR5K_TSF_U32_5211 0x8050
+#define AR5K_TSF_U32 (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_TSF_U32_5210 : AR5K_TSF_U32_5211)
+
+/*
+ * Last beacon timestamp register
+ */
+#define AR5K_LAST_TSTP 0x8080
+
+/*
+ * ADDAC test register (5211/5212)
+ */
+#define AR5K_ADDAC_TEST 0x8054
+
+/*
+ * Default antenna register (5211/5212)
+ */
+#define AR5K_DEFAULT_ANTENNA 0x8058
+
+
+
+/*
+ * Retry count register (5210)
+ */
+#define AR5K_RETRY_CNT 0x8084 /*Register Address (5210)*/
+#define AR5K_RETRY_CNT_SSH 0x0000003f /*Station short retry count (?)*/
+#define AR5K_RETRY_CNT_SLG 0x00000fc0 /*Station long retry count (?)*/
+
+/*
+ * Back-off status register (5210)
+ */
+#define AR5K_BACKOFF 0x8088 /*Register Address (5210)*/
+#define AR5K_BACKOFF_CW 0x000003ff /*Backoff Contention Window (?)*/
+#define AR5K_BACKOFF_CNT 0x03ff0000 /*Backoff count (?)*/
+
+
+
+/*
+ * NAV register (current)
+ */
+#define AR5K_NAV_5210 0x808c
+#define AR5K_NAV_5211 0x8084
+#define AR5K_NAV (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_NAV_5210 : AR5K_NAV_5211)
+
+/*
+ * RTS success register
+ */
+#define AR5K_RTS_OK_5210 0x8090
+#define AR5K_RTS_OK_5211 0x8088
+#define AR5K_RTS_OK (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_RTS_OK_5210 : AR5K_RTS_OK_5211)
+
+/*
+ * RTS failure register
+ */
+#define AR5K_RTS_FAIL_5210 0x8094
+#define AR5K_RTS_FAIL_5211 0x808c
+#define AR5K_RTS_FAIL (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_RTS_FAIL_5210 : AR5K_RTS_FAIL_5211)
+
+/*
+ * ACK failure register
+ */
+#define AR5K_ACK_FAIL_5210 0x8098
+#define AR5K_ACK_FAIL_5211 0x8090
+#define AR5K_ACK_FAIL (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_ACK_FAIL_5210 : AR5K_ACK_FAIL_5211)
+
+/*
+ * FCS failure register
+ */
+#define AR5K_FCS_FAIL_5210 0x809c
+#define AR5K_FCS_FAIL_5211 0x8094
+#define AR5K_FCS_FAIL (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_FCS_FAIL_5210 : AR5K_FCS_FAIL_5211)
+
+/*
+ * Beacon count register
+ */
+#define AR5K_BEACON_CNT_5210 0x80a0
+#define AR5K_BEACON_CNT_5211 0x8098
+#define AR5K_BEACON_CNT (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_BEACON_CNT_5210 : AR5K_BEACON_CNT_5211)
+
+
+/*===5212 Specific PCU registers===*/
+
+/*
+ * XR (eXtended Range) mode register
+ */
+#define AR5K_XRMODE 0x80c0
+#define AR5K_XRMODE_POLL_TYPE_M 0x0000003f
+#define AR5K_XRMODE_POLL_TYPE_S 0
+#define AR5K_XRMODE_POLL_SUBTYPE_M 0x0000003c
+#define AR5K_XRMODE_POLL_SUBTYPE_S 2
+#define AR5K_XRMODE_POLL_WAIT_ALL 0x00000080
+#define AR5K_XRMODE_SIFS_DELAY 0x000fff00
+#define AR5K_XRMODE_FRAME_HOLD_M 0xfff00000
+#define AR5K_XRMODE_FRAME_HOLD_S 20
+
+/*
+ * XR delay register
+ */
+#define AR5K_XRDELAY 0x80c4
+#define AR5K_XRDELAY_SLOT_DELAY_M 0x0000ffff
+#define AR5K_XRDELAY_SLOT_DELAY_S 0
+#define AR5K_XRDELAY_CHIRP_DELAY_M 0xffff0000
+#define AR5K_XRDELAY_CHIRP_DELAY_S 16
+
+/*
+ * XR timeout register
+ */
+#define AR5K_XRTIMEOUT 0x80c8
+#define AR5K_XRTIMEOUT_CHIRP_M 0x0000ffff
+#define AR5K_XRTIMEOUT_CHIRP_S 0
+#define AR5K_XRTIMEOUT_POLL_M 0xffff0000
+#define AR5K_XRTIMEOUT_POLL_S 16
+
+/*
+ * XR chirp register
+ */
+#define AR5K_XRCHIRP 0x80cc
+#define AR5K_XRCHIRP_SEND 0x00000001
+#define AR5K_XRCHIRP_GAP 0xffff0000
+
+/*
+ * XR stomp register
+ */
+#define AR5K_XRSTOMP 0x80d0
+#define AR5K_XRSTOMP_TX 0x00000001
+#define AR5K_XRSTOMP_RX_ABORT 0x00000002
+#define AR5K_XRSTOMP_RSSI_THRES 0x0000ff00
+
+/*
+ * First enhanced sleep register
+ */
+#define AR5K_SLEEP0 0x80d4
+#define AR5K_SLEEP0_NEXT_DTIM 0x0007ffff
+#define AR5K_SLEEP0_NEXT_DTIM_S 0
+#define AR5K_SLEEP0_ASSUME_DTIM 0x00080000
+#define AR5K_SLEEP0_ENH_SLEEP_EN 0x00100000
+#define AR5K_SLEEP0_CABTO 0xff000000
+#define AR5K_SLEEP0_CABTO_S 24
+
+/*
+ * Second enhanced sleep register
+ */
+#define AR5K_SLEEP1 0x80d8
+#define AR5K_SLEEP1_NEXT_TIM 0x0007ffff
+#define AR5K_SLEEP1_NEXT_TIM_S 0
+#define AR5K_SLEEP1_BEACON_TO 0xff000000
+#define AR5K_SLEEP1_BEACON_TO_S 24
+
+/*
+ * Third enhanced sleep register
+ */
+#define AR5K_SLEEP2 0x80dc
+#define AR5K_SLEEP2_TIM_PER 0x0000ffff
+#define AR5K_SLEEP2_TIM_PER_S 0
+#define AR5K_SLEEP2_DTIM_PER 0xffff0000
+#define AR5K_SLEEP2_DTIM_PER_S 16
+
+/*
+ * BSSID mask registers
+ */
+#define AR5K_BSS_IDM0 0x80e0
+#define AR5K_BSS_IDM1 0x80e4
+
+/*
+ * TX power control (TPC) register
+ */
+#define AR5K_TXPC 0x80e8
+#define AR5K_TXPC_ACK_M 0x0000003f
+#define AR5K_TXPC_ACK_S 0
+#define AR5K_TXPC_CTS_M 0x00003f00
+#define AR5K_TXPC_CTS_S 8
+#define AR5K_TXPC_CHIRP_M 0x003f0000
+#define AR5K_TXPC_CHIRP_S 22
+
+/*
+ * Profile count registers
+ */
+#define AR5K_PROFCNT_TX 0x80ec
+#define AR5K_PROFCNT_RX 0x80f0
+#define AR5K_PROFCNT_RXCLR 0x80f4
+#define AR5K_PROFCNT_CYCLE 0x80f8
+
+/*
+ * TSF parameter register
+ */
+#define AR5K_TSF_PARM 0x8104
+#define AR5K_TSF_PARM_INC_M 0x000000ff
+#define AR5K_TSF_PARM_INC_S 0
+
+/*
+ * PHY error filter register
+ */
+#define AR5K_PHY_ERR_FIL 0x810c
+#define AR5K_PHY_ERR_FIL_RADAR 0x00000020
+#define AR5K_PHY_ERR_FIL_OFDM 0x00020000
+#define AR5K_PHY_ERR_FIL_CCK 0x02000000
+
+/*
+ * Rate duration register
+ */
+#define AR5K_RATE_DUR_BASE 0x8700
+#define AR5K_RATE_DUR(_n) (AR5K_RATE_DUR_BASE + ((_n) << 2))
+
+/*===5212===*/
+
+/*
+ * Key table (WEP) register
+ */
+#define AR5K_KEYTABLE_0_5210 0x9000
+#define AR5K_KEYTABLE_0_5211 0x8800
+#define AR5K_KEYTABLE_5210(_n) (AR5K_KEYTABLE_0_5210 + ((_n) << 5))
+#define AR5K_KEYTABLE_5211(_n) (AR5K_KEYTABLE_0_5211 + ((_n) * 32))
+#define AR5K_KEYTABLE(_n) (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_KEYTABLE_5210(_n) : AR5K_KEYTABLE_5211(_n))
+#define AR5K_KEYTABLE_OFF(_n, x) (AR5K_KEYTABLE(_n) + (x << 2))
+#define AR5K_KEYTABLE_TYPE(_n) AR5K_KEYTABLE_OFF(_n, 5)
+#define AR5K_KEYTABLE_TYPE_40 0x00000000
+#define AR5K_KEYTABLE_TYPE_104 0x00000001
+#define AR5K_KEYTABLE_TYPE_128 0x00000003
+#define AR5K_KEYTABLE_TYPE_TKIP 0x00000004 /*5212*/
+#define AR5K_KEYTABLE_TYPE_AES 0x00000005 /*!5210*/
+#define AR5K_KEYTABLE_TYPE_CCM 0x00000006 /*5212*/
+#define AR5K_KEYTABLE_TYPE_NULL 0x00000007 /*!5210*/
+#define AR5K_KEYTABLE_ANTENNA 0x00000008 /*5212*/
+#define AR5K_KEYTABLE_MAC0(_n) AR5K_KEYTABLE_OFF(_n, 6)
+#define AR5K_KEYTABLE_MAC1(_n) AR5K_KEYTABLE_OFF(_n, 7)
+#define AR5K_KEYTABLE_VALID 0x00008000
+
+#define AR5K_KEYTABLE_SIZE_5210 64
+#define AR5K_KEYTABLE_SIZE_5211 128
+#define AR5K_KEYTABLE_SIZE (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_KEYTABLE_SIZE_5210 : AR5K_KEYTABLE_SIZE_5211)
+#define AR5K_KEYCACHE_SIZE 8
+
+
+
+/*===PHY REGISTERS===*/
+
+/*
+ * PHY register
+ */
+#define AR5K_PHY_BASE 0x9800
+#define AR5K_PHY(_n) (AR5K_PHY_BASE + ((_n) << 2))
+#define AR5K_PHY_SHIFT_2GHZ 0x00004007
+#define AR5K_PHY_SHIFT_5GHZ 0x00000007
+
+/*
+ * PHY frame control register (5210) /turbo mode register (5211/5212)
+ *
+ * There is another frame control register for 5211/5212
+ * at address 0x9944 (see below) but the 2 first flags
+ * are common here between 5210 frame control register
+ * and 5211/5212 turbo mode register, so this also works as
+ * a "turbo mode register" for 5210. We treat this one as
+ * a frame control register for 5210 below.
+ */
+#define AR5K_PHY_TURBO 0x9804
+#define AR5K_PHY_TURBO_MODE 0x00000001
+#define AR5K_PHY_TURBO_SHORT 0x00000002
+
+/*
+ * PHY agility command register
+ */
+#define AR5K_PHY_AGC 0x9808
+#define AR5K_PHY_AGC_DISABLE 0x08000000
+
+/*
+ * PHY timing register (5212)
+ */
+#define AR5K_PHY_TIMING_3 0x9814
+#define AR5K_PHY_TIMING_3_DSC_MAN 0xfffe0000
+#define AR5K_PHY_TIMING_3_DSC_MAN_S 17
+#define AR5K_PHY_TIMING_3_DSC_EXP 0x0001e000
+#define AR5K_PHY_TIMING_3_DSC_EXP_S 13
+
+/*
+ * PHY chip revision register
+ */
+#define AR5K_PHY_CHIP_ID 0x9818
+
+/*
+ * PHY activation register
+ */
+#define AR5K_PHY_ACT 0x981c
+#define AR5K_PHY_ACT_ENABLE 0x00000001
+#define AR5K_PHY_ACT_DISABLE 0x00000002
+
+/*
+ * PHY signal register (5210)
+ */
+#define AR5K_PHY_SIG 0x9858
+#define AR5K_PHY_SIG_FIRSTEP 0x0003f000
+#define AR5K_PHY_SIG_FIRSTEP_S 12
+#define AR5K_PHY_SIG_FIRPWR 0x03fc0000
+#define AR5K_PHY_SIG_FIRPWR_S 18
+
+/*
+ * PHY coarse agility control register (5210)
+ */
+#define AR5K_PHY_AGCCOARSE 0x985c
+#define AR5K_PHY_AGCCOARSE_LO 0x00007f80
+#define AR5K_PHY_AGCCOARSE_LO_S 7
+#define AR5K_PHY_AGCCOARSE_HI 0x003f8000
+#define AR5K_PHY_AGCCOARSE_HI_S 15
+
+/*
+ * PHY agility control register
+ */
+#define AR5K_PHY_AGCCTL 0x9860
+#define AR5K_PHY_AGCCTL_CAL 0x00000001
+#define AR5K_PHY_AGCCTL_NF 0x00000002
+
+/*
+ * PHY noise floor status register
+ */
+#define AR5K_PHY_NF 0x9864
+#define AR5K_PHY_NF_M 0x000001ff
+#define AR5K_PHY_NF_ACTIVE 0x00000100
+#define AR5K_PHY_NF_RVAL(_n) (((_n) >> 19) & AR5K_PHY_NF_M)
+#define AR5K_PHY_NF_AVAL(_n) (-((_n) ^ AR5K_PHY_NF_M) + 1)
+#define AR5K_PHY_NF_SVAL(_n) (((_n) & AR5K_PHY_NF_M) | (1 << 9))
+
+/*
+ * PHY ADC saturation register (5210)
+ */
+#define AR5K_PHY_ADCSAT 0x9868
+#define AR5K_PHY_ADCSAT_ICNT 0x0001f800
+#define AR5K_PHY_ADCSAT_ICNT_S 11
+#define AR5K_PHY_ADCSAT_THR 0x000007e0
+#define AR5K_PHY_ADCSAT_THR_S 5
+
+/*
+ * PHY sleep registers (5212)
+ */
+#define AR5K_PHY_SCR 0x9870
+#define AR5K_PHY_SCR_32MHZ 0x0000001f
+#define AR5K_PHY_SLMT 0x9874
+#define AR5K_PHY_SLMT_32MHZ 0x0000007f
+#define AR5K_PHY_SCAL 0x9878
+#define AR5K_PHY_SCAL_32MHZ 0x0000000e
+
+/*
+ * PHY PLL control register (!5210)
+ */
+#define AR5K_PHY_PLL 0x987c
+#define AR5K_PHY_PLL_20MHZ 0x13 /*5211 only*/
+#define AR5K_PHY_PLL_40MHZ_5211 0x18
+#define AR5K_PHY_PLL_40MHZ_5212 0x000000aa
+#define AR5K_PHY_PLL_40MHZ (hal->ah_version == AR5K_AR5211 ? \
+ AR5K_PHY_PLL_40MHZ_5211 : AR5K_PHY_PLL_40MHZ_5212)
+#define AR5K_PHY_PLL_44MHZ_5211 0x19
+#define AR5K_PHY_PLL_44MHZ_5212 0x000000ab
+#define AR5K_PHY_PLL_44MHZ (hal->ah_version == AR5K_AR5211 ? \
+ AR5K_PHY_PLL_44MHZ_5211 : AR5K_PHY_PLL_44MHZ_5212)
+#define AR5K_PHY_PLL_AR5111 0x00000000
+#define AR5K_PHY_PLL_AR5112 0x00000040
+
+/*
+ * PHY RF stage register (5210)
+ */
+#define AR5K_PHY_RFSTG 0x98d4
+#define AR5K_PHY_RFSTG_DISABLE 0x00000021
+
+/*
+ * PHY receiver delay register (!5210)
+ */
+#define AR5K_PHY_RX_DELAY 0x9914
+#define AR5K_PHY_RX_DELAY_M 0x00003fff
+
+/*
+ * PHY timing IQ control register (!5210)
+ */
+#define AR5K_PHY_IQ 0x9920
+#define AR5K_PHY_IQ_CORR_Q_Q_COFF 0x0000001f
+#define AR5K_PHY_IQ_CORR_Q_I_COFF 0x000007e0
+#define AR5K_PHY_IQ_CORR_Q_I_COFF_S 5
+#define AR5K_PHY_IQ_CORR_ENABLE 0x00000800
+#define AR5K_PHY_IQ_CAL_NUM_LOG_MAX 0x0000f000
+#define AR5K_PHY_IQ_CAL_NUM_LOG_MAX_S 12
+#define AR5K_PHY_IQ_RUN 0x00010000
+
+
+/*
+ * PHY PAPD probe register (!5210)
+ */
+#define AR5K_PHY_PAPD_PROBE 0x9930
+#define AR5K_PHY_PAPD_PROBE_TXPOWER 0x00007e00
+#define AR5K_PHY_PAPD_PROBE_TXPOWER_S 9
+#define AR5K_PHY_PAPD_PROBE_TX_NEXT 0x00008000
+#define AR5K_PHY_PAPD_PROBE_TYPE 0x01800000 /*5212 only*/
+#define AR5K_PHY_PAPD_PROBE_TYPE_S 23
+#define AR5K_PHY_PAPD_PROBE_TYPE_OFDM 0
+#define AR5K_PHY_PAPD_PROBE_TYPE_XR 1
+#define AR5K_PHY_PAPD_PROBE_TYPE_CCK 2
+#define AR5K_PHY_PAPD_PROBE_GAINF 0xfe000000
+#define AR5K_PHY_PAPD_PROBE_GAINF_S 25
+
+
+/*
+ * PHY TX power registers (5212)
+ */
+#define AR5K_PHY_TXPOWER_RATE1 0x9934
+#define AR5K_PHY_TXPOWER_RATE2 0x9938
+#define AR5K_PHY_TXPOWER_RATE_MAX 0x993c
+#define AR5K_PHY_TXPOWER_RATE_MAX_TPC_ENABLE 0x00000040
+#define AR5K_PHY_TXPOWER_RATE3 0xa234
+#define AR5K_PHY_TXPOWER_RATE4 0xa238
+
+/*
+ * PHY frame control register (!5210)
+ */
+#define AR5K_PHY_FRAME_CTL_5210 0x9804
+#define AR5K_PHY_FRAME_CTL_5211 0x9944
+#define AR5K_PHY_FRAME_CTL (hal->ah_version == AR5K_AR5210 ? \
+ AR5K_PHY_FRAME_CTL_5210 : AR5K_PHY_FRAME_CTL_5211)
+/*---non 5210---*/
+#define AR5K_PHY_FRAME_CTL_TX_CLIP 0x00000038
+#define AR5K_PHY_FRAME_CTL_TX_CLIP_S 3
+/*---5210 only---*/
+#define AR5K_PHY_FRAME_CTL_TIMING_ERR 0x01000000
+#define AR5K_PHY_FRAME_CTL_PARITY_ERR 0x02000000
+#define AR5K_PHY_FRAME_CTL_ILLRATE_ERR 0x04000000
+#define AR5K_PHY_FRAME_CTL_ILLLEN_ERR 0x08000000
+#define AR5K_PHY_FRAME_CTL_SERVICE_ERR 0x20000000
+#define AR5K_PHY_FRAME_CTL_TXURN_ERR 0x40000000
+
+/*
+ * PHY radar detection enable register (!5210)
+ */
+#define AR5K_PHY_RADAR 0x9954
+#define AR5K_PHY_RADAR_DISABLE 0x00000000
+#define AR5K_PHY_RADAR_ENABLE 0x00000001
+
+/*
+ * PHY antenna switch table registers (!5210)
+ */
+#define AR5K_PHY_ANT_SWITCH_TABLE_0 0x9960
+#define AR5K_PHY_ANT_SWITCH_TABLE_1 0x9964
+
+/*
+ * PHY clock sleep registers (5212)
+ */
+#define AR5K_PHY_SCLOCK 0x99f0
+#define AR5K_PHY_SCLOCK_32MHZ 0x0000000c
+#define AR5K_PHY_SDELAY 0x99f4
+#define AR5K_PHY_SDELAY_32MHZ 0x000000ff
+#define AR5K_PHY_SPENDING 0x99f8
+#define AR5K_PHY_SPENDING_AR5111 0x00000018
+#define AR5K_PHY_SPENDING_AR5112 0x00000014
+
+/*
+ * Misc PHY/radio registers (5210/5211)
+ */
+#define AR5K_BB_GAIN_BASE 0x9b00
+#define AR5K_BB_GAIN(_n) (AR5K_BB_GAIN_BASE + ((_n) << 2))
+#define AR5K_RF_GAIN_BASE 0x9a00
+#define AR5K_RF_GAIN(_n) (AR5K_RF_GAIN_BASE + ((_n) << 2))
+
+/*
+ * PHY timing IQ calibration result register (!5210)
+ */
+#define AR5K_PHY_IQRES_CAL_PWR_I 0x9c10
+#define AR5K_PHY_IQRES_CAL_PWR_Q 0x9c14
+#define AR5K_PHY_IQRES_CAL_CORR 0x9c18
+
+/*
+ * PHY current RSSI register (!5210)
+ */
+#define AR5K_PHY_CURRENT_RSSI 0x9c1c
+
+/*
+ * PHY PCDAC TX power register (5212)
+ */
+#define AR5K_PHY_PCDAC_TXPOWER_BASE 0xa180
+#define AR5K_PHY_PCDAC_TXPOWER(_n) (AR5K_PHY_PCDAC_TXPOWER_BASE + ((_n) << 2))
+
+/*
+ * PHY mode register (!5210)
+ */
+#define AR5K_PHY_MODE 0x0a200
+#define AR5K_PHY_MODE_MOD 0x00000001
+#define AR5K_PHY_MODE_MOD_OFDM 0
+#define AR5K_PHY_MODE_MOD_CCK 1
+#define AR5K_PHY_MODE_FREQ 0x00000002
+#define AR5K_PHY_MODE_FREQ_5GHZ 0
+#define AR5K_PHY_MODE_FREQ_2GHZ 2
+#define AR5K_PHY_MODE_MOD_DYN 0x00000004 /*5212 only*/
+#define AR5K_PHY_MODE_RAD 0x00000008 /*5212 only*/
+#define AR5K_PHY_MODE_RAD_AR5111 0
+#define AR5K_PHY_MODE_RAD_AR5112 8
+#define AR5K_PHY_MODE_XR 0x00000010 /*5212 only*/
+
+/*
+ * PHY CCK transmit control register (5212)
+ */
+#define AR5K_PHY_CCKTXCTL 0xa204
+#define AR5K_PHY_CCKTXCTL_WORLD 0x00000000
+#define AR5K_PHY_CCKTXCTL_JAPAN 0x00000010
+
+/*
+ * PHY 2GHz gain register (5212)
+ */
+#define AR5K_PHY_GAIN_2GHZ 0xa20c
+#define AR5K_PHY_GAIN_2GHZ_MARGIN_TXRX 0x00fc0000
+#define AR5K_PHY_GAIN_2GHZ_MARGIN_TXRX_S 18
diff -Nurp qemu-0.9.1-untouched/hw/atheros_wlan_ap.c qemu-0.9.1/hw/atheros_wlan_ap.c
--- qemu-0.9.1-untouched/hw/atheros_wlan_ap.c 1970-01-01 01:00:00.000000000 +0100
+++ qemu-0.9.1/hw/atheros_wlan_ap.c 2008-02-28 14:15:00.000000000 +0100
@@ -0,0 +1,771 @@
+/**
+ * QEMU WLAN access point emulation
+ *
+ * Copyright (c) 2008 Clemens Kolbitsch
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Modifications:
+ * 2008-February-24 Clemens Kolbitsch :
+ * New implementation based on ne2000.c
+ *
+ */
+
+
+#include "hw.h"
+#include "pci.h"
+#include "pc.h"
+#include "net.h"
+#include "qemu-timer.h"
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/shm.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+#include <sys/mman.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include <signal.h>
+
+#include <time.h>
+#include <sys/time.h>
+
+/*
+ * PCI and EEPROM definitions
+ */
+#include "hw/atheros_wlan.h"
+#include "hw/atheros_wlan_ap.h"
+#include "hw/atheros_wlan_io.h"
+#include "hw/atheros_wlan_packet.h"
+
+/*
+ * MadWifi OPENHAL atheros constants
+ */
+#include "hw/ath5k_hw.h"
+#include "hw/ath5kreg.h"
+#include "hw/ath5k.h"
+
+static int semaphore_helper(int semaphore, int sem_op, int semaphore_nr, short flags)
+{
+ struct sembuf semp;
+ semp.sem_num = semaphore_nr;
+ semp.sem_op = sem_op;
+ semp.sem_flg = flags;
+
+ if (semaphore == -1)
+ {
+ /*
+ * We don't have a semaphore... probably not
+ * that bad, but having one is better :-)
+ */
+ return -1;
+ }
+
+ int ret;
+ while ((ret = semop(semaphore, &semp, 1)) < 0)
+ {
+ if (errno == EAGAIN && flags == IPC_NOWAIT)
+ {
+ return errno;
+ }
+ else if (errno != EINTR)
+ {
+ fprintf(stderr, "Semaphore error: 0x%x / %u\n", errno, errno);
+ return errno;
+ }
+ }
+
+ return ret;
+}
+
+
+static int signal_semaphore(int semaphore, int semaphore_nr)
+{
+ return semaphore_helper(semaphore, 1, semaphore_nr, 0);
+}
+static int wait_semaphore(int semaphore, int semaphore_nr)
+{
+ return semaphore_helper(semaphore, -1, semaphore_nr, 0);
+}
+
+void Atheros_WLAN_insert_frame(Atheros_WLANState *s, struct mac80211_frame *frame)
+{
+ struct mac80211_frame *i_frame;
+
+ wait_semaphore(s->access_semaphore, 0);
+
+ s->inject_queue_size++;
+ i_frame = s->inject_queue;
+ if (!i_frame)
+ {
+ s->inject_queue = frame;
+ }
+ else
+ {
+ while (i_frame->next_frame)
+ {
+ i_frame = i_frame->next_frame;
+ }
+
+ i_frame->next_frame = frame;
+ }
+
+ if (!s->inject_timer_running)
+ {
+ // if the injection timer is not
+ // running currently, let's schedule
+ // one run...
+ s->inject_timer_running = 1;
+ qemu_mod_timer(s->inject_timer, qemu_get_clock(rt_clock) + 5);
+ }
+
+ signal_semaphore(s->access_semaphore, 0);
+}
+
+static void Atheros_WLAN_beacon_timer(void *opaque)
+{
+ struct mac80211_frame *frame;
+ Atheros_WLANState *s = (Atheros_WLANState *)opaque;
+
+ frame = Atheros_WLAN_create_beacon_frame();
+ if (frame)
+ {
+ Atheros_WLAN_init_frame(s, frame);
+ Atheros_WLAN_insert_frame(s, frame);
+ }
+
+ qemu_mod_timer(s->beacon_timer, qemu_get_clock(rt_clock) + 500);
+}
+
+static void Atheros_WLAN_inject_timer(void *opaque)
+{
+ Atheros_WLANState *s = (Atheros_WLANState *)opaque;
+ struct mac80211_frame *frame;
+
+ wait_semaphore(s->access_semaphore, 0);
+
+ frame = s->inject_queue;
+ if (frame)
+ {
+ // remove from queue
+ s->inject_queue_size--;
+ s->inject_queue = frame->next_frame;
+ }
+ signal_semaphore(s->access_semaphore, 0);
+
+ if (!frame)
+ {
+ goto timer_done;
+ }
+
+ if (s->receive_queue_address == NULL)
+ {
+ // we drop the packet
+ }
+ else
+ {
+ Atheros_WLAN_handleRxBuffer(s, frame, frame->frame_length);
+ }
+
+ free(frame);
+
+timer_done:
+ wait_semaphore(s->access_semaphore, 0);
+
+ if (s->inject_queue_size > 0)
+ {
+ // there are more packets... schedule
+ // the timer for sending them as well
+ qemu_mod_timer(s->inject_timer, qemu_get_clock(rt_clock) + 25);
+ }
+ else
+ {
+ // we wait until a new packet schedules
+ // us again
+ s->inject_timer_running = 0;
+ }
+
+ signal_semaphore(s->access_semaphore, 0);
+}
+
+
+static int Atheros_WLAN_can_receive(void *opaque)
+{
+ Atheros_WLANState *s = (Atheros_WLANState *)opaque;
+
+ if (s->ap_state != Atheros_WLAN__STATE_ASSOCIATED)
+ {
+ // we are currently not connected
+ // to the access point
+ return 0;
+ }
+
+ if (s->inject_queue_size > Atheros_WLAN__MAX_INJECT_QUEUE_SIZE)
+ {
+ // overload, please give me some time...
+ return 0;
+ }
+
+ return 1;
+}
+
+static void Atheros_WLAN_receive(void *opaque, const uint8_t *buf, int size)
+{
+ struct mac80211_frame *frame;
+ Atheros_WLANState *s = (Atheros_WLANState *)opaque;
+
+ if (!Atheros_WLAN_can_receive(opaque))
+ {
+ // this should not happen, but in
+ // case it does, let's simply drop
+ // the packet
+ return;
+ }
+
+ if (!s)
+ {
+ return;
+ }
+
+ /*
+ * A 802.3 packet comes from the qemu network. The
+ * access points turns it into a 802.11 frame and
+ * forwards it to the wireless device
+ */
+ frame = Atheros_WLAN_create_data_packet(s, buf, size);
+ if (frame)
+ {
+ Atheros_WLAN_init_frame(s, frame);
+ Atheros_WLAN_insert_frame(s, frame);
+ }
+}
+
+void Atheros_WLAN_setup_ap(NICInfo *nd, PCIAtheros_WLANState *d)
+{
+ Atheros_WLANState *s;
+ s = &d->Atheros_WLAN;
+
+ s->ap_state = Atheros_WLAN__STATE_NOT_AUTHENTICATED;
+ s->ap_macaddr[0] = 0x00;
+ s->ap_macaddr[1] = 0x13;
+ s->ap_macaddr[2] = 0x46;
+ s->ap_macaddr[3] = 0xbf;
+ s->ap_macaddr[4] = 0x31;
+ s->ap_macaddr[5] = 0x59;
+
+ s->inject_timer_running = 0;
+ s->inject_sequence_number = 0;
+
+ s->inject_queue = NULL;
+ s->inject_queue_size = 0;
+
+ s->access_semaphore = semget(ATHEROS_WLAN_ACCESS_SEM_KEY, 1, 0666 | IPC_CREAT);
+ semctl(s->access_semaphore, 0, SETVAL, 1);
+
+ s->beacon_timer = qemu_new_timer(rt_clock, Atheros_WLAN_beacon_timer, s);
+ qemu_mod_timer(s->beacon_timer, qemu_get_clock(rt_clock));
+
+ // setup the timer but only schedule
+ // it when necessary...
+ s->inject_timer = qemu_new_timer(rt_clock, Atheros_WLAN_inject_timer, s);
+
+ s->vc = qemu_new_vlan_client(nd->vlan, Atheros_WLAN_receive, Atheros_WLAN_can_receive, s);
+
+ snprintf(s->vc->info_str, sizeof(s->vc->info_str), "atheros wireless lan (macaddr=%02x:%02x:%02x:%02x:%02x:%02x)",
+ s->macaddr[0], s->macaddr[1], s->macaddr[2],
+ s->macaddr[3], s->macaddr[4], s->macaddr[5]);
+}
+
+
+
+void Atheros_WLAN_disable_irq(void *arg)
+{
+ Atheros_WLANState *s = (Atheros_WLANState *)arg;
+ SET_MEM_L(s->mem, ATH_HW_IRQ_PENDING, ATH_HW_IRQ_PENDING_FALSE);
+ qemu_set_irq(s->irq, 0);
+ DEBUG_PRINT((">> Disabling irq\n"));
+}
+
+void Atheros_WLAN_enable_irq(void *arg)
+{
+ Atheros_WLANState *s = (Atheros_WLANState *)arg;
+
+ if (!s->interrupt_enabled)
+ {
+ DEBUG_PRINT((">> Wanted to enable irq, but they are disabled\n"));
+ Atheros_WLAN_disable_irq(s);
+ return;
+ }
+
+ DEBUG_PRINT((">> Enabling irq\n"));
+ SET_MEM_L(s->mem, ATH_HW_IRQ_PENDING, ATH_HW_IRQ_PENDING_TRUE);
+ qemu_set_irq(s->irq, 1);
+}
+
+
+void Atheros_WLAN_update_irq(void *arg)
+{
+ Atheros_WLANState *s = (Atheros_WLANState *)arg;
+ DEBUG_PRINT((">> Updating... irq-enabled is %u\n", s->interrupt_enabled));
+ /*
+ * NOTE: Since we use shared interrupts
+ * the device driver will check if the
+ * interrupt really comes from this hardware
+ *
+ * This is done by checking the
+ * ATH_HW_IRQ_PENDING memory...
+ */
+ if (/*(!s->interrupt_enabled) ||*/
+ (s->pending_interrupts == NULL))
+ {
+ SET_MEM_L(s->mem, AR5K_RAC_PISR, 0);
+ goto disable_further_interrupts;
+ }
+
+ /*
+ * Make sure this is done atomically!!
+ */
+ wait_semaphore(s->access_semaphore, 0);
+ uint32_t status = 0x0;
+ struct pending_interrupt *i = s->pending_interrupts;
+ struct pending_interrupt *next;
+
+ s->pending_interrupts = NULL;
+ while (i != NULL)
+ {
+ next = i->next;
+ if (1) //(s->interrupt_p_mask & i->status)
+ {
+ status |= i->status;
+ }
+ free(i);
+
+ i = next;
+ }
+
+ SET_MEM_L(s->mem, AR5K_RAC_PISR, status);
+ DEBUG_PRINT((">> Status set to %u\n", status));
+ /*
+ * Atomic part done...
+ */
+ signal_semaphore(s->access_semaphore, 0);
+
+
+disable_further_interrupts:
+ /*
+ * NOTE: At last, it will check if any
+ * more interrupts are pending. The call
+ * to check what type of interrupt was
+ * pending already put down the interrupt_pending
+ * bit for us (check the readl function for RAC)
+ *
+ * if_ath.c: 921
+ */
+ Atheros_WLAN_disable_irq(s);
+}
+
+
+void Atheros_WLAN_append_irq(Atheros_WLANState *s, struct pending_interrupt intr)
+{
+ struct pending_interrupt *new_intr;
+ new_intr = (struct pending_interrupt *)malloc(sizeof(struct pending_interrupt));
+ memcpy(new_intr, &intr, sizeof(intr));
+
+ /*
+ * Make sure this is done atomically!!
+ */
+ wait_semaphore(s->access_semaphore, 0);
+
+ if (s->pending_interrupts == NULL)
+ {
+ s->pending_interrupts = new_intr;
+ }
+ else
+ {
+ /*
+ * Insert at the end of the
+ * list to assure correct order
+ * of interrupts!
+ */
+ struct pending_interrupt *i = s->pending_interrupts;
+ while (i->next != NULL)
+ {
+ i = i->next;
+ }
+
+ new_intr->next = NULL;
+ i->next = new_intr;
+ }
+
+ /*
+ * Atomic part done...
+ */
+ signal_semaphore(s->access_semaphore, 0);
+}
+
+
+
+
+
+
+
+
+void Atheros_WLAN_handleRxBuffer(Atheros_WLANState *s, struct mac80211_frame *frame, uint32_t frame_length)
+{
+ struct ath_desc desc;
+ struct ath5k_ar5212_rx_status *rx_status;
+ rx_status = (struct ath5k_ar5212_rx_status*)&desc.ds_hw[0];
+
+ if (s->receive_queue_address == NULL)
+ {
+ return;
+ }
+
+ cpu_physical_memory_read((target_phys_addr_t)s->receive_queue_address, (uint8_t*)&desc, sizeof(desc));
+
+ /*
+ * Put some good base-data into
+ * the descriptor. Length & co
+ * will be modified below...
+ *
+ * NOTE: Better set everything correctly
+ *
+ * Look at ath5k_hw.c: proc_tx_desc
+ */
+ desc.ds_ctl0 = 0x0;
+ desc.ds_ctl1 = 0x9c0;
+ desc.ds_hw[0] = 0x126d806a;
+ desc.ds_hw[1] = 0x49860003;
+ desc.ds_hw[2] = 0x0;
+ desc.ds_hw[3] = 0x0;
+
+
+ /*
+ * Filter out old length and put in correct value...
+ */
+ rx_status->rx_status_0 &= ~AR5K_AR5212_DESC_RX_STATUS0_DATA_LEN;
+ rx_status->rx_status_0 |= frame_length;
+ rx_status->rx_status_0 &= ~AR5K_AR5211_DESC_RX_STATUS0_MORE;
+
+ /*
+ * Write descriptor and packet back to DMA memory...
+ */
+ cpu_physical_memory_write((target_phys_addr_t)s->receive_queue_address, (uint8_t*)&desc, sizeof(desc));
+ cpu_physical_memory_write((target_phys_addr_t)desc.ds_data, (uint8_t*)frame, sizeof(struct mac80211_frame));
+
+ /*
+ * Set address to next position
+ * in single-linked list
+ *
+ * The receive list's last element
+ * points to itself to avoid overruns.
+ * This way, at some point no more
+ * packets will be received, but (I
+ * ASSUME) that it is the drivers
+ * responsibility to reset the address
+ * list!
+ *
+ *
+ * NOTE: It seems the real madwifi cannot
+ * handle multiple packets at once. so we
+ * set the buffer to NULL to make the injection
+ * fail next time until an interrupt was
+ * received by the driver and a new buffer
+ * is registered!!
+ */
+ s->receive_queue_address =
+ ((++s->receive_queue_count) > MAX_CONCURRENT_RX_FRAMES)
+ ? NULL
+ : (uint32_t *)desc.ds_link;
+
+
+ DEBUG_PRINT((">> Enabling rx\n"));
+ /*
+ * Notify the driver about the new packet
+ */
+ struct pending_interrupt intr;
+ intr.status = AR5K_INT_RX;
+ Atheros_WLAN_append_irq(s, intr);
+ Atheros_WLAN_enable_irq(s);
+}
+
+
+
+void Atheros_WLAN_handleTxBuffer(Atheros_WLANState *s, uint32_t queue)
+{
+ struct ath_desc desc;
+ struct mac80211_frame frame;
+
+ if (s->transmit_queue_address[queue] == NULL)
+ {
+ return;
+ }
+
+ cpu_physical_memory_read((target_phys_addr_t)s->transmit_queue_address[queue], (uint8_t*)&desc, sizeof(desc));
+
+ if (s->transmit_queue_processed[queue])
+ {
+ /*
+ * Maybe we already processed the frame
+ * and have not gotten the address of the
+ * next frame buffer but still got a call
+ * to send the next frame
+ *
+ * this way we have to process the next
+ * frame in the single linked list!!
+ */
+ s->transmit_queue_address[queue] = (uint32_t *)desc.ds_link;
+
+ /*
+ * And now get the frame we really have to process...
+ */
+ cpu_physical_memory_read((target_phys_addr_t)s->transmit_queue_address[queue], (uint8_t*)&desc, sizeof(desc));
+ }
+
+ uint32_t segment_len, frame_length = 0, more;
+ uint8_t *frame_pos = (uint8_t*)&frame;
+ struct ath5k_ar5212_tx_desc *tx_desc;
+ tx_desc = (struct ath5k_ar5212_tx_desc*)&desc.ds_ctl0;
+ do
+ {
+ more = tx_desc->tx_control_1 & AR5K_AR5211_DESC_TX_CTL1_MORE;
+ segment_len = tx_desc->tx_control_1 & AR5K_AR5212_DESC_TX_CTL1_BUF_LEN;
+
+ cpu_physical_memory_read((target_phys_addr_t)desc.ds_data, frame_pos, segment_len);
+ frame_pos += segment_len;
+ frame_length += segment_len;
+
+
+ /*
+ * Notify successful transmission
+ *
+ * NOTE: It'd be better to leave the
+ * descriptor as it is and only modify
+ * the transmit-ok-bits --> this way
+ * the timestamp and co. would stay
+ * valid...
+ *
+ * Look at ath5k_hw.c: proc_tx_desc
+ *
+ * NOTE: Not sure if this acknowledgement
+ * must be copied back for every single
+ * descriptor in a multi-segment frame,
+ * but better safe than sorry!!
+ */
+ desc.ds_ctl0 = 0x213f002f;
+ desc.ds_ctl1 = 0x2b;
+ desc.ds_hw[0] = 0xf0000;
+ desc.ds_hw[1] = 0x1b;
+ desc.ds_hw[2] = 0xab640001;
+ desc.ds_hw[3] = 0x4a019;
+
+ /*
+ *
+ * struct ath5k_tx_status *tx_status = (struct ath5k_tx_status*)&desc.ds_hw[2];
+ * tx_status->tx_status_1 |= AR5K_DESC_TX_STATUS1_DONE;
+ * tx_status->tx_status_0 |= AR5K_DESC_TX_STATUS0_FRAME_XMIT_OK;
+ *
+ *
+ * Write descriptor back to DMA memory...
+ */
+ cpu_physical_memory_write((target_phys_addr_t)s->transmit_queue_address[queue], (uint8_t*)&desc, sizeof(desc));
+
+ if (more && frame_length < sizeof(frame))
+ {
+ /*
+ * This is done at the end of the loop
+ * since sometimes the next-link is not
+ * yet set (assuming frame is a 1-segment
+ * frame)!!
+ *
+ * This is very strange (and maybe obsolete
+ * by this version) but let's do it the safe
+ * way and not mess it up :-)
+ */
+ s->transmit_queue_address[queue] = (uint32_t *)desc.ds_link;
+ cpu_physical_memory_read((target_phys_addr_t)s->transmit_queue_address[queue], (uint8_t*)&desc, sizeof(desc));
+ }
+ }
+ while (more && frame_length < sizeof(frame));
+
+
+ struct pending_interrupt intr;
+ intr.status = AR5K_INT_TX;
+ Atheros_WLAN_append_irq(s, intr);
+ Atheros_WLAN_enable_irq(s);
+
+ /*
+ * Set address to next position
+ * in single-linked list
+ *
+ * The transmit list's last element
+ * points to itself to avoid overruns.
+ * This way, at some point no more
+ * packets will be received, but (I
+ * ASSUME) that it is the drivers
+ * responsibility to reset the address
+ * list!
+ */
+ s->transmit_queue_processed[queue] = 1;
+
+ frame.frame_length = frame_length + 4;
+ Atheros_WLAN_handle_frame(s, &frame);
+}
+
+
+void Atheros_WLAN_handle_frame(Atheros_WLANState *s, struct mac80211_frame *frame)
+{
+ struct mac80211_frame *reply = NULL;
+ unsigned long ethernet_frame_size;
+ unsigned char ethernet_frame[1518];
+
+ if ((frame->frame_control.type == IEEE80211_TYPE_MGT) &&
+ (frame->frame_control.sub_type == IEEE80211_TYPE_MGT_SUBTYPE_PROBE_REQ))
+ {
+ reply = Atheros_WLAN_create_probe_response();
+ }
+ else if ((frame->frame_control.type == IEEE80211_TYPE_MGT) &&
+ (frame->frame_control.sub_type == IEEE80211_TYPE_MGT_SUBTYPE_AUTHENTICATION))
+ {
+ DEBUG_PRINT_AP(("Received authentication!\n"));
+ reply = Atheros_WLAN_create_authentication();
+
+ if (s->ap_state == Atheros_WLAN__STATE_NOT_AUTHENTICATED)
+ {
+ // if everything is going according to
+ // the state machine, let's jump into the
+ // next state
+ s->ap_state = Atheros_WLAN__STATE_AUTHENTICATED;
+ }
+ }
+ else if ((frame->frame_control.type == IEEE80211_TYPE_MGT) &&
+ (frame->frame_control.sub_type == IEEE80211_TYPE_MGT_SUBTYPE_DEAUTHENTICATION))
+ {
+ DEBUG_PRINT_AP(("Received deauthentication!\n"));
+ reply = Atheros_WLAN_create_deauthentication();
+
+ // some systems (e.g. WinXP) won't send a
+ // disassociation. just believe that the
+ // deauthentication is ok... nothing bad
+ // can happen anyways ;-)
+ s->ap_state = Atheros_WLAN__STATE_NOT_AUTHENTICATED;
+ }
+ else if ((frame->frame_control.type == IEEE80211_TYPE_MGT) &&
+ (frame->frame_control.sub_type == IEEE80211_TYPE_MGT_SUBTYPE_ASSOCIATION_REQ))
+ {
+ DEBUG_PRINT_AP(("Received association request!\n"));
+ reply = Atheros_WLAN_create_association_response();
+
+ if (s->ap_state == Atheros_WLAN__STATE_AUTHENTICATED)
+ {
+ // if everything is going according to
+ // the state machine, let's jump into the
+ // next state
+ s->ap_state = Atheros_WLAN__STATE_ASSOCIATED;
+ }
+ }
+ else if ((frame->frame_control.type == IEEE80211_TYPE_MGT) &&
+ (frame->frame_control.sub_type == IEEE80211_TYPE_MGT_SUBTYPE_DISASSOCIATION))
+ {
+ DEBUG_PRINT_AP(("Received disassociation!\n"));
+ reply = Atheros_WLAN_create_disassociation();
+
+ if (s->ap_state == Atheros_WLAN__STATE_ASSOCIATED)
+ {
+ // if everything is going according to
+ // the state machine, let's jump into the
+ // next state
+ s->ap_state = Atheros_WLAN__STATE_AUTHENTICATED;
+ }
+ }
+ else if ((frame->frame_control.type == IEEE80211_TYPE_DATA) &&
+ (s->ap_state == Atheros_WLAN__STATE_ASSOCIATED))
+ {
+ /*
+ * The access point uses the 802.11 frame
+ * and sends a 802.3 frame into the network...
+ * This packet is then understandable by
+ * qemu-slirp
+ *
+ * If we ever want the access point to offer
+ * some services, it can be added here!!
+ */
+ // ethernet header type
+ ethernet_frame[12] = frame->data_and_fcs[6];
+ ethernet_frame[13] = frame->data_and_fcs[7];
+
+ // the new originator of the packet is
+ // the access point
+ memcpy(ðernet_frame[6], s->ap_macaddr, 6);
+
+ if (ethernet_frame[12] == 0x08 && ethernet_frame[13] == 0x06)
+ {
+ // for arp request, we use a broadcast
+ memset(ðernet_frame[0], 0xff, 6);
+ }
+ else
+ {
+ // otherwise we forward the packet to
+ // where it really belongs
+ memcpy(ðernet_frame[0], frame->destination_address, 6);
+ }
+
+ // add packet content
+ ethernet_frame_size = frame->frame_length - 24 - 4 - 8;
+
+ // for some reason, the packet is 22 bytes too small (??)
+ ethernet_frame_size += 22;
+ if (ethernet_frame_size > sizeof(ethernet_frame))
+ {
+ ethernet_frame_size = sizeof(ethernet_frame);
+ }
+ memcpy(ðernet_frame[14], &frame->data_and_fcs[8], ethernet_frame_size);
+
+ // add size of ethernet header
+ ethernet_frame_size += 14;
+
+ /*
+ * Send 802.3 frame
+ */
+ qemu_send_packet(s->vc, ethernet_frame, ethernet_frame_size);
+ }
+
+ if (reply)
+ {
+ memcpy(reply->destination_address, frame->source_address, 6);
+ Atheros_WLAN_init_frame(s, reply);
+ Atheros_WLAN_insert_frame(s, reply);
+ }
+}
+
+
+
+
+
+
+
diff -Nurp qemu-0.9.1-untouched/hw/atheros_wlan_ap.h qemu-0.9.1/hw/atheros_wlan_ap.h
--- qemu-0.9.1-untouched/hw/atheros_wlan_ap.h 1970-01-01 01:00:00.000000000 +0100
+++ qemu-0.9.1/hw/atheros_wlan_ap.h 2008-02-28 14:02:51.000000000 +0100
@@ -0,0 +1,47 @@
+/**
+ * QEMU WLAN access point emulation
+ *
+ * Copyright (c) 2008 Clemens Kolbitsch
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Modifications:
+ * 2008-February-24 Clemens Kolbitsch :
+ * New implementation based on ne2000.c
+ *
+ */
+
+#ifndef atheros_wlan_ap_h
+#define atheros_wlan_ap_h 1
+
+void Atheros_WLAN_setup_ap(NICInfo *nd, PCIAtheros_WLANState *d);
+
+void Atheros_WLAN_handleTxBuffer(Atheros_WLANState *s, uint32_t queue);
+void Atheros_WLAN_handleRxBuffer(Atheros_WLANState *s, struct mac80211_frame *frame, uint32_t frame_length);
+
+void Atheros_WLAN_handle_frame(Atheros_WLANState *s, struct mac80211_frame *frame);
+
+void Atheros_WLAN_insert_frame(Atheros_WLANState *s, struct mac80211_frame *frame);
+
+void Atheros_WLAN_disable_irq(void *arg);
+void Atheros_WLAN_enable_irq(void *arg);
+void Atheros_WLAN_update_irq(void *arg);
+void Atheros_WLAN_append_irq(Atheros_WLANState *s, struct pending_interrupt intr);
+
+#endif // atheros_wlan_ap_h
diff -Nurp qemu-0.9.1-untouched/hw/atheros_wlan.c qemu-0.9.1/hw/atheros_wlan.c
--- qemu-0.9.1-untouched/hw/atheros_wlan.c 1970-01-01 01:00:00.000000000 +0100
+++ qemu-0.9.1/hw/atheros_wlan.c 2008-02-28 14:18:07.000000000 +0100
@@ -0,0 +1,348 @@
+/**
+ * QEMU WLAN device emulation
+ *
+ * Copyright (c) 2008 Clemens Kolbitsch
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Modifications:
+ * 2008-February-24 Clemens Kolbitsch :
+ * New implementation based on ne2000.c
+ *
+ */
+
+#include "hw.h"
+#include "pci.h"
+#include "pc.h"
+#include "net.h"
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/shm.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+#include <sys/mman.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include <signal.h>
+
+#include <time.h>
+#include <sys/time.h>
+
+/*
+ * PCI and EEPROM definitions
+ */
+#include "hw/atheros_wlan.h"
+#include "hw/atheros_wlan_io.h"
+#include "hw/atheros_wlan_ap.h"
+#include "hw/atheros_wlan_eeprom.h"
+
+/*
+ * MadWifi OPENHAL atheros constants
+ */
+#include "hw/ath5k_hw.h"
+#include "hw/ath5kreg.h"
+#include "hw/ath5k.h"
+
+
+static void Atheros_WLAN_reset(NICInfo *nd, Atheros_WLANState *s)
+{
+ DEBUG_PRINT(("reset\n"));
+
+ /*
+ * Restore mac address
+ */
+ memcpy(s->macaddr, nd->macaddr, 6);
+
+ /*
+ * data from my local AR5212 device
+ */
+ SET_MEM_L(s->mem, 12, 0);
+ SET_MEM_L(s->mem, AR5K_SREV, 86);
+ SET_MEM_L(s->mem, AR5K_PCICFG, 0x00010014);
+ SET_MEM_L(s->mem, AR5K_PHY_CHIP_ID, 65);
+ SET_MEM_L(s->mem, AR5K_SLEEP_CTL, 0x00010000);
+ SET_MEM_L(s->mem, 0x9820, 0x02020200);
+
+ Atheros_WLAN_update_irq(s);
+}
+
+void Atheros_WLAN_setup_type(NICInfo *nd, PCIAtheros_WLANState *d)
+{
+ // create buffer large enough to
+ // do all checks
+ char *device_name;
+ char nd_model[128];
+ uint8_t *pci_conf;
+ Atheros_WLANState *s;
+
+ device_name = nd_model;
+ pci_conf = d->dev.config;
+ s = &d->Atheros_WLAN;
+
+ snprintf(nd_model, sizeof(nd_model), "%s", nd->model);
+
+
+ // skip "atheros_wlan"
+ // if it had not been part of nd->model, this
+ // module would not be loaded anyways!!
+ device_name += 12;
+ DEBUG_PRINT_AP(("Loading virtual wlan-pci device...\n"));
+ if (strncmp(device_name, "_winxp", 6) == 0)
+ {
+ s->device_driver_type = WINXP_DRIVER;
+ DEBUG_PRINT_AP((" * Make sure you are using a MS Windows driver!!\n"));
+
+ // skip "_winxp"
+ device_name += 6;
+ }
+ else if (strncmp(device_name, "_linux", 6) == 0)
+ {
+ s->device_driver_type = LINUX_DRIVER;
+ DEBUG_PRINT_AP((" * Make sure you are using a MadWifi driver!!\n"));
+
+ // skip "_linux"
+ device_name += 6;
+ }
+ else
+ {
+ s->device_driver_type = LINUX_DRIVER;
+ DEBUG_PRINT_AP((" * Unknown driver type '%s'... defaulting to Linux... Make sure you are using a MadWifi driver!!\n", nd->model));
+ }
+
+ if (strncmp(device_name, "_HPW400", 7) == 0)
+ {
+ s->eeprom_data = (u_int32_t*)Atheros_WLAN_eeprom_data_HPW400;
+ s->eeprom_size = sizeof(Atheros_WLAN_eeprom_data_HPW400);
+
+ memcpy(pci_conf, Atheros_WLAN_pci_config_HPW400, 256);
+
+ DEBUG_PRINT_AP((" * Using EEPROM and device configuration of HP W400!!\n"));
+
+ // skip "_HPW400"
+ device_name += 7;
+ }
+ else if (strncmp(device_name, "_MacBook", 8) == 0)
+ {
+ s->eeprom_data = (u_int32_t*)Atheros_WLAN_eeprom_data_MacBook;
+ s->eeprom_size = sizeof(Atheros_WLAN_eeprom_data_MacBook);
+
+ memcpy(pci_conf, Atheros_WLAN_pci_config_MacBook, 256);
+
+ DEBUG_PRINT_AP((" * Using EEPROM and device configuration of Mac Book!!\n"));
+
+ // skip "_MacBook"
+ device_name += 8;
+ }
+ else if (strncmp(device_name, "_AR5001XPlus", 12) == 0)
+ {
+ s->eeprom_data = (u_int32_t*)Atheros_WLAN_eeprom_data_HPW400;
+ s->eeprom_size = sizeof(Atheros_WLAN_eeprom_data_HPW400);
+
+ memcpy(pci_conf, Atheros_WLAN_pci_config_AR5001XPlus, 256);
+
+ DEBUG_PRINT_AP((" * Using EEPROM and device configuration of AR5001X+ (e.g. Toshiba A100)!!\n"));
+
+ // skip "_AR5001XPlus"
+ device_name += 12;
+ }
+ else if (strncmp(device_name, "_John", 5) == 0)
+ {
+ s->eeprom_data = (u_int32_t*)Atheros_WLAN_eeprom_data_HPW400;
+ s->eeprom_size = sizeof(Atheros_WLAN_eeprom_data_HPW400);
+
+ memcpy(pci_conf, Atheros_WLAN_pci_config_JOHN, 256);
+
+ DEBUG_PRINT_AP((" * Using EEPROM and device configuration of John!!\n"));
+
+ // skip "_John"
+ device_name += 5;
+ }
+ else if (strncmp(device_name, "_TPLinkWN651G", 13) == 0)
+ {
+ s->eeprom_data = (u_int32_t*)Atheros_WLAN_eeprom_data_HPW400;
+ s->eeprom_size = sizeof(Atheros_WLAN_eeprom_data_HPW400);
+
+ memcpy(pci_conf, Atheros_WLAN_pci_config_TP_Link_WN651G, 64);
+
+ DEBUG_PRINT_AP((" * Using EEPROM and device configuration of TP-Link WN651G!!\n"));
+
+ // skip "_TPLinkWN651G"
+ device_name += 13;
+ }
+ else
+ {
+ s->eeprom_data = (u_int32_t*)Atheros_WLAN_eeprom_data_HPW400;
+ s->eeprom_size = sizeof(Atheros_WLAN_eeprom_data_HPW400);
+
+ memcpy(pci_conf, Atheros_WLAN_pci_config_HPW400, 256);
+
+ DEBUG_PRINT_AP((" * Unknown EEPROM type '%s'... defaulting to HP W400!!\n", nd->model));
+ }
+}
+
+
+static void Atheros_WLAN_save(QEMUFile* f, void* opaque)
+{
+ int i;
+ uint32_t direct_value;
+ Atheros_WLANState *s = (Atheros_WLANState *)opaque;
+
+ if (s->pci_dev)
+ {
+ pci_device_save(s->pci_dev, f);
+ }
+
+ qemu_put_be32s(f, &s->device_driver_type);
+
+ qemu_put_buffer(f, s->ipaddr, 4);
+ qemu_put_buffer(f, s->macaddr, 6);
+
+ qemu_put_buffer(f, s->ap_ipaddr, 4);
+ qemu_put_buffer(f, s->ap_macaddr, 6);
+
+
+ qemu_put_be32s(f, &s->interrupt_p_mask);
+ for (i=0; i<5; qemu_put_be32s(f, &s->interrupt_s_mask[i++]));
+ qemu_put_8s(f, &s->interrupt_enabled);
+
+ qemu_put_be32s(f, &s->current_frequency);
+
+ direct_value = (uint32_t)s->receive_queue_address;
+ qemu_put_be32s(f, &direct_value);
+ qemu_put_be32s(f, &s->receive_queue_count);
+
+ qemu_put_be32s(f, &s->transmit_queue_size);
+ for (i=0; i<16; i++)
+ {
+ qemu_put_8s(f, &s->transmit_queue_enabled[i]);
+ direct_value = (uint32_t)s->transmit_queue_address[i];
+ qemu_put_be32s(f, &direct_value);
+ qemu_put_be32s(f, &s->transmit_queue_processed[i]);
+ }
+
+ qemu_put_be32s(f, &s->ap_state);
+ qemu_put_be32s(f, &s->inject_sequence_number);
+
+ qemu_put_buffer(f, (uint8_t *)s->mem, Atheros_WLAN_MEM_SIZE);
+}
+
+static int Atheros_WLAN_load(QEMUFile* f, void* opaque, int version_id)
+{
+ int i, ret;
+ uint32_t direct_value;
+ Atheros_WLANState *s = (Atheros_WLANState *)opaque;
+
+ // everyone has version 3... and the pci
+ // stuff should be there as well, I think
+ //
+ // let's just claim this has been around
+ // for quite some time ;-)
+ if (version_id != 3)
+ return -EINVAL;
+
+ if (s->pci_dev && version_id >= 3) {
+ ret = pci_device_load(s->pci_dev, f);
+ if (ret < 0)
+ return ret;
+ }
+
+ qemu_get_be32s(f, &s->device_driver_type);
+
+ qemu_get_buffer(f, s->ipaddr, 4);
+ qemu_get_buffer(f, s->macaddr, 6);
+
+ qemu_get_buffer(f, s->ap_ipaddr, 4);
+ qemu_get_buffer(f, s->ap_macaddr, 6);
+
+
+ qemu_get_be32s(f, &s->interrupt_p_mask);
+ for (i=0; i<5; qemu_get_be32s(f, &s->interrupt_s_mask[i++]));
+ qemu_get_8s(f, &s->interrupt_enabled);
+
+ qemu_get_be32s(f, &s->current_frequency);
+ qemu_get_be32s(f, &direct_value);
+ s->receive_queue_address = (uint32_t*)direct_value;
+ qemu_get_be32s(f, &s->receive_queue_count);
+
+ qemu_get_be32s(f, &s->transmit_queue_size);
+ for (i=0; i<16; i++)
+ {
+ qemu_get_8s(f, &s->transmit_queue_enabled[i]);
+ qemu_get_be32s(f, &direct_value);
+ s->transmit_queue_address[i] = (uint32_t*)direct_value;
+ qemu_get_be32s(f, &s->transmit_queue_processed[i]);
+ }
+
+ qemu_get_be32s(f, &s->ap_state);
+ qemu_get_be32s(f, &s->inject_sequence_number);
+
+ qemu_get_buffer(f, (uint8_t *)s->mem, Atheros_WLAN_MEM_SIZE);
+
+
+ s->inject_timer_running = 0;
+ s->inject_queue_size = 0;
+ s->inject_queue = NULL;
+
+ return 0;
+}
+
+
+void pci_Atheros_WLAN_init(PCIBus *bus, NICInfo *nd, int devfn)
+{
+ PCIAtheros_WLANState *d;
+ Atheros_WLANState *s;
+
+ /*
+ * currently, we have to use this mac-address.
+ * it is hardcoded in the eeprom/io-stuff
+ */
+ nd->macaddr[0] = 0x00;
+ nd->macaddr[1] = 0x11;
+ nd->macaddr[2] = 0x0a;
+ nd->macaddr[3] = 0x80;
+ nd->macaddr[4] = 0x2e;
+ nd->macaddr[5] = 0x9e;
+
+ d = (PCIAtheros_WLANState *)pci_register_device(bus, "Atheros_WLAN", sizeof(PCIAtheros_WLANState), devfn, NULL, NULL);
+ s = &d->Atheros_WLAN;
+
+ // s->irq = 9; /* PCI interrupt */
+ s->irq = d->dev.irq[0];
+ s->pci_dev = (PCIDevice *)d;
+ s->pending_interrupts = NULL;
+ memcpy(s->macaddr, nd->macaddr, 6);
+
+ Atheros_WLAN_setup_type(nd, d);
+ Atheros_WLAN_setup_io(d);
+ Atheros_WLAN_setup_ap(nd, d);
+
+ /* TODO: we don't support multiple instance yet!! */
+ register_savevm("Atheros_WLAN", 0, 3, Atheros_WLAN_save, Atheros_WLAN_load, s);
+
+ Atheros_WLAN_reset(nd, s);
+}
diff -Nurp qemu-0.9.1-untouched/hw/atheros_wlan_crc32.c qemu-0.9.1/hw/atheros_wlan_crc32.c
--- qemu-0.9.1-untouched/hw/atheros_wlan_crc32.c 1970-01-01 01:00:00.000000000 +0100
+++ qemu-0.9.1/hw/atheros_wlan_crc32.c 2008-02-28 14:02:51.000000000 +0100
@@ -0,0 +1,238 @@
+/* crc32.c
+ * CRC-32 routine
+ *
+ * $Id: crc32.c 18197 2006-05-21 05:12:17Z sahlberg $
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * Copied from README.developer
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Credits:
+ *
+ * Table from Solomon Peachy
+ * Routine from Chris Waters
+ */
+
+#include "atheros_wlan_crc32.h"
+
+/*
+ * Table for the AUTODIN/HDLC/802.x CRC.
+ *
+ * Polynomial is
+ *
+ * x^32 + x^26 + x^23 + x^22 + x^16 + x^12 + x^11 + x^8 + x^7 +
+ * x^5 + x^4 + x^2 + x + 1
+ */
+const guint32 crc32_ccitt_table[256] = {
+ 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
+ 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
+ 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
+ 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
+ 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
+ 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
+ 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
+ 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
+ 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
+ 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
+ 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
+ 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
+ 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
+ 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
+ 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
+ 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
+ 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
+ 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
+ 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
+ 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
+ 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
+ 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
+ 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
+ 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
+ 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
+ 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
+ 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
+ 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
+ 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
+ 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
+ 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
+ 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
+ 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
+ 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
+ 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
+ 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
+ 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
+ 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
+ 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
+ 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
+ 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
+ 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
+ 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
+ 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
+ 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
+ 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
+ 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
+ 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
+ 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
+ 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
+ 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
+ 0x2d02ef8d
+};
+
+#define CRC32_CCITT_SEED 0xFFFFFFFF
+
+guint32
+crc32_ccitt(const guint8 *buf, guint len)
+{
+ return ( crc32_ccitt_seed(buf, len, CRC32_CCITT_SEED) );
+}
+
+guint32
+crc32_ccitt_seed(const guint8 *buf, guint len, guint32 seed)
+{
+ guint i;
+ guint32 crc32 = seed;
+
+ for (i = 0; i < len; i++)
+ crc32 = crc32_ccitt_table[(crc32 ^ buf[i]) & 0xff] ^ (crc32 >> 8);
+
+ return ( ~crc32 );
+}
+
+
+
+
+
+
+
+
+
+
+/*
+ * Checksum routine for Internet Protocol family headers (Portable Version).
+ *
+ * This routine is very heavily used in the network
+ * code and should be modified for each CPU to be as fast as possible.
+ */
+
+#define ADDCARRY(x) (x > 65535 ? x -= 65535 : x)
+#define REDUCE {l_util.l = sum; sum = l_util.s[0] + l_util.s[1]; ADDCARRY(sum);}
+
+int
+in_cksum(const vec_t *vec, int veclen)
+{
+ register const guint16 *w;
+ register int sum = 0;
+ register int mlen = 0;
+ int byte_swapped = 0;
+
+ union {
+ guint8 c[2];
+ guint16 s;
+ } s_util;
+ union {
+ guint16 s[2];
+ guint32 l;
+ } l_util;
+
+ for (; veclen != 0; vec++, veclen--) {
+ if (vec->len == 0)
+ continue;
+ w = (const guint16 *)vec->ptr;
+ if (mlen == -1) {
+ /*
+ * The first byte of this chunk is the continuation
+ * of a word spanning between this chunk and the
+ * last chunk.
+ *
+ * s_util.c[0] is already saved when scanning previous
+ * chunk.
+ */
+ s_util.c[1] = *(const guint8 *)w;
+ sum += s_util.s;
+ w = (const guint16 *)((const guint8 *)w + 1);
+ mlen = vec->len - 1;
+ } else
+ mlen = vec->len;
+ /*
+ * Force to even boundary.
+ */
+ if ((1 & (unsigned long) w) && (mlen > 0)) {
+ REDUCE;
+ sum <<= 8;
+ s_util.c[0] = *(const guint8 *)w;
+ w = (const guint16 *)((const guint8 *)w + 1);
+ mlen--;
+ byte_swapped = 1;
+ }
+ /*
+ * Unroll the loop to make overhead from
+ * branches &c small.
+ */
+ while ((mlen -= 32) >= 0) {
+ sum += w[0]; sum += w[1]; sum += w[2]; sum += w[3];
+ sum += w[4]; sum += w[5]; sum += w[6]; sum += w[7];
+ sum += w[8]; sum += w[9]; sum += w[10]; sum += w[11];
+ sum += w[12]; sum += w[13]; sum += w[14]; sum += w[15];
+ w += 16;
+ }
+ mlen += 32;
+ while ((mlen -= 8) >= 0) {
+ sum += w[0]; sum += w[1]; sum += w[2]; sum += w[3];
+ w += 4;
+ }
+ mlen += 8;
+ if (mlen == 0 && byte_swapped == 0)
+ continue;
+ REDUCE;
+ while ((mlen -= 2) >= 0) {
+ sum += *w++;
+ }
+ if (byte_swapped) {
+ REDUCE;
+ sum <<= 8;
+ byte_swapped = 0;
+ if (mlen == -1) {
+ s_util.c[1] = *(const guint8 *)w;
+ sum += s_util.s;
+ mlen = 0;
+ } else
+ mlen = -1;
+ } else if (mlen == -1)
+ s_util.c[0] = *(const guint8 *)w;
+ }
+ if (mlen == -1) {
+ /* The last mbuf has odd # of bytes. Follow the
+ standard (the odd byte may be shifted left by 8 bits
+ or not as determined by endian-ness of the machine) */
+ s_util.c[1] = 0;
+ sum += s_util.s;
+ }
+ REDUCE;
+ return (~sum & 0xffff);
+}
+
+guint16 ip_checksum(const guint8 *ptr, int len)
+{
+ vec_t cksum_vec[1];
+
+ cksum_vec[0].ptr = ptr;
+ cksum_vec[0].len = len;
+ return in_cksum(&cksum_vec[0], 1);
+}
+
diff -Nurp qemu-0.9.1-untouched/hw/atheros_wlan_crc32.h qemu-0.9.1/hw/atheros_wlan_crc32.h
--- qemu-0.9.1-untouched/hw/atheros_wlan_crc32.h 1970-01-01 01:00:00.000000000 +0100
+++ qemu-0.9.1/hw/atheros_wlan_crc32.h 2008-02-28 14:02:51.000000000 +0100
@@ -0,0 +1,51 @@
+/* crc32.h
+ * Declaration of CRC-32 routine and table
+ *
+ * $Id: crc32.h 20485 2007-01-18 18:43:30Z guy $
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * Copied from README.developer
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __CRC32_H_
+#define __CRC32_H_
+
+#define guint32 unsigned long
+#define guint16 unsigned short
+#define guint8 unsigned char
+#define guint unsigned int
+
+extern const guint32 crc32_ccitt_table[256];
+
+extern guint32 crc32_ccitt(const guint8 *buf, guint len);
+extern guint32 crc32_ccitt_seed(const guint8 *buf, guint len, guint32 seed);
+
+
+typedef struct {
+ const guint8 *ptr;
+ int len;
+} vec_t;
+
+extern int in_cksum(const vec_t *vec, int veclen);
+extern guint16 ip_checksum(const guint8 *ptr, int len);
+
+
+
+#endif /* crc32.h */
diff -Nurp qemu-0.9.1-untouched/hw/atheros_wlan_eeprom.h qemu-0.9.1/hw/atheros_wlan_eeprom.h
--- qemu-0.9.1-untouched/hw/atheros_wlan_eeprom.h 1970-01-01 01:00:00.000000000 +0100
+++ qemu-0.9.1/hw/atheros_wlan_eeprom.h 2008-02-28 14:02:51.000000000 +0100
@@ -0,0 +1,1137 @@
+/**
+ * QEMU WLAN device emulation
+ *
+ * Copyright (c) 2008 Clemens Kolbitsch
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Modifications:
+ * 2008-February-24 Clemens Kolbitsch :
+ * New implementation based on ne2000.c
+ *
+ */
+
+#ifndef atheros_wlan_eeprom
+#define atheros_wlan_eeprom 1
+
+
+/*
+ * on my laptop the atheros card is at
+ *
+ * lspci -n
+ * 02:04:00 0200 168c:0013 (rev 01)
+ *
+ * lspci
+ * 02:04.0 Ethernet controller: Atheros Communications, Inc. AR5212 802.11abg NIC (rev 01)
+ *
+ *
+ *
+ * values found on my laptop using
+ *
+ * sudo pcitweak 02:04:00 0
+ * sudo pcitweak 02:04:00 4
+ * sudo pcitweak 02:04:00 8
+ * sudo pcitweak 02:04:00 12
+ * ...
+ * sudo pcitweak -r 02:04:00 -b 52 // to read byte-values
+ *
+ * OR
+ *
+ * sudo lspci -xxxx > tmp
+ * lspci2devconfig tmp
+ */
+
+const unsigned int Atheros_WLAN_eeprom_data_MacBook[] =
+{
+ 0x168c, 0x0200, 0x0001, 0x0000, 0x5001, 0x0000, 0x00e6, 0x0e11,
+ 0x1c0a, 0x0100, 0x0000, 0x0002, 0x0002, 0xc606, 0x0001, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x2e9e, 0x0a80, 0x0011, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x5aa5, 0x0000, 0x0000, 0x0313,
+ 0x4943, 0x2053, 0x7104, 0x1202, 0x0400, 0x0306, 0x0001, 0x0000,
+ 0x0500, 0x410e, 0x39b1, 0x1eb5, 0x4e2d, 0x3056, 0xffff, 0xe902,
+ 0x0700, 0x0106, 0x0000, 0x0100, 0x1500, 0x0752, 0x4101, 0x6874,
+ 0x7265, 0x736f, 0x4320, 0x6d6f, 0x756d, 0x696e, 0x6163, 0x6974,
+ 0x6e6f, 0x2c73, 0x4920, 0x636e, 0x002e, 0x5241, 0x3035, 0x3130,
+ 0x302d, 0x3030, 0x2d30, 0x3030, 0x3030, 0x5700, 0x7269, 0x6c65,
+ 0x7365, 0x2073, 0x414c, 0x204e, 0x6552, 0x6566, 0x6572, 0x636e,
+ 0x2065, 0x6143, 0x6472, 0x3000, 0x0030, 0x00ff, 0x2100, 0x0602,
+ 0x2201, 0x0205, 0x8d80, 0x005b, 0x0522, 0x4002, 0x8954, 0x2200,
+ 0x0205, 0x1b00, 0x00b7, 0x0522, 0x8002, 0x12a8, 0x2201, 0x0205,
+ 0x3600, 0x016e, 0x0522, 0x0002, 0x2551, 0x2202, 0x0205, 0x6c00,
+ 0x02dc, 0x0522, 0x8002, 0x37f9, 0x2203, 0x0205, 0xa200, 0x044a,
+ 0x0222, 0x0803, 0x0822, 0x0604, 0x0011, 0x0a80, 0x2e9e, 0x0222,
+ 0x0105, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0060, 0x6115,
+ 0x3004, 0x5a06, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x2d2c, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0xe028, 0xa492, 0x1c00, 0x000e, 0xb8ca, 0x01bb, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x233c, 0x0214, 0x1100, 0x0460, 0x8400, 0xda22, 0x021c,
+ 0x0007, 0xb0ff, 0x01b7, 0x4024, 0x0001, 0x0170, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x2d3c, 0x0214, 0x1100, 0x0460,
+ 0x8400, 0xe022, 0x021c, 0x000e, 0xb0ff, 0x01b7, 0x401b, 0x0079,
+ 0x8e70, 0x0020, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1112,
+ 0x3132, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xe014, 0x5461,
+ 0xc7e1, 0x9259, 0xe8a4, 0x9c34, 0x5359, 0x96de, 0x7e18, 0xa494,
+ 0x9c34, 0x1359, 0x86dd, 0x7e18, 0xa390, 0xa814, 0x5459, 0x96dd,
+ 0x7e08, 0xa390, 0xa814, 0x5459, 0x96dd, 0x7e08, 0xa390, 0x6044,
+ 0x1251, 0x55d9, 0x69b7, 0x5e7c, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x7079, 0xe79e, 0xb879, 0xe79e,
+ 0x7079, 0xc698, 0x8979, 0xc698, 0xa279, 0xc698, 0x7075, 0x7a84,
+ 0x8e9d, 0xa2a7, 0x2224, 0x2424, 0x2424, 0x223c, 0x7075, 0x7a84,
+ 0x8e9d, 0xa2a7, 0x1c24, 0x2424, 0x2424, 0x1c3c, 0x7075, 0x7a84,
+ 0x8e9d, 0xa7ac, 0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c, 0x7075, 0x7a84,
+ 0x8e9d, 0xa7ac, 0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xbad1,
+ 0x0205, 0x0013, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff
+};
+
+const unsigned char Atheros_WLAN_pci_config_MacBook[] =
+{
+ 0x8c, 0x16, 0x1c, 0x00, 0x07, 0x00, 0x10, 0x00,
+ 0x01, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x10, 0x90, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x50, 0x00, 0x00, 0x6b, 0x10, 0x86, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0b, 0x01, 0x00, 0x00,
+ 0x01, 0x50, 0xc2, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x05, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x90, 0x11, 0x00, 0xc0, 0x0c, 0x04, 0x05,
+ 0x10, 0x20, 0x0a, 0x00, 0x11, 0x3c, 0x03, 0x00,
+ 0x4b, 0x00, 0x11, 0x10, 0x00, 0x00, 0x00, 0x00,
+ 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x01, 0x14, 0x00, 0x00, 0x10, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x11, 0x20, 0x06, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xb4, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x04,
+ 0x01, 0x01, 0x00, 0x00, 0x34, 0x00, 0x01, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x80,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x76, 0x00, 0x63, 0x01, 0xff, 0xff, 0xff, 0xff,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x3f, 0x00, 0x0f,
+ 0x20, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xaa, 0x13, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x56, 0x61, 0x03, 0x10, 0x00, 0x00, 0x08,
+ 0x10, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00,
+ 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+
+};
+
+const unsigned int Atheros_WLAN_eeprom_data_HPW400_new_nonworking[] =
+{
+ 0x168c, 0x0200, 0x0001, 0x0000, 0x5001, 0x0000, 0x00e6, 0x0e11,
+ 0x1c0a, 0x0100, 0x0000, 0x0002, 0x0002, 0xc606, 0x0001, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x2e9e, 0x0a80, 0x0011, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x5aa5, 0x0000, 0x0000, 0x0313,
+ 0x4943, 0x2053, 0x7104, 0x1202, 0x0400, 0x0306, 0x0001, 0x0000,
+ 0x0500, 0x410e, 0x39b1, 0x1eb5, 0x4e2d, 0x3056, 0xffff, 0xe902,
+ 0x0700, 0x0106, 0x0000, 0x0100, 0x1500, 0x0752, 0x4101, 0x6874,
+ 0x7265, 0x736f, 0x4320, 0x6d6f, 0x756d, 0x696e, 0x6163, 0x6974,
+ 0x6e6f, 0x2c73, 0x4920, 0x636e, 0x002e, 0x5241, 0x3035, 0x3130,
+ 0x302d, 0x3030, 0x2d30, 0x3030, 0x3030, 0x5700, 0x7269, 0x6c65,
+ 0x7365, 0x2073, 0x414c, 0x204e, 0x6552, 0x6566, 0x6572, 0x636e,
+ 0x2065, 0x6143, 0x6472, 0x3000, 0x0030, 0x00ff, 0x2100, 0x0602,
+ 0x2201, 0x0205, 0x8d80, 0x005b, 0x0522, 0x4002, 0x8954, 0x2200,
+ 0x0205, 0x1b00, 0x00b7, 0x0522, 0x8002, 0x12a8, 0x2201, 0x0205,
+ 0x3600, 0x016e, 0x0522, 0x0002, 0x2551, 0x2202, 0x0205, 0x6c00,
+ 0x02dc, 0x0522, 0x8002, 0x37f9, 0x2203, 0x0205, 0xa200, 0x044a,
+ 0x0222, 0x0803, 0x0822, 0x0604, 0x0011, 0x0a80, 0x2e9e, 0x0222,
+ 0x0105, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0060, 0x6115,
+ 0x3004, 0x5a06, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x2d2c, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0xe028, 0xa492, 0x1c00, 0x000e, 0xb8ca, 0x01bb, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x233c, 0x0214, 0x1100, 0x0460, 0x8400, 0xda22, 0x021c,
+ 0x0007, 0xb0ff, 0x01b7, 0x4024, 0x0001, 0x0170, 0x0000, 0x0013,
+ 0x168c, 0x0200, 0x0001, 0x0000, 0x5001, 0x0000, 0x00e6, 0x0e11,
+ 0x1c0a, 0x0100, 0x0000, 0x0002, 0x0002, 0xc606, 0x0001, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x2e9e, 0x0a80, 0x0011, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x5aa5, 0x0000, 0x0000, 0x0313,
+ 0x4943, 0x2053, 0x7104, 0x1202, 0x0400, 0x0306, 0x0001, 0x0000,
+ 0x0500, 0x410e, 0x39b1, 0x1eb5, 0x4e2d, 0x3056, 0xffff, 0xe902,
+ 0x0700, 0x0106, 0x0000, 0x0100, 0x1500, 0x0752, 0x4101, 0x6874,
+ 0x7265, 0x736f, 0x4320, 0x6d6f, 0x756d, 0x696e, 0x6163, 0x6974,
+ 0x6e6f, 0x2c73, 0x4920, 0x636e, 0x002e, 0x5241, 0x3035, 0x3130,
+ 0x302d, 0x3030, 0x2d30, 0x3030, 0x3030, 0x5700, 0x7269, 0x6c65,
+ 0x7365, 0x2073, 0x414c, 0x204e, 0x6552, 0x6566, 0x6572, 0x636e,
+ 0x2065, 0x6143, 0x6472, 0x3000, 0x0030, 0x00ff, 0x2100, 0x0602,
+ 0x2201, 0x0205, 0x8d80, 0x005b, 0x0522, 0x4002, 0x8954, 0x2200,
+ 0x0205, 0x1b00, 0x00b7, 0x0522, 0x8002, 0x12a8, 0x2201, 0x0205,
+ 0x3600, 0x016e, 0x0522, 0x0002, 0x2551, 0x2202, 0x0205, 0x6c00,
+ 0x02dc, 0x0522, 0x8002, 0x37f9, 0x2203, 0x0205, 0xa200, 0x044a,
+ 0x0222, 0x0803, 0x0822, 0x0604, 0x0011, 0x0a80, 0x2e9e, 0x0222,
+ 0x0105, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0060, 0x6115,
+ 0x3004, 0x5a06, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x2d2c, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0xe028, 0xa492, 0x1c00, 0x000e, 0xb8ca, 0x01bb, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x233c, 0x0214, 0x1100, 0x0460, 0x8400, 0xda22, 0x021c,
+ 0x0007, 0xb0ff, 0x01b7, 0x4024, 0x0001, 0x0170, 0x0000, 0x0013,
+ 0x168c, 0x0200, 0x0001, 0x0000, 0x5001, 0x0000, 0x00e6, 0x0e11,
+ 0x1c0a, 0x0100, 0x0000, 0x0002, 0x0002, 0xc606, 0x0001, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x2e9e, 0x0a80, 0x0011, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x5aa5, 0x0000, 0x0000, 0x0313,
+ 0x4943, 0x2053, 0x7104, 0x1202, 0x0400, 0x0306, 0x0001, 0x0000,
+ 0x0500, 0x410e, 0x39b1, 0x1eb5, 0x4e2d, 0x3056, 0xffff, 0xe902,
+ 0x0700, 0x0106, 0x0000, 0x0100, 0x1500, 0x0752, 0x4101, 0x6874,
+ 0x7265, 0x736f, 0x4320, 0x6d6f, 0x756d, 0x696e, 0x6163, 0x6974,
+ 0x6e6f, 0x2c73, 0x4920, 0x636e, 0x002e, 0x5241, 0x3035, 0x3130,
+ 0x302d, 0x3030, 0x2d30, 0x3030, 0x3030, 0x5700, 0x7269, 0x6c65,
+ 0x7365, 0x2073, 0x414c, 0x204e, 0x6552, 0x6566, 0x6572, 0x636e,
+ 0x2065, 0x6143, 0x6472, 0x3000, 0x0030, 0x00ff, 0x2100, 0x0602,
+ 0x2201, 0x0205, 0x8d80, 0x005b, 0x0522, 0x4002, 0x8954, 0x2200,
+ 0x0205, 0x1b00, 0x00b7, 0x0522, 0x8002, 0x12a8, 0x2201, 0x0205,
+ 0x3600, 0x016e, 0x0522, 0x0002, 0x2551, 0x2202, 0x0205, 0x6c00,
+ 0x02dc, 0x0522, 0x8002, 0x37f9, 0x2203, 0x0205, 0xa200, 0x044a,
+ 0x0222, 0x0803, 0x0822, 0x0604, 0x0011, 0x0a80, 0x2e9e, 0x0222,
+ 0x0105, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0060, 0x6115,
+ 0x3004, 0x5a06, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x2d2c, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0xe028, 0xa492, 0x1c00, 0x000e, 0xb8ca, 0x01bb, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x233c, 0x0214, 0x1100, 0x0460, 0x8400, 0xda22, 0x021c,
+ 0x0007, 0xb0ff, 0x01b7, 0x4024, 0x0001, 0x0170, 0x0000, 0x0013,
+ 0x168c, 0x0200, 0x0001, 0x0000, 0x5001, 0x0000, 0x00e6, 0x0e11,
+ 0x1c0a, 0x0100, 0x0000, 0x0002, 0x0002, 0xc606, 0x0001, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x2e9e, 0x0a80, 0x0011, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x5aa5, 0x0000, 0x0000, 0x0313,
+ 0x4943, 0x2053, 0x7104, 0x1202, 0x0400, 0x0306, 0x0001, 0x0000,
+ 0x0500, 0x410e, 0x39b1, 0x1eb5, 0x4e2d, 0x3056, 0xffff, 0xe902,
+ 0x0700, 0x0106, 0x0000, 0x0100, 0x1500, 0x0752, 0x4101, 0x6874,
+ 0x7265, 0x736f, 0x4320, 0x6d6f, 0x756d, 0x696e, 0x6163, 0x6974,
+ 0x6e6f, 0x2c73, 0x4920, 0x636e, 0x002e, 0x5241, 0x3035, 0x3130,
+ 0x302d, 0x3030, 0x2d30, 0x3030, 0x3030, 0x5700, 0x7269, 0x6c65,
+ 0x7365, 0x2073, 0x414c, 0x204e, 0x6552, 0x6566, 0x6572, 0x636e,
+ 0x2065, 0x6143, 0x6472, 0x3000, 0x0030, 0x00ff, 0x2100, 0x0602,
+ 0x2201, 0x0205, 0x8d80, 0x005b, 0x0522, 0x4002, 0x8954, 0x2200,
+ 0x0205, 0x1b00, 0x00b7, 0x0522, 0x8002, 0x12a8, 0x2201, 0x0205,
+ 0x3600, 0x016e, 0x0522, 0x0002, 0x2551, 0x2202, 0x0205, 0x6c00,
+ 0x02dc, 0x0522, 0x8002, 0x37f9, 0x2203, 0x0205, 0xa200, 0x044a,
+ 0x0222, 0x0803, 0x0822, 0x0604, 0x0011, 0x0a80, 0x2e9e, 0x0222,
+ 0x0105, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0060, 0x6115,
+ 0x3004, 0x5a06, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x2d2c, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0xe028, 0xa492, 0x1c00, 0x000e, 0xb8ca, 0x01bb, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x233c, 0x0214, 0x1100, 0x0460, 0x8400, 0xda22, 0x021c,
+ 0x0007, 0xb0ff, 0x01b7, 0x4024, 0x0001, 0x0170, 0x0000, 0x0013,
+ 0x168c, 0x0200, 0x0001, 0x0000, 0x5001, 0x0000, 0x00e6, 0x0e11,
+ 0x1c0a, 0x0100, 0x0000, 0x0002, 0x0002, 0xc606, 0x0001, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x2e9e, 0x0a80, 0x0011, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x5aa5, 0x0000, 0x0000, 0x0313,
+ 0x4943, 0x2053, 0x7104, 0x1202, 0x0400, 0x0306, 0x0001, 0x0000,
+ 0x0500, 0x410e, 0x39b1, 0x1eb5, 0x4e2d, 0x3056, 0xffff, 0xe902,
+ 0x0700, 0x0106, 0x0000, 0x0100, 0x1500, 0x0752, 0x4101, 0x6874,
+ 0x7265, 0x736f, 0x4320, 0x6d6f, 0x756d, 0x696e, 0x6163, 0x6974,
+ 0x6e6f, 0x2c73, 0x4920, 0x636e, 0x002e, 0x5241, 0x3035, 0x3130,
+ 0x302d, 0x3030, 0x2d30, 0x3030, 0x3030, 0x5700, 0x7269, 0x6c65,
+ 0x7365, 0x2073, 0x414c, 0x204e, 0x6552, 0x6566, 0x6572, 0x636e,
+ 0x2065, 0x6143, 0x6472, 0x3000, 0x0030, 0x00ff, 0x2100, 0x0602,
+ 0x2201, 0x0205, 0x8d80, 0x005b, 0x0522, 0x4002, 0x8954, 0x2200,
+ 0x0205, 0x1b00, 0x00b7, 0x0522, 0x8002, 0x12a8, 0x2201, 0x0205,
+ 0x3600, 0x016e, 0x0522, 0x0002, 0x2551, 0x2202, 0x0205, 0x6c00,
+ 0x02dc, 0x0522, 0x8002, 0x37f9, 0x2203, 0x0205, 0xa200, 0x044a,
+ 0x0222, 0x0803, 0x0822, 0x0604, 0x0011, 0x0a80, 0x2e9e, 0x0222,
+ 0x0105, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0060, 0x6115,
+ 0x3004, 0x5a06, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x2d2c, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0xe028, 0xa492, 0x1c00, 0x000e, 0xb8ca, 0x01bb, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x233c, 0x0214, 0x1100, 0x0460, 0x8400, 0xda22, 0x021c
+};
+
+const unsigned int Atheros_WLAN_eeprom_data_HPW400[] =
+{
+ 0x168c, 0x0200, 0x0001, 0x0000, 0x5001, 0x0000, 0x00e6, 0x0e11,
+ 0x1c0a, 0x0100, 0x0000, 0x0002, 0x0002, 0xc606, 0x0001, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x2e9e, 0x0a80, 0x0011, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x5aa5, 0x0000, 0x0000, 0x0313,
+ 0x4943, 0x2053, 0x7104, 0x1202, 0x0400, 0x0306, 0x0001, 0x0000,
+ 0x0500, 0x410e, 0x39b1, 0x1eb5, 0x4e2d, 0x3056, 0xffff, 0xe902,
+ 0x0700, 0x0106, 0x0000, 0x0100, 0x1500, 0x0752, 0x4101, 0x6874,
+ 0x7265, 0x736f, 0x4320, 0x6d6f, 0x756d, 0x696e, 0x6163, 0x6974,
+ 0x6e6f, 0x2c73, 0x4920, 0x636e, 0x002e, 0x5241, 0x3035, 0x3130,
+ 0x302d, 0x3030, 0x2d30, 0x3030, 0x3030, 0x5700, 0x7269, 0x6c65,
+ 0x7365, 0x2073, 0x414c, 0x204e, 0x6552, 0x6566, 0x6572, 0x636e,
+ 0x2065, 0x6143, 0x6472, 0x3000, 0x0030, 0x00ff, 0x2100, 0x0602,
+ 0x2201, 0x0205, 0x8d80, 0x005b, 0x0522, 0x4002, 0x8954, 0x2200,
+ 0x0205, 0x1b00, 0x00b7, 0x0522, 0x8002, 0x12a8, 0x2201, 0x0205,
+ 0x3600, 0x016e, 0x0522, 0x0002, 0x2551, 0x2202, 0x0205, 0x6c00,
+ 0x02dc, 0x0522, 0x8002, 0x37f9, 0x2203, 0x0205, 0xa200, 0x044a,
+ 0x0222, 0x0803, 0x0822, 0x0604, 0x0011, 0x0a80, 0x2e9e, 0x0222,
+ 0x0105, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0060, 0x6115,
+ 0x3004, 0x5a06, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x2d2c, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0xe028, 0xa492, 0x1c00, 0x000e, 0xb8ca, 0x01bb, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x233c, 0x0214, 0x1100, 0x0460, 0x8400, 0xda22, 0x021c,
+ 0x0007, 0xb0ff, 0x01b7, 0x4024, 0x0001, 0x0170, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x2d3c, 0x0214, 0x1100, 0x0460,
+ 0x8400, 0xe022, 0x021c, 0x000e, 0xb0ff, 0x01b7, 0x401b, 0x0079,
+ 0x8e70, 0x0020, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1112,
+ 0x3132, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xe014, 0x5461,
+ 0xc7e1, 0x9259, 0xe8a4, 0x9c34, 0x5359, 0x96de, 0x7e18, 0xa494,
+ 0x9c34, 0x1359, 0x86dd, 0x7e18, 0xa390, 0xa814, 0x5459, 0x96dd,
+ 0x7e08, 0xa390, 0xa814, 0x5459, 0x96dd, 0x7e08, 0xa390, 0x6044,
+ 0x1251, 0x55d9, 0x69b7, 0x5e7c, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x7079, 0xe79e, 0xb879, 0xe79e,
+ 0x7079, 0xc698, 0x8979, 0xc698, 0xa279, 0xc698, 0x7075, 0x7a84,
+ 0x8e9d, 0xa2a7, 0x2224, 0x2424, 0x2424, 0x223c, 0x7075, 0x7a84,
+ 0x8e9d, 0xa2a7, 0x1c24, 0x2424, 0x2424, 0x1c3c, 0x7075, 0x7a84,
+ 0x8e9d, 0xa7ac, 0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c, 0x7075, 0x7a84,
+ 0x8e9d, 0xa7ac, 0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xbad1,
+ 0x0205, 0x0013, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff
+};
+
+const unsigned char Atheros_WLAN_pci_config_HPW400[] =
+{
+ 0x8c, 0x16, 0x13, 0x00, 0x06, 0x00, 0x90, 0x02,
+ 0x01, 0x00, 0x00, 0x02, 0x10, 0xa8, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x90, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x50, 0x00, 0x00, 0x11, 0x0e, 0xe6, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0b, 0x01, 0x0a, 0x1c,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00,
+ 0x00, 0x40, 0x00, 0xc6, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+/*
+ * Thanks Paolo :-)
+ */
+const unsigned char Atheros_WLAN_pci_config_AR5001XPlus[] =
+{
+ 0x8c, 0x16, 0x13, 0x00, 0x16, 0x01, 0x90, 0x02,
+ 0x01, 0x00, 0x00, 0x02, 0x10, 0xa8, 0x00, 0x00,
+ 0x00, 0x00, 0x0e, 0xe0, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x50, 0x00, 0x00, 0x4f, 0x14, 0x58, 0x70,
+ 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x05, 0x01, 0x0a, 0x1c,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00,
+ 0x00, 0x40, 0x00, 0xc6, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+
+/*
+ * Thanks John Denker :-)
+ */
+const unsigned char Atheros_WLAN_pci_config_JOHN[] =
+{
+ 0x8c, 0x16, 0x14, 0x10, 0x16, 0x01, 0x90, 0x02,
+ 0x01, 0x00, 0x00, 0x02, 0x08, 0xa8, 0x00, 0x00,
+ 0x00, 0x00, 0x21, 0xc0, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x50, 0x00, 0x00, 0xab, 0x17, 0x31, 0x83,
+ 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0b, 0x01, 0x0a, 0x1c,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00,
+ 0x00, 0x40, 0x00, 0xc6, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+
+/*
+ * Thanks Zzav (?? MadWifi mailing list)
+ *
+ * it's a TP-LINK TL-WN651G
+ * http://www.tp-link.com/products/product_des.asp?id=17
+ */
+const unsigned char Atheros_WLAN_pci_config_TP_Link_WN651G[] =
+{
+ 0x8c, 0x16, 0x13, 0x00, 0x16, 0x00, 0x90, 0x02,
+ 0x01, 0x00, 0x00, 0x02, 0x08, 0xa8, 0x00, 0x00,
+ 0x00, 0x00, 0xbf, 0xfe, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x50, 0x00, 0x00, 0x8c, 0x16, 0x51, 0x10,
+ 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0a, 0x01, 0x0a, 0x1c
+};
+
+#endif // atheros_wlan_eeprom
diff -Nurp qemu-0.9.1-untouched/hw/atheros_wlan.h qemu-0.9.1/hw/atheros_wlan.h
--- qemu-0.9.1-untouched/hw/atheros_wlan.h 1970-01-01 01:00:00.000000000 +0100
+++ qemu-0.9.1/hw/atheros_wlan.h 2008-02-28 14:17:02.000000000 +0100
@@ -0,0 +1,345 @@
+/**
+ * QEMU WLAN device emulation
+ *
+ * Copyright (c) 2008 Clemens Kolbitsch
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Modifications:
+ * 2008-February-24 Clemens Kolbitsch :
+ * New implementation based on ne2000.c
+ *
+ */
+
+#ifndef atheros_wlan_h
+#define atheros_wlan_h 1
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/shm.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+#include <sys/mman.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+
+/*
+ * debug Atheros_WLAN card
+ *
+ * i.e. show all access traces
+ */
+// #define DEBUG_Atheros_WLAN 1
+// #define DEBUG_Atheros_AP_WLAN 1
+
+#define PCI_FREQUENCY 33000000L
+
+#if defined (DEBUG_Atheros_WLAN)
+# define DEBUG_PRINT(x) do { struct timeval __tt; gettimeofday(&__tt, NULL); printf("%u:%u ", __tt.tv_sec, __tt.tv_usec); printf x ; } while (0)
+#else
+# define DEBUG_PRINT(x)
+#endif
+
+#if defined (DEBUG_Atheros_AP_WLAN)
+# define DEBUG_PRINT_AP(x) printf x ;
+#else
+# define DEBUG_PRINT_AP(x)
+#endif
+
+
+
+/*
+ * The madwifi driver crashes if too
+ * many frames are in the receive
+ * queue linked list
+ *
+ * This can happen when interrupts are
+ * not picked up right away (what can
+ * happen due to qemu's lazy interrupt
+ * checking/handling)!!
+ *
+ * UPDATE: BinaryHAL suddenly seems to
+ * work with the WINDOWS_RX_FRAME as well
+ * which is even better (because more frames
+ * may be received concurrently...)
+ */
+#define MAX_CONCURRENT_RX_FRAMES_WINDOWS_OR_OPEN_HAL 999
+#define MAX_CONCURRENT_RX_FRAMES_BINARY_HAL 10
+#define MAX_CONCURRENT_RX_FRAMES MAX_CONCURRENT_RX_FRAMES_WINDOWS_OR_OPEN_HAL
+
+/*
+ * In case we are connecting with a windows guest OS
+ * (or the ndiswrapper of the windows driver) we must
+ * define this macro... otherwise no packets will be
+ * received.
+ *
+ * If connecting with a linux guest/madwifi with the
+ * macro defined it won't work on the other hand!!!
+ */
+#define WINXP_DRIVER 1
+#define LINUX_DRIVER 2
+
+#define PCI_CONFIG_AR5212 1
+#define PCI_CONFIG_AR5424 2
+
+
+
+
+
+#define IEEE80211_IDLE 0xff
+
+#define IEEE80211_TYPE_MGT 0x00
+#define IEEE80211_TYPE_CTL 0x01
+#define IEEE80211_TYPE_DATA 0x02
+
+#define IEEE80211_TYPE_MGT_SUBTYPE_BEACON 0x08
+#define IEEE80211_TYPE_MGT_SUBTYPE_ACTION 0x0d
+#define IEEE80211_TYPE_MGT_SUBTYPE_PROBE_REQ 0x04
+#define IEEE80211_TYPE_MGT_SUBTYPE_PROBE_RESP 0x05
+#define IEEE80211_TYPE_MGT_SUBTYPE_AUTHENTICATION 0x0b
+#define IEEE80211_TYPE_MGT_SUBTYPE_DEAUTHENTICATION 0x0c
+#define IEEE80211_TYPE_MGT_SUBTYPE_ASSOCIATION_REQ 0x00
+#define IEEE80211_TYPE_MGT_SUBTYPE_ASSOCIATION_RESP 0x01
+#define IEEE80211_TYPE_MGT_SUBTYPE_DISASSOCIATION 0x09
+
+#define IEEE80211_TYPE_CTL_SUBTYPE_ACK 0x0d
+
+#define IEEE80211_TYPE_DATA_SUBTYPE_DATA 0x00
+
+
+#define IEEE80211_BEACON_PARAM_SSID 0x00
+#define IEEE80211_BEACON_PARAM_SSID_STRING "\x00"
+#define IEEE80211_BEACON_PARAM_RATES 0x01
+#define IEEE80211_BEACON_PARAM_RATES_STRING "\x01"
+#define IEEE80211_BEACON_PARAM_CHANNEL 0x03
+#define IEEE80211_BEACON_PARAM_CHANNEL_STRING "\x03"
+#define IEEE80211_BEACON_PARAM_EXTENDED_RATES 0x32
+#define IEEE80211_BEACON_PARAM_EXTENDED_RATES_STRING "\x32"
+
+
+
+
+
+
+#define IEEE80211_CHANNEL1_FREQUENCY 2412
+#define IEEE80211_CHANNEL2_FREQUENCY 2417
+#define IEEE80211_CHANNEL3_FREQUENCY 2422
+#define IEEE80211_CHANNEL4_FREQUENCY 2427
+#define IEEE80211_CHANNEL5_FREQUENCY 2432
+#define IEEE80211_CHANNEL6_FREQUENCY 2437
+#define IEEE80211_CHANNEL7_FREQUENCY 2442
+#define IEEE80211_CHANNEL8_FREQUENCY 2447
+#define IEEE80211_CHANNEL9_FREQUENCY 2452
+#define IEEE80211_CHANNEL10_FREQUENCY 2457
+#define IEEE80211_CHANNEL11_FREQUENCY 2462
+
+
+#define IEEE80211_HEADER_SIZE 24
+
+struct mac80211_frame
+{
+ struct mac80211_frame_control
+ {
+ unsigned protocol_version :2;
+ unsigned type :2;
+ unsigned sub_type :4;
+
+ union
+ {
+ struct mac80211_frame_control_flags
+ {
+ unsigned to_ds :1;
+ unsigned from_ds :1;
+ unsigned more_frag :1;
+ unsigned retry :1;
+ unsigned power_mng :1;
+ unsigned more_data :1;
+ unsigned wep :1;
+ unsigned order :1;
+ } __attribute__((packed)) frame_control_flags;
+ uint8_t flags;
+ };
+
+ } __attribute__((packed)) frame_control;
+ uint16_t duration_id;
+
+ union
+ {
+ uint8_t address_1[6];
+ uint8_t destination_address[6];
+ };
+
+ union
+ {
+ uint8_t address_2[6];
+ uint8_t source_address[6];
+ };
+
+ union
+ {
+ uint8_t address_3[6];
+ uint8_t bssid_address[6];
+ };
+
+ struct mac80211_sequence_control
+ {
+ unsigned fragment_number :4;
+ unsigned sequence_number :12;
+ } __attribute__((packed)) sequence_control;
+
+ // WHEN IS THIS USED??
+ // uint8_t address_4[6];
+
+ // variable length, 2312 byte plus 4 byte frame-checksum
+ uint8_t data_and_fcs[2316];
+
+ unsigned int frame_length;
+ struct mac80211_frame *next_frame;
+
+} __attribute__((packed));
+
+
+#define GET_MEM_L(_mem, _addr) _mem[_addr >> 2]
+#define SET_MEM_L(_mem, _addr, _val) _mem[_addr >> 2] = _val
+
+#define WRITE_EEPROM(_mem, _val) \
+ SET_MEM_L(_mem, AR5K_EEPROM_DATA_5210, _val); \
+ SET_MEM_L(_mem, AR5K_EEPROM_DATA_5211, _val);
+
+
+
+
+#define Atheros_WLAN_PCI_REVID_ATHEROS 0x01
+#define Atheros_WLAN_PCI_REVID Atheros_WLAN_PCI_REVID_ATHEROS
+
+
+#define KiB 1024
+#define Atheros_WLAN_MEM_SIZE (64 * KiB)
+#define Atheros_WLAN_MEM_SANITIZE(x) (x & (Atheros_WLAN_MEM_SIZE - 1))
+
+#define Atheros_WLAN__STATE_NOT_AUTHENTICATED 0
+#define Atheros_WLAN__STATE_AUTHENTICATED 1
+#define Atheros_WLAN__STATE_ASSOCIATED 2
+
+
+#define Atheros_WLAN__MAX_INJECT_QUEUE_SIZE 20
+
+
+/*
+ * We use a semaphore to make sure
+ * that accessing the linked lists
+ * inside the state is done atomically
+ */
+#define ATHEROS_WLAN_ACCESS_SEM_KEY 20071
+
+
+/*
+ * AR521X uses a very complicated algorithm to
+ * express current channel... too lazy to understand
+ * it... just use a matrix :-)
+ *
+ * ATTENTION: This matrix is valid only for little-endian
+ * as the algorithm uses bitswapping
+ *
+ * NOTE: Maybe, bitswapping also takes care of this and
+ * big-endian values thus correspond with this matrix, but
+ * I just don't care ;-)
+ */
+struct Atheros_WLAN_frequency {
+ u_int32_t value1;
+ u_int32_t value2;
+ u_int32_t frequency;
+};
+
+struct pending_interrupt
+{
+ uint32_t status;
+ struct pending_interrupt *next;
+};
+
+typedef struct Atheros_WLANState
+{
+ PCIDevice *pci_dev;
+ VLANClientState *vc;
+ int Atheros_WLAN_mmio_io_addr;
+
+ int device_driver_type;
+
+ uint8_t ipaddr[4]; // currently unused
+ uint8_t macaddr[6]; // mac address
+
+ uint8_t ap_ipaddr[4]; // currently unused
+ uint8_t ap_macaddr[6]; // mac address
+
+ // int irq;
+ qemu_irq irq;
+ uint32_t interrupt_p_mask; // primary interrupt mask
+ uint32_t interrupt_s_mask[5]; // secondary interrupt masks
+ uint8_t interrupt_enabled;
+ struct pending_interrupt *pending_interrupts;
+ int access_semaphore;
+
+ uint32_t current_frequency_partial_data[2];
+ uint32_t current_frequency;
+
+
+ uint32_t *receive_queue_address;
+ uint32_t receive_queue_count;
+
+ uint32_t transmit_queue_size;
+ uint8_t transmit_queue_enabled[16];
+ uint32_t *transmit_queue_address[16];
+ int transmit_queue_processed[16];
+
+ uint32_t mem[Atheros_WLAN_MEM_SIZE / 4];
+
+ int eeprom_size;
+ u_int32_t *eeprom_data;
+
+ int ap_state;
+ int inject_timer_running;
+ unsigned int inject_sequence_number;
+
+ // various timers
+ QEMUTimer *beacon_timer;
+ QEMUTimer *inject_timer;
+
+ int inject_queue_size;
+ struct mac80211_frame *inject_queue;
+
+} Atheros_WLANState;
+
+
+/***********************************************************/
+/* PCI Atheros_WLAN definitions */
+
+typedef struct PCIAtheros_WLANState {
+ PCIDevice dev;
+ Atheros_WLANState Atheros_WLAN;
+} PCIAtheros_WLANState;
+
+
+#endif // atheros_wlan_h
diff -Nurp qemu-0.9.1-untouched/hw/atheros_wlan_io.c qemu-0.9.1/hw/atheros_wlan_io.c
--- qemu-0.9.1-untouched/hw/atheros_wlan_io.c 1970-01-01 01:00:00.000000000 +0100
+++ qemu-0.9.1/hw/atheros_wlan_io.c 2008-02-28 14:11:57.000000000 +0100
@@ -0,0 +1,1188 @@
+/**
+ * QEMU WLAN device emulation
+ *
+ * Copyright (c) 2008 Clemens Kolbitsch
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Modifications:
+ * 2008-February-24 Clemens Kolbitsch :
+ * New implementation based on ne2000.c
+ *
+ */
+
+
+#include "hw.h"
+#include "pci.h"
+#include "pc.h"
+#include "net.h"
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/shm.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+#include <sys/mman.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include <signal.h>
+
+#include <time.h>
+#include <sys/time.h>
+
+#include "hw/atheros_wlan.h"
+#include "hw/atheros_wlan_ap.h"
+
+
+/*
+ * MadWifi OPENHAL atheros constants
+ */
+#include "hw/ath5k.h"
+#include "hw/ath5k_hw.h"
+#include "hw/ath5kreg.h"
+
+
+static const struct Atheros_WLAN_frequency Atheros_WLAN_frequency_data[] =
+ {
+ { 20689, 3077, 2412 }, // channel 1
+ { 20715, 3078, 2417 }, // channel 2
+ { 20689, 3079, 2422 }, // channel 3
+ { 20715, 3079, 2427 }, // channel 4
+ { 20529, 3076, 2432 }, // channel 5
+ { 20507, 3078, 2437 }, // channel 6
+ { 20529, 3078, 2442 }, // channel 7
+ { 20507, 3079, 2447 }, // channel 8
+ { 20529, 3077, 2452 }, // channel 9
+ { 20635, 3078, 2457 }, // channel 10
+ { 20529, 3079, 2462 }, // channel 11
+ { 20635, 3079, 2467 }, // channel 12
+ { 20657, 3076, 2472 }, // channel 13
+ { 20529, 1029, 2484 } // channel 14
+ };
+
+/*
+ * NOTE: By using this function instead
+ * of accessing the array directly through
+ * an index, we can leave out parts of the
+ * EEPROM data!!
+ */
+static int get_eeprom_data(Atheros_WLANState *s, uint32_t addr, uint32_t *val)
+{
+ if (val == NULL)
+ {
+ return 1;
+ }
+
+ // why?? but seems necessary...
+ addr--;
+
+ if ((addr < 0) || (addr > s->eeprom_size))
+ {
+ return 2;
+ }
+
+ *val = s->eeprom_data[addr];
+ return 0;
+}
+
+
+
+
+
+
+void updateFrequency(Atheros_WLANState *s)
+{
+ int i;
+ u_int32_t new_frequency = 0;
+ for (i=0; i < sizeof(Atheros_WLAN_frequency_data) / sizeof(Atheros_WLAN_frequency_data[0]); i++)
+ {
+ if (Atheros_WLAN_frequency_data[i].value1 != s->current_frequency_partial_data[0])
+ continue;
+
+ if (Atheros_WLAN_frequency_data[i].value2 != s->current_frequency_partial_data[1])
+ continue;
+
+ new_frequency = Atheros_WLAN_frequency_data[i].frequency;
+ break;
+ }
+
+ if (new_frequency)
+ {
+ s->current_frequency = new_frequency;
+ }
+}
+
+
+
+static uint32_t mm_readl(Atheros_WLANState *s, target_phys_addr_t addr);
+static void mm_writel(Atheros_WLANState *s, target_phys_addr_t addr, uint32_t val);
+
+static void Atheros_WLAN_mmio_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
+{
+ DEBUG_PRINT(("!!! DEBUG INIMPLEMENTED !!!\n"));
+ DEBUG_PRINT(("mmio_writeb %x val %x\n", addr, val));
+ DEBUG_PRINT(("!!! DEBUG INIMPLEMENTED !!!\n"));
+}
+
+static void Atheros_WLAN_mmio_writew(void *opaque, target_phys_addr_t addr, uint32_t val)
+{
+ DEBUG_PRINT(("!!! DEBUG INIMPLEMENTED !!!\n"));
+ DEBUG_PRINT(("mmio_writew %x val %x\n", addr, val));
+ DEBUG_PRINT(("!!! DEBUG INIMPLEMENTED !!!\n"));
+}
+
+static void Atheros_WLAN_mmio_writel(void *opaque, target_phys_addr_t addr, uint32_t val)
+{
+ mm_writel((Atheros_WLANState *)opaque, Atheros_WLAN_MEM_SANITIZE(addr), val);
+ DEBUG_PRINT((" through call: mmio_writel 0x%x (%u) val 0x%x (%u)\n", Atheros_WLAN_MEM_SANITIZE(addr), Atheros_WLAN_MEM_SANITIZE(addr), val, val));
+}
+
+static uint32_t Atheros_WLAN_mmio_readb(void *opaque, target_phys_addr_t addr)
+{
+ DEBUG_PRINT(("!!! DEBUG INIMPLEMENTED !!!\n"));
+ DEBUG_PRINT(("mmio_readb %u\n", addr));
+ DEBUG_PRINT(("!!! DEBUG INIMPLEMENTED !!!\n"));
+
+ return 0;
+}
+
+static uint32_t Atheros_WLAN_mmio_readw(void *opaque, target_phys_addr_t addr)
+{
+ DEBUG_PRINT(("!!! DEBUG INIMPLEMENTED !!!\n"));
+ DEBUG_PRINT(("mmio_readw %u\n", addr));
+ DEBUG_PRINT(("!!! DEBUG INIMPLEMENTED !!!\n"));
+
+ return 0;
+}
+
+static uint32_t Atheros_WLAN_mmio_readl(void *opaque, target_phys_addr_t addr)
+{
+ uint32_t val;
+ val = mm_readl((Atheros_WLANState *)opaque, Atheros_WLAN_MEM_SANITIZE(addr));
+
+ DEBUG_PRINT((" mmio_readl 0x%x (%u) = 0x%x (%u)\n", Atheros_WLAN_MEM_SANITIZE(addr), Atheros_WLAN_MEM_SANITIZE(addr), val, val));
+ return val;
+}
+
+
+static void Atheros_WLAN_mmio_map(PCIDevice *pci_dev, int region_num, uint32_t addr, uint32_t size, int type)
+{
+ DEBUG_PRINT(("mmio_map\n"));
+ PCIAtheros_WLANState *d = (PCIAtheros_WLANState *)pci_dev;
+ Atheros_WLANState *s = &d->Atheros_WLAN;
+
+ DEBUG_PRINT(("cpu_register_physical_memory(%p, %u, %p);\n", (unsigned long*)addr, Atheros_WLAN_MEM_SIZE, (unsigned long*)s->Atheros_WLAN_mmio_io_addr));
+
+ cpu_register_physical_memory(addr + 0, Atheros_WLAN_MEM_SIZE, s->Atheros_WLAN_mmio_io_addr);
+}
+
+static CPUReadMemoryFunc *Atheros_WLAN_mmio_read[3] = {
+ Atheros_WLAN_mmio_readb,
+ Atheros_WLAN_mmio_readw,
+ Atheros_WLAN_mmio_readl,
+};
+
+static CPUWriteMemoryFunc *Atheros_WLAN_mmio_write[3] = {
+ Atheros_WLAN_mmio_writeb,
+ Atheros_WLAN_mmio_writew,
+ Atheros_WLAN_mmio_writel,
+};
+
+void Atheros_WLAN_setup_io(PCIAtheros_WLANState *d)
+{
+ Atheros_WLANState *s;
+ s = &d->Atheros_WLAN;
+
+ /* I/O handler for memory-mapped I/O */
+ s->Atheros_WLAN_mmio_io_addr = cpu_register_io_memory(0, Atheros_WLAN_mmio_read, Atheros_WLAN_mmio_write, s);
+ pci_register_io_region(&d->dev, 0, Atheros_WLAN_MEM_SIZE, PCI_ADDRESS_SPACE_MEM, Atheros_WLAN_mmio_map);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#define FASTBINLOG(x) \
+ (x == 1) ? 0 : \
+ (x == 2) ? 1 : \
+ (x == 4) ? 2 : \
+ (x == 8) ? 3 : \
+ (x == 16) ? 4 : \
+ (x == 32) ? 5 : \
+ (x == 64) ? 6 : \
+ (x == 128) ? 7 : \
+ (x == 256) ? 8 : \
+ (x == 512) ? 9 : \
+ (x == 1024) ? 10 : \
+ (x == 2048) ? 11 : \
+ (x == 4096) ? 12 : 13
+
+
+
+static uint32_t mm_readl(Atheros_WLANState *s, target_phys_addr_t addr)
+{
+ uint32_t val = GET_MEM_L(s->mem, addr);
+ switch (addr)
+ {
+ case ATH_HW_IRQ_PENDING:
+ /*
+ * This indicates that the interrupt
+ * routine has been called. reset interrupt
+ * status and put the interrupt-status
+ * number at the correct memory-location
+ *
+ * In case multiple interrupts are pending
+ * this memory-location is checked multiple
+ * times... each time, we put another interrupt
+ * status into memory until no more interrupts
+ * have to be handled
+ */
+ Atheros_WLAN_disable_irq(s);
+
+ DEBUG_PRINT((">> irq pending? ... 0x%x\n", val));
+ SET_MEM_L(s->mem, 0x0080, 0x0);
+ SET_MEM_L(s->mem, 0x80ec, 0x0001c680);
+ SET_MEM_L(s->mem, 0x80f0, 0x000055dc);
+ SET_MEM_L(s->mem, 0x80f8, 0x0015f6fc);
+ SET_MEM_L(s->mem, 0x9850, 0x0de8b0da);
+ break;
+
+ /*
+ * The following registers are Read-and-Clear
+ * registers --> must be reset after a read!!
+ *
+ * However, it does not work when using linux!!
+ */
+ case AR5K_PISR:
+ if (s->device_driver_type == WINXP_DRIVER)
+ {
+ addr = AR5K_RAC_PISR;
+ // fall through...
+ }
+ else
+ {
+ break;
+ }
+
+ case AR5K_RAC_PISR:
+ Atheros_WLAN_update_irq(s);
+ val = GET_MEM_L(s->mem, addr);
+ SET_MEM_L(s->mem, addr, 0);
+ SET_MEM_L(s->mem, AR5K_PCICFG, 0x34);
+
+ DEBUG_PRINT((">> irq status 0x%x\n", val));
+ break;
+
+ case AR5K_RAC_SISR0:
+ case AR5K_RAC_SISR1:
+ case AR5K_RAC_SISR2:
+ case AR5K_RAC_SISR3:
+ case AR5K_RAC_SISR4:
+ val = 0;
+ SET_MEM_L(s->mem, addr, 0);
+ DEBUG_PRINT(("secondary irq status\n"));
+ break;
+
+
+ /*
+ * According to the openHAL source
+ * documentation this is also read-and-clear
+ * but if it is made so, the WinDriver does
+ * not work any more...
+ */
+ case AR5K_RXDP:
+ //SET_MEM_L(s->mem, addr, 0);
+ break;
+
+ default:
+ break;
+ }
+ return val;
+}
+
+static void mm_writel(Atheros_WLANState *s, target_phys_addr_t addr, uint32_t val)
+{
+ uint32_t h;
+ switch (addr)
+ {
+
+/******************************************************************
+ *
+ * ath5k_hw_init ---> ath5k_hw_nic_wakeup
+ *
+ ******************************************************************/
+
+ case AR5K_RESET_CTL:
+
+ if (val == (AR5K_RESET_CTL_CHIP | AR5K_RESET_CTL_PCI))
+ {
+ /* ath5k_hw.c: 613 */
+ DEBUG_PRINT(("reset device (MAC + PCI)\n"));
+
+ /*
+ * claim device is inited
+ */
+ SET_MEM_L(s->mem, AR5K_STA_ID1, 0);
+ SET_MEM_L(s->mem, AR5K_RESET_CTL, 3);
+ }
+ else if (val & (AR5K_RESET_CTL_CHIP | AR5K_RESET_CTL_PCI))
+ {
+ /* ath5k_hw.c: 613 */
+ DEBUG_PRINT(("reset device (MAC + PCI + ?)\n"));
+
+ /*
+ * claim device is inited
+ */
+ SET_MEM_L(s->mem, AR5K_STA_ID1, 0);
+ SET_MEM_L(s->mem, AR5K_RESET_CTL, 3);
+ }
+ else
+ {
+ /* ath5k_hw.c: 626 */
+ DEBUG_PRINT(("reset device (generic)\n"));
+
+ /*
+ * warm-start device
+ */
+ SET_MEM_L(s->mem, AR5K_RESET_CTL, 0);
+ }
+ break;
+
+
+/******************************************************************
+ *
+ * interrupt handling
+ *
+ ******************************************************************/
+
+ case AR5K_IER:
+ if (val == AR5K_IER_DISABLE)
+ {
+ /* ath5k_hw.c: 1636 */
+ DEBUG_PRINT(("disabling interrupts\n"));
+ SET_MEM_L(s->mem, AR5K_GPIODO, 0x0);
+ SET_MEM_L(s->mem, AR5K_GPIODI, 0x0);
+
+ s->interrupt_enabled = 0;
+ }
+ else if (val == AR5K_IER_ENABLE)
+ {
+ /* ath5k_hw.c: 1674 */
+ DEBUG_PRINT(("enabling interrupts\n"));
+ SET_MEM_L(s->mem, AR5K_GPIODO, 0x2);
+ SET_MEM_L(s->mem, AR5K_GPIODI, 0x3); // new
+
+ s->interrupt_enabled = 1;
+ }
+ else
+ {
+ DEBUG_PRINT(("setting interrupt-enable to undefined value!!\n"));
+ }
+ break;
+
+ case AR5K_GPIODO:
+ if (val == 0x2)
+ {
+ SET_MEM_L(s->mem, AR5K_GPIODI, 0x3);
+ }
+ break;
+
+ case AR5K_GPIODI: // new
+ if (val == 0x2)
+ {
+ SET_MEM_L(s->mem, AR5K_GPIODO, 0x3);
+ }
+ break;
+
+ case AR5K_PIMR:
+ /* ath5k_hw.c: 1668 */
+ DEBUG_PRINT(("setting primary interrupt-mask to 0x%x (%u)\n", val, val));
+ s->interrupt_p_mask = val;
+
+ SET_MEM_L(s->mem, addr, val);
+ break;
+
+ case AR5K_SIMR0:
+ DEBUG_PRINT(("setting secondary interrupt-mask 0 to 0x%x (%u)\n", val, val));
+ s->interrupt_s_mask[0] = val;
+ break;
+ case AR5K_SIMR1:
+ DEBUG_PRINT(("setting secondary interrupt-mask 1 to 0x%x (%u)\n", val, val));
+ s->interrupt_s_mask[1] = val;
+ break;
+ case AR5K_SIMR2:
+ DEBUG_PRINT(("setting secondary interrupt-mask 2 to 0x%x (%u)\n", val, val));
+ s->interrupt_s_mask[2] = val;
+ break;
+ case AR5K_SIMR3:
+ DEBUG_PRINT(("setting secondary interrupt-mask 3 to 0x%x (%u)\n", val, val));
+ s->interrupt_s_mask[3] = val;
+ break;
+ case AR5K_SIMR4:
+ DEBUG_PRINT(("setting secondary interrupt-mask 4 to 0x%x (%u)\n", val, val));
+ s->interrupt_s_mask[4] = val;
+ break;
+
+/******************************************************************
+ *
+ * ath5k queuing (for transmit and receive buffers)
+ *
+ ******************************************************************/
+
+ case AR5K_QCU_TXE:
+ /* ath5k_hw.c: 1423ff */
+
+ /* enable specified queue (nr in val) */
+ val = FASTBINLOG(val);
+
+ DEBUG_PRINT(("queue %u enabled\n", val));
+ if ((val >= 0) && (val < 16))
+ {
+ s->transmit_queue_enabled[val] = 1;
+ Atheros_WLAN_handleTxBuffer(s, val);
+ }
+ else
+ {
+ DEBUG_PRINT(("unknown queue 0x%x (%u)\n", val, val));
+ }
+ break;
+
+ case AR5K_QCU_TXD:
+ /* ath5k_hw.c: 1423ff */
+
+ /* disable specified queue (nr in val) */
+ val = FASTBINLOG(val);
+
+ DEBUG_PRINT(("queue %u disabled\n", val));
+ if ((val >= 0) && (val < 16))
+ {
+ s->transmit_queue_enabled[val] = 0;
+ }
+ else
+ {
+ DEBUG_PRINT(("unknown queue 0x%x (%u)\n", val, val));
+ }
+ break;
+
+ case AR5K_IFS0:
+ case AR5K_IFS1:
+ DEBUG_PRINT(("TODO: find out what inter frame spacing registers are used for...\n"));
+ break;
+
+ case AR5K_CFG:
+
+ if (val == AR5K_INIT_CFG)
+ {
+ /* ath5k_hw.c: 1261 */
+ DEBUG_PRINT(("Reset configuration register (for hw bitswap)\n"));
+ }
+ SET_MEM_L(s->mem, AR5K_SLEEP_CTL, 0x0);
+ break;
+
+ case AR5K_TXCFG:
+ /* ath5k_hw.c: 1122 */
+ DEBUG_PRINT(("Setting transmit queue size to %u byte\n", (1 << (val+2)) ));
+
+ s->transmit_queue_size = (1 << (val+2));
+ break;
+
+ case AR5K_CR:
+ if (val == AR5K_CR_TXE0) // TX Enable for queue 0 on 5210
+ {
+ DEBUG_PRINT(("TX enable for queue 0\n"));
+ }
+ else if (val == AR5K_CR_TXE1) // TX Enable for queue 1 on 5210
+ {
+ DEBUG_PRINT(("TX enable for queue 1\n"));
+ }
+ else if (val == AR5K_CR_RXE) // RX Enable
+ {
+ DEBUG_PRINT(("RX enable\n"));
+ SET_MEM_L(s->mem, AR5K_DIAG_SW_5211, 0x0);
+ }
+ else if (val == AR5K_CR_TXD0) // TX Disable for queue 0 on 5210
+ {
+ DEBUG_PRINT(("TX disable for queue 0\n"));
+ }
+ else if (val == AR5K_CR_TXD1) // TX Disable for queue 1 on 5210
+ {
+ DEBUG_PRINT(("TX disable for queue 1\n"));
+ }
+ else if (val == AR5K_CR_RXD) // RX Disable
+ {
+ DEBUG_PRINT(("RX disable\n"));
+ }
+ else if (val == AR5K_CR_SWI) // unknown...
+ {
+
+ DEBUG_PRINT(("Undefined TX/RX en/disable CR_SWI\n"));
+ }
+ else
+ {
+ DEBUG_PRINT(("Undefined TX/RX en/disable\n"));
+ }
+ break;
+
+ case AR5K_RXDP:
+ /*
+ * unkown location, but this should
+ * set the location of the receive
+ * buffer's PHYSICAL address!!
+ */
+ DEBUG_PRINT(("Setting receive queue to address 0x%x (%u)\n", val, val));
+
+ /*
+ * This address will be queried again
+ * later... store it!!
+ */
+ if (val == 0)
+ {
+ // hm... ar5424 resets its queue to 0 :-(
+ }
+ SET_MEM_L(s->mem, addr, val);
+ s->receive_queue_address = (uint32_t *)val;
+
+ /*
+ * Madwifi hack: we allow only a certain
+ * number of packets in the receive queue!!
+ */
+ s->receive_queue_count = 0;
+ break;
+
+ case AR5K_QUEUE_TXDP(0):
+ case AR5K_QUEUE_TXDP(1):
+ case AR5K_QUEUE_TXDP(2):
+ case AR5K_QUEUE_TXDP(3):
+ case AR5K_QUEUE_TXDP(4):
+ case AR5K_QUEUE_TXDP(5):
+ case AR5K_QUEUE_TXDP(6):
+ case AR5K_QUEUE_TXDP(7):
+ case AR5K_QUEUE_TXDP(8):
+ case AR5K_QUEUE_TXDP(9):
+ case AR5K_QUEUE_TXDP(10):
+ case AR5K_QUEUE_TXDP(11):
+ case AR5K_QUEUE_TXDP(12):
+ case AR5K_QUEUE_TXDP(13):
+ case AR5K_QUEUE_TXDP(14):
+ case AR5K_QUEUE_TXDP(15):
+ /*
+ * unkown location, but this should
+ * set the location of queue-dependent
+ * transmit buffer's PHYSICAL address!!
+ */
+ DEBUG_PRINT(("Setting a transmit queue to address 0x%x (%u)\n", val, val));
+
+ /*
+ * This address will be queried again
+ * later... store it!!
+ */
+ SET_MEM_L(s->mem, addr, val);
+
+ addr -= AR5K_QCU_TXDP_BASE;
+ addr /= 4;
+ if (addr >= 0 && addr < 16)
+ {
+ /*
+ * In case the given address specifies a
+ * valid DMA address, let's use it and copy
+ * the data into our device and process it
+ * once the queue is enabled
+ */
+ s->transmit_queue_processed[addr] = 0;
+ s->transmit_queue_address[addr] = (uint32_t *)val;
+ }
+ else
+ {
+ DEBUG_PRINT(("unknown queue 0x%x (%u)\n", addr, addr));
+ }
+ break;
+
+ case AR5K_RXCFG:
+ /* ath5k_hw.c: 1124 */
+ DEBUG_PRINT(("Setting receive queue size to %u byte\n", (1 << (val+2)) ));
+ SET_MEM_L(s->mem, addr, val);
+ break;
+
+ case AR5K_QUEUE_QCUMASK(0):
+ case AR5K_QUEUE_QCUMASK(1):
+ case AR5K_QUEUE_QCUMASK(2):
+ case AR5K_QUEUE_QCUMASK(3):
+ case AR5K_QUEUE_QCUMASK(4):
+ case AR5K_QUEUE_QCUMASK(5):
+ case AR5K_QUEUE_QCUMASK(6):
+ case AR5K_QUEUE_QCUMASK(7):
+ case AR5K_QUEUE_QCUMASK(8):
+ case AR5K_QUEUE_QCUMASK(9):
+ case AR5K_QUEUE_QCUMASK(10):
+ case AR5K_QUEUE_QCUMASK(11):
+ case AR5K_QUEUE_QCUMASK(12):
+ case AR5K_QUEUE_QCUMASK(13):
+ case AR5K_QUEUE_QCUMASK(14):
+ case AR5K_QUEUE_QCUMASK(15):
+ DEBUG_PRINT(("ath5k_hw_reset_tx_queue for queue x (%u)\n", val));
+ break;
+
+ case AR5K_QUEUE_DFS_RETRY_LIMIT(0):
+ case AR5K_QUEUE_DFS_RETRY_LIMIT(1):
+ case AR5K_QUEUE_DFS_RETRY_LIMIT(2):
+ case AR5K_QUEUE_DFS_RETRY_LIMIT(3):
+ case AR5K_QUEUE_DFS_RETRY_LIMIT(4):
+ case AR5K_QUEUE_DFS_RETRY_LIMIT(5):
+ case AR5K_QUEUE_DFS_RETRY_LIMIT(6):
+ case AR5K_QUEUE_DFS_RETRY_LIMIT(7):
+ case AR5K_QUEUE_DFS_RETRY_LIMIT(8):
+ case AR5K_QUEUE_DFS_RETRY_LIMIT(9):
+ case AR5K_QUEUE_DFS_RETRY_LIMIT(10):
+ case AR5K_QUEUE_DFS_RETRY_LIMIT(11):
+ case AR5K_QUEUE_DFS_RETRY_LIMIT(12):
+ case AR5K_QUEUE_DFS_RETRY_LIMIT(13):
+ case AR5K_QUEUE_DFS_RETRY_LIMIT(14):
+ case AR5K_QUEUE_DFS_RETRY_LIMIT(15):
+ DEBUG_PRINT(("setting retry-limit for queue x to 0x%x (%u)\n", val, val));
+ break;
+
+ case AR5K_QUEUE_DFS_LOCAL_IFS(0):
+ case AR5K_QUEUE_DFS_LOCAL_IFS(1):
+ case AR5K_QUEUE_DFS_LOCAL_IFS(2):
+ case AR5K_QUEUE_DFS_LOCAL_IFS(3):
+ case AR5K_QUEUE_DFS_LOCAL_IFS(4):
+ case AR5K_QUEUE_DFS_LOCAL_IFS(5):
+ case AR5K_QUEUE_DFS_LOCAL_IFS(6):
+ case AR5K_QUEUE_DFS_LOCAL_IFS(7):
+ case AR5K_QUEUE_DFS_LOCAL_IFS(8):
+ case AR5K_QUEUE_DFS_LOCAL_IFS(9):
+ case AR5K_QUEUE_DFS_LOCAL_IFS(10):
+ case AR5K_QUEUE_DFS_LOCAL_IFS(11):
+ case AR5K_QUEUE_DFS_LOCAL_IFS(12):
+ case AR5K_QUEUE_DFS_LOCAL_IFS(13):
+ case AR5K_QUEUE_DFS_LOCAL_IFS(14):
+ case AR5K_QUEUE_DFS_LOCAL_IFS(15):
+ DEBUG_PRINT(("setting interframe space for queue x to 0x%x (%u)\n", val, val));
+ break;
+
+ case AR5K_QUEUE_MISC(0):
+ case AR5K_QUEUE_MISC(1):
+ case AR5K_QUEUE_MISC(2):
+ case AR5K_QUEUE_MISC(3):
+ case AR5K_QUEUE_MISC(4):
+ case AR5K_QUEUE_MISC(5):
+ case AR5K_QUEUE_MISC(6):
+ case AR5K_QUEUE_MISC(7):
+ case AR5K_QUEUE_MISC(8):
+ case AR5K_QUEUE_MISC(9):
+ case AR5K_QUEUE_MISC(10):
+ case AR5K_QUEUE_MISC(11):
+ case AR5K_QUEUE_MISC(12):
+ case AR5K_QUEUE_MISC(13):
+ case AR5K_QUEUE_MISC(14):
+ case AR5K_QUEUE_MISC(15):
+ DEBUG_PRINT(("setting options for queue x to 0x%x (%u)\n", val, val));
+ break;
+
+ case AR5K_SLEEP_CTL:
+ SET_MEM_L(s->mem, AR5K_SLEEP_CTL, val);
+ if (val == AR5K_SLEEP_CTL_SLE_WAKE)
+ {
+ DEBUG_PRINT(("waking up device\n"));
+
+ /*
+ * yes, we are awake
+ *
+ * basically it just checks if power-down
+ * is false (val & AR5K_PCICFG_SPWR_DN == 0)
+ * but my AR5212 says 20 what has the same
+ * result but might be better ;-)
+ */
+ SET_MEM_L(s->mem, AR5K_PCICFG, 0x14);
+ SET_MEM_L(s->mem, AR5K_STA_ID1, 0x00049e2e);
+// SET_MEM_L(s->mem, AR5K_STA_ID1, 0x0);
+
+// SET_MEM_L(s->mem, AR5K_PCICFG, 0x34);
+// SET_MEM_L(s->mem, AR5K_STA_ID1, AR5K_STA_ID1_PWR_SV);
+ }
+ else if (val == AR5K_SLEEP_CTL_SLE_SLP)
+ {
+ DEBUG_PRINT(("putting device to sleep\n"));
+ }
+ else
+ {
+ DEBUG_PRINT(("unknown SLEEP command %u\n", val));
+ }
+ break;
+
+ case AR5K_PHY_PLL:
+ /*
+ * ...set the PHY operating mode after reset
+ */
+
+ /* ath5k_hw.c: 632 */
+ DEBUG_PRINT(("setting PHY operating mode (PLL)\n"));
+ break;
+
+ case AR5K_PHY_MODE:
+ /*
+ * ...set the PHY operating mode after reset
+ */
+
+ /* ath5k_hw.c: 635 */
+ DEBUG_PRINT(("setting PHY operating mode (mode)\n"));
+ break;
+
+ case AR5K_PHY_TURBO:
+ /*
+ * ...set the PHY operating mode after reset
+ */
+
+ /* ath5k_hw.c: 636 */
+ DEBUG_PRINT(("setting PHY operating mode (turbo)\n"));
+ break;
+
+
+/******************************************************************
+ *
+ * ath5k_hw_init ---> ath5k_hw_radio_revision
+ *
+ ******************************************************************/
+
+
+ case AR5K_PHY(0):
+ /*
+ * Unknown
+ */
+ if (val == AR5K_PHY_SHIFT_2GHZ)
+ {
+ DEBUG_PRINT(("requesting 2GHZ radio\n"));
+ SET_MEM_L(s->mem, AR5K_PHY(0x100), 0x4c047000);
+ }
+ /* ath5k_hw.c: 662 */
+ else if (val == AR5K_PHY_SHIFT_5GHZ)
+ {
+ DEBUG_PRINT(("requesting 5GHZ radio\n"));
+ SET_MEM_L(s->mem, AR5K_PHY(0x100), 0x8e000000);
+ }
+
+ SET_MEM_L(s->mem, AR5K_SLEEP_CTL, 0x0);
+ break;
+
+ case AR5K_PHY(0x20):
+ /*
+ * request radio revision
+ */
+
+ /* ath5k_hw.c: 659 */
+ if (val == AR5K_PHY_SHIFT_2GHZ)
+ {
+ DEBUG_PRINT(("requesting 2GHZ radio\n"));
+ SET_MEM_L(s->mem, AR5K_PHY(0x100), 0x4c047000); // 1275359232);
+ }
+ /* ath5k_hw.c: 662 */
+ else if (val == AR5K_PHY_SHIFT_5GHZ)
+ {
+ DEBUG_PRINT(("requesting 5GHZ radio\n"));
+ SET_MEM_L(s->mem, AR5K_PHY(0x100), 0x7fffffff); // 2382364672);
+ }
+ /* ath5k_hw.c: 671 */
+ else if (val == 0x00001c16)
+ {
+ DEBUG_PRINT(("requesting radio\n"));
+ }
+ /* ath5k_hw.c: 674 */
+ else if (val == 0x00010000)
+ {
+ DEBUG_PRINT(("requesting radio 8 times...\n"));
+ // NOW we request the radio revision (it was set before...)
+
+ // SET_MEM_L(s->mem, 0x9c00, 0x8e026023);
+ SET_MEM_L(s->mem, 0x9c00, 0x8e000000);
+
+ SET_MEM_L(s->mem, 0x9c00, 0x4c047000);
+ }
+
+ break;
+
+ /*
+ * Setting frequency is different for AR5210/AR5211/AR5212
+ *
+ * see ath5k_hw.c: 4590 ff
+ *
+ * they all set AR5K_PHY(0x27),
+ * AR5210 sets AR5K_PHY(0x30),
+ * AR5211 sets AR5K_PHY(0x34) and
+ * AR5212 sets AR5K_PHY(0x36)
+ *
+ *
+ * The virtual device seems to read out 0x34 for
+ * the current channel (e.g. after a packet has
+ * been received)!!
+ */
+ case AR5K_PHY(0x27):
+// fprintf(stderr, "0x%04x => 0x%08x (27)\n", addr, val);
+ SET_MEM_L(s->mem, addr, val);
+ s->current_frequency_partial_data[0] = val;
+ updateFrequency(s);
+ break;
+
+ case AR5K_PHY(0x34):
+// fprintf(stderr, "0x%04x => 0x%08x (34)\n", addr, val);
+ SET_MEM_L(s->mem, addr, val);
+ s->current_frequency_partial_data[1] = val;
+ updateFrequency(s);
+ break;
+
+ /*
+ * these are used by AR521 and AR5212 respectively,
+ * but we seem to simulate an AR5211 and the calls
+ * destroy our channel frequency mapping :-(
+ *
+ case AR5K_PHY(0x30):
+ fprintf(stderr, "0x%04x => 0x%08x (30)\n", addr, val);
+ SET_MEM_L(s->mem, addr, val);
+ s->current_frequency_partial_data[1] = val;
+ updateFrequency(s);
+ break;
+ case AR5K_PHY(0x36):
+ fprintf(stderr, "0x%04x => 0x%08x (36)\n", addr, val);
+ SET_MEM_L(s->mem, addr, val);
+ s->current_frequency_partial_data[1] = val;
+ updateFrequency(s);
+ break;
+ */
+
+
+
+/*
+ case AR5K_PHY(0x21):
+ case AR5K_PHY(0x22):
+ case AR5K_PHY(0x23):
+ case AR5K_PHY(0x24):
+ case AR5K_PHY(0x25):
+ case AR5K_PHY(0x26):
+ case AR5K_PHY(0x28):
+ case AR5K_PHY(0x29):
+ case AR5K_PHY(0x31):
+ case AR5K_PHY(0x32):
+ case AR5K_PHY(0x33):
+ case AR5K_PHY(0x35):
+ case AR5K_PHY(0x37):
+ case AR5K_PHY(0x38):
+ case AR5K_PHY(0x39):
+ case AR5K_PHY(0x40):
+ case AR5K_PHY(0x41):
+ case AR5K_PHY(0x42):
+ case AR5K_PHY(0x43):
+ case AR5K_PHY(0x44):
+ case AR5K_PHY(0x45):
+ case AR5K_PHY(0x46):
+ case AR5K_PHY(0x47):
+ case AR5K_PHY(0x48):
+ case AR5K_PHY(0x49):
+ case AR5K_PHY(0x50):
+ fprintf(stderr, "0x%04x => 0x%08x\n", addr, val);
+ break;*/
+
+/******************************************************************
+ *
+ * ath5k_hw_init ---> ath5k_hw_set_associd (aka. set BSSID)
+ *
+ ******************************************************************/
+
+ case AR5K_BSS_IDM0:
+ case AR5K_BSS_IDM1:
+ /*
+ * Set simple BSSID mask on 5212
+ */
+
+ /* ath5k_hw.c: 2420 */
+ DEBUG_PRINT(("setting bssid mask\n"));
+ break;
+
+ case AR5K_BSS_ID0:
+ case AR5K_BSS_ID1:
+ /*
+ * Set BSSID which triggers the "SME Join" operation
+ */
+
+ /* ath5k_hw.c: 2432 & 2433 */
+ DEBUG_PRINT(("setting bssid : %c%c%c%c \n", (val << 24) >> 24, (val << 16) >> 24, (val << 8) >> 24, val >> 24));
+ break;
+
+ case AR5K_STA_ID0:
+ /*
+ * a set to client(adhoc|managed) | ap | monitor mode is coming
+ *
+ * if there are more than one chip present, this
+ * call defines which chip is to be used!
+ */
+
+ /* ath5k_hw.c: 2358 */
+ DEBUG_PRINT(("a set to client | ap | monitor mode is coming for station %u\n", val));
+
+ // ext
+ SET_MEM_L(s->mem, addr, val);
+
+ break;
+
+ case AR5K_STA_ID1:
+ /*
+ * seems to have a double-meaning:
+ *
+ * setting client mode AND power mode
+ */
+
+ /* ath5k_hw.c: 619 */
+ DEBUG_PRINT(("setting power mode\n"));
+ SET_MEM_L(s->mem, AR5K_STA_ID1, val);
+ SET_MEM_L(s->mem, AR5K_STA_ID0, 0x800a1100);
+ //SET_MEM_L(s->mem, 0xc, 0x1a7d823c);
+ SET_MEM_L(s->mem, 0xc, 0x0);
+ SET_MEM_L(s->mem, 0x00c0, 0x01040000);
+
+
+ /* ath5k_hw.c: 2361 */
+ if (val & AR5K_STA_ID1_ADHOC & AR5K_STA_ID1_DESC_ANTENNA)
+ {
+ DEBUG_PRINT(("setting device into ADHOC mode\n"));
+ }
+ else if (val & AR5K_STA_ID1_AP & AR5K_STA_ID1_RTS_DEF_ANTENNA)
+ {
+ DEBUG_PRINT(("setting device into managed mode\n"));
+ }
+ else if (val & AR5K_STA_ID1_DEFAULT_ANTENNA)
+ {
+ DEBUG_PRINT(("setting device into some other mode (probably monitor)\n"));
+ }
+ else
+ {
+ DEBUG_PRINT(("setting device into unknown mode\n"));
+ }
+ break;
+
+
+
+/******************************************************************
+ *
+ * ath5k_hw_init ---> ath5k_eeprom_init
+ *
+ ******************************************************************/
+
+ case AR5K_EEPROM_BASE:
+ /*
+ * an access to an offset inside the
+ * EEPROM uses an initialization of
+ * the address at this location
+ */
+
+ /* ath5k_hw.c: 1738 */
+ DEBUG_PRINT(("there will be an access to the EEPROM at %p\n", (unsigned long*)val));
+
+ /*
+ * set the data that will be returned
+ * after calling AR5K_EEPROM_CMD=READ
+ */
+ switch (val)
+ {
+#if 0
+ case AR5K_EEPROM_MAGIC:
+ WRITE_EEPROM(s->mem, AR5K_EEPROM_MAGIC_VALUE);
+ break;
+
+ case AR5K_EEPROM_PROTECT:
+ WRITE_EEPROM(s->mem, 0);
+ break;
+
+ case AR5K_EEPROM_REG_DOMAIN:
+ /*
+ * reg-domain central europe ???
+ */
+ WRITE_EEPROM(s->mem, 96);
+ break;
+
+ case AR5K_EEPROM_VERSION:
+ WRITE_EEPROM(s->mem, AR5K_EEPROM_VERSION_3_4);
+ break;
+
+ case AR5K_EEPROM_HDR:
+ WRITE_EEPROM(s->mem, 23046);
+ break;
+
+ case 195:
+ /*
+ * an radio-GHZ specific eeprom data (AR5K_EEPROM_ANT_GAIN)
+ *
+ * on my AR5212 it is 0
+ */
+
+ /* ath5k_hw.c: 2023 */
+ WRITE_EEPROM(s->mem, 0);
+ break;
+
+ case 0x20:
+ /*
+ * before we read the MAC addr, we read this (???)
+ *
+ * ATTENTION: this value is present in the EEPROM!!
+ */
+
+ /* ath5k_hw.c : 2185 */
+ break;
+
+ case 0x1f:
+ /*
+ * 1st part of MAC-addr
+ */
+ DEBUG_PRINT(("EEPROM request first part of MAC\n"));
+ WRITE_EEPROM(s->mem, (s->phys[0] << 8) | s->phys[1]);
+ break;
+
+ case 0x1e:
+ /*
+ * 2nd part of MAC-addr
+ */
+ DEBUG_PRINT(("EEPROM request second part of MAC\n"));
+ WRITE_EEPROM(s->mem, (s->phys[2] << 8) | s->phys[3]);
+ break;
+
+ case 0x1d:
+ /*
+ * 3rd part of MAC-addr
+ */
+ DEBUG_PRINT(("EEPROM request third part of MAC\n"));
+ WRITE_EEPROM(s->mem, (s->phys[4] << 8) | s->phys[5]);
+ break;
+#endif
+ /*
+ * ATTENTION: if we modify anything in the
+ * eeprom, we might get (at least in linux we
+ * do) an EEPROM-checksum error!!
+ */
+
+ case 0x0:
+ /*
+ * this is not part of the EEPROM dumps for some reason!!
+ */
+ DEBUG_PRINT(("EEPROM request 0x0\n"));
+ WRITE_EEPROM(s->mem, 0x13);
+ break;
+
+ default:
+ if (!get_eeprom_data(s, val, &h))
+ {
+ /*
+ * we have a hit in the internal eeprom-buffer
+ */
+ DEBUG_PRINT(("EEPROM hit %u at %u\n", h, val));
+ WRITE_EEPROM(s->mem, h);
+ }
+ else
+ {
+ DEBUG_PRINT(("EEPROM request at %p is unknown\n", (unsigned long*)val));
+ WRITE_EEPROM(s->mem, 0);
+ }
+ break;
+ }
+ break;
+
+ case AR5K_EEPROM_CMD:
+ /*
+ * what type of access is specified as well
+ */
+
+ /* ath5k_hw.c: 1739 */
+ if (val & AR5K_EEPROM_CMD_READ)
+ {
+ DEBUG_PRINT(("the EEPROM access will be READ\n"));
+
+ /*
+ * tell the device the read was successful
+ */
+ SET_MEM_L(s->mem, AR5K_EEPROM_STAT_5210, AR5K_EEPROM_STAT_RDDONE);
+ SET_MEM_L(s->mem, AR5K_EEPROM_STAT_5211, AR5K_EEPROM_STAT_RDDONE);
+ /*
+ * and return the data that was set
+ * during the write to AR5K_EEPROM_BASE
+ */
+ }
+ else
+ {
+ DEBUG_PRINT(("the EEPROM access will be UNKNOWN\n"));
+ fprintf(stderr, "Is this a write to the eeprom??\n");
+ }
+ break;
+
+
+/******************************************************************
+ *
+ * additional reverse engineering:
+ *
+ ******************************************************************/
+
+ case AR5K_USEC_5210: // new
+ SET_MEM_L(s->mem, AR5K_XRMODE, 0x2a80001a);
+ SET_MEM_L(s->mem, AR5K_XRTIMEOUT, 0x13881c20);
+ break;
+
+ case AR5K_PHY_AGCCTL: // new
+ if (val & AR5K_PHY_AGCCTL_CAL)
+ {
+ SET_MEM_L(s->mem, AR5K_PHY_AGCCTL, val & (~AR5K_PHY_AGCCTL_CAL));
+ }
+ else if (val & AR5K_PHY_AGCCTL_NF)
+ {
+ SET_MEM_L(s->mem, AR5K_PHY_AGCCTL, val & (~AR5K_PHY_AGCCTL_NF));
+ }
+ break;
+
+ default:
+ if (addr / 4 < Atheros_WLAN_MEM_SIZE)
+ {
+ SET_MEM_L(s->mem, addr, val);
+ }
+
+ if ((addr >= AR5K_PCU_MIN) &&
+ (addr <= AR5K_PCU_MAX))
+ {
+ DEBUG_PRINT(("Setting up ini-registers...!!\n"));
+ }
+ else
+ {
+ DEBUG_PRINT(("Unknown call to memory!!\n"));
+ }
+ break;
+ }
+}
+
diff -Nurp qemu-0.9.1-untouched/hw/atheros_wlan_io.h qemu-0.9.1/hw/atheros_wlan_io.h
--- qemu-0.9.1-untouched/hw/atheros_wlan_io.h 1970-01-01 01:00:00.000000000 +0100
+++ qemu-0.9.1/hw/atheros_wlan_io.h 2008-02-28 14:02:51.000000000 +0100
@@ -0,0 +1,35 @@
+/**
+ * QEMU WLAN device emulation
+ *
+ * Copyright (c) 2008 Clemens Kolbitsch
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Modifications:
+ * 2008-February-24 Clemens Kolbitsch :
+ * New implementation based on ne2000.c
+ *
+ */
+
+#ifndef atheros_wlan_io_h
+#define atheros_wlan_io_h 1
+
+void Atheros_WLAN_setup_io(PCIAtheros_WLANState *d);
+
+#endif // atheros_wlan_io_h
diff -Nurp qemu-0.9.1-untouched/hw/atheros_wlan_packet.c qemu-0.9.1/hw/atheros_wlan_packet.c
--- qemu-0.9.1-untouched/hw/atheros_wlan_packet.c 1970-01-01 01:00:00.000000000 +0100
+++ qemu-0.9.1/hw/atheros_wlan_packet.c 2008-02-28 14:11:58.000000000 +0100
@@ -0,0 +1,481 @@
+/**
+ * QEMU WLAN access point emulation
+ *
+ * Copyright (c) 2008 Clemens Kolbitsch
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Modifications:
+ * 2008-February-24 Clemens Kolbitsch :
+ * New implementation based on ne2000.c
+ *
+ */
+
+
+#include "hw.h"
+#include "pci.h"
+#include "pc.h"
+#include "net.h"
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/shm.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+#include <sys/mman.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+
+#include "hw/atheros_wlan.h"
+#include "hw/atheros_wlan_crc32.h"
+#include "hw/atheros_wlan_packet.h"
+
+#define FRAME_INSERT(_8bit_data) buf[i++] = _8bit_data
+
+
+static int insertCRC(struct mac80211_frame *frame, uint32_t frame_length)
+{
+ unsigned long crc;
+ unsigned char *fcs = (char*)frame;
+
+ crc = crc32_ccitt(fcs, frame_length);
+ memcpy(&fcs[frame_length], &crc, 4);
+
+ return frame_length + 4;
+}
+
+
+void Atheros_WLAN_init_frame(Atheros_WLANState *s, struct mac80211_frame *frame)
+{
+ if (!frame)
+ return;
+
+ frame->sequence_control.sequence_number = s->inject_sequence_number++;
+ memcpy(frame->source_address, s->ap_macaddr, 6);
+ memcpy(frame->bssid_address, s->ap_macaddr, 6);
+
+ frame->frame_length = insertCRC(frame, frame->frame_length);
+}
+
+
+struct mac80211_frame *Atheros_WLAN_create_beacon_frame()
+{
+ unsigned int i;
+ unsigned char *buf;
+ struct mac80211_frame *frame;
+
+ frame = (struct mac80211_frame *)malloc(sizeof(struct mac80211_frame));
+ if (!frame)
+ {
+ return NULL;
+ }
+
+ frame->next_frame = NULL;
+ frame->frame_control.protocol_version = 0;
+ frame->frame_control.type = IEEE80211_TYPE_MGT;
+ frame->frame_control.sub_type = IEEE80211_TYPE_MGT_SUBTYPE_BEACON;
+ frame->frame_control.flags = 0;
+ frame->duration_id = 0;
+ frame->sequence_control.fragment_number = 0;
+
+ for (i=0; i<6; frame->destination_address[i] = 0xff, i++);
+
+ i = 0;
+ buf = (unsigned char*)frame->data_and_fcs;
+
+ /*
+ * Fixed params... typical AP params (12 byte)
+ *
+ * They include
+ * - Timestamp
+ * - Beacon Interval
+ * - Capability Information
+ */
+ FRAME_INSERT(0x8d);
+ FRAME_INSERT(0x61);
+ FRAME_INSERT(0xa5);
+ FRAME_INSERT(0x18);
+ FRAME_INSERT(0x00);
+ FRAME_INSERT(0x00);
+ FRAME_INSERT(0x00);
+ FRAME_INSERT(0x00);
+ FRAME_INSERT(0x64);
+ FRAME_INSERT(0x00);
+ FRAME_INSERT(0x01);
+ FRAME_INSERT(0x00);
+
+ FRAME_INSERT(IEEE80211_BEACON_PARAM_SSID);
+ FRAME_INSERT(4); // length
+ FRAME_INSERT('Q'); // SSID
+ FRAME_INSERT('L'); // SSID
+ FRAME_INSERT('a'); // SSID
+ FRAME_INSERT('n'); // SSID
+
+ FRAME_INSERT(IEEE80211_BEACON_PARAM_RATES);
+ FRAME_INSERT(8); // length
+ FRAME_INSERT(0x82);
+ FRAME_INSERT(0x84);
+ FRAME_INSERT(0x8b);
+ FRAME_INSERT(0x96);
+ FRAME_INSERT(0x24);
+ FRAME_INSERT(0x30);
+ FRAME_INSERT(0x48);
+ FRAME_INSERT(0x6c);
+
+ FRAME_INSERT(IEEE80211_BEACON_PARAM_CHANNEL);
+ FRAME_INSERT(1); // length
+ FRAME_INSERT(0x09);
+
+ frame->frame_length = IEEE80211_HEADER_SIZE + i;
+ return frame;
+}
+
+struct mac80211_frame *Atheros_WLAN_create_probe_response()
+{
+ unsigned int i;
+ unsigned char *buf;
+ struct mac80211_frame *frame;
+
+ frame = (struct mac80211_frame *)malloc(sizeof(struct mac80211_frame));
+ if (!frame)
+ {
+ return NULL;
+ }
+
+ frame->next_frame = NULL;
+ frame->frame_control.protocol_version = 0;
+ frame->frame_control.type = IEEE80211_TYPE_MGT;
+ frame->frame_control.sub_type = IEEE80211_TYPE_MGT_SUBTYPE_PROBE_RESP;
+ frame->frame_control.flags = 0;
+ frame->duration_id = 314;
+ frame->sequence_control.fragment_number = 0;
+
+ i = 0;
+ buf = (unsigned char*)frame->data_and_fcs;
+
+ /*
+ * Fixed params... typical AP params (12 byte)
+ *
+ * They include
+ * - Timestamp
+ * - Beacon Interval
+ * - Capability Information
+ */
+ buf[i++] = 0x8d; buf[i++] = 0x61; buf[i++] = 0xa5; buf[i++] = 0x18;
+ buf[i++] = 0x00; buf[i++] = 0x00; buf[i++] = 0x00; buf[i++] = 0x00;
+ buf[i++] = 0x64; buf[i++] = 0x00; buf[i++] = 0x01; buf[i++] = 0x00;
+
+ FRAME_INSERT(IEEE80211_BEACON_PARAM_SSID);
+ FRAME_INSERT(4); // length
+ FRAME_INSERT('Q'); // SSID
+ FRAME_INSERT('L'); // SSID
+ FRAME_INSERT('a'); // SSID
+ FRAME_INSERT('n'); // SSID
+
+ FRAME_INSERT(IEEE80211_BEACON_PARAM_RATES);
+ FRAME_INSERT(8); // length
+ FRAME_INSERT(0x82);
+ FRAME_INSERT(0x84);
+ FRAME_INSERT(0x8b);
+ FRAME_INSERT(0x96);
+ FRAME_INSERT(0x24);
+ FRAME_INSERT(0x30);
+ FRAME_INSERT(0x48);
+ FRAME_INSERT(0x6c);
+
+ FRAME_INSERT(IEEE80211_BEACON_PARAM_CHANNEL);
+ FRAME_INSERT(1); // length
+ FRAME_INSERT(0x09);
+
+ frame->frame_length = IEEE80211_HEADER_SIZE + i;
+ return frame;
+}
+
+struct mac80211_frame *Atheros_WLAN_create_authentication()
+{
+ unsigned int i;
+ unsigned char *buf;
+ struct mac80211_frame *frame;
+
+ frame = (struct mac80211_frame *)malloc(sizeof(struct mac80211_frame));
+ if (!frame)
+ {
+ return NULL;
+ }
+
+ frame->next_frame = NULL;
+ frame->frame_control.protocol_version = 0;
+ frame->frame_control.type = IEEE80211_TYPE_MGT;
+ frame->frame_control.sub_type = IEEE80211_TYPE_MGT_SUBTYPE_AUTHENTICATION;
+ frame->frame_control.flags = 0;
+ frame->duration_id = 314;
+ frame->sequence_control.fragment_number = 0;
+
+ i = 0;
+ buf = (unsigned char*)frame->data_and_fcs;
+
+ /*
+ * Fixed params... typical AP params (6 byte)
+ *
+ * They include
+ * - Authentication Algorithm (here: Open System)
+ * - Authentication SEQ
+ * - Status code (successful 0x0)
+ */
+ FRAME_INSERT(0x00);
+ FRAME_INSERT(0x00);
+ FRAME_INSERT(0x02);
+ FRAME_INSERT(0x00);
+ FRAME_INSERT(0x00);
+ FRAME_INSERT(0x00);
+
+ FRAME_INSERT(IEEE80211_BEACON_PARAM_SSID);
+ FRAME_INSERT(4); // length
+ FRAME_INSERT('Q'); // SSID
+ FRAME_INSERT('L'); // SSID
+ FRAME_INSERT('a'); // SSID
+ FRAME_INSERT('n'); // SSID
+
+ frame->frame_length = IEEE80211_HEADER_SIZE + i;
+ return frame;
+}
+
+struct mac80211_frame *Atheros_WLAN_create_deauthentication()
+{
+ unsigned int i;
+ unsigned char *buf;
+ struct mac80211_frame *frame;
+
+ frame = (struct mac80211_frame *)malloc(sizeof(struct mac80211_frame));
+ if (!frame)
+ {
+ return NULL;
+ }
+
+ frame->next_frame = NULL;
+ frame->frame_control.protocol_version = 0;
+ frame->frame_control.type = IEEE80211_TYPE_MGT;
+ frame->frame_control.sub_type = IEEE80211_TYPE_MGT_SUBTYPE_DEAUTHENTICATION;
+ frame->frame_control.flags = 0;
+ frame->duration_id = 314;
+ frame->sequence_control.fragment_number = 0;
+
+ i = 0;
+ buf = (unsigned char*)frame->data_and_fcs;
+
+ /*
+ * Inser reason code:
+ * "Deauthentication because sending STA is leaving"
+ */
+ FRAME_INSERT(0x03);
+ FRAME_INSERT(0x00);
+
+ frame->frame_length = IEEE80211_HEADER_SIZE + i;
+ return frame;
+}
+
+struct mac80211_frame *Atheros_WLAN_create_association_response()
+{
+ unsigned int i;
+ unsigned char *buf;
+ struct mac80211_frame *frame;
+
+ frame = (struct mac80211_frame *)malloc(sizeof(struct mac80211_frame));
+ if (!frame)
+ {
+ return NULL;
+ }
+
+ frame->next_frame = NULL;
+ frame->frame_control.protocol_version = 0;
+ frame->frame_control.type = IEEE80211_TYPE_MGT;
+ frame->frame_control.sub_type = IEEE80211_TYPE_MGT_SUBTYPE_ASSOCIATION_RESP;
+ frame->frame_control.flags = 0;
+ // frame->duration_id = 314;
+ frame->sequence_control.fragment_number = 0;
+
+ i = 0;
+ buf = (unsigned char*)frame->data_and_fcs;
+
+ /*
+ * Fixed params... typical AP params (6 byte)
+ *
+ * They include
+ * - Capability Information
+ * - Status code (successful 0x0)
+ * - Association ID
+ */
+ FRAME_INSERT(0x01);
+ FRAME_INSERT(0x00);
+ FRAME_INSERT(0x00);
+ FRAME_INSERT(0x00);
+ FRAME_INSERT(0x01);
+ FRAME_INSERT(0xc0);
+
+ FRAME_INSERT(IEEE80211_BEACON_PARAM_SSID);
+ FRAME_INSERT(4); // length
+ FRAME_INSERT('Q'); // SSID
+ FRAME_INSERT('L'); // SSID
+ FRAME_INSERT('a'); // SSID
+ FRAME_INSERT('n'); // SSID
+
+ FRAME_INSERT(IEEE80211_BEACON_PARAM_RATES);
+ FRAME_INSERT(8); // length
+ FRAME_INSERT(0x82);
+ FRAME_INSERT(0x84);
+ FRAME_INSERT(0x8b);
+ FRAME_INSERT(0x96);
+ FRAME_INSERT(0x24);
+ FRAME_INSERT(0x30);
+ FRAME_INSERT(0x48);
+ FRAME_INSERT(0x6c);
+
+ FRAME_INSERT(IEEE80211_BEACON_PARAM_EXTENDED_RATES);
+ FRAME_INSERT(4); // length
+ FRAME_INSERT(0x0c);
+ FRAME_INSERT(0x12);
+ FRAME_INSERT(0x18);
+ FRAME_INSERT(0x60);
+
+ frame->frame_length = IEEE80211_HEADER_SIZE + i;
+ return frame;
+}
+
+struct mac80211_frame *Atheros_WLAN_create_disassociation()
+{
+ unsigned int i;
+ unsigned char *buf;
+ struct mac80211_frame *frame;
+
+ frame = (struct mac80211_frame *)malloc(sizeof(struct mac80211_frame));
+ if (!frame)
+ {
+ return NULL;
+ }
+
+ frame->next_frame = NULL;
+ frame->frame_control.protocol_version = 0;
+ frame->frame_control.type = IEEE80211_TYPE_MGT;
+ frame->frame_control.sub_type = IEEE80211_TYPE_MGT_SUBTYPE_DISASSOCIATION;
+ frame->frame_control.flags = 0;
+ frame->duration_id = 314;
+ frame->sequence_control.fragment_number = 0;
+
+ i = 0;
+ buf = (unsigned char*)frame->data_and_fcs;
+
+ /*
+ * Inser reason code:
+ * "Disassociation because sending STA is leaving"
+ */
+ FRAME_INSERT(0x03);
+ FRAME_INSERT(0x00);
+
+ frame->frame_length = IEEE80211_HEADER_SIZE + i;
+ return frame;
+}
+
+struct mac80211_frame *Atheros_WLAN_create_data_packet(Atheros_WLANState *s, const uint8_t *buf, int size)
+{
+ struct mac80211_frame *frame;
+
+ frame = (struct mac80211_frame *)malloc(sizeof(struct mac80211_frame));
+ if (!frame)
+ {
+ return NULL;
+ }
+
+ frame->next_frame = NULL;
+ frame->frame_control.protocol_version = 0;
+ frame->frame_control.type = IEEE80211_TYPE_DATA;
+ frame->frame_control.sub_type = IEEE80211_TYPE_DATA_SUBTYPE_DATA;
+ frame->frame_control.flags = 0x2; // from station back to station via AP
+ frame->duration_id = 44;
+ frame->sequence_control.fragment_number = 0;
+
+ // send message to wlan-device
+ memcpy(frame->destination_address, s->macaddr, 6);
+
+ size -= 12; // remove old 803.2 header
+ size += 6; // add new 803.11 header
+ if (size > sizeof(frame->data_and_fcs))
+ {
+ // sanitize memcpy
+ size = sizeof(frame->data_and_fcs);
+ }
+
+ // LLC
+ frame->data_and_fcs[0] = 0xaa;
+ frame->data_and_fcs[1] = 0xaa;
+ frame->data_and_fcs[2] = 0x03;
+ frame->data_and_fcs[3] = 0x00;
+ frame->data_and_fcs[4] = 0x00;
+ frame->data_and_fcs[5] = 0x00;
+
+ memcpy(&frame->data_and_fcs[6], &buf[12], size);
+ frame->frame_length = IEEE80211_HEADER_SIZE + size;
+
+ return frame;
+}
+
+int Atheros_WLAN_dumpFrame(struct mac80211_frame *frame, int frame_len, char *filename)
+{
+ int i = 0, j;
+ unsigned char buf[56];
+ unsigned int frame_total_length = frame_len + 16;
+ unsigned char *l = (unsigned char *)&frame_total_length;
+
+ // Wireshark header
+ buf[i++] = 0xd4; buf[i++] = 0xc3; buf[i++] = 0xb2; buf[i++] = 0xa1; buf[i++] = 0x02; buf[i++] = 0x00; buf[i++] = 0x04; buf[i++] = 0x00;
+ buf[i++] = 0x00; buf[i++] = 0x00; buf[i++] = 0x00; buf[i++] = 0x00; buf[i++] = 0x00; buf[i++] = 0x00; buf[i++] = 0x00; buf[i++] = 0x00;
+ buf[i++] = 0x60; buf[i++] = 0x00; buf[i++] = 0x00; buf[i++] = 0x00; buf[i++] = 0x7f; buf[i++] = 0x00; buf[i++] = 0x00; buf[i++] = 0x00;
+ buf[i++] = 0xd1; buf[i++] = 0x75; buf[i++] = 0x5d; buf[i++] = 0x46; buf[i++] = 0x76; buf[i++] = 0x8b; buf[i++] = 0x06; buf[i++] = 0x00;
+
+ // total frame length
+ for (j=0; j<4; buf[i++] = l[j++]);
+ // captured frame length
+ for (j=0; j<4; buf[i++] = l[j++]);
+
+ // Radiotap header
+ buf[i++] = 0x00; buf[i++] = 0x00; buf[i++] = 0x10; buf[i++] = 0x00; buf[i++] = 0x0e; buf[i++] = 0x18; buf[i++] = 0x00; buf[i++] = 0x00;
+ buf[i++] = 0x10; buf[i++] = 0x02; buf[i++] = 0x94; buf[i++] = 0x09; buf[i++] = 0xa0; buf[i++] = 0x00; buf[i++] = 0x00; buf[i++] = 0x26;
+
+ FILE *fp;
+ fp = fopen(filename, "w");
+ if (!fp)
+ {
+ return 1;
+ }
+
+ fwrite(buf, 1, sizeof(buf), fp);
+ fwrite(frame, 1, frame_len, fp);
+
+ fclose(fp);
+
+ return 0;
+}
+
diff -Nurp qemu-0.9.1-untouched/hw/atheros_wlan_packet.h qemu-0.9.1/hw/atheros_wlan_packet.h
--- qemu-0.9.1-untouched/hw/atheros_wlan_packet.h 1970-01-01 01:00:00.000000000 +0100
+++ qemu-0.9.1/hw/atheros_wlan_packet.h 2008-02-28 14:11:16.000000000 +0100
@@ -0,0 +1,48 @@
+/**
+ * QEMU WLAN access point emulation
+ *
+ * Copyright (c) 2008 Clemens Kolbitsch
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Modifications:
+ * 2008-February-24 Clemens Kolbitsch :
+ * New implementation based on ne2000.c
+ *
+ */
+
+#ifndef atheros_wlan_packet_h
+#define atheros_wlan_packet_h 1
+
+#include "hw/atheros_wlan.h"
+
+void Atheros_WLAN_init_frame(Atheros_WLANState *s, struct mac80211_frame *frame);
+
+int Atheros_WLAN_dumpFrame(struct mac80211_frame *frame, int frame_len, char *filename);
+
+struct mac80211_frame *Atheros_WLAN_create_beacon_frame();
+struct mac80211_frame *Atheros_WLAN_create_probe_response();
+struct mac80211_frame *Atheros_WLAN_create_authentication();
+struct mac80211_frame *Atheros_WLAN_create_deauthentication();
+struct mac80211_frame *Atheros_WLAN_create_association_response();
+struct mac80211_frame *Atheros_WLAN_create_disassociation();
+struct mac80211_frame *Atheros_WLAN_create_data_reply(Atheros_WLANState *s, struct mac80211_frame *incoming);
+struct mac80211_frame *Atheros_WLAN_create_data_packet(Atheros_WLANState *s, const uint8_t *buf, int size);
+
+#endif // atheros_wlan_packet_h
diff -Nurp qemu-0.9.1-untouched/hw/pci.c qemu-0.9.1/hw/pci.c
--- qemu-0.9.1-untouched/hw/pci.c 2008-02-28 13:58:19.000000000 +0100
+++ qemu-0.9.1/hw/pci.c 2008-02-28 14:19:42.000000000 +0100
@@ -636,6 +636,8 @@ void pci_nic_init(PCIBus *bus, NICInfo *
pci_i82559er_init(bus, nd, devfn);
} else if (strcmp(nd->model, "rtl8139") == 0) {
pci_rtl8139_init(bus, nd, devfn);
+ } else if (strncmp(nd->model, "atheros_wlan", 12) == 0) {
+ pci_Atheros_WLAN_init(bus, nd, devfn);
} else if (strcmp(nd->model, "pcnet") == 0) {
pci_pcnet_init(bus, nd, devfn);
} else if (strcmp(nd->model, "?") == 0) {
diff -Nurp qemu-0.9.1-untouched/hw/pci.h qemu-0.9.1/hw/pci.h
--- qemu-0.9.1-untouched/hw/pci.h 2008-02-28 13:58:19.000000000 +0100
+++ qemu-0.9.1/hw/pci.h 2008-02-28 14:20:33.000000000 +0100
@@ -126,6 +126,9 @@ void pci_ne2000_init(PCIBus *bus, NICInf
void pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn);
+/* atheros_wlan.c */
+void pci_Atheros_WLAN_init(PCIBus *bus, NICInfo *nd, int devfn);
+
/* pcnet.c */
void pci_pcnet_init(PCIBus *bus, NICInfo *nd, int devfn);
diff -Nurp qemu-0.9.1-untouched/Makefile.target qemu-0.9.1/Makefile.target
--- qemu-0.9.1-untouched/Makefile.target 2008-02-28 13:58:19.000000000 +0100
+++ qemu-0.9.1/Makefile.target 2008-02-28 14:06:54.000000000 +0100
@@ -435,6 +435,8 @@ VL_OBJS += eepro100.o
VL_OBJS += ne2000.o
VL_OBJS += pcnet.o
VL_OBJS += rtl8139.o
+VL_OBJS += atheros_wlan.o atheros_wlan_io.o atheros_wlan_ap.o
+VL_OBJS += atheros_wlan_packet.o atheros_wlan_crc32.o
ifeq ($(TARGET_BASE_ARCH), i386)
# Hardware support
^ permalink raw reply [flat|nested] 3+ messages in thread