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 53e2676e0Svikram * Common Development and Distribution License (the "License"). 63e2676e0Svikram * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*94c894bbSVikram Hegde * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 237c478bd9Sstevel@tonic-gate */ 247c478bd9Sstevel@tonic-gate 257c478bd9Sstevel@tonic-gate #ifndef _SYS_DEVINFO_IMPL_H 267c478bd9Sstevel@tonic-gate #define _SYS_DEVINFO_IMPL_H 277c478bd9Sstevel@tonic-gate 2882a2fc47SJames Carlson #include <sys/ddi_impldefs.h> 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate /* 317c478bd9Sstevel@tonic-gate * This file is separate from libdevinfo.h because the devinfo driver 327c478bd9Sstevel@tonic-gate * needs to know about the stuff. Library consumer should not care 337c478bd9Sstevel@tonic-gate * about stuff defined here. 347c478bd9Sstevel@tonic-gate * 357c478bd9Sstevel@tonic-gate * The only exception is di_priv_data (consolidation private) and 367c478bd9Sstevel@tonic-gate * DINFO* ioctls. 377c478bd9Sstevel@tonic-gate */ 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate #ifdef __cplusplus 407c478bd9Sstevel@tonic-gate extern "C" { 417c478bd9Sstevel@tonic-gate #endif 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate /* ioctl commands for devinfo driver */ 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate #define DIIOC (0xdf<<8) 467c478bd9Sstevel@tonic-gate #define DIIOC_MASK (0xffff00ff) 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate /* 497c478bd9Sstevel@tonic-gate * Any combination of the following ORed together will take a snapshot 507c478bd9Sstevel@tonic-gate * of the device configuration data. 517c478bd9Sstevel@tonic-gate */ 527c478bd9Sstevel@tonic-gate #define DINFOSUBTREE (DIIOC | 0x01) /* include subtree */ 537c478bd9Sstevel@tonic-gate #define DINFOMINOR (DIIOC | 0x02) /* include minor data */ 547c478bd9Sstevel@tonic-gate #define DINFOPROP (DIIOC | 0x04) /* include properties */ 55602ca9eaScth #define DINFOPATH (DIIOC | 0x08) /* include i/o pathing information */ 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate /* private bits */ 587c478bd9Sstevel@tonic-gate #define DINFOPRIVDATA (DIIOC | 0x10) /* include private data */ 597c478bd9Sstevel@tonic-gate #define DINFOFORCE (DIIOC | 0x20) /* force load all drivers */ 607c478bd9Sstevel@tonic-gate #define DINFOCACHE (DIIOC | 0x100000) /* use cached data */ 613c34adc5Sramat #define DINFOCLEANUP (DIIOC | 0x200000) /* cleanup /etc/devices files */ 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate /* new public flag for the layered drivers framework */ 647c478bd9Sstevel@tonic-gate #define DINFOLYR (DIIOC | 0x40) /* get device layering information */ 657c478bd9Sstevel@tonic-gate 6626947304SEvan Yan /* new public flag for the hotplug framework */ 6726947304SEvan Yan #define DINFOHP (DIIOC | 0x400000) /* include hotplug information */ 6826947304SEvan Yan 697c478bd9Sstevel@tonic-gate /* 707c478bd9Sstevel@tonic-gate * Straight ioctl commands, not bitwise operation 717c478bd9Sstevel@tonic-gate */ 727c478bd9Sstevel@tonic-gate #define DINFOUSRLD (DIIOC | 0x80) /* copy snapshot to usrland */ 737c478bd9Sstevel@tonic-gate #define DINFOLODRV (DIIOC | 0x81) /* force load a driver */ 747c478bd9Sstevel@tonic-gate #define DINFOIDENT (DIIOC | 0x82) /* identify the driver */ 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gate /* 777c478bd9Sstevel@tonic-gate * ioctl for taking a snapshot a single node and all nodes 787c478bd9Sstevel@tonic-gate */ 797c478bd9Sstevel@tonic-gate #define DINFOCPYONE DIIOC 807c478bd9Sstevel@tonic-gate #define DINFOCPYALL (DINFOSUBTREE | DINFOPROP | DINFOMINOR) 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate #define DI_MAGIC 0xdfdf /* magic number returned by DINFOIDENT */ 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gate /* driver ops encoding */ 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate #define DI_BUS_OPS 0x1 877c478bd9Sstevel@tonic-gate #define DI_CB_OPS 0x2 887c478bd9Sstevel@tonic-gate #define DI_STREAM_OPS 0x4 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate /* property list enumeration */ 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate #define DI_PROP_DRV_LIST 0 937c478bd9Sstevel@tonic-gate #define DI_PROP_SYS_LIST 1 947c478bd9Sstevel@tonic-gate #define DI_PROP_GLB_LIST 2 957c478bd9Sstevel@tonic-gate #define DI_PROP_HW_LIST 3 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate /* misc parameters */ 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate #define MAX_TREE_DEPTH 64 1007c478bd9Sstevel@tonic-gate #define MAX_PTR_IN_PRV 5 1017c478bd9Sstevel@tonic-gate #define DI_SNAPSHOT_VERSION_0 0 /* reserved */ 1028c4f8890Srs #define DI_SNAPSHOT_VERSION_1 1 /* reserved */ 1033e2676e0Svikram #define DI_SNAPSHOT_VERSION_2 2 /* reserved */ 1043e2676e0Svikram #define DI_SNAPSHOT_VERSION DI_SNAPSHOT_VERSION_2 /* current version */ 1057c478bd9Sstevel@tonic-gate #define DI_PRIVDATA_VERSION_0 10 /* Start from 10 so caller must set */ 1067c478bd9Sstevel@tonic-gate #define DI_BIG_ENDIAN 0 /* reserved */ 1077c478bd9Sstevel@tonic-gate #define DI_LITTLE_ENDIAN 1 /* reserved */ 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate #define DI_CACHE_MAGIC 0xdfcac6ed /* magic # for cache */ 1107c478bd9Sstevel@tonic-gate #define DI_CACHE_PERMS (0444) 1118c4f8890Srs #define DI_CACHE_SNAPSHOT_FLAGS \ 1128c4f8890Srs (DINFOFORCE|DINFOSUBTREE|DINFOMINOR|DINFOPROP|DINFOPATH) 1137c478bd9Sstevel@tonic-gate 1147c478bd9Sstevel@tonic-gate #define DI_NODE(addr) ((struct di_node *)((void *)(addr))) 1157c478bd9Sstevel@tonic-gate #define DI_MINOR(addr) ((struct di_minor *)((void *)(addr))) 1167c478bd9Sstevel@tonic-gate #define DI_PROP(addr) ((struct di_prop *)((void *)(addr))) 1177c478bd9Sstevel@tonic-gate #define DI_PATH(addr) ((struct di_path *)((void *)(addr))) 1187c478bd9Sstevel@tonic-gate #define DI_PATHPROP(addr) ((struct di_path_prop *)((void *)(addr))) 1197c478bd9Sstevel@tonic-gate #define DI_ALL(addr) ((struct di_all *)((void *)(addr))) 1207c478bd9Sstevel@tonic-gate #define DI_DEVNM(addr) ((struct di_devnm *)((void *)(addr))) 1217c478bd9Sstevel@tonic-gate #define DI_LINK(addr) ((struct di_link *)((void *)(addr))) 1227c478bd9Sstevel@tonic-gate #define DI_LNODE(addr) ((struct di_lnode *)((void *)(addr))) 123b9ccdc5aScth #define DI_PRIV_FORMAT(addr) ((struct di_priv_format *)((void *)(addr))) 12426947304SEvan Yan #define DI_HP(addr) ((struct di_hp *)((void *)(addr))) 125*94c894bbSVikram Hegde #define DI_ALIAS(addr) ((struct di_alias *)((void *)(addr))) 1267c478bd9Sstevel@tonic-gate 1278c4f8890Srs /* 1288c4f8890Srs * multipath component definitions: Follows the registered component of 1298c4f8890Srs * the mpxio system. 1308c4f8890Srs */ 1318c4f8890Srs #define MULTIPATH_COMPONENT_NONE 0 1328c4f8890Srs #define MULTIPATH_COMPONENT_VHCI 0x1 1338c4f8890Srs #define MULTIPATH_COMPONENT_PHCI 0x2 1348c4f8890Srs #define MULTIPATH_COMPONENT_CLIENT 0x4 1358c4f8890Srs 1367c478bd9Sstevel@tonic-gate typedef int32_t di_off_t; 1377c478bd9Sstevel@tonic-gate 1387c478bd9Sstevel@tonic-gate /* 1397c478bd9Sstevel@tonic-gate * devinfo driver snapshot data structure 1407c478bd9Sstevel@tonic-gate */ 1417c478bd9Sstevel@tonic-gate struct di_all { 1427c478bd9Sstevel@tonic-gate int version; /* snapshot version, reserved */ 1437c478bd9Sstevel@tonic-gate int cache_magic; /* magic number for cached snapshot */ 1447c478bd9Sstevel@tonic-gate int pd_version; /* private data format version */ 1457c478bd9Sstevel@tonic-gate int endianness; /* reserved for future use */ 1467c478bd9Sstevel@tonic-gate int generation; /* reserved for future use */ 1477c478bd9Sstevel@tonic-gate uint32_t cache_checksum; /* snapshot checksum */ 1487c478bd9Sstevel@tonic-gate uint64_t snapshot_time; /* snapshot timestamp */ 149*94c894bbSVikram Hegde di_off_t top_devinfo; /* actual top devinfo in snapshot */ 1508c4f8890Srs di_off_t top_vhci_devinfo; 1517c478bd9Sstevel@tonic-gate di_off_t devnames; 1527c478bd9Sstevel@tonic-gate di_off_t ppdata_format; /* parent priv data format array */ 1537c478bd9Sstevel@tonic-gate di_off_t dpdata_format; /* driver priv data format array */ 154*94c894bbSVikram Hegde di_off_t aliases; /* offset to alias tree */ 1557c478bd9Sstevel@tonic-gate int n_ppdata; /* size of ppdata_format array */ 1567c478bd9Sstevel@tonic-gate int n_dpdata; /* size of pddata_format array */ 1577c478bd9Sstevel@tonic-gate int devcnt; /* size of devnames array */ 1587c478bd9Sstevel@tonic-gate uint_t command; /* same as in di_init() */ 1597c478bd9Sstevel@tonic-gate uint_t map_size; /* size of the snapshot */ 160*94c894bbSVikram Hegde char req_path[MAXPATHLEN]; /* path to requested root */ 161*94c894bbSVikram Hegde char root_path[1]; /* path to actual snapshot root */ 1627c478bd9Sstevel@tonic-gate }; 1637c478bd9Sstevel@tonic-gate 1647c478bd9Sstevel@tonic-gate struct di_devnm { 1657c478bd9Sstevel@tonic-gate di_off_t name; 1667c478bd9Sstevel@tonic-gate di_off_t global_prop; 1677c478bd9Sstevel@tonic-gate di_off_t head; /* head of per instance list */ 1687c478bd9Sstevel@tonic-gate int flags; /* driver attachment info */ 1697c478bd9Sstevel@tonic-gate int instance; /* next instance to assign */ 1707c478bd9Sstevel@tonic-gate uint_t ops; /* bit-encoded driver ops */ 1717c478bd9Sstevel@tonic-gate }; 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate 1747c478bd9Sstevel@tonic-gate struct di_lnode; 1757c478bd9Sstevel@tonic-gate 1767c478bd9Sstevel@tonic-gate struct di_link { 1777c478bd9Sstevel@tonic-gate di_off_t self; 1787c478bd9Sstevel@tonic-gate int count; 1797c478bd9Sstevel@tonic-gate int spec_type; /* block or char access type */ 1807c478bd9Sstevel@tonic-gate di_off_t src_lnode; /* src di_lnode */ 1817c478bd9Sstevel@tonic-gate di_off_t tgt_lnode; /* tgt di_lnode */ 1827c478bd9Sstevel@tonic-gate di_off_t src_link_next; /* next src di_link /w same di_lnode */ 1837c478bd9Sstevel@tonic-gate di_off_t tgt_link_next; /* next tgt di_link /w same di_lnode */ 1847c478bd9Sstevel@tonic-gate di_off_t src_node_next; /* next src di_link /w same di_node */ 1857c478bd9Sstevel@tonic-gate di_off_t tgt_node_next; /* next tgt di_link /w same di_node */ 1867c478bd9Sstevel@tonic-gate uint64_t user_private_data; 1877c478bd9Sstevel@tonic-gate }; 1887c478bd9Sstevel@tonic-gate 1897c478bd9Sstevel@tonic-gate struct di_lnode { 1907c478bd9Sstevel@tonic-gate di_off_t self; 1917c478bd9Sstevel@tonic-gate 1927c478bd9Sstevel@tonic-gate /* 1937c478bd9Sstevel@tonic-gate * public information describing a link endpoint 1947c478bd9Sstevel@tonic-gate */ 1957c478bd9Sstevel@tonic-gate major_t dev_major; /* dev_t can be 64-bit */ 1967c478bd9Sstevel@tonic-gate minor_t dev_minor; /* dev_t can be 64-bit */ 1977c478bd9Sstevel@tonic-gate di_off_t node; /* offset of di_node */ 1987c478bd9Sstevel@tonic-gate 1997c478bd9Sstevel@tonic-gate /* 2007c478bd9Sstevel@tonic-gate * di_link ptr to links comming into this node 2017c478bd9Sstevel@tonic-gate * (this lnode is the target of these di_links) 2027c478bd9Sstevel@tonic-gate */ 2037c478bd9Sstevel@tonic-gate di_off_t link_in; 2047c478bd9Sstevel@tonic-gate 2057c478bd9Sstevel@tonic-gate /* 2067c478bd9Sstevel@tonic-gate * di_link ptr to links going out of this node 2077c478bd9Sstevel@tonic-gate * (this lnode is the source of these di_links) 2087c478bd9Sstevel@tonic-gate */ 2097c478bd9Sstevel@tonic-gate di_off_t link_out; 2107c478bd9Sstevel@tonic-gate 2117c478bd9Sstevel@tonic-gate /* 2127c478bd9Sstevel@tonic-gate * di_lnode pointer to the next lnode associated with the 2137c478bd9Sstevel@tonic-gate * same di_node 2147c478bd9Sstevel@tonic-gate */ 2157c478bd9Sstevel@tonic-gate di_off_t node_next; 2167c478bd9Sstevel@tonic-gate 2177c478bd9Sstevel@tonic-gate uint64_t user_private_data; 2187c478bd9Sstevel@tonic-gate }; 2197c478bd9Sstevel@tonic-gate 2207c478bd9Sstevel@tonic-gate struct di_node { /* useful info to export for each tree node */ 2217c478bd9Sstevel@tonic-gate /* 2227c478bd9Sstevel@tonic-gate * offset to di_node structures 2237c478bd9Sstevel@tonic-gate */ 2247c478bd9Sstevel@tonic-gate di_off_t self; /* make it self addressable */ 2257c478bd9Sstevel@tonic-gate di_off_t parent; /* offset of parent node */ 2267c478bd9Sstevel@tonic-gate di_off_t child; /* offset of child node */ 2277c478bd9Sstevel@tonic-gate di_off_t sibling; /* offset of sibling */ 2287c478bd9Sstevel@tonic-gate di_off_t next; /* next node on per-instance list */ 2297c478bd9Sstevel@tonic-gate /* 2307c478bd9Sstevel@tonic-gate * offset to char strings of current node 2317c478bd9Sstevel@tonic-gate */ 2327c478bd9Sstevel@tonic-gate di_off_t node_name; /* offset of device node name */ 2337c478bd9Sstevel@tonic-gate di_off_t address; /* offset of address part of name */ 2347c478bd9Sstevel@tonic-gate di_off_t bind_name; /* offset of binding name */ 2357c478bd9Sstevel@tonic-gate di_off_t compat_names; /* offset of compatible names */ 2367c478bd9Sstevel@tonic-gate /* 2377c478bd9Sstevel@tonic-gate * offset to property lists, private data, etc. 2387c478bd9Sstevel@tonic-gate */ 2397c478bd9Sstevel@tonic-gate di_off_t minor_data; 2407c478bd9Sstevel@tonic-gate di_off_t drv_prop; 2417c478bd9Sstevel@tonic-gate di_off_t sys_prop; 2427c478bd9Sstevel@tonic-gate di_off_t glob_prop; 2437c478bd9Sstevel@tonic-gate di_off_t hw_prop; 2447c478bd9Sstevel@tonic-gate di_off_t parent_data; 2457c478bd9Sstevel@tonic-gate di_off_t driver_data; 2467c478bd9Sstevel@tonic-gate di_off_t multipath_client; 2477c478bd9Sstevel@tonic-gate di_off_t multipath_phci; 2487c478bd9Sstevel@tonic-gate di_off_t devid; /* registered device id */ 2497c478bd9Sstevel@tonic-gate di_off_t pm_info; /* RESERVED FOR FUTURE USE */ 2507c478bd9Sstevel@tonic-gate /* 2517c478bd9Sstevel@tonic-gate * misc values 2527c478bd9Sstevel@tonic-gate */ 2537c478bd9Sstevel@tonic-gate int compat_length; /* size of compatible name list */ 2547c478bd9Sstevel@tonic-gate int drv_major; /* for indexing into devnames array */ 2557c478bd9Sstevel@tonic-gate /* 2567c478bd9Sstevel@tonic-gate * value attributes of current node 2577c478bd9Sstevel@tonic-gate */ 2587c478bd9Sstevel@tonic-gate int instance; /* instance number */ 2597c478bd9Sstevel@tonic-gate int nodeid; /* node id */ 2607c478bd9Sstevel@tonic-gate ddi_node_class_t node_class; /* node class */ 2617c478bd9Sstevel@tonic-gate int attributes; /* node attributes */ 2627c478bd9Sstevel@tonic-gate uint_t state; /* hotplugging device state */ 2637c478bd9Sstevel@tonic-gate ddi_node_state_t node_state; /* devinfo state */ 2647c478bd9Sstevel@tonic-gate 2657c478bd9Sstevel@tonic-gate di_off_t lnodes; /* lnodes associated with this di_node */ 2667c478bd9Sstevel@tonic-gate di_off_t tgt_links; 2677c478bd9Sstevel@tonic-gate di_off_t src_links; 2687c478bd9Sstevel@tonic-gate 2698c4f8890Srs uint32_t di_pad1; /* 4 byte padding for 32bit x86 app. */ 2708c4f8890Srs uint64_t user_private_data; 2718c4f8890Srs /* 2728c4f8890Srs * offset to link vhci/phci nodes. 2738c4f8890Srs */ 2748c4f8890Srs di_off_t next_vhci; 2758c4f8890Srs di_off_t top_phci; 2768c4f8890Srs di_off_t next_phci; 2778c4f8890Srs uint32_t multipath_component; /* stores MDI_COMPONENT_* value. */ 2783e2676e0Svikram /* 2793e2676e0Svikram * devi_flags field 2803e2676e0Svikram */ 2813e2676e0Svikram uint32_t flags; 2823e2676e0Svikram uint32_t di_pad2; /* 4 byte padding for 32bit x86 app. */ 28326947304SEvan Yan /* 28426947304SEvan Yan * offset to hotplug nodes. 28526947304SEvan Yan */ 28626947304SEvan Yan di_off_t hp_data; 2877c478bd9Sstevel@tonic-gate }; 2887c478bd9Sstevel@tonic-gate 2897c478bd9Sstevel@tonic-gate /* 2907c478bd9Sstevel@tonic-gate * chain of ddi_minor_data structure 2917c478bd9Sstevel@tonic-gate */ 2927c478bd9Sstevel@tonic-gate struct di_minor { 2937c478bd9Sstevel@tonic-gate di_off_t self; /* make it self addressable */ 2947c478bd9Sstevel@tonic-gate di_off_t next; /* next one in the chain */ 2957c478bd9Sstevel@tonic-gate di_off_t name; /* name of node */ 2967c478bd9Sstevel@tonic-gate di_off_t node_type; /* block, byte, serial, network */ 2977c478bd9Sstevel@tonic-gate ddi_minor_type type; /* data type */ 2987c478bd9Sstevel@tonic-gate major_t dev_major; /* dev_t can be 64-bit */ 2997c478bd9Sstevel@tonic-gate minor_t dev_minor; 3007c478bd9Sstevel@tonic-gate int spec_type; /* block or char */ 3017c478bd9Sstevel@tonic-gate unsigned int mdclass; /* no longer used, may be removed */ 3027c478bd9Sstevel@tonic-gate di_off_t node; /* address of di_node */ 3037c478bd9Sstevel@tonic-gate uint64_t user_private_data; 3047c478bd9Sstevel@tonic-gate }; 3057c478bd9Sstevel@tonic-gate 3067c478bd9Sstevel@tonic-gate typedef enum { 3077c478bd9Sstevel@tonic-gate DI_PATH_STATE_UNKNOWN, 3087c478bd9Sstevel@tonic-gate DI_PATH_STATE_OFFLINE, 3097c478bd9Sstevel@tonic-gate DI_PATH_STATE_STANDBY, 3107c478bd9Sstevel@tonic-gate DI_PATH_STATE_ONLINE, 3117c478bd9Sstevel@tonic-gate DI_PATH_STATE_FAULT 3127c478bd9Sstevel@tonic-gate } di_path_state_t; 3137c478bd9Sstevel@tonic-gate 3147c478bd9Sstevel@tonic-gate /* 3157c478bd9Sstevel@tonic-gate * multipathing information structures 3167c478bd9Sstevel@tonic-gate */ 3177c478bd9Sstevel@tonic-gate struct di_path { 3187c478bd9Sstevel@tonic-gate di_off_t self; /* make it self addressable */ 3197c478bd9Sstevel@tonic-gate di_off_t path_c_link; /* next pathinfo via client linkage */ 3207c478bd9Sstevel@tonic-gate di_off_t path_p_link; /* next pathinfo via phci linkage */ 3217c478bd9Sstevel@tonic-gate di_off_t path_client; /* reference to client node */ 3227c478bd9Sstevel@tonic-gate di_off_t path_phci; /* reference to phci node */ 3237c478bd9Sstevel@tonic-gate di_off_t path_prop; /* property list */ 3247c478bd9Sstevel@tonic-gate di_off_t path_addr; /* path addressing information */ 3257c478bd9Sstevel@tonic-gate di_path_state_t path_state; /* path state */ 326602ca9eaScth uint_t path_snap_state; /* describes valid fields */ 327602ca9eaScth int path_instance; /* path instance */ 328602ca9eaScth uint64_t user_private_data; 3294c06356bSdh uint_t path_flags; /* path flags */ 3307c478bd9Sstevel@tonic-gate }; 3317c478bd9Sstevel@tonic-gate 33226947304SEvan Yan /* 33326947304SEvan Yan * chain of hotplug information structures 33426947304SEvan Yan */ 33526947304SEvan Yan struct di_hp { 33626947304SEvan Yan di_off_t self; /* make it self addressable */ 33726947304SEvan Yan di_off_t next; /* next one in chain */ 33826947304SEvan Yan di_off_t hp_name; /* name of hotplug connection */ 33926947304SEvan Yan int hp_connection; /* connection number */ 34026947304SEvan Yan int hp_depends_on; /* connection number depended upon */ 34126947304SEvan Yan int hp_state; /* current hotplug state */ 34226947304SEvan Yan int hp_type; /* connection type: PCI, ... */ 34326947304SEvan Yan di_off_t hp_type_str; /* description of connection type */ 34426947304SEvan Yan uint32_t hp_last_change; /* timestamp of last change */ 34526947304SEvan Yan di_off_t hp_child; /* child device node */ 34626947304SEvan Yan }; 34726947304SEvan Yan 3487c478bd9Sstevel@tonic-gate /* 3497c478bd9Sstevel@tonic-gate * Flags for snap_state 3507c478bd9Sstevel@tonic-gate */ 3517c478bd9Sstevel@tonic-gate #define DI_PATH_SNAP_NOCLIENT 0x01 /* client endpt not in snapshot */ 3527c478bd9Sstevel@tonic-gate #define DI_PATH_SNAP_NOPHCI 0x02 /* phci endpt not in snapshot */ 3537c478bd9Sstevel@tonic-gate #define DI_PATH_SNAP_ENDPTS 0x04 /* Endpoints have been postprocessed */ 3547c478bd9Sstevel@tonic-gate 3557c478bd9Sstevel@tonic-gate #define DI_PATH_SNAP_NOCLINK 0x10 /* client linkage not in snapshot */ 3567c478bd9Sstevel@tonic-gate #define DI_PATH_SNAP_NOPLINK 0x20 /* phci linkage not in snapshot */ 3577c478bd9Sstevel@tonic-gate #define DI_PATH_SNAP_LINKS 0x40 /* linkages have been postprocessed */ 3587c478bd9Sstevel@tonic-gate 3594c06356bSdh /* 3604c06356bSdh * Flags for path_flags 3614c06356bSdh */ 3624c06356bSdh #define DI_PATH_FLAGS_DEVICE_REMOVED 0x01 /* peer of DI_DEVICE_REMOVED */ 3634c06356bSdh 3647c478bd9Sstevel@tonic-gate /* 3657c478bd9Sstevel@tonic-gate * path properties 3667c478bd9Sstevel@tonic-gate */ 3677c478bd9Sstevel@tonic-gate struct di_path_prop { 3687c478bd9Sstevel@tonic-gate di_off_t self; /* make it self addressable */ 3697c478bd9Sstevel@tonic-gate di_off_t prop_next; /* next property linkage */ 3707c478bd9Sstevel@tonic-gate di_off_t prop_name; /* property name */ 3717c478bd9Sstevel@tonic-gate di_off_t prop_data; /* property data */ 3727c478bd9Sstevel@tonic-gate int prop_type; /* property data type */ 3737c478bd9Sstevel@tonic-gate int prop_len; /* prop length in bytes */ 3747c478bd9Sstevel@tonic-gate }; 3757c478bd9Sstevel@tonic-gate 3767c478bd9Sstevel@tonic-gate /* 3777c478bd9Sstevel@tonic-gate * Now the properties. 3787c478bd9Sstevel@tonic-gate */ 3797c478bd9Sstevel@tonic-gate struct di_prop { 3807c478bd9Sstevel@tonic-gate di_off_t self; /* make it self addressable */ 3817c478bd9Sstevel@tonic-gate di_off_t next; 3827c478bd9Sstevel@tonic-gate di_off_t prop_name; /* Property name */ 3837c478bd9Sstevel@tonic-gate di_off_t prop_data; /* property data */ 3847c478bd9Sstevel@tonic-gate major_t dev_major; /* dev_t can be 64 bit */ 3857c478bd9Sstevel@tonic-gate minor_t dev_minor; 386b9ccdc5aScth int prop_flags; /* mark prop value types & more */ 387b9ccdc5aScth int prop_len; /* prop len in bytes (boolean if 0) */ 388b9ccdc5aScth int prop_list; /* which list (DI_PROP_SYS_LIST), etc */ 3897c478bd9Sstevel@tonic-gate }; 3907c478bd9Sstevel@tonic-gate 3917c478bd9Sstevel@tonic-gate /* 3927c478bd9Sstevel@tonic-gate * Private data stuff for supporting prtconf. 3937c478bd9Sstevel@tonic-gate * Allows one level of indirection of fixed sized obj or obj array. 3947c478bd9Sstevel@tonic-gate * The array size may be an int member of the array. 3957c478bd9Sstevel@tonic-gate */ 3967c478bd9Sstevel@tonic-gate 3977c478bd9Sstevel@tonic-gate struct di_priv_format { 3987c478bd9Sstevel@tonic-gate char drv_name[MAXPATHLEN]; /* name of parent drv for ppdata */ 3997c478bd9Sstevel@tonic-gate size_t bytes; /* size in bytes of this struct */ 4007c478bd9Sstevel@tonic-gate struct { /* ptrs to dereference */ 4017c478bd9Sstevel@tonic-gate int size; /* size of object assoc. this ptr */ 4027c478bd9Sstevel@tonic-gate int offset; /* location of pointer within struct */ 4037c478bd9Sstevel@tonic-gate int len_offset; /* offset to var. containing the len */ 4047c478bd9Sstevel@tonic-gate } ptr[MAX_PTR_IN_PRV]; 4057c478bd9Sstevel@tonic-gate }; 4067c478bd9Sstevel@tonic-gate 4077c478bd9Sstevel@tonic-gate struct di_priv_data { 4087c478bd9Sstevel@tonic-gate int version; 4097c478bd9Sstevel@tonic-gate int n_parent; 4107c478bd9Sstevel@tonic-gate int n_driver; 4117c478bd9Sstevel@tonic-gate struct di_priv_format *parent; 4127c478bd9Sstevel@tonic-gate struct di_priv_format *driver; 4137c478bd9Sstevel@tonic-gate }; 4147c478bd9Sstevel@tonic-gate 415*94c894bbSVikram Hegde 416*94c894bbSVikram Hegde /* 417*94c894bbSVikram Hegde * structure for saving alias information 418*94c894bbSVikram Hegde */ 419*94c894bbSVikram Hegde struct di_alias { 420*94c894bbSVikram Hegde di_off_t self; /* make it self addressable */ 421*94c894bbSVikram Hegde di_off_t curroff; /* offset to curr dip's snapshot */ 422*94c894bbSVikram Hegde di_off_t next; /* next alias */ 423*94c894bbSVikram Hegde char alias[1]; /* alias path */ 424*94c894bbSVikram Hegde }; 425*94c894bbSVikram Hegde 4267c478bd9Sstevel@tonic-gate /* 4277c478bd9Sstevel@tonic-gate * structure passed in from ioctl 4287c478bd9Sstevel@tonic-gate */ 4297c478bd9Sstevel@tonic-gate struct dinfo_io { 4307c478bd9Sstevel@tonic-gate char root_path[MAXPATHLEN]; 4317c478bd9Sstevel@tonic-gate struct di_priv_data priv; 4327c478bd9Sstevel@tonic-gate }; 4337c478bd9Sstevel@tonic-gate 4347c478bd9Sstevel@tonic-gate #ifdef __cplusplus 4357c478bd9Sstevel@tonic-gate } 4367c478bd9Sstevel@tonic-gate #endif 4377c478bd9Sstevel@tonic-gate 4387c478bd9Sstevel@tonic-gate #endif /* _SYS_DEVINFO_IMPL_H */ 439