xref: /titanic_44/usr/src/uts/sun4u/sys/pic16f747.h (revision b29b9e18acbca49b266e291e6dc75a886c5d3d2b)
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 
277d2291eeSess #ifndef _PIC16F747_H
287d2291eeSess #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
56*b29b9e18Svenki #define	RF_FAN5_PERIOD	0x05	/* unused */
577c478bd9Sstevel@tonic-gate #define	RF_LOCAL_TEMP	0x06
587c478bd9Sstevel@tonic-gate #define	RF_REMOTE1_TEMP	0x07
597c478bd9Sstevel@tonic-gate #define	RF_REMOTE2_TEMP	0x08
607c478bd9Sstevel@tonic-gate #define	RF_REMOTE3_TEMP	0x09
617c478bd9Sstevel@tonic-gate #define	RF_LM95221_TEMP	0x0A
627c478bd9Sstevel@tonic-gate #define	RF_FIRE_TEMP	0x0B
637c478bd9Sstevel@tonic-gate #define	RF_LSI1064_TEMP	0x0C
647c478bd9Sstevel@tonic-gate #define	RF_FRONT_TEMP	0x0D
657c478bd9Sstevel@tonic-gate #define	RF_FAN_STATUS	0x0E
667c478bd9Sstevel@tonic-gate #define	RF_VCORE0	0x0F
677c478bd9Sstevel@tonic-gate #define	RF_VCORE1	0x10
68*b29b9e18Svenki #define	RF_VMEM0	0x11
69*b29b9e18Svenki #define	RF_VMEM1	0x12
70*b29b9e18Svenki #define	RF_PSU_TEMP	0x13
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate /*
737c478bd9Sstevel@tonic-gate  * Bitmasks for RF_COMMAND values
747c478bd9Sstevel@tonic-gate  */
757c478bd9Sstevel@tonic-gate #define	CMD_TO_ESTAR		0x01
767c478bd9Sstevel@tonic-gate #define	CMD_PIC_RESET		0x80
777c478bd9Sstevel@tonic-gate 
78*b29b9e18Svenki /*
79*b29b9e18Svenki  * Bitmasks for RF_STATUS values
80*b29b9e18Svenki  */
81*b29b9e18Svenki #define	ST_FFAULT		0x01	/* fan failure has occurred */
82*b29b9e18Svenki #define	ST_ENV_BUSY		0x02	/* environmental bus is busy */
83*b29b9e18Svenki #define	ST_ENV_STALE		0x04	/* ADT7462/LM95221 data invalid */
84*b29b9e18Svenki #define	ST_TPM_GOOD		0x08	/* TPM self test passed */
85*b29b9e18Svenki #define	ST_FW_VERSION		0xF0	/* firmware version number */
86*b29b9e18Svenki 
87*b29b9e18Svenki /*
88*b29b9e18Svenki  * Fan fault bits in RF_FAN_STATUS
89*b29b9e18Svenki  */
90*b29b9e18Svenki #define	F0_FLT_BIT		0
91*b29b9e18Svenki #define	F1_FLT_BIT		1
92*b29b9e18Svenki #define	F2_FLT_BIT		2
93*b29b9e18Svenki #define	F3_FLT_BIT		3
94*b29b9e18Svenki #define	F4_FLT_BIT		4
95*b29b9e18Svenki #define	F5_FLT_BIT		5	/* unused */
96*b29b9e18Svenki #define	PSUF_FLT_BIT		6
97*b29b9e18Svenki 
987c478bd9Sstevel@tonic-gate /* Number of fans/sensors */
997c478bd9Sstevel@tonic-gate #define	N_FANS			5
100*b29b9e18Svenki #define	N_SENSORS		9
1017c478bd9Sstevel@tonic-gate #define	N_PIC_NODES		(N_FANS+N_SENSORS+1)
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate /*
1047c478bd9Sstevel@tonic-gate  * PIC devices' node name and register offset
1057c478bd9Sstevel@tonic-gate  */
1067c478bd9Sstevel@tonic-gate #define	PICDEV_NODE_TYPE	"pic_client:env-monitor"
1077c478bd9Sstevel@tonic-gate typedef struct minor_node_info {
1087c478bd9Sstevel@tonic-gate 	char		*minor_name;	/* node name */
1097c478bd9Sstevel@tonic-gate 	uint8_t		reg_offset;	/* indirect register offset */
1107c478bd9Sstevel@tonic-gate 	uint8_t		ff_shift;	/* fan fault shift (only for fans) */
1117c478bd9Sstevel@tonic-gate } minor_node_info;
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate /*
114*b29b9e18Svenki  * PIC device minor numbers are constructed as <inst_8-11>:<unit_0-7>
1157c478bd9Sstevel@tonic-gate  */
1167c478bd9Sstevel@tonic-gate #define	PIC_INST_TO_MINOR(x)	(((x) << 8) & 0x0F00)
1177c478bd9Sstevel@tonic-gate #define	PIC_UNIT_TO_MINOR(x)	((x) & 0xFF)
1187c478bd9Sstevel@tonic-gate #define	PIC_MINOR_TO_UNIT(x)	((x) & 0xFF)
1197c478bd9Sstevel@tonic-gate #define	PIC_MINOR_TO_INST(x)	(((x)>> 8) & 0xF)
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate /*
1227c478bd9Sstevel@tonic-gate  * PIC ioctl commands
1237c478bd9Sstevel@tonic-gate  */
1247c478bd9Sstevel@tonic-gate #define	PICIOC	('X'<<8)
1257c478bd9Sstevel@tonic-gate #define	PIC_GET_TEMPERATURE	(PICIOC|1)
1267c478bd9Sstevel@tonic-gate #define	PIC_GET_FAN_SPEED	(PICIOC|2)
1277c478bd9Sstevel@tonic-gate #define	PIC_SET_FAN_SPEED	(PICIOC|3)
1287c478bd9Sstevel@tonic-gate #define	PIC_GET_STATUS		(PICIOC|4)
1297c478bd9Sstevel@tonic-gate #define	PIC_GET_FAN_STATUS	(PICIOC|5)
1307c478bd9Sstevel@tonic-gate #define	PIC_SET_ESTAR_MODE	(PICIOC|6)
1317c478bd9Sstevel@tonic-gate 
1327c478bd9Sstevel@tonic-gate /*
1337c478bd9Sstevel@tonic-gate  * Miscellaneous
1347c478bd9Sstevel@tonic-gate  */
1357c478bd9Sstevel@tonic-gate #define	MAX_PIC_INSTANCES	4
1367c478bd9Sstevel@tonic-gate #define	MAX_RETRIES		10
1377c478bd9Sstevel@tonic-gate 
1387c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1397c478bd9Sstevel@tonic-gate }
1407c478bd9Sstevel@tonic-gate #endif
1417c478bd9Sstevel@tonic-gate 
1427d2291eeSess #endif /* _PIC16F747_H */
143