1 /*- 2 * Copyright (c) 2022-2024 The FreeBSD Foundation 3 * 4 * This software was developed by Björn Zeeb under sponsorship from 5 * the FreeBSD Foundation. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * $FreeBSD$ 29 */ 30 31 #ifndef _IWL_MEI_IWL_MEI_H 32 #define _IWL_MEI_IWL_MEI_H 33 34 #include <linux/types.h> 35 #include <linux/kernel.h> 36 #include <linux/netdevice.h> 37 #include <linux/skbuff.h> 38 39 enum mei_nvm_caps { 40 MEI_NVM_CAPS_11AX_SUPPORT = BIT(0), 41 MEI_NVM_CAPS_LARI_SUPPORT = BIT(1), 42 }; 43 44 struct iwl_mei_nvm { 45 uint8_t n_hw_addrs; 46 enum mei_nvm_caps caps; 47 uint32_t nvm_version; 48 uint32_t radio_cfg; 49 uint32_t channels[110 /* IWL_NVM_NUM_CHANNELS_UHB */]; 50 }; 51 52 struct iwl_mei_conn_info { 53 uint8_t lp_state; 54 uint8_t band; 55 uint8_t channel; 56 uint8_t ssid_len; 57 uint8_t bssid[ETH_ALEN]; 58 uint8_t ssid[IEEE80211_MAX_SSID_LEN]; 59 }; 60 61 struct iwl_mei_ops { 62 void (*me_conn_status)(void *, const struct iwl_mei_conn_info *); 63 void (*nic_stolen)(void *); 64 void (*rfkill)(void *, bool); 65 void (*roaming_forbidden)(void *, bool); 66 void (*sap_connected)(void *); 67 }; 68 69 #if IS_ENABLED(CONFIG_IWLMEI) 70 #error No MEI support in FreeBSD currently 71 #else 72 73 static __inline void 74 iwl_mei_device_down(void) 75 { 76 } 77 78 static __inline struct iwl_mei_nvm * 79 iwl_mei_get_nvm(void) 80 { 81 return (NULL); 82 } 83 84 static __inline int 85 iwl_mei_get_ownership(void) 86 { 87 return (0); 88 } 89 90 static __inline void 91 iwl_mei_host_disassociated(void) 92 { 93 } 94 95 static __inline bool 96 iwl_mei_is_connected(void) 97 { 98 return (false); 99 } 100 101 static __inline void 102 iwl_mei_set_country_code(uint16_t mcc __unused) 103 { 104 } 105 106 static __inline void 107 iwl_mei_set_netdev(struct net_device *netdevice __unused) 108 { 109 } 110 111 static __inline void 112 iwl_mei_set_nic_info(const uint8_t *addr __unused, const uint8_t *hw_addr __unused) 113 { 114 } 115 116 static __inline void 117 iwl_mei_set_rfkill_state(bool rf_killed __unused, bool sw_rfkill __unused) 118 { 119 } 120 121 static __inline void 122 iwl_mei_tx_copy_to_csme(struct sk_buff *skb __unused, unsigned int ivlen __unused) 123 { 124 } 125 126 static __inline int 127 iwl_mei_register(void *mvm __unused, const struct iwl_mei_ops *ops __unused) 128 { 129 return (0); 130 } 131 132 static __inline void 133 iwl_mei_start_unregister(void) 134 { 135 } 136 137 static __inline void 138 iwl_mei_unregister_complete(void) 139 { 140 } 141 142 static __inline void 143 iwl_mei_device_state(bool up __unused) 144 { 145 } 146 147 static __inline void 148 iwl_mei_alive_notif(bool x __unused) 149 { 150 } 151 152 static __inline bool 153 iwl_mei_pldr_req(void) 154 { 155 return (false); 156 } 157 158 static __inline void 159 iwl_mei_set_power_limit(__le16 *x __unused) 160 { 161 } 162 #endif 163 164 #endif /* _IWL_MEI_IWL_MEI_H */ 165