blob: 84ddae3f21555d0e445bd3ec6b7abd0ed9028bfe [file] [log] [blame]
Deepak Kodihalli1ea02332016-11-20 22:50:39 -06001#pragma once
2
3namespace openpower
4{
5namespace vpd
6{
7
8/** @brief OpenPOWER VPD records we're interested in */
9enum 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
Deepak Kodihalli158c0462016-11-21 21:33:28 -060016/** @brief Convert VPD Record name from enum to string
17 * @tparam R - VPD Record
18 * @returns string representation of Record name
19 */
20template<Record R>
21constexpr const char* getRecord() = delete;
22
23template<>
24constexpr const char* getRecord<Record::VINI>()
25{
26 return "VINI";
27}
28
29template<>
30constexpr const char* getRecord<Record::OPFR>()
31{
32 return "OPFR";
33}
34
35template<>
36constexpr const char* getRecord<Record::OSYS>()
37{
38 return "OSYS";
39}
40
Deepak Kodihalli1ea02332016-11-20 22:50:39 -060041namespace record
42{
43
44/** @brief OpenPOWER VPD keywords we're interested in */
45enum 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 */
Dinesh Chinaric576b482017-07-17 16:34:10 -050055 MM, /**< FRU model */
56 UD /**< System UUID */
Deepak Kodihalli1ea02332016-11-20 22:50:39 -060057};
58
Deepak Kodihalli158c0462016-11-21 21:33:28 -060059/** @brief Convert VPD Keyword name from enum to string
60 * @tparam K - VPD Keyword
61 * @returns string representation of Keyword name
62 */
63template<Keyword K>
64constexpr const char* getKeyword() = delete;
65
66template<>
67constexpr const char* getKeyword<Keyword::DR>()
68{
69 return "DR";
70}
71
72template<>
73constexpr const char* getKeyword<Keyword::PN>()
74{
75 return "PN";
76}
77
78template<>
79constexpr const char* getKeyword<Keyword::SN>()
80{
81 return "SN";
82}
83
84template<>
85constexpr const char* getKeyword<Keyword::CC>()
86{
87 return "CC";
88}
89
90template<>
91constexpr const char* getKeyword<Keyword::HW>()
92{
93 return "HW";
94}
95
96template<>
97constexpr const char* getKeyword<Keyword::B1>()
98{
99 return "B1";
100}
101
102template<>
103constexpr const char* getKeyword<Keyword::VN>()
104{
105 return "VN";
106}
107
108template<>
109constexpr const char* getKeyword<Keyword::MB>()
110{
111 return "MB";
112}
113
114template<>
115constexpr const char* getKeyword<Keyword::MM>()
116{
117 return "MM";
118}
119
Dinesh Chinaric576b482017-07-17 16:34:10 -0500120template<>
121constexpr const char* getKeyword<Keyword::UD>()
122{
123 return "UD";
124}
125
Deepak Kodihalli1ea02332016-11-20 22:50:39 -0600126} // namespace record
Deepak Kodihalli82c1e562016-11-28 06:06:50 -0600127
128/** @brief FRUs whose VPD we're interested in
129 *
130 * BMC The VPD on the BMC planar, for eg
131 * ETHERNET The ethernet card on the BMC
132 */
133enum Fru
134{
135 BMC,
136 ETHERNET
137};
138
Deepak Kodihalli1ea02332016-11-20 22:50:39 -0600139} // namespace vpd
140} // namespace openpower