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