xref: /onnv-gate/usr/src/uts/common/sys/devinfo_impl.h (revision 10923:df470fd79c3c)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
54444Svikram  * Common Development and Distribution License (the "License").
64444Svikram  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
229107Sjames.d.carlson@sun.com  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SYS_DEVINFO_IMPL_H
270Sstevel@tonic-gate #define	_SYS_DEVINFO_IMPL_H
280Sstevel@tonic-gate 
299107Sjames.d.carlson@sun.com #include <sys/ddi_impldefs.h>
300Sstevel@tonic-gate 
310Sstevel@tonic-gate /*
320Sstevel@tonic-gate  * This file is separate from libdevinfo.h because the devinfo driver
330Sstevel@tonic-gate  * needs to know about the stuff. Library consumer should not care
340Sstevel@tonic-gate  * about stuff defined here.
350Sstevel@tonic-gate  *
360Sstevel@tonic-gate  * The only exception is di_priv_data (consolidation private) and
370Sstevel@tonic-gate  * DINFO* ioctls.
380Sstevel@tonic-gate  */
390Sstevel@tonic-gate 
400Sstevel@tonic-gate #ifdef	__cplusplus
410Sstevel@tonic-gate extern "C" {
420Sstevel@tonic-gate #endif
430Sstevel@tonic-gate 
440Sstevel@tonic-gate /* ioctl commands for devinfo driver */
450Sstevel@tonic-gate 
460Sstevel@tonic-gate #define	DIIOC		(0xdf<<8)
470Sstevel@tonic-gate #define	DIIOC_MASK	(0xffff00ff)
480Sstevel@tonic-gate 
490Sstevel@tonic-gate /*
500Sstevel@tonic-gate  * Any combination of the following ORed together will take a snapshot
510Sstevel@tonic-gate  * of the device configuration data.
520Sstevel@tonic-gate  */
530Sstevel@tonic-gate #define	DINFOSUBTREE	(DIIOC | 0x01)	/* include subtree */
540Sstevel@tonic-gate #define	DINFOMINOR	(DIIOC | 0x02)	/* include minor data */
550Sstevel@tonic-gate #define	DINFOPROP	(DIIOC | 0x04)	/* include properties */
566640Scth #define	DINFOPATH	(DIIOC | 0x08)	/* include i/o pathing information */
570Sstevel@tonic-gate 
580Sstevel@tonic-gate /* private bits */
590Sstevel@tonic-gate #define	DINFOPRIVDATA	(DIIOC | 0x10)	/* include private data */
600Sstevel@tonic-gate #define	DINFOFORCE	(DIIOC | 0x20)	/* force load all drivers */
610Sstevel@tonic-gate #define	DINFOCACHE	(DIIOC | 0x100000) /* use cached data  */
62878Sramat #define	DINFOCLEANUP	(DIIOC | 0x200000) /* cleanup /etc/devices files */
630Sstevel@tonic-gate 
640Sstevel@tonic-gate /* new public flag for the layered drivers framework */
650Sstevel@tonic-gate #define	DINFOLYR	(DIIOC | 0x40)	/* get device layering information */
660Sstevel@tonic-gate 
67*10923SEvan.Yan@Sun.COM /* new public flag for the hotplug framework */
68*10923SEvan.Yan@Sun.COM #define	DINFOHP		(DIIOC | 0x400000)  /* include hotplug information */
69*10923SEvan.Yan@Sun.COM 
700Sstevel@tonic-gate /*
710Sstevel@tonic-gate  * Straight ioctl commands, not bitwise operation
720Sstevel@tonic-gate  */
730Sstevel@tonic-gate #define	DINFOUSRLD	(DIIOC | 0x80)	/* copy snapshot to usrland */
740Sstevel@tonic-gate #define	DINFOLODRV	(DIIOC | 0x81)	/* force load a driver */
750Sstevel@tonic-gate #define	DINFOIDENT	(DIIOC | 0x82)	/* identify the driver */
760Sstevel@tonic-gate 
770Sstevel@tonic-gate /*
780Sstevel@tonic-gate  * ioctl for taking a snapshot a single node and all nodes
790Sstevel@tonic-gate  */
800Sstevel@tonic-gate #define	DINFOCPYONE	DIIOC
810Sstevel@tonic-gate #define	DINFOCPYALL	(DINFOSUBTREE | DINFOPROP | DINFOMINOR)
820Sstevel@tonic-gate 
830Sstevel@tonic-gate #define	DI_MAGIC	0xdfdf	/* magic number returned by DINFOIDENT */
840Sstevel@tonic-gate 
850Sstevel@tonic-gate /* driver ops encoding */
860Sstevel@tonic-gate 
870Sstevel@tonic-gate #define	DI_BUS_OPS	0x1
880Sstevel@tonic-gate #define	DI_CB_OPS	0x2
890Sstevel@tonic-gate #define	DI_STREAM_OPS	0x4
900Sstevel@tonic-gate 
910Sstevel@tonic-gate /* property list enumeration */
920Sstevel@tonic-gate 
930Sstevel@tonic-gate #define	DI_PROP_DRV_LIST	0
940Sstevel@tonic-gate #define	DI_PROP_SYS_LIST	1
950Sstevel@tonic-gate #define	DI_PROP_GLB_LIST	2
960Sstevel@tonic-gate #define	DI_PROP_HW_LIST		3
970Sstevel@tonic-gate 
980Sstevel@tonic-gate /* misc parameters */
990Sstevel@tonic-gate 
1000Sstevel@tonic-gate #define	MAX_TREE_DEPTH	64
1010Sstevel@tonic-gate #define	MAX_PTR_IN_PRV	5
1020Sstevel@tonic-gate #define	DI_SNAPSHOT_VERSION_0	0	/* reserved */
103893Srs135747 #define	DI_SNAPSHOT_VERSION_1	1	/* reserved */
1044444Svikram #define	DI_SNAPSHOT_VERSION_2	2	/* reserved */
1054444Svikram #define	DI_SNAPSHOT_VERSION	DI_SNAPSHOT_VERSION_2	/* current version */
1060Sstevel@tonic-gate #define	DI_PRIVDATA_VERSION_0	10	/* Start from 10 so caller must set */
1070Sstevel@tonic-gate #define	DI_BIG_ENDIAN		0	/* reserved */
1080Sstevel@tonic-gate #define	DI_LITTLE_ENDIAN	1	/* reserved */
1090Sstevel@tonic-gate 
1100Sstevel@tonic-gate #define	DI_CACHE_MAGIC		0xdfcac6ed	/* magic # for cache */
1110Sstevel@tonic-gate #define	DI_CACHE_PERMS		(0444)
112893Srs135747 #define	DI_CACHE_SNAPSHOT_FLAGS	\
113893Srs135747 	(DINFOFORCE|DINFOSUBTREE|DINFOMINOR|DINFOPROP|DINFOPATH)
1140Sstevel@tonic-gate 
1150Sstevel@tonic-gate #define	DI_NODE(addr)		((struct di_node *)((void *)(addr)))
1160Sstevel@tonic-gate #define	DI_MINOR(addr)		((struct di_minor *)((void *)(addr)))
1170Sstevel@tonic-gate #define	DI_PROP(addr)		((struct di_prop *)((void *)(addr)))
1180Sstevel@tonic-gate #define	DI_PATH(addr)		((struct di_path *)((void *)(addr)))
1190Sstevel@tonic-gate #define	DI_PATHPROP(addr)	((struct di_path_prop *)((void *)(addr)))
1200Sstevel@tonic-gate #define	DI_ALL(addr)		((struct di_all *)((void *)(addr)))
1210Sstevel@tonic-gate #define	DI_DEVNM(addr)		((struct di_devnm *)((void *)(addr)))
1220Sstevel@tonic-gate #define	DI_LINK(addr)		((struct di_link *)((void *)(addr)))
1230Sstevel@tonic-gate #define	DI_LNODE(addr)		((struct di_lnode *)((void *)(addr)))
1247224Scth #define	DI_PRIV_FORMAT(addr)	((struct di_priv_format *)((void *)(addr)))
125*10923SEvan.Yan@Sun.COM #define	DI_HP(addr)		((struct di_hp *)((void *)(addr)))
1260Sstevel@tonic-gate 
127893Srs135747 /*
128893Srs135747  * multipath component definitions:  Follows the registered component of
129893Srs135747  * the mpxio system.
130893Srs135747  */
131893Srs135747 #define	MULTIPATH_COMPONENT_NONE	0
132893Srs135747 #define	MULTIPATH_COMPONENT_VHCI	0x1
133893Srs135747 #define	MULTIPATH_COMPONENT_PHCI	0x2
134893Srs135747 #define	MULTIPATH_COMPONENT_CLIENT	0x4
135893Srs135747 
1360Sstevel@tonic-gate typedef int32_t di_off_t;
1370Sstevel@tonic-gate 
1380Sstevel@tonic-gate /*
1390Sstevel@tonic-gate  * devinfo driver snapshot data structure
1400Sstevel@tonic-gate  */
1410Sstevel@tonic-gate struct di_all {
1420Sstevel@tonic-gate 	int	version;	/* snapshot version, reserved */
1430Sstevel@tonic-gate 	int	cache_magic;	/* magic number for cached snapshot */
1440Sstevel@tonic-gate 	int	pd_version;	/* private data format version */
1450Sstevel@tonic-gate 	int	endianness;	/* reserved for future use */
1460Sstevel@tonic-gate 	int	generation;	/* reserved for future use */
1470Sstevel@tonic-gate 	uint32_t	cache_checksum;	/* snapshot checksum */
1480Sstevel@tonic-gate 	uint64_t	snapshot_time;	/* snapshot timestamp */
1490Sstevel@tonic-gate 	di_off_t	top_devinfo;
150893Srs135747 	di_off_t	top_vhci_devinfo;
1510Sstevel@tonic-gate 	di_off_t	devnames;
1520Sstevel@tonic-gate 	di_off_t	ppdata_format;	/* parent priv data format array */
1530Sstevel@tonic-gate 	di_off_t	dpdata_format;	/* driver priv data format array */
1540Sstevel@tonic-gate 	int	n_ppdata;	/* size of ppdata_format array */
1550Sstevel@tonic-gate 	int	n_dpdata;	/* size of pddata_format array */
1560Sstevel@tonic-gate 	int	devcnt;		/* size of devnames array */
1570Sstevel@tonic-gate 	uint_t	command;	/* same as in di_init() */
1580Sstevel@tonic-gate 	uint_t	map_size;	/* size of the snapshot */
1590Sstevel@tonic-gate 	char	root_path[1];	/* path to snapshot root */
1600Sstevel@tonic-gate };
1610Sstevel@tonic-gate 
1620Sstevel@tonic-gate struct di_devnm {
1630Sstevel@tonic-gate 	di_off_t name;
1640Sstevel@tonic-gate 	di_off_t global_prop;
1650Sstevel@tonic-gate 	di_off_t head;	/* head of per instance list */
1660Sstevel@tonic-gate 	int flags;	/* driver attachment info */
1670Sstevel@tonic-gate 	int instance;	/* next instance to assign */
1680Sstevel@tonic-gate 	uint_t ops;	/* bit-encoded driver ops */
1690Sstevel@tonic-gate };
1700Sstevel@tonic-gate 
1710Sstevel@tonic-gate 
1720Sstevel@tonic-gate struct di_lnode;
1730Sstevel@tonic-gate 
1740Sstevel@tonic-gate struct di_link {
1750Sstevel@tonic-gate 	di_off_t	self;
1760Sstevel@tonic-gate 	int		count;
1770Sstevel@tonic-gate 	int		spec_type;	/* block or char access type */
1780Sstevel@tonic-gate 	di_off_t	src_lnode;	/* src di_lnode */
1790Sstevel@tonic-gate 	di_off_t	tgt_lnode;	/* tgt di_lnode */
1800Sstevel@tonic-gate 	di_off_t	src_link_next;	/* next src di_link /w same di_lnode */
1810Sstevel@tonic-gate 	di_off_t	tgt_link_next;	/* next tgt di_link /w same di_lnode */
1820Sstevel@tonic-gate 	di_off_t	src_node_next;	/* next src di_link /w same di_node */
1830Sstevel@tonic-gate 	di_off_t	tgt_node_next;	/* next tgt di_link /w same di_node */
1840Sstevel@tonic-gate 	uint64_t 	user_private_data;
1850Sstevel@tonic-gate };
1860Sstevel@tonic-gate 
1870Sstevel@tonic-gate struct di_lnode {
1880Sstevel@tonic-gate 	di_off_t	self;
1890Sstevel@tonic-gate 
1900Sstevel@tonic-gate 	/*
1910Sstevel@tonic-gate 	 * public information describing a link endpoint
1920Sstevel@tonic-gate 	 */
1930Sstevel@tonic-gate 	major_t		dev_major;	/* dev_t can be 64-bit */
1940Sstevel@tonic-gate 	minor_t		dev_minor;	/* dev_t can be 64-bit */
1950Sstevel@tonic-gate 	di_off_t	node;		/* offset of di_node */
1960Sstevel@tonic-gate 
1970Sstevel@tonic-gate 	/*
1980Sstevel@tonic-gate 	 * di_link ptr to links comming into this node
1990Sstevel@tonic-gate 	 * (this lnode is the target of these di_links)
2000Sstevel@tonic-gate 	 */
2010Sstevel@tonic-gate 	di_off_t	link_in;
2020Sstevel@tonic-gate 
2030Sstevel@tonic-gate 	/*
2040Sstevel@tonic-gate 	 * di_link ptr to links going out of this node
2050Sstevel@tonic-gate 	 * (this lnode is the source of these di_links)
2060Sstevel@tonic-gate 	 */
2070Sstevel@tonic-gate 	di_off_t	link_out;
2080Sstevel@tonic-gate 
2090Sstevel@tonic-gate 	/*
2100Sstevel@tonic-gate 	 * di_lnode pointer to the next lnode associated with the
2110Sstevel@tonic-gate 	 * same di_node
2120Sstevel@tonic-gate 	 */
2130Sstevel@tonic-gate 	di_off_t	node_next;
2140Sstevel@tonic-gate 
2150Sstevel@tonic-gate 	uint64_t 	user_private_data;
2160Sstevel@tonic-gate };
2170Sstevel@tonic-gate 
2180Sstevel@tonic-gate struct di_node {	/* useful info to export for each tree node */
2190Sstevel@tonic-gate 	/*
2200Sstevel@tonic-gate 	 * offset to di_node structures
2210Sstevel@tonic-gate 	 */
2220Sstevel@tonic-gate 	di_off_t self;		/* make it self addressable */
2230Sstevel@tonic-gate 	di_off_t parent;	/* offset of parent node */
2240Sstevel@tonic-gate 	di_off_t child;		/* offset of child node */
2250Sstevel@tonic-gate 	di_off_t sibling;	/* offset of sibling */
2260Sstevel@tonic-gate 	di_off_t next;		/* next node on per-instance list */
2270Sstevel@tonic-gate 	/*
2280Sstevel@tonic-gate 	 * offset to char strings of current node
2290Sstevel@tonic-gate 	 */
2300Sstevel@tonic-gate 	di_off_t node_name;	/* offset of device node name */
2310Sstevel@tonic-gate 	di_off_t address;	/* offset of address part of name */
2320Sstevel@tonic-gate 	di_off_t bind_name;	/* offset of binding name */
2330Sstevel@tonic-gate 	di_off_t compat_names;	/* offset of compatible names */
2340Sstevel@tonic-gate 	/*
2350Sstevel@tonic-gate 	 * offset to property lists, private data, etc.
2360Sstevel@tonic-gate 	 */
2370Sstevel@tonic-gate 	di_off_t minor_data;
2380Sstevel@tonic-gate 	di_off_t drv_prop;
2390Sstevel@tonic-gate 	di_off_t sys_prop;
2400Sstevel@tonic-gate 	di_off_t glob_prop;
2410Sstevel@tonic-gate 	di_off_t hw_prop;
2420Sstevel@tonic-gate 	di_off_t parent_data;
2430Sstevel@tonic-gate 	di_off_t driver_data;
2440Sstevel@tonic-gate 	di_off_t multipath_client;
2450Sstevel@tonic-gate 	di_off_t multipath_phci;
2460Sstevel@tonic-gate 	di_off_t devid;		/* registered device id */
2470Sstevel@tonic-gate 	di_off_t pm_info;	/* RESERVED FOR FUTURE USE */
2480Sstevel@tonic-gate 	/*
2490Sstevel@tonic-gate 	 * misc values
2500Sstevel@tonic-gate 	 */
2510Sstevel@tonic-gate 	int compat_length;	/* size of compatible name list */
2520Sstevel@tonic-gate 	int drv_major;		/* for indexing into devnames array */
2530Sstevel@tonic-gate 	/*
2540Sstevel@tonic-gate 	 * value attributes of current node
2550Sstevel@tonic-gate 	 */
2560Sstevel@tonic-gate 	int instance;		/* instance number */
2570Sstevel@tonic-gate 	int nodeid;		/* node id */
2580Sstevel@tonic-gate 	ddi_node_class_t node_class;	/* node class */
2590Sstevel@tonic-gate 	int attributes;		/* node attributes */
2600Sstevel@tonic-gate 	uint_t state;		/* hotplugging device state */
2610Sstevel@tonic-gate 	ddi_node_state_t node_state;	/* devinfo state */
2620Sstevel@tonic-gate 
2630Sstevel@tonic-gate 	di_off_t lnodes;	/* lnodes associated with this di_node */
2640Sstevel@tonic-gate 	di_off_t tgt_links;
2650Sstevel@tonic-gate 	di_off_t src_links;
2660Sstevel@tonic-gate 
267893Srs135747 	uint32_t di_pad1;	/* 4 byte padding for 32bit x86 app. */
268893Srs135747 	uint64_t user_private_data;
269893Srs135747 	/*
270893Srs135747 	 * offset to link vhci/phci nodes.
271893Srs135747 	 */
272893Srs135747 	di_off_t next_vhci;
273893Srs135747 	di_off_t top_phci;
274893Srs135747 	di_off_t next_phci;
275893Srs135747 	uint32_t multipath_component;	/* stores MDI_COMPONENT_* value. */
2764444Svikram 	/*
2774444Svikram 	 * devi_flags field
2784444Svikram 	 */
2794444Svikram 	uint32_t flags;
2804444Svikram 	uint32_t di_pad2;	/* 4 byte padding for 32bit x86 app. */
281*10923SEvan.Yan@Sun.COM 	/*
282*10923SEvan.Yan@Sun.COM 	 * offset to hotplug nodes.
283*10923SEvan.Yan@Sun.COM 	 */
284*10923SEvan.Yan@Sun.COM 	di_off_t hp_data;
2850Sstevel@tonic-gate };
2860Sstevel@tonic-gate 
2870Sstevel@tonic-gate /*
2880Sstevel@tonic-gate  * chain of ddi_minor_data structure
2890Sstevel@tonic-gate  */
2900Sstevel@tonic-gate struct di_minor {
2910Sstevel@tonic-gate 	di_off_t	self;		/* make it self addressable */
2920Sstevel@tonic-gate 	di_off_t	next;		/* next one in the chain */
2930Sstevel@tonic-gate 	di_off_t	name;		/* name of node */
2940Sstevel@tonic-gate 	di_off_t	node_type;	/* block, byte, serial, network */
2950Sstevel@tonic-gate 	ddi_minor_type	type;		/* data type */
2960Sstevel@tonic-gate 	major_t		dev_major;	/* dev_t can be 64-bit */
2970Sstevel@tonic-gate 	minor_t		dev_minor;
2980Sstevel@tonic-gate 	int		spec_type;	/* block or char */
2990Sstevel@tonic-gate 	unsigned int	mdclass;	/* no longer used, may be removed */
3000Sstevel@tonic-gate 	di_off_t	node;		/* address of di_node */
3010Sstevel@tonic-gate 	uint64_t 	user_private_data;
3020Sstevel@tonic-gate };
3030Sstevel@tonic-gate 
3040Sstevel@tonic-gate typedef enum {
3050Sstevel@tonic-gate 	DI_PATH_STATE_UNKNOWN,
3060Sstevel@tonic-gate 	DI_PATH_STATE_OFFLINE,
3070Sstevel@tonic-gate 	DI_PATH_STATE_STANDBY,
3080Sstevel@tonic-gate 	DI_PATH_STATE_ONLINE,
3090Sstevel@tonic-gate 	DI_PATH_STATE_FAULT
3100Sstevel@tonic-gate } di_path_state_t;
3110Sstevel@tonic-gate 
3120Sstevel@tonic-gate /*
3130Sstevel@tonic-gate  * multipathing information structures
3140Sstevel@tonic-gate  */
3150Sstevel@tonic-gate struct di_path {
3160Sstevel@tonic-gate 	di_off_t	self;		/* make it self addressable */
3170Sstevel@tonic-gate 	di_off_t	path_c_link;	/* next pathinfo via client linkage */
3180Sstevel@tonic-gate 	di_off_t	path_p_link;	/* next pathinfo via phci linkage */
3190Sstevel@tonic-gate 	di_off_t	path_client;	/* reference to client node */
3200Sstevel@tonic-gate 	di_off_t	path_phci;	/* reference to phci node */
3210Sstevel@tonic-gate 	di_off_t	path_prop;	/* property list */
3220Sstevel@tonic-gate 	di_off_t	path_addr;	/* path addressing information */
3230Sstevel@tonic-gate 	di_path_state_t path_state;	/* path state */
3246640Scth 	uint_t		path_snap_state; /* describes valid fields */
3256640Scth 	int		path_instance;	/* path instance */
3266640Scth 	uint64_t 	user_private_data;
32710696SDavid.Hollister@Sun.COM 	uint_t		path_flags;	/* path flags */
3280Sstevel@tonic-gate };
3290Sstevel@tonic-gate 
3300Sstevel@tonic-gate /*
331*10923SEvan.Yan@Sun.COM  * chain of hotplug information structures
332*10923SEvan.Yan@Sun.COM  */
333*10923SEvan.Yan@Sun.COM struct di_hp {
334*10923SEvan.Yan@Sun.COM 	di_off_t	self;		/* make it self addressable */
335*10923SEvan.Yan@Sun.COM 	di_off_t	next;		/* next one in chain */
336*10923SEvan.Yan@Sun.COM 	di_off_t	hp_name;	/* name of hotplug connection */
337*10923SEvan.Yan@Sun.COM 	int		hp_connection;	/* connection number */
338*10923SEvan.Yan@Sun.COM 	int		hp_depends_on;	/* connection number depended upon */
339*10923SEvan.Yan@Sun.COM 	int		hp_state;	/* current hotplug state */
340*10923SEvan.Yan@Sun.COM 	int		hp_type;	/* connection type: PCI, ... */
341*10923SEvan.Yan@Sun.COM 	di_off_t	hp_type_str;	/* description of connection type */
342*10923SEvan.Yan@Sun.COM 	uint32_t	hp_last_change;	/* timestamp of last change */
343*10923SEvan.Yan@Sun.COM 	di_off_t	hp_child;	/* child device node */
344*10923SEvan.Yan@Sun.COM };
345*10923SEvan.Yan@Sun.COM 
346*10923SEvan.Yan@Sun.COM /*
3470Sstevel@tonic-gate  * Flags for snap_state
3480Sstevel@tonic-gate  */
3490Sstevel@tonic-gate #define	DI_PATH_SNAP_NOCLIENT	0x01	/* client endpt not in snapshot */
3500Sstevel@tonic-gate #define	DI_PATH_SNAP_NOPHCI	0x02	/* phci endpt not in snapshot */
3510Sstevel@tonic-gate #define	DI_PATH_SNAP_ENDPTS	0x04	/* Endpoints have been postprocessed */
3520Sstevel@tonic-gate 
3530Sstevel@tonic-gate #define	DI_PATH_SNAP_NOCLINK	0x10	/* client linkage not in snapshot */
3540Sstevel@tonic-gate #define	DI_PATH_SNAP_NOPLINK	0x20	/* phci linkage not in snapshot */
3550Sstevel@tonic-gate #define	DI_PATH_SNAP_LINKS	0x40	/* linkages have been postprocessed */
3560Sstevel@tonic-gate 
3570Sstevel@tonic-gate /*
35810696SDavid.Hollister@Sun.COM  * Flags for path_flags
35910696SDavid.Hollister@Sun.COM  */
36010696SDavid.Hollister@Sun.COM #define	DI_PATH_FLAGS_DEVICE_REMOVED	0x01	/* peer of DI_DEVICE_REMOVED */
36110696SDavid.Hollister@Sun.COM 
36210696SDavid.Hollister@Sun.COM /*
3630Sstevel@tonic-gate  * path properties
3640Sstevel@tonic-gate  */
3650Sstevel@tonic-gate struct di_path_prop {
3660Sstevel@tonic-gate 	di_off_t	self;		/* make it self addressable */
3670Sstevel@tonic-gate 	di_off_t	prop_next;	/* next property linkage */
3680Sstevel@tonic-gate 	di_off_t	prop_name;	/* property name */
3690Sstevel@tonic-gate 	di_off_t	prop_data;	/* property data */
3700Sstevel@tonic-gate 	int		prop_type;	/* property data type */
3710Sstevel@tonic-gate 	int		prop_len;	/* prop length in bytes */
3720Sstevel@tonic-gate };
3730Sstevel@tonic-gate 
3740Sstevel@tonic-gate /*
3750Sstevel@tonic-gate  * Now the properties.
3760Sstevel@tonic-gate  */
3770Sstevel@tonic-gate struct di_prop {
3780Sstevel@tonic-gate 	di_off_t	self;		/* make it self addressable */
3790Sstevel@tonic-gate 	di_off_t	next;
3800Sstevel@tonic-gate 	di_off_t	prop_name;	/* Property name */
3810Sstevel@tonic-gate 	di_off_t	prop_data;	/* property data */
3820Sstevel@tonic-gate 	major_t		dev_major;	/* dev_t can be 64 bit */
3830Sstevel@tonic-gate 	minor_t		dev_minor;
3847224Scth 	int		prop_flags;	/* mark prop value types & more */
3857224Scth 	int		prop_len;	/* prop len in bytes (boolean if 0) */
3867224Scth 	int		prop_list;	/* which list (DI_PROP_SYS_LIST), etc */
3870Sstevel@tonic-gate };
3880Sstevel@tonic-gate 
3890Sstevel@tonic-gate /*
3900Sstevel@tonic-gate  * Private data stuff for supporting prtconf.
3910Sstevel@tonic-gate  * Allows one level of indirection of fixed sized obj or obj array.
3920Sstevel@tonic-gate  * The array size may be an int member of the array.
3930Sstevel@tonic-gate  */
3940Sstevel@tonic-gate 
3950Sstevel@tonic-gate struct di_priv_format {
3960Sstevel@tonic-gate 	char drv_name[MAXPATHLEN];	/* name of parent drv for ppdata */
3970Sstevel@tonic-gate 	size_t bytes;			/* size in bytes of this struct */
3980Sstevel@tonic-gate 	struct {			/* ptrs to dereference */
3990Sstevel@tonic-gate 		int size;	/* size of object assoc. this ptr */
4000Sstevel@tonic-gate 		int offset;	/* location of pointer within struct */
4010Sstevel@tonic-gate 		int len_offset;	/* offset to var. containing the len */
4020Sstevel@tonic-gate 	} ptr[MAX_PTR_IN_PRV];
4030Sstevel@tonic-gate };
4040Sstevel@tonic-gate 
4050Sstevel@tonic-gate struct di_priv_data {
4060Sstevel@tonic-gate 	int version;
4070Sstevel@tonic-gate 	int n_parent;
4080Sstevel@tonic-gate 	int n_driver;
4090Sstevel@tonic-gate 	struct di_priv_format *parent;
4100Sstevel@tonic-gate 	struct di_priv_format *driver;
4110Sstevel@tonic-gate };
4120Sstevel@tonic-gate 
4130Sstevel@tonic-gate /*
4140Sstevel@tonic-gate  * structure passed in from ioctl
4150Sstevel@tonic-gate  */
4160Sstevel@tonic-gate struct dinfo_io {
4170Sstevel@tonic-gate 	char root_path[MAXPATHLEN];
4180Sstevel@tonic-gate 	struct di_priv_data priv;
4190Sstevel@tonic-gate };
4200Sstevel@tonic-gate 
4210Sstevel@tonic-gate #ifdef	__cplusplus
4220Sstevel@tonic-gate }
4230Sstevel@tonic-gate #endif
4240Sstevel@tonic-gate 
4250Sstevel@tonic-gate #endif	/* _SYS_DEVINFO_IMPL_H */
426