hc
2024-03-25 edb30157bad0c0001c32b854271ace01d3b9a16a
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
/** @file
  Generic Definations for Server Management Header File.
 
  @copyright
  Copyright 1999 - 2021 Intel Corporation. <BR>
  SPDX-License-Identifier: BSD-2-Clause-Patent
**/
 
#ifndef _SERVER_MANAGEMENT_H_
#define _SERVER_MANAGEMENT_H_
 
//
// Defines
//
#define PRIM_IPMB_CHANNEL       0x0
#define BMC_LUN                 0x0
#define PRESENT_INTERFACE       0xE
#define SYSTEM_INTERFACE        0xF
#define COMPLETE_SEL_RECORD     0xFF
#define IPMI_UNSPECIFIED_ERROR  0xFF
 
//
// Net Function Defines.
//
#define SM_CHASSIS      0x0
#define SM_BRIDGE       0x2
#define SM_SENSOR_EVENT 0x4
#define SM_APPLICATION  0x6
#define SM_FIRMWARE     0x8
#define SM_STORAGE      0xA
#define SM_TRANSPORT    0xC
#define SM_GROUP_EXT    0x2C
#define SM_OEM_GROUP    0x2E
#define SM_INTEL_OEM    0x30
#define SM_SOL_OEM      0x34
 
//
// IPMI Command Definations.
//
#define IPMI_GET_DEVICE_ID          1
#define IPMI_COLD_RESET             2
#define IPMI_WARM_RESET             3
#define IPMI_GET_SELF_TEST_RESULTS  4
#define IPMI_MFG_MODE_ON            5
#define IPMI_SET_ACPI_POWER_STATE   6
#define IPMI_GET_ACPI_POWER_STATE   7
#define IPMI_GET_DEVICE_GUID        8
 
#define IPMI_GET_MESSAGE_FLAGS      0x31
#define IPMI_GET_MESSAGE            0x33
#define IPMI_SEND_MESSAGE           0x34
 
#define RESERVE_SEL_ENTRY               0x42
#define ADD_SEL_ENTRY                   0x44
#define GET_SEL_ENTRY                   0x43
#define DELETE_SEL_ENTRY                0x46
#define CLEAR_SEL_ENTRY                 0x47
#define SET_BMC_GLOBALS                 0x2E
#define GET_BMC_GLOBALS                 0x2F
#define SET_SEL_TIME                    0x49
 
#define GET_SELF_TEST_RESULTS           0x4
 
#define NMI_ENABLE_DISABLE              0xF7
 
//
// Controller Attributes
//
#define IPMI_SENSOR_DEVICE_SUPPORT    0x1
#define IPMB_SDR_REPOSITORY_SUPPORT   0x2
#define IPMI_SEL_DEVICE_SUPPORT       0x4
#define IPMI_FRU_INVENTORY_SUPPORT    0x8
#define IPMB_EVENT_RECEIVER_SUPPORT   0x10
#define IPMB_EVENT_GENERATOR_SUPPORT  0x20
#define ICMB_BRIDGE_SUPPORT           0x40
#define ICMB_CHASSIS_DEVICE_SUPPORT   0x80
#define SM_TCP_SUPPORT                0x100
#define SM_UDP_SUPPORT                0x200
#define SM_IPV4_SUPPORT               0x400
#define SM_IPV6_SUPPORT               0x800
#define SM_RS232_SUPPORT              0x1000
 
//
// Sensor Type Definations
//
typedef enum {
  SensorReserved,
  SensorTemperature,
  SensorVoltage,
  SensorCurrent,
  SensorFan,
  SensorPhysicalSecurity,
  SensorPlatformSecurityViolationAttempt,
  SensorProcessor,
  SensorPowerSupply,
  SensorPowerUnit,
  SensorCoolingDevice,
  SensorOtherUnits,
  SensorMemory,
  SensorDriveSlot,
  SensorPOSTMemoryResize,
  SensorSystemFirmwareProgress,
  SensorEventLoggingDisabled,
  SensorWatchdog1,
  SensorSystemEvent,
  SensorCriticalInterrupt,
  SensorButton,
  SensorModuleBoard,
  SensorMicrocontrollerCoprocessor,
  SensorAddinCard,
  SensorChassis,
  SensorChipSet,
  SensorOtherFRU,
  SensorCableInterconnect,
  SensorTerminator,
  SensorSystemBootInitiated,
  SensorBootError,
  SensorOSBoot,
  SensorOSCriticalStop,
  SensorSlotConnector,
  SensorSystemACPIPowerState,
  SensorWatchdog2,
  SensorPlatformAlert,
  SensorEntityPresence,
  SensorMonitorASIC,
  SensorLAN,
  SensorManagementSubsystemHealth
} SM_SENSOR_TYPE;
 
//
// Sensor Event Type Code
//
#define SENSOR_THRESHOLD_EVENT_TYPE 1
#define SENSOR_SPECIFIC_EVENT_TYPE  0x6F
 
//
// THRESHOLD SENSOR TYPE BIT MASK
//
#define LOWER_NON_CRITICAL_GOING_LOW  0x1
#define LOWER_NON_CRITICAL_GOING_HI   0x2
#define LOWER_CRITICAL_GOING_LOW      0x4
#define LOWER_CRITICAL_GOING_HI       0x8
#define LOWER_NON_RECOVER_GOING_LOW   0x10
#define LOWER_NON_RECOVER_GOING_HI    0x20
#define UPPER_NON_CRITICAL_GOING_LOW  0x40
#define UPPER_NON_CRITICAL_GOING_HI   0x80
#define UPPER_CRITICAL_GOING_LOW      0x100
#define UPPER_CRITICAL_GOING_HI       0x200
#define UPPER_NON_RECOVER_GOING_LOW   0x400
#define UPPER_NON_RECOVER_GOING_HI    0x800
 
//
// Server Management COM Addressing types
//
typedef enum {
  SmReserved,
  SmIpmb,
  SmIcmb1_0,
  SmIcmb0_9,
  Sm802_3_Lan,
  SmRs_232,
  SmOtherLan,
  SmPciSmBus,
  SmSmBus1_0,
  SmSmBus2_0,
  SmUsb1_x,
  SmUsb2_x,
  SmBmc
} SM_CHANNEL_MEDIA_TYPE;
 
typedef enum {
  SmTcp,
  SmUdp,
  SmIcmp,
  SmIpmi
} SM_PROTOCOL_TYPE;
 
typedef enum {
  SmMessage,
  SmRawData
} SM_DATA_TYPE;
 
typedef struct {
  BOOLEAN IpAddressType;
  UINT16  IpPort;
  UINT8   IpAddress[16];
} SM_IP_ADDRESS;
 
typedef struct {
  UINT8 SlaveAddress;
  UINT8 LunAddress;
  UINT8 NetFunction;
  UINT8 ChannelAddress;
} SM_IPMI_ADDRESS;
 
typedef struct {
  UINT8 SerialPortNumber;
} SM_SERIAL_ADDRESS;
 
typedef union {
  SM_IP_ADDRESS     IpAddress;
  SM_IPMI_ADDRESS   BmcAddress;
  SM_SERIAL_ADDRESS SerialAddress;
} SM_COM_ADDRESS_TYPE;
 
typedef struct {
  SM_CHANNEL_MEDIA_TYPE ChannelType;
  SM_COM_ADDRESS_TYPE   Address;
} SM_COM_ADDRESS;
 
#pragma pack(1)
//
// Sensor Reading Data
//
typedef enum {
  DataLinear,                                   // Linear
  DataNaturalLog,                               // Ln(x)
  DataLog10,                                    // Log10(x)
  DataLog2,                                     // Log2(x)
  Datae,                                        // e
  DataExp10,                                    // Exp 10
  DataExp2,                                     // Exp 2
  DataInverse,                                  // 1/x
  DataSqr,                                      // Sqr
  DataCube,                                     // Cube
  DataSqrt,                                     // Square Root
  DataCubeInverse                               // Cube-1 (x)
} LINERIZATION_TYPE;
 
typedef union {
  UINT8   SensorUint8Data[2];
  UINT16  SensorUint16Data;
} SENSOR_SPLIT_DATA;
 
typedef struct {
  LINERIZATION_TYPE Linearization;              // L
  UINT8             Tolerance;                  // Tolerance
  UINT8             AdditiveOffsetExp;          // k1
  UINT8             AccuracyExp;                // Accuracy Exponential
  UINT8             ResultExponent;             // k2
  SENSOR_SPLIT_DATA IntegerConstantMultiplier;  // M
  SENSOR_SPLIT_DATA AdditiveOffset;             // B
  SENSOR_SPLIT_DATA Accuracy;                   // Accuracy
} SENSOR_CONVERSION_DATA;
 
//
// Server Management Controller Information
//
typedef struct {
  UINT8   CompletionCode;
  UINT8   DeviceId;
  UINT8   DeviceRevision : 4;
  UINT8   Reserved : 3;
  UINT8   DeviceSdr : 1;
  UINT8   MajorFirmwareRev : 7;
  UINT8   UpdateMode : 1;
  UINT8   MinorFirmwareRev;
  UINT8   SpecificationVersion;
  UINT8   SensorDeviceSupport : 1;
  UINT8   SdrRepositorySupport : 1;
  UINT8   SelDeviceSupport : 1;
  UINT8   FruInventorySupport : 1;
  UINT8   IPMBMessageReceiver : 1;
  UINT8   IPMBMessageGenerator : 1;
  UINT8   BridgeSupport : 1;
  UINT8   ChassisSupport : 1;
  UINT8   ManufacturerId[3];
  UINT16  ProductId;
  UINT32  AuxFirmwareRevInfo;
} SM_CTRL_INFO;
 
typedef struct {
  UINT8 Reserved1 : 1;
  UINT8 ControllerSlaveAddress : 7;
  UINT8 FruDeviceId;
  UINT8 BusId : 3;
  UINT8 Lun : 2;
  UINT8 Reserved : 2;
  UINT8 LogicalFruDevice : 1;
  UINT8 Reserved3 : 4;
  UINT8 ChannelNumber : 4;
} FRU_DATA_INFO;
#pragma pack()
 
typedef enum {
  Unicode,
  BcdPlus,
  Ascii6BitPacked,
  AsciiLatin1
} SENSOR_ID_STRING_TYPE;
 
//
// SENSOR Structures
//
typedef struct {
  BOOLEAN                     Valid;              // Data is Valid
  SENSOR_CONVERSION_DATA      ConversionParam;    // Conversion Parameters
  UINT8                       UpperNonRec;        // Upper Non Recoverable
  UINT8                       UpperCritical;      // Upper Critical
  UINT8                       UpperNonCritical;   // Upper Non Critical
  UINT8                       LowerNonRec;        // Lower Non Recoverable
  UINT8                       LowerCritical;      // Lower Critical
  UINT8                       LowerNonCritical;   // Lower Non Critical
} SENSOR_THRESHOLD_STRUCT;
 
typedef struct {
  BOOLEAN                     Valid;              // Structure Valid
  SENSOR_CONVERSION_DATA      ConversionParam;    // Conversion Parameters
  SENSOR_ID_STRING_TYPE       SensorIdStringType; // Sensor ID String type
  UINT8                       NominalReading;     // Nominal Reading of the Sensor
  UINT8                       SensorId[16];       // Sensor Description
} SENSOR_READING_STRUCT;
 
//
//  IPMI HOB
//
typedef struct {
  UINT16  IoBasePort;
} IPMI_HOB_DATA;
 
//
// COM Layer Callback
//
typedef
EFI_STATUS
(EFIAPI *SM_CALLBACK_PROC) (
  OUT  EFI_STATUS                          Status,
  IN  VOID                                 *UserContext
  );
 
typedef struct {
  SM_CALLBACK_PROC      SmCallback;
  VOID                  *UserContext;
} SM_CALLBACK;
 
#endif  // _SERVER_MANAGEMENT_H_