forked from ibm-openbmc/openpower-vpd-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
defines.hpp
161 lines (136 loc) · 2.9 KB
/
defines.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
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
#pragma once
namespace openpower
{
namespace vpd
{
/** @brief OpenPOWER VPD records we're interested in */
enum class Record
{
VINI, /**< Initial information, common to all OpenPOWER FRUs */
OPFR, /**< OpenPOWER FRU information, common to all OpenPOWER FRUs */
OSYS /**< Information specific to a system board */
};
/** @brief Convert VPD Record name from enum to string
* @tparam R - VPD Record
* @returns string representation of Record name
*/
template <Record R>
constexpr const char* getRecord() = delete;
template <>
constexpr const char* getRecord<Record::VINI>()
{
return "VINI";
}
template <>
constexpr const char* getRecord<Record::OPFR>()
{
return "OPFR";
}
template <>
constexpr const char* getRecord<Record::OSYS>()
{
return "OSYS";
}
namespace record
{
/** @brief OpenPOWER VPD keywords we're interested in */
enum class Keyword
{
DR, /**< FRU name/description */
PN, /**< FRU part number */
SN, /**< FRU serial number */
CC, /**< Customer Card Identification Number (CCIN) */
HW, /**< FRU version */
B1, /**< MAC Address */
VN, /**< FRU manufacturer name */
MB, /**< FRU manufacture date */
MM, /**< FRU model */
UD, /**< System UUID */
VS, /**< OpenPower serial number */
VP /**< OpenPower part number */
};
/** @brief Convert VPD Keyword name from enum to string
* @tparam K - VPD Keyword
* @returns string representation of Keyword name
*/
template <Keyword K>
constexpr const char* getKeyword() = delete;
template <>
constexpr const char* getKeyword<Keyword::DR>()
{
return "DR";
}
template <>
constexpr const char* getKeyword<Keyword::PN>()
{
return "PN";
}
template <>
constexpr const char* getKeyword<Keyword::SN>()
{
return "SN";
}
template <>
constexpr const char* getKeyword<Keyword::CC>()
{
return "CC";
}
template <>
constexpr const char* getKeyword<Keyword::HW>()
{
return "HW";
}
template <>
constexpr const char* getKeyword<Keyword::B1>()
{
return "B1";
}
template <>
constexpr const char* getKeyword<Keyword::VN>()
{
return "VN";
}
template <>
constexpr const char* getKeyword<Keyword::MB>()
{
return "MB";
}
template <>
constexpr const char* getKeyword<Keyword::MM>()
{
return "MM";
}
template <>
constexpr const char* getKeyword<Keyword::UD>()
{
return "UD";
}
template <>
constexpr const char* getKeyword<Keyword::VS>()
{
return "VS";
}
template <>
constexpr const char* getKeyword<Keyword::VP>()
{
return "VP";
}
} // namespace record
/** @brief FRUs whose VPD we're interested in
*
* BMC The VPD on the BMC planar, for eg
* ETHERNET The ethernet card on the BMC
* ETHERNET1 The 2nd ethernet card on the BMC
*/
enum Fru
{
BMC,
ETHERNET,
ETHERNET1
};
static constexpr auto BD_YEAR_END = 4;
static constexpr auto BD_MONTH_END = 7;
static constexpr auto BD_DAY_END = 10;
static constexpr auto BD_HOUR_END = 13;
} // namespace vpd
} // namespace openpower