blob: 9bb7d23086a54cab400307d3652d25faed205152 [file] [log] [blame]
Sampa Misra032bd502019-03-06 05:03:22 -06001#pragma once
2
Sampa Misrab37be312019-07-03 02:26:41 -05003#include "config.h"
4
5#include "bios_parser.hpp"
6#include "bios_table.hpp"
7
Sampa Misra032bd502019-03-06 05:03:22 -06008#include <stdint.h>
9
Sampa Misrab37be312019-07-03 02:26:41 -050010#include <map>
vkaverapa6575b82019-04-03 05:33:52 -050011#include <vector>
12
Sampa Misra032bd502019-03-06 05:03:22 -060013#include "libpldm/bios.h"
14
15namespace pldm
16{
17
vkaverapa6575b82019-04-03 05:33:52 -050018using Response = std::vector<uint8_t>;
Sampa Misrab37be312019-07-03 02:26:41 -050019using AttributeHandle = uint16_t;
20using StringHandle = uint16_t;
21using PossibleValuesByHandle = std::vector<StringHandle>;
vkaverapa6575b82019-04-03 05:33:52 -050022
Sampa Misra032bd502019-03-06 05:03:22 -060023namespace responder
24{
25
Jinu Joy Thomasf666db12019-05-29 05:22:31 -050026namespace bios
27{
28/** @brief Register handlers for command from the platform spec
29 */
30void registerHandlers();
Sampa Misrab37be312019-07-03 02:26:41 -050031
32namespace 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 */
42Response buildBIOSTables(const pldm_msg* request, size_t payloadLength,
43 const char* biosJsonDir, const char* biosTablePath);
44} // end namespace internal
45
Jinu Joy Thomasf666db12019-05-29 05:22:31 -050046} // namespace bios
47
Sampa Misra032bd502019-03-06 05:03:22 -060048/** @brief Handler for GetDateTime
49 *
50 * @param[in] request - Request message payload
vkaverapa6575b82019-04-03 05:33:52 -050051 * @param[return] Response - PLDM Response message
Sampa Misra032bd502019-03-06 05:03:22 -060052 */
Jinu Joy Thomasf666db12019-05-29 05:22:31 -050053Response getDateTime(const pldm_msg* request, size_t payloadLength);
Sampa Misra032bd502019-03-06 05:03:22 -060054
Sampa Misrab37be312019-07-03 02:26:41 -050055/** @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 */
61Response getBIOSTable(const pldm_msg* request, size_t payloadLength);
62
Sampa Misra032bd502019-03-06 05:03:22 -060063namespace 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 */
76void 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