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