GetBIOSTable responder implementation
This commit implements the GetBIOSTable responder handler
for the BIOS Enumeration type.
One of the tables among String table, Attribute table and Attribute
Value Table are created/fetched and sent to PLDM requester as response to
the command.
Tested:
Following are the tables constructed from the sample json file present at
"test/bios_jsons/enum_attrs.json"
-bash-4.2$ hexdump -C /tmp/AllBiosTables/stringTable
00000000 00 00 07 00 41 6c 6c 6f 77 65 64 01 00 10 00 43 |....Allowed....C|
00000010 6f 64 65 55 70 64 61 74 65 50 6f 6c 69 63 79 02 |odeUpdatePolicy.|
00000020 00 0a 00 43 6f 6e 63 75 72 72 65 6e 74 03 00 0a |...Concurrent...|
00000030 00 44 69 73 72 75 70 74 69 76 65 04 00 0a 00 46 |.Disruptive....F|
00000040 57 42 6f 6f 74 53 69 64 65 05 00 0f 00 48 4d 43 |WBootSide....HMC|
00000050 4d 61 6e 61 67 65 64 53 74 61 74 65 06 00 10 00 |ManagedState....|
00000060 49 6e 62 61 6e 64 43 6f 64 65 55 70 64 61 74 65 |InbandCodeUpdate|
00000070 07 00 0a 00 4e 6f 74 41 6c 6c 6f 77 65 64 08 00 |....NotAllowed..|
00000080 03 00 4f 66 66 09 00 02 00 4f 6e 0a 00 04 00 50 |..Off....On....P|
00000090 65 72 6d 0b 00 04 00 54 65 6d 70 00 37 90 c0 da |erm....Temp.7...|
000000a0
-bash-4.2$ hexdump -C /tmp/AllBiosTables/attributeTable
00000000 00 00 00 01 00 02 02 00 03 00 01 00 01 00 00 04 |................|
00000010 00 02 0a 00 0b 00 01 00 02 00 00 05 00 02 08 00 |................|
00000020 09 00 01 01 03 00 00 06 00 02 00 00 07 00 01 00 |................|
00000030 3b 85 69 a7 |;.i.|
00000034
-bash-4.2$ hexdump -C /tmp/AllBiosTables/attributeValueTable
00000000 00 00 00 01 00 00 00 00 d9 f6 42 58 |..........BX|
0000000c
Change-Id: I06aebcc2c2deea66e867fb775afa76a1e5d18dca
Signed-off-by: Sampa Misra <sampmisr@in.ibm.com>
diff --git a/libpldmresponder/bios.hpp b/libpldmresponder/bios.hpp
index 2befe24..9bb7d23 100644
--- a/libpldmresponder/bios.hpp
+++ b/libpldmresponder/bios.hpp
@@ -1,7 +1,13 @@
#pragma once
+#include "config.h"
+
+#include "bios_parser.hpp"
+#include "bios_table.hpp"
+
#include <stdint.h>
+#include <map>
#include <vector>
#include "libpldm/bios.h"
@@ -10,6 +16,9 @@
{
using Response = std::vector<uint8_t>;
+using AttributeHandle = uint16_t;
+using StringHandle = uint16_t;
+using PossibleValuesByHandle = std::vector<StringHandle>;
namespace responder
{
@@ -19,6 +28,21 @@
/** @brief Register handlers for command from the platform spec
*/
void registerHandlers();
+
+namespace internal
+{
+
+/** @brief Constructs all the BIOS Tables
+ *
+ * @param[in] request - Request message
+ * @param[in] payload_length - Request message payload length
+ * @param[in] biosJsonDir - path to fetch the BIOS json files
+ * @param[in] biosTablePath - path where the BIOS tables will be persisted
+ */
+Response buildBIOSTables(const pldm_msg* request, size_t payloadLength,
+ const char* biosJsonDir, const char* biosTablePath);
+} // end namespace internal
+
} // namespace bios
/** @brief Handler for GetDateTime
@@ -28,6 +52,14 @@
*/
Response getDateTime(const pldm_msg* request, size_t payloadLength);
+/** @brief Handler for GetBIOSTable
+ *
+ * @param[in] request - Request message
+ * @param[in] payload_length - Request message payload length
+ * @param[return] Response - PLDM Response message
+ */
+Response getBIOSTable(const pldm_msg* request, size_t payloadLength);
+
namespace utils
{