iPXE
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)
 FILE_SECBOOT (FORBIDDEN)
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 )

◆ FILE_SECBOOT()

FILE_SECBOOT ( FORBIDDEN )

◆ ath5k_hw_set_capabilities()

int ath5k_hw_set_capabilities ( struct ath5k_hw * ah)

Definition at line 37 of file ath5k_caps.c.

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

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

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 116 of file ath5k_caps.c.

119{
120 switch (cap_type) {
122 if (result) {
123 *result = 1;
124 goto yes;
125 }
126 case AR5K_CAP_VEOL:
127 goto yes;
129 if (ah->ah_version == AR5K_AR5212)
130 goto yes;
131 else
132 goto no;
133 case AR5K_CAP_BURST:
134 goto yes;
135 case AR5K_CAP_TPC:
136 goto yes;
138 if (ah->ah_version == AR5K_AR5212)
139 goto yes;
140 else
141 goto no;
142 case AR5K_CAP_XR:
143 if (ah->ah_version == AR5K_AR5212)
144 goto yes;
145 else
146 goto no;
147 default:
148 goto no;
149 }
150
151no:
152 return -EINVAL;
153yes:
154 return 0;
155}
uint16_t result
Definition hyperv.h:33
@ AR5K_CAP_XR
Definition ath5k.h:903
@ AR5K_CAP_NUM_TXQUEUES
Definition ath5k.h:893
@ AR5K_CAP_BURST
Definition ath5k.h:896
@ AR5K_CAP_VEOL
Definition ath5k.h:894
@ AR5K_CAP_BSSIDMASK
Definition ath5k.h:900
@ AR5K_CAP_COMPRESSION
Definition ath5k.h:895
@ AR5K_CAP_TPC
Definition ath5k.h:899
#define EINVAL
Invalid argument.
Definition errno.h:429

References __unused, 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, capability, EINVAL, result, and u32.