xref: /dflybsd-src/sys/dev/netif/ath/ath_hal/ah_regdomain.h (revision 572ff6f6e8b95055988f178b6ba12ce77bb5b3c2)
1*572ff6f6SMatthew Dillon /*
2*572ff6f6SMatthew Dillon  * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
3*572ff6f6SMatthew Dillon  * Copyright (c) 2005-2006 Atheros Communications, Inc.
4*572ff6f6SMatthew Dillon  * All rights reserved.
5*572ff6f6SMatthew Dillon  *
6*572ff6f6SMatthew Dillon  * Permission to use, copy, modify, and/or distribute this software for any
7*572ff6f6SMatthew Dillon  * purpose with or without fee is hereby granted, provided that the above
8*572ff6f6SMatthew Dillon  * copyright notice and this permission notice appear in all copies.
9*572ff6f6SMatthew Dillon  *
10*572ff6f6SMatthew Dillon  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11*572ff6f6SMatthew Dillon  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12*572ff6f6SMatthew Dillon  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13*572ff6f6SMatthew Dillon  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14*572ff6f6SMatthew Dillon  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15*572ff6f6SMatthew Dillon  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16*572ff6f6SMatthew Dillon  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*572ff6f6SMatthew Dillon  *
18*572ff6f6SMatthew Dillon  * $FreeBSD$
19*572ff6f6SMatthew Dillon  */
20*572ff6f6SMatthew Dillon #ifndef	__AH_REGDOMAIN_H__
21*572ff6f6SMatthew Dillon #define	__AH_REGDOMAIN_H__
22*572ff6f6SMatthew Dillon 
23*572ff6f6SMatthew Dillon /*
24*572ff6f6SMatthew Dillon  * BMLEN defines the size of the bitmask used to hold frequency
25*572ff6f6SMatthew Dillon  * band specifications.  Note this must agree with the BM macro
26*572ff6f6SMatthew Dillon  * definition that's used to setup initializers.  See also further
27*572ff6f6SMatthew Dillon  * comments below.
28*572ff6f6SMatthew Dillon  */
29*572ff6f6SMatthew Dillon #define BMLEN 2		/* 2 x 64 bits in each channel bitmask */
30*572ff6f6SMatthew Dillon typedef uint64_t chanbmask_t[BMLEN];
31*572ff6f6SMatthew Dillon 
32*572ff6f6SMatthew Dillon /*
33*572ff6f6SMatthew Dillon  * The following describe the bit masks for different passive scan
34*572ff6f6SMatthew Dillon  * capability/requirements per regdomain.
35*572ff6f6SMatthew Dillon  */
36*572ff6f6SMatthew Dillon #define	NO_PSCAN	0x0ULL			/* NB: must be zero */
37*572ff6f6SMatthew Dillon #define	PSCAN_FCC	0x0000000000000001ULL
38*572ff6f6SMatthew Dillon #define	PSCAN_FCC_T	0x0000000000000002ULL
39*572ff6f6SMatthew Dillon #define	PSCAN_ETSI	0x0000000000000004ULL
40*572ff6f6SMatthew Dillon #define	PSCAN_MKK1	0x0000000000000008ULL
41*572ff6f6SMatthew Dillon #define	PSCAN_MKK2	0x0000000000000010ULL
42*572ff6f6SMatthew Dillon #define	PSCAN_MKKA	0x0000000000000020ULL
43*572ff6f6SMatthew Dillon #define	PSCAN_MKKA_G	0x0000000000000040ULL
44*572ff6f6SMatthew Dillon #define	PSCAN_ETSIA	0x0000000000000080ULL
45*572ff6f6SMatthew Dillon #define	PSCAN_ETSIB	0x0000000000000100ULL
46*572ff6f6SMatthew Dillon #define	PSCAN_ETSIC	0x0000000000000200ULL
47*572ff6f6SMatthew Dillon #define	PSCAN_WWR	0x0000000000000400ULL
48*572ff6f6SMatthew Dillon #define	PSCAN_MKKA1	0x0000000000000800ULL
49*572ff6f6SMatthew Dillon #define	PSCAN_MKKA1_G	0x0000000000001000ULL
50*572ff6f6SMatthew Dillon #define	PSCAN_MKKA2	0x0000000000002000ULL
51*572ff6f6SMatthew Dillon #define	PSCAN_MKKA2_G	0x0000000000004000ULL
52*572ff6f6SMatthew Dillon #define	PSCAN_MKK3	0x0000000000008000ULL
53*572ff6f6SMatthew Dillon #define	PSCAN_DEFER	0x7FFFFFFFFFFFFFFFULL
54*572ff6f6SMatthew Dillon #define	IS_ECM_CHAN	0x8000000000000000ULL
55*572ff6f6SMatthew Dillon 
56*572ff6f6SMatthew Dillon /*
57*572ff6f6SMatthew Dillon  * The following are flags for different requirements per reg domain.
58*572ff6f6SMatthew Dillon  * These requirements are either inhereted from the reg domain pair or
59*572ff6f6SMatthew Dillon  * from the unitary reg domain if the reg domain pair flags value is 0
60*572ff6f6SMatthew Dillon  */
61*572ff6f6SMatthew Dillon enum {
62*572ff6f6SMatthew Dillon 	NO_REQ			= 0x00000000,	/* NB: must be zero */
63*572ff6f6SMatthew Dillon 	DISALLOW_ADHOC_11A	= 0x00000001,	/* adhoc not allowed in 5GHz */
64*572ff6f6SMatthew Dillon 	DISALLOW_ADHOC_11A_TURB	= 0x00000002,	/* not allowed w/ 5GHz turbo */
65*572ff6f6SMatthew Dillon 	NEED_NFC		= 0x00000004,	/* need noise floor check */
66*572ff6f6SMatthew Dillon 	ADHOC_PER_11D		= 0x00000008,	/* must receive 11d beacon */
67*572ff6f6SMatthew Dillon 	LIMIT_FRAME_4MS 	= 0x00000020,	/* 4msec tx burst limit */
68*572ff6f6SMatthew Dillon 	NO_HOSTAP		= 0x00000040,	/* No HOSTAP mode opereation */
69*572ff6f6SMatthew Dillon };
70*572ff6f6SMatthew Dillon 
71*572ff6f6SMatthew Dillon /* Bit masks for DFS per regdomain */
72*572ff6f6SMatthew Dillon enum {
73*572ff6f6SMatthew Dillon 	NO_DFS   = 0x0000000000000000ULL,	/* NB: must be zero */
74*572ff6f6SMatthew Dillon 	DFS_FCC3 = 0x0000000000000001ULL,
75*572ff6f6SMatthew Dillon 	DFS_ETSI = 0x0000000000000002ULL,
76*572ff6f6SMatthew Dillon 	DFS_MKK4 = 0x0000000000000004ULL,
77*572ff6f6SMatthew Dillon };
78*572ff6f6SMatthew Dillon 
79*572ff6f6SMatthew Dillon enum {						/* conformance test limits */
80*572ff6f6SMatthew Dillon 	FCC	= 0x10,
81*572ff6f6SMatthew Dillon 	MKK	= 0x40,
82*572ff6f6SMatthew Dillon 	ETSI	= 0x30,
83*572ff6f6SMatthew Dillon };
84*572ff6f6SMatthew Dillon 
85*572ff6f6SMatthew Dillon /*
86*572ff6f6SMatthew Dillon  * THE following table is the mapping of regdomain pairs specified by
87*572ff6f6SMatthew Dillon  * an 8 bit regdomain value to the individual unitary reg domains
88*572ff6f6SMatthew Dillon  */
89*572ff6f6SMatthew Dillon typedef struct regDomainPair {
90*572ff6f6SMatthew Dillon 	HAL_REG_DOMAIN regDmnEnum;	/* 16 bit reg domain pair */
91*572ff6f6SMatthew Dillon 	HAL_REG_DOMAIN regDmn5GHz;	/* 5GHz reg domain */
92*572ff6f6SMatthew Dillon 	HAL_REG_DOMAIN regDmn2GHz;	/* 2GHz reg domain */
93*572ff6f6SMatthew Dillon 	uint32_t flags5GHz;		/* Requirements flags (AdHoc
94*572ff6f6SMatthew Dillon 					   disallow, noise floor cal needed,
95*572ff6f6SMatthew Dillon 					   etc) */
96*572ff6f6SMatthew Dillon 	uint32_t flags2GHz;		/* Requirements flags (AdHoc
97*572ff6f6SMatthew Dillon 					   disallow, noise floor cal needed,
98*572ff6f6SMatthew Dillon 					   etc) */
99*572ff6f6SMatthew Dillon 	uint64_t pscanMask;		/* Passive Scan flags which
100*572ff6f6SMatthew Dillon 					   can override unitary domain
101*572ff6f6SMatthew Dillon 					   passive scan flags.  This
102*572ff6f6SMatthew Dillon 					   value is used as a mask on
103*572ff6f6SMatthew Dillon 					   the unitary flags*/
104*572ff6f6SMatthew Dillon 	uint16_t singleCC;		/* Country code of single country if
105*572ff6f6SMatthew Dillon 					   a one-on-one mapping exists */
106*572ff6f6SMatthew Dillon }  REG_DMN_PAIR_MAPPING;
107*572ff6f6SMatthew Dillon 
108*572ff6f6SMatthew Dillon typedef struct {
109*572ff6f6SMatthew Dillon 	HAL_CTRY_CODE		countryCode;
110*572ff6f6SMatthew Dillon 	HAL_REG_DOMAIN		regDmnEnum;
111*572ff6f6SMatthew Dillon } COUNTRY_CODE_TO_ENUM_RD;
112*572ff6f6SMatthew Dillon 
113*572ff6f6SMatthew Dillon /*
114*572ff6f6SMatthew Dillon  * Frequency band collections are defined using bitmasks.  Each bit
115*572ff6f6SMatthew Dillon  * in a mask is the index of an entry in one of the following tables.
116*572ff6f6SMatthew Dillon  * Bitmasks are BMLEN*64 bits so if a table grows beyond that the bit
117*572ff6f6SMatthew Dillon  * vectors must be enlarged or the tables split somehow (e.g. split
118*572ff6f6SMatthew Dillon  * 1/2 and 1/4 rate channels into a separate table).
119*572ff6f6SMatthew Dillon  *
120*572ff6f6SMatthew Dillon  * Beware of ordering; the indices are defined relative to the preceding
121*572ff6f6SMatthew Dillon  * entry so if things get off there will be confusion.  A good way to
122*572ff6f6SMatthew Dillon  * check the indices is to collect them in a switch statement in a stub
123*572ff6f6SMatthew Dillon  * function so the compiler checks for duplicates.
124*572ff6f6SMatthew Dillon  */
125*572ff6f6SMatthew Dillon typedef struct {
126*572ff6f6SMatthew Dillon 	uint16_t	lowChannel;	/* Low channel center in MHz */
127*572ff6f6SMatthew Dillon 	uint16_t	highChannel;	/* High Channel center in MHz */
128*572ff6f6SMatthew Dillon 	uint8_t		powerDfs;	/* Max power (dBm) for channel
129*572ff6f6SMatthew Dillon 					   range when using DFS */
130*572ff6f6SMatthew Dillon 	uint8_t		antennaMax;	/* Max allowed antenna gain */
131*572ff6f6SMatthew Dillon 	uint8_t		channelBW;	/* Bandwidth of the channel */
132*572ff6f6SMatthew Dillon 	uint8_t		channelSep;	/* Channel separation within
133*572ff6f6SMatthew Dillon 					   the band */
134*572ff6f6SMatthew Dillon 	uint64_t	useDfs;		/* Use DFS in the RegDomain
135*572ff6f6SMatthew Dillon 					   if corresponding bit is set */
136*572ff6f6SMatthew Dillon 	uint64_t	usePassScan;	/* Use Passive Scan in the RegDomain
137*572ff6f6SMatthew Dillon 					   if corresponding bit is set */
138*572ff6f6SMatthew Dillon } REG_DMN_FREQ_BAND;
139*572ff6f6SMatthew Dillon 
140*572ff6f6SMatthew Dillon typedef struct regDomain {
141*572ff6f6SMatthew Dillon 	uint16_t regDmnEnum;		/* value from EnumRd table */
142*572ff6f6SMatthew Dillon 	uint8_t conformanceTestLimit;
143*572ff6f6SMatthew Dillon 	uint32_t flags;			/* Requirement flags (AdHoc disallow,
144*572ff6f6SMatthew Dillon 					   noise floor cal needed, etc) */
145*572ff6f6SMatthew Dillon 	uint64_t dfsMask;		/* DFS bitmask for 5Ghz tables */
146*572ff6f6SMatthew Dillon 	uint64_t pscan;			/* Bitmask for passive scan */
147*572ff6f6SMatthew Dillon 	chanbmask_t chan11a;		/* 11a channels */
148*572ff6f6SMatthew Dillon 	chanbmask_t chan11a_turbo;	/* 11a static turbo channels */
149*572ff6f6SMatthew Dillon 	chanbmask_t chan11a_dyn_turbo;	/* 11a dynamic turbo channels */
150*572ff6f6SMatthew Dillon 	chanbmask_t chan11a_half;	/* 11a 1/2 width channels */
151*572ff6f6SMatthew Dillon 	chanbmask_t chan11a_quarter;	/* 11a 1/4 width channels */
152*572ff6f6SMatthew Dillon 	chanbmask_t chan11b;		/* 11b channels */
153*572ff6f6SMatthew Dillon 	chanbmask_t chan11g;		/* 11g channels */
154*572ff6f6SMatthew Dillon 	chanbmask_t chan11g_turbo;	/* 11g dynamic turbo channels */
155*572ff6f6SMatthew Dillon 	chanbmask_t chan11g_half;	/* 11g 1/2 width channels */
156*572ff6f6SMatthew Dillon 	chanbmask_t chan11g_quarter;	/* 11g 1/4 width channels */
157*572ff6f6SMatthew Dillon } REG_DOMAIN;
158*572ff6f6SMatthew Dillon 
159*572ff6f6SMatthew Dillon struct cmode {
160*572ff6f6SMatthew Dillon 	u_int	mode;
161*572ff6f6SMatthew Dillon 	u_int	flags;
162*572ff6f6SMatthew Dillon };
163*572ff6f6SMatthew Dillon #endif
164