blob: 89c20acf60e77365c4220019c818719c1abba383 [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>
vishwa13555bd2015-11-10 12:10:38 -06006#include <systemd/sd-bus.h>
Vishwa4be4b7a2015-10-31 22:55:50 -05007
8// IPMI commands for Storage net functions.
9enum ipmi_netfn_storage_cmds
10{
11 IPMI_CMD_WRITE_FRU_DATA = 0x12
12};
13
14// Format of write fru data command
15struct write_fru_data_t
16{
17 uint8_t frunum;
18 uint8_t offsetls;
19 uint8_t offsetms;
20 uint8_t data;
21}__attribute__ ((packed));
22
23// Per IPMI v2.0 FRU specification
24struct common_header
25{
26 uint8_t fixed;
27 uint8_t internal_offset;
28 uint8_t chassis_offset;
29 uint8_t board_offset;
30 uint8_t product_offset;
31 uint8_t multi_offset;
32 uint8_t pad;
33 uint8_t crc;
34}__attribute__((packed));
35
36// Contains key info about a particular area.
37typedef struct
38{
39 uint8_t type;
40 uint8_t *offset;
41 size_t len;
42}__attribute__((packed)) fru_area_t;
43
44// first byte in header is 1h per IPMI V2 spec.
45#define IPMI_FRU_HDR_BYTE_ZERO 1
46#define IPMI_FRU_INTERNAL_OFFSET offsetof(struct common_header, internal_offset)
47#define IPMI_FRU_CHASSIS_OFFSET offsetof(struct common_header, chassis_offset)
48#define IPMI_FRU_BOARD_OFFSET offsetof(struct common_header, board_offset)
49#define IPMI_FRU_PRODUCT_OFFSET offsetof(struct common_header, product_offset)
50#define IPMI_FRU_MULTI_OFFSET offsetof(struct common_header, multi_offset)
51#define IPMI_FRU_HDR_CRC_OFFSET offsetof(struct common_header, crc)
52#define IPMI_EIGHT_BYTES 8
53
vishwa13555bd2015-11-10 12:10:38 -060054extern "C" int ipmi_validate_fru_area(const uint8_t, const char *, sd_bus *);
55
Vishwa4be4b7a2015-10-31 22:55:50 -050056#endif