blob: 42924a3b140109d845eb1d6eb80a9d8a68b4b880 [file] [log] [blame]
Vishwa4be4b7a2015-10-31 22:55:50 -05001#ifndef __IPMI_WRITE_FRU_DATA_H__
2#define __IPMI_WRITE_FRU_DATA_H__
3
4#include <stdint.h>
5#include <stddef.h>
6
7// IPMI commands for Storage net functions.
8enum ipmi_netfn_storage_cmds
9{
10 IPMI_CMD_WRITE_FRU_DATA = 0x12
11};
12
13// Format of write fru data command
14struct write_fru_data_t
15{
16 uint8_t frunum;
17 uint8_t offsetls;
18 uint8_t offsetms;
19 uint8_t data;
20}__attribute__ ((packed));
21
22// Per IPMI v2.0 FRU specification
23struct common_header
24{
25 uint8_t fixed;
26 uint8_t internal_offset;
27 uint8_t chassis_offset;
28 uint8_t board_offset;
29 uint8_t product_offset;
30 uint8_t multi_offset;
31 uint8_t pad;
32 uint8_t crc;
33}__attribute__((packed));
34
35// Contains key info about a particular area.
36typedef struct
37{
38 uint8_t type;
39 uint8_t *offset;
40 size_t len;
41}__attribute__((packed)) fru_area_t;
42
43// first byte in header is 1h per IPMI V2 spec.
44#define IPMI_FRU_HDR_BYTE_ZERO 1
45#define IPMI_FRU_INTERNAL_OFFSET offsetof(struct common_header, internal_offset)
46#define IPMI_FRU_CHASSIS_OFFSET offsetof(struct common_header, chassis_offset)
47#define IPMI_FRU_BOARD_OFFSET offsetof(struct common_header, board_offset)
48#define IPMI_FRU_PRODUCT_OFFSET offsetof(struct common_header, product_offset)
49#define IPMI_FRU_MULTI_OFFSET offsetof(struct common_header, multi_offset)
50#define IPMI_FRU_HDR_CRC_OFFSET offsetof(struct common_header, crc)
51#define IPMI_EIGHT_BYTES 8
52
53#endif