xref: /illumos-gate/usr/src/cmd/mdb/common/modules/genunix/devinfo.h (revision 1fa2a66491e7d8ae0be84e7da4da8e812480c710)
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  * Copyright 2019, Joyent, Inc.
26  */
27 
28 #ifndef	_DEVINFO_H
29 #define	_DEVINFO_H
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #include <mdb/mdb_modapi.h>
36 
37 /*
38  * Options for prtconf/devinfo/hotplug dcmd.
39  */
40 #define	DEVINFO_VERBOSE		0x1
41 #define	DEVINFO_PARENT		0x2
42 #define	DEVINFO_CHILD		0x4
43 #define	DEVINFO_ALLBOLD		0x8
44 #define	DEVINFO_SUMMARY		0x10
45 #define	DEVINFO_HP_PHYSICAL	0x20
46 #define	DEVINFO_PIPE		0x40
47 #define	DEVINFO_DRIVER		0x80
48 
49 typedef struct devinfo_cb_data {
50 	uintptr_t	di_base;
51 	uint_t		di_flags;
52 	char		*di_filter;
53 	uint64_t	di_instance;
54 } devinfo_cb_data_t;
55 
56 extern int devinfo_walk_init(mdb_walk_state_t *);
57 extern int devinfo_walk_step(mdb_walk_state_t *);
58 extern void devinfo_walk_fini(mdb_walk_state_t *);
59 
60 extern int devinfo_parents_walk_init(mdb_walk_state_t *);
61 extern int devinfo_parents_walk_step(mdb_walk_state_t *);
62 extern void devinfo_parents_walk_fini(mdb_walk_state_t *);
63 
64 extern int devinfo_children_walk_init(mdb_walk_state_t *);
65 extern int devinfo_children_walk_step(mdb_walk_state_t *);
66 extern void devinfo_children_walk_fini(mdb_walk_state_t *);
67 
68 extern int devinfo2driver(uintptr_t, uint_t, int, const mdb_arg_t *);
69 
70 extern int devnames_walk_init(mdb_walk_state_t *);
71 extern int devnames_walk_step(mdb_walk_state_t *);
72 extern void devnames_walk_fini(mdb_walk_state_t *);
73 
74 extern int devinfo_siblings_walk_init(mdb_walk_state_t *);
75 extern int devinfo_siblings_walk_step(mdb_walk_state_t *);
76 
77 extern int devi_next_walk_step(mdb_walk_state_t *);
78 
79 extern int prtconf(uintptr_t, uint_t, int, const mdb_arg_t *);
80 extern int devinfo(uintptr_t, uint_t, int, const mdb_arg_t *);
81 extern int modctl2devinfo(uintptr_t, uint_t, int, const mdb_arg_t *);
82 extern int devnames(uintptr_t, uint_t, int, const mdb_arg_t *);
83 extern int devbindings(uintptr_t, uint_t, int, const mdb_arg_t *);
84 extern int name2major(uintptr_t, uint_t, int, const mdb_arg_t *);
85 extern int major2name(uintptr_t, uint_t, int, const mdb_arg_t *);
86 extern int major2snode(uintptr_t, uint_t, int, const mdb_arg_t *);
87 extern int dev2major(uintptr_t, uint_t, int, const mdb_arg_t *);
88 extern int dev2minor(uintptr_t, uint_t, int, const mdb_arg_t *);
89 extern int dev2snode(uintptr_t, uint_t, int, const mdb_arg_t *);
90 extern int devt(uintptr_t, uint_t, int, const mdb_arg_t *);
91 extern int softstate(uintptr_t, uint_t, int, const mdb_arg_t *);
92 extern int devinfo_fm(uintptr_t, uint_t, int, const mdb_arg_t *);
93 extern int devinfo_fmce(uintptr_t, uint_t, int, const mdb_arg_t *);
94 extern int devinfo2bus(uintptr_t, uint_t, int, const mdb_arg_t *);
95 
96 extern int soft_state_walk_init(mdb_walk_state_t *);
97 extern int soft_state_walk_step(mdb_walk_state_t *);
98 extern int soft_state_all_walk_step(mdb_walk_state_t *);
99 extern void soft_state_walk_fini(mdb_walk_state_t *);
100 
101 extern int devinfo_fmc_walk_init(mdb_walk_state_t *);
102 extern int devinfo_fmc_walk_step(mdb_walk_state_t *);
103 
104 extern int binding_hash_walk_init(mdb_walk_state_t *);
105 extern int binding_hash_walk_step(mdb_walk_state_t *);
106 extern void binding_hash_walk_fini(mdb_walk_state_t *);
107 extern int binding_hash_entry(uintptr_t, uint_t, int, const mdb_arg_t *);
108 
109 extern int devinfo_audit(uintptr_t, uint_t, int, const mdb_arg_t *);
110 
111 extern int devinfo_audit_log_walk_init(mdb_walk_state_t *);
112 extern int devinfo_audit_log_walk_step(mdb_walk_state_t *);
113 extern void devinfo_audit_log_walk_fini(mdb_walk_state_t *);
114 extern int devinfo_audit_log(uintptr_t, uint_t, int, const mdb_arg_t *);
115 
116 extern int devinfo_audit_node_walk_init(mdb_walk_state_t *);
117 extern int devinfo_audit_node_walk_step(mdb_walk_state_t *);
118 extern void devinfo_audit_node_walk_fini(mdb_walk_state_t *);
119 extern int devinfo_audit_node(uintptr_t, uint_t, int, const mdb_arg_t *);
120 
121 extern int minornode_walk_init(mdb_walk_state_t *);
122 extern int minornode_walk_step(mdb_walk_state_t *);
123 extern int minornodes(uintptr_t, uint_t, int, const mdb_arg_t *);
124 
125 extern void prtconf_help(void);
126 extern void devinfo_help(void);
127 extern void devinfo2bus_help(void);
128 
129 #ifdef	__cplusplus
130 }
131 #endif
132 
133 #endif	/* _DEVINFO_H */
134