1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * DHD Linux header file (dhd_linux exports for cfg80211 and other components) 3*4882a593Smuzhiyun * 4*4882a593Smuzhiyun * Portions of this code are copyright (c) 2021 Cypress Semiconductor Corporation 5*4882a593Smuzhiyun * 6*4882a593Smuzhiyun * Copyright (C) 1999-2017, Broadcom Corporation 7*4882a593Smuzhiyun * 8*4882a593Smuzhiyun * Unless you and Broadcom execute a separate written software license 9*4882a593Smuzhiyun * agreement governing use of this software, this software is licensed to you 10*4882a593Smuzhiyun * under the terms of the GNU General Public License version 2 (the "GPL"), 11*4882a593Smuzhiyun * available at http://www.broadcom.com/licenses/GPLv2.php, with the 12*4882a593Smuzhiyun * following added to such license: 13*4882a593Smuzhiyun * 14*4882a593Smuzhiyun * As a special exception, the copyright holders of this software give you 15*4882a593Smuzhiyun * permission to link this software with independent modules, and to copy and 16*4882a593Smuzhiyun * distribute the resulting executable under terms of your choice, provided that 17*4882a593Smuzhiyun * you also meet, for each linked independent module, the terms and conditions of 18*4882a593Smuzhiyun * the license of that module. An independent module is a module which is not 19*4882a593Smuzhiyun * derived from this software. The special exception does not apply to any 20*4882a593Smuzhiyun * modifications of the software. 21*4882a593Smuzhiyun * 22*4882a593Smuzhiyun * Notwithstanding the above, under no circumstances may you combine this 23*4882a593Smuzhiyun * software in any way with any other Broadcom software provided under a license 24*4882a593Smuzhiyun * other than the GPL, without Broadcom's express prior written consent. 25*4882a593Smuzhiyun * 26*4882a593Smuzhiyun * 27*4882a593Smuzhiyun * <<Broadcom-WL-IPTag/Open:>> 28*4882a593Smuzhiyun * 29*4882a593Smuzhiyun * $Id: dhd_linux.h 701006 2017-05-23 08:25:04Z $ 30*4882a593Smuzhiyun */ 31*4882a593Smuzhiyun 32*4882a593Smuzhiyun /* wifi platform functions for power, interrupt and pre-alloc, either 33*4882a593Smuzhiyun * from Android-like platform device data, or Broadcom wifi platform 34*4882a593Smuzhiyun * device data. 35*4882a593Smuzhiyun * 36*4882a593Smuzhiyun */ 37*4882a593Smuzhiyun #ifndef __DHD_LINUX_H__ 38*4882a593Smuzhiyun #define __DHD_LINUX_H__ 39*4882a593Smuzhiyun 40*4882a593Smuzhiyun #include <linux/kernel.h> 41*4882a593Smuzhiyun #include <linux/init.h> 42*4882a593Smuzhiyun #include <linux/fs.h> 43*4882a593Smuzhiyun 44*4882a593Smuzhiyun #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 1)) 45*4882a593Smuzhiyun #include <linux/time64.h> 46*4882a593Smuzhiyun #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 1)) */ 47*4882a593Smuzhiyun 48*4882a593Smuzhiyun #include <dngl_stats.h> 49*4882a593Smuzhiyun #include <dhd.h> 50*4882a593Smuzhiyun #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 1)) 51*4882a593Smuzhiyun #include <linux/time64.h> 52*4882a593Smuzhiyun #define get_monotonic_boottime ktime_get_boottime_ts64 53*4882a593Smuzhiyun #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 1)) */ 54*4882a593Smuzhiyun /* Linux wireless extension support */ 55*4882a593Smuzhiyun #if defined(WL_WIRELESS_EXT) 56*4882a593Smuzhiyun #include <wl_iw.h> 57*4882a593Smuzhiyun #endif /* defined(WL_WIRELESS_EXT) */ 58*4882a593Smuzhiyun #if defined(CONFIG_HAS_EARLYSUSPEND) && defined(DHD_USE_EARLYSUSPEND) 59*4882a593Smuzhiyun #include <linux/earlysuspend.h> 60*4882a593Smuzhiyun #endif /* defined(CONFIG_HAS_EARLYSUSPEND) && defined(DHD_USE_EARLYSUSPEND) */ 61*4882a593Smuzhiyun #if defined(CONFIG_WIFI_CONTROL_FUNC) 62*4882a593Smuzhiyun #include <linux/wlan_plat.h> 63*4882a593Smuzhiyun #endif // endif 64*4882a593Smuzhiyun #ifdef PCIE_FULL_DONGLE 65*4882a593Smuzhiyun #include <etd.h> 66*4882a593Smuzhiyun #endif /* PCIE_FULL_DONGLE */ 67*4882a593Smuzhiyun #ifdef WL_MONITOR 68*4882a593Smuzhiyun #include <bcmmsgbuf.h> 69*4882a593Smuzhiyun #define MAX_RADIOTAP_SIZE 256 /* Maximum size to hold HE Radiotap header format */ 70*4882a593Smuzhiyun #define MAX_MON_PKT_SIZE (4096 + MAX_RADIOTAP_SIZE) 71*4882a593Smuzhiyun #endif /* WL_MONITOR */ 72*4882a593Smuzhiyun 73*4882a593Smuzhiyun #define FILE_DUMP_MAX_WAIT_TIME 4000 74*4882a593Smuzhiyun 75*4882a593Smuzhiyun #define htod32(i) (i) 76*4882a593Smuzhiyun #define htod16(i) (i) 77*4882a593Smuzhiyun #define dtoh32(i) (i) 78*4882a593Smuzhiyun #define dtoh16(i) (i) 79*4882a593Smuzhiyun #define htodchanspec(i) (i) 80*4882a593Smuzhiyun #define dtohchanspec(i) (i) 81*4882a593Smuzhiyun 82*4882a593Smuzhiyun #ifdef BLOCK_IPV6_PACKET 83*4882a593Smuzhiyun #define HEX_PREF_STR "0x" 84*4882a593Smuzhiyun #define UNI_FILTER_STR "010000000000" 85*4882a593Smuzhiyun #define ZERO_ADDR_STR "000000000000" 86*4882a593Smuzhiyun #define ETHER_TYPE_STR "0000" 87*4882a593Smuzhiyun #define IPV6_FILTER_STR "20" 88*4882a593Smuzhiyun #define ZERO_TYPE_STR "00" 89*4882a593Smuzhiyun #endif /* BLOCK_IPV6_PACKET */ 90*4882a593Smuzhiyun 91*4882a593Smuzhiyun typedef struct dhd_if_event { 92*4882a593Smuzhiyun struct list_head list; 93*4882a593Smuzhiyun wl_event_data_if_t event; 94*4882a593Smuzhiyun char name[IFNAMSIZ+1]; 95*4882a593Smuzhiyun uint8 mac[ETHER_ADDR_LEN]; 96*4882a593Smuzhiyun } dhd_if_event_t; 97*4882a593Smuzhiyun 98*4882a593Smuzhiyun /* Interface control information */ 99*4882a593Smuzhiyun typedef struct dhd_if { 100*4882a593Smuzhiyun struct dhd_info *info; /* back pointer to dhd_info */ 101*4882a593Smuzhiyun /* OS/stack specifics */ 102*4882a593Smuzhiyun struct net_device *net; 103*4882a593Smuzhiyun int idx; /* iface idx in dongle */ 104*4882a593Smuzhiyun uint subunit; /* subunit */ 105*4882a593Smuzhiyun uint8 mac_addr[ETHER_ADDR_LEN]; /* assigned MAC address */ 106*4882a593Smuzhiyun bool set_macaddress; 107*4882a593Smuzhiyun bool set_multicast; 108*4882a593Smuzhiyun uint8 bssidx; /* bsscfg index for the interface */ 109*4882a593Smuzhiyun bool attached; /* Delayed attachment when unset */ 110*4882a593Smuzhiyun bool txflowcontrol; /* Per interface flow control indicator */ 111*4882a593Smuzhiyun char name[IFNAMSIZ+1]; /* linux interface name */ 112*4882a593Smuzhiyun char dngl_name[IFNAMSIZ+1]; /* corresponding dongle interface name */ 113*4882a593Smuzhiyun struct net_device_stats stats; 114*4882a593Smuzhiyun struct list_head sta_list; /* sll of associated stations */ 115*4882a593Smuzhiyun spinlock_t sta_list_lock; /* lock for manipulating sll */ 116*4882a593Smuzhiyun uint32 ap_isolate; /* ap-isolation settings */ 117*4882a593Smuzhiyun #ifdef DHD_L2_FILTER 118*4882a593Smuzhiyun bool parp_enable; 119*4882a593Smuzhiyun bool parp_discard; 120*4882a593Smuzhiyun bool parp_allnode; 121*4882a593Smuzhiyun arp_table_t *phnd_arp_table; 122*4882a593Smuzhiyun /* for Per BSS modification */ 123*4882a593Smuzhiyun bool dhcp_unicast; 124*4882a593Smuzhiyun bool block_ping; 125*4882a593Smuzhiyun bool grat_arp; 126*4882a593Smuzhiyun bool block_tdls; 127*4882a593Smuzhiyun #endif /* DHD_L2_FILTER */ 128*4882a593Smuzhiyun #ifdef DHD_MCAST_REGEN 129*4882a593Smuzhiyun bool mcast_regen_bss_enable; 130*4882a593Smuzhiyun #endif // endif 131*4882a593Smuzhiyun bool rx_pkt_chainable; /* set all rx packet to chainable config by default */ 132*4882a593Smuzhiyun cumm_ctr_t cumm_ctr; /* cummulative queue length of child flowrings */ 133*4882a593Smuzhiyun uint8 tx_paths_active; 134*4882a593Smuzhiyun bool del_in_progress; 135*4882a593Smuzhiyun bool static_if; /* used to avoid some operations on static_if */ 136*4882a593Smuzhiyun #ifdef DHD_4WAYM4_FAIL_DISCONNECT 137*4882a593Smuzhiyun struct delayed_work m4state_work; 138*4882a593Smuzhiyun atomic_t m4state; 139*4882a593Smuzhiyun #endif /* DHD_4WAYM4_FAIL_DISCONNECT */ 140*4882a593Smuzhiyun #ifdef DHD_POST_EAPOL_M1_AFTER_ROAM_EVT 141*4882a593Smuzhiyun bool recv_reassoc_evt; 142*4882a593Smuzhiyun bool post_roam_evt; 143*4882a593Smuzhiyun #endif /* DHD_POST_EAPOL_M1_AFTER_ROAM_EVT */ 144*4882a593Smuzhiyun #ifdef DHDTCPSYNC_FLOOD_BLK 145*4882a593Smuzhiyun uint32 tsync_rcvd; 146*4882a593Smuzhiyun uint32 tsyncack_txed; 147*4882a593Smuzhiyun u64 last_sync; 148*4882a593Smuzhiyun struct work_struct blk_tsfl_work; 149*4882a593Smuzhiyun #endif /* DHDTCPSYNC_FLOOD_BLK */ 150*4882a593Smuzhiyun #if defined(BCMSDIO) 151*4882a593Smuzhiyun int role; 152*4882a593Smuzhiyun #endif /* BCMSDIO */ 153*4882a593Smuzhiyun } dhd_if_t; 154*4882a593Smuzhiyun 155*4882a593Smuzhiyun struct ipv6_work_info_t { 156*4882a593Smuzhiyun uint8 if_idx; 157*4882a593Smuzhiyun char ipv6_addr[IPV6_ADDR_LEN]; 158*4882a593Smuzhiyun unsigned long event; 159*4882a593Smuzhiyun }; 160*4882a593Smuzhiyun 161*4882a593Smuzhiyun typedef struct dhd_dump { 162*4882a593Smuzhiyun uint8 *buf; 163*4882a593Smuzhiyun int bufsize; 164*4882a593Smuzhiyun uint8 *hscb_buf; 165*4882a593Smuzhiyun int hscb_bufsize; 166*4882a593Smuzhiyun } dhd_dump_t; 167*4882a593Smuzhiyun #ifdef DNGL_AXI_ERROR_LOGGING 168*4882a593Smuzhiyun typedef struct dhd_axi_error_dump { 169*4882a593Smuzhiyun ulong fault_address; 170*4882a593Smuzhiyun uint32 axid; 171*4882a593Smuzhiyun struct hnd_ext_trap_axi_error_v1 etd_axi_error_v1; 172*4882a593Smuzhiyun } dhd_axi_error_dump_t; 173*4882a593Smuzhiyun #endif /* DNGL_AXI_ERROR_LOGGING */ 174*4882a593Smuzhiyun 175*4882a593Smuzhiyun #ifdef DHD_PCIE_NATIVE_RUNTIMEPM 176*4882a593Smuzhiyun struct dhd_rx_tx_work { 177*4882a593Smuzhiyun struct work_struct work; 178*4882a593Smuzhiyun struct sk_buff *skb; 179*4882a593Smuzhiyun struct net_device *net; 180*4882a593Smuzhiyun struct dhd_pub *pub; 181*4882a593Smuzhiyun }; 182*4882a593Smuzhiyun #endif /* DHD_PCIE_NATIVE_RUNTIMEPM */ 183*4882a593Smuzhiyun 184*4882a593Smuzhiyun #if defined(DHD_LB) 185*4882a593Smuzhiyun #if !defined(PCIE_FULL_DONGLE) 186*4882a593Smuzhiyun #error "DHD Loadbalancing only supported on PCIE_FULL_DONGLE" 187*4882a593Smuzhiyun #endif /* !PCIE_FULL_DONGLE */ 188*4882a593Smuzhiyun #endif /* DHD_LB */ 189*4882a593Smuzhiyun 190*4882a593Smuzhiyun #if defined(DHD_LB_RXP) || defined(DHD_LB_RXC) || defined(DHD_LB_TXC) || \ 191*4882a593Smuzhiyun defined(DHD_LB_STATS) 192*4882a593Smuzhiyun #if !defined(DHD_LB) 193*4882a593Smuzhiyun #error "DHD loadbalance derivatives are supported only if DHD_LB is defined" 194*4882a593Smuzhiyun #endif /* !DHD_LB */ 195*4882a593Smuzhiyun #endif /* DHD_LB_RXP || DHD_LB_RXC || DHD_LB_TXC || DHD_LB_STATS */ 196*4882a593Smuzhiyun 197*4882a593Smuzhiyun #if defined(DHD_LB) 198*4882a593Smuzhiyun /* Dynamic CPU selection for load balancing */ 199*4882a593Smuzhiyun #include <linux/cpu.h> 200*4882a593Smuzhiyun #include <linux/cpumask.h> 201*4882a593Smuzhiyun #include <linux/notifier.h> 202*4882a593Smuzhiyun #include <linux/workqueue.h> 203*4882a593Smuzhiyun #include <asm/atomic.h> 204*4882a593Smuzhiyun 205*4882a593Smuzhiyun #if !defined(DHD_LB_PRIMARY_CPUS) 206*4882a593Smuzhiyun #define DHD_LB_PRIMARY_CPUS 0x0 /* Big CPU coreids mask */ 207*4882a593Smuzhiyun #endif // endif 208*4882a593Smuzhiyun #if !defined(DHD_LB_SECONDARY_CPUS) 209*4882a593Smuzhiyun #define DHD_LB_SECONDARY_CPUS 0xFE /* Little CPU coreids mask */ 210*4882a593Smuzhiyun #endif // endif 211*4882a593Smuzhiyun 212*4882a593Smuzhiyun #define HIST_BIN_SIZE 9 213*4882a593Smuzhiyun 214*4882a593Smuzhiyun #if defined(DHD_LB_TXP) 215*4882a593Smuzhiyun /* Pkttag not compatible with PROP_TXSTATUS or WLFC */ 216*4882a593Smuzhiyun typedef struct dhd_tx_lb_pkttag_fr { 217*4882a593Smuzhiyun struct net_device *net; 218*4882a593Smuzhiyun int ifidx; 219*4882a593Smuzhiyun } dhd_tx_lb_pkttag_fr_t; 220*4882a593Smuzhiyun 221*4882a593Smuzhiyun #define DHD_LB_TX_PKTTAG_SET_NETDEV(tag, netdevp) ((tag)->net = netdevp) 222*4882a593Smuzhiyun #define DHD_LB_TX_PKTTAG_NETDEV(tag) ((tag)->net) 223*4882a593Smuzhiyun 224*4882a593Smuzhiyun #define DHD_LB_TX_PKTTAG_SET_IFIDX(tag, ifidx) ((tag)->ifidx = ifidx) 225*4882a593Smuzhiyun #define DHD_LB_TX_PKTTAG_IFIDX(tag) ((tag)->ifidx) 226*4882a593Smuzhiyun #endif /* DHD_LB_TXP */ 227*4882a593Smuzhiyun 228*4882a593Smuzhiyun #endif /* DHD_LB */ 229*4882a593Smuzhiyun 230*4882a593Smuzhiyun #ifdef FILTER_IE 231*4882a593Smuzhiyun #define FILTER_IE_PATH "/etc/wifi/filter_ie" 232*4882a593Smuzhiyun #define FILTER_IE_BUFSZ 1024 /* ioc buffsize for FILTER_IE */ 233*4882a593Smuzhiyun #define FILE_BLOCK_READ_SIZE 256 234*4882a593Smuzhiyun #define WL_FILTER_IE_IOV_HDR_SIZE OFFSETOF(wl_filter_ie_iov_v1_t, tlvs) 235*4882a593Smuzhiyun #endif /* FILTER_IE */ 236*4882a593Smuzhiyun 237*4882a593Smuzhiyun #define NULL_CHECK(p, s, err) \ 238*4882a593Smuzhiyun do { \ 239*4882a593Smuzhiyun if (!(p)) { \ 240*4882a593Smuzhiyun printk("NULL POINTER (%s) : %s\n", __FUNCTION__, (s)); \ 241*4882a593Smuzhiyun err = BCME_ERROR; \ 242*4882a593Smuzhiyun return err; \ 243*4882a593Smuzhiyun } \ 244*4882a593Smuzhiyun } while (0) 245*4882a593Smuzhiyun 246*4882a593Smuzhiyun #if !defined(CONFIG_WIFI_CONTROL_FUNC) 247*4882a593Smuzhiyun #define WLAN_PLAT_NODFS_FLAG 0x01 248*4882a593Smuzhiyun #define WLAN_PLAT_AP_FLAG 0x02 249*4882a593Smuzhiyun struct wifi_platform_data { 250*4882a593Smuzhiyun int (*set_power)(int val); 251*4882a593Smuzhiyun int (*set_reset)(int val); 252*4882a593Smuzhiyun int (*set_carddetect)(int val); 253*4882a593Smuzhiyun void *(*mem_prealloc)(int section, unsigned long size); 254*4882a593Smuzhiyun int (*get_mac_addr)(unsigned char *buf); 255*4882a593Smuzhiyun #ifdef BCMSDIO 256*4882a593Smuzhiyun int (*get_wake_irq)(void); 257*4882a593Smuzhiyun #endif // endif 258*4882a593Smuzhiyun #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 58)) || defined(CUSTOM_COUNTRY_CODE) 259*4882a593Smuzhiyun void *(*get_country_code)(char *ccode, u32 flags); 260*4882a593Smuzhiyun #else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 58)) || defined (CUSTOM_COUNTRY_CODE) */ 261*4882a593Smuzhiyun void *(*get_country_code)(char *ccode); 262*4882a593Smuzhiyun #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 58)) */ 263*4882a593Smuzhiyun }; 264*4882a593Smuzhiyun #endif /* CONFIG_WIFI_CONTROL_FUNC */ 265*4882a593Smuzhiyun 266*4882a593Smuzhiyun #define DHD_REGISTRATION_TIMEOUT 12000 /* msec : allowed time to finished dhd registration */ 267*4882a593Smuzhiyun 268*4882a593Smuzhiyun typedef struct wifi_adapter_info { 269*4882a593Smuzhiyun const char *name; 270*4882a593Smuzhiyun uint irq_num; 271*4882a593Smuzhiyun uint intr_flags; 272*4882a593Smuzhiyun const char *fw_path; 273*4882a593Smuzhiyun const char *nv_path; 274*4882a593Smuzhiyun void *wifi_plat_data; /* wifi ctrl func, for backward compatibility */ 275*4882a593Smuzhiyun uint bus_type; 276*4882a593Smuzhiyun uint bus_num; 277*4882a593Smuzhiyun uint slot_num; 278*4882a593Smuzhiyun #if defined(BT_OVER_SDIO) 279*4882a593Smuzhiyun const char *btfw_path; 280*4882a593Smuzhiyun #endif /* defined (BT_OVER_SDIO) */ 281*4882a593Smuzhiyun } wifi_adapter_info_t; 282*4882a593Smuzhiyun 283*4882a593Smuzhiyun typedef struct bcmdhd_wifi_platdata { 284*4882a593Smuzhiyun uint num_adapters; 285*4882a593Smuzhiyun wifi_adapter_info_t *adapters; 286*4882a593Smuzhiyun } bcmdhd_wifi_platdata_t; 287*4882a593Smuzhiyun 288*4882a593Smuzhiyun /** Per STA params. A list of dhd_sta objects are managed in dhd_if */ 289*4882a593Smuzhiyun typedef struct dhd_sta { 290*4882a593Smuzhiyun cumm_ctr_t cumm_ctr; /* cummulative queue length of child flowrings */ 291*4882a593Smuzhiyun uint16 flowid[NUMPRIO]; /* allocated flow ring ids (by priority) */ 292*4882a593Smuzhiyun void * ifp; /* associated dhd_if */ 293*4882a593Smuzhiyun struct ether_addr ea; /* stations ethernet mac address */ 294*4882a593Smuzhiyun struct list_head list; /* link into dhd_if::sta_list */ 295*4882a593Smuzhiyun int idx; /* index of self in dhd_pub::sta_pool[] */ 296*4882a593Smuzhiyun int ifidx; /* index of interface in dhd */ 297*4882a593Smuzhiyun } dhd_sta_t; 298*4882a593Smuzhiyun typedef dhd_sta_t dhd_sta_pool_t; 299*4882a593Smuzhiyun 300*4882a593Smuzhiyun #ifdef DHD_4WAYM4_FAIL_DISCONNECT 301*4882a593Smuzhiyun typedef enum { 302*4882a593Smuzhiyun M3_RXED, 303*4882a593Smuzhiyun M4_TXFAILED 304*4882a593Smuzhiyun } msg_4way_state_t; 305*4882a593Smuzhiyun #define MAX_4WAY_TIMEOUT_MS 2000 306*4882a593Smuzhiyun #endif /* DHD_4WAYM4_FAIL_DISCONNECT */ 307*4882a593Smuzhiyun 308*4882a593Smuzhiyun #ifdef DHD_SEND_HANG_PRIVCMD_ERRORS 309*4882a593Smuzhiyun extern uint32 report_hang_privcmd_err; 310*4882a593Smuzhiyun #endif /* DHD_SEND_HANG_PRIVCMD_ERRORS */ 311*4882a593Smuzhiyun 312*4882a593Smuzhiyun #if defined(ARGOS_NOTIFY_CB) 313*4882a593Smuzhiyun int argos_register_notifier_init(struct net_device *net); 314*4882a593Smuzhiyun int argos_register_notifier_deinit(void); 315*4882a593Smuzhiyun 316*4882a593Smuzhiyun extern int sec_argos_register_notifier(struct notifier_block *n, char *label); 317*4882a593Smuzhiyun extern int sec_argos_unregister_notifier(struct notifier_block *n, char *label); 318*4882a593Smuzhiyun 319*4882a593Smuzhiyun typedef struct { 320*4882a593Smuzhiyun struct net_device *wlan_primary_netdev; 321*4882a593Smuzhiyun int argos_rps_cpus_enabled; 322*4882a593Smuzhiyun } argos_rps_ctrl; 323*4882a593Smuzhiyun 324*4882a593Smuzhiyun #define RPS_TPUT_THRESHOLD 300 325*4882a593Smuzhiyun #define DELAY_TO_CLEAR_RPS_CPUS 300 326*4882a593Smuzhiyun #endif // endif 327*4882a593Smuzhiyun 328*4882a593Smuzhiyun #if defined(BT_OVER_SDIO) 329*4882a593Smuzhiyun extern void wl_android_set_wifi_on_flag(bool enable); 330*4882a593Smuzhiyun #endif /* BT_OVER_SDIO */ 331*4882a593Smuzhiyun 332*4882a593Smuzhiyun #ifdef DHD_LOG_DUMP 333*4882a593Smuzhiyun /* 0: DLD_BUF_TYPE_GENERAL, 1: DLD_BUF_TYPE_PRESERVE 334*4882a593Smuzhiyun * 2: DLD_BUF_TYPE_SPECIAL 335*4882a593Smuzhiyun */ 336*4882a593Smuzhiyun #define DLD_BUFFER_NUM 3 337*4882a593Smuzhiyun 338*4882a593Smuzhiyun #ifndef CUSTOM_LOG_DUMP_BUFSIZE_MB 339*4882a593Smuzhiyun #define CUSTOM_LOG_DUMP_BUFSIZE_MB 4 /* DHD_LOG_DUMP_BUF_SIZE 4 MB static memory in kernel */ 340*4882a593Smuzhiyun #endif /* CUSTOM_LOG_DUMP_BUFSIZE_MB */ 341*4882a593Smuzhiyun 342*4882a593Smuzhiyun #define LOG_DUMP_TOTAL_BUFSIZE (1024 * 1024 * CUSTOM_LOG_DUMP_BUFSIZE_MB) 343*4882a593Smuzhiyun 344*4882a593Smuzhiyun /* 345*4882a593Smuzhiyun * Below are different sections that use the prealloced buffer 346*4882a593Smuzhiyun * and sum of the sizes of these should not cross LOG_DUMP_TOTAL_BUFSIZE 347*4882a593Smuzhiyun */ 348*4882a593Smuzhiyun #define LOG_DUMP_GENERAL_MAX_BUFSIZE (256 * 1024 * CUSTOM_LOG_DUMP_BUFSIZE_MB) 349*4882a593Smuzhiyun #define LOG_DUMP_PRESERVE_MAX_BUFSIZE (128 * 1024 * CUSTOM_LOG_DUMP_BUFSIZE_MB) 350*4882a593Smuzhiyun #define LOG_DUMP_ECNTRS_MAX_BUFSIZE (256 * 1024 * CUSTOM_LOG_DUMP_BUFSIZE_MB) 351*4882a593Smuzhiyun #define LOG_DUMP_RTT_MAX_BUFSIZE (256 * 1024 * CUSTOM_LOG_DUMP_BUFSIZE_MB) 352*4882a593Smuzhiyun #define LOG_DUMP_FILTER_MAX_BUFSIZE (128 * 1024 * CUSTOM_LOG_DUMP_BUFSIZE_MB) 353*4882a593Smuzhiyun 354*4882a593Smuzhiyun #if LOG_DUMP_TOTAL_BUFSIZE < (LOG_DUMP_GENERAL_MAX_BUFSIZE + \ 355*4882a593Smuzhiyun LOG_DUMP_PRESERVE_MAX_BUFSIZE + LOG_DUMP_ECNTRS_MAX_BUFSIZE + LOG_DUMP_RTT_MAX_BUFSIZE \ 356*4882a593Smuzhiyun + LOG_DUMP_FILTER_MAX_BUFSIZE) 357*4882a593Smuzhiyun #error "LOG_DUMP_TOTAL_BUFSIZE is lesser than sum of all rings" 358*4882a593Smuzhiyun #endif // endif 359*4882a593Smuzhiyun 360*4882a593Smuzhiyun /* Special buffer is allocated as separately in prealloc */ 361*4882a593Smuzhiyun #define LOG_DUMP_SPECIAL_MAX_BUFSIZE (8 * 1024) 362*4882a593Smuzhiyun 363*4882a593Smuzhiyun #define LOG_DUMP_MAX_FILESIZE (8 *1024 * 1024) /* 8 MB default */ 364*4882a593Smuzhiyun #ifdef CONFIG_LOG_BUF_SHIFT 365*4882a593Smuzhiyun /* 15% of kernel log buf size, if for example klog buf size is 512KB 366*4882a593Smuzhiyun * 15% of 512KB ~= 80KB 367*4882a593Smuzhiyun */ 368*4882a593Smuzhiyun #define LOG_DUMP_KERNEL_TAIL_FLUSH_SIZE \ 369*4882a593Smuzhiyun (15 * ((1 << CONFIG_LOG_BUF_SHIFT)/100)) 370*4882a593Smuzhiyun #endif /* CONFIG_LOG_BUF_SHIFT */ 371*4882a593Smuzhiyun 372*4882a593Smuzhiyun #define LOG_DUMP_COOKIE_BUFSIZE 1024u 373*4882a593Smuzhiyun 374*4882a593Smuzhiyun typedef struct { 375*4882a593Smuzhiyun char *hdr_str; 376*4882a593Smuzhiyun log_dump_section_type_t sec_type; 377*4882a593Smuzhiyun } dld_hdr_t; 378*4882a593Smuzhiyun 379*4882a593Smuzhiyun typedef struct { 380*4882a593Smuzhiyun int attr; 381*4882a593Smuzhiyun char *hdr_str; 382*4882a593Smuzhiyun log_dump_section_type_t sec_type; 383*4882a593Smuzhiyun int log_type; 384*4882a593Smuzhiyun } dld_log_hdr_t; 385*4882a593Smuzhiyun 386*4882a593Smuzhiyun #define DHD_PRINT_BUF_NAME_LEN 30 387*4882a593Smuzhiyun #endif /* DHD_LOG_DUMP */ 388*4882a593Smuzhiyun 389*4882a593Smuzhiyun int dhd_wifi_platform_register_drv(void); 390*4882a593Smuzhiyun void dhd_wifi_platform_unregister_drv(void); 391*4882a593Smuzhiyun wifi_adapter_info_t* dhd_wifi_platform_get_adapter(uint32 bus_type, uint32 bus_num, 392*4882a593Smuzhiyun uint32 slot_num); 393*4882a593Smuzhiyun int wifi_platform_set_power(wifi_adapter_info_t *adapter, bool on, unsigned long msec); 394*4882a593Smuzhiyun int wifi_platform_bus_enumerate(wifi_adapter_info_t *adapter, bool device_present); 395*4882a593Smuzhiyun int wifi_platform_get_irq_number(wifi_adapter_info_t *adapter, unsigned long *irq_flags_ptr); 396*4882a593Smuzhiyun int wifi_platform_get_mac_addr(wifi_adapter_info_t *adapter, unsigned char *buf); 397*4882a593Smuzhiyun #ifdef CUSTOM_COUNTRY_CODE 398*4882a593Smuzhiyun void *wifi_platform_get_country_code(wifi_adapter_info_t *adapter, char *ccode, 399*4882a593Smuzhiyun u32 flags); 400*4882a593Smuzhiyun #else 401*4882a593Smuzhiyun void *wifi_platform_get_country_code(wifi_adapter_info_t *adapter, char *ccode); 402*4882a593Smuzhiyun #endif /* CUSTOM_COUNTRY_CODE */ 403*4882a593Smuzhiyun void* wifi_platform_prealloc(wifi_adapter_info_t *adapter, int section, unsigned long size); 404*4882a593Smuzhiyun void* wifi_platform_get_prealloc_func_ptr(wifi_adapter_info_t *adapter); 405*4882a593Smuzhiyun 406*4882a593Smuzhiyun int dhd_get_fw_mode(struct dhd_info *dhdinfo); 407*4882a593Smuzhiyun bool dhd_update_fw_nv_path(struct dhd_info *dhdinfo); 408*4882a593Smuzhiyun 409*4882a593Smuzhiyun #if defined(BT_OVER_SDIO) 410*4882a593Smuzhiyun int dhd_net_bus_get(struct net_device *dev); 411*4882a593Smuzhiyun int dhd_net_bus_put(struct net_device *dev); 412*4882a593Smuzhiyun #endif /* BT_OVER_SDIO */ 413*4882a593Smuzhiyun #if defined(WLADPS) || defined(WLADPS_PRIVATE_CMD) 414*4882a593Smuzhiyun #define ADPS_ENABLE 1 415*4882a593Smuzhiyun #define ADPS_DISABLE 0 416*4882a593Smuzhiyun 417*4882a593Smuzhiyun int dhd_enable_adps(dhd_pub_t *dhd, uint8 on); 418*4882a593Smuzhiyun #endif /* WLADPS || WLADPS_PRIVATE_CMD */ 419*4882a593Smuzhiyun #ifdef DHDTCPSYNC_FLOOD_BLK 420*4882a593Smuzhiyun extern void dhd_reset_tcpsync_info_by_ifp(dhd_if_t *ifp); 421*4882a593Smuzhiyun extern void dhd_reset_tcpsync_info_by_dev(struct net_device *dev); 422*4882a593Smuzhiyun #endif /* DHDTCPSYNC_FLOOD_BLK */ 423*4882a593Smuzhiyun 424*4882a593Smuzhiyun int compat_kernel_read(struct file *file, loff_t offset, char *addr, unsigned long count); 425*4882a593Smuzhiyun 426*4882a593Smuzhiyun #endif /* __DHD_LINUX_H__ */ 427