1*5113495bSYour Name /* 2*5113495bSYour Name * Copyright (c) 2011, 2014-2018, 2020 The Linux Foundation. All rights reserved. 3*5113495bSYour Name * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. 4*5113495bSYour Name * 5*5113495bSYour Name * Permission to use, copy, modify, and/or distribute this software for 6*5113495bSYour Name * any purpose with or without fee is hereby granted, provided that the 7*5113495bSYour Name * above copyright notice and this permission notice appear in all 8*5113495bSYour Name * copies. 9*5113495bSYour Name * 10*5113495bSYour Name * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11*5113495bSYour Name * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12*5113495bSYour Name * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13*5113495bSYour Name * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14*5113495bSYour Name * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15*5113495bSYour Name * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16*5113495bSYour Name * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17*5113495bSYour Name * PERFORMANCE OF THIS SOFTWARE. 18*5113495bSYour Name */ 19*5113495bSYour Name 20*5113495bSYour Name /* 21*5113495bSYour Name * Notifications and licenses are retained for attribution purposes only. 22*5113495bSYour Name */ 23*5113495bSYour Name /* 24*5113495bSYour Name * Copyright (c) 2002-2006 Sam Leffler, Errno Consulting 25*5113495bSYour Name * Copyright (c) 2005-2006 Atheros Communications, Inc. 26*5113495bSYour Name * Copyright (c) 2010, Atheros Communications Inc. 27*5113495bSYour Name * 28*5113495bSYour Name * Redistribution and use in source and binary forms are permitted 29*5113495bSYour Name * provided that the following conditions are met: 30*5113495bSYour Name * 1. The materials contained herein are unmodified and are used 31*5113495bSYour Name * unmodified. 32*5113495bSYour Name * 2. Redistributions of source code must retain the above copyright 33*5113495bSYour Name * notice, this list of conditions and the following NO 34*5113495bSYour Name * ''WARRANTY'' disclaimer below (''Disclaimer''), without 35*5113495bSYour Name * modification. 36*5113495bSYour Name * 3. Redistributions in binary form must reproduce at minimum a 37*5113495bSYour Name * disclaimer similar to the Disclaimer below and any redistribution 38*5113495bSYour Name * must be conditioned upon including a substantially similar 39*5113495bSYour Name * Disclaimer requirement for further binary redistribution. 40*5113495bSYour Name * 4. Neither the names of the above-listed copyright holders nor the 41*5113495bSYour Name * names of any contributors may be used to endorse or promote 42*5113495bSYour Name * product derived from this software without specific prior written 43*5113495bSYour Name * permission. 44*5113495bSYour Name * 45*5113495bSYour Name * NO WARRANTY 46*5113495bSYour Name * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 47*5113495bSYour Name * ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 48*5113495bSYour Name * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, 49*5113495bSYour Name * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 50*5113495bSYour Name * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE 51*5113495bSYour Name * FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 52*5113495bSYour Name * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 53*5113495bSYour Name * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 54*5113495bSYour Name * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 55*5113495bSYour Name * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 56*5113495bSYour Name * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 57*5113495bSYour Name * SUCH DAMAGES. 58*5113495bSYour Name * 59*5113495bSYour Name * This module contains the regulatory domain private structure definitions . 60*5113495bSYour Name * 61*5113495bSYour Name */ 62*5113495bSYour Name 63*5113495bSYour Name #ifndef __CDS_REGDOMAIN_H 64*5113495bSYour Name #define __CDS_REGDOMAIN_H 65*5113495bSYour Name 66*5113495bSYour Name #include <wlan_cmn.h> 67*5113495bSYour Name #include <reg_services_public_struct.h> 68*5113495bSYour Name #include "reg_db.h" 69*5113495bSYour Name 70*5113495bSYour Name #define MIN_TX_PWR_CAP 8 71*5113495bSYour Name #define MAX_TX_PWR_CAP 24 72*5113495bSYour Name 73*5113495bSYour Name #define CTRY_DEFAULT 0 74*5113495bSYour Name #define CTRY_FLAG 0x8000 75*5113495bSYour Name #define WORLD_ROAMING_FLAG 0x4000 76*5113495bSYour Name #define WORLD_ROAMING_MASK 0x00F0 77*5113495bSYour Name #define WORLD_ROAMING_PREFIX 0x0060 78*5113495bSYour Name /** 79*5113495bSYour Name * struct reg_dmn_pair: regulatory domain pair 80*5113495bSYour Name * @reg_dmn_pair: reg domain pair 81*5113495bSYour Name * @reg_dmn_5ghz: 5G reg domain 82*5113495bSYour Name * @reg_dmn_2ghz: 2G reg domain 83*5113495bSYour Name * @single_cc: country with this reg domain 84*5113495bSYour Name */ 85*5113495bSYour Name struct reg_dmn_pair { 86*5113495bSYour Name uint16_t reg_dmn_pair; 87*5113495bSYour Name uint16_t reg_dmn_5ghz; 88*5113495bSYour Name uint16_t reg_dmn_2ghz; 89*5113495bSYour Name uint16_t single_cc; 90*5113495bSYour Name }; 91*5113495bSYour Name 92*5113495bSYour Name /** 93*5113495bSYour Name * struct country_code_to_reg_dmn: country code to reg domain mapping 94*5113495bSYour Name * @country_code: country code 95*5113495bSYour Name * @reg_dmn_pair: regulatory domain pair 96*5113495bSYour Name * @alpha2: country alpha2 97*5113495bSYour Name * @name: country name 98*5113495bSYour Name */ 99*5113495bSYour Name struct country_code_to_reg_dmn { 100*5113495bSYour Name uint16_t country_code; 101*5113495bSYour Name uint16_t reg_dmn_pair; 102*5113495bSYour Name const char *alpha2; 103*5113495bSYour Name const char *name; 104*5113495bSYour Name }; 105*5113495bSYour Name 106*5113495bSYour Name /** 107*5113495bSYour Name * struct reg_dmn: regulatory domain structure 108*5113495bSYour Name * @reg_dmn: regulatory domain 109*5113495bSYour Name * @conformance_test_limit: CTL limit 110*5113495bSYour Name */ 111*5113495bSYour Name struct reg_dmn { 112*5113495bSYour Name uint16_t reg_dmn; 113*5113495bSYour Name uint8_t conformance_test_limit; 114*5113495bSYour Name }; 115*5113495bSYour Name 116*5113495bSYour Name /** 117*5113495bSYour Name * struct reg_dmn_tables: reg domain table 118*5113495bSYour Name * @reg_dmn_pairs: list of reg domain pairs 119*5113495bSYour Name * @all_countries: list of countries 120*5113495bSYour Name * @reg_dmns: list of reg domains 121*5113495bSYour Name * @reg_dmn_pairs_cnt: count of reg domain pairs 122*5113495bSYour Name * @all_countries_cnt: count of countries 123*5113495bSYour Name * @reg_dmns_cnt: count of reg domains 124*5113495bSYour Name */ 125*5113495bSYour Name struct reg_dmn_tables { 126*5113495bSYour Name const struct reg_dmn_pair *reg_dmn_pairs; 127*5113495bSYour Name const struct country_code_to_reg_dmn *all_countries; 128*5113495bSYour Name const struct reg_dmn *reg_dmns; 129*5113495bSYour Name uint16_t reg_dmn_pairs_cnt; 130*5113495bSYour Name uint16_t all_countries_cnt; 131*5113495bSYour Name uint16_t reg_dmns_cnt; 132*5113495bSYour Name }; 133*5113495bSYour Name 134*5113495bSYour Name int32_t cds_fill_some_regulatory_info(struct regulatory *reg); 135*5113495bSYour Name int32_t cds_get_country_from_alpha2(uint8_t *alpha2); 136*5113495bSYour Name void cds_fill_and_send_ctl_to_fw(struct regulatory *reg); 137*5113495bSYour Name /** 138*5113495bSYour Name * cds_is_etsi_europe_country - check ETSI Europe country or not 139*5113495bSYour Name * @country: country string with two Characters 140*5113495bSYour Name * 141*5113495bSYour Name * Return: true if country in ETSI Europe country list 142*5113495bSYour Name */ 143*5113495bSYour Name bool cds_is_etsi_europe_country(uint8_t *country); 144*5113495bSYour Name #endif /* __CDS_REGDOMAIN_H */ 145