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.
Changes to note,
- All cmd are removed from the request data. That is automatically
extracted now.
Tested:
Unit Test Passed.
All IPMI OEM command still works the same as before this change.
```
$ burn_my_bmc -command stage -image /tmp/test.txt -interface ipmipci
Set up ipmi flash updater with /flash/dummy
Received failure on delete: Received IPMI_CC: 255
Sending over the firmware image.
Find [0x1050 0x750]
bar0[0x94000000]
Upload to BMC 100% |Goooooooooooooooooooooooooooooooooooooooooooooooooooooooogle| Time: 00:00:00
Opening the verification file
Committing to /flash/verify to trigger service
Calling stat on /flash/verify session to check status
success
succeeded
```
Also tested gBMC Update workflow which worked fine.
Change-Id: Ib2bfeab0c2ec5aa72ede1ff457ef5f90e488053c
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/main.cpp b/main.cpp
index e90969b..d3179f3 100644
--- a/main.cpp
+++ b/main.cpp
@@ -24,11 +24,14 @@
#include <ipmid/api.h>
#include <cstdio>
+#include <ipmid/api-types.hpp>
+#include <ipmid/handler.hpp>
#include <ipmid/iana.hpp>
#include <ipmid/oemopenbmc.hpp>
#include <ipmid/oemrouter.hpp>
#include <memory>
#include <phosphor-logging/log.hpp>
+#include <span>
namespace blobs
{
@@ -39,13 +42,16 @@
void setupBlobGlobalHandler()
{
- oem::Router* oemRouter = oem::mutableRouter();
std::fprintf(stderr,
"Registering OEM:[%#08X], Cmd:[%#04X] for Blob Commands\n",
oem::obmcOemNumber, oem::Cmd::blobTransferCmd);
- oemRouter->registerHandler(oem::obmcOemNumber, oem::Cmd::blobTransferCmd,
- handleBlobCommand);
+ ipmi::registerOemHandler(
+ ipmi::prioOemBase, oem::obmcOemNumber, oem::Cmd::blobTransferCmd,
+ ::ipmi::Privilege::User,
+ [](ipmi::Context::ptr, uint8_t cmd, const std::vector<uint8_t>& data) {
+ return handleBlobCommand(cmd, data);
+ });
/* Install handlers. */
try