blob: 7917e4fe2a1b1ab67a2c851be474124ef853188f [file] [log] [blame]
Deepak Kodihalli35c7fb12016-11-21 04:32:44 -06001#pragma once
2
Patrick Williamsc78d8872023-05-10 07:50:56 -05003#include <sdbusplus/server.hpp>
4
Deepak Kodihalli35c7fb12016-11-21 04:32:44 -06005#include <climits>
Deepak Kodihalli76794492017-02-16 23:48:18 -06006#include <map>
Patrick Venturec83c4dc2018-11-01 16:29:18 -07007#include <string>
SunnySrivastava1984de3c60d2020-02-03 10:34:33 -06008#include <unordered_map>
Patrick Venturec83c4dc2018-11-01 16:29:18 -07009#include <vector>
Deepak Kodihalli35c7fb12016-11-21 04:32:44 -060010
11namespace openpower
12{
13namespace vpd
14{
15
16/** @brief The OpenPOWER VPD, in binary, is specified as a
17 * sequence of characters */
18static_assert((8 == CHAR_BIT), "A byte is not 8 bits!");
19using Byte = uint8_t;
20using Binary = std::vector<Byte>;
Santosh Puranikf2d3b532022-04-19 06:44:07 -050021using BIOSAttrValueType = std::variant<int64_t, std::string>;
22using PendingBIOSAttrItemType =
23 std::pair<std::string, std::tuple<std::string, BIOSAttrValueType>>;
24using PendingBIOSAttrsType = std::vector<PendingBIOSAttrItemType>;
Deepak Kodihalli35c7fb12016-11-21 04:32:44 -060025
Deepak Kodihalli76794492017-02-16 23:48:18 -060026namespace inventory
27{
28
29using Path = std::string;
30using Property = std::string;
Alpana Kumari3ab26a72021-04-05 19:09:19 +000031using Value = std::variant<bool, size_t, int64_t, std::string, Binary>;
Deepak Kodihalli76794492017-02-16 23:48:18 -060032using PropertyMap = std::map<Property, Value>;
jinuthomas6555e7e2023-02-14 21:48:00 -060033using kwdVpdValueTypes = std::variant<size_t, Binary, std::string>;
Deepak Kodihalli76794492017-02-16 23:48:18 -060034
35using Interface = std::string;
36using InterfaceMap = std::map<Interface, PropertyMap>;
37
38using Object = sdbusplus::message::object_path;
39using ObjectMap = std::map<Object, InterfaceMap>;
40
SunnySrivastava1984de3c60d2020-02-03 10:34:33 -060041using VPDfilepath = std::string;
SunnySrivastava198443306542020-04-01 02:50:20 -050042using FruIsMotherboard = bool;
Santosh Puranika0b23912022-02-10 13:37:09 +053043using FrusMap =
44 std::multimap<Path, std::tuple<VPDfilepath, VPDfilepath, FruIsMotherboard>>;
SunnySrivastava1984bca5aaa2020-04-21 05:31:04 -050045using LocationCode = std::string;
SunnySrivastava19841356d7e2020-04-24 04:29:35 -050046using LocationCodeMap = std::unordered_multimap<LocationCode, Path>;
47using ListOfPaths = std::vector<sdbusplus::message::object_path>;
SunnySrivastava1984fb5815a2020-04-24 08:03:52 -050048using NodeNumber = uint16_t;
Alpana Kumari3ab26a72021-04-05 19:09:19 +000049using KeywordVpdMap = std::unordered_map<std::string, kwdVpdValueTypes>;
Deepak Kodihalli76794492017-02-16 23:48:18 -060050
Alpana Kumari65b83602020-09-01 00:24:56 -050051using systemType = std::string;
52using deviceTree = std::string;
53using deviceTreeMap = std::unordered_map<systemType, deviceTree>;
SunnySrivastava1984a20be8e2020-08-26 02:00:50 -050054using PelAdditionalData = std::map<std::string, std::string>;
SunnySrivastava19849094d4f2020-08-05 09:32:29 -050055using Keyword = std::string;
56using KeywordData = std::string;
57using DbusPropertyMap = std::unordered_map<Keyword, KeywordData>;
58using PelAdditionalData = std::map<std::string, std::string>;
59using Service = std::string;
60using MapperResponse =
61 std::map<Path, std::map<Service, std::vector<Interface>>>;
Sunny Srivastavac6e7ea92023-11-03 21:10:43 +053062using MapperGetObjectResponse = std::map<Service, std::vector<Interface>>;
SunnySrivastava19849094d4f2020-08-05 09:32:29 -050063using RestoredEeproms = std::tuple<Path, std::string, Keyword, Binary>;
SunnySrivastava19849a195542020-09-07 06:04:50 -050064using ReplaceableFrus = std::vector<VPDfilepath>;
Sunny Srivastavafdf9ff22022-06-15 11:15:54 -050065using EssentialFrus = std::vector<Path>;
Priyanga Ramasamy952d6c52022-11-07 07:20:24 -060066using RecordName = std::string;
67using KeywordDefault = Binary;
68using isPELReqOnRestoreFailure = bool;
69using isMFGResetRequired = bool;
70using SystemKeywordInfo =
71 std::tuple<Keyword, KeywordDefault, isPELReqOnRestoreFailure,
Kantesh Nagaradder38ee9c82023-04-07 00:58:12 -050072 isMFGResetRequired, RecordName, Keyword>;
Priyanga Ramasamy952d6c52022-11-07 07:20:24 -060073
74/** Map of system backplane records to list of keywords and its related data. {
75 * Record : { Keyword, Default value, Is PEL required on restore failure, Is MFG
76 * reset required }} **/
77using SystemKeywordsMap =
78 std::unordered_map<RecordName, std::vector<SystemKeywordInfo>>;
Priyanga Ramasamy6d5e7342022-10-14 07:17:25 -050079
80using GetAllResultType = std::vector<std::pair<Keyword, Value>>;
81using IntfPropMap = std::map<RecordName, GetAllResultType>;
Priyanga Ramasamy124ae6c2022-10-18 12:46:14 -050082using RecKwValMap =
83 std::unordered_map<RecordName, std::unordered_map<Keyword, Binary>>;
Deepak Kodihalli76794492017-02-16 23:48:18 -060084} // namespace inventory
85
Deepak Kodihalli35c7fb12016-11-21 04:32:44 -060086} // namespace vpd
Patrick Williamsc78d8872023-05-10 07:50:56 -050087} // namespace openpower