xref: /illumos-gate/usr/src/cmd/scadm/sparc/mpxu/common/adm.h (revision 002c70ff32f5df6f93c15f88d351ce26443e6ee7)
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 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef __ADM_H__
28 #define	__ADM_H__
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * adm.h: defines and function prototypes for scadm
38  */
39 
40 #include <stdio.h>
41 #include <time.h>
42 
43 #include "librsc.h"
44 
45 
46 /* DEFINES */
47 #define	ADM_TIMEOUT		2  /* RX timeout for normal messages */
48 #define	ADM_SEPROM_TIMEOUT	10 /* timeout for messages requiring serial */
49 				    /* eprom update */
50 #define	ADM_BOOT_INIT_TIMEOUT	1  /* RX timeout for BOOT_INIT message */
51 #define	ADM_BOOT_LOAD_TIMEOUT	10 /* RX timeout for BOOT s-record message */
52 #define	ADM_BOOT_RETRY		5  /* Number of times to retry BOOT messages */
53 #define	ADM_LINE_SIZE		1024 /* Max s-record line size */
54 #define	ADM_BP_BUFF_SIZE	20
55 
56 /*
57  * By default, how much of an extended log will be displayed (for character-
58  * based logs.)
59  */
60 #define	ADM_DEFAULT_LOG_LENGTH	8192
61 
62 /* Default number of events we ask ALOM for (for event-based logs.) */
63 #define	DEFAULT_NUM_EVENTS 100
64 
65 
66 /* Return values for ADM_Valid_srecord() */
67 #define	SREC_OK			0
68 #define	SREC_ERR_LINE_TOO_BIG	-1
69 #define	SREC_ERR_LINE_TOO_SMALL	-2
70 #define	SREC_ERR_BAD_HEADER	-3
71 #define	SREC_ERR_WRONG_LENGTH	-4
72 #define	SREC_ERR_BAD_CRC	-5
73 
74 
75 /* SPEC'S */
76 void  ADM_Init();
77 void  ADM_Cleanup();
78 void  ADM_Exit(int errorCode);
79 
80 void  ADM_Process_command(int argc, char *argv[]);
81 void  ADM_Process_help();
82 void  ADM_Process_modem_setup();
83 void  ADM_Process_status();
84 void  ADM_Process_send_event(int argc, char *argv[]);
85 void  ADM_Process_date(int argc, char *argv[]);
86 void  ADM_Process_set(int argc, char *argv[]);
87 void  ADM_Process_show(int argc, char *argv[]);
88 void  ADM_Process_reset(int argc, char *argv[]);
89 void  ADM_Process_download(int argc, char *argv[]);
90 void  ADM_Process_useradd(int argc, char *argv[]);
91 void  ADM_Process_userdel(int argc, char *argv[]);
92 void  ADM_Process_usershow(int argc, char *argv[]);
93 void  ADM_Process_userpassword(int argc, char *argv[]);
94 void  ADM_Process_userperm(int argc, char *argv[]);
95 void  ADM_Process_show_network();
96 void  ADM_Process_event_log(int all);
97 void  ADM_Process_console_log(int all);
98 void  ADM_Process_fru_log(int all);
99 
100 void  ADM_Usage();
101 void  ADM_Callback(bp_msg_t *Message);
102 int   ADM_Valid_srecord(FILE  *FilePtr);
103 int   ADM_Send_file(FILE  *FilePtr);
104 void  ADM_Display_download_error(int cmd, int dat1); /* in send_file.c */
105 
106 /* rscp_register_bpmsg_cb() must be called before using */
107 /* rscp_send_bpmsg() or ADM_Boot_Recv() */
108 int  ADM_Boot_recv(bp_msg_t *MessagePtr, struct timespec *Timeout);
109 
110 
111 /* Wrappers for rscp routines */
112 void ADM_Start();
113 void ADM_Send(rscp_msg_t *msg);
114 int ADM_Send_ret(rscp_msg_t *msg);
115 void ADM_Recv(rscp_msg_t *msg, struct timespec *timeout, int expectType,
116     int expectSize);
117 void ADM_Free(rscp_msg_t  *msg);
118 
119 #ifdef	__cplusplus
120 }
121 #endif
122 
123 #endif /* __ADM_H__ */
124