xref: /titanic_41/usr/src/uts/sparc/sys/ddi_isa.h (revision d89fccd8788afe1e920f842edd883fe192a1b8fe)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_DDI_ISA_H
27 #define	_SYS_DDI_ISA_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <sys/isa_defs.h>
32 #include <sys/ndifm.h>
33 #include <sys/dditypes.h>
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 #ifdef	_KERNEL
40 
41 /*
42  * These are the data access functions which the platform
43  * can choose to define as functions or macro's.
44  */
45 
46 /*
47  * DDI interfaces defined as macro's
48  */
49 
50 /*
51  * DDI interfaces defined as functions
52  */
53 
54 /*
55  * The implementation specific ddi access handle is the same for
56  * all sparc v7 platforms.
57  */
58 
59 typedef struct ddi_acc_impl {
60 	ddi_acc_hdl_t	ahi_common;
61 	uint8_t
62 		(*ahi_get8)(struct ddi_acc_impl *handle, uint8_t *addr);
63 	uint16_t
64 		(*ahi_get16)(struct ddi_acc_impl *handle, uint16_t *addr);
65 	uint32_t
66 		(*ahi_get32)(struct ddi_acc_impl *handle, uint32_t *addr);
67 	uint64_t
68 		(*ahi_get64)(struct ddi_acc_impl *handle, uint64_t *addr);
69 	void	(*ahi_put8)(struct ddi_acc_impl *handle, uint8_t *addr,
70 			uint8_t value);
71 	void	(*ahi_put16)(struct ddi_acc_impl *handle, uint16_t *addr,
72 			uint16_t value);
73 	void	(*ahi_put32)(struct ddi_acc_impl *handle, uint32_t *addr,
74 			uint32_t value);
75 	void	(*ahi_put64)(struct ddi_acc_impl *handle, uint64_t *addr,
76 			uint64_t value);
77 
78 	void	(*ahi_rep_get8)(struct ddi_acc_impl *handle,
79 			uint8_t *host_addr, uint8_t *dev_addr,
80 			size_t repcount, uint_t flags);
81 	void	(*ahi_rep_get16)(struct ddi_acc_impl *handle,
82 			uint16_t *host_addr, uint16_t *dev_addr,
83 			size_t repcount, uint_t flags);
84 	void	(*ahi_rep_get32)(struct ddi_acc_impl *handle,
85 			uint32_t *host_addr, uint32_t *dev_addr,
86 			size_t repcount, uint_t flags);
87 	void	(*ahi_rep_get64)(struct ddi_acc_impl *handle,
88 			uint64_t *host_addr, uint64_t *dev_addr,
89 			size_t repcount, uint_t flags);
90 
91 	void	(*ahi_rep_put8)(struct ddi_acc_impl *handle,
92 			uint8_t *host_addr, uint8_t *dev_addr,
93 			size_t repcount, uint_t flags);
94 	void	(*ahi_rep_put16)(struct ddi_acc_impl *handle,
95 			uint16_t *host_addr, uint16_t *dev_addr,
96 			size_t repcount, uint_t flags);
97 	void	(*ahi_rep_put32)(struct ddi_acc_impl *handle,
98 			uint32_t *host_addr, uint32_t *dev_addr,
99 			size_t repcount, uint_t flags);
100 	void	(*ahi_rep_put64)(struct ddi_acc_impl *handle,
101 			uint64_t *host_addr, uint64_t *dev_addr,
102 			size_t repcount, uint_t flags);
103 
104 	int	(*ahi_fault_check)(struct ddi_acc_impl *handle);
105 	void	(*ahi_fault_notify)(struct ddi_acc_impl *handle);
106 	uint32_t	ahi_fault;
107 	ndi_err_t *ahi_err;	/* Access error data */
108 } ddi_acc_impl_t;
109 
110 /*
111  * Input functions to memory mapped IO
112  */
113 uint8_t
114 i_ddi_get8(ddi_acc_impl_t *hdlp, uint8_t *addr);
115 
116 uint16_t
117 i_ddi_get16(ddi_acc_impl_t *hdlp, uint16_t *addr);
118 
119 uint32_t
120 i_ddi_get32(ddi_acc_impl_t *hdlp, uint32_t *addr);
121 
122 uint64_t
123 i_ddi_get64(ddi_acc_impl_t *hdlp, uint64_t *addr);
124 
125 uint16_t
126 i_ddi_swap_get16(ddi_acc_impl_t *hdlp, uint16_t *addr);
127 
128 uint32_t
129 i_ddi_swap_get32(ddi_acc_impl_t *hdlp, uint32_t *addr);
130 
131 uint64_t
132 i_ddi_swap_get64(ddi_acc_impl_t *hdlp, uint64_t *addr);
133 
134 /*
135  * Output functions to memory mapped IO
136  */
137 void
138 i_ddi_put8(ddi_acc_impl_t *hdlp, uint8_t *addr, uint8_t value);
139 
140 void
141 i_ddi_put16(ddi_acc_impl_t *hdlp, uint16_t *addr, uint16_t value);
142 
143 void
144 i_ddi_put32(ddi_acc_impl_t *hdlp, uint32_t *addr, uint32_t value);
145 
146 void
147 i_ddi_put64(ddi_acc_impl_t *hdlp, uint64_t *addr, uint64_t value);
148 
149 void
150 i_ddi_swap_put16(ddi_acc_impl_t *hdlp, uint16_t *addr, uint16_t value);
151 
152 void
153 i_ddi_swap_put32(ddi_acc_impl_t *hdlp, uint32_t *addr, uint32_t value);
154 
155 void
156 i_ddi_swap_put64(ddi_acc_impl_t *hdlp, uint64_t *addr, uint64_t value);
157 
158 /*
159  * Repeated input functions for memory mapped IO
160  */
161 void
162 i_ddi_rep_get8(ddi_acc_impl_t *hdlp, uint8_t *host_addr, uint8_t *dev_addr,
163 	size_t repcount, uint_t flags);
164 
165 void
166 i_ddi_rep_get16(ddi_acc_impl_t *hdlp, uint16_t *host_addr, uint16_t *dev_addr,
167 	size_t repcount, uint_t flags);
168 
169 void
170 i_ddi_rep_get32(ddi_acc_impl_t *hdlp, uint32_t *host_addr, uint32_t *dev_addr,
171 	size_t repcount, uint_t flags);
172 
173 void
174 i_ddi_rep_get64(ddi_acc_impl_t *hdlp, uint64_t *host_addr, uint64_t *dev_addr,
175 	size_t repcount, uint_t flags);
176 
177 void
178 i_ddi_swap_rep_get16(ddi_acc_impl_t *hdlp, uint16_t *host_addr,
179 	uint16_t *dev_addr, size_t repcount, uint_t flags);
180 
181 void
182 i_ddi_swap_rep_get32(ddi_acc_impl_t *hdlp, uint32_t *host_addr,
183 	uint32_t *dev_addr, size_t repcount, uint_t flags);
184 
185 void
186 i_ddi_swap_rep_get64(ddi_acc_impl_t *hdlp, uint64_t *host_addr,
187 	uint64_t *dev_addr, size_t repcount, uint_t flags);
188 
189 /*
190  * Repeated output functions for memory mapped IO
191  */
192 void
193 i_ddi_rep_put8(ddi_acc_impl_t *hdlp, uint8_t *host_addr, uint8_t *dev_addr,
194 	size_t repcount, uint_t flags);
195 
196 void
197 i_ddi_rep_put16(ddi_acc_impl_t *hdlp, uint16_t *host_addr, uint16_t *dev_addr,
198 	size_t repcount, uint_t flags);
199 
200 void
201 i_ddi_rep_put32(ddi_acc_impl_t *hdl, uint32_t *host_addr, uint32_t *dev_addr,
202 	size_t repcount, uint_t flags);
203 
204 void
205 i_ddi_rep_put64(ddi_acc_impl_t *hdl, uint64_t *host_addr, uint64_t *dev_addr,
206 	size_t repcount, uint_t flags);
207 
208 void
209 i_ddi_swap_rep_put16(ddi_acc_impl_t *hdlp, uint16_t *host_addr,
210 	uint16_t *dev_addr, size_t repcount, uint_t flags);
211 
212 void
213 i_ddi_swap_rep_put32(ddi_acc_impl_t *hdl, uint32_t *host_addr,
214 	uint32_t *dev_addr, size_t repcount, uint_t flags);
215 
216 void
217 i_ddi_swap_rep_put64(ddi_acc_impl_t *hdl, uint64_t *host_addr,
218 	uint64_t *dev_addr, size_t repcount, uint_t flags);
219 
220 /*
221  * Default fault-checking and notification functions
222  */
223 int
224 i_ddi_acc_fault_check(ddi_acc_impl_t *hdlp);
225 
226 void
227 i_ddi_acc_fault_notify(ddi_acc_impl_t *hdlp);
228 
229 /* DDI Fault Services functions */
230 
231 void i_ddi_caut_get(size_t size, void *addr, void *val);
232 
233 uint8_t i_ddi_prot_get8(ddi_acc_impl_t *hdlp, uint8_t *addr);
234 uint16_t i_ddi_prot_get16(ddi_acc_impl_t *hdlp, uint16_t *addr);
235 uint32_t i_ddi_prot_get32(ddi_acc_impl_t *hdlp, uint32_t *addr);
236 uint64_t i_ddi_prot_get64(ddi_acc_impl_t *hdlp, uint64_t *addr);
237 
238 void i_ddi_prot_put8(ddi_acc_impl_t *hdlp, uint8_t *addr, uint8_t value);
239 void i_ddi_prot_put16(ddi_acc_impl_t *hdlp, uint16_t *addr, uint16_t value);
240 void i_ddi_prot_put32(ddi_acc_impl_t *hdlp, uint32_t *addr, uint32_t value);
241 void i_ddi_prot_put64(ddi_acc_impl_t *hdlp, uint64_t *addr, uint64_t value);
242 
243 void i_ddi_prot_rep_get8(ddi_acc_impl_t *hdlp, uint8_t *host_addr,
244     uint8_t *dev_addr, size_t repcount, uint_t flags);
245 void i_ddi_prot_rep_get16(ddi_acc_impl_t *hdlp, uint16_t *host_addr,
246     uint16_t *dev_addr, size_t repcount, uint_t flags);
247 void i_ddi_prot_rep_get32(ddi_acc_impl_t *hdlp, uint32_t *host_addr,
248     uint32_t *dev_addr, size_t repcount, uint_t flags);
249 void i_ddi_prot_rep_get64(ddi_acc_impl_t *hdlp, uint64_t *host_addr,
250     uint64_t *dev_addr, size_t repcount, uint_t flags);
251 
252 void i_ddi_prot_rep_put8(ddi_acc_impl_t *hdlp, uint8_t *host_addr,
253     uint8_t *dev_addr, size_t repcount, uint_t flags);
254 void i_ddi_prot_rep_put16(ddi_acc_impl_t *hdlp, uint16_t *host_addr,
255     uint16_t *dev_addr, size_t repcount, uint_t flags);
256 void i_ddi_prot_rep_put32(ddi_acc_impl_t *hdl, uint32_t *host_addr,
257     uint32_t *dev_addr, size_t repcount, uint_t flags);
258 void i_ddi_prot_rep_put64(ddi_acc_impl_t *hdl, uint64_t *host_addr,
259     uint64_t *dev_addr, size_t repcount, uint_t flags);
260 
261 uint8_t i_ddi_caut_get8(ddi_acc_impl_t *hdlp, uint8_t *addr);
262 uint16_t i_ddi_caut_get16(ddi_acc_impl_t *hdlp, uint16_t *addr);
263 uint32_t i_ddi_caut_get32(ddi_acc_impl_t *hdlp, uint32_t *addr);
264 uint64_t i_ddi_caut_get64(ddi_acc_impl_t *hdlp, uint64_t *addr);
265 
266 void i_ddi_caut_put8(ddi_acc_impl_t *hdlp, uint8_t *addr, uint8_t value);
267 void i_ddi_caut_put16(ddi_acc_impl_t *hdlp, uint16_t *addr, uint16_t value);
268 void i_ddi_caut_put32(ddi_acc_impl_t *hdlp, uint32_t *addr, uint32_t value);
269 void i_ddi_caut_put64(ddi_acc_impl_t *hdlp, uint64_t *addr, uint64_t value);
270 
271 void i_ddi_caut_rep_get8(ddi_acc_impl_t *hdlp, uint8_t *host_addr,
272     uint8_t *dev_addr, size_t repcount, uint_t flags);
273 void i_ddi_caut_rep_get16(ddi_acc_impl_t *hdlp, uint16_t *host_addr,
274     uint16_t *dev_addr, size_t repcount, uint_t flags);
275 void i_ddi_caut_rep_get32(ddi_acc_impl_t *hdlp, uint32_t *host_addr,
276     uint32_t *dev_addr, size_t repcount, uint_t flags);
277 void i_ddi_caut_rep_get64(ddi_acc_impl_t *hdlp, uint64_t *host_addr,
278     uint64_t *dev_addr, size_t repcount, uint_t flags);
279 
280 void i_ddi_caut_rep_put8(ddi_acc_impl_t *hdlp, uint8_t *host_addr,
281     uint8_t *dev_addr, size_t repcount, uint_t flags);
282 void i_ddi_caut_rep_put16(ddi_acc_impl_t *hdlp, uint16_t *host_addr,
283     uint16_t *dev_addr, size_t repcount, uint_t flags);
284 void i_ddi_caut_rep_put32(ddi_acc_impl_t *hdl, uint32_t *host_addr,
285     uint32_t *dev_addr, size_t repcount, uint_t flags);
286 void i_ddi_caut_rep_put64(ddi_acc_impl_t *hdl, uint64_t *host_addr,
287     uint64_t *dev_addr, size_t repcount, uint_t flags);
288 
289 #endif	/* _KERNEL */
290 
291 #ifdef	__cplusplus
292 }
293 #endif
294 
295 #endif	/* _SYS_DDI_ISA_H */
296