blob: dda0530d9a8b111184e0f0303ced38fbd360465f [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 */
Matt Spinlercfbb1ff2018-05-10 10:43:03 -050056 UD, /**< System UUID */
57 VS, /**< OpenPower serial number */
58 VP /**< OpenPower part number */
Deepak Kodihalli1ea02332016-11-20 22:50:39 -060059};
60
Deepak Kodihalli158c0462016-11-21 21:33:28 -060061/** @brief Convert VPD Keyword name from enum to string
62 * @tparam K - VPD Keyword
63 * @returns string representation of Keyword name
64 */
65template<Keyword K>
66constexpr const char* getKeyword() = delete;
67
68template<>
69constexpr const char* getKeyword<Keyword::DR>()
70{
71 return "DR";
72}
73
74template<>
75constexpr const char* getKeyword<Keyword::PN>()
76{
77 return "PN";
78}
79
80template<>
81constexpr const char* getKeyword<Keyword::SN>()
82{
83 return "SN";
84}
85
86template<>
87constexpr const char* getKeyword<Keyword::CC>()
88{
89 return "CC";
90}
91
92template<>
93constexpr const char* getKeyword<Keyword::HW>()
94{
95 return "HW";
96}
97
98template<>
99constexpr const char* getKeyword<Keyword::B1>()
100{
101 return "B1";
102}
103
104template<>
105constexpr const char* getKeyword<Keyword::VN>()
106{
107 return "VN";
108}
109
110template<>
111constexpr const char* getKeyword<Keyword::MB>()
112{
113 return "MB";
114}
115
116template<>
117constexpr const char* getKeyword<Keyword::MM>()
118{
119 return "MM";
120}
121
Dinesh Chinaric576b482017-07-17 16:34:10 -0500122template<>
123constexpr const char* getKeyword<Keyword::UD>()
124{
125 return "UD";
126}
127
Matt Spinlercfbb1ff2018-05-10 10:43:03 -0500128template<>
129constexpr const char* getKeyword<Keyword::VS>()
130{
131 return "VS";
132}
133
134template<>
135constexpr const char* getKeyword<Keyword::VP>()
136{
137 return "VP";
138}
139
Deepak Kodihalli1ea02332016-11-20 22:50:39 -0600140} // namespace record
Deepak Kodihalli82c1e562016-11-28 06:06:50 -0600141
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 */
147enum Fru
148{
149 BMC,
150 ETHERNET
151};
152
Deepak Kodihalli1ea02332016-11-20 22:50:39 -0600153} // namespace vpd
154} // namespace openpower