tools: starting burn_my_bmc host utility
burn_my_bmc is a host-run utility that in cooperation with the
phosphor-ipmi-flash library, attempts to send a BMC firmware image and
signature file to the BMC and trigger verification of said image.
The program's current design and use were tailored towards the legacy
OpenBMC image and not UBI. Therefore, changes to support the UBI
process will get addressed as it all takes shape.
The overall process is:
1) Attempts to send firmware image over an interface.
2) Attempts to send signature file contents over an interface*.
3) Triggers a verification step.
4) Reboots the BMC**.
* The only interface in the initial version here is the blocktransfer
interface. It's technically also possibly KCS. It's sending the data
over the same communications channel as the normal IPMI packets. A
later patchset will enable sending the data bytes over an LPC memory
region or the PCI P2A region.
** The 4th step is done by a separate call to the 'reboot' command.
The 'reboot' and 'ping' commands will come in a later patchset.
Change-Id: I62d725274e56c55ca414fa6c2a3eab6c500066ed
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/tools/libs/ipmitoolintf.h b/tools/libs/ipmitoolintf.h
new file mode 100644
index 0000000..c4994fd
--- /dev/null
+++ b/tools/libs/ipmitoolintf.h
@@ -0,0 +1,28 @@
+#pragma once
+
+/* The Aspeed AST2400 & AST2500 have 64 bytes of SRAM as the FIFO for each
+ * direction, of which 2 bytes are reserved for len and for seq by upper layer
+ * ipmi driver.
+ */
+#define MAX_PIPELINE_BANDWIDTH 62
+#define IPMI_BUF_SIZE 1024
+
+#include <stdint.h>
+
+struct IpmiResponse
+{
+ uint8_t ccode;
+ uint8_t data[IPMI_BUF_SIZE];
+ int dataLen;
+};
+
+/**
+ * Call into the ipmitool source to send the IPMI packet.
+ *
+ * @param[in] bytes - the IPMI packet contents.
+ * @param[in] length - the number of bytes.
+ * @param[in,out] resp - a pointer to write the response.
+ * @return 0 on success.
+ */
+int ipmiSendCommand(const uint8_t* bytes, int length,
+ struct IpmiResponse* resp);