Path: blob/main/sys/dev/ath/ath_hal/ah_regdomain.h
39536 views
/*-1* SPDX-License-Identifier: ISC2*3* Copyright (c) 2002-2009 Sam Leffler, Errno Consulting4* Copyright (c) 2005-2006 Atheros Communications, Inc.5* All rights reserved.6*7* Permission to use, copy, modify, and/or distribute this software for any8* purpose with or without fee is hereby granted, provided that the above9* copyright notice and this permission notice appear in all copies.10*11* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES12* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF13* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR14* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES15* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN16* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF17* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.18*/19#ifndef __AH_REGDOMAIN_H__20#define __AH_REGDOMAIN_H__2122/*23* BMLEN defines the size of the bitmask used to hold frequency24* band specifications. Note this must agree with the BM macro25* definition that's used to setup initializers. See also further26* comments below.27*/28#define BMLEN 2 /* 2 x 64 bits in each channel bitmask */29typedef uint64_t chanbmask_t[BMLEN];3031/*32* The following describe the bit masks for different passive scan33* capability/requirements per regdomain.34*/35#define NO_PSCAN 0x0ULL /* NB: must be zero */36#define PSCAN_FCC 0x0000000000000001ULL37#define PSCAN_FCC_T 0x0000000000000002ULL38#define PSCAN_ETSI 0x0000000000000004ULL39#define PSCAN_MKK1 0x0000000000000008ULL40#define PSCAN_MKK2 0x0000000000000010ULL41#define PSCAN_MKKA 0x0000000000000020ULL42#define PSCAN_MKKA_G 0x0000000000000040ULL43#define PSCAN_ETSIA 0x0000000000000080ULL44#define PSCAN_ETSIB 0x0000000000000100ULL45#define PSCAN_ETSIC 0x0000000000000200ULL46#define PSCAN_WWR 0x0000000000000400ULL47#define PSCAN_MKKA1 0x0000000000000800ULL48#define PSCAN_MKKA1_G 0x0000000000001000ULL49#define PSCAN_MKKA2 0x0000000000002000ULL50#define PSCAN_MKKA2_G 0x0000000000004000ULL51#define PSCAN_MKK3 0x0000000000008000ULL52#define PSCAN_DEFER 0x7FFFFFFFFFFFFFFFULL53#define IS_ECM_CHAN 0x8000000000000000ULL5455/*56* The following are flags for different requirements per reg domain.57* These requirements are either inhereted from the reg domain pair or58* from the unitary reg domain if the reg domain pair flags value is 059*/60enum {61NO_REQ = 0x00000000, /* NB: must be zero */62DISALLOW_ADHOC_11A = 0x00000001, /* adhoc not allowed in 5GHz */63DISALLOW_ADHOC_11A_TURB = 0x00000002, /* not allowed w/ 5GHz turbo */64NEED_NFC = 0x00000004, /* need noise floor check */65ADHOC_PER_11D = 0x00000008, /* must receive 11d beacon */66LIMIT_FRAME_4MS = 0x00000020, /* 4msec tx burst limit */67NO_HOSTAP = 0x00000040, /* No HOSTAP mode opereation */68};6970/* Bit masks for DFS per regdomain */71enum {72NO_DFS = 0x0000000000000000ULL, /* NB: must be zero */73DFS_FCC3 = 0x0000000000000001ULL,74DFS_ETSI = 0x0000000000000002ULL,75DFS_MKK4 = 0x0000000000000004ULL,76};7778enum { /* conformance test limits */79FCC = 0x10,80MKK = 0x40,81ETSI = 0x30,82};8384/*85* THE following table is the mapping of regdomain pairs specified by86* an 8 bit regdomain value to the individual unitary reg domains87*/88typedef struct regDomainPair {89HAL_REG_DOMAIN regDmnEnum; /* 16 bit reg domain pair */90HAL_REG_DOMAIN regDmn5GHz; /* 5GHz reg domain */91HAL_REG_DOMAIN regDmn2GHz; /* 2GHz reg domain */92uint32_t flags5GHz; /* Requirements flags (AdHoc93disallow, noise floor cal needed,94etc) */95uint32_t flags2GHz; /* Requirements flags (AdHoc96disallow, noise floor cal needed,97etc) */98uint64_t pscanMask; /* Passive Scan flags which99can override unitary domain100passive scan flags. This101value is used as a mask on102the unitary flags*/103uint16_t singleCC; /* Country code of single country if104a one-on-one mapping exists */105} REG_DMN_PAIR_MAPPING;106107typedef struct {108HAL_CTRY_CODE countryCode;109HAL_REG_DOMAIN regDmnEnum;110} COUNTRY_CODE_TO_ENUM_RD;111112/*113* Frequency band collections are defined using bitmasks. Each bit114* in a mask is the index of an entry in one of the following tables.115* Bitmasks are BMLEN*64 bits so if a table grows beyond that the bit116* vectors must be enlarged or the tables split somehow (e.g. split117* 1/2 and 1/4 rate channels into a separate table).118*119* Beware of ordering; the indices are defined relative to the preceding120* entry so if things get off there will be confusion. A good way to121* check the indices is to collect them in a switch statement in a stub122* function so the compiler checks for duplicates.123*/124typedef struct {125uint16_t lowChannel; /* Low channel center in MHz */126uint16_t highChannel; /* High Channel center in MHz */127uint8_t powerDfs; /* Max power (dBm) for channel128range when using DFS */129uint8_t antennaMax; /* Max allowed antenna gain */130uint8_t channelBW; /* Bandwidth of the channel */131uint8_t channelSep; /* Channel separation within132the band */133uint64_t useDfs; /* Use DFS in the RegDomain134if corresponding bit is set */135uint64_t usePassScan; /* Use Passive Scan in the RegDomain136if corresponding bit is set */137} REG_DMN_FREQ_BAND;138139typedef struct regDomain {140uint16_t regDmnEnum; /* value from EnumRd table */141uint8_t conformanceTestLimit;142uint32_t flags; /* Requirement flags (AdHoc disallow,143noise floor cal needed, etc) */144uint64_t dfsMask; /* DFS bitmask for 5Ghz tables */145uint64_t pscan; /* Bitmask for passive scan */146chanbmask_t chan11a; /* 11a channels */147chanbmask_t chan11a_turbo; /* 11a static turbo channels */148chanbmask_t chan11a_dyn_turbo; /* 11a dynamic turbo channels */149chanbmask_t chan11a_half; /* 11a 1/2 width channels */150chanbmask_t chan11a_quarter; /* 11a 1/4 width channels */151chanbmask_t chan11b; /* 11b channels */152chanbmask_t chan11g; /* 11g channels */153chanbmask_t chan11g_turbo; /* 11g dynamic turbo channels */154chanbmask_t chan11g_half; /* 11g 1/2 width channels */155chanbmask_t chan11g_quarter; /* 11g 1/4 width channels */156} REG_DOMAIN;157158struct cmode {159u_int mode;160u_int flags;161REG_DMN_FREQ_BAND *freqs;162};163#endif164165166