-
Notifications
You must be signed in to change notification settings - Fork 25
/
frup.hpp
115 lines (96 loc) · 3.22 KB
/
frup.hpp
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
#ifndef OPENBMC_IPMI_FRU_PARSER_H
#define OPENBMC_IPMI_FRU_PARSER_H
#include <systemd/sd-bus.h>
#include <array>
#include <map>
#include <string>
#include <utility>
#include <vector>
enum ipmi_fru_area_type
{
IPMI_FRU_AREA_INTERNAL_USE = 0x00,
IPMI_FRU_AREA_CHASSIS_INFO,
IPMI_FRU_AREA_BOARD_INFO,
IPMI_FRU_AREA_PRODUCT_INFO,
IPMI_FRU_AREA_MULTI_RECORD,
IPMI_FRU_AREA_TYPE_MAX
};
enum openbmc_vpd_key_id
{
OPENBMC_VPD_KEY_CHASSIS_TYPE = 1, /* not a type/len */
OPENBMC_VPD_KEY_CHASSIS_PART_NUM,
OPENBMC_VPD_KEY_CHASSIS_SERIAL_NUM,
OPENBMC_VPD_KEY_CHASSIS_CUSTOM1,
OPENBMC_VPD_KEY_CHASSIS_CUSTOM2,
OPENBMC_VPD_KEY_CHASSIS_CUSTOM3,
OPENBMC_VPD_KEY_CHASSIS_CUSTOM4,
OPENBMC_VPD_KEY_CHASSIS_CUSTOM5,
OPENBMC_VPD_KEY_CHASSIS_CUSTOM6,
OPENBMC_VPD_KEY_CHASSIS_CUSTOM7,
OPENBMC_VPD_KEY_CHASSIS_CUSTOM8,
OPENBMC_VPD_KEY_CHASSIS_MAX = OPENBMC_VPD_KEY_CHASSIS_CUSTOM8,
/* TODO: chassis_custom_fields */
OPENBMC_VPD_KEY_BOARD_MFG_DATE, /* not a type/len */
OPENBMC_VPD_KEY_BOARD_MFR,
OPENBMC_VPD_KEY_BOARD_NAME,
OPENBMC_VPD_KEY_BOARD_SERIAL_NUM,
OPENBMC_VPD_KEY_BOARD_PART_NUM,
OPENBMC_VPD_KEY_BOARD_FRU_FILE_ID,
OPENBMC_VPD_KEY_BOARD_CUSTOM1,
OPENBMC_VPD_KEY_BOARD_CUSTOM2,
OPENBMC_VPD_KEY_BOARD_CUSTOM3,
OPENBMC_VPD_KEY_BOARD_CUSTOM4,
OPENBMC_VPD_KEY_BOARD_CUSTOM5,
OPENBMC_VPD_KEY_BOARD_CUSTOM6,
OPENBMC_VPD_KEY_BOARD_CUSTOM7,
OPENBMC_VPD_KEY_BOARD_CUSTOM8,
OPENBMC_VPD_KEY_BOARD_MAX = OPENBMC_VPD_KEY_BOARD_CUSTOM8,
/* TODO: board_custom_fields */
OPENBMC_VPD_KEY_PRODUCT_MFR,
OPENBMC_VPD_KEY_PRODUCT_NAME,
OPENBMC_VPD_KEY_PRODUCT_PART_MODEL_NUM,
OPENBMC_VPD_KEY_PRODUCT_VER,
OPENBMC_VPD_KEY_PRODUCT_SERIAL_NUM,
OPENBMC_VPD_KEY_PRODUCT_ASSET_TAG,
OPENBMC_VPD_KEY_PRODUCT_FRU_FILE_ID,
OPENBMC_VPD_KEY_PRODUCT_CUSTOM1,
OPENBMC_VPD_KEY_PRODUCT_CUSTOM2,
OPENBMC_VPD_KEY_PRODUCT_CUSTOM3,
OPENBMC_VPD_KEY_PRODUCT_CUSTOM4,
OPENBMC_VPD_KEY_PRODUCT_CUSTOM5,
OPENBMC_VPD_KEY_PRODUCT_CUSTOM6,
OPENBMC_VPD_KEY_PRODUCT_CUSTOM7,
OPENBMC_VPD_KEY_PRODUCT_CUSTOM8,
OPENBMC_VPD_KEY_PRODUCT_MAX = OPENBMC_VPD_KEY_PRODUCT_CUSTOM8,
OPENBMC_VPD_KEY_MAX,
OPENBMC_VPD_KEY_CUSTOM_FIELDS_MAX = 8,
};
using IPMIFruInfo =
std::array<std::pair<std::string, std::string>, OPENBMC_VPD_KEY_MAX>;
struct IPMIFruData
{
std::string section;
std::string property;
std::string delimiter;
};
using DbusProperty = std::string;
using DbusPropertyVec = std::vector<std::pair<DbusProperty, IPMIFruData>>;
using DbusInterface = std::string;
using DbusInterfaceVec = std::vector<std::pair<DbusInterface, DbusPropertyVec>>;
using FruInstancePath = std::string;
struct FruInstance
{
uint8_t entityID;
uint8_t entityInstance;
FruInstancePath path;
DbusInterfaceVec interfaces;
};
using FruInstanceVec = std::vector<FruInstance>;
using FruId = uint32_t;
using FruMap = std::map<FruId, FruInstanceVec>;
/* Parse an IPMI write fru data message into a dictionary containing name value
* pair of VPD entries.*/
int parse_fru(const void* msgbuf, sd_bus_message* vpdtbl);
int parse_fru_area(const uint8_t area, const void* msgbuf, const size_t len,
IPMIFruInfo& info);
#endif