1 /*
2 * Copyright (c) 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and
9 * this paragraph in its entirety in the documentation or other materials
10 * provided with the distribution, and (3) all advertising materials mentioning
11 * features or use of this software display the following acknowledgement:
12 * ``This product includes software developed by the University of California,
13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14 * the University nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior
16 * written permission.
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 */
21
22 #ifndef lint
23 static char rcsid[] =
24 "@(#) $Header: md-sun4.c,v 1.2 90/09/21 02:20:17 mccanne Exp $ (LBL)";
25 #endif
26
27 /* The sun includes are arranged too stupidly to help us */
28
29 #define ARCH_MASK 0xf0000000
30 #define MACH_MASK 0x0f000000
31 #define ARCH_MACH_MASK (ARCH_MASK + MACH_MASK)
32
33 #define ARCH_SUN4 0x20000000
34 #define ARCH_SUN4C 0x50000000
35 #define MACH_60 0x01000000 /* Sparcstation 1 */
36
37 #define MACH_4_330 (ARCH_SUN4 + 0x03000000)
38 #define MACH_4_460 (ARCH_SUN4 + 0x04000000)
39
40 #define MACH_260 0x01000000
41 #define MACH_110 0x02000000
42 #define MACH_330 0x03000000
43 #define MACH_460 0x04000000
44
45 int
clock_sigfigs()46 clock_sigfigs()
47 {
48 int good = 0;
49 long id = gethostid();
50
51 /*
52 * Apparently, all sun4c's, 4/300's, and 4/400's have the
53 * Mostek 48T02 clock chip.
54 */
55 if ((id & ARCH_MASK) == ARCH_SUN4C)
56 ++good;
57 else
58 switch (id & ARCH_MACH_MASK) {
59
60 case MACH_4_330:
61 case MACH_4_460:
62 ++good;
63 break;
64 }
65 /* On machines with "good" clocks, timestamps to microseconds.
66 Default is hundreths of a second. */
67
68 if (good)
69 return 6;
70 else
71 return 2;
72 }
73