diff options
author | Dinesh Chinari <chinari@us.ibm.com> | 2017-07-17 16:34:10 -0500 |
---|---|---|
committer | Dinesh Chinari <chinari@us.ibm.com> | 2017-08-22 16:33:22 -0500 |
commit | c576b48c959513fa4c6eb338e8f6eebb65a4f73b (patch) | |
tree | c41676d5e75d3316c24b354a64a7b508c6cb4f25 | |
parent | 193b22826c5a9ba8e6f03861967fe922ce3557ff (diff) | |
download | openpower-vpd-parser-c576b48c959513fa4c6eb338e8f6eebb65a4f73b.tar.gz openpower-vpd-parser-c576b48c959513fa4c6eb338e8f6eebb65a4f73b.zip |
Added BMC, UUID interface map.
Change-Id: I62a7284e58f8688b1560663aab52cc5746a77dda
Signed-off-by: Dinesh Chinari <chinari@us.ibm.com>
-rw-r--r-- | defines.hpp | 9 | ||||
-rw-r--r-- | impl.cpp | 30 | ||||
-rw-r--r-- | impl.hpp | 3 | ||||
-rw-r--r-- | writefru.yaml | 2 |
4 files changed, 41 insertions, 3 deletions
diff --git a/defines.hpp b/defines.hpp index e391879..84ddae3 100644 --- a/defines.hpp +++ b/defines.hpp @@ -52,7 +52,8 @@ enum class Keyword B1, /**< MAC Address */ VN, /**< FRU manufacturer name */ MB, /**< FRU manufacture date */ - MM /**< FRU model */ + MM, /**< FRU model */ + UD /**< System UUID */ }; /** @brief Convert VPD Keyword name from enum to string @@ -116,6 +117,12 @@ constexpr const char* getKeyword<Keyword::MM>() return "MM"; } +template<> +constexpr const char* getKeyword<Keyword::UD>() +{ + return "UD"; +} + } // namespace record /** @brief FRUs whose VPD we're interested in @@ -25,6 +25,11 @@ static const std::unordered_map<std::string, Record> supportedRecords = static constexpr auto MAC_ADDRESS_LEN_BYTES = 6; static constexpr auto LAST_KW = "PF"; +static constexpr auto UUID_LEN_BYTES = 16; +static constexpr auto UUID_TIME_LOW_END = 8; +static constexpr auto UUID_TIME_MID_END = 13; +static constexpr auto UUID_TIME_HIGH_END = 18; +static constexpr auto UUID_CLK_SEQ_END = 23; static const std::unordered_map<std::string, internal::KeywordInfo> supportedKeywords = @@ -37,7 +42,8 @@ static const std::unordered_map<std::string, {"B1", std::make_tuple(record::Keyword::B1, keyword::Encoding::B1)}, {"VN", std::make_tuple(record::Keyword::VN, keyword::Encoding::ASCII)}, {"MB", std::make_tuple(record::Keyword::MB, keyword::Encoding::RAW)}, - {"MM", std::make_tuple(record::Keyword::MM, keyword::Encoding::ASCII)} + {"MM", std::make_tuple(record::Keyword::MM, keyword::Encoding::ASCII)}, + {"UD", std::make_tuple(record::Keyword::UD, keyword::Encoding::UD)} }; namespace @@ -251,6 +257,28 @@ std::string Impl::readKwData(const internal::KeywordInfo& keyword, return result; } + case keyword::Encoding::UD: + { + //UD, the UUID info, represented as + //123e4567-e89b-12d3-a456-426655440000 + //<time_low>-<time_mid>-<time hi and version> + //-<clock_seq_hi_and_res clock_seq_low>-<48 bits node id> + auto stop = std::next(iterator, UUID_LEN_BYTES); + std::string data(iterator, stop); + std::string result{}; + std::for_each(data.cbegin(), data.cend(), + [&result](size_t c) + { + result += toHex(c >> 4); + result += toHex(c & 0x0F); + }); + result.insert(UUID_TIME_LOW_END, 1, '-'); + result.insert(UUID_TIME_MID_END, 1, '-'); + result.insert(UUID_TIME_HIGH_END, 1, '-'); + result.insert(UUID_CLK_SEQ_END, 1, '-'); + + return result; + } default: break; } @@ -18,7 +18,8 @@ enum class Encoding ASCII, /**< data encoded in ascii */ RAW, /**< raw data */ // Keywords needing custom decoding - B1 /**< The keyword B1 needs to be decoded specially */ + B1, /**< The keyword B1 needs to be decoded specially */ + UD /**< Special decoding of UD meant for UUID */ }; } // namespace keyword diff --git a/writefru.yaml b/writefru.yaml index c9f1d80..6e75dcd 100644 --- a/writefru.yaml +++ b/writefru.yaml @@ -9,6 +9,8 @@ BMC: PrettyName: VINI,DR xyz.openbmc_project.Inventory.Decorator.Revision: Version: VINI,HW + xyz.openbmc_project.Common.UUID: + UUID: OSYS,UD ETHERNET: xyz.openbmc_project.Inventory.Item.NetworkInterface: |