1 #pragma once 2 3 #include <stdint.h> 4 5 #include <sdbusplus/message/types.hpp> 6 7 #include <bitset> 8 #include <map> 9 #include <set> 10 #include <string> 11 #include <unordered_map> 12 #include <variant> 13 #include <vector> 14 15 namespace pldm 16 { 17 18 using Availability = bool; 19 using eid = uint8_t; 20 using UUID = std::string; 21 using Request = std::vector<uint8_t>; 22 using Response = std::vector<uint8_t>; 23 using Command = uint8_t; 24 25 /** @brief MCTP Endpoint Medium type in string 26 * Reserved for future purpose 27 */ 28 29 using MctpMedium = std::string; 30 /** @brief Type definition of MCTP Network Index. 31 * uint32_t is used as defined in MCTP Endpoint D-Bus Interface 32 */ 33 using NetworkId = uint32_t; 34 35 /** @brief Type definition of MCTP interface information between two endpoints. 36 * eid : Endpoint EID in byte. Defined to match with MCTP D-Bus 37 * interface 38 * UUID : Endpoint UUID which is used to different the endpoints 39 * MctpMedium: Endpoint MCTP Medium info (Resersed) 40 * NetworkId: MCTP network index 41 */ 42 using MctpInfo = std::tuple<eid, UUID, MctpMedium, NetworkId>; 43 44 /** @brief Type defined for list of MCTP interface information 45 */ 46 using MctpInfos = std::vector<MctpInfo>; 47 48 /** 49 * In `Table 2 - Special endpoint IDs` of DSP0236. 50 * EID from 1 to 7 is reserved EID. So the start valid EID is 8 51 */ 52 #define MCTP_START_VALID_EID 8 53 constexpr uint8_t BmcMctpEid = 8; 54 55 #define PLDM_PLATFORM_GETPDR_MAX_RECORD_BYTES 1024 56 57 namespace dbus 58 { 59 60 using ObjectPath = std::string; 61 using Service = std::string; 62 using Interface = std::string; 63 using Interfaces = std::vector<std::string>; 64 using Property = std::string; 65 using PropertyType = std::string; 66 using Value = 67 std::variant<bool, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, 68 uint64_t, double, std::string, std::vector<uint8_t>>; 69 70 using PropertyMap = std::map<Property, Value>; 71 using InterfaceMap = std::map<Interface, PropertyMap>; 72 using ObjectValueTree = std::map<sdbusplus::message::object_path, InterfaceMap>; 73 74 } // namespace dbus 75 76 namespace fw_update 77 { 78 79 // Descriptor definition 80 using DescriptorType = uint16_t; 81 using DescriptorData = std::vector<uint8_t>; 82 using VendorDefinedDescriptorTitle = std::string; 83 using VendorDefinedDescriptorData = std::vector<uint8_t>; 84 using VendorDefinedDescriptorInfo = 85 std::tuple<VendorDefinedDescriptorTitle, VendorDefinedDescriptorData>; 86 using Descriptors = 87 std::map<DescriptorType, 88 std::variant<DescriptorData, VendorDefinedDescriptorInfo>>; 89 90 using DescriptorMap = std::unordered_map<eid, Descriptors>; 91 92 // Component information 93 using CompClassification = uint16_t; 94 using CompIdentifier = uint16_t; 95 using CompKey = std::pair<CompClassification, CompIdentifier>; 96 using CompClassificationIndex = uint8_t; 97 using ComponentInfo = std::map<CompKey, CompClassificationIndex>; 98 using ComponentInfoMap = std::unordered_map<eid, ComponentInfo>; 99 100 // PackageHeaderInformation 101 using PackageHeaderSize = size_t; 102 using PackageVersion = std::string; 103 using ComponentBitmapBitLength = uint16_t; 104 using PackageHeaderChecksum = uint32_t; 105 106 // FirmwareDeviceIDRecords 107 using DeviceIDRecordCount = uint8_t; 108 using DeviceUpdateOptionFlags = std::bitset<32>; 109 using ApplicableComponents = std::vector<size_t>; 110 using ComponentImageSetVersion = std::string; 111 using FirmwareDevicePackageData = std::vector<uint8_t>; 112 using FirmwareDeviceIDRecord = 113 std::tuple<DeviceUpdateOptionFlags, ApplicableComponents, 114 ComponentImageSetVersion, Descriptors, 115 FirmwareDevicePackageData>; 116 using FirmwareDeviceIDRecords = std::vector<FirmwareDeviceIDRecord>; 117 118 // ComponentImageInformation 119 using ComponentImageCount = uint16_t; 120 using CompComparisonStamp = uint32_t; 121 using CompOptions = std::bitset<16>; 122 using ReqCompActivationMethod = std::bitset<16>; 123 using CompLocationOffset = uint32_t; 124 using CompSize = uint32_t; 125 using CompVersion = std::string; 126 using ComponentImageInfo = 127 std::tuple<CompClassification, CompIdentifier, CompComparisonStamp, 128 CompOptions, ReqCompActivationMethod, CompLocationOffset, 129 CompSize, CompVersion>; 130 using ComponentImageInfos = std::vector<ComponentImageInfo>; 131 132 enum class ComponentImageInfoPos : size_t 133 { 134 CompClassificationPos = 0, 135 CompIdentifierPos = 1, 136 CompComparisonStampPos = 2, 137 CompOptionsPos = 3, 138 ReqCompActivationMethodPos = 4, 139 CompLocationOffsetPos = 5, 140 CompSizePos = 6, 141 CompVersionPos = 7, 142 }; 143 144 } // namespace fw_update 145 146 namespace pdr 147 { 148 149 using EID = uint8_t; 150 using TerminusHandle = uint16_t; 151 using TerminusID = uint8_t; 152 using SensorID = uint16_t; 153 using EntityType = uint16_t; 154 using EntityInstance = uint16_t; 155 using ContainerID = uint16_t; 156 using StateSetId = uint16_t; 157 using CompositeCount = uint8_t; 158 using SensorOffset = uint8_t; 159 using EventState = uint8_t; 160 using TerminusValidity = uint8_t; 161 162 //!< Subset of the State Set that is supported by a effecter/sensor 163 using PossibleStates = std::set<uint8_t>; 164 //!< Subset of the State Set that is supported by each effecter/sensor in a 165 //!< composite efffecter/sensor 166 using CompositeSensorStates = std::vector<PossibleStates>; 167 using EntityInfo = std::tuple<ContainerID, EntityType, EntityInstance>; 168 using SensorInfo = 169 std::tuple<EntityInfo, CompositeSensorStates, std::vector<StateSetId>>; 170 171 } // namespace pdr 172 173 } // namespace pldm 174