1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_DEVINFO_H
28 #define	_DEVINFO_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #include <mdb/mdb_modapi.h>
35 
36 /*
37  * Options for prtconf/devinfo/hotplug dcmd.
38  */
39 #define	DEVINFO_VERBOSE		0x1
40 #define	DEVINFO_PARENT		0x2
41 #define	DEVINFO_CHILD		0x4
42 #define	DEVINFO_ALLBOLD		0x8
43 #define	DEVINFO_SUMMARY		0x10
44 #define	DEVINFO_HP_PHYSICAL	0x20
45 #define	DEVINFO_PIPE		0x40
46 
47 typedef struct devinfo_cb_data {
48 	uintptr_t	di_base;
49 	uint_t		di_flags;
50 	char 		*di_filter;
51 } devinfo_cb_data_t;
52 
53 extern int devinfo_walk_init(mdb_walk_state_t *);
54 extern int devinfo_walk_step(mdb_walk_state_t *);
55 extern void devinfo_walk_fini(mdb_walk_state_t *);
56 
57 extern int devinfo_parents_walk_init(mdb_walk_state_t *);
58 extern int devinfo_parents_walk_step(mdb_walk_state_t *);
59 extern void devinfo_parents_walk_fini(mdb_walk_state_t *);
60 
61 extern int devinfo_children_walk_init(mdb_walk_state_t *);
62 extern int devinfo_children_walk_step(mdb_walk_state_t *);
63 extern void devinfo_children_walk_fini(mdb_walk_state_t *);
64 
65 extern int devinfo2driver(uintptr_t, uint_t, int, const mdb_arg_t *);
66 
67 extern int devnames_walk_init(mdb_walk_state_t *);
68 extern int devnames_walk_step(mdb_walk_state_t *);
69 extern void devnames_walk_fini(mdb_walk_state_t *);
70 
71 extern int devinfo_siblings_walk_init(mdb_walk_state_t *);
72 extern int devinfo_siblings_walk_step(mdb_walk_state_t *);
73 
74 extern int devi_next_walk_step(mdb_walk_state_t *);
75 
76 extern int prtconf(uintptr_t, uint_t, int, const mdb_arg_t *);
77 extern int devinfo(uintptr_t, uint_t, int, const mdb_arg_t *);
78 extern int modctl2devinfo(uintptr_t, uint_t, int, const mdb_arg_t *);
79 extern int devnames(uintptr_t, uint_t, int, const mdb_arg_t *);
80 extern int devbindings(uintptr_t, uint_t, int, const mdb_arg_t *);
81 extern int name2major(uintptr_t, uint_t, int, const mdb_arg_t *);
82 extern int major2name(uintptr_t, uint_t, int, const mdb_arg_t *);
83 extern int major2snode(uintptr_t, uint_t, int, const mdb_arg_t *);
84 extern int dev2major(uintptr_t, uint_t, int, const mdb_arg_t *);
85 extern int dev2minor(uintptr_t, uint_t, int, const mdb_arg_t *);
86 extern int dev2snode(uintptr_t, uint_t, int, const mdb_arg_t *);
87 extern int devt(uintptr_t, uint_t, int, const mdb_arg_t *);
88 extern int softstate(uintptr_t, uint_t, int, const mdb_arg_t *);
89 extern int devinfo_fm(uintptr_t, uint_t, int, const mdb_arg_t *);
90 extern int devinfo_fmce(uintptr_t, uint_t, int, const mdb_arg_t *);
91 
92 extern int soft_state_walk_init(mdb_walk_state_t *);
93 extern int soft_state_walk_step(mdb_walk_state_t *);
94 extern int soft_state_all_walk_step(mdb_walk_state_t *);
95 extern void soft_state_walk_fini(mdb_walk_state_t *);
96 
97 extern int devinfo_fmc_walk_init(mdb_walk_state_t *);
98 extern int devinfo_fmc_walk_step(mdb_walk_state_t *);
99 
100 extern int binding_hash_walk_init(mdb_walk_state_t *);
101 extern int binding_hash_walk_step(mdb_walk_state_t *);
102 extern void binding_hash_walk_fini(mdb_walk_state_t *);
103 extern int binding_hash_entry(uintptr_t, uint_t, int, const mdb_arg_t *);
104 
105 extern int devinfo_audit(uintptr_t, uint_t, int, const mdb_arg_t *);
106 
107 extern int devinfo_audit_log_walk_init(mdb_walk_state_t *);
108 extern int devinfo_audit_log_walk_step(mdb_walk_state_t *);
109 extern void devinfo_audit_log_walk_fini(mdb_walk_state_t *);
110 extern int devinfo_audit_log(uintptr_t, uint_t, int, const mdb_arg_t *);
111 
112 extern int devinfo_audit_node_walk_init(mdb_walk_state_t *);
113 extern int devinfo_audit_node_walk_step(mdb_walk_state_t *);
114 extern void devinfo_audit_node_walk_fini(mdb_walk_state_t *);
115 extern int devinfo_audit_node(uintptr_t, uint_t, int, const mdb_arg_t *);
116 
117 extern int minornode_walk_init(mdb_walk_state_t *);
118 extern int minornode_walk_step(mdb_walk_state_t *);
119 extern int minornodes(uintptr_t, uint_t, int, const mdb_arg_t *);
120 
121 extern void prtconf_help(void);
122 extern void devinfo_help(void);
123 
124 #ifdef	__cplusplus
125 }
126 #endif
127 
128 #endif	/* _DEVINFO_H */
129