1 /* $OpenBSD: aic79xx_inline.h,v 1.5 2022/01/09 05:42:38 jsg Exp $ */
2
3 /*
4 * Copyright (c) 2004 Milos Urbanek, Kenneth R. Westerback & Marco Peereboom
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 */
29
30 /*
31 * Inline routines shareable across OS platforms.
32 *
33 * Copyright (c) 1994-2001 Justin T. Gibbs.
34 * Copyright (c) 2000-2003 Adaptec Inc.
35 * All rights reserved.
36 *
37 * Redistribution and use in source and binary forms, with or without
38 * modification, are permitted provided that the following conditions
39 * are met:
40 * 1. Redistributions of source code must retain the above copyright
41 * notice, this list of conditions, and the following disclaimer,
42 * without modification.
43 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
44 * substantially similar to the "NO WARRANTY" disclaimer below
45 * ("Disclaimer") and any redistribution must be conditioned upon
46 * including a substantially similar Disclaimer requirement for further
47 * binary redistribution.
48 * 3. Neither the names of the above-listed copyright holders nor the names
49 * of any contributors may be used to endorse or promote products derived
50 * from this software without specific prior written permission.
51 *
52 * Alternatively, this software may be distributed under the terms of the
53 * GNU General Public License ("GPL") version 2 as published by the Free
54 * Software Foundation.
55 *
56 * NO WARRANTY
57 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
58 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
59 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
60 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
61 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
62 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
63 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
64 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
65 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
66 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
67 * POSSIBILITY OF SUCH DAMAGES.
68 *
69 * $FreeBSD: src/sys/dev/aic7xxx/aic79xx_inline.h,v 1.14 2004/02/04 16:38:38 gibbs Exp $
70 *
71 */
72
73 #ifndef _AIC79XX_INLINE_H_
74 #define _AIC79XX_INLINE_H_
75
76 /******************************** Debugging ***********************************/
77 char *ahd_name(struct ahd_softc *ahd);
78
79 /************************ Sequencer Execution Control *************************/
80 void ahd_known_modes(struct ahd_softc *, ahd_mode, ahd_mode);
81 ahd_mode_state ahd_build_mode_state(struct ahd_softc *,
82 ahd_mode , ahd_mode );
83 void ahd_extract_mode_state(struct ahd_softc *, ahd_mode_state,
84 ahd_mode *, ahd_mode *);
85 void ahd_set_modes(struct ahd_softc *, ahd_mode, ahd_mode );
86 void ahd_update_modes(struct ahd_softc *);
87 void ahd_assert_modes(struct ahd_softc *, ahd_mode,
88 ahd_mode, const char *, int);
89 ahd_mode_state ahd_save_modes(struct ahd_softc *);
90 void ahd_restore_modes(struct ahd_softc *, ahd_mode_state);
91 int ahd_is_paused(struct ahd_softc *);
92 void ahd_pause(struct ahd_softc *);
93
94 void ahd_unpause(struct ahd_softc *);
95
96 /*********************** Scatter Gather List Handling *************************/
97 void *ahd_sg_setup(struct ahd_softc *ahd, struct scb *scb,
98 void *sgptr, bus_addr_t addr,
99 bus_size_t len, int last);
100 void ahd_setup_scb_common(struct ahd_softc *ahd,
101 struct scb *scb);
102 void ahd_setup_data_scb(struct ahd_softc *ahd,
103 struct scb *scb);
104 void ahd_setup_noxfer_scb(struct ahd_softc *ahd,
105 struct scb *scb);
106
107 /************************** Memory mapping routines ***************************/
108 size_t ahd_sg_size(struct ahd_softc *);
109 void *
110 ahd_sg_bus_to_virt(struct ahd_softc *, struct scb *,
111 uint32_t);
112 uint32_t
113 ahd_sg_virt_to_bus(struct ahd_softc *, struct scb *,
114 void *);
115 void ahd_sync_scb(struct ahd_softc *, struct scb *, int);
116 void ahd_sync_sglist(struct ahd_softc *, struct scb *, int);
117 void ahd_sync_sense(struct ahd_softc *, struct scb *, int);
118 uint32_t
119 ahd_targetcmd_offset(struct ahd_softc *, u_int);
120
121 /*********************** Miscellaneous Support Functions **********************/
122 void ahd_complete_scb(struct ahd_softc *, struct scb *);
123 void ahd_update_residual(struct ahd_softc *, struct scb *);
124 struct ahd_initiator_tinfo *
125 ahd_fetch_transinfo(struct ahd_softc *, char , u_int,
126 u_int, struct ahd_tmode_tstate **);
127 uint16_t
128 ahd_inw(struct ahd_softc *, u_int);
129 void ahd_outw(struct ahd_softc *, u_int, u_int);
130 uint32_t
131 ahd_inl(struct ahd_softc *, u_int);
132 void ahd_outl(struct ahd_softc *, u_int, uint32_t);
133 uint64_t ahd_inq(struct ahd_softc *, u_int);
134 void ahd_outq(struct ahd_softc *, u_int, uint64_t);
135 u_int ahd_get_scbptr(struct ahd_softc *ahd);
136 void ahd_set_scbptr(struct ahd_softc *ahd, u_int scbptr);
137 u_int ahd_get_hnscb_qoff(struct ahd_softc *ahd);
138 void ahd_set_hnscb_qoff(struct ahd_softc *ahd, u_int value);
139 u_int ahd_get_hescb_qoff(struct ahd_softc *ahd);
140 void ahd_set_hescb_qoff(struct ahd_softc *ahd, u_int value);
141 u_int ahd_get_snscb_qoff(struct ahd_softc *ahd);
142 void ahd_set_snscb_qoff(struct ahd_softc *ahd, u_int value);
143 u_int ahd_get_sescb_qoff(struct ahd_softc *ahd);
144 void ahd_set_sescb_qoff(struct ahd_softc *ahd, u_int value);
145 u_int ahd_get_sdscb_qoff(struct ahd_softc *ahd);
146 void ahd_set_sdscb_qoff(struct ahd_softc *ahd, u_int value);
147 u_int ahd_inb_scbram(struct ahd_softc *ahd, u_int offset);
148 u_int ahd_inw_scbram(struct ahd_softc *ahd, u_int offset);
149 uint32_t ahd_inl_scbram(struct ahd_softc *ahd, u_int offset);
150 uint64_t ahd_inq_scbram(struct ahd_softc *ahd, u_int offset);
151 struct scb *ahd_lookup_scb(struct ahd_softc *, u_int);
152 void ahd_swap_with_next_hscb(struct ahd_softc *ahd, struct scb *scb);
153 void ahd_queue_scb(struct ahd_softc *ahd, struct scb *scb);
154 uint8_t *ahd_get_sense_buf(struct ahd_softc *ahd, struct scb *scb);
155 uint32_t ahd_get_sense_bufaddr(struct ahd_softc *ahd, struct scb *scb);
156
157 /************************** Interrupt Processing ******************************/
158 void ahd_sync_qoutfifo(struct ahd_softc *ahd, int op);
159 void ahd_sync_tqinfifo(struct ahd_softc *ahd, int op);
160 u_int ahd_check_cmdcmpltqueues(struct ahd_softc *ahd);
161 int ahd_intr(struct ahd_softc *ahd);
162
163 #define AHD_ASSERT_MODES(ahd, source, dest) \
164 ahd_assert_modes(ahd, source, dest, __FILE__, __LINE__);
165
166 #endif /* _AIC79XX_INLINE_H_ */
Cache object: c8508fc230aab39ede174bb36018c1e1
|