* [PATCH 1/8] Staging: rt3090: disable HAS_ATE option
2009-09-22 18:43 [PATCH 0/8] Staging: updates for Ralink drivers Bartlomiej Zolnierkiewicz
@ 2009-09-22 18:43 ` Bartlomiej Zolnierkiewicz
2009-09-22 18:43 ` [PATCH 2/8] Staging: rt3090: disable HAS_ANTENNA_DIVERSITY_SUPPORT option Bartlomiej Zolnierkiewicz
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-09-22 18:43 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: devel, Bartlomiej Zolnierkiewicz, Mike Galbraith, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rt3090: disable HAS_ATE option
Disable ATE debugging functionality.
This makes rt3090 match other Ralink drivers and V2.2.0.0 vendor version.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/staging/rt3090/config.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: b/drivers/staging/rt3090/config.mk
===================================================================
--- a/drivers/staging/rt3090/config.mk
+++ b/drivers/staging/rt3090/config.mk
@@ -1,5 +1,5 @@
# Support ATE function
-HAS_ATE=y
+HAS_ATE=n
# Support 28xx QA ATE function
HAS_28xx_QA=n
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 2/8] Staging: rt3090: disable HAS_ANTENNA_DIVERSITY_SUPPORT option
2009-09-22 18:43 [PATCH 0/8] Staging: updates for Ralink drivers Bartlomiej Zolnierkiewicz
2009-09-22 18:43 ` [PATCH 1/8] Staging: rt3090: disable HAS_ATE option Bartlomiej Zolnierkiewicz
@ 2009-09-22 18:43 ` Bartlomiej Zolnierkiewicz
2009-09-22 18:43 ` [PATCH 3/8] Staging: rt3090: remove private debugging ioctls Bartlomiej Zolnierkiewicz
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-09-22 18:43 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: devel, Bartlomiej Zolnierkiewicz, Mike Galbraith, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rt3090: disable HAS_ANTENNA_DIVERSITY_SUPPORT option
This makes rt3090 match other Ralink drivers and V2.2.0.0 vendor version.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/staging/rt3090/config.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: b/drivers/staging/rt3090/config.mk
===================================================================
--- a/drivers/staging/rt3090/config.mk
+++ b/drivers/staging/rt3090/config.mk
@@ -84,7 +84,7 @@ HAS_AUTO_CH_SELECT_ENHANCE=n
HAS_BG_FT_SUPPORT=n
#Support Antenna Diversity
-HAS_ANTENNA_DIVERSITY_SUPPORT=y
+HAS_ANTENNA_DIVERSITY_SUPPORT=n
#################################################
WFLAGS := -DAGGREGATION_SUPPORT -DPIGGYBACK_SUPPORT -DWMM_SUPPORT -DLINUX -Wall -Wstrict-prototypes -Wno-trigraphs -Wpointer-sign
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 3/8] Staging: rt3090: remove private debugging ioctls
2009-09-22 18:43 [PATCH 0/8] Staging: updates for Ralink drivers Bartlomiej Zolnierkiewicz
2009-09-22 18:43 ` [PATCH 1/8] Staging: rt3090: disable HAS_ATE option Bartlomiej Zolnierkiewicz
2009-09-22 18:43 ` [PATCH 2/8] Staging: rt3090: disable HAS_ANTENNA_DIVERSITY_SUPPORT option Bartlomiej Zolnierkiewicz
@ 2009-09-22 18:43 ` Bartlomiej Zolnierkiewicz
2009-09-22 18:43 ` [PATCH 4/8] Staging: rt3090: remove private ioctls Bartlomiej Zolnierkiewicz
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-09-22 18:43 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: devel, Bartlomiej Zolnierkiewicz, Mike Galbraith, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rt3090: remove private debugging ioctls
This makes rt3090 match other Ralink drivers.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/staging/rt3090/oid.h | 12
drivers/staging/rt3090/sta_ioctl.c | 799 -------------------------------------
2 files changed, 811 deletions(-)
Index: b/drivers/staging/rt3090/oid.h
===================================================================
--- a/drivers/staging/rt3090/oid.h
+++ b/drivers/staging/rt3090/oid.h
@@ -679,18 +679,6 @@ typedef struct _NDIS_802_11_CAPABILITY
#define RT_PRIV_IOCTL (SIOCIWFIRSTPRIV + 0x01) // Sync. with AP for wsc upnp daemon
#define RTPRIV_IOCTL_SET (SIOCIWFIRSTPRIV + 0x02)
-#ifdef DBG
-#define RTPRIV_IOCTL_BBP (SIOCIWFIRSTPRIV + 0x03)
-#define RTPRIV_IOCTL_MAC (SIOCIWFIRSTPRIV + 0x05)
-
-#ifdef RTMP_RF_RW_SUPPORT
-// TODO: shiang, Need to reassign the oid number. ArchTeam use (SIOCIWFIRSTPRIV + 0x19) for this oid
-#define RTPRIV_IOCTL_RF (SIOCIWFIRSTPRIV + 0x13) // edit by johnli, fix read rf register problem
-#endif // RTMP_RF_RW_SUPPORT //
-
-#define RTPRIV_IOCTL_E2P (SIOCIWFIRSTPRIV + 0x07)
-#endif // DBG //
-
#ifdef RALINK_ATE
#ifdef RALINK_28xx_QA
#define RTPRIV_IOCTL_ATE (SIOCIWFIRSTPRIV + 0x08)
Index: b/drivers/staging/rt3090/sta_ioctl.c
===================================================================
--- a/drivers/staging/rt3090/sta_ioctl.c
+++ b/drivers/staging/rt3090/sta_ioctl.c
@@ -101,23 +101,6 @@ struct iw_priv_args privtab[] = {
IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "adhocEntry" },
/* --- sub-ioctls relations --- */
-#ifdef DBG
-{ RTPRIV_IOCTL_BBP,
- IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK,
- "bbp"},
-{ RTPRIV_IOCTL_MAC,
- IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | 1024,
- "mac"},
-#ifdef RTMP_RF_RW_SUPPORT
-{ RTPRIV_IOCTL_RF,
- IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK,
- "rf"},
-#endif // RTMP_RF_RW_SUPPORT //
-{ RTPRIV_IOCTL_E2P,
- IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | 1024,
- "e2p"},
-#endif /* DBG */
-
{ RTPRIV_IOCTL_STATISTICS,
0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK,
"stat"},
@@ -204,18 +187,6 @@ INT Set_Wpa_Support(
IN PSTRING arg);
#endif // WPA_SUPPLICANT_SUPPORT //
-#ifdef DBG
-
-VOID RTMPIoctlMAC(
- IN PRTMP_ADAPTER pAdapter,
- IN struct iwreq *wrq);
-
-VOID RTMPIoctlE2PROM(
- IN PRTMP_ADAPTER pAdapter,
- IN struct iwreq *wrq);
-#endif // DBG //
-
-
NDIS_STATUS RTMPWPANoneAddKeyProc(
IN PRTMP_ADAPTER pAd,
IN PVOID pBuf);
@@ -2917,142 +2888,6 @@ int rt_ioctl_siwpmksa(struct net_device
}
#endif // #if WIRELESS_EXT > 17
-#ifdef DBG
-static int
-rt_private_ioctl_bbp(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra)
- {
- PSTRING this_char;
- PSTRING value = NULL;
- UCHAR regBBP = 0;
-// CHAR arg[255]={0};
- UINT32 bbpId;
- UINT32 bbpValue;
- BOOLEAN bIsPrintAllBBP = FALSE;
- INT Status = 0;
- PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev);
-
-
- memset(extra, 0x00, IW_PRIV_SIZE_MASK);
-
- if (wrq->length > 1) //No parameters.
- {
- sprintf(extra, "\n");
-
- //Parsing Read or Write
- this_char = wrq->pointer;
- DBGPRINT(RT_DEBUG_TRACE, ("this_char=%s\n", this_char));
- if (!*this_char)
- goto next;
-
- if ((value = rtstrchr(this_char, '=')) != NULL)
- *value++ = 0;
-
- if (!value || !*value)
- { //Read
- DBGPRINT(RT_DEBUG_TRACE, ("this_char=%s, value=%s\n", this_char, value));
- if (sscanf(this_char, "%d", &(bbpId)) == 1)
- {
- if (bbpId <= MAX_BBP_ID)
- {
-#ifdef RALINK_ATE
- if (ATE_ON(pAdapter))
- {
- ATE_BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP);
- }
- else
-#endif // RALINK_ATE //
- {
- RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP);
- }
- sprintf(extra+strlen(extra), "R%02d[0x%02X]:%02X\n", bbpId, bbpId, regBBP);
- wrq->length = strlen(extra) + 1; // 1: size of '\0'
- DBGPRINT(RT_DEBUG_TRACE, ("msg=%s\n", extra));
- }
- else
- {//Invalid parametes, so default printk all bbp
- bIsPrintAllBBP = TRUE;
- goto next;
- }
- }
- else
- { //Invalid parametes, so default printk all bbp
- bIsPrintAllBBP = TRUE;
- goto next;
- }
- }
- else
- { //Write
- if ((sscanf(this_char, "%d", &(bbpId)) == 1) && (sscanf(value, "%x", &(bbpValue)) == 1))
- {
- if (bbpId <= MAX_BBP_ID)
- {
-#ifdef RALINK_ATE
- if (ATE_ON(pAdapter))
- {
- ATE_BBP_IO_WRITE8_BY_REG_ID(pAdapter, bbpId, bbpValue);
- /* read it back for showing */
- ATE_BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP);
- }
- else
-#endif // RALINK_ATE //
- {
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, bbpId, bbpValue);
- /* read it back for showing */
- RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP);
- }
- sprintf(extra+strlen(extra), "R%02d[0x%02X]:%02X\n", bbpId, bbpId, regBBP);
- wrq->length = strlen(extra) + 1; // 1: size of '\0'
- DBGPRINT(RT_DEBUG_TRACE, ("msg=%s\n", extra));
- }
- else
- {//Invalid parametes, so default printk all bbp
- bIsPrintAllBBP = TRUE;
- goto next;
- }
- }
- else
- { //Invalid parametes, so default printk all bbp
- bIsPrintAllBBP = TRUE;
- goto next;
- }
- }
- }
- else
- bIsPrintAllBBP = TRUE;
-
-next:
- if (bIsPrintAllBBP)
- {
- memset(extra, 0x00, IW_PRIV_SIZE_MASK);
- sprintf(extra, "\n");
- for (bbpId = 0; bbpId <= MAX_BBP_ID; bbpId++)
- {
- if (strlen(extra) >= (IW_PRIV_SIZE_MASK - 20))
- break;
-#ifdef RALINK_ATE
- if (ATE_ON(pAdapter))
- {
- ATE_BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP);
- }
- else
-#endif // RALINK_ATE //
- RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP);
- sprintf(extra+strlen(extra), "R%02d[0x%02X]:%02X ", bbpId, bbpId, regBBP);
- if (bbpId%5 == 4)
- sprintf(extra+strlen(extra), "%03d = %02X\n", bbpId, regBBP); // edit by johnli, change display format
- }
-
- wrq->length = strlen(extra) + 1; // 1: size of '\0'
- DBGPRINT(RT_DEBUG_TRACE, ("wrq->length = %d\n", wrq->length));
- }
-
- DBGPRINT(RT_DEBUG_TRACE, ("<==rt_private_ioctl_bbp\n\n"));
-
- return Status;
-}
-#endif // DBG //
-
int rt_ioctl_siwrate(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
@@ -3246,11 +3081,7 @@ static const iw_handler rt_priv_handlers
(iw_handler) NULL, /* + 0x00 */
(iw_handler) NULL, /* + 0x01 */
(iw_handler) rt_ioctl_setparam, /* + 0x02 */
-#ifdef DBG
- (iw_handler) rt_private_ioctl_bbp, /* + 0x03 */
-#else
(iw_handler) NULL, /* + 0x03 */
-#endif
(iw_handler) NULL, /* + 0x04 */
(iw_handler) NULL, /* + 0x05 */
(iw_handler) NULL, /* + 0x06 */
@@ -5773,20 +5604,6 @@ INT rt28xx_sta_ioctl(
case RTPRIV_IOCTL_GSITESURVEY:
RTMPIoctlGetSiteSurvey(pAd, wrq);
break;
-#ifdef DBG
- case RTPRIV_IOCTL_MAC:
- RTMPIoctlMAC(pAd, wrq);
- break;
- case RTPRIV_IOCTL_E2P:
- RTMPIoctlE2PROM(pAd, wrq);
- break;
-#ifdef RTMP_RF_RW_SUPPORT
- case RTPRIV_IOCTL_RF:
- RTMPIoctlRF(pAd, wrq);
- break;
-#endif // RTMP_RF_RW_SUPPORT //
-#endif // DBG //
-
case SIOCETHTOOL:
break;
default:
@@ -6700,622 +6517,6 @@ INT Set_Wpa_Support(
}
#endif // WPA_SUPPLICANT_SUPPORT //
-#ifdef DBG
-/*
- ==========================================================================
- Description:
- Read / Write MAC
- Arguments:
- pAdapter Pointer to our adapter
- wrq Pointer to the ioctl argument
-
- Return Value:
- None
-
- Note:
- Usage:
- 1.) iwpriv ra0 mac 0 ==> read MAC where Addr=0x0
- 2.) iwpriv ra0 mac 0=12 ==> write MAC where Addr=0x0, value=12
- ==========================================================================
-*/
-VOID RTMPIoctlMAC(
- IN PRTMP_ADAPTER pAdapter,
- IN struct iwreq *wrq)
-{
- PSTRING this_char;
- PSTRING value;
- INT j = 0, k = 0;
- STRING msg[1024];
- STRING arg[255];
- ULONG macAddr = 0;
- UCHAR temp[16];
- STRING temp2[16];
- UINT32 macValue = 0;
- INT Status;
- BOOLEAN bIsPrintAllMAC = FALSE;
-
-
- memset(msg, 0x00, 1024);
- 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 = rtstrchr(this_char, '=')) != NULL)
- *value++ = 0;
-
- if (!value || !*value)
- { //Read
- // Sanity check
- if(strlen(this_char) > 4)
- goto next;
-
- j = strlen(this_char);
- while(j-- > 0)
- {
- if(this_char[j] > 'f' || this_char[j] < '0')
- return;
- }
-
- // Mac Addr
- k = j = strlen(this_char);
- while(j-- > 0)
- {
- this_char[4-k+j] = this_char[j];
- }
-
- while(k < 4)
- this_char[3-k++]='0';
- this_char[4]='\0';
-
- if(strlen(this_char) == 4)
- {
- AtoH(this_char, temp, 2);
- macAddr = *temp*256 + temp[1];
- if (macAddr < 0xFFFF)
- {
- RTMP_IO_READ32(pAdapter, macAddr, &macValue);
- DBGPRINT(RT_DEBUG_TRACE, ("MacAddr=%lx, MacValue=%x\n", macAddr, macValue));
- sprintf(msg+strlen(msg), "[0x%08lX]:%08X ", macAddr , macValue);
- }
- else
- {//Invalid parametes, so default printk all mac
- bIsPrintAllMAC = TRUE;
- goto next;
- }
- }
- }
- else
- { //Write
- memcpy(&temp2, value, strlen(value));
- temp2[strlen(value)] = '\0';
-
- // Sanity check
- if((strlen(this_char) > 4) || strlen(temp2) > 8)
- goto next;
-
- j = strlen(this_char);
- while(j-- > 0)
- {
- if(this_char[j] > 'f' || this_char[j] < '0')
- return;
- }
-
- j = strlen(temp2);
- while(j-- > 0)
- {
- if(temp2[j] > 'f' || temp2[j] < '0')
- return;
- }
-
- //MAC Addr
- k = j = strlen(this_char);
- while(j-- > 0)
- {
- this_char[4-k+j] = this_char[j];
- }
-
- while(k < 4)
- this_char[3-k++]='0';
- this_char[4]='\0';
-
- //MAC value
- k = j = strlen(temp2);
- while(j-- > 0)
- {
- temp2[8-k+j] = temp2[j];
- }
-
- while(k < 8)
- temp2[7-k++]='0';
- temp2[8]='\0';
-
- {
- AtoH(this_char, temp, 2);
- macAddr = *temp*256 + temp[1];
-
- AtoH(temp2, temp, 4);
- macValue = *temp*256*256*256 + temp[1]*256*256 + temp[2]*256 + temp[3];
-
- // debug mode
- if (macAddr == (HW_DEBUG_SETTING_BASE + 4))
- {
- // 0x2bf4: byte0 non-zero: enable R17 tuning, 0: disable R17 tuning
- if (macValue & 0x000000ff)
- {
- pAdapter->BbpTuning.bEnable = TRUE;
- DBGPRINT(RT_DEBUG_TRACE,("turn on R17 tuning\n"));
- }
- else
- {
- UCHAR R66;
- pAdapter->BbpTuning.bEnable = FALSE;
- R66 = 0x26 + GET_LNA_GAIN(pAdapter);
-#ifdef RALINK_ATE
- if (ATE_ON(pAdapter))
- {
- ATE_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R66, (0x26 + GET_LNA_GAIN(pAdapter)));
- }
- else
-#endif // RALINK_ATE //
-
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R66, (0x26 + GET_LNA_GAIN(pAdapter)));
- DBGPRINT(RT_DEBUG_TRACE,("turn off R17 tuning, restore to 0x%02x\n", R66));
- }
- return;
- }
-
- DBGPRINT(RT_DEBUG_TRACE, ("MacAddr=%02lx, MacValue=0x%x\n", macAddr, macValue));
-
- RTMP_IO_WRITE32(pAdapter, macAddr, macValue);
- sprintf(msg+strlen(msg), "[0x%08lX]:%08X ", macAddr, macValue);
- }
- }
- }
- else
- bIsPrintAllMAC = TRUE;
-next:
- if (bIsPrintAllMAC)
- {
- struct file *file_w;
- PSTRING 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", __FUNCTION__, -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);
- }
- if(strlen(msg) == 1)
- sprintf(msg+strlen(msg), "===>Error command format!");
-
- // 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, ("<==RTMPIoctlMAC\n\n"));
-}
-
-/*
- ==========================================================================
- Description:
- Read / Write E2PROM
- Arguments:
- pAdapter Pointer to our adapter
- wrq Pointer to the ioctl argument
-
- Return Value:
- None
-
- Note:
- Usage:
- 1.) iwpriv ra0 e2p 0 ==> read E2PROM where Addr=0x0
- 2.) iwpriv ra0 e2p 0=1234 ==> write E2PROM where Addr=0x0, value=1234
- ==========================================================================
-*/
-VOID RTMPIoctlE2PROM(
- IN PRTMP_ADAPTER pAdapter,
- IN struct iwreq *wrq)
-{
- PSTRING this_char;
- PSTRING value;
- INT j = 0, k = 0;
- STRING msg[1024];
- STRING arg[255];
- USHORT eepAddr = 0;
- UCHAR temp[16];
- STRING temp2[16];
- USHORT eepValue;
- int Status;
- BOOLEAN bIsPrintAllE2P = FALSE;
-
-
- memset(msg, 0x00, 1024);
- 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 = rtstrchr(this_char, '=')) != NULL)
- *value++ = 0;
-
- if (!value || !*value)
- { //Read
-
- // Sanity check
- if(strlen(this_char) > 4)
- goto next;
-
- j = strlen(this_char);
- while(j-- > 0)
- {
- if(this_char[j] > 'f' || this_char[j] < '0')
- return;
- }
-
- // E2PROM addr
- k = j = strlen(this_char);
- while(j-- > 0)
- {
- this_char[4-k+j] = this_char[j];
- }
-
- while(k < 4)
- this_char[3-k++]='0';
- this_char[4]='\0';
-
- if(strlen(this_char) == 4)
- {
- AtoH(this_char, temp, 2);
- eepAddr = *temp*256 + temp[1];
- if (eepAddr < 0xFFFF)
- {
- RT28xx_EEPROM_READ16(pAdapter, eepAddr, eepValue);
- sprintf(msg+strlen(msg), "[0x%04X]:0x%04X ", eepAddr , eepValue);
- }
- else
- {//Invalid parametes, so default printk all bbp
- bIsPrintAllE2P = TRUE;
- goto next;
- }
- }
- }
- else
- { //Write
- memcpy(&temp2, value, strlen(value));
- temp2[strlen(value)] = '\0';
-
- // Sanity check
- if((strlen(this_char) > 4) || strlen(temp2) > 8)
- goto next;
-
- j = strlen(this_char);
- while(j-- > 0)
- {
- if(this_char[j] > 'f' || this_char[j] < '0')
- return;
- }
- j = strlen(temp2);
- while(j-- > 0)
- {
- if(temp2[j] > 'f' || temp2[j] < '0')
- return;
- }
-
- //MAC Addr
- k = j = strlen(this_char);
- while(j-- > 0)
- {
- this_char[4-k+j] = this_char[j];
- }
-
- while(k < 4)
- this_char[3-k++]='0';
- this_char[4]='\0';
-
- //MAC value
- k = j = strlen(temp2);
- while(j-- > 0)
- {
- temp2[4-k+j] = temp2[j];
- }
-
- while(k < 4)
- temp2[3-k++]='0';
- temp2[4]='\0';
-
- AtoH(this_char, temp, 2);
- eepAddr = *temp*256 + temp[1];
-
- AtoH(temp2, temp, 2);
- eepValue = *temp*256 + temp[1];
-
- RT28xx_EEPROM_WRITE16(pAdapter, eepAddr, eepValue);
- sprintf(msg+strlen(msg), "[0x%02X]:%02X ", eepAddr, eepValue);
- }
- }
- else
- bIsPrintAllE2P = TRUE;
-next:
- if (bIsPrintAllE2P)
- {
- struct file *file_w;
- PSTRING 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", __FUNCTION__, -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);
- }
- if(strlen(msg) == 1)
- sprintf(msg+strlen(msg), "===>Error command format!");
-
-
- // 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, ("<==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;
- STRING 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((PSTRING) this_char, "%d", &(rfId)) == 1)
- {
- if (rfId <= 31)
- {
-#ifdef RALINK_ATE
- /*
- 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.
- */
- if (ATE_ON(pAdapter))
- {
- ATE_RF_IO_READ8_BY_REG_ID(pAdapter, rfId, ®RF);
- }
- else
-#endif // RALINK_ATE //
- // according to Andy, Gary, David require.
- // the command rf shall read rf register directly for dubug.
- // BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP);
- RT30xxReadRFRegister(pAdapter, rfId, ®RF);
-
- sprintf(msg+strlen(msg), "R%02d[0x%02x]:%02X ", rfId, rfId, 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((PSTRING) this_char, "%d", &(rfId)) == 1) && (sscanf((PSTRING) value, "%lx", &(rfValue)) == 1))
- {
- if (rfId <= 31)
- {
-#ifdef RALINK_ATE
- /*
- 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.
- */
- if (ATE_ON(pAdapter))
- {
- ATE_RF_IO_READ8_BY_REG_ID(pAdapter, rfId, ®RF);
- ATE_RF_IO_WRITE8_BY_REG_ID(pAdapter, (UCHAR)rfId,(UCHAR) rfValue);
- //Read it back for showing
- ATE_RF_IO_READ8_BY_REG_ID(pAdapter, rfId, ®RF);
- sprintf(msg+strlen(msg), "R%02d[0x%02X]:%02X\n", rfId, rfId, regRF);
- }
- else
-#endif // RALINK_ATE //
- {
- // 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, ®BBP);
- //BBP_IO_WRITE8_BY_REG_ID(pAdapter, (UCHAR)bbpId,(UCHAR) bbpValue);
- RT30xxReadRFRegister(pAdapter, rfId, ®RF);
- RT30xxWriteRFRegister(pAdapter, (UCHAR)rfId,(UCHAR) rfValue);
- //Read it back for showing
- //BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP);
- RT30xxReadRFRegister(pAdapter, rfId, ®RF);
- sprintf(msg+strlen(msg), "R%02d[0x%02X]:%02X\n", rfId, rfId, 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++)
- {
-#ifdef RALINK_ATE
- /*
- 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.
- */
- if (ATE_ON(pAdapter))
- {
- ATE_RF_IO_READ8_BY_REG_ID(pAdapter, rfId, ®RF);
- }
- else
-#endif // RALINK_ATE //
-
- // according to Andy, Gary, David require.
- // the command RF shall read/write RF register directly for dubug.
- RT30xxReadRFRegister(pAdapter, rfId, ®RF);
- 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", __FUNCTION__));
- }
- }
- 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 //
-
-
-
-
INT Set_TGnWifiTest_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg)
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 4/8] Staging: rt3090: remove private ioctls
2009-09-22 18:43 [PATCH 0/8] Staging: updates for Ralink drivers Bartlomiej Zolnierkiewicz
` (2 preceding siblings ...)
2009-09-22 18:43 ` [PATCH 3/8] Staging: rt3090: remove private debugging ioctls Bartlomiej Zolnierkiewicz
@ 2009-09-22 18:43 ` Bartlomiej Zolnierkiewicz
2009-09-22 18:44 ` [PATCH 5/8] Staging: rt28x0: updates from vendor's V2.1.0.0 drivers Bartlomiej Zolnierkiewicz
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-09-22 18:43 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: devel, Bartlomiej Zolnierkiewicz, Mike Galbraith, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rt3090: remove private ioctls
This makes rt3090 match other Ralink drivers.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/staging/rt3090/oid.h | 117 -
drivers/staging/rt3090/sta_ioctl.c | 2285 -------------------------------------
2 files changed, 2 insertions(+), 2400 deletions(-)
Index: b/drivers/staging/rt3090/oid.h
===================================================================
--- a/drivers/staging/rt3090/oid.h
+++ b/drivers/staging/rt3090/oid.h
@@ -98,143 +98,26 @@
#define OID_GET_SET_TOGGLE 0x8000
#define OID_GET_SET_FROM_UI 0x4000
-#define OID_802_11_NETWORK_TYPES_SUPPORTED 0x0103
-#define OID_802_11_NETWORK_TYPE_IN_USE 0x0104
-#define OID_802_11_RSSI_TRIGGER 0x0107
-#define RT_OID_802_11_RSSI 0x0108 //rt2860 only , kathy
-#define RT_OID_802_11_RSSI_1 0x0109 //rt2860 only , kathy
-#define RT_OID_802_11_RSSI_2 0x010A //rt2860 only , kathy
-#define OID_802_11_NUMBER_OF_ANTENNAS 0x010B
-#define OID_802_11_RX_ANTENNA_SELECTED 0x010C
-#define OID_802_11_TX_ANTENNA_SELECTED 0x010D
-#define OID_802_11_SUPPORTED_RATES 0x010E
#define OID_802_11_ADD_WEP 0x0112
-#define OID_802_11_REMOVE_WEP 0x0113
#define OID_802_11_DISASSOCIATE 0x0114
-#define OID_802_11_PRIVACY_FILTER 0x0118
-#define OID_802_11_ASSOCIATION_INFORMATION 0x011E
-#define OID_802_11_TEST 0x011F
-
-
-#define RT_OID_802_11_COUNTRY_REGION 0x0507
#define OID_802_11_BSSID_LIST_SCAN 0x0508
#define OID_802_11_SSID 0x0509
#define OID_802_11_BSSID 0x050A
-#define RT_OID_802_11_RADIO 0x050B
-#define RT_OID_802_11_PHY_MODE 0x050C
-#define RT_OID_802_11_STA_CONFIG 0x050D
-#define OID_802_11_DESIRED_RATES 0x050E
-#define RT_OID_802_11_PREAMBLE 0x050F
-#define OID_802_11_WEP_STATUS 0x0510
-#define OID_802_11_AUTHENTICATION_MODE 0x0511
-#define OID_802_11_INFRASTRUCTURE_MODE 0x0512
-#define RT_OID_802_11_RESET_COUNTERS 0x0513
-#define OID_802_11_RTS_THRESHOLD 0x0514
-#define OID_802_11_FRAGMENTATION_THRESHOLD 0x0515
-#define OID_802_11_POWER_MODE 0x0516
-#define OID_802_11_TX_POWER_LEVEL 0x0517
-#define RT_OID_802_11_ADD_WPA 0x0518
-#define OID_802_11_REMOVE_KEY 0x0519
-#define OID_802_11_ADD_KEY 0x0520
-#define OID_802_11_CONFIGURATION 0x0521
-#define OID_802_11_TX_PACKET_BURST 0x0522
-#define RT_OID_802_11_QUERY_NOISE_LEVEL 0x0523
-#define RT_OID_802_11_EXTRA_INFO 0x0524
-#ifdef DBG
-#define RT_OID_802_11_HARDWARE_REGISTER 0x0525
-#endif
-#define OID_802_11_ENCRYPTION_STATUS OID_802_11_WEP_STATUS
-#define OID_802_11_DEAUTHENTICATION 0x0526
-#define OID_802_11_DROP_UNENCRYPTED 0x0527
#define OID_802_11_MIC_FAILURE_REPORT_FRAME 0x0528
-#define OID_802_11_EAP_METHOD 0x0529
-
-// For 802.1x daemin using to require current driver configuration
-#define OID_802_11_RADIUS_QUERY_SETTING 0x0540
#define RT_OID_DEVICE_NAME 0x0607
#define RT_OID_VERSION_INFO 0x0608
-#define OID_802_11_BSSID_LIST 0x0609
-#define OID_802_3_CURRENT_ADDRESS 0x060A
#define OID_GEN_MEDIA_CONNECT_STATUS 0x060B
-#define RT_OID_802_11_QUERY_LINK_STATUS 0x060C
-#define OID_802_11_RSSI 0x060D
-#define OID_802_11_STATISTICS 0x060E
#define OID_GEN_RCV_OK 0x060F
#define OID_GEN_RCV_NO_BUFFER 0x0610
-#define RT_OID_802_11_QUERY_EEPROM_VERSION 0x0611
-#define RT_OID_802_11_QUERY_FIRMWARE_VERSION 0x0612
-#define RT_OID_802_11_QUERY_LAST_RX_RATE 0x0613
-#define RT_OID_802_11_TX_POWER_LEVEL_1 0x0614
-#define RT_OID_802_11_QUERY_PIDVID 0x0615
//for WPA_SUPPLICANT_SUPPORT
#define OID_SET_COUNTERMEASURES 0x0616
-#define OID_802_11_SET_IEEE8021X 0x0617
-#define OID_802_11_SET_IEEE8021X_REQUIRE_KEY 0x0618
-#define OID_802_11_PMKID 0x0620
#define RT_OID_WPA_SUPPLICANT_SUPPORT 0x0621
#define RT_OID_WE_VERSION_COMPILED 0x0622
#define RT_OID_NEW_DRIVER 0x0623
-#define RT_OID_802_11_SNR_0 0x0630
-#define RT_OID_802_11_SNR_1 0x0631
-#define RT_OID_802_11_QUERY_LAST_TX_RATE 0x0632
-#define RT_OID_802_11_QUERY_HT_PHYMODE 0x0633
-#define RT_OID_802_11_SET_HT_PHYMODE 0x0634
-#define OID_802_11_RELOAD_DEFAULTS 0x0635
-#define RT_OID_802_11_QUERY_APSD_SETTING 0x0636
-#define RT_OID_802_11_SET_APSD_SETTING 0x0637
-#define RT_OID_802_11_QUERY_APSD_PSM 0x0638
-#define RT_OID_802_11_SET_APSD_PSM 0x0639
-#define RT_OID_802_11_QUERY_DLS 0x063A
-#define RT_OID_802_11_SET_DLS 0x063B
-#define RT_OID_802_11_QUERY_DLS_PARAM 0x063C
-#define RT_OID_802_11_SET_DLS_PARAM 0x063D
-#define RT_OID_802_11_QUERY_WMM 0x063E
-#define RT_OID_802_11_SET_WMM 0x063F
-#define RT_OID_802_11_QUERY_IMME_BA_CAP 0x0640
-#define RT_OID_802_11_SET_IMME_BA_CAP 0x0641
-#define RT_OID_802_11_QUERY_BATABLE 0x0642
-#define RT_OID_802_11_ADD_IMME_BA 0x0643
-#define RT_OID_802_11_TEAR_IMME_BA 0x0644
#define RT_OID_DRIVER_DEVICE_NAME 0x0645
-#define RT_OID_802_11_QUERY_DAT_HT_PHYMODE 0x0646
#define RT_OID_QUERY_MULTIPLE_CARD_SUPPORT 0x0647
-#define OID_802_11_SET_PSPXLINK_MODE 0x0648
-/*+++ add by woody +++*/
-#define OID_802_11_SET_PASSPHRASE 0x0649
-// Ralink defined OIDs
-// Dennis Lee move to platform specific
-
-#define RT_OID_802_11_BSSID (OID_GET_SET_TOGGLE | OID_802_11_BSSID)
-#define RT_OID_802_11_SSID (OID_GET_SET_TOGGLE | OID_802_11_SSID)
-#define RT_OID_802_11_INFRASTRUCTURE_MODE (OID_GET_SET_TOGGLE | OID_802_11_INFRASTRUCTURE_MODE)
-#define RT_OID_802_11_ADD_WEP (OID_GET_SET_TOGGLE | OID_802_11_ADD_WEP)
-#define RT_OID_802_11_ADD_KEY (OID_GET_SET_TOGGLE | OID_802_11_ADD_KEY)
-#define RT_OID_802_11_REMOVE_WEP (OID_GET_SET_TOGGLE | OID_802_11_REMOVE_WEP)
-#define RT_OID_802_11_REMOVE_KEY (OID_GET_SET_TOGGLE | OID_802_11_REMOVE_KEY)
-#define RT_OID_802_11_DISASSOCIATE (OID_GET_SET_TOGGLE | OID_802_11_DISASSOCIATE)
-#define RT_OID_802_11_AUTHENTICATION_MODE (OID_GET_SET_TOGGLE | OID_802_11_AUTHENTICATION_MODE)
-#define RT_OID_802_11_PRIVACY_FILTER (OID_GET_SET_TOGGLE | OID_802_11_PRIVACY_FILTER)
-#define RT_OID_802_11_BSSID_LIST_SCAN (OID_GET_SET_TOGGLE | OID_802_11_BSSID_LIST_SCAN)
-#define RT_OID_802_11_WEP_STATUS (OID_GET_SET_TOGGLE | OID_802_11_WEP_STATUS)
-#define RT_OID_802_11_RELOAD_DEFAULTS (OID_GET_SET_TOGGLE | OID_802_11_RELOAD_DEFAULTS)
-#define RT_OID_802_11_NETWORK_TYPE_IN_USE (OID_GET_SET_TOGGLE | OID_802_11_NETWORK_TYPE_IN_USE)
-#define RT_OID_802_11_TX_POWER_LEVEL (OID_GET_SET_TOGGLE | OID_802_11_TX_POWER_LEVEL)
-#define RT_OID_802_11_RSSI_TRIGGER (OID_GET_SET_TOGGLE | OID_802_11_RSSI_TRIGGER)
-#define RT_OID_802_11_FRAGMENTATION_THRESHOLD (OID_GET_SET_TOGGLE | OID_802_11_FRAGMENTATION_THRESHOLD)
-#define RT_OID_802_11_RTS_THRESHOLD (OID_GET_SET_TOGGLE | OID_802_11_RTS_THRESHOLD)
-#define RT_OID_802_11_RX_ANTENNA_SELECTED (OID_GET_SET_TOGGLE | OID_802_11_RX_ANTENNA_SELECTED)
-#define RT_OID_802_11_TX_ANTENNA_SELECTED (OID_GET_SET_TOGGLE | OID_802_11_TX_ANTENNA_SELECTED)
-#define RT_OID_802_11_SUPPORTED_RATES (OID_GET_SET_TOGGLE | OID_802_11_SUPPORTED_RATES)
-#define RT_OID_802_11_DESIRED_RATES (OID_GET_SET_TOGGLE | OID_802_11_DESIRED_RATES)
-#define RT_OID_802_11_CONFIGURATION (OID_GET_SET_TOGGLE | OID_802_11_CONFIGURATION)
-#define RT_OID_802_11_POWER_MODE (OID_GET_SET_TOGGLE | OID_802_11_POWER_MODE)
-#define RT_OID_802_11_SET_PSPXLINK_MODE (OID_GET_SET_TOGGLE | OID_802_11_SET_PSPXLINK_MODE)
-#define RT_OID_802_11_EAP_METHOD (OID_GET_SET_TOGGLE | OID_802_11_EAP_METHOD)
-#define RT_OID_802_11_SET_PASSPHRASE (OID_GET_SET_TOGGLE | OID_802_11_SET_PASSPHRASE)
-
-
typedef enum _NDIS_802_11_STATUS_TYPE
{
Index: b/drivers/staging/rt3090/sta_ioctl.c
===================================================================
--- a/drivers/staging/rt3090/sta_ioctl.c
+++ b/drivers/staging/rt3090/sta_ioctl.c
@@ -3119,2279 +3119,6 @@ const struct iw_handler_def rt28xx_iw_ha
#endif
};
-INT RTMPSetInformation(
- IN PRTMP_ADAPTER pAd,
- IN OUT struct ifreq *rq,
- IN INT cmd)
-{
- struct iwreq *wrq = (struct iwreq *) rq;
- NDIS_802_11_SSID Ssid;
- NDIS_802_11_MAC_ADDRESS Bssid;
- RT_802_11_PHY_MODE PhyMode;
- RT_802_11_STA_CONFIG StaConfig;
- NDIS_802_11_RATES aryRates;
- RT_802_11_PREAMBLE Preamble;
- NDIS_802_11_WEP_STATUS WepStatus;
- NDIS_802_11_AUTHENTICATION_MODE AuthMode = Ndis802_11AuthModeMax;
- NDIS_802_11_NETWORK_INFRASTRUCTURE BssType;
- NDIS_802_11_RTS_THRESHOLD RtsThresh;
- NDIS_802_11_FRAGMENTATION_THRESHOLD FragThresh;
- NDIS_802_11_POWER_MODE PowerMode;
- PNDIS_802_11_KEY pKey = NULL;
- PNDIS_802_11_WEP pWepKey =NULL;
- PNDIS_802_11_REMOVE_KEY pRemoveKey = NULL;
- NDIS_802_11_CONFIGURATION Config, *pConfig = NULL;
- NDIS_802_11_NETWORK_TYPE NetType;
- ULONG Now;
- UINT KeyIdx = 0;
- INT Status = NDIS_STATUS_SUCCESS, MaxPhyMode = PHY_11G;
- ULONG PowerTemp;
- BOOLEAN RadioState;
- BOOLEAN StateMachineTouched = FALSE;
- PNDIS_802_11_PASSPHRASE ppassphrase = NULL;
-#ifdef DOT11_N_SUPPORT
- OID_SET_HT_PHYMODE HT_PhyMode; //11n ,kathy
-#endif // DOT11_N_SUPPORT //
-#ifdef WPA_SUPPLICANT_SUPPORT
- PNDIS_802_11_PMKID pPmkId = NULL;
- BOOLEAN IEEE8021xState = FALSE;
- BOOLEAN IEEE8021x_required_keys = FALSE;
- UCHAR wpa_supplicant_enable = 0;
-#endif // WPA_SUPPLICANT_SUPPORT //
-
-#ifdef SNMP_SUPPORT
- TX_RTY_CFG_STRUC tx_rty_cfg;
- ULONG ShortRetryLimit, LongRetryLimit;
- UCHAR ctmp;
-#endif // SNMP_SUPPORT //
-
-
-
-
-#ifdef DOT11_N_SUPPORT
- MaxPhyMode = PHY_11N_5G;
-#endif // DOT11_N_SUPPORT //
-
- DBGPRINT(RT_DEBUG_TRACE, ("-->RTMPSetInformation(), 0x%08x\n", cmd&0x7FFF));
- switch(cmd & 0x7FFF) {
- case RT_OID_802_11_COUNTRY_REGION:
- if (wrq->u.data.length < sizeof(UCHAR))
- Status = -EINVAL;
- // Only avaliable when EEPROM not programming
- else if (!(pAd->CommonCfg.CountryRegion & 0x80) && !(pAd->CommonCfg.CountryRegionForABand & 0x80))
- {
- ULONG Country;
- UCHAR TmpPhy;
-
- Status = copy_from_user(&Country, wrq->u.data.pointer, wrq->u.data.length);
- pAd->CommonCfg.CountryRegion = (UCHAR)(Country & 0x000000FF);
- pAd->CommonCfg.CountryRegionForABand = (UCHAR)((Country >> 8) & 0x000000FF);
- TmpPhy = pAd->CommonCfg.PhyMode;
- pAd->CommonCfg.PhyMode = 0xff;
- // Build all corresponding channel information
- RTMPSetPhyMode(pAd, TmpPhy);
-#ifdef DOT11_N_SUPPORT
- SetCommonHT(pAd);
-#endif // DOT11_N_SUPPORT //
- DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_COUNTRY_REGION (A:%d B/G:%d)\n", pAd->CommonCfg.CountryRegionForABand,
- pAd->CommonCfg.CountryRegion));
- }
- break;
- case OID_802_11_BSSID_LIST_SCAN:
- Now = jiffies;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_BSSID_LIST_SCAN, TxCnt = %d \n", pAd->RalinkCounters.LastOneSecTotalTxCount));
-
- if (MONITOR_ON(pAd))
- {
- DBGPRINT(RT_DEBUG_TRACE, ("!!! Driver is in Monitor Mode now !!!\n"));
- break;
- }
-
- //Benson add 20080527, when radio off, sta don't need to scan
- if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF))
- break;
-
- if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS))
- {
- DBGPRINT(RT_DEBUG_TRACE, ("!!! Driver is scanning now !!!\n"));
- pAd->StaCfg.bScanReqIsFromWebUI = TRUE;
- Status = NDIS_STATUS_SUCCESS;
- break;
- }
-
- if (pAd->RalinkCounters.LastOneSecTotalTxCount > 100)
- {
- DBGPRINT(RT_DEBUG_TRACE, ("!!! Link UP, ignore this set::OID_802_11_BSSID_LIST_SCAN\n"));
- Status = NDIS_STATUS_SUCCESS;
- pAd->StaCfg.ScanCnt = 99; // Prevent auto scan triggered by this OID
- break;
- }
-
- if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) &&
- ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) ||
- (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) ||
- (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) ||
- (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) &&
- (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED))
- {
- DBGPRINT(RT_DEBUG_TRACE, ("!!! Link UP, Port Not Secured! ignore this set::OID_802_11_BSSID_LIST_SCAN\n"));
- Status = NDIS_STATUS_SUCCESS;
- pAd->StaCfg.ScanCnt = 99; // Prevent auto scan triggered by this OID
- break;
- }
-
-
- if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE)
- {
- RTMP_MLME_RESET_STATE_MACHINE(pAd);
- DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n"));
- }
-
- // tell CNTL state machine to call NdisMSetInformationComplete() after completing
- // this request, because this request is initiated by NDIS.
- pAd->MlmeAux.CurrReqIsFromNdis = FALSE;
- // Reset allowed scan retries
- pAd->StaCfg.ScanCnt = 0;
- pAd->StaCfg.LastScanTime = Now;
-
- pAd->StaCfg.bScanReqIsFromWebUI = TRUE;
- RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS);
- MlmeEnqueue(pAd,
- MLME_CNTL_STATE_MACHINE,
- OID_802_11_BSSID_LIST_SCAN,
- 0,
- NULL);
-
- Status = NDIS_STATUS_SUCCESS;
- StateMachineTouched = TRUE;
- break;
- case OID_802_11_SSID:
- if (wrq->u.data.length != sizeof(NDIS_802_11_SSID))
- Status = -EINVAL;
- else
- {
- PSTRING pSsidString = NULL;
- Status = copy_from_user(&Ssid, wrq->u.data.pointer, wrq->u.data.length);
-
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_SSID (Len=%d,Ssid=%s)\n", Ssid.SsidLength, Ssid.Ssid));
- if (Ssid.SsidLength > MAX_LEN_OF_SSID)
- Status = -EINVAL;
- else
- {
- if (Ssid.SsidLength == 0)
- {
- Set_SSID_Proc(pAd, "");
- }
- else
- {
- pSsidString = (PSTRING)kmalloc(MAX_LEN_OF_SSID+1, MEM_ALLOC_FLAG);
- if (pSsidString)
- {
- NdisZeroMemory(pSsidString, MAX_LEN_OF_SSID+1);
- NdisMoveMemory(pSsidString, Ssid.Ssid, Ssid.SsidLength);
- Set_SSID_Proc(pAd, pSsidString);
- kfree(pSsidString);
- }
- else
- Status = -ENOMEM;
- }
- }
- }
- break;
- case OID_802_11_SET_PASSPHRASE:
- ppassphrase= kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG);
-
- if(ppassphrase== NULL)
- {
- Status = -ENOMEM;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_SET_PASSPHRASE, Failed!!\n"));
- break;
- }
- else
- {
- Status = copy_from_user(ppassphrase, wrq->u.data.pointer, wrq->u.data.length);
-
- if (Status)
- {
- Status = -EINVAL;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_SET_PASSPHRASE, Failed (length mismatch)!!\n"));
- }
- else
- {
- if(ppassphrase->KeyLength < 8 || ppassphrase->KeyLength > 64)
- {
- Status = -EINVAL;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_SET_PASSPHRASE, Failed (len less than 8 or greater than 64)!!\n"));
- }
- else
- {
- // set key passphrase and length
- NdisZeroMemory(pAd->StaCfg.WpaPassPhrase, 64);
- NdisMoveMemory(pAd->StaCfg.WpaPassPhrase, &ppassphrase->KeyMaterial, ppassphrase->KeyLength);
- pAd->StaCfg.WpaPassPhraseLen = ppassphrase->KeyLength;
- hex_dump("pAd->StaCfg.WpaPassPhrase", pAd->StaCfg.WpaPassPhrase, 64);
- printk("WpaPassPhrase=%s\n",pAd->StaCfg.WpaPassPhrase);
- }
- }
- }
- kfree(ppassphrase);
- break;
-
- case OID_802_11_BSSID:
- if (wrq->u.data.length != sizeof(NDIS_802_11_MAC_ADDRESS))
- Status = -EINVAL;
- else
- {
- Status = copy_from_user(&Bssid, wrq->u.data.pointer, wrq->u.data.length);
-
- // tell CNTL state machine to call NdisMSetInformationComplete() after completing
- // this request, because this request is initiated by NDIS.
- pAd->MlmeAux.CurrReqIsFromNdis = FALSE;
-
- // Prevent to connect AP again in STAMlmePeriodicExec
- pAd->MlmeAux.AutoReconnectSsidLen= 32;
-
- // Reset allowed scan retries
- pAd->StaCfg.ScanCnt = 0;
-
- if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE)
- {
- RTMP_MLME_RESET_STATE_MACHINE(pAd);
- DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n"));
- }
- MlmeEnqueue(pAd,
- MLME_CNTL_STATE_MACHINE,
- OID_802_11_BSSID,
- sizeof(NDIS_802_11_MAC_ADDRESS),
- (VOID *)&Bssid);
- Status = NDIS_STATUS_SUCCESS;
- StateMachineTouched = TRUE;
-
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_BSSID %02x:%02x:%02x:%02x:%02x:%02x\n",
- Bssid[0], Bssid[1], Bssid[2], Bssid[3], Bssid[4], Bssid[5]));
- }
- break;
- case RT_OID_802_11_RADIO:
- if (wrq->u.data.length != sizeof(BOOLEAN))
- Status = -EINVAL;
- else
- {
- Status = copy_from_user(&RadioState, wrq->u.data.pointer, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_RADIO (=%d)\n", RadioState));
- if (pAd->StaCfg.bSwRadio != RadioState)
- {
- pAd->StaCfg.bSwRadio = RadioState;
- if (pAd->StaCfg.bRadio != (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio))
- {
- pAd->StaCfg.bRadio = (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio);
- if (pAd->StaCfg.bRadio == TRUE)
- {
- MlmeRadioOn(pAd);
- // Update extra information
- pAd->ExtraInfo = EXTRA_INFO_CLEAR;
- }
- else
- {
- if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS))
- {
- if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE)
- {
- RTMP_MLME_RESET_STATE_MACHINE(pAd);
- DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n"));
- }
- }
-
- MlmeRadioOff(pAd);
- // Update extra information
- pAd->ExtraInfo = SW_RADIO_OFF;
- }
- }
- }
- }
- break;
- case RT_OID_802_11_PHY_MODE:
- if (wrq->u.data.length != sizeof(RT_802_11_PHY_MODE))
- Status = -EINVAL;
- else
- {
- Status = copy_from_user(&PhyMode, wrq->u.data.pointer, wrq->u.data.length);
- if (PhyMode <= MaxPhyMode)
- {
- RTMPSetPhyMode(pAd, PhyMode);
-#ifdef DOT11_N_SUPPORT
- SetCommonHT(pAd);
-#endif // DOT11_N_SUPPORT //
- }
- DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_PHY_MODE (=%d)\n", PhyMode));
- }
- break;
- case RT_OID_802_11_STA_CONFIG:
- if (wrq->u.data.length != sizeof(RT_802_11_STA_CONFIG))
- Status = -EINVAL;
- else
- {
- UINT32 Value;
-
- Status = copy_from_user(&StaConfig, wrq->u.data.pointer, wrq->u.data.length);
- pAd->CommonCfg.bEnableTxBurst = StaConfig.EnableTxBurst;
- pAd->CommonCfg.UseBGProtection = StaConfig.UseBGProtection;
- pAd->CommonCfg.bUseShortSlotTime = 1; // 2003-10-30 always SHORT SLOT capable
- if ((pAd->CommonCfg.PhyMode != StaConfig.AdhocMode) &&
- (StaConfig.AdhocMode <= MaxPhyMode))
- {
- // 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
- if (pAd->StaCfg.BssType == BSS_ADHOC)
- {
- pAd->CommonCfg.PhyMode = StaConfig.AdhocMode;
- RTMPSetPhyMode(pAd, PhyMode);
- MlmeUpdateTxRates(pAd, FALSE, 0);
- MakeIbssBeacon(pAd); // re-build BEACON frame
- AsicEnableIbssSync(pAd); // copy to on-chip memory
- }
- }
- DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_SET_STA_CONFIG (Burst=%d, Protection=%ld,ShortSlot=%d\n",
- pAd->CommonCfg.bEnableTxBurst,
- pAd->CommonCfg.UseBGProtection,
- pAd->CommonCfg.bUseShortSlotTime));
-
- if (pAd->CommonCfg.PSPXlink)
- Value = PSPXLINK;
- else
- Value = STANORMAL;
- RTMP_IO_WRITE32(pAd, RX_FILTR_CFG, Value);
- Value = 0;
- RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value);
- Value &= (~0x80);
- RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value);
- }
- break;
- case OID_802_11_DESIRED_RATES:
- if (wrq->u.data.length != sizeof(NDIS_802_11_RATES))
- Status = -EINVAL;
- else
- {
- Status = copy_from_user(&aryRates, wrq->u.data.pointer, wrq->u.data.length);
- NdisZeroMemory(pAd->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES);
- NdisMoveMemory(pAd->CommonCfg.DesireRate, &aryRates, sizeof(NDIS_802_11_RATES));
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_DESIRED_RATES (%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x)\n",
- pAd->CommonCfg.DesireRate[0],pAd->CommonCfg.DesireRate[1],
- pAd->CommonCfg.DesireRate[2],pAd->CommonCfg.DesireRate[3],
- pAd->CommonCfg.DesireRate[4],pAd->CommonCfg.DesireRate[5],
- pAd->CommonCfg.DesireRate[6],pAd->CommonCfg.DesireRate[7] ));
- // Changing DesiredRate may affect the MAX TX rate we used to TX frames out
- MlmeUpdateTxRates(pAd, FALSE, 0);
- }
- break;
- case RT_OID_802_11_PREAMBLE:
- if (wrq->u.data.length != sizeof(RT_802_11_PREAMBLE))
- Status = -EINVAL;
- else
- {
- Status = copy_from_user(&Preamble, wrq->u.data.pointer, wrq->u.data.length);
- if (Preamble == Rt802_11PreambleShort)
- {
- pAd->CommonCfg.TxPreamble = Preamble;
- MlmeSetTxPreamble(pAd, Rt802_11PreambleShort);
- }
- else if ((Preamble == Rt802_11PreambleLong) || (Preamble == Rt802_11PreambleAuto))
- {
- // if user wants AUTO, initialize to LONG here, then change according to AP's
- // capability upon association.
- pAd->CommonCfg.TxPreamble = Preamble;
- MlmeSetTxPreamble(pAd, Rt802_11PreambleLong);
- }
- else
- {
- Status = -EINVAL;
- break;
- }
- DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_PREAMBLE (=%d)\n", Preamble));
- }
- break;
- case OID_802_11_WEP_STATUS:
- if (wrq->u.data.length != sizeof(NDIS_802_11_WEP_STATUS))
- Status = -EINVAL;
- else
- {
- Status = copy_from_user(&WepStatus, wrq->u.data.pointer, wrq->u.data.length);
- // Since TKIP, AES, WEP are all supported. It should not have any invalid setting
- if (WepStatus <= Ndis802_11Encryption3KeyAbsent)
- {
- if (pAd->StaCfg.WepStatus != WepStatus)
- {
- // Config has changed
- pAd->bConfigChanged = TRUE;
- }
- pAd->StaCfg.WepStatus = WepStatus;
- pAd->StaCfg.OrigWepStatus = WepStatus;
- pAd->StaCfg.PairCipher = WepStatus;
- pAd->StaCfg.GroupCipher = WepStatus;
- }
- else
- {
- Status = -EINVAL;
- break;
- }
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_WEP_STATUS (=%d)\n",WepStatus));
- }
- break;
- case OID_802_11_AUTHENTICATION_MODE:
- if (wrq->u.data.length != sizeof(NDIS_802_11_AUTHENTICATION_MODE))
- Status = -EINVAL;
- else
- {
- Status = copy_from_user(&AuthMode, wrq->u.data.pointer, wrq->u.data.length);
- if (AuthMode > Ndis802_11AuthModeMax)
- {
- Status = -EINVAL;
- break;
- }
- else
- {
- if (pAd->StaCfg.AuthMode != AuthMode)
- {
- // Config has changed
- pAd->bConfigChanged = TRUE;
- }
- pAd->StaCfg.AuthMode = AuthMode;
- }
- pAd->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_AUTHENTICATION_MODE (=%d) \n",pAd->StaCfg.AuthMode));
- }
- break;
- case OID_802_11_INFRASTRUCTURE_MODE:
- if (wrq->u.data.length != sizeof(NDIS_802_11_NETWORK_INFRASTRUCTURE))
- Status = -EINVAL;
- else
- {
- Status = copy_from_user(&BssType, wrq->u.data.pointer, wrq->u.data.length);
-
- if (BssType == Ndis802_11IBSS)
- Set_NetworkType_Proc(pAd, "Adhoc");
- else if (BssType == Ndis802_11Infrastructure)
- Set_NetworkType_Proc(pAd, "Infra");
- else if (BssType == Ndis802_11Monitor)
- Set_NetworkType_Proc(pAd, "Monitor");
- else
- {
- Status = -EINVAL;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_INFRASTRUCTURE_MODE (unknown)\n"));
- }
- }
- break;
- case OID_802_11_REMOVE_WEP:
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_WEP\n"));
- if (wrq->u.data.length != sizeof(NDIS_802_11_KEY_INDEX))
- {
- Status = -EINVAL;
- }
- else
- {
- KeyIdx = *(NDIS_802_11_KEY_INDEX *) wrq->u.data.pointer;
-
- if (KeyIdx & 0x80000000)
- {
- // Should never set default bit when remove key
- Status = -EINVAL;
- }
- else
- {
- KeyIdx = KeyIdx & 0x0fffffff;
- if (KeyIdx >= 4){
- Status = -EINVAL;
- }
- else
- {
- pAd->SharedKey[BSS0][KeyIdx].KeyLen = 0;
- pAd->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_NONE;
- AsicRemoveSharedKeyEntry(pAd, 0, (UCHAR)KeyIdx);
- }
- }
- }
- break;
- case RT_OID_802_11_RESET_COUNTERS:
- NdisZeroMemory(&pAd->WlanCounters, sizeof(COUNTER_802_11));
- NdisZeroMemory(&pAd->Counters8023, sizeof(COUNTER_802_3));
- NdisZeroMemory(&pAd->RalinkCounters, sizeof(COUNTER_RALINK));
- pAd->Counters8023.RxNoBuffer = 0;
- pAd->Counters8023.GoodReceives = 0;
- pAd->Counters8023.RxNoBuffer = 0;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_RESET_COUNTERS \n"));
- break;
- case OID_802_11_RTS_THRESHOLD:
- if (wrq->u.data.length != sizeof(NDIS_802_11_RTS_THRESHOLD))
- Status = -EINVAL;
- else
- {
- Status = copy_from_user(&RtsThresh, wrq->u.data.pointer, wrq->u.data.length);
- if (RtsThresh > MAX_RTS_THRESHOLD)
- Status = -EINVAL;
- else
- pAd->CommonCfg.RtsThreshold = (USHORT)RtsThresh;
- }
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_RTS_THRESHOLD (=%ld)\n",RtsThresh));
- break;
- case OID_802_11_FRAGMENTATION_THRESHOLD:
- if (wrq->u.data.length != sizeof(NDIS_802_11_FRAGMENTATION_THRESHOLD))
- Status = -EINVAL;
- else
- {
- Status = copy_from_user(&FragThresh, wrq->u.data.pointer, wrq->u.data.length);
- pAd->CommonCfg.bUseZeroToDisableFragment = FALSE;
- if (FragThresh > MAX_FRAG_THRESHOLD || FragThresh < MIN_FRAG_THRESHOLD)
- {
- if (FragThresh == 0)
- {
- pAd->CommonCfg.FragmentThreshold = MAX_FRAG_THRESHOLD;
- pAd->CommonCfg.bUseZeroToDisableFragment = TRUE;
- }
- else
- Status = -EINVAL;
- }
- else
- pAd->CommonCfg.FragmentThreshold = (USHORT)FragThresh;
- }
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_FRAGMENTATION_THRESHOLD (=%ld) \n",FragThresh));
- break;
- case OID_802_11_POWER_MODE:
- if (wrq->u.data.length != sizeof(NDIS_802_11_POWER_MODE))
- Status = -EINVAL;
- else
- {
- Status = copy_from_user(&PowerMode, wrq->u.data.pointer, wrq->u.data.length);
- if (PowerMode == Ndis802_11PowerModeCAM)
- Set_PSMode_Proc(pAd, "CAM");
- else if (PowerMode == Ndis802_11PowerModeMAX_PSP)
- Set_PSMode_Proc(pAd, "Max_PSP");
- else if (PowerMode == Ndis802_11PowerModeFast_PSP)
- Set_PSMode_Proc(pAd, "Fast_PSP");
- else if (PowerMode == Ndis802_11PowerModeLegacy_PSP)
- Set_PSMode_Proc(pAd, "Legacy_PSP");
- else
- Status = -EINVAL;
- }
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_POWER_MODE (=%d)\n",PowerMode));
- break;
- case RT_OID_802_11_TX_POWER_LEVEL_1:
- if (wrq->u.data.length < sizeof(ULONG))
- Status = -EINVAL;
- else
- {
- Status = copy_from_user(&PowerTemp, wrq->u.data.pointer, wrq->u.data.length);
- if (PowerTemp > 100)
- PowerTemp = 0xffffffff; // AUTO
- pAd->CommonCfg.TxPowerDefault = PowerTemp; //keep current setting.
- pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_TX_POWER_LEVEL_1 (=%ld)\n", pAd->CommonCfg.TxPowerPercentage));
- }
- break;
- case OID_802_11_NETWORK_TYPE_IN_USE:
- if (wrq->u.data.length != sizeof(NDIS_802_11_NETWORK_TYPE))
- Status = -EINVAL;
- else
- {
- Status = copy_from_user(&NetType, wrq->u.data.pointer, wrq->u.data.length);
-
- if (NetType == Ndis802_11DS)
- RTMPSetPhyMode(pAd, PHY_11B);
- else if (NetType == Ndis802_11OFDM24)
- RTMPSetPhyMode(pAd, PHY_11BG_MIXED);
- else if (NetType == Ndis802_11OFDM5)
- RTMPSetPhyMode(pAd, PHY_11A);
- else
- Status = -EINVAL;
-#ifdef DOT11_N_SUPPORT
- if (Status == NDIS_STATUS_SUCCESS)
- SetCommonHT(pAd);
-#endif // DOT11_N_SUPPORT //
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_NETWORK_TYPE_IN_USE (=%d)\n",NetType));
- }
- break;
- // For WPA PSK PMK key
- case RT_OID_802_11_ADD_WPA:
- pKey = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG);
- if(pKey == NULL)
- {
- Status = -ENOMEM;
- break;
- }
-
- Status = copy_from_user(pKey, wrq->u.data.pointer, wrq->u.data.length);
- if (pKey->Length != wrq->u.data.length)
- {
- Status = -EINVAL;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_ADD_WPA, Failed!!\n"));
- }
- else
- {
- if ((pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPAPSK) &&
- (pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPA2PSK) &&
- (pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPANone) )
- {
- Status = -EOPNOTSUPP;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_ADD_WPA, Failed!! [AuthMode != WPAPSK/WPA2PSK/WPANONE]\n"));
- }
- else if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) ||
- (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) ||
- (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) ) // Only for WPA PSK mode
- {
- NdisMoveMemory(pAd->StaCfg.PMK, &pKey->KeyMaterial, pKey->KeyLength);
- // Use RaConfig as PSK agent.
- // Start STA supplicant state machine
- if (pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPANone)
- pAd->StaCfg.WpaState = SS_START;
-
- DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_ADD_WPA (id=0x%x, Len=%d-byte)\n", pKey->KeyIndex, pKey->KeyLength));
- }
- else
- {
- pAd->StaCfg.WpaState = SS_NOTUSE;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_ADD_WPA (id=0x%x, Len=%d-byte)\n", pKey->KeyIndex, pKey->KeyLength));
- }
- }
- kfree(pKey);
- break;
- case OID_802_11_REMOVE_KEY:
- pRemoveKey = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG);
- if(pRemoveKey == NULL)
- {
- Status = -ENOMEM;
- break;
- }
-
- Status = copy_from_user(pRemoveKey, wrq->u.data.pointer, wrq->u.data.length);
- if (pRemoveKey->Length != wrq->u.data.length)
- {
- Status = -EINVAL;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_KEY, Failed!!\n"));
- }
- else
- {
- if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA)
- {
- RTMPWPARemoveKeyProc(pAd, pRemoveKey);
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_KEY, Remove WPA Key!!\n"));
- }
- else
- {
- KeyIdx = pRemoveKey->KeyIndex;
-
- if (KeyIdx & 0x80000000)
- {
- // Should never set default bit when remove key
- Status = -EINVAL;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_KEY, Failed!!(Should never set default bit when remove key)\n"));
- }
- else
- {
- KeyIdx = KeyIdx & 0x0fffffff;
- if (KeyIdx > 3)
- {
- Status = -EINVAL;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_KEY, Failed!!(KeyId[%d] out of range)\n", KeyIdx));
- }
- else
- {
- pAd->SharedKey[BSS0][KeyIdx].KeyLen = 0;
- pAd->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_NONE;
- AsicRemoveSharedKeyEntry(pAd, 0, (UCHAR)KeyIdx);
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_KEY (id=0x%x, Len=%d-byte)\n", pRemoveKey->KeyIndex, pRemoveKey->Length));
- }
- }
- }
- }
- kfree(pRemoveKey);
- break;
- // New for WPA
- case OID_802_11_ADD_KEY:
- pKey = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG);
- if(pKey == NULL)
- {
- Status = -ENOMEM;
- break;
- }
- Status = copy_from_user(pKey, wrq->u.data.pointer, wrq->u.data.length);
- if (pKey->Length != wrq->u.data.length)
- {
- Status = -EINVAL;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_KEY, Failed!!\n"));
- }
- else
- {
- RTMPAddKey(pAd, pKey);
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_KEY (id=0x%x, Len=%d-byte)\n", pKey->KeyIndex, pKey->KeyLength));
- }
- kfree(pKey);
- break;
- case OID_802_11_CONFIGURATION:
- if (wrq->u.data.length != sizeof(NDIS_802_11_CONFIGURATION))
- Status = -EINVAL;
- else
- {
- Status = copy_from_user(&Config, wrq->u.data.pointer, wrq->u.data.length);
- pConfig = &Config;
-
- if ((pConfig->BeaconPeriod >= 20) && (pConfig->BeaconPeriod <=400))
- pAd->CommonCfg.BeaconPeriod = (USHORT) pConfig->BeaconPeriod;
-
- pAd->StaActive.AtimWin = (USHORT) pConfig->ATIMWindow;
- MAP_KHZ_TO_CHANNEL_ID(pConfig->DSConfig, pAd->CommonCfg.Channel);
- //
- // Save the channel on MlmeAux for CntlOidRTBssidProc used.
- //
- pAd->MlmeAux.Channel = pAd->CommonCfg.Channel;
-
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_CONFIGURATION (BeacnPeriod=%ld,AtimW=%ld,Ch=%d)\n",
- pConfig->BeaconPeriod, pConfig->ATIMWindow, pAd->CommonCfg.Channel));
- // Config has changed
- pAd->bConfigChanged = TRUE;
- }
- break;
-#ifdef DOT11_N_SUPPORT
- case RT_OID_802_11_SET_HT_PHYMODE:
- if (wrq->u.data.length != sizeof(OID_SET_HT_PHYMODE))
- Status = -EINVAL;
- else
- {
- POID_SET_HT_PHYMODE pHTPhyMode = &HT_PhyMode;
-
- Status = copy_from_user(&HT_PhyMode, wrq->u.data.pointer, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Set::pHTPhyMode (PhyMode = %d,TransmitNo = %d, HtMode = %d, ExtOffset = %d , MCS = %d, BW = %d, STBC = %d, SHORTGI = %d) \n",
- pHTPhyMode->PhyMode, pHTPhyMode->TransmitNo,pHTPhyMode->HtMode,pHTPhyMode->ExtOffset,
- pHTPhyMode->MCS, pHTPhyMode->BW, pHTPhyMode->STBC, pHTPhyMode->SHORTGI));
- if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)
- RTMPSetHT(pAd, pHTPhyMode);
- }
- DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_SET_HT_PHYMODE(MCS=%d,BW=%d,SGI=%d,STBC=%d)\n",
- pAd->StaCfg.HTPhyMode.field.MCS, pAd->StaCfg.HTPhyMode.field.BW, pAd->StaCfg.HTPhyMode.field.ShortGI,
- pAd->StaCfg.HTPhyMode.field.STBC));
- break;
-#endif // DOT11_N_SUPPORT //
- case RT_OID_802_11_SET_APSD_SETTING:
- if (wrq->u.data.length != sizeof(ULONG))
- Status = -EINVAL;
- else
- {
- ULONG apsd ;
- Status = copy_from_user(&apsd, wrq->u.data.pointer, wrq->u.data.length);
-
- /*-------------------------------------------------------------------
- |B31~B7 | B6~B5 | B4 | B3 | B2 | B1 | B0 |
- ---------------------------------------------------------------------
- | Rsvd | Max SP Len | AC_VO | AC_VI | AC_BK | AC_BE | APSD Capable |
- ---------------------------------------------------------------------*/
- pAd->CommonCfg.bAPSDCapable = (apsd & 0x00000001) ? TRUE : FALSE;
- pAd->CommonCfg.bAPSDAC_BE = ((apsd & 0x00000002) >> 1) ? TRUE : FALSE;
- pAd->CommonCfg.bAPSDAC_BK = ((apsd & 0x00000004) >> 2) ? TRUE : FALSE;
- pAd->CommonCfg.bAPSDAC_VI = ((apsd & 0x00000008) >> 3) ? TRUE : FALSE;
- pAd->CommonCfg.bAPSDAC_VO = ((apsd & 0x00000010) >> 4) ? TRUE : FALSE;
- pAd->CommonCfg.MaxSPLength = (UCHAR)((apsd & 0x00000060) >> 5);
-
- DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_SET_APSD_SETTING (apsd=0x%lx, APSDCap=%d, [BE,BK,VI,VO]=[%d/%d/%d/%d], MaxSPLen=%d)\n", apsd, pAd->CommonCfg.bAPSDCapable,
- pAd->CommonCfg.bAPSDAC_BE, pAd->CommonCfg.bAPSDAC_BK, pAd->CommonCfg.bAPSDAC_VI, pAd->CommonCfg.bAPSDAC_VO, pAd->CommonCfg.MaxSPLength));
- }
- break;
-
- case RT_OID_802_11_SET_APSD_PSM:
- if (wrq->u.data.length != sizeof(ULONG))
- Status = -EINVAL;
- else
- {
- // Driver needs to notify AP when PSM changes
- Status = copy_from_user(&pAd->CommonCfg.bAPSDForcePowerSave, wrq->u.data.pointer, wrq->u.data.length);
- if (pAd->CommonCfg.bAPSDForcePowerSave != pAd->StaCfg.Psm)
- {
- RTMP_SET_PSM_BIT(pAd, pAd->CommonCfg.bAPSDForcePowerSave);
- RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, TRUE);
- }
- DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_SET_APSD_PSM (bAPSDForcePowerSave:%d)\n", pAd->CommonCfg.bAPSDForcePowerSave));
- }
- break;
-#ifdef QOS_DLS_SUPPORT
- case RT_OID_802_11_SET_DLS:
- if (wrq->u.data.length != sizeof(ULONG))
- Status = -EINVAL;
- else
- {
- BOOLEAN oldvalue = pAd->CommonCfg.bDLSCapable;
- Status = copy_from_user(&pAd->CommonCfg.bDLSCapable, wrq->u.data.pointer, wrq->u.data.length);
- if (oldvalue && !pAd->CommonCfg.bDLSCapable)
- {
- int i;
- // tear down local dls table entry
- for (i=0; i<MAX_NUM_OF_INIT_DLS_ENTRY; i++)
- {
- if (pAd->StaCfg.DLSEntry[i].Valid && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH))
- {
- pAd->StaCfg.DLSEntry[i].Status = DLS_NONE;
- pAd->StaCfg.DLSEntry[i].Valid = FALSE;
- RTMPSendDLSTearDownFrame(pAd, pAd->StaCfg.DLSEntry[i].MacAddr);
- }
- }
-
- // tear down peer dls table entry
- for (i=MAX_NUM_OF_INIT_DLS_ENTRY; i<MAX_NUM_OF_DLS_ENTRY; i++)
- {
- if (pAd->StaCfg.DLSEntry[i].Valid && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH))
- {
- pAd->StaCfg.DLSEntry[i].Status = DLS_NONE;
- pAd->StaCfg.DLSEntry[i].Valid = FALSE;
- RTMPSendDLSTearDownFrame(pAd, pAd->StaCfg.DLSEntry[i].MacAddr);
- }
- }
- }
-
- DBGPRINT(RT_DEBUG_TRACE,("Set::RT_OID_802_11_SET_DLS (=%d)\n", pAd->CommonCfg.bDLSCapable));
- }
- break;
-
- case RT_OID_802_11_SET_DLS_PARAM:
- if (wrq->u.data.length != sizeof(RT_802_11_DLS_UI))
- Status = -EINVAL;
- else
- {
- RT_802_11_DLS Dls;
-
- NdisZeroMemory(&Dls, sizeof(RT_802_11_DLS));
- RTMPMoveMemory(&Dls, wrq->u.data.pointer, sizeof(RT_802_11_DLS_UI));
- MlmeEnqueue(pAd,
- MLME_CNTL_STATE_MACHINE,
- RT_OID_802_11_SET_DLS_PARAM,
- sizeof(RT_802_11_DLS),
- &Dls);
- DBGPRINT(RT_DEBUG_TRACE,("Set::RT_OID_802_11_SET_DLS_PARAM \n"));
- }
- break;
-#endif // QOS_DLS_SUPPORT //
- case RT_OID_802_11_SET_WMM:
- if (wrq->u.data.length != sizeof(BOOLEAN))
- Status = -EINVAL;
- else
- {
- Status = copy_from_user(&pAd->CommonCfg.bWmmCapable, wrq->u.data.pointer, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_SET_WMM (=%d) \n", pAd->CommonCfg.bWmmCapable));
- }
- break;
-
- case OID_802_11_DISASSOCIATE:
- //
- // Set NdisRadioStateOff to TRUE, instead of called MlmeRadioOff.
- // Later on, NDIS_802_11_BSSID_LIST_EX->NumberOfItems should be 0
- // when query OID_802_11_BSSID_LIST.
- //
- // TRUE: NumberOfItems will set to 0.
- // FALSE: NumberOfItems no change.
- //
- pAd->CommonCfg.NdisRadioStateOff = TRUE;
- // Set to immediately send the media disconnect event
- pAd->MlmeAux.CurrReqIsFromNdis = TRUE;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_DISASSOCIATE \n"));
-
-
- if (INFRA_ON(pAd))
- {
- if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE)
- {
- RTMP_MLME_RESET_STATE_MACHINE(pAd);
- DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n"));
- }
-
- MlmeEnqueue(pAd,
- MLME_CNTL_STATE_MACHINE,
- OID_802_11_DISASSOCIATE,
- 0,
- NULL);
-
- StateMachineTouched = TRUE;
- }
- break;
-
-#ifdef DOT11_N_SUPPORT
- case RT_OID_802_11_SET_IMME_BA_CAP:
- if (wrq->u.data.length != sizeof(OID_BACAP_STRUC))
- Status = -EINVAL;
- else
- {
- OID_BACAP_STRUC Orde ;
- Status = copy_from_user(&Orde, wrq->u.data.pointer, wrq->u.data.length);
- if (Orde.Policy > BA_NOTUSE)
- {
- Status = NDIS_STATUS_INVALID_DATA;
- }
- else if (Orde.Policy == BA_NOTUSE)
- {
- pAd->CommonCfg.BACapability.field.Policy = BA_NOTUSE;
- pAd->CommonCfg.BACapability.field.MpduDensity = Orde.MpduDensity;
- pAd->CommonCfg.DesiredHtPhy.MpduDensity = Orde.MpduDensity;
- pAd->CommonCfg.DesiredHtPhy.AmsduEnable = Orde.AmsduEnable;
- pAd->CommonCfg.DesiredHtPhy.AmsduSize= Orde.AmsduSize;
- pAd->CommonCfg.DesiredHtPhy.MimoPs= Orde.MMPSmode;
- pAd->CommonCfg.BACapability.field.MMPSmode = Orde.MMPSmode;
- // UPdata to HT IE
- pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = Orde.MMPSmode;
- pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = Orde.AmsduSize;
- pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = Orde.MpduDensity;
- }
- else
- {
- pAd->CommonCfg.BACapability.field.AutoBA = Orde.AutoBA;
- pAd->CommonCfg.BACapability.field.Policy = IMMED_BA; // we only support immediate BA.
- pAd->CommonCfg.BACapability.field.MpduDensity = Orde.MpduDensity;
- pAd->CommonCfg.DesiredHtPhy.MpduDensity = Orde.MpduDensity;
- pAd->CommonCfg.DesiredHtPhy.AmsduEnable = Orde.AmsduEnable;
- pAd->CommonCfg.DesiredHtPhy.AmsduSize= Orde.AmsduSize;
- pAd->CommonCfg.DesiredHtPhy.MimoPs = Orde.MMPSmode;
- pAd->CommonCfg.BACapability.field.MMPSmode = Orde.MMPSmode;
-
- // UPdata to HT IE
- pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = Orde.MMPSmode;
- pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = Orde.AmsduSize;
- pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = Orde.MpduDensity;
-
- if (pAd->CommonCfg.BACapability.field.RxBAWinLimit > MAX_RX_REORDERBUF)
- pAd->CommonCfg.BACapability.field.RxBAWinLimit = MAX_RX_REORDERBUF;
-
- }
-
- pAd->CommonCfg.REGBACapability.word = pAd->CommonCfg.BACapability.word;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::(Orde.AutoBA = %d) (Policy=%d)(ReBAWinLimit=%d)(TxBAWinLimit=%d)(AutoMode=%d)\n",Orde.AutoBA, pAd->CommonCfg.BACapability.field.Policy,
- pAd->CommonCfg.BACapability.field.RxBAWinLimit,pAd->CommonCfg.BACapability.field.TxBAWinLimit, pAd->CommonCfg.BACapability.field.AutoBA));
- DBGPRINT(RT_DEBUG_TRACE, ("Set::(MimoPs = %d)(AmsduEnable = %d) (AmsduSize=%d)(MpduDensity=%d)\n",pAd->CommonCfg.DesiredHtPhy.MimoPs, pAd->CommonCfg.DesiredHtPhy.AmsduEnable,
- pAd->CommonCfg.DesiredHtPhy.AmsduSize, pAd->CommonCfg.DesiredHtPhy.MpduDensity));
- }
-
- break;
- case RT_OID_802_11_ADD_IMME_BA:
- DBGPRINT(RT_DEBUG_TRACE, (" Set :: RT_OID_802_11_ADD_IMME_BA \n"));
- if (wrq->u.data.length != sizeof(OID_ADD_BA_ENTRY))
- Status = -EINVAL;
- else
- {
- UCHAR index;
- OID_ADD_BA_ENTRY BA;
- MAC_TABLE_ENTRY *pEntry;
-
- Status = copy_from_user(&BA, wrq->u.data.pointer, wrq->u.data.length);
- if (BA.TID > 15)
- {
- Status = NDIS_STATUS_INVALID_DATA;
- break;
- }
- else
- {
- //BATableInsertEntry
- //As ad-hoc mode, BA pair is not limited to only BSSID. so add via OID.
- index = BA.TID;
- // in ad hoc mode, when adding BA pair, we should insert this entry into MACEntry too
- pEntry = MacTableLookup(pAd, BA.MACAddr);
- if (!pEntry)
- {
- DBGPRINT(RT_DEBUG_TRACE, ("RT_OID_802_11_ADD_IMME_BA. break on no connection.----:%x:%x\n", BA.MACAddr[4], BA.MACAddr[5]));
- break;
- }
- if (BA.IsRecipient == FALSE)
- {
- if (pEntry->bIAmBadAtheros == TRUE)
- pAd->CommonCfg.BACapability.field.RxBAWinLimit = 0x10;
-
- BAOriSessionSetUp(pAd, pEntry, index, 0, 100, TRUE);
- }
- else
- {
- //BATableInsertEntry(pAd, pEntry->Aid, BA.MACAddr, 0, 0xffff, BA.TID, BA.nMSDU, BA.IsRecipient);
- }
-
- DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_ADD_IMME_BA. Rec = %d. Mac = %x:%x:%x:%x:%x:%x . \n",
- BA.IsRecipient, BA.MACAddr[0], BA.MACAddr[1], BA.MACAddr[2], BA.MACAddr[2]
- , BA.MACAddr[4], BA.MACAddr[5]));
- }
- }
- break;
-
- case RT_OID_802_11_TEAR_IMME_BA:
- DBGPRINT(RT_DEBUG_TRACE, ("Set :: RT_OID_802_11_TEAR_IMME_BA \n"));
- if (wrq->u.data.length != sizeof(OID_ADD_BA_ENTRY))
- Status = -EINVAL;
- else
- {
- POID_ADD_BA_ENTRY pBA;
- MAC_TABLE_ENTRY *pEntry;
-
- pBA = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG);
-
- if (pBA == NULL)
- {
- DBGPRINT(RT_DEBUG_TRACE, ("Set :: RT_OID_802_11_TEAR_IMME_BA kmalloc() can't allocate enough memory\n"));
- Status = NDIS_STATUS_FAILURE;
- }
- else
- {
- Status = copy_from_user(pBA, wrq->u.data.pointer, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Set :: RT_OID_802_11_TEAR_IMME_BA(TID=%d, bAllTid=%d)\n", pBA->TID, pBA->bAllTid));
-
- if (!pBA->bAllTid && (pBA->TID > NUM_OF_TID))
- {
- Status = NDIS_STATUS_INVALID_DATA;
- break;
- }
-
- if (pBA->IsRecipient == FALSE)
- {
- pEntry = MacTableLookup(pAd, pBA->MACAddr);
- DBGPRINT(RT_DEBUG_TRACE, (" pBA->IsRecipient == FALSE\n"));
- if (pEntry)
- {
- DBGPRINT(RT_DEBUG_TRACE, (" pBA->pEntry\n"));
- BAOriSessionTearDown(pAd, pEntry->Aid, pBA->TID, FALSE, TRUE);
- }
- else
- DBGPRINT(RT_DEBUG_TRACE, ("Set :: Not found pEntry \n"));
- }
- else
- {
- pEntry = MacTableLookup(pAd, pBA->MACAddr);
- if (pEntry)
- {
- BARecSessionTearDown( pAd, (UCHAR)pEntry->Aid, pBA->TID, TRUE);
- }
- else
- DBGPRINT(RT_DEBUG_TRACE, ("Set :: Not found pEntry \n"));
- }
- kfree(pBA);
- }
- }
- break;
-#endif // DOT11_N_SUPPORT //
-
- // For WPA_SUPPLICANT to set static wep key
- case OID_802_11_ADD_WEP:
- pWepKey = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG);
-
- if(pWepKey == NULL)
- {
- Status = -ENOMEM;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_WEP, Failed!!\n"));
- break;
- }
- Status = copy_from_user(pWepKey, wrq->u.data.pointer, wrq->u.data.length);
- if (Status)
- {
- Status = -EINVAL;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_WEP, Failed (length mismatch)!!\n"));
- }
- else
- {
- KeyIdx = pWepKey->KeyIndex & 0x0fffffff;
- // KeyIdx must be 0 ~ 3
- if (KeyIdx > 4)
- {
- Status = -EINVAL;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_WEP, Failed (KeyIdx must be smaller than 4)!!\n"));
- }
- else
- {
- UCHAR CipherAlg = 0;
- PUCHAR Key;
-
- // set key material and key length
- NdisZeroMemory(pAd->SharedKey[BSS0][KeyIdx].Key, 16);
- pAd->SharedKey[BSS0][KeyIdx].KeyLen = (UCHAR) pWepKey->KeyLength;
- NdisMoveMemory(pAd->SharedKey[BSS0][KeyIdx].Key, &pWepKey->KeyMaterial, pWepKey->KeyLength);
-
- switch(pWepKey->KeyLength)
- {
- case 5:
- CipherAlg = CIPHER_WEP64;
- break;
- case 13:
- CipherAlg = CIPHER_WEP128;
- break;
- default:
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_WEP, only support CIPHER_WEP64(len:5) & CIPHER_WEP128(len:13)!!\n"));
- Status = -EINVAL;
- break;
- }
- pAd->SharedKey[BSS0][KeyIdx].CipherAlg = CipherAlg;
-
- // Default key for tx (shared key)
- if (pWepKey->KeyIndex & 0x80000000)
- {
-#ifdef WPA_SUPPLICANT_SUPPORT
- // set key material and key length
- NdisZeroMemory(pAd->StaCfg.DesireSharedKey[KeyIdx].Key, 16);
- pAd->StaCfg.DesireSharedKey[KeyIdx].KeyLen = (UCHAR) pWepKey->KeyLength;
- NdisMoveMemory(pAd->StaCfg.DesireSharedKey[KeyIdx].Key, &pWepKey->KeyMaterial, pWepKey->KeyLength);
- pAd->StaCfg.DesireSharedKeyId = KeyIdx;
- pAd->StaCfg.DesireSharedKey[KeyIdx].CipherAlg = CipherAlg;
-#endif // WPA_SUPPLICANT_SUPPORT //
- pAd->StaCfg.DefaultKeyId = (UCHAR) KeyIdx;
- }
-
-#ifdef WPA_SUPPLICANT_SUPPORT
- if ((pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) &&
- (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA))
- {
- Key = pWepKey->KeyMaterial;
-
- // Set Group key material to Asic
- AsicAddSharedKeyEntry(pAd, BSS0, KeyIdx, CipherAlg, Key, NULL, NULL);
-
- // Update WCID attribute table and IVEIV table for this group key table
- RTMPAddWcidAttributeEntry(pAd, BSS0, KeyIdx, CipherAlg, NULL);
-
- STA_PORT_SECURED(pAd);
-
- // Indicate Connected for GUI
- pAd->IndicateMediaState = NdisMediaStateConnected;
- }
- else if (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_SECURED)
-#endif // WPA_SUPPLICANT_SUPPORT
- {
- Key = pAd->SharedKey[BSS0][KeyIdx].Key;
-
- // Set key material and cipherAlg to Asic
- AsicAddSharedKeyEntry(pAd, BSS0, KeyIdx, CipherAlg, Key, NULL, NULL);
-
- if (pWepKey->KeyIndex & 0x80000000)
- {
- PMAC_TABLE_ENTRY pEntry = &pAd->MacTab.Content[BSSID_WCID];
- // Assign group key info
- RTMPAddWcidAttributeEntry(pAd, BSS0, KeyIdx, CipherAlg, NULL);
- // Assign pairwise key info
- RTMPAddWcidAttributeEntry(pAd, BSS0, KeyIdx, CipherAlg, pEntry);
- }
- }
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_WEP (id=0x%x, Len=%d-byte), %s\n", pWepKey->KeyIndex, pWepKey->KeyLength, (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_SECURED) ? "Port Secured":"Port NOT Secured"));
- }
- }
- kfree(pWepKey);
- break;
-#ifdef WPA_SUPPLICANT_SUPPORT
- case OID_SET_COUNTERMEASURES:
- if (wrq->u.data.length != sizeof(int))
- Status = -EINVAL;
- else
- {
- int enabled = 0;
- Status = copy_from_user(&enabled, wrq->u.data.pointer, wrq->u.data.length);
- if (enabled == 1)
- pAd->StaCfg.bBlockAssoc = TRUE;
- else
- // WPA MIC error should block association attempt for 60 seconds
- pAd->StaCfg.bBlockAssoc = FALSE;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_SET_COUNTERMEASURES bBlockAssoc=%s\n", pAd->StaCfg.bBlockAssoc ? "TRUE":"FALSE"));
- }
- break;
- case RT_OID_WPA_SUPPLICANT_SUPPORT:
- if (wrq->u.data.length != sizeof(UCHAR))
- Status = -EINVAL;
- else
- {
- Status = copy_from_user(&wpa_supplicant_enable, wrq->u.data.pointer, wrq->u.data.length);
- pAd->StaCfg.WpaSupplicantUP = wpa_supplicant_enable;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_WPA_SUPPLICANT_SUPPORT (=%d)\n", pAd->StaCfg.WpaSupplicantUP));
- }
- break;
- case OID_802_11_DEAUTHENTICATION:
- if (wrq->u.data.length != sizeof(MLME_DEAUTH_REQ_STRUCT))
- Status = -EINVAL;
- else
- {
- MLME_DEAUTH_REQ_STRUCT *pInfo;
- MLME_QUEUE_ELEM *MsgElem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG);
- if (MsgElem == NULL)
- {
- DBGPRINT(RT_DEBUG_ERROR, ("%s():alloc memory failed!\n", __FUNCTION__));
- return -EINVAL;
- }
-
- pInfo = (MLME_DEAUTH_REQ_STRUCT *) MsgElem->Msg;
- Status = copy_from_user(pInfo, wrq->u.data.pointer, wrq->u.data.length);
- MlmeDeauthReqAction(pAd, MsgElem);
- kfree(MsgElem);
-
- if (INFRA_ON(pAd))
- {
- LinkDown(pAd, FALSE);
- pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE;
- }
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_DEAUTHENTICATION (Reason=%d)\n", pInfo->Reason));
- }
- break;
- case OID_802_11_DROP_UNENCRYPTED:
- if (wrq->u.data.length != sizeof(int))
- Status = -EINVAL;
- else
- {
- int enabled = 0;
- Status = copy_from_user(&enabled, wrq->u.data.pointer, wrq->u.data.length);
- if (enabled == 1)
- pAd->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED;
- else
- pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED;
- NdisAcquireSpinLock(&pAd->MacTabLock);
- pAd->MacTab.Content[BSSID_WCID].PortSecured = pAd->StaCfg.PortSecured;
- NdisReleaseSpinLock(&pAd->MacTabLock);
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_DROP_UNENCRYPTED (=%d)\n", enabled));
- }
- break;
- case OID_802_11_SET_IEEE8021X:
- if (wrq->u.data.length != sizeof(BOOLEAN))
- Status = -EINVAL;
- else
- {
- Status = copy_from_user(&IEEE8021xState, wrq->u.data.pointer, wrq->u.data.length);
- pAd->StaCfg.IEEE8021X = IEEE8021xState;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_SET_IEEE8021X (=%d)\n", IEEE8021xState));
- }
- break;
- case OID_802_11_SET_IEEE8021X_REQUIRE_KEY:
- if (wrq->u.data.length != sizeof(BOOLEAN))
- Status = -EINVAL;
- else
- {
- Status = copy_from_user(&IEEE8021x_required_keys, wrq->u.data.pointer, wrq->u.data.length);
- pAd->StaCfg.IEEE8021x_required_keys = IEEE8021x_required_keys;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_SET_IEEE8021X_REQUIRE_KEY (%d)\n", IEEE8021x_required_keys));
- }
- break;
- case OID_802_11_PMKID:
- pPmkId = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG);
-
- if(pPmkId == NULL) {
- Status = -ENOMEM;
- break;
- }
- Status = copy_from_user(pPmkId, wrq->u.data.pointer, wrq->u.data.length);
-
- // check the PMKID information
- if (pPmkId->BSSIDInfoCount == 0)
- NdisZeroMemory(pAd->StaCfg.SavedPMK, sizeof(BSSID_INFO)*PMKID_NO);
- else
- {
- PBSSID_INFO pBssIdInfo;
- UINT BssIdx;
- UINT CachedIdx;
-
- for (BssIdx = 0; BssIdx < pPmkId->BSSIDInfoCount; BssIdx++)
- {
- // point to the indexed BSSID_INFO structure
- pBssIdInfo = (PBSSID_INFO) ((PUCHAR) pPmkId + 2 * sizeof(UINT) + BssIdx * sizeof(BSSID_INFO));
- // Find the entry in the saved data base.
- for (CachedIdx = 0; CachedIdx < pAd->StaCfg.SavedPMKNum; CachedIdx++)
- {
- // compare the BSSID
- if (NdisEqualMemory(pBssIdInfo->BSSID, pAd->StaCfg.SavedPMK[CachedIdx].BSSID, sizeof(NDIS_802_11_MAC_ADDRESS)))
- break;
- }
-
- // Found, replace it
- if (CachedIdx < PMKID_NO)
- {
- DBGPRINT(RT_DEBUG_OFF, ("Update OID_802_11_PMKID, idx = %d\n", CachedIdx));
- NdisMoveMemory(&pAd->StaCfg.SavedPMK[CachedIdx], pBssIdInfo, sizeof(BSSID_INFO));
- pAd->StaCfg.SavedPMKNum++;
- }
- // Not found, replace the last one
- else
- {
- // Randomly replace one
- CachedIdx = (pBssIdInfo->BSSID[5] % PMKID_NO);
- DBGPRINT(RT_DEBUG_OFF, ("Update OID_802_11_PMKID, idx = %d\n", CachedIdx));
- NdisMoveMemory(&pAd->StaCfg.SavedPMK[CachedIdx], pBssIdInfo, sizeof(BSSID_INFO));
- }
- }
- }
- if(pPmkId)
- kfree(pPmkId);
- break;
-#endif // WPA_SUPPLICANT_SUPPORT //
-
-
-
-#ifdef SNMP_SUPPORT
- case OID_802_11_SHORTRETRYLIMIT:
- if (wrq->u.data.length != sizeof(ULONG))
- Status = -EINVAL;
- else
- {
- Status = copy_from_user(&ShortRetryLimit, wrq->u.data.pointer, wrq->u.data.length);
- RTMP_IO_READ32(pAd, TX_RTY_CFG, &tx_rty_cfg.word);
- tx_rty_cfg.field.ShortRtyLimit = ShortRetryLimit;
- RTMP_IO_WRITE32(pAd, TX_RTY_CFG, tx_rty_cfg.word);
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_SHORTRETRYLIMIT (tx_rty_cfg.field.ShortRetryLimit=%d, ShortRetryLimit=%ld)\n", tx_rty_cfg.field.ShortRtyLimit, ShortRetryLimit));
- }
- break;
-
- case OID_802_11_LONGRETRYLIMIT:
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_LONGRETRYLIMIT \n"));
- if (wrq->u.data.length != sizeof(ULONG))
- Status = -EINVAL;
- else
- {
- Status = copy_from_user(&LongRetryLimit, wrq->u.data.pointer, wrq->u.data.length);
- RTMP_IO_READ32(pAd, TX_RTY_CFG, &tx_rty_cfg.word);
- tx_rty_cfg.field.LongRtyLimit = LongRetryLimit;
- RTMP_IO_WRITE32(pAd, TX_RTY_CFG, tx_rty_cfg.word);
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_LONGRETRYLIMIT (tx_rty_cfg.field.LongRetryLimit= %d,LongRetryLimit=%ld)\n", tx_rty_cfg.field.LongRtyLimit, LongRetryLimit));
- }
- break;
-
- case OID_802_11_WEPDEFAULTKEYVALUE:
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_WEPDEFAULTKEYVALUE\n"));
- pKey = kmalloc(wrq->u.data.length, GFP_KERNEL);
- Status = copy_from_user(pKey, wrq->u.data.pointer, wrq->u.data.length);
- //pKey = &WepKey;
-
- if ( pKey->Length != wrq->u.data.length)
- {
- Status = -EINVAL;
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_WEPDEFAULTKEYVALUE, Failed!!\n"));
- }
- KeyIdx = pKey->KeyIndex & 0x0fffffff;
- DBGPRINT(RT_DEBUG_TRACE,("pKey->KeyIndex =%d, pKey->KeyLength=%d\n", pKey->KeyIndex, pKey->KeyLength));
-
- // it is a shared key
- if (KeyIdx > 4)
- Status = -EINVAL;
- else
- {
- pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].KeyLen = (UCHAR) pKey->KeyLength;
- NdisMoveMemory(&pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].Key, &pKey->KeyMaterial, pKey->KeyLength);
- if (pKey->KeyIndex & 0x80000000)
- {
- // Default key for tx (shared key)
- pAd->StaCfg.DefaultKeyId = (UCHAR) KeyIdx;
- }
- //RestartAPIsRequired = TRUE;
- }
- break;
-
-
- case OID_802_11_WEPDEFAULTKEYID:
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_WEPDEFAULTKEYID \n"));
-
- if (wrq->u.data.length != sizeof(UCHAR))
- Status = -EINVAL;
- else
- Status = copy_from_user(&pAd->StaCfg.DefaultKeyId, wrq->u.data.pointer, wrq->u.data.length);
-
- break;
-
-
- case OID_802_11_CURRENTCHANNEL:
- DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_CURRENTCHANNEL \n"));
- if (wrq->u.data.length != sizeof(UCHAR))
- Status = -EINVAL;
- else
- {
- Status = copy_from_user(&ctmp, wrq->u.data.pointer, wrq->u.data.length);
- sprintf((PSTRING)&ctmp,"%d", ctmp);
- Set_Channel_Proc(pAd, (PSTRING)&ctmp);
- }
- break;
-#endif
-
-
-
- case RT_OID_802_11_SET_PSPXLINK_MODE:
- if (wrq->u.data.length != sizeof(BOOLEAN))
- Status = -EINVAL;
- else
- {
- Status = copy_from_user(&pAd->CommonCfg.PSPXlink, wrq->u.data.pointer, wrq->u.data.length);
- /*if (pAd->CommonCfg.PSPXlink)
- RX_FILTER_SET_FLAG(pAd, fRX_FILTER_ACCEPT_PROMISCUOUS)*/
- DBGPRINT(RT_DEBUG_TRACE,("Set::RT_OID_802_11_SET_PSPXLINK_MODE(=%d) \n", pAd->CommonCfg.PSPXlink));
- }
- break;
-
-
- default:
- DBGPRINT(RT_DEBUG_TRACE, ("Set::unknown IOCTL's subcmd = 0x%08x\n", cmd));
- Status = -EOPNOTSUPP;
- break;
- }
-
-
- return Status;
-}
-
-INT RTMPQueryInformation(
- IN PRTMP_ADAPTER pAd,
- IN OUT struct ifreq *rq,
- IN INT cmd)
-{
- struct iwreq *wrq = (struct iwreq *) rq;
- NDIS_802_11_BSSID_LIST_EX *pBssidList = NULL;
- PNDIS_WLAN_BSSID_EX pBss;
- NDIS_802_11_SSID Ssid;
- NDIS_802_11_CONFIGURATION *pConfiguration = NULL;
- RT_802_11_LINK_STATUS *pLinkStatus = NULL;
- RT_802_11_STA_CONFIG *pStaConfig = NULL;
- NDIS_802_11_STATISTICS *pStatistics = NULL;
- NDIS_802_11_RTS_THRESHOLD RtsThresh;
- NDIS_802_11_FRAGMENTATION_THRESHOLD FragThresh;
- NDIS_802_11_POWER_MODE PowerMode;
- NDIS_802_11_NETWORK_INFRASTRUCTURE BssType;
- RT_802_11_PREAMBLE PreamType;
- NDIS_802_11_AUTHENTICATION_MODE AuthMode;
- NDIS_802_11_WEP_STATUS WepStatus;
- NDIS_MEDIA_STATE MediaState;
- ULONG BssBufSize, ulInfo=0, NetworkTypeList[4], apsd = 0;
- USHORT BssLen = 0;
- PUCHAR pBuf = NULL, pPtr;
- INT Status = NDIS_STATUS_SUCCESS;
- UINT we_version_compiled;
- UCHAR i, Padding = 0;
- BOOLEAN RadioState;
- STRING driverVersion[8];
- OID_SET_HT_PHYMODE *pHTPhyMode = NULL;
-
-
-#ifdef SNMP_SUPPORT
- //for snmp, kathy
- DefaultKeyIdxValue *pKeyIdxValue;
- INT valueLen;
- TX_RTY_CFG_STRUC tx_rty_cfg;
- ULONG ShortRetryLimit, LongRetryLimit;
- UCHAR tmp[64];
-#endif //SNMP
-
- switch(cmd)
- {
- case RT_OID_DEVICE_NAME:
- wrq->u.data.length = sizeof(pAd->nickname);
- Status = copy_to_user(wrq->u.data.pointer, pAd->nickname, wrq->u.data.length);
- break;
- case RT_OID_VERSION_INFO:
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_VERSION_INFO \n"));
- wrq->u.data.length = 8*sizeof(CHAR);
- sprintf(&driverVersion[0], "%s", STA_DRIVER_VERSION);
- driverVersion[7] = '\0';
- if (copy_to_user(wrq->u.data.pointer, &driverVersion[0], wrq->u.data.length))
- {
- Status = -EFAULT;
- }
- break;
-
- case OID_802_11_BSSID_LIST:
- if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS))
- {
- /*
- * Still scanning, indicate the caller should try again.
- */
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_BSSID_LIST (Still scanning)\n"));
- return -EAGAIN;
- }
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_BSSID_LIST (%d BSS returned)\n",pAd->ScanTab.BssNr));
- pAd->StaCfg.bScanReqIsFromWebUI = FALSE;
- // Claculate total buffer size required
- BssBufSize = sizeof(ULONG);
-
- for (i = 0; i < pAd->ScanTab.BssNr; i++)
- {
- // Align pointer to 4 bytes boundary.
- //Padding = 4 - (pAdapter->ScanTab.BssEntry[i].VarIELen & 0x0003);
- //if (Padding == 4)
- // Padding = 0;
- BssBufSize += (sizeof(NDIS_WLAN_BSSID_EX) - 1 + sizeof(NDIS_802_11_FIXED_IEs) + pAd->ScanTab.BssEntry[i].VarIELen + Padding);
- }
-
- // For safety issue, we add 256 bytes just in case
- BssBufSize += 256;
- // Allocate the same size as passed from higher layer
- pBuf = kmalloc(BssBufSize, MEM_ALLOC_FLAG);
- if(pBuf == NULL)
- {
- Status = -ENOMEM;
- break;
- }
- // Init 802_11_BSSID_LIST_EX structure
- NdisZeroMemory(pBuf, BssBufSize);
- pBssidList = (PNDIS_802_11_BSSID_LIST_EX) pBuf;
- pBssidList->NumberOfItems = pAd->ScanTab.BssNr;
-
- // Calculate total buffer length
- BssLen = 4; // Consist of NumberOfItems
- // Point to start of NDIS_WLAN_BSSID_EX
- // pPtr = pBuf + sizeof(ULONG);
- pPtr = (PUCHAR) &pBssidList->Bssid[0];
- for (i = 0; i < pAd->ScanTab.BssNr; i++)
- {
- pBss = (PNDIS_WLAN_BSSID_EX) pPtr;
- NdisMoveMemory(&pBss->MacAddress, &pAd->ScanTab.BssEntry[i].Bssid, MAC_ADDR_LEN);
- if ((pAd->ScanTab.BssEntry[i].Hidden == 1) && (pAd->StaCfg.bShowHiddenSSID == FALSE))
- {
- //
- // We must return this SSID during 4way handshaking, otherwise Aegis will failed to parse WPA infomation
- // and then failed to send EAPOl farame.
- //
- if ((pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) && (pAd->StaCfg.PortSecured != WPA_802_1X_PORT_SECURED))
- {
- pBss->Ssid.SsidLength = pAd->ScanTab.BssEntry[i].SsidLen;
- NdisMoveMemory(pBss->Ssid.Ssid, pAd->ScanTab.BssEntry[i].Ssid, pAd->ScanTab.BssEntry[i].SsidLen);
- }
- else
- pBss->Ssid.SsidLength = 0;
- }
- else
- {
- pBss->Ssid.SsidLength = pAd->ScanTab.BssEntry[i].SsidLen;
- NdisMoveMemory(pBss->Ssid.Ssid, pAd->ScanTab.BssEntry[i].Ssid, pAd->ScanTab.BssEntry[i].SsidLen);
- }
- pBss->Privacy = pAd->ScanTab.BssEntry[i].Privacy;
- pBss->Rssi = pAd->ScanTab.BssEntry[i].Rssi - pAd->BbpRssiToDbmDelta;
- pBss->NetworkTypeInUse = NetworkTypeInUseSanity(&pAd->ScanTab.BssEntry[i]);
- pBss->Configuration.Length = sizeof(NDIS_802_11_CONFIGURATION);
- pBss->Configuration.BeaconPeriod = pAd->ScanTab.BssEntry[i].BeaconPeriod;
- pBss->Configuration.ATIMWindow = pAd->ScanTab.BssEntry[i].AtimWin;
-
- MAP_CHANNEL_ID_TO_KHZ(pAd->ScanTab.BssEntry[i].Channel, pBss->Configuration.DSConfig);
-
- if (pAd->ScanTab.BssEntry[i].BssType == BSS_INFRA)
- pBss->InfrastructureMode = Ndis802_11Infrastructure;
- else
- pBss->InfrastructureMode = Ndis802_11IBSS;
-
- NdisMoveMemory(pBss->SupportedRates, pAd->ScanTab.BssEntry[i].SupRate, pAd->ScanTab.BssEntry[i].SupRateLen);
- NdisMoveMemory(pBss->SupportedRates + pAd->ScanTab.BssEntry[i].SupRateLen,
- pAd->ScanTab.BssEntry[i].ExtRate,
- pAd->ScanTab.BssEntry[i].ExtRateLen);
-
- if (pAd->ScanTab.BssEntry[i].VarIELen == 0)
- {
- pBss->IELength = sizeof(NDIS_802_11_FIXED_IEs);
- NdisMoveMemory(pBss->IEs, &pAd->ScanTab.BssEntry[i].FixIEs, sizeof(NDIS_802_11_FIXED_IEs));
- pPtr = pPtr + sizeof(NDIS_WLAN_BSSID_EX) - 1 + sizeof(NDIS_802_11_FIXED_IEs);
- }
- else
- {
- pBss->IELength = (ULONG)(sizeof(NDIS_802_11_FIXED_IEs) + pAd->ScanTab.BssEntry[i].VarIELen);
- pPtr = pPtr + sizeof(NDIS_WLAN_BSSID_EX) - 1 + sizeof(NDIS_802_11_FIXED_IEs);
- NdisMoveMemory(pBss->IEs, &pAd->ScanTab.BssEntry[i].FixIEs, sizeof(NDIS_802_11_FIXED_IEs));
- NdisMoveMemory(pBss->IEs + sizeof(NDIS_802_11_FIXED_IEs), pAd->ScanTab.BssEntry[i].VarIEs, pAd->ScanTab.BssEntry[i].VarIELen);
- pPtr += pAd->ScanTab.BssEntry[i].VarIELen;
- }
- pBss->Length = (ULONG)(sizeof(NDIS_WLAN_BSSID_EX) - 1 + sizeof(NDIS_802_11_FIXED_IEs) + pAd->ScanTab.BssEntry[i].VarIELen + Padding);
-
-#if WIRELESS_EXT < 17
- if ((BssLen + pBss->Length) < wrq->u.data.length)
- BssLen += pBss->Length;
- else
- {
- pBssidList->NumberOfItems = i;
- break;
- }
-#else
- BssLen += pBss->Length;
-#endif
- }
-
-#if WIRELESS_EXT < 17
- wrq->u.data.length = BssLen;
-#else
- if (BssLen > wrq->u.data.length)
- {
- kfree(pBssidList);
- return -E2BIG;
- }
- else
- wrq->u.data.length = BssLen;
-#endif
- Status = copy_to_user(wrq->u.data.pointer, pBssidList, BssLen);
- kfree(pBssidList);
- break;
- case OID_802_3_CURRENT_ADDRESS:
- wrq->u.data.length = MAC_ADDR_LEN;
- Status = copy_to_user(wrq->u.data.pointer, &pAd->CurrentAddress, wrq->u.data.length);
- break;
- case OID_GEN_MEDIA_CONNECT_STATUS:
- if (pAd->IndicateMediaState == NdisMediaStateConnected)
- MediaState = NdisMediaStateConnected;
- else
- MediaState = NdisMediaStateDisconnected;
-
- wrq->u.data.length = sizeof(NDIS_MEDIA_STATE);
- Status = copy_to_user(wrq->u.data.pointer, &MediaState, wrq->u.data.length);
- break;
- case OID_802_11_BSSID:
- if (INFRA_ON(pAd) || ADHOC_ON(pAd))
- {
- Status = copy_to_user(wrq->u.data.pointer, &pAd->CommonCfg.Bssid, sizeof(NDIS_802_11_MAC_ADDRESS));
-
- }
- else
- {
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_BSSID(=EMPTY)\n"));
- Status = -ENOTCONN;
- }
- break;
- case OID_802_11_SSID:
- NdisZeroMemory(&Ssid, sizeof(NDIS_802_11_SSID));
- NdisZeroMemory(Ssid.Ssid, MAX_LEN_OF_SSID);
- Ssid.SsidLength = pAd->CommonCfg.SsidLen;
- memcpy(Ssid.Ssid, pAd->CommonCfg.Ssid, Ssid.SsidLength);
- wrq->u.data.length = sizeof(NDIS_802_11_SSID);
- Status = copy_to_user(wrq->u.data.pointer, &Ssid, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_SSID (Len=%d, ssid=%s)\n", Ssid.SsidLength,Ssid.Ssid));
- break;
- case RT_OID_802_11_QUERY_LINK_STATUS:
- pLinkStatus = (RT_802_11_LINK_STATUS *) kmalloc(sizeof(RT_802_11_LINK_STATUS), MEM_ALLOC_FLAG);
- if (pLinkStatus)
- {
- pLinkStatus->CurrTxRate = RateIdTo500Kbps[pAd->CommonCfg.TxRate]; // unit : 500 kbps
- pLinkStatus->ChannelQuality = pAd->Mlme.ChannelQuality;
- pLinkStatus->RxByteCount = pAd->RalinkCounters.ReceivedByteCount;
- pLinkStatus->TxByteCount = pAd->RalinkCounters.TransmittedByteCount;
- pLinkStatus->CentralChannel = pAd->CommonCfg.CentralChannel;
- wrq->u.data.length = sizeof(RT_802_11_LINK_STATUS);
- Status = copy_to_user(wrq->u.data.pointer, pLinkStatus, wrq->u.data.length);
- kfree(pLinkStatus);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_LINK_STATUS\n"));
- }
- else
- {
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_LINK_STATUS(kmalloc failed)\n"));
- Status = -EFAULT;
- }
- break;
- case OID_802_11_CONFIGURATION:
- pConfiguration = (NDIS_802_11_CONFIGURATION *) kmalloc(sizeof(NDIS_802_11_CONFIGURATION), MEM_ALLOC_FLAG);
- if (pConfiguration)
- {
- pConfiguration->Length = sizeof(NDIS_802_11_CONFIGURATION);
- pConfiguration->BeaconPeriod = pAd->CommonCfg.BeaconPeriod;
- pConfiguration->ATIMWindow = pAd->StaActive.AtimWin;
- MAP_CHANNEL_ID_TO_KHZ(pAd->CommonCfg.Channel, pConfiguration->DSConfig);
- wrq->u.data.length = sizeof(NDIS_802_11_CONFIGURATION);
- Status = copy_to_user(wrq->u.data.pointer, pConfiguration, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_CONFIGURATION(BeaconPeriod=%ld,AtimW=%ld,Channel=%d) \n",
- pConfiguration->BeaconPeriod, pConfiguration->ATIMWindow, pAd->CommonCfg.Channel));
- kfree(pConfiguration);
- }
- else
- {
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_CONFIGURATION(kmalloc failed)\n"));
- Status = -EFAULT;
- }
- break;
- case RT_OID_802_11_SNR_0:
- if ((pAd->StaCfg.LastSNR0 > 0))
- {
- ulInfo = ((0xeb - pAd->StaCfg.LastSNR0) * 3) / 16 ;
- wrq->u.data.length = sizeof(ulInfo);
- Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_SNR_0(0x=%lx)\n", ulInfo));
- }
- else
- Status = -EFAULT;
- break;
- case RT_OID_802_11_SNR_1:
- if ((pAd->Antenna.field.RxPath > 1) &&
- (pAd->StaCfg.LastSNR1 > 0))
- {
- ulInfo = ((0xeb - pAd->StaCfg.LastSNR1) * 3) / 16 ;
- wrq->u.data.length = sizeof(ulInfo);
- Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE,("Query::RT_OID_802_11_SNR_1(0x=%lx)\n",ulInfo));
- }
- else
- Status = -EFAULT;
- DBGPRINT(RT_DEBUG_TRACE,("Query::RT_OID_802_11_SNR_1(pAd->StaCfg.LastSNR1=%d)\n",pAd->StaCfg.LastSNR1));
- break;
- case OID_802_11_RSSI_TRIGGER:
- ulInfo = pAd->StaCfg.RssiSample.LastRssi0 - pAd->BbpRssiToDbmDelta;
- wrq->u.data.length = sizeof(ulInfo);
- Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_RSSI_TRIGGER(=%ld)\n", ulInfo));
- break;
- case OID_802_11_RSSI:
- case RT_OID_802_11_RSSI:
- ulInfo = pAd->StaCfg.RssiSample.LastRssi0;
- wrq->u.data.length = sizeof(ulInfo);
- Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length);
- break;
- case RT_OID_802_11_RSSI_1:
- ulInfo = pAd->StaCfg.RssiSample.LastRssi1;
- wrq->u.data.length = sizeof(ulInfo);
- Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length);
- break;
- case RT_OID_802_11_RSSI_2:
- ulInfo = pAd->StaCfg.RssiSample.LastRssi2;
- wrq->u.data.length = sizeof(ulInfo);
- Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length);
- break;
- case OID_802_11_STATISTICS:
- pStatistics = (NDIS_802_11_STATISTICS *) kmalloc(sizeof(NDIS_802_11_STATISTICS), MEM_ALLOC_FLAG);
- if (pStatistics)
- {
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_STATISTICS \n"));
- // add the most up-to-date h/w raw counters into software counters
- NICUpdateRawCounters(pAd);
-
- // Sanity check for calculation of sucessful count
- if (pAd->WlanCounters.TransmittedFragmentCount.QuadPart < pAd->WlanCounters.RetryCount.QuadPart)
- pAd->WlanCounters.TransmittedFragmentCount.QuadPart = pAd->WlanCounters.RetryCount.QuadPart;
-
- pStatistics->TransmittedFragmentCount.QuadPart = pAd->WlanCounters.TransmittedFragmentCount.QuadPart;
- pStatistics->MulticastTransmittedFrameCount.QuadPart = pAd->WlanCounters.MulticastTransmittedFrameCount.QuadPart;
- pStatistics->FailedCount.QuadPart = pAd->WlanCounters.FailedCount.QuadPart;
- pStatistics->RetryCount.QuadPart = pAd->WlanCounters.RetryCount.QuadPart;
- pStatistics->MultipleRetryCount.QuadPart = pAd->WlanCounters.MultipleRetryCount.QuadPart;
- pStatistics->RTSSuccessCount.QuadPart = pAd->WlanCounters.RTSSuccessCount.QuadPart;
- pStatistics->RTSFailureCount.QuadPart = pAd->WlanCounters.RTSFailureCount.QuadPart;
- pStatistics->ACKFailureCount.QuadPart = pAd->WlanCounters.ACKFailureCount.QuadPart;
- pStatistics->FrameDuplicateCount.QuadPart = pAd->WlanCounters.FrameDuplicateCount.QuadPart;
- pStatistics->ReceivedFragmentCount.QuadPart = pAd->WlanCounters.ReceivedFragmentCount.QuadPart;
- pStatistics->MulticastReceivedFrameCount.QuadPart = pAd->WlanCounters.MulticastReceivedFrameCount.QuadPart;
-#ifdef DBG
- pStatistics->FCSErrorCount = pAd->RalinkCounters.RealFcsErrCount;
-#else
- pStatistics->FCSErrorCount.QuadPart = pAd->WlanCounters.FCSErrorCount.QuadPart;
- pStatistics->FrameDuplicateCount.u.LowPart = pAd->WlanCounters.FrameDuplicateCount.u.LowPart / 100;
-#endif
- wrq->u.data.length = sizeof(NDIS_802_11_STATISTICS);
- Status = copy_to_user(wrq->u.data.pointer, pStatistics, wrq->u.data.length);
- kfree(pStatistics);
- }
- else
- {
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_STATISTICS(kmalloc failed)\n"));
- Status = -EFAULT;
- }
- break;
- case OID_GEN_RCV_OK:
- ulInfo = pAd->Counters8023.GoodReceives;
- wrq->u.data.length = sizeof(ulInfo);
- Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length);
- break;
- case OID_GEN_RCV_NO_BUFFER:
- ulInfo = pAd->Counters8023.RxNoBuffer;
- wrq->u.data.length = sizeof(ulInfo);
- Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length);
- break;
- case RT_OID_802_11_PHY_MODE:
- ulInfo = (ULONG)pAd->CommonCfg.PhyMode;
- wrq->u.data.length = sizeof(ulInfo);
- Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_PHY_MODE (=%ld)\n", ulInfo));
- break;
- case RT_OID_802_11_STA_CONFIG:
- pStaConfig = (RT_802_11_STA_CONFIG *) kmalloc(sizeof(RT_802_11_STA_CONFIG), MEM_ALLOC_FLAG);
- if (pStaConfig)
- {
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_STA_CONFIG\n"));
- pStaConfig->EnableTxBurst = pAd->CommonCfg.bEnableTxBurst;
- pStaConfig->EnableTurboRate = 0;
- pStaConfig->UseBGProtection = pAd->CommonCfg.UseBGProtection;
- pStaConfig->UseShortSlotTime = pAd->CommonCfg.bUseShortSlotTime;
- //pStaConfig->AdhocMode = pAd->StaCfg.AdhocMode;
- pStaConfig->HwRadioStatus = (pAd->StaCfg.bHwRadio == TRUE) ? 1 : 0;
- pStaConfig->Rsv1 = 0;
- pStaConfig->SystemErrorBitmap = pAd->SystemErrorBitmap;
- wrq->u.data.length = sizeof(RT_802_11_STA_CONFIG);
- Status = copy_to_user(wrq->u.data.pointer, pStaConfig, wrq->u.data.length);
- kfree(pStaConfig);
- }
- else
- {
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_STA_CONFIG(kmalloc failed)\n"));
- Status = -EFAULT;
- }
- break;
- case OID_802_11_RTS_THRESHOLD:
- RtsThresh = pAd->CommonCfg.RtsThreshold;
- wrq->u.data.length = sizeof(RtsThresh);
- Status = copy_to_user(wrq->u.data.pointer, &RtsThresh, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_RTS_THRESHOLD(=%ld)\n", RtsThresh));
- break;
- case OID_802_11_FRAGMENTATION_THRESHOLD:
- FragThresh = pAd->CommonCfg.FragmentThreshold;
- if (pAd->CommonCfg.bUseZeroToDisableFragment == TRUE)
- FragThresh = 0;
- wrq->u.data.length = sizeof(FragThresh);
- Status = copy_to_user(wrq->u.data.pointer, &FragThresh, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_FRAGMENTATION_THRESHOLD(=%ld)\n", FragThresh));
- break;
- case OID_802_11_POWER_MODE:
- PowerMode = pAd->StaCfg.WindowsPowerMode;
- wrq->u.data.length = sizeof(PowerMode);
- Status = copy_to_user(wrq->u.data.pointer, &PowerMode, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_POWER_MODE(=%d)\n", PowerMode));
- break;
- case RT_OID_802_11_RADIO:
- RadioState = (BOOLEAN) pAd->StaCfg.bSwRadio;
- wrq->u.data.length = sizeof(RadioState);
- Status = copy_to_user(wrq->u.data.pointer, &RadioState, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_RADIO (=%d)\n", RadioState));
- break;
- case OID_802_11_INFRASTRUCTURE_MODE:
- if (pAd->StaCfg.BssType == BSS_ADHOC)
- BssType = Ndis802_11IBSS;
- else if (pAd->StaCfg.BssType == BSS_INFRA)
- BssType = Ndis802_11Infrastructure;
- else if (pAd->StaCfg.BssType == BSS_MONITOR)
- BssType = Ndis802_11Monitor;
- else
- BssType = Ndis802_11AutoUnknown;
-
- wrq->u.data.length = sizeof(BssType);
- Status = copy_to_user(wrq->u.data.pointer, &BssType, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_INFRASTRUCTURE_MODE(=%d)\n", BssType));
- break;
- case RT_OID_802_11_PREAMBLE:
- PreamType = pAd->CommonCfg.TxPreamble;
- wrq->u.data.length = sizeof(PreamType);
- Status = copy_to_user(wrq->u.data.pointer, &PreamType, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_PREAMBLE(=%d)\n", PreamType));
- break;
- case OID_802_11_AUTHENTICATION_MODE:
- AuthMode = pAd->StaCfg.AuthMode;
- wrq->u.data.length = sizeof(AuthMode);
- Status = copy_to_user(wrq->u.data.pointer, &AuthMode, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_AUTHENTICATION_MODE(=%d)\n", AuthMode));
- break;
- case OID_802_11_WEP_STATUS:
- WepStatus = pAd->StaCfg.WepStatus;
- wrq->u.data.length = sizeof(WepStatus);
- Status = copy_to_user(wrq->u.data.pointer, &WepStatus, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_WEP_STATUS(=%d)\n", WepStatus));
- break;
- case OID_802_11_TX_POWER_LEVEL:
- wrq->u.data.length = sizeof(ULONG);
- Status = copy_to_user(wrq->u.data.pointer, &pAd->CommonCfg.TxPower, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_TX_POWER_LEVEL %x\n",pAd->CommonCfg.TxPower));
- break;
- case RT_OID_802_11_TX_POWER_LEVEL_1:
- wrq->u.data.length = sizeof(ULONG);
- Status = copy_to_user(wrq->u.data.pointer, &pAd->CommonCfg.TxPowerPercentage, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_TX_POWER_LEVEL_1 (=%ld)\n", pAd->CommonCfg.TxPowerPercentage));
- break;
- case OID_802_11_NETWORK_TYPES_SUPPORTED:
- if ((pAd->RfIcType == RFIC_2850) || (pAd->RfIcType == RFIC_2750) || (pAd->RfIcType == RFIC_3052))
- {
- NetworkTypeList[0] = 3; // NumberOfItems = 3
- NetworkTypeList[1] = Ndis802_11DS; // NetworkType[1] = 11b
- NetworkTypeList[2] = Ndis802_11OFDM24; // NetworkType[2] = 11g
- NetworkTypeList[3] = Ndis802_11OFDM5; // NetworkType[3] = 11a
- wrq->u.data.length = 16;
- Status = copy_to_user(wrq->u.data.pointer, &NetworkTypeList[0], wrq->u.data.length);
- }
- else
- {
- NetworkTypeList[0] = 2; // NumberOfItems = 2
- NetworkTypeList[1] = Ndis802_11DS; // NetworkType[1] = 11b
- NetworkTypeList[2] = Ndis802_11OFDM24; // NetworkType[2] = 11g
- wrq->u.data.length = 12;
- Status = copy_to_user(wrq->u.data.pointer, &NetworkTypeList[0], wrq->u.data.length);
- }
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_NETWORK_TYPES_SUPPORTED\n"));
- break;
- case OID_802_11_NETWORK_TYPE_IN_USE:
- wrq->u.data.length = sizeof(ULONG);
- if (pAd->CommonCfg.PhyMode == PHY_11A)
- ulInfo = Ndis802_11OFDM5;
- else if ((pAd->CommonCfg.PhyMode == PHY_11BG_MIXED) || (pAd->CommonCfg.PhyMode == PHY_11G))
- ulInfo = Ndis802_11OFDM24;
- else
- ulInfo = Ndis802_11DS;
- Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length);
- break;
- case RT_OID_802_11_QUERY_LAST_RX_RATE:
- ulInfo = (ULONG)pAd->LastRxRate;
- wrq->u.data.length = sizeof(ulInfo);
- Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_LAST_RX_RATE (=%ld)\n", ulInfo));
- break;
- case RT_OID_802_11_QUERY_LAST_TX_RATE:
- //ulInfo = (ULONG)pAd->LastTxRate;
- ulInfo = (ULONG)pAd->MacTab.Content[BSSID_WCID].HTPhyMode.word;
- wrq->u.data.length = sizeof(ulInfo);
- Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_LAST_TX_RATE (=%lx)\n", ulInfo));
- break;
- case RT_OID_802_11_QUERY_EEPROM_VERSION:
- wrq->u.data.length = sizeof(ULONG);
- Status = copy_to_user(wrq->u.data.pointer, &pAd->EepromVersion, wrq->u.data.length);
- break;
- case RT_OID_802_11_QUERY_FIRMWARE_VERSION:
- wrq->u.data.length = sizeof(ULONG);
- Status = copy_to_user(wrq->u.data.pointer, &pAd->FirmwareVersion, wrq->u.data.length);
- break;
- case RT_OID_802_11_QUERY_NOISE_LEVEL:
- wrq->u.data.length = sizeof(UCHAR);
- Status = copy_to_user(wrq->u.data.pointer, &pAd->BbpWriteLatch[66], wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_NOISE_LEVEL (=%d)\n", pAd->BbpWriteLatch[66]));
- break;
- case RT_OID_802_11_EXTRA_INFO:
- wrq->u.data.length = sizeof(ULONG);
- Status = copy_to_user(wrq->u.data.pointer, &pAd->ExtraInfo, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_EXTRA_INFO (=%ld)\n", pAd->ExtraInfo));
- break;
- case RT_OID_WE_VERSION_COMPILED:
- wrq->u.data.length = sizeof(UINT);
- we_version_compiled = WIRELESS_EXT;
- Status = copy_to_user(wrq->u.data.pointer, &we_version_compiled, wrq->u.data.length);
- break;
- case RT_OID_802_11_QUERY_APSD_SETTING:
- apsd = (pAd->CommonCfg.bAPSDCapable | (pAd->CommonCfg.bAPSDAC_BE << 1) | (pAd->CommonCfg.bAPSDAC_BK << 2)
- | (pAd->CommonCfg.bAPSDAC_VI << 3) | (pAd->CommonCfg.bAPSDAC_VO << 4) | (pAd->CommonCfg.MaxSPLength << 5));
-
- wrq->u.data.length = sizeof(ULONG);
- Status = copy_to_user(wrq->u.data.pointer, &apsd, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_APSD_SETTING (=0x%lx,APSDCap=%d,AC_BE=%d,AC_BK=%d,AC_VI=%d,AC_VO=%d,MAXSPLen=%d)\n",
- apsd,pAd->CommonCfg.bAPSDCapable,pAd->CommonCfg.bAPSDAC_BE,pAd->CommonCfg.bAPSDAC_BK,pAd->CommonCfg.bAPSDAC_VI,pAd->CommonCfg.bAPSDAC_VO,pAd->CommonCfg.MaxSPLength));
- break;
- case RT_OID_802_11_QUERY_APSD_PSM:
- wrq->u.data.length = sizeof(ULONG);
- Status = copy_to_user(wrq->u.data.pointer, &pAd->CommonCfg.bAPSDForcePowerSave, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_APSD_PSM (=%d)\n", pAd->CommonCfg.bAPSDForcePowerSave));
- break;
- case RT_OID_802_11_QUERY_WMM:
- wrq->u.data.length = sizeof(BOOLEAN);
- Status = copy_to_user(wrq->u.data.pointer, &pAd->CommonCfg.bWmmCapable, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_WMM (=%d)\n", pAd->CommonCfg.bWmmCapable));
- break;
-#ifdef WPA_SUPPLICANT_SUPPORT
- case RT_OID_NEW_DRIVER:
- {
- UCHAR enabled = 1;
- wrq->u.data.length = sizeof(UCHAR);
- Status = copy_to_user(wrq->u.data.pointer, &enabled, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_NEW_DRIVER (=%d)\n", enabled));
- }
- break;
- case RT_OID_WPA_SUPPLICANT_SUPPORT:
- wrq->u.data.length = sizeof(UCHAR);
- Status = copy_to_user(wrq->u.data.pointer, &pAd->StaCfg.WpaSupplicantUP, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_WPA_SUPPLICANT_SUPPORT (=%d)\n", pAd->StaCfg.WpaSupplicantUP));
- break;
-#endif // WPA_SUPPLICANT_SUPPORT //
-
- case RT_OID_DRIVER_DEVICE_NAME:
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_DRIVER_DEVICE_NAME \n"));
- wrq->u.data.length = 16;
- if (copy_to_user(wrq->u.data.pointer, pAd->StaCfg.dev_name, wrq->u.data.length))
- {
- Status = -EFAULT;
- }
- break;
- case RT_OID_802_11_QUERY_HT_PHYMODE:
- pHTPhyMode = (OID_SET_HT_PHYMODE *) kmalloc(sizeof(OID_SET_HT_PHYMODE), MEM_ALLOC_FLAG);
- if (pHTPhyMode)
- {
- pHTPhyMode->PhyMode = pAd->CommonCfg.PhyMode;
- pHTPhyMode->HtMode = (UCHAR)pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE;
- pHTPhyMode->BW = (UCHAR)pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.BW;
- pHTPhyMode->MCS= (UCHAR)pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MCS;
- pHTPhyMode->SHORTGI= (UCHAR)pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.ShortGI;
- pHTPhyMode->STBC= (UCHAR)pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.STBC;
-
- pHTPhyMode->ExtOffset = ((pAd->CommonCfg.CentralChannel < pAd->CommonCfg.Channel) ? (EXTCHA_BELOW) : (EXTCHA_ABOVE));
- wrq->u.data.length = sizeof(OID_SET_HT_PHYMODE);
- if (copy_to_user(wrq->u.data.pointer, pHTPhyMode, wrq->u.data.length))
- {
- Status = -EFAULT;
- }
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_HT_PHYMODE (PhyMode = %d, MCS =%d, BW = %d, STBC = %d, ExtOffset=%d)\n",
- pHTPhyMode->HtMode, pHTPhyMode->MCS, pHTPhyMode->BW, pHTPhyMode->STBC, pHTPhyMode->ExtOffset));
- DBGPRINT(RT_DEBUG_TRACE, (" MlmeUpdateTxRates (.word = %x )\n", pAd->MacTab.Content[BSSID_WCID].HTPhyMode.word));
- }
- else
- {
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_STA_CONFIG(kmalloc failed)\n"));
- Status = -EFAULT;
- }
- break;
- case RT_OID_802_11_COUNTRY_REGION:
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_COUNTRY_REGION \n"));
- wrq->u.data.length = sizeof(ulInfo);
- ulInfo = pAd->CommonCfg.CountryRegionForABand;
- ulInfo = (ulInfo << 8)|(pAd->CommonCfg.CountryRegion);
- if (copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length))
- {
- Status = -EFAULT;
- }
- break;
- case RT_OID_802_11_QUERY_DAT_HT_PHYMODE:
- pHTPhyMode = (OID_SET_HT_PHYMODE *) kmalloc(sizeof(OID_SET_HT_PHYMODE), MEM_ALLOC_FLAG);
- if (pHTPhyMode)
- {
- pHTPhyMode->PhyMode = pAd->CommonCfg.PhyMode;
- pHTPhyMode->HtMode = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.HTMODE;
- pHTPhyMode->BW = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.BW;
- pHTPhyMode->MCS= (UCHAR)pAd->StaCfg.DesiredTransmitSetting.field.MCS;
- pHTPhyMode->SHORTGI= (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.ShortGI;
- pHTPhyMode->STBC= (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.STBC;
-
- wrq->u.data.length = sizeof(OID_SET_HT_PHYMODE);
- if (copy_to_user(wrq->u.data.pointer, pHTPhyMode, wrq->u.data.length))
- {
- Status = -EFAULT;
- }
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_HT_PHYMODE (PhyMode = %d, MCS =%d, BW = %d, STBC = %d, ExtOffset=%d)\n",
- pHTPhyMode->HtMode, pHTPhyMode->MCS, pHTPhyMode->BW, pHTPhyMode->STBC, pHTPhyMode->ExtOffset));
- DBGPRINT(RT_DEBUG_TRACE, (" MlmeUpdateTxRates (.word = %x )\n", pAd->MacTab.Content[BSSID_WCID].HTPhyMode.word));
- }
- else
- {
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_STA_CONFIG(kmalloc failed)\n"));
- Status = -EFAULT;
- }
- break;
- case RT_OID_QUERY_MULTIPLE_CARD_SUPPORT:
- wrq->u.data.length = sizeof(UCHAR);
- i = 0;
-#ifdef MULTIPLE_CARD_SUPPORT
- i = 1;
-#endif // MULTIPLE_CARD_SUPPORT //
- if (copy_to_user(wrq->u.data.pointer, &i, wrq->u.data.length))
- {
- Status = -EFAULT;
- }
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_QUERY_MULTIPLE_CARD_SUPPORT(=%d) \n", i));
- break;
-#ifdef SNMP_SUPPORT
- case RT_OID_802_11_MAC_ADDRESS:
- wrq->u.data.length = MAC_ADDR_LEN;
- Status = copy_to_user(wrq->u.data.pointer, &pAd->CurrentAddress, wrq->u.data.length);
- break;
-
- case RT_OID_802_11_MANUFACTUREROUI:
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_MANUFACTUREROUI \n"));
- wrq->u.data.length = ManufacturerOUI_LEN;
- Status = copy_to_user(wrq->u.data.pointer, &pAd->CurrentAddress, wrq->u.data.length);
- break;
-
- case RT_OID_802_11_MANUFACTURERNAME:
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_MANUFACTURERNAME \n"));
- wrq->u.data.length = strlen(ManufacturerNAME);
- Status = copy_to_user(wrq->u.data.pointer, ManufacturerNAME, wrq->u.data.length);
- break;
-
- case RT_OID_802_11_RESOURCETYPEIDNAME:
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_RESOURCETYPEIDNAME \n"));
- wrq->u.data.length = strlen(ResourceTypeIdName);
- Status = copy_to_user(wrq->u.data.pointer, ResourceTypeIdName, wrq->u.data.length);
- break;
-
- case RT_OID_802_11_PRIVACYOPTIONIMPLEMENTED:
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_PRIVACYOPTIONIMPLEMENTED \n"));
- ulInfo = 1; // 1 is support wep else 2 is not support.
- wrq->u.data.length = sizeof(ulInfo);
- Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length);
- break;
-
- case RT_OID_802_11_POWERMANAGEMENTMODE:
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_POWERMANAGEMENTMODE \n"));
- if (pAd->StaCfg.Psm == PSMP_ACTION)
- ulInfo = 1; // 1 is power active else 2 is power save.
- else
- ulInfo = 2;
-
- wrq->u.data.length = sizeof(ulInfo);
- Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length);
- break;
-
- case OID_802_11_WEPDEFAULTKEYVALUE:
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_WEPDEFAULTKEYVALUE \n"));
- //KeyIdxValue.KeyIdx = pAd->PortCfg.MBSSID[pAd->IoctlIF].DefaultKeyId;
- pKeyIdxValue = wrq->u.data.pointer;
- DBGPRINT(RT_DEBUG_TRACE,("KeyIdxValue.KeyIdx = %d, \n",pKeyIdxValue->KeyIdx));
- valueLen = pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].KeyLen;
- NdisMoveMemory(pKeyIdxValue->Value,
- &pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].Key,
- valueLen);
- pKeyIdxValue->Value[valueLen]='\0';
-
- wrq->u.data.length = sizeof(DefaultKeyIdxValue);
-
- Status = copy_to_user(wrq->u.data.pointer, pKeyIdxValue, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE,("DefaultKeyId = %d, total len = %d, str len=%d, KeyValue= %02x %02x %02x %02x \n",
- pAd->StaCfg.DefaultKeyId,
- wrq->u.data.length,
- pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].KeyLen,
- pAd->SharedKey[BSS0][0].Key[0],
- pAd->SharedKey[BSS0][1].Key[0],
- pAd->SharedKey[BSS0][2].Key[0],
- pAd->SharedKey[BSS0][3].Key[0]));
- break;
-
- case OID_802_11_WEPDEFAULTKEYID:
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_WEPDEFAULTKEYID \n"));
- wrq->u.data.length = sizeof(UCHAR);
- Status = copy_to_user(wrq->u.data.pointer, &pAd->StaCfg.DefaultKeyId, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("DefaultKeyId =%d \n", pAd->StaCfg.DefaultKeyId));
- break;
-
- case RT_OID_802_11_WEPKEYMAPPINGLENGTH:
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_WEPKEYMAPPINGLENGTH \n"));
- wrq->u.data.length = sizeof(UCHAR);
- Status = copy_to_user(wrq->u.data.pointer,
- &pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].KeyLen,
- wrq->u.data.length);
- break;
-
- case OID_802_11_SHORTRETRYLIMIT:
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_SHORTRETRYLIMIT \n"));
- wrq->u.data.length = sizeof(ULONG);
- RTMP_IO_READ32(pAd, TX_RTY_CFG, &tx_rty_cfg.word);
- ShortRetryLimit = tx_rty_cfg.field.ShortRtyLimit;
- DBGPRINT(RT_DEBUG_TRACE, ("ShortRetryLimit =%ld, tx_rty_cfg.field.ShortRetryLimit=%d\n", ShortRetryLimit, tx_rty_cfg.field.ShortRtyLimit));
- Status = copy_to_user(wrq->u.data.pointer, &ShortRetryLimit, wrq->u.data.length);
- break;
-
- case OID_802_11_LONGRETRYLIMIT:
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_LONGRETRYLIMIT \n"));
- wrq->u.data.length = sizeof(ULONG);
- RTMP_IO_READ32(pAd, TX_RTY_CFG, &tx_rty_cfg.word);
- LongRetryLimit = tx_rty_cfg.field.LongRtyLimit;
- DBGPRINT(RT_DEBUG_TRACE, ("LongRetryLimit =%ld, tx_rty_cfg.field.LongRtyLimit=%d\n", LongRetryLimit, tx_rty_cfg.field.LongRtyLimit));
- Status = copy_to_user(wrq->u.data.pointer, &LongRetryLimit, wrq->u.data.length);
- break;
-
- case RT_OID_802_11_PRODUCTID:
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_PRODUCTID \n"));
-
-#ifdef RTMP_MAC_PCI
- {
-
- USHORT device_id;
- if (((POS_COOKIE)pAd->OS_Cookie)->pci_dev != NULL)
- pci_read_config_word(((POS_COOKIE)pAd->OS_Cookie)->pci_dev, PCI_DEVICE_ID, &device_id);
- else
- DBGPRINT(RT_DEBUG_TRACE, (" pci_dev = NULL\n"));
- sprintf((PSTRING)tmp, "%04x %04x\n", NIC_PCI_VENDOR_ID, device_id);
- }
-#endif // RTMP_MAC_PCI //
- wrq->u.data.length = strlen((PSTRING)tmp);
- Status = copy_to_user(wrq->u.data.pointer, tmp, wrq->u.data.length);
- break;
-
- case RT_OID_802_11_MANUFACTUREID:
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_MANUFACTUREID \n"));
- wrq->u.data.length = strlen(ManufacturerNAME);
- Status = copy_to_user(wrq->u.data.pointer, ManufacturerNAME, wrq->u.data.length);
- break;
-
- case OID_802_11_CURRENTCHANNEL:
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_CURRENTCHANNEL \n"));
- wrq->u.data.length = sizeof(UCHAR);
- DBGPRINT(RT_DEBUG_TRACE, ("sizeof UCHAR=%d, channel=%d \n", sizeof(UCHAR), pAd->CommonCfg.Channel));
- Status = copy_to_user(wrq->u.data.pointer, &pAd->CommonCfg.Channel, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Status=%d\n", Status));
- break;
-#endif //SNMP_SUPPORT
-
- case OID_802_11_BUILD_CHANNEL_EX:
- {
- UCHAR value;
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_BUILD_CHANNEL_EX \n"));
- wrq->u.data.length = sizeof(UCHAR);
-#ifdef EXT_BUILD_CHANNEL_LIST
- DBGPRINT(RT_DEBUG_TRACE, ("Support EXT_BUILD_CHANNEL_LIST.\n"));
- value = 1;
-#else
- DBGPRINT(RT_DEBUG_TRACE, ("Doesn't support EXT_BUILD_CHANNEL_LIST.\n"));
- value = 0;
-#endif // EXT_BUILD_CHANNEL_LIST //
- Status = copy_to_user(wrq->u.data.pointer, &value, 1);
- DBGPRINT(RT_DEBUG_TRACE, ("Status=%d\n", Status));
- }
- break;
-
- case OID_802_11_GET_CH_LIST:
- {
- PRT_CHANNEL_LIST_INFO pChListBuf;
-
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_GET_CH_LIST \n"));
- if (pAd->ChannelListNum == 0)
- {
- wrq->u.data.length = 0;
- break;
- }
-
- pChListBuf = (RT_CHANNEL_LIST_INFO *) kmalloc(sizeof(RT_CHANNEL_LIST_INFO), MEM_ALLOC_FLAG);
- if (pChListBuf == NULL)
- {
- wrq->u.data.length = 0;
- break;
- }
-
- pChListBuf->ChannelListNum = pAd->ChannelListNum;
- for (i = 0; i < pChListBuf->ChannelListNum; i++)
- pChListBuf->ChannelList[i] = pAd->ChannelList[i].Channel;
-
- wrq->u.data.length = sizeof(RT_CHANNEL_LIST_INFO);
- Status = copy_to_user(wrq->u.data.pointer, pChListBuf, sizeof(RT_CHANNEL_LIST_INFO));
- DBGPRINT(RT_DEBUG_TRACE, ("Status=%d\n", Status));
-
- if (pChListBuf)
- kfree(pChListBuf);
- }
- break;
-
- case OID_802_11_GET_COUNTRY_CODE:
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_GET_COUNTRY_CODE \n"));
- wrq->u.data.length = 2;
- Status = copy_to_user(wrq->u.data.pointer, &pAd->CommonCfg.CountryCode, 2);
- DBGPRINT(RT_DEBUG_TRACE, ("Status=%d\n", Status));
- break;
-
- case OID_802_11_GET_CHANNEL_GEOGRAPHY:
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_GET_CHANNEL_GEOGRAPHY \n"));
- wrq->u.data.length = 1;
- Status = copy_to_user(wrq->u.data.pointer, &pAd->CommonCfg.Geography, 1);
- DBGPRINT(RT_DEBUG_TRACE, ("Status=%d\n", Status));
- break;
-
-
-#ifdef QOS_DLS_SUPPORT
- case RT_OID_802_11_QUERY_DLS:
- wrq->u.data.length = sizeof(BOOLEAN);
- Status = copy_to_user(wrq->u.data.pointer, &pAd->CommonCfg.bDLSCapable, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_DLS(=%d)\n", pAd->CommonCfg.bDLSCapable));
- break;
-
- case RT_OID_802_11_QUERY_DLS_PARAM:
- {
- PRT_802_11_DLS_INFO pDlsInfo = kmalloc(sizeof(RT_802_11_DLS_INFO), GFP_ATOMIC);
- if (pDlsInfo == NULL)
- break;
-
- for (i=0; i<MAX_NUM_OF_DLS_ENTRY; i++)
- {
- RTMPMoveMemory(&pDlsInfo->Entry[i], &pAd->StaCfg.DLSEntry[i], sizeof(RT_802_11_DLS_UI));
- }
-
- pDlsInfo->num = MAX_NUM_OF_DLS_ENTRY;
- wrq->u.data.length = sizeof(RT_802_11_DLS_INFO);
- Status = copy_to_user(wrq->u.data.pointer, pDlsInfo, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_DLS_PARAM\n"));
-
- if (pDlsInfo)
- kfree(pDlsInfo);
- }
- break;
-#endif // QOS_DLS_SUPPORT //
-
- case OID_802_11_SET_PSPXLINK_MODE:
- wrq->u.data.length = sizeof(BOOLEAN);
- Status = copy_to_user(wrq->u.data.pointer, &pAd->CommonCfg.PSPXlink, wrq->u.data.length);
- DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_SET_PSPXLINK_MODE(=%d)\n", pAd->CommonCfg.PSPXlink));
- break;
-
-
- default:
- DBGPRINT(RT_DEBUG_TRACE, ("Query::unknown IOCTL's subcmd = 0x%08x\n", cmd));
- Status = -EOPNOTSUPP;
- break;
- }
- return Status;
-}
-
INT rt28xx_sta_ioctl(
IN struct net_device *net_dev,
IN OUT struct ifreq *rq,
@@ -5402,8 +3129,6 @@ INT rt28xx_sta_ioctl(
struct iwreq *wrq = (struct iwreq *) rq;
BOOLEAN StateMachineTouched = FALSE;
INT Status = NDIS_STATUS_SUCCESS;
- USHORT subcmd;
-
pAd = RTMP_OS_NETDEV_GET_PRIV(net_dev);
if (pAd == NULL)
@@ -5576,15 +3301,9 @@ INT rt28xx_sta_ioctl(
case SIOCGIWRANGE: //Get range of parameters
case SIOCGIWRETRY: //get retry limits and lifetime
case SIOCSIWRETRY: //set retry limits and lifetime
- Status = -EOPNOTSUPP;
- break;
case RT_PRIV_IOCTL:
- case RT_PRIV_IOCTL_EXT:
- subcmd = wrq->u.data.flags;
- if( subcmd & OID_GET_SET_TOGGLE)
- Status = RTMPSetInformation(pAd, rq, subcmd);
- else
- Status = RTMPQueryInformation(pAd, rq, subcmd);
+ case RT_PRIV_IOCTL_EXT:
+ Status = -EOPNOTSUPP;
break;
case SIOCGIWPRIV:
if (wrq->u.data.pointer)
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 5/8] Staging: rt28x0: updates from vendor's V2.1.0.0 drivers
2009-09-22 18:43 [PATCH 0/8] Staging: updates for Ralink drivers Bartlomiej Zolnierkiewicz
` (3 preceding siblings ...)
2009-09-22 18:43 ` [PATCH 4/8] Staging: rt3090: remove private ioctls Bartlomiej Zolnierkiewicz
@ 2009-09-22 18:44 ` Bartlomiej Zolnierkiewicz
2009-09-22 18:44 ` [PATCH 6/8] Staging: rt28x0: remove unused code from common/dfs.c Bartlomiej Zolnierkiewicz
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-09-22 18:44 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: devel, Bartlomiej Zolnierkiewicz, Mike Galbraith, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rt28x0: updates from vendor's V2.1.0.0 drivers
Port changes from:
* 2009_0420_RT2860_Linux_STA_V2.1.0.0
* 2009_0302_RT2870_Linux_STA_v2.1.0.0
* 2009_0525_RT3070_Linux_STA_v2.1.1.0
to in-kernel drivers.
>From the RT2860 driver release note:
[2.1.0.0]
1. New generation schema for multiple OS porting
2. Fixed Ad-hoc ping failed in noisy environment. (Probe Response has too
many retry packet then cause "not enough space in MgmtRing")
3. Fixed WPA(2)PSK issue when group cipher of AP is WEP40 or WEP104.
4. Modified iwpriv ra0 get_site_survey:
In scan list result: Security shows "NONE" when AP is OPEN/NONE,
shows "WEP" when AP is OPEN/WEP or SHARED/WEP, shows
"WPAPSK(WPA2PSK)/TKIP(AES)" when AP is WPAPSK(WPA2PSK)/TKIP(AES)
shows "WPA(WPA2)/TKIP(AES)" when AP is WPA(WPA2)/TKIP(AES)
5. Support kthread.
6. Add New A band channel list region 15 contains the whole channels in
the A band region 4 and the new CE channel 167,169,171,173
7. Add New IEEE802.11r functionality.
8. Fixed WPA2-Enterprise failed when AP reboot or turn off then turn on.
9. Fixed STA cannot connect to 11B only AP when the setting of is PHY_11GN.
>From the RT2870 driver release note:
[V2.1.0.0]
1. New generation schema for multiple OS porting.
2. Fixed Ad-hoc ping failed in noisy environment. (Probe Response has too
many retry packet then cause "not enough space in MgmtRing").
3. Fixed WPS failed with D-Link DIR-628 in 5GHz.
4. Change FastRoaming in DAT file to AutoRoaming.
5. Support kthread.
6. Add New A band channel list region 15 contains the whole channels in
the A band region and the new CE channel 167,169,171,173.
7. New IEEE802.11r functionality.
>From the RT3070 driver release note:
Version V2.1.1.0
1. Linux kernel 2.6.29 support.
2. Fix eFuse write from BIN file bug.
Version 2.1.0.0
1. New generation schema for multiple OS porting
2. Fixed Ad-hoc ping failed in noisy environment.
3. Modified iwpriv ra0 get_site_survey:
4. Change FastRoaming in DAT file to AutoRoaming.
5. Support kthread.
6. New IEEE802.11r functionality.
Tested with RT2860 and RT3070 chipsets.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
The patch itself can be obtained from:
http://www.kernel.org/pub/linux/kernel/people/bart/ralink/staging-rt28x0-updates-from-vendors-v2.1.0.0-driver.patch
[ it is too big for the mailing list ]
drivers/staging/rt2860/2860_main_dev.c | 1319 ---
drivers/staging/rt2860/Makefile | 26
drivers/staging/rt2860/aironet.h | 210
drivers/staging/rt2860/ap.h | 12
drivers/staging/rt2860/chip/mac_pci.h | 365
drivers/staging/rt2860/chip/mac_usb.h | 365
drivers/staging/rt2860/chip/rt2860.h | 56
drivers/staging/rt2860/chip/rt2870.h | 47
drivers/staging/rt2860/chip/rt3070.h | 68
drivers/staging/rt2860/chip/rt30xx.h | 48
drivers/staging/rt2860/chip/rtmp_mac.h | 1334 +++
drivers/staging/rt2860/chip/rtmp_phy.h | 405 +
drivers/staging/rt2860/chips/rt3070.c | 185
drivers/staging/rt2860/chips/rt30xx.c | 525 +
drivers/staging/rt2860/chlist.h | 1215 ---
drivers/staging/rt2860/common/2860_rtmp_init.c | 897 --
drivers/staging/rt2860/common/action.c | 12
drivers/staging/rt2860/common/ba_action.c | 147
drivers/staging/rt2860/common/cmm_aes.c | 1404 +++
drivers/staging/rt2860/common/cmm_asic.c | 2531 ++++++
drivers/staging/rt2860/common/cmm_cfg.c | 290
drivers/staging/rt2860/common/cmm_data.c | 906 --
drivers/staging/rt2860/common/cmm_data_2860.c | 1197 ---
drivers/staging/rt2860/common/cmm_data_pci.c | 1153 +++
drivers/staging/rt2860/common/cmm_data_usb.c | 968 ++
drivers/staging/rt2860/common/cmm_info.c | 822 +-
drivers/staging/rt2860/common/cmm_mac_pci.c | 1504 +++
drivers/staging/rt2860/common/cmm_mac_usb.c | 1216 +++
drivers/staging/rt2860/common/cmm_profile.c | 1736 ++++
drivers/staging/rt2860/common/cmm_sanity.c | 233
drivers/staging/rt2860/common/cmm_sync.c | 70
drivers/staging/rt2860/common/cmm_tkip.c | 882 ++
drivers/staging/rt2860/common/cmm_wep.c | 499 +
drivers/staging/rt2860/common/cmm_wpa.c | 3332 +++++++-
drivers/staging/rt2860/common/crypt_hmac.c | 279
drivers/staging/rt2860/common/crypt_md5.c | 352
drivers/staging/rt2860/common/crypt_sha2.c | 535 +
drivers/staging/rt2860/common/dfs.c | 66
drivers/staging/rt2860/common/ee_efuse.c | 1525 ++++
drivers/staging/rt2860/common/ee_prom.c | 270
drivers/staging/rt2860/common/eeprom.c | 1462 ---
drivers/staging/rt2860/common/firmware.h | 2
drivers/staging/rt2860/common/firmware_3070.h | 517 +
drivers/staging/rt2860/common/md5.c | 1415 ---
drivers/staging/rt2860/common/mlme.c | 9508 ++++++++-----------------
drivers/staging/rt2860/common/rt_channel.c | 1280 +++
drivers/staging/rt2860/common/rt_rf.c | 194
drivers/staging/rt2860/common/rtmp_init.c | 1969 ++---
drivers/staging/rt2860/common/rtmp_mcu.c | 233
drivers/staging/rt2860/common/rtmp_timer.c | 323
drivers/staging/rt2860/common/rtmp_tkip.c | 1586 ----
drivers/staging/rt2860/common/rtmp_wep.c | 497 -
drivers/staging/rt2860/common/spectrum.c | 460 +
drivers/staging/rt2860/config.mk | 241
drivers/staging/rt2860/crypt_hmac.h | 82
drivers/staging/rt2860/crypt_md5.h | 80
drivers/staging/rt2860/crypt_sha2.h | 109
drivers/staging/rt2860/dfs.h | 32
drivers/staging/rt2860/eeprom.h | 93
drivers/staging/rt2860/iface/rtmp_pci.h | 83
drivers/staging/rt2860/iface/rtmp_usb.h | 200
drivers/staging/rt2860/md5.h | 107
drivers/staging/rt2860/mlme.h | 89
drivers/staging/rt2860/oid.h | 135
drivers/staging/rt2860/pci_main_dev.c | 873 ++
drivers/staging/rt2860/rt2860.h | 333
drivers/staging/rt2860/rt28xx.h | 1688 ----
drivers/staging/rt2860/rt_config.h | 32
drivers/staging/rt2860/rt_linux.c | 615 +
drivers/staging/rt2860/rt_linux.h | 966 +-
drivers/staging/rt2860/rt_main_dev.c | 750 -
drivers/staging/rt2860/rt_pci_rbus.c | 877 ++
drivers/staging/rt2860/rt_profile.c | 1839 ----
drivers/staging/rt2860/rt_usb.c | 828 ++
drivers/staging/rt2860/rtmp.h | 2894 +++----
drivers/staging/rt2860/rtmp_chip.h | 265
drivers/staging/rt2860/rtmp_def.h | 289
drivers/staging/rt2860/rtmp_dot11.h | 102
drivers/staging/rt2860/rtmp_iface.h | 84
drivers/staging/rt2860/rtmp_mcu.h | 55
drivers/staging/rt2860/rtmp_os.h | 98
drivers/staging/rt2860/rtmp_timer.h | 156
drivers/staging/rt2860/rtmp_type.h | 55
drivers/staging/rt2860/rtusb_io.h | 189
drivers/staging/rt2860/spectrum.h | 169
drivers/staging/rt2860/spectrum_def.h | 148
drivers/staging/rt2860/sta/aironet.c | 1312 ---
drivers/staging/rt2860/sta/assoc.c | 327
drivers/staging/rt2860/sta/auth.c | 138
drivers/staging/rt2860/sta/auth_rsp.c | 16
drivers/staging/rt2860/sta/connect.c | 637 -
drivers/staging/rt2860/sta/rtmp_data.c | 257
drivers/staging/rt2860/sta/sanity.c | 44
drivers/staging/rt2860/sta/sync.c | 398 -
drivers/staging/rt2860/sta/wpa.c | 1994 -----
drivers/staging/rt2860/sta_ioctl.c | 761 +-
drivers/staging/rt2860/usb_main_dev.c | 897 ++
drivers/staging/rt2860/wpa.h | 104
drivers/staging/rt2870/2870_main_dev.c | 1530 ----
drivers/staging/rt2870/Makefile | 32
drivers/staging/rt2870/chips/rt3070.c | 1
drivers/staging/rt2870/chips/rt30xx.c | 1
drivers/staging/rt2870/common/2870_rtmp_init.c | 1730 ----
drivers/staging/rt2870/common/acction.c | 1
drivers/staging/rt2870/common/cmm_aes.c | 1
drivers/staging/rt2870/common/cmm_asic.c | 1
drivers/staging/rt2870/common/cmm_cfg.c | 1
drivers/staging/rt2870/common/cmm_data_2870.c | 936 --
drivers/staging/rt2870/common/cmm_data_usb.c | 1
drivers/staging/rt2870/common/cmm_mac_usb.c | 1
drivers/staging/rt2870/common/cmm_profile.c | 1
drivers/staging/rt2870/common/cmm_tkip.c | 1
drivers/staging/rt2870/common/cmm_wep.c | 1
drivers/staging/rt2870/common/crypt_hmac.c | 1
drivers/staging/rt2870/common/crypt_md5.c | 1
drivers/staging/rt2870/common/crypt_sha2.c | 1
drivers/staging/rt2870/common/ee_efuse.c | 1
drivers/staging/rt2870/common/rt_channel.c | 1
drivers/staging/rt2870/common/rt_rf.c | 1
drivers/staging/rt2870/common/rtmp_mcu.c | 1
drivers/staging/rt2870/common/rtmp_timer.c | 1
drivers/staging/rt2870/common/rtusb_bulk.c | 37
drivers/staging/rt2870/common/rtusb_data.c | 55
drivers/staging/rt2870/common/rtusb_io.c | 465 -
drivers/staging/rt2870/rt2870.h | 583 -
drivers/staging/rt2870/rt_usb.c | 1
drivers/staging/rt2870/usb_main_dev.c | 1
drivers/staging/rt3070/firmware.h | 2
128 files changed, 39592 insertions(+), 35692 deletions(-)
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 6/8] Staging: rt28x0: remove unused code from common/dfs.c
2009-09-22 18:43 [PATCH 0/8] Staging: updates for Ralink drivers Bartlomiej Zolnierkiewicz
` (4 preceding siblings ...)
2009-09-22 18:44 ` [PATCH 5/8] Staging: rt28x0: updates from vendor's V2.1.0.0 drivers Bartlomiej Zolnierkiewicz
@ 2009-09-22 18:44 ` Bartlomiej Zolnierkiewicz
2009-09-22 18:44 ` [PATCH 7/8] Staging: rt2860: add RT3090 chipset support Bartlomiej Zolnierkiewicz
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-09-22 18:44 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: devel, Bartlomiej Zolnierkiewicz, Mike Galbraith, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rt28x0: remove unused code from common/dfs.c
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/staging/rt2860/common/dfs.c | 378 ------------------------------------
drivers/staging/rt2860/dfs.h | 75 -------
2 files changed, 453 deletions(-)
Index: b/drivers/staging/rt2860/common/dfs.c
===================================================================
--- a/drivers/staging/rt2860/common/dfs.c
+++ b/drivers/staging/rt2860/common/dfs.c
@@ -37,196 +37,6 @@
#include "../rt_config.h"
-typedef struct _RADAR_DURATION_TABLE
-{
- ULONG RDDurRegion;
- ULONG RadarSignalDuration;
- ULONG Tolerance;
-} RADAR_DURATION_TABLE, *PRADAR_DURATION_TABLE;
-
-
-
-UCHAR RdIdleTimeTable[MAX_RD_REGION][4] =
-{
- {9, 250, 250, 250}, // CE
-#ifdef DFS_FCC_BW40_FIX
- {1, 250, 250, 250}, // FCC
-#else
- {4, 250, 250, 250}, // FCC
-#endif
- {4, 250, 250, 250}, // JAP
- {15, 250, 250, 250}, // JAP_W53
- {4, 250, 250, 250} // JAP_W56
-};
-
-/*
- ========================================================================
-
- Routine Description:
- Bbp Radar detection routine
-
- Arguments:
- pAd Pointer to our adapter
-
- Return Value:
-
- ========================================================================
-*/
-VOID BbpRadarDetectionStart(
- IN PRTMP_ADAPTER pAd)
-{
- UINT8 RadarPeriod;
-
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, 114, 0x02);
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, 121, 0x20);
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, 122, 0x00);
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, 123, 0x08/*0x80*/);
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, 124, 0x28);
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, 125, 0xff);
-
-#ifdef MERGE_ARCH_TEAM
- if ((pAd->CommonCfg.RadarDetect.RDDurRegion == JAP) || (pAd->CommonCfg.RadarDetect.RDDurRegion == JAP_W53) || (pAd->CommonCfg.RadarDetect.RDDurRegion == JAP_W56))
- {
- pAd->CommonCfg.RadarDetect.RDDurRegion = JAP;
- pAd->CommonCfg.RadarDetect.RDDurRegion = JapRadarType(pAd);
- if (pAd->CommonCfg.RadarDetect.RDDurRegion == JAP_W56)
- {
- pAd->CommonCfg.RadarDetect.DfsSessionTime = 13;
- }
- else if (pAd->CommonCfg.RadarDetect.RDDurRegion == JAP_W53)
- {
- pAd->CommonCfg.RadarDetect.DfsSessionTime = 15;
- }
- }
-#endif // MERGE_ARCH_TEAM //
-
- RadarPeriod = ((UINT)RdIdleTimeTable[pAd->CommonCfg.RadarDetect.RDDurRegion][0] + (UINT)pAd->CommonCfg.RadarDetect.DfsSessionTime) < 250 ?
- (RdIdleTimeTable[pAd->CommonCfg.RadarDetect.RDDurRegion][0] + pAd->CommonCfg.RadarDetect.DfsSessionTime) : 250;
-
-#ifdef MERGE_ARCH_TEAM
-
-
-#else // Original RT28xx source code.
- RTMP_IO_WRITE8(pAd, 0x7020, 0x1d);
- RTMP_IO_WRITE8(pAd, 0x7021, 0x40);
-#endif // MERGE_ARCH_TEAM //
-
- RadarDetectionStart(pAd, 0, RadarPeriod);
- return;
-}
-
-/*
- ========================================================================
-
- Routine Description:
- Bbp Radar detection routine
-
- Arguments:
- pAd Pointer to our adapter
-
- Return Value:
-
- ========================================================================
-*/
-VOID BbpRadarDetectionStop(
- IN PRTMP_ADAPTER pAd)
-{
- RTMP_IO_WRITE8(pAd, 0x7020, 0x1d);
- RTMP_IO_WRITE8(pAd, 0x7021, 0x60);
-
- RadarDetectionStop(pAd);
- return;
-}
-
-/*
- ========================================================================
-
- Routine Description:
- Radar detection routine
-
- Arguments:
- pAd Pointer to our adapter
-
- Return Value:
-
- ========================================================================
-*/
-VOID RadarDetectionStart(
- IN PRTMP_ADAPTER pAd,
- IN BOOLEAN CTSProtect,
- IN UINT8 CTSPeriod)
-{
- UINT8 DfsActiveTime = (pAd->CommonCfg.RadarDetect.DfsSessionTime & 0x1f);
- UINT8 CtsProtect = (CTSProtect == 1) ? 0x02 : 0x01; // CTS protect.
-
- if (CTSProtect != 0)
- {
- switch(pAd->CommonCfg.RadarDetect.RDDurRegion)
- {
- case FCC:
- case JAP_W56:
- CtsProtect = 0x03;
- break;
-
- case JAP:
- {
- UCHAR RDDurRegion;
- RDDurRegion = JapRadarType(pAd);
- if (RDDurRegion == JAP_W56)
- CtsProtect = 0x03;
- else
- CtsProtect = 0x02;
- break;
- }
-
- case CE:
- case JAP_W53:
- default:
- CtsProtect = 0x02;
- break;
- }
- }
- else
- CtsProtect = 0x01;
-
-
- // send start-RD with CTS protection command to MCU
- // highbyte [7] reserve
- // highbyte [6:5] 0x: stop Carrier/Radar detection
- // highbyte [10]: Start Carrier/Radar detection without CTS protection, 11: Start Carrier/Radar detection with CTS protection
- // highbyte [4:0] Radar/carrier detection duration. In 1ms.
-
- // lowbyte [7:0] Radar/carrier detection period, in 1ms.
- AsicSendCommandToMcu(pAd, 0x60, 0xff, CTSPeriod, DfsActiveTime | (CtsProtect << 5));
- //AsicSendCommandToMcu(pAd, 0x63, 0xff, 10, 0);
-
- return;
-}
-
-/*
- ========================================================================
-
- Routine Description:
- Radar detection routine
-
- Arguments:
- pAd Pointer to our adapter
-
- Return Value:
- TRUE Found radar signal
- FALSE Not found radar signal
-
- ========================================================================
-*/
-VOID RadarDetectionStop(
- IN PRTMP_ADAPTER pAd)
-{
- DBGPRINT(RT_DEBUG_TRACE,("RadarDetectionStop.\n"));
- AsicSendCommandToMcu(pAd, 0x60, 0xff, 0x00, 0x00); // send start-RD with CTS protection command to MCU
-
- return;
-}
-
/*
========================================================================
@@ -260,191 +70,3 @@ BOOLEAN RadarChannelCheck(
return result;
}
-
-ULONG JapRadarType(
- IN PRTMP_ADAPTER pAd)
-{
- ULONG i;
- const UCHAR Channel[15]={52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140};
-
- if (pAd->CommonCfg.RadarDetect.RDDurRegion != JAP)
- {
- return pAd->CommonCfg.RadarDetect.RDDurRegion;
- }
-
- for (i=0; i<15; i++)
- {
- if (pAd->CommonCfg.Channel == Channel[i])
- {
- break;
- }
- }
-
- if (i < 4)
- return JAP_W53;
- else if (i < 15)
- return JAP_W56;
- else
- return JAP; // W52
-
-}
-
-ULONG RTMPBbpReadRadarDuration(
- IN PRTMP_ADAPTER pAd)
-{
- UINT8 byteValue = 0;
- ULONG result;
-
- BBP_IO_READ8_BY_REG_ID(pAd, BBP_R115, &byteValue);
-
- result = 0;
- switch (byteValue)
- {
- case 1: // radar signal detected by pulse mode.
- case 2: // radar signal detected by width mode.
- result = RTMPReadRadarDuration(pAd);
- break;
-
- case 0: // No radar signal.
- default:
-
- result = 0;
- break;
- }
-
- return result;
-}
-
-ULONG RTMPReadRadarDuration(
- IN PRTMP_ADAPTER pAd)
-{
- ULONG result = 0;
-
- return result;
-
-}
-
-VOID RTMPCleanRadarDuration(
- IN PRTMP_ADAPTER pAd)
-{
- return;
-}
-
-/*
- ========================================================================
- Routine Description:
- Radar wave detection. The API should be invoke each second.
-
- Arguments:
- pAd - Adapter pointer
-
- Return Value:
- None
-
- ========================================================================
-*/
-VOID ApRadarDetectPeriodic(
- IN PRTMP_ADAPTER pAd)
-{
- INT i;
-
- pAd->CommonCfg.RadarDetect.InServiceMonitorCount++;
-
- for (i=0; i<pAd->ChannelListNum; i++)
- {
- if (pAd->ChannelList[i].RemainingTimeForUse > 0)
- {
- pAd->ChannelList[i].RemainingTimeForUse --;
- if ((pAd->Mlme.PeriodicRound%5) == 0)
- {
- DBGPRINT(RT_DEBUG_TRACE, ("RadarDetectPeriodic - ch=%d, RemainingTimeForUse=%d\n", pAd->ChannelList[i].Channel, pAd->ChannelList[i].RemainingTimeForUse));
- }
- }
- }
-
- //radar detect
- if ((pAd->CommonCfg.Channel > 14)
- && (pAd->CommonCfg.bIEEE80211H == 1)
- && RadarChannelCheck(pAd, pAd->CommonCfg.Channel))
- {
- RadarDetectPeriodic(pAd);
- }
-
- return;
-}
-
-// Periodic Radar detection, switch channel will occur in RTMPHandleTBTTInterrupt()
-// Before switch channel, driver needs doing channel switch announcement.
-VOID RadarDetectPeriodic(
- IN PRTMP_ADAPTER pAd)
-{
- // need to check channel availability, after switch channel
- if (pAd->CommonCfg.RadarDetect.RDMode != RD_SILENCE_MODE)
- return;
-
- // channel availability check time is 60sec, use 65 for assurance
- if (pAd->CommonCfg.RadarDetect.RDCount++ > pAd->CommonCfg.RadarDetect.ChMovingTime)
- {
- DBGPRINT(RT_DEBUG_TRACE, ("Not found radar signal, start send beacon and radar detection in service monitor\n\n"));
- BbpRadarDetectionStop(pAd);
- AsicEnableBssSync(pAd);
- pAd->CommonCfg.RadarDetect.RDMode = RD_NORMAL_MODE;
-
-
- return;
- }
-
- return;
-}
-
-
-/*
- ==========================================================================
- Description:
- change channel moving time for DFS testing.
-
- Arguments:
- pAdapter Pointer to our adapter
- wrq Pointer to the ioctl argument
-
- Return Value:
- None
-
- Note:
- Usage:
- 1.) iwpriv ra0 set ChMovTime=[value]
- ==========================================================================
-*/
-INT Set_ChMovingTime_Proc(
- IN PRTMP_ADAPTER pAd,
- IN PSTRING arg)
-{
- UINT8 Value;
-
- Value = (UINT8) simple_strtol(arg, 0, 10);
-
- pAd->CommonCfg.RadarDetect.ChMovingTime = Value;
-
- DBGPRINT(RT_DEBUG_TRACE, ("%s:: %d\n", __func__,
- pAd->CommonCfg.RadarDetect.ChMovingTime));
-
- return TRUE;
-}
-
-INT Set_LongPulseRadarTh_Proc(
- IN PRTMP_ADAPTER pAd,
- IN PSTRING arg)
-{
- UINT8 Value;
-
- Value = (UINT8) simple_strtol(arg, 0, 10) > 10 ? 10 : simple_strtol(arg, 0, 10);
-
- pAd->CommonCfg.RadarDetect.LongPulseRadarTh = Value;
-
- DBGPRINT(RT_DEBUG_TRACE, ("%s:: %d\n", __func__,
- pAd->CommonCfg.RadarDetect.LongPulseRadarTh));
-
- return TRUE;
-}
-
-
Index: b/drivers/staging/rt2860/dfs.h
===================================================================
--- a/drivers/staging/rt2860/dfs.h
+++ b/drivers/staging/rt2860/dfs.h
@@ -36,81 +36,6 @@
Fonchi 03-12-2007 created
*/
-#define RADAR_PULSE 1
-#define RADAR_WIDTH 2
-
-#define WIDTH_RD_IDLE 0
-#define WIDTH_RD_CHECK 1
-
-
-
-/*************************************************************************
- *
- * DFS Radar related definitions.
- *
- ************************************************************************/
-//#define CARRIER_DETECT_TASK_NUM 6
-//#define RADAR_DETECT_TASK_NUM 7
-
-// McuRadarState && McuCarrierState for 2880-SW-MCU
-#define FREE_FOR_TX 0
-#define WAIT_CTS_BEING_SENT 1
-#define DO_DETECTION 2
-
-// McuRadarEvent
-#define RADAR_EVENT_CTS_SENT 0x01 // Host signal MCU that CTS has been sent
-#define RADAR_EVENT_CTS_CARRIER_SENT 0x02 // Host signal MCU that CTS has been sent (Carrier)
-#define RADAR_EVENT_RADAR_DETECTING 0x04 // Radar detection is on going, carrier detection hold back
-#define RADAR_EVENT_CARRIER_DETECTING 0x08 // Carrier detection is on going, radar detection hold back
-#define RADAR_EVENT_WIDTH_RADAR 0x10 // BBP == 2 radar detected
-#define RADAR_EVENT_CTS_KICKED 0x20 // Radar detection need to sent double CTS, first CTS sent
-
-// McuRadarCmd
-#define DETECTION_STOP 0
-#define RADAR_DETECTION 1
-#define CARRIER_DETECTION 2
-
-VOID BbpRadarDetectionStart(
- IN PRTMP_ADAPTER pAd);
-
-VOID BbpRadarDetectionStop(
- IN PRTMP_ADAPTER pAd);
-
-VOID RadarDetectionStart(
- IN PRTMP_ADAPTER pAd,
- IN BOOLEAN CTS_Protect,
- IN UINT8 CTSPeriod);
-
-VOID RadarDetectionStop(
- IN PRTMP_ADAPTER pAd);
-
-VOID RadarDetectPeriodic(
- IN PRTMP_ADAPTER pAd);
-
-
BOOLEAN RadarChannelCheck(
IN PRTMP_ADAPTER pAd,
IN UCHAR Ch);
-
-ULONG JapRadarType(
- IN PRTMP_ADAPTER pAd);
-
-ULONG RTMPBbpReadRadarDuration(
- IN PRTMP_ADAPTER pAd);
-
-ULONG RTMPReadRadarDuration(
- IN PRTMP_ADAPTER pAd);
-
-VOID RTMPCleanRadarDuration(
- IN PRTMP_ADAPTER pAd);
-
-
-INT Set_ChMovingTime_Proc(
- IN PRTMP_ADAPTER pAd,
- IN PSTRING arg);
-
-INT Set_LongPulseRadarTh_Proc(
- IN PRTMP_ADAPTER pAd,
- IN PSTRING arg);
-
-
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 7/8] Staging: rt2860: add RT3090 chipset support
2009-09-22 18:43 [PATCH 0/8] Staging: updates for Ralink drivers Bartlomiej Zolnierkiewicz
` (5 preceding siblings ...)
2009-09-22 18:44 ` [PATCH 6/8] Staging: rt28x0: remove unused code from common/dfs.c Bartlomiej Zolnierkiewicz
@ 2009-09-22 18:44 ` Bartlomiej Zolnierkiewicz
2009-09-22 18:44 ` [PATCH 8/8] Staging: remove no longer needed rt3090 driver Bartlomiej Zolnierkiewicz
2009-10-09 16:24 ` [PATCH 0/8] Staging: updates for Ralink drivers Greg KH
8 siblings, 0 replies; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-09-22 18:44 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: devel, Bartlomiej Zolnierkiewicz, Mike Galbraith, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rt2860: add RT3090 chipset support
Add support for RT3090 chipset
(based on 2009_0612_RT3090_Linux_STA_V2.1.0.0_DPO).
Tested with RT2860.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/staging/rt2860/Kconfig | 5
drivers/staging/rt2860/Makefile | 7
drivers/staging/rt2860/chip/mac_pci.h | 12
drivers/staging/rt2860/chip/rt3090.h | 72 +++++
drivers/staging/rt2860/chip/rtmp_phy.h | 183 ++++++++++++
drivers/staging/rt2860/chips/rt3090.c | 123 ++++++++
drivers/staging/rt2860/chips/rt30xx.c | 12
drivers/staging/rt2860/common/cmm_asic.c | 29 ++
drivers/staging/rt2860/common/cmm_data_pci.c | 6
drivers/staging/rt2860/common/cmm_mac_pci.c | 255 ++++++++++++++---
drivers/staging/rt2860/common/cmm_profile.c | 43 +++
drivers/staging/rt2860/common/cmm_sync.c | 13
drivers/staging/rt2860/common/mlme.c | 112 +++++--
drivers/staging/rt2860/common/rt_rf.c | 8
drivers/staging/rt2860/common/rtmp_init.c | 73 ++++-
drivers/staging/rt2860/common/rtmp_mcu.c | 98 ++++++
drivers/staging/rt2860/common/rtmp_timer.c | 4
drivers/staging/rt2860/iface/rtmp_pci.h | 2
drivers/staging/rt2860/pci_main_dev.c | 384 ++++++++++++++++++++++++---
drivers/staging/rt2860/rt_linux.c | 3
drivers/staging/rt2860/rt_linux.h | 13
drivers/staging/rt2860/rt_main_dev.c | 17 -
drivers/staging/rt2860/rt_pci_rbus.c | 4
drivers/staging/rt2860/rtmp.h | 49 ++-
drivers/staging/rt2860/rtmp_chip.h | 3
drivers/staging/rt2860/rtmp_def.h | 5
drivers/staging/rt2860/sta/assoc.c | 12
drivers/staging/rt2860/sta/auth_rsp.c | 4
drivers/staging/rt2860/sta/connect.c | 190 ++-----------
drivers/staging/rt2860/sta/rtmp_data.c | 1
drivers/staging/rt2860/sta/sync.c | 26 +
drivers/staging/rt2860/sta/wpa.c | 48 ---
drivers/staging/rt2860/sta_ioctl.c | 7
drivers/staging/rt2860/wpa.h | 7
drivers/staging/rt3090/common/rtmp_mcu.c | 8
drivers/staging/rt3090/firmware.h | 2
36 files changed, 1416 insertions(+), 424 deletions(-)
Index: b/drivers/staging/rt2860/Kconfig
===================================================================
--- a/drivers/staging/rt2860/Kconfig
+++ b/drivers/staging/rt2860/Kconfig
@@ -1,5 +1,6 @@
config RT2860
- tristate "Ralink 2860 wireless support"
+ tristate "Ralink 2860/3090 wireless support"
depends on PCI && X86 && WLAN_80211
---help---
- This is an experimental driver for the Ralink 2860 wireless chip.
+ This is an experimental driver for the Ralink 2860 and 3090
+ wireless chips.
Index: b/drivers/staging/rt2860/Makefile
===================================================================
--- a/drivers/staging/rt2860/Makefile
+++ b/drivers/staging/rt2860/Makefile
@@ -3,6 +3,7 @@ obj-$(CONFIG_RT2860) += rt2860sta.o
# TODO: all of these should be removed
EXTRA_CFLAGS += -DLINUX -DAGGREGATION_SUPPORT -DPIGGYBACK_SUPPORT -DWMM_SUPPORT
EXTRA_CFLAGS += -DRTMP_MAC_PCI -DRTMP_PCI_SUPPORT -DRT2860
+EXTRA_CFLAGS += -DRTMP_RF_RW_SUPPORT -DRTMP_EFUSE_SUPPORT -DRT30xx -DRT3090
EXTRA_CFLAGS += -DDBG
rt2860sta-objs := \
@@ -46,4 +47,8 @@ rt2860sta-objs := \
common/cmm_mac_pci.o \
common/cmm_data_pci.o \
common/ee_prom.o \
- common/rtmp_mcu.o
+ common/rtmp_mcu.o \
+ common/ee_efuse.o \
+ chips/rt30xx.o \
+ common/rt_rf.o \
+ chips/rt3090.o
Index: b/drivers/staging/rt2860/chip/mac_pci.h
===================================================================
--- a/drivers/staging/rt2860/chip/mac_pci.h
+++ b/drivers/staging/rt2860/chip/mac_pci.h
@@ -133,6 +133,18 @@ typedef struct PACKED _RXD_STRUC{
UINT32 Rsv1:13;
} RXD_STRUC, *PRXD_STRUC, RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC;
+typedef union _TX_ATTENUATION_CTRL_STRUC {
+ struct
+ {
+ ULONG RF_ISOLATION_ENABLE:1;
+ ULONG Reserve2:7;
+ ULONG PCIE_PHY_TX_ATTEN_VALUE:3;
+ ULONG PCIE_PHY_TX_ATTEN_EN:1;
+ ULONG Reserve1:20;
+ } field;
+
+ ULONG word;
+} TX_ATTENUATION_CTRL_STRUC, *PTX_ATTENUATION_CTRL_STRUC;
/* ----------------- EEPROM Related MACRO ----------------- */
Index: b/drivers/staging/rt2860/chip/rt3090.h
===================================================================
--- /dev/null
+++ b/drivers/staging/rt2860/chip/rt3090.h
@@ -0,0 +1,72 @@
+/*
+ *************************************************************************
+ * Ralink Tech Inc.
+ * 5F., No.36, Taiyuan St., Jhubei City,
+ * Hsinchu County 302,
+ * Taiwan, R.O.C.
+ *
+ * (c) Copyright 2002-2007, Ralink Technology, Inc.
+ *
+ * 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. *
+ * *
+ *************************************************************************
+
+ Module Name:
+ rt3090.h
+
+ Abstract:
+
+ Revision History:
+ Who When What
+ --------- ---------- ----------------------------------------------
+ */
+
+#ifndef __RT3090_H__
+#define __RT3090_H__
+
+#ifdef RT3090
+
+#ifndef RTMP_PCI_SUPPORT
+#error "For RT3090, you should define the compile flag -DRTMP_PCI_SUPPORT"
+#endif
+
+#ifndef RTMP_MAC_PCI
+#error "For RT3090, you should define the compile flag -DRTMP_MAC_PCI"
+#endif
+
+#ifndef RTMP_RF_RW_SUPPORT
+#error "For RT3090, you should define the compile flag -DRTMP_RF_RW_SUPPORT"
+#endif
+
+#ifndef RT30xx
+#error "For RT3090, you should define the compile flag -DRT30xx"
+#endif
+
+#define PCIE_PS_SUPPORT
+
+#include "mac_pci.h"
+#include "rt30xx.h"
+
+//
+// Device ID & Vendor ID, these values should match EEPROM value
+//
+#define NIC3090_PCIe_DEVICE_ID 0x3090 // 1T/1R miniCard
+#define NIC3091_PCIe_DEVICE_ID 0x3091 // 1T/2R miniCard
+#define NIC3092_PCIe_DEVICE_ID 0x3092 // 2T/2R miniCard
+
+#endif // RT3090 //
+
+#endif //__RT3090_H__ //
Index: b/drivers/staging/rt2860/chip/rtmp_phy.h
===================================================================
--- a/drivers/staging/rt2860/chip/rtmp_phy.h
+++ b/drivers/staging/rt2860/chip/rtmp_phy.h
@@ -278,6 +278,7 @@
But for some chipset which didn't have mcu (e.g., RBUS based chipset), we
will use this function too and didn't access the bbp register via the MCU.
*/
+#if 0
#define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) \
do{ \
if ((_A)->bPCIclkOff == FALSE) \
@@ -288,7 +289,99 @@
RTMP_BBP_IO_READ8((_A), (_I), (_pV), TRUE); \
} \
}while(0)
-
+#else
+// Read BBP register by register's ID. Generate PER to test BA
+#define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) \
+{ \
+ BBP_CSR_CFG_STRUC BbpCsr; \
+ int i, k; \
+ BOOLEAN brc; \
+ BbpCsr.field.Busy = IDLE; \
+ if ((IS_RT3090((_A)) || IS_RT3572((_A)) || IS_RT3390((_A))) && ((_A)->StaCfg.PSControl.field.rt30xxPowerMode == 3) \
+ && ((_A)->StaCfg.PSControl.field.EnableNewPS == TRUE) \
+ && ((_A)->bPCIclkOff == FALSE) \
+ && ((_A)->brt30xxBanMcuCmd == FALSE)) \
+ { \
+ for (i=0; i<MAX_BUSY_COUNT; i++) \
+ { \
+ RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \
+ if (BbpCsr.field.Busy == BUSY) \
+ { \
+ continue; \
+ } \
+ BbpCsr.word = 0; \
+ BbpCsr.field.fRead = 1; \
+ BbpCsr.field.BBP_RW_MODE = 1; \
+ BbpCsr.field.Busy = 1; \
+ BbpCsr.field.RegNum = _I; \
+ RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \
+ brc = AsicSendCommandToMcu(_A, 0x80, 0xff, 0x0, 0x0); \
+ if (brc == TRUE) \
+ { \
+ for (k=0; k<MAX_BUSY_COUNT; k++) \
+ { \
+ RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \
+ if (BbpCsr.field.Busy == IDLE) \
+ break; \
+ } \
+ if ((BbpCsr.field.Busy == IDLE) && \
+ (BbpCsr.field.RegNum == _I)) \
+ { \
+ *(_pV) = (UCHAR)BbpCsr.field.Value; \
+ break; \
+ } \
+ } \
+ else \
+ { \
+ BbpCsr.field.Busy = 0; \
+ RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \
+ } \
+ } \
+ } \
+ else if (!((IS_RT3090((_A)) || IS_RT3572((_A)) || IS_RT3390((_A))) && ((_A)->StaCfg.PSControl.field.rt30xxPowerMode == 3) \
+ && ((_A)->StaCfg.PSControl.field.EnableNewPS == TRUE)) \
+ && ((_A)->bPCIclkOff == FALSE)) \
+ { \
+ for (i=0; i<MAX_BUSY_COUNT; i++) \
+ { \
+ RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \
+ if (BbpCsr.field.Busy == BUSY) \
+ { \
+ continue; \
+ } \
+ BbpCsr.word = 0; \
+ BbpCsr.field.fRead = 1; \
+ BbpCsr.field.BBP_RW_MODE = 1; \
+ BbpCsr.field.Busy = 1; \
+ BbpCsr.field.RegNum = _I; \
+ RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \
+ AsicSendCommandToMcu(_A, 0x80, 0xff, 0x0, 0x0); \
+ for (k=0; k<MAX_BUSY_COUNT; k++) \
+ { \
+ RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \
+ if (BbpCsr.field.Busy == IDLE) \
+ break; \
+ } \
+ if ((BbpCsr.field.Busy == IDLE) && \
+ (BbpCsr.field.RegNum == _I)) \
+ { \
+ *(_pV) = (UCHAR)BbpCsr.field.Value; \
+ break; \
+ } \
+ } \
+ } \
+ else \
+ { \
+ DBGPRINT_ERR((" , brt30xxBanMcuCmd = %d, Read BBP %d \n", (_A)->brt30xxBanMcuCmd, (_I))); \
+ *(_pV) = (_A)->BbpWriteLatch[_I]; \
+ } \
+ if ((BbpCsr.field.Busy == BUSY) || ((_A)->bPCIclkOff == TRUE)) \
+ { \
+ DBGPRINT_ERR(("BBP read R%d=0x%x fail\n", _I, BbpCsr.word)); \
+ *(_pV) = (_A)->BbpWriteLatch[_I]; \
+ } \
+}
+#endif // 0 //
/*
basic marco for BBP write operation.
@@ -348,6 +441,7 @@
But for some chipset which didn't have mcu (e.g., RBUS based chipset), we
will use this function too and didn't access the bbp register via the MCU.
*/
+#if 0
#define RTMP_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _pV) \
do{ \
if ((_A)->bPCIclkOff == FALSE) \
@@ -358,6 +452,93 @@
RTMP_BBP_IO_WRITE8((_A), (_I), (_pV), TRUE); \
} \
}while(0)
+#else
+// Write BBP register by register's ID & value
+#define RTMP_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) \
+{ \
+ BBP_CSR_CFG_STRUC BbpCsr; \
+ INT BusyCnt = 0; \
+ BOOLEAN brc; \
+ if (_I < MAX_NUM_OF_BBP_LATCH) \
+ { \
+ if ((IS_RT3090((_A)) || IS_RT3572((_A)) || IS_RT3390((_A))) && ((_A)->StaCfg.PSControl.field.rt30xxPowerMode == 3) \
+ && ((_A)->StaCfg.PSControl.field.EnableNewPS == TRUE) \
+ && ((_A)->bPCIclkOff == FALSE) \
+ && ((_A)->brt30xxBanMcuCmd == FALSE)) \
+ { \
+ if (_A->AccessBBPFailCount > 20) \
+ { \
+ AsicResetBBPAgent(_A); \
+ _A->AccessBBPFailCount = 0; \
+ } \
+ for (BusyCnt=0; BusyCnt<MAX_BUSY_COUNT; BusyCnt++) \
+ { \
+ RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \
+ if (BbpCsr.field.Busy == BUSY) \
+ continue; \
+ BbpCsr.word = 0; \
+ BbpCsr.field.fRead = 0; \
+ BbpCsr.field.BBP_RW_MODE = 1; \
+ BbpCsr.field.Busy = 1; \
+ BbpCsr.field.Value = _V; \
+ BbpCsr.field.RegNum = _I; \
+ RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \
+ brc = AsicSendCommandToMcu(_A, 0x80, 0xff, 0x0, 0x0); \
+ if (brc == TRUE) \
+ { \
+ (_A)->BbpWriteLatch[_I] = _V; \
+ } \
+ else \
+ { \
+ BbpCsr.field.Busy = 0; \
+ RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \
+ } \
+ break; \
+ } \
+ } \
+ else if (!((IS_RT3090((_A)) || IS_RT3572((_A)) || IS_RT3390((_A))) && ((_A)->StaCfg.PSControl.field.rt30xxPowerMode == 3) \
+ && ((_A)->StaCfg.PSControl.field.EnableNewPS == TRUE)) \
+ && ((_A)->bPCIclkOff == FALSE)) \
+ { \
+ if (_A->AccessBBPFailCount > 20) \
+ { \
+ AsicResetBBPAgent(_A); \
+ _A->AccessBBPFailCount = 0; \
+ } \
+ for (BusyCnt=0; BusyCnt<MAX_BUSY_COUNT; BusyCnt++) \
+ { \
+ RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \
+ if (BbpCsr.field.Busy == BUSY) \
+ continue; \
+ BbpCsr.word = 0; \
+ BbpCsr.field.fRead = 0; \
+ BbpCsr.field.BBP_RW_MODE = 1; \
+ BbpCsr.field.Busy = 1; \
+ BbpCsr.field.Value = _V; \
+ BbpCsr.field.RegNum = _I; \
+ RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \
+ AsicSendCommandToMcu(_A, 0x80, 0xff, 0x0, 0x0); \
+ (_A)->BbpWriteLatch[_I] = _V; \
+ break; \
+ } \
+ } \
+ else \
+ { \
+ DBGPRINT_ERR((" brt30xxBanMcuCmd = %d. Write BBP %d \n", (_A)->brt30xxBanMcuCmd, (_I))); \
+ } \
+ if ((BusyCnt == MAX_BUSY_COUNT) || ((_A)->bPCIclkOff == TRUE)) \
+ { \
+ if (BusyCnt == MAX_BUSY_COUNT) \
+ (_A)->AccessBBPFailCount++; \
+ DBGPRINT_ERR(("BBP write R%d=0x%x fail. BusyCnt= %d.bPCIclkOff = %d. \n", _I, BbpCsr.word, BusyCnt, (_A)->bPCIclkOff )); \
+ } \
+ } \
+ else \
+ { \
+ DBGPRINT_ERR(("****** BBP_Write_Latch Buffer exceeds max boundry ****** \n")); \
+ } \
+}
+#endif // 0 //
#endif // RTMP_MAC_PCI //
#ifdef RTMP_MAC_USB
Index: b/drivers/staging/rt2860/chips/rt3090.c
===================================================================
--- /dev/null
+++ b/drivers/staging/rt2860/chips/rt3090.c
@@ -0,0 +1,123 @@
+/*
+ *************************************************************************
+ * Ralink Tech Inc.
+ * 5F., No.36, Taiyuan St., Jhubei City,
+ * Hsinchu County 302,
+ * Taiwan, R.O.C.
+ *
+ * (c) Copyright 2002-2007, Ralink Technology, Inc.
+ *
+ * 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. *
+ * *
+ *************************************************************************
+
+ Module Name:
+ rt3090.c
+
+ Abstract:
+ Specific funcitons and variables for RT3070
+
+ Revision History:
+ Who When What
+ -------- ---------- ----------------------------------------------
+*/
+
+#ifdef RT3090
+
+#include "../rt_config.h"
+
+
+#ifndef RTMP_RF_RW_SUPPORT
+#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip"
+#endif // RTMP_RF_RW_SUPPORT //
+
+
+VOID NICInitRT3090RFRegisters(IN PRTMP_ADAPTER pAd)
+{
+ INT i;
+ // Driver must read EEPROM to get RfIcType before initial RF registers
+ // Initialize RF register to default value
+ if (IS_RT3090(pAd))
+ {
+ // Init RF calibration
+ // Driver should toggle RF R30 bit7 before init RF registers
+ UINT32 RfReg = 0, data;
+
+ RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR)&RfReg);
+ RfReg |= 0x80;
+ RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg);
+ RTMPusecDelay(1000);
+ RfReg &= 0x7F;
+ RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg);
+
+ // init R24, R31
+ RT30xxWriteRFRegister(pAd, RF_R24, 0x0F);
+ RT30xxWriteRFRegister(pAd, RF_R31, 0x0F);
+
+ // RT309x version E has fixed this issue
+ if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211))
+ {
+ // patch tx EVM issue temporarily
+ RTMP_IO_READ32(pAd, LDO_CFG0, &data);
+ data = ((data & 0xE0FFFFFF) | 0x0D000000);
+ RTMP_IO_WRITE32(pAd, LDO_CFG0, data);
+ }
+ else
+ {
+ RTMP_IO_READ32(pAd, LDO_CFG0, &data);
+ data = ((data & 0xE0FFFFFF) | 0x01000000);
+ RTMP_IO_WRITE32(pAd, LDO_CFG0, data);
+ }
+
+ // patch LNA_PE_G1 failed issue
+ RTMP_IO_READ32(pAd, GPIO_SWITCH, &data);
+ data &= ~(0x20);
+ RTMP_IO_WRITE32(pAd, GPIO_SWITCH, data);
+
+ // Initialize RF register to default value
+ for (i = 0; i < NUM_RF_REG_PARMS; i++)
+ {
+ RT30xxWriteRFRegister(pAd, RT30xx_RFRegTable[i].Register, RT30xx_RFRegTable[i].Value);
+ }
+
+ // Driver should set RF R6 bit6 on before calibration
+ RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR)&RfReg);
+ RfReg |= 0x40;
+ RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR)RfReg);
+
+ //For RF filter Calibration
+ RTMPFilterCalibration(pAd);
+
+ // Initialize RF R27 register, set RF R27 must be behind RTMPFilterCalibration()
+ if ((pAd->MACVersion & 0xffff) < 0x0211)
+ RT30xxWriteRFRegister(pAd, RF_R27, 0x3);
+
+ // set led open drain enable
+ RTMP_IO_READ32(pAd, OPT_14, &data);
+ data |= 0x01;
+ RTMP_IO_WRITE32(pAd, OPT_14, data);
+
+ // set default antenna as main
+ if (pAd->RfIcType == RFIC_3020)
+ AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt);
+
+ // add by johnli, RF power sequence setup, load RF normal operation-mode setup
+ RT30xxLoadRFNormalModeSetup(pAd);
+ }
+
+}
+
+#endif // RT3090 //
Index: b/drivers/staging/rt2860/chips/rt30xx.c
===================================================================
--- a/drivers/staging/rt2860/chips/rt30xx.c
+++ b/drivers/staging/rt2860/chips/rt30xx.c
@@ -101,7 +101,13 @@ VOID RT30xxSetRxAnt(
if (Ant == 0)
{
// Main antenna
+#ifdef RTMP_MAC_PCI
+ RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
+ x |= (EESK);
+ RTMP_IO_WRITE32(pAd, E2PROM_CSR, x);
+#else
AsicSendCommandToMcu(pAd, 0x73, 0xFF, 0x1, 0x0);
+#endif // RTMP_MAC_PCI //
RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &Value);
Value &= ~(0x0808);
@@ -111,7 +117,13 @@ VOID RT30xxSetRxAnt(
else
{
// Aux antenna
+#ifdef RTMP_MAC_PCI
+ RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
+ x &= ~(EESK);
+ RTMP_IO_WRITE32(pAd, E2PROM_CSR, x);
+#else
AsicSendCommandToMcu(pAd, 0x73, 0xFF, 0x0, 0x0);
+#endif // RTMP_MAC_PCI //
RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &Value);
Value &= ~(0x0808);
Value |= 0x08;
Index: b/drivers/staging/rt2860/common/cmm_asic.c
===================================================================
--- a/drivers/staging/rt2860/common/cmm_asic.c
+++ b/drivers/staging/rt2860/common/cmm_asic.c
@@ -808,6 +808,28 @@ VOID AsicSwitchChannel(
RTMP_IO_WRITE32(pAd, TX_PIN_CFG, TxPinCfg);
+#if defined(RT3090) || defined(RT3390)
+ // PCIe PHY Transmit attenuation adjustment
+ if (IS_RT3090A(pAd) || IS_RT3390(pAd))
+ {
+ TX_ATTENUATION_CTRL_STRUC TxAttenuationCtrl = {0};
+
+ RTMP_IO_READ32(pAd, PCIE_PHY_TX_ATTENUATION_CTRL, &TxAttenuationCtrl.word);
+
+ if (Channel == 14) // Channel #14
+ {
+ TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_EN = 1; // Enable PCIe PHY Tx attenuation
+ TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_VALUE = 4; // 9/16 full drive level
+ }
+ else // Channel #1~#13
+ {
+ TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_EN = 0; // Disable PCIe PHY Tx attenuation
+ TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_VALUE = 0; // n/a
+ }
+
+ RTMP_IO_WRITE32(pAd, PCIE_PHY_TX_ATTENUATION_CTRL, TxAttenuationCtrl.word);
+ }
+#endif
}
else
{
@@ -2477,6 +2499,13 @@ VOID AsicTurnOnRFClk(
UCHAR index;
RTMP_RF_REGS *RFRegTable;
+#ifdef PCIE_PS_SUPPORT
+ // The RF programming sequence is difference between 3xxx and 2xxx
+ if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)))
+ {
+ return;
+ }
+#endif // PCIE_PS_SUPPORT //
RFRegTable = RF2850RegTable;
Index: b/drivers/staging/rt2860/common/cmm_data_pci.c
===================================================================
--- a/drivers/staging/rt2860/common/cmm_data_pci.c
+++ b/drivers/staging/rt2860/common/cmm_data_pci.c
@@ -638,9 +638,6 @@ BOOLEAN RTMPHandleTxRingDmaDoneInterrupt
if (TxRingBitmap.field.Ac0DmaDone)
bReschedule = RTMPFreeTXDUponTxDmaDone(pAd, QID_AC_BE);
- if (TxRingBitmap.field.HccaDmaDone)
- bReschedule |= RTMPFreeTXDUponTxDmaDone(pAd, QID_HCCA);
-
if (TxRingBitmap.field.Ac3DmaDone)
bReschedule |= RTMPFreeTXDUponTxDmaDone(pAd, QID_AC_VO);
@@ -791,7 +788,6 @@ VOID RTMPHandleRxCoherentInterrupt(
RTMPRingCleanUp(pAd, QID_AC_BK);
RTMPRingCleanUp(pAd, QID_AC_VI);
RTMPRingCleanUp(pAd, QID_AC_VO);
- RTMPRingCleanUp(pAd, QID_HCCA);
RTMPRingCleanUp(pAd, QID_MGMT);
RTMPRingCleanUp(pAd, QID_RX);
@@ -1147,7 +1143,5 @@ VOID RTMPWriteTxDescriptor(
pTxD->QSEL= (QueueSEL);
//RT2860c?? fixed using EDCA queue for test... We doubt Queue1 has problem. 2006-09-26 Jan
//pTxD->QSEL= FIFO_EDCA;
- if (pAd->bGenOneHCCA == TRUE)
- pTxD->QSEL= FIFO_HCCA;
pTxD->DMADONE = 0;
}
Index: b/drivers/staging/rt2860/common/cmm_mac_pci.c
===================================================================
--- a/drivers/staging/rt2860/common/cmm_mac_pci.c
+++ b/drivers/staging/rt2860/common/cmm_mac_pci.c
@@ -414,7 +414,6 @@ VOID RTMPRingCleanUp(
case QID_AC_BE:
case QID_AC_VI:
case QID_AC_VO:
- case QID_HCCA:
pTxRing = &pAd->TxRing[RingType];
@@ -860,11 +859,14 @@ VOID RT28xxPciStaAsicForceWakeup(
OPSTATUS_SET_FLAG(pAd, fOP_STATUS_WAKEUP_NOW);
-#ifdef RTMP_PCI_SUPPORT
- if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE))
+ RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_GO_TO_SLEEP_NOW);
+
+ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)
+ &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)
{
// Support PCIe Advance Power Save
- if (bFromTx == TRUE)
+ if (bFromTx == TRUE
+ &&(pAd->Mlme.bPsPollTimerRunning == TRUE))
{
pAd->Mlme.bPsPollTimerRunning = FALSE;
RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_WAKEUP);
@@ -877,6 +879,17 @@ VOID RT28xxPciStaAsicForceWakeup(
if (RT28xxPciAsicRadioOn(pAd, DOT11POWERSAVE))
{
+#ifdef PCIE_PS_SUPPORT
+ // add by johnli, RF power sequence setup, load RF normal operation-mode setup
+ if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd))
+ {
+ RTMP_CHIP_OP *pChipOps = &pAd->chipOps;
+
+ if (pChipOps->AsicReverseRfFromSleepMode)
+ pChipOps->AsicReverseRfFromSleepMode(pAd);
+ }
+ else
+#endif // PCIE_PS_SUPPORT //
{
// end johnli
// In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again.
@@ -895,11 +908,24 @@ VOID RT28xxPciStaAsicForceWakeup(
}
}
}
+#ifdef PCIE_PS_SUPPORT
+ // 3090 MCU Wakeup command needs more time to be stable.
+ // Before stable, don't issue other MCU command to prevent from firmware error.
+ if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd)
+ && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3)
+ && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE))
+ {
+ DBGPRINT(RT_DEBUG_TRACE, ("<==RT28xxPciStaAsicForceWakeup::Release the MCU Lock(3090)\n"));
+ RTMP_SEM_LOCK(&pAd->McuCmdLock);
+ pAd->brt30xxBanMcuCmd = FALSE;
+ RTMP_SEM_UNLOCK(&pAd->McuCmdLock);
+ }
+#endif // PCIE_PS_SUPPORT //
}
else
-#endif // RTMP_PCI_SUPPORT //
{
// PCI, 2860-PCIe
+ DBGPRINT(RT_DEBUG_TRACE, ("<==RT28xxPciStaAsicForceWakeup::Original PCI Power Saving\n"));
AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x02);
AutoWakeupCfg.word = 0;
RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word);
@@ -922,7 +948,8 @@ VOID RT28xxPciStaAsicSleepThenAutoWakeup
OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE);
return;
}
- if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE))
+ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)
+ &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)
{
ULONG Now = 0;
if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WAKEUP_NOW))
@@ -972,7 +999,6 @@ VOID RT28xxPciStaAsicSleepThenAutoWakeup
}
-#ifdef RTMP_PCI_SUPPORT
VOID PsPollWakeExec(
IN PVOID SystemSpecific1,
IN PVOID FunctionContext,
@@ -990,6 +1016,17 @@ VOID PsPollWakeExec(
}
pAd->Mlme.bPsPollTimerRunning = FALSE;
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
+#ifdef PCIE_PS_SUPPORT
+ // For rt30xx power solution 3, Use software timer to wake up in psm. So call
+ // AsicForceWakeup here instead of handling twakeup interrupt.
+ if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd))
+ && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3)
+ && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE))
+ {
+ DBGPRINT(RT_DEBUG_TRACE,("<--PsPollWakeExec::3090 calls AsicForceWakeup(pAd, DOT11POWERSAVE) in advance \n"));
+ AsicForceWakeup(pAd, DOT11POWERSAVE);
+ }
+#endif // PCIE_PS_SUPPORT //
}
VOID RadioOnExec(
@@ -1006,18 +1043,34 @@ VOID RadioOnExec(
if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE))
{
DBGPRINT(RT_DEBUG_TRACE,("-->RadioOnExec() return on fOP_STATUS_DOZE == TRUE; \n"));
+//KH Debug: Add the compile flag "RT2860 and condition
+#ifdef RTMP_PCI_SUPPORT
+ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)
+ &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)
RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10);
+#endif // RTMP_PCI_SUPPORT //
return;
}
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS))
{
DBGPRINT(RT_DEBUG_TRACE,("-->RadioOnExec() return on SCAN_IN_PROGRESS; \n"));
+#ifdef RTMP_PCI_SUPPORT
+if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)
+ &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)
RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10);
+#endif // RTMP_PCI_SUPPORT //
return;
}
+//KH Debug: need to check. I add the compile flag "CONFIG_STA_SUPPORT" to enclose the following codes.
+#ifdef RTMP_PCI_SUPPORT
+if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)
+ &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)
+ {
pAd->Mlme.bPsPollTimerRunning = FALSE;
RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled);
+ }
+#endif // RTMP_PCI_SUPPORT //
if (pAd->StaCfg.bRadio == TRUE)
{
pAd->bPCIclkOff = FALSE;
@@ -1025,7 +1078,6 @@ VOID RadioOnExec(
RTMPRingCleanUp(pAd, QID_AC_BE);
RTMPRingCleanUp(pAd, QID_AC_VI);
RTMPRingCleanUp(pAd, QID_AC_VO);
- RTMPRingCleanUp(pAd, QID_HCCA);
RTMPRingCleanUp(pAd, QID_MGMT);
RTMPRingCleanUp(pAd, QID_RX);
@@ -1058,9 +1110,23 @@ VOID RadioOnExec(
AsicLockChannel(pAd, pAd->CommonCfg.Channel);
}
+//KH Debug:The following codes should be enclosed by RT3090 compile flag
if (pChipOps->AsicReverseRfFromSleepMode)
pChipOps->AsicReverseRfFromSleepMode(pAd);
+#ifdef PCIE_PS_SUPPORT
+// 3090 MCU Wakeup command needs more time to be stable.
+// Before stable, don't issue other MCU command to prevent from firmware error.
+if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)
+ && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3)
+ && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE))
+ {
+ RTMP_SEM_LOCK(&pAd->McuCmdLock);
+ pAd->brt30xxBanMcuCmd = FALSE;
+ RTMP_SEM_UNLOCK(&pAd->McuCmdLock);
+ }
+#endif // PCIE_PS_SUPPORT //
+
// Clear Radio off flag
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF);
@@ -1077,8 +1143,6 @@ VOID RadioOnExec(
RT28xxPciAsicRadioOff(pAd, GUIRADIO_OFF, 0);
}
}
-#endif // RTMP_PCI_SUPPORT //
-
/*
==========================================================================
@@ -1102,12 +1166,24 @@ BOOLEAN RT28xxPciAsicRadioOn(
if (pAd->OpMode == OPMODE_AP && Level==DOT11POWERSAVE)
return FALSE;
-#ifdef RTMP_PCI_SUPPORT
- if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE))
+ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE))
+ {
+ if (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)
{
pAd->Mlme.bPsPollTimerRunning = FALSE;
RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled);
- if ((Level == GUIRADIO_OFF) || (Level == GUI_IDLE_POWER_SAVE))
+ }
+ if ((pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)&&
+ ((Level == GUIRADIO_OFF) || (Level == GUI_IDLE_POWER_SAVE))
+ ||(RTMP_TEST_PSFLAG(pAd, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND)))
+ {
+ // Some chips don't need to delay 6ms, so copy RTMPPCIePowerLinkCtrlRestore
+ // return condition here.
+ /*
+ if (((pAd->MACVersion&0xffff0000) != 0x28600000)
+ && ((pAd->DeviceID == NIC2860_PCIe_DEVICE_ID)
+ ||(pAd->DeviceID == NIC2790_PCIe_DEVICE_ID)))
+ */
{
DBGPRINT(RT_DEBUG_TRACE, ("RT28xxPciAsicRadioOn ()\n"));
// 1. Set PCI Link Control in Configuration Space.
@@ -1115,9 +1191,17 @@ BOOLEAN RT28xxPciAsicRadioOn(
RTMPusecDelay(6000);
}
}
-#endif // RTMP_PCI_SUPPORT //
+ }
+#ifdef PCIE_PS_SUPPORT
+if (!(((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)
+ && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3)
+ && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE))))
+#endif // PCIE_PS_SUPPORT //
+ {
pAd->bPCIclkOff = FALSE;
+ DBGPRINT(RT_DEBUG_TRACE, ("PSM :309xbPCIclkOff == %d\n", pAd->bPCIclkOff));
+ }
// 2. Send wake up command.
AsicSendCommandToMcu(pAd, 0x31, PowerWakeCID, 0x00, 0x02);
pAd->bPCIclkOff = FALSE;
@@ -1125,10 +1209,32 @@ BOOLEAN RT28xxPciAsicRadioOn(
AsicCheckCommanOk(pAd, PowerWakeCID);
RTMP_ASIC_INTERRUPT_ENABLE(pAd);
-
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF);
if (Level == GUI_IDLE_POWER_SAVE)
{
+#ifdef PCIE_PS_SUPPORT
+
+ // add by johnli, RF power sequence setup, load RF normal operation-mode setup
+ if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)))
+ {
+ RTMP_CHIP_OP *pChipOps = &pAd->chipOps;
+
+ if (pChipOps->AsicReverseRfFromSleepMode)
+ pChipOps->AsicReverseRfFromSleepMode(pAd);
+ // 3090 MCU Wakeup command needs more time to be stable.
+ // Before stable, don't issue other MCU command to prevent from firmware error.
+ if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)
+ && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3)
+ && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE))
+ {
+ RTMP_SEM_LOCK(&pAd->McuCmdLock);
+ pAd->brt30xxBanMcuCmd = FALSE;
+ RTMP_SEM_UNLOCK(&pAd->McuCmdLock);
+ }
+ }
+ else
+ // end johnli
+#endif // PCIE_PS_SUPPORT //
{
// In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again.
{
@@ -1198,11 +1304,13 @@ BOOLEAN RT28xxPciAsicRadioOff(
}
// Once go into this function, disable tx because don't want too many packets in queue to prevent HW stops.
- pAd->bPCIclkOffDisableTx = TRUE;
-
- if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE) && pAd->OpMode == OPMODE_STA)
+ //pAd->bPCIclkOffDisableTx = TRUE;
+ RTMP_SET_PSFLAG(pAd, fRTMP_PS_DISABLE_TX);
+ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)
+ && pAd->OpMode == OPMODE_STA
+ &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE
+ )
{
- printk("==>fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE\n");
RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled);
RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled);
@@ -1216,12 +1324,22 @@ BOOLEAN RT28xxPciAsicRadioOff(
{
DBGPRINT(RT_DEBUG_TRACE, ("TbTTTime = 0x%x , give up this sleep. \n", TbTTTime));
OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE);
- pAd->bPCIclkOffDisableTx = FALSE;
+ //pAd->bPCIclkOffDisableTx = FALSE;
+ RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_DISABLE_TX);
return FALSE;
}
else
{
PsPollTime = (64*TbTTTime- LEAD_TIME*1024)/1000;
+#ifdef PCIE_PS_SUPPORT
+ if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)
+ && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3)
+ && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE))
+ {
+ PsPollTime -= 5;
+ }
+ else
+#endif // PCIE_PS_SUPPORT //
PsPollTime -= 3;
BeaconPeriodTime = pAd->CommonCfg.BeaconPeriod*102/100;
@@ -1233,6 +1351,12 @@ BOOLEAN RT28xxPciAsicRadioOff(
}
}
}
+ else
+ {
+ DBGPRINT(RT_DEBUG_TRACE, ("RT28xxPciAsicRadioOff::Level!=DOT11POWERSAVE \n"));
+ }
+
+ pAd->bPCIclkOffDisableTx = FALSE;
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF);
@@ -1315,6 +1439,23 @@ BOOLEAN RT28xxPciAsicRadioOff(
pAd->CheckDmaBusyCount = 0;
}
*/
+//KH Debug:My original codes have the follwoing codes, but currecnt codes do not have it.
+// Disable for stability. If PCIE Link Control is modified for advance power save, re-covery this code segment.
+RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, 0x1280);
+//OPSTATUS_SET_FLAG(pAd, fOP_STATUS_CLKSELECT_40MHZ);
+
+#ifdef PCIE_PS_SUPPORT
+if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)
+ && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3)
+ && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE))
+ {
+ DBGPRINT(RT_DEBUG_TRACE, ("RT28xxPciAsicRadioOff::3090 return to skip the following TbttNumToNextWakeUp setting for 279x\n"));
+ pAd->bPCIclkOff = TRUE;
+ RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_DISABLE_TX);
+ // For this case, doesn't need to below actions, so return here.
+ return brc;
+ }
+#endif // PCIE_PS_SUPPORT //
if (Level == DOT11POWERSAVE)
{
@@ -1335,7 +1476,6 @@ BOOLEAN RT28xxPciAsicRadioOff(
RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word);
}
-#ifdef RTMP_PCI_SUPPORT
// 4-1. If it's to disable our device. Need to restore PCI Configuration Space to its original value.
if (Level == RTMP_HALT && pAd->OpMode == OPMODE_STA)
{
@@ -1348,9 +1488,9 @@ BOOLEAN RT28xxPciAsicRadioOff(
if ((brc == TRUE) && (i < 50))
RTMPPCIeLinkCtrlSetting(pAd, 3);
}
-#endif // RTMP_PCI_SUPPORT //
- pAd->bPCIclkOffDisableTx = FALSE;
+ //pAd->bPCIclkOffDisableTx = FALSE;
+ RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_DISABLE_TX);
return TRUE;
}
@@ -1365,41 +1505,37 @@ VOID RT28xxPciMlmeRadioOn(
DBGPRINT(RT_DEBUG_TRACE,("%s===>\n", __func__));
- if ((pAd->OpMode == OPMODE_AP) ||
- ((pAd->OpMode == OPMODE_STA) && (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE))))
+ if ((pAd->OpMode == OPMODE_AP) ||
+ ((pAd->OpMode == OPMODE_STA)
+ && (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)
+ ||pAd->StaCfg.PSControl.field.EnableNewPS == FALSE
+ )))
{
- if (pAd->OpMode == OPMODE_AP)
RT28xxPciAsicRadioOn(pAd, GUI_IDLE_POWER_SAVE);
-
//NICResetFromError(pAd);
RTMPRingCleanUp(pAd, QID_AC_BK);
RTMPRingCleanUp(pAd, QID_AC_BE);
RTMPRingCleanUp(pAd, QID_AC_VI);
RTMPRingCleanUp(pAd, QID_AC_VO);
- RTMPRingCleanUp(pAd, QID_HCCA);
RTMPRingCleanUp(pAd, QID_MGMT);
RTMPRingCleanUp(pAd, QID_RX);
- if (pAd->OpMode == OPMODE_STA)
- {
- AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x02);
- RTMPusecDelay(10000);
- }
-
// Enable Tx/Rx
RTMPEnableRxTx(pAd);
// Clear Radio off flag
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF);
+ RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF);
+
// Set LED
RTMPSetLED(pAd, LED_RADIO_ON);
}
-#ifdef RTMP_PCI_SUPPORT
if ((pAd->OpMode == OPMODE_STA) &&
- (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)))
+ (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE))
+ &&(pAd->StaCfg.PSControl.field.EnableNewPS == TRUE))
{
BOOLEAN Cancelled;
@@ -1408,9 +1544,8 @@ VOID RT28xxPciMlmeRadioOn(
pAd->Mlme.bPsPollTimerRunning = FALSE;
RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled);
RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled);
- RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10);
+ RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 40);
}
-#endif // RTMP_PCI_SUPPORT //
}
@@ -1455,19 +1590,33 @@ VOID RT28xxPciMlmeRadioOFF(
{
BOOLEAN Cancelled;
+ if (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)
+ {
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS))
{
RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &Cancelled);
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS);
}
-
- if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE))
+ // If during power safe mode.
+ if (pAd->StaCfg.bRadio == TRUE)
+ {
+ DBGPRINT(RT_DEBUG_TRACE,("-->MlmeRadioOff() return on bRadio == TRUE; \n"));
+ return;
+ }
+ // Always radio on since the NIC needs to set the MCU command (LED_RADIO_OFF).
+ if (IDLE_ON(pAd) &&
+ (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF)))
+ {
+ RT28xxPciAsicRadioOn(pAd, GUI_IDLE_POWER_SAVE);
+ }
+ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE))
{
BOOLEAN Cancelled;
pAd->Mlme.bPsPollTimerRunning = FALSE;
RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled);
RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled);
}
+ }
// Link down first if any association exists
if (INFRA_ON(pAd) || ADHOC_ON(pAd))
@@ -1477,28 +1626,38 @@ VOID RT28xxPciMlmeRadioOFF(
// Clean up old bss table
BssTableInit(&pAd->ScanTab);
- if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE))
+ /*
+ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE))
{
RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10);
return;
}
+ */
}
- // Set LED
+ // Set LED.Move to here for fixing LED bug. This flag must be called after LinkDown
RTMPSetLED(pAd, LED_RADIO_OFF);
- if (pAd->OpMode == OPMODE_AP)
+//KH Debug:All PCIe devices need to use timer to execute radio off function, or the PCIe&&EnableNewPS needs.
+//KH Ans:It is right, because only when the PCIe and EnableNewPs is true, we need to delay the RadioOffTimer
+//to avoid the deadlock with PCIe Power saving function.
+if (pAd->OpMode == OPMODE_STA&&
+ OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)&&
+ pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)
+ {
+ RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10);
+ }
+else
+{
brc=RT28xxPciAsicRadioOff(pAd, GUIRADIO_OFF, 0);
if (brc==FALSE)
{
DBGPRINT(RT_DEBUG_ERROR,("%s call RT28xxPciAsicRadioOff fail !!\n", __func__));
}
-
-
- if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE) &&
- (pAd->OpMode == OPMODE_STA))
- AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x02);
+}
+/*
+*/
}
#endif // RTMP_MAC_PCI //
Index: b/drivers/staging/rt2860/common/cmm_profile.c
===================================================================
--- a/drivers/staging/rt2860/common/cmm_profile.c
+++ b/drivers/staging/rt2860/common/cmm_profile.c
@@ -1266,6 +1266,49 @@ NDIS_STATUS RTMPSetProfileParameters(
DBGPRINT(RT_DEBUG_TRACE, ("%s::(NetworkType=%d)\n", __func__, pAd->StaCfg.BssType));
}
}
+#ifdef RTMP_MAC_PCI
+ //NewPCIePS
+ if(RTMPGetKeyParameter("NewPCIePS", tmpbuf, 10, pBuffer, TRUE))
+ {
+ UCHAR temp_buffer = (UCHAR) simple_strtol(tmpbuf, 0, 10);
+ if(temp_buffer>0)
+ pAd->StaCfg.PSControl.field.EnableNewPS=TRUE;
+ else
+ pAd->StaCfg.PSControl.field.EnableNewPS=FALSE;
+ DBGPRINT(RT_DEBUG_TRACE, ("NewPCIePS=%d\n", pAd->StaCfg.PSControl.field.EnableNewPS));
+ }
+#endif // RTMP_MAC_PCI //
+#ifdef RT3090
+ //PCIePowerLevel
+
+ if(RTMPGetKeyParameter("PCIePowerLevel", tmpbuf, 10, pBuffer, TRUE))
+ {
+ pAd->StaCfg.PSControl.field.rt30xxPowerMode = (UCHAR) simple_strtol(tmpbuf, 0, 10);
+ DBGPRINT(RT_DEBUG_TRACE, ("PCIePowerLevel=%d\n", pAd->StaCfg.PSControl.field.rt30xxPowerMode));
+ }
+ //FollowHostASPM
+ if(RTMPGetKeyParameter("FollowHostASPM", tmpbuf, 10, pBuffer, TRUE))
+ {
+ UCHAR temp_buffer = (UCHAR) simple_strtol(tmpbuf, 0, 10);
+
+ if(temp_buffer>0)
+ pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM=TRUE;
+ else
+ pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM=FALSE;
+ DBGPRINT(RT_DEBUG_TRACE, ("rt30xxFollowHostASPM=%d\n", pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM));
+ }
+ //ForceTestASPM
+ if(RTMPGetKeyParameter("ForceTestASPM", tmpbuf, 10, pBuffer, TRUE))
+ {
+ UCHAR temp_buffer = (UCHAR) simple_strtol(tmpbuf, 0, 10);
+
+ if(temp_buffer>0)
+ pAd->StaCfg.PSControl.field.rt30xxForceASPMTest=TRUE;
+ else
+ pAd->StaCfg.PSControl.field.rt30xxForceASPMTest=FALSE;
+ DBGPRINT(RT_DEBUG_TRACE, ("rt30xxForceASPM=%d\n", pAd->StaCfg.PSControl.field.rt30xxForceASPMTest));
+ }
+#endif // RT3090 //
//Channel
if(RTMPGetKeyParameter("Channel", tmpbuf, 10, pBuffer, TRUE))
{
Index: b/drivers/staging/rt2860/common/cmm_sync.c
===================================================================
--- a/drivers/staging/rt2860/common/cmm_sync.c
+++ b/drivers/staging/rt2860/common/cmm_sync.c
@@ -432,19 +432,6 @@ VOID ScanNextChannel(
}
{
-#ifdef RT2860
- /*
- If all peer Ad-hoc clients leave, driver would do LinkDown and LinkUp.
- In LinkUp, CommonCfg.Ssid would copy SSID from MlmeAux.
- To prevent SSID is zero or wrong in Beacon, need to recover MlmeAux.SSID here.
- */
- if (ADHOC_ON(pAd))
- {
- NdisZeroMemory(pAd->MlmeAux.Ssid, MAX_LEN_OF_SSID);
- pAd->MlmeAux.SsidLen = pAd->CommonCfg.SsidLen;
- NdisMoveMemory(pAd->MlmeAux.Ssid, pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen);
- }
-#endif // RT2860 //
//
// To prevent data lost.
// Send an NULL data with turned PSM bit on to current associated AP before SCAN progress.
Index: b/drivers/staging/rt2860/common/mlme.c
===================================================================
--- a/drivers/staging/rt2860/common/mlme.c
+++ b/drivers/staging/rt2860/common/mlme.c
@@ -397,7 +397,7 @@ NDIS_STATUS MlmeInit(
{
#ifdef RTMP_PCI_SUPPORT
- if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE))
+ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE))
{
// only PCIe cards need these two timers
RTMPInitTimer(pAd, &pAd->Mlme.PsPollTimer, GET_TIMER_FUNCTION(PsPollWakeExec), pAd, FALSE);
@@ -569,7 +569,8 @@ VOID MlmeHalt(
#ifdef RTMP_MAC_PCI
- if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE))
+ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)
+ &&(pAd->StaCfg.PSControl.field.EnableNewPS == TRUE))
{
RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled);
RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled);
@@ -678,6 +679,7 @@ VOID MlmePeriodicExec(
{
ULONG TxTotalCnt;
PRTMP_ADAPTER pAd = (RTMP_ADAPTER *)FunctionContext;
+ SHORT realavgrssi;
#ifdef RTMP_MAC_PCI
{
@@ -691,7 +693,27 @@ VOID MlmePeriodicExec(
UINT32 data = 0;
// Read GPIO pin2 as Hardware controlled radio state
+#ifndef RT3090
RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &data);
+#endif // RT3090 //
+//KH(PCIE PS):Added based on Jane<--
+#ifdef RT3090
+// Read GPIO pin2 as Hardware controlled radio state
+// We need to Read GPIO if HW said so no mater what advance power saving
+if ((pAd->OpMode == OPMODE_STA) && (IDLE_ON(pAd))
+ && (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))
+ && (pAd->StaCfg.PSControl.field.EnablePSinIdle == TRUE))
+ {
+ // Want to make sure device goes to L0 state before reading register.
+ RTMPPCIeLinkCtrlValueRestore(pAd, 0);
+ RTMP_IO_FORCE_READ32(pAd, GPIO_CTRL_CFG, &data);
+ RTMPPCIeLinkCtrlSetting(pAd, 3);
+ }
+else
+ RTMP_IO_FORCE_READ32(pAd, GPIO_CTRL_CFG, &data);
+#endif // RT3090 //
+//KH(PCIE PS):Added based on Jane-->
+
if (data & 0x04)
{
pAd->StaCfg.bHwRadio = TRUE;
@@ -1187,6 +1209,60 @@ VOID STAMlmePeriodicExec(
}
}
#endif
+#ifdef PCIE_PS_SUPPORT
+// don't perform idle-power-save mechanism within 3 min after driver initialization.
+// This can make rebooter test more robust
+if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE))
+ {
+ if ((pAd->OpMode == OPMODE_STA) && (IDLE_ON(pAd))
+ && (pAd->Mlme.SyncMachine.CurrState == SYNC_IDLE)
+ && (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE)
+ && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF)))
+ {
+ if (IS_RT3090(pAd)|| IS_RT3572(pAd) || IS_RT3390(pAd))
+ {
+ if (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)
+ {
+ DBGPRINT(RT_DEBUG_TRACE, ("%s::%d\n",__FUNCTION__,__LINE__));
+
+ RT28xxPciAsicRadioOff(pAd, GUI_IDLE_POWER_SAVE, 0);
+ }
+ else
+ {
+ DBGPRINT(RT_DEBUG_TRACE, ("%s::%d\n",__FUNCTION__,__LINE__));
+ AsicSendCommandToMcu(pAd, 0x30, PowerSafeCID, 0xff, 0x2);
+ // Wait command success
+ AsicCheckCommanOk(pAd, PowerSafeCID);
+ RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF);
+ DBGPRINT(RT_DEBUG_TRACE, ("PSM - rt30xx Issue Sleep command)\n"));
+ }
+ }
+ else if (pAd->Mlme.OneSecPeriodicRound > 180)
+ {
+ if (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)
+ {
+ DBGPRINT(RT_DEBUG_TRACE, ("%s::%d\n",__FUNCTION__,__LINE__));
+ RT28xxPciAsicRadioOff(pAd, GUI_IDLE_POWER_SAVE, 0);
+ }
+ else
+ {
+ DBGPRINT(RT_DEBUG_TRACE, ("%s::%d\n",__FUNCTION__,__LINE__));
+ AsicSendCommandToMcu(pAd, 0x30, PowerSafeCID, 0xff, 0x02);
+ // Wait command success
+ AsicCheckCommanOk(pAd, PowerSafeCID);
+ RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF);
+ DBGPRINT(RT_DEBUG_TRACE, ("PSM - rt28xx Issue Sleep command)\n"));
+ }
+ }
+ }
+ else
+ {
+ DBGPRINT(RT_DEBUG_TRACE,("STAMlmePeriodicExec MMCHK - CommonCfg.Ssid[%d]=%c%c%c%c... MlmeAux.Ssid[%d]=%c%c%c%c...\n",
+ pAd->CommonCfg.SsidLen, pAd->CommonCfg.Ssid[0], pAd->CommonCfg.Ssid[1], pAd->CommonCfg.Ssid[2], pAd->CommonCfg.Ssid[3],
+ pAd->MlmeAux.SsidLen, pAd->MlmeAux.Ssid[0], pAd->MlmeAux.Ssid[1], pAd->MlmeAux.Ssid[2], pAd->MlmeAux.Ssid[3]));
+ }
+ }
+#endif // PCIE_PS_SUPPORT //
if (pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_DISABLE)
{
@@ -1275,10 +1351,6 @@ VOID STAMlmePeriodicExec(
{
DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - No BEACON. Dead CQI. Auto Recovery attempt #%ld\n", pAd->RalinkCounters.BadCQIAutoRecoveryCount));
- if ((pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) &&
- (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2))
- pAd->StaCfg.bLostAp = TRUE;
-
// Lost AP, send disconnect & link down event
LinkDown(pAd, FALSE);
@@ -2240,10 +2312,6 @@ VOID MlmeDynamicTxRateSwitching(
}
pEntry->LastTxOkCount = TxSuccess;
-#ifdef RT2860
- pNextTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(pEntry->CurrTxRateIndex+1)*5];
-#endif // RT2860 //
-#if defined(RT2870) || defined(RT3070)
{
UCHAR tmpTxRate;
@@ -2261,7 +2329,6 @@ VOID MlmeDynamicTxRateSwitching(
pNextTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(tmpTxRate+1)*5];
}
-#endif // RT2870 //
if (bTxRateChanged && pNextTxRate)
{
MlmeSetTxRate(pAd, pEntry, pNextTxRate);
@@ -3805,14 +3872,6 @@ VOID BssTableSsidSort(
DBGPRINT(RT_DEBUG_TRACE,("STA is in N-only Mode, this AP don't have Ht capability in Beacon.\n"));
continue;
}
-#ifdef RT2860
- if ((pAd->CommonCfg.PhyMode == PHY_11GN_MIXED) &&
- ((pInBss->SupRateLen + pInBss->ExtRateLen) < 12))
- {
- DBGPRINT(RT_DEBUG_TRACE,("STA is in GN-only Mode, this AP is in B mode.\n"));
- continue;
- }
-#endif // RT2860 //
// New for WPA2
// Check the Authmode first
if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA)
@@ -3921,14 +3980,7 @@ VOID BssTableSsidSort(
DBGPRINT(RT_DEBUG_TRACE,("STA is in N-only Mode, this AP don't have Ht capability in Beacon.\n"));
continue;
}
-#ifdef RT2860
- if ((pAd->CommonCfg.PhyMode == PHY_11GN_MIXED) &&
- ((pInBss->SupRateLen + pInBss->ExtRateLen) < 12))
- {
- DBGPRINT(RT_DEBUG_TRACE,("STA is in GN-only Mode, this AP is in B mode.\n"));
- continue;
- }
-#endif // RT2860 //
+
// New for WPA2
// Check the Authmode first
if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA)
@@ -5495,6 +5547,9 @@ VOID AsicEvaluateRxAnt(
#ifdef RT30xx
|| (pAd->EepromAccess)
#endif // RT30xx //
+#ifdef RT3090
+ || (pAd->bPCIclkOff == TRUE)
+#endif // RT3090 //
)
return;
@@ -5583,6 +5638,9 @@ VOID AsicRxAntEvalTimeout(
#ifdef RT30xx
|| (pAd->EepromAccess)
#endif // RT30xx //
+#ifdef RT3090
+ || (pAd->bPCIclkOff == TRUE)
+#endif // RT3090 //
)
return;
Index: b/drivers/staging/rt2860/common/rt_rf.c
===================================================================
--- a/drivers/staging/rt2860/common/rt_rf.c
+++ b/drivers/staging/rt2860/common/rt_rf.c
@@ -187,6 +187,14 @@ VOID RtmpChipOpsRFHook(
}
}
#endif // RT3070 //
+#ifdef RT3090
+ if (IS_RT3090(pAd) && (pAd->infType == RTMP_DEV_INF_PCI))
+ {
+ pChipOps->AsicRfTurnOff = RT30xxLoadRFSleepModeSetup;
+ pChipOps->AsicRfInit = NICInitRT3090RFRegisters;
+ pChipOps->AsicReverseRfFromSleepMode = RT30xxReverseRFSleepModeSetup;
+ }
+#endif // RT3090 //
}
#endif // RT30xx //
}
Index: b/drivers/staging/rt2860/common/rtmp_init.c
===================================================================
--- a/drivers/staging/rt2860/common/rtmp_init.c
+++ b/drivers/staging/rt2860/common/rtmp_init.c
@@ -191,6 +191,9 @@ NDIS_STATUS RTMPAllocAdapterBlock(
NdisAllocateSpinLock(&pAd->MgmtRingLock);
#ifdef RTMP_MAC_PCI
NdisAllocateSpinLock(&pAd->RxRingLock);
+#ifdef RT3090
+ NdisAllocateSpinLock(&pAd->McuCmdLock);
+#endif // RT3090 //
#endif // RTMP_MAC_PCI //
for (index =0 ; index < NUM_OF_TX_RING; index++)
@@ -1238,7 +1241,13 @@ VOID NICInitAsicFromEEPROM(
{
RTMPSetLED(pAd, LED_RADIO_ON);
#ifdef RTMP_MAC_PCI
+#ifdef RT3090
+ AsicSendCommandToMcu(pAd, 0x30, PowerRadioOffCID, 0xff, 0x02);
+ AsicCheckCommanOk(pAd, PowerRadioOffCID);
+#endif // RT3090 //
+#ifndef RT3090
AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x02);
+#endif // RT3090 //
AsicSendCommandToMcu(pAd, 0x31, PowerWakeCID, 0x00, 0x00);
// 2-1. wait command ok.
AsicCheckCommanOk(pAd, PowerWakeCID);
@@ -1246,6 +1255,29 @@ VOID NICInitAsicFromEEPROM(
}
}
+#ifdef RTMP_MAC_PCI
+#ifdef RT30xx
+ if (IS_RT3090(pAd)|| IS_RT3572(pAd) || IS_RT3390(pAd))
+ {
+ RTMP_CHIP_OP *pChipOps = &pAd->chipOps;
+ if (pChipOps->AsicReverseRfFromSleepMode)
+ pChipOps->AsicReverseRfFromSleepMode(pAd);
+ }
+ // 3090 MCU Wakeup command needs more time to be stable.
+ // Before stable, don't issue other MCU command to prevent from firmware error.
+
+ if ((IS_RT3090(pAd)|| IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)
+ && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3)
+ && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE))
+ {
+ DBGPRINT(RT_DEBUG_TRACE,("%s::%d,release Mcu Lock\n",__FUNCTION__,__LINE__));
+ RTMP_SEM_LOCK(&pAd->McuCmdLock);
+ pAd->brt30xxBanMcuCmd = FALSE;
+ RTMP_SEM_UNLOCK(&pAd->McuCmdLock);
+ }
+#endif // RT30xx //
+#endif // RTMP_MAC_PCI //
+
// Turn off patching for cardbus controller
if (NicConfig2.field.CardbusAcceleration == 1)
{
@@ -1443,11 +1475,6 @@ retry:
RTMP_IO_WRITE32(pAd, TX_BASE_PTR3, Value);
DBGPRINT(RT_DEBUG_TRACE, ("--> TX_BASE_PTR3 : 0x%x\n", Value));
- // Write HCCA base address register
- Value = RTMP_GetPhysicalAddressLow(pAd->TxRing[QID_HCCA].Cell[0].AllocPa);
- RTMP_IO_WRITE32(pAd, TX_BASE_PTR4, Value);
- DBGPRINT(RT_DEBUG_TRACE, ("--> TX_BASE_PTR4 : 0x%x\n", Value));
-
// Write MGMT_BASE_CSR register
Value = RTMP_GetPhysicalAddressLow(pAd->MgmtRing.Cell[0].AllocPa);
RTMP_IO_WRITE32(pAd, TX_BASE_PTR5, Value);
@@ -1641,7 +1668,7 @@ NDIS_STATUS NICInitializeAsic(
for(Index=0; Index<NUM_MAC_REG_PARMS; Index++)
{
#ifdef RT30xx
- if ((MACRegTable[Index].Register == TX_SW_CFG0) && (IS_RT3070(pAd) || IS_RT3071(pAd) || IS_RT3572(pAd)))
+ if ((MACRegTable[Index].Register == TX_SW_CFG0) && (IS_RT3070(pAd) || IS_RT3071(pAd) || IS_RT3572(pAd) || IS_RT3090(pAd) || IS_RT3390(pAd)))
{
MACRegTable[Index].Value = 0x00000400;
}
@@ -1713,6 +1740,11 @@ NDIS_STATUS NICInitializeAsic(
// PCI and USB are not the same because PCI driver needs to wait for PCI bus ready
RTMP_IO_WRITE32(pAd, H2M_BBP_AGENT, 0); // initialize BBP R/W access agent
RTMP_IO_WRITE32(pAd, H2M_MAILBOX_CSR, 0);
+#ifdef RT3090
+ //2008/11/28:KH add to fix the dead rf frequency offset bug<--
+ AsicSendCommandToMcu(pAd, 0x72, 0, 0, 0);
+ //2008/11/28:KH add to fix the dead rf frequency offset bug-->
+#endif // RT3090 //
RTMPusecDelay(1000);
// Read BBP register, make sure BBP is up and running before write new data
@@ -2588,6 +2620,8 @@ VOID UserCfgInit(
pAd->LedIndicatorStrength = 0;
pAd->RLnkCtrlOffset = 0;
pAd->HostLnkCtrlOffset = 0;
+ pAd->StaCfg.PSControl.field.EnableNewPS=TRUE;
+ pAd->CheckDmaBusyCount = 0;
#endif // RTMP_MAC_PCI //
pAd->bAutoTxAgcA = FALSE; // Default is OFF
@@ -2600,8 +2634,6 @@ VOID UserCfgInit(
pAd->bForcePrintRX = FALSE;
pAd->bStaFifoTest = FALSE;
pAd->bProtectionTest = FALSE;
- pAd->bHCCATest = FALSE;
- pAd->bGenOneHCCA = FALSE;
pAd->CommonCfg.Dsifs = 10; // in units of usec
pAd->CommonCfg.TxPower = 100; //mW
pAd->CommonCfg.TxPowerPercentage = 0xffffffff; // AUTO
@@ -2720,6 +2752,15 @@ VOID UserCfgInit(
pAd->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
}
+#ifdef PCIE_PS_SUPPORT
+pAd->brt30xxBanMcuCmd = FALSE;
+pAd->b3090ESpecialChip = FALSE;
+//KH Debug:the following must be removed
+pAd->StaCfg.PSControl.field.rt30xxPowerMode=3;
+pAd->StaCfg.PSControl.field.rt30xxForceASPMTest=0;
+pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM=1;
+#endif // PCIE_PS_SUPPORT //
+
// global variables mXXXX used in MAC protocol state machines
OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM);
OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_ADHOC_ON);
@@ -2757,6 +2798,9 @@ VOID UserCfgInit(
pAd->StaCfg.LastScanTime -= (10 * OS_HZ);
NdisZeroMemory(pAd->nickname, IW_ESSID_MAX_SIZE+1);
+#ifdef RTMP_MAC_PCI
+ sprintf((PSTRING) pAd->nickname, "RT2860STA");
+#endif // RTMP_MAC_PCI //
#ifdef RTMP_MAC_USB
sprintf((PSTRING) pAd->nickname, "RT2870STA");
#endif // RTMP_MAC_USB //
@@ -2766,7 +2810,6 @@ VOID UserCfgInit(
pAd->StaCfg.WpaSupplicantUP = WPA_SUPPLICANT_DISABLE;
pAd->StaCfg.bRSN_IE_FromWpaSupplicant = FALSE;
pAd->StaCfg.WpaSupplicantUP = WPA_SUPPLICANT_ENABLE;
- pAd->StaCfg.bLostAp = FALSE;
NdisZeroMemory(pAd->StaCfg.ReplayCounter, 8);
@@ -3272,7 +3315,7 @@ int rt28xx_init(
// NICLoadFirmware will hang forever when interface is up again.
// RT2860 PCI
if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) &&
- OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE))
+ OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE))
{
AUTO_WAKEUP_STRUC AutoWakeupCfg;
AsicForceWakeup(pAd, TRUE);
@@ -3307,6 +3350,16 @@ int rt28xx_init(
DBGPRINT(RT_DEBUG_TRACE, ("MAC_CSR0 [ Ver:Rev=0x%08x]\n", pAd->MACVersion));
#ifdef RTMP_MAC_PCI
+#ifdef PCIE_PS_SUPPORT
+ /*Iverson patch PCIE L1 issue to make sure that driver can be read,write ,BBP and RF register at pcie L.1 level */
+ if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))&&OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE))
+ {
+ RTMP_IO_READ32(pAd, AUX_CTRL, &MacCsr0);
+ MacCsr0 |= 0x402;
+ RTMP_IO_WRITE32(pAd, AUX_CTRL, MacCsr0);
+ DBGPRINT(RT_DEBUG_TRACE, ("AUX_CTRL = 0x%x\n", MacCsr0));
+ }
+#endif // PCIE_PS_SUPPORT //
// To fix driver disable/enable hang issue when radio off
RTMP_IO_WRITE32(pAd, PWR_PIN_CFG, 0x2);
Index: b/drivers/staging/rt2860/common/rtmp_mcu.c
===================================================================
--- a/drivers/staging/rt2860/common/rtmp_mcu.c
+++ b/drivers/staging/rt2860/common/rtmp_mcu.c
@@ -38,8 +38,9 @@
#include "../rt_config.h"
-#ifdef RT2860
+#if defined(RT2860) || defined(RT3090)
#include "firmware.h"
+#include "../../rt3090/firmware.h"
#endif
#ifdef RT2870
#include "../../rt3070/firmware.h"
@@ -115,20 +116,18 @@ NDIS_STATUS RtmpAsicLoadFirmware(
{
NDIS_STATUS Status = NDIS_STATUS_SUCCESS;
- PUCHAR pFirmwareImage;
+ PUCHAR pFirmwareImage = NULL;
ULONG FileLength, Index;
- //ULONG firm;
UINT32 MacReg = 0;
UINT32 Version = (pAd->MACVersion >> 16);
-// pFirmwareImage = FirmwareImage;
-// FileLength = sizeof(FirmwareImage);
-
// New 8k byte firmware size for RT3071/RT3072
{
#ifdef RTMP_MAC_PCI
- if ((Version == 0x2860) || (Version == 0x3572) || IS_RT3090(pAd))
- {
+ if (IS_RT3090(pAd) || IS_RT3390(pAd)) {
+ pFirmwareImage = FirmwareImage_3090;
+ FileLength = FIRMWAREIMAGE_MAX_LENGTH;
+ } else {
pFirmwareImage = FirmwareImage_2860;
FileLength = FIRMWAREIMAGE_MAX_LENGTH;
}
@@ -190,11 +189,74 @@ INT RtmpAsicSendCommandToMcu(
HOST_CMD_CSR_STRUC H2MCmd;
H2M_MAILBOX_STRUC H2MMailbox;
ULONG i = 0;
-#ifdef RTMP_MAC_PCI
-#endif // RTMP_MAC_PCI //
+
+#ifdef PCIE_PS_SUPPORT
+ // 3090F power solution 3 has hw limitation that needs to ban all mcu command
+ // when firmware is in radio state. For other chip doesn't have this limitation.
+ if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd)
+ && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3)
+ && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE))
+ {
+ RTMP_SEM_LOCK(&pAd->McuCmdLock);
+ if ((pAd->brt30xxBanMcuCmd == TRUE)
+ && (Command != WAKE_MCU_CMD) && (Command != RFOFF_MCU_CMD))
+ {
+ RTMP_SEM_UNLOCK(&pAd->McuCmdLock);
+ DBGPRINT(RT_DEBUG_TRACE, (" Ban Mcu Cmd %x in sleep mode\n", Command));
+ return FALSE;
+ }
+ else if ((Command == SLEEP_MCU_CMD)
+ ||(Command == RFOFF_MCU_CMD))
+ {
+ pAd->brt30xxBanMcuCmd = TRUE;
+ }
+ else if (Command != WAKE_MCU_CMD)
+ {
+ pAd->brt30xxBanMcuCmd = FALSE;
+ }
+
+ RTMP_SEM_UNLOCK(&pAd->McuCmdLock);
+
+ }
+ if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd)
+ && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3)
+ && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)
+ && (Command == WAKE_MCU_CMD))
+ {
do
{
+ RTMP_IO_FORCE_READ32(pAd, H2M_MAILBOX_CSR, &H2MMailbox.word);
+ if (H2MMailbox.field.Owner == 0)
+ break;
+
+ RTMPusecDelay(2);
+ DBGPRINT(RT_DEBUG_INFO, ("AsicSendCommanToMcu::Mail box is busy\n"));
+ } while(i++ < 100);
+
+ if (i >= 100)
+ {
+ DBGPRINT_ERR(("H2M_MAILBOX still hold by MCU. command fail\n"));
+ return FALSE;
+ }
+
+ H2MMailbox.field.Owner = 1; // pass ownership to MCU
+ H2MMailbox.field.CmdToken = Token;
+ H2MMailbox.field.HighByte = Arg1;
+ H2MMailbox.field.LowByte = Arg0;
+ RTMP_IO_FORCE_WRITE32(pAd, H2M_MAILBOX_CSR, H2MMailbox.word);
+
+ H2MCmd.word = 0;
+ H2MCmd.field.HostCommand = Command;
+ RTMP_IO_FORCE_WRITE32(pAd, HOST_CMD_CSR, H2MCmd.word);
+
+
+ }
+ else
+#endif // PCIE_PS_SUPPORT //
+ {
+ do
+ {
RTMP_IO_READ32(pAd, H2M_MAILBOX_CSR, &H2MMailbox.word);
if (H2MMailbox.field.Owner == 0)
break;
@@ -228,6 +290,22 @@ INT RtmpAsicSendCommandToMcu(
if (Command != 0x80)
{
}
+}
+#ifdef PCIE_PS_SUPPORT
+ // 3090 MCU Wakeup command needs more time to be stable.
+ // Before stable, don't issue other MCU command to prevent from firmware error.
+ if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd)
+ && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3)
+ && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)
+ && (Command == WAKE_MCU_CMD))
+ {
+ RTMPusecDelay(2000);
+ //Put this is after RF programming.
+ //NdisAcquireSpinLock(&pAd->McuCmdLock);
+ //pAd->brt30xxBanMcuCmd = FALSE;
+ //NdisReleaseSpinLock(&pAd->McuCmdLock);
+ }
+#endif // PCIE_PS_SUPPORT //
return TRUE;
}
Index: b/drivers/staging/rt2860/common/rtmp_timer.c
===================================================================
--- a/drivers/staging/rt2860/common/rtmp_timer.c
+++ b/drivers/staging/rt2860/common/rtmp_timer.c
@@ -59,10 +59,10 @@ BUILD_TIMER_FUNCTION(DisassocTimeout);
BUILD_TIMER_FUNCTION(LinkDownExec);
BUILD_TIMER_FUNCTION(StaQuickResponeForRateUpExec);
BUILD_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc);
-#ifdef RTMP_PCI_SUPPORT
+#ifdef RTMP_MAC_PCI
BUILD_TIMER_FUNCTION(PsPollWakeExec);
BUILD_TIMER_FUNCTION(RadioOnExec);
-#endif // RTMP_PCI_SUPPORT //
+#endif // RTMP_MAC_PCI //
#ifdef RTMP_MAC_USB
BUILD_TIMER_FUNCTION(RtmpUsbStaAsicForceWakeupTimeout);
#endif // RTMP_MAC_USB //
Index: b/drivers/staging/rt2860/iface/rtmp_pci.h
===================================================================
--- a/drivers/staging/rt2860/iface/rtmp_pci.h
+++ b/drivers/staging/rt2860/iface/rtmp_pci.h
@@ -38,9 +38,7 @@
#define RT28XX_PUT_DEVICE(dev_p)
-#ifndef SA_SHIRQ
#define SA_SHIRQ IRQF_SHARED
-#endif
#ifdef PCI_MSI_SUPPORT
#define RTMP_MSI_ENABLE(_pAd) \
Index: b/drivers/staging/rt2860/pci_main_dev.c
===================================================================
--- a/drivers/staging/rt2860/pci_main_dev.c
+++ b/drivers/staging/rt2860/pci_main_dev.c
@@ -38,6 +38,13 @@
#include "rt_config.h"
#include <linux/pci.h>
+// Following information will be show when you run 'modinfo'
+// *** If you have a solution for the bug in current version of driver, please mail to me.
+// Otherwise post to forum in ralinktech's web site(www.ralinktech.com) and let all users help you. ***
+MODULE_AUTHOR("Jett Chen <jett_chen@ralinktech.com>");
+MODULE_DESCRIPTION("RT2860/RT3090 Wireless Lan Linux Driver");
+MODULE_LICENSE("GPL");
+
//
// Function declarations
//
@@ -63,6 +70,7 @@ static int rt2860_resume(struct pci_dev
//
static struct pci_device_id rt2860_pci_tbl[] __devinitdata =
{
+#ifdef RT2860
{PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2860_PCI_DEVICE_ID)}, //RT28602.4G
{PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2860_PCIe_DEVICE_ID)},
{PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2760_PCI_DEVICE_ID)},
@@ -75,11 +83,21 @@ static struct pci_device_id rt2860_pci_t
{PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7738)},
{PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7748)},
{PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7768)},
+#endif
+#ifdef RT3090
+ {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3090_PCIe_DEVICE_ID)},
+ {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3091_PCIe_DEVICE_ID)},
+ {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3092_PCIe_DEVICE_ID)},
+#endif // RT3090 //
+#ifdef RT3390
+ {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3390_PCIe_DEVICE_ID)},
+ {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3391_PCIe_DEVICE_ID)},
+ {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3392_PCIe_DEVICE_ID)},
+#endif // RT3390 //
{0,} // terminate list
};
MODULE_DEVICE_TABLE(pci, rt2860_pci_tbl);
-MODULE_LICENSE("GPL");
#ifdef MODULE_VERSION
MODULE_VERSION(STA_DRIVER_VERSION);
#endif
@@ -363,9 +381,6 @@ static INT __devinit rt2860_probe(
pAd->StaCfg.OriDevType = net_dev->type;
RTMPInitPCIeDevice(pci_dev, pAd);
-#ifdef KTHREAD_SUPPORT
-#endif // KTHREAD_SUPPORT //
-
DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2860_probe\n"));
return 0; // probe ok
@@ -478,11 +493,17 @@ BOOLEAN RT28XXChipsetCheck(
pci_read_config_word(pci_dev, PCI_DEVICE_ID, &device_id);
device_id = le2cpu16(device_id);
pObj->DeviceID = device_id;
- OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE);
if (
+#ifdef RT2860
(device_id == NIC2860_PCIe_DEVICE_ID) ||
(device_id == NIC2790_PCIe_DEVICE_ID) ||
(device_id == VEN_AWT_PCIe_DEVICE_ID) ||
+#endif
+#ifdef RT3090
+ (device_id == NIC3090_PCIe_DEVICE_ID) ||
+ (device_id == NIC3091_PCIe_DEVICE_ID) ||
+ (device_id == NIC3092_PCIe_DEVICE_ID) ||
+#endif // RT3090 //
0)
{
UINT32 MacCsr0 = 0, Index= 0;
@@ -500,7 +521,7 @@ BOOLEAN RT28XXChipsetCheck(
// MAC version at offset 0x1000 is 0x2872XXXX/0x2870XXXX(PCIe, USB, SDIO).
if ((MacCsr0&0xffff0000) != 0x28600000)
{
- OPSTATUS_SET_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE);
+ OPSTATUS_SET_FLAG(pAd, fOP_STATUS_PCIE_DEVICE);
}
}
}
@@ -511,24 +532,26 @@ VOID RTMPInitPCIeLinkCtrlValue(
{
INT pos;
USHORT reg16, data2, PCIePowerSaveLevel, Configuration;
+ UINT32 MacValue;
BOOLEAN bFindIntel = FALSE;
POS_COOKIE pObj;
pObj = (POS_COOKIE) pAd->OS_Cookie;
- if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE))
+ if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE))
return;
DBGPRINT(RT_DEBUG_TRACE, ("%s.===>\n", __func__));
// Init EEPROM, and save settings
- if (!IS_RT3090(pAd))
+ if (!(IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)))
{
RT28xx_EEPROM_READ16(pAd, 0x22, PCIePowerSaveLevel);
pAd->PCIePowerSaveLevel = PCIePowerSaveLevel & 0xff;
+ pAd->LnkCtrlBitMask = 0;
if ((PCIePowerSaveLevel&0xff) == 0xff)
{
- OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE);
+ OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_PCIE_DEVICE);
DBGPRINT(RT_DEBUG_TRACE, ("====> PCIePowerSaveLevel = 0x%x.\n", PCIePowerSaveLevel));
return;
}
@@ -563,40 +586,108 @@ VOID RTMPInitPCIeLinkCtrlValue(
pAd->LnkCtrlBitMask = 0x103;
break;
}
+ RT28xx_EEPROM_READ16(pAd, 0x24, data2);
+ if ((PCIePowerSaveLevel&0xff) != 0xff)
+ {
+ PCIePowerSaveLevel &= 0x3;
+
+ if( !(((data2&0xff00) == 0x9200) && ((data2&0x80) !=0)) )
+ {
+ if (PCIePowerSaveLevel > 1 )
+ PCIePowerSaveLevel = 1;
+ }
+
+ DBGPRINT(RT_DEBUG_TRACE, ("====> rt28xx Write 0x83 Command = 0x%x.\n", PCIePowerSaveLevel));
+ printk("\n\n\n%s:%d\n",__FUNCTION__,__LINE__);
+
+ AsicSendCommandToMcu(pAd, 0x83, 0xff, (UCHAR)PCIePowerSaveLevel, 0x00);
+ }
DBGPRINT(RT_DEBUG_TRACE, ("====> LnkCtrlBitMask = 0x%x.\n", pAd->LnkCtrlBitMask));
}
}
- else if (IS_RT3090(pAd))
+ else if (IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))
{
+ UCHAR LinkCtrlSetting = 0;
+
+ // Check 3090E special setting chip.
+ RT28xx_EEPROM_READ16(pAd, 0x24, data2);
+ if ((data2 == 0x9280) && ((pAd->MACVersion&0xffff) == 0x0211))
+ {
+ pAd->b3090ESpecialChip = TRUE;
+ DBGPRINT_RAW(RT_DEBUG_ERROR,("Special 3090E chip \n"));
+ }
+
+ RTMP_IO_READ32(pAd, AUX_CTRL, &MacValue);
+ //enable WAKE_PCIE function, which forces to enable PCIE clock when mpu interrupt asserting.
+ //Force PCIE 125MHz CLK to toggle
+ MacValue |= 0x402;
+ RTMP_IO_WRITE32(pAd, AUX_CTRL, MacValue);
+ DBGPRINT_RAW(RT_DEBUG_ERROR,(" AUX_CTRL = 0x%32x\n", MacValue));
+
+
+
+ // for RT30xx F and after, PCIe infterface, and for power solution 3
+ if ((IS_VERSION_AFTER_F(pAd))
+ && (pAd->StaCfg.PSControl.field.rt30xxPowerMode >= 2)
+ && (pAd->StaCfg.PSControl.field.rt30xxPowerMode <= 3))
+ {
+ RTMP_IO_READ32(pAd, AUX_CTRL, &MacValue);
+ DBGPRINT_RAW(RT_DEBUG_ERROR,(" Read AUX_CTRL = 0x%x\n", MacValue));
+ // turn on bit 12.
+ //enable 32KHz clock mode for power saving
+ MacValue |= 0x1000;
+ if (MacValue != 0xffffffff)
+ {
+ RTMP_IO_WRITE32(pAd, AUX_CTRL, MacValue);
+ DBGPRINT_RAW(RT_DEBUG_ERROR,(" Write AUX_CTRL = 0x%x\n", MacValue));
+ // 1. if use PCIePowerSetting is 2 or 3, need to program OSC_CTRL to 0x3ff11.
+ MacValue = 0x3ff11;
+ RTMP_IO_WRITE32(pAd, OSC_CTRL, MacValue);
+ DBGPRINT_RAW(RT_DEBUG_ERROR,(" OSC_CTRL = 0x%x\n", MacValue));
+ // 2. Write PCI register Clk ref bit
+ RTMPrt3xSetPCIePowerLinkCtrl(pAd);
+ }
+ else
+ {
+ // Error read Aux_Ctrl value. Force to use solution 1
+ DBGPRINT(RT_DEBUG_ERROR,(" Error Value in AUX_CTRL = 0x%x\n", MacValue));
+ pAd->StaCfg.PSControl.field.rt30xxPowerMode = 1;
+ DBGPRINT(RT_DEBUG_ERROR,(" Force to use power solution1 \n"));
+ }
+ }
// 1. read setting from inf file.
- // .....
- USHORT PCIePowerSetting = 0;
- /* code from windows, default value of rt30xxPowerMode = 0
- PCIePowerSetting = pAd->StaCfg.PSControl.field.rt30xxPowerMode;
- */
- DBGPRINT(RT_DEBUG_TRACE, ("====> rt30xx Read PowerLevelMode = 0x%x.\n", PCIePowerSetting));
- // 2. Check EnableNewPS
- /*
+
+ PCIePowerSaveLevel = (USHORT)pAd->StaCfg.PSControl.field.rt30xxPowerMode;
+ DBGPRINT(RT_DEBUG_ERROR, ("====> rt30xx Read PowerLevelMode = 0x%x.\n", PCIePowerSaveLevel));
+ // 2. Check EnableNewPS.
if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE)
- PCIePowerSetting = 1;
- */
+ PCIePowerSaveLevel = 1;
- if ((pAd->MACVersion&0xffff) <= 0x0211)
+ if (IS_VERSION_BEFORE_F(pAd) && (pAd->b3090ESpecialChip == FALSE))
{
- // Chip Version E only allow 1
- PCIePowerSetting = 1;
- DBGPRINT(RT_DEBUG_TRACE, ("====> rt30xx Write 0x83 Command = 0x%x.\n", PCIePowerSetting));
- AsicSendCommandToMcu(pAd, 0x83, 0xff, (UCHAR)PCIePowerSetting, 0x00);
+ // Chip Version E only allow 1, So force set 1.
+ PCIePowerSaveLevel &= 0x1;
+ pAd->PCIePowerSaveLevel = (USHORT)PCIePowerSaveLevel;
+ DBGPRINT(RT_DEBUG_TRACE, ("====> rt30xx E Write 0x83 Command = 0x%x.\n", PCIePowerSaveLevel));
+
+ AsicSendCommandToMcu(pAd, 0x83, 0xff, (UCHAR)PCIePowerSaveLevel, 0x00);
}
else
{
- // Chip Version F only allow 1 or 2
- if ((PCIePowerSetting > 2) || (PCIePowerSetting == 0))
- PCIePowerSetting = 1;
- DBGPRINT(RT_DEBUG_TRACE, ("====> rt30xx Write 0x83 Command = 0x%x.\n", PCIePowerSetting));
- AsicSendCommandToMcu(pAd, 0x83, 0xff, (UCHAR)PCIePowerSetting, 0x00);
+ // Chip Version F and after only allow 1 or 2 or 3. This might be modified after new chip version come out.
+ if (!((PCIePowerSaveLevel == 1) || (PCIePowerSaveLevel == 3)))
+ PCIePowerSaveLevel = 1;
+ DBGPRINT(RT_DEBUG_ERROR, ("====> rt30xx F Write 0x83 Command = 0x%x.\n", PCIePowerSaveLevel));
+ pAd->PCIePowerSaveLevel = (USHORT)PCIePowerSaveLevel;
+ // for 3090F , we need to add high-byte arg for 0x83 command to indicate the link control setting in
+ // PCI Configuration Space. Because firmware can't read PCI Configuration Space
+ if ((pAd->Rt3xxRalinkLinkCtrl & 0x2) && (pAd->Rt3xxHostLinkCtrl & 0x2))
+ {
+ LinkCtrlSetting = 1;
+ }
+ DBGPRINT(RT_DEBUG_TRACE, ("====> rt30xxF LinkCtrlSetting = 0x%x.\n", LinkCtrlSetting));
+ AsicSendCommandToMcu(pAd, 0x83, 0xff, (UCHAR)PCIePowerSaveLevel, LinkCtrlSetting);
}
-
}
// Find Ralink PCIe Device's Express Capability Offset
@@ -613,6 +704,7 @@ VOID RTMPInitPCIeLinkCtrlValue(
pAd->RLnkCtrlConfiguration = (Configuration & 0x103);
Configuration &= 0xfefc;
Configuration |= (0x0);
+#ifdef RT2860
if ((pObj->DeviceID == NIC2860_PCIe_DEVICE_ID)
||(pObj->DeviceID == NIC2790_PCIe_DEVICE_ID))
{
@@ -621,6 +713,7 @@ VOID RTMPInitPCIeLinkCtrlValue(
DBGPRINT(RT_DEBUG_TRACE, ("Write (Ralink PCIe Link Control Register) offset 0x%x = 0x%x\n",
pos + PCI_EXP_LNKCTL, Configuration));
}
+#endif // RT2860 //
RTMPFindHostPCIDev(pAd);
if (pObj->parent_pci_dev)
@@ -630,7 +723,10 @@ VOID RTMPInitPCIeLinkCtrlValue(
pci_read_config_word(pObj->parent_pci_dev, PCI_VENDOR_ID, &vendor_id);
vendor_id = le2cpu16(vendor_id);
if (vendor_id == PCIBUS_INTEL_VENDOR)
+ {
bFindIntel = TRUE;
+ RTMP_SET_PSFLAG(pAd, fRTMP_PS_TOGGLE_L1);
+ }
// Find PCI-to-PCI Bridge Express Capability Offset
pos = pci_find_capability(pObj->parent_pci_dev, PCI_CAP_ID_EXP);
@@ -650,10 +746,20 @@ VOID RTMPInitPCIeLinkCtrlValue(
switch (pObj->DeviceID)
{
+#ifdef RT2860
case NIC2860_PCIe_DEVICE_ID:
case NIC2790_PCIe_DEVICE_ID:
bChange = TRUE;
break;
+#endif // RT2860 //
+#ifdef RT3090
+ case NIC3090_PCIe_DEVICE_ID:
+ case NIC3091_PCIe_DEVICE_ID:
+ case NIC3092_PCIe_DEVICE_ID:
+ if (bFindIntel == FALSE)
+ bChange = TRUE;
+ break;
+#endif // RT3090 //
default:
break;
}
@@ -686,6 +792,11 @@ VOID RTMPInitPCIeLinkCtrlValue(
// Doesn't switch L0, L1, So set PCIePowerSaveLevel to 0xff
pAd->PCIePowerSaveLevel = 0xff;
if ((pAd->RLnkCtrlOffset != 0)
+#ifdef RT3090
+ && ((pObj->DeviceID == NIC3090_PCIe_DEVICE_ID)
+ ||(pObj->DeviceID == NIC3091_PCIe_DEVICE_ID)
+ ||(pObj->DeviceID == NIC3092_PCIe_DEVICE_ID))
+#endif // RT3090 //
)
{
pci_read_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, ®16);
@@ -714,7 +825,7 @@ VOID RTMPFindHostPCIDev(
pObj = (POS_COOKIE) pAd->OS_Cookie;
- if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE))
+ if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE))
return;
DBGPRINT(RT_DEBUG_TRACE, ("%s.===>\n", __func__));
@@ -761,12 +872,27 @@ VOID RTMPPCIeLinkCtrlValueRestore(
pObj = (POS_COOKIE) pAd->OS_Cookie;
- if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE))
+ if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE))
return;
+#ifdef RT2860
if (!((pObj->DeviceID == NIC2860_PCIe_DEVICE_ID)
||(pObj->DeviceID == NIC2790_PCIe_DEVICE_ID)))
return;
+#endif // RT2860 //
+ // Check PSControl Configuration
+ if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE)
+ return TRUE;
+
+ //3090 will not execute the following codes.
+ // Check interface : If not PCIe interface, return.
+
+#ifdef RT3090
+ if ((pObj->DeviceID == NIC3090_PCIe_DEVICE_ID)
+ ||(pObj->DeviceID == NIC3091_PCIe_DEVICE_ID)
+ ||(pObj->DeviceID == NIC3092_PCIe_DEVICE_ID))
+ return;
+#endif // RT3090 //
DBGPRINT(RT_DEBUG_TRACE, ("%s.===>\n", __func__));
PCIePowerSaveLevel = pAd->PCIePowerSaveLevel;
@@ -840,12 +966,32 @@ VOID RTMPPCIeLinkCtrlSetting(
pObj = (POS_COOKIE) pAd->OS_Cookie;
- if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE))
+ if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE))
return;
+#ifdef RT2860
if (!((pObj->DeviceID == NIC2860_PCIe_DEVICE_ID)
||(pObj->DeviceID == NIC2790_PCIe_DEVICE_ID)))
return;
+#endif // RT2860 //
+ // Check PSControl Configuration
+ if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE)
+ return TRUE;
+
+ // Check interface : If not PCIe interface, return.
+ //Block 3090 to enter the following function
+
+#ifdef RT3090
+ if ((pObj->DeviceID == NIC3090_PCIe_DEVICE_ID)
+ ||(pObj->DeviceID == NIC3091_PCIe_DEVICE_ID)
+ ||(pObj->DeviceID == NIC3092_PCIe_DEVICE_ID))
+ return;
+#endif // RT3090 //
+ if (!RTMP_TEST_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP))
+ {
+ DBGPRINT(RT_DEBUG_INFO, ("RTMPPCIePowerLinkCtrl return on fRTMP_PS_CAN_GO_SLEEP flag\n"));
+ return;
+ }
DBGPRINT(RT_DEBUG_TRACE,("%s===>\n", __func__));
PCIePowerSaveLevel = pAd->PCIePowerSaveLevel;
@@ -856,6 +1002,35 @@ VOID RTMPPCIeLinkCtrlSetting(
}
PCIePowerSaveLevel = PCIePowerSaveLevel>>6;
+ // Skip non-exist deice right away
+ if (pObj->parent_pci_dev && (pAd->HostLnkCtrlOffset != 0))
+ {
+ PCI_REG_READ_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, Configuration);
+ switch (PCIePowerSaveLevel)
+ {
+ case 0:
+ // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 00
+ Configuration &= 0xfefc;
+ break;
+ case 1:
+ // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 01
+ Configuration &= 0xfefc;
+ Configuration |= 0x1;
+ break;
+ case 2:
+ // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11
+ Configuration &= 0xfefc;
+ Configuration |= 0x3;
+ break;
+ case 3:
+ // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 and bit 8 of LinkControl of 2892 to 1
+ Configuration &= 0xfefc;
+ Configuration |= 0x103;
+ break;
+ }
+ PCI_REG_WIRTE_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, Configuration);
+ DBGPRINT(RT_DEBUG_TRACE, ("Write PCI host offset 0x%x = 0x%x\n", pAd->HostLnkCtrlOffset, Configuration));
+ }
if (pObj->pci_dev && (pAd->RLnkCtrlOffset != 0))
{
@@ -864,10 +1039,149 @@ VOID RTMPPCIeLinkCtrlSetting(
PCIePowerSaveLevel = Max;
PCI_REG_READ_WORD(pObj->pci_dev, pAd->RLnkCtrlOffset, Configuration);
- Configuration |= 0x100;
+ switch (PCIePowerSaveLevel)
+ {
+ case 0:
+ // No PCI power safe
+ // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 00 .
+ Configuration &= 0xfefc;
+ break;
+ case 1:
+ // L0
+ // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 01 .
+ Configuration &= 0xfefc;
+ Configuration |= 0x1;
+ break;
+ case 2:
+ // L0 and L1
+ // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11
+ Configuration &= 0xfefc;
+ Configuration |= 0x3;
+ break;
+ case 3:
+ // L0 , L1 and clock management.
+ // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 and bit 8 of LinkControl of 2892 to 1
+ Configuration &= 0xfefc;
+ Configuration |= 0x103;
+ pAd->bPCIclkOff = TRUE;
+ break;
+ }
PCI_REG_WIRTE_WORD(pObj->pci_dev, pAd->RLnkCtrlOffset, Configuration);
DBGPRINT(RT_DEBUG_TRACE, ("Write Ralink device : offset 0x%x = 0x%x\n", pAd->RLnkCtrlOffset, Configuration));
}
DBGPRINT(RT_DEBUG_TRACE,("RTMPPCIePowerLinkCtrl <==============\n"));
}
+
+/*
+ ========================================================================
+
+ Routine Description:
+ 1. Write a PCI register for rt30xx power solution 3
+
+ ========================================================================
+*/
+VOID RTMPrt3xSetPCIePowerLinkCtrl(
+ IN PRTMP_ADAPTER pAd)
+{
+
+ ULONG HostConfiguration;
+ ULONG Configuration;
+ ULONG Vendor;
+ ULONG offset;
+ POS_COOKIE pObj;
+ INT pos;
+ USHORT reg16;
+
+ pObj = (POS_COOKIE) pAd->OS_Cookie;
+
+ DBGPRINT(RT_DEBUG_INFO, ("RTMPrt3xSetPCIePowerLinkCtrl.===> %x\n", pAd->StaCfg.PSControl.word));
+
+ // Check PSControl Configuration
+ if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE)
+ return;
+ RTMPFindHostPCIDev(pAd);
+ if (pObj->parent_pci_dev)
+ {
+ USHORT vendor_id;
+ // Find PCI-to-PCI Bridge Express Capability Offset
+ pos = pci_find_capability(pObj->parent_pci_dev, PCI_CAP_ID_EXP);
+
+ if (pos != 0)
+ {
+ pAd->HostLnkCtrlOffset = pos + PCI_EXP_LNKCTL;
+ }
+ // If configurared to turn on L1.
+ HostConfiguration = 0;
+ if (pAd->StaCfg.PSControl.field.rt30xxForceASPMTest == 1)
+ {
+ DBGPRINT(RT_DEBUG_TRACE, ("Enter,PSM : Force ASPM \n"));
+
+ // Skip non-exist deice right away
+ if ((pAd->HostLnkCtrlOffset != 0))
+ {
+ PCI_REG_READ_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, HostConfiguration);
+ // Prepare Configuration to write to Host
+ HostConfiguration |= 0x3;
+ PCI_REG_WIRTE_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, HostConfiguration);
+ pAd->Rt3xxHostLinkCtrl = HostConfiguration;
+ // Because in rt30xxForceASPMTest Mode, Force turn on L0s, L1.
+ // Fix HostConfiguration bit0:1 = 0x3 for later use.
+ HostConfiguration = 0x3;
+ DBGPRINT(RT_DEBUG_TRACE, ("PSM : Force ASPM : Host device L1/L0s Value = 0x%x\n", HostConfiguration));
+ }
+ }
+ else if (pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM == 1)
+ {
+
+ // Skip non-exist deice right away
+ if ((pAd->HostLnkCtrlOffset != 0))
+ {
+ PCI_REG_READ_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, HostConfiguration);
+ pAd->Rt3xxHostLinkCtrl = HostConfiguration;
+ HostConfiguration &= 0x3;
+ DBGPRINT(RT_DEBUG_TRACE, ("PSM : Follow Host ASPM : Host device L1/L0s Value = 0x%x\n", HostConfiguration));
+ }
+ }
+ }
+ // Prepare to write Ralink setting.
+ // Find Ralink PCIe Device's Express Capability Offset
+ pos = pci_find_capability(pObj->pci_dev, PCI_CAP_ID_EXP);
+
+ if (pos != 0)
+ {
+ // Ralink PCIe Device's Link Control Register Offset
+ pAd->RLnkCtrlOffset = pos + PCI_EXP_LNKCTL;
+ pci_read_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, ®16);
+ Configuration = le2cpu16(reg16);
+ DBGPRINT(RT_DEBUG_TRACE, ("Read (Ralink PCIe Link Control Register) offset 0x%x = 0x%x\n",
+ pAd->RLnkCtrlOffset, Configuration));
+ Configuration |= 0x100;
+ if ((pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM == 1)
+ || (pAd->StaCfg.PSControl.field.rt30xxForceASPMTest == 1))
+ {
+ switch(HostConfiguration)
+ {
+ case 0:
+ Configuration &= 0xffffffc;
+ break;
+ case 1:
+ Configuration &= 0xffffffc;
+ Configuration |= 0x1;
+ break;
+ case 2:
+ Configuration &= 0xffffffc;
+ Configuration |= 0x2;
+ break;
+ case 3:
+ Configuration |= 0x3;
+ break;
+ }
+ }
+ reg16 = cpu2le16(Configuration);
+ pci_write_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, reg16);
+ pAd->Rt3xxRalinkLinkCtrl = Configuration;
+ DBGPRINT(RT_DEBUG_TRACE, ("PSM :Write Ralink device L1/L0s Value = 0x%x\n", Configuration));
+ }
+ DBGPRINT(RT_DEBUG_INFO,("PSM :RTMPrt3xSetPCIePowerLinkCtrl <==============\n"));
+}
Index: b/drivers/staging/rt2860/rt_linux.c
===================================================================
--- a/drivers/staging/rt2860/rt_linux.c
+++ b/drivers/staging/rt2860/rt_linux.c
@@ -283,6 +283,9 @@ VOID RTMPFreeAdapter(
#ifdef RTMP_MAC_PCI
NdisFreeSpinLock(&pAd->RxRingLock);
+#ifdef RT3090
+NdisFreeSpinLock(&pAd->McuCmdLock);
+#endif // RT3090 //
#endif // RTMP_MAC_PCI //
for (index =0 ; index < NUM_OF_TX_RING; index++)
Index: b/drivers/staging/rt2860/rt_linux.h
===================================================================
--- a/drivers/staging/rt2860/rt_linux.h
+++ b/drivers/staging/rt2860/rt_linux.h
@@ -590,6 +590,12 @@ void linux_pci_unmap_single(void *handle
*_pV = 0; \
}
+#define RTMP_IO_FORCE_READ32(_A, _R, _pV) \
+{ \
+ (*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0))); \
+ (*_pV = readl((void *)((_A)->CSRBaseAddress + (_R)))); \
+}
+
#define RTMP_IO_READ8(_A, _R, _pV) \
{ \
(*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0))); \
@@ -605,7 +611,12 @@ void linux_pci_unmap_single(void *handle
} \
}
-
+#define RTMP_IO_FORCE_WRITE32(_A, _R, _V) \
+{ \
+ UINT Val; \
+ Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \
+ writel(_V, (void *)((_A)->CSRBaseAddress + (_R))); \
+}
#if defined(RALINK_2880) || defined(RALINK_3052)
#define RTMP_IO_WRITE8(_A, _R, _V) \
Index: b/drivers/staging/rt2860/rt_main_dev.c
===================================================================
--- a/drivers/staging/rt2860/rt_main_dev.c
+++ b/drivers/staging/rt2860/rt_main_dev.c
@@ -226,9 +226,9 @@ int rt28xx_close(IN PNET_DEV dev)
return 0; // close ok
{
-#ifdef RTMP_PCI_SUPPORT
+#ifdef RTMP_MAC_PCI
RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_CLOSE);
-#endif // RTMP_PCI_SUPPORT //
+#endif // RTMP_MAC_PCI //
// If dirver doesn't wake up firmware here,
// NICLoadFirmware will hang forever when interface is up again.
@@ -320,6 +320,10 @@ int rt28xx_close(IN PNET_DEV dev)
brc=RT28xxPciAsicRadioOff(pAd, RTMP_HALT, 0);
+
+//In solution 3 of 3090F, the bPCIclkOff will be set to TRUE after calling RT28xxPciAsicRadioOff
+ pAd->bPCIclkOff = FALSE;
+
if (brc==FALSE)
{
DBGPRINT(RT_DEBUG_ERROR,("%s call RT28xxPciAsicRadioOff fail !!\n", __func__));
@@ -400,11 +404,6 @@ int rt28xx_open(IN PNET_DEV dev)
return -1;
}
-#ifdef RTMP_PCI_SUPPORT
- RTMPInitPCIeLinkCtrlValue(pAd);
-#endif // RTMP_PCI_SUPPORT //
-
-
if (net_dev->priv_flags == INT_MAIN)
{
if (pAd->OpMode == OPMODE_STA)
@@ -449,7 +448,9 @@ int rt28xx_open(IN PNET_DEV dev)
// RTMP_IO_WRITE32(pAd, XIFS_TIME_CFG, reg);
}
-
+#ifdef RTMP_MAC_PCI
+ RTMPInitPCIeLinkCtrlValue(pAd);
+#endif // RTMP_MAC_PCI //
return (retval);
Index: b/drivers/staging/rt2860/rt_pci_rbus.c
===================================================================
--- a/drivers/staging/rt2860/rt_pci_rbus.c
+++ b/drivers/staging/rt2860/rt_pci_rbus.c
@@ -236,7 +236,6 @@ VOID Invalid_Remaining_Packet(
PhysicalAddress = PCI_MAP_SINGLE(pAd, (void *)(VirtualAddress+1600), RX_BUFFER_NORMSIZE-1600, -1, PCI_DMA_FROMDEVICE);
}
-
NDIS_STATUS RtmpNetTaskInit(IN RTMP_ADAPTER *pAd)
{
POS_COOKIE pObj;
@@ -871,7 +870,6 @@ void linux_pci_unmap_single(void *handle
pAd=(PRTMP_ADAPTER)handle;
pObj = (POS_COOKIE)pAd->OS_Cookie;
- if (size > 0)
- pci_unmap_single(pObj->pci_dev, dma_addr, size, direction);
+ pci_unmap_single(pObj->pci_dev, dma_addr, size, direction);
}
Index: b/drivers/staging/rt2860/rtmp.h
===================================================================
--- a/drivers/staging/rt2860/rtmp.h
+++ b/drivers/staging/rt2860/rtmp.h
@@ -913,6 +913,20 @@ typedef enum _ABGBAND_STATE_ {
A_BAND,
} ABGBAND_STATE;
+#ifdef RTMP_MAC_PCI
+// Power save method control
+typedef union _PS_CONTROL {
+ struct {
+ ULONG EnablePSinIdle:1; // Enable radio off when not connect to AP. radio on only when sitesurvey,
+ ULONG EnableNewPS:1; // Enable new Chip power save fucntion . New method can only be applied in chip version after 2872. and PCIe.
+ ULONG rt30xxPowerMode:2; // Power Level Mode for rt30xx chip
+ ULONG rt30xxFollowHostASPM:1; // Card Follows Host's setting for rt30xx chip.
+ ULONG rt30xxForceASPMTest:1; // Force enable L1 for rt30xx chip. This has higher priority than rt30xxFollowHostASPM Mode.
+ ULONG rsv:26; // Radio Measurement Enable
+ } field;
+ ULONG word;
+} PS_CONTROL, *PPS_CONTROL;
+#endif // RTMP_MAC_PCI //
/***************************************************************************
* structure for MLME state machine
@@ -1542,7 +1556,6 @@ typedef struct _STA_ADMIN_CONFIG {
UCHAR WpaSupplicantUP;
UCHAR WpaSupplicantScanCount;
BOOLEAN bRSN_IE_FromWpaSupplicant;
- BOOLEAN bLostAp;
CHAR dev_name[16];
USHORT OriDevType;
@@ -1557,6 +1570,10 @@ typedef struct _STA_ADMIN_CONFIG {
#ifdef RTMP_MAC_PCI
UCHAR BBPR3;
+ // PS Control has 2 meanings for advanced power save function.
+ // 1. EnablePSinIdle : When no connection, always radio off except need to do site survey.
+ // 2. EnableNewPS : will save more current in sleep or radio off mode.
+ PS_CONTROL PSControl;
#endif // RTMP_MAC_PCI //
@@ -1815,9 +1832,17 @@ struct _RTMP_ADAPTER
USHORT HostLnkCtrlConfiguration;
USHORT HostLnkCtrlOffset;
USHORT PCIePowerSaveLevel;
+ ULONG Rt3xxHostLinkCtrl; // USed for 3090F chip
+ ULONG Rt3xxRalinkLinkCtrl; // USed for 3090F chip
+ USHORT DeviceID; // Read from PCI config
+ ULONG AccessBBPFailCount;
BOOLEAN bPCIclkOff; // flag that indicate if the PICE power status in Configuration SPace..
BOOLEAN bPCIclkOffDisableTx; //
+ BOOLEAN brt30xxBanMcuCmd; //when = 0xff means all commands are ok to set .
+ BOOLEAN b3090ESpecialChip; //3090E special chip that write EEPROM 0x24=0x9280.
+ ULONG CheckDmaBusyCount; // Check Interrupt Status Register Count.
+
UINT int_enable_reg;
UINT int_disable_mask;
UINT int_pending;
@@ -1923,6 +1948,9 @@ struct _RTMP_ADAPTER
#ifdef RTMP_MAC_PCI
RTMP_RX_RING RxRing;
NDIS_SPIN_LOCK RxRingLock; // Rx Ring spinlock
+#ifdef RT3090
+ NDIS_SPIN_LOCK McuCmdLock; //MCU Command Queue spinlock
+#endif // RT3090 //
#endif // RTMP_MAC_PCI //
#ifdef RTMP_MAC_USB
RX_CONTEXT RxContext[RX_RING_SIZE]; // 1 for redundant multiple IRP bulk in.
@@ -2179,8 +2207,6 @@ struct _RTMP_ADAPTER
//BOOLEAN bDisablescanning; //defined in RT2870 USB
BOOLEAN bStaFifoTest;
BOOLEAN bProtectionTest;
- BOOLEAN bHCCATest;
- BOOLEAN bGenOneHCCA;
BOOLEAN bBroadComHT;
//+++Following add from RT2870 USB.
ULONG BulkOutReq;
@@ -2333,6 +2359,7 @@ typedef struct _TX_BLK_
UCHAR HeaderBuf[128]; // TempBuffer for TX_INFO + TX_WI + 802.11 Header + padding + AMSDU SubHeader + LLC/SNAP
//RT2870 2.1.0.0 uses only 80 bytes
//RT3070 2.1.1.0 uses only 96 bytes
+ //RT3090 2.1.0.0 uses only 96 bytes
UCHAR MpduHeaderLen; // 802.11 header length NOT including the padding
UCHAR HdrPadLen; // recording Header Padding Length;
UCHAR apidx; // The interface associated to this packet
@@ -2875,10 +2902,6 @@ VOID WpaStaPairwiseKeySetting(
VOID WpaStaGroupKeySetting(
IN PRTMP_ADAPTER pAd);
-VOID WpaSendEapolStart(
- IN PRTMP_ADAPTER pAdapter,
- IN PUCHAR pBssid);
-
NDIS_STATUS RTMPCloneNdisPacket(
IN PRTMP_ADAPTER pAd,
IN BOOLEAN pInsAMSDUHdr,
@@ -3685,9 +3708,6 @@ VOID ScanNextChannel(
ULONG MakeIbssBeacon(
IN PRTMP_ADAPTER pAd);
-VOID InitChannelRelatedValue(
- IN PRTMP_ADAPTER pAd);
-
BOOLEAN MlmeScanReqSanity(
IN PRTMP_ADAPTER pAd,
IN VOID *Msg,
@@ -4063,6 +4083,10 @@ VOID RT30xxReverseRFSleepModeSetup(
VOID NICInitRT3070RFRegisters(
IN RTMP_ADAPTER *pAd);
#endif // RT3070 //
+#ifdef RT3090
+VOID NICInitRT3090RFRegisters(
+ IN RTMP_ADAPTER *pAd);
+#endif // RT3090 //
VOID RT30xxHaltAction(
IN PRTMP_ADAPTER pAd);
@@ -5254,7 +5278,6 @@ BOOLEAN RT28xxPciAsicRadioOn(
IN PRTMP_ADAPTER pAd,
IN UCHAR Level);
-#ifdef RTMP_PCI_SUPPORT
VOID RTMPInitPCIeLinkCtrlValue(
IN PRTMP_ADAPTER pAd);
@@ -5269,6 +5292,9 @@ VOID RTMPPCIeLinkCtrlSetting(
IN PRTMP_ADAPTER pAd,
IN USHORT Max);
+VOID RTMPrt3xSetPCIePowerLinkCtrl(
+ IN PRTMP_ADAPTER pAd);
+
VOID PsPollWakeExec(
IN PVOID SystemSpecific1,
IN PVOID FunctionContext,
@@ -5280,7 +5306,6 @@ VOID RadioOnExec(
IN PVOID FunctionContext,
IN PVOID SystemSpecific2,
IN PVOID SystemSpecific3);
-#endif // RTMP_PCI_SUPPORT //
VOID RT28xxPciStaAsicForceWakeup(
IN PRTMP_ADAPTER pAd,
Index: b/drivers/staging/rt2860/rtmp_chip.h
===================================================================
--- a/drivers/staging/rt2860/rtmp_chip.h
+++ b/drivers/staging/rt2860/rtmp_chip.h
@@ -49,6 +49,9 @@
#ifdef RT3070
#include "chip/rt3070.h"
#endif // RT3070 //
+#ifdef RT3090
+#include "chip/rt3090.h"
+#endif // RT3090 //
// We will have a cost down version which mac version is 0x3090xxxx
//
Index: b/drivers/staging/rt2860/rtmp_def.h
===================================================================
--- a/drivers/staging/rt2860/rtmp_def.h
+++ b/drivers/staging/rt2860/rtmp_def.h
@@ -221,6 +221,11 @@
#define fRTMP_PS_GO_TO_SLEEP_NOW 0x00000008
#define fRTMP_PS_TOGGLE_L1 0x00000010 // Use Toggle L1 mechanism for rt28xx PCIe
+#ifdef RT3090
+#define WAKE_MCU_CMD 0x31
+#define SLEEP_MCU_CMD 0x30
+#define RFOFF_MCU_CMD 0x35
+#endif // RT3090 //
#define CCKSETPROTECT 0x1
#define OFDMSETPROTECT 0x2
Index: b/drivers/staging/rt2860/sta/assoc.c
===================================================================
--- a/drivers/staging/rt2860/sta/assoc.c
+++ b/drivers/staging/rt2860/sta/assoc.c
@@ -464,18 +464,6 @@ VOID MlmeAssocReqAction(
break;
}
}
-#ifdef RT2860
- /*
- When AuthMode is WPA2-Enterprise and AP reboot or STA lost AP,
- AP would not do PMK cache with STA after STA re-connect to AP again.
- In this case, driver doesn't need to send PMKID to AP and WpaSupplicant.
- */
- if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) &&
- (NdisEqualMemory(pAd->MlmeAux.Bssid, pAd->CommonCfg.LastBssid, MAC_ADDR_LEN)))
- {
- FoundPMK = FALSE;
- }
-#endif // RT2860 //
if (FoundPMK)
{
// Set PMK number
Index: b/drivers/staging/rt2860/sta/auth_rsp.c
===================================================================
--- a/drivers/staging/rt2860/sta/auth_rsp.c
+++ b/drivers/staging/rt2860/sta/auth_rsp.c
@@ -137,10 +137,6 @@ VOID PeerDeauthAction(
if (pAd->CommonCfg.bWirelessEvent)
RTMPSendWirelessEvent(pAd, IW_DEAUTH_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0);
- if ((pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) &&
- (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2))
- pAd->StaCfg.bLostAp = TRUE;
-
LinkDown(pAd, TRUE);
}
}
Index: b/drivers/staging/rt2860/sta/connect.c
===================================================================
--- a/drivers/staging/rt2860/sta/connect.c
+++ b/drivers/staging/rt2860/sta/connect.c
@@ -1125,6 +1125,26 @@ VOID LinkUp(
COPY_HTSETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(pAd);
+#ifdef RTMP_MAC_PCI
+ // Before power save before link up function, We will force use 1R.
+ // So after link up, check Rx antenna # again.
+ RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value);
+ if(pAd->Antenna.field.RxPath == 3)
+ {
+ Value |= (0x10);
+ }
+ else if(pAd->Antenna.field.RxPath == 2)
+ {
+ Value |= (0x8);
+ }
+ else if(pAd->Antenna.field.RxPath == 1)
+ {
+ Value |= (0x0);
+ }
+ RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value);
+ pAd->StaCfg.BBPR3 = Value;
+#endif // RTMP_MAC_PCI //
+
if (BssType == BSS_ADHOC)
{
OPSTATUS_SET_FLAG(pAd, fOP_STATUS_ADHOC_ON);
@@ -1134,8 +1154,6 @@ VOID LinkUp(
if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)
AdhocTurnOnQos(pAd);
- InitChannelRelatedValue(pAd);
-
DBGPRINT(RT_DEBUG_TRACE, ("!!!Adhoc LINK UP !!! \n" ));
}
else
@@ -1146,7 +1164,6 @@ VOID LinkUp(
DBGPRINT(RT_DEBUG_TRACE, ("!!!Infra LINK UP !!! \n" ));
}
-#if defined(RT2870) || defined(RT3070)
// 3*3
// reset Tx beamforming bit
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &Value);
@@ -1171,6 +1188,9 @@ VOID LinkUp(
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value);
Value &= (~0x20);
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value);
+#ifdef RTMP_MAC_PCI
+ pAd->StaCfg.BBPR3 = Value;
+#endif // RTMP_MAC_PCI //
RTMP_IO_READ32(pAd, TX_BAND_CFG, &Data);
Data &= 0xfffffffe;
@@ -1205,6 +1225,9 @@ VOID LinkUp(
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value);
Value |= (0x20);
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value);
+#ifdef RTMP_MAC_PCI
+ pAd->StaCfg.BBPR3 = Value;
+#endif // RTMP_MAC_PCI //
if (pAd->MACVersion == 0x28600100)
{
@@ -1234,6 +1257,9 @@ VOID LinkUp(
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value);
Value &= (~0x20);
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value);
+#ifdef RTMP_MAC_PCI
+ pAd->StaCfg.BBPR3 = Value;
+#endif // RTMP_MAC_PCI //
if (pAd->MACVersion == 0x28600100)
{
@@ -1247,7 +1273,6 @@ VOID LinkUp(
}
RTMPSetAGCInitValue(pAd, pAd->CommonCfg.BBPCurrentBW);
-#endif // RT2870 //
//
// Save BBP_R66 value, it will be used in RTUSBResumeMsduTransmission
@@ -1752,21 +1777,6 @@ VOID LinkUp(
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS);
RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_GO_TO_SLEEP_NOW);
-
-#ifdef RT2860
- /*
- When AuthMode is WPA2-Enterprise and AP reboot or STA lost AP,
- WpaSupplicant would not send EapolStart to AP after STA re-connect to AP again.
- In this case, driver would send EapolStart to AP.
- */
- if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) &&
- (NdisEqualMemory(pAd->CommonCfg.Bssid, pAd->CommonCfg.LastBssid, MAC_ADDR_LEN)) &&
- (pAd->StaCfg.bLostAp == TRUE))
- {
- WpaSendEapolStart(pAd, pAd->CommonCfg.Bssid);
- }
-#endif // RT2860 //
- pAd->StaCfg.bLostAp = FALSE;
}
/*
@@ -1820,7 +1830,7 @@ VOID LinkDown(
OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED);
#ifdef RTMP_MAC_PCI
- if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE))
+ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE))
{
BOOLEAN Cancelled;
pAd->Mlme.bPsPollTimerRunning = FALSE;
@@ -1841,6 +1851,10 @@ VOID LinkDown(
OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE);
}
+#ifdef RTMP_MAC_PCI
+ pAd->bPCIclkOff = FALSE;
+#endif // RTMP_MAC_PCI //
+
if (ADHOC_ON(pAd)) // Adhoc mode link down
{
DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK DOWN 1!!!\n"));
@@ -2520,139 +2534,3 @@ ULONG MakeIbssBeacon(
FrameLen, SupRateLen, ExtRateLen, pAd->CommonCfg.Channel, pAd->CommonCfg.PhyMode));
return FrameLen;
}
-
-VOID InitChannelRelatedValue(
- IN PRTMP_ADAPTER pAd)
-{
-#ifdef RT2860
- UCHAR Value = 0;
- UINT32 Data = 0;
-
-#ifdef RTMP_MAC_PCI
- // In power save , We will force use 1R.
- // So after link up, check Rx antenna # again.
- RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value);
- if(pAd->Antenna.field.RxPath == 3)
- {
- Value |= (0x10);
- }
- else if(pAd->Antenna.field.RxPath == 2)
- {
- Value |= (0x8);
- }
- else if(pAd->Antenna.field.RxPath == 1)
- {
- Value |= (0x0);
- }
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value);
- pAd->StaCfg.BBPR3 = Value;
-#endif // RTMP_MAC_PCI //
-
- pAd->CommonCfg.CentralChannel = pAd->MlmeAux.CentralChannel;
- pAd->CommonCfg.Channel = pAd->MlmeAux.Channel;
- // Change to AP channel
- if ((pAd->CommonCfg.CentralChannel > pAd->CommonCfg.Channel) && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40))
- {
- // Must using 40MHz.
- pAd->CommonCfg.BBPCurrentBW = BW_40;
- AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE);
- AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel);
-
- RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &Value);
- Value &= (~0x18);
- Value |= 0x10;
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, Value);
-
- // RX : control channel at lower
- RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value);
- Value &= (~0x20);
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value);
-#ifdef RTMP_MAC_PCI
- pAd->StaCfg.BBPR3 = Value;
-#endif // RTMP_MAC_PCI //
-
- RTMP_IO_READ32(pAd, TX_BAND_CFG, &Data);
- Data &= 0xfffffffe;
- RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Data);
-
- if (pAd->MACVersion == 0x28600100)
- {
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x1A);
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x0A);
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x16);
- DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n" ));
- }
-
- DBGPRINT(RT_DEBUG_TRACE, ("!!!40MHz Lower !!! Control Channel at Below. Central = %d \n", pAd->CommonCfg.CentralChannel ));
- }
- else if ((pAd->CommonCfg.CentralChannel < pAd->CommonCfg.Channel) && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40))
- {
- // Must using 40MHz.
- pAd->CommonCfg.BBPCurrentBW = BW_40;
- AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE);
- AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel);
-
- RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &Value);
- Value &= (~0x18);
- Value |= 0x10;
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, Value);
-
- RTMP_IO_READ32(pAd, TX_BAND_CFG, &Data);
- Data |= 0x1;
- RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Data);
-
- RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value);
- Value |= (0x20);
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value);
-#ifdef RTMP_MAC_PCI
- pAd->StaCfg.BBPR3 = Value;
-#endif // RTMP_MAC_PCI //
-
- if (pAd->MACVersion == 0x28600100)
- {
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x1A);
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x0A);
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x16);
- DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n" ));
- }
-
- DBGPRINT(RT_DEBUG_TRACE, ("!!! 40MHz Upper !!! Control Channel at UpperCentral = %d \n", pAd->CommonCfg.CentralChannel ));
- }
- else
- {
- pAd->CommonCfg.BBPCurrentBW = BW_20;
- pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel;
- AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE);
- AsicLockChannel(pAd, pAd->CommonCfg.Channel);
-
- RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &Value);
- Value &= (~0x18);
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, Value);
-
- RTMP_IO_READ32(pAd, TX_BAND_CFG, &Data);
- Data &= 0xfffffffe;
- RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Data);
-
- RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value);
- Value &= (~0x20);
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value);
-#ifdef RTMP_MAC_PCI
- pAd->StaCfg.BBPR3 = Value;
-#endif // RTMP_MAC_PCI //
-
- if (pAd->MACVersion == 0x28600100)
- {
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x16);
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x08);
- RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x11);
- DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n" ));
- }
-
- DBGPRINT(RT_DEBUG_TRACE, ("!!! 20MHz !!! \n" ));
- }
-
- RTMPSetAGCInitValue(pAd, pAd->CommonCfg.BBPCurrentBW);
-#endif // RT2860 //
-}
-
-
Index: b/drivers/staging/rt2860/sta/rtmp_data.c
===================================================================
--- a/drivers/staging/rt2860/sta/rtmp_data.c
+++ b/drivers/staging/rt2860/sta/rtmp_data.c
@@ -1208,7 +1208,6 @@ NDIS_STATUS RTMPFreeTXDRequest(
case QID_AC_BE:
case QID_AC_VI:
case QID_AC_VO:
- case QID_HCCA:
if (pAd->TxRing[QueIdx].TxSwFreeIdx > pAd->TxRing[QueIdx].TxCpuIdx)
FreeNumber = pAd->TxRing[QueIdx].TxSwFreeIdx - pAd->TxRing[QueIdx].TxCpuIdx - 1;
else
Index: b/drivers/staging/rt2860/sta/sync.c
===================================================================
--- a/drivers/staging/rt2860/sta/sync.c
+++ b/drivers/staging/rt2860/sta/sync.c
@@ -195,13 +195,23 @@ VOID MlmeScanReqAction(
pAd->StaCfg.ScanCnt++;
#ifdef RTMP_MAC_PCI
- if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) &&
+ if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) &&
(IDLE_ON(pAd)) &&
(pAd->StaCfg.bRadio == TRUE) &&
(RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF)))
{
+ if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE)
+ {
+ AsicSendCommandToMcu(pAd, 0x31, PowerWakeCID, 0x00, 0x02);
+ AsicCheckCommanOk(pAd, PowerWakeCID);
+ RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF);
+ DBGPRINT(RT_DEBUG_TRACE, ("PSM - Issue Wake up command \n"));
+ }
+ else
+ {
RT28xxPciAsicRadioOn(pAd, GUI_IDLE_POWER_SAVE);
}
+ }
#endif // RTMP_MAC_PCI //
// first check the parameter sanity
@@ -303,7 +313,7 @@ VOID MlmeJoinReqAction(
DBGPRINT(RT_DEBUG_TRACE, ("SYNC - MlmeJoinReqAction(BSS #%ld)\n", pInfo->BssIdx));
#ifdef RTMP_MAC_PCI
- if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) &&
+ if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) &&
(IDLE_ON(pAd)) &&
(pAd->StaCfg.bRadio == TRUE) &&
(RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF)))
@@ -338,9 +348,7 @@ VOID MlmeJoinReqAction(
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
BBPValue &= (~0x18);
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
-#ifdef RT2860
- pAd->CommonCfg.BBPCurrentBW = BW_20;
-#endif // RT2860 //
+
DBGPRINT(RT_DEBUG_TRACE, ("SYNC - BBP R4 to 20MHz.l\n"));
// switch channel and waiting for beacon timer
@@ -898,8 +906,6 @@ VOID PeerBeaconAtJoinAction(
else //Used the default TX Power Percentage.
pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault;
- InitChannelRelatedValue(pAd);
-
pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE;
Status = MLME_SUCCESS;
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_JOIN_CONF, 2, &Status);
@@ -1317,7 +1323,7 @@ VOID PeerBeacon(
if (MessageToMe)
{
#ifdef RTMP_MAC_PCI
- if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE))
+ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE))
{
// Restore to correct BBP R3 value
if (pAd->Antenna.field.RxPath > 1)
@@ -1336,7 +1342,7 @@ VOID PeerBeacon(
else if (BcastFlag && (DtimCount == 0) && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM))
{
#ifdef RTMP_MAC_PCI
- if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE))
+ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE))
{
if (pAd->Antenna.field.RxPath > 1)
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, pAd->StaCfg.BBPR3);
@@ -1356,7 +1362,7 @@ VOID PeerBeacon(
// TODO: consider scheduled HCCA. might not be proper to use traditional DTIM-based power-saving scheme
// can we cheat here (i.e. just check MGMT & AC_BE) for better performance?
#ifdef RTMP_MAC_PCI
- if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE))
+ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE))
{
if (pAd->Antenna.field.RxPath > 1)
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, pAd->StaCfg.BBPR3);
Index: b/drivers/staging/rt2860/sta/wpa.c
===================================================================
--- a/drivers/staging/rt2860/sta/wpa.c
+++ b/drivers/staging/rt2860/sta/wpa.c
@@ -389,51 +389,3 @@ VOID WpaStaGroupKeySetting(
NULL);
}
-
-
-/*
- ========================================================================
-
- Routine Description:
- Send EAPoL-Start packet to AP.
-
- Arguments:
- pAd - NIC Adapter pointer
-
- Return Value:
- None
-
- IRQL = DISPATCH_LEVEL
-
- Note:
- Actions after link up
- 1. Change the correct parameters
- 2. Send EAPOL - START
-
- ========================================================================
-*/
-VOID WpaSendEapolStart(
- IN PRTMP_ADAPTER pAd,
- IN PUCHAR pBssid)
-{
- IEEE8021X_FRAME Packet;
- UCHAR Header802_3[14];
-
- DBGPRINT(RT_DEBUG_TRACE, ("-----> WpaSendEapolStart\n"));
-
- NdisZeroMemory(Header802_3,sizeof(UCHAR)*14);
-
- MAKE_802_3_HEADER(Header802_3, pBssid, &pAd->CurrentAddress[0], EAPOL);
-
- // Zero message 2 body
- NdisZeroMemory(&Packet, sizeof(Packet));
- Packet.Version = EAPOL_VER;
- Packet.Type = EAPOLStart;
- Packet.Length = cpu2be16(0);
-
- // Copy frame to Tx ring
- RTMPToWirelessSta((PRTMP_ADAPTER)pAd, &pAd->MacTab.Content[BSSID_WCID],
- Header802_3, LENGTH_802_3, (PUCHAR)&Packet, 4, TRUE);
-
- DBGPRINT(RT_DEBUG_TRACE, ("<----- WpaSendEapolStart\n"));
-}
Index: b/drivers/staging/rt2860/sta_ioctl.c
===================================================================
--- a/drivers/staging/rt2860/sta_ioctl.c
+++ b/drivers/staging/rt2860/sta_ioctl.c
@@ -160,6 +160,12 @@ INT Set_PSMode_Proc(
IN PRTMP_ADAPTER pAdapter,
IN PSTRING arg);
+#ifdef RT3090
+INT Set_PCIePSLevel_Proc(
+IN PRTMP_ADAPTER pAdapter,
+IN PUCHAR arg);
+#endif // RT3090 //
+
INT Set_Wpa_Support(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg);
@@ -515,6 +521,7 @@ rt_ioctl_giwname(struct net_device *dev,
{
strncpy(name, "Ralink STA", IFNAMSIZ);
// RT2870 2.1.0.0 uses "RT2870 Wireless"
+ // RT3090 2.1.0.0 uses "RT2860 Wireless"
return 0;
}
Index: b/drivers/staging/rt2860/wpa.h
===================================================================
--- a/drivers/staging/rt2860/wpa.h
+++ b/drivers/staging/rt2860/wpa.h
@@ -347,13 +347,6 @@ typedef enum _WpaMixPairCipher
WPA_TKIPAES_WPA2_TKIPAES = 0x0F,
} WPA_MIX_PAIR_CIPHER;
-// 802.1x authentication format
-typedef struct _IEEE8021X_FRAME {
- UCHAR Version; // 1.0
- UCHAR Type; // 0 = EAP Packet
- USHORT Length;
-} IEEE8021X_FRAME, *PIEEE8021X_FRAME;
-
typedef struct PACKED _RSN_IE_HEADER_STRUCT {
UCHAR Eid;
UCHAR Length;
Index: b/drivers/staging/rt3090/common/rtmp_mcu.c
===================================================================
--- a/drivers/staging/rt3090/common/rtmp_mcu.c
+++ b/drivers/staging/rt3090/common/rtmp_mcu.c
@@ -43,7 +43,7 @@
// New 8k byte firmware size for RT3071/RT3072
#define FIRMWAREIMAGE_MAX_LENGTH 0x2000
-#define FIRMWAREIMAGE_LENGTH (sizeof (FirmwareImage) / sizeof(UCHAR))
+#define FIRMWAREIMAGE_LENGTH (sizeof (FirmwareImage_3090) / sizeof(UCHAR))
#define FIRMWARE_MAJOR_VERSION 0
#define FIRMWAREIMAGEV1_LENGTH 0x1000
@@ -335,8 +335,8 @@ NDIS_STATUS RtmpAsicLoadFirmware(
UINT32 MacReg = 0;
UINT32 Version = (pAd->MACVersion >> 16);
- pFirmwareImage = FirmwareImage;
- FileLength = sizeof(FirmwareImage);
+ pFirmwareImage = FirmwareImage_3090;
+ FileLength = sizeof(*pFirmwareImage);
// New 8k byte firmware size for RT3071/RT3072
//DBGPRINT(RT_DEBUG_TRACE, ("Usb Chip\n"));
@@ -347,7 +347,7 @@ NDIS_STATUS RtmpAsicLoadFirmware(
#ifdef RTMP_MAC_PCI
if ((Version == 0x2860) || IS_RT3090(pAd)||IS_RT3390(pAd))
{
- pFirmwareImage = FirmwareImage;
+ pFirmwareImage = FirmwareImage_3090;
FileLength = FIRMWAREIMAGE_LENGTH;
}
#endif // RTMP_MAC_PCI //
Index: b/drivers/staging/rt3090/firmware.h
===================================================================
--- a/drivers/staging/rt3090/firmware.h
+++ b/drivers/staging/rt3090/firmware.h
@@ -2,7 +2,7 @@
/* AUTO GEN PLEASE DO NOT MODIFY IT */
-UCHAR FirmwareImage [] = {
+UCHAR FirmwareImage_3090 [] = {
0x02, 0x02, 0xf3, 0x02, 0x02, 0xa1, 0x22, 0x22, 0xff, 0xff, 0xff, 0x02, 0x01, 0x27, 0xff, 0xff,
0xff, 0xff, 0xff, 0x02, 0x00, 0x1e, 0xff, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0xd8, 0xc0, 0xe0,
0xc0, 0xf0, 0xc0, 0x83, 0xc0, 0x82, 0xc0, 0xd0, 0x75, 0xd0, 0x18, 0xc2, 0xaf, 0x30, 0x45, 0x03,
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 8/8] Staging: remove no longer needed rt3090 driver
2009-09-22 18:43 [PATCH 0/8] Staging: updates for Ralink drivers Bartlomiej Zolnierkiewicz
` (6 preceding siblings ...)
2009-09-22 18:44 ` [PATCH 7/8] Staging: rt2860: add RT3090 chipset support Bartlomiej Zolnierkiewicz
@ 2009-09-22 18:44 ` Bartlomiej Zolnierkiewicz
2009-10-09 16:24 ` [PATCH 0/8] Staging: updates for Ralink drivers Greg KH
8 siblings, 0 replies; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-09-22 18:44 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: devel, Bartlomiej Zolnierkiewicz, Mike Galbraith, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: remove no longer needed rt3090 driver
rt2860 handles now all rt2860/rt3090 chipsets.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
The patch itself can be obtained from:
http://www.kernel.org/pub/linux/kernel/people/bart/ralink/staging-remove-no-longer-needed-rt3090-driver.patch
[ it is too big for the mailing list ]
drivers/staging/Kconfig | 2
drivers/staging/Makefile | 1
drivers/staging/rt2860/pci_main_dev.c | 1
drivers/staging/rt3090/Kconfig | 5
drivers/staging/rt3090/Makefile | 80
drivers/staging/rt3090/action.h | 66
drivers/staging/rt3090/ap.h | 512 -
drivers/staging/rt3090/ap_apcli.h | 276
drivers/staging/rt3090/ap_autoChSel.h | 79
drivers/staging/rt3090/ap_autoChSel_cmm.h | 66
drivers/staging/rt3090/ap_cfg.h | 118
drivers/staging/rt3090/ap_ids.h | 82
drivers/staging/rt3090/ap_mbss.h | 72
drivers/staging/rt3090/ap_uapsd.h | 636 --
drivers/staging/rt3090/ap_wds.h | 212
drivers/staging/rt3090/chips/rt3090.c | 123
drivers/staging/rt3090/chips/rt30xx.c | 525 -
drivers/staging/rt3090/chips/rt3370.c | 121
drivers/staging/rt3090/chips/rt3390.c | 122
drivers/staging/rt3090/chips/rt33xx.c | 536 -
drivers/staging/rt3090/chlist.h | 130
drivers/staging/rt3090/common/action.c | 1057 ---
drivers/staging/rt3090/common/ba_action.c | 1779 -----
drivers/staging/rt3090/common/cmm_aes.c | 1560 -----
drivers/staging/rt3090/common/cmm_asic.c | 2753 ---------
drivers/staging/rt3090/common/cmm_cfg.c | 295
drivers/staging/rt3090/common/cmm_data.c | 2763 ---------
drivers/staging/rt3090/common/cmm_data_pci.c | 1576 -----
drivers/staging/rt3090/common/cmm_info.c | 3717 ------------
drivers/staging/rt3090/common/cmm_mac_pci.c | 1757 -----
drivers/staging/rt3090/common/cmm_profile.c | 2321 -------
drivers/staging/rt3090/common/cmm_sanity.c | 1718 -----
drivers/staging/rt3090/common/cmm_sync.c | 734 --
drivers/staging/rt3090/common/cmm_tkip.c | 966 ---
drivers/staging/rt3090/common/cmm_wep.c | 500 -
drivers/staging/rt3090/common/cmm_wpa.c | 3149 ----------
drivers/staging/rt3090/common/crypt_aes.c | 1007 ---
drivers/staging/rt3090/common/crypt_biginteger.c | 1119 ---
drivers/staging/rt3090/common/crypt_dh.c | 234
drivers/staging/rt3090/common/crypt_hmac.c | 279
drivers/staging/rt3090/common/crypt_md5.c | 353 -
drivers/staging/rt3090/common/crypt_sha2.c | 536 -
drivers/staging/rt3090/common/dfs.c | 481 -
drivers/staging/rt3090/common/ee_efuse.c | 1548 -----
drivers/staging/rt3090/common/ee_prom.c | 308 -
drivers/staging/rt3090/common/eeprom.c | 98
drivers/staging/rt3090/common/igmp_snoop.c | 1365 ----
drivers/staging/rt3090/common/mlme.c | 6550 ---------------------
drivers/staging/rt3090/common/mlme_ex.c | 215
drivers/staging/rt3090/common/netif_block.c | 147
drivers/staging/rt3090/common/rt_channel.c | 1287 ----
drivers/staging/rt3090/common/rt_rf.c | 201
drivers/staging/rt3090/common/rtmp_init.c | 3882 ------------
drivers/staging/rt3090/common/rtmp_mcu.c | 560 -
drivers/staging/rt3090/common/rtmp_timer.c | 327 -
drivers/staging/rt3090/common/spectrum.c | 2221 -------
drivers/staging/rt3090/config.mk | 187
drivers/staging/rt3090/crypt_hmac.h | 81
drivers/staging/rt3090/crypt_md5.h | 78
drivers/staging/rt3090/crypt_sha2.h | 107
drivers/staging/rt3090/dfs.h | 137
drivers/staging/rt3090/eeprom.h | 82
drivers/staging/rt3090/igmp_snoop.h | 152
drivers/staging/rt3090/ipv6.h | 215
drivers/staging/rt3090/link_list.h | 133
drivers/staging/rt3090/mac_pci.h | 454 -
drivers/staging/rt3090/mlme.h | 1360 ----
drivers/staging/rt3090/mlme_ex.h | 83
drivers/staging/rt3090/mlme_ex_def.h | 53
drivers/staging/rt3090/netif_block.h | 56
drivers/staging/rt3090/oid.h | 1015 ---
drivers/staging/rt3090/pci_main_dev.c | 1195 ---
drivers/staging/rt3090/rt3090.h | 77
drivers/staging/rt3090/rt30xx.h | 48
drivers/staging/rt3090/rt3370.h | 64
drivers/staging/rt3090/rt3390.h | 77
drivers/staging/rt3090/rt33xx.h | 48
drivers/staging/rt3090/rt_ate.c | 6089 --------------------
drivers/staging/rt3090/rt_ate.h | 314 -
drivers/staging/rt3090/rt_config.h | 126
drivers/staging/rt3090/rt_linux.c | 1623 -----
drivers/staging/rt3090/rt_linux.h | 1034 ---
drivers/staging/rt3090/rt_main_dev.c | 897 ---
drivers/staging/rt3090/rt_pci_rbus.c | 989 ---
drivers/staging/rt3090/rt_profile.c | 101
drivers/staging/rt3090/rtmp.h | 6873 -----------------------
drivers/staging/rt3090/rtmp_chip.h | 355 -
drivers/staging/rt3090/rtmp_def.h | 1650 -----
drivers/staging/rt3090/rtmp_dot11.h | 146
drivers/staging/rt3090/rtmp_iface.h | 81
drivers/staging/rt3090/rtmp_mac.h | 2304 -------
drivers/staging/rt3090/rtmp_mcu.h | 55
drivers/staging/rt3090/rtmp_os.h | 93
drivers/staging/rt3090/rtmp_pci.h | 110
drivers/staging/rt3090/rtmp_phy.h | 631 --
drivers/staging/rt3090/rtmp_timer.h | 162
drivers/staging/rt3090/rtmp_type.h | 147
drivers/staging/rt3090/spectrum.h | 234
drivers/staging/rt3090/spectrum_def.h | 257
drivers/staging/rt3090/sta/assoc.c | 1673 -----
drivers/staging/rt3090/sta/auth.c | 491 -
drivers/staging/rt3090/sta/auth_rsp.c | 151
drivers/staging/rt3090/sta/connect.c | 2759 ---------
drivers/staging/rt3090/sta/dls.c | 2207 -------
drivers/staging/rt3090/sta/rtmp_ckipmic.c | 579 -
drivers/staging/rt3090/sta/rtmp_data.c | 2661 --------
drivers/staging/rt3090/sta/sanity.c | 382 -
drivers/staging/rt3090/sta/sync.c | 1840 ------
drivers/staging/rt3090/sta/wpa.c | 396 -
drivers/staging/rt3090/sta_ioctl.c | 4477 --------------
drivers/staging/rt3090/vr_ikans.h | 71
drivers/staging/rt3090/wpa.h | 447 -
112 files changed, 1 insertion(+), 101234 deletions(-)
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 0/8] Staging: updates for Ralink drivers
2009-09-22 18:43 [PATCH 0/8] Staging: updates for Ralink drivers Bartlomiej Zolnierkiewicz
` (7 preceding siblings ...)
2009-09-22 18:44 ` [PATCH 8/8] Staging: remove no longer needed rt3090 driver Bartlomiej Zolnierkiewicz
@ 2009-10-09 16:24 ` Greg KH
8 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2009-10-09 16:24 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz
Cc: Greg Kroah-Hartman, devel, Mike Galbraith, linux-kernel
On Tue, Sep 22, 2009 at 08:43:21PM +0200, Bartlomiej Zolnierkiewicz wrote:
>
> Hi,
>
> Here are some major updates to Ralink drivers from the staging tree.
>
> rt28x0 drivers are updated to match V2.1.0.0 vendor's drivers, rt2860
> driver gets RT3090 PCIe chipset support and no longer needed separate
> rt3090 driver is removed.
>
> The end result is 100 KLOC gone and shared common code for all chipsets.
>
> The patchset was tested with RT2860 and RT3070 chipsets.
Very cool work, thanks so much. They are all now in my tree and in
linux-next.
greg k-h
^ permalink raw reply [flat|nested] 10+ messages in thread