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