xref: /titanic_51/usr/src/uts/sun4u/grover/sys/grfans.h (revision c8e880c1386b032ac975c61826ba3bc0d8dce5ac)
1 /*
2  * Copyright (c) 2000 by Sun Microsystems, Inc.
3  * All rights reserved.
4  */
5 
6 #ifndef _GRFANS_H
7 #define	_GRFANS_H
8 
9 #pragma ident	"%Z%%M%	%I%	%E% SMI"
10 
11 #ifdef	__cplusplus
12 extern "C" {
13 #endif
14 
15 #define	UNKNOWN_OUT	-1
16 
17 #define	MINOR_TO_DEVINST(x) ((x & 0xf00) >> 8)
18 #define	MINOR_TO_CHANNEL(x) (x & 0x00f)
19 
20 #define	CPU_FAN_CHANNEL		0x0
21 #define	SYSTEM_FAN_CHANNEL	0x1
22 
23 #define	CHANNEL_TO_MINOR(x) (x)
24 #define	DEVINST_TO_MINOR(x) (x << 8)
25 
26 #define	FANS_NODE_TYPE "ddi_env:fan"
27 
28 #define	CPU_FAN_0	0x01
29 #define	CPU_FAN_25	0x05
30 #define	CPU_FAN_50	0x09
31 #define	CPU_FAN_75	0x0d
32 #define	CPU_FAN_100	0x00
33 
34 #define	CPU_FAN_MASK	0x0d
35 
36 #define	SYS_FAN_OFF	0x02
37 #define	SYS_FAN_ON	0x00
38 
39 struct grfans_unit {
40 	kmutex_t	mutex;
41 	uint8_t		flags;
42 	int8_t		sysfan_output;
43 	int8_t		cpufan_output;
44 	uint16_t	oflag[2];
45 	ddi_acc_handle_t cpufan_rhandle;
46 	ddi_acc_handle_t sysfan_rhandle;
47 	uint8_t		*cpufan_reg;
48 	uint8_t		*sysfan_reg;
49 };
50 
51 #ifdef	__cplusplus
52 }
53 #endif
54 
55 #endif /* _GRFANS_H */
56