1 /** @file
2   IPMI 2.0 definitions from the IPMI Specification Version 2.0, Revision 1.1.
3 
4   This file contains all NetFn Storage commands, including:
5     FRU Inventory Commands (Chapter 34)
6     SDR Repository (Chapter 33)
7     System Event Log(SEL) Commands (Chapter 31)
8     SEL Record Formats (Chapter 32)
9 
10   See IPMI specification, Appendix G, Command Assignments
11   and Appendix H, Sub-function Assignments.
12 
13   Copyright (c) 1999 - 2015, Intel Corporation. All rights reserved.<BR>
14   This program and the accompanying materials
15   are licensed and made available under the terms and conditions of the BSD License
16   which accompanies this distribution.  The full text of the license may be found at
17   http://opensource.org/licenses/bsd-license.php
18 
19   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
20   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
21 **/
22 
23 #ifndef _IPMI_NET_FN_STORAGE_H_
24 #define _IPMI_NET_FN_STORAGE_H_
25 
26 #pragma pack(1)
27 //
28 // Net function definition for Storage command
29 //
30 #define IPMI_NETFN_STORAGE  0x0A
31 
32 //
33 // All Storage commands and their structure definitions to follow here
34 //
35 
36 //
37 //  Below is Definitions for FRU Inventory Commands (Chapter 34)
38 //
39 
40 //
41 //  Definitions for Get Fru Inventory Area Info command
42 //
43 #define IPMI_STORAGE_GET_FRU_INVENTORY_AREAINFO  0x10
44 
45 //
46 //  Constants and Structure definitions for "Get Fru Inventory Area Info" command to follow here
47 //
48 
49 //
50 //  Definitions for Get Fru Data command
51 //
52 #define IPMI_STORAGE_READ_FRU_DATA 0x11
53 
54 //
55 //  Constants and Structure definitions for "Get Fru Data" command to follow here
56 //
57 typedef struct {
58   UINT8   FruDeviceId;
59   UINT16  FruOffset;
60 } IPMI_FRU_COMMON_DATA;
61 
62 typedef struct {
63   IPMI_FRU_COMMON_DATA Data;
64   UINT8                Count;
65 } IPMI_FRU_READ_COMMAND;
66 
67 //
68 //  Definitions for Write Fru Data command
69 //
70 #define IPMI_STORAGE_WRITE_FRU_DATA  0x12
71 
72 //
73 //  Constants and Structure definitions for "Write Fru Data" command to follow here
74 //
75 typedef struct {
76   IPMI_FRU_COMMON_DATA Data;
77   UINT8                FruData[16];
78 } IPMI_FRU_WRITE_COMMAND;
79 
80 //
81 //  Below is Definitions for SDR Repository (Chapter 33)
82 //
83 
84 //
85 //  Definitions for Get SDR Repository Info command
86 //
87 #define IPMI_STORAGE_GET_SDR_REPOSITORY_INFO 0x20
88 
89 //
90 //  Constants and Structure definitions for "Get SDR Repository Info" command to follow here
91 //
92 typedef struct {
93   UINT8   CompletionCode;
94   UINT8   Version;
95   UINT16  RecordCount;
96   UINT16  FreeSpace;
97   UINT32  RecentAdditionTimeStamp;
98   UINT32  RecentEraseTimeStamp;
99   UINT8   SdrRepAllocInfoCmd : 1;
100   UINT8   SdrRepReserveCmd : 1;
101   UINT8   PartialAddSdrCmd : 1;
102   UINT8   DeleteSdrRepCmd : 1;
103   UINT8   Reserved : 1;
104   UINT8   SdrRepUpdateOp : 2;
105   UINT8   Overflow : 1;
106 } IPMI_GET_SDR_REPOSITORY_INFO;
107 
108 //
109 //  Definitions for Get SDR Repository Allocateion Info command
110 //
111 #define IPMI_STORAGE_GET_SDR_REPOSITORY_ALLOCATION_INFO  0x21
112 
113 //
114 //  Constants and Structure definitions for "Get SDR Repository Allocateion Info" command to follow here
115 //
116 
117 //
118 //  Definitions for Reserve SDR Repository command
119 //
120 #define IPMI_STORAGE_RESERVE_SDR_REPOSITORY  0x22
121 
122 //
123 //  Constants and Structure definitions for "Reserve SDR Repository" command to follow here
124 //
125 
126 //
127 //  Definitions for Get SDR command
128 //
129 #define IPMI_STORAGE_GET_SDR 0x23
130 
131 //
132 //  Constants and Structure definitions for "Get SDR" command to follow here
133 //
134 
135 typedef struct {
136   UINT16  RecordId;                     // 1
137   UINT8   Version;                      // 3
138   UINT8   RecordType;                   // 4
139   UINT8   RecordLength;                 // 5
140   UINT8   OwnerId;                      // 6
141   UINT8   OwnerLun;                     // 7
142   UINT8   SensorNumber;                 // 8
143   UINT8   EntityId;                     // 9
144   UINT8   EntityInstance;               // 10
145   UINT8   EventScanningEnabled : 1;     // 11
146   UINT8   EventScanningDisabled : 1;    // 11
147   UINT8   InitSensorType : 1;           // 11
148   UINT8   InitHysteresis : 1;           // 11
149   UINT8   InitThresholds : 1;           // 11
150   UINT8   InitEvent : 1;                // 11
151   UINT8   InitScanning : 1;             // 11
152   UINT8   Reserved : 1;                 // 11
153   UINT8   EventMessageControl : 2;      // 12
154   UINT8   ThresholdAccessSupport : 2;   // 12
155   UINT8   HysteresisSupport : 2;        // 12
156   UINT8   ReArmSupport : 1;             // 12
157   UINT8   IgnoreSensor : 1;             // 12
158   UINT8   SensorType;                   // 13
159   UINT8   EventType;                    // 14
160   UINT8   Reserved1[7];                 // 15
161   UINT8   UnitType;                     // 22
162   UINT8   Reserved2;                    // 23
163   UINT8   Linearization : 7;            // 24
164   UINT8   Reserved3 : 1;                // 24
165   UINT8   MLo;                          // 25
166   UINT8   Toleremce : 6;                // 26
167   UINT8   MHi : 2;                      // 26
168   UINT8   BLo;                          // 27
169   UINT8   AccuracyLow : 6;              // 28
170   UINT8   BHi : 2;                      // 28
171   UINT8   Reserved4 : 2;                // 29
172   UINT8   AccuracyExp : 2;              // 29
173   UINT8   AccuracyHi : 4;               // 29
174   UINT8   BExp : 4;                     // 30
175   UINT8   RExp : 4;                     // 30
176   UINT8   NominalReadingSpscified : 1;  // 31
177   UINT8   NominalMaxSpscified : 1;      // 31
178   UINT8   NominalMinSpscified : 1;      // 31
179   UINT8   Reserved5 : 5;                // 31
180   UINT8   NominalReading;               // 32
181   UINT8   Reserved6[4];                 // 33
182   UINT8   UpperNonRecoverThreshold;     // 37
183   UINT8   UpperCriticalThreshold;       // 38
184   UINT8   UpperNonCriticalThreshold;    // 39
185   UINT8   LowerNonRecoverThreshold;     // 40
186   UINT8   LowerCriticalThreshold;       // 41
187   UINT8   LowerNonCriticalThreshold;    // 42
188   UINT8   Reserved7[5];                 // 43
189   UINT8   IdStringLength;               // 48
190   UINT8   AsciiIdString[16];            // 49 - 64
191 } IPMI_SDR_RECORD_STRUCT_1;
192 
193 typedef struct {
194   UINT16  RecordId;                     // 1
195   UINT8   Version;                      // 3
196   UINT8   RecordType;                   // 4
197   UINT8   RecordLength;                 // 5
198   UINT8   OwnerId;                      // 6
199   UINT8   OwnerLun;                     // 7
200   UINT8   SensorNumber;                 // 8
201   UINT8   EntityId;                     // 9
202   UINT8   EntityInstance;               // 10
203   UINT8   SensorScanning : 1;           // 11
204   UINT8   EventScanning : 1;            // 11
205   UINT8   InitSensorType : 1;           // 11
206   UINT8   InitHysteresis : 1;           // 11
207   UINT8   InitThresholds : 1;           // 11
208   UINT8   InitEvent : 1;                // 11
209   UINT8   InitScanning : 1;             // 11
210   UINT8   Reserved : 1;                 // 11
211   UINT8   EventMessageControl : 2;      // 12
212   UINT8   ThresholdAccessSupport : 2;   // 12
213   UINT8   HysteresisSupport : 2;        // 12
214   UINT8   ReArmSupport : 1;             // 12
215   UINT8   IgnoreSensor : 1;             // 12
216   UINT8   SensorType;                   // 13
217   UINT8   EventType;                    // 14
218   UINT8   Reserved1[7];                 // 15
219   UINT8   UnitType;                     // 22
220   UINT8   Reserved2[9];                 // 23
221   UINT8   IdStringLength;               // 32
222   UINT8   AsciiIdString[16];            // 33 - 48
223 } IPMI_SDR_RECORD_STRUCT_2;
224 
225 typedef struct {
226   UINT8 Reserved1 : 1;
227   UINT8 ControllerSlaveAddress : 7;
228   UINT8 FruDeviceId;
229   UINT8 BusId : 3;
230   UINT8 Lun : 2;
231   UINT8 Reserved : 2;
232   UINT8 LogicalFruDevice : 1;
233   UINT8 Reserved3 : 4;
234   UINT8 ChannelNumber : 4;
235 } IPMI_FRU_DATA_INFO;
236 
237 typedef struct {
238   UINT16            RecordId;           // 1
239   UINT8             Version;            // 3
240   UINT8             RecordType;         // 4
241   UINT8             RecordLength;       // 5
242   IPMI_FRU_DATA_INFO FruDeviceData;      // 6
243   UINT8             Reserved1;          // 10
244   UINT8             DeviceType;         // 11
245   UINT8             DeviceTypeModifier; // 12
246   UINT8             FruEntityId;        // 13
247   UINT8             FruEntityInstance;  // 14
248   UINT8             OemReserved;        // 15
249   UINT8             Length : 4;         // 16
250   UINT8             Reserved2 : 1;      // 16
251   UINT8             StringType : 3;     // 16
252   UINT8             String[16];         // 17
253 } IPMI_SDR_RECORD_STRUCT_11;
254 
255 typedef struct {
256   UINT16              NextRecordId;       //1
257   UINT16              RecordId;           //3
258   UINT8               Version;            //5
259   UINT8               RecordType;         //6
260   UINT8               RecordLength;       //7
261   UINT8               ManufacturerId[3];  //8
262   UINT8               StringChars[20];
263 } IPMI_SDR_RECORD_STRUCT_C0;
264 
265 typedef struct {
266   UINT16              NextRecordId;       //1
267   UINT16              RecordId;           //3
268   UINT8               Version;            //5
269   UINT8               RecordType;         //6
270   UINT8               RecordLength;       //7
271 } IPMI_SDR_RECORD_STRUCT_HEADER;
272 
273 typedef union {
274   IPMI_SDR_RECORD_STRUCT_1  SensorType1;
275   IPMI_SDR_RECORD_STRUCT_2  SensorType2;
276   IPMI_SDR_RECORD_STRUCT_11 SensorType11;
277   IPMI_SDR_RECORD_STRUCT_C0       SensorTypeC0;
278   IPMI_SDR_RECORD_STRUCT_HEADER   SensorHeader;
279 } IPMI_SENSOR_RECORD_STRUCT;
280 
281 typedef struct {
282   UINT16      ReservationId;
283   UINT16      RecordId;
284   UINT8       RecordOffset;
285   UINT8       BytesToRead;
286 } IPMI_GET_SDR_REQUEST;
287 
288 //
289 //  Definitions for Add SDR command
290 //
291 #define IPMI_STORAGE_ADD_SDR 0x24
292 
293 //
294 //  Constants and Structure definitions for "Add SDR" command to follow here
295 //
296 
297 //
298 //  Definitions for Partial Add SDR command
299 //
300 #define IPMI_STORAGE_PARTIAL_ADD_SDR 0x25
301 
302 //
303 //  Constants and Structure definitions for "Partial Add SDR" command to follow here
304 //
305 
306 //
307 //  Definitions for Delete SDR command
308 //
309 #define IPMI_STORAGE_DELETE_SDR  0x26
310 
311 //
312 //  Constants and Structure definitions for "Delete SDR" command to follow here
313 //
314 
315 //
316 //  Definitions for Clear SDR Repository command
317 //
318 #define IPMI_STORAGE_CLEAR_SDR 0x27
319 
320 //
321 //  Constants and Structure definitions for "Clear SDR Repository" command to follow here
322 //
323 
324 //
325 //  Definitions for Get SDR Repository Time command
326 //
327 #define IPMI_STORAGE_GET_SDR_REPOSITORY_TIME 0x28
328 
329 //
330 //  Constants and Structure definitions for "Get SDR Repository Time" command to follow here
331 //
332 
333 //
334 //  Definitions for Set SDR Repository Time command
335 //
336 #define IPMI_STORAGE_SET_SDR_REPOSITORY_TIME 0x29
337 
338 //
339 //  Constants and Structure definitions for "Set SDR Repository Time" command to follow here
340 //
341 
342 //
343 //  Definitions for Enter SDR Repository Update Mode command
344 //
345 #define IPMI_STORAGE_ENTER_SDR_UPDATE_MODE 0x2A
346 
347 //
348 //  Constants and Structure definitions for "Enter SDR Repository Update Mode" command to follow here
349 //
350 
351 //
352 //  Definitions for Exit SDR Repository Update Mode command
353 //
354 #define IPMI_STORAGE_EXIT_SDR_UPDATE_MODE  0x2B
355 
356 //
357 //  Constants and Structure definitions for "Exit SDR Repository Update Mode" command to follow here
358 //
359 
360 //
361 //  Definitions for Run Initialize Agent command
362 //
363 #define IPMI_STORAGE_RUN_INIT_AGENT  0x2C
364 
365 //
366 //  Constants and Structure definitions for "Run Initialize Agent" command to follow here
367 //
368 
369 //
370 //  Below is Definitions for System Event Log(SEL) Commands (Chapter 31)
371 //
372 
373 //
374 //  Definitions for Get SEL Info command
375 //
376 #define IPMI_STORAGE_GET_SEL_INFO  0x40
377 
378 //
379 //  Constants and Structure definitions for "Get SEL Info" command to follow here
380 //
381 typedef struct {
382   UINT8   CompletionCode;
383   UINT8   Version;              // Version of SEL
384   UINT16  NoOfEntries;          // No of Entries in the SEL
385   UINT16  FreeSpace;            // Free space in Bytes
386   UINT32  RecentAddTimeStamp;   // Most Recent Addition of Time Stamp
387   UINT32  RecentEraseTimeStamp; // Most Recent Erasure of Time Stamp
388   UINT8   OperationSupport;     // Operation Support
389 } IPMI_GET_SEL_INFO_RESPONSE;
390 
391 //
392 //  Definitions for Get SEL Allocation Info command
393 //
394 #define IPMI_STORAGE_GET_SEL_ALLOCATION_INFO 0x41
395 
396 //
397 //  Constants and Structure definitions for "Get SEL Allocation Info" command to follow here
398 //
399 
400 //
401 //  Definitions for Reserve SEL command
402 //
403 #define IPMI_STORAGE_RESERVE_SEL 0x42
404 
405 //
406 //  Constants and Structure definitions for "Reserve SEL" command to follow here
407 //
408 
409 //
410 //  Definitions for Get SEL Entry command
411 //
412 #define IPMI_STORAGE_GET_SEL_ENTRY 0x43
413 
414 //
415 //  Constants and Structure definitions for "Get SEL Entry" command to follow here
416 //
417 typedef struct {
418   UINT8 ReserveId[2]; // Reservation ID, LS Byte First
419   UINT8 SelRecID[2];  // Sel Record ID, LS Byte First
420   UINT8 Offset;       // Offset Into Record
421   UINT8 BytesToRead;  // Bytes to be Read, 0xFF for entire record
422 } IPMI_GET_SEL_ENTRY_REQUEST;
423 
424 //
425 //  Definitions for Add SEL Entry command
426 //
427 #define IPMI_STORAGE_ADD_SEL_ENTRY 0x44
428 
429 //
430 //  Constants and Structure definitions for "Add SEL Entry" command to follow here
431 //
432 
433 //
434 //  Definitions for Partial Add SEL Entry command
435 //
436 #define IPMI_STORAGE_PARTIAL_ADD_SEL_ENTRY 0x45
437 
438 //
439 //  Constants and Structure definitions for "Partial Add SEL Entry" command to follow here
440 //
441 
442 //
443 //  Definitions for Delete SEL Entry command
444 //
445 #define IPMI_STORAGE_DELETE_SEL_ENTRY  0x46
446 
447 //
448 //  Constants and Structure definitions for "Delete SEL Entry" command to follow here
449 //
450 typedef struct {
451   UINT8 ReserveId[2];       // Reservation ID, LS byte first
452   UINT8 RecordToDelete[2];  // Record to Delete, LS Byte First
453 } IPMI_DELETE_SEL_REQUEST;
454 
455 //
456 //  Definitions for Clear SEL command
457 //
458 #define IPMI_STORAGE_CLEAR_SEL 0x47
459 
460 //
461 //  Constants and Structure definitions for "Clear SEL" command to follow here
462 //
463 typedef struct {
464   UINT8 Reserve[2]; // Reserve ID, LSB first
465   UINT8 AscC;       // Ascii for 'C' (0x43)
466   UINT8 AscL;       // Ascii for 'L' (0x4c)
467   UINT8 AscR;       // Ascii for 'R' (0x52)
468   UINT8 Erase;      // 0xAA, Initiate Erase, 0x00 Get Erase Status
469 } IPMI_CLEAR_SEL_REQUEST;
470 
471 //
472 //  Definitions for Get SEL Time command
473 //
474 #define IPMI_STORAGE_GET_SEL_TIME  0x48
475 
476 //
477 //  Constants and Structure definitions for "Get SEL Time" command to follow here
478 //
479 
480 //
481 //  Definitions for Set SEL Time command
482 //
483 #define IPMI_STORAGE_SET_SEL_TIME  0x49
484 
485 //
486 //  Constants and Structure definitions for "Set SEL Time" command to follow here
487 //
488 
489 //
490 //  Definitions for Get Auxillary Log Status command
491 //
492 #define IPMI_STORAGE_GET_AUXILLARY_LOG_STATUS  0x5A
493 
494 //
495 //  Constants and Structure definitions for "Get Auxillary Log Status" command to follow here
496 //
497 
498 //
499 //  Definitions for Set Auxillary Log Status command
500 //
501 #define IPMI_STORAGE_SET_AUXILLARY_LOG_STATUS  0x5B
502 
503 //
504 //  Constants and Structure definitions for "Set Auxillary Log Status" command to follow here
505 //
506 
507 #define IPMI_COMPLETE_SEL_RECORD 0xFF
508 
509 //
510 //  Below is Definitions for SEL Record Formats (Chapter 32)
511 //
512 typedef struct {
513   UINT16  RecordId;
514   UINT8   RecordType;
515   UINT32  TimeStamp;
516   UINT16  GeneratorId;
517   UINT8   EvMRevision;
518   UINT8   SensorType;
519   UINT8   SensorNumber;
520   UINT8   EventDirType;
521   UINT8   OEMEvData1;
522   UINT8   OEMEvData2;
523   UINT8   OEMEvData3;
524 } IPMI_SEL_EVENT_RECORD_DATA;
525 
526 #define IPMI_SEL_SYSTEM_RECORD                     0x02
527 
528 #define IPMI_EVM_REVISION                          0x04
529 #define IPMI_BIOS_ID                               0x18
530 #define IPMI_FORMAT_REV                            0x00
531 #define IPMI_FORMAT_REV1                           0x01
532 #define IPMI_SOFTWARE_ID                           0x01
533 #define IPMI_PLATFORM_VAL_ID                       0x01
534 #define IPMI_GENERATOR_ID(i,f)                     ((i << 1) | (f << 1) | IPMI_SOFTWARE_ID)
535 
536 #define IPMI_SENSOR_TYPE_EVENT_CODE_DISCRETE       0x6F
537 
538 #define IPMI_OEM_SPECIFIC_DATA                     0x02
539 #define IPMI_SENSOR_SPECIFIC_DATA                  0x03
540 
541 #pragma pack()
542 #endif
543