xref: /titanic_41/usr/src/uts/sun4u/grover/sys/grfans.h (revision 9db67a327daf1243e630c20b81978ffd2a7baad7)
17c478bd9Sstevel@tonic-gate /*
2*9db67a32Sanbui  * CDDL HEADER START
3*9db67a32Sanbui  *
4*9db67a32Sanbui  * The contents of this file are subject to the terms of the
5*9db67a32Sanbui  * Common Development and Distribution License (the "License").
6*9db67a32Sanbui  * You may not use this file except in compliance with the License.
7*9db67a32Sanbui  *
8*9db67a32Sanbui  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*9db67a32Sanbui  * or http://www.opensolaris.org/os/licensing.
10*9db67a32Sanbui  * See the License for the specific language governing permissions
11*9db67a32Sanbui  * and limitations under the License.
12*9db67a32Sanbui  *
13*9db67a32Sanbui  * When distributing Covered Code, include this CDDL HEADER in each
14*9db67a32Sanbui  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*9db67a32Sanbui  * If applicable, add the following below this CDDL HEADER, with the
16*9db67a32Sanbui  * fields enclosed by brackets "[]" replaced with your own identifying
17*9db67a32Sanbui  * information: Portions Copyright [yyyy] [name of copyright owner]
18*9db67a32Sanbui  *
19*9db67a32Sanbui  * CDDL HEADER END
20*9db67a32Sanbui  */
21*9db67a32Sanbui /*
22*9db67a32Sanbui  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23*9db67a32Sanbui  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef _GRFANS_H
277c478bd9Sstevel@tonic-gate #define	_GRFANS_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #define	UNKNOWN_OUT	-1
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #define	MINOR_TO_DEVINST(x) ((x & 0xf00) >> 8)
387c478bd9Sstevel@tonic-gate #define	MINOR_TO_CHANNEL(x) (x & 0x00f)
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #define	CPU_FAN_CHANNEL		0x0
417c478bd9Sstevel@tonic-gate #define	SYSTEM_FAN_CHANNEL	0x1
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate #define	CHANNEL_TO_MINOR(x) (x)
447c478bd9Sstevel@tonic-gate #define	DEVINST_TO_MINOR(x) (x << 8)
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate #define	FANS_NODE_TYPE "ddi_env:fan"
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate #define	CPU_FAN_0	0x01
497c478bd9Sstevel@tonic-gate #define	CPU_FAN_25	0x05
507c478bd9Sstevel@tonic-gate #define	CPU_FAN_50	0x09
517c478bd9Sstevel@tonic-gate #define	CPU_FAN_75	0x0d
527c478bd9Sstevel@tonic-gate #define	CPU_FAN_100	0x00
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate #define	CPU_FAN_MASK	0x0d
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate #define	SYS_FAN_OFF	0x02
577c478bd9Sstevel@tonic-gate #define	SYS_FAN_ON	0x00
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate struct grfans_unit {
607c478bd9Sstevel@tonic-gate 	kmutex_t	mutex;
617c478bd9Sstevel@tonic-gate 	uint8_t		flags;
627c478bd9Sstevel@tonic-gate 	int8_t		sysfan_output;
637c478bd9Sstevel@tonic-gate 	int8_t		cpufan_output;
647c478bd9Sstevel@tonic-gate 	uint16_t	oflag[2];
657c478bd9Sstevel@tonic-gate 	ddi_acc_handle_t cpufan_rhandle;
667c478bd9Sstevel@tonic-gate 	ddi_acc_handle_t sysfan_rhandle;
677c478bd9Sstevel@tonic-gate 	uint8_t		*cpufan_reg;
687c478bd9Sstevel@tonic-gate 	uint8_t		*sysfan_reg;
697c478bd9Sstevel@tonic-gate };
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
727c478bd9Sstevel@tonic-gate }
737c478bd9Sstevel@tonic-gate #endif
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate #endif /* _GRFANS_H */
76