blob: 050f7ca1d8c79210e35169858616634d7a8dbb48 [file] [log] [blame]
Patrick Venture54c3b532018-08-01 11:45:49 -07001#pragma once
2
3#include "host-ipmid/ipmid-api.h"
4
5#include "flash-ipmi.hpp"
6
7/**
Patrick Venturea53a7b32018-08-03 09:15:20 -07008 * 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 */
14bool validateRequestLength(FlashSubCmds command, size_t requestLen);
15
16/**
Patrick Venture54c3b532018-08-01 11:45:49 -070017 * 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 */
26ipmi_ret_t startTransfer(UpdateInterface* updater, const uint8_t* reqBuf,
27 uint8_t* replyBuf, size_t* dataLen);
Patrick Venture79e131f2018-08-01 13:34:35 -070028
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 */
39ipmi_ret_t dataBlock(UpdateInterface* updater, const uint8_t* reqBuf,
40 uint8_t* replyBuf, size_t* dataLen);
Patrick Venture2c1205d2018-08-03 10:23:14 -070041
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 */
52ipmi_ret_t dataFinish(UpdateInterface* updater, const uint8_t* reqBuf,
53 uint8_t* replyBuf, size_t* dataLen);