mirror of https://github.com/proski/madwifi
move all HAL extensions (everything including direct register read and writes
or reverse engineered information) to if_ath_hal_extensions.[ch] git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3657 0192ed92-7a03-0410-a25b-9323aeb14dbd
This commit is contained in:
parent
fe5351a3e3
commit
8d0833e60d
|
@ -57,7 +57,7 @@ COPTS += -DDFS_DOMAIN_ETSI -DDFS_DOMAIN_FCC
|
|||
include $(TOP)/Makefile.inc
|
||||
|
||||
obj-m += ath_$(BUSNAME).o
|
||||
ath_$(BUSNAME)-objs := if_ath.o if_ath_radar.o if_ath_$(BUSNAME).o
|
||||
ath_$(BUSNAME)-objs := if_ath.o if_ath_radar.o if_ath_hal_extensions.o if_ath_$(BUSNAME).o
|
||||
|
||||
INCS += -I$(TOP) -I$(ATH_HAL) -I$(HAL) -I$(WLAN)
|
||||
|
||||
|
|
70
ath/if_ath.c
70
ath/if_ath.c
|
@ -129,7 +129,6 @@ static struct ieee80211vap *ath_vap_create(struct ieee80211com *,
|
|||
const char *, int, int, struct net_device *);
|
||||
static void ath_vap_delete(struct ieee80211vap *);
|
||||
static int ath_init(struct net_device *);
|
||||
static int ath_set_ack_bitrate(struct ath_softc *, int);
|
||||
static int ath_reset(struct net_device *);
|
||||
static void ath_fatal_tasklet(TQUEUE_ARG);
|
||||
static void ath_rxorn_tasklet(TQUEUE_ARG);
|
||||
|
@ -2751,75 +2750,6 @@ ath_stop(struct net_device *dev)
|
|||
return error;
|
||||
}
|
||||
|
||||
int
|
||||
ar_device(int devid)
|
||||
{
|
||||
switch (devid) {
|
||||
case AR5210_DEFAULT:
|
||||
case AR5210_PROD:
|
||||
case AR5210_AP:
|
||||
return 5210;
|
||||
case AR5211_DEFAULT:
|
||||
case AR5311_DEVID:
|
||||
case AR5211_LEGACY:
|
||||
case AR5211_FPGA11B:
|
||||
return 5211;
|
||||
case AR5212_DEFAULT:
|
||||
case AR5212_DEVID:
|
||||
case AR5212_FPGA:
|
||||
case AR5212_DEVID_IBM:
|
||||
case AR5212_AR5312_REV2:
|
||||
case AR5212_AR5312_REV7:
|
||||
case AR5212_AR2313_REV8:
|
||||
case AR5212_AR2315_REV6:
|
||||
case AR5212_AR2315_REV7:
|
||||
case AR5212_AR2317_REV1:
|
||||
case AR5212_DEVID_0014:
|
||||
case AR5212_DEVID_0015:
|
||||
case AR5212_DEVID_0016:
|
||||
case AR5212_DEVID_0017:
|
||||
case AR5212_DEVID_0018:
|
||||
case AR5212_DEVID_0019:
|
||||
case AR5212_AR2413:
|
||||
case AR5212_AR5413:
|
||||
case AR5212_AR5424:
|
||||
case AR5212_DEVID_FF19:
|
||||
return 5212;
|
||||
case AR5213_SREV_1_0:
|
||||
case AR5213_SREV_REG:
|
||||
case AR_SUBVENDOR_ID_NOG:
|
||||
case AR_SUBVENDOR_ID_NEW_A:
|
||||
return 5213;
|
||||
default:
|
||||
return 0; /* unknown */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
ath_set_ack_bitrate(struct ath_softc *sc, int high)
|
||||
{
|
||||
if (ar_device(sc->devid) == 5212 || ar_device(sc->devid) == 5213) {
|
||||
/* set ack to be sent at low bit-rate */
|
||||
/* registers taken from the OpenBSD 5212 HAL */
|
||||
#define AR5K_AR5212_STA_ID1 0x8004
|
||||
#define AR5K_AR5212_STA_ID1_ACKCTS_6MB 0x01000000
|
||||
#define AR5K_AR5212_STA_ID1_BASE_RATE_11B 0x02000000
|
||||
u_int32_t v = AR5K_AR5212_STA_ID1_BASE_RATE_11B |
|
||||
AR5K_AR5212_STA_ID1_ACKCTS_6MB;
|
||||
if (high)
|
||||
ath_reg_write(sc, AR5K_AR5212_STA_ID1,
|
||||
ath_reg_read(sc, AR5K_AR5212_STA_ID1) & ~v);
|
||||
else
|
||||
ath_reg_write(sc, AR5K_AR5212_STA_ID1,
|
||||
ath_reg_read(sc, AR5K_AR5212_STA_ID1) | v);
|
||||
#undef AR5K_AR5212_STA_ID1
|
||||
#undef AR5K_AR5212_STA_ID1_BASE_RATE_11B
|
||||
#undef AR5K_AR5212_STA_ID1_ACKCTS_6MB
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset the hardware w/o losing operational state. This is
|
||||
|
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Bruno Randolf <br1@einfach.org>
|
||||
* 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.
|
||||
*
|
||||
* $Id: br1 $
|
||||
*/
|
||||
|
||||
#include "hal/ah_devid.h"
|
||||
#include "if_media.h"
|
||||
#include <net80211/ieee80211_var.h>
|
||||
#include "if_athvar.h"
|
||||
#include "if_ath_hal.h"
|
||||
#include "if_ath_hal_macros.h"
|
||||
#include "if_ath_hal_wrappers.h"
|
||||
#include "if_ath_hal_extensions.h"
|
||||
|
||||
|
||||
int
|
||||
ar_device(int devid)
|
||||
{
|
||||
switch (devid) {
|
||||
case AR5210_DEFAULT:
|
||||
case AR5210_PROD:
|
||||
case AR5210_AP:
|
||||
return 5210;
|
||||
case AR5211_DEFAULT:
|
||||
case AR5311_DEVID:
|
||||
case AR5211_LEGACY:
|
||||
case AR5211_FPGA11B:
|
||||
return 5211;
|
||||
case AR5212_DEFAULT:
|
||||
case AR5212_DEVID:
|
||||
case AR5212_FPGA:
|
||||
case AR5212_DEVID_IBM:
|
||||
case AR5212_AR5312_REV2:
|
||||
case AR5212_AR5312_REV7:
|
||||
case AR5212_AR2313_REV8:
|
||||
case AR5212_AR2315_REV6:
|
||||
case AR5212_AR2315_REV7:
|
||||
case AR5212_AR2317_REV1:
|
||||
case AR5212_DEVID_0014:
|
||||
case AR5212_DEVID_0015:
|
||||
case AR5212_DEVID_0016:
|
||||
case AR5212_DEVID_0017:
|
||||
case AR5212_DEVID_0018:
|
||||
case AR5212_DEVID_0019:
|
||||
case AR5212_AR2413:
|
||||
case AR5212_AR5413:
|
||||
case AR5212_AR5424:
|
||||
case AR5212_DEVID_FF19:
|
||||
return 5212;
|
||||
case AR5213_SREV_1_0:
|
||||
case AR5213_SREV_REG:
|
||||
case AR_SUBVENDOR_ID_NOG:
|
||||
case AR_SUBVENDOR_ID_NEW_A:
|
||||
return 5213;
|
||||
default:
|
||||
return 0; /* unknown */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ath_set_ack_bitrate(struct ath_softc *sc, int high)
|
||||
{
|
||||
if (ar_device(sc->devid) == 5212 || ar_device(sc->devid) == 5213) {
|
||||
/* set ack to be sent at low bit-rate */
|
||||
u_int32_t v = AR5K_STA_ID1_BASE_RATE_11B | AR5K_STA_ID1_ACKCTS_6MB;
|
||||
if (high)
|
||||
ath_reg_write(sc, AR5K_STA_ID1,
|
||||
ath_reg_read(sc, AR5K_STA_ID1) & ~v);
|
||||
else
|
||||
ath_reg_write(sc, AR5K_STA_ID1,
|
||||
ath_reg_read(sc, AR5K_STA_ID1) | v);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -157,6 +157,26 @@
|
|||
#define AR5K_RXCFG_SDMAMW 0x00000007 /* DMA size */
|
||||
#define AR5K_RXCFG_SDMAMW_S 0
|
||||
|
||||
/*
|
||||
* 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 power save polling [5210] */
|
||||
#define AR5K_STA_ID1_PCF_5211 0x00100000 /* Enable PCF on [5211+] */
|
||||
#define AR5K_STA_ID1_PCF_5210 0x00200000 /* Enable PCF on [5210]*/
|
||||
#define AR5K_STA_ID1_PCF (ah->ah_version == AR5K_AR5210 ? \
|
||||
AR5K_STA_ID1_PCF_5210 : AR5K_STA_ID1_PCF_5211)
|
||||
#define AR5K_STA_ID1_DEFAULT_ANTENNA 0x00200000 /* Use default antenna */
|
||||
#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 ?) [5211+] */
|
||||
|
||||
|
||||
/*
|
||||
* DMA size definitions (2^(n+2))
|
||||
*/
|
||||
|
@ -171,6 +191,11 @@ enum ath5k_dmasize {
|
|||
AR5K_DMASIZE_512B
|
||||
};
|
||||
|
||||
|
||||
int ath_set_ack_bitrate(struct ath_softc* sc, int);
|
||||
int ar_device(int devid);
|
||||
|
||||
|
||||
static inline unsigned long field_width(unsigned long mask, unsigned long shift)
|
||||
{
|
||||
unsigned long r = 0;
|
||||
|
|
|
@ -997,7 +997,6 @@ int ath_ioctl_ethtool(struct ath_softc *, int, void __user *);
|
|||
void bus_read_cachesize(struct ath_softc *, u_int8_t *);
|
||||
void ath_sysctl_register(void);
|
||||
void ath_sysctl_unregister(void);
|
||||
int ar_device(int devid);
|
||||
|
||||
#define DEV_NAME(_d) \
|
||||
((NULL == _d || NULL == _d->name || 0 == strncmp(_d->name, "wifi%d", 6)) ? \
|
||||
|
|
Loading…
Reference in New Issue