blob: 6b0ce4575a66a0613e5c0499e8bedd3af42c0410 [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 */
55 MM /**< FRU model */
56};
57
Deepak Kodihalli158c0462016-11-21 21:33:28 -060058/** @brief Convert VPD Keyword name from enum to string
59 * @tparam K - VPD Keyword
60 * @returns string representation of Keyword name
61 */
62template<Keyword K>
63constexpr const char* getKeyword() = delete;
64
65template<>
66constexpr const char* getKeyword<Keyword::DR>()
67{
68 return "DR";
69}
70
71template<>
72constexpr const char* getKeyword<Keyword::PN>()
73{
74 return "PN";
75}
76
77template<>
78constexpr const char* getKeyword<Keyword::SN>()
79{
80 return "SN";
81}
82
83template<>
84constexpr const char* getKeyword<Keyword::CC>()
85{
86 return "CC";
87}
88
89template<>
90constexpr const char* getKeyword<Keyword::HW>()
91{
92 return "HW";
93}
94
95template<>
96constexpr const char* getKeyword<Keyword::B1>()
97{
98 return "B1";
99}
100
101template<>
102constexpr const char* getKeyword<Keyword::VN>()
103{
104 return "VN";
105}
106
107template<>
108constexpr const char* getKeyword<Keyword::MB>()
109{
110 return "MB";
111}
112
113template<>
114constexpr const char* getKeyword<Keyword::MM>()
115{
116 return "MM";
117}
118
Deepak Kodihalli1ea02332016-11-20 22:50:39 -0600119} // namespace record
120} // namespace vpd
121} // namespace openpower