xref: /onnv-gate/usr/src/uts/sun4u/grover/sys/grfans.h (revision 6982:b1c949aa1b3c)
10Sstevel@tonic-gate /*
2*6982Sanbui  * CDDL HEADER START
3*6982Sanbui  *
4*6982Sanbui  * The contents of this file are subject to the terms of the
5*6982Sanbui  * Common Development and Distribution License (the "License").
6*6982Sanbui  * You may not use this file except in compliance with the License.
7*6982Sanbui  *
8*6982Sanbui  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*6982Sanbui  * or http://www.opensolaris.org/os/licensing.
10*6982Sanbui  * See the License for the specific language governing permissions
11*6982Sanbui  * and limitations under the License.
12*6982Sanbui  *
13*6982Sanbui  * When distributing Covered Code, include this CDDL HEADER in each
14*6982Sanbui  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*6982Sanbui  * If applicable, add the following below this CDDL HEADER, with the
16*6982Sanbui  * fields enclosed by brackets "[]" replaced with your own identifying
17*6982Sanbui  * information: Portions Copyright [yyyy] [name of copyright owner]
18*6982Sanbui  *
19*6982Sanbui  * CDDL HEADER END
20*6982Sanbui  */
21*6982Sanbui /*
22*6982Sanbui  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23*6982Sanbui  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef _GRFANS_H
270Sstevel@tonic-gate #define	_GRFANS_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifdef	__cplusplus
320Sstevel@tonic-gate extern "C" {
330Sstevel@tonic-gate #endif
340Sstevel@tonic-gate 
350Sstevel@tonic-gate #define	UNKNOWN_OUT	-1
360Sstevel@tonic-gate 
370Sstevel@tonic-gate #define	MINOR_TO_DEVINST(x) ((x & 0xf00) >> 8)
380Sstevel@tonic-gate #define	MINOR_TO_CHANNEL(x) (x & 0x00f)
390Sstevel@tonic-gate 
400Sstevel@tonic-gate #define	CPU_FAN_CHANNEL		0x0
410Sstevel@tonic-gate #define	SYSTEM_FAN_CHANNEL	0x1
420Sstevel@tonic-gate 
430Sstevel@tonic-gate #define	CHANNEL_TO_MINOR(x) (x)
440Sstevel@tonic-gate #define	DEVINST_TO_MINOR(x) (x << 8)
450Sstevel@tonic-gate 
460Sstevel@tonic-gate #define	FANS_NODE_TYPE "ddi_env:fan"
470Sstevel@tonic-gate 
480Sstevel@tonic-gate #define	CPU_FAN_0	0x01
490Sstevel@tonic-gate #define	CPU_FAN_25	0x05
500Sstevel@tonic-gate #define	CPU_FAN_50	0x09
510Sstevel@tonic-gate #define	CPU_FAN_75	0x0d
520Sstevel@tonic-gate #define	CPU_FAN_100	0x00
530Sstevel@tonic-gate 
540Sstevel@tonic-gate #define	CPU_FAN_MASK	0x0d
550Sstevel@tonic-gate 
560Sstevel@tonic-gate #define	SYS_FAN_OFF	0x02
570Sstevel@tonic-gate #define	SYS_FAN_ON	0x00
580Sstevel@tonic-gate 
590Sstevel@tonic-gate struct grfans_unit {
600Sstevel@tonic-gate 	kmutex_t	mutex;
610Sstevel@tonic-gate 	uint8_t		flags;
620Sstevel@tonic-gate 	int8_t		sysfan_output;
630Sstevel@tonic-gate 	int8_t		cpufan_output;
640Sstevel@tonic-gate 	uint16_t	oflag[2];
650Sstevel@tonic-gate 	ddi_acc_handle_t cpufan_rhandle;
660Sstevel@tonic-gate 	ddi_acc_handle_t sysfan_rhandle;
670Sstevel@tonic-gate 	uint8_t		*cpufan_reg;
680Sstevel@tonic-gate 	uint8_t		*sysfan_reg;
690Sstevel@tonic-gate };
700Sstevel@tonic-gate 
710Sstevel@tonic-gate #ifdef	__cplusplus
720Sstevel@tonic-gate }
730Sstevel@tonic-gate #endif
740Sstevel@tonic-gate 
750Sstevel@tonic-gate #endif /* _GRFANS_H */
76