Skip to content

Commit 6fd45a1

Browse files
committed
minerva-ag/vr_update_version_and_remain_check
1 parent aa75d53 commit 6fd45a1

File tree

6 files changed

+328
-3
lines changed

6 files changed

+328
-3
lines changed

common/service/pldm/pldm_firmware_update.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@ __weak uint16_t plat_find_update_info_work(uint16_t comp_id)
8686
return comp_id;
8787
}
8888

89+
__weak uint8_t plat_pldm_pass_component_table_check(uint16_t num_of_comp,
90+
const uint8_t *comp_image_version_str,
91+
uint8_t comp_image_version_str_len)
92+
{
93+
return PLDM_SUCCESS;
94+
}
95+
8996
int get_descriptor_type_length(uint16_t type)
9097
{
9198
switch (type) {
@@ -645,7 +652,7 @@ static void state_update(uint8_t state)
645652
}
646653
}
647654

648-
static void pldm_status_reset()
655+
void pldm_status_reset()
649656
{
650657
state_update(STATE_IDLE);
651658
cur_aux_state = STATE_AUX_NOT_IN_UPDATE;
@@ -658,7 +665,7 @@ static void pldm_status_reset()
658665

659666
static void exit_update_mode()
660667
{
661-
printk("PLDM update mode timeout, exiting update mode...\n");
668+
LOG_WRN("PLDM update mode timeout, exiting update mode...");
662669
pldm_status_reset();
663670
}
664671

@@ -1069,6 +1076,14 @@ static uint8_t pass_component_table(void *mctp_inst, uint8_t *buf, uint16_t len,
10691076
LOG_HEXDUMP_INF(buf + sizeof(struct pldm_pass_component_table_req), req_p->comp_ver_str_len,
10701077
"");
10711078

1079+
uint8_t check_result = plat_pldm_pass_component_table_check(
1080+
req_p->comp_identifier, buf + sizeof(struct pldm_pass_component_table_req),
1081+
req_p->comp_ver_str_len);
1082+
if (check_result != PLDM_SUCCESS) {
1083+
resp_p->completion_code = check_result;
1084+
goto exit;
1085+
}
1086+
10721087
if (current_state != STATE_LEARN_COMP) {
10731088
LOG_ERR("Firmware update failed because current state %d is not %d", current_state,
10741089
STATE_LEARN_COMP);

common/service/pldm/pldm_firmware_update.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,10 @@ uint8_t fill_descriptor_into_buf(struct pldm_descriptor_string *descriptor, uint
726726
uint8_t *fill_length, uint16_t current_length);
727727
bool is_update_state_download_phase();
728728
bool is_update_state_idle();
729+
void pldm_status_reset();
730+
uint8_t plat_pldm_pass_component_table_check(uint16_t num_of_comp,
731+
const uint8_t *comp_image_version_str,
732+
uint8_t comp_image_version_str_len);
729733

730734
#ifdef __cplusplus
731735
}

common/service/pldm/pldm_oem.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,42 @@ static uint8_t oem_wf_read_spd_chunk(void *mctp_inst, uint8_t *buf, uint16_t len
4343
void *ext_params);
4444
#endif
4545

46+
__weak uint8_t force_update_flag_set_cmd(void *mctp_inst, uint8_t *buf, uint16_t len,
47+
uint8_t instance_id, uint8_t *resp, uint16_t *resp_len,
48+
void *ext_params)
49+
{
50+
CHECK_NULL_ARG_WITH_RETURN(mctp_inst, PLDM_ERROR);
51+
CHECK_NULL_ARG_WITH_RETURN(buf, PLDM_ERROR);
52+
CHECK_NULL_ARG_WITH_RETURN(resp, PLDM_ERROR);
53+
CHECK_NULL_ARG_WITH_RETURN(resp_len, PLDM_ERROR);
54+
CHECK_NULL_ARG_WITH_RETURN(ext_params, PLDM_ERROR);
55+
56+
uint8_t *completion_code_p = resp;
57+
58+
*completion_code_p = PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
59+
*resp_len = 1;
60+
61+
return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
62+
}
63+
64+
__weak uint8_t force_update_flag_get_cmd(void *mctp_inst, uint8_t *buf, uint16_t len,
65+
uint8_t instance_id, uint8_t *resp, uint16_t *resp_len,
66+
void *ext_params)
67+
{
68+
CHECK_NULL_ARG_WITH_RETURN(mctp_inst, PLDM_ERROR);
69+
CHECK_NULL_ARG_WITH_RETURN(buf, PLDM_ERROR);
70+
CHECK_NULL_ARG_WITH_RETURN(resp, PLDM_ERROR);
71+
CHECK_NULL_ARG_WITH_RETURN(resp_len, PLDM_ERROR);
72+
CHECK_NULL_ARG_WITH_RETURN(ext_params, PLDM_ERROR);
73+
74+
uint8_t *completion_code_p = resp;
75+
76+
*completion_code_p = PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
77+
*resp_len = 1;
78+
79+
return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
80+
}
81+
4682
__weak uint8_t sensor_polling_cmd(void *mctp_inst, uint8_t *buf, uint16_t len, uint8_t instance_id,
4783
uint8_t *resp, uint16_t *resp_len, void *ext_params)
4884
{
@@ -251,6 +287,8 @@ static pldm_cmd_handler pldm_oem_cmd_tbl[] = {
251287
#ifdef ENABLE_VISTARA
252288
{ PLDM_OEM_WF_READ_SPD_CHUNK, oem_wf_read_spd_chunk },
253289
#endif
290+
{ PLDM_OEM_FORCE_UPDATE_SETTING_CMD, force_update_flag_set_cmd },
291+
{ PLDM_OEM_FORCE_UPDATE_GETTING_CMD, force_update_flag_get_cmd },
254292
};
255293

256294
uint8_t pldm_oem_handler_query(uint8_t code, void **ret_fn)

common/service/pldm/pldm_oem.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ extern "C" {
3737
#define PLDM_OEM_READ_FILE_IO 0x03
3838
#define PLDM_OEM_SENSOR_POLLING_CMD 0x04
3939
#define PLDM_OEM_WF_READ_SPD_CHUNK 0x05
40+
#define PLDM_OEM_FORCE_UPDATE_SETTING_CMD 0x06
41+
#define PLDM_OEM_FORCE_UPDATE_GETTING_CMD 0x07
4042

4143
#define POWER_CONTROL_LEN 0x01
4244

@@ -286,6 +288,27 @@ struct _sensor_polling_cmd_resp {
286288
uint8_t set_value;
287289
} __attribute__((packed));
288290

291+
struct _force_update_flag_set_cmd_req {
292+
uint8_t iana[IANA_LEN];
293+
uint8_t set_value;
294+
} __attribute__((packed));
295+
296+
struct _force_update_flag_set_cmd_resp {
297+
uint8_t completion_code;
298+
uint8_t iana[IANA_LEN];
299+
uint8_t set_value;
300+
} __attribute__((packed));
301+
302+
struct _force_update_flag_get_cmd_req {
303+
uint8_t iana[IANA_LEN];
304+
} __attribute__((packed));
305+
306+
struct _force_update_flag_get_cmd_resp {
307+
uint8_t completion_code;
308+
uint8_t iana[IANA_LEN];
309+
uint8_t get_value;
310+
} __attribute__((packed));
311+
289312
uint8_t check_iana(const uint8_t *iana);
290313
uint8_t set_iana(uint8_t *buf, uint8_t buf_len);
291314
uint8_t send_event_log_to_bmc(struct pldm_addsel_data msg);

meta-facebook/minerva-ag/boards/npcm400f_evb.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ CONFIG_I2C_NPCM4XX=y
1515
CONFIG_I3C_NPCM4XX=y
1616
CONFIG_ADC_NPCM4XX=y
1717
CONFIG_USB_DC_NPCM4XX=y
18-
CONFIG_JTAG_NPCM4XX=y
18+
CONFIG_JTAG_NPCM4XX=y
19+
CONFIG_LOG_STRDUP_BUF_COUNT=16

0 commit comments

Comments
 (0)