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 */ |
| 56 | UD /**< System UUID */ |
Deepak Kodihalli | 1ea0233 | 2016-11-20 22:50:39 -0600 | [diff] [blame] | 57 | }; |
| 58 | |
Deepak Kodihalli | 158c046 | 2016-11-21 21:33:28 -0600 | [diff] [blame] | 59 | /** @brief Convert VPD Keyword name from enum to string |
| 60 | * @tparam K - VPD Keyword |
| 61 | * @returns string representation of Keyword name |
| 62 | */ |
| 63 | template<Keyword K> |
| 64 | constexpr const char* getKeyword() = delete; |
| 65 | |
| 66 | template<> |
| 67 | constexpr const char* getKeyword<Keyword::DR>() |
| 68 | { |
| 69 | return "DR"; |
| 70 | } |
| 71 | |
| 72 | template<> |
| 73 | constexpr const char* getKeyword<Keyword::PN>() |
| 74 | { |
| 75 | return "PN"; |
| 76 | } |
| 77 | |
| 78 | template<> |
| 79 | constexpr const char* getKeyword<Keyword::SN>() |
| 80 | { |
| 81 | return "SN"; |
| 82 | } |
| 83 | |
| 84 | template<> |
| 85 | constexpr const char* getKeyword<Keyword::CC>() |
| 86 | { |
| 87 | return "CC"; |
| 88 | } |
| 89 | |
| 90 | template<> |
| 91 | constexpr const char* getKeyword<Keyword::HW>() |
| 92 | { |
| 93 | return "HW"; |
| 94 | } |
| 95 | |
| 96 | template<> |
| 97 | constexpr const char* getKeyword<Keyword::B1>() |
| 98 | { |
| 99 | return "B1"; |
| 100 | } |
| 101 | |
| 102 | template<> |
| 103 | constexpr const char* getKeyword<Keyword::VN>() |
| 104 | { |
| 105 | return "VN"; |
| 106 | } |
| 107 | |
| 108 | template<> |
| 109 | constexpr const char* getKeyword<Keyword::MB>() |
| 110 | { |
| 111 | return "MB"; |
| 112 | } |
| 113 | |
| 114 | template<> |
| 115 | constexpr const char* getKeyword<Keyword::MM>() |
| 116 | { |
| 117 | return "MM"; |
| 118 | } |
| 119 | |
Dinesh Chinari | c576b48 | 2017-07-17 16:34:10 -0500 | [diff] [blame^] | 120 | template<> |
| 121 | constexpr const char* getKeyword<Keyword::UD>() |
| 122 | { |
| 123 | return "UD"; |
| 124 | } |
| 125 | |
Deepak Kodihalli | 1ea0233 | 2016-11-20 22:50:39 -0600 | [diff] [blame] | 126 | } // namespace record |
Deepak Kodihalli | 82c1e56 | 2016-11-28 06:06:50 -0600 | [diff] [blame] | 127 | |
| 128 | /** @brief FRUs whose VPD we're interested in |
| 129 | * |
| 130 | * BMC The VPD on the BMC planar, for eg |
| 131 | * ETHERNET The ethernet card on the BMC |
| 132 | */ |
| 133 | enum Fru |
| 134 | { |
| 135 | BMC, |
| 136 | ETHERNET |
| 137 | }; |
| 138 | |
Deepak Kodihalli | 1ea0233 | 2016-11-20 22:50:39 -0600 | [diff] [blame] | 139 | } // namespace vpd |
| 140 | } // namespace openpower |