Skip to content

Commit

Permalink
rcar-gen3: plat: BL2: Fix cache maintenance process of reading cert h…
Browse files Browse the repository at this point in the history
…eader

Move calling inv_dcache_range from before io_read to after that.

Signed-off-by: Hideyuki Nitta <[email protected]>
Signed-off-by: Toshiyuki Ogasahara <[email protected]>
Signed-off-by: Yoshifumi Hosoya <[email protected]>
  • Loading branch information
Toshiyuki-Ogasahara authored and takuya-sakata committed Jul 13, 2021
1 parent 3922864 commit d2c5696
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions drivers/renesas/common/io/io_rcar.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,15 +417,17 @@ static int32_t rcar_dev_init(io_dev_info_t *dev_info, const uintptr_t name)
WARN("Firmware Image Package header failed to seek\n");
goto error;
}
#if RCAR_BL2_DCACHE == 1
inv_dcache_range((uint64_t) header, sizeof(header));
#endif

rc = io_read(handle, (uintptr_t) &header, sizeof(header), &cnt);
if (rc != IO_SUCCESS) {
WARN("Firmware Image Package header failed to read\n");
goto error;
}

#if RCAR_BL2_DCACHE == 1
inv_dcache_range((uint64_t) header, sizeof(header));
#endif

rcar_image_number = header[0];
for (i = 0; i < rcar_image_number + 2; i++) {
rcar_image_header[i] = header[i * 2 + 1];
Expand All @@ -443,17 +445,19 @@ static int32_t rcar_dev_init(io_dev_info_t *dev_info, const uintptr_t name)
WARN("Firmware Image Package header failed to seek cert\n");
goto error;
}
#if RCAR_BL2_DCACHE == 1
inv_dcache_range(RCAR_SDRAM_certESS,
RCAR_CERT_SIZE * (2 + rcar_image_number));
#endif

rc = io_read(handle, RCAR_SDRAM_certESS,
RCAR_CERT_SIZE * (2 + rcar_image_number), &cnt);
if (rc != IO_SUCCESS) {
WARN("cert file read error.\n");
goto error;
}

#if RCAR_BL2_DCACHE == 1
inv_dcache_range(RCAR_SDRAM_certESS,
RCAR_CERT_SIZE * (2 + rcar_image_number));
#endif

rcar_cert_load = RCAR_CERT_LOAD;
error:

Expand Down

0 comments on commit d2c5696

Please sign in to comment.