5525 Update hwdata - 20150111
[illumos-gate.git] / usr / src / lib / librcm / librcm.h
blob5c105fd173cb62ceb980d0116fc59e3c42db6ce1
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _LIBRCM_H
27 #define _LIBRCM_H
29 #include <libnvpair.h>
30 #include <sys/types.h>
31 #include <sys/processor.h>
32 #include <sys/pset.h>
33 #include <sys/time_impl.h>
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
40 * Flags for rcm requests
42 #define RCM_INCLUDE_SUBTREE 0x0001
43 #define RCM_INCLUDE_DEPENDENT 0x0002
44 #define RCM_QUERY 0x0004
45 #define RCM_FORCE 0x0008
46 #define RCM_FILESYS 0x0010 /* private to filesys module */
47 #define RCM_NOPID 0x0020
48 #define RCM_DR_OPERATION 0x0040
49 #define RCM_MOD_INFO 0x0080 /* private */
50 #define RCM_CAPACITY_ADD 0x0100
51 #define RCM_CAPACITY_DELETE 0x0200
52 #define RCM_QUERY_CANCEL 0x0400 /* private */
53 #define RCM_SCOPE 0x0800
54 #define RCM_REGISTER_DR 0x1000 /* private */
55 #define RCM_REGISTER_EVENT 0x2000 /* private */
56 #define RCM_REGISTER_CAPACITY 0x4000 /* private */
57 #define RCM_SUSPENDED 0x8000 /* private */
58 #define RCM_RETIRE_REQUEST 0x10000
59 #define RCM_RETIRE_NOTIFY 0x20000
62 * RCM return values
64 #define RCM_SUCCESS 0
65 #define RCM_FAILURE -1
66 #define RCM_CONFLICT -2
67 #define RCM_NO_CONSTRAINT -3
70 * RCM resource states
72 #define RCM_STATE_UNKNOWN 0
73 #define RCM_STATE_ONLINE 1
74 #define RCM_STATE_ONLINING 2
75 #define RCM_STATE_OFFLINE_FAIL 3
76 #define RCM_STATE_OFFLINING 4
77 #define RCM_STATE_OFFLINE 5
78 #define RCM_STATE_REMOVING 6
79 #define RCM_STATE_RESUMING 10
80 #define RCM_STATE_SUSPEND_FAIL 11
81 #define RCM_STATE_SUSPENDING 12
82 #define RCM_STATE_SUSPEND 13
83 #define RCM_STATE_REMOVE 14 /* private to rcm_daemon */
84 #define RCM_STATE_OFFLINE_QUERYING 15
85 #define RCM_STATE_OFFLINE_QUERY_FAIL 16
86 #define RCM_STATE_OFFLINE_QUERY 17
87 #define RCM_STATE_SUSPEND_QUERYING 18
88 #define RCM_STATE_SUSPEND_QUERY_FAIL 19
89 #define RCM_STATE_SUSPEND_QUERY 20
92 * RCM event attr and properties
94 #define RCM_RSRCNAME "rcm.rsrcname"
95 #define RCM_CLIENT_NAME "rcm.client_name"
96 #define RCM_CLIENT_EXPORTS "rcm.client_exports"
98 /* Resource name to register for new links reconfigured */
99 #define RCM_RESOURCE_LINK_NEW "SUNW_event/resource/new/link"
101 /* Resource name to register for new physical data-links */
102 #define RCM_RESOURCE_PHYSLINK_NEW "SUNW_event/resource/new/physlink"
104 /* name-value pair definitions for rcm_notify_event() */
105 #define RCM_NV_LINKID "linkid"
106 #define RCM_NV_RECONFIGURED "reconfigured"
109 * rcm handles
111 typedef struct rcm_handle rcm_handle_t;
112 typedef struct rcm_info rcm_info_t;
113 typedef rcm_info_t rcm_info_tuple_t;
116 * Interface definitions
118 int rcm_alloc_handle(char *, uint_t, void *, rcm_handle_t **);
119 int rcm_free_handle(rcm_handle_t *);
120 int rcm_get_info(rcm_handle_t *, char *, uint_t, rcm_info_t **);
121 int rcm_get_info_list(rcm_handle_t *, char **, uint_t, rcm_info_t **);
122 void rcm_free_info(rcm_info_t *);
123 int rcm_append_info(rcm_info_t **, rcm_info_t *);
124 rcm_info_tuple_t *rcm_info_next(rcm_info_t *, rcm_info_tuple_t *);
125 const char *rcm_info_rsrc(rcm_info_tuple_t *);
126 const char *rcm_info_info(rcm_info_tuple_t *);
127 const char *rcm_info_error(rcm_info_tuple_t *);
128 const char *rcm_info_modname(rcm_info_tuple_t *);
129 pid_t rcm_info_pid(rcm_info_tuple_t *);
130 int rcm_info_state(rcm_info_tuple_t *);
131 int rcm_info_seqnum(rcm_info_tuple_t *);
132 nvlist_t *rcm_info_properties(rcm_info_tuple_t *);
134 int rcm_request_offline(rcm_handle_t *, char *, uint_t, rcm_info_t **);
135 int rcm_request_offline_list(rcm_handle_t *, char **, uint_t, rcm_info_t **);
136 int rcm_notify_online(rcm_handle_t *, char *, uint_t, rcm_info_t **);
137 int rcm_notify_online_list(rcm_handle_t *, char **, uint_t, rcm_info_t **);
138 int rcm_notify_remove(rcm_handle_t *, char *, uint_t, rcm_info_t **);
139 int rcm_notify_remove_list(rcm_handle_t *, char **, uint_t, rcm_info_t **);
140 int rcm_request_suspend(rcm_handle_t *, char *, uint_t, timespec_t *,
141 rcm_info_t **);
142 int rcm_request_suspend_list(rcm_handle_t *, char **, uint_t, timespec_t *,
143 rcm_info_t **);
144 int rcm_notify_resume(rcm_handle_t *, char *, uint_t, rcm_info_t **);
145 int rcm_notify_resume_list(rcm_handle_t *, char **, uint_t, rcm_info_t **);
146 int rcm_notify_capacity_change(rcm_handle_t *, char *, uint_t, nvlist_t *,
147 rcm_info_t **);
148 int rcm_request_capacity_change(rcm_handle_t *, char *, uint_t, nvlist_t *,
149 rcm_info_t **);
150 int rcm_notify_event(rcm_handle_t *, char *, uint_t, nvlist_t *, rcm_info_t **);
152 int rcm_register_event(rcm_handle_t *, char *, uint_t, rcm_info_t **);
153 int rcm_register_capacity(rcm_handle_t *, char *, uint_t, rcm_info_t **);
154 int rcm_register_interest(rcm_handle_t *, char *, uint_t, rcm_info_t **);
155 int rcm_unregister_event(rcm_handle_t *, char *, uint_t);
156 int rcm_unregister_capacity(rcm_handle_t *, char *, uint_t);
157 int rcm_unregister_interest(rcm_handle_t *, char *, uint_t);
159 int rcm_get_rsrcstate(rcm_handle_t *, char *, int *);
160 int rcm_exec_cmd(char *);
161 const char *rcm_get_client_name(rcm_handle_t *);
163 #ifdef __cplusplus
165 #endif
167 #endif /* _LIBRCM_H */