17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 237c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _SYS_DDITYPES_H 287c478bd9Sstevel@tonic-gate #define _SYS_DDITYPES_H 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #include <sys/isa_defs.h> 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #ifdef __cplusplus 357c478bd9Sstevel@tonic-gate extern "C" { 367c478bd9Sstevel@tonic-gate #endif 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate #ifndef _ASM 397c478bd9Sstevel@tonic-gate /* 407c478bd9Sstevel@tonic-gate * DMA types 417c478bd9Sstevel@tonic-gate * 427c478bd9Sstevel@tonic-gate * A DMA handle represent a "DMA object". A DMA object is an abstraction 437c478bd9Sstevel@tonic-gate * that represents the potential source or destination of DMA transfers to 447c478bd9Sstevel@tonic-gate * or from a device. The DMA object is the highest level description of 457c478bd9Sstevel@tonic-gate * the source or destination and is not suitable for the actual transfer. 467c478bd9Sstevel@tonic-gate * 477c478bd9Sstevel@tonic-gate * Note, that we avoid the specific references to "mapping". The fact that 487c478bd9Sstevel@tonic-gate * a transfer requires mapping is an artifact of the specific architectural 497c478bd9Sstevel@tonic-gate * implementation. 507c478bd9Sstevel@tonic-gate */ 517c478bd9Sstevel@tonic-gate typedef struct __ddi_dma_handle *ddi_dma_handle_t; 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate /* 547c478bd9Sstevel@tonic-gate * A dma window type represents a "DMA window". A DMA window is a portion 557c478bd9Sstevel@tonic-gate * of a dma object or might be the entire object. A DMA window has had system 567c478bd9Sstevel@tonic-gate * resources allocated to it and is prepared to be transferred into or 577c478bd9Sstevel@tonic-gate * out of. Examples of system resources are DVMA mapping resources and 587c478bd9Sstevel@tonic-gate * intermediate transfer buffer resources. 597c478bd9Sstevel@tonic-gate * 607c478bd9Sstevel@tonic-gate */ 617c478bd9Sstevel@tonic-gate typedef struct __ddi_dma_win *ddi_dma_win_t; 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate /* 657c478bd9Sstevel@tonic-gate * A dma segment type represents a "DMA segment". A dma segment is a 667c478bd9Sstevel@tonic-gate * contiguous portion of a DMA window which is entirely addressable by the 677c478bd9Sstevel@tonic-gate * device for a transfer operation. One example where DMA segments are 687c478bd9Sstevel@tonic-gate * required is where the system does not contain DVMA capability and 697c478bd9Sstevel@tonic-gate * the object or window may be non-contiguous. In this example the 707c478bd9Sstevel@tonic-gate * object or window will be broken into smaller contiguous segments. 717c478bd9Sstevel@tonic-gate * Another example is where a device or some intermediary bus adapter has 727c478bd9Sstevel@tonic-gate * some upper limit on its transfer size (i.e. an 8-bit address register). 737c478bd9Sstevel@tonic-gate * In this example the object or window will be broken into smaller 747c478bd9Sstevel@tonic-gate * addressable segments. 757c478bd9Sstevel@tonic-gate */ 767c478bd9Sstevel@tonic-gate typedef struct __ddi_dma_seg *ddi_dma_seg_t; 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gate /* 797c478bd9Sstevel@tonic-gate * A DMA cookie contains DMA address information required to 807c478bd9Sstevel@tonic-gate * program a DMA engine 817c478bd9Sstevel@tonic-gate */ 827c478bd9Sstevel@tonic-gate typedef struct { 837c478bd9Sstevel@tonic-gate union { 847c478bd9Sstevel@tonic-gate uint64_t _dmac_ll; /* 64 bit DMA address */ 857c478bd9Sstevel@tonic-gate uint32_t _dmac_la[2]; /* 2 x 32 bit address */ 867c478bd9Sstevel@tonic-gate } _dmu; 877c478bd9Sstevel@tonic-gate size_t dmac_size; /* DMA cookie size */ 887c478bd9Sstevel@tonic-gate uint_t dmac_type; /* bus specific type bits */ 897c478bd9Sstevel@tonic-gate } ddi_dma_cookie_t; 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate #define dmac_laddress _dmu._dmac_ll 927c478bd9Sstevel@tonic-gate #ifdef _LONG_LONG_HTOL 937c478bd9Sstevel@tonic-gate #define dmac_notused _dmu._dmac_la[0] 947c478bd9Sstevel@tonic-gate #define dmac_address _dmu._dmac_la[1] 957c478bd9Sstevel@tonic-gate #else 967c478bd9Sstevel@tonic-gate #define dmac_address _dmu._dmac_la[0] 977c478bd9Sstevel@tonic-gate #define dmac_notused _dmu._dmac_la[1] 987c478bd9Sstevel@tonic-gate #endif 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate /* 1017c478bd9Sstevel@tonic-gate * Interrupt types 1027c478bd9Sstevel@tonic-gate */ 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate /* 105*a195726fSgovinda * Both ddi_iblock_cookie_t and ddi_idevice_cookie_t are 106*a195726fSgovinda * obsolete data structures. 107*a195726fSgovinda * 1087c478bd9Sstevel@tonic-gate * lock initialization type 1097c478bd9Sstevel@tonic-gate */ 1107c478bd9Sstevel@tonic-gate typedef struct __ddi_iblock_cookie *ddi_iblock_cookie_t; 1117c478bd9Sstevel@tonic-gate typedef union { 1127c478bd9Sstevel@tonic-gate struct { 1137c478bd9Sstevel@tonic-gate ushort_t _idev_vector; /* vector - bus dependent */ 1147c478bd9Sstevel@tonic-gate ushort_t _idev_priority; /* priority - bus dependent */ 1157c478bd9Sstevel@tonic-gate } idu; 1167c478bd9Sstevel@tonic-gate uint_t idev_softint; /* Soft interrupt register bit(s) */ 1177c478bd9Sstevel@tonic-gate } ddi_idevice_cookie_t; 1187c478bd9Sstevel@tonic-gate #define idev_vector idu._idev_vector 1197c478bd9Sstevel@tonic-gate #define idev_priority idu._idev_priority 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate /* 1227c478bd9Sstevel@tonic-gate * register specification 1237c478bd9Sstevel@tonic-gate */ 1247c478bd9Sstevel@tonic-gate typedef struct __ddi_regspec *ddi_regspec_t; 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gate /* 1277c478bd9Sstevel@tonic-gate * interrupt specification 1287c478bd9Sstevel@tonic-gate */ 1297c478bd9Sstevel@tonic-gate typedef struct __ddi_intrspec *ddi_intrspec_t; 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gate /* 132*a195726fSgovinda * ddi_softintr_t is an obsolete data structure. 133*a195726fSgovinda * 1347c478bd9Sstevel@tonic-gate * soft interrupt id 1357c478bd9Sstevel@tonic-gate */ 1367c478bd9Sstevel@tonic-gate typedef struct __ddi_softintr *ddi_softintr_t; 1377c478bd9Sstevel@tonic-gate 1387c478bd9Sstevel@tonic-gate /* 1397c478bd9Sstevel@tonic-gate * opaque device info handle 1407c478bd9Sstevel@tonic-gate */ 1417c478bd9Sstevel@tonic-gate typedef struct __dev_info *dev_info_t; 1427c478bd9Sstevel@tonic-gate 1437c478bd9Sstevel@tonic-gate /* 1447c478bd9Sstevel@tonic-gate * Mapping cookie for devmap(9E) 1457c478bd9Sstevel@tonic-gate */ 1467c478bd9Sstevel@tonic-gate typedef struct __ddi_devmap_data *ddi_devmap_data_t; 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate /* 1497c478bd9Sstevel@tonic-gate * Opaque Device id 1507c478bd9Sstevel@tonic-gate */ 1517c478bd9Sstevel@tonic-gate typedef struct __ddi_devid *ddi_devid_t; 1527c478bd9Sstevel@tonic-gate 1537c478bd9Sstevel@tonic-gate /* 1547c478bd9Sstevel@tonic-gate * Device id types 1557c478bd9Sstevel@tonic-gate */ 1567c478bd9Sstevel@tonic-gate #define DEVID_NONE 0 1577c478bd9Sstevel@tonic-gate #define DEVID_SCSI3_WWN 1 1587c478bd9Sstevel@tonic-gate #define DEVID_SCSI_SERIAL 2 1597c478bd9Sstevel@tonic-gate #define DEVID_FAB 3 1607c478bd9Sstevel@tonic-gate #define DEVID_ENCAP 4 1617c478bd9Sstevel@tonic-gate #define DEVID_ATA_SERIAL 5 1627c478bd9Sstevel@tonic-gate #define DEVID_SCSI3_VPD_T10 6 1637c478bd9Sstevel@tonic-gate #define DEVID_SCSI3_VPD_EUI 7 1647c478bd9Sstevel@tonic-gate #define DEVID_SCSI3_VPD_NAA 8 1657c478bd9Sstevel@tonic-gate #define DEVID_MAXTYPE 8 1667c478bd9Sstevel@tonic-gate 1677c478bd9Sstevel@tonic-gate /* 1687c478bd9Sstevel@tonic-gate * Device id scsi encode versions 1697c478bd9Sstevel@tonic-gate */ 1707c478bd9Sstevel@tonic-gate #define DEVID_SCSI_ENCODE_VERSION1 0 1717c478bd9Sstevel@tonic-gate #define DEVID_SCSI_ENCODE_VERSION2 1 1727c478bd9Sstevel@tonic-gate #define DEVID_SCSI_ENCODE_VERSION_LATEST DEVID_SCSI_ENCODE_VERSION2 1737c478bd9Sstevel@tonic-gate 1747c478bd9Sstevel@tonic-gate /* minor name values for devid lookup interfaces */ 1757c478bd9Sstevel@tonic-gate #define DEVID_MINOR_NAME_ALL ((char *)0) 1767c478bd9Sstevel@tonic-gate #define DEVID_MINOR_NAME_ALL_CHR ((char *)1) 1777c478bd9Sstevel@tonic-gate #define DEVID_MINOR_NAME_ALL_BLK ((char *)2) 1787c478bd9Sstevel@tonic-gate 1797c478bd9Sstevel@tonic-gate /* 1807c478bd9Sstevel@tonic-gate * Define ddi_devmap_cmd types. This should probably be elsewhere. 1817c478bd9Sstevel@tonic-gate */ 1827c478bd9Sstevel@tonic-gate typedef enum { 1837c478bd9Sstevel@tonic-gate DDI_DEVMAP_VALIDATE = 0 /* Check mapping, but do nothing */ 1847c478bd9Sstevel@tonic-gate } ddi_devmap_cmd_t; 1857c478bd9Sstevel@tonic-gate 1867c478bd9Sstevel@tonic-gate /* 1877c478bd9Sstevel@tonic-gate * Definitions for node state 1887c478bd9Sstevel@tonic-gate */ 1897c478bd9Sstevel@tonic-gate typedef enum { 1907c478bd9Sstevel@tonic-gate DS_INVAL = -1, 1917c478bd9Sstevel@tonic-gate DS_PROTO = 0, 1927c478bd9Sstevel@tonic-gate DS_LINKED, /* in orphan list */ 1937c478bd9Sstevel@tonic-gate DS_BOUND, /* in per-driver list */ 1947c478bd9Sstevel@tonic-gate DS_INITIALIZED, /* bus address assigned */ 1957c478bd9Sstevel@tonic-gate DS_PROBED, /* device known to exist */ 1967c478bd9Sstevel@tonic-gate DS_ATTACHED, /* driver attached */ 1977c478bd9Sstevel@tonic-gate DS_READY /* post attach complete */ 1987c478bd9Sstevel@tonic-gate } ddi_node_state_t; 1997c478bd9Sstevel@tonic-gate 2007c478bd9Sstevel@tonic-gate /* 2017c478bd9Sstevel@tonic-gate * NDI Event Service 2027c478bd9Sstevel@tonic-gate */ 2037c478bd9Sstevel@tonic-gate typedef enum {EPL_KERNEL, EPL_INTERRUPT, EPL_HIGHLEVEL} ddi_plevel_t; 2047c478bd9Sstevel@tonic-gate typedef struct ddi_event_cookie *ddi_eventcookie_t; 2057c478bd9Sstevel@tonic-gate typedef struct ddi_event_callbacks *ddi_callback_id_t; 2067c478bd9Sstevel@tonic-gate 2077c478bd9Sstevel@tonic-gate #endif /* !_ASM */ 2087c478bd9Sstevel@tonic-gate 2097c478bd9Sstevel@tonic-gate #ifdef _KERNEL 2107c478bd9Sstevel@tonic-gate #ifndef _ASM 2117c478bd9Sstevel@tonic-gate 2127c478bd9Sstevel@tonic-gate /* 2137c478bd9Sstevel@tonic-gate * Device Access Attributes 2147c478bd9Sstevel@tonic-gate */ 2157c478bd9Sstevel@tonic-gate 2167c478bd9Sstevel@tonic-gate typedef struct ddi_device_acc_attr { 2177c478bd9Sstevel@tonic-gate ushort_t devacc_attr_version; 2187c478bd9Sstevel@tonic-gate uchar_t devacc_attr_endian_flags; 2197c478bd9Sstevel@tonic-gate uchar_t devacc_attr_dataorder; 2207c478bd9Sstevel@tonic-gate uchar_t devacc_attr_access; /* access error protection */ 2217c478bd9Sstevel@tonic-gate } ddi_device_acc_attr_t; 2227c478bd9Sstevel@tonic-gate 2237c478bd9Sstevel@tonic-gate #define DDI_DEVICE_ATTR_V0 0x0001 2247c478bd9Sstevel@tonic-gate #define DDI_DEVICE_ATTR_V1 0x0002 2257c478bd9Sstevel@tonic-gate 2267c478bd9Sstevel@tonic-gate /* 2277c478bd9Sstevel@tonic-gate * endian-ness flags 2287c478bd9Sstevel@tonic-gate */ 2297c478bd9Sstevel@tonic-gate #define DDI_NEVERSWAP_ACC 0x00 2307c478bd9Sstevel@tonic-gate #define DDI_STRUCTURE_LE_ACC 0x01 2317c478bd9Sstevel@tonic-gate #define DDI_STRUCTURE_BE_ACC 0x02 2327c478bd9Sstevel@tonic-gate 2337c478bd9Sstevel@tonic-gate /* 2347c478bd9Sstevel@tonic-gate * Data ordering values 2357c478bd9Sstevel@tonic-gate */ 2367c478bd9Sstevel@tonic-gate #define DDI_STRICTORDER_ACC 0x00 2377c478bd9Sstevel@tonic-gate #define DDI_UNORDERED_OK_ACC 0x01 2387c478bd9Sstevel@tonic-gate #define DDI_MERGING_OK_ACC 0x02 2397c478bd9Sstevel@tonic-gate #define DDI_LOADCACHING_OK_ACC 0x03 2407c478bd9Sstevel@tonic-gate #define DDI_STORECACHING_OK_ACC 0x04 2417c478bd9Sstevel@tonic-gate 2427c478bd9Sstevel@tonic-gate /* 2437c478bd9Sstevel@tonic-gate * Data size 2447c478bd9Sstevel@tonic-gate */ 2457c478bd9Sstevel@tonic-gate #define DDI_DATA_SZ01_ACC 1 2467c478bd9Sstevel@tonic-gate #define DDI_DATA_SZ02_ACC 2 2477c478bd9Sstevel@tonic-gate #define DDI_DATA_SZ04_ACC 4 2487c478bd9Sstevel@tonic-gate #define DDI_DATA_SZ08_ACC 8 2497c478bd9Sstevel@tonic-gate 2507c478bd9Sstevel@tonic-gate /* 2517c478bd9Sstevel@tonic-gate * Data Access Handle 2527c478bd9Sstevel@tonic-gate */ 2537c478bd9Sstevel@tonic-gate #define VERS_ACCHDL 0x0001 2547c478bd9Sstevel@tonic-gate 2557c478bd9Sstevel@tonic-gate typedef struct __ddi_acc_handle *ddi_acc_handle_t; 2567c478bd9Sstevel@tonic-gate 2577c478bd9Sstevel@tonic-gate typedef struct ddi_acc_hdl { 2587c478bd9Sstevel@tonic-gate int ah_vers; /* version number */ 2597c478bd9Sstevel@tonic-gate void *ah_bus_private; /* bus private pointer */ 2607c478bd9Sstevel@tonic-gate void *ah_platform_private; /* platform private pointer */ 2617c478bd9Sstevel@tonic-gate dev_info_t *ah_dip; /* requesting device */ 2627c478bd9Sstevel@tonic-gate 2637c478bd9Sstevel@tonic-gate uint_t ah_rnumber; /* register number */ 2647c478bd9Sstevel@tonic-gate caddr_t ah_addr; /* address of mapping */ 2657c478bd9Sstevel@tonic-gate 2667c478bd9Sstevel@tonic-gate off_t ah_offset; /* offset of mapping */ 2677c478bd9Sstevel@tonic-gate off_t ah_len; /* length of mapping */ 2687c478bd9Sstevel@tonic-gate uint_t ah_hat_flags; /* hat flags used to map object */ 2697c478bd9Sstevel@tonic-gate pfn_t ah_pfn; /* physical page frame number */ 2707c478bd9Sstevel@tonic-gate uint_t ah_pnum; /* number of contiguous pages */ 2717c478bd9Sstevel@tonic-gate ulong_t ah_xfermodes; /* data transfer modes */ 2727c478bd9Sstevel@tonic-gate ddi_device_acc_attr_t ah_acc; /* device access attributes */ 2737c478bd9Sstevel@tonic-gate } ddi_acc_hdl_t; 2747c478bd9Sstevel@tonic-gate 2757c478bd9Sstevel@tonic-gate /* 2767c478bd9Sstevel@tonic-gate * Used by DDI_CTLOPS_POKE and DDI_CTLOPS_PEEK for peek/poke and cautious acc 2777c478bd9Sstevel@tonic-gate */ 2787c478bd9Sstevel@tonic-gate typedef struct { 2797c478bd9Sstevel@tonic-gate size_t size; 2807c478bd9Sstevel@tonic-gate uintptr_t dev_addr; 2817c478bd9Sstevel@tonic-gate uintptr_t host_addr; 2827c478bd9Sstevel@tonic-gate ddi_acc_handle_t handle; 2837c478bd9Sstevel@tonic-gate size_t repcount; 2847c478bd9Sstevel@tonic-gate uint_t flags; 2857c478bd9Sstevel@tonic-gate } peekpoke_ctlops_t; 2867c478bd9Sstevel@tonic-gate 2877c478bd9Sstevel@tonic-gate #endif /* !_ASM */ 2887c478bd9Sstevel@tonic-gate 2897c478bd9Sstevel@tonic-gate /* 2907c478bd9Sstevel@tonic-gate * devacc_attr_access error protection types 2917c478bd9Sstevel@tonic-gate */ 2927c478bd9Sstevel@tonic-gate #define DDI_DEFAULT_ACC 0x01 /* take default action */ 2937c478bd9Sstevel@tonic-gate #define DDI_FLAGERR_ACC 0x02 /* protected against access faults */ 2947c478bd9Sstevel@tonic-gate #define DDI_CAUTIOUS_ACC 0x03 /* high protection against faults */ 2957c478bd9Sstevel@tonic-gate 2967c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 2977c478bd9Sstevel@tonic-gate 2987c478bd9Sstevel@tonic-gate #ifdef __cplusplus 2997c478bd9Sstevel@tonic-gate } 3007c478bd9Sstevel@tonic-gate #endif 3017c478bd9Sstevel@tonic-gate 3027c478bd9Sstevel@tonic-gate #endif /* _SYS_DDITYPES_H */ 303