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