blob: a98a4f301e482577bf0bcac36a07a7686bfd9a1e [file] [log] [blame]
Deepak Kodihalli35c7fb12016-11-21 04:32:44 -06001#pragma once
2
3#include <climits>
Deepak Kodihalli76794492017-02-16 23:48:18 -06004#include <map>
5#include <sdbusplus/server.hpp>
Patrick Venturec83c4dc2018-11-01 16:29:18 -07006#include <string>
SunnySrivastava1984de3c60d2020-02-03 10:34:33 -06007#include <unordered_map>
Patrick Venturec83c4dc2018-11-01 16:29:18 -07008#include <vector>
Deepak Kodihalli35c7fb12016-11-21 04:32:44 -06009
10namespace openpower
11{
12namespace vpd
13{
14
15/** @brief The OpenPOWER VPD, in binary, is specified as a
16 * sequence of characters */
17static_assert((8 == CHAR_BIT), "A byte is not 8 bits!");
18using Byte = uint8_t;
19using Binary = std::vector<Byte>;
Santosh Puranikf2d3b532022-04-19 06:44:07 -050020using BIOSAttrValueType = std::variant<int64_t, std::string>;
21using PendingBIOSAttrItemType =
22 std::pair<std::string, std::tuple<std::string, BIOSAttrValueType>>;
23using PendingBIOSAttrsType = std::vector<PendingBIOSAttrItemType>;
Deepak Kodihalli35c7fb12016-11-21 04:32:44 -060024
Deepak Kodihalli76794492017-02-16 23:48:18 -060025namespace inventory
26{
27
28using Path = std::string;
29using Property = std::string;
Alpana Kumari3ab26a72021-04-05 19:09:19 +000030using Value = std::variant<bool, size_t, int64_t, std::string, Binary>;
Deepak Kodihalli76794492017-02-16 23:48:18 -060031using PropertyMap = std::map<Property, Value>;
jinuthomas6555e7e2023-02-14 21:48:00 -060032using kwdVpdValueTypes = std::variant<size_t, Binary, std::string>;
Deepak Kodihalli76794492017-02-16 23:48:18 -060033
34using Interface = std::string;
35using InterfaceMap = std::map<Interface, PropertyMap>;
36
37using Object = sdbusplus::message::object_path;
38using ObjectMap = std::map<Object, InterfaceMap>;
39
SunnySrivastava1984de3c60d2020-02-03 10:34:33 -060040using VPDfilepath = std::string;
SunnySrivastava198443306542020-04-01 02:50:20 -050041using FruIsMotherboard = bool;
Santosh Puranika0b23912022-02-10 13:37:09 +053042using FrusMap =
43 std::multimap<Path, std::tuple<VPDfilepath, VPDfilepath, FruIsMotherboard>>;
SunnySrivastava1984bca5aaa2020-04-21 05:31:04 -050044using LocationCode = std::string;
SunnySrivastava19841356d7e2020-04-24 04:29:35 -050045using LocationCodeMap = std::unordered_multimap<LocationCode, Path>;
46using ListOfPaths = std::vector<sdbusplus::message::object_path>;
SunnySrivastava1984fb5815a2020-04-24 08:03:52 -050047using NodeNumber = uint16_t;
Alpana Kumari3ab26a72021-04-05 19:09:19 +000048using KeywordVpdMap = std::unordered_map<std::string, kwdVpdValueTypes>;
Deepak Kodihalli76794492017-02-16 23:48:18 -060049
Alpana Kumari65b83602020-09-01 00:24:56 -050050using systemType = std::string;
51using deviceTree = std::string;
52using deviceTreeMap = std::unordered_map<systemType, deviceTree>;
SunnySrivastava1984a20be8e2020-08-26 02:00:50 -050053using PelAdditionalData = std::map<std::string, std::string>;
SunnySrivastava19849094d4f2020-08-05 09:32:29 -050054using Keyword = std::string;
55using KeywordData = std::string;
56using DbusPropertyMap = std::unordered_map<Keyword, KeywordData>;
57using PelAdditionalData = std::map<std::string, std::string>;
58using Service = std::string;
59using MapperResponse =
60 std::map<Path, std::map<Service, std::vector<Interface>>>;
61using RestoredEeproms = std::tuple<Path, std::string, Keyword, Binary>;
SunnySrivastava19849a195542020-09-07 06:04:50 -050062using ReplaceableFrus = std::vector<VPDfilepath>;
Sunny Srivastavafdf9ff22022-06-15 11:15:54 -050063using EssentialFrus = std::vector<Path>;
Priyanga Ramasamy952d6c52022-11-07 07:20:24 -060064using RecordName = std::string;
65using KeywordDefault = Binary;
66using isPELReqOnRestoreFailure = bool;
67using isMFGResetRequired = bool;
68using SystemKeywordInfo =
69 std::tuple<Keyword, KeywordDefault, isPELReqOnRestoreFailure,
70 isMFGResetRequired>;
71
72/** Map of system backplane records to list of keywords and its related data. {
73 * Record : { Keyword, Default value, Is PEL required on restore failure, Is MFG
74 * reset required }} **/
75using SystemKeywordsMap =
76 std::unordered_map<RecordName, std::vector<SystemKeywordInfo>>;
Priyanga Ramasamy6d5e7342022-10-14 07:17:25 -050077
78using GetAllResultType = std::vector<std::pair<Keyword, Value>>;
79using IntfPropMap = std::map<RecordName, GetAllResultType>;
Priyanga Ramasamy124ae6c2022-10-18 12:46:14 -050080using RecKwValMap =
81 std::unordered_map<RecordName, std::unordered_map<Keyword, Binary>>;
Deepak Kodihalli76794492017-02-16 23:48:18 -060082} // namespace inventory
83
Deepak Kodihalli35c7fb12016-11-21 04:32:44 -060084} // namespace vpd
Alpana Kumari3ab26a72021-04-05 19:09:19 +000085} // namespace openpower