google-ipmi-sys: Refactor to use new version of OEM IPMI Handler
Using the new version of ipmi handler provide a higher level wrapper
over the same functionalities. It helps us parse the input and output to
have more control of the input/output we see.
The input and output will be
`std::uint8_t, std::optional<std::vector<uint8_t>>`.
This represents `subcommand` and any input data.
Changes to note,
- all subcommand in the request/response struct are removed. It will be
managed by the wrapper directly.
- Unit tests checking for input with only the subcommand are
removed.
- Move all reply struct to header files to be accessible in unit test.
Tested:
All IPMI OEM command still works the same as before this change.
Change-Id: I4230ab84a497a867248fe82224e32cc69b314b64
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/pcie_i2c.hpp b/pcie_i2c.hpp
index 2b572b9..5f1cd35 100644
--- a/pcie_i2c.hpp
+++ b/pcie_i2c.hpp
@@ -18,20 +18,34 @@
#include <ipmid/api.h>
+#include <ipmid/api-types.hpp>
+#include <vector>
+
namespace google
{
namespace ipmi
{
+struct PcieSlotCountReply
+{
+ uint8_t value;
+} __attribute__((packed));
+
+struct PcieSlotI2cBusMappingReply
+{
+ uint8_t i2c_bus_number;
+ uint8_t pcie_slot_name_len;
+} __attribute__((packed));
+
// Handle the pcie slot count command.
// Sys can query the number of pcie slots.
-ipmi_ret_t pcieSlotCount(const uint8_t* reqBuf, uint8_t* replyBuf,
- size_t* dataLen, HandlerInterface* handler);
+Resp pcieSlotCount(const std::vector<std::uint8_t>& data,
+ HandlerInterface* handler);
// Handle the pcie slot to i2c bus mapping command.
// Sys can query which i2c bus is routed to which pcie slot.
-ipmi_ret_t pcieSlotI2cBusMapping(const uint8_t* reqBuf, uint8_t* replyBuf,
- size_t* dataLen, HandlerInterface* handler);
+Resp pcieSlotI2cBusMapping(const std::vector<std::uint8_t>& data,
+ HandlerInterface* handler);
} // namespace ipmi
} // namespace google