Deepak Kodihalli | 1ea0233 | 2016-11-20 22:50:39 -0600 | [diff] [blame] | 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 | |
Deepak Kodihalli | 158c046 | 2016-11-21 21:33:28 -0600 | [diff] [blame] | 16 | /** @brief Convert VPD Record name from enum to string |
| 17 | * @tparam R - VPD Record |
| 18 | * @returns string representation of Record name |
| 19 | */ |
Patrick Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 20 | template <Record R> |
Deepak Kodihalli | 158c046 | 2016-11-21 21:33:28 -0600 | [diff] [blame] | 21 | constexpr const char* getRecord() = delete; |
| 22 | |
Patrick Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 23 | template <> |
Deepak Kodihalli | 158c046 | 2016-11-21 21:33:28 -0600 | [diff] [blame] | 24 | constexpr const char* getRecord<Record::VINI>() |
| 25 | { |
| 26 | return "VINI"; |
| 27 | } |
| 28 | |
Patrick Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 29 | template <> |
Deepak Kodihalli | 158c046 | 2016-11-21 21:33:28 -0600 | [diff] [blame] | 30 | constexpr const char* getRecord<Record::OPFR>() |
| 31 | { |
| 32 | return "OPFR"; |
| 33 | } |
| 34 | |
Patrick Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 35 | template <> |
Deepak Kodihalli | 158c046 | 2016-11-21 21:33:28 -0600 | [diff] [blame] | 36 | constexpr const char* getRecord<Record::OSYS>() |
| 37 | { |
| 38 | return "OSYS"; |
| 39 | } |
| 40 | |
Deepak Kodihalli | 1ea0233 | 2016-11-20 22:50:39 -0600 | [diff] [blame] | 41 | namespace record |
| 42 | { |
| 43 | |
| 44 | /** @brief OpenPOWER VPD keywords we're interested in */ |
| 45 | enum class Keyword |
| 46 | { |
Patrick Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 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 */ |
Deepak Kodihalli | 1ea0233 | 2016-11-20 22:50:39 -0600 | [diff] [blame] | 59 | }; |
| 60 | |
Deepak Kodihalli | 158c046 | 2016-11-21 21:33:28 -0600 | [diff] [blame] | 61 | /** @brief Convert VPD Keyword name from enum to string |
| 62 | * @tparam K - VPD Keyword |
| 63 | * @returns string representation of Keyword name |
| 64 | */ |
Patrick Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 65 | template <Keyword K> |
Deepak Kodihalli | 158c046 | 2016-11-21 21:33:28 -0600 | [diff] [blame] | 66 | constexpr const char* getKeyword() = delete; |
| 67 | |
Patrick Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 68 | template <> |
Deepak Kodihalli | 158c046 | 2016-11-21 21:33:28 -0600 | [diff] [blame] | 69 | constexpr const char* getKeyword<Keyword::DR>() |
| 70 | { |
| 71 | return "DR"; |
| 72 | } |
| 73 | |
Patrick Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 74 | template <> |
Deepak Kodihalli | 158c046 | 2016-11-21 21:33:28 -0600 | [diff] [blame] | 75 | constexpr const char* getKeyword<Keyword::PN>() |
| 76 | { |
| 77 | return "PN"; |
| 78 | } |
| 79 | |
Patrick Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 80 | template <> |
Deepak Kodihalli | 158c046 | 2016-11-21 21:33:28 -0600 | [diff] [blame] | 81 | constexpr const char* getKeyword<Keyword::SN>() |
| 82 | { |
| 83 | return "SN"; |
| 84 | } |
| 85 | |
Patrick Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 86 | template <> |
Deepak Kodihalli | 158c046 | 2016-11-21 21:33:28 -0600 | [diff] [blame] | 87 | constexpr const char* getKeyword<Keyword::CC>() |
| 88 | { |
| 89 | return "CC"; |
| 90 | } |
| 91 | |
Patrick Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 92 | template <> |
Deepak Kodihalli | 158c046 | 2016-11-21 21:33:28 -0600 | [diff] [blame] | 93 | constexpr const char* getKeyword<Keyword::HW>() |
| 94 | { |
| 95 | return "HW"; |
| 96 | } |
| 97 | |
Patrick Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 98 | template <> |
Deepak Kodihalli | 158c046 | 2016-11-21 21:33:28 -0600 | [diff] [blame] | 99 | constexpr const char* getKeyword<Keyword::B1>() |
| 100 | { |
| 101 | return "B1"; |
| 102 | } |
| 103 | |
Patrick Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 104 | template <> |
Deepak Kodihalli | 158c046 | 2016-11-21 21:33:28 -0600 | [diff] [blame] | 105 | constexpr const char* getKeyword<Keyword::VN>() |
| 106 | { |
| 107 | return "VN"; |
| 108 | } |
| 109 | |
Patrick Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 110 | template <> |
Deepak Kodihalli | 158c046 | 2016-11-21 21:33:28 -0600 | [diff] [blame] | 111 | constexpr const char* getKeyword<Keyword::MB>() |
| 112 | { |
| 113 | return "MB"; |
| 114 | } |
| 115 | |
Patrick Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 116 | template <> |
Deepak Kodihalli | 158c046 | 2016-11-21 21:33:28 -0600 | [diff] [blame] | 117 | constexpr const char* getKeyword<Keyword::MM>() |
| 118 | { |
| 119 | return "MM"; |
| 120 | } |
| 121 | |
Patrick Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 122 | template <> |
Dinesh Chinari | c576b48 | 2017-07-17 16:34:10 -0500 | [diff] [blame] | 123 | constexpr const char* getKeyword<Keyword::UD>() |
| 124 | { |
| 125 | return "UD"; |
| 126 | } |
| 127 | |
Patrick Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 128 | template <> |
Matt Spinler | cfbb1ff | 2018-05-10 10:43:03 -0500 | [diff] [blame] | 129 | constexpr const char* getKeyword<Keyword::VS>() |
| 130 | { |
| 131 | return "VS"; |
| 132 | } |
| 133 | |
Patrick Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 134 | template <> |
Matt Spinler | cfbb1ff | 2018-05-10 10:43:03 -0500 | [diff] [blame] | 135 | constexpr const char* getKeyword<Keyword::VP>() |
| 136 | { |
| 137 | return "VP"; |
| 138 | } |
| 139 | |
Deepak Kodihalli | 1ea0233 | 2016-11-20 22:50:39 -0600 | [diff] [blame] | 140 | } // namespace record |
Deepak Kodihalli | 82c1e56 | 2016-11-28 06:06:50 -0600 | [diff] [blame] | 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 |
Alvin Wang | 18197ae | 2019-08-29 22:56:18 +0800 | [diff] [blame] | 146 | * ETHERNET1 The 2nd ethernet card on the BMC |
Deepak Kodihalli | 82c1e56 | 2016-11-28 06:06:50 -0600 | [diff] [blame] | 147 | */ |
| 148 | enum Fru |
| 149 | { |
| 150 | BMC, |
Alvin Wang | 18197ae | 2019-08-29 22:56:18 +0800 | [diff] [blame] | 151 | ETHERNET, |
| 152 | ETHERNET1 |
Deepak Kodihalli | 82c1e56 | 2016-11-28 06:06:50 -0600 | [diff] [blame] | 153 | }; |
| 154 | |
Alpana Kumari | 31970de | 2020-02-17 06:49:57 -0600 | [diff] [blame] | 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 | |
Deepak Kodihalli | 1ea0233 | 2016-11-20 22:50:39 -0600 | [diff] [blame] | 160 | } // namespace vpd |
| 161 | } // namespace openpower |