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