2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-21 11:44:01 +08:00

Staging: rt2860: prepare for rt28[67]0/*.[ch] merge

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Bartlomiej Zolnierkiewicz 2009-04-26 16:06:25 +02:00 committed by Greg Kroah-Hartman
parent 0eae1ca391
commit 3a32ed12b6
14 changed files with 1952 additions and 38 deletions

View File

@ -2,6 +2,7 @@ obj-$(CONFIG_RT2860) += rt2860sta.o
# TODO: all of these should be removed
EXTRA_CFLAGS += -DLINUX -DAGGREGATION_SUPPORT -DPIGGYBACK_SUPPORT -DWMM_SUPPORT
EXTRA_CFLAGS += -DRT2860
EXTRA_CFLAGS += -DDBG
rt2860sta-objs := \

View File

@ -324,6 +324,13 @@ VOID APQuickResponeForRateUpExec(
IN PVOID SystemSpecific2,
IN PVOID SystemSpecific3);
#ifdef RT2870
VOID BeaconUpdateExec(
IN PVOID SystemSpecific1,
IN PVOID FunctionContext,
IN PVOID SystemSpecific2,
IN PVOID SystemSpecific3);
#endif // RT2870 //
VOID RTMPSetPiggyBack(
IN PRTMP_ADAPTER pAd,

View File

@ -524,7 +524,12 @@ static CH_REGION ChRegion[] =
JAP,
{
{ 1, 14, 20, BOTH, FALSE}, // 2.4 G, ch 1~14
#ifndef RT30xx
{ 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48
#endif
#ifdef RT30xx
{ 34, 4, 23, IDOR, FALSE}, // 5G, ch 34~46
#endif
{ 0}, // end
}
},

View File

@ -535,8 +535,10 @@ typedef enum _NDIS_802_11_WEP_STATUS
Ndis802_11Encryption3KeyAbsent,
Ndis802_11Encryption4Enabled, // TKIP or AES mix
Ndis802_11Encryption4KeyAbsent,
#ifndef RT30xx
Ndis802_11GroupWEP40Enabled,
Ndis802_11GroupWEP104Enabled,
#endif
} NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
@ -631,11 +633,17 @@ typedef struct _NDIS_802_11_CAPABILITY
#define SIOCIWFIRSTPRIV SIOCDEVPRIVATE
#endif
#ifdef RT30xx
#define RT_PRIV_IOCTL_EXT (SIOCIWFIRSTPRIV + 0x01) // Sync. with AP for wsc upnp daemon
#endif
#define RTPRIV_IOCTL_SET (SIOCIWFIRSTPRIV + 0x02)
#ifdef DBG
#define RTPRIV_IOCTL_BBP (SIOCIWFIRSTPRIV + 0x03)
#define RTPRIV_IOCTL_MAC (SIOCIWFIRSTPRIV + 0x05)
#ifdef RT30xx
#define RTPRIV_IOCTL_RF (SIOCIWFIRSTPRIV + 0x13)
#endif
#define RTPRIV_IOCTL_E2P (SIOCIWFIRSTPRIV + 0x07)
#endif
@ -652,9 +660,16 @@ enum {
SHOW_DRVIER_VERION = 5,
SHOW_BA_INFO = 6,
SHOW_DESC_INFO = 7,
#ifdef RT2870
SHOW_RXBULK_INFO = 8,
SHOW_TXBULK_INFO = 9,
#endif // RT2870 //
RAIO_OFF = 10,
RAIO_ON = 11,
SHOW_CFG_VALUE = 20,
#if !defined(RT2860) && !defined(RT30xx)
SHOW_ADHOC_ENTRY_INFO = 21,
#endif
};
#define OID_802_11_BUILD_CHANNEL_EX 0x0714
@ -662,13 +677,41 @@ enum {
#define OID_802_11_GET_COUNTRY_CODE 0x0716
#define OID_802_11_GET_CHANNEL_GEOGRAPHY 0x0717
#ifdef RT30xx
#define RT_OID_WSC_SET_PASSPHRASE 0x0740 // passphrase for wpa(2)-psk
#define RT_OID_WSC_DRIVER_AUTO_CONNECT 0x0741
#define RT_OID_WSC_QUERY_DEFAULT_PROFILE 0x0742
#define RT_OID_WSC_SET_CONN_BY_PROFILE_INDEX 0x0743
#define RT_OID_WSC_SET_ACTION 0x0744
#define RT_OID_WSC_SET_SSID 0x0745
#define RT_OID_WSC_SET_PIN_CODE 0x0746
#define RT_OID_WSC_SET_MODE 0x0747 // PIN or PBC
#define RT_OID_WSC_SET_CONF_MODE 0x0748 // Enrollee or Registrar
#define RT_OID_WSC_SET_PROFILE 0x0749
#define RT_OID_802_11_WSC_QUERY_PROFILE 0x0750
// for consistency with RT61
#define RT_OID_WSC_QUERY_STATUS 0x0751
#define RT_OID_WSC_PIN_CODE 0x0752
#define RT_OID_WSC_UUID 0x0753
#define RT_OID_WSC_SET_SELECTED_REGISTRAR 0x0754
#define RT_OID_WSC_EAPMSG 0x0755
#define RT_OID_WSC_MANUFACTURER 0x0756
#define RT_OID_WSC_MODEL_NAME 0x0757
#define RT_OID_WSC_MODEL_NO 0x0758
#define RT_OID_WSC_SERIAL_NO 0x0759
#define RT_OID_WSC_MAC_ADDRESS 0x0760
#endif
#ifdef LLTD_SUPPORT
// for consistency with RT61
#define RT_OID_GET_PHY_MODE 0x761
#endif // LLTD_SUPPORT //
#if defined(RT2860) || defined(RT30xx)
// New for MeetingHouse Api support
#define OID_MH_802_1X_SUPPORTED 0xFFEDC100
#endif
// MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI. Don't change this definition!!!
typedef union _HTTRANSMIT_SETTING {
@ -691,7 +734,6 @@ typedef enum _RT_802_11_PREAMBLE {
} RT_802_11_PREAMBLE, *PRT_802_11_PREAMBLE;
// Only for STA, need to sync with AP
// 2005-03-08 match current RaConfig.
typedef enum _RT_802_11_PHY_MODE {
PHY_11BG_MIXED = 0,
PHY_11B,
@ -886,6 +928,27 @@ typedef struct _RT_CHANNEL_LIST_INFO
UCHAR ChannelListNum; // number of channel in ChannelList[]
} RT_CHANNEL_LIST_INFO, *PRT_CHANNEL_LIST_INFO;
#ifdef RT2870
// WSC configured credential
typedef struct _WSC_CREDENTIAL
{
NDIS_802_11_SSID SSID; // mandatory
USHORT AuthType; // mandatory, 1: open, 2: wpa-psk, 4: shared, 8:wpa, 0x10: wpa2, 0x20: wpa2-psk
USHORT EncrType; // mandatory, 1: none, 2: wep, 4: tkip, 8: aes
UCHAR Key[64]; // mandatory, Maximum 64 byte
USHORT KeyLength;
UCHAR MacAddr[6]; // mandatory, AP MAC address
UCHAR KeyIndex; // optional, default is 1
UCHAR Rsvd[3]; // Make alignment
} WSC_CREDENTIAL, *PWSC_CREDENTIAL;
// WSC configured profiles
typedef struct _WSC_PROFILE
{
UINT ProfileCnt;
WSC_CREDENTIAL Profile[8]; // Support up to 8 profiles
} WSC_PROFILE, *PWSC_PROFILE;
#endif
#endif // _OID_H_

View File

@ -47,6 +47,15 @@
#define PCI_EECTRL 0x0004
#define PCI_MCUCTRL 0x0008
#ifdef RT30xx
#define OPT_14 0x114
typedef int NTSTATUS;
#define RETRY_LIMIT 10
#define STATUS_SUCCESS 0x00
#define STATUS_UNSUCCESSFUL 0x01
#endif
//
// SCH/DMA registers - base address 0x0200
//
@ -282,6 +291,36 @@ typedef union _USB_DMA_CFG_STRUC {
#define PBF_DBG 0x043c
#define PBF_CAP_CTRL 0x0440
#ifdef RT30xx
// eFuse registers
#define EFUSE_CTRL 0x0580
#define EFUSE_DATA0 0x0590
#define EFUSE_DATA1 0x0594
#define EFUSE_DATA2 0x0598
#define EFUSE_DATA3 0x059c
#define EFUSE_USAGE_MAP_START 0x2d0
#define EFUSE_USAGE_MAP_END 0x2fc
#define EFUSE_TAG 0x2fe
#define EFUSE_USAGE_MAP_SIZE 45
typedef union _EFUSE_CTRL_STRUC {
struct {
UINT32 EFSROM_AOUT:6;
UINT32 EFSROM_MODE:2;
UINT32 EFSROM_LDO_OFF_TIME:6;
UINT32 EFSROM_LDO_ON_TIME:2;
UINT32 EFSROM_AIN:10;
UINT32 RESERVED:4;
UINT32 EFSROM_KICK:1;
UINT32 SEL_EFUSE:1;
} field;
UINT32 word;
} EFUSE_CTRL_STRUC, *PEFUSE_CTRL_STRUC;
#define LDO_CFG0 0x05d4
#define GPIO_SWITCH 0x05dc
#endif /* RT30xx */
//
// 4 MAC registers
//
@ -1007,10 +1046,16 @@ typedef struct _HW_WCID_ENTRY { // 8-byte per entry
#define E2PROM_CSR 0x0004
#define IO_CNTL_CSR 0x77d0
#ifdef RT2860
// 8051 firmware image for RT2860 - base address = 0x4000
#define FIRMWARE_IMAGE_BASE 0x2000
#define MAX_FIRMWARE_IMAGE_SIZE 0x2000 // 8kbyte
#endif
#ifdef RT2870
// 8051 firmware image for usb - use last-half base address = 0x3000
#define FIRMWARE_IMAGE_BASE 0x3000
#define MAX_FIRMWARE_IMAGE_SIZE 0x1000 // 4kbyte
#endif // RT2870 //
// ================================================================
// Tx / Rx / Mgmt ring descriptor definition
@ -1091,6 +1136,9 @@ typedef struct _HW_WCID_ENTRY { // 8-byte per entry
#define BBP_R22 22
#define BBP_R24 24
#define BBP_R25 25
#ifdef RT30xx
#define BBP_R31 31
#endif
#define BBP_R49 49 //TSSI
#define BBP_R50 50
#define BBP_R51 51
@ -1108,6 +1156,10 @@ typedef struct _HW_WCID_ENTRY { // 8-byte per entry
#define BBP_R73 73
#define BBP_R75 75
#define BBP_R77 77
#ifdef RT30xx
#define BBP_R79 79
#define BBP_R80 80
#endif
#define BBP_R81 81
#define BBP_R82 82
#define BBP_R83 83
@ -1129,6 +1181,9 @@ typedef struct _HW_WCID_ENTRY { // 8-byte per entry
#define BBP_R121 121
#define BBP_R122 122
#define BBP_R123 123
#ifdef RT30xx
#define BBP_R138 138 // add by johnli, RF power sequence setup, ADC dynamic on/off control
#endif // RT30xx //
#define BBPR94_DEFAULT 0x06 // Add 1 value will gain 1db
@ -1294,6 +1349,7 @@ typedef struct PACKED _TXWI_STRUC {
//
// Rx descriptor format, Rx Ring
//
#ifdef RT2860
typedef struct PACKED _RXD_STRUC {
// Word 0
UINT32 SDP0;
@ -1326,6 +1382,7 @@ typedef struct PACKED _RXD_STRUC {
UINT32 PlcpRssil:1;// To be moved
UINT32 Rsv1:13;
} RXD_STRUC, *PRXD_STRUC, RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC;
#endif /* RT2860 */
//
// RXWI wireless information format, in PBF. invisible in driver.
@ -1550,7 +1607,15 @@ typedef union _EEPROM_NIC_CINFIG2_STRUC {
USHORT EnableWPSPBC:1; // WPS PBC Control bit
USHORT BW40MAvailForG:1; // 0:enable, 1:disable
USHORT BW40MAvailForA:1; // 0:enable, 1:disable
#ifndef RT30xx
USHORT Rsv2:6; // must be 0
#endif
#ifdef RT30xx
USHORT Rsv1:1; // must be 0
USHORT AntDiversity:1; // Antenna diversity
USHORT Rsv2:3; // must be 0
USHORT DACTestBit:1; // control if driver should patch the DAC issue
#endif
} field;
USHORT word;
} EEPROM_NIC_CONFIG2_STRUC, *PEEPROM_NIC_CONFIG2_STRUC;

View File

@ -47,8 +47,12 @@
#include "rtmp_def.h"
#include "rt28xx.h"
#ifdef RT2860
#include "rt2860.h"
#endif
#ifdef RT2870
#include "../rt2870/rt2870.h"
#endif // RT2870 //
#include "oid.h"
#include "mlme.h"

View File

@ -33,6 +33,9 @@ BUILD_TIMER_FUNCTION(MlmePeriodicExec);
BUILD_TIMER_FUNCTION(AsicRxAntEvalTimeout);
BUILD_TIMER_FUNCTION(APSDPeriodicExec);
BUILD_TIMER_FUNCTION(AsicRfTuningExec);
#ifdef RT2870
BUILD_TIMER_FUNCTION(BeaconUpdateExec);
#endif // RT2870 //
BUILD_TIMER_FUNCTION(BeaconTimeout);
BUILD_TIMER_FUNCTION(ScanTimeout);
@ -43,8 +46,10 @@ BUILD_TIMER_FUNCTION(DisassocTimeout);
BUILD_TIMER_FUNCTION(LinkDownExec);
BUILD_TIMER_FUNCTION(StaQuickResponeForRateUpExec);
BUILD_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc);
#ifdef RT2860
BUILD_TIMER_FUNCTION(PsPollWakeExec);
BUILD_TIMER_FUNCTION(RadioOnExec);
#endif
// for wireless system event message
char const *pWirelessSysEventText[IW_SYS_EVENT_TYPE_NUM] = {
@ -281,9 +286,9 @@ VOID RTMPFreeAdapter(
NdisFreeSpinLock(&pAd->MgmtRingLock);
#ifdef RT2860
NdisFreeSpinLock(&pAd->RxRingLock);
#endif
for (index =0 ; index < NUM_OF_TX_RING; index++)
{
NdisFreeSpinLock(&pAd->TxSwQueueLock[index]);
@ -829,7 +834,12 @@ void send_monitor_packets(
if (pRxBlk->DataSize + sizeof(wlan_ng_prism2_header) > RX_BUFFER_AGGRESIZE)
{
#ifndef RT30xx
DBGPRINT(RT_DEBUG_ERROR, ("%s : Size is too large! (%zu)\n", __func__, pRxBlk->DataSize + sizeof(wlan_ng_prism2_header)));
#endif
#ifdef RT30xx
DBGPRINT(RT_DEBUG_ERROR, ("%s : Size is too large! (%d)\n", __func__, pRxBlk->DataSize + sizeof(wlan_ng_prism2_header)));
#endif
goto err_free_sk_buff;
}

View File

@ -43,6 +43,9 @@
#include "rtmp_type.h"
#include <linux/module.h>
#include <linux/kernel.h>
#if !defined(RT2860) && !defined(RT30xx)
#include <linux/kthread.h>
#endif
#include <linux/spinlock.h>
#include <linux/init.h>
@ -64,6 +67,9 @@
#include <linux/vmalloc.h>
#ifdef RT30xx
#include <linux/wireless.h>
#endif
#include <net/iw_handler.h>
// load firmware
@ -87,16 +93,31 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_
// add by kathy
#ifdef RT2860
#define STA_PROFILE_PATH "/etc/Wireless/RT2860STA/RT2860STA.dat"
#define STA_RTMP_FIRMWARE_FILE_NAME "/etc/Wireless/RT2860STA/RT2860STA.bin"
#define STA_NIC_DEVICE_NAME "RT2860STA"
#define STA_DRIVER_VERSION "1.8.1.1"
#endif
#ifdef RT2870
#define STA_PROFILE_PATH "/etc/Wireless/RT2870STA/RT2870STA.dat"
#define STA_RT2870_IMAGE_FILE_NAME "/etc/Wireless/RT2870STA/rt2870.bin"
#define STA_NIC_DEVICE_NAME "RT2870STA"
#ifndef RT30xx
#define STA_DRIVER_VERSION "1.4.0.0"
#endif
#ifdef RT30xx
#define STA_DRIVER_VERSION "2.0.1.0"
#endif
#endif
#ifdef RT2860
#ifndef PCI_DEVICE
#define PCI_DEVICE(vend,dev) \
.vendor = (vend), .device = (dev), \
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
#endif // PCI_DEVICE //
#endif
#define RTMP_TIME_AFTER(a,b) \
(typecheck(unsigned long, (unsigned long)a) && \
@ -143,12 +164,16 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_
#define NDIS_PACKET_TYPE_BROADCAST 2
#define NDIS_PACKET_TYPE_ALL_MULTICAST 3
#ifndef RT30xx
typedef struct pid * THREAD_PID;
#ifdef RT2860
#define THREAD_PID_INIT_VALUE NULL
#endif
#define GET_PID(_v) find_get_pid(_v)
#define GET_PID_NUMBER(_v) pid_nr(_v)
#define CHECK_PID_LEGALITY(_pid) if (pid_nr(_pid) >= 0)
#define KILL_THREAD_PID(_A, _B, _C) kill_pid(_A, _B, _C)
#endif
struct os_lock {
spinlock_t lock;
@ -157,10 +182,25 @@ struct os_lock {
struct os_cookie {
#ifdef RT2860
struct pci_dev *pci_dev;
struct pci_dev *parent_pci_dev;
dma_addr_t pAd_pa;
#endif
#ifdef RT2870
struct usb_device *pUsb_Dev;
#ifndef RT30xx
struct task_struct *MLMEThr_task;
struct task_struct *RTUSBCmdThr_task;
struct task_struct *TimerQThr_task;
#endif
#ifdef RT30xx
struct pid *MLMEThr_pid;
struct pid *RTUSBCmdThr_pid;
struct pid *TimerQThr_pid;
#endif
#endif // RT2870 //
struct tasklet_struct rx_done_task;
struct tasklet_struct mgmt_dma_done_task;
@ -170,8 +210,14 @@ struct os_cookie {
struct tasklet_struct ac3_dma_done_task;
struct tasklet_struct hcca_dma_done_task;
struct tasklet_struct tbtt_task;
#ifdef RT2860
struct tasklet_struct fifo_statistic_full_task;
#endif
#ifdef RT2870
struct tasklet_struct null_frame_complete_task;
struct tasklet_struct rts_frame_complete_task;
struct tasklet_struct pspoll_frame_complete_task;
#endif // RT2870 //
unsigned long apd_pid; //802.1x daemon pid
INT ioctl_if_type;
@ -219,6 +265,7 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int
#define RT2860_PCI_DEVICE_ID 0x0601
#ifdef RT2860
#define PCI_MAP_SINGLE(_handle, _ptr, _size, _sd_idx, _dir) \
linux_pci_map_single(_handle, _ptr, _size, _sd_idx, _dir)
@ -233,7 +280,12 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int
#define DEV_ALLOC_SKB(_length) \
dev_alloc_skb(_length)
#endif
#ifdef RT2870
#define PCI_MAP_SINGLE(_handle, _ptr, _size, _dir) (ULONG)0
#define PCI_UNMAP_SINGLE(_handle, _ptr, _size, _dir)
#endif // RT2870 //
#define BEACON_FRAME_DMA_CACHE_WBACK(_ptr, _size) \
@ -247,9 +299,20 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int
#define NdisMIndicateStatus(_w, _x, _y, _z)
typedef struct timer_list RTMP_OS_TIMER;
#ifdef RT2870
/* ----------------- Timer Related MARCO ---------------*/
// In RT2870, we have a lot of timer functions and will read/write register, it's
// not allowed in Linux USB sub-system to do it ( because of sleep issue when submit
// to ctrl pipe). So we need a wrapper function to take care it.
typedef VOID (*RT2870_TIMER_HANDLE)(
IN PVOID SystemSpecific1,
IN PVOID FunctionContext,
IN PVOID SystemSpecific2,
IN PVOID SystemSpecific3);
#endif // RT2870 //
typedef struct _RALINK_TIMER_STRUCT {
@ -260,9 +323,42 @@ typedef struct _RALINK_TIMER_STRUCT {
BOOLEAN Repeat; // True if periodic timer
ULONG TimerValue; // Timer value in milliseconds
ULONG cookie; // os specific object
#ifdef RT2870
RT2870_TIMER_HANDLE handle;
void *pAd;
#endif // RT2870 //
} RALINK_TIMER_STRUCT, *PRALINK_TIMER_STRUCT;
#ifdef RT2870
typedef enum _RT2870_KERNEL_THREAD_STATUS_
{
RT2870_THREAD_UNKNOWN = 0,
RT2870_THREAD_INITED = 1,
RT2870_THREAD_RUNNING = 2,
RT2870_THREAD_STOPED = 4,
}RT2870_KERNEL_THREAD_STATUS;
#define RT2870_THREAD_CAN_DO_INSERT (RT2870_THREAD_INITED |RT2870_THREAD_RUNNING)
typedef struct _RT2870_TIMER_ENTRY_
{
RALINK_TIMER_STRUCT *pRaTimer;
struct _RT2870_TIMER_ENTRY_ *pNext;
}RT2870_TIMER_ENTRY;
#define TIMER_QUEUE_SIZE_MAX 128
typedef struct _RT2870_TIMER_QUEUE_
{
unsigned int status;
UCHAR *pTimerQPoll;
RT2870_TIMER_ENTRY *pQPollFreeList;
RT2870_TIMER_ENTRY *pQHead;
RT2870_TIMER_ENTRY *pQTail;
}RT2870_TIMER_QUEUE;
#endif // RT2870 //
//#define DBG 1
@ -352,6 +448,7 @@ extern ULONG RTDebugLevel;
spin_unlock_irqrestore((spinlock_t *)(__lock), ((unsigned long)__irqflag)); \
}
#ifdef RT2860
#if defined(INF_TWINPASS) || defined(INF_DANUBE) || defined(IKANOS_VX_1X0)
//Patch for ASIC turst read/write bug, needs to remove after metel fix
#define RTMP_IO_READ32(_A, _R, _pV) \
@ -453,7 +550,32 @@ extern ULONG RTDebugLevel;
writew((_V), (PUSHORT)((_A)->CSRBaseAddress + (_R))); \
}
#endif
#endif /* RT2860 */
#ifdef RT2870
//Patch for ASIC turst read/write bug, needs to remove after metel fix
#define RTMP_IO_READ32(_A, _R, _pV) \
RTUSBReadMACRegister(_A, _R, _pV)
#define RTMP_IO_READ8(_A, _R, _pV) \
{ \
}
#define RTMP_IO_WRITE32(_A, _R, _V) \
RTUSBWriteMACRegister(_A, _R, _V)
#define RTMP_IO_WRITE8(_A, _R, _V) \
{ \
USHORT _Val = _V; \
RTUSBSingleWrite(_A, _R, _Val); \
}
#define RTMP_IO_WRITE16(_A, _R, _V) \
{ \
RTUSBSingleWrite(_A, _R, _V); \
}
#endif // RT2870 //
#ifndef wait_event_interruptible_timeout
#define __wait_event_interruptible_timeout(wq, condition, ret) \
@ -496,7 +618,6 @@ do { \
wait_event_interruptible_timeout(_wait, 0, ONE_TICK); }
/* Modified by Wu Xi-Kun 4/21/2006 */
typedef void (*TIMER_FUNCTION)(unsigned long);
#define COPY_MAC_ADDR(Addr1, Addr2) memcpy((Addr1), (Addr2), MAC_ADDR_LEN)
@ -504,6 +625,7 @@ typedef void (*TIMER_FUNCTION)(unsigned long);
#define MlmeAllocateMemory(_pAd, _ppVA) os_alloc_mem(_pAd, _ppVA, MGMT_DMA_BUFFER_SIZE)
#define MlmeFreeMemory(_pAd, _pVA) os_free_mem(_pAd, _pVA)
#ifdef RT2860
#define BUILD_TIMER_FUNCTION(_func) \
void linux_##_func(unsigned long data) \
{ \
@ -513,7 +635,22 @@ void linux_##_func(unsigned long data) \
if (pTimer->Repeat) \
RTMP_OS_Add_Timer(&pTimer->TimerObj, pTimer->TimerValue); \
}
#endif
#ifdef RT2870
#define BUILD_TIMER_FUNCTION(_func) \
void linux_##_func(unsigned long data) \
{ \
PRALINK_TIMER_STRUCT _pTimer = (PRALINK_TIMER_STRUCT)data; \
RT2870_TIMER_ENTRY *_pQNode; \
RTMP_ADAPTER *_pAd; \
\
_pTimer->handle = _func; \
_pAd = (RTMP_ADAPTER *)_pTimer->pAd; \
_pQNode = RT2870_TimerQ_Insert(_pAd, _pTimer); \
if ((_pQNode == NULL) && (_pAd->TimerQ.status & RT2870_THREAD_CAN_DO_INSERT)) \
RTMP_OS_Add_Timer(&_pTimer->TimerObj, HZ); \
}
#endif // RT2870 //
#define DECLARE_TIMER_FUNCTION(_func) \
@ -527,6 +664,9 @@ DECLARE_TIMER_FUNCTION(MlmeRssiReportExec);
DECLARE_TIMER_FUNCTION(AsicRxAntEvalTimeout);
DECLARE_TIMER_FUNCTION(APSDPeriodicExec);
DECLARE_TIMER_FUNCTION(AsicRfTuningExec);
#ifdef RT2870
DECLARE_TIMER_FUNCTION(BeaconUpdateExec);
#endif // RT2870 //
DECLARE_TIMER_FUNCTION(BeaconTimeout);
DECLARE_TIMER_FUNCTION(ScanTimeout);
@ -849,6 +989,7 @@ int rt28xx_packet_xmit(struct sk_buff *skb);
void rtmp_os_thread_init(PUCHAR pThreadName, PVOID pNotify);
#ifdef RT2860
#if !defined(PCI_CAP_ID_EXP)
#define PCI_CAP_ID_EXP 0x10
#endif
@ -862,5 +1003,5 @@ void rtmp_os_thread_init(PUCHAR pThreadName, PVOID pNotify);
#endif
#define PCIBUS_INTEL_VENDOR 0x8086
#endif

View File

@ -58,7 +58,9 @@ extern BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num);
extern void ba_reordering_resource_release(PRTMP_ADAPTER pAd);
extern NDIS_STATUS NICLoadRateSwitchingParams(IN PRTMP_ADAPTER pAd);
#ifdef RT2860
extern void init_thread_task(PRTMP_ADAPTER pAd);
#endif
// public function prototype
INT __devinit rt28xx_probe(IN void *_dev_p, IN void *_dev_id_p,
@ -187,6 +189,12 @@ int rt28xx_close(IN PNET_DEV dev)
RTMP_ADAPTER *pAd = net_dev->ml_priv;
BOOLEAN Cancelled = FALSE;
UINT32 i = 0;
#ifdef RT2870
DECLARE_WAIT_QUEUE_HEAD(unlink_wakeup);
DECLARE_WAITQUEUE(wait, current);
//RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_REMOVE_IN_PROGRESS);
#endif // RT2870 //
DBGPRINT(RT_DEBUG_TRACE, ("===> rt28xx_close\n"));
@ -198,11 +206,21 @@ int rt28xx_close(IN PNET_DEV dev)
{
// If dirver doesn't wake up firmware here,
// NICLoadFirmware will hang forever when interface is up again.
#ifdef RT2860
if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) ||
RTMP_SET_PSFLAG(pAd, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND) ||
RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))
#endif
#ifdef RT2870
if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE))
#endif
{
#ifdef RT2860
AsicForceWakeup(pAd, RTMP_HALT);
#endif
#ifdef RT2870
AsicForceWakeup(pAd, TRUE);
#endif
}
if (INFRA_ON(pAd) &&
@ -230,6 +248,9 @@ int rt28xx_close(IN PNET_DEV dev)
RTMPusecDelay(1000);
}
#ifdef RT2870
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_REMOVE_IN_PROGRESS);
#endif // RT2870 //
#ifdef CCX_SUPPORT
RTMPCancelTimer(&pAd->StaCfg.LeapAuthTimer, &Cancelled);
@ -239,7 +260,9 @@ int rt28xx_close(IN PNET_DEV dev)
RTMPCancelTimer(&pAd->StaCfg.WpaDisassocAndBlockAssocTimer, &Cancelled);
MlmeRadioOff(pAd);
#ifdef RT2860
pAd->bPCIclkOff = FALSE;
#endif
}
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS);
@ -253,6 +276,40 @@ int rt28xx_close(IN PNET_DEV dev)
}
}
#ifdef RT2870
// ensure there are no more active urbs.
add_wait_queue (&unlink_wakeup, &wait);
pAd->wait = &unlink_wakeup;
// maybe wait for deletions to finish.
i = 0;
//while((i < 25) && atomic_read(&pAd->PendingRx) > 0)
while(i < 25)
{
unsigned long IrqFlags;
RTMP_IRQ_LOCK(&pAd->BulkInLock, IrqFlags);
if (pAd->PendingRx == 0)
{
RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags);
break;
}
RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags);
msleep(UNLINK_TIMEOUT_MS); //Time in millisecond
i++;
}
pAd->wait = NULL;
remove_wait_queue (&unlink_wakeup, &wait);
#endif // RT2870 //
#ifdef RT2870
// We need clear timerQ related structure before exits of the timer thread.
RT2870_TimerQ_Exit(pAd);
// Close kernel threads or tasklets
RT28xxThreadTerminate(pAd);
#endif // RT2870 //
// Stop Mlme state machine
MlmeHalt(pAd);
@ -264,7 +321,7 @@ int rt28xx_close(IN PNET_DEV dev)
MeasureReqTabExit(pAd);
TpcReqTabExit(pAd);
#ifdef RT2860
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE))
{
NICDisableInterrupt(pAd);
@ -280,7 +337,7 @@ int rt28xx_close(IN PNET_DEV dev)
RT28XX_IRQ_RELEASE(net_dev)
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE);
}
#endif
// Free Ring or USB buffers
RTMPFreeTxRxRingMemory(pAd);
@ -297,7 +354,12 @@ int rt28xx_close(IN PNET_DEV dev)
static int rt28xx_init(IN struct net_device *net_dev)
{
#ifdef RT2860
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)net_dev->ml_priv;
#endif
#ifdef RT2870
PRTMP_ADAPTER pAd = net_dev->ml_priv;
#endif
UINT index;
UCHAR TmpPhy;
NDIS_STATUS Status;
@ -320,11 +382,11 @@ static int rt28xx_init(IN struct net_device *net_dev)
} while (index++ < 100);
DBGPRINT(RT_DEBUG_TRACE, ("MAC_CSR0 [ Ver:Rev=0x%08x]\n", pAd->MACVersion));
/*Iverson patch PCIE L1 issue */
// Disable DMA
RT28XXDMADisable(pAd);
// Load 8051 firmware
Status = NICLoadFirmware(pAd);
if (Status != NDIS_STATUS_SUCCESS)
@ -337,10 +399,12 @@ static int rt28xx_init(IN struct net_device *net_dev)
// Disable interrupts here which is as soon as possible
// This statement should never be true. We might consider to remove it later
#ifdef RT2860
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE))
{
NICDisableInterrupt(pAd);
}
#endif
Status = RTMPAllocTxRxRingMemory(pAd);
if (Status != NDIS_STATUS_SUCCESS)
@ -365,6 +429,10 @@ static int rt28xx_init(IN struct net_device *net_dev)
//
UserCfgInit(pAd);
#ifdef RT2870
// We need init timerQ related structure before create the timer thread.
RT2870_TimerQ_Init(pAd);
#endif // RT2870 //
RT28XX_TASK_THREAD_INIT(pAd, Status);
if (Status != NDIS_STATUS_SUCCESS)
@ -398,6 +466,14 @@ static int rt28xx_init(IN struct net_device *net_dev)
goto err4;
}
#ifdef RT2870
pAd->CommonCfg.bMultipleIRP = FALSE;
if (pAd->CommonCfg.bMultipleIRP)
pAd->CommonCfg.NumOfBulkInIRP = RX_RING_SIZE;
else
pAd->CommonCfg.NumOfBulkInIRP = 1;
#endif // RT2870 //
//Init Ba Capability parameters.
@ -436,6 +512,11 @@ static int rt28xx_init(IN struct net_device *net_dev)
pAd->CommonCfg.HtCapability.MCSSet[1], pAd->CommonCfg.HtCapability.MCSSet[2],
pAd->CommonCfg.HtCapability.MCSSet[3], pAd->CommonCfg.HtCapability.MCSSet[4]);
#ifdef RT2870
//Init RT30xx RFRegisters after read RFIC type from EEPROM
NICInitRT30xxRFRegisters(pAd);
#endif // RT2870 //
#ifdef IKANOS_VX_1X0
VR_IKANOS_FP_Init(pAd->ApCfg.BssidNum, pAd->PermanentAddress);
#endif // IKANOS_VX_1X0 //
@ -446,8 +527,10 @@ static int rt28xx_init(IN struct net_device *net_dev)
AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE);
AsicLockChannel(pAd, pAd->CommonCfg.Channel);
#ifndef RT30xx
// 8051 firmware require the signal during booting time.
AsicSendCommandToMcu(pAd, 0x72, 0xFF, 0x00, 0x00);
#endif
if (pAd && (Status != NDIS_STATUS_SUCCESS))
{
@ -464,9 +547,24 @@ static int rt28xx_init(IN struct net_device *net_dev)
// Microsoft HCT require driver send a disconnect event after driver initialization.
OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED);
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_MEDIA_STATE_CHANGE);
DBGPRINT(RT_DEBUG_TRACE, ("NDIS_STATUS_MEDIA_DISCONNECT Event B!\n"));
#ifdef RT2870
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS);
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_REMOVE_IN_PROGRESS);
//
// Support multiple BulkIn IRP,
// the value on pAd->CommonCfg.NumOfBulkInIRP may be large than 1.
//
for(index=0; index<pAd->CommonCfg.NumOfBulkInIRP; index++)
{
RTUSBBulkReceive(pAd);
DBGPRINT(RT_DEBUG_TRACE, ("RTUSBBulkReceive!\n" ));
}
#endif // RT2870 //
}// end of else
@ -565,8 +663,9 @@ int rt28xx_open(IN PNET_DEV dev)
printk("0x1300 = %08x\n", reg);
}
#ifdef RT2860
RTMPInitPCIeLinkCtrlValue(pAd);
#endif
return (retval);
err:
@ -662,8 +761,15 @@ INT __devinit rt28xx_probe(
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) NULL;
INT status;
PVOID handle;
#ifdef RT2860
struct pci_dev *dev_p = (struct pci_dev *)_dev_p;
#endif
#ifdef RT2870
struct usb_interface *intf = (struct usb_interface *)_dev_p;
struct usb_device *dev_p = interface_to_usbdev(intf);
dev_p = usb_get_dev(dev_p);
#endif // RT2870 //
DBGPRINT(RT_DEBUG_TRACE, ("STA Driver version-%s\n", STA_DRIVER_VERSION));

View File

@ -886,11 +886,13 @@ NDIS_STATUS RTMPReadParametersHook(
// Save uid and gid used for filesystem access.
// Set user and group to 0 (root)
#ifndef RT30xx
orgfsuid = current_fsuid();
orgfsgid = current_fsgid();
/* Hm, can't really do this nicely anymore, so rely on these files
* being set to the proper permission to read them... */
/* current->cred->fsuid = current->cred->fsgid = 0; */
#endif
orgfs = get_fs();
set_fs(KERNEL_DS);
@ -1352,7 +1354,12 @@ NDIS_STATUS RTMPReadParametersHook(
{
//PSMode
#ifdef RT2860
if (RTMPGetKeyParameter("PSMode", tmpbuf, 32, buffer))
#endif
#ifdef RT2870
if (RTMPGetKeyParameter("PSMode", tmpbuf, 10, buffer))
#endif
{
if (pAd->StaCfg.BssType == BSS_INFRA)
{
@ -1435,6 +1442,23 @@ NDIS_STATUS RTMPReadParametersHook(
DBGPRINT(RT_DEBUG_TRACE, ("TGnWifiTest=%d\n", pAd->StaCfg.bTGnWifiTest));
}
}
#ifdef RT30xx
{
if(RTMPGetKeyParameter("AntDiversity", tmpbuf, 10, buffer))
{
for (i = 0, macptr = rstrtok(tmpbuf,";"); macptr; macptr = rstrtok(NULL,";"), i++)
{
if(simple_strtol(macptr, 0, 10) != 0) //Enable
pAd->CommonCfg.bRxAntDiversity = TRUE;
else //Disable
pAd->CommonCfg.bRxAntDiversity = FALSE;
DBGPRINT(RT_DEBUG_ERROR, ("AntDiversity=%d\n", pAd->CommonCfg.bRxAntDiversity));
}
}
}
#endif // RT30xx //
}
}
else
@ -1547,12 +1571,21 @@ static void HTParametersHook(
if (Value == 0)
{
pAd->CommonCfg.BACapability.field.AutoBA = FALSE;
#ifdef RT30xx
pAd->CommonCfg.BACapability.field.Policy = BA_NOTUSE;
#endif
}
else
{
pAd->CommonCfg.BACapability.field.AutoBA = TRUE;
#ifdef RT30xx
pAd->CommonCfg.BACapability.field.Policy = IMMED_BA;
#endif
}
pAd->CommonCfg.REGBACapability.field.AutoBA = pAd->CommonCfg.BACapability.field.AutoBA;
#ifdef RT30xx
pAd->CommonCfg.REGBACapability.field.Policy = pAd->CommonCfg.BACapability.field.Policy;
#endif
DBGPRINT(RT_DEBUG_TRACE, ("HT: Auto BA = %s\n", (Value==0) ? "Disable" : "Enable"));
}

File diff suppressed because it is too large Load Diff

View File

@ -102,6 +102,7 @@
// Entry number for each DMA descriptor ring
//
#ifdef RT2860
#define TX_RING_SIZE 64 //64
#define MGMT_RING_SIZE 128
#define RX_RING_SIZE 128 //64
@ -109,6 +110,15 @@
#define MAX_DMA_DONE_PROCESS TX_RING_SIZE
#define MAX_TX_DONE_PROCESS TX_RING_SIZE //8
#define LOCAL_TXBUF_SIZE 2
#endif
#ifdef RT2870
#define TX_RING_SIZE 8 // 1
#define PRIO_RING_SIZE 8
#define MGMT_RING_SIZE 32 // PRIO_RING_SIZE
#define RX_RING_SIZE 8
#define MAX_TX_PROCESS 4
#define LOCAL_TXBUF_SIZE 2048
#endif // RT2870 //
#define MAX_RX_PROCESS 128 //64 //32
#define NUM_OF_LOCAL_TXBUF 2
@ -138,7 +148,11 @@
#define MAX_PACKETS_IN_PS_QUEUE 128 //32
#define WMM_NUM_OF_AC 4 /* AC0, AC1, AC2, and AC3 */
#ifdef RT30xx
//2008/09/11:KH add to support efuse<--
#define MAX_EEPROM_BIN_FILE_SIZE 1024
//2008/09/11:KH add to support efuse-->
#endif
// RxFilter
#define STANORMAL 0x17f97
@ -195,6 +209,7 @@
#define fOP_STATUS_WAKEUP_NOW 0x00008000
#define fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE 0x00020000
#ifdef RT2860
//
// RTMP_ADAPTER PSFlags : related to advanced power save.
//
@ -207,6 +222,7 @@
// Indicate driver should IMMEDIATELY fo to sleep after receiving AP's beacon in which doesn't indicate unicate nor multicast packets for me
//. This flag is used ONLY in RTMPHandleRxDoneInterrupt routine.
#define fRTMP_PS_GO_TO_SLEEP_NOW 0x00000008
#endif
#define CCKSETPROTECT 0x1
#define OFDMSETPROTECT 0x2
@ -309,10 +325,12 @@
#define MAX_APCLI_NUM 0
#define MAX_MBSSID_NUM 1
#if defined(RT2860) || defined(RT30xx)
#ifdef MBSS_SUPPORT
#undef MAX_MBSSID_NUM
#define MAX_MBSSID_NUM (8 - MAX_MESH_NUM - MAX_APCLI_NUM)
#endif // MBSS_SUPPORT //
#endif
/* sanity check for apidx */
#define MBSS_MR_APIDX_SANITY_CHECK(apidx) \
@ -555,6 +573,9 @@
// For 802.11n D3.03
//#define IE_NEW_EXT_CHA_OFFSET 62 // 802.11n d1. New extension channel offset elemet
#define IE_SECONDARY_CH_OFFSET 62 // 802.11n D3.03 Secondary Channel Offset element
#ifdef RT2870
#define IE_WAPI 68 // WAPI information element
#endif
#define IE_2040_BSS_COEXIST 72 // 802.11n D3.0.3
#define IE_2040_BSS_INTOLERANT_REPORT 73 // 802.11n D3.03
#define IE_OVERLAPBSS_SCAN_PARM 74 // 802.11n D3.03
@ -603,6 +624,11 @@
#define AP_CNTL_STATE_MACHINE 15
#define AP_WPA_STATE_MACHINE 16
#ifdef RT30xx
#define WSC_STATE_MACHINE 17
#define WSC_UPNP_STATE_MACHINE 18
#endif
//
// STA's CONTROL/CONNECT state machine: states, events, total function #
//
@ -616,6 +642,9 @@
#define CNTL_WAIT_AUTH2 7
#define CNTL_WAIT_OID_LIST_SCAN 8
#define CNTL_WAIT_OID_DISASSOC 9
#ifdef RT2870
#define CNTL_WAIT_SCAN_FOR_CONNECT 10
#endif // RT2870 //
#define MT2_ASSOC_CONF 34
#define MT2_AUTH_CONF 35
@ -1186,6 +1215,10 @@
#define RFIC_2750 4 // 2.4G/5G 1T2R
#define RFIC_3020 5 // 2.4G 1T1R
#define RFIC_2020 6 // 2.4G B/G
#ifdef RT30xx
#define RFIC_3021 7 // 2.4G 1T2R
#define RFIC_3022 8 // 2.4G 2T2R
#endif
// LED Status.
#define LED_LINK_DOWN 0
@ -1286,6 +1319,8 @@
#define INT_APCLI 0x0400
#define INT_MESH 0x0500
// Use bitmap to allow coexist of ATE_TXFRAME and ATE_RXFRAME(i.e.,to support LoopBack mode)
// WEP Key TYPE
#define WEP_HEXADECIMAL_TYPE 0
#define WEP_ASCII_TYPE 1
@ -1378,6 +1413,7 @@
#define MCAST_HTMIX 3
#endif // MCAST_RATE_SPECIFIC //
#ifdef RT2860
// For AsicRadioOff/AsicRadioOn/AsicForceWakeup function
// This is to indicate from where to call this function.
#define DOT11POWERSAVE 0 // TO do .11 power save sleep
@ -1385,8 +1421,14 @@
#define RTMP_HALT 2 // Called from Halt handler.
#define GUI_IDLE_POWER_SAVE 3 // Call to sleep before link up with AP
#define FROM_TX 4 // Force wake up from Tx packet.
#endif
#ifdef RT2870
// For AsicRadioOff/AsicRadioOn function
#define DOT11POWERSAVE 0
#define GUIRADIO_OFF 1
#define RTMP_HALT 2
#define GUI_IDLE_POWER_SAVE 3
#endif
// definition for WpaSupport flag
#define WPA_SUPPLICANT_DISABLE 0

View File

@ -87,6 +87,10 @@ struct iw_priv_args privtab[] = {
0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "radio_on" },
{ SHOW_CFG_VALUE,
IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "show" },
#if !defined(RT2860) && !defined(RT30xx)
{ SHOW_ADHOC_ENTRY_INFO,
0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "adhocEntry" },
#endif
/* --- sub-ioctls relations --- */
#ifdef DBG
@ -96,6 +100,11 @@ struct iw_priv_args privtab[] = {
{ RTPRIV_IOCTL_MAC,
IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | 1024,
"mac"},
#ifdef RT30xx
{ RTPRIV_IOCTL_RF,
IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK,
"rf"},
#endif // RT30xx //
{ RTPRIV_IOCTL_E2P,
IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | 1024,
"e2p"},
@ -165,9 +174,11 @@ INT Set_Wpa_Support(
IN PUCHAR arg);
#ifdef DBG
#if !defined(RT2860) && !defined(RT30xx)
VOID RTMPIoctlBBP(
IN PRTMP_ADAPTER pAdapter,
IN struct iwreq *wrq);
#endif
VOID RTMPIoctlMAC(
IN PRTMP_ADAPTER pAdapter,
@ -176,6 +187,12 @@ VOID RTMPIoctlMAC(
VOID RTMPIoctlE2PROM(
IN PRTMP_ADAPTER pAdapter,
IN struct iwreq *wrq);
#ifdef RT30xx
VOID RTMPIoctlRF(
IN PRTMP_ADAPTER pAdapter,
IN struct iwreq *wrq);
#endif // RT30xx //
#endif // DBG //
@ -199,6 +216,12 @@ INT Set_ShortRetryLimit_Proc(
IN PRTMP_ADAPTER pAdapter,
IN PUCHAR arg);
#if !defined(RT2860) && !defined(RT30xx)
INT Show_Adhoc_MacTable_Proc(
IN PRTMP_ADAPTER pAd,
IN PCHAR extra);
#endif
static struct {
CHAR *name;
INT (*set_proc)(PRTMP_ADAPTER pAdapter, PUCHAR arg);
@ -256,6 +279,13 @@ static struct {
{"ForceGF", Set_ForceGF_Proc},
{"LongRetry", Set_LongRetryLimit_Proc},
{"ShortRetry", Set_ShortRetryLimit_Proc},
//2008/09/11:KH add to support efuse<--
#ifdef RT30xx
{"efuseFreeNumber", set_eFuseGetFreeBlockCount_Proc},
{"efuseDump", set_eFusedump_Proc},
{"efuseLoadFromBin", set_eFuseLoadFromBin_Proc},
#endif // RT30xx //
//2008/09/11:KH add to support efuse-->
{NULL,}
};
@ -269,6 +299,7 @@ VOID RTMPAddKey(
DBGPRINT(RT_DEBUG_TRACE, ("RTMPAddKey ------>\n"));
#ifdef RT2860
RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP);
if (RTMP_TEST_PSFLAG(pAd, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND))
{
@ -282,6 +313,7 @@ VOID RTMPAddKey(
RTMPusecDelay(6000);
pAd->bPCIclkOff = FALSE;
}
#endif
if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA)
{
@ -474,8 +506,10 @@ VOID RTMPAddKey(
}
}
end:
#ifdef RT2860
RTMP_SET_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP);
DBGPRINT(RT_DEBUG_INFO, ("<------ RTMPAddKey\n"));
#endif
return;
}
@ -497,8 +531,12 @@ rt_ioctl_giwname(struct net_device *dev,
char *name, char *extra)
{
// PRTMP_ADAPTER pAdapter = dev->ml_priv;
#ifdef RT2860
strncpy(name, "RT2860 Wireless", IFNAMSIZ);
#endif
#ifdef RT2870
strncpy(name, "RT2870 Wireless", IFNAMSIZ);
#endif // RT2870 //
return 0;
}
@ -540,7 +578,12 @@ int rt_ioctl_giwfreq(struct net_device *dev,
struct iw_freq *freq, char *extra)
{
VIRTUAL_ADAPTER *pVirtualAd = NULL;
#ifndef RT30xx
PRTMP_ADAPTER pAdapter = NULL;
#endif
#ifdef RT30xx
PRTMP_ADAPTER pAdapter;
#endif
UCHAR ch;
ULONG m;
@ -551,7 +594,9 @@ int rt_ioctl_giwfreq(struct net_device *dev,
else
{
pVirtualAd = dev->ml_priv;
#ifndef RT30xx
if (pVirtualAd && pVirtualAd->RtmpDev)
#endif
pAdapter = pVirtualAd->RtmpDev->ml_priv;
}
@ -611,6 +656,7 @@ int rt_ioctl_giwmode(struct net_device *dev,
struct iw_request_info *info,
__u32 *mode, char *extra)
{
#ifndef RT30xx
PRTMP_ADAPTER pAdapter = NULL;
VIRTUAL_ADAPTER *pVirtualAd = NULL;
@ -631,6 +677,10 @@ int rt_ioctl_giwmode(struct net_device *dev,
So the net_dev->ml_priv will be NULL in 2rd open */
return -ENETDOWN;
}
#endif
#ifdef RT30xx
PRTMP_ADAPTER pAdapter = dev->ml_priv;
#endif
if (ADHOC_ON(pAdapter))
*mode = IW_MODE_ADHOC;
@ -674,12 +724,18 @@ int rt_ioctl_giwrange(struct net_device *dev,
struct iw_request_info *info,
struct iw_point *data, char *extra)
{
#ifndef RT30xx
PRTMP_ADAPTER pAdapter = NULL;
VIRTUAL_ADAPTER *pVirtualAd = NULL;
#endif
#ifdef RT30xx
PRTMP_ADAPTER pAdapter = dev->ml_priv;
#endif
struct iw_range *range = (struct iw_range *) extra;
u16 val;
int i;
#ifndef RT30xx
if (dev->priv_flags == INT_MAIN)
{
pAdapter = dev->ml_priv;
@ -697,6 +753,7 @@ int rt_ioctl_giwrange(struct net_device *dev,
So the net_dev->ml_priv will be NULL in 2rd open */
return -ENETDOWN;
}
#endif
DBGPRINT(RT_DEBUG_TRACE ,("===>rt_ioctl_giwrange\n"));
data->length = sizeof(struct iw_range);
@ -816,6 +873,7 @@ int rt_ioctl_giwap(struct net_device *dev,
struct iw_request_info *info,
struct sockaddr *ap_addr, char *extra)
{
#ifndef RT30xx
PRTMP_ADAPTER pAdapter = NULL;
VIRTUAL_ADAPTER *pVirtualAd = NULL;
@ -836,6 +894,10 @@ int rt_ioctl_giwap(struct net_device *dev,
So the net_dev->ml_priv will be NULL in 2rd open */
return -ENETDOWN;
}
#endif
#ifdef RT30xx
PRTMP_ADAPTER pAdapter = dev->ml_priv;
#endif
if (INFRA_ON(pAdapter) || ADHOC_ON(pAdapter))
{
@ -954,7 +1016,7 @@ int rt_ioctl_siwscan(struct net_device *dev,
DBGPRINT(RT_DEBUG_TRACE, ("!!! Driver is in Monitor Mode now !!!\n"));
return -EINVAL;
}
#ifdef RT2860
if ((pAdapter->OpMode == OPMODE_STA) && (IDLE_ON(pAdapter))
&& (pAdapter->StaCfg.bRadio == TRUE)
&& (RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_IDLE_RADIO_OFF)))
@ -964,7 +1026,7 @@ int rt_ioctl_siwscan(struct net_device *dev,
// Check if still radio off.
else if (pAdapter->bPCIclkOff == TRUE)
return 0;
#endif
if (pAdapter->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_ENABLE)
{
pAdapter->StaCfg.WpaSupplicantScanCount++;
@ -1082,6 +1144,87 @@ int rt_ioctl_giwscan(struct net_device *dev,
previous_ev = current_ev;
current_ev = iwe_stream_add_event(info, current_ev,end_buf, &iwe, IW_EV_ADDR_LEN);
#ifdef RT30xx
if (current_ev == previous_ev)
#if WIRELESS_EXT >= 17
return -E2BIG;
#else
break;
#endif
/*
Protocol:
it will show scanned AP's WirelessMode .
it might be
802.11a
802.11a/n
802.11g/n
802.11b/g/n
802.11g
802.11b/g
*/
memset(&iwe, 0, sizeof(iwe));
iwe.cmd = SIOCGIWNAME;
{
PBSS_ENTRY pBssEntry=&pAdapter->ScanTab.BssEntry[i];
BOOLEAN isGonly=FALSE;
int rateCnt=0;
if (pBssEntry->Channel>14)
{
if (pBssEntry->HtCapabilityLen!=0)
strcpy(iwe.u.name,"802.11a/n");
else
strcpy(iwe.u.name,"802.11a");
}
else
{
/*
if one of non B mode rate is set supported rate . it mean G only.
*/
for (rateCnt=0;rateCnt<pBssEntry->SupRateLen;rateCnt++)
{
/*
6Mbps(140) 9Mbps(146) and >=12Mbps(152) are supported rate , it mean G only.
*/
if (pBssEntry->SupRate[rateCnt]==140 || pBssEntry->SupRate[rateCnt]==146 || pBssEntry->SupRate[rateCnt]>=152)
isGonly=TRUE;
}
for (rateCnt=0;rateCnt<pBssEntry->ExtRateLen;rateCnt++)
{
if (pBssEntry->ExtRate[rateCnt]==140 || pBssEntry->ExtRate[rateCnt]==146 || pBssEntry->ExtRate[rateCnt]>=152)
isGonly=TRUE;
}
if (pBssEntry->HtCapabilityLen!=0)
{
if (isGonly==TRUE)
strcpy(iwe.u.name,"802.11g/n");
else
strcpy(iwe.u.name,"802.11b/g/n");
}
else
{
if (isGonly==TRUE)
strcpy(iwe.u.name,"802.11g");
else
{
if (pBssEntry->SupRateLen==4 && pBssEntry->ExtRateLen==0)
strcpy(iwe.u.name,"802.11b");
else
strcpy(iwe.u.name,"802.11b/g");
}
}
}
}
previous_ev = current_ev;
current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_ADDR_LEN);
#endif /* RT30xx */
if (current_ev == previous_ev)
#if WIRELESS_EXT >= 17
return -E2BIG;
@ -1351,6 +1494,7 @@ int rt_ioctl_giwessid(struct net_device *dev,
struct iw_request_info *info,
struct iw_point *data, char *essid)
{
#ifndef RT30xx
PRTMP_ADAPTER pAdapter = NULL;
VIRTUAL_ADAPTER *pVirtualAd = NULL;
@ -1371,6 +1515,10 @@ int rt_ioctl_giwessid(struct net_device *dev,
So the net_dev->ml_priv will be NULL in 2rd open */
return -ENETDOWN;
}
#endif
#ifdef RT30xx
PRTMP_ADAPTER pAdapter = dev->ml_priv;
#endif
data->flags = 1;
if (MONITOR_ON(pAdapter))
@ -1385,6 +1533,14 @@ int rt_ioctl_giwessid(struct net_device *dev,
data->length = pAdapter->CommonCfg.SsidLen;
memcpy(essid, pAdapter->CommonCfg.Ssid, pAdapter->CommonCfg.SsidLen);
}
#ifdef RT2870
// Add for RT2870
else if (pAdapter->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE)
{
data->length = pAdapter->CommonCfg.SsidLen;
memcpy(essid, pAdapter->CommonCfg.Ssid, pAdapter->CommonCfg.SsidLen);
}
#endif // RT2870 //
else
{//the ANY ssid was specified
data->length = 0;
@ -1422,6 +1578,7 @@ int rt_ioctl_giwnickn(struct net_device *dev,
struct iw_request_info *info,
struct iw_point *data, char *nickname)
{
#ifndef RT30xx
PRTMP_ADAPTER pAdapter = NULL;
VIRTUAL_ADAPTER *pVirtualAd = NULL;
@ -1442,6 +1599,10 @@ int rt_ioctl_giwnickn(struct net_device *dev,
So the net_dev->ml_priv will be NULL in 2rd open */
return -ENETDOWN;
}
#endif
#ifdef RT30xx
PRTMP_ADAPTER pAdapter = dev->ml_priv;
#endif
if (data->length > strlen(pAdapter->nickname) + 1)
data->length = strlen(pAdapter->nickname) + 1;
@ -1485,6 +1646,7 @@ int rt_ioctl_giwrts(struct net_device *dev,
struct iw_request_info *info,
struct iw_param *rts, char *extra)
{
#ifndef RT30xx
PRTMP_ADAPTER pAdapter = NULL;
VIRTUAL_ADAPTER *pVirtualAd = NULL;
@ -1505,6 +1667,10 @@ int rt_ioctl_giwrts(struct net_device *dev,
So the net_dev->ml_priv will be NULL in 2rd open */
return -ENETDOWN;
}
#endif
#ifdef RT30xx
PRTMP_ADAPTER pAdapter = dev->ml_priv;
#endif
//check if the interface is down
if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE))
@ -1551,6 +1717,7 @@ int rt_ioctl_giwfrag(struct net_device *dev,
struct iw_request_info *info,
struct iw_param *frag, char *extra)
{
#ifndef RT30xx
PRTMP_ADAPTER pAdapter = NULL;
VIRTUAL_ADAPTER *pVirtualAd = NULL;
@ -1571,6 +1738,10 @@ int rt_ioctl_giwfrag(struct net_device *dev,
So the net_dev->ml_priv will be NULL in 2rd open */
return -ENETDOWN;
}
#endif
#ifdef RT30xx
PRTMP_ADAPTER pAdapter = dev->ml_priv;
#endif
//check if the interface is down
if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE))
@ -1611,8 +1782,13 @@ int rt_ioctl_siwencode(struct net_device *dev,
pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen;
goto done;
}
#ifndef RT30xx
else if ((erq->length == 0) &&
(erq->flags & IW_ENCODE_RESTRICTED || erq->flags & IW_ENCODE_OPEN))
#endif
#ifdef RT30xx
else if (erq->flags & IW_ENCODE_RESTRICTED || erq->flags & IW_ENCODE_OPEN)
#endif
{
STA_PORT_SECURED(pAdapter);
pAdapter->StaCfg.PairCipher = Ndis802_11WEPEnabled;
@ -1623,7 +1799,9 @@ int rt_ioctl_siwencode(struct net_device *dev,
pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeShared;
else
pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen;
#ifndef RT30xx
goto done;
#endif
}
if (erq->length > 0)
@ -1642,6 +1820,12 @@ int rt_ioctl_siwencode(struct net_device *dev,
//Using default key
keyIdx = pAdapter->StaCfg.DefaultKeyId;
}
#ifdef RT30xx
else
{
pAdapter->StaCfg.DefaultKeyId=keyIdx;
}
#endif
NdisZeroMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, 16);
@ -1693,7 +1877,11 @@ rt_ioctl_giwencode(struct net_device *dev,
struct iw_request_info *info,
struct iw_point *erq, char *key)
{
#ifdef RT30xx
PRTMP_ADAPTER pAdapter = dev->ml_priv;
#endif
int kid;
#ifndef RT30xx
PRTMP_ADAPTER pAdapter = NULL;
VIRTUAL_ADAPTER *pVirtualAd = NULL;
@ -1714,6 +1902,7 @@ rt_ioctl_giwencode(struct net_device *dev,
So the net_dev->ml_priv will be NULL in 2rd open */
return -ENETDOWN;
}
#endif
//check if the interface is down
if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE))
@ -2046,6 +2235,14 @@ rt_private_show(struct net_device *dev, struct iw_request_info *info,
wrq->length = strlen(extra) + 1; // 1: size of '\0'
break;
case RAIO_ON:
#ifdef RT2870
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS))
{
sprintf(extra, "Scanning\n");
wrq->length = strlen(extra) + 1; // 1: size of '\0'
break;
}
#endif
pAd->StaCfg.bSwRadio = TRUE;
//if (pAd->StaCfg.bRadio != (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio))
{
@ -2068,6 +2265,12 @@ rt_private_show(struct net_device *dev, struct iw_request_info *info,
wrq->length = strlen(extra) + 1; // 1: size of '\0'
}
break;
#if !defined(RT2860) && !defined(RT30xx)
case SHOW_ADHOC_ENTRY_INFO:
Show_Adhoc_MacTable_Proc(pAd, extra);
wrq->length = strlen(extra) + 1; // 1: size of '\0'
break;
#endif
default:
DBGPRINT(RT_DEBUG_TRACE, ("%s - unknow subcmd = %d\n", __func__, subcmd));
break;
@ -2311,6 +2514,7 @@ void fnSetCipherKey(
IN BOOLEAN bGTK,
IN struct iw_encode_ext *ext)
{
#ifdef RT2860
RTMP_CLEAR_PSFLAG(pAdapter, fRTMP_PS_CAN_GO_SLEEP);
if (RTMP_TEST_PSFLAG(pAdapter, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND))
{
@ -2324,7 +2528,7 @@ void fnSetCipherKey(
RTMPusecDelay(6000);
pAdapter->bPCIclkOff = FALSE;
}
#endif
NdisZeroMemory(&pAdapter->SharedKey[BSS0][keyIdx], sizeof(CIPHER_KEY));
pAdapter->SharedKey[BSS0][keyIdx].KeyLen = LEN_TKIP_EK;
NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, ext->key, LEN_TKIP_EK);
@ -2355,8 +2559,9 @@ void fnSetCipherKey(
keyIdx,
pAdapter->SharedKey[BSS0][keyIdx].CipherAlg,
&pAdapter->MacTab.Content[BSSID_WCID]);
#ifdef RT2860
RTMP_SET_PSFLAG(pAdapter, fRTMP_PS_CAN_GO_SLEEP);
#endif
}
int rt_ioctl_siwencodeext(struct net_device *dev,
@ -2421,7 +2626,7 @@ int rt_ioctl_siwencodeext(struct net_device *dev,
NdisZeroMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, 16);
NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, ext->key, ext->key_len);
#ifndef RT30xx
if (pAdapter->StaCfg.GroupCipher == Ndis802_11GroupWEP40Enabled ||
pAdapter->StaCfg.GroupCipher == Ndis802_11GroupWEP104Enabled)
{
@ -2436,6 +2641,7 @@ int rt_ioctl_siwencodeext(struct net_device *dev,
// Indicate Connected for GUI
pAdapter->IndicateMediaState = NdisMediaStateConnected;
}
#endif
break;
case IW_ENCODE_ALG_TKIP:
DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_ENCODE_ALG_TKIP - keyIdx = %d, ext->key_len = %d\n", __func__, keyIdx, ext->key_len));
@ -2747,7 +2953,12 @@ rt_private_ioctl_bbp(struct net_device *dev, struct iw_request_info *info,
DBGPRINT(RT_DEBUG_TRACE, ("this_char=%s, value=%s\n", this_char, value));
if (sscanf(this_char, "%d", &(bbpId)) == 1)
{
#ifndef RT30xx
if (bbpId <= 136)
#endif // RT30xx //
#ifdef RT30xx
if (bbpId <= 138) // edit by johnli, RF power sequence setup, add BBP R138 for ADC dynamic on/off control
#endif // RT30xx //
{
{
RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, &regBBP);
@ -2772,7 +2983,12 @@ rt_private_ioctl_bbp(struct net_device *dev, struct iw_request_info *info,
{ //Write
if ((sscanf(this_char, "%d", &(bbpId)) == 1) && (sscanf(value, "%x", &(bbpValue)) == 1))
{
#ifndef RT30xx
if (bbpId <= 136)
#endif // RT30xx //
#ifdef RT30xx
if (bbpId <= 138) // edit by johnli, RF power sequence setup, add BBP R138 for ADC dynamic on/off control
#endif // RT30xx //
{
{
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, bbpId, bbpValue);
@ -2804,14 +3020,24 @@ next:
{
memset(extra, 0x00, IW_PRIV_SIZE_MASK);
sprintf(extra, "\n");
#ifndef RT30xx
for (bbpId = 0; bbpId <= 136; bbpId++)
#endif // RT30xx //
#ifdef RT30xx
for (bbpId = 0; bbpId <= 138; bbpId++) // edit by johnli, RF power sequence setup, add BBP R138 for ADC dynamic on/off control
#endif // RT30xx //
{
if (strlen(extra) >= (IW_PRIV_SIZE_MASK - 10))
break;
RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, &regBBP);
#ifndef RT30xx
sprintf(extra+strlen(extra), "R%02d[0x%02X]:%02X ", bbpId, bbpId*2, regBBP);
if (bbpId%5 == 4)
sprintf(extra+strlen(extra), "\n");
#endif
#ifdef RT30xx
sprintf(extra+strlen(extra), "%03d = %02X\n", bbpId, regBBP); // edit by johnli, change display format
#endif
}
wrq->length = strlen(extra) + 1; // 1: size of '\0'
@ -3300,9 +3526,14 @@ INT RTMPSetInformation(
{
// allow dynamic change of "USE OFDM rate or not" in ADHOC mode
// if setting changed, need to reset current TX rate as well as BEACON frame format
#ifdef RT30xx
pAdapter->CommonCfg.PhyMode = StaConfig.AdhocMode;
#endif
if (pAdapter->StaCfg.BssType == BSS_ADHOC)
{
#ifndef RT30xx
pAdapter->CommonCfg.PhyMode = StaConfig.AdhocMode;
#endif
RTMPSetPhyMode(pAdapter, PhyMode);
MlmeUpdateTxRates(pAdapter, FALSE, 0);
MakeIbssBeacon(pAdapter); // re-build BEACON frame
@ -3466,6 +3697,15 @@ INT RTMPSetInformation(
pAdapter->Counters8023.RxNoBuffer = 0;
pAdapter->Counters8023.GoodReceives = 0;
pAdapter->Counters8023.RxNoBuffer = 0;
#ifdef RT2870
pAdapter->BulkOutComplete = 0;
pAdapter->BulkOutCompleteOther= 0;
pAdapter->BulkOutCompleteCancel = 0;
pAdapter->BulkOutReq = 0;
pAdapter->BulkInReq= 0;
pAdapter->BulkInComplete = 0;
pAdapter->BulkInCompleteFail = 0;
#endif // RT2870 //
DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_RESET_COUNTERS \n"));
break;
case OID_802_11_RTS_THRESHOLD:
@ -4012,8 +4252,13 @@ INT RTMPSetInformation(
pAdapter->StaCfg.DesireSharedKey[KeyIdx].CipherAlg = CipherAlg;
pAdapter->StaCfg.DefaultKeyId = (UCHAR) KeyIdx;
}
#ifndef RT30xx
#ifdef RT2860
if ((pAdapter->StaCfg.WpaSupplicantUP != 0) &&
#endif
#ifdef RT2870
if ((pAdapter->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) &&
#endif
(pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA))
{
Key = pWepKey->KeyMaterial;
@ -4030,6 +4275,10 @@ INT RTMPSetInformation(
pAdapter->IndicateMediaState = NdisMediaStateConnected;
}
else if (pAdapter->StaCfg.PortSecured == WPA_802_1X_PORT_SECURED)
#endif
#ifdef RT30xx
if (pAdapter->StaCfg.PortSecured == WPA_802_1X_PORT_SECURED)
#endif
{
Key = pAdapter->SharedKey[BSS0][KeyIdx].Key;
@ -5054,6 +5303,9 @@ INT rt28xx_sta_ioctl(
Status = -EOPNOTSUPP;
break;
case RT_PRIV_IOCTL:
#ifdef RT30xx
case RT_PRIV_IOCTL_EXT:
#endif
subcmd = wrq->u.data.flags;
if( subcmd & OID_GET_SET_TOGGLE)
Status = RTMPSetInformation(pAd, rq, subcmd);
@ -5085,6 +5337,11 @@ INT rt28xx_sta_ioctl(
case RTPRIV_IOCTL_E2P:
RTMPIoctlE2PROM(pAd, wrq);
break;
#ifdef RT30xx
case RTPRIV_IOCTL_RF:
RTMPIoctlRF(pAd, wrq);
break;
#endif // RT30xx //
#endif // DBG //
case SIOCETHTOOL:
break;
@ -5180,6 +5437,9 @@ INT Set_WmmCapable_Proc(
bWmmCapable = simple_strtol(arg, 0, 10);
if ((bWmmCapable == 1)
#ifdef RT2870
&& (pAd->NumberOfPipes >= 5)
#endif // RT2870 //
)
pAd->CommonCfg.bWmmCapable = TRUE;
else if (bWmmCapable == 0)
@ -6012,7 +6272,9 @@ VOID RTMPIoctlMAC(
UCHAR temp[16], temp2[16];
UINT32 macValue = 0;
INT Status;
#ifdef RT30xx
BOOLEAN bIsPrintAllMAC = FALSE;
#endif
memset(msg, 0x00, 1024);
if (wrq->u.data.length > 1) //No parameters.
@ -6063,7 +6325,13 @@ VOID RTMPIoctlMAC(
sprintf(msg+strlen(msg), "[0x%08lX]:%08X ", macAddr , macValue);
}
else
#ifndef RT30xx
{//Invalid parametes, so default printk all bbp
#endif
#ifdef RT30xx
{//Invalid parametes, so default printk all mac
bIsPrintAllMAC = TRUE;
#endif
goto next;
}
}
@ -6147,7 +6415,52 @@ VOID RTMPIoctlMAC(
}
}
}
#ifdef RT30xx
else
bIsPrintAllMAC = TRUE;
#endif
next:
#ifdef RT30xx
if (bIsPrintAllMAC)
{
struct file *file_w;
PCHAR fileName = "MacDump.txt";
mm_segment_t orig_fs;
orig_fs = get_fs();
set_fs(KERNEL_DS);
// open file
file_w = filp_open(fileName, O_WRONLY|O_CREAT, 0);
if (IS_ERR(file_w))
{
DBGPRINT(RT_DEBUG_TRACE, ("-->2) %s: Error %ld opening %s\n", __func__, -PTR_ERR(file_w), fileName));
}
else
{
if (file_w->f_op && file_w->f_op->write)
{
file_w->f_pos = 0;
macAddr = 0x1000;
while (macAddr <= 0x1800)
{
RTMP_IO_READ32(pAdapter, macAddr, &macValue);
sprintf(msg, "%08lx = %08X\n", macAddr, macValue);
// write data to file
file_w->f_op->write(file_w, msg, strlen(msg), &file_w->f_pos);
printk("%s", msg);
macAddr += 4;
}
sprintf(msg, "\nDump all MAC values to %s\n", fileName);
}
filp_close(file_w, NULL);
}
set_fs(orig_fs);
}
#endif /* RT30xx */
if(strlen(msg) == 1)
sprintf(msg+strlen(msg), "===>Error command format!");
@ -6188,7 +6501,9 @@ VOID RTMPIoctlE2PROM(
UCHAR temp[16], temp2[16];
USHORT eepValue;
int Status;
#ifdef RT30xx
BOOLEAN bIsPrintAllE2P = FALSE;
#endif
memset(msg, 0x00, 1024);
if (wrq->u.data.length > 1) //No parameters.
@ -6242,6 +6557,9 @@ VOID RTMPIoctlE2PROM(
}
else
{//Invalid parametes, so default printk all bbp
#ifdef RT30xx
bIsPrintAllE2P = TRUE;
#endif
goto next;
}
}
@ -6300,7 +6618,52 @@ VOID RTMPIoctlE2PROM(
sprintf(msg+strlen(msg), "[0x%02X]:%02X ", eepAddr, eepValue);
}
}
#ifdef RT30xx
else
bIsPrintAllE2P = TRUE;
#endif
next:
#ifdef RT30xx
if (bIsPrintAllE2P)
{
struct file *file_w;
PCHAR fileName = "EEPROMDump.txt";
mm_segment_t orig_fs;
orig_fs = get_fs();
set_fs(KERNEL_DS);
// open file
file_w = filp_open(fileName, O_WRONLY|O_CREAT, 0);
if (IS_ERR(file_w))
{
DBGPRINT(RT_DEBUG_TRACE, ("-->2) %s: Error %ld opening %s\n", __func__, -PTR_ERR(file_w), fileName));
}
else
{
if (file_w->f_op && file_w->f_op->write)
{
file_w->f_pos = 0;
eepAddr = 0x00;
while (eepAddr <= 0xFE)
{
RT28xx_EEPROM_READ16(pAdapter, eepAddr, eepValue);
sprintf(msg, "%08x = %04x\n", eepAddr , eepValue);
// write data to file
file_w->f_op->write(file_w, msg, strlen(msg), &file_w->f_pos);
printk("%s", msg);
eepAddr += 2;
}
sprintf(msg, "\nDump all EEPROM values to %s\n", fileName);
}
filp_close(file_w, NULL);
}
set_fs(orig_fs);
}
#endif /* RT30xx */
if(strlen(msg) == 1)
sprintf(msg+strlen(msg), "===>Error command format!");
@ -6311,6 +6674,154 @@ next:
DBGPRINT(RT_DEBUG_TRACE, ("<==RTMPIoctlE2PROM\n"));
}
#ifdef RT30xx
/*
==========================================================================
Description:
Read / Write RF register
Arguments:
pAdapter Pointer to our adapter
wrq Pointer to the ioctl argument
Return Value:
None
Note:
Usage:
1.) iwpriv ra0 rf ==> read all RF registers
2.) iwpriv ra0 rf 1 ==> read RF where RegID=1
3.) iwpriv ra0 rf 1=10 ==> write RF R1=0x10
==========================================================================
*/
VOID RTMPIoctlRF(
IN PRTMP_ADAPTER pAdapter,
IN struct iwreq *wrq)
{
CHAR *this_char;
CHAR *value;
UCHAR regRF = 0;
CHAR msg[2048];
CHAR arg[255];
INT rfId;
LONG rfValue;
int Status;
BOOLEAN bIsPrintAllRF = FALSE;
memset(msg, 0x00, 2048);
if (wrq->u.data.length > 1) //No parameters.
{
Status = copy_from_user(arg, wrq->u.data.pointer, (wrq->u.data.length > 255) ? 255 : wrq->u.data.length);
sprintf(msg, "\n");
//Parsing Read or Write
this_char = arg;
if (!*this_char)
goto next;
if ((value = strchr(this_char, '=')) != NULL)
*value++ = 0;
if (!value || !*value)
{ //Read
if (sscanf(this_char, "%d", &(rfId)) == 1)
{
if (rfId <= 31)
{
// In RT2860 ATE mode, we do not load 8051 firmware.
//We must access RF directly.
// For RT2870 ATE mode, ATE_RF_IO_WRITE8(/READ8)_BY_REG_ID are redefined.
// according to Andy, Gary, David require.
// the command rf shall read rf register directly for dubug.
// BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, &regBBP);
RT30xxReadRFRegister(pAdapter, rfId, &regRF);
sprintf(msg+strlen(msg), "R%02d[0x%02x]:%02X ", rfId, rfId*2, regRF);
}
else
{//Invalid parametes, so default printk all RF
bIsPrintAllRF = TRUE;
goto next;
}
}
else
{ //Invalid parametes, so default printk all RF
bIsPrintAllRF = TRUE;
goto next;
}
}
else
{ //Write
if ((sscanf(this_char, "%d", &(rfId)) == 1) && (sscanf(value, "%lx", &(rfValue)) == 1))
{
if (rfId <= 31)
{
// In RT2860 ATE mode, we do not load 8051 firmware.
// We should access RF registers directly.
// For RT2870 ATE mode, ATE_RF_IO_WRITE8/READ8_BY_REG_ID are redefined.
{
// according to Andy, Gary, David require.
// the command RF shall read/write RF register directly for dubug.
//BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, &regBBP);
//BBP_IO_WRITE8_BY_REG_ID(pAdapter, (UCHAR)bbpId,(UCHAR) bbpValue);
RT30xxReadRFRegister(pAdapter, rfId, &regRF);
RT30xxWriteRFRegister(pAdapter, (UCHAR)rfId,(UCHAR) rfValue);
//Read it back for showing
//BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, &regBBP);
RT30xxReadRFRegister(pAdapter, rfId, &regRF);
sprintf(msg+strlen(msg), "R%02d[0x%02X]:%02X\n", rfId, rfId*2, regRF);
}
}
else
{//Invalid parametes, so default printk all RF
bIsPrintAllRF = TRUE;
}
}
else
{ //Invalid parametes, so default printk all RF
bIsPrintAllRF = TRUE;
}
}
}
else
bIsPrintAllRF = TRUE;
next:
if (bIsPrintAllRF)
{
memset(msg, 0x00, 2048);
sprintf(msg, "\n");
for (rfId = 0; rfId <= 31; rfId++)
{
// according to Andy, Gary, David require.
// the command RF shall read/write RF register directly for dubug.
RT30xxReadRFRegister(pAdapter, rfId, &regRF);
sprintf(msg+strlen(msg), "%03d = %02X\n", rfId, regRF);
}
// Copy the information into the user buffer
DBGPRINT(RT_DEBUG_TRACE, ("strlen(msg)=%d\n", (UINT32)strlen(msg)));
wrq->u.data.length = strlen(msg);
if (copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length))
{
DBGPRINT(RT_DEBUG_TRACE, ("%s: copy_to_user() fail\n", __func__));
}
}
else
{
if(strlen(msg) == 1)
sprintf(msg+strlen(msg), "===>Error command format!");
DBGPRINT(RT_DEBUG_TRACE, ("copy to user [msg=%s]\n", msg));
// Copy the information into the user buffer
DBGPRINT(RT_DEBUG_TRACE, ("strlen(msg) =%d\n", (UINT32)strlen(msg)));
// Copy the information into the user buffer
wrq->u.data.length = strlen(msg);
Status = copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length);
}
DBGPRINT(RT_DEBUG_TRACE, ("<==RTMPIoctlRF\n\n"));
}
#endif // RT30xx //
#endif // DBG //
@ -6356,3 +6867,48 @@ INT Set_ShortRetryLimit_Proc(
DBGPRINT(RT_DEBUG_TRACE, ("IF Set_ShortRetryLimit_Proc::(tx_rty_cfg=0x%x)\n", tx_rty_cfg.word));
return TRUE;
}
#if !defined(RT2860) && !defined(RT30xx)
INT Show_Adhoc_MacTable_Proc(
IN PRTMP_ADAPTER pAd,
IN PCHAR extra)
{
INT i;
sprintf(extra, "\n");
sprintf(extra + strlen(extra), "HT Operating Mode : %d\n", pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode);
sprintf(extra + strlen(extra), "\n%-19s%-4s%-4s%-7s%-7s%-7s%-10s%-6s%-6s%-6s%-6s\n",
"MAC", "AID", "BSS", "RSSI0", "RSSI1", "RSSI2", "PhMd", "BW", "MCS", "SGI", "STBC");
for (i=1; i<MAX_LEN_OF_MAC_TABLE; i++)
{
PMAC_TABLE_ENTRY pEntry = &pAd->MacTab.Content[i];
if (strlen(extra) > (IW_PRIV_SIZE_MASK - 30))
break;
if ((pEntry->ValidAsCLI || pEntry->ValidAsApCli) && (pEntry->Sst == SST_ASSOC))
{
sprintf(extra + strlen(extra), "%02X:%02X:%02X:%02X:%02X:%02X ",
pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2],
pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5]);
sprintf(extra + strlen(extra), "%-4d", (int)pEntry->Aid);
sprintf(extra + strlen(extra), "%-4d", (int)pEntry->apidx);
sprintf(extra + strlen(extra), "%-7d", pEntry->RssiSample.AvgRssi0);
sprintf(extra + strlen(extra), "%-7d", pEntry->RssiSample.AvgRssi1);
sprintf(extra + strlen(extra), "%-7d", pEntry->RssiSample.AvgRssi2);
sprintf(extra + strlen(extra), "%-10s", GetPhyMode(pEntry->HTPhyMode.field.MODE));
sprintf(extra + strlen(extra), "%-6s", GetBW(pEntry->HTPhyMode.field.BW));
sprintf(extra + strlen(extra), "%-6d", pEntry->HTPhyMode.field.MCS);
sprintf(extra + strlen(extra), "%-6d", pEntry->HTPhyMode.field.ShortGI);
sprintf(extra + strlen(extra), "%-6d", pEntry->HTPhyMode.field.STBC);
sprintf(extra + strlen(extra), "%-10d, %d, %d%%\n", pEntry->DebugFIFOCount, pEntry->DebugTxCount,
(pEntry->DebugTxCount) ? ((pEntry->DebugTxCount-pEntry->DebugFIFOCount)*100/pEntry->DebugTxCount) : 0);
sprintf(extra, "%s\n", extra);
}
}
return TRUE;
}
#endif /* RT2870 */

View File

@ -90,7 +90,9 @@
#define TKIP_AP_RXMICK_OFFSET (TKIP_AP_TXMICK_OFFSET+LEN_TKIP_TXMICK)
#define TKIP_GTK_LENGTH ((LEN_TKIP_EK)+(LEN_TKIP_RXMICK)+(LEN_TKIP_TXMICK))
#define LEN_PTK ((LEN_EAP_KEY)+(LEN_TKIP_KEY))
#ifndef RT30xx
#define MIN_LEN_OF_GTK 5
#endif
// RSN IE Length definition
#define MAX_LEN_OF_RSNIE 90