1 #pragma once 2 3 #include "config.h" 4 5 #include "bios_parser.hpp" 6 #include "bios_table.hpp" 7 8 #include <stdint.h> 9 10 #include <map> 11 #include <vector> 12 13 #include "libpldm/bios.h" 14 15 namespace pldm 16 { 17 18 using Response = std::vector<uint8_t>; 19 using AttributeHandle = uint16_t; 20 using StringHandle = uint16_t; 21 using PossibleValuesByHandle = std::vector<StringHandle>; 22 23 namespace responder 24 { 25 26 namespace bios 27 { 28 /** @brief Register handlers for command from the platform spec 29 */ 30 void registerHandlers(); 31 32 namespace internal 33 { 34 35 /** @brief Constructs all the BIOS Tables 36 * 37 * @param[in] request - Request message 38 * @param[in] payload_length - Request message payload length 39 * @param[in] biosJsonDir - path to fetch the BIOS json files 40 * @param[in] biosTablePath - path where the BIOS tables will be persisted 41 */ 42 Response buildBIOSTables(const pldm_msg* request, size_t payloadLength, 43 const char* biosJsonDir, const char* biosTablePath); 44 } // end namespace internal 45 46 } // namespace bios 47 48 /** @brief Handler for GetDateTime 49 * 50 * @param[in] request - Request message payload 51 * @param[return] Response - PLDM Response message 52 */ 53 Response getDateTime(const pldm_msg* request, size_t payloadLength); 54 55 /** @brief Handler for GetBIOSTable 56 * 57 * @param[in] request - Request message 58 * @param[in] payload_length - Request message payload length 59 * @param[return] Response - PLDM Response message 60 */ 61 Response getBIOSTable(const pldm_msg* request, size_t payloadLength); 62 63 namespace utils 64 { 65 66 /** @brief Convert epoch time to BCD time 67 * 68 * @param[in] timeSec - Time got from epoch time in seconds 69 * @param[out] seconds - number of seconds in BCD 70 * @param[out] minutes - number of minutes in BCD 71 * @param[out] hours - number of hours in BCD 72 * @param[out] day - day of the month in BCD 73 * @param[out] month - month number in BCD 74 * @param[out] year - year number in BCD 75 */ 76 void epochToBCDTime(uint64_t timeSec, uint8_t& seconds, uint8_t& minutes, 77 uint8_t& hours, uint8_t& day, uint8_t& month, 78 uint16_t& year); 79 } // namespace utils 80 81 } // namespace responder 82 } // namespace pldm 83