xref: /titanic_41/usr/src/uts/sun4u/sys/todsg.h (revision fef1e07ef354c2dcda4dc397c33f5a5532432c7a)
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 (c) 2000 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef _TODSG_H
28 #define	_TODSG_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * Serengeti TOD (time of day) driver
38  *
39  * Serengeti does not have hardware TOD chip inside chassis. SC has
40  * a hardware TOD chip and maintains virtual TOD information for
41  * each domain. Domain accesses virtual TOD through SRAM on chosen
42  * IO board.
43  */
44 
45 #include <sys/time_impl.h>
46 
47 /*
48  * IOSRAM used by virtual TOD
49  *
50  * +-------------------------------+
51  * |       tod_magic               |
52  * +-------------------------------+
53  * |       tod_version		   |
54  * +-------------------------------+
55  * |       tod_get_value           |
56  * +-------------------------------+
57  * |       tod_domain_skew         |
58  * +-------------------------------+
59  * |       tod_reserved            |
60  * +-------------------------------+
61  * |       tod_i_am_alive          |
62  * +-------------------------------+
63  * |       tod_timeout_period      |
64  * +-------------------------------+
65  *
66  * For every struct member in IOSRAM except tod_domain_skew and tod_reserved,
67  * there are only one writer and one reader.
68  * tod_reserved (was tod_set_flag) is for backwards compatibility.
69  *
70  *                      reader  read interval    writer  write interval
71  * ------------------------------------------------------------------------
72  * tod_get_value	Solaris 1 second         SC      twice per second
73  * tod_domain_skew	Solaris 1 second         Solaris when needed
74  * 			SC (see following NOTE)
75  * tod_i_am_alive	SC      twice per second Solaris 1 second
76  * tod_timeout_period	SC      twice per second Solaris when needed
77  *
78  * NOTE: SC reads tod_domain_skew twice per second, notices if it
79  *       changes, and always keeps the last observed value preserved
80  *       in non-volatile storage.
81  */
82 typedef struct _tod_iosram {
83 	uint32_t tod_magic;	/* magic number, always TODSG_MAGIC	*/
84 	uint32_t tod_version;	/* version number			*/
85 	time_t tod_get_value;	/* SC updates and Solaris reads		*/
86 	time_t tod_domain_skew;	/* Solaris updates and read		*/
87 	uint32_t tod_reserved;	/* Was tod_set_flag. No use		*/
88 	uint32_t tod_i_am_alive;	/* I'm alive! a.k.a. heartbeat	*/
89 	uint32_t tod_timeout_period;	/* time period to decide hard hang */
90 } tod_iosram_t;
91 
92 #define	TODSG_MAGIC	0x54443100	/* 'T','D', '1', \0 */
93 #define	TODSG_VERSION_1	1
94 
95 extern int todsg_use_sc;
96 
97 #ifdef __cplusplus
98 }
99 #endif
100 
101 #endif /* _TODSG_H */
102