xref: /titanic_50/usr/src/uts/sun4u/sys/todsg.h (revision 03831d35f7499c87d51205817c93e9a8d42c4bae)
1*03831d35Sstevel /*
2*03831d35Sstevel  * CDDL HEADER START
3*03831d35Sstevel  *
4*03831d35Sstevel  * The contents of this file are subject to the terms of the
5*03831d35Sstevel  * Common Development and Distribution License, Version 1.0 only
6*03831d35Sstevel  * (the "License").  You may not use this file except in compliance
7*03831d35Sstevel  * with the License.
8*03831d35Sstevel  *
9*03831d35Sstevel  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*03831d35Sstevel  * or http://www.opensolaris.org/os/licensing.
11*03831d35Sstevel  * See the License for the specific language governing permissions
12*03831d35Sstevel  * and limitations under the License.
13*03831d35Sstevel  *
14*03831d35Sstevel  * When distributing Covered Code, include this CDDL HEADER in each
15*03831d35Sstevel  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*03831d35Sstevel  * If applicable, add the following below this CDDL HEADER, with the
17*03831d35Sstevel  * fields enclosed by brackets "[]" replaced with your own identifying
18*03831d35Sstevel  * information: Portions Copyright [yyyy] [name of copyright owner]
19*03831d35Sstevel  *
20*03831d35Sstevel  * CDDL HEADER END
21*03831d35Sstevel  */
22*03831d35Sstevel /*
23*03831d35Sstevel  * Copyright (c) 2000 by Sun Microsystems, Inc.
24*03831d35Sstevel  * All rights reserved.
25*03831d35Sstevel  */
26*03831d35Sstevel 
27*03831d35Sstevel #ifndef _TODSG_H
28*03831d35Sstevel #define	_TODSG_H
29*03831d35Sstevel 
30*03831d35Sstevel #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*03831d35Sstevel 
32*03831d35Sstevel #ifdef __cplusplus
33*03831d35Sstevel extern "C" {
34*03831d35Sstevel #endif
35*03831d35Sstevel 
36*03831d35Sstevel /*
37*03831d35Sstevel  * Serengeti TOD (time of day) driver
38*03831d35Sstevel  *
39*03831d35Sstevel  * Serengeti does not have hardware TOD chip inside chassis. SC has
40*03831d35Sstevel  * a hardware TOD chip and maintains virtual TOD information for
41*03831d35Sstevel  * each domain. Domain accesses virtual TOD through SRAM on chosen
42*03831d35Sstevel  * IO board.
43*03831d35Sstevel  */
44*03831d35Sstevel 
45*03831d35Sstevel #include <sys/time_impl.h>
46*03831d35Sstevel 
47*03831d35Sstevel /*
48*03831d35Sstevel  * IOSRAM used by virtual TOD
49*03831d35Sstevel  *
50*03831d35Sstevel  * +-------------------------------+
51*03831d35Sstevel  * |       tod_magic               |
52*03831d35Sstevel  * +-------------------------------+
53*03831d35Sstevel  * |       tod_version		   |
54*03831d35Sstevel  * +-------------------------------+
55*03831d35Sstevel  * |       tod_get_value           |
56*03831d35Sstevel  * +-------------------------------+
57*03831d35Sstevel  * |       tod_domain_skew         |
58*03831d35Sstevel  * +-------------------------------+
59*03831d35Sstevel  * |       tod_reserved            |
60*03831d35Sstevel  * +-------------------------------+
61*03831d35Sstevel  * |       tod_i_am_alive          |
62*03831d35Sstevel  * +-------------------------------+
63*03831d35Sstevel  * |       tod_timeout_period      |
64*03831d35Sstevel  * +-------------------------------+
65*03831d35Sstevel  *
66*03831d35Sstevel  * For every struct member in IOSRAM except tod_domain_skew and tod_reserved,
67*03831d35Sstevel  * there are only one writer and one reader.
68*03831d35Sstevel  * tod_reserved (was tod_set_flag) is for backwards compatibility.
69*03831d35Sstevel  *
70*03831d35Sstevel  *                      reader  read interval    writer  write interval
71*03831d35Sstevel  * ------------------------------------------------------------------------
72*03831d35Sstevel  * tod_get_value	Solaris 1 second         SC      twice per second
73*03831d35Sstevel  * tod_domain_skew	Solaris 1 second         Solaris when needed
74*03831d35Sstevel  * 			SC (see following NOTE)
75*03831d35Sstevel  * tod_i_am_alive	SC      twice per second Solaris 1 second
76*03831d35Sstevel  * tod_timeout_period	SC      twice per second Solaris when needed
77*03831d35Sstevel  *
78*03831d35Sstevel  * NOTE: SC reads tod_domain_skew twice per second, notices if it
79*03831d35Sstevel  *       changes, and always keeps the last observed value preserved
80*03831d35Sstevel  *       in non-volatile storage.
81*03831d35Sstevel  */
82*03831d35Sstevel typedef struct _tod_iosram {
83*03831d35Sstevel 	uint32_t tod_magic;	/* magic number, always TODSG_MAGIC	*/
84*03831d35Sstevel 	uint32_t tod_version;	/* version number			*/
85*03831d35Sstevel 	time_t tod_get_value;	/* SC updates and Solaris reads		*/
86*03831d35Sstevel 	time_t tod_domain_skew;	/* Solaris updates and read		*/
87*03831d35Sstevel 	uint32_t tod_reserved;	/* Was tod_set_flag. No use		*/
88*03831d35Sstevel 	uint32_t tod_i_am_alive;	/* I'm alive! a.k.a. heartbeat	*/
89*03831d35Sstevel 	uint32_t tod_timeout_period;	/* time period to decide hard hang */
90*03831d35Sstevel } tod_iosram_t;
91*03831d35Sstevel 
92*03831d35Sstevel #define	TODSG_MAGIC	0x54443100	/* 'T','D', '1', \0 */
93*03831d35Sstevel #define	TODSG_VERSION_1	1
94*03831d35Sstevel 
95*03831d35Sstevel extern int todsg_use_sc;
96*03831d35Sstevel 
97*03831d35Sstevel #ifdef __cplusplus
98*03831d35Sstevel }
99*03831d35Sstevel #endif
100*03831d35Sstevel 
101*03831d35Sstevel #endif /* _TODSG_H */
102