xref: /titanic_53/usr/src/uts/sun4u/sys/pic16f747.h (revision 7d2291ee46fb70e109c8a1c76b0d34a47e613bc7)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
27*7d2291eeSess #ifndef _PIC16F747_H
28*7d2291eeSess #define	_PIC16F747_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
337c478bd9Sstevel@tonic-gate extern "C" {
347c478bd9Sstevel@tonic-gate #endif
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate /*
377c478bd9Sstevel@tonic-gate  * PIC Registers
387c478bd9Sstevel@tonic-gate  */
397c478bd9Sstevel@tonic-gate #define	RF_COMMAND	0x00
407c478bd9Sstevel@tonic-gate #define	RF_STATUS	0x01
417c478bd9Sstevel@tonic-gate #define	RF_IND_DATA	0x40
427c478bd9Sstevel@tonic-gate #define	RF_IND_ADDR	0x41
437c478bd9Sstevel@tonic-gate #define	RF_ENV_S0	0x80
447c478bd9Sstevel@tonic-gate #define	RF_ENV_S1	0x81
457c478bd9Sstevel@tonic-gate #define	RF_TPM_S0	0xC0
467c478bd9Sstevel@tonic-gate #define	RF_TPM_S1	0xC1
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate /*
497c478bd9Sstevel@tonic-gate  * PIC Registers from Indirect Address/Data
507c478bd9Sstevel@tonic-gate  */
517c478bd9Sstevel@tonic-gate #define	RF_FAN0_PERIOD	0x00
527c478bd9Sstevel@tonic-gate #define	RF_FAN1_PERIOD	0x01
537c478bd9Sstevel@tonic-gate #define	RF_FAN2_PERIOD	0x02
547c478bd9Sstevel@tonic-gate #define	RF_FAN3_PERIOD	0x03
557c478bd9Sstevel@tonic-gate #define	RF_FAN4_PERIOD	0x04
567c478bd9Sstevel@tonic-gate #define	RF_LOCAL_TEMP	0x06
577c478bd9Sstevel@tonic-gate #define	RF_REMOTE1_TEMP	0x07
587c478bd9Sstevel@tonic-gate #define	RF_REMOTE2_TEMP	0x08
597c478bd9Sstevel@tonic-gate #define	RF_REMOTE3_TEMP	0x09
607c478bd9Sstevel@tonic-gate #define	RF_LM95221_TEMP	0x0A
617c478bd9Sstevel@tonic-gate #define	RF_FIRE_TEMP	0x0B
627c478bd9Sstevel@tonic-gate #define	RF_LSI1064_TEMP	0x0C
637c478bd9Sstevel@tonic-gate #define	RF_FRONT_TEMP	0x0D
647c478bd9Sstevel@tonic-gate #define	RF_FAN_STATUS	0x0E
657c478bd9Sstevel@tonic-gate #define	RF_VCORE0	0x0F
667c478bd9Sstevel@tonic-gate #define	RF_VCORE1	0x10
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate /*
697c478bd9Sstevel@tonic-gate  * Bitmasks for RF_STATUS register
707c478bd9Sstevel@tonic-gate  */
717c478bd9Sstevel@tonic-gate #define	ST_FFAULT		0x01	/* fan failure has occurred */
727c478bd9Sstevel@tonic-gate #define	ST_ENV_BUSY		0x02	/* environmental bus is busy */
737c478bd9Sstevel@tonic-gate #define	ST_STALE_ADT_DATA	0x04	/* ADT7462 data currently invalid */
747c478bd9Sstevel@tonic-gate #define	ST_STALE_LM_DATA	0x08	/* LM95221 data currently invalid */
757c478bd9Sstevel@tonic-gate #define	ST_FW_VERSION		0xF0	/* firmware version number */
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate /*
787c478bd9Sstevel@tonic-gate  * Bitmasks for RF_COMMAND values
797c478bd9Sstevel@tonic-gate  */
807c478bd9Sstevel@tonic-gate #define	CMD_TO_ESTAR		0x01
817c478bd9Sstevel@tonic-gate #define	CMD_PIC_RESET		0x80
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate /* Number of fans/sensors */
847c478bd9Sstevel@tonic-gate #define	MAX_PIC_NODES		16
857c478bd9Sstevel@tonic-gate #define	N_FANS			5
867c478bd9Sstevel@tonic-gate #define	N_SENSORS		8
877c478bd9Sstevel@tonic-gate #define	N_PIC_NODES		(N_FANS+N_SENSORS+1)
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate /*
907c478bd9Sstevel@tonic-gate  * PIC devices' node name and register offset
917c478bd9Sstevel@tonic-gate  */
927c478bd9Sstevel@tonic-gate #define	PICDEV_NODE_TYPE	"pic_client:env-monitor"
937c478bd9Sstevel@tonic-gate typedef struct minor_node_info {
947c478bd9Sstevel@tonic-gate 	char		*minor_name;	/* node name */
957c478bd9Sstevel@tonic-gate 	uint8_t		reg_offset;	/* indirect register offset */
967c478bd9Sstevel@tonic-gate 	uint8_t		ff_shift;	/* fan fault shift (only for fans) */
977c478bd9Sstevel@tonic-gate } minor_node_info;
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate /*
1007c478bd9Sstevel@tonic-gate  * PIC device minor numbers are constructed as <inst_9-12>:<unit_0-8>
1017c478bd9Sstevel@tonic-gate  */
1027c478bd9Sstevel@tonic-gate #define	PIC_INST_TO_MINOR(x)	(((x) << 8) & 0x0F00)
1037c478bd9Sstevel@tonic-gate #define	PIC_UNIT_TO_MINOR(x)	((x) & 0xFF)
1047c478bd9Sstevel@tonic-gate #define	PIC_MINOR_TO_UNIT(x)	((x) & 0xFF)
1057c478bd9Sstevel@tonic-gate #define	PIC_MINOR_TO_INST(x)	(((x)>> 8) & 0xF)
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate /*
1087c478bd9Sstevel@tonic-gate  * PIC ioctl commands
1097c478bd9Sstevel@tonic-gate  */
1107c478bd9Sstevel@tonic-gate #define	PICIOC	('X'<<8)
1117c478bd9Sstevel@tonic-gate #define	PIC_GET_TEMPERATURE	(PICIOC|1)
1127c478bd9Sstevel@tonic-gate #define	PIC_GET_FAN_SPEED	(PICIOC|2)
1137c478bd9Sstevel@tonic-gate #define	PIC_SET_FAN_SPEED	(PICIOC|3)
1147c478bd9Sstevel@tonic-gate #define	PIC_GET_STATUS		(PICIOC|4)
1157c478bd9Sstevel@tonic-gate #define	PIC_GET_FAN_STATUS	(PICIOC|5)
1167c478bd9Sstevel@tonic-gate #define	PIC_SET_ESTAR_MODE	(PICIOC|6)
1177c478bd9Sstevel@tonic-gate 
1187c478bd9Sstevel@tonic-gate /*
1197c478bd9Sstevel@tonic-gate  * Miscellaneous
1207c478bd9Sstevel@tonic-gate  */
1217c478bd9Sstevel@tonic-gate #define	MAX_PIC_INSTANCES	4
1227c478bd9Sstevel@tonic-gate #define	MAX_RETRIES		10
1237c478bd9Sstevel@tonic-gate 
1247c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1257c478bd9Sstevel@tonic-gate }
1267c478bd9Sstevel@tonic-gate #endif
1277c478bd9Sstevel@tonic-gate 
128*7d2291eeSess #endif /* _PIC16F747_H */
129