Author: adrian
Date: Tue Feb  1 03:51:35 2011
New Revision: 218150
URL: http://svn.freebsd.org/changeset/base/218150

Log:
  Add a new capability which reports the number of spatial streams a device 
supports.
  
  The higher levels (net80211, if_ath, ath_rate) need this to make correct
  choices about what MCS capabilities to advertise and what MCS rates are
  able to be TXed.
  
  In summary:
  
  * AR5416 - 2/3 antennas, 2x2 streams
  * AR9160 - 2/3 antennas, 2x2 streams
  * AR9220 - 2 antennas, 2x2 sstraems
  * AR9280 - 2 antennas, 2x2 streams
  * AR9285 - 2 antennas but with antenna diversity, 1x1 stream

Modified:
  head/sys/dev/ath/ath_hal/ah.c
  head/sys/dev/ath/ath_hal/ah.h
  head/sys/dev/ath/ath_hal/ah_internal.h
  head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
  head/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c
  head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
  head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c

Modified: head/sys/dev/ath/ath_hal/ah.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ah.c       Tue Feb  1 01:05:11 2011        
(r218149)
+++ head/sys/dev/ath/ath_hal/ah.c       Tue Feb  1 03:51:35 2011        
(r218150)
@@ -583,6 +583,17 @@ ath_hal_getcapability(struct ath_hal *ah
                return HAL_OK;
        case HAL_CAP_BSSIDMATCH:        /* hardware has disable bssid match */
                return pCap->halBssidMatchSupport ? HAL_OK : HAL_ENOTSUPP;
+       case HAL_CAP_STREAMS:           /* number of 11n spatial streams */
+               switch (capability) {
+               case 0:                 /* TX */
+                       *result = pCap->halTxStreams;
+                       return HAL_OK;
+               case 1:                 /* RX */
+                       *result = pCap->halRxStreams;
+                       return HAL_OK;
+               default:
+                       return HAL_ENOTSUPP;
+               }
        default:
                return HAL_EINVAL;
        }

Modified: head/sys/dev/ath/ath_hal/ah.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ah.h       Tue Feb  1 01:05:11 2011        
(r218149)
+++ head/sys/dev/ath/ath_hal/ah.h       Tue Feb  1 03:51:35 2011        
(r218150)
@@ -111,6 +111,7 @@ typedef enum {
        HAL_CAP_MAC_HANG        = 36,   /* can MAC hang */
        HAL_CAP_INTRMASK        = 37,   /* bitmask of supported interrupts */
        HAL_CAP_BSSIDMATCH      = 38,   /* hardware has disable bssid match */
+       HAL_CAP_STREAMS         = 39,   /* how many 802.11n spatial streams are 
available */
 } HAL_CAPABILITY_TYPE;
 
 /* 

Modified: head/sys/dev/ath/ath_hal/ah_internal.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ah_internal.h      Tue Feb  1 01:05:11 2011        
(r218149)
+++ head/sys/dev/ath/ath_hal/ah_internal.h      Tue Feb  1 03:51:35 2011        
(r218150)
@@ -209,6 +209,8 @@ typedef struct {
        uint8_t         halNumAntCfg2GHz;
        uint8_t         halNumAntCfg5GHz;
        uint32_t        halIntrMask;
+       uint8_t         halTxStreams;
+       uint8_t         halRxStreams;
 } HAL_CAPABILITIES;
 
 struct regDomain;

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c     Tue Feb  1 01:05:11 
2011        (r218149)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c     Tue Feb  1 03:51:35 
2011        (r218150)
@@ -819,6 +819,9 @@ ar5416FillCapabilityInfo(struct ath_hal 
        pCap->halTxChainMask = ath_hal_eepromGet(ah, AR_EEP_TXMASK, AH_NULL);
        /* XXX CB71 uses GPIO 0 to indicate 3 rx chains */
        pCap->halRxChainMask = ath_hal_eepromGet(ah, AR_EEP_RXMASK, AH_NULL);
+       /* AR5416 may have 3 antennas but is a 2x2 stream device */
+       pCap->halTxStreams = 2;
+       pCap->halRxStreams = 2;
        pCap->halRtsAggrLimit = 8*1024;         /* Owl 2.0 limit */
        pCap->halMbssidAggrSupport = AH_TRUE;
        pCap->halForcePpmSupport = AH_TRUE;

Modified: head/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c     Tue Feb  1 01:05:11 
2011        (r218149)
+++ head/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c     Tue Feb  1 03:51:35 
2011        (r218150)
@@ -290,6 +290,10 @@ ar9160FillCapabilityInfo(struct ath_hal 
        pCap->halRtsAggrLimit = 64*1024;        /* 802.11n max */
        pCap->halExtChanDfsSupport = AH_TRUE;
        pCap->halAutoSleepSupport = AH_FALSE;   /* XXX? */
+       /* AR9160 is a 2x2 stream device */
+       pCap->halTxStreams = 2;
+       pCap->halRxStreams = 2;
+
        return AH_TRUE;
 }
 

Modified: head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c     Tue Feb  1 01:05:11 
2011        (r218149)
+++ head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c     Tue Feb  1 03:51:35 
2011        (r218150)
@@ -684,6 +684,10 @@ ar9280FillCapabilityInfo(struct ath_hal 
 #if 0
        pCap->halWowMatchPatternDword = AH_TRUE;
 #endif
+       /* AR9280 is a 2x2 stream device */
+       pCap->halTxStreams = 2;
+       pCap->halRxStreams = 2;
+
        pCap->halCSTSupport = AH_TRUE;
        pCap->halRifsRxSupport = AH_TRUE;
        pCap->halRifsTxSupport = AH_TRUE;

Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c     Tue Feb  1 01:05:11 
2011        (r218149)
+++ head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c     Tue Feb  1 03:51:35 
2011        (r218150)
@@ -370,6 +370,10 @@ ar9285FillCapabilityInfo(struct ath_hal 
 #if 0
        pCap->halWowMatchPatternDword = AH_TRUE;
 #endif
+       /* AR9285 has 2 antennas but is a 1x1 stream device */
+       pCap->halTxStreams = 2;
+       pCap->halRxStreams = 2;
+
        pCap->halCSTSupport = AH_TRUE;
        pCap->halRifsRxSupport = AH_TRUE;
        pCap->halRifsTxSupport = AH_TRUE;
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to