feat(plat/imx8m): do not release JR0 to NS if HAB is using it

In case JR0 is used by the HAB for secure boot, it can be used later
for authenticating kernel or other binaries.

We are checking if the HAB is using the JR by the DID set.

Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Change-Id: I6e9595012262ffabfc3f3d4841f446f34e48e059
This commit is contained in:
Franck LENORMAND 2021-06-13 14:38:01 +02:00 committed by Manish Pandey
parent efceb6bead
commit 77850c96f2
1 changed files with 10 additions and 2 deletions

View File

@ -1,13 +1,16 @@
/*
* Copyright (c) 2019, NXP. All rights reserved.
* Copyright (c) 2019-2022 NXP. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <common/debug.h>
#include <lib/mmio.h>
#include <imx8m_caam.h>
#define HAB_JR0_DID U(0x8011)
void imx8m_caam_init(void)
{
uint32_t sm_cmd;
@ -20,7 +23,12 @@ void imx8m_caam_init(void)
mmio_write_32(SM_CMD, sm_cmd);
/* config CAAM JRaMID set MID to Cortex A */
mmio_write_32(CAAM_JR0MID, CAAM_NS_MID);
if (mmio_read_32(CAAM_JR0MID) == HAB_JR0_DID) {
NOTICE("Do not release JR0 to NS as it can be used by HAB");
} else {
mmio_write_32(CAAM_JR0MID, CAAM_NS_MID);
}
mmio_write_32(CAAM_JR1MID, CAAM_NS_MID);
mmio_write_32(CAAM_JR2MID, CAAM_NS_MID);