xref: /illumos-gate/usr/src/cmd/scadm/sparc/mpxu/common/status.c (revision 20a7641f9918de8574b8b3b47dbe35c4bfc78df1)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
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.
13  *
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]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2002 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28  * status.c: support for scadm version option (to display the service processor
29  * status, fw version)
30  */
31 
32 #include <libintl.h>
33 #include <stdio.h>
34 #include <string.h>
35 #include <time.h>  /* required by librsc.h */
36 
37 #include "librsc.h"
38 #include "adm.h"
39 
40 
41 void
42 ADM_Process_status(int verbose)
43 {
44 	rscp_msg_t		Message;
45 	struct timespec		Timeout;
46 	dp_rsc_status_r_t	*rscStatus;
47 
48 
49 	ADM_Start();
50 
51 	Message.type = DP_RSC_STATUS;
52 	Message.len  = 0;
53 	Message.data = NULL;
54 	ADM_Send(&Message);
55 
56 	Timeout.tv_nsec = 0;
57 	Timeout.tv_sec  = ADM_TIMEOUT;
58 	ADM_Recv(&Message, &Timeout,
59 	    DP_RSC_STATUS_R, sizeof (dp_rsc_status_r_t));
60 
61 	/* Print the status */
62 	rscStatus = (dp_rsc_status_r_t *)Message.data;
63 	(void) printf("\n");
64 	(void) printf("%s v%d.%d\n",
65 	    gettext("SC Version"),
66 	    rscStatus->release_rev_major, rscStatus->release_rev_minor);
67 	(void) printf("%s v%d.%d.%d\n",
68 	    gettext("SC Bootmon Version: "),
69 	    rscStatus->bootmon_rev_major, rscStatus->bootmon_rev_minor,
70 	    rscStatus->bootmon_rev_micro);
71 	if (verbose) {
72 		(void) printf("%s %08lX\r\n\n", gettext("SC Bootmon checksum:"),
73 		    rscStatus->bm_cksum);
74 	}
75 
76 	(void) printf("%s v%d.%d.%d\n",
77 	    gettext("SC Firmware Version: "),
78 	    rscStatus->main_rev_major, rscStatus->main_rev_minor,
79 	    rscStatus->main_rev_micro);
80 	if (verbose) {
81 		(void) printf("%s %02d\r\n", gettext("SC Build Release:"),
82 		    rscStatus->rsc_build);
83 	}
84 
85 	(void) printf("\n");
86 
87 
88 	if (verbose) {
89 		(void) printf("%s %08lX\r\n\n",
90 		    gettext("SC firmware checksum:"), rscStatus->fw_cksum);
91 		(void) printf("%s %s\r\n\n",
92 		    gettext("SC firmware built:"), rscStatus->creationDate);
93 		(void) printf("%s %ld%s\r\n\r\n",
94 		    gettext("SC System Memory Size:"), rscStatus->sys_mem,
95 		    gettext("MB"));
96 		(void) printf("%s %lx\r\n\r\n",
97 		    gettext("SC NVRAM Version ="), rscStatus->nvram_version);
98 	}
99 	/*
100 	 * Not currently implemented in firmware
101 	 * (void) printf("%s = %d\n",
102 	 *  gettext("Users currently logged in"), rscStatus->nusers);
103 	 */
104 
105 	if (verbose) {
106 		/* 4388953 Display SC board type */
107 		(void) printf("%s %d\r\n\r\n",
108 		    gettext("SC hardware type:"), rscStatus->hardware_rev);
109 	}
110 
111 	ADM_Free(&Message);
112 }
113