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