tools: blob add writeMeta to interface
Add the blob write metadata command to the interface. The LPC interface
will use write meta to configure the BMC's window.
Change-Id: I0266e62174fac428bf0fb84fb9d128451b69e4d8
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/test/blob_interface_mock.hpp b/test/blob_interface_mock.hpp
index bf9fdbc..520d5b4 100644
--- a/test/blob_interface_mock.hpp
+++ b/test/blob_interface_mock.hpp
@@ -9,6 +9,8 @@
{
public:
virtual ~BlobInterfaceMock() = default;
+ MOCK_METHOD3(writeMeta, void(std::uint16_t, std::uint32_t,
+ const std::vector<std::uint8_t>&));
MOCK_METHOD3(writeBytes, void(std::uint16_t, std::uint32_t,
const std::vector<std::uint8_t>&));
MOCK_METHOD0(getBlobList, std::vector<std::string>());
diff --git a/tools/blob_handler.cpp b/tools/blob_handler.cpp
index fd50c00..e1a995d 100644
--- a/tools/blob_handler.cpp
+++ b/tools/blob_handler.cpp
@@ -161,8 +161,9 @@
}
}
-void BlobHandler::writeBytes(std::uint16_t session, std::uint32_t offset,
- const std::vector<std::uint8_t>& bytes)
+void BlobHandler::writeGeneric(BlobOEMCommands command, std::uint16_t session,
+ std::uint32_t offset,
+ const std::vector<std::uint8_t>& bytes)
{
std::vector<std::uint8_t> payload;
@@ -177,7 +178,20 @@
std::copy(bytes.begin(), bytes.end(), std::back_inserter(payload));
- auto resp = sendIpmiPayload(BlobOEMCommands::bmcBlobWrite, payload);
+ auto resp = sendIpmiPayload(command, payload);
+}
+
+void BlobHandler::writeMeta(std::uint16_t session, std::uint32_t offset,
+ const std::vector<std::uint8_t>& bytes)
+{
+ return writeGeneric(BlobOEMCommands::bmcBlobWriteMeta, session, offset,
+ bytes);
+}
+
+void BlobHandler::writeBytes(std::uint16_t session, std::uint32_t offset,
+ const std::vector<std::uint8_t>& bytes)
+{
+ return writeGeneric(BlobOEMCommands::bmcBlobWrite, session, offset, bytes);
}
std::vector<std::string> BlobHandler::getBlobList()
diff --git a/tools/blob_handler.hpp b/tools/blob_handler.hpp
index 0114b89..3c90404 100644
--- a/tools/blob_handler.hpp
+++ b/tools/blob_handler.hpp
@@ -55,6 +55,25 @@
std::string enumerateBlob(std::uint32_t index);
/**
+ * Generic blob byte writer.
+ *
+ * @param[in] command - the command associated with this write.
+ * @param[in] session - the session id.
+ * @param[in] offset - the offset for the metadata to write.
+ * @param[in] bytes - the bytes to send.
+ * @throws BlobException on failure.
+ */
+ void writeGeneric(BlobOEMCommands command, std::uint16_t session,
+ std::uint32_t offset,
+ const std::vector<std::uint8_t>& bytes);
+
+ /**
+ * @throws BlobException.
+ */
+ void writeMeta(std::uint16_t session, std::uint32_t offset,
+ const std::vector<std::uint8_t>& bytes) override;
+
+ /**
* @throw BlobException.
*/
void writeBytes(std::uint16_t session, std::uint32_t offset,
diff --git a/tools/blob_interface.hpp b/tools/blob_interface.hpp
index 00031b8..07525c9 100644
--- a/tools/blob_interface.hpp
+++ b/tools/blob_interface.hpp
@@ -22,6 +22,17 @@
virtual ~BlobInterface() = default;
/**
+ * Write metadata to a blob.
+ *
+ * @param[in] session - the session id.
+ * @param[in] offset - the offset for the metadata to write.
+ * @param[in] bytes - the bytes to send.
+ * @throws BlobException on failure.
+ */
+ virtual void writeMeta(std::uint16_t session, std::uint32_t offset,
+ const std::vector<std::uint8_t>& bytes) = 0;
+
+ /**
* Write bytes to a blob.
*
* @param[in] session - the session id.