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 | */ |
| 20 | template<Record R> |
| 21 | constexpr const char* getRecord() = delete; |
| 22 | |
| 23 | template<> |
| 24 | constexpr const char* getRecord<Record::VINI>() |
| 25 | { |
| 26 | return "VINI"; |
| 27 | } |
| 28 | |
| 29 | template<> |
| 30 | constexpr const char* getRecord<Record::OPFR>() |
| 31 | { |
| 32 | return "OPFR"; |
| 33 | } |
| 34 | |
| 35 | template<> |
| 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 | { |
| 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 Chinari | c576b48 | 2017-07-17 16:34:10 -0500 | [diff] [blame] | 55 | MM, /**< FRU model */ |
Matt Spinler | cfbb1ff | 2018-05-10 10:43:03 -0500 | [diff] [blame^] | 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 | */ |
| 65 | template<Keyword K> |
| 66 | constexpr const char* getKeyword() = delete; |
| 67 | |
| 68 | template<> |
| 69 | constexpr const char* getKeyword<Keyword::DR>() |
| 70 | { |
| 71 | return "DR"; |
| 72 | } |
| 73 | |
| 74 | template<> |
| 75 | constexpr const char* getKeyword<Keyword::PN>() |
| 76 | { |
| 77 | return "PN"; |
| 78 | } |
| 79 | |
| 80 | template<> |
| 81 | constexpr const char* getKeyword<Keyword::SN>() |
| 82 | { |
| 83 | return "SN"; |
| 84 | } |
| 85 | |
| 86 | template<> |
| 87 | constexpr const char* getKeyword<Keyword::CC>() |
| 88 | { |
| 89 | return "CC"; |
| 90 | } |
| 91 | |
| 92 | template<> |
| 93 | constexpr const char* getKeyword<Keyword::HW>() |
| 94 | { |
| 95 | return "HW"; |
| 96 | } |
| 97 | |
| 98 | template<> |
| 99 | constexpr const char* getKeyword<Keyword::B1>() |
| 100 | { |
| 101 | return "B1"; |
| 102 | } |
| 103 | |
| 104 | template<> |
| 105 | constexpr const char* getKeyword<Keyword::VN>() |
| 106 | { |
| 107 | return "VN"; |
| 108 | } |
| 109 | |
| 110 | template<> |
| 111 | constexpr const char* getKeyword<Keyword::MB>() |
| 112 | { |
| 113 | return "MB"; |
| 114 | } |
| 115 | |
| 116 | template<> |
| 117 | constexpr const char* getKeyword<Keyword::MM>() |
| 118 | { |
| 119 | return "MM"; |
| 120 | } |
| 121 | |
Dinesh Chinari | c576b48 | 2017-07-17 16:34:10 -0500 | [diff] [blame] | 122 | template<> |
| 123 | constexpr const char* getKeyword<Keyword::UD>() |
| 124 | { |
| 125 | return "UD"; |
| 126 | } |
| 127 | |
Matt Spinler | cfbb1ff | 2018-05-10 10:43:03 -0500 | [diff] [blame^] | 128 | template<> |
| 129 | constexpr const char* getKeyword<Keyword::VS>() |
| 130 | { |
| 131 | return "VS"; |
| 132 | } |
| 133 | |
| 134 | template<> |
| 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 |
| 146 | */ |
| 147 | enum Fru |
| 148 | { |
| 149 | BMC, |
| 150 | ETHERNET |
| 151 | }; |
| 152 | |
Deepak Kodihalli | 1ea0233 | 2016-11-20 22:50:39 -0600 | [diff] [blame] | 153 | } // namespace vpd |
| 154 | } // namespace openpower |