iPXE
Functions
ath5k_caps.c File Reference
#include "ath5k.h"
#include "reg.h"
#include "base.h"

Go to the source code of this file.

Functions

 FILE_LICENCE (MIT)
int ath5k_hw_set_capabilities (struct ath5k_hw *ah)
int ath5k_hw_get_capability (struct ath5k_hw *ah, enum ath5k_capability_type cap_type, u32 capability __unused, u32 *result)

Function Documentation

FILE_LICENCE ( MIT  )
int ath5k_hw_set_capabilities ( struct ath5k_hw ah)

Definition at line 36 of file ath5k_caps.c.

References ath5k_hw::ah_capabilities, ath5k_hw::ah_gpio_npins, ath5k_hw::ah_version, AR5K_AR5210, AR5K_AR5211, AR5K_AR5212, AR5K_EEPROM_HDR_11A, AR5K_EEPROM_HDR_11B, AR5K_EEPROM_HDR_11G, AR5K_MODE_BIT_11A, AR5K_MODE_BIT_11A_TURBO, AR5K_MODE_BIT_11B, AR5K_MODE_BIT_11G, AR5K_MODE_BIT_11G_TURBO, AR5K_NUM_GPIO, ath5k_capabilities::cap_eeprom, ath5k_capabilities::cap_mode, ath5k_capabilities::cap_queues, ath5k_capabilities::cap_range, ath5k_eeprom_info::ee_header, ath5k_capabilities::q_tx_num, ath5k_capabilities::range_2ghz_max, ath5k_capabilities::range_2ghz_min, ath5k_capabilities::range_5ghz_max, and ath5k_capabilities::range_5ghz_min.

Referenced by ath5k_hw_attach().

{
        u16 ee_header;

        /* Capabilities stored in the EEPROM */
        ee_header = ah->ah_capabilities.cap_eeprom.ee_header;

        if (ah->ah_version == AR5K_AR5210) {
                /*
                 * Set radio capabilities
                 * (The AR5110 only supports the middle 5GHz band)
                 */
                ah->ah_capabilities.cap_range.range_5ghz_min = 5120;
                ah->ah_capabilities.cap_range.range_5ghz_max = 5430;
                ah->ah_capabilities.cap_range.range_2ghz_min = 0;
                ah->ah_capabilities.cap_range.range_2ghz_max = 0;

                /* Set supported modes */
                ah->ah_capabilities.cap_mode |= AR5K_MODE_BIT_11A;
                ah->ah_capabilities.cap_mode |= AR5K_MODE_BIT_11A_TURBO;
        } else {
                /*
                 * XXX The tranceiver supports frequencies from 4920 to 6100GHz
                 * XXX and from 2312 to 2732GHz. There are problems with the
                 * XXX current ieee80211 implementation because the IEEE
                 * XXX channel mapping does not support negative channel
                 * XXX numbers (2312MHz is channel -19). Of course, this
                 * XXX doesn't matter because these channels are out of range
                 * XXX but some regulation domains like MKK (Japan) will
                 * XXX support frequencies somewhere around 4.8GHz.
                 */

                /*
                 * Set radio capabilities
                 */

                if (AR5K_EEPROM_HDR_11A(ee_header)) {
                        /* 4920 */
                        ah->ah_capabilities.cap_range.range_5ghz_min = 5005;
                        ah->ah_capabilities.cap_range.range_5ghz_max = 6100;

                        /* Set supported modes */
                        ah->ah_capabilities.cap_mode |= AR5K_MODE_BIT_11A;
                        ah->ah_capabilities.cap_mode |= AR5K_MODE_BIT_11A_TURBO;
                        if (ah->ah_version == AR5K_AR5212)
                                ah->ah_capabilities.cap_mode |=
                                        AR5K_MODE_BIT_11G_TURBO;
                }

                /* Enable  802.11b if a 2GHz capable radio (2111/5112) is
                 * connected */
                if (AR5K_EEPROM_HDR_11B(ee_header) ||
                    (AR5K_EEPROM_HDR_11G(ee_header) &&
                     ah->ah_version != AR5K_AR5211)) {
                        /* 2312 */
                        ah->ah_capabilities.cap_range.range_2ghz_min = 2412;
                        ah->ah_capabilities.cap_range.range_2ghz_max = 2732;

                        if (AR5K_EEPROM_HDR_11B(ee_header))
                                ah->ah_capabilities.cap_mode |=
                                        AR5K_MODE_BIT_11B;

                        if (AR5K_EEPROM_HDR_11G(ee_header) &&
                            ah->ah_version != AR5K_AR5211)
                                ah->ah_capabilities.cap_mode |=
                                        AR5K_MODE_BIT_11G;
                }
        }

        /* GPIO */
        ah->ah_gpio_npins = AR5K_NUM_GPIO;

        /* Set number of supported TX queues */
        ah->ah_capabilities.cap_queues.q_tx_num = 1;

        return 0;
}
int ath5k_hw_get_capability ( struct ath5k_hw ah,
enum ath5k_capability_type  cap_type,
u32 capability  __unused,
u32 result 
)

Definition at line 115 of file ath5k_caps.c.

References ath5k_hw::ah_version, AR5K_AR5212, AR5K_CAP_BSSIDMASK, AR5K_CAP_BURST, AR5K_CAP_COMPRESSION, AR5K_CAP_NUM_TXQUEUES, AR5K_CAP_TPC, AR5K_CAP_VEOL, AR5K_CAP_XR, and EINVAL.

{
        switch (cap_type) {
        case AR5K_CAP_NUM_TXQUEUES:
                if (result) {
                        *result = 1;
                        goto yes;
                }
        case AR5K_CAP_VEOL:
                goto yes;
        case AR5K_CAP_COMPRESSION:
                if (ah->ah_version == AR5K_AR5212)
                        goto yes;
                else
                        goto no;
        case AR5K_CAP_BURST:
                goto yes;
        case AR5K_CAP_TPC:
                goto yes;
        case AR5K_CAP_BSSIDMASK:
                if (ah->ah_version == AR5K_AR5212)
                        goto yes;
                else
                        goto no;
        case AR5K_CAP_XR:
                if (ah->ah_version == AR5K_AR5212)
                        goto yes;
                else
                        goto no;
        default:
                goto no;
        }

no:
        return -EINVAL;
yes:
        return 0;
}