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]
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
30 * wrappers.c: utility for scadm command processing functions
36 #include <time.h> /* required by rsc.h */
45 if (rscp_start() != 0) {
47 (void) fprintf(stderr
, "\n%s\n\n",
48 gettext("scadm: SC firmware not responding"));
55 ADM_Send(rscp_msg_t
*msg
)
63 (void) fprintf(stderr
, "\n%s\n\n",
64 gettext("scadm: command/option not supported"));
67 } else if (err
!= 0) {
69 (void) fprintf(stderr
, "\n%s\n\n",
70 gettext("scadm: unable to send data to SC"));
77 ADM_Send_ret(rscp_msg_t
*msg
)
79 return (rscp_send(msg
));
84 ADM_Recv(rscp_msg_t
*msg
, struct timespec
*timeout
, int expectType
,
87 if (rscp_recv(msg
, timeout
) != 0) {
88 (void) fprintf(stderr
, "\n%s\n\n",
89 gettext("scadm: SC not responding to requests"));
93 if ((msg
->type
!= expectType
) || (msg
->len
< expectSize
)) {
94 (void) fprintf(stderr
, "\n%s: 0x%08x:0x%08lx\n\n",
95 gettext("scadm: SC returned garbage"),
104 ADM_Free(rscp_msg_t
*msg
)
106 if (rscp_free_msg(msg
) != 0) {
107 (void) fprintf(stderr
, "\n%s\n\n",
108 gettext("scadm: SC unable to free up memory"));