Patrick Venture | 54c3b53 | 2018-08-01 11:45:49 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "host-ipmid/ipmid-api.h" |
| 4 | |
| 5 | #include "flash-ipmi.hpp" |
| 6 | |
| 7 | /** |
Patrick Venture | a53a7b3 | 2018-08-03 09:15:20 -0700 | [diff] [blame] | 8 | * Validate the minimum request length if there is one. |
| 9 | * |
| 10 | * @param[in] subcommand - the command |
| 11 | * @param[in] requestLength - the length of the request |
| 12 | * @return bool - true if valid. |
| 13 | */ |
| 14 | bool validateRequestLength(FlashSubCmds command, size_t requestLen); |
| 15 | |
| 16 | /** |
Patrick Venture | 54c3b53 | 2018-08-01 11:45:49 -0700 | [diff] [blame] | 17 | * Prepare to receive a BMC image and then a signature. |
| 18 | * |
| 19 | * @param[in] updater - Pointer to Updater object. |
| 20 | * @param[in] reqBuf - the IPMI packet. |
| 21 | * @param[in] replyBuf - Pointer to buffer for any response. |
| 22 | * @param[in,out] dataLen - Initially reqBuf length, set to replyBuf |
| 23 | * length when done. |
| 24 | * @return corresponding IPMI return code. |
| 25 | */ |
| 26 | ipmi_ret_t startTransfer(UpdateInterface* updater, const uint8_t* reqBuf, |
| 27 | uint8_t* replyBuf, size_t* dataLen); |
Patrick Venture | 79e131f | 2018-08-01 13:34:35 -0700 | [diff] [blame] | 28 | |
| 29 | /** |
| 30 | * Receive a flash image data block and store it. |
| 31 | * |
| 32 | * @param[in] updater - Pointer to Updater object. |
| 33 | * @param[in] reqBuf - the IPMI packet. |
| 34 | * @param[in] replyBuf - Pointer to buffer for any response. |
| 35 | * @param[in,out] dataLen - Initially reqBuf length, set to replyBuf |
| 36 | * length when done. |
| 37 | * @return corresponding IPMI return code. |
| 38 | */ |
| 39 | ipmi_ret_t dataBlock(UpdateInterface* updater, const uint8_t* reqBuf, |
| 40 | uint8_t* replyBuf, size_t* dataLen); |
Patrick Venture | 2c1205d | 2018-08-03 10:23:14 -0700 | [diff] [blame] | 41 | |
| 42 | /** |
| 43 | * Indicate all flash data has been sent. |
| 44 | * |
| 45 | * @param[in] updater - Pointer to Updater object. |
| 46 | * @param[in] reqBuf - the IPMI packet. |
| 47 | * @param[in] replyBuf - Pointer to buffer for any response. |
| 48 | * @param[in,out] dataLen - Initially reqBuf length, set to replyBuf |
| 49 | * length when done. |
| 50 | * @return corresponding IPMI return code. |
| 51 | */ |
| 52 | ipmi_ret_t dataFinish(UpdateInterface* updater, const uint8_t* reqBuf, |
| 53 | uint8_t* replyBuf, size_t* dataLen); |
Patrick Venture | 8d9f732 | 2018-08-03 10:39:13 -0700 | [diff] [blame^] | 54 | |
| 55 | /** |
| 56 | * Prepare to receive a BMC image signature. |
| 57 | * |
| 58 | * @param[in] updater - Pointer to Updater object. |
| 59 | * @param[in] reqBuf - the IPMI packet. |
| 60 | * @param[in] replyBuf - Pointer to buffer for any response. |
| 61 | * @param[in,out] dataLen - Initially reqBuf length, set to replyBuf |
| 62 | * length when done. |
| 63 | * @return corresponding IPMI return code. |
| 64 | */ |
| 65 | ipmi_ret_t startHash(UpdateInterface* updater, const uint8_t* reqBuf, |
| 66 | uint8_t* replyBuf, size_t* dataLen); |