blob: 0d493aca4cc9631997769934632a35a04fb4f4f6 [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 */
Patrick Venturec83c4dc2018-11-01 16:29:18 -070020template <Record R>
Deepak Kodihalli158c0462016-11-21 21:33:28 -060021constexpr const char* getRecord() = delete;
22
Patrick Venturec83c4dc2018-11-01 16:29:18 -070023template <>
Deepak Kodihalli158c0462016-11-21 21:33:28 -060024constexpr const char* getRecord<Record::VINI>()
25{
26 return "VINI";
27}
28
Patrick Venturec83c4dc2018-11-01 16:29:18 -070029template <>
Deepak Kodihalli158c0462016-11-21 21:33:28 -060030constexpr const char* getRecord<Record::OPFR>()
31{
32 return "OPFR";
33}
34
Patrick Venturec83c4dc2018-11-01 16:29:18 -070035template <>
Deepak Kodihalli158c0462016-11-21 21:33:28 -060036constexpr 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{
Patrick Venturec83c4dc2018-11-01 16:29:18 -070047 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 */
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 */
Patrick Venturec83c4dc2018-11-01 16:29:18 -070065template <Keyword K>
Deepak Kodihalli158c0462016-11-21 21:33:28 -060066constexpr const char* getKeyword() = delete;
67
Patrick Venturec83c4dc2018-11-01 16:29:18 -070068template <>
Deepak Kodihalli158c0462016-11-21 21:33:28 -060069constexpr const char* getKeyword<Keyword::DR>()
70{
71 return "DR";
72}
73
Patrick Venturec83c4dc2018-11-01 16:29:18 -070074template <>
Deepak Kodihalli158c0462016-11-21 21:33:28 -060075constexpr const char* getKeyword<Keyword::PN>()
76{
77 return "PN";
78}
79
Patrick Venturec83c4dc2018-11-01 16:29:18 -070080template <>
Deepak Kodihalli158c0462016-11-21 21:33:28 -060081constexpr const char* getKeyword<Keyword::SN>()
82{
83 return "SN";
84}
85
Patrick Venturec83c4dc2018-11-01 16:29:18 -070086template <>
Deepak Kodihalli158c0462016-11-21 21:33:28 -060087constexpr const char* getKeyword<Keyword::CC>()
88{
89 return "CC";
90}
91
Patrick Venturec83c4dc2018-11-01 16:29:18 -070092template <>
Deepak Kodihalli158c0462016-11-21 21:33:28 -060093constexpr const char* getKeyword<Keyword::HW>()
94{
95 return "HW";
96}
97
Patrick Venturec83c4dc2018-11-01 16:29:18 -070098template <>
Deepak Kodihalli158c0462016-11-21 21:33:28 -060099constexpr const char* getKeyword<Keyword::B1>()
100{
101 return "B1";
102}
103
Patrick Venturec83c4dc2018-11-01 16:29:18 -0700104template <>
Deepak Kodihalli158c0462016-11-21 21:33:28 -0600105constexpr const char* getKeyword<Keyword::VN>()
106{
107 return "VN";
108}
109
Patrick Venturec83c4dc2018-11-01 16:29:18 -0700110template <>
Deepak Kodihalli158c0462016-11-21 21:33:28 -0600111constexpr const char* getKeyword<Keyword::MB>()
112{
113 return "MB";
114}
115
Patrick Venturec83c4dc2018-11-01 16:29:18 -0700116template <>
Deepak Kodihalli158c0462016-11-21 21:33:28 -0600117constexpr const char* getKeyword<Keyword::MM>()
118{
119 return "MM";
120}
121
Patrick Venturec83c4dc2018-11-01 16:29:18 -0700122template <>
Dinesh Chinaric576b482017-07-17 16:34:10 -0500123constexpr const char* getKeyword<Keyword::UD>()
124{
125 return "UD";
126}
127
Patrick Venturec83c4dc2018-11-01 16:29:18 -0700128template <>
Matt Spinlercfbb1ff2018-05-10 10:43:03 -0500129constexpr const char* getKeyword<Keyword::VS>()
130{
131 return "VS";
132}
133
Patrick Venturec83c4dc2018-11-01 16:29:18 -0700134template <>
Matt Spinlercfbb1ff2018-05-10 10:43:03 -0500135constexpr 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
Alvin Wang18197ae2019-08-29 22:56:18 +0800146 * ETHERNET1 The 2nd ethernet card on the BMC
Deepak Kodihalli82c1e562016-11-28 06:06:50 -0600147 */
148enum Fru
149{
150 BMC,
Alvin Wang18197ae2019-08-29 22:56:18 +0800151 ETHERNET,
152 ETHERNET1
Deepak Kodihalli82c1e562016-11-28 06:06:50 -0600153};
154
Alpana Kumari31970de2020-02-17 06:49:57 -0600155static constexpr auto BD_YEAR_END = 4;
156static constexpr auto BD_MONTH_END = 7;
157static constexpr auto BD_DAY_END = 10;
158static constexpr auto BD_HOUR_END = 13;
159
Deepak Kodihalli1ea02332016-11-20 22:50:39 -0600160} // namespace vpd
161} // namespace openpower