Skip to content

Commit

Permalink
Add support for VNDR Records
Browse files Browse the repository at this point in the history
The vendor data (VNDR) record is for vendor-specific data and add
support for the IN keyword.

Signed-off-by: Ben Pai <Ben_Pai@wistron.com>
Signed-off-by: LuluTHSu <Lulu_Su@wistron.com>
  • Loading branch information
LuluTHSu committed Jul 14, 2021
1 parent 540038a commit 0056b09
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions defines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace vpd
/** @brief OpenPOWER VPD records we're interested in */
enum class Record
{
VNDR, /**< Vendor-specific data information */
VINI, /**< Initial information, common to all OpenPOWER FRUs */
OPFR, /**< OpenPOWER FRU information, common to all OpenPOWER FRUs */
OSYS /**< Information specific to a system board */
Expand All @@ -20,6 +21,12 @@ enum class Record
template <Record R>
constexpr const char* getRecord() = delete;

template <>
constexpr const char* getRecord<Record::VNDR>()
{
return "VNDR";
}

template <>
constexpr const char* getRecord<Record::VINI>()
{
Expand Down Expand Up @@ -55,6 +62,7 @@ enum class Keyword
MM, /**< FRU model */
UD, /**< System UUID */
VS, /**< OpenPower serial number */
IN, /**< Vendor defines the data */
VP /**< OpenPower part number */
};

Expand Down Expand Up @@ -131,6 +139,12 @@ constexpr const char* getKeyword<Keyword::VS>()
return "VS";
}

template <>
constexpr const char* getKeyword<Keyword::IN>()
{
return "IN";
}

template <>
constexpr const char* getKeyword<Keyword::VP>()
{
Expand Down
3 changes: 2 additions & 1 deletion impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace parser
{

static const std::unordered_map<std::string, Record> supportedRecords = {
{"VINI", Record::VINI}, {"OPFR", Record::OPFR}, {"OSYS", Record::OSYS}};
{"VINI", Record::VINI}, {"OPFR", Record::OPFR}, {"VNDR", Record::VNDR}, {"OSYS", Record::OSYS}};

static constexpr auto MAC_ADDRESS_LEN_BYTES = 6;
static constexpr auto LAST_KW = "PF";
Expand Down Expand Up @@ -51,6 +51,7 @@ static const std::unordered_map<std::string, internal::KeywordInfo>
{"UD", std::make_tuple(record::Keyword::UD, keyword::Encoding::UD)},
{"VP", std::make_tuple(record::Keyword::VP, keyword::Encoding::ASCII)},
{"VS", std::make_tuple(record::Keyword::VS, keyword::Encoding::ASCII)},
{"IN", std::make_tuple(record::Keyword::IN, keyword::Encoding::ASCII)},
};

namespace
Expand Down

0 comments on commit 0056b09

Please sign in to comment.