xref: /dflybsd-src/sys/dev/netif/iwm/if_iwm_fw.h (revision 4cbc7cf96a5a52309aab9d8db3e0335042767af2)
18a5b1999SImre Vadász /*-
28a5b1999SImre Vadász  * Based on BSD-licensed source modules in the Linux iwlwifi driver,
38a5b1999SImre Vadász  * which were used as the reference documentation for this implementation.
48a5b1999SImre Vadász  *
58a5b1999SImre Vadász  * Driver version we are currently based off of is
68a5b1999SImre Vadász  * Linux 4.7.3 (tag id d7f6728f57e3ecbb7ef34eb7d9f564d514775d75)
78a5b1999SImre Vadász  *
88a5b1999SImre Vadász  ***********************************************************************
98a5b1999SImre Vadász  *
108a5b1999SImre Vadász  * This file is provided under a dual BSD/GPLv2 license.  When using or
118a5b1999SImre Vadász  * redistributing this file, you may do so under either license.
128a5b1999SImre Vadász  *
138a5b1999SImre Vadász  * GPL LICENSE SUMMARY
148a5b1999SImre Vadász  *
158a5b1999SImre Vadász  * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
168a5b1999SImre Vadász  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
178a5b1999SImre Vadász  * Copyright(c) 2016        Intel Deutschland GmbH
188a5b1999SImre Vadász  *
198a5b1999SImre Vadász  * This program is free software; you can redistribute it and/or modify
208a5b1999SImre Vadász  * it under the terms of version 2 of the GNU General Public License as
218a5b1999SImre Vadász  * published by the Free Software Foundation.
228a5b1999SImre Vadász  *
238a5b1999SImre Vadász  * This program is distributed in the hope that it will be useful, but
248a5b1999SImre Vadász  * WITHOUT ANY WARRANTY; without even the implied warranty of
258a5b1999SImre Vadász  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
268a5b1999SImre Vadász  * General Public License for more details.
278a5b1999SImre Vadász  *
288a5b1999SImre Vadász  * You should have received a copy of the GNU General Public License
298a5b1999SImre Vadász  * along with this program; if not, write to the Free Software
308a5b1999SImre Vadász  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
318a5b1999SImre Vadász  * USA
328a5b1999SImre Vadász  *
338a5b1999SImre Vadász  * The full GNU General Public License is included in this distribution
348a5b1999SImre Vadász  * in the file called COPYING.
358a5b1999SImre Vadász  *
368a5b1999SImre Vadász  * Contact Information:
378a5b1999SImre Vadász  *  Intel Linux Wireless <linuxwifi@intel.com>
388a5b1999SImre Vadász  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
398a5b1999SImre Vadász  *
408a5b1999SImre Vadász  * BSD LICENSE
418a5b1999SImre Vadász  *
428a5b1999SImre Vadász  * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
438a5b1999SImre Vadász  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
448a5b1999SImre Vadász  * Copyright(c) 2016        Intel Deutschland GmbH
458a5b1999SImre Vadász  * All rights reserved.
468a5b1999SImre Vadász  *
478a5b1999SImre Vadász  * Redistribution and use in source and binary forms, with or without
488a5b1999SImre Vadász  * modification, are permitted provided that the following conditions
498a5b1999SImre Vadász  * are met:
508a5b1999SImre Vadász  *
518a5b1999SImre Vadász  *  * Redistributions of source code must retain the above copyright
528a5b1999SImre Vadász  *    notice, this list of conditions and the following disclaimer.
538a5b1999SImre Vadász  *  * Redistributions in binary form must reproduce the above copyright
548a5b1999SImre Vadász  *    notice, this list of conditions and the following disclaimer in
558a5b1999SImre Vadász  *    the documentation and/or other materials provided with the
568a5b1999SImre Vadász  *    distribution.
578a5b1999SImre Vadász  *  * Neither the name Intel Corporation nor the names of its
588a5b1999SImre Vadász  *    contributors may be used to endorse or promote products derived
598a5b1999SImre Vadász  *    from this software without specific prior written permission.
608a5b1999SImre Vadász  *
618a5b1999SImre Vadász  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
628a5b1999SImre Vadász  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
638a5b1999SImre Vadász  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
648a5b1999SImre Vadász  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
658a5b1999SImre Vadász  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
668a5b1999SImre Vadász  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
678a5b1999SImre Vadász  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
688a5b1999SImre Vadász  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
698a5b1999SImre Vadász  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
708a5b1999SImre Vadász  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
718a5b1999SImre Vadász  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
728a5b1999SImre Vadász  */
73*6acbba79SMatthew Dillon /*
74*6acbba79SMatthew Dillon  */
758a5b1999SImre Vadász #ifndef	__IF_IWM_FW_H__
768a5b1999SImre Vadász #define	__IF_IWM_FW_H__
778a5b1999SImre Vadász 
788a5b1999SImre Vadász /*
798a5b1999SImre Vadász  * Block paging calculations
808a5b1999SImre Vadász  */
818a5b1999SImre Vadász #define IWM_PAGE_2_EXP_SIZE 12 /* 4K == 2^12 */
828a5b1999SImre Vadász #define IWM_FW_PAGING_SIZE (1 << IWM_PAGE_2_EXP_SIZE) /* page size is 4KB */
838a5b1999SImre Vadász #define IWM_PAGE_PER_GROUP_2_EXP_SIZE 3
848a5b1999SImre Vadász /* 8 pages per group */
858a5b1999SImre Vadász #define IWM_NUM_OF_PAGE_PER_GROUP (1 << IWM_PAGE_PER_GROUP_2_EXP_SIZE)
868a5b1999SImre Vadász /* don't change, support only 32KB size */
878a5b1999SImre Vadász #define IWM_PAGING_BLOCK_SIZE (IWM_NUM_OF_PAGE_PER_GROUP * IWM_FW_PAGING_SIZE)
888a5b1999SImre Vadász /* 32K == 2^15 */
898a5b1999SImre Vadász #define IWM_BLOCK_2_EXP_SIZE (IWM_PAGE_2_EXP_SIZE + IWM_PAGE_PER_GROUP_2_EXP_SIZE)
908a5b1999SImre Vadász 
918a5b1999SImre Vadász /*
928a5b1999SImre Vadász  * Image paging calculations
938a5b1999SImre Vadász  */
948a5b1999SImre Vadász #define IWM_BLOCK_PER_IMAGE_2_EXP_SIZE 5
958a5b1999SImre Vadász /* 2^5 == 32 blocks per image */
968a5b1999SImre Vadász #define IWM_NUM_OF_BLOCK_PER_IMAGE (1 << IWM_BLOCK_PER_IMAGE_2_EXP_SIZE)
978a5b1999SImre Vadász /* maximum image size 1024KB */
988a5b1999SImre Vadász #define IWM_MAX_PAGING_IMAGE_SIZE (IWM_NUM_OF_BLOCK_PER_IMAGE * IWM_PAGING_BLOCK_SIZE)
998a5b1999SImre Vadász 
1008a5b1999SImre Vadász /* Virtual address signature */
1018a5b1999SImre Vadász #define IWM_PAGING_ADDR_SIG 0xAA000000
1028a5b1999SImre Vadász 
1038a5b1999SImre Vadász #define IWM_PAGING_CMD_IS_SECURED (1 << 9)
1048a5b1999SImre Vadász #define IWM_PAGING_CMD_IS_ENABLED (1 << 8)
1058a5b1999SImre Vadász #define IWM_PAGING_CMD_NUM_OF_PAGES_IN_LAST_GRP_POS 0
1068a5b1999SImre Vadász #define IWM_PAGING_TLV_SECURE_MASK 1
1078a5b1999SImre Vadász 
1088a5b1999SImre Vadász extern	void iwm_free_fw_paging(struct iwm_softc *);
1094b1006a6SImre Vadász extern	int iwm_save_fw_paging(struct iwm_softc *, const struct iwm_fw_img *);
1104b1006a6SImre Vadász extern	int iwm_send_paging_cmd(struct iwm_softc *, const struct iwm_fw_img *);
1118a5b1999SImre Vadász 
1128a5b1999SImre Vadász #endif	/* __IF_IWM_FW_H__ */
113