xref: /onnv-gate/usr/src/uts/common/sys/devinfo_impl.h (revision 12116:ea985fb42600)
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 /*
22*12116SVikram.Hegde@Sun.COM  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
230Sstevel@tonic-gate  */
240Sstevel@tonic-gate 
250Sstevel@tonic-gate #ifndef	_SYS_DEVINFO_IMPL_H
260Sstevel@tonic-gate #define	_SYS_DEVINFO_IMPL_H
270Sstevel@tonic-gate 
289107Sjames.d.carlson@sun.com #include <sys/ddi_impldefs.h>
290Sstevel@tonic-gate 
300Sstevel@tonic-gate /*
310Sstevel@tonic-gate  * This file is separate from libdevinfo.h because the devinfo driver
320Sstevel@tonic-gate  * needs to know about the stuff. Library consumer should not care
330Sstevel@tonic-gate  * about stuff defined here.
340Sstevel@tonic-gate  *
350Sstevel@tonic-gate  * The only exception is di_priv_data (consolidation private) and
360Sstevel@tonic-gate  * DINFO* ioctls.
370Sstevel@tonic-gate  */
380Sstevel@tonic-gate 
390Sstevel@tonic-gate #ifdef	__cplusplus
400Sstevel@tonic-gate extern "C" {
410Sstevel@tonic-gate #endif
420Sstevel@tonic-gate 
430Sstevel@tonic-gate /* ioctl commands for devinfo driver */
440Sstevel@tonic-gate 
450Sstevel@tonic-gate #define	DIIOC		(0xdf<<8)
460Sstevel@tonic-gate #define	DIIOC_MASK	(0xffff00ff)
470Sstevel@tonic-gate 
480Sstevel@tonic-gate /*
490Sstevel@tonic-gate  * Any combination of the following ORed together will take a snapshot
500Sstevel@tonic-gate  * of the device configuration data.
510Sstevel@tonic-gate  */
520Sstevel@tonic-gate #define	DINFOSUBTREE	(DIIOC | 0x01)	/* include subtree */
530Sstevel@tonic-gate #define	DINFOMINOR	(DIIOC | 0x02)	/* include minor data */
540Sstevel@tonic-gate #define	DINFOPROP	(DIIOC | 0x04)	/* include properties */
556640Scth #define	DINFOPATH	(DIIOC | 0x08)	/* include i/o pathing information */
560Sstevel@tonic-gate 
570Sstevel@tonic-gate /* private bits */
580Sstevel@tonic-gate #define	DINFOPRIVDATA	(DIIOC | 0x10)	/* include private data */
590Sstevel@tonic-gate #define	DINFOFORCE	(DIIOC | 0x20)	/* force load all drivers */
600Sstevel@tonic-gate #define	DINFOCACHE	(DIIOC | 0x100000) /* use cached data  */
61878Sramat #define	DINFOCLEANUP	(DIIOC | 0x200000) /* cleanup /etc/devices files */
620Sstevel@tonic-gate 
630Sstevel@tonic-gate /* new public flag for the layered drivers framework */
640Sstevel@tonic-gate #define	DINFOLYR	(DIIOC | 0x40)	/* get device layering information */
650Sstevel@tonic-gate 
6610923SEvan.Yan@Sun.COM /* new public flag for the hotplug framework */
6710923SEvan.Yan@Sun.COM #define	DINFOHP		(DIIOC | 0x400000)  /* include hotplug information */
6810923SEvan.Yan@Sun.COM 
690Sstevel@tonic-gate /*
700Sstevel@tonic-gate  * Straight ioctl commands, not bitwise operation
710Sstevel@tonic-gate  */
720Sstevel@tonic-gate #define	DINFOUSRLD	(DIIOC | 0x80)	/* copy snapshot to usrland */
730Sstevel@tonic-gate #define	DINFOLODRV	(DIIOC | 0x81)	/* force load a driver */
740Sstevel@tonic-gate #define	DINFOIDENT	(DIIOC | 0x82)	/* identify the driver */
750Sstevel@tonic-gate 
760Sstevel@tonic-gate /*
770Sstevel@tonic-gate  * ioctl for taking a snapshot a single node and all nodes
780Sstevel@tonic-gate  */
790Sstevel@tonic-gate #define	DINFOCPYONE	DIIOC
800Sstevel@tonic-gate #define	DINFOCPYALL	(DINFOSUBTREE | DINFOPROP | DINFOMINOR)
810Sstevel@tonic-gate 
820Sstevel@tonic-gate #define	DI_MAGIC	0xdfdf	/* magic number returned by DINFOIDENT */
830Sstevel@tonic-gate 
840Sstevel@tonic-gate /* driver ops encoding */
850Sstevel@tonic-gate 
860Sstevel@tonic-gate #define	DI_BUS_OPS	0x1
870Sstevel@tonic-gate #define	DI_CB_OPS	0x2
880Sstevel@tonic-gate #define	DI_STREAM_OPS	0x4
890Sstevel@tonic-gate 
900Sstevel@tonic-gate /* property list enumeration */
910Sstevel@tonic-gate 
920Sstevel@tonic-gate #define	DI_PROP_DRV_LIST	0
930Sstevel@tonic-gate #define	DI_PROP_SYS_LIST	1
940Sstevel@tonic-gate #define	DI_PROP_GLB_LIST	2
950Sstevel@tonic-gate #define	DI_PROP_HW_LIST		3
960Sstevel@tonic-gate 
970Sstevel@tonic-gate /* misc parameters */
980Sstevel@tonic-gate 
990Sstevel@tonic-gate #define	MAX_TREE_DEPTH	64
1000Sstevel@tonic-gate #define	MAX_PTR_IN_PRV	5
1010Sstevel@tonic-gate #define	DI_SNAPSHOT_VERSION_0	0	/* reserved */
102893Srs135747 #define	DI_SNAPSHOT_VERSION_1	1	/* reserved */
1034444Svikram #define	DI_SNAPSHOT_VERSION_2	2	/* reserved */
1044444Svikram #define	DI_SNAPSHOT_VERSION	DI_SNAPSHOT_VERSION_2	/* current version */
1050Sstevel@tonic-gate #define	DI_PRIVDATA_VERSION_0	10	/* Start from 10 so caller must set */
1060Sstevel@tonic-gate #define	DI_BIG_ENDIAN		0	/* reserved */
1070Sstevel@tonic-gate #define	DI_LITTLE_ENDIAN	1	/* reserved */
1080Sstevel@tonic-gate 
1090Sstevel@tonic-gate #define	DI_CACHE_MAGIC		0xdfcac6ed	/* magic # for cache */
1100Sstevel@tonic-gate #define	DI_CACHE_PERMS		(0444)
111893Srs135747 #define	DI_CACHE_SNAPSHOT_FLAGS	\
112893Srs135747 	(DINFOFORCE|DINFOSUBTREE|DINFOMINOR|DINFOPROP|DINFOPATH)
1130Sstevel@tonic-gate 
1140Sstevel@tonic-gate #define	DI_NODE(addr)		((struct di_node *)((void *)(addr)))
1150Sstevel@tonic-gate #define	DI_MINOR(addr)		((struct di_minor *)((void *)(addr)))
1160Sstevel@tonic-gate #define	DI_PROP(addr)		((struct di_prop *)((void *)(addr)))
1170Sstevel@tonic-gate #define	DI_PATH(addr)		((struct di_path *)((void *)(addr)))
1180Sstevel@tonic-gate #define	DI_PATHPROP(addr)	((struct di_path_prop *)((void *)(addr)))
1190Sstevel@tonic-gate #define	DI_ALL(addr)		((struct di_all *)((void *)(addr)))
1200Sstevel@tonic-gate #define	DI_DEVNM(addr)		((struct di_devnm *)((void *)(addr)))
1210Sstevel@tonic-gate #define	DI_LINK(addr)		((struct di_link *)((void *)(addr)))
1220Sstevel@tonic-gate #define	DI_LNODE(addr)		((struct di_lnode *)((void *)(addr)))
1237224Scth #define	DI_PRIV_FORMAT(addr)	((struct di_priv_format *)((void *)(addr)))
12410923SEvan.Yan@Sun.COM #define	DI_HP(addr)		((struct di_hp *)((void *)(addr)))
125*12116SVikram.Hegde@Sun.COM #define	DI_ALIAS(addr)		((struct di_alias *)((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 */
149*12116SVikram.Hegde@Sun.COM 	di_off_t	top_devinfo;  /* actual top devinfo in snapshot */
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 */
154*12116SVikram.Hegde@Sun.COM 	di_off_t	aliases;	/* offset to alias tree */
1550Sstevel@tonic-gate 	int	n_ppdata;	/* size of ppdata_format array */
1560Sstevel@tonic-gate 	int	n_dpdata;	/* size of pddata_format array */
1570Sstevel@tonic-gate 	int	devcnt;		/* size of devnames array */
1580Sstevel@tonic-gate 	uint_t	command;	/* same as in di_init() */
1590Sstevel@tonic-gate 	uint_t	map_size;	/* size of the snapshot */
160*12116SVikram.Hegde@Sun.COM 	char	req_path[MAXPATHLEN];	/* path to requested root */
161*12116SVikram.Hegde@Sun.COM 	char	root_path[1];	/* path to actual snapshot root */
1620Sstevel@tonic-gate };
1630Sstevel@tonic-gate 
1640Sstevel@tonic-gate struct di_devnm {
1650Sstevel@tonic-gate 	di_off_t name;
1660Sstevel@tonic-gate 	di_off_t global_prop;
1670Sstevel@tonic-gate 	di_off_t head;	/* head of per instance list */
1680Sstevel@tonic-gate 	int flags;	/* driver attachment info */
1690Sstevel@tonic-gate 	int instance;	/* next instance to assign */
1700Sstevel@tonic-gate 	uint_t ops;	/* bit-encoded driver ops */
1710Sstevel@tonic-gate };
1720Sstevel@tonic-gate 
1730Sstevel@tonic-gate 
1740Sstevel@tonic-gate struct di_lnode;
1750Sstevel@tonic-gate 
1760Sstevel@tonic-gate struct di_link {
1770Sstevel@tonic-gate 	di_off_t	self;
1780Sstevel@tonic-gate 	int		count;
1790Sstevel@tonic-gate 	int		spec_type;	/* block or char access type */
1800Sstevel@tonic-gate 	di_off_t	src_lnode;	/* src di_lnode */
1810Sstevel@tonic-gate 	di_off_t	tgt_lnode;	/* tgt di_lnode */
1820Sstevel@tonic-gate 	di_off_t	src_link_next;	/* next src di_link /w same di_lnode */
1830Sstevel@tonic-gate 	di_off_t	tgt_link_next;	/* next tgt di_link /w same di_lnode */
1840Sstevel@tonic-gate 	di_off_t	src_node_next;	/* next src di_link /w same di_node */
1850Sstevel@tonic-gate 	di_off_t	tgt_node_next;	/* next tgt di_link /w same di_node */
1860Sstevel@tonic-gate 	uint64_t 	user_private_data;
1870Sstevel@tonic-gate };
1880Sstevel@tonic-gate 
1890Sstevel@tonic-gate struct di_lnode {
1900Sstevel@tonic-gate 	di_off_t	self;
1910Sstevel@tonic-gate 
1920Sstevel@tonic-gate 	/*
1930Sstevel@tonic-gate 	 * public information describing a link endpoint
1940Sstevel@tonic-gate 	 */
1950Sstevel@tonic-gate 	major_t		dev_major;	/* dev_t can be 64-bit */
1960Sstevel@tonic-gate 	minor_t		dev_minor;	/* dev_t can be 64-bit */
1970Sstevel@tonic-gate 	di_off_t	node;		/* offset of di_node */
1980Sstevel@tonic-gate 
1990Sstevel@tonic-gate 	/*
2000Sstevel@tonic-gate 	 * di_link ptr to links comming into this node
2010Sstevel@tonic-gate 	 * (this lnode is the target of these di_links)
2020Sstevel@tonic-gate 	 */
2030Sstevel@tonic-gate 	di_off_t	link_in;
2040Sstevel@tonic-gate 
2050Sstevel@tonic-gate 	/*
2060Sstevel@tonic-gate 	 * di_link ptr to links going out of this node
2070Sstevel@tonic-gate 	 * (this lnode is the source of these di_links)
2080Sstevel@tonic-gate 	 */
2090Sstevel@tonic-gate 	di_off_t	link_out;
2100Sstevel@tonic-gate 
2110Sstevel@tonic-gate 	/*
2120Sstevel@tonic-gate 	 * di_lnode pointer to the next lnode associated with the
2130Sstevel@tonic-gate 	 * same di_node
2140Sstevel@tonic-gate 	 */
2150Sstevel@tonic-gate 	di_off_t	node_next;
2160Sstevel@tonic-gate 
2170Sstevel@tonic-gate 	uint64_t 	user_private_data;
2180Sstevel@tonic-gate };
2190Sstevel@tonic-gate 
2200Sstevel@tonic-gate struct di_node {	/* useful info to export for each tree node */
2210Sstevel@tonic-gate 	/*
2220Sstevel@tonic-gate 	 * offset to di_node structures
2230Sstevel@tonic-gate 	 */
2240Sstevel@tonic-gate 	di_off_t self;		/* make it self addressable */
2250Sstevel@tonic-gate 	di_off_t parent;	/* offset of parent node */
2260Sstevel@tonic-gate 	di_off_t child;		/* offset of child node */
2270Sstevel@tonic-gate 	di_off_t sibling;	/* offset of sibling */
2280Sstevel@tonic-gate 	di_off_t next;		/* next node on per-instance list */
2290Sstevel@tonic-gate 	/*
2300Sstevel@tonic-gate 	 * offset to char strings of current node
2310Sstevel@tonic-gate 	 */
2320Sstevel@tonic-gate 	di_off_t node_name;	/* offset of device node name */
2330Sstevel@tonic-gate 	di_off_t address;	/* offset of address part of name */
2340Sstevel@tonic-gate 	di_off_t bind_name;	/* offset of binding name */
2350Sstevel@tonic-gate 	di_off_t compat_names;	/* offset of compatible names */
2360Sstevel@tonic-gate 	/*
2370Sstevel@tonic-gate 	 * offset to property lists, private data, etc.
2380Sstevel@tonic-gate 	 */
2390Sstevel@tonic-gate 	di_off_t minor_data;
2400Sstevel@tonic-gate 	di_off_t drv_prop;
2410Sstevel@tonic-gate 	di_off_t sys_prop;
2420Sstevel@tonic-gate 	di_off_t glob_prop;
2430Sstevel@tonic-gate 	di_off_t hw_prop;
2440Sstevel@tonic-gate 	di_off_t parent_data;
2450Sstevel@tonic-gate 	di_off_t driver_data;
2460Sstevel@tonic-gate 	di_off_t multipath_client;
2470Sstevel@tonic-gate 	di_off_t multipath_phci;
2480Sstevel@tonic-gate 	di_off_t devid;		/* registered device id */
2490Sstevel@tonic-gate 	di_off_t pm_info;	/* RESERVED FOR FUTURE USE */
2500Sstevel@tonic-gate 	/*
2510Sstevel@tonic-gate 	 * misc values
2520Sstevel@tonic-gate 	 */
2530Sstevel@tonic-gate 	int compat_length;	/* size of compatible name list */
2540Sstevel@tonic-gate 	int drv_major;		/* for indexing into devnames array */
2550Sstevel@tonic-gate 	/*
2560Sstevel@tonic-gate 	 * value attributes of current node
2570Sstevel@tonic-gate 	 */
2580Sstevel@tonic-gate 	int instance;		/* instance number */
2590Sstevel@tonic-gate 	int nodeid;		/* node id */
2600Sstevel@tonic-gate 	ddi_node_class_t node_class;	/* node class */
2610Sstevel@tonic-gate 	int attributes;		/* node attributes */
2620Sstevel@tonic-gate 	uint_t state;		/* hotplugging device state */
2630Sstevel@tonic-gate 	ddi_node_state_t node_state;	/* devinfo state */
2640Sstevel@tonic-gate 
2650Sstevel@tonic-gate 	di_off_t lnodes;	/* lnodes associated with this di_node */
2660Sstevel@tonic-gate 	di_off_t tgt_links;
2670Sstevel@tonic-gate 	di_off_t src_links;
2680Sstevel@tonic-gate 
269893Srs135747 	uint32_t di_pad1;	/* 4 byte padding for 32bit x86 app. */
270893Srs135747 	uint64_t user_private_data;
271893Srs135747 	/*
272893Srs135747 	 * offset to link vhci/phci nodes.
273893Srs135747 	 */
274893Srs135747 	di_off_t next_vhci;
275893Srs135747 	di_off_t top_phci;
276893Srs135747 	di_off_t next_phci;
277893Srs135747 	uint32_t multipath_component;	/* stores MDI_COMPONENT_* value. */
2784444Svikram 	/*
2794444Svikram 	 * devi_flags field
2804444Svikram 	 */
2814444Svikram 	uint32_t flags;
2824444Svikram 	uint32_t di_pad2;	/* 4 byte padding for 32bit x86 app. */
28310923SEvan.Yan@Sun.COM 	/*
28410923SEvan.Yan@Sun.COM 	 * offset to hotplug nodes.
28510923SEvan.Yan@Sun.COM 	 */
28610923SEvan.Yan@Sun.COM 	di_off_t hp_data;
2870Sstevel@tonic-gate };
2880Sstevel@tonic-gate 
2890Sstevel@tonic-gate /*
2900Sstevel@tonic-gate  * chain of ddi_minor_data structure
2910Sstevel@tonic-gate  */
2920Sstevel@tonic-gate struct di_minor {
2930Sstevel@tonic-gate 	di_off_t	self;		/* make it self addressable */
2940Sstevel@tonic-gate 	di_off_t	next;		/* next one in the chain */
2950Sstevel@tonic-gate 	di_off_t	name;		/* name of node */
2960Sstevel@tonic-gate 	di_off_t	node_type;	/* block, byte, serial, network */
2970Sstevel@tonic-gate 	ddi_minor_type	type;		/* data type */
2980Sstevel@tonic-gate 	major_t		dev_major;	/* dev_t can be 64-bit */
2990Sstevel@tonic-gate 	minor_t		dev_minor;
3000Sstevel@tonic-gate 	int		spec_type;	/* block or char */
3010Sstevel@tonic-gate 	unsigned int	mdclass;	/* no longer used, may be removed */
3020Sstevel@tonic-gate 	di_off_t	node;		/* address of di_node */
3030Sstevel@tonic-gate 	uint64_t 	user_private_data;
3040Sstevel@tonic-gate };
3050Sstevel@tonic-gate 
3060Sstevel@tonic-gate typedef enum {
3070Sstevel@tonic-gate 	DI_PATH_STATE_UNKNOWN,
3080Sstevel@tonic-gate 	DI_PATH_STATE_OFFLINE,
3090Sstevel@tonic-gate 	DI_PATH_STATE_STANDBY,
3100Sstevel@tonic-gate 	DI_PATH_STATE_ONLINE,
3110Sstevel@tonic-gate 	DI_PATH_STATE_FAULT
3120Sstevel@tonic-gate } di_path_state_t;
3130Sstevel@tonic-gate 
3140Sstevel@tonic-gate /*
3150Sstevel@tonic-gate  * multipathing information structures
3160Sstevel@tonic-gate  */
3170Sstevel@tonic-gate struct di_path {
3180Sstevel@tonic-gate 	di_off_t	self;		/* make it self addressable */
3190Sstevel@tonic-gate 	di_off_t	path_c_link;	/* next pathinfo via client linkage */
3200Sstevel@tonic-gate 	di_off_t	path_p_link;	/* next pathinfo via phci linkage */
3210Sstevel@tonic-gate 	di_off_t	path_client;	/* reference to client node */
3220Sstevel@tonic-gate 	di_off_t	path_phci;	/* reference to phci node */
3230Sstevel@tonic-gate 	di_off_t	path_prop;	/* property list */
3240Sstevel@tonic-gate 	di_off_t	path_addr;	/* path addressing information */
3250Sstevel@tonic-gate 	di_path_state_t path_state;	/* path state */
3266640Scth 	uint_t		path_snap_state; /* describes valid fields */
3276640Scth 	int		path_instance;	/* path instance */
3286640Scth 	uint64_t 	user_private_data;
32910696SDavid.Hollister@Sun.COM 	uint_t		path_flags;	/* path flags */
3300Sstevel@tonic-gate };
3310Sstevel@tonic-gate 
3320Sstevel@tonic-gate /*
33310923SEvan.Yan@Sun.COM  * chain of hotplug information structures
33410923SEvan.Yan@Sun.COM  */
33510923SEvan.Yan@Sun.COM struct di_hp {
33610923SEvan.Yan@Sun.COM 	di_off_t	self;		/* make it self addressable */
33710923SEvan.Yan@Sun.COM 	di_off_t	next;		/* next one in chain */
33810923SEvan.Yan@Sun.COM 	di_off_t	hp_name;	/* name of hotplug connection */
33910923SEvan.Yan@Sun.COM 	int		hp_connection;	/* connection number */
34010923SEvan.Yan@Sun.COM 	int		hp_depends_on;	/* connection number depended upon */
34110923SEvan.Yan@Sun.COM 	int		hp_state;	/* current hotplug state */
34210923SEvan.Yan@Sun.COM 	int		hp_type;	/* connection type: PCI, ... */
34310923SEvan.Yan@Sun.COM 	di_off_t	hp_type_str;	/* description of connection type */
34410923SEvan.Yan@Sun.COM 	uint32_t	hp_last_change;	/* timestamp of last change */
34510923SEvan.Yan@Sun.COM 	di_off_t	hp_child;	/* child device node */
34610923SEvan.Yan@Sun.COM };
34710923SEvan.Yan@Sun.COM 
34810923SEvan.Yan@Sun.COM /*
3490Sstevel@tonic-gate  * Flags for snap_state
3500Sstevel@tonic-gate  */
3510Sstevel@tonic-gate #define	DI_PATH_SNAP_NOCLIENT	0x01	/* client endpt not in snapshot */
3520Sstevel@tonic-gate #define	DI_PATH_SNAP_NOPHCI	0x02	/* phci endpt not in snapshot */
3530Sstevel@tonic-gate #define	DI_PATH_SNAP_ENDPTS	0x04	/* Endpoints have been postprocessed */
3540Sstevel@tonic-gate 
3550Sstevel@tonic-gate #define	DI_PATH_SNAP_NOCLINK	0x10	/* client linkage not in snapshot */
3560Sstevel@tonic-gate #define	DI_PATH_SNAP_NOPLINK	0x20	/* phci linkage not in snapshot */
3570Sstevel@tonic-gate #define	DI_PATH_SNAP_LINKS	0x40	/* linkages have been postprocessed */
3580Sstevel@tonic-gate 
3590Sstevel@tonic-gate /*
36010696SDavid.Hollister@Sun.COM  * Flags for path_flags
36110696SDavid.Hollister@Sun.COM  */
36210696SDavid.Hollister@Sun.COM #define	DI_PATH_FLAGS_DEVICE_REMOVED	0x01	/* peer of DI_DEVICE_REMOVED */
36310696SDavid.Hollister@Sun.COM 
36410696SDavid.Hollister@Sun.COM /*
3650Sstevel@tonic-gate  * path properties
3660Sstevel@tonic-gate  */
3670Sstevel@tonic-gate struct di_path_prop {
3680Sstevel@tonic-gate 	di_off_t	self;		/* make it self addressable */
3690Sstevel@tonic-gate 	di_off_t	prop_next;	/* next property linkage */
3700Sstevel@tonic-gate 	di_off_t	prop_name;	/* property name */
3710Sstevel@tonic-gate 	di_off_t	prop_data;	/* property data */
3720Sstevel@tonic-gate 	int		prop_type;	/* property data type */
3730Sstevel@tonic-gate 	int		prop_len;	/* prop length in bytes */
3740Sstevel@tonic-gate };
3750Sstevel@tonic-gate 
3760Sstevel@tonic-gate /*
3770Sstevel@tonic-gate  * Now the properties.
3780Sstevel@tonic-gate  */
3790Sstevel@tonic-gate struct di_prop {
3800Sstevel@tonic-gate 	di_off_t	self;		/* make it self addressable */
3810Sstevel@tonic-gate 	di_off_t	next;
3820Sstevel@tonic-gate 	di_off_t	prop_name;	/* Property name */
3830Sstevel@tonic-gate 	di_off_t	prop_data;	/* property data */
3840Sstevel@tonic-gate 	major_t		dev_major;	/* dev_t can be 64 bit */
3850Sstevel@tonic-gate 	minor_t		dev_minor;
3867224Scth 	int		prop_flags;	/* mark prop value types & more */
3877224Scth 	int		prop_len;	/* prop len in bytes (boolean if 0) */
3887224Scth 	int		prop_list;	/* which list (DI_PROP_SYS_LIST), etc */
3890Sstevel@tonic-gate };
3900Sstevel@tonic-gate 
3910Sstevel@tonic-gate /*
3920Sstevel@tonic-gate  * Private data stuff for supporting prtconf.
3930Sstevel@tonic-gate  * Allows one level of indirection of fixed sized obj or obj array.
3940Sstevel@tonic-gate  * The array size may be an int member of the array.
3950Sstevel@tonic-gate  */
3960Sstevel@tonic-gate 
3970Sstevel@tonic-gate struct di_priv_format {
3980Sstevel@tonic-gate 	char drv_name[MAXPATHLEN];	/* name of parent drv for ppdata */
3990Sstevel@tonic-gate 	size_t bytes;			/* size in bytes of this struct */
4000Sstevel@tonic-gate 	struct {			/* ptrs to dereference */
4010Sstevel@tonic-gate 		int size;	/* size of object assoc. this ptr */
4020Sstevel@tonic-gate 		int offset;	/* location of pointer within struct */
4030Sstevel@tonic-gate 		int len_offset;	/* offset to var. containing the len */
4040Sstevel@tonic-gate 	} ptr[MAX_PTR_IN_PRV];
4050Sstevel@tonic-gate };
4060Sstevel@tonic-gate 
4070Sstevel@tonic-gate struct di_priv_data {
4080Sstevel@tonic-gate 	int version;
4090Sstevel@tonic-gate 	int n_parent;
4100Sstevel@tonic-gate 	int n_driver;
4110Sstevel@tonic-gate 	struct di_priv_format *parent;
4120Sstevel@tonic-gate 	struct di_priv_format *driver;
4130Sstevel@tonic-gate };
4140Sstevel@tonic-gate 
415*12116SVikram.Hegde@Sun.COM 
416*12116SVikram.Hegde@Sun.COM /*
417*12116SVikram.Hegde@Sun.COM  * structure for saving alias information
418*12116SVikram.Hegde@Sun.COM  */
419*12116SVikram.Hegde@Sun.COM struct di_alias {
420*12116SVikram.Hegde@Sun.COM 	di_off_t	self;		/* make it self addressable */
421*12116SVikram.Hegde@Sun.COM 	di_off_t	curroff;	/* offset to curr dip's snapshot */
422*12116SVikram.Hegde@Sun.COM 	di_off_t	next;		/* next alias */
423*12116SVikram.Hegde@Sun.COM 	char		alias[1];	/* alias path */
424*12116SVikram.Hegde@Sun.COM };
425*12116SVikram.Hegde@Sun.COM 
4260Sstevel@tonic-gate /*
4270Sstevel@tonic-gate  * structure passed in from ioctl
4280Sstevel@tonic-gate  */
4290Sstevel@tonic-gate struct dinfo_io {
4300Sstevel@tonic-gate 	char root_path[MAXPATHLEN];
4310Sstevel@tonic-gate 	struct di_priv_data priv;
4320Sstevel@tonic-gate };
4330Sstevel@tonic-gate 
4340Sstevel@tonic-gate #ifdef	__cplusplus
4350Sstevel@tonic-gate }
4360Sstevel@tonic-gate #endif
4370Sstevel@tonic-gate 
4380Sstevel@tonic-gate #endif	/* _SYS_DEVINFO_IMPL_H */
439