1 /* 2 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 3 * Use is subject to license terms. 4 */ 5 /* 6 * Copyright 2012 Garrett D'Amore <garrett@damore.org>. All rights reserved. 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 /* 27 * The following are intentionally outside of _DDI_STRICT, they are obsolete 28 * and shouldn't be used by drivers, but are still used in the consolidation. 29 * e.g. DDI implementation. 30 */ 31 int ddi_iomin(dev_info_t *dip, int initial, int streaming); 32 33 34 #ifndef _DDI_STRICT 35 36 extern long strtol(const char *, char **, int); 37 extern unsigned long strtoul(const char *, char **, int); 38 39 /* we'd really like to remove this; unbundled nexus drivers might have it */ 40 int ddi_dma_map(dev_info_t *dip, dev_info_t *rdip, 41 struct ddi_dma_req *dmareqp, ddi_dma_handle_t *handlep); 42 43 uint8_t ddi_mem_get8(ddi_acc_handle_t handle, uint8_t *host_addr); 44 uint16_t ddi_mem_get16(ddi_acc_handle_t handle, uint16_t *host_addr); 45 uint32_t ddi_mem_get32(ddi_acc_handle_t handle, uint32_t *host_addr); 46 uint64_t ddi_mem_get64(ddi_acc_handle_t handle, uint64_t *host_addr); 47 void ddi_mem_put8(ddi_acc_handle_t handle, uint8_t *dev_addr, uint8_t value); 48 void ddi_mem_put16(ddi_acc_handle_t handle, uint16_t *dev_addr, uint16_t value); 49 void ddi_mem_put32(ddi_acc_handle_t handle, uint32_t *dev_addr, uint32_t value); 50 void ddi_mem_put64(ddi_acc_handle_t handle, uint64_t *dev_addr, uint64_t value); 51 52 void ddi_mem_rep_get8(ddi_acc_handle_t handle, uint8_t *host_addr, 53 uint8_t *dev_addr, size_t repcount, uint_t flags); 54 void ddi_mem_rep_get16(ddi_acc_handle_t handle, uint16_t *host_addr, 55 uint16_t *dev_addr, size_t repcount, uint_t flags); 56 void ddi_mem_rep_get32(ddi_acc_handle_t handle, uint32_t *host_addr, 57 uint32_t *dev_addr, size_t repcount, uint_t flags); 58 void ddi_mem_rep_get64(ddi_acc_handle_t handle, uint64_t *host_addr, 59 uint64_t *dev_addr, size_t repcount, uint_t flags); 60 void ddi_mem_rep_put8(ddi_acc_handle_t handle, uint8_t *host_addr, 61 uint8_t *dev_addr, size_t repcount, uint_t flags); 62 void ddi_mem_rep_put16(ddi_acc_handle_t handle, uint16_t *host_addr, 63 uint16_t *dev_addr, size_t repcount, uint_t flags); 64 void ddi_mem_rep_put32(ddi_acc_handle_t handle, uint32_t *host_addr, 65 uint32_t *dev_addr, size_t repcount, uint_t flags); 66 void ddi_mem_rep_put64(ddi_acc_handle_t handle, uint64_t *host_addr, 67 uint64_t *dev_addr, size_t repcount, uint_t flags); 68 69 uint8_t ddi_io_get8(ddi_acc_handle_t handle, uint8_t *dev_addr); 70 uint16_t ddi_io_get16(ddi_acc_handle_t handle, uint16_t *dev_addr); 71 uint32_t ddi_io_get32(ddi_acc_handle_t handle, uint32_t *dev_addr); 72 void ddi_io_put8(ddi_acc_handle_t handle, uint8_t *dev_addr, uint8_t value); 73 void ddi_io_put16(ddi_acc_handle_t handle, uint16_t *dev_addr, uint16_t value); 74 void ddi_io_put32(ddi_acc_handle_t handle, uint32_t *dev_addr, uint32_t value); 75 76 void ddi_io_rep_get8(ddi_acc_handle_t handle, 77 uint8_t *host_addr, uint8_t *dev_addr, size_t repcount); 78 void ddi_io_rep_get16(ddi_acc_handle_t handle, 79 uint16_t *host_addr, uint16_t *dev_addr, size_t repcount); 80 void ddi_io_rep_get32(ddi_acc_handle_t handle, 81 uint32_t *host_addr, uint32_t *dev_addr, size_t repcount); 82 void ddi_io_rep_put8(ddi_acc_handle_t handle, 83 uint8_t *host_addr, uint8_t *dev_addr, size_t repcount); 84 void ddi_io_rep_put16(ddi_acc_handle_t handle, 85 uint16_t *host_addr, uint16_t *dev_addr, size_t repcount); 86 void ddi_io_rep_put32(ddi_acc_handle_t handle, 87 uint32_t *host_addr, uint32_t *dev_addr, size_t repcount); 88 89 /* only support older interfaces on 32-bit systems */ 90 #ifdef _ILP32 91 #define ddi_mem_getb ddi_mem_get8 92 #define ddi_mem_getw ddi_mem_get16 93 #define ddi_mem_getl ddi_mem_get32 94 #define ddi_mem_getll ddi_mem_get64 95 #define ddi_mem_rep_getb ddi_mem_rep_get8 96 #define ddi_mem_rep_getw ddi_mem_rep_get16 97 #define ddi_mem_rep_getl ddi_mem_rep_get32 98 #define ddi_mem_rep_getll ddi_mem_rep_get64 99 #define ddi_mem_putb ddi_mem_put8 100 #define ddi_mem_putw ddi_mem_put16 101 #define ddi_mem_putl ddi_mem_put32 102 #define ddi_mem_putll ddi_mem_put64 103 #define ddi_mem_rep_putb ddi_mem_rep_put8 104 #define ddi_mem_rep_putw ddi_mem_rep_put16 105 #define ddi_mem_rep_putl ddi_mem_rep_put32 106 #define ddi_mem_rep_putll ddi_mem_rep_put64 107 #define ddi_io_getb ddi_io_get8 108 #define ddi_io_getw ddi_io_get16 109 #define ddi_io_getl ddi_io_get32 110 #define ddi_io_putb ddi_io_put8 111 #define ddi_io_putw ddi_io_put16 112 #define ddi_io_putl ddi_io_put32 113 #define ddi_getb ddi_get8 114 #define ddi_getw ddi_get16 115 #define ddi_getl ddi_get32 116 #define ddi_getll ddi_get64 117 #define ddi_rep_getb ddi_rep_get8 118 #define ddi_rep_getw ddi_rep_get16 119 #define ddi_rep_getl ddi_rep_get32 120 #define ddi_rep_getll ddi_rep_get64 121 #define ddi_putb ddi_put8 122 #define ddi_putw ddi_put16 123 #define ddi_putl ddi_put32 124 #define ddi_putll ddi_put64 125 #define ddi_rep_putb ddi_rep_put8 126 #define ddi_rep_putw ddi_rep_put16 127 #define ddi_rep_putl ddi_rep_put32 128 #define ddi_rep_putll ddi_rep_put64 129 130 /* These can't be define's since they're not asm routines */ 131 void ddi_io_rep_getb(ddi_acc_handle_t handle, uint8_t *host_addr, 132 uint8_t *dev_addr, size_t repcount); 133 void ddi_io_rep_getw(ddi_acc_handle_t handle, uint16_t *host_addr, 134 uint16_t *dev_addr, size_t repcount); 135 void ddi_io_rep_getl(ddi_acc_handle_t handle, uint32_t *host_addr, 136 uint32_t *dev_addr, size_t repcount); 137 void ddi_io_rep_putb(ddi_acc_handle_t handle, uint8_t *host_addr, 138 uint8_t *dev_addr, size_t repcount); 139 void ddi_io_rep_putw(ddi_acc_handle_t handle, uint16_t *host_addr, 140 uint16_t *dev_addr, size_t repcount); 141 void ddi_io_rep_putl(ddi_acc_handle_t handle, uint32_t *host_addr, 142 uint32_t *dev_addr, size_t repcount); 143 144 int ddi_peekc(dev_info_t *dip, int8_t *addr, int8_t *val_p); 145 int ddi_peeks(dev_info_t *dip, int16_t *addr, int16_t *val_p); 146 int ddi_peekl(dev_info_t *dip, int32_t *addr, int32_t *val_p); 147 int ddi_peekd(dev_info_t *dip, int64_t *addr, int64_t *val_p); 148 int ddi_pokec(dev_info_t *dip, int8_t *addr, int8_t val); 149 int ddi_pokes(dev_info_t *dip, int16_t *addr, int16_t val); 150 int ddi_pokel(dev_info_t *dip, int32_t *addr, int32_t val); 151 int ddi_poked(dev_info_t *dip, int64_t *addr, int64_t val); 152 153 uint8_t pci_config_getb(ddi_acc_handle_t handle, off_t offset); 154 uint16_t pci_config_getw(ddi_acc_handle_t handle, off_t offset); 155 uint32_t pci_config_getl(ddi_acc_handle_t handle, off_t offset); 156 uint64_t pci_config_getll(ddi_acc_handle_t handle, off_t offset); 157 void pci_config_putb(ddi_acc_handle_t handle, off_t offset, uint8_t value); 158 void pci_config_putw(ddi_acc_handle_t handle, off_t offset, uint16_t value); 159 void pci_config_putl(ddi_acc_handle_t handle, off_t offset, uint32_t value); 160 void pci_config_putll(ddi_acc_handle_t handle, off_t offset, uint64_t value); 161 162 extern void repinsb(int port, uint8_t *addr, int count); 163 extern void repinsw(int port, uint16_t *addr, int count); 164 extern void repinsd(int port, uint32_t *addr, int count); 165 extern void repoutsb(int port, uint8_t *addr, int count); 166 extern void repoutsw(int port, uint16_t *addr, int count); 167 extern void repoutsd(int port, uint32_t *addr, int count); 168 #endif 169 170 /* Obsolete LDI event interfaces */ 171 extern int ldi_get_eventcookie(ldi_handle_t, char *, 172 ddi_eventcookie_t *); 173 extern int ldi_add_event_handler(ldi_handle_t, ddi_eventcookie_t, 174 void (*handler)(ldi_handle_t, ddi_eventcookie_t, void *, void *), 175 void *, ldi_callback_id_t *); 176 extern int ldi_remove_event_handler(ldi_handle_t, ldi_callback_id_t); 177 178 179 #endif /* not _DDI_STRICT */ 180 181 #ifdef __cplusplus 182 } 183 #endif 184 185 #endif /* _SYS_DDI_OBSOLETE_H */