xref: /dflybsd-src/sys/dev/netif/iwm/if_iwm_pcie_trans.h (revision 4cbc7cf96a5a52309aab9d8db3e0335042767af2)
124a8d46aSMatthew Dillon /*
224a8d46aSMatthew Dillon  * Copyright (c) 2014 genua mbh <info@genua.de>
324a8d46aSMatthew Dillon  * Copyright (c) 2014 Fixup Software Ltd.
424a8d46aSMatthew Dillon  *
524a8d46aSMatthew Dillon  * Permission to use, copy, modify, and distribute this software for any
624a8d46aSMatthew Dillon  * purpose with or without fee is hereby granted, provided that the above
724a8d46aSMatthew Dillon  * copyright notice and this permission notice appear in all copies.
824a8d46aSMatthew Dillon  *
924a8d46aSMatthew Dillon  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1024a8d46aSMatthew Dillon  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1124a8d46aSMatthew Dillon  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1224a8d46aSMatthew Dillon  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1324a8d46aSMatthew Dillon  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1424a8d46aSMatthew Dillon  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1524a8d46aSMatthew Dillon  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1624a8d46aSMatthew Dillon  */
1724a8d46aSMatthew Dillon 
1824a8d46aSMatthew Dillon /*-
1924a8d46aSMatthew Dillon  * Based on BSD-licensed source modules in the Linux iwlwifi driver,
2024a8d46aSMatthew Dillon  * which were used as the reference documentation for this implementation.
2124a8d46aSMatthew Dillon  *
2224a8d46aSMatthew Dillon  * Driver version we are currently based off of is
2324a8d46aSMatthew Dillon  * Linux 3.14.3 (tag id a2df521e42b1d9a23f620ac79dbfe8655a8391dd)
2424a8d46aSMatthew Dillon  *
2524a8d46aSMatthew Dillon  ***********************************************************************
2624a8d46aSMatthew Dillon  *
2724a8d46aSMatthew Dillon  * This file is provided under a dual BSD/GPLv2 license.  When using or
2824a8d46aSMatthew Dillon  * redistributing this file, you may do so under either license.
2924a8d46aSMatthew Dillon  *
3024a8d46aSMatthew Dillon  * GPL LICENSE SUMMARY
3124a8d46aSMatthew Dillon  *
3224a8d46aSMatthew Dillon  * Copyright(c) 2007 - 2013 Intel Corporation. All rights reserved.
3324a8d46aSMatthew Dillon  *
3424a8d46aSMatthew Dillon  * This program is free software; you can redistribute it and/or modify
3524a8d46aSMatthew Dillon  * it under the terms of version 2 of the GNU General Public License as
3624a8d46aSMatthew Dillon  * published by the Free Software Foundation.
3724a8d46aSMatthew Dillon  *
3824a8d46aSMatthew Dillon  * This program is distributed in the hope that it will be useful, but
3924a8d46aSMatthew Dillon  * WITHOUT ANY WARRANTY; without even the implied warranty of
4024a8d46aSMatthew Dillon  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4124a8d46aSMatthew Dillon  * General Public License for more details.
4224a8d46aSMatthew Dillon  *
4324a8d46aSMatthew Dillon  * You should have received a copy of the GNU General Public License
4424a8d46aSMatthew Dillon  * along with this program; if not, write to the Free Software
4524a8d46aSMatthew Dillon  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
4624a8d46aSMatthew Dillon  * USA
4724a8d46aSMatthew Dillon  *
4824a8d46aSMatthew Dillon  * The full GNU General Public License is included in this distribution
4924a8d46aSMatthew Dillon  * in the file called COPYING.
5024a8d46aSMatthew Dillon  *
5124a8d46aSMatthew Dillon  * Contact Information:
5224a8d46aSMatthew Dillon  *  Intel Linux Wireless <ilw@linux.intel.com>
5324a8d46aSMatthew Dillon  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
5424a8d46aSMatthew Dillon  *
5524a8d46aSMatthew Dillon  *
5624a8d46aSMatthew Dillon  * BSD LICENSE
5724a8d46aSMatthew Dillon  *
5824a8d46aSMatthew Dillon  * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved.
5924a8d46aSMatthew Dillon  * All rights reserved.
6024a8d46aSMatthew Dillon  *
6124a8d46aSMatthew Dillon  * Redistribution and use in source and binary forms, with or without
6224a8d46aSMatthew Dillon  * modification, are permitted provided that the following conditions
6324a8d46aSMatthew Dillon  * are met:
6424a8d46aSMatthew Dillon  *
6524a8d46aSMatthew Dillon  *  * Redistributions of source code must retain the above copyright
6624a8d46aSMatthew Dillon  *    notice, this list of conditions and the following disclaimer.
6724a8d46aSMatthew Dillon  *  * Redistributions in binary form must reproduce the above copyright
6824a8d46aSMatthew Dillon  *    notice, this list of conditions and the following disclaimer in
6924a8d46aSMatthew Dillon  *    the documentation and/or other materials provided with the
7024a8d46aSMatthew Dillon  *    distribution.
7124a8d46aSMatthew Dillon  *  * Neither the name Intel Corporation nor the names of its
7224a8d46aSMatthew Dillon  *    contributors may be used to endorse or promote products derived
7324a8d46aSMatthew Dillon  *    from this software without specific prior written permission.
7424a8d46aSMatthew Dillon  *
7524a8d46aSMatthew Dillon  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
7624a8d46aSMatthew Dillon  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7724a8d46aSMatthew Dillon  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7824a8d46aSMatthew Dillon  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7924a8d46aSMatthew Dillon  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8024a8d46aSMatthew Dillon  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
8124a8d46aSMatthew Dillon  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
8224a8d46aSMatthew Dillon  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
8324a8d46aSMatthew Dillon  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
8424a8d46aSMatthew Dillon  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
8524a8d46aSMatthew Dillon  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8624a8d46aSMatthew Dillon  */
8724a8d46aSMatthew Dillon 
8824a8d46aSMatthew Dillon /*-
8924a8d46aSMatthew Dillon  * Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr>
9024a8d46aSMatthew Dillon  *
9124a8d46aSMatthew Dillon  * Permission to use, copy, modify, and distribute this software for any
9224a8d46aSMatthew Dillon  * purpose with or without fee is hereby granted, provided that the above
9324a8d46aSMatthew Dillon  * copyright notice and this permission notice appear in all copies.
9424a8d46aSMatthew Dillon  *
9524a8d46aSMatthew Dillon  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9624a8d46aSMatthew Dillon  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9724a8d46aSMatthew Dillon  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
9824a8d46aSMatthew Dillon  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
9924a8d46aSMatthew Dillon  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
10024a8d46aSMatthew Dillon  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
10124a8d46aSMatthew Dillon  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
10224a8d46aSMatthew Dillon  */
10324a8d46aSMatthew Dillon #ifndef	__IWM_PCIE_TRANS_H__
10424a8d46aSMatthew Dillon #define	__IWM_PCIE_TRANS_H__
10524a8d46aSMatthew Dillon 
10624a8d46aSMatthew Dillon extern	uint32_t iwm_read_prph(struct iwm_softc *sc, uint32_t addr);
10724a8d46aSMatthew Dillon extern	void iwm_write_prph(struct iwm_softc *sc, uint32_t addr, uint32_t val);
108*6acbba79SMatthew Dillon extern	void iwm_write_prph64(struct iwm_softc *sc, uint64_t addr,
109*6acbba79SMatthew Dillon     uint64_t val);
110*6acbba79SMatthew Dillon extern	int iwm_poll_prph(struct iwm_softc *sc, uint32_t addr, uint32_t bits,
111*6acbba79SMatthew Dillon     uint32_t mask, int timeout);
11224a8d46aSMatthew Dillon extern	int iwm_read_mem(struct iwm_softc *sc, uint32_t addr, void *buf, int dwords);
11324a8d46aSMatthew Dillon extern	int iwm_write_mem(struct iwm_softc *sc, uint32_t addr, const void *buf,
11424a8d46aSMatthew Dillon 		int dwords);
11524a8d46aSMatthew Dillon extern	int iwm_write_mem32(struct iwm_softc *sc, uint32_t addr, uint32_t val);
11624a8d46aSMatthew Dillon extern	int iwm_poll_bit(struct iwm_softc *sc, int reg,
11724a8d46aSMatthew Dillon 	uint32_t bits, uint32_t mask, int timo);
11824a8d46aSMatthew Dillon extern	int iwm_nic_lock(struct iwm_softc *sc);
11924a8d46aSMatthew Dillon extern	void iwm_nic_unlock(struct iwm_softc *sc);
12024a8d46aSMatthew Dillon extern	void iwm_set_bits_mask_prph(struct iwm_softc *sc,
12124a8d46aSMatthew Dillon 	uint32_t reg, uint32_t bits, uint32_t mask);
12224a8d46aSMatthew Dillon extern	void iwm_set_bits_prph(struct iwm_softc *sc, uint32_t reg, uint32_t bits);
12324a8d46aSMatthew Dillon extern	void iwm_clear_bits_prph(struct iwm_softc *sc, uint32_t reg, uint32_t bits);
12424a8d46aSMatthew Dillon extern	void iwm_enable_rfkill_int(struct iwm_softc *sc);
12524a8d46aSMatthew Dillon extern	int iwm_check_rfkill(struct iwm_softc *sc);
12624a8d46aSMatthew Dillon extern	int iwm_set_hw_ready(struct iwm_softc *sc);
12724a8d46aSMatthew Dillon extern	int iwm_prepare_card_hw(struct iwm_softc *sc);
12824a8d46aSMatthew Dillon extern	void iwm_apm_config(struct iwm_softc *sc);
12924a8d46aSMatthew Dillon extern	int iwm_apm_init(struct iwm_softc *sc);
13024a8d46aSMatthew Dillon extern	void iwm_apm_stop(struct iwm_softc *sc);
13124a8d46aSMatthew Dillon extern	int iwm_start_hw(struct iwm_softc *sc);
13224a8d46aSMatthew Dillon extern	void iwm_set_pwr(struct iwm_softc *sc);
13324a8d46aSMatthew Dillon extern	int iwm_pcie_rx_stop(struct iwm_softc *sc);
13424a8d46aSMatthew Dillon 
135ce43f57fSImre Vadász extern	int iwm_pcie_set_cmd_in_flight(struct iwm_softc *sc);
136ce43f57fSImre Vadász extern	void iwm_pcie_clear_cmd_in_flight(struct iwm_softc *sc);
137ce43f57fSImre Vadász 
13824a8d46aSMatthew Dillon #endif
139