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