xref: /freebsd/sys/dev/iwm/if_iwm_fw.h (revision 2ff63af9b88c7413b7d71715b5532625752a248e)
19c8efa1dSAdrian Chadd /*-
29c8efa1dSAdrian Chadd  * Based on BSD-licensed source modules in the Linux iwlwifi driver,
39c8efa1dSAdrian Chadd  * which were used as the reference documentation for this implementation.
49c8efa1dSAdrian Chadd  *
59c8efa1dSAdrian Chadd  * Driver version we are currently based off of is
69c8efa1dSAdrian Chadd  * Linux 4.7.3 (tag id d7f6728f57e3ecbb7ef34eb7d9f564d514775d75)
79c8efa1dSAdrian Chadd  *
89c8efa1dSAdrian Chadd  ***********************************************************************
99c8efa1dSAdrian Chadd  *
109c8efa1dSAdrian Chadd  * This file is provided under a dual BSD/GPLv2 license.  When using or
119c8efa1dSAdrian Chadd  * redistributing this file, you may do so under either license.
129c8efa1dSAdrian Chadd  *
139c8efa1dSAdrian Chadd  * GPL LICENSE SUMMARY
149c8efa1dSAdrian Chadd  *
159c8efa1dSAdrian Chadd  * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
169c8efa1dSAdrian Chadd  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
179c8efa1dSAdrian Chadd  * Copyright(c) 2016        Intel Deutschland GmbH
189c8efa1dSAdrian Chadd  *
199c8efa1dSAdrian Chadd  * This program is free software; you can redistribute it and/or modify
209c8efa1dSAdrian Chadd  * it under the terms of version 2 of the GNU General Public License as
219c8efa1dSAdrian Chadd  * published by the Free Software Foundation.
229c8efa1dSAdrian Chadd  *
239c8efa1dSAdrian Chadd  * This program is distributed in the hope that it will be useful, but
249c8efa1dSAdrian Chadd  * WITHOUT ANY WARRANTY; without even the implied warranty of
259c8efa1dSAdrian Chadd  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
269c8efa1dSAdrian Chadd  * General Public License for more details.
279c8efa1dSAdrian Chadd  *
289c8efa1dSAdrian Chadd  * You should have received a copy of the GNU General Public License
299c8efa1dSAdrian Chadd  * along with this program; if not, write to the Free Software
309c8efa1dSAdrian Chadd  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
319c8efa1dSAdrian Chadd  * USA
329c8efa1dSAdrian Chadd  *
339c8efa1dSAdrian Chadd  * The full GNU General Public License is included in this distribution
349c8efa1dSAdrian Chadd  * in the file called COPYING.
359c8efa1dSAdrian Chadd  *
369c8efa1dSAdrian Chadd  * Contact Information:
379c8efa1dSAdrian Chadd  *  Intel Linux Wireless <linuxwifi@intel.com>
389c8efa1dSAdrian Chadd  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
399c8efa1dSAdrian Chadd  *
409c8efa1dSAdrian Chadd  * BSD LICENSE
419c8efa1dSAdrian Chadd  *
429c8efa1dSAdrian Chadd  * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
439c8efa1dSAdrian Chadd  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
449c8efa1dSAdrian Chadd  * Copyright(c) 2016        Intel Deutschland GmbH
459c8efa1dSAdrian Chadd  * All rights reserved.
469c8efa1dSAdrian Chadd  *
479c8efa1dSAdrian Chadd  * Redistribution and use in source and binary forms, with or without
489c8efa1dSAdrian Chadd  * modification, are permitted provided that the following conditions
499c8efa1dSAdrian Chadd  * are met:
509c8efa1dSAdrian Chadd  *
519c8efa1dSAdrian Chadd  *  * Redistributions of source code must retain the above copyright
529c8efa1dSAdrian Chadd  *    notice, this list of conditions and the following disclaimer.
539c8efa1dSAdrian Chadd  *  * Redistributions in binary form must reproduce the above copyright
549c8efa1dSAdrian Chadd  *    notice, this list of conditions and the following disclaimer in
559c8efa1dSAdrian Chadd  *    the documentation and/or other materials provided with the
569c8efa1dSAdrian Chadd  *    distribution.
579c8efa1dSAdrian Chadd  *  * Neither the name Intel Corporation nor the names of its
589c8efa1dSAdrian Chadd  *    contributors may be used to endorse or promote products derived
599c8efa1dSAdrian Chadd  *    from this software without specific prior written permission.
609c8efa1dSAdrian Chadd  *
619c8efa1dSAdrian Chadd  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
629c8efa1dSAdrian Chadd  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
639c8efa1dSAdrian Chadd  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
649c8efa1dSAdrian Chadd  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
659c8efa1dSAdrian Chadd  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
669c8efa1dSAdrian Chadd  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
679c8efa1dSAdrian Chadd  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
689c8efa1dSAdrian Chadd  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
699c8efa1dSAdrian Chadd  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
709c8efa1dSAdrian Chadd  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
719c8efa1dSAdrian Chadd  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
729c8efa1dSAdrian Chadd  */
739c8efa1dSAdrian Chadd /*
749c8efa1dSAdrian Chadd  */
759c8efa1dSAdrian Chadd #ifndef	__IF_IWM_FW_H__
769c8efa1dSAdrian Chadd #define	__IF_IWM_FW_H__
779c8efa1dSAdrian Chadd 
789c8efa1dSAdrian Chadd /*
799c8efa1dSAdrian Chadd  * Block paging calculations
809c8efa1dSAdrian Chadd  */
819c8efa1dSAdrian Chadd #define IWM_PAGE_2_EXP_SIZE 12 /* 4K == 2^12 */
829c8efa1dSAdrian Chadd #define IWM_FW_PAGING_SIZE (1 << IWM_PAGE_2_EXP_SIZE) /* page size is 4KB */
839c8efa1dSAdrian Chadd #define IWM_PAGE_PER_GROUP_2_EXP_SIZE 3
849c8efa1dSAdrian Chadd /* 8 pages per group */
859c8efa1dSAdrian Chadd #define IWM_NUM_OF_PAGE_PER_GROUP (1 << IWM_PAGE_PER_GROUP_2_EXP_SIZE)
869c8efa1dSAdrian Chadd /* don't change, support only 32KB size */
879c8efa1dSAdrian Chadd #define IWM_PAGING_BLOCK_SIZE (IWM_NUM_OF_PAGE_PER_GROUP * IWM_FW_PAGING_SIZE)
889c8efa1dSAdrian Chadd /* 32K == 2^15 */
899c8efa1dSAdrian Chadd #define IWM_BLOCK_2_EXP_SIZE (IWM_PAGE_2_EXP_SIZE + IWM_PAGE_PER_GROUP_2_EXP_SIZE)
909c8efa1dSAdrian Chadd 
919c8efa1dSAdrian Chadd /*
929c8efa1dSAdrian Chadd  * Image paging calculations
939c8efa1dSAdrian Chadd  */
949c8efa1dSAdrian Chadd #define IWM_BLOCK_PER_IMAGE_2_EXP_SIZE 5
959c8efa1dSAdrian Chadd /* 2^5 == 32 blocks per image */
969c8efa1dSAdrian Chadd #define IWM_NUM_OF_BLOCK_PER_IMAGE (1 << IWM_BLOCK_PER_IMAGE_2_EXP_SIZE)
979c8efa1dSAdrian Chadd /* maximum image size 1024KB */
989c8efa1dSAdrian Chadd #define IWM_MAX_PAGING_IMAGE_SIZE (IWM_NUM_OF_BLOCK_PER_IMAGE * IWM_PAGING_BLOCK_SIZE)
999c8efa1dSAdrian Chadd 
1009c8efa1dSAdrian Chadd /* Virtual address signature */
1019c8efa1dSAdrian Chadd #define IWM_PAGING_ADDR_SIG 0xAA000000
1029c8efa1dSAdrian Chadd 
1039c8efa1dSAdrian Chadd #define IWM_PAGING_CMD_IS_SECURED (1 << 9)
1049c8efa1dSAdrian Chadd #define IWM_PAGING_CMD_IS_ENABLED (1 << 8)
1059c8efa1dSAdrian Chadd #define IWM_PAGING_CMD_NUM_OF_PAGES_IN_LAST_GRP_POS 0
1069c8efa1dSAdrian Chadd #define IWM_PAGING_TLV_SECURE_MASK 1
1079c8efa1dSAdrian Chadd 
1089c8efa1dSAdrian Chadd extern	void iwm_free_fw_paging(struct iwm_softc *);
109*f33c8309SKyle Evans extern	int iwm_save_fw_paging(struct iwm_softc *, const struct iwm_fw_img *);
110*f33c8309SKyle Evans extern	int iwm_send_paging_cmd(struct iwm_softc *, const struct iwm_fw_img *);
1119c8efa1dSAdrian Chadd 
1129c8efa1dSAdrian Chadd #endif	/* __IF_IWM_FW_H__ */
113