display_funcs.c revision 03831d35f7499c87d51205817c93e9a8d42c4bae
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <stdarg.h>
#include <syslog.h>
#include <sys/openpromio.h>
#include <libintl.h>
#include "pdevinfo.h"
#include "display.h"
#if !defined(TEXT_DOMAIN)
#define TEXT_DOMAIN "SYS_TEST"
#endif
/*
* external data
*/
extern int print_flag;
extern int logging;
/*
* The following macros for dealing with raw output from the Mostek 48T02
* were borrowed from the kernel. Openboot passes the raw Mostek data
* thru the device tree, and there are no library routines to deal with
* this data.
*/
/*
* Tables to convert a single byte from binary-coded decimal (BCD).
*/
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, 0, 0, 0, 0, 0,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 0, 0, 0, 0, 0, 0,
30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 0, 0, 0, 0, 0, 0,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 0, 0, 0, 0, 0, 0,
50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 0, 0, 0, 0, 0, 0,
60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 0, 0, 0, 0, 0, 0,
70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 0, 0, 0, 0, 0, 0,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 0, 0, 0, 0, 0, 0,
90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
};
#define YRBASE 68
static int days_thru_month[64] = {
0, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366, 0, 0,
0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365, 0, 0,
0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365, 0, 0,
0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365, 0, 0,
};
/*
* This function takes the raw Mostek data from the device tree translates
* it into UNIXC time (secs since Jan 1, 1970) and returns a string from
* ctime(3c).
*/
char *
{
}
void
{
char *option_str = "options";
char *pf_str = "powerfail-time";
char *value_str;
return;
}
return;
}
if (value == 0)
return;
(void) log_printf(
"Most recent AC Power Failure:\n"));
(void) log_printf("=============================\n");
(void) log_printf("\n");
}
/*VARARGS1*/
void
log_printf(char *fmt, ...)
{
int len;
static char bigbuf[4096];
char buffer[1024];
if (print_flag == 0) {
return;
}
if (logging != 0) {
/* we only call to syslog when we get the entire line. */
bigbuf[0] = 0;
}
} else {
}
}
void
print_header(int board)
{
log_printf("\n");
"Analysis for Board %d\n"), board, 0);
log_printf("--------------------\n", 0);
}