xref: /titanic_41/usr/src/uts/common/sys/ddi_obsolete.h (revision bd5222b6bd017872d8b0f84855a82a20fc5ce74d)
1 /*
2  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 /*
6  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
7  */
8 
9 #ifndef	_SYS_DDI_OBSOLETE_H
10 #define	_SYS_DDI_OBSOLETE_H
11 
12 /*
13  * Obsoleted DDI Interfaces
14  */
15 
16 #include <sys/types.h>
17 #include <sys/dditypes.h>
18 #include <sys/sunldi.h>
19 
20 
21 #ifdef	__cplusplus
22 extern "C" {
23 #endif
24 
25 
26 #ifndef	_DDI_STRICT
27 
28 extern long strtol(const char *, char **, int);
29 extern unsigned long strtoul(const char *, char **, int);
30 
31 uint8_t ddi_mem_get8(ddi_acc_handle_t handle, uint8_t *host_addr);
32 uint16_t ddi_mem_get16(ddi_acc_handle_t handle, uint16_t *host_addr);
33 uint32_t ddi_mem_get32(ddi_acc_handle_t handle, uint32_t *host_addr);
34 uint64_t ddi_mem_get64(ddi_acc_handle_t handle, uint64_t *host_addr);
35 void ddi_mem_put8(ddi_acc_handle_t handle, uint8_t *dev_addr, uint8_t value);
36 void ddi_mem_put16(ddi_acc_handle_t handle, uint16_t *dev_addr, uint16_t value);
37 void ddi_mem_put32(ddi_acc_handle_t handle, uint32_t *dev_addr, uint32_t value);
38 void ddi_mem_put64(ddi_acc_handle_t handle, uint64_t *dev_addr, uint64_t value);
39 
40 void ddi_mem_rep_get8(ddi_acc_handle_t handle, uint8_t *host_addr,
41     uint8_t *dev_addr, size_t repcount, uint_t flags);
42 void ddi_mem_rep_get16(ddi_acc_handle_t handle, uint16_t *host_addr,
43     uint16_t *dev_addr, size_t repcount, uint_t flags);
44 void ddi_mem_rep_get32(ddi_acc_handle_t handle, uint32_t *host_addr,
45     uint32_t *dev_addr, size_t repcount, uint_t flags);
46 void ddi_mem_rep_get64(ddi_acc_handle_t handle, uint64_t *host_addr,
47     uint64_t *dev_addr, size_t repcount, uint_t flags);
48 void ddi_mem_rep_put8(ddi_acc_handle_t handle, uint8_t *host_addr,
49     uint8_t *dev_addr, size_t repcount, uint_t flags);
50 void ddi_mem_rep_put16(ddi_acc_handle_t handle, uint16_t *host_addr,
51     uint16_t *dev_addr, size_t repcount, uint_t flags);
52 void ddi_mem_rep_put32(ddi_acc_handle_t handle, uint32_t *host_addr,
53     uint32_t *dev_addr, size_t repcount, uint_t flags);
54 void ddi_mem_rep_put64(ddi_acc_handle_t handle, uint64_t *host_addr,
55     uint64_t *dev_addr, size_t repcount, uint_t flags);
56 
57 uint8_t ddi_io_get8(ddi_acc_handle_t handle, uint8_t *dev_addr);
58 uint16_t ddi_io_get16(ddi_acc_handle_t handle, uint16_t *dev_addr);
59 uint32_t ddi_io_get32(ddi_acc_handle_t handle, uint32_t *dev_addr);
60 void ddi_io_put8(ddi_acc_handle_t handle, uint8_t *dev_addr, uint8_t value);
61 void ddi_io_put16(ddi_acc_handle_t handle, uint16_t *dev_addr, uint16_t value);
62 void ddi_io_put32(ddi_acc_handle_t handle, uint32_t *dev_addr, uint32_t value);
63 
64 void ddi_io_rep_get8(ddi_acc_handle_t handle,
65     uint8_t *host_addr, uint8_t *dev_addr, size_t repcount);
66 void ddi_io_rep_get16(ddi_acc_handle_t handle,
67     uint16_t *host_addr, uint16_t *dev_addr, size_t repcount);
68 void ddi_io_rep_get32(ddi_acc_handle_t handle,
69     uint32_t *host_addr, uint32_t *dev_addr, size_t repcount);
70 void ddi_io_rep_put8(ddi_acc_handle_t handle,
71     uint8_t *host_addr, uint8_t *dev_addr, size_t repcount);
72 void ddi_io_rep_put16(ddi_acc_handle_t handle,
73     uint16_t *host_addr, uint16_t *dev_addr, size_t repcount);
74 void ddi_io_rep_put32(ddi_acc_handle_t handle,
75     uint32_t *host_addr, uint32_t *dev_addr, size_t repcount);
76 
77 /* only support older interfaces on 32-bit systems */
78 #ifdef _ILP32
79 #define	ddi_mem_getb		ddi_mem_get8
80 #define	ddi_mem_getw		ddi_mem_get16
81 #define	ddi_mem_getl		ddi_mem_get32
82 #define	ddi_mem_getll		ddi_mem_get64
83 #define	ddi_mem_rep_getb	ddi_mem_rep_get8
84 #define	ddi_mem_rep_getw	ddi_mem_rep_get16
85 #define	ddi_mem_rep_getl	ddi_mem_rep_get32
86 #define	ddi_mem_rep_getll	ddi_mem_rep_get64
87 #define	ddi_mem_putb		ddi_mem_put8
88 #define	ddi_mem_putw		ddi_mem_put16
89 #define	ddi_mem_putl		ddi_mem_put32
90 #define	ddi_mem_putll		ddi_mem_put64
91 #define	ddi_mem_rep_putb	ddi_mem_rep_put8
92 #define	ddi_mem_rep_putw	ddi_mem_rep_put16
93 #define	ddi_mem_rep_putl	ddi_mem_rep_put32
94 #define	ddi_mem_rep_putll	ddi_mem_rep_put64
95 #define	ddi_io_getb		ddi_io_get8
96 #define	ddi_io_getw		ddi_io_get16
97 #define	ddi_io_getl		ddi_io_get32
98 #define	ddi_io_putb		ddi_io_put8
99 #define	ddi_io_putw		ddi_io_put16
100 #define	ddi_io_putl		ddi_io_put32
101 #define	ddi_getb		ddi_get8
102 #define	ddi_getw		ddi_get16
103 #define	ddi_getl		ddi_get32
104 #define	ddi_getll		ddi_get64
105 #define	ddi_rep_getb		ddi_rep_get8
106 #define	ddi_rep_getw		ddi_rep_get16
107 #define	ddi_rep_getl		ddi_rep_get32
108 #define	ddi_rep_getll		ddi_rep_get64
109 #define	ddi_putb		ddi_put8
110 #define	ddi_putw		ddi_put16
111 #define	ddi_putl		ddi_put32
112 #define	ddi_putll		ddi_put64
113 #define	ddi_rep_putb		ddi_rep_put8
114 #define	ddi_rep_putw		ddi_rep_put16
115 #define	ddi_rep_putl		ddi_rep_put32
116 #define	ddi_rep_putll		ddi_rep_put64
117 
118 /* These can't be define's since they're not asm routines */
119 void ddi_io_rep_getb(ddi_acc_handle_t handle, uint8_t *host_addr,
120     uint8_t *dev_addr, size_t repcount);
121 void ddi_io_rep_getw(ddi_acc_handle_t handle, uint16_t *host_addr,
122     uint16_t *dev_addr, size_t repcount);
123 void ddi_io_rep_getl(ddi_acc_handle_t handle, uint32_t *host_addr,
124     uint32_t *dev_addr, size_t repcount);
125 void ddi_io_rep_putb(ddi_acc_handle_t handle, uint8_t *host_addr,
126     uint8_t *dev_addr, size_t repcount);
127 void ddi_io_rep_putw(ddi_acc_handle_t handle, uint16_t *host_addr,
128     uint16_t *dev_addr, size_t repcount);
129 void ddi_io_rep_putl(ddi_acc_handle_t handle, uint32_t *host_addr,
130     uint32_t *dev_addr, size_t repcount);
131 
132 int ddi_peekc(dev_info_t *dip, int8_t *addr, int8_t *val_p);
133 int ddi_peeks(dev_info_t *dip, int16_t *addr, int16_t *val_p);
134 int ddi_peekl(dev_info_t *dip, int32_t *addr, int32_t *val_p);
135 int ddi_peekd(dev_info_t *dip, int64_t *addr, int64_t *val_p);
136 int ddi_pokec(dev_info_t *dip, int8_t *addr, int8_t val);
137 int ddi_pokes(dev_info_t *dip, int16_t *addr, int16_t val);
138 int ddi_pokel(dev_info_t *dip, int32_t *addr, int32_t val);
139 int ddi_poked(dev_info_t *dip, int64_t *addr, int64_t val);
140 
141 uint8_t pci_config_getb(ddi_acc_handle_t handle, off_t offset);
142 uint16_t pci_config_getw(ddi_acc_handle_t handle, off_t offset);
143 uint32_t pci_config_getl(ddi_acc_handle_t handle, off_t offset);
144 uint64_t pci_config_getll(ddi_acc_handle_t handle, off_t offset);
145 void pci_config_putb(ddi_acc_handle_t handle, off_t offset, uint8_t value);
146 void pci_config_putw(ddi_acc_handle_t handle, off_t offset, uint16_t value);
147 void pci_config_putl(ddi_acc_handle_t handle, off_t offset, uint32_t value);
148 void pci_config_putll(ddi_acc_handle_t handle, off_t offset, uint64_t value);
149 
150 extern void repinsb(int port, uint8_t *addr, int count);
151 extern void repinsw(int port, uint16_t *addr, int count);
152 extern void repinsd(int port, uint32_t *addr, int count);
153 extern void repoutsb(int port, uint8_t *addr, int count);
154 extern void repoutsw(int port, uint16_t *addr, int count);
155 extern void repoutsd(int port, uint32_t *addr, int count);
156 #endif
157 
158 /* Obsolete LDI event interfaces */
159 extern int ldi_get_eventcookie(ldi_handle_t, char *,
160     ddi_eventcookie_t *);
161 extern int ldi_add_event_handler(ldi_handle_t, ddi_eventcookie_t,
162     void (*handler)(ldi_handle_t, ddi_eventcookie_t, void *, void *),
163     void *, ldi_callback_id_t *);
164 extern int ldi_remove_event_handler(ldi_handle_t, ldi_callback_id_t);
165 
166 
167 #endif /* not _DDI_STRICT */
168 
169 #ifdef	__cplusplus
170 }
171 #endif
172 
173 #endif	/* _SYS_DDI_OBSOLETE_H */
174