Sampa Misra | 032bd50 | 2019-03-06 05:03:22 -0600 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Sampa Misra | b37be31 | 2019-07-03 02:26:41 -0500 | [diff] [blame] | 3 | #include "config.h" |
| 4 | |
| 5 | #include "bios_parser.hpp" |
| 6 | #include "bios_table.hpp" |
| 7 | |
Sampa Misra | 032bd50 | 2019-03-06 05:03:22 -0600 | [diff] [blame] | 8 | #include <stdint.h> |
| 9 | |
Sampa Misra | b37be31 | 2019-07-03 02:26:41 -0500 | [diff] [blame] | 10 | #include <map> |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 11 | #include <vector> |
| 12 | |
Sampa Misra | 032bd50 | 2019-03-06 05:03:22 -0600 | [diff] [blame] | 13 | #include "libpldm/bios.h" |
| 14 | |
| 15 | namespace pldm |
| 16 | { |
| 17 | |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 18 | using Response = std::vector<uint8_t>; |
Sampa Misra | b37be31 | 2019-07-03 02:26:41 -0500 | [diff] [blame] | 19 | using AttributeHandle = uint16_t; |
| 20 | using StringHandle = uint16_t; |
| 21 | using PossibleValuesByHandle = std::vector<StringHandle>; |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 22 | |
Sampa Misra | 032bd50 | 2019-03-06 05:03:22 -0600 | [diff] [blame] | 23 | namespace responder |
| 24 | { |
| 25 | |
Jinu Joy Thomas | f666db1 | 2019-05-29 05:22:31 -0500 | [diff] [blame] | 26 | namespace bios |
| 27 | { |
| 28 | /** @brief Register handlers for command from the platform spec |
| 29 | */ |
| 30 | void registerHandlers(); |
Sampa Misra | b37be31 | 2019-07-03 02:26:41 -0500 | [diff] [blame] | 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 | |
Jinu Joy Thomas | f666db1 | 2019-05-29 05:22:31 -0500 | [diff] [blame] | 46 | } // namespace bios |
| 47 | |
Sampa Misra | 032bd50 | 2019-03-06 05:03:22 -0600 | [diff] [blame] | 48 | /** @brief Handler for GetDateTime |
| 49 | * |
| 50 | * @param[in] request - Request message payload |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 51 | * @param[return] Response - PLDM Response message |
Sampa Misra | 032bd50 | 2019-03-06 05:03:22 -0600 | [diff] [blame] | 52 | */ |
Jinu Joy Thomas | f666db1 | 2019-05-29 05:22:31 -0500 | [diff] [blame] | 53 | Response getDateTime(const pldm_msg* request, size_t payloadLength); |
Sampa Misra | 032bd50 | 2019-03-06 05:03:22 -0600 | [diff] [blame] | 54 | |
Sampa Misra | b37be31 | 2019-07-03 02:26:41 -0500 | [diff] [blame] | 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 | |
Sampa Misra | 032bd50 | 2019-03-06 05:03:22 -0600 | [diff] [blame] | 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 |