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()

FILE_LICENCE ( MIT  )

◆ ath5k_hw_set_capabilities()

int ath5k_hw_set_capabilities ( struct ath5k_hw ah)

Definition at line 36 of file ath5k_caps.c.

37 {
38  u16 ee_header;
39 
40  /* Capabilities stored in the EEPROM */
41  ee_header = ah->ah_capabilities.cap_eeprom.ee_header;
42 
43  if (ah->ah_version == AR5K_AR5210) {
44  /*
45  * Set radio capabilities
46  * (The AR5110 only supports the middle 5GHz band)
47  */
48  ah->ah_capabilities.cap_range.range_5ghz_min = 5120;
49  ah->ah_capabilities.cap_range.range_5ghz_max = 5430;
50  ah->ah_capabilities.cap_range.range_2ghz_min = 0;
51  ah->ah_capabilities.cap_range.range_2ghz_max = 0;
52 
53  /* Set supported modes */
54  ah->ah_capabilities.cap_mode |= AR5K_MODE_BIT_11A;
55  ah->ah_capabilities.cap_mode |= AR5K_MODE_BIT_11A_TURBO;
56  } else {
57  /*
58  * XXX The tranceiver supports frequencies from 4920 to 6100GHz
59  * XXX and from 2312 to 2732GHz. There are problems with the
60  * XXX current ieee80211 implementation because the IEEE
61  * XXX channel mapping does not support negative channel
62  * XXX numbers (2312MHz is channel -19). Of course, this
63  * XXX doesn't matter because these channels are out of range
64  * XXX but some regulation domains like MKK (Japan) will
65  * XXX support frequencies somewhere around 4.8GHz.
66  */
67 
68  /*
69  * Set radio capabilities
70  */
71 
72  if (AR5K_EEPROM_HDR_11A(ee_header)) {
73  /* 4920 */
74  ah->ah_capabilities.cap_range.range_5ghz_min = 5005;
75  ah->ah_capabilities.cap_range.range_5ghz_max = 6100;
76 
77  /* Set supported modes */
78  ah->ah_capabilities.cap_mode |= AR5K_MODE_BIT_11A;
79  ah->ah_capabilities.cap_mode |= AR5K_MODE_BIT_11A_TURBO;
80  if (ah->ah_version == AR5K_AR5212)
81  ah->ah_capabilities.cap_mode |=
83  }
84 
85  /* Enable 802.11b if a 2GHz capable radio (2111/5112) is
86  * connected */
87  if (AR5K_EEPROM_HDR_11B(ee_header) ||
88  (AR5K_EEPROM_HDR_11G(ee_header) &&
89  ah->ah_version != AR5K_AR5211)) {
90  /* 2312 */
91  ah->ah_capabilities.cap_range.range_2ghz_min = 2412;
92  ah->ah_capabilities.cap_range.range_2ghz_max = 2732;
93 
94  if (AR5K_EEPROM_HDR_11B(ee_header))
95  ah->ah_capabilities.cap_mode |=
97 
98  if (AR5K_EEPROM_HDR_11G(ee_header) &&
99  ah->ah_version != AR5K_AR5211)
100  ah->ah_capabilities.cap_mode |=
102  }
103  }
104 
105  /* GPIO */
106  ah->ah_gpio_npins = AR5K_NUM_GPIO;
107 
108  /* Set number of supported TX queues */
109  ah->ah_capabilities.cap_queues.q_tx_num = 1;
110 
111  return 0;
112 }
uint16_t u16
Definition: stdint.h:21
#define AR5K_EEPROM_HDR_11B(_v)
Definition: eeprom.h:68
#define AR5K_EEPROM_HDR_11A(_v)
Definition: eeprom.h:67
#define AR5K_NUM_GPIO
Definition: reg.h:931
uint8_t ah
Definition: registers.h:85
#define AR5K_EEPROM_HDR_11G(_v)
Definition: eeprom.h:69

References ah, 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, and AR5K_NUM_GPIO.

Referenced by ath5k_hw_attach().

◆ ath5k_hw_get_capability()

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.

118 {
119  switch (cap_type) {
121  if (result) {
122  *result = 1;
123  goto yes;
124  }
125  case AR5K_CAP_VEOL:
126  goto yes;
128  if (ah->ah_version == AR5K_AR5212)
129  goto yes;
130  else
131  goto no;
132  case AR5K_CAP_BURST:
133  goto yes;
134  case AR5K_CAP_TPC:
135  goto yes;
136  case AR5K_CAP_BSSIDMASK:
137  if (ah->ah_version == AR5K_AR5212)
138  goto yes;
139  else
140  goto no;
141  case AR5K_CAP_XR:
142  if (ah->ah_version == AR5K_AR5212)
143  goto yes;
144  else
145  goto no;
146  default:
147  goto no;
148  }
149 
150 no:
151  return -EINVAL;
152 yes:
153  return 0;
154 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
static const void const void void * result
Definition: crypto.h:335
uint8_t ah
Definition: registers.h:85

References ah, AR5K_AR5212, AR5K_CAP_BSSIDMASK, AR5K_CAP_BURST, AR5K_CAP_COMPRESSION, AR5K_CAP_NUM_TXQUEUES, AR5K_CAP_TPC, AR5K_CAP_VEOL, AR5K_CAP_XR, EINVAL, and result.