xref: /titanic_51/usr/src/cmd/hotplugd/hotplugd_impl.h (revision 269473047d747f7815af570197e4ef7322d3632c)
1*26947304SEvan Yan /*
2*26947304SEvan Yan  * CDDL HEADER START
3*26947304SEvan Yan  *
4*26947304SEvan Yan  * The contents of this file are subject to the terms of the
5*26947304SEvan Yan  * Common Development and Distribution License (the "License").
6*26947304SEvan Yan  * You may not use this file except in compliance with the License.
7*26947304SEvan Yan  *
8*26947304SEvan Yan  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*26947304SEvan Yan  * or http://www.opensolaris.org/os/licensing.
10*26947304SEvan Yan  * See the License for the specific language governing permissions
11*26947304SEvan Yan  * and limitations under the License.
12*26947304SEvan Yan  *
13*26947304SEvan Yan  * When distributing Covered Code, include this CDDL HEADER in each
14*26947304SEvan Yan  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*26947304SEvan Yan  * If applicable, add the following below this CDDL HEADER, with the
16*26947304SEvan Yan  * fields enclosed by brackets "[]" replaced with your own identifying
17*26947304SEvan Yan  * information: Portions Copyright [yyyy] [name of copyright owner]
18*26947304SEvan Yan  *
19*26947304SEvan Yan  * CDDL HEADER END
20*26947304SEvan Yan  */
21*26947304SEvan Yan 
22*26947304SEvan Yan /*
23*26947304SEvan Yan  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24*26947304SEvan Yan  * Use is subject to license terms.
25*26947304SEvan Yan  */
26*26947304SEvan Yan 
27*26947304SEvan Yan #ifndef	_HOTPLUGD_IMPL_H
28*26947304SEvan Yan #define	_HOTPLUGD_IMPL_H
29*26947304SEvan Yan 
30*26947304SEvan Yan #ifdef  __cplusplus
31*26947304SEvan Yan extern "C" {
32*26947304SEvan Yan #endif
33*26947304SEvan Yan 
34*26947304SEvan Yan /*
35*26947304SEvan Yan  * Define macros to test connection states.
36*26947304SEvan Yan  */
37*26947304SEvan Yan #define	HP_IS_ENABLED(s)	(s == DDI_HP_CN_STATE_ENABLED)
38*26947304SEvan Yan 
39*26947304SEvan Yan #define	HP_IS_ONLINE(s)		((s == DDI_HP_CN_STATE_ONLINE) || \
40*26947304SEvan Yan 				(s == DDI_HP_CN_STATE_MAINTENANCE))
41*26947304SEvan Yan 
42*26947304SEvan Yan #define	HP_IS_OFFLINE(s)	((s == DDI_HP_CN_STATE_PORT_EMPTY) || \
43*26947304SEvan Yan 				(s == DDI_HP_CN_STATE_PORT_PRESENT) || \
44*26947304SEvan Yan 				(s == DDI_HP_CN_STATE_OFFLINE))
45*26947304SEvan Yan 
46*26947304SEvan Yan /*
47*26947304SEvan Yan  * Define size of nvlist buffer for set/get commands.
48*26947304SEvan Yan  */
49*26947304SEvan Yan #define	HP_PRIVATE_BUF_SZ	4096
50*26947304SEvan Yan 
51*26947304SEvan Yan /*
52*26947304SEvan Yan  * Define a string for parsing /devices paths.
53*26947304SEvan Yan  */
54*26947304SEvan Yan #define	S_DEVICES		"/devices"
55*26947304SEvan Yan 
56*26947304SEvan Yan /*
57*26947304SEvan Yan  * Global functions.
58*26947304SEvan Yan  */
59*26947304SEvan Yan void		log_err(char *fmt, ...);
60*26947304SEvan Yan void		log_info(char *fmt, ...);
61*26947304SEvan Yan void		dprintf(char *fmt, ...);
62*26947304SEvan Yan boolean_t	door_server_init(void);
63*26947304SEvan Yan void		door_server_fini(void);
64*26947304SEvan Yan int		getinfo(const char *path, const char *connection, uint_t flags,
65*26947304SEvan Yan 		    hp_node_t *rootp);
66*26947304SEvan Yan int		changestate(const char *path, const char *connection, int state,
67*26947304SEvan Yan 		    uint_t flags, int *old_statep, hp_node_t *resultsp);
68*26947304SEvan Yan int		private_options(const char *path, const char *connection,
69*26947304SEvan Yan 		    hp_cmd_t cmd, const char *options, char **resultsp);
70*26947304SEvan Yan int		copy_usage(hp_node_t root);
71*26947304SEvan Yan int		rcm_resources(hp_node_t root, char ***rsrcsp);
72*26947304SEvan Yan void		free_rcm_resources(char **rsrcs);
73*26947304SEvan Yan int		rcm_offline(char **rsrcs, uint_t flags, hp_node_t root);
74*26947304SEvan Yan void		rcm_online(char **rsrcs);
75*26947304SEvan Yan void		rcm_remove(char **rsrcs);
76*26947304SEvan Yan 
77*26947304SEvan Yan #ifdef  __cplusplus
78*26947304SEvan Yan }
79*26947304SEvan Yan #endif
80*26947304SEvan Yan 
81*26947304SEvan Yan #endif	/* _HOTPLUGD_IMPL_H */
82