1 /*++
2 
3   Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
4 
5 
6   This program and the accompanying materials are licensed and made available under
7 
8   the terms and conditions of the BSD License that accompanies this distribution.
9 
10   The full text of the license may be found at
11 
12   http://opensource.org/licenses/bsd-license.php.
13 
14 
15 
16   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
17 
18   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 
20 
21 
22 
23 
24 
25 Module Name:
26 
27   SensorInfoVariable.h
28 
29 Abstract:
30 
31   GUID used for Sensor Info variable.
32 
33 --*/
34 
35 
36 //
37 //  Module:         SensorInfoVariable.h
38 //
39 //  Description:    Provides  structure  and  literal  definitions for the
40 //                  Sensor Information Variable.  The  BIOS  will  provide
41 //                  this  variable  to  runtime  applications  via the EFI
42 //                  GetVariable function.
43 //
44 //  Notes:      1.  When defining and initializing the variable within the
45 //                  BIOS, the module will define the structure  using  the
46 //                  typedef  macros  in  a block. For an ATX board using a
47 //                  single Heceta 6P, which has 4 temperature  sensors,  6
48 //                  voltage  sensors,  4 fan speed sensors and 3 fan speed
49 //                  controllers, this block would be declared as follows:
50 //
51 //                      TYPEDEF_TEMP_SENSOR_SECTION(4);
52 //                      TYPEDEF_VOLT_SENSOR_SECTION(6);
53 //                      TYPEDEF_FAN_SENSOR_SECTION(4);
54 //                      TYPEDEF_FAN_CONTROLLER_SENSOR(3);
55 //                      TYPEDEF_SENSOR_INFO_VAR;
56 //
57 //              2.  When crafting code to access the variable, the  module
58 //                  will  also  need  to  invoke  the  typedef macros in a
59 //                  block but, since it cannot declare a structure for the
60 //                overall variable (because array lengths will vary), it
61 //                cannot  use  TYPEDEF_SENSOR_INFO_VAR.  The  block will
62 //                typically be used as follows:
63 //
64 //                      TYPEDEF_TEMP_SENSOR_SECTION(1);
65 //                     TYPEDEF_VOLT_SENSOR_SECTION(1);
66 //                     TYPEDEF_FAN_SENSOR_SECTION(1);
67 //                     TYPEDEF_FAN_CONTROLLER_SENSOR(1);
68 //
69 //                 The structure buffer should instead be declared  as  a
70 //                 BYTE  array. Pointers to the various sections can then
71 //                  be built using the XXXX_SECTION_LEN macros...
72 //
73 
74 
75 #ifndef _SENSOR_INFO_VAR_GUID_H_
76 #define _SENSOR_INFO_VAR_GUID_H_
77 
78 #define SENSOR_INFO_VAR_GUID \
79   { \
80     0xE59E7B4D, 0x06DC, 0x44AB, 0xB3, 0x6D, 0x5E, 0xD7, 0x78, 0x9C, 0x53, 0x0A \
81   }
82 
83 extern EFI_GUID gEfiSensorInfoVarGuid;
84 extern CHAR16   gEfiSensorInfoVarName[];
85 extern CHAR16   gEfiSensorInfoVarNameWithPassword[];
86 
87 #define SENSOR_INFO_VAR_NAME L"SensorInfoVar"
88 #define SENSOR_INFO_VAR_NAME_WITH_PASSWORD SENSOR_INFO_VAR_NAME L"S4k?A^7!"
89 
90 //
91 // Sensor/Controller usage definitions
92 //
93 
94 #define UNKNOWN_OTHER                   0
95 
96 //
97 // Temperature Sensors
98 //
99 #define CPU_CORE_TEMPERATURE            1
100 #define CPU_DIE_TEMPERATURE             2
101 #define ICH_TEMPERATURE                 3
102 #define MCH_TEMPERATURE                 4
103 #define VR_TEMPERATURE                  5
104 #define MEMORY_TEMPERATURE              6
105 #define MOTHERBOARD_AMBIENT_TEMPERATURE 7
106 #define SYSTEM_AMBIENT_AIR_TEMPERATURE  8
107 #define CPU_INLET_AIR_TEMPERATURE       9
108 #define SYSTEM_INLET_AIR_TEMPERATURE    10
109 #define SYSTEM_OUTLET_AIR_TEMPERATURE   11
110 #define PSU_HOTSPOT_TEMPERATURE         12
111 #define PSU_INLET_AIR_TEMPERATURE       13
112 #define PSU_OUTLET_AIR_TEMPERATURE      14
113 #define DRIVE_TEMPERATURE               15
114 #define GPU_TEMPERATURE                 16
115 #define IOH_TEMPERATURE                 17
116 
117 #define LAST_TEMPERATURE                17
118 
119 //
120 // Voltage Sensors
121 //
122 #define PLUS_12_VOLTS                   1
123 #define NEG_12_VOLTS                    2
124 #define PLUS_5_VOLTS                    3
125 #define PLUS_5_VOLT_BACKUP              4
126 #define NEG_5_VOLTS                     5
127 #define PLUS_3P3_VOLTS                  6
128 #define PLUS_2P5_VOLTS                  7
129 #define PLUS_1P5_VOLTS                  8
130 #define CPU_1_VCCP_VOLTAGE              9
131 #define CPU_2_VCCP_VOLTAGE              10
132 #define CPU_3_VCCP_VOLTAGE              11
133 #define CPU_4_VCCP_VOLTAGE              12
134 #define PSU_INPUT_VOLTAGE               13
135 #define MCH_VCC_VOLTAGE                 14
136 #define PLUS_3P3_VOLT_STANDBY           15
137 #define CPU_VTT_VOLTAGE                 16
138 #define PLUS_1P8_VOLTS                  17
139 
140 #define LAST_VOLTAGE                    17
141 
142 //
143 // Fan Speed Sensors and Controllers.
144 //
145 #define CPU_COOLING_FAN                 1
146 #define SYSTEM_COOLING_FAN              2
147 #define MCH_COOLING_FAN                 3
148 #define VR_COOLING_FAN                  4
149 #define CHASSIS_COOLING_FAN             5
150 #define CHASSIS_INLET_FAN               6
151 #define CHASSIS_OUTLET_FAN              7
152 #define PSU_COOLING_FAN                 8
153 #define PSU_INLET_FAN                   9
154 #define PSU_OUTLET_FAN                  10
155 #define DRIVE_COOLING_FAN               11
156 #define GPU_COOLING_FAN                 12
157 #define AUX_COOLING_FAN                 13
158 #define IOH_COOLING_FAN                 14
159 
160 #define LAST_FAN                        14
161 
162 //
163 // Fan Type Definitions
164 //
165 #define FAN_TYPE_UNKNOWN                0
166 #define FAN_3WIRE_PULSE                 1
167 #define FAN_3WIRE_VOLTAGE               2
168 #define FAN_4WIRE                       3
169 
170 #pragma pack(1)
171 
172 //
173 // TEMP_SENSOR_INFO - Structure providing info for a temperature sensor.
174 //
175 typedef struct _TEMP_SENSOR_INFO
176 {
177     UINT8                               byDevice;       // Device index
178     UINT8                               byIndex;        // Physical sensor index
179     UINT8                               byUsage;        // Usage indicator
180     UINT8                               bRelative;      // Relative vs. Absolute readings
181 
182 } TEMP_SENSOR_INFO, *P_TEMP_SENSOR_INFO;
183 
184 //
185 // TYPEDEF_TEMP_SENSOR_SECTION - Macro that can be used to typedef the
186 // TEMP_SENSOR_SECTION structure, which provides information about all
187 // temperature sensors.
188 //
189 #define TYPEDEF_TEMP_SENSOR_SECTION(count)                              \
190 typedef struct _TEMP_SENSOR_SECTION                                     \
191 {                                                                       \
192     UINT8                               byCount;                        \
193     TEMP_SENSOR_INFO                    stSensor[count];                \
194                                                                         \
195 } TEMP_SENSOR_SECTION, *P_TEMP_SENSOR_SECTION
196 
197 //
198 // VOLT_SENSOR_INFO - Structure providing info for a voltage sensor.
199 //
200 typedef struct _VOLT_SENSOR_INFO
201 {
202     UINT8                               byDevice;       // Device index
203     UINT8                               byIndex;        // Physical sensor index
204     UINT8                               byUsage;        // Usage indicator
205 
206 } VOLT_SENSOR_INFO, *P_VOLT_SENSOR_INFO;
207 
208 //
209 // TYPEDEF_VOLT_SENSOR_SECTION - Macro that can be used to typedef the
210 // VOLT_SENSOR_SECTION structure, which provides information about all
211 // voltage sensors.
212 //
213 #define TYPEDEF_VOLT_SENSOR_SECTION(count)                              \
214 typedef struct _VOLT_SENSOR_SECTION                                     \
215 {                                                                       \
216     UINT8                               byCount;                        \
217     VOLT_SENSOR_INFO                    stSensor[count];                \
218                                                                         \
219 } VOLT_SENSOR_SECTION, *P_VOLT_SENSOR_SECTION
220 
221 //
222 // FAN_SENSOR_INFO - Structure providing info for a fan speed sensor.
223 //
224 typedef struct _FAN_SENSOR_INFO
225 {
226     UINT8                               byDevice;       // Device index
227     UINT8                               byIndex;        // Physical sensor index
228     UINT8                               byUsage;        // Usage indicator
229     UINT8                               byType;         // Fan type
230     UINT8                               byController;   // Associated Fan Controller
231 
232 } FAN_SENSOR_INFO, *P_FAN_SENSOR_INFO;
233 
234 //
235 // TYPEDEF_FAN_SENSOR_SECTION - Macro that can be used to typedef the
236 // FAN_SENSOR_SECTION structure, which provides information about all fan
237 // speed sensors.
238 //
239 #define TYPEDEF_FAN_SENSOR_SECTION(count)                               \
240 typedef struct _FAN_SENSOR_SECTION                                      \
241 {                                                                       \
242     UINT8                               byCount;                        \
243     FAN_SENSOR_INFO                     stSensor[count];                \
244                                                                         \
245 } FAN_SENSOR_SECTION, *P_FAN_SENSOR_SECTION
246 
247 //
248 // FAN_CONTROLLER_INFO - Structure providing info for a fan speed controller.
249 //
250 #define MAX_ASSOC_FANS                  4
251 #define ASSOC_UNUSED                    0xFF
252 
253 typedef struct _FAN_CONTROLLER_INFO
254 {
255     UINT8                               byDevice;       // Device index
256     UINT8                               byIndex;        // Physical Controller Index
257     UINT8                               byUsage;        // Usage Indicator
258     UINT8                               byFan[MAX_ASSOC_FANS]; // Associated Fan Sensors
259 
260 } FAN_CONTROLLER_INFO, *P_FAN_CONTROLLER_INFO;
261 
262 //
263 // TYPEDEF_FAN_CONTROLLER_SECTION - Macro that can be used to typedef the
264 // FAN_CONTROLLER_SECTION structure, which provides information about all
265 // fan speed controllers.
266 //
267 #define TYPEDEF_FAN_CONTROLLER_SECTION(count)                           \
268 typedef struct _FAN_CONTROLLER_SECTION                                  \
269 {                                                                       \
270     UINT8                               byCount;                        \
271     FAN_CONTROLLER_INFO                 stController[count];            \
272                                                                         \
273 } FAN_CONTROLLER_SECTION, *P_FAN_CONTROLLER_SECTION
274 
275 //
276 // TYPEDEF_SENSOR_INFO_VAR - Macro that can be used to typedef the
277 // SENSOR_INFO_VAR structure, which provides information about all sensors
278 // and fan speed controllers. The other TYPEDEF macros must be invoked
279 // before using this one...
280 //
281 #define TYPEDEF_SENSOR_INFO_VAR                                         \
282 typedef struct _SENSOR_INFO_VAR                                         \
283 {                                                                       \
284     TEMP_SENSOR_SECTION                 stTemps;                        \
285     VOLT_SENSOR_SECTION                 stVolts;                        \
286     FAN_SENSOR_SECTION                  stFans;                         \
287     FAN_CONTROLLER_SECTION              stCtrls;                        \
288                                                                         \
289 } SENSOR_INFO_VAR, *P_SENSOR_INFO_VAR
290 
291 #pragma pack()
292 
293 #endif
294