1*5113495bSYour Name /* 2*5113495bSYour Name * Copyright (c) 2021, The Linux Foundation. All rights reserved. 3*5113495bSYour Name * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved. 4*5113495bSYour Name * 5*5113495bSYour Name * Permission to use, copy, modify, and/or distribute this software for any 6*5113495bSYour Name * purpose with or without fee is hereby granted, provided that the above 7*5113495bSYour Name * copyright notice and this permission notice appear in all copies. 8*5113495bSYour Name * 9*5113495bSYour Name * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10*5113495bSYour Name * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11*5113495bSYour Name * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12*5113495bSYour Name * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13*5113495bSYour Name * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14*5113495bSYour Name * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15*5113495bSYour Name * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16*5113495bSYour Name */ 17*5113495bSYour Name 18*5113495bSYour Name /** 19*5113495bSYour Name * DOC: Define the data structure for AFC implementation 20*5113495bSYour Name */ 21*5113495bSYour Name 22*5113495bSYour Name #ifndef __WLAN_REG_AFC_H 23*5113495bSYour Name #define __WLAN_REG_AFC_H 24*5113495bSYour Name 25*5113495bSYour Name /* All the structures in this header will be packed and will follow network 26*5113495bSYour Name * byte order 27*5113495bSYour Name */ 28*5113495bSYour Name 29*5113495bSYour Name /** 30*5113495bSYour Name * struct wlan_afc_freq_range_obj - Structure for frequency range query. 31*5113495bSYour Name * @lowfreq: Lower limit(in MHz) for frequency range query. 32*5113495bSYour Name * @highfreq: Higher limit(in MHz) for frequency range query. 33*5113495bSYour Name */ 34*5113495bSYour Name struct wlan_afc_freq_range_obj { 35*5113495bSYour Name uint16_t lowfreq; 36*5113495bSYour Name uint16_t highfreq; 37*5113495bSYour Name }; 38*5113495bSYour Name 39*5113495bSYour Name /** 40*5113495bSYour Name * struct wlan_afc_frange_list - Structure to send freq range list to AFC app. 41*5113495bSYour Name * @num_ranges: Number of queried frequency ranges. 42*5113495bSYour Name * @range_objs: List of queried frequency ranges. 43*5113495bSYour Name */ 44*5113495bSYour Name struct wlan_afc_frange_list { 45*5113495bSYour Name uint32_t num_ranges; 46*5113495bSYour Name struct wlan_afc_freq_range_obj *range_objs; 47*5113495bSYour Name }; 48*5113495bSYour Name 49*5113495bSYour Name /** 50*5113495bSYour Name * struct wlan_afc_opclass_obj - Structure for opclass/channel query. 51*5113495bSYour Name * @opclass_num_cfis: Number of channels to be required for given opclass. 52*5113495bSYour Name * @opclass: Operating class to be queried. 53*5113495bSYour Name * @cfis: List of Channels to be queried for given Global opclass. 54*5113495bSYour Name */ 55*5113495bSYour Name struct wlan_afc_opclass_obj { 56*5113495bSYour Name uint8_t opclass_num_cfis; 57*5113495bSYour Name uint8_t opclass; 58*5113495bSYour Name uint8_t *cfis; 59*5113495bSYour Name }; 60*5113495bSYour Name 61*5113495bSYour Name /** 62*5113495bSYour Name * struct wlan_afc_opclass_obj_list - Structure to send opclass object list 63*5113495bSYour Name * to AFC app. 64*5113495bSYour Name * @num_opclass_objs: Number of opclass objects. 65*5113495bSYour Name * @opclass_objs: Pointer to list of opclass objects. 66*5113495bSYour Name */ 67*5113495bSYour Name struct wlan_afc_opclass_obj_list { 68*5113495bSYour Name uint8_t num_opclass_objs; 69*5113495bSYour Name struct wlan_afc_opclass_obj *opclass_objs; 70*5113495bSYour Name }; 71*5113495bSYour Name 72*5113495bSYour Name /** 73*5113495bSYour Name * struct wlan_afc_host_request - Structure to send AFC request info. 74*5113495bSYour Name * @req_id: Unique request ID from FW to be used as AFC request ID 75*5113495bSYour Name * to server. 76*5113495bSYour Name * @version_minor: Lower 16 bits for the AFC request version. 77*5113495bSYour Name * @version_major: Higher 16 bits for the AFC request version. 78*5113495bSYour Name * @min_des_power: Minimum desired power(in dbm) for queried spectrum. 79*5113495bSYour Name * @freq_lst: Pointer to the list of frequency ranges. 80*5113495bSYour Name * @opclass_obj_lst: Pointer to opclass objects list. 81*5113495bSYour Name * @afc_location: Pointer to the AFC location structure, 82*5113495bSYour Name */ 83*5113495bSYour Name struct wlan_afc_host_request { 84*5113495bSYour Name uint64_t req_id; 85*5113495bSYour Name uint16_t version_minor; 86*5113495bSYour Name uint16_t version_major; 87*5113495bSYour Name int16_t min_des_power; 88*5113495bSYour Name struct wlan_afc_frange_list *freq_lst; 89*5113495bSYour Name struct wlan_afc_opclass_obj_list *opclass_obj_lst; 90*5113495bSYour Name struct wlan_afc_location *afc_location; 91*5113495bSYour Name }; 92*5113495bSYour Name 93*5113495bSYour Name /** 94*5113495bSYour Name * enum reg_afc_dev_deploy_type - Deployment type of AP 95*5113495bSYour Name * @AFC_DEPLOYMENT_UNKNOWN: Unknown 96*5113495bSYour Name * @AFC_DEPLOYMENT_INDOOR: Located Indoor 97*5113495bSYour Name * @AFC_DEPLOYMENT_OUTDOOR: Located Outdoor 98*5113495bSYour Name */ 99*5113495bSYour Name enum reg_afc_dev_deploy_type { 100*5113495bSYour Name AFC_DEPLOYMENT_UNKNOWN = 0, 101*5113495bSYour Name AFC_DEPLOYMENT_INDOOR = 1, 102*5113495bSYour Name AFC_DEPLOYMENT_OUTDOOR = 2, 103*5113495bSYour Name }; 104*5113495bSYour Name 105*5113495bSYour Name /** 106*5113495bSYour Name * enum reg_afc_resp_format_type - Response type supported by AP 107*5113495bSYour Name * 108*5113495bSYour Name * @AFC_RESP_TYPE_JSON_RESP: JSON format 109*5113495bSYour Name * @AFC_RESP_TYPE_BIN_RESP: Binary format 110*5113495bSYour Name */ 111*5113495bSYour Name enum reg_afc_resp_format_type { 112*5113495bSYour Name AFC_RESP_TYPE_JSON_RESP = 0, 113*5113495bSYour Name AFC_RESP_TYPE_BIN_RESP = 1, 114*5113495bSYour Name }; 115*5113495bSYour Name 116*5113495bSYour Name /** 117*5113495bSYour Name * enum afc_object_type - AFC Request object types 118*5113495bSYour Name * @AFC_OBJ_LOCATION: Location object 119*5113495bSYour Name */ 120*5113495bSYour Name enum afc_object_type { 121*5113495bSYour Name AFC_OBJ_LOCATION = 1 122*5113495bSYour Name }; 123*5113495bSYour Name 124*5113495bSYour Name /** 125*5113495bSYour Name * struct wlan_afc_location - Structure for afc location info. 126*5113495bSYour Name * @deployment_type: Deployment type of enum reg_afc_dev_deploy_type 127*5113495bSYour Name */ 128*5113495bSYour Name struct wlan_afc_location { 129*5113495bSYour Name uint32_t deployment_type; 130*5113495bSYour Name }; 131*5113495bSYour Name 132*5113495bSYour Name /** 133*5113495bSYour Name * struct wlan_afc_host_resp - Structure for AFC Host response to FW 134*5113495bSYour Name * @header: Header for compatibility. 135*5113495bSYour Name * Valid value: 0 136*5113495bSYour Name * @status: Flag to indicate validity of data. To be updated by TZ 137*5113495bSYour Name * 1: Success 138*5113495bSYour Name * -1: Failure 139*5113495bSYour Name * @time_to_live: Period(in seconds) the data is valid for 140*5113495bSYour Name * @length: Length of the response message 141*5113495bSYour Name * @resp_format: AFC response format. 142*5113495bSYour Name * 0: JSON format 143*5113495bSYour Name * 1: Binary data format 144*5113495bSYour Name * @afc_resp: Response message from the AFC server for queried parameters 145*5113495bSYour Name * 146*5113495bSYour Name * The following is the layout of the AFC response. 147*5113495bSYour Name * 148*5113495bSYour Name * struct wlan_afc_host_resp { 149*5113495bSYour Name * header; 150*5113495bSYour Name * status; 151*5113495bSYour Name * time_to_live; 152*5113495bSYour Name * length; 153*5113495bSYour Name * resp_format; 154*5113495bSYour Name * afc_resp { 155*5113495bSYour Name * struct wlan_afc_bin_resp_data fixed_params; 156*5113495bSYour Name * struct wlan_afc_resp_freq_psd_info obj[0]; 157*5113495bSYour Name * .... 158*5113495bSYour Name * struct wlan_afc_resp_freq_psd_info obj[num_frequency_obj - 1]; 159*5113495bSYour Name * struct wlan_afc_resp_opclass_info opclass[0]; 160*5113495bSYour Name * { 161*5113495bSYour Name * struct wlan_afc_resp_eirp_info eirp[0]; 162*5113495bSYour Name * .... 163*5113495bSYour Name * struct wlan_afc_resp_eirp_info eirp[num_channels - 1]; 164*5113495bSYour Name * } 165*5113495bSYour Name * . 166*5113495bSYour Name * . 167*5113495bSYour Name * struct wlan_afc_resp_opclass_info opclass[num_channel_obj - 1]; 168*5113495bSYour Name * { 169*5113495bSYour Name * struct wlan_afc_resp_eirp_info eirp[0]; 170*5113495bSYour Name * .... 171*5113495bSYour Name * struct wlan_afc_resp_eirp_info eirp[num_channels - 1]; 172*5113495bSYour Name * } 173*5113495bSYour Name * } 174*5113495bSYour Name * } 175*5113495bSYour Name * 176*5113495bSYour Name */ 177*5113495bSYour Name struct wlan_afc_host_resp { 178*5113495bSYour Name uint32_t header; 179*5113495bSYour Name int32_t status; 180*5113495bSYour Name uint32_t time_to_live; 181*5113495bSYour Name uint32_t length; 182*5113495bSYour Name uint32_t resp_format; 183*5113495bSYour Name uint8_t afc_resp[]; 184*5113495bSYour Name } qdf_packed; 185*5113495bSYour Name 186*5113495bSYour Name /** 187*5113495bSYour Name * struct wlan_afc_resp_opclass_info - Structure to populate operating class 188*5113495bSYour Name * and channel information from AFC 189*5113495bSYour Name * response. 190*5113495bSYour Name * @opclass: Operating class 191*5113495bSYour Name * @num_channels: Number of channels received in AFC response 192*5113495bSYour Name */ 193*5113495bSYour Name struct wlan_afc_resp_opclass_info { 194*5113495bSYour Name uint32_t opclass; 195*5113495bSYour Name uint32_t num_channels; 196*5113495bSYour Name } qdf_packed; 197*5113495bSYour Name 198*5113495bSYour Name /** 199*5113495bSYour Name * struct wlan_afc_resp_eirp_info - Structure to update EIRP values for channels 200*5113495bSYour Name * @channel_cfi: Channel center frequency index 201*5113495bSYour Name * @max_eirp_pwr: Maximum permissible EIRP(in dBm) for the Channel 202*5113495bSYour Name */ 203*5113495bSYour Name struct wlan_afc_resp_eirp_info { 204*5113495bSYour Name uint32_t channel_cfi; 205*5113495bSYour Name int32_t max_eirp_pwr; 206*5113495bSYour Name } qdf_packed; 207*5113495bSYour Name 208*5113495bSYour Name /** 209*5113495bSYour Name * struct wlan_afc_resp_freq_psd_info - Structure to update PSD values for 210*5113495bSYour Name * queried frequency ranges 211*5113495bSYour Name * @freq_info: Frequency range in MHz:- bits 15:0 = u16 start_freq, 212*5113495bSYour Name * bits 31:16 = u16 end_freq 213*5113495bSYour Name * @max_psd: Maximum PSD in dbm/MHz 214*5113495bSYour Name */ 215*5113495bSYour Name struct wlan_afc_resp_freq_psd_info { 216*5113495bSYour Name uint32_t freq_info; 217*5113495bSYour Name uint32_t max_psd; 218*5113495bSYour Name } qdf_packed; 219*5113495bSYour Name 220*5113495bSYour Name /** 221*5113495bSYour Name * struct wlan_afc_bin_resp_data - Structure to populate AFC binary response 222*5113495bSYour Name * @local_err_code: Internal error code between AFC app and FW 223*5113495bSYour Name * 0 - Success 224*5113495bSYour Name * 1 - General failure 225*5113495bSYour Name * @version: Internal version between AFC app and FW 226*5113495bSYour Name * Current version: 1 227*5113495bSYour Name * @afc_wfa_version: AFC spec version info. Bits 15:0 - Minor version 228*5113495bSYour Name * Bits 31:16 - Major version 229*5113495bSYour Name * @request_id: AFC unique request ID 230*5113495bSYour Name * @avail_exp_time_d: Availability expiry date in UTC. 231*5113495bSYour Name * Date format: bits 7:0 - DD (Day 1-31) 232*5113495bSYour Name * bits 15:8 - MM (Month 1-12) 233*5113495bSYour Name * bits 31:16 - YYYY (Year) 234*5113495bSYour Name * @avail_exp_time_t: Availability expiry time in UTC. 235*5113495bSYour Name * Time format: bits 7:0 - SS (Seconds 0-59) 236*5113495bSYour Name * bits 15:8 - MM (Minutes 0-59) 237*5113495bSYour Name * bits 23:16 - HH (Hours 0-23) 238*5113495bSYour Name * bits 31:24 - Reserved 239*5113495bSYour Name * @afc_serv_resp_code: AFC server response code. The AFC server response codes 240*5113495bSYour Name * are defined in the WiFi Spec doc for AFC as follows: 241*5113495bSYour Name * 0: Success. 242*5113495bSYour Name * 100 - 199: General errors related to protocol. 243*5113495bSYour Name * 300 - 399: Error events specific to message exchange 244*5113495bSYour Name * for the available Spectrum Inquiry. 245*5113495bSYour Name * @num_frequency_obj: Number of frequency objects 246*5113495bSYour Name * @num_channel_obj: Number of channel objects 247*5113495bSYour Name * @shortdesc: Short description corresponding to resp_code field 248*5113495bSYour Name * @reserved: Reserved for future use 249*5113495bSYour Name */ 250*5113495bSYour Name struct wlan_afc_bin_resp_data { 251*5113495bSYour Name uint32_t local_err_code; 252*5113495bSYour Name uint32_t version; 253*5113495bSYour Name uint32_t afc_wfa_version; 254*5113495bSYour Name uint32_t request_id; 255*5113495bSYour Name uint32_t avail_exp_time_d; 256*5113495bSYour Name uint32_t avail_exp_time_t; 257*5113495bSYour Name uint32_t afc_serv_resp_code; 258*5113495bSYour Name uint32_t num_frequency_obj; 259*5113495bSYour Name uint32_t num_channel_obj; 260*5113495bSYour Name uint8_t shortdesc[64]; 261*5113495bSYour Name uint32_t reserved[2]; 262*5113495bSYour Name } qdf_packed; 263*5113495bSYour Name #endif 264