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 54 #define PLDM_PLATFORM_GETPDR_MAX_RECORD_BYTES 1024 55 56 namespace dbus 57 { 58 59 using ObjectPath = std::string; 60 using Service = std::string; 61 using Interface = std::string; 62 using Interfaces = std::vector<std::string>; 63 using Property = std::string; 64 using PropertyType = std::string; 65 using Value = 66 std::variant<bool, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, 67 uint64_t, double, std::string, std::vector<uint8_t>>; 68 69 using PropertyMap = std::map<Property, Value>; 70 using InterfaceMap = std::map<Interface, PropertyMap>; 71 using ObjectValueTree = std::map<sdbusplus::message::object_path, InterfaceMap>; 72 73 } // namespace dbus 74 75 namespace fw_update 76 { 77 78 // Descriptor definition 79 using DescriptorType = uint16_t; 80 using DescriptorData = std::vector<uint8_t>; 81 using VendorDefinedDescriptorTitle = std::string; 82 using VendorDefinedDescriptorData = std::vector<uint8_t>; 83 using VendorDefinedDescriptorInfo = 84 std::tuple<VendorDefinedDescriptorTitle, VendorDefinedDescriptorData>; 85 using Descriptors = 86 std::map<DescriptorType, 87 std::variant<DescriptorData, VendorDefinedDescriptorInfo>>; 88 89 using DescriptorMap = std::unordered_map<eid, Descriptors>; 90 91 // Component information 92 using CompClassification = uint16_t; 93 using CompIdentifier = uint16_t; 94 using CompKey = std::pair<CompClassification, CompIdentifier>; 95 using CompClassificationIndex = uint8_t; 96 using ComponentInfo = std::map<CompKey, CompClassificationIndex>; 97 using ComponentInfoMap = std::unordered_map<eid, ComponentInfo>; 98 99 // PackageHeaderInformation 100 using PackageHeaderSize = size_t; 101 using PackageVersion = std::string; 102 using ComponentBitmapBitLength = uint16_t; 103 using PackageHeaderChecksum = uint32_t; 104 105 // FirmwareDeviceIDRecords 106 using DeviceIDRecordCount = uint8_t; 107 using DeviceUpdateOptionFlags = std::bitset<32>; 108 using ApplicableComponents = std::vector<size_t>; 109 using ComponentImageSetVersion = std::string; 110 using FirmwareDevicePackageData = std::vector<uint8_t>; 111 using FirmwareDeviceIDRecord = 112 std::tuple<DeviceUpdateOptionFlags, ApplicableComponents, 113 ComponentImageSetVersion, Descriptors, 114 FirmwareDevicePackageData>; 115 using FirmwareDeviceIDRecords = std::vector<FirmwareDeviceIDRecord>; 116 117 // ComponentImageInformation 118 using ComponentImageCount = uint16_t; 119 using CompComparisonStamp = uint32_t; 120 using CompOptions = std::bitset<16>; 121 using ReqCompActivationMethod = std::bitset<16>; 122 using CompLocationOffset = uint32_t; 123 using CompSize = uint32_t; 124 using CompVersion = std::string; 125 using ComponentImageInfo = 126 std::tuple<CompClassification, CompIdentifier, CompComparisonStamp, 127 CompOptions, ReqCompActivationMethod, CompLocationOffset, 128 CompSize, CompVersion>; 129 using ComponentImageInfos = std::vector<ComponentImageInfo>; 130 131 enum class ComponentImageInfoPos : size_t 132 { 133 CompClassificationPos = 0, 134 CompIdentifierPos = 1, 135 CompComparisonStampPos = 2, 136 CompOptionsPos = 3, 137 ReqCompActivationMethodPos = 4, 138 CompLocationOffsetPos = 5, 139 CompSizePos = 6, 140 CompVersionPos = 7, 141 }; 142 143 } // namespace fw_update 144 145 namespace pdr 146 { 147 148 using EID = uint8_t; 149 using TerminusHandle = uint16_t; 150 using TerminusID = uint8_t; 151 using SensorID = uint16_t; 152 using EntityType = uint16_t; 153 using EntityInstance = uint16_t; 154 using ContainerID = uint16_t; 155 using StateSetId = uint16_t; 156 using CompositeCount = uint8_t; 157 using SensorOffset = uint8_t; 158 using EventState = uint8_t; 159 using TerminusValidity = uint8_t; 160 161 //!< Subset of the State Set that is supported by a effecter/sensor 162 using PossibleStates = std::set<uint8_t>; 163 //!< Subset of the State Set that is supported by each effecter/sensor in a 164 //!< composite efffecter/sensor 165 using CompositeSensorStates = std::vector<PossibleStates>; 166 using EntityInfo = std::tuple<ContainerID, EntityType, EntityInstance>; 167 using SensorInfo = 168 std::tuple<EntityInfo, CompositeSensorStates, std::vector<StateSetId>>; 169 170 } // namespace pdr 171 172 } // namespace pldm 173