1 #pragma once 2 3 #include "common/utils.hpp" 4 #include "libpldmresponder/fru.hpp" 5 #include "libpldmresponder/oem_handler.hpp" 6 #include "oem/ibm/libpldmresponder/utils.hpp" 7 8 #include <libpldm/oem/ibm/fru.h> 9 10 namespace pldm 11 { 12 namespace responder 13 { 14 using ObjectPath = std::string; 15 using AssociatedEntityMap = std::map<ObjectPath, pldm_entity>; 16 17 namespace oem_ibm_fru 18 { 19 20 // structure of the PCIE config space data 21 struct PcieConfigSpaceData 22 { 23 uint16_t vendorId; 24 uint16_t deviceId; 25 uint32_t first_reserved; 26 uint8_t revisionId; 27 std::array<uint8_t, 3> classCode; 28 uint32_t second_reserved[8]; 29 uint16_t subSystemVendorId; 30 uint16_t subSystemId; 31 uint32_t last_reserved[4]; 32 33 } __attribute__((packed)); 34 35 class Handler : public oem_fru::Handler 36 { 37 public: 38 Handler(pldm_pdr* repo) : pdrRepo(repo) {} 39 40 /** @brief Method to set the fru handler in the 41 * oem_ibm_handler class 42 * 43 * @param[in] handler - pointer to PLDM platform handler 44 */ 45 void setIBMFruHandler(pldm::responder::fru::Handler* handler); 46 47 /** @brief Process OEM FRU table 48 * 49 * @param[in] fruData - the data of the fru records 50 * 51 * @return success or failure 52 */ 53 int processOEMFRUTable(const std::vector<uint8_t>& fruData); 54 55 virtual const AssociatedEntityMap& getAssociateEntityMap() 56 { 57 return fruHandler->getAssociateEntityMap(); 58 } 59 60 ~Handler() = default; 61 62 private: 63 /** @brief pointer to BMC's primary PDR repo */ 64 const pldm_pdr* pdrRepo; 65 66 pldm::responder::fru::Handler* fruHandler; //!< pointer to PLDM fru handler 67 68 /** @brief update the DBus property 69 * 70 * @param[in] fruRSI - fru record set identifier 71 * @param[in] fruAssociationMap - the dbus path to pldm entity stored while 72 * creating the pldm fru records 73 * @param[in] vendorId - the vendor ID 74 * @param[in] deviceId - the device ID 75 * @param[in] revisionId - the revision ID 76 * @param[in] classCode - the class Code 77 * @param[in] subSystemVendorId - the subSystemVendor ID 78 * @param[in] subSystemId - the subSystem ID 79 */ 80 void updateDBusProperty( 81 uint16_t fruRSI, const AssociatedEntityMap& fruAssociationMap, 82 const std::string& vendorId, const std::string& deviceId, 83 const std::string& revisionId, const std::string& classCode, 84 const std::string& subSystemVendorId, const std::string& subSystemId); 85 86 /** @brief DBus Map update 87 * 88 * @param[in] adapterObjectPath - the fru object path 89 * @param[in] propertyName - the fru property name 90 * @param[in] propValue - the fru property value 91 */ 92 void dbus_map_update(const std::string& adapterObjectPath, 93 const std::string& propertyName, 94 const std::string& propValue); 95 96 /** @brief setting firmware UAK (Update Access Key) 97 * 98 * @param[in] data - value to be set 99 */ 100 void setFirmwareUAK(const std::vector<uint8_t>& data); 101 }; 102 103 } // namespace oem_ibm_fru 104 } // namespace responder 105 } // namespace pldm 106