aspeed: Support secure boot chain with FIT image verification
Subsystems (7)
v6 cover aspeed: Support secure boot chain with FIT image verification
This patch series intends to provide a secure boot chain from SPL to Linux kernel based on the hash and signature verification of FIT image paradigm.
To improve the performance and save code size (SPL is limited to 64KB due to HW-RoT), the drviers of two HW crypto engine HACE and ACRY are also added for AST26xx SoCs.
As HACE and ACRY can only access to DRAM space, additional configuration and boot command are also updated according to move each FIT image before its booting.
In addition, the common code of FIT image hash algorithm lookup is also revised to leverage the HW accelerated calculation.
v6:
- fix parameter comment for v5 update
v5:
- fix inconsistent parameter name due to parallel patch work
v4:
- add new DM_HASH based driver for Aspeed HACE
- remove SPL board init, which was originally used to probe non-DM HACE driver
- fix typo of ARCY to ACRY
- refactor defconfig based on the new Kconfig of U-Boot next branch
v3:
- add SW work around for HACE HW DMA issue by resetting HACE
- add reset control for HACE device tree node
- sync all of the HACE error message to use debug()
v2:
- update commit authors
Chia-Wei Wang (9):
image: fit: Fix parameter name for hash algorithm
aspeed: ast2600: Enlarge SRAM size
clk: ast2600: Add RSACLK control for ACRY
crypto: aspeed: Add AST2600 ACRY support
ARM: dts: ast2600: Add ACRY to device tree
ast2600: spl: Locate load buffer in DRAM space
configs: ast2600-evb: Enable SPL FIT support
configs: aspeed: Make EXTRA_ENV_SETTINGS board specific
configs: ast2600: Boot kernel FIT in DRAM
Joel Stanley (2):
clk: ast2600: Add YCLK control for HACE
ARM: dts: ast2600: Add HACE to device tree
Johnny Huang (1):
crypto: aspeed: Add AST2600 HACE support
arch/arm/dts/ast2600-evb.dts | 10 + arch/arm/dts/ast2600.dtsi | 17 + arch/arm/include/asm/arch-aspeed/platform.h | 2 +- .../arm/include/asm/arch-aspeed/scu_ast2600.h | 6 +- arch/arm/mach-aspeed/ast2600/spl.c | 9 +- common/image-fit.c | 4 +- configs/evb-ast2600_defconfig | 22 +- drivers/clk/aspeed/clk_ast2600.c | 38 ++ drivers/crypto/Kconfig | 2 + drivers/crypto/Makefile | 1 + drivers/crypto/aspeed/Kconfig | 20 + drivers/crypto/aspeed/Makefile | 2 + drivers/crypto/aspeed/aspeed_acry.c | 182 +++++++++ drivers/crypto/aspeed/aspeed_hace.c | 381 ++++++++++++++++++ drivers/crypto/hash/Kconfig | 8 + include/configs/aspeed-common.h | 9 - include/configs/evb_ast2500.h | 9 + include/configs/evb_ast2600.h | 16 + lib/rsa/Kconfig | 10 +- 19 files changed, 721 insertions(+), 27 deletions(-) create mode 100644 drivers/crypto/aspeed/Kconfig create mode 100644 drivers/crypto/aspeed/Makefile create mode 100644 drivers/crypto/aspeed/aspeed_acry.c create mode 100644 drivers/crypto/aspeed/aspeed_hace.c
Signature · 1 line
2.17.1
PATCH v6 1/12 image: fit: Fix parameter name for hash algorithm
Fix inconsistent parameter naming of the hash algorithm.
--- common/image-fit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
common/image-fit.c +2 -2
@@ -1201,7 +1201,7 @@ int fit_set_timestamp(void *fit, int noffset, time_t timestamp)* calculate_hash - calculate and return hash for provided input data * @data: pointer to the input data * @data_len: data length -* @algo: requested hash algorithm +* @name: requested hash algorithm name * @value: pointer to the char, will hold hash value data (caller must * allocate enough free space) * value_len: length of the calculated hash
@@ -1229,7 +1229,7 @@ int calculate_hash(const void *data, int data_len, const char *name,return -1 ; } - hash_algo =hash_algo_lookup_by_name (algo); + hash_algo =hash_algo_lookup_by_name (name);if (hash_algo ==HASH_ALGO_INVALID ) {debug ("Unsupported hash algorithm\n" );return -1 ;
Signature · 1 line
2.17.1
PATCH v6 2/12 aspeed: ast2600: Enlarge SRAM size
In reply to Chia-Wei WangThe AST2600 SRAM has been extended to 88KB since A1 chip revision. This patch updates the SRAM size to offer more space for early stack/heap use.
--- arch/arm/include/asm/arch-aspeed/platform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/arch-aspeed/platform.h +1 -1
@@ -17,7 +17,7 @@#define ASPEED_MAC_COUNT 4#define ASPEED_DRAM_BASE 0x80000000#define ASPEED_SRAM_BASE 0x10000000 -#define ASPEED_SRAM_SIZE 0x10000 +#define ASPEED_SRAM_SIZE 0x16000#else #err "Unrecognized Aspeed platform."#endif
Signature · 1 line
2.17.1
PATCH v6 3/12 clk: ast2600: Add YCLK control for HACE
In reply to Chia-Wei WangFrom: Joel Stanley <[email protected]>
Add YCLK enable for HACE, the HW hash engine of
ASPEED AST2600 SoCs.
--- .../arm/include/asm/arch-aspeed/scu_ast2600.h | 5 +++-- drivers/clk/aspeed/clk_ast2600.c | 20 +++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-aspeed/scu_ast2600.h +3 -2
@@ -10,8 +10,9 @@#define SCU_CLKGATE1_EMMC BIT(27)#define SCU_CLKGATE1_MAC2 BIT(21)#define SCU_CLKGATE1_MAC1 BIT(20) -#define SCU_CLKGATE1_USB_HUB BIT(14) -#define SCU_CLKGATE1_USB_HOST2 BIT(7) +#define SCU_CLKGATE1_USB_HUB BIT(14) +#define SCU_CLKGATE1_HACE BIT(13) +#define SCU_CLKGATE1_USB_HOST2 BIT(7)#define SCU_CLKGATE2_FSI BIT(30)#define SCU_CLKGATE2_MAC4 BIT(21)
drivers/clk/aspeed/clk_ast2600.c +20 -0
@@ -1013,6 +1013,23 @@ static ulong ast2600_enable_usbbhclk(struct ast2600_scu *scu)return 0 ; } +static ulong ast2600_enable_haceclk (struct ast2600_scu *scu) +{ +uint32_t reset_bit; +uint32_t clkgate_bit; + + reset_bit =BIT (ASPEED_RESET_HACE ); + clkgate_bit =SCU_CLKGATE1_HACE ; + +writel (reset_bit, &scu->modrst_ctrl1); +udelay (100 ); +writel (clkgate_bit, &scu->clkgate_clr1); +mdelay (20 ); +writel (reset_bit, &scu->modrst_clr1); + +return 0 ; +} +static int ast2600_clk_enable (struct clk *clk) {struct ast2600_clk_priv *priv =dev_get_priv (clk->dev);
@@ -1051,6 +1068,9 @@ static int ast2600_clk_enable(struct clk *clk)case ASPEED_CLK_GATE_USBPORT2CLK :ast2600_enable_usbbhclk (priv->scu);break ; +case ASPEED_CLK_GATE_YCLK : +ast2600_enable_haceclk (priv->scu); +break ;default :pr_err ("can't enable clk\n" );return -ENOENT ;
Signature · 1 line
2.17.1
PATCH v6 4/12 crypto: aspeed: Add AST2600 HACE support
In reply to Chia-Wei WangFrom: Johnny Huang <[email protected]>
Hash and Crypto Engine (HACE) is designed to accelerate the throughput of hash data digest, and symmetric-key encryption.
--- drivers/crypto/Kconfig | 2 + drivers/crypto/Makefile | 1 + drivers/crypto/aspeed/Kconfig | 10 + drivers/crypto/aspeed/Makefile | 1 + drivers/crypto/aspeed/aspeed_hace.c | 381 ++++++++++++++++++++++++++++ drivers/crypto/hash/Kconfig | 8 + 6 files changed, 403 insertions(+) create mode 100644 drivers/crypto/aspeed/Kconfig create mode 100644 drivers/crypto/aspeed/Makefile create mode 100644 drivers/crypto/aspeed/aspeed_hace.c
drivers/crypto/Kconfig +2 -0
@@ -4,4 +4,6 @@ source drivers/crypto/hash/Kconfig source drivers/crypto/fsl/Kconfig +source drivers/crypto/aspeed/Kconfig + endmenu
drivers/crypto/Makefile +1 -0
@@ -7,3 +7,4 @@ obj-$(CONFIG_EXYNOS_ACE_SHA) += ace_sha.o obj-y += rsa_mod_exp/ obj-y += fsl/ obj-y += hash/ +obj-y += aspeed/
drivers/crypto/aspeed/Kconfig new file +10 -0
@@ -0,0 +1,10 @@ +config ASPEED_HACE + bool "ASPEED Hash and Crypto Engine" + depends on DM_HASH + help + Select this option to enable a driver for using the SHA engine in + the ASPEED BMC SoCs. + + Enabling this allows the use of SHA operations in hardware without + requiring the SHA software implementations. It also improves performance + and saves code size.
drivers/crypto/aspeed/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_ASPEED_HACE) += aspeed_hace.o
drivers/crypto/aspeed/aspeed_hace.c new file +381 -0
381 lines not on this page · raw message
drivers/crypto/hash/Kconfig +8 -0
@@ -14,3 +14,11 @@ config HASH_SOFTWARE help Enable driver for hashing operations in software. Currently it support multiple hash algorithm including CRC/MD5/SHA. + +config HASH_ASPEED + bool "Enable Hash with ASPEED hash accelerator" + depends on DM_HASH + select ASPEED_HACE + help + Enable this to support HW-assisted hashing operations using ASPEED Hash + and Crypto engine - HACE
Signature · 1 line
2.17.1
PATCH v6 5/12 ARM: dts: ast2600: Add HACE to device tree
In reply to Chia-Wei WangFrom: Joel Stanley <[email protected]>
Add HACE DTS node and enable it for AST2600 EVB.
--- arch/arm/dts/ast2600-evb.dts | 5 +++++ arch/arm/dts/ast2600.dtsi | 8 ++++++++ 2 files changed, 13 insertions(+)
arch/arm/dts/ast2600-evb.dts +5 -0
@@ -177,3 +177,8 @@ 0x08 0x04 0x08 0x04>; }; + +&hace { + u-boot,dm-pre-reloc; + status = "okay"; +};
arch/arm/dts/ast2600.dtsi +8 -0
@@ -187,6 +187,14 @@ }; }; + hace: hace@1e6d0000 { + compatible = "aspeed,ast2600-hace"; + reg = <0x1e6d0000 0x200>; + interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&scu ASPEED_CLK_GATE_YCLK>; + status = "disabled"; + }; + edac: sdram@1e6e0000 { compatible = "aspeed,ast2600-sdram-edac"; reg = <0x1e6e0000 0x174>;
Signature · 1 line
2.17.1
PATCH v6 6/12 clk: ast2600: Add RSACLK control for ACRY
In reply to Chia-Wei WangAdd RSACLK enable for ACRY, the HW RSA/ECC crypto engine of ASPEED AST2600 SoCs.
As ACRY and HACE share the same reset control bit, we do not perform the reset-hold-n-release operation during their clock ungating process. Instead, only reset release is conducted to prevent mutual interference.
--- .../arm/include/asm/arch-aspeed/scu_ast2600.h | 1 + drivers/clk/aspeed/clk_ast2600.c | 22 +++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-aspeed/scu_ast2600.h +1 -0
@@ -8,6 +8,7 @@#define SCU_UNLOCK_KEY 0x1688a8a8#define SCU_CLKGATE1_EMMC BIT(27) +#define SCU_CLKGATE1_ACRY BIT(24)#define SCU_CLKGATE1_MAC2 BIT(21)#define SCU_CLKGATE1_MAC1 BIT(20)#define SCU_CLKGATE1_USB_HUB BIT(14)
drivers/clk/aspeed/clk_ast2600.c +20 -2
@@ -1018,11 +1018,26 @@ static ulong ast2600_enable_haceclk(struct ast2600_scu *scu)uint32_t reset_bit;uint32_t clkgate_bit; +/* share the same reset control bit with ACRY */ reset_bit =BIT (ASPEED_RESET_HACE ); clkgate_bit =SCU_CLKGATE1_HACE ; -writel (reset_bit, &scu->modrst_ctrl1); -udelay (100 ); +writel (clkgate_bit, &scu->clkgate_clr1); +mdelay (20 ); +writel (reset_bit, &scu->modrst_clr1); + +return 0 ; +} + +static ulong ast2600_enable_rsaclk (struct ast2600_scu *scu) +{ +uint32_t reset_bit; +uint32_t clkgate_bit; + +/* share the same reset control bit with HACE */ + reset_bit =BIT (ASPEED_RESET_HACE ); + clkgate_bit =SCU_CLKGATE1_ACRY ; +writel (clkgate_bit, &scu->clkgate_clr1);mdelay (20 );writel (reset_bit, &scu->modrst_clr1);
@@ -1071,6 +1086,9 @@ static int ast2600_clk_enable(struct clk *clk)case ASPEED_CLK_GATE_YCLK :ast2600_enable_haceclk (priv->scu);break ; +case ASPEED_CLK_GATE_RSACLK : +ast2600_enable_rsaclk (priv->scu); +break ;default :pr_err ("can't enable clk\n" );return -ENOENT ;
Signature · 1 line
2.17.1
PATCH v6 7/12 crypto: aspeed: Add AST2600 ACRY support
In reply to Chia-Wei WangACRY is deisnged to accerlerate ECC/RSA digital signature generation and verification.
--- drivers/crypto/aspeed/Kconfig | 10 ++ drivers/crypto/aspeed/Makefile | 1 + drivers/crypto/aspeed/aspeed_acry.c | 182 ++++++++++++++++++++++++++++ lib/rsa/Kconfig | 10 +- 4 files changed, 202 insertions(+), 1 deletion(-) create mode 100644 drivers/crypto/aspeed/aspeed_acry.c
drivers/crypto/aspeed/Kconfig +10 -0
@@ -8,3 +8,13 @@ config ASPEED_HACE Enabling this allows the use of SHA operations in hardware without requiring the SHA software implementations. It also improves performance and saves code size. + +config ASPEED_ACRY + bool "ASPEED RSA and ECC Engine" + depends on ASPEED_AST2600 + help + Select this option to enable a driver for using the RSA/ECC engine in + the ASPEED BMC SoCs. + + Enabling this allows the use of RSA/ECC operations in hardware without requiring the + software implementations. It also improves performance and saves code size.
drivers/crypto/aspeed/Makefile +1 -0
@@ -1 +1,2 @@ obj-$(CONFIG_ASPEED_HACE) += aspeed_hace.o +obj-$(CONFIG_ASPEED_ACRY) += aspeed_acry.o
drivers/crypto/aspeed/aspeed_acry.c new file +182 -0
182 lines not on this page · raw message
lib/rsa/Kconfig +9 -1
@@ -1,7 +1,8 @@ config RSA bool "Use RSA Library" select RSA_FREESCALE_EXP if FSL_CAAM && !ARCH_MX7 && !ARCH_MX6 && !ARCH_MX5 - select RSA_SOFTWARE_EXP if !RSA_FREESCALE_EXP + select RSA_ASPEED_EXP if ASPEED_ACRY + select RSA_SOFTWARE_EXP if !RSA_FREESCALE_EXP && !RSA_ASPEED_EXP help RSA support. This enables the RSA algorithm used for FIT image verification in U-Boot.
@@ -61,4 +62,11 @@ config RSA_FREESCALE_EXP Enables driver for RSA modular exponentiation using Freescale cryptographic accelerator - CAAM. +config RSA_ASPEED_EXP + bool "Enable RSA Modular Exponentiation with ASPEED crypto accelerator" + depends on DM && ASPEED_ACRY + help + Enables driver for RSA modular exponentiation using ASPEED cryptographic + accelerator - ACRY + endif
Signature · 1 line
2.17.1
RE: [PATCH next v6 07/12] crypto: aspeed: Add AST2600 ACRY support
Quoted 152 lines
From: U-Boot <[email protected]> On Behalf Of Chia-Wei Wang
Sent: Friday, October 15, 2021 10:04 AMACRY is deisnged to accerlerate ECC/RSA digital signature generation and verification.
Signed-off-by Chia-Wei Wang <[email protected]>--- drivers/crypto/aspeed/Kconfig | 10 ++ drivers/crypto/aspeed/Makefile | 1 + drivers/crypto/aspeed/aspeed_acry.c | 182 ++++++++++++++++++++++++++++ lib/rsa/Kconfig | 10 +- 4 files changed, 202 insertions(+), 1 deletion(-) create mode 100644
drivers/crypto/aspeed/aspeed_acry.cdrivers/crypto/aspeed/Kconfig +0
-0@@ -8,3 +8,13 @@ config ASPEED_HACE Enabling this allows the use of SHA operations in hardware without requiring the SHA software implementations. It also improvesperformance
drivers/crypto/aspeed/Kconfig +9
-0and saves code size. + +config ASPEED_ACRY + bool "ASPEED RSA and ECC Engine" + depends on ASPEED_AST2600 + help + Select this option to enable a driver for using the RSA/ECC engine in + the ASPEED BMC SoCs. + + Enabling this allows the use of RSA/ECC operations in hardware withoutrequiring the
drivers/crypto/aspeed/Kconfig +1
-0+ software implementations. It also improves performance and saves codesize.
drivers/crypto/aspeed/Makefile +1
-0@@ -1 +1,2 @@ obj-$(CONFIG_ASPEED_HACE) += aspeed_hace.o +obj-$(CONFIG_ASPEED_ACRY) += aspeed_acry.odrivers/crypto/aspeed/aspeed_acry.c new file +52
-0@@ -0,0 +1,182 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright 2021 ASPEED Technology Inc. +*/ +#include <config.h> +#include <common.h> +#include <clk.h> +#include <dm.h> +#include <asm/types.h> +#include <asm/io.h> +#include <dm/device.h> +#include <dm/fdtaddr.h> +#include <linux/delay.h> +#include <u-boot/rsa-mod-exp.h> + +/* ACRY register offsets */ +#define ACRY_CTRL1 0x00 +#define ACRY_CTRL1_RSA_DMA BIT(1) +#define ACRY_CTRL1_RSA_START BIT(0) +#define ACRY_CTRL2 0x44 +#define ACRY_CTRL3 0x48 +#define ACRY_CTRL3_SRAM_AHB_ACCESS BIT(8) +#define ACRY_CTRL3_ECC_RSA_MODE_MASK GENMASK(5, 4) +#define ACRY_CTRL3_ECC_RSA_MODE_SHIFT 4 +#define ACRY_DMA_DRAM_SADDR 0x4c +#define ACRY_DMA_DMEM_TADDR 0x50 +#define ACRY_DMA_DMEM_TADDR_LEN_MASK GENMASK(15, 0) +#define ACRY_DMA_DMEM_TADDR_LEN_SHIFT 0 +#define ACRY_RSA_PARAM 0x58 +#define ACRY_RSA_PARAM_EXP_MASK GENMASK(31, 16) +#define ACRY_RSA_PARAM_EXP_SHIFT 16 +#define ACRY_RSA_PARAM_MOD_MASK GENMASK(15, 0) +#define ACRY_RSA_PARAM_MOD_SHIFT 0 +#define ACRY_RSA_INT_EN 0x3f8 +#define ACRY_RSA_INT_EN_RSA_READY BIT(2) +#define ACRY_RSA_INT_EN_RSA_CMPLT BIT(1) +#define ACRY_RSA_INT_STS 0x3fc +#define ACRY_RSA_INT_STS_RSA_READY BIT(2) +#define ACRY_RSA_INT_STS_RSA_CMPLT BIT(1) + +/* misc. constant */ +#define ACRY_ECC_MODE 2 +#define ACRY_RSA_MODE 3 +#define ACRY_CTX_BUFSZ 0x600 + +struct aspeed_acry { +phys_addr_t base; +phys_addr_t sram_base;/* internal sram */ +struct clk clk; +}; + +static int aspeed_acry_mod_exp(struct udevice *dev, const uint8_t *sig,
uint32_tsig_len,drivers/crypto/aspeed/aspeed_acry.c new file +37
-0+ struct key_prop *prop, uint8_t *out) { + int i, j; +u8 *ctx; +u8 *ptr; +u32 reg; +struct aspeed_acry *acry =dev_get_priv (dev); + + ctx =memalign (16 ,ACRY_CTX_BUFSZ ); +if (!ctx) +return -ENOMEM ; + +memset (ctx,0 ,ACRY_CTX_BUFSZ ); + + ptr = (u8 *)prop->public_exponent; +for (i = prop->exp_len -1 , j =0 ; i >=0 ; --i) { + ctx[j] = ptr[i]; + j++; + j = (j %16 ) ? j : j +32 ; + } + + ptr = (u8 *)prop->modulus; +for (i = (prop->num_bits >>3 ) -1 , j =0 ; i >=0 ; --i) { + ctx[j +16 ] = ptr[i]; + j++; + j = (j %16 ) ? j : j +32 ; + } + + ptr = (u8 *)sig; +for (i = sig_len -1 , j =0 ; i >=0 ; --i) { + ctx[j +32 ] = ptr[i]; + j++; + j = (j %16 ) ? j : j +32 ; + } + +writel ((u32 )ctx, acry->base +ACRY_DMA_DRAM_SADDR ); + + reg = (((prop->exp_len << 3) << ACRY_RSA_PARAM_EXP_SHIFT) &
ACRY_RSA_PARAM_EXP_MASK) |drivers/crypto/aspeed/aspeed_acry.c new file +1
-0+ ((prop->num_bits << ACRY_RSA_PARAM_MOD_SHIFT) &
ACRY_RSA_PARAM_MOD_MASK);drivers/crypto/aspeed/aspeed_acry.c new file +3
-0+writel (reg, acry->base +ACRY_RSA_PARAM ); + + reg = (ACRY_CTX_BUFSZ << ACRY_DMA_DMEM_TADDR_LEN_SHIFT) &
ACRY_DMA_DMEM_TADDR_LEN_MASK;drivers/crypto/aspeed/aspeed_acry.c new file +3
-0+writel (reg, acry->base +ACRY_DMA_DMEM_TADDR ); + + reg = (ACRY_RSA_MODE << ACRY_CTRL3_ECC_RSA_MODE_SHIFT) &
ACRY_CTRL3_ECC_RSA_MODE_MASK;
drivers/crypto/aspeed/aspeed_acry.c line 106
Quoted 10 lines
drivers/crypto/aspeed/aspeed_acry.c new file +10
-0+writel (reg, acry->base +ACRY_CTRL3 ); + +writel (ACRY_CTRL1_RSA_DMA |ACRY_CTRL1_RSA_START , acry->base + +ACRY_CTRL1 ); + +/* polling RSA status */ +while (1 ) { + reg =readl (acry->base +ACRY_RSA_INT_STS ); +if ((reg &ACRY_RSA_INT_STS_RSA_READY ) && (reg &ACRY_RSA_INT_STS_RSA_CMPLT )) +break ;
Interrupt status clear is missed here.
Will prepare v7 patch to fix this.
Regards,
Chiawei
PATCH v6 8/12 ARM: dts: ast2600: Add ACRY to device tree
In reply to Chia-Wei WangAdd ACRY DTS node and enable it for AST2600 EVB.
--- arch/arm/dts/ast2600-evb.dts | 5 +++++ arch/arm/dts/ast2600.dtsi | 9 +++++++++ 2 files changed, 14 insertions(+)
arch/arm/dts/ast2600-evb.dts +5 -0
@@ -182,3 +182,8 @@ u-boot,dm-pre-reloc; status = "okay"; }; + +&acry { + u-boot,dm-pre-reloc; + status = "okay"; +};
arch/arm/dts/ast2600.dtsi +9 -0
@@ -195,6 +195,15 @@ status = "disabled"; }; + acry: acry@1e6fa000 { + compatible = "aspeed,ast2600-acry"; + reg = <0x1e6fa000 0x1000>, + <0x1e710000 0x10000>; + interrupts = <GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&scu ASPEED_CLK_GATE_RSACLK>; + status = "disabled"; + }; + edac: sdram@1e6e0000 { compatible = "aspeed,ast2600-sdram-edac"; reg = <0x1e6e0000 0x174>;
Signature · 1 line
2.17.1
PATCH v6 9/12 ast2600: spl: Locate load buffer in DRAM space
In reply to Chia-Wei WangReturn CONFIG_SYS_LOAD_ADDR pointing to DRAM space for spl_get_load_buffer() to allow generic SPL image loading code (e.g. FIT and Ymodem) to store data in DRAM.
--- arch/arm/mach-aspeed/ast2600/spl.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
arch/arm/mach-aspeed/ast2600/spl.c +1 -8
@@ -28,14 +28,7 @@ u32 spl_boot_device(void)struct image_header *spl_get_load_buffer (ssize_t offset,size_t size) { -/* -* When boot from SPI, AST2600 already remap 0x00000000 ~ 0x0fffffff -* to BMC SPI memory space 0x20000000 ~ 0x2fffffff. The next stage BL -* has been located in SPI for XIP. In this case, the load buffer for -* SPL image loading will be set to the remapped address of the next -* BL instead of the DRAM space CONFIG_SYS_LOAD_ADDR -*/ -return (struct image_header *)(CONFIG_SYS_TEXT_BASE ); +return (struct image_header *)(CONFIG_SYS_LOAD_ADDR ); }#ifdef CONFIG_SPL_OS_BOOT
Signature · 1 line
2.17.1
PATCH v6 10/12 configs: ast2600-evb: Enable SPL FIT support
In reply to Chia-Wei WangEnable SPL FIT image load and verification support. The HW accelerated SHA is also available with the newly added support of the HACE HW hash engine.
The SPL thumb build is also enabled to keep the binary less than 64KB to fit into the Aspeed secure boot design.
--- configs/evb-ast2600_defconfig | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
configs/evb-ast2600_defconfig +17 -3
@@ -1,7 +1,8 @@ CONFIG_ARM=y CONFIG_SYS_DCACHE_OFF=y +CONFIG_SPL_SYS_THUMB_BUILD=y CONFIG_ARCH_ASPEED=y -CONFIG_SYS_TEXT_BASE=0x10000 +CONFIG_SYS_TEXT_BASE=0x80000000 CONFIG_ASPEED_AST2600=y CONFIG_TARGET_EVB_AST2600=y CONFIG_SPL_LIBCOMMON_SUPPORT=y
@@ -12,13 +13,17 @@ CONFIG_ENV_SIZE=0x10000 CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_DEFAULT_DEVICE_TREE="ast2600-evb" CONFIG_SPL_SERIAL=y +CONFIG_SPL_STACK_R_ADDR=0x83000000 CONFIG_SPL_SIZE_LIMIT=0x10000 CONFIG_SPL=y # CONFIG_ARMV7_NONSEC is not set # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SYS_LOAD_ADDR=0x83000000 CONFIG_FIT=y -# CONFIG_LEGACY_IMAGE_FORMAT is not set +CONFIG_SPL_FIT_SIGNATURE=y +CONFIG_SPL_LOAD_FIT=y +CONFIG_SPL_LOAD_FIT_ADDRESS=0x10000 +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS4,115200n8 root=/dev/ram rw" CONFIG_USE_BOOTCOMMAND=y
@@ -26,8 +31,10 @@ CONFIG_BOOTCOMMAND="bootm 20100000" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_SPL_SIZE_LIMIT_SUBTRACT_GD=y CONFIG_SPL_SIZE_LIMIT_SUBTRACT_MALLOC=y -# CONFIG_SPL_LEGACY_IMAGE_SUPPORT is not set CONFIG_SPL_SYS_MALLOC_SIMPLE=y +CONFIG_SPL_STACK_R=y +CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000000 +CONFIG_SPL_FIT_IMAGE_TINY=y CONFIG_SPL_DM_RESET=y CONFIG_SPL_RAM_SUPPORT=y CONFIG_SPL_RAM_DEVICE=y
@@ -47,6 +54,9 @@ CONFIG_REGMAP=y CONFIG_SPL_OF_TRANSLATE=y CONFIG_CLK=y CONFIG_SPL_CLK=y +CONFIG_DM_HASH=y +CONFIG_HASH_ASPEED=y +CONFIG_ASPEED_ACRY=y CONFIG_DM_I2C=y CONFIG_MISC=y CONFIG_SPL_MISC=y
@@ -65,5 +75,9 @@ CONFIG_SYS_NS16550=y CONFIG_SYSRESET=y CONFIG_SPL_SYSRESET=y CONFIG_WDT=y +CONFIG_SHA512_ALGO=y +CONFIG_SHA512=y +CONFIG_SHA384=y CONFIG_HEXDUMP=y # CONFIG_EFI_LOADER is not set +CONFIG_PHANDLE_CHECK_SEQ=y
Signature · 1 line
2.17.1
PATCH v6 11/12 configs: aspeed: Make EXTRA_ENV_SETTINGS board specific
In reply to Chia-Wei WangMove CONFIG_EXTRA_ENV_SETTINGS to board-specific
configuration headers.
--- include/configs/aspeed-common.h | 9 --------- include/configs/evb_ast2500.h | 9 +++++++++ include/configs/evb_ast2600.h | 9 +++++++++ 3 files changed, 18 insertions(+), 9 deletions(-)
include/configs/aspeed-common.h +0 -9
@@ -38,13 +38,4 @@*/ #define CONFIG_BOOTP_BOOTFILESIZE -/* -* Miscellaneous configurable options -*/ - -#define CONFIG_EXTRA_ENV_SETTINGS \ - "verify=yes\0" \ - "spi_dma=yes\0" \ - "" -#endif /* __AST_COMMON_CONFIG_H */
include/configs/evb_ast2500.h +9 -0
@@ -13,4 +13,13 @@#define CONFIG_SYS_UBOOT_BASE CONFIG_SYS_TEXT_BASE +/* Memory Info */ +#define CONFIG_SYS_LOAD_ADDR 0x83000000 + +/* Misc */ +#define CONFIG_EXTRA_ENV_SETTINGS \ + "verify=yes\0" \ + "spi_dma=yes\0" \ + "" +#endif /* __CONFIG_H */
include/configs/evb_ast2600.h +9 -0
@@ -10,4 +10,13 @@#define CONFIG_SYS_UBOOT_BASE CONFIG_SYS_TEXT_BASE +/* Memory Info */ +#define CONFIG_SYS_LOAD_ADDR 0x83000000 + +/* Misc */ +#define CONFIG_EXTRA_ENV_SETTINGS \ + "verify=yes\0" \ + "spi_dma=yes\0" \ + "" +#endif /* __CONFIG_H */
Signature · 1 line
2.17.1
PATCH v6 12/12 configs: ast2600: Boot kernel FIT in DRAM
In reply to Chia-Wei WangAST2600 leverages the FIT hash/signature verification to fulfill secure boot trust chain. To improve the performance and save SW code size for those crypto operations, the two HW crypto engine, HACE and ACRY, are enabled.
However, both of the engines can only access to data stored in DRAM space. Therefore, we need to move the FIT image into DRAM before the booting.
This patch update the CONFIG_BOOTCOMMAND to execute the pre-defined ENV variable which consists of FIT image copy to memory and booting.
--- configs/evb-ast2600_defconfig | 2 +- include/configs/evb_ast2600.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-)
configs/evb-ast2600_defconfig +1 -1
@@ -27,7 +27,7 @@ CONFIG_SPL_LOAD_FIT_ADDRESS=0x10000 CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS4,115200n8 root=/dev/ram rw" CONFIG_USE_BOOTCOMMAND=y -CONFIG_BOOTCOMMAND="bootm 20100000" +CONFIG_BOOTCOMMAND="run bootspi" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_SPL_SIZE_LIMIT_SUBTRACT_GD=y CONFIG_SPL_SIZE_LIMIT_SUBTRACT_MALLOC=y
include/configs/evb_ast2600.h +7 -0
@@ -14,7 +14,14 @@#define CONFIG_SYS_LOAD_ADDR 0x83000000/* Misc */ +#define STR_HELPER (s) #s +#define STR (s) STR_HELPER(s) +#define CONFIG_EXTRA_ENV_SETTINGS \ + "loadaddr=" STR(CONFIG_SYS_LOAD_ADDR) "\0" \ + "bootspi=fdt addr 20100000 && fdt header get fitsize totalsize && " \ + "cp.b 20100000 ${loadaddr} ${fitsize} && bootm; " \ + "echo Error loading kernel FIT image\0" \ "verify=yes\0" \ "spi_dma=yes\0" \ ""
Signature · 1 line
2.17.1