SunnySrivastava1984 | e12b181 | 2020-05-26 02:23:11 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "const.hpp" |
| 4 | #include "parser_interface.hpp" |
| 5 | #include "store.hpp" |
| 6 | #include "types.hpp" |
| 7 | |
| 8 | #include <vector> |
| 9 | |
| 10 | namespace openpower |
| 11 | { |
| 12 | namespace vpd |
| 13 | { |
| 14 | namespace ipz |
| 15 | { |
| 16 | namespace parser |
| 17 | { |
| 18 | |
| 19 | using ParserInterface = openpower::vpd::parser::interface::ParserInterface; |
| 20 | using kwdVpdMap = openpower::vpd::inventory::KeywordVpdMap; |
| 21 | |
| 22 | class IpzVpdParser : public ParserInterface |
| 23 | { |
| 24 | public: |
| 25 | IpzVpdParser() = delete; |
| 26 | IpzVpdParser(const IpzVpdParser&) = delete; |
| 27 | IpzVpdParser& operator=(const IpzVpdParser&) = delete; |
| 28 | IpzVpdParser(IpzVpdParser&&) = delete; |
| 29 | IpzVpdParser& operator=(IpzVpdParser&&) = delete; |
| 30 | ~IpzVpdParser() = default; |
| 31 | |
| 32 | /** |
| 33 | * @brief Constructor |
girik | 18bb985 | 2022-11-16 05:48:13 -0600 | [diff] [blame] | 34 | * @param[in] - VpdVector - vpd buffer |
| 35 | * @param[in] - path - Inventory Path |
| 36 | * @param[in] - vpdFilePath - VPD H/w path |
| 37 | * @param[in] - vpdStartOffset - VPD starting offset |
SunnySrivastava1984 | e12b181 | 2020-05-26 02:23:11 -0500 | [diff] [blame] | 38 | */ |
girik | 18bb985 | 2022-11-16 05:48:13 -0600 | [diff] [blame] | 39 | IpzVpdParser(const Binary& VpdVector, const std::string& path, |
| 40 | const std::string& vpdFilePath, uint32_t vpdStartOffset) : |
Patrick Williams | 08dc31c | 2024-08-16 15:21:06 -0400 | [diff] [blame] | 41 | vpd(VpdVector), inventoryPath(path), vpdFilePath(vpdFilePath), |
girik | 18bb985 | 2022-11-16 05:48:13 -0600 | [diff] [blame] | 42 | vpdStartOffset(vpdStartOffset) |
Patrick Williams | c78d887 | 2023-05-10 07:50:56 -0500 | [diff] [blame] | 43 | {} |
SunnySrivastava1984 | e12b181 | 2020-05-26 02:23:11 -0500 | [diff] [blame] | 44 | |
| 45 | /** |
| 46 | * @brief Parse the memory VPD binary data. |
| 47 | * Collects and emplace the keyword-value pairs in map. |
| 48 | * |
| 49 | * @return map of keyword:value |
| 50 | */ |
| 51 | std::variant<kwdVpdMap, Store> parse(); |
| 52 | |
| 53 | /** |
| 54 | * @brief An api to return interface name with respect to |
| 55 | * the parser selected. |
| 56 | * |
| 57 | * @return - Interface name for that vpd type. |
| 58 | */ |
| 59 | std::string getInterfaceName() const; |
| 60 | |
| 61 | /** @brief API to check vpd header |
| 62 | * @param [in] vpd - VPDheader in binary format |
| 63 | */ |
| 64 | void processHeader(); |
| 65 | |
| 66 | private: |
PriyangaRamasamy | 33c61c2 | 2021-04-06 11:15:57 -0500 | [diff] [blame] | 67 | const Binary& vpd; |
Sunny Srivastava | f31a91b | 2022-06-09 08:11:29 -0500 | [diff] [blame] | 68 | |
| 69 | /*Inventory path of the FRU */ |
| 70 | const std::string inventoryPath; |
girik | 18bb985 | 2022-11-16 05:48:13 -0600 | [diff] [blame] | 71 | |
| 72 | /* VPD Path */ |
| 73 | const std::string vpdFilePath; |
| 74 | |
| 75 | /* Offset */ |
| 76 | uint32_t vpdStartOffset; |
| 77 | |
SunnySrivastava1984 | e12b181 | 2020-05-26 02:23:11 -0500 | [diff] [blame] | 78 | }; // class IpzVpdParser |
| 79 | |
| 80 | } // namespace parser |
| 81 | } // namespace ipz |
| 82 | } // namespace vpd |
| 83 | } // namespace openpower |