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