Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 8e30804

Browse files
zhouji3xbuildslave
authored andcommitted
[heci] fix fw update fail issue
changes: 1) issue heci reset before send heci user command 2) zero uninitialized variables Change-Id: I955aeec77e994a3c65a01fde5446133ade619830 Tracked-On: https://jira01.devtools.intel.com/browse/OAM-67703 Signed-off-by: zhouji3x <[email protected]> Reviewed-on: https://android.intel.com:443/642296
1 parent 9dcc52b commit 8e30804

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

drivers/abl/capsule_msg.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ static EFI_STATUS cse4sbl_capsule_msg_write(CSE_MSG *msg)
184184
if (!msg_buf)
185185
return EFI_OUT_OF_RESOURCES;
186186

187+
memset(msg_buf, 0, CSE_USRCMD_SIZE);
187188
memcpy(msg_buf, (uint8_t *)msg, sizeof(CSE_MSG));
188189

189190
status = heci_send_user_command(msg_buf, CSE_USRCMD_SIZE);
@@ -228,6 +229,7 @@ static EFI_STATUS cse4sbl_capsule_cmd_create(CSE_CMD **cmd, size_t *cmd_size, co
228229
if (!(*cmd))
229230
return EFI_OUT_OF_RESOURCES;
230231

232+
memset(*cmd, 0, sizeof(CSE_CMD));
231233
(*cmd)->dev_addr = boot_dev->diskbus;
232234
(*cmd)->dev_type = device_map[boot_dev->type];
233235
if (buf[0] == 'm')
@@ -254,6 +256,7 @@ static EFI_STATUS cse4sbl_capsule_msg_create(CSE_MSG **msg, CSE_CMD *cmd, __attr
254256
if (!(*msg))
255257
return EFI_OUT_OF_RESOURCES;
256258

259+
memset(*msg, 0, sizeof(CSE_MSG));
257260
cdata_blob_t *cdb = &(*msg)->cdb;
258261
cdb->Signature = CFG_DATA_SIGNATURE;
259262
cdb->HeaderLength = sizeof(cdata_blob_t);
@@ -323,6 +326,7 @@ static EFI_STATUS cse4abl_capsule_cmd_create(CSE_CMD **cmd, size_t *cmd_size, co
323326
if (!(*cmd))
324327
return EFI_OUT_OF_RESOURCES;
325328

329+
memset(*cmd, 0, *cmd_size);
326330
(*cmd)->action = USERCMD_UPDATE_IFWI(name_len + 2);
327331
(*cmd)->device = device;
328332
(*cmd)->partition = partition;
@@ -342,6 +346,7 @@ static EFI_STATUS cse4abl_capsule_msg_create(CSE_MSG **msg, CSE_CMD *cmd, size_t
342346
if (!(*msg))
343347
return EFI_OUT_OF_RESOURCES;
344348

349+
memset(*msg, 0, sizeof(CSE_MSG));
345350
(*msg)->magic = NVRAM_VALID_FLAG;
346351
(*msg)->size = offsetof(CSE_MSG, cdata_payload) + cmd_size + sizeof((*msg)->crc);
347352
(*msg)->cdata_header.data = cdh.data;

drivers/heci/heci.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ static int heci_send_impl(uint32_t u32HeciBase, uint32_t *Message, uint32_t Leng
250250
ewdbg("heci Message Header: %08x\n", head.data);
251251
heci_reg_write(u32HeciBase, H_CB_WW, head.data);
252252
for (Index = 0; Index < Size; Index++) {
253-
ewdbg("heci data[%x] = %08x\n", Index, Message[Index + WriteSize]);
254253
heci_reg_write(u32HeciBase, H_CB_WW, Message[Index + WriteSize]);
255254
}
256255

@@ -465,6 +464,8 @@ static EFI_STATUS EFIAPI HeciSendwACK(
465464
if (u32HeciBase == 0)
466465
return EFI_DEVICE_ERROR;
467466

467+
heci_reset_interface();
468+
468469
/* Send the message */
469470
status = heci_send_impl(u32HeciBase, Message, Length, HostAddress, SECAddress);
470471
if (status)

0 commit comments

Comments
 (0)