xref: /titanic_50/usr/src/uts/common/sys/ddi_obsolete.h (revision 0e42dee69ed771bf604dd1789fca9d77b5bbe302)
1 /*
2  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 #ifndef	_SYS_DDI_OBSOLETE_H
7 #define	_SYS_DDI_OBSOLETE_H
8 
9 #pragma ident	"%Z%%M%	%I%	%E% SMI"
10 
11 /*
12  * Obsoleted DDI Interfaces
13  */
14 
15 #include <sys/types.h>
16 #include <sys/dditypes.h>
17 
18 
19 #ifdef	__cplusplus
20 extern "C" {
21 #endif
22 
23 
24 /*
25  * The following are intentionally outside of _DDI_STRICT, they are obsolete
26  * and shouldn't be used by drivers, but are still used in the consolidation.
27  * e.g. DDI implementation.
28  */
29 int ddi_iomin(dev_info_t *dip, int initial, int streaming);
30 
31 
32 #ifndef	_DDI_STRICT
33 
34 
35 int ddi_dma_setup(dev_info_t *dip, struct ddi_dma_req *dmareqp,
36     ddi_dma_handle_t *handlep);
37 int ddi_dma_addr_setup(dev_info_t *dip, struct as *as, caddr_t addr, size_t len,
38     uint_t flags, int (*waitfp)(), caddr_t arg, ddi_dma_lim_t *limits,
39     ddi_dma_handle_t *handlep);
40 int ddi_dma_buf_setup(dev_info_t *dip, struct buf *bp, uint_t flags,
41     int (*waitfp)(), caddr_t arg, ddi_dma_lim_t *limits,
42     ddi_dma_handle_t *handlep);
43 int ddi_dma_kvaddrp(ddi_dma_handle_t, off_t, size_t, caddr_t *);
44 int ddi_dma_htoc(ddi_dma_handle_t handle, off_t off, ddi_dma_cookie_t *cookiep);
45 int ddi_dma_coff(ddi_dma_handle_t handle, ddi_dma_cookie_t *cookiep,
46     off_t *offp);
47 int ddi_dma_curwin(ddi_dma_handle_t handle, off_t *offp, size_t *lenp);
48 int ddi_dma_nextwin(ddi_dma_handle_t, ddi_dma_win_t, ddi_dma_win_t *);
49 int ddi_dma_nextseg(ddi_dma_win_t, ddi_dma_seg_t, ddi_dma_seg_t *);
50 int ddi_dma_segtocookie(ddi_dma_seg_t, off_t *, off_t *, ddi_dma_cookie_t *);
51 int ddi_dma_free(ddi_dma_handle_t handle);
52 int ddi_iopb_alloc(dev_info_t *dip, ddi_dma_lim_t *limits, uint_t length,
53     caddr_t *iopbp);
54 void ddi_iopb_free(caddr_t iopb);
55 int ddi_mem_alloc(dev_info_t *dip, ddi_dma_lim_t *limits, uint_t length,
56     uint_t flags, caddr_t *kaddrp, uint_t *real_length);
57 void ddi_mem_free(caddr_t kaddr);
58 int ddi_dma_get_attr(ddi_dma_handle_t handle, ddi_dma_attr_t *attrp);
59 int ddi_dma_devalign(ddi_dma_handle_t handle, uint_t *alignment,
60     uint_t *mineffect);
61 void ddi_dmalim_merge(ddi_dma_lim_t *limit, ddi_dma_lim_t *modifier);
62 
63 #if defined(__sparc)
64 int ddi_dma_movwin(ddi_dma_handle_t, off_t *offp, size_t *lenp,
65     ddi_dma_cookie_t *);
66 #endif
67 
68 uint8_t ddi_mem_get8(ddi_acc_handle_t handle, uint8_t *host_addr);
69 uint16_t ddi_mem_get16(ddi_acc_handle_t handle, uint16_t *host_addr);
70 uint32_t ddi_mem_get32(ddi_acc_handle_t handle, uint32_t *host_addr);
71 uint64_t ddi_mem_get64(ddi_acc_handle_t handle, uint64_t *host_addr);
72 void ddi_mem_put8(ddi_acc_handle_t handle, uint8_t *dev_addr, uint8_t value);
73 void ddi_mem_put16(ddi_acc_handle_t handle, uint16_t *dev_addr, uint16_t value);
74 void ddi_mem_put32(ddi_acc_handle_t handle, uint32_t *dev_addr, uint32_t value);
75 void ddi_mem_put64(ddi_acc_handle_t handle, uint64_t *dev_addr, uint64_t value);
76 
77 void ddi_mem_rep_get8(ddi_acc_handle_t handle, uint8_t *host_addr,
78     uint8_t *dev_addr, size_t repcount, uint_t flags);
79 void ddi_mem_rep_get16(ddi_acc_handle_t handle, uint16_t *host_addr,
80     uint16_t *dev_addr, size_t repcount, uint_t flags);
81 void ddi_mem_rep_get32(ddi_acc_handle_t handle, uint32_t *host_addr,
82     uint32_t *dev_addr, size_t repcount, uint_t flags);
83 void ddi_mem_rep_get64(ddi_acc_handle_t handle, uint64_t *host_addr,
84     uint64_t *dev_addr, size_t repcount, uint_t flags);
85 void ddi_mem_rep_put8(ddi_acc_handle_t handle, uint8_t *host_addr,
86     uint8_t *dev_addr, size_t repcount, uint_t flags);
87 void ddi_mem_rep_put16(ddi_acc_handle_t handle, uint16_t *host_addr,
88     uint16_t *dev_addr, size_t repcount, uint_t flags);
89 void ddi_mem_rep_put32(ddi_acc_handle_t handle, uint32_t *host_addr,
90     uint32_t *dev_addr, size_t repcount, uint_t flags);
91 void ddi_mem_rep_put64(ddi_acc_handle_t handle, uint64_t *host_addr,
92     uint64_t *dev_addr, size_t repcount, uint_t flags);
93 
94 uint8_t ddi_io_get8(ddi_acc_handle_t handle, uint8_t *dev_addr);
95 uint16_t ddi_io_get16(ddi_acc_handle_t handle, uint16_t *dev_addr);
96 uint32_t ddi_io_get32(ddi_acc_handle_t handle, uint32_t *dev_addr);
97 void ddi_io_put8(ddi_acc_handle_t handle, uint8_t *dev_addr, uint8_t value);
98 void ddi_io_put16(ddi_acc_handle_t handle, uint16_t *dev_addr, uint16_t value);
99 void ddi_io_put32(ddi_acc_handle_t handle, uint32_t *dev_addr, uint32_t value);
100 
101 void ddi_io_rep_get8(ddi_acc_handle_t handle,
102     uint8_t *host_addr, uint8_t *dev_addr, size_t repcount);
103 void ddi_io_rep_get16(ddi_acc_handle_t handle,
104     uint16_t *host_addr, uint16_t *dev_addr, size_t repcount);
105 void ddi_io_rep_get32(ddi_acc_handle_t handle,
106     uint32_t *host_addr, uint32_t *dev_addr, size_t repcount);
107 void ddi_io_rep_put8(ddi_acc_handle_t handle,
108     uint8_t *host_addr, uint8_t *dev_addr, size_t repcount);
109 void ddi_io_rep_put16(ddi_acc_handle_t handle,
110     uint16_t *host_addr, uint16_t *dev_addr, size_t repcount);
111 void ddi_io_rep_put32(ddi_acc_handle_t handle,
112     uint32_t *host_addr, uint32_t *dev_addr, size_t repcount);
113 
114 /* only support older interfaces on 32-bit systems */
115 #ifdef _ILP32
116 #define	ddi_mem_getb		ddi_mem_get8
117 #define	ddi_mem_getw		ddi_mem_get16
118 #define	ddi_mem_getl		ddi_mem_get32
119 #define	ddi_mem_getll		ddi_mem_get64
120 #define	ddi_mem_rep_getb	ddi_mem_rep_get8
121 #define	ddi_mem_rep_getw	ddi_mem_rep_get16
122 #define	ddi_mem_rep_getl	ddi_mem_rep_get32
123 #define	ddi_mem_rep_getll	ddi_mem_rep_get64
124 #define	ddi_mem_putb		ddi_mem_put8
125 #define	ddi_mem_putw		ddi_mem_put16
126 #define	ddi_mem_putl		ddi_mem_put32
127 #define	ddi_mem_putll		ddi_mem_put64
128 #define	ddi_mem_rep_putb	ddi_mem_rep_put8
129 #define	ddi_mem_rep_putw	ddi_mem_rep_put16
130 #define	ddi_mem_rep_putl	ddi_mem_rep_put32
131 #define	ddi_mem_rep_putll	ddi_mem_rep_put64
132 #define	ddi_io_getb		ddi_io_get8
133 #define	ddi_io_getw		ddi_io_get16
134 #define	ddi_io_getl		ddi_io_get32
135 #define	ddi_io_putb		ddi_io_put8
136 #define	ddi_io_putw		ddi_io_put16
137 #define	ddi_io_putl		ddi_io_put32
138 #define	ddi_getb		ddi_get8
139 #define	ddi_getw		ddi_get16
140 #define	ddi_getl		ddi_get32
141 #define	ddi_getll		ddi_get64
142 #define	ddi_rep_getb		ddi_rep_get8
143 #define	ddi_rep_getw		ddi_rep_get16
144 #define	ddi_rep_getl		ddi_rep_get32
145 #define	ddi_rep_getll		ddi_rep_get64
146 #define	ddi_putb		ddi_put8
147 #define	ddi_putw		ddi_put16
148 #define	ddi_putl		ddi_put32
149 #define	ddi_putll		ddi_put64
150 #define	ddi_rep_putb		ddi_rep_put8
151 #define	ddi_rep_putw		ddi_rep_put16
152 #define	ddi_rep_putl		ddi_rep_put32
153 #define	ddi_rep_putll		ddi_rep_put64
154 
155 /* These can't be define's since they're not asm routines */
156 void ddi_io_rep_getb(ddi_acc_handle_t handle, uint8_t *host_addr,
157     uint8_t *dev_addr, size_t repcount);
158 void ddi_io_rep_getw(ddi_acc_handle_t handle, uint16_t *host_addr,
159     uint16_t *dev_addr, size_t repcount);
160 void ddi_io_rep_getl(ddi_acc_handle_t handle, uint32_t *host_addr,
161     uint32_t *dev_addr, size_t repcount);
162 void ddi_io_rep_putb(ddi_acc_handle_t handle, uint8_t *host_addr,
163     uint8_t *dev_addr, size_t repcount);
164 void ddi_io_rep_putw(ddi_acc_handle_t handle, uint16_t *host_addr,
165     uint16_t *dev_addr, size_t repcount);
166 void ddi_io_rep_putl(ddi_acc_handle_t handle, uint32_t *host_addr,
167     uint32_t *dev_addr, size_t repcount);
168 
169 int ddi_peekc(dev_info_t *dip, int8_t *addr, int8_t *val_p);
170 int ddi_peeks(dev_info_t *dip, int16_t *addr, int16_t *val_p);
171 int ddi_peekl(dev_info_t *dip, int32_t *addr, int32_t *val_p);
172 int ddi_peekd(dev_info_t *dip, int64_t *addr, int64_t *val_p);
173 int ddi_pokec(dev_info_t *dip, int8_t *addr, int8_t val);
174 int ddi_pokes(dev_info_t *dip, int16_t *addr, int16_t val);
175 int ddi_pokel(dev_info_t *dip, int32_t *addr, int32_t val);
176 int ddi_poked(dev_info_t *dip, int64_t *addr, int64_t val);
177 
178 uint8_t pci_config_getb(ddi_acc_handle_t handle, off_t offset);
179 uint16_t pci_config_getw(ddi_acc_handle_t handle, off_t offset);
180 uint32_t pci_config_getl(ddi_acc_handle_t handle, off_t offset);
181 uint64_t pci_config_getll(ddi_acc_handle_t handle, off_t offset);
182 void pci_config_putb(ddi_acc_handle_t handle, off_t offset, uint8_t value);
183 void pci_config_putw(ddi_acc_handle_t handle, off_t offset, uint16_t value);
184 void pci_config_putl(ddi_acc_handle_t handle, off_t offset, uint32_t value);
185 void pci_config_putll(ddi_acc_handle_t handle, off_t offset, uint64_t value);
186 
187 extern void repinsb(int port, uint8_t *addr, int count);
188 extern void repinsw(int port, uint16_t *addr, int count);
189 extern void repinsd(int port, uint32_t *addr, int count);
190 extern void repoutsb(int port, uint8_t *addr, int count);
191 extern void repoutsw(int port, uint16_t *addr, int count);
192 extern void repoutsd(int port, uint32_t *addr, int count);
193 #endif
194 
195 #endif /* not _DDI_STRICT */
196 
197 #ifdef	__cplusplus
198 }
199 #endif
200 
201 #endif	/* _SYS_DDI_OBSOLETE_H */
202