1 #pragma once
2
3 namespace openpower
4 {
5 namespace vpd
6 {
7
8 /** @brief OpenPOWER VPD records we're interested in */
9 enum class Record
10 {
11 VINI, /**< Initial information, common to all OpenPOWER FRUs */
12 OPFR, /**< OpenPOWER FRU information, common to all OpenPOWER FRUs */
13 OSYS /**< Information specific to a system board */
14 };
15
16 /** @brief Convert VPD Record name from enum to string
17 * @tparam R - VPD Record
18 * @returns string representation of Record name
19 */
20 template <Record R>
21 constexpr const char* getRecord() = delete;
22
23 template <>
getRecord()24 constexpr const char* getRecord<Record::VINI>()
25 {
26 return "VINI";
27 }
28
29 template <>
getRecord()30 constexpr const char* getRecord<Record::OPFR>()
31 {
32 return "OPFR";
33 }
34
35 template <>
getRecord()36 constexpr const char* getRecord<Record::OSYS>()
37 {
38 return "OSYS";
39 }
40
41 namespace record
42 {
43
44 /** @brief OpenPOWER VPD keywords we're interested in */
45 enum class Keyword
46 {
47 DR, /**< FRU name/description */
48 PN, /**< FRU part number */
49 SN, /**< FRU serial number */
50 CC, /**< Customer Card Identification Number (CCIN) */
51 HW, /**< FRU version */
52 B1, /**< MAC Address */
53 VN, /**< FRU manufacturer name */
54 MB, /**< FRU manufacture date */
55 MM, /**< FRU model */
56 UD, /**< System UUID */
57 VS, /**< OpenPower serial number */
58 VP /**< OpenPower part number */
59 };
60
61 /** @brief Convert VPD Keyword name from enum to string
62 * @tparam K - VPD Keyword
63 * @returns string representation of Keyword name
64 */
65 template <Keyword K>
66 constexpr const char* getKeyword() = delete;
67
68 template <>
getKeyword()69 constexpr const char* getKeyword<Keyword::DR>()
70 {
71 return "DR";
72 }
73
74 template <>
getKeyword()75 constexpr const char* getKeyword<Keyword::PN>()
76 {
77 return "PN";
78 }
79
80 template <>
getKeyword()81 constexpr const char* getKeyword<Keyword::SN>()
82 {
83 return "SN";
84 }
85
86 template <>
getKeyword()87 constexpr const char* getKeyword<Keyword::CC>()
88 {
89 return "CC";
90 }
91
92 template <>
getKeyword()93 constexpr const char* getKeyword<Keyword::HW>()
94 {
95 return "HW";
96 }
97
98 template <>
getKeyword()99 constexpr const char* getKeyword<Keyword::B1>()
100 {
101 return "B1";
102 }
103
104 template <>
getKeyword()105 constexpr const char* getKeyword<Keyword::VN>()
106 {
107 return "VN";
108 }
109
110 template <>
getKeyword()111 constexpr const char* getKeyword<Keyword::MB>()
112 {
113 return "MB";
114 }
115
116 template <>
getKeyword()117 constexpr const char* getKeyword<Keyword::MM>()
118 {
119 return "MM";
120 }
121
122 template <>
getKeyword()123 constexpr const char* getKeyword<Keyword::UD>()
124 {
125 return "UD";
126 }
127
128 template <>
getKeyword()129 constexpr const char* getKeyword<Keyword::VS>()
130 {
131 return "VS";
132 }
133
134 template <>
getKeyword()135 constexpr const char* getKeyword<Keyword::VP>()
136 {
137 return "VP";
138 }
139
140 } // namespace record
141
142 /** @brief FRUs whose VPD we're interested in
143 *
144 * BMC The VPD on the BMC planar, for eg
145 * ETHERNET The ethernet card on the BMC
146 * ETHERNET1 The 2nd ethernet card on the BMC
147 */
148 enum Fru
149 {
150 BMC,
151 ETHERNET,
152 ETHERNET1
153 };
154
155 static constexpr auto BD_YEAR_END = 4;
156 static constexpr auto BD_MONTH_END = 7;
157 static constexpr auto BD_DAY_END = 10;
158 static constexpr auto BD_HOUR_END = 13;
159
160 } // namespace vpd
161 } // namespace openpower
162