diff mbox series

[3/9] optee: Make OPTEE_TZDRAM_BASE a mandatory define

Message ID 1515768744-25246-4-git-send-email-bryan.odonoghue@linaro.org
State New
Headers show
Series Add new OPTEE bootm support to u-boot | expand

Commit Message

Bryan O'Donoghue Jan. 12, 2018, 2:52 p.m. UTC
This patch makes OTPEE_TZDRAM_BASE a mandatory parameter.
Subsequent patches will ensure that the region between
OTPEE_TZDRAM_BASE and (OTPEE_TZDRAM_BASE +
CONFIG_OPTEE_TZDRAM_SIZE) match the information given in the OPTEE header
before handing off control to the OPTEE image when booting OPTEE directly
via bootm.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
---
 lib/optee/optee.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Tom Rini Jan. 12, 2018, 4:23 p.m. UTC | #1
On Fri, Jan 12, 2018 at 02:52:18PM +0000, Bryan O'Donoghue wrote:

> This patch makes OTPEE_TZDRAM_BASE a mandatory parameter.

> Subsequent patches will ensure that the region between

> OTPEE_TZDRAM_BASE and (OTPEE_TZDRAM_BASE +

> CONFIG_OPTEE_TZDRAM_SIZE) match the information given in the OPTEE header

> before handing off control to the OPTEE image when booting OPTEE directly

> via bootm.

> 

> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

> Cc: Harinarayan Bhatta <harinarayan@ti.com>

> Cc: Andrew F. Davis <afd@ti.com>

> Cc: Tom Rini <trini@konsulko.com>

> Cc: Kever Yang <kever.yang@rock-chips.com>

> Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

> Cc: Peng Fan <peng.fan@nxp.com>

> ---

>  lib/optee/optee.c | 5 +++++

>  1 file changed, 5 insertions(+)

> 

> diff --git a/lib/optee/optee.c b/lib/optee/optee.c

> index a6c856a..6e55027 100644

> --- a/lib/optee/optee.c

> +++ b/lib/optee/optee.c

> @@ -5,9 +5,14 @@

>   * SPDX-License-Identifier:	GPL-2.0+

>   */

>  

> +#include <config.h>

>  #include <common.h>

>  #include <tee/optee.h>

>  

> +#ifndef OPTEE_TZDRAM_BASE

> +#error "OPTEE_TZDRAM_BASE not defined"

> +#endif

> +

>  int optee_verify_image(struct optee_header *hdr, unsigned long tzdram_start,

>  		       unsigned long tzdram_len, unsigned long image_len)

>  {


I'm not a fan of adding #error's like this.  Since this is a static
value,it should be in Kconfig (with appropriate depends) or defined in a
consistent location (asm/arch/optee.h ?) and it should be obvious from
the code that uses the value that you need to have this value be
provided and how to determine what the valid and correct value is.
Thanks!

-- 
Tom
diff mbox series

Patch

diff --git a/lib/optee/optee.c b/lib/optee/optee.c
index a6c856a..6e55027 100644
--- a/lib/optee/optee.c
+++ b/lib/optee/optee.c
@@ -5,9 +5,14 @@ 
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
+#include <config.h>
 #include <common.h>
 #include <tee/optee.h>
 
+#ifndef OPTEE_TZDRAM_BASE
+#error "OPTEE_TZDRAM_BASE not defined"
+#endif
+
 int optee_verify_image(struct optee_header *hdr, unsigned long tzdram_start,
 		       unsigned long tzdram_len, unsigned long image_len)
 {