xref: /freebsd/sys/contrib/dev/iwlwifi/mei/iwl-mei.h (revision 7ef62cebc2f965b0f640263e179276928885e33d)
1 /*-
2  * Copyright (c) 2022 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 	int __dummy;
54 };
55 
56 struct iwl_mei_ops {
57 	void (*me_conn_status)(void *, const struct iwl_mei_conn_info *);
58 	void (*nic_stolen)(void *);
59 	void (*rfkill)(void *, bool);
60 	void (*roaming_forbidden)(void *, bool);
61 	void (*sap_connected)(void *);
62 };
63 
64 #if IS_ENABLED(CONFIG_IWLMEI)
65 #error No MEI support in FreeBSD currently
66 #else
67 
68 static __inline void
69 iwl_mei_device_down(void)
70 {
71 }
72 
73 static __inline struct iwl_mei_nvm *
74 iwl_mei_get_nvm(void)
75 {
76         return (NULL);
77 }
78 
79 static __inline int
80 iwl_mei_get_ownership(void)
81 {
82 	return (0);
83 }
84 
85 static __inline void
86 iwl_mei_host_disassociated(void)
87 {
88 }
89 
90 static __inline bool
91 iwl_mei_is_connected(void)
92 {
93         return (false);
94 }
95 
96 static __inline void
97 iwl_mei_set_country_code(uint16_t mcc __unused)
98 {
99 }
100 
101 static __inline void
102 iwl_mei_set_netdev(struct net_device *netdevice __unused)
103 {
104 }
105 
106 static __inline void
107 iwl_mei_set_nic_info(const uint8_t *addr __unused, const uint8_t *hw_addr __unused)
108 {
109 }
110 
111 static __inline void
112 iwl_mei_set_rfkill_state(bool rf_killed __unused, bool sw_rfkill __unused)
113 {
114 }
115 
116 static __inline void
117 iwl_mei_tx_copy_to_csme(struct sk_buff *skb __unused, unsigned int ivlen __unused)
118 {
119 }
120 
121 static __inline int
122 iwl_mei_register(void *mvm __unused, const struct iwl_mei_ops *ops __unused)
123 {
124 	return (0);
125 }
126 
127 static __inline void
128 iwl_mei_start_unregister(void)
129 {
130 }
131 
132 static __inline void
133 iwl_mei_unregister_complete(void)
134 {
135 }
136 #endif
137 
138 #endif /* _IWL_MEI_IWL_MEI_H */
139