diff mbox series

[1/2] arm: mach-k3: add support for detecting TIFSSTUB images

Message ID 20240403120309.4026170-2-d-gole@ti.com
State Accepted
Commit 4a0067c8575c7c3b98f3fc0a689f53dc80700393
Delegated to: Tom Rini
Headers show
Series Add TIFS Stub support in AM62x | expand

Commit Message

Dhruva Gole April 3, 2024, 12:03 p.m. UTC
From: Kamlesh Gurudasani <kamlesh@ti.com>

Add support for detecting and processing TIFSSTUB images for HS, HSFS
and GP devices.

TIFSSTUB image for related device type will be loaded, rest TIFSSTUB
images will be discarded.

Example, for GP device, tifsstub-gp will be loaded, tifsstub-hs and
tifsstub-fs will be discarded.

Signed-off-by: Kamlesh Gurudasani <kamlesh@ti.com>
Signed-off-by: Dhruva Gole <d-gole@ti.com>
---
 arch/arm/mach-k3/r5/common.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

Comments

Neha Malcom Francis April 4, 2024, 4:24 a.m. UTC | #1
Hi Dhruva,

On 03/04/24 17:33, Dhruva Gole wrote:
> From: Kamlesh Gurudasani <kamlesh@ti.com>
> 
> Add support for detecting and processing TIFSSTUB images for HS, HSFS
> and GP devices.
> 
> TIFSSTUB image for related device type will be loaded, rest TIFSSTUB
> images will be discarded.
> 
> Example, for GP device, tifsstub-gp will be loaded, tifsstub-hs and
> tifsstub-fs will be discarded.
> 
> Signed-off-by: Kamlesh Gurudasani <kamlesh@ti.com>
> Signed-off-by: Dhruva Gole <d-gole@ti.com>
> ---
>   arch/arm/mach-k3/r5/common.c | 24 ++++++++++++++++++++++++
>   1 file changed, 24 insertions(+)
> 
> diff --git a/arch/arm/mach-k3/r5/common.c b/arch/arm/mach-k3/r5/common.c
> index c02f8d330998..0f6c294f1eb2 100644
> --- a/arch/arm/mach-k3/r5/common.c
> +++ b/arch/arm/mach-k3/r5/common.c
> @@ -24,6 +24,9 @@ enum {
>   	IMAGE_ID_OPTEE,
>   	IMAGE_ID_SPL,
>   	IMAGE_ID_DM_FW,
> +	IMAGE_ID_TIFSSTUB_HS,
> +	IMAGE_ID_TIFSSTUB_FS,
> +	IMAGE_ID_T,
>   	IMAGE_AMT,
>   };
>   
> @@ -33,6 +36,9 @@ static const char *image_os_match[IMAGE_AMT] = {
>   	"tee",
>   	"U-Boot",
>   	"DM",
> +	"tifsstub-hs",
> +	"tifsstub-fs",
> +	"tifsstub-gp",
>   };
>   #endif
>   
> @@ -314,6 +320,24 @@ void board_fit_image_post_process(const void *fit, int node, void **p_image,
>   			break;
>   		}
>   	}
> +
> +	if (i < IMAGE_AMT && i > IMAGE_ID_DM_FW) {
> +		int device_type = get_device_type();
> +
> +		if ((device_type == K3_DEVICE_TYPE_HS_SE &&
> +		     strcmp(os, "tifsstub-hs")) ||
> +		   (device_type == K3_DEVICE_TYPE_HS_FS &&
> +		     strcmp(os, "tifsstub-fs")) ||
> +		   (device_type == K3_DEVICE_TYPE_GP &&
> +		     strcmp(os, "tifsstub-gp"))) {
> +			*p_size = 0;
> +		} else {
> +			debug("tifsstub-type: %s\n", os);
> +		}
> +
> +		return;
> +	}
> +
>   	/*
>   	 * Only DM and the DTBs are being authenticated here,
>   	 * rest will be authenticated when A72 cluster is up

Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
diff mbox series

Patch

diff --git a/arch/arm/mach-k3/r5/common.c b/arch/arm/mach-k3/r5/common.c
index c02f8d330998..0f6c294f1eb2 100644
--- a/arch/arm/mach-k3/r5/common.c
+++ b/arch/arm/mach-k3/r5/common.c
@@ -24,6 +24,9 @@  enum {
 	IMAGE_ID_OPTEE,
 	IMAGE_ID_SPL,
 	IMAGE_ID_DM_FW,
+	IMAGE_ID_TIFSSTUB_HS,
+	IMAGE_ID_TIFSSTUB_FS,
+	IMAGE_ID_T,
 	IMAGE_AMT,
 };
 
@@ -33,6 +36,9 @@  static const char *image_os_match[IMAGE_AMT] = {
 	"tee",
 	"U-Boot",
 	"DM",
+	"tifsstub-hs",
+	"tifsstub-fs",
+	"tifsstub-gp",
 };
 #endif
 
@@ -314,6 +320,24 @@  void board_fit_image_post_process(const void *fit, int node, void **p_image,
 			break;
 		}
 	}
+
+	if (i < IMAGE_AMT && i > IMAGE_ID_DM_FW) {
+		int device_type = get_device_type();
+
+		if ((device_type == K3_DEVICE_TYPE_HS_SE &&
+		     strcmp(os, "tifsstub-hs")) ||
+		   (device_type == K3_DEVICE_TYPE_HS_FS &&
+		     strcmp(os, "tifsstub-fs")) ||
+		   (device_type == K3_DEVICE_TYPE_GP &&
+		     strcmp(os, "tifsstub-gp"))) {
+			*p_size = 0;
+		} else {
+			debug("tifsstub-type: %s\n", os);
+		}
+
+		return;
+	}
+
 	/*
 	 * Only DM and the DTBs are being authenticated here,
 	 * rest will be authenticated when A72 cluster is up