8354 sync regcomp(3C) with upstream (fix make catalog)
[unleashed/tickless.git] / usr / src / uts / sun4u / sys / pic16f747.h
blob3669c96bb7163982d23cccc14796325fff897c1d
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _PIC16F747_H
28 #define _PIC16F747_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
37 * PIC Registers
39 #define RF_COMMAND 0x00
40 #define RF_STATUS 0x01
41 #define RF_IND_DATA 0x40
42 #define RF_IND_ADDR 0x41
43 #define RF_ENV_S0 0x80
44 #define RF_ENV_S1 0x81
45 #define RF_TPM_S0 0xC0
46 #define RF_TPM_S1 0xC1
49 * PIC Registers from Indirect Address/Data
51 #define RF_FAN0_PERIOD 0x00
52 #define RF_FAN1_PERIOD 0x01
53 #define RF_FAN2_PERIOD 0x02
54 #define RF_FAN3_PERIOD 0x03
55 #define RF_FAN4_PERIOD 0x04
56 #define RF_FAN5_PERIOD 0x05 /* unused */
57 #define RF_LOCAL_TEMP 0x06
58 #define RF_REMOTE1_TEMP 0x07
59 #define RF_REMOTE2_TEMP 0x08
60 #define RF_REMOTE3_TEMP 0x09
61 #define RF_LM95221_TEMP 0x0A
62 #define RF_FIRE_TEMP 0x0B
63 #define RF_LSI1064_TEMP 0x0C
64 #define RF_FRONT_TEMP 0x0D
65 #define RF_FAN_STATUS 0x0E
66 #define RF_VCORE0 0x0F
67 #define RF_VCORE1 0x10
68 #define RF_VMEM0 0x11
69 #define RF_VMEM1 0x12
70 #define RF_PSU_TEMP 0x13
73 * Bitmasks for RF_COMMAND values
75 #define CMD_TO_ESTAR 0x01
76 #define CMD_PIC_RESET 0x80
79 * Bitmasks for RF_STATUS values
81 #define ST_FFAULT 0x01 /* fan failure has occurred */
82 #define ST_ENV_BUSY 0x02 /* environmental bus is busy */
83 #define ST_ENV_STALE 0x04 /* ADT7462/LM95221 data invalid */
84 #define ST_TPM_GOOD 0x08 /* TPM self test passed */
85 #define ST_FW_VERSION 0xF0 /* firmware version number */
88 * Fan fault bits in RF_FAN_STATUS
90 #define F0_FLT_BIT 0
91 #define F1_FLT_BIT 1
92 #define F2_FLT_BIT 2
93 #define F3_FLT_BIT 3
94 #define F4_FLT_BIT 4
95 #define F5_FLT_BIT 5 /* unused */
96 #define PSUF_FLT_BIT 6
98 /* Number of fans/sensors */
99 #define N_FANS 5
100 #define N_SENSORS 9
101 #define N_PIC_NODES (N_FANS+N_SENSORS+1)
104 * PIC devices' node name and register offset
106 #define PICDEV_NODE_TYPE "pic_client:env-monitor"
107 typedef struct minor_node_info {
108 char *minor_name; /* node name */
109 uint8_t reg_offset; /* indirect register offset */
110 uint8_t ff_shift; /* fan fault shift (only for fans) */
111 } minor_node_info;
114 * PIC device minor numbers are constructed as <inst_8-11>:<unit_0-7>
116 #define PIC_INST_TO_MINOR(x) (((x) << 8) & 0x0F00)
117 #define PIC_UNIT_TO_MINOR(x) ((x) & 0xFF)
118 #define PIC_MINOR_TO_UNIT(x) ((x) & 0xFF)
119 #define PIC_MINOR_TO_INST(x) (((x)>> 8) & 0xF)
122 * PIC ioctl commands
124 #define PICIOC ('X'<<8)
125 #define PIC_GET_TEMPERATURE (PICIOC|1)
126 #define PIC_GET_FAN_SPEED (PICIOC|2)
127 #define PIC_SET_FAN_SPEED (PICIOC|3)
128 #define PIC_GET_STATUS (PICIOC|4)
129 #define PIC_GET_FAN_STATUS (PICIOC|5)
130 #define PIC_SET_ESTAR_MODE (PICIOC|6)
133 * Miscellaneous
135 #define MAX_PIC_INSTANCES 4
136 #define MAX_RETRIES 10
138 #ifdef __cplusplus
140 #endif
142 #endif /* _PIC16F747_H */