xref: /freebsd/sys/dev/iwm/if_iwm_phy_db.h (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
1 /*	$OpenBSD: if_iwm.c,v 1.39 2015/03/23 00:35:19 jsg Exp $	*/
2 /*	$FreeBSD$ */
3 
4 /*
5  * Copyright (c) 2014 genua mbh <info@genua.de>
6  * Copyright (c) 2014 Fixup Software Ltd.
7  *
8  * Permission to use, copy, modify, and distribute this software for any
9  * purpose with or without fee is hereby granted, provided that the above
10  * copyright notice and this permission notice appear in all copies.
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19  */
20 
21 /*-
22  * Based on BSD-licensed source modules in the Linux iwlwifi driver,
23  * which were used as the reference documentation for this implementation.
24  *
25  * Driver version we are currently based off of is
26  * Linux 3.14.3 (tag id a2df521e42b1d9a23f620ac79dbfe8655a8391dd)
27  *
28  ***********************************************************************
29  *
30  * This file is provided under a dual BSD/GPLv2 license.  When using or
31  * redistributing this file, you may do so under either license.
32  *
33  * GPL LICENSE SUMMARY
34  *
35  * Copyright(c) 2007 - 2013 Intel Corporation. All rights reserved.
36  *
37  * This program is free software; you can redistribute it and/or modify
38  * it under the terms of version 2 of the GNU General Public License as
39  * published by the Free Software Foundation.
40  *
41  * This program is distributed in the hope that it will be useful, but
42  * WITHOUT ANY WARRANTY; without even the implied warranty of
43  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
44  * General Public License for more details.
45  *
46  * You should have received a copy of the GNU General Public License
47  * along with this program; if not, write to the Free Software
48  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
49  * USA
50  *
51  * The full GNU General Public License is included in this distribution
52  * in the file called COPYING.
53  *
54  * Contact Information:
55  *  Intel Linux Wireless <ilw@linux.intel.com>
56  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
57  *
58  *
59  * BSD LICENSE
60  *
61  * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved.
62  * All rights reserved.
63  *
64  * Redistribution and use in source and binary forms, with or without
65  * modification, are permitted provided that the following conditions
66  * are met:
67  *
68  *  * Redistributions of source code must retain the above copyright
69  *    notice, this list of conditions and the following disclaimer.
70  *  * Redistributions in binary form must reproduce the above copyright
71  *    notice, this list of conditions and the following disclaimer in
72  *    the documentation and/or other materials provided with the
73  *    distribution.
74  *  * Neither the name Intel Corporation nor the names of its
75  *    contributors may be used to endorse or promote products derived
76  *    from this software without specific prior written permission.
77  *
78  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
79  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
80  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
81  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
82  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
83  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
84  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
85  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
86  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
87  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
88  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
89  */
90 
91 /*-
92  * Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr>
93  *
94  * Permission to use, copy, modify, and distribute this software for any
95  * purpose with or without fee is hereby granted, provided that the above
96  * copyright notice and this permission notice appear in all copies.
97  *
98  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
99  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
100  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
101  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
102  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
103  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
104  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
105  */
106 #ifndef	__IF_IWM_PHY_DB_H__
107 #define	__IF_IWM_PHY_DB_H__
108 
109 enum iwm_phy_db_section_type {
110 	IWM_PHY_DB_CFG = 1,
111 	IWM_PHY_DB_CALIB_NCH,
112 	IWM_PHY_DB_UNUSED,
113 	IWM_PHY_DB_CALIB_CHG_PAPD,
114 	IWM_PHY_DB_CALIB_CHG_TXP,
115 	IWM_PHY_DB_MAX
116 };
117 
118 #define IWM_PHY_DB_CMD 0x6c /* TEMP API - The actual is 0x8c */
119 
120 /*
121  * phy db - configure operational ucode
122  */
123 struct iwm_phy_db_cmd {
124 	uint16_t type;
125 	uint16_t length;
126 	uint8_t data[];
127 } __packed;
128 
129 /* for parsing of tx power channel group data that comes from the firmware*/
130 struct iwm_phy_db_chg_txp {
131 	uint32_t space;
132 	uint16_t max_channel_idx;
133 } __packed;
134 
135 /*
136  * phy db - Receive phy db chunk after calibrations
137  */
138 struct iwm_calib_res_notif_phy_db {
139 	uint16_t type;
140 	uint16_t length;
141 	uint8_t data[];
142 } __packed;
143 
144 extern	int iwm_phy_db_set_section(struct iwm_softc *sc,
145 	     struct iwm_calib_res_notif_phy_db *phy_db_notif);
146 extern	int iwm_send_phy_db_data(struct iwm_softc *sc);
147 #endif	/* __IF_IWM_PHY_DB_H__ */
148