xref: /titanic_44/usr/src/uts/sun4u/grover/sys/grfans.h (revision e4b86885570d77af552e9cf94f142f4d744fb8c8)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _GRFANS_H
27 #define	_GRFANS_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #define	UNKNOWN_OUT	-1
36 
37 #define	MINOR_TO_DEVINST(x) ((x & 0xf00) >> 8)
38 #define	MINOR_TO_CHANNEL(x) (x & 0x00f)
39 
40 #define	CPU_FAN_CHANNEL		0x0
41 #define	SYSTEM_FAN_CHANNEL	0x1
42 
43 #define	CHANNEL_TO_MINOR(x) (x)
44 #define	DEVINST_TO_MINOR(x) (x << 8)
45 
46 #define	FANS_NODE_TYPE "ddi_env:fan"
47 
48 #define	CPU_FAN_0	0x01
49 #define	CPU_FAN_25	0x05
50 #define	CPU_FAN_50	0x09
51 #define	CPU_FAN_75	0x0d
52 #define	CPU_FAN_100	0x00
53 
54 #define	CPU_FAN_MASK	0x0d
55 
56 #define	SYS_FAN_OFF	0x02
57 #define	SYS_FAN_ON	0x00
58 
59 struct grfans_unit {
60 	kmutex_t	mutex;
61 	uint8_t		flags;
62 	int8_t		sysfan_output;
63 	int8_t		cpufan_output;
64 	uint16_t	oflag[2];
65 	ddi_acc_handle_t cpufan_rhandle;
66 	ddi_acc_handle_t sysfan_rhandle;
67 	uint8_t		*cpufan_reg;
68 	uint8_t		*sysfan_reg;
69 };
70 
71 #ifdef	__cplusplus
72 }
73 #endif
74 
75 #endif /* _GRFANS_H */
76