4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
30 #pragma ident "%Z%%M% %I% %E% SMI"
36 #define DEVDIR "/devices"
40 void dbg(char *, ...);
57 * Some of the options are provided for testing purpose and
58 * will not published (e.g. err,code,mid).
60 #define OPT_UNASSIGN 0
62 #define OPT_PARSABLE 2
63 #define OPT_NOPOWEROFF 3
67 #define OPT_PLATFORM 7
69 #define OPT_SUSPEND_OK 9
70 #define OPT_LIST_ALL 29
72 #define OPT_VERBOSE 31
74 #define ap_getopt(a, o) ((a)->opts.flags & ((uint_t)1 << (o)))
75 #define ap_setopt(a, o) ((a)->opts.flags |= ((uint_t)1 << (o)))
89 * Attachment point descriptor.
91 * All commands are processed as follows:
93 * . allocate a command descriptor
94 * . parse the physical ap_id
95 * . parse the command and its options.
96 * . sequence if necessary (state change commands)
120 struct cfga_msg
*msgp
;
121 struct cfga_confirm
*confp
;
129 * Command definitions.
131 * The command order is significant. The sequenced (-c) commands
132 * are sorted in execution order. The configure command starts from
133 * assign and ends with online. The disconnect command starts
134 * from offline and goes to unassign. Steps in the sequencing may
135 * be optionally skipped.
138 #define CMD_POWERON 1
140 #define CMD_CONNECT 3
141 #define CMD_CONFIGURE 4
142 #define CMD_RCM_ONLINE 5
143 #define CMD_RCM_CAP_ADD 6
144 #define CMD_SUSPEND_CHECK 7
145 #define CMD_RCM_SUSPEND 8
146 #define CMD_RCM_CAP_DEL 9
147 #define CMD_RCM_OFFLINE 10
148 #define CMD_UNCONFIGURE 11
149 #define CMD_RCM_REMOVE 12
150 #define CMD_RCM_CAP_NOTIFY 13
151 #define CMD_DISCONNECT 14
152 #define CMD_POWEROFF 15
153 #define CMD_UNASSIGN 16
154 #define CMD_RCM_RESUME 17
155 #define CMD_STATUS 18
156 #define CMD_GETNCM 19
157 #define CMD_PASSTHRU 20
159 #define CMD_ERRTEST 22
165 #define ERR_CMD_INVAL 0
166 #define ERR_CMD_FAIL 1
167 #define ERR_CMD_NACK 2
168 #define ERR_CMD_NOTSUPP 3
169 #define ERR_CMD_ABORT 4
170 #define ERR_OPT_INVAL 5
171 #define ERR_OPT_NOVAL 6
172 #define ERR_OPT_VAL 7
173 #define ERR_OPT_BADVAL 8
174 #define ERR_AP_INVAL 9
175 #define ERR_CM_INVAL 10
176 #define ERR_TRANS_INVAL 11
177 #define ERR_SIG_CHANGE 12
178 #define ERR_RCM_HANDLE 13
179 #define ERR_RCM_CMD 14
180 #define ERR_RCM_INFO 15
181 #define ERR_LIB_OPEN 16
182 #define ERR_LIB_SYM 17
185 #define ERR_PLUGIN 20
190 #define MSG_SUSPEND 2
197 #define s_free(x) (((x) != NULL) ? (free(x), (x) = NULL) : (void *)0)
198 #define str_valid(p) ((p) != NULL && *(p) != '\0')
199 #define mask(x) ((uint_t)1 << (x))
201 #define CM_DFLT -1 /* default (current) component */
204 int ap_parse(apd_t
*, const char *);
205 int ap_confirm(apd_t
*);
206 int ap_state_cmd(cfga_cmd_t
, int *);
207 int ap_symid(apd_t
*, char *, char *, size_t);
208 char *ap_sys_err(apd_t
*, char **);
209 char *ap_cmd_name(int);
210 char *ap_opt_name(int);
211 char *ap_logid(apd_t
*, char *);
212 void ap_err(apd_t
*, ...);
213 void ap_msg(apd_t
*, ...);
214 void ap_info(apd_t
*, cfga_info_t
, ap_target_t
);
215 void ap_init(apd_t
*, cfga_list_data_t
*);
216 void ap_state(apd_t
*, cfga_stat_t
*, cfga_stat_t
*);
217 cfga_err_t
ap_stat(apd_t
*a
, int);
218 cfga_err_t
ap_ioctl(apd_t
*, int);
219 cfga_err_t
ap_help(struct cfga_msg
*, const char *, cfga_flags_t
);
220 cfga_err_t
ap_cmd_exec(apd_t
*, int);
221 cfga_err_t
ap_cmd_seq(apd_t
*, int);
222 cfga_err_t
ap_suspend_query(apd_t
*, int, int *);
223 cfga_err_t
ap_platopts_check(apd_t
*, int, int);
224 cfga_err_t
ap_cmd_parse(apd_t
*, const char *, const char *, int *);
225 cfga_err_t
ap_test_err(apd_t
*, const char *);
227 int ap_cm_capacity(apd_t
*, int, void *, int *, cfga_stat_t
*);
228 int ap_cm_ncap(apd_t
*, int);
229 void ap_cm_id(apd_t
*, int, char *, size_t);
230 void ap_cm_init(apd_t
*, cfga_list_data_t
*, int);
231 char *ap_cm_devpath(apd_t
*, int);
232 ap_target_t
ap_cm_type(apd_t
*, int);
234 cfga_err_t
ap_rcm_init(apd_t
*);
235 void ap_rcm_fini(apd_t
*);
236 cfga_err_t
ap_rcm_ctl(apd_t
*, int);
237 int ap_rcm_info(apd_t
*, char **);
239 apd_t
*apd_alloc(const char *, cfga_flags_t
, char **,
240 struct cfga_msg
*, struct cfga_confirm
*);
241 void apd_free(apd_t
*a
);
242 cfga_err_t
apd_init(apd_t
*, int);
250 #endif /* _CFGA_SBD_H */