[U-Boot] [PATCH v2 1/2] Revert "powerpc/mpc85xx: SECURE BOOT - Bypass PAMU in case of secure boot"
This reverts commit 7cad2e38d61e27ea59fb7944f7e647e97ef292d3. PAMU should not be by-passed in case of Secure Boot. Signed-off-by: Ruchika Gupta Signed-off-by: Aneesh Bansal --- Changes in v2: Modified the commit message arch/powerpc/cpu/mpc85xx/cpu_init.c | 9 + arch/powerpc/include/asm/immap_85xx.h | 1 - 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c b/arch/powerpc/cpu/mpc85xx/cpu_init.c index 13a7d0f..c738c96 100644 --- a/arch/powerpc/cpu/mpc85xx/cpu_init.c +++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c @@ -425,8 +425,7 @@ void fsl_erratum_a007212_workaround(void) ulong cpu_init_f(void) { extern void m8560_cpm_reset (void); -#if defined(CONFIG_SYS_DCSRBAR_PHYS) || \ - (defined(CONFIG_SECURE_BOOT) && defined(CONFIG_FSL_CORENET)) +#ifdef CONFIG_SYS_DCSRBAR_PHYS ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); #endif #if defined(CONFIG_SECURE_BOOT) @@ -458,12 +457,6 @@ ulong cpu_init_f(void) #if defined(CONFIG_SYS_CPC_REINIT_F) disable_cpc_sram(); #endif - -#if defined(CONFIG_FSL_CORENET) - /* Put PAMU in bypass mode */ - out_be32(&gur->pamubypenr, FSL_CORENET_PAMU_BYPASS); -#endif - #endif #ifdef CONFIG_CPM2 diff --git a/arch/powerpc/include/asm/immap_85xx.h b/arch/powerpc/include/asm/immap_85xx.h index 101b8db..667a97e 100644 --- a/arch/powerpc/include/asm/immap_85xx.h +++ b/arch/powerpc/include/asm/immap_85xx.h @@ -1933,7 +1933,6 @@ defined(CONFIG_PPC_T1020) || defined(CONFIG_PPC_T1022) u8 res24[64]; u32 pblsr; /* Preboot loader status */ u32 pamubypenr; /* PAMU bypass enable */ -#define FSL_CORENET_PAMU_BYPASS0x u32 dmacr1; /* DMA control */ u8 res25[4]; u32 gensr1; /* General status */ -- 1.8.1.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] Enable snooping on transactions from CAAM block
To enable snooping on CAAM transactions following programmign is done 1. Enable core snooping (CCI interface, Core is Slave5 on CCI) This setting is also required for making the system coherent 2. CAAM IP lies behind SMMU3 in teh system. Configure SMMU3 to do teh following: a) Program SCR to bypass transactions with stream ID other than taht of CAAM b_ Program S2CR to change memroy attributes of transactions with CAAM's stream ID (0x10) to cacheable. Signed-off-by: Ruchika Gupta Signed-off-by: Nitesh Narayan Lal Signed-off-by: Aneesh Bansal --- arch/arm/include/asm/arch-ls102xa/config.h | 1 + .../include/asm/arch-ls102xa/ls102xa_stream_id.h | 34 ++ board/freescale/common/ls102xa_stream_id.c | 34 ++ board/freescale/ls1021aqds/ls1021aqds.c| 4 +++ board/freescale/ls1021atwr/ls1021atwr.c| 4 +++ 5 files changed, 77 insertions(+) diff --git a/arch/arm/include/asm/arch-ls102xa/config.h b/arch/arm/include/asm/arch-ls102xa/config.h index f066480..f14ea2f 100644 --- a/arch/arm/include/asm/arch-ls102xa/config.h +++ b/arch/arm/include/asm/arch-ls102xa/config.h @@ -38,6 +38,7 @@ #define CONFIG_SYS_LS102XA_XHCI_USB1_ADDR (CONFIG_SYS_IMMR + 0x0210) #define CONFIG_SYS_LS102XA_USB1_ADDR \ (CONFIG_SYS_IMMR + CONFIG_SYS_LS102XA_USB1_OFFSET) +#define CONFIG_SYS_SMMU3_ADDR (CONFIG_SYS_IMMR + 0x30) #define CONFIG_SYS_FSL_SEC_OFFSET 0x0070 #define CONFIG_SYS_LS102XA_USB1_OFFSET 0x0760 diff --git a/arch/arm/include/asm/arch-ls102xa/ls102xa_stream_id.h b/arch/arm/include/asm/arch-ls102xa/ls102xa_stream_id.h index fa571b3..68e4e02 100644 --- a/arch/arm/include/asm/arch-ls102xa/ls102xa_stream_id.h +++ b/arch/arm/include/asm/arch-ls102xa/ls102xa_stream_id.h @@ -6,6 +6,39 @@ #ifndef __FSL_LS102XA_STREAM_ID_H_ #define __FSL_LS102XA_STREAM_ID_H_ +#define CONFIG_SMMU_NSCR_OFFSET0x400 +#define CONFIG_SMMU_SMR_OFFSET 0x800 +#define CONFIG_SMMU_S2CR_OFFSET0xc00 + +#define SMMU_NSCR_CLIENTPD_SHIFT 0 +#define SMMU_NSCR_MTCFG_SHIFT 20 + +#define SMR_SMR_VALID_SHIFT31 +#define SMR_ID_MASK0x7fff +#define SMR_MASK_SHIFT 16 + +#define S2CR_WACFG_SHIFT 22 +#define S2CR_WACFG_MASK0x3 +#define S2CR_WACFG_WRITE_ALLOCATE 0x2 + +#define S2CR_RACFG_SHIFT 20 +#define S2CR_RACFG_MASK0x3 +#define S2CR_RACFG_READ_ALLOCATE 0x2 + +#define S2CR_TYPE_SHIFT16 +#define S2CR_TYPE_MASK 0x3 +#define S2CR_TYPE_BYPASS 0x01 + +#define S2CR_MEM_ATTR_SHIFT12 +#define S2CR_MEM_ATTR_MASK 0xf +#define S2CR_MEM_ATTR_CACHEABLE0xa + +#define S2CR_MTCFG 0x0800 + +#define S2CR_SHCFG_SHIFT 8 +#define S2CR_SHCFG_MASK0x3 +#define S2CR_SHCFG_OUTER_CACHEABLE 0x1 +#define S2CR_SHCFG_INNER_CACHEABLE 0x2 #include @@ -71,4 +104,5 @@ struct smmu_stream_id { void ls1021x_config_caam_stream_id(struct liodn_id_table *tbl, int size); void ls102xa_config_smmu_stream_id(struct smmu_stream_id *id, uint32_t num); +void ls1021x_config_smmu3(uint32_t liodn); #endif diff --git a/board/freescale/common/ls102xa_stream_id.c b/board/freescale/common/ls102xa_stream_id.c index f434269..2b12a8c 100644 --- a/board/freescale/common/ls102xa_stream_id.c +++ b/board/freescale/common/ls102xa_stream_id.c @@ -31,3 +31,37 @@ void ls1021x_config_caam_stream_id(struct liodn_id_table *tbl, int size) out_le32((uint32_t *)(tbl[i].reg_offset), liodn); } } + +void ls1021x_config_smmu3(uint32_t liodn) +{ + uint32_t *addr; + u32 smr, s2cr, nscr; + + addr = (uint32_t *)(CONFIG_SYS_SMMU3_ADDR + CONFIG_SMMU_NSCR_OFFSET); + /* SMMU NSCR configuration */ + nscr = in_le32(addr); + + nscr = nscr & ~(1 << SMMU_NSCR_CLIENTPD_SHIFT | +1 << SMMU_NSCR_MTCFG_SHIFT); + out_le32(addr, nscr); + + /* SMMU SMR configuration */ + addr = (uint32_t *)(CONFIG_SYS_SMMU3_ADDR + CONFIG_SMMU_SMR_OFFSET); + + smr = 0; + smr = smr & (~(SMR_ID_MASK << SMR_MASK_SHIFT)); + smr = smr | (1 << SMR_SMR_VALID_SHIFT) | liodn; + + out_le32(addr, smr); + + /* SMMU S2CR configuration */ + addr = (uint32_t *)(CONFIG_SYS_SMMU3_ADDR + CONFIG_SMMU_S2CR_OFFSET); + s2cr = (S2CR_WACFG_WRITE_ALLOCATE << S2CR_WACFG_SHIFT) | + (S2CR_RACFG_READ_ALLOCATE << S2CR_RACFG_SHIFT) | + (S2CR_TYPE_BYPASS << S2CR_TYPE_SHIFT) | + (S2CR_MEM_ATTR_CACHEABLE << S2CR_MEM_ATTR_SHIFT) | + S2CR_MTCFG | + (S2CR_SHCFG_OUTER_CACHEABLE << S2CR_SHCFG_SHIFT); + + out_le32(addr, s2cr); +} diff --git a/board/freescale/ls1021aqds/ls1021aqds.c b/board
[U-Boot] [PATCH v2 2/2] powerpc/SECURE_BOOT: Add PAMU driver
PAMU driver basic support for usage in Secure Boot. In secure boot PAMU is not in bypass mode. Hence to use any peripheral (SEC Job ring in our case), PAMU has to be configured. The Header file pamu.h and few functions in driver have been derived from Freescale Libos. Signed-off-by: Ruchika Gupta Signed-off-by: Aneesh Bansal --- Changes in v2: Replace the Debug printf() call with debug() arch/powerpc/cpu/mpc85xx/cpu_init.c | 9 + arch/powerpc/cpu/mpc8xxx/Makefile | 1 + arch/powerpc/cpu/mpc8xxx/fsl_pamu.c | 449 ++ arch/powerpc/cpu/mpc8xxx/pamu_table.c | 55 + arch/powerpc/include/asm/fsl_pamu.h | 169 + arch/powerpc/include/asm/immap_85xx.h | 18 ++ drivers/crypto/fsl/jr.c | 23 ++ 7 files changed, 724 insertions(+) create mode 100644 arch/powerpc/cpu/mpc8xxx/fsl_pamu.c create mode 100644 arch/powerpc/cpu/mpc8xxx/pamu_table.c create mode 100644 arch/powerpc/include/asm/fsl_pamu.h diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c b/arch/powerpc/cpu/mpc85xx/cpu_init.c index c738c96..50bb86a 100644 --- a/arch/powerpc/cpu/mpc85xx/cpu_init.c +++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c @@ -30,6 +30,10 @@ #ifdef CONFIG_FSL_CAAM #include #endif +#if defined(CONFIG_SECURE_BOOT) && defined(CONFIG_FSL_CORENET) +#include +#include +#endif #ifdef CONFIG_SYS_QE_FMAN_FW_IN_NAND #include #include @@ -933,6 +937,11 @@ int cpu_init_r(void) fman_enet_init(); #endif +#if defined(CONFIG_SECURE_BOOT) && defined(CONFIG_FSL_CORENET) + if (pamu_init() < 0) + fsl_secboot_handle_error(ERROR_ESBC_PAMU_INIT); +#endif + #ifdef CONFIG_FSL_CAAM sec_init(); #endif diff --git a/arch/powerpc/cpu/mpc8xxx/Makefile b/arch/powerpc/cpu/mpc8xxx/Makefile index ac45e0e..c5592cd 100644 --- a/arch/powerpc/cpu/mpc8xxx/Makefile +++ b/arch/powerpc/cpu/mpc8xxx/Makefile @@ -24,5 +24,6 @@ obj-$(CONFIG_OF_LIBFDT) += fdt.o obj-$(CONFIG_FSL_LBC) += fsl_lbc.o obj-$(CONFIG_SYS_SRIO) += srio.o obj-$(CONFIG_FSL_LAW) += law.o +obj-$(CONFIG_FSL_CORENET) += fsl_pamu.o pamu_table.o endif diff --git a/arch/powerpc/cpu/mpc8xxx/fsl_pamu.c b/arch/powerpc/cpu/mpc8xxx/fsl_pamu.c new file mode 100644 index 000..8dee2e7 --- /dev/null +++ b/arch/powerpc/cpu/mpc8xxx/fsl_pamu.c @@ -0,0 +1,449 @@ +/* + * FSL PAMU driver + * + * Copyright 2012-2016 Freescale Semiconductor, Inc. + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#include +#include +#include +#include + +struct paace *ppaact; +struct paace *sec; +unsigned long fspi; + +static inline int __ilog2_roundup_64(uint64_t val) +{ + if ((val & (val - 1)) == 0) + return __ilog2_u64(val); + else + return __ilog2_u64(val) + 1; +} + + +static inline int count_lsb_zeroes(unsigned long val) +{ + return ffs(val) - 1; +} + +static unsigned int map_addrspace_size_to_wse(uint64_t addrspace_size) +{ + /* window size is 2^(WSE+1) bytes */ + return count_lsb_zeroes(addrspace_size >> PAMU_PAGE_SHIFT) + + PAMU_PAGE_SHIFT - 1; +} + +static unsigned int map_subwindow_cnt_to_wce(uint32_t subwindow_cnt) +{ + /* window count is 2^(WCE+1) bytes */ + return count_lsb_zeroes(subwindow_cnt) - 1; +} + +static void pamu_setup_default_xfer_to_host_ppaace(struct paace *ppaace) +{ + set_bf(ppaace->addr_bitfields, PAACE_AF_PT, PAACE_PT_PRIMARY); + set_bf(ppaace->domain_attr.to_host.coherency_required, PAACE_DA_HOST_CR, + PAACE_M_COHERENCE_REQ); +} + +static void pamu_setup_default_xfer_to_host_spaace(struct paace *spaace) +{ + set_bf(spaace->addr_bitfields, PAACE_AF_PT, PAACE_PT_SECONDARY); + set_bf(spaace->domain_attr.to_host.coherency_required, PAACE_DA_HOST_CR, + PAACE_M_COHERENCE_REQ); +} + +/** Sets up PPAACE entry for specified liodn + * + * @param[in] liodn Logical IO device number + * @param[in] win_addr starting address of DSA window + * @param[in] win-size size of DSA window + * @param[in] omiOperation mapping index -- if ~omi == 0 then omi + not defined + * @param[in] stashidcache stash id for associated cpu -- if ~stashid == 0 + then stashid not defined + * @param[in] snoopidsnoop id for hardware coherency -- if ~snoopid == 0 + then snoopid not defined + * @param[in] subwin_cnt number of sub-windows + * + * @return Returns 0 upon success else error code < 0 returned + */ +static int pamu_config_ppaace(uint32_t liodn, uint64_t win_addr, + uint64_t win_size, uint32_t omi, + uint32_t snoopid, uint32_t stashid, + uint32_t subwin_cnt) +{ + struct paace *ppaace; + + if ((win_size & (win_size - 1)) || win_size < PAMU_PAGE_SIZE) + return -1; + + if (win_addr & (win_size - 1)) + return -2; + + if (liodn > NUM_PPAACT_ENTRIES) { + printf("Entries in PPACT not sufficient
Re: [U-Boot] [PATCH 1/4] SECURE BOOT: change prototype of fsl_secboot_validate function
> -Original Message- > From: Aneesh Bansal > Sent: Tuesday, December 08, 2015 2:14 PM > To: u-boot@lists.denx.de > Cc: Yusong Sun ; Ruchika Gupta > ; Prabhakar Kushwaha > ; Aneesh Bansal > ; Saksham Jain > Subject: [PATCH 1/4] SECURE BOOT: change prototype of > fsl_secboot_validate function > > The prototype and defination of function fsl_secboot_validate has been > changed to support calling this function from another function within u-boot. > Only two aruments needed: > 1) header address - Mandatory > 2) SHA256 string - optional > > Signed-off-by: Saksham Jain > Signed-off-by: Aneesh Bansal > --- > board/freescale/common/cmd_esbc_validate.c | 17 - > board/freescale/common/fsl_validate.c | 18 +++--- > include/fsl_validate.h | 5 ++--- > 3 files changed, 25 insertions(+), 15 deletions(-) > > diff --git a/board/freescale/common/cmd_esbc_validate.c > b/board/freescale/common/cmd_esbc_validate.c > index 8bbe85b..ae6a9af 100644 > --- a/board/freescale/common/cmd_esbc_validate.c > +++ b/board/freescale/common/cmd_esbc_validate.c > @@ -21,10 +21,25 @@ loop: > static int do_esbc_validate(cmd_tbl_t *cmdtp, int flag, int argc, > char * const argv[]) > { > + char *hash_str = NULL; > + ulong haddr; > + int ret; > + > if (argc < 2) > return cmd_usage(cmdtp); > + else if (argc > 2) > + /* Second arg - Optional - Hash Str*/ > + hash_str = argv[2]; > + > + /* First argument - header address -32/64bit */ > + haddr = simple_strtoul(argv[1], NULL, 16); > > - return fsl_secboot_validate(cmdtp, flag, argc, argv); > + ret = fsl_secboot_validate(haddr, hash_str); > + if (ret) > + return 1; > + > + printf("esbc_validate command successful\n"); > + return 0; > } > > /***/ > diff --git a/board/freescale/common/fsl_validate.c > b/board/freescale/common/fsl_validate.c > index b510c71..282ce53 100644 > --- a/board/freescale/common/fsl_validate.c > +++ b/board/freescale/common/fsl_validate.c > @@ -699,13 +699,11 @@ static inline int str2longbe(const char *p, ulong > *num) > return *p != '\0' && *endptr == '\0'; > } > > -int fsl_secboot_validate(cmd_tbl_t *cmdtp, int flag, int argc, > - char * const argv[]) > +int fsl_secboot_validate(ulong haddr, char *arg_hash_str) > { > struct ccsr_sfp_regs *sfp_regs = (void *)(CONFIG_SYS_SFP_ADDR); > ulong hash[SHA256_BYTES/sizeof(ulong)]; > char hash_str[NUM_HEX_CHARS + 1]; > - ulong addr = simple_strtoul(argv[1], NULL, 16); > struct fsl_secboot_img_priv *img; > struct fsl_secboot_img_hdr *hdr; > void *esbc; > @@ -717,8 +715,8 @@ int fsl_secboot_validate(cmd_tbl_t *cmdtp, int flag, > int argc, > struct udevice *mod_exp_dev; > #endif > > - if (argc == 3) { > - char *cp = argv[2]; > + if (arg_hash_str != NULL) { > + const char *cp = arg_hash_str; > int i = 0; > > if (*cp == '0' && *(cp + 1) == 'x') > @@ -731,7 +729,7 @@ int fsl_secboot_validate(cmd_tbl_t *cmdtp, int flag, > int argc, >*/ > if (strlen(cp) != SHA256_NIBBLES) { > printf("%s is not a 256 bits hex string as expected\n", > -argv[2]); > +arg_hash_str); > return -1; > } > > @@ -741,7 +739,7 @@ int fsl_secboot_validate(cmd_tbl_t *cmdtp, int flag, > int argc, > hash_str[NUM_HEX_CHARS] = '\0'; > if (!str2longbe(hash_str, &hash[i])) { > printf("%s is not a 256 bits hex string ", > -argv[2]); > +arg_hash_str); > return -1; > } > } > @@ -757,7 +755,7 @@ int fsl_secboot_validate(cmd_tbl_t *cmdtp, int flag, > int argc, > memset(img, 0, sizeof(struct fsl_secboot_img_priv)); > > hdr = &img->hdr; > - img->ehdrloc = addr; > + img->ehdrloc = haddr; > esbc = (u8 *)(uintptr_t)img->ehdrloc; > > memcpy(hdr, esbc, sizeof(struct fsl_secboot_img_hdr)); @@ -843,8 > +841,6 @@ int fsl_secboot_validate(cmd_tbl_t *cmdtp, int flag, int argc, > goto exit; > } > > - printf("esbc_validate command successful\n"); > - > exit: > - return 0; > + return ret; > } > diff --git a/include/fsl_validate.h b/include/fsl_validate.h index > a62dc74..bda802f 100644 > --- a/include/fsl_validate.h > +++ b/include/fsl_validate.h > @@ -193,11 +193,10 @@ struct fsl_secboot_img_priv { >*/ > > struct fsl_secboot_sg_table sgtbl[MAX_SG_ENTRIES]; /* SG table */ > - u32 ehdrloc;/* ESBC client location */ > + ulong ehdrl
Re: [U-Boot] [PATCH 2/4] SECURE BOOT: separate functions for reading keys
> -Original Message- > From: Aneesh Bansal > Sent: Tuesday, December 08, 2015 2:14 PM > To: u-boot@lists.denx.de > Cc: Yusong Sun ; Ruchika Gupta > ; Prabhakar Kushwaha > ; Aneesh Bansal > ; Saksham Jain > Subject: [PATCH 2/4] SECURE BOOT: separate functions for reading keys > > Separate functions are created for reading and checking the sanity of Public > keys: > - read_validate_single_key > - read_validate_ie_tbl > - read_validate_srk_table > > Signed-off-by: Saksham Jain > Signed-off-by: Aneesh Bansal > --- > board/freescale/common/fsl_validate.c | 169 +++- > -- > 1 file changed, 96 insertions(+), 73 deletions(-) > > diff --git a/board/freescale/common/fsl_validate.c > b/board/freescale/common/fsl_validate.c > index 282ce53..ef7a5ae 100644 > --- a/board/freescale/common/fsl_validate.c > +++ b/board/freescale/common/fsl_validate.c > @@ -24,6 +24,10 @@ > #define SHA256_NIBBLES (256/4) > #define NUM_HEX_CHARS(sizeof(ulong) * 2) > > +#define CHECK_KEY_LEN(key_len) (((key_len) == 2 * KEY_SIZE_BYTES / > 4) || \ > + ((key_len) == 2 * KEY_SIZE_BYTES / 2) || \ > + ((key_len) == 2 * KEY_SIZE_BYTES)) > + > /* This array contains DER value for SHA-256 */ static const u8 > hash_identifier[] = { 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, > 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, > @@ -179,20 +183,97 @@ static u32 is_key_revoked(u32 keynum, u32 > rev_flag) > return 0; > } > > -/* It validates srk_table key lengths.*/ -static u32 validate_srk_tbl(struct > srk_table *tbl, u32 num_entries) > +/* It read validates srk_table key lengths.*/ static u32 > +read_validate_srk_tbl(struct fsl_secboot_img_priv *img) > { > int i = 0; > - for (i = 0; i < num_entries; i++) { > - if (!((tbl[i].key_len == 2 * KEY_SIZE_BYTES/4) || > - (tbl[i].key_len == 2 * KEY_SIZE_BYTES/2) || > - (tbl[i].key_len == 2 * KEY_SIZE_BYTES))) > + u32 ret, key_num, key_revoc_flag, size; > + struct fsl_secboot_img_hdr *hdr = &img->hdr; > + void *esbc = (u8 *)(uintptr_t)img->ehdrloc; > + > + if ((hdr->len_kr.num_srk == 0) || > + (hdr->len_kr.num_srk > MAX_KEY_ENTRIES)) > + return > ERROR_ESBC_CLIENT_HEADER_INVALID_SRK_NUM_ENTRY; > + > + key_num = hdr->len_kr.srk_sel; > + if (key_num == 0 || key_num > hdr->len_kr.num_srk) > + return ERROR_ESBC_CLIENT_HEADER_INVALID_KEY_NUM; > + > + /* Get revoc key from sfp */ > + key_revoc_flag = get_key_revoc(); > + ret = is_key_revoked(key_num, key_revoc_flag); > + if (ret) > + return ERROR_ESBC_CLIENT_HEADER_KEY_REVOKED; > + > + size = hdr->len_kr.num_srk * sizeof(struct srk_table); > + > + memcpy(&img->srk_tbl, esbc + hdr->srk_tbl_off, size); > + > + for (i = 0; i < hdr->len_kr.num_srk; i++) { > + if (!CHECK_KEY_LEN(img->srk_tbl[i].key_len)) > return > ERROR_ESBC_CLIENT_HEADER_INV_SRK_ENTRY_KEYLEN; > } > + > + img->key_len = img->srk_tbl[key_num - 1].key_len; > + > + memcpy(&img->img_key, &(img->srk_tbl[key_num - 1].pkey), > +img->key_len); > + > return 0; > } > #endif > > +static u32 read_validate_single_key(struct fsl_secboot_img_priv *img) { > + struct fsl_secboot_img_hdr *hdr = &img->hdr; > + void *esbc = (u8 *)(uintptr_t)img->ehdrloc; > + > + /* check key length */ > + if (!CHECK_KEY_LEN(hdr->key_len)) > + return ERROR_ESBC_CLIENT_HEADER_KEY_LEN; > + > + memcpy(&img->img_key, esbc + hdr->pkey, hdr->key_len); > + > + img->key_len = hdr->key_len; > + > + return 0; > +} > + > +#if defined(CONFIG_FSL_ISBC_KEY_EXT) > +static u32 read_validate_ie_tbl(struct fsl_secboot_img_priv *img) { > + struct fsl_secboot_img_hdr *hdr = &img->hdr; > + u32 ie_key_len, ie_revoc_flag, ie_num; > + struct ie_key_info *ie_info; > + > + if (get_ie_info_addr(&img->ie_addr)) > + return ERROR_IE_TABLE_NOT_FOUND; > + ie_info = (struct ie_key_info *)(uintptr_t)img->ie_addr; > + if (ie_info->num_keys == 0 || ie_info->num_keys > 32) > + return > ERROR_ESBC_CLIENT_HEADER_INVALID_IE_NUM_ENTRY; > + > + ie_num = hdr->ie_key_sel; > + if (ie_num == 0 || ie_num > ie_info->num_keys) > + return > ERROR_ESBC_CLIENT_HEADER_INVALID_IE_KEY_NUM; > + > + ie_revoc_flag = ie_info->key_revok; > + if ((u32)(1 << (ie_num - 1)) & ie_revoc_flag) > + return ERROR_ESBC_CLIENT_HEADER_IE_KEY_REVOKED; > + > + ie_key_len = ie_info->ie_key_tbl[ie_num - 1].key_len; > + > + if (!CHECK_KEY_LEN(ie_key_len)) > + return > ERROR_ESBC_CLIENT_HEADER_INV_IE_ENTRY_KEYLEN; > + > + memcpy(&img->img_key, &(ie_info->ie_key_tbl[ie_num - 1].pkey), > +ie_key_len); > + > + img->key_len = ie_key_len; > + return 0; > +} > +#endif > + > + > /* Th
Re: [U-Boot] [PATCH] ls2-2085ardb: Correct the model name of ls2085ardb
> -Original Message- > From: york sun [mailto:york@nxp.com] > Sent: Thursday, January 14, 2016 10:36 PM > To: Ashish Kumar ; u-boot@lists.denx.de > Cc: Prabhakar Kushwaha > Subject: Re: [PATCH] ls2-2085ardb: Correct the model name of ls2085ardb > > On 01/14/2016 04:42 AM, Ashish Kumar wrote: > > Signed-off-by: Ashish Kumar > > --- > > arch/arm/dts/fsl-ls2080a-rdb.dts |2 +- > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > > diff --git a/arch/arm/dts/fsl-ls2080a-rdb.dts b/arch/arm/dts/fsl-ls2080a- > rdb.dts > > index 1a1813b..71d1969 100644 > > --- a/arch/arm/dts/fsl-ls2080a-rdb.dts > > +++ b/arch/arm/dts/fsl-ls2080a-rdb.dts > > @@ -11,7 +11,7 @@ > > #include "fsl-ls2080a.dtsi" > > > > / { > > - model = "Freescale Layerscape 2080a RDB Board"; > > + model = "Freescale Layerscape 2085a RDB Board"; > > compatible = "fsl,ls2080a-rdb", "fsl,ls2080a"; > > > > aliases { > > > > Ashish, > > Why change this? This product has been renamed to LS2080A. > LS2085ARDB is a platform/board hosting LS2080A, LS2085A and LS2088A. This is the reason board name is being updated. --prabhakar ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] board: ls2085aqds: Update kernel_size env variable
> -Original Message- > From: york sun [mailto:york@nxp.com] > Sent: Thursday, January 14, 2016 11:37 PM > To: Prabhakar Kushwaha ; u-boot@lists.denx.de > Cc: Scott Wood > Subject: Re: [PATCH] board: ls2085aqds: Update kernel_size env variable > > On 01/05/2016 09:00 PM, Prabhakar Kushwaha wrote: > > kernel_size env variable is defined as 0x2800, it is beyond NOR > > flash. > > > > Update kernel_size with 40MB kernel size. > > > > Signed-off-by: Prabhakar Kushwaha > > --- > > include/configs/ls2080aqds.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/include/configs/ls2080aqds.h > > b/include/configs/ls2080aqds.h index ba84248..a402c06 100644 > > --- a/include/configs/ls2080aqds.h > > +++ b/include/configs/ls2080aqds.h > > @@ -346,7 +346,7 @@ unsigned long get_board_ddr_clk(void); > > "initrd_high=0x\0" \ > > "kernel_start=0x58110\0"\ > > "kernel_load=0xa000\0" \ > > - "kernel_size=0x2800\0" > > + "kernel_size=0x280\0" > > > > #ifdef CONFIG_FSL_MC_ENET > > #define CONFIG_FSL_MEMAC > > > Prabhakar, > > I am tired of these changes. Can you go over all the default settings and > verify they all make sense? I agree. Let me review all settings and provide one patch to fix all of them at once. Do you want to hold this patch till I check and provide patch (if required) >A short while ago Scott found fdt_high was not correct. Is this change part of code or not? --prabhakar ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 4/4] SECURE BOOT: support for validation of dynamic image
> -Original Message- > From: Aneesh Bansal > Sent: Tuesday, December 08, 2015 2:14 PM > To: u-boot@lists.denx.de > Cc: Yusong Sun ; Ruchika Gupta > ; Prabhakar Kushwaha > ; Aneesh Bansal > ; Saksham Jain > Subject: [PATCH 4/4] SECURE BOOT: support for validation of dynamic image > > Some images to be validated are relocated to a dynamic address at run time. > So, these addresses cannot be known befor hand while signing the images > and creating the header offline. > So, support is required to pass the image address to the validate function as > an argument. > If an address is provided to the function, the address field in Header is not > read and is treated as a reserved field. > > Signed-off-by: Saksham Jain > Signed-off-by: Aneesh Bansal > --- > board/freescale/common/cmd_esbc_validate.c | 10 ++--- > board/freescale/common/fsl_validate.c | 33 ++- > --- > include/fsl_validate.h | 7 +-- > 3 files changed, 32 insertions(+), 18 deletions(-) > > diff --git a/board/freescale/common/cmd_esbc_validate.c > b/board/freescale/common/cmd_esbc_validate.c > index ae6a9af..ca7c737 100644 > --- a/board/freescale/common/cmd_esbc_validate.c > +++ b/board/freescale/common/cmd_esbc_validate.c > @@ -22,7 +22,7 @@ static int do_esbc_validate(cmd_tbl_t *cmdtp, int flag, > int argc, > char * const argv[]) > { > char *hash_str = NULL; > - ulong haddr; > + uintptr_t haddr; > int ret; > > if (argc < 2) > @@ -32,9 +32,13 @@ static int do_esbc_validate(cmd_tbl_t *cmdtp, int flag, > int argc, > hash_str = argv[2]; > > /* First argument - header address -32/64bit */ > - haddr = simple_strtoul(argv[1], NULL, 16); > + haddr = (uintptr_t)simple_strtoul(argv[1], NULL, 16); > > - ret = fsl_secboot_validate(haddr, hash_str); > + /* With esbc_validate command, Image address must be > + * part of header. So, the function is called > + * by passing this argument as 0. > + */ > + ret = fsl_secboot_validate(haddr, hash_str, 0); > if (ret) > return 1; > > diff --git a/board/freescale/common/fsl_validate.c > b/board/freescale/common/fsl_validate.c > index 08a2f79..de40081 100644 > --- a/board/freescale/common/fsl_validate.c > +++ b/board/freescale/common/fsl_validate.c > @@ -536,13 +536,8 @@ static int calc_esbchdr_esbc_hash(struct > fsl_secboot_img_priv *img) > return ret; > > /* Update hash for actual Image */ > -#ifdef CONFIG_ESBC_ADDR_64BIT > ret = algo->hash_update(algo, ctx, > - (u8 *)(uintptr_t)img->hdr.pimg64, img->hdr.img_size, 1); > -#else > - ret = algo->hash_update(algo, ctx, > - (u8 *)(uintptr_t)img->hdr.pimg, img->hdr.img_size, 1); > -#endif > + (u8 *)img->img_addr, img->img_size, 1); > if (ret) > return ret; > > @@ -632,16 +627,25 @@ static int read_validate_esbc_client_header(struct > fsl_secboot_img_priv *img) > if (memcmp(hdr->barker, barker_code, ESBC_BARKER_LEN)) > return ERROR_ESBC_CLIENT_HEADER_BARKER; > > -#ifdef CONFIG_ESBC_ADDR_64BIT > - sprintf(buf, "%llx", hdr->pimg64); > -#else > - sprintf(buf, "%x", hdr->pimg); > -#endif > + /* If Image Address is not passed as argument to function, > + * then Address and Size must be read from the Header. > + */ > + if (img->img_addr == 0) { > + #ifdef CONFIG_ESBC_ADDR_64BIT > + img->img_addr = hdr->pimg64; > + #else > + img->img_addr = hdr->pimg; > + #endif > + } > + > + sprintf(buf, "%lx", img->img_addr); > setenv("img_addr", buf); > > if (!hdr->img_size) > return ERROR_ESBC_CLIENT_HEADER_IMG_SIZE; > > + img->img_size = hdr->img_size; > + > /* Key checking*/ > #ifdef CONFIG_KEY_REVOCATION > if (check_srk(img)) { > @@ -774,7 +778,8 @@ static int calculate_cmp_img_sig(struct > fsl_secboot_img_priv *img) > return 0; > } > > -int fsl_secboot_validate(ulong haddr, char *arg_hash_str) > +int fsl_secboot_validate(uintptr_t haddr, char *arg_hash_str, > + uintptr_t img_addr) > { > struct ccsr_sfp_regs *sfp_regs = (void *)(CONFIG_SYS_SFP_ADDR); > ulong hash[SHA256_BYTES/sizeof(ulong)]; @@ -824,9 +829,11 @@ > int fsl_secboot_validate(ulong haddr, char *arg_hash_str) > > memset(img, 0, sizeof(struct fsl_secboot_img_priv)); > > + /* Update the information in Private Struct */ > hdr = &img->hdr; > img->ehdrloc = haddr; > - esbc = (u8 *)(uintptr_t)img->ehdrloc; > + img->img_addr = img_addr; > + esbc = (u8 *)img->ehdrloc; > > memcpy(hdr, esbc, sizeof(struct fsl_secboot_img_hdr)); > > diff --git a/include/fsl_validate.h b/include/fsl_validate.h index > bda802f..ad14867 100644 > --- a/include/fsl_validate.h > +++ b/include/fsl_validate.h > @@ -193,10 +193,13 @@ struct fsl_secboot_img_priv
Re: [U-Boot] [PATCH] ls2-2085a: Increase default hugepage count
> -Original Message- > From: U-Boot [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Ashish > Kumar > Sent: Thursday, January 14, 2016 6:04 PM > To: u-boot@lists.denx.de > Cc: Ashish Kumar > Subject: [U-Boot] [PATCH] ls2-2085a: Increase default hugepage count > Please add description of this patch --prabhakar ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] armv8: Enable all 8 DPMAC ports in LS2080A Personality
> -Original Message- > From: Pratiyush Srivastava > Sent: Tuesday, December 22, 2015 4:48 PM > To: u-boot@lists.denx.de > Cc: Yusong Sun ; Prabhakar Kushwaha > ; Pratiyush Srivastava > > Subject: [PATCH] armv8: Enable all 8 DPMAC ports in LS2080A Personality > > LS2080A has support for 8 DPMAC ports out of which only 5 ports can be used > at a time. > Enabling all 8 DPMAC ports of LS2080A personality. > > Signed-off-by: Pratiyush Mohan Srivastava > > --- > arch/arm/cpu/armv8/fsl-layerscape/ls2080a_serdes.c | 5 - > 1 file changed, 5 deletions(-) > > diff --git a/arch/arm/cpu/armv8/fsl-layerscape/ls2080a_serdes.c > b/arch/arm/cpu/armv8/fsl-layerscape/ls2080a_serdes.c > index 8ef4f1c..ea3114c 100644 > --- a/arch/arm/cpu/armv8/fsl-layerscape/ls2080a_serdes.c > +++ b/arch/arm/cpu/armv8/fsl-layerscape/ls2080a_serdes.c > @@ -28,12 +28,7 @@ static struct serdes_config serdes1_cfg_tbl[] = { > SGMII1 } }, > {0x26, {SGMII8, SGMII7, SGMII6, SGMII5, SGMII4, SGMII3, XFI2, XFI1 > } }, > {0x28, {SGMII8, SGMII7, SGMII6, SGMII5, XFI4, XFI3, XFI2, XFI1 } }, - > #ifdef CONFIG_LS2080A > - {0x2A, {NONE, NONE, NONE, XFI5, XFI4, XFI3, XFI2, XFI1 } }, > -#endif > -#ifdef CONFIG_LS2085A > {0x2A, {XFI8, XFI7, XFI6, XFI5, XFI4, XFI3, XFI2, XFI1 } }, -#endif > {0x2B, {SGMII8, SGMII7, SGMII6, SGMII5, XAUI1, XAUI1, XAUI1, > XAUI1 } }, > {0x32, {XAUI2, XAUI2, XAUI2, XAUI2, XAUI1, XAUI1, XAUI1, XAUI1 } }, > {0x33, {PCIE2, PCIE2, PCIE2, PCIE2, QSGMII_C, QSGMII_D, QSGMII_A, > -- Acked-by: Prabhakar Kushwaha ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] armv8: ls2040a: Add support of LS2040A SoC
> -Original Message- > From: Pratiyush Srivastava > Sent: Tuesday, December 22, 2015 4:49 PM > To: u-boot@lists.denx.de > Cc: Yusong Sun ; Prabhakar Kushwaha > ; Pratiyush Srivastava > > Subject: [PATCH] armv8: ls2040a: Add support of LS2040A SoC > > Freescale's LS2040A is a another personality of LS2080A SoC without AIOP > support consisting of 4 armv8 cores. > > Signed-off-by: Pratiyush Mohan Srivastava > > --- > arch/arm/include/asm/arch-fsl-layerscape/cpu.h | 1 + > arch/arm/include/asm/arch-fsl-layerscape/soc.h | 1 + > 2 files changed, 2 insertions(+) > > diff --git a/arch/arm/include/asm/arch-fsl-layerscape/cpu.h > b/arch/arm/include/asm/arch-fsl-layerscape/cpu.h > index e030430..b10ee43 100644 > --- a/arch/arm/include/asm/arch-fsl-layerscape/cpu.h > +++ b/arch/arm/include/asm/arch-fsl-layerscape/cpu.h > @@ -12,6 +12,7 @@ static struct cpu_type cpu_type_list[] = { > CPU_TYPE_ENTRY(LS2085, LS2085, 8), > CPU_TYPE_ENTRY(LS2045, LS2045, 4), > CPU_TYPE_ENTRY(LS1043, LS1043, 4), > + CPU_TYPE_ENTRY(LS2040, LS2040, 4), > }; > > #ifndef CONFIG_SYS_DCACHE_OFF > diff --git a/arch/arm/include/asm/arch-fsl-layerscape/soc.h > b/arch/arm/include/asm/arch-fsl-layerscape/soc.h > index 1565592..ea78e15 100644 > --- a/arch/arm/include/asm/arch-fsl-layerscape/soc.h > +++ b/arch/arm/include/asm/arch-fsl-layerscape/soc.h > @@ -45,6 +45,7 @@ struct cpu_type { > #define SVR_LS2045 0x870120 > #define SVR_LS2080 0x870110 > #define SVR_LS2085 0x870100 > +#define SVR_LS2040 0x870130 > > #define SVR_MAJ(svr) (((svr) >> 4) & 0xf) > #define SVR_MIN(svr) (((svr) >> 0) & 0xf) > -- Acked-by: Prabhakar Kushwaha --prabhakar ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] drivers: net: fsl_mc: Compare pointer value qbman_swp_mc_start
> -Original Message- > From: Pratiyush Srivastava > Sent: Tuesday, December 22, 2015 4:50 PM > To: u-boot@lists.denx.de > Cc: Yusong Sun ; Prabhakar Kushwaha > ; Pratiyush Srivastava > > Subject: [PATCH] drivers: net: fsl_mc: Compare pointer value > qbman_swp_mc_start > > Current code compares the return pointer of function > qbman_cena_write_start with NULL. Instead the value of the return pointer > should be compared. > Signed-off-by: Pratiyush Mohan Srivastava > > --- > drivers/net/fsl-mc/dpio/qbman_portal.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/fsl-mc/dpio/qbman_portal.c b/drivers/net/fsl- > mc/dpio/qbman_portal.c > index 449ff8a..4b64c8a 100644 > --- a/drivers/net/fsl-mc/dpio/qbman_portal.c > +++ b/drivers/net/fsl-mc/dpio/qbman_portal.c > @@ -102,12 +102,14 @@ struct qbman_swp *qbman_swp_init(const struct > qbman_swp_desc *d) void *qbman_swp_mc_start(struct qbman_swp *p) > { > void *ret; > + int *return_val; > #ifdef QBMAN_CHECKING > BUG_ON(p->mc.check != swp_mc_can_start); #endif > ret = qbman_cena_write_start(&p->sys, QBMAN_CENA_SWP_CR); > #ifdef QBMAN_CHECKING > - if (!ret) > + return_val = (int *)ret; > + if (!(*return_val)) > p->mc.check = swp_mc_can_submit; > #endif > return ret; > -- Acked-by: Prabhakar Kushwaha --prabhakar ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] armv8: ls2080a: Increase MC's DDR size to 512 MB
> -Original Message- > From: Pratiyush Srivastava > Sent: Tuesday, December 22, 2015 4:50 PM > To: u-boot@lists.denx.de > Cc: Yusong Sun ; Prabhakar Kushwaha > ; Pratiyush Srivastava > > Subject: [PATCH] armv8: ls2080a: Increase MC's DDR size to 512 MB > > Freescale's management complex (MC) uses System DDR for internal usage. > Increase used System DDR size from 256MB to 512 MB. > > Signed-off-by: Pratiyush Mohan Srivastava > > --- > include/configs/ls2080a_common.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/configs/ls2080a_common.h > b/include/configs/ls2080a_common.h > index 4ae7d11..7323e10 100644 > --- a/include/configs/ls2080a_common.h > +++ b/include/configs/ls2080a_common.h > @@ -196,7 +196,7 @@ unsigned long long get_qixis_addr(void); > */ > #if defined(CONFIG_FSL_MC_ENET) || > defined(CONFIG_FSL_DEBUG_SERVER) > #define CONFIG_SYS_DEBUG_SERVER_DRAM_BLOCK_MIN_SIZE > (254UL * 1024 * 1024) > -#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE > (256UL * 1024 * 1024) > +#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE > (512UL * 1024 * 1024) > #define CONFIG_SYS_MC_RSV_MEM_ALIGN (512UL * 1024 > * 1024) > #endif > Acked-by: Prabhakar Kushwaha --prabhakar ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 19/25] exynos: Allow PWM0 pinmux to be set up
On 15/01/16 09:00, Simon Glass wrote: > This is commonly used for LCD backlight control. Add pinmux support for it > on exynos5250 and 5420. > > Signed-off-by: Simon Glass > --- > > arch/arm/mach-exynos/pinmux.c | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/arch/arm/mach-exynos/pinmux.c b/arch/arm/mach-exynos/pinmux.c > index 12eb79c..fec2df9 100644 > --- a/arch/arm/mach-exynos/pinmux.c > +++ b/arch/arm/mach-exynos/pinmux.c > @@ -506,6 +506,9 @@ static int exynos5_pinmux_config(int peripheral, int > flags) >*/ > gpio_set_pull(EXYNOS5_GPIO_X07, S5P_GPIO_PULL_NONE); > break; > + case PERIPH_ID_PWM0: > + gpio_cfg_pin(EXYNOS5_GPIO_B20, S5P_GPIO_FUNC(2)); > + break; > default: > debug("%s: invalid peripheral %d", __func__, peripheral); > return -1; > @@ -548,6 +551,9 @@ static int exynos5420_pinmux_config(int peripheral, int > flags) > case PERIPH_ID_I2C10: > exynos5420_i2c_config(peripheral); > break; > + case PERIPH_ID_PWM0: > + gpio_cfg_pin(EXYNOS5420_GPIO_B20, S5P_GPIO_FUNC(2)); > + break; > default: > debug("%s: invalid peripheral %d", __func__, peripheral); > return -1; > Acked-by: Minkyu Kang Thanks, Minkyu Kang. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/2] dts:exynos:update pinctrl size-cells and fix child regs
On 15/01/16 02:17, Simon Glass wrote: > On 12 January 2016 at 07:40, Przemyslaw Marczak wrote: >> This change is required to avoid warnings about invalid >> size-cells defined in device-tree pinctrl nodes for Exynos. >> >> Tested on: >> - Odroid U3 >> - Odroid XU3 >> >> Signed-off-by: Przemyslaw Marczak >> Cc: Stefan Roese >> Cc: Tom Rini >> Cc: Simon Glass >> Cc: Stephen Warren >> Cc: Stephen Warren >> --- >> arch/arm/dts/exynos4210-pinctrl-uboot.dtsi | 8 >> arch/arm/dts/exynos4x12-pinctrl-uboot.dtsi | 18 +- >> arch/arm/dts/exynos5250-pinctrl-uboot.dtsi | 16 >> arch/arm/dts/exynos54xx-pinctrl-uboot.dtsi | 12 ++-- >> arch/arm/dts/s5pc110-pinctrl.dtsi | 4 ++-- >> 5 files changed, 29 insertions(+), 29 deletions(-) > > Tested on snow: > Tested-by: Simon Glass > Acked-by: Simon Glass > > Stephen, I plan to pick this up so please sing out if there is a problem. > > Acked-by: Minkyu Kang Thanks, Minkyu Kang. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] fdt: __of_translate_address(): check parent's 'ranges' before translate
Hello Simon, On 01/14/2016 06:17 PM, Simon Glass wrote: Hi Przemyslaw, Stephen, On 13 January 2016 at 04:10, Przemyslaw Marczak wrote: Hello Stephen, On 01/12/2016 05:43 PM, Stephen Warren wrote: On 01/12/2016 03:25 AM, Przemyslaw Marczak wrote: Hello Stephen, On 01/11/2016 05:47 PM, Stephen Warren wrote: On 01/11/2016 04:21 AM, Przemyslaw Marczak wrote: Hello Stephen, On 01/07/2016 07:25 PM, Stephen Warren wrote: On 01/07/2016 04:40 AM, Przemyslaw Marczak wrote: The present implementation of __of_translate_address() taken from the Linux, is designed for translate bus/child address mappings by using 'ranges' property - and it doesn't allow for checking an address for a device's node with zero size-cells. The 'size-cells > 0' is required for bus/child address mapping, but is not required for non-memory mapped address, e.g.: I2C chip. Then when we need only raw 'reg' property's value. Since the I2C device address goes to a single-cell reg property, support for that case is welcome, but currently calling dev_get_addr() for I2C device will return 'FDT_ADDR_T_NONE', and print the warning: warning: __of_translate_address: Bad cell count for 'some-dev' This patch takes the wrong approach. It simply doesn't make sense to /attempt/ to translate an I2C address into an MMIO address space. It's a nonsensical operation; no such translation is possible under any circumstances because I2C and MMIO addresses mean completely different things and simply can't be translated to each-other. Rather than making this nonsensical operation succeed in a way that gives the desired no-op result, the nonsensical operation simply shouldn't be performed in the first place. Okay, the example with I2C may be little confusing - I could use some general naming convention. However, this patch updates FDT-related code only. In one of your previous e-mails, you well argued that we shouldn't use dev_get_reg() for some buses, since they have a different 'reg' meaning. You are right, using dev_get_addr() as universal function may be nonsensical. Please note, that the present implementation of function: '__of_translate_address()' - allows for 1:1 translation, but only if '#size-cells' exists. So the below case is possible: -- parent { address-cells = <1>; size-cells = <1>; reg = <0x1000 0x1000>; child { reg = <0xa00 0x100>; }; }; dev_get_reg(child) - will return '0xa00' -- If we don't need the address length, we can define: -- parent { address-cells = <1>; size-cells = <0>; reg = <0x1000 0x1000>; child { reg = <0xa00>; }; }; This case won't ever appear in a correctly written DT where reg represents an MMIO address; MMIO addresses always have sizes, and hence can't have size-cells=0. Hence, translating through a DT structures like that is an error case, and shouldn't work. As we found out, the 'reg' property can represent not only MMIO, but may have other meaning, Of course. so the above case is possible. Yes and no. That DT snippet is certainly possible. However, that's irrelevant to whether address translation should be attempted across that boundary. *That* is not legal and should not be attempted. Going through your suggestions I took your side. You are on Cc in the new patchset. > The 'reg' for the parent bus can represent MMIO (depends on what its parent defines) and the child is non-MMIO. Correct. You won't allow to use dev_get_addr() for other than MMIO addresses. Ok, I have no more arguments and no more time. "You" is incorrect. This has absolutely nothing to do with me, but rather the rule is imposed by the semantics of device tree. Also, I never said that dev_get_addr() must not be used for non-MMIO addresses. In fact, I offered a suggestion to make it work correctly. What I actually stated is that address translation must not be attempted across boundaries between address spaces, since it is semantically non-sensical. Ok, please don't take it personally:), it was just how I understood your opinion. As you know the specification is not so clean, I thought, that checking the existence of "ranges" in parent node - is enough to provide proper "translation" (or rather choosing the root address space), when size-cells == 0. However, checking this condition is probably not enough, but you didn't provide a device-tree example to give it some light. Also maybe the translation is a bad word here, since we know that it's not MMIO translatable address. For me, this patch is okay. If I call it for I2C chip and it returns the chip address in I2C address space - then I can assume, that this is correct. Since, at present I2C subsystem takes the 'reg' as property's value, it looks that there should be no difference when using modified dev_get_reg(). However the main reason for this change was not I2C code update, but fixing E
[U-Boot] [PATCH 2/3] dm: pci: Avoid a memory leak when allocating the ROM
Adjust pci_rom_load() to return an indication of whether it allocated memory or not. Adjust the caller to free it. This fixes a memory leak when PCI_VGA_RAM_IMAGE_START is not used. Reported-by: Tom Rini Signed-off-by: Simon Glass --- drivers/pci/pci_rom.c | 45 + 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/drivers/pci/pci_rom.c b/drivers/pci/pci_rom.c index 2cb81b66..8c83be6 100644 --- a/drivers/pci/pci_rom.c +++ b/drivers/pci/pci_rom.c @@ -129,14 +129,26 @@ static int pci_rom_probe(struct udevice *dev, struct pci_rom_header **hdrp) return 0; } -int pci_rom_load(struct pci_rom_header *rom_header, -struct pci_rom_header **ram_headerp) +/** + * pci_rom_load() - Load a ROM image and return a pointer to it + * + * @rom_header:Pointer to ROM image + * @ram_headerp: Returns a pointer to the image in RAM + * @allocedp: Returns true if @ram_headerp was allocated and needs + * to be freed + * @return 0 if OK, -ve on error. Note that @allocedp is set up regardless of + * the error state. Even if this function returns an error, it may have + * allocated memory. + */ +static int pci_rom_load(struct pci_rom_header *rom_header, + struct pci_rom_header **ram_headerp, bool *allocedp) { struct pci_rom_data *rom_data; unsigned int rom_size; unsigned int image_size = 0; void *target; + *allocedp = false; do { /* Get next image, until we see an x86 version */ rom_header = (struct pci_rom_header *)((void *)rom_header + @@ -159,6 +171,7 @@ int pci_rom_load(struct pci_rom_header *rom_header, target = (void *)malloc(rom_size); if (!target) return -ENOMEM; + *allocedp = true; #endif if (target != rom_header) { ulong start = get_timer(0); @@ -255,7 +268,7 @@ int dm_pci_run_vga_bios(struct udevice *dev, int (*int15_handler)(void), struct pci_child_platdata *pplat = dev_get_parent_platdata(dev); struct pci_rom_header *rom, *ram; int vesa_mode = -1; - bool emulate; + bool emulate, alloced; int ret; /* Only execute VGA ROMs */ @@ -272,12 +285,14 @@ int dm_pci_run_vga_bios(struct udevice *dev, int (*int15_handler)(void), if (ret) return ret; - ret = pci_rom_load(rom, &ram); + ret = pci_rom_load(rom, &ram, &alloced); if (ret) - return ret; + goto err; - if (!board_should_run_oprom(dev)) - return -ENXIO; + if (!board_should_run_oprom(dev)) { + ret = -ENXIO; + goto err; + } #if defined(CONFIG_FRAMEBUFFER_SET_VESA_MODE) && \ defined(CONFIG_FRAMEBUFFER_VESA_MODE) @@ -291,7 +306,8 @@ int dm_pci_run_vga_bios(struct udevice *dev, int (*int15_handler)(void), #else if (!(exec_method & PCI_ROM_ALLOW_FALLBACK)) { printf("BIOS native execution is only available on x86\n"); - return -ENOSYS; + ret = -ENOSYS; + goto err; } emulate = true; #endif @@ -301,7 +317,8 @@ int dm_pci_run_vga_bios(struct udevice *dev, int (*int15_handler)(void), #else if (!(exec_method & PCI_ROM_ALLOW_FALLBACK)) { printf("BIOS emulation not available - see CONFIG_BIOSEMU\n"); - return -ENOSYS; + ret = -ENOSYS; + goto err; } emulate = false; #endif @@ -313,12 +330,12 @@ int dm_pci_run_vga_bios(struct udevice *dev, int (*int15_handler)(void), ret = biosemu_setup(dm_pci_get_bdf(dev), &info); if (ret) - return ret; + goto err; biosemu_set_interrupt_handler(0x15, int15_handler); ret = biosemu_run(dm_pci_get_bdf(dev), (uchar *)ram, 1 << 16, info, true, vesa_mode, &mode_info); if (ret) - return ret; + goto err; #endif } else { #ifdef CONFIG_X86 @@ -329,6 +346,10 @@ int dm_pci_run_vga_bios(struct udevice *dev, int (*int15_handler)(void), #endif } debug("Final vesa mode %#x\n", mode_info.video_mode); + ret = 0; - return 0; +err: + if (alloced) + free(ram); + return ret; } -- 2.6.0.rc2.230.g3dd15c0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/3] dm: pci: Add a 'fall through' comment
For this class it is intended to set up the PCI device, so add a comment to indicate this. This avoids a coverity warning. Reported-by: Tom Rini Signed-off-by: Simon Glass --- drivers/pci/pci_auto.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c index 842eafc..5cfa135 100644 --- a/drivers/pci/pci_auto.c +++ b/drivers/pci/pci_auto.c @@ -375,6 +375,7 @@ int dm_pciauto_config_device(struct udevice *dev) case PCI_CLASS_PROCESSOR_POWERPC: /* an agent or end-point */ debug("PCI AutoConfig: Found PowerPC device\n"); + /* fall through */ default: dm_pciauto_setup_device(dev, 6, pci_mem, pci_prefetch, pci_io, -- 2.6.0.rc2.230.g3dd15c0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 3/3] x86: Fix board init breakage
Commit ecc30663 ("Fix board init code to respect the C runtime environment") breaks x86. This was mentioned on https://patchwork.ozlabs.org/patch/548644 but not addressed. Correct it so that x86 boards boot again. Signed-off-by: Simon Glass --- common/init/board_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/init/board_init.c b/common/init/board_init.c index d98648e..d17bb29 100644 --- a/common/init/board_init.c +++ b/common/init/board_init.c @@ -128,7 +128,7 @@ void board_init_f_init_reserve(ulong base) *ptr++ = 0; #endif /* set GD unless architecture did it already */ -#if !defined(CONFIG_X86) && !defined(CONFIG_ARM) +#if !defined(CONFIG_ARM) arch_setup_gd(gd_ptr); #endif /* next alloc will be higher by one GD plus 16-byte alignment */ -- 2.6.0.rc2.230.g3dd15c0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/3] x86: Fix board init breakage
Hi Tom, On 15 January 2016 at 05:23, Simon Glass wrote: > Commit ecc30663 ("Fix board init code to respect the C runtime environment") > breaks x86. This was mentioned on https://patchwork.ozlabs.org/patch/548644 > but not addressed. Correct it so that x86 boards boot again. > > Signed-off-by: Simon Glass > --- > > common/init/board_init.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/common/init/board_init.c b/common/init/board_init.c > index d98648e..d17bb29 100644 > --- a/common/init/board_init.c > +++ b/common/init/board_init.c > @@ -128,7 +128,7 @@ void board_init_f_init_reserve(ulong base) > *ptr++ = 0; > #endif > /* set GD unless architecture did it already */ > -#if !defined(CONFIG_X86) && !defined(CONFIG_ARM) > +#if !defined(CONFIG_ARM) > arch_setup_gd(gd_ptr); > #endif > /* next alloc will be higher by one GD plus 16-byte alignment */ > -- > 2.6.0.rc2.230.g3dd15c0 > This is a bug fix to fix x86 booting so can you please take this directly? Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/4] eth-raw-os.c: Add cast to bind(2) call
On Fri, Jan 15, 2016 at 11:45:22AM +0800, Bin Meng wrote: > Hi Tom, > > On Tue, Dec 1, 2015 at 6:13 AM, Joe Hershberger > wrote: > > On Sat, Nov 28, 2015 at 7:04 AM, Tom Rini wrote: > >> With more recent gcc versions we otherwise get an error like: > >> note: expected 'const struct sockaddr *' but argument is of type > >> 'struct sockaddr_in *' > >> > >> and the common solution here is to cast, rather than re-work the code. > >> > >> Cc: Joe Hershberger > >> Cc: Simon Glass > >> Signed-off-by: Tom Rini > > > > Acked-by: Joe Hershberger > > I see this patch was assigned to me in patchwork. Patch 2&3 in the > same series were applied by York to fsl-qoriq repo and patch 4 was > applied by you to u-boot/master. So maybe you can apply this patch > directly to u-boot/master? Sure. I think I intended to assign this to Simon instead, sorry. The golden rule about patchwork assignments is I get 'em wrong sometimes, just pass it around if so :) -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/3] dm: pci: Add a 'fall through' comment
On Fri, Jan 15, 2016 at 05:23:21AM -0700, Simon Glass wrote: > For this class it is intended to set up the PCI device, so add a comment to > indicate this. This avoids a coverity warning. > > Reported-by: Tom Rini > > Signed-off-by: Simon Glass Reviewed-by: Tom Rini -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/9] efi_loader: Add PE image loader
On Fri, Jan 15, 2016 at 12:45:46AM +0100, Alexander Graf wrote: > On 26.12.15 17:26, Leif Lindholm wrote: > >> new file mode 100644 > >> index 000..688e177 > >> --- /dev/null > >> +++ b/lib/efi_loader/efi_image_loader.c > >> @@ -0,0 +1,203 @@ > >> +/* > >> + * EFI image loader > >> + * > >> + * based partly on wine code > >> + * > >> + * Copyright (c) 2015 Alexander Graf > >> + * > >> + * This library is free software; you can redistribute it and/or > >> + * modify it under the terms of the GNU Lesser General Public > >> + * License as published by the Free Software Foundation; either > >> + * version 2.1 of the License, or (at your option) any later version. > >> + * > >> + * This library is distributed in the hope that it will be useful, > >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of > >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > >> + * Lesser General Public License for more details. > >> + * > >> + * You should have received a copy of the GNU Lesser General Public > >> + * License along with this library; if not, write to the Free Software > >> + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, > >> USA > >> + * > >> + * SPDX-License-Identifier: LGPL-2.1+ > >> + */ > >> + > >> +#include > >> +#include > >> +#include > >> +#include > >> + > >> +DECLARE_GLOBAL_DATA_PTR; > >> + > >> +#define ROUND_UP(val, round) ((val + (round - 1)) & ~(round - 1)) > >> +#define MB (1024 * 1024) > >> + > >> +const efi_guid_t efi_guid_device_path = DEVICE_PATH_GUID; > >> +const efi_guid_t efi_guid_loaded_image = LOADED_IMAGE_GUID; > >> + > >> +efi_status_t efi_return_handle(void *handle, efi_guid_t *protocol, > >> + void **protocol_interface, void *agent_handle, > >> + void *controller_handle, uint32_t attributes) > >> +{ > >> + *protocol_interface = handle; > >> + return EFI_SUCCESS; > >> +} > >> + > >> +/* > >> + * EFI payloads potentially want to load pretty big images into memory, > >> + * so our small malloc region isn't enough for them. However, they usually > >> + * don't need a smart allocator either. > >> + * > >> + * So instead give them a really dumb one. We just reserve > >> EFI_LOADER_POOL_SIZE > >> + * bytes from 16MB below the malloc region start to give the stack some > >> space. > > > > Is there any chance you could break out the memory allocation and > > memory map management as a separate patch, rather than spread across > > 3,4 and 6? > > Uh, sure, I can try. I'm not sure it'll end up more readable than now > though :). Heh, ok. It was a theory. > > Assigning a specific 128MB pool for LOADER_DATA memory can have > > unexpected side effects. > > Like for example? Like applications running out of memory when there's plenty left in the system. OK, so not "unexpected" unexpected, but "may cause valid programs to break". My initial comment was because I was scratching my head over how GRUB managed to allocate its heap at all. / Leif ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/3] dm: pci: Avoid a memory leak when allocating the ROM
On Fri, Jan 15, 2016 at 05:23:22AM -0700, Simon Glass wrote: > Adjust pci_rom_load() to return an indication of whether it allocated > memory or not. Adjust the caller to free it. This fixes a memory leak > when PCI_VGA_RAM_IMAGE_START is not used. > > Reported-by: Tom Rini > Signed-off-by: Simon Glass Reported-by: Coverity (CID: 134194) Reviewed-by: Tom Rini -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/3] x86: Fix board init breakage
On Fri, Jan 15, 2016 at 05:23:23AM -0700, Simon Glass wrote: > Commit ecc30663 ("Fix board init code to respect the C runtime environment") > breaks x86. This was mentioned on https://patchwork.ozlabs.org/patch/548644 > but not addressed. Correct it so that x86 boards boot again. > > Signed-off-by: Simon Glass Reviewed-by: Tom Rini -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 4/9] efi_loader: Add boot time services
On Fri, Jan 15, 2016 at 01:13:15AM +0100, Alexander Graf wrote: > On 26.12.15 19:09, Leif Lindholm wrote: > >> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c > >> new file mode 100644 > >> index 000..ed95962 > >> --- /dev/null > >> +++ b/lib/efi_loader/efi_boottime.c > >> @@ -0,0 +1,838 @@ > >> +/* > >> + * EFI application boot time services > >> + * ... > >> + > >> +static unsigned long efi_raise_tpl(unsigned long new_tpl) > >> +{ > >> + EFI_ENTRY("0x%lx", new_tpl); > >> + return EFI_EXIT(efi_unsupported(__func__)); > > > > "Unlike other UEFI interface functions, EFI_BOOT_SERVICES.RaiseTPL() > > does not return a status code. Instead, it returns the previous task > > priority level, which is to be restored later with a matching call to > > RestoreTPL()." > > Since we don't do TPLs (or IRQs for that matter), I'll just return 0 here. Sure. > >> +} > >> + > >> +static void efi_restore_tpl(unsigned long old_tpl) > >> +{ > >> + EFI_ENTRY("0x%lx", old_tpl); > >> + EFI_EXIT(efi_unsupported(__func__)); > > > > (void function, nothing to return) > > Yes, hence no return. EFI_EXIT deals with the gd swapping and > efi_unsupported() gives me a nice debug message :). Ah, ok. > >> +static efi_status_t efi_allocate_pages(int type, int memory_type, > >> + unsigned long pages, uint64_t *memory) > >> +{ > >> + u64 len = pages << 12; > >> + efi_status_t r = EFI_SUCCESS; > >> + > >> + EFI_ENTRY("%d, %d, 0x%lx, %p", type, memory_type, pages, memory); > >> + > >> + switch (type) { > >> + case 0: > >> + /* Any page means we can go to efi_alloc */ > >> + *memory = (unsigned long)efi_alloc(len, memory_type); > >> + break; > >> + case 1: > >> + /* Max address */ > >> + if (gd->relocaddr < *memory) { > >> + *memory = (unsigned long)efi_alloc(len, memory_type); > >> + break; > >> + } > >> + r = EFI_UNSUPPORTED; > > > > EFI_OUT_OF_RESOURCES/EFI_NOT_FOUND? > > > >> + break; > >> + case 2: > >> + /* Exact address, grant it. The addr is already in *memory. */ > > > > As far as I can tell, this is why GRUB works. Because it filters > > through the memory map manually, requesting to allocate its heap at an > > exact address in a region of free memory in the UEFI memory map. > > Yes. > > > The key is that EFI_LOADER_MEMORY will be used by applications loaded > > as well as by U-Boot to load applications into. A simple example where > > this could be problematic would be a large(ish) initrd loaded via initrd= > > on kernel (stub loader) command line rather than via GRUB. > > Ah, so here the 128MB limit on the LOADER_DATA section might bite us? Yeah, I think so. > >> + runtime_start = (ulong)&__efi_runtime_start & ~0xfffULL; > >> + runtime_end = ((ulong)&__efi_runtime_stop + 0xfff) & ~0xfffULL; > >> + runtime_len_pages = (runtime_end - runtime_start) >> 12; > >> + runtime_len = runtime_len_pages << 12; > >> + > >> + /* Fill in where normal RAM is (up to U-Boot) */ > >> + efi_memory_map[0].num_pages = gd->relocaddr >> 12; > > > > U-Boot question: is gd->relocaddr always the offset from start of RAM? > > How does this work with gaps in memory map? > > U-Boot always relocates itself at TOM (or at least what we consider TOM > here). gd->relocaddr is the physical address of the start of U-Boot > which is right below TOM. Still ... would need additional handling if memory has holes (like, fitted with multiple DIMMs smaller than the individual memory window reserved for them). Or even on something like Juno, which has 2GB of RAM at 0x00_8000_, and a further 6GB at 0x08_8000_ (I think). > >> +#ifdef CONFIG_SYS_SDRAM_BASE > >> + efi_memory_map[0].physical_start = CONFIG_SYS_SDRAM_BASE; > >> + efi_memory_map[0].virtual_start = CONFIG_SYS_SDRAM_BASE; > >> + efi_memory_map[0].num_pages -= CONFIG_SYS_SDRAM_BASE >> 12; > > #else > > #error "..." > > ? > > If it's not defined, it's 0 :). Make it #if CONFIG_SYS_SDRAM_BASE != 0 for clarity? / Leif ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] Please pull u-boot-rockchip
Hi Tom, This pulls in a few minor fixes, including making jerry build again. The following changes since commit 4edde96111aefac63d6aaca6ba87a90d149e973e: Merge branch 'master' of git://git.denx.de/u-boot-x86 (2016-01-14 21:51:32 -0500) are available in the git repository at: git://git.denx.de/u-boot-rockchip.git for you to fetch changes up to 3c8fb12b77849400ffc04737c113a7acff7d7f18: dm: spi_flash: Allow the uclass to work without printf() (2016-01-15 05:39:27 -0700) Masahiro Yamada (1): MAINTAINERS: add entry for Rockchip Simon Glass (1): dm: spi_flash: Allow the uclass to work without printf() huang lin (1): mmc: rockchip: the non-removable property must point to emmc MAINTAINERS | 6 ++ drivers/mmc/rockchip_dw_mmc.c | 2 ++ drivers/mtd/spi/sf-uclass.c | 8 +++- 3 files changed, 15 insertions(+), 1 deletion(-) Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [U-Boot, v2] Fix GCC format-security errors and convert sprintfs.
On Wed, Dec 30, 2015 at 01:05:58PM +, Ben Whitten wrote: > From: Ben Whitten > > With format-security errors turned on, GCC picks up the use of sprintf with > a format parameter not being a string literal. > > Simple uses of sprintf are also converted to use strcpy. > > Signed-off-by: Ben Whitten > Acked-by: Wolfgang Denk > Reviewed-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [U-Boot,1/4] eth-raw-os.c: Add cast to bind(2) call
On Sat, Nov 28, 2015 at 08:04:40AM -0500, Tom Rini wrote: > With more recent gcc versions we otherwise get an error like: > note: expected 'const struct sockaddr *' but argument is of type > 'struct sockaddr_in *' > > and the common solution here is to cast, rather than re-work the code. > > Cc: Joe Hershberger > Cc: Simon Glass > Signed-off-by: Tom Rini > Reviewed-by: Bin Meng > Acked-by: Joe Hershberger Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [U-Boot,1/3] dm: pci: Add a 'fall through' comment
On Fri, Jan 15, 2016 at 05:23:21AM -0700, Simon Glass wrote: > For this class it is intended to set up the PCI device, so add a comment to > indicate this. This avoids a coverity warning. > > Reported-by: Coverity (CID: 134194) > Signed-off-by: Simon Glass > Reviewed-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [U-Boot, 2/3] dm: pci: Avoid a memory leak when allocating the ROM
On Fri, Jan 15, 2016 at 05:23:22AM -0700, Simon Glass wrote: > Adjust pci_rom_load() to return an indication of whether it allocated > memory or not. Adjust the caller to free it. This fixes a memory leak > when PCI_VGA_RAM_IMAGE_START is not used. > > Reported-by: Coverity (CID: 134194) > Signed-off-by: Simon Glass > Reviewed-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [U-Boot,3/3] x86: Fix board init breakage
On Fri, Jan 15, 2016 at 05:23:23AM -0700, Simon Glass wrote: > Commit ecc30663 ("Fix board init code to respect the C runtime environment") > breaks x86. This was mentioned on https://patchwork.ozlabs.org/patch/548644 > but not addressed. Correct it so that x86 boards boot again. > > Signed-off-by: Simon Glass > Reviewed-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Please pull u-boot-rockchip
On Fri, Jan 15, 2016 at 06:06:04AM -0700, Simon Glass wrote: > Hi Tom, > > This pulls in a few minor fixes, including making jerry build again. > > > The following changes since commit 4edde96111aefac63d6aaca6ba87a90d149e973e: > > Merge branch 'master' of git://git.denx.de/u-boot-x86 (2016-01-14 > 21:51:32 -0500) > > are available in the git repository at: > > git://git.denx.de/u-boot-rockchip.git > > for you to fetch changes up to 3c8fb12b77849400ffc04737c113a7acff7d7f18: > > dm: spi_flash: Allow the uclass to work without printf() (2016-01-15 > 05:39:27 -0700) > Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] igep00x0: Falcon mode
On Thu, Jan 14, 2016 at 12:10:25PM -0500, Tom Rini wrote: > On Thu, Jan 14, 2016 at 01:44:20AM +0100, Ladislav Michl wrote: > > > Implement spl_start_uboot to let Falcon mode work. Also as board comes > > either with 256 or 512MB of memory, fixup fdt before jumping to kernel. > > ATAG support for doing the same is left as an excercise for readers > > loving legacy stuff. > > > > Signed-off-by: Ladislav Michl > > So, I want to hear more about how you're using Falcon mode here. > Usually memory size is corrected as part of the spl export step. Or are > you using the raw fdt coming from the kernel build? Yes, I'm using raw ftd from kernel build. Other posibility is doing some scripting with spl export step and then storing fdt into UBI volume. That would bring in also advantage of taking bootargs into account. However I have prepared whole UBI image with all UBI volumes and then I'm using something like that: flash_erase /dev/mtd0 0 0 writeloader -i MLO -o /dev/mtd0 ubiformat /dev/mtd1 -f root.ubi So, system is booted with initramfs using SD card and NAND is reflashed with new content - ftd manipulation would be done from Linux then. Other possibility is to find a way, how to transfer large file into NAND UBI aware way (without destroying erase counters) and do the same using U-Boot scripting. I didn't look into this way (yet). Proposed patch is the easiest way to fix that isue (I need to do it on thousands of boards, so it has to be automated). Also note, that if you are going to use falcon mode from FAT on SD card you simply cannot move that SD card between boards, as you do not know amount of memory installed. Of course, I do not refuse to do anything better to solve this problem :) As a side note, this solution brings in some more code (libfdt) into SPL, so I'm playing with -flto and -fwole-program a bit. Just in case anyone wants continue (for ARM only and incomplete): diff --git a/Kbuild b/Kbuild index e2e3b29..349ecce 100644 --- a/Kbuild +++ b/Kbuild @@ -30,6 +30,9 @@ define filechk_offsets echo "#endif" ) endef +CFLAGS_REMOVE_asm-offsets.o = -flto +CFLAGS_REMOVE_generic-asm-offsets.o = -flto + # # 1) Generate generic-asm-offsets.h diff --git a/Makefile b/Makefile index aa19cc6..64062a2 100644 --- a/Makefile +++ b/Makefile @@ -331,12 +331,7 @@ include scripts/Kbuild.include # Make variables (CC, etc...) AS = $(CROSS_COMPILE)as -# Always use GNU ld -ifneq ($(shell $(CROSS_COMPILE)ld.bfd -v 2> /dev/null),) -LD = $(CROSS_COMPILE)ld.bfd -else -LD = $(CROSS_COMPILE)ld -endif +LD = $(CROSS_COMPILE)gcc CC = $(CROSS_COMPILE)gcc CPP= $(CC) -E AR = $(CROSS_COMPILE)ar @@ -786,7 +781,7 @@ endif LDFLAGS_u-boot += $(LDFLAGS_FINAL) ifneq ($(CONFIG_SYS_TEXT_BASE),) -LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE) +LDFLAGS_u-boot += -Wl,-Ttext,$(CONFIG_SYS_TEXT_BASE) endif # Normally we fill empty space with 0xff @@ -1178,9 +1173,9 @@ u-boot.elf: u-boot.bin # May be overridden by arch/$(ARCH)/config.mk quiet_cmd_u-boot__ ?= LD $@ cmd_u-boot__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_u-boot) -o $@ \ - -T u-boot.lds $(u-boot-init) \ - --start-group $(u-boot-main) --end-group \ - $(PLATFORM_LIBS) -Map u-boot.map + -Wl,-T,u-boot.lds $(u-boot-init) \ + -Wl,--start-group $(u-boot-main) -Wl,--end-group \ + $(PLATFORM_LIBS) -Wl,-Map,u-boot.map quiet_cmd_smap = GEN common/system_map.o cmd_smap = \ diff --git a/arch/arm/config.mk b/arch/arm/config.mk index 0550225..09fe270 100644 --- a/arch/arm/config.mk +++ b/arch/arm/config.mk @@ -13,7 +13,7 @@ CONFIG_STANDALONE_LOAD_ADDR = 0xc10 endif endif -LDFLAGS_FINAL += --gc-sections +LDFLAGS_FINAL += -Wl,--gc-sections PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections \ -fno-common -ffixed-r9 PLATFORM_RELFLAGS += $(call cc-option, -msoft-float) \ @@ -79,7 +79,7 @@ PLATFORM_LIBS := arch/arm/lib/eabi_compat.o \ endif # needed for relocation -LDFLAGS_u-boot += -pie +LDFLAGS_u-boot += -Wl,-pie # # FIXME: binutils versions < 2.22 have a bug in the assembler where diff --git a/config.mk b/config.mk index b77d589..7c4892c 100644 --- a/config.mk +++ b/config.mk @@ -74,10 +74,10 @@ endif RELFLAGS := $(PLATFORM_RELFLAGS) PLATFORM_CPPFLAGS += $(RELFLAGS) -PLATFORM_CPPFLAGS += -pipe +PLATFORM_CPPFLAGS += -pipe -flto -LDFLAGS += $(PLATFORM_LDFLAGS) -LDFLAGS_FINAL += -Bstatic +LDFLAGS += $(PLATFORM_LDFLAGS) -Wl,--build-id=none -nostdlib -flto +LDFLAGS_FINAL += -Wl,-Bstatic -Wl,-allow-multiple-definition -fwhole-program export PLATFORM_CPPFLAGS export RELFLAGS diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile index 5a6ae00..578cac2 100644 --- a/examples/standalone/Makefile +++ b/examples/standalone/Makefile @@ -60,7 +60,8 @@ $(LIB): $(LIBOBJS) FORCE $(cal
Re: [U-Boot] [PATCH 01/50] dm: clk: Add support for decoding clocks from the device tree
Hi Masahiro, On 14 January 2016 at 03:11, Masahiro Yamada wrote: > Hi Simon, > > > >> @@ -12,6 +12,8 @@ >> #include >> #include >> >> +DECLARE_GLOBAL_DATA_PTR; >> + >> ulong clk_get_rate(struct udevice *dev) >> { >> struct clk_ops *ops = clk_get_ops(dev); >> @@ -62,6 +64,32 @@ int clk_get_id(struct udevice *dev, int args_count, >> uint32_t *args) >> return ops->get_id(dev, args_count, args); >> } >> >> +int clk_get_by_index(struct udevice *dev, int index, struct udevice >> **clk_devp, >> +int *periphp) > > > This function causes NULL pointer access > if called with clk_devp == NULL. Yes, don't do that. Do you think the function comment is unclear? > > > You can decrease the number of arguments > if this function returns periph ID. Right, but how to handle 0? > > >> +{ >> + struct fdtdec_phandle_args args; >> + int ret; >> + >> + ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev->of_offset, >> +"clocks", "#clock-cells", 0, >> index, >> +&args); >> + if (ret) { >> + debug("%s: fdtdec_parse_phandle_with_args failed: err=%d\n", >> + __func__, ret); >> + return ret; >> + } >> + >> + ret = uclass_get_device_by_of_offset(UCLASS_CLK, args.node, >> clk_devp); >> + if (ret) { >> + debug("%s: uclass_get_device_by_of_offset failed: err=%d\n", >> + __func__, ret); >> + return ret; >> + } >> + *periphp = args.args_count > 0 ? args.args[0] : -1; > > > Do you want to let this function fail against #clock-cells == 0? At present it doesn't. That's why I didn't have it return the peripheral ID. What could we return to signify that the function succeeded but there was no peripheral ID? > > > > This code should be compiled only when OF_CONTROL is on. OK, I'll update it once we sort out the above. Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 05/10] dm: spi_flash: Allow the uclass to work without printf()
On 29 December 2015 at 05:22, Simon Glass wrote: > For SPL we don't really need sprintf() and with tiny-printf this is not > available. Allow this to be dropped in SPL when using tiny-printf. > > Signed-off-by: Simon Glass > --- > > drivers/mtd/spi/sf-uclass.c | 8 +++- > 1 file changed, 7 insertions(+), 1 deletion(-) Applied to u-boot-rockchip, as it fixes a build error with Jerry. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [RFC PATCH 6/6] clk: add fixed rate clock driver
Hi Masahiro, On 28 December 2015 at 10:08, Masahiro Yamada wrote: > Hi Simon, > > > 2015-12-28 23:20 GMT+09:00 Simon Glass : >> Hi Masahiro, >> >> On 18 December 2015 at 04:15, Masahiro Yamada >> wrote: >>> This commit intends to implement "fixed-clock" as in Linux. >>> (drivers/clk/clk-fixed-rate.c in Linux) >>> >>> If you need a very simple clock to just provide fixed clock rate >>> like a crystal oscillator, you do not have to write a new driver. >>> This driver can support it. >>> >>> Note: >>> As you see in dts/ directories, fixed clocks are often collected in >>> one container node like this: >>> >>> clocks { >>> refclk_a: refclk_a { >>> #clock-cells = <0>; >>> compatible = "fixed-clock"; >>> clock-frequency = <1000>; >>> }; >>> >>> refclk_b: refclk_b { >>> #clock-cells = <0>; >>> compatible = "fixed-clock"; >>> clock-frequency = <2000>; >>> }; >>> }; >>> >>> This does not work in the current DM of U-Boot, unfortunately. >>> The "clocks" node must have 'compatible = "simple-bus";' or something >>> to bind children. >> >> I suppose we could explicitly probe the children of the 'clocks' node >> somewhere. What do you suggest? > > Sounds reasonable. > > Or, postpone this until somebody urges to implement it. I haven't picked this patch up but would like to. Are you able to respin it? Sorry if you were waiting on me. Sounds good. > > >>> >>> Most of developers would be unhappy about adding such a compatible >>> string only in U-Boot because we generally want to use the same set >>> of device trees beyond projects. >> >> I'm not sure we need to change it, but if we did, we could try to >> upstream the change. > > As you suggest, no change is needed in the core part. > > >>> >>> Signed-off-by: Masahiro Yamada >>> --- >>> >>> I do not understand why we need both .get_rate and .get_periph_rate. >>> >>> I set both in this driver, but I am not sure if I am doing right. >> >> This is to avoid needing a new clock device for every single clock >> divider in the SoC. For example, it is common to have a PLL be used by >> 20-30 devices. In U-Boot we can encode the device number as a >> peripheral ID, Then we can adjust those dividers by settings the >> clock's rate on a per-peripheral basis. Thus we need only one clock >> device instead of 20-30. > > I understand this. The peripheral ID is useful. > (I think this is similar to the of_clk_provider in Linux) > If so, we can only use .get_periph_rate(), and drop .get_rate(). > >> In the case of your clock I think you could return -ENOSYS for >> get_periph_rate(). > > > This is "#clock-cells = <0>" case. > > Maybe, can we use .get_periph_rate() with index == 0 > for .get_rate() ? > > I am not sure if I am understanding correctly... The idea is that the peripheral clock is a child of the main clock (e.g. with a clock enable and a divider). So get_rate(SOME_CLOCK) get_periph_rate(SOME_CLOCK, SOME_PERIPH) They are different clocks, but we avoid needing a device for every peripheral that uses the source clock. > > > >>> +#include >>> +#include >>> +#include >>> + >>> +DECLARE_GLOBAL_DATA_PTR; >>> + >>> +struct clk_fixed_rate { >> >> Perhaps have a _priv suffix so it is clear that this is device-private data? >> >>> + unsigned long fixed_rate; >>> +}; >>> + >>> +#define to_clk_fixed_rate(dev) ((struct clk_fixed_rate *)dev_get_priv(dev)) >> >> Should this be to_priv()? > > OK, they are local in the file, so name space conflict would never happen. > > I took these names from drivers/clk/clk-fixed-rate.c in Linux, though. OK, it's just different from how it is normally done in U-Boot. I think consistency is best. But it's a minor issue, I'll leave it up to you. > > > >>> + >>> +static ulong clk_fixed_get_rate(struct udevice *dev) >>> +{ >>> + return to_clk_fixed_rate(dev)->fixed_rate; >>> +} >>> + >>> +static ulong clk_fixed_get_periph_rate(struct udevice *dev, int ignored) >> >> Don't need this. >> >>> +{ >>> + return to_clk_fixed_rate(dev)->fixed_rate; >>> +} >>> + >>> +const struct clk_ops clk_fixed_rate_ops = { >>> + .get_rate = clk_fixed_get_rate, >>> + .get_periph_rate = clk_fixed_get_periph_rate, >>> + .get_id = clk_get_id_simple, >>> +}; >>> + >>> +static int clk_fixed_rate_probe(struct udevice *dev) >> >> Could be in the ofdata_to_platdata() method if you like. > > > Right. > >>> +{ >>> + to_clk_fixed_rate(dev)->fixed_rate = >>> + fdtdec_get_int(gd->fdt_blob, dev->of_offset, >>> + "clock-frequency", 0); >>> + >>> + return 0; >>> +} >>> + >>> +static const struct udevice_id clk_fixed_rate_match[] = { >>> + { >>> + .compatible = "fixed-clock", >>> + }, >>> + { /* sentinel */ } >>> +}; >>> + >>> +U_BOOT_DRIVER(clk_fixed_rate) = { >>> + .na
Re: [U-Boot] [RESEND PATCH 4/5] clk: add device tree support for clock framework
Hi Masahiro, On 28 December 2015 at 10:06, Masahiro Yamada wrote: > Hi Simon, > > > 2015-12-28 23:20 GMT+09:00 Simon Glass : > drivers/clk/clk-fdt.c | 37 + >>> >>> I think clk_fdt.c is better since we mostly avoid hyphens except for the >>> uclass. > > OK. > > include/clk.h | 20 3 files changed, 58 insertions(+) create mode 100644 drivers/clk/clk-fdt.c diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index 4a6a4a8..5fcdf39 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -6,6 +6,7 @@ # obj-$(CONFIG_CLK) += clk-uclass.o +obj-$(CONFIG_$(SPL_)OF_CONTROL) += clk-fdt.o obj-$(CONFIG_ROCKCHIP_RK3036) += clk_rk3036.o obj-$(CONFIG_ROCKCHIP_RK3288) += clk_rk3288.o obj-$(CONFIG_SANDBOX) += clk_sandbox.o diff --git a/drivers/clk/clk-fdt.c b/drivers/clk/clk-fdt.c new file mode 100644 index 000..fc53157 --- /dev/null +++ b/drivers/clk/clk-fdt.c @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2015 Masahiro Yamada + * + * Device Tree support for clk uclass + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#include +#include +#include + +int fdt_clk_get(const void *fdt, int nodeoffset, int index, + struct udevice **dev) >>> >>> I think this should work using a device rather than a node offset. >>> I've pushed a working tree to u-boot-dm/rockchip-working to show what >>> I mean. > > Looks good to me. > > > >>> Also BTW I implemented your full pinctrl for rockchip in that tree - >>> seems to work well! > > That's good to hear! > >>> The only problem is that init is quite slow. It >>> might be the phandle lookups, I'm not sure. > > I did not realize the slowness, at least on my board. > I enable D-cache on both SPL and U-Boot proper. Yes, and Rockchip should do the same, really. But I think it is worth digging into. I end up with quite a lot of pinconfig devices (maybe 50). I'll see if I can figure it out in the next few weeks. > > > +{ + struct fdtdec_phandle_args clkspec; + struct udevice *clkdev; + int rc; + + rc = fdtdec_parse_phandle_with_args(fdt, nodeoffset, "clocks", + "#clock-cells", 0, index, &clkspec); + if (rc) + return rc; + + rc = uclass_get_device_by_of_offset(UCLASS_CLK, clkspec.node, &clkdev); + if (rc) + return rc; + + rc = clk_get_id(clkdev, clkspec.args_count, clkspec.args); + if (rc < 0) + return rc; + + if (dev) + *dev = clkdev; + + return rc; +} diff --git a/include/clk.h b/include/clk.h index 1efbaf2..518cb47 100644 --- a/include/clk.h +++ b/include/clk.h @@ -121,4 +121,24 @@ static inline int clk_get_id_simple(struct udevice *dev, int args_count, return args_count > 0 ? args[0] : 0; } +#if CONFIG_IS_ENABLED(OF_CONTROL) +/** + * fdt_clk_get() - Get peripheral ID from device tree + * + * @fdt: FDT blob + * @periph:Offset of clock consumer node + * @index: index of a phandle to parse out in "clocks" property + * @dev: if not NULL, filled with pointer of clock provider + * @return peripheral ID, or -ve error code + */ +int fdt_clk_get(const void *fdt, int nodeoffset, int index, + struct udevice **dev); +#else +static inline int fdt_clk_get(const void *fdt, int nodeoffset, int index, + struct udevice **dev); >> >> With a bit more thought, I think the concerns I have are mostly >> cosmetic. This function should be passed a struct udevice rather than >> fdt and nodeoffset, since it can get them itself. Also I'm not keen on >> the fdt_ prefix. Other than that it is similar to the >> clk_get_by_index() that I was fiddling with for rockchip. I think it >> is better to return the periph_id as a return value (as you have) >> rather than a pointer arg (as I did). > > > My main motivation is to use device trees to get clocks, so I do not mind > cosmetic stuff here. > > Yours is simpler and works for me too. > So, shall we replace 03 and 04 with the one in your rockchip branch? > (with modification of the return value) > > If you like, please submit the patch. I am glad to test it. OK I did that, but we need to sort out the return value. See my email on the patch. Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 6/9] efi_loader: Add runtime services
On Fri, Jan 15, 2016 at 01:26:42AM +0100, Alexander Graf wrote: > On 26.12.15 19:33, Leif Lindholm wrote: > >> + .reset_system = (void *)&efi_unimplemented, > > > > "The ResetSystem() function does not return." > > Hrm, I think returning EFI_UNSUPPORTED is still better than while(1) { > }. With the return an OS at least has the chance to fix things up itself. I'm not saying it isn't better, I'm saying it's not compliant - there is no valid return value. I would prefer simply having the pointer set to NULL. / Leif ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 2/2] powerpc/SECURE_BOOT: Add PAMU driver
On Fri, Jan 15, 2016 at 01:38:33PM +0530, Aneesh Bansal wrote: > PAMU driver basic support for usage in Secure Boot. > In secure boot PAMU is not in bypass mode. Hence to use > any peripheral (SEC Job ring in our case), PAMU has to be > configured. > > The Header file pamu.h and few functions in driver have been derived > from Freescale Libos. > > Signed-off-by: Ruchika Gupta > Signed-off-by: Aneesh Bansal > --- > Changes in v2: > Replace the Debug printf() call with debug() [snip] > +#ifdef DEBUG > + printf("sec_addr < end_addr is %llx < %llx\n", sec_addr, > +end_addr); > +#endif No you didn't :) Also, please merge 1/2 and 2/2 together. -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 4/9] efi_loader: Add boot time services
On 15.01.16 14:02, Leif Lindholm wrote: > On Fri, Jan 15, 2016 at 01:13:15AM +0100, Alexander Graf wrote: >> On 26.12.15 19:09, Leif Lindholm wrote: diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c new file mode 100644 index 000..ed95962 --- /dev/null +++ b/lib/efi_loader/efi_boottime.c @@ -0,0 +1,838 @@ +/* + * EFI application boot time services + * > ... + +static unsigned long efi_raise_tpl(unsigned long new_tpl) +{ + EFI_ENTRY("0x%lx", new_tpl); + return EFI_EXIT(efi_unsupported(__func__)); >>> >>> "Unlike other UEFI interface functions, EFI_BOOT_SERVICES.RaiseTPL() >>> does not return a status code. Instead, it returns the previous task >>> priority level, which is to be restored later with a matching call to >>> RestoreTPL()." >> >> Since we don't do TPLs (or IRQs for that matter), I'll just return 0 here. > > Sure. > +} + +static void efi_restore_tpl(unsigned long old_tpl) +{ + EFI_ENTRY("0x%lx", old_tpl); + EFI_EXIT(efi_unsupported(__func__)); >>> >>> (void function, nothing to return) >> >> Yes, hence no return. EFI_EXIT deals with the gd swapping and >> efi_unsupported() gives me a nice debug message :). > > Ah, ok. > +static efi_status_t efi_allocate_pages(int type, int memory_type, + unsigned long pages, uint64_t *memory) +{ + u64 len = pages << 12; + efi_status_t r = EFI_SUCCESS; + + EFI_ENTRY("%d, %d, 0x%lx, %p", type, memory_type, pages, memory); + + switch (type) { + case 0: + /* Any page means we can go to efi_alloc */ + *memory = (unsigned long)efi_alloc(len, memory_type); + break; + case 1: + /* Max address */ + if (gd->relocaddr < *memory) { + *memory = (unsigned long)efi_alloc(len, memory_type); + break; + } + r = EFI_UNSUPPORTED; >>> >>> EFI_OUT_OF_RESOURCES/EFI_NOT_FOUND? >>> + break; + case 2: + /* Exact address, grant it. The addr is already in *memory. */ >>> >>> As far as I can tell, this is why GRUB works. Because it filters >>> through the memory map manually, requesting to allocate its heap at an >>> exact address in a region of free memory in the UEFI memory map. >> >> Yes. >> >>> The key is that EFI_LOADER_MEMORY will be used by applications loaded >>> as well as by U-Boot to load applications into. A simple example where >>> this could be problematic would be a large(ish) initrd loaded via initrd= >>> on kernel (stub loader) command line rather than via GRUB. >> >> Ah, so here the 128MB limit on the LOADER_DATA section might bite us? > > Yeah, I think so. > + runtime_start = (ulong)&__efi_runtime_start & ~0xfffULL; + runtime_end = ((ulong)&__efi_runtime_stop + 0xfff) & ~0xfffULL; + runtime_len_pages = (runtime_end - runtime_start) >> 12; + runtime_len = runtime_len_pages << 12; + + /* Fill in where normal RAM is (up to U-Boot) */ + efi_memory_map[0].num_pages = gd->relocaddr >> 12; >>> >>> U-Boot question: is gd->relocaddr always the offset from start of RAM? >>> How does this work with gaps in memory map? >> >> U-Boot always relocates itself at TOM (or at least what we consider TOM >> here). gd->relocaddr is the physical address of the start of U-Boot >> which is right below TOM. > > Still ... would need additional handling if memory has holes (like, > fitted with multiple DIMMs smaller than the individual memory window > reserved for them). Or even on something like Juno, which has 2GB of > RAM at 0x00_8000_, and a further 6GB at 0x08_8000_ (I think). Yes. I think we'll have to just implement that when we hit the first board that does this (and has awareness in U-Boot for it). With the UEFI entry path, Linux will ignore memory nodes in dt, right? > +#ifdef CONFIG_SYS_SDRAM_BASE + efi_memory_map[0].physical_start = CONFIG_SYS_SDRAM_BASE; + efi_memory_map[0].virtual_start = CONFIG_SYS_SDRAM_BASE; + efi_memory_map[0].num_pages -= CONFIG_SYS_SDRAM_BASE >> 12; >>> #else >>> #error "..." >>> ? >> >> If it's not defined, it's 0 :). > > Make it > #if CONFIG_SYS_SDRAM_BASE != 0 > for clarity? I really don't think we'll make it more readable with more #iffery here :). Alex ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 6/9] efi_loader: Add runtime services
On 15.01.16 14:52, Leif Lindholm wrote: > On Fri, Jan 15, 2016 at 01:26:42AM +0100, Alexander Graf wrote: >> On 26.12.15 19:33, Leif Lindholm wrote: + .reset_system = (void *)&efi_unimplemented, >>> >>> "The ResetSystem() function does not return." >> >> Hrm, I think returning EFI_UNSUPPORTED is still better than while(1) { >> }. With the return an OS at least has the chance to fix things up itself. > > I'm not saying it isn't better, I'm saying it's not compliant - there > is no valid return value. I would prefer simply having the pointer set > to NULL. Is a NULL function pointer valid here? Alex ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 4/9] efi_loader: Add boot time services
On Fri, Jan 15, 2016 at 03:14:54PM +0100, Alexander Graf wrote: > On 15.01.16 14:02, Leif Lindholm wrote: > >>> U-Boot question: is gd->relocaddr always the offset from start of RAM? > >>> How does this work with gaps in memory map? > >> > >> U-Boot always relocates itself at TOM (or at least what we consider TOM > >> here). gd->relocaddr is the physical address of the start of U-Boot > >> which is right below TOM. > > > > Still ... would need additional handling if memory has holes (like, > > fitted with multiple DIMMs smaller than the individual memory window > > reserved for them). Or even on something like Juno, which has 2GB of > > RAM at 0x00_8000_, and a further 6GB at 0x08_8000_ (I think). > > Yes. I think we'll have to just implement that when we hit the first > board that does this (and has awareness in U-Boot for it). Yeah, sure. > With the UEFI entry path, Linux will ignore memory nodes in dt, right? Yep. > +#ifdef CONFIG_SYS_SDRAM_BASE > +efi_memory_map[0].physical_start = CONFIG_SYS_SDRAM_BASE; > +efi_memory_map[0].virtual_start = CONFIG_SYS_SDRAM_BASE; > +efi_memory_map[0].num_pages -= CONFIG_SYS_SDRAM_BASE >> 12; > >>> #else > >>> #error "..." > >>> ? > >> > >> If it's not defined, it's 0 :). > > > > Make it > > #if CONFIG_SYS_SDRAM_BASE != 0 > > for clarity? > > I really don't think we'll make it more readable with more #iffery here :). It isn't really the kind of thing I'm here to review, but ... Current version requires knowledge of state of certain macros, the alternative is explicit without familiarity with the codebase. / Leif ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 6/9] efi_loader: Add runtime services
On Fri, Jan 15, 2016 at 03:15:37PM +0100, Alexander Graf wrote: > On 15.01.16 14:52, Leif Lindholm wrote: > >>> "The ResetSystem() function does not return." > >> > >> Hrm, I think returning EFI_UNSUPPORTED is still better than while(1) { > >> }. With the return an OS at least has the chance to fix things up itself. > > > > I'm not saying it isn't better, I'm saying it's not compliant - there > > is no valid return value. I would prefer simply having the pointer set > > to NULL. > > Is a NULL function pointer valid here? More than returning is. / Leif ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] x86: Bay Trail support with W83627DHG
Hi Simon, Hi Bin! I'm currently busy with porting U-Boot to a Bay Trail board. Equipped with an Intel Atom E3845 and additionally the Nuvoton / Winbond W83627DHG Super IO chip. My staring point for this port is the Minnowboard MAX, which works very well btw. I've used the same binaries as described in the README.x86 as on the MinnowMAX for this new Bay Trail board. But am not able yet to see any output on the DEBUG_UART. Bin, you already mentioned in a previous mail, that I need to enable the legacy UART in the Super IO chip for this. I've started adding a small driver for this, similar to the one you've introduced for the SMSC: --< #define WINBOND_ENTRY_KEY 0x87 #define WINBOND_EXIT_KEY0xAA /* Enable configuration: pass entry key '0x87' into index port dev. */ static void pnp_enter_conf_state(u16 dev) { u16 port = dev >> 8; outb(WINBOND_ENTRY_KEY, port); outb(WINBOND_ENTRY_KEY, port); } /* Disable configuration: pass exit key '0xAA' into index port dev. */ static void pnp_exit_conf_state(u16 dev) { u16 port = dev >> 8; outb(WINBOND_EXIT_KEY, port); } /* Bring up early serial debugging output before the RAM is initialized. */ void winbond_enable_serial(uint dev, uint iobase, uint irq) { pnp_enter_conf_state(dev); pnp_set_logical_device(dev); pnp_set_enable(dev, 0); pnp_set_iobase(dev, PNP_IDX_IO0, iobase); pnp_set_irq(dev, PNP_IDX_IRQ0, irq); pnp_set_enable(dev, 1); pnp_exit_conf_state(dev); } --< This is called via: --< /* I/O address of Winbond Super IO chip */ #define WINBOND_IO_PORT 0x2e /* Logical device number */ #define W83627DHG_SP1 2 /* Com1 */ winbond_enable_serial(PNP_DEV(WINBOND_IO_PORT, W83627DHG_SP1), UART0_BASE, UART0_IRQ); --< As you may notice, this is ported from coreboot. But still, this is not enough to get some output on the UART. Debugging (without JTAG debugger and without DEBUG_UART but with POST output) shows, that the board hangs somewhere in the FSP code. When called via fsp_init(). POST shows 0x2A in this case. And FSP does not return to fsp_continue() at all. Do you have any hints what could be missing for the DEBUG UART to work on this board? Or what might cause the board to hang in the FSP code? Or what the meaning of the FSP 0x2A POST code is? Thanks, Stefan ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v4 5/6] rockchip: kylin: Enable boot with android boot image
On Fri, Jan 15, 2016 at 10:20:43AM +0800, Jeffy Chen wrote: > Hi Tom, > > On 2016-1-15 8:59, Tom Rini wrote: > >On Fri, Jan 15, 2016 at 08:53:06AM +0800, Jeffy Chen wrote: > >>Hi Tom, > >> > >>On 2016-1-15 0:22, Tom Rini wrote: > >>>On Thu, Jan 14, 2016 at 10:31:34AM +0800, Jeffy Chen wrote: > Hi Tom, > > On 2016-1-13 23:28, Tom Rini wrote: > >On Wed, Jan 13, 2016 at 04:53:19PM +0800, Jeffy Chen wrote: > > > >>The android kernel is using appended dtb by default, and store > >>ramdisk right after kernel & dtb. > >>So we needs to relocate ramdisk, and use atags to pass params. > >> > >>Signed-off-by: Jeffy Chen > >>Acked-by: Simon Glass > >>--- > >> > >>Changes in v4: None > >>Changes in v3: None > >>Changes in v2: None > >> > >> include/configs/kylin_rk3036.h | 23 +++ > >> 1 file changed, 23 insertions(+) > >> > >>diff --git a/include/configs/kylin_rk3036.h > >>b/include/configs/kylin_rk3036.h > >>index b750b26..49997ec 100644 > >>--- a/include/configs/kylin_rk3036.h > >>+++ b/include/configs/kylin_rk3036.h > >>@@ -35,6 +35,29 @@ > >> #undef CONFIG_EXTRA_ENV_SETTINGS > >> #define CONFIG_EXTRA_ENV_SETTINGS \ > >>"partitions=" PARTS_DEFAULT \ > >>+ "mmcdev=0\0" \ > >>+ "mmcpart=5\0" \ > >>+ "loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \ > >>+ > >>+#define CONFIG_ANDROID_BOOT_IMAGE > >>+#define CONFIG_SYS_BOOT_RAMDISK_HIGH > >This should already be set. > Right, i'll remove it... > >>+#define CONFIG_SYS_HUSH_PARSER > >>+ > >>+#undef CONFIG_BOOTCOMMAND > >>+#define CONFIG_BOOTCOMMAND \ > >>+ "mmc dev ${mmcdev}; if mmc rescan; then " \ > >>+ "part start mmc ${mmcdev} ${mmcpart} boot_start;" \ > >>+ "part size mmc ${mmcdev} ${mmcpart} boot_size;" \ > >>+ "mmc read ${loadaddr} ${boot_start} ${boot_size};" \ > >>+ "bootm start ${loadaddr}; bootm ramdisk;" \ > >>+ "bootm prep; bootm go;" \ > >>+ "fi;" \ > >>+ > >>+/* Enable atags */ > >>+#define CONFIG_SYS_BOOTPARAMS_LEN (64*1024) > >>+#define CONFIG_INITRD_TAG > >>+#define CONFIG_SETUP_MEMORY_TAGS > >>+#define CONFIG_CMDLINE_TAG > >But I'm confused as to what exactly is going on here. Appended dtb is > >not the same as ATAGS. And you shouldn't need to split up bootm like > >that. Can you please explain a bit more? Thanks! > The u-boot will pass atags to kernel, and kernel will merge those > atags into the appended dtb(fdt). > > The default bootm flow would not pass ramdisk state, but we need it, > so we should add this state into default flow, or just use split > bootm cmds :) > >>>That seems very strange. Is the ramdisk concatenated with the kernel > >>>and dtb as well (and that's why bootm ramdisk somehow finds it but > >>>normal bootm doesn't as you aren't passing in a ramdisk address) ? > >>Yes, the ramdisk concatenated with the kernel and dtb as > >>well(u-boot/include/android_image.h: struct andr_img_hdr). > >> > >>And the normal bootm cmd would find it by parsing andr_img_hdr struct. > >>But we still need bootm ramdisk state, because it will call > >>boot_ramdisk_high to relocate ramdisk area :) > >> > >>I found if not relocate it to somewhere else, it would be corrupted > >>after kernel's decompressing(during update fdt area). > >So 'bootm $loadaddr' of an Android image sees, but does not relocate the > >ramdisk that is included in the image, but bootm ramdisk does? That > >sounds like a bug in the regular bootm handling. > Yep, the default bootm flow would not contain ramdisk relocate state: > > vi common/cmd_bootm.c > return do_bootm_states(cmdtp, flag, argc, argv, BOOTM_STATE_START | > BOOTM_STATE_FINDOS | BOOTM_STATE_FINDOTHER | > BOOTM_STATE_LOADOS | > #if defined(CONFIG_PPC) || defined(CONFIG_MIPS) > BOOTM_STATE_OS_CMDLINE | > #endif > BOOTM_STATE_OS_PREP | BOOTM_STATE_OS_FAKE_GO | > BOOTM_STATE_OS_GO, &images, 1); > > But i'm not sure if it's ok to add it here... Actually, maybe so. This made me do some digging again back into Simon's series that refactored the bootm code. In the long long ago, nearly every architecture would call bootm_ramdisk_high to relocate the ramdisk and set the environment (and poke the DT). But it wasn't always clear when / why it would do this. And it got consolidated. And here's where it's tricky. It looks correct today, still, to make sure that we relocate the ramdisk. image_setup_linux() checks IMAGE_ENABLE_RAMDISK_HIGH which is toggled by CONFIG_SYS_BOOT_RAMDISK_HIGH. But for example, MIPS whacked _back_ in a local call to make sure the ramdisk was being relocated because it wasn't back in 2014 into boot_prep_linux. It may
Re: [U-Boot] Broken: U-Boot SPL 2016.01
On Fri, Jan 15, 2016 at 12:32:04AM +0100, Peter Kümmel wrote: > > > Am 14.01.2016 um 22:49 schrieb Tom Rini: > >On Thu, Jan 14, 2016 at 10:29:44PM +0100, Peter Kümmel wrote: > > > >>In 2016.01 SPL is broken on an omap board with DM3730: > >> > >>U-Boot SPL 2016.01-00076-g72128b2 (Jan 14 2016 - 22:07:33) > >>wrong hwadapnr: 1075903588 > > > >Seems like gd isn't pointing in the right place or looking at garbage or > >something. > > > > After disabling CONFIG_EXPERT (and implicitly > CONFIG_SYS_MALLOC_CLEAR_ON_INIT) it works again. > > Seems with for a GCC update from 5.2 to 5.3 this flag is very critical. To be clear, disabling or enabling CONFIG_SYS_MALLOC_CLEAR_ON_INIT ? -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v4 5/6] MIPS: implement bit manipulating I/O accessors
Add support for functions clrbits_X(), setbits_X() and clrsetbits_X() on MIPS. Signed-off-by: Daniel Schwierzeck --- @Wills, after rebasing my own SoC code to this series and trying to use the new accessors I've hit the same problems with endianess in a driver. My drivers have to support Big and Little Endian, thus I have to use __raw_readX/__raw_writeX. So I also added variants of the new accessors without swapping and a similar behaviour as __raw_readX/__raw_writeX. This should address your concers too. Changes in v4: - added clrbits_X(), setbits_X() and clrsetbits_X() variants without endianess swapping Changes in v3: None Changes in v2: None arch/mips/include/asm/io.h | 55 ++ 1 file changed, 55 insertions(+) diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h index eb06afa..b8ac5a5 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -541,4 +541,59 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags) { } +#define __BUILD_CLRBITS(bwlq, sfx, end, type) \ + \ +static inline void clrbits_##sfx(volatile void __iomem *mem, type clr) \ +{ \ + type __val = __raw_read##bwlq(mem); \ + __val = end##_to_cpu(__val);\ + __val &= ~clr; \ + __val = cpu_to_##end(__val);\ + __raw_write##bwlq(__val, mem); \ +} + +#define __BUILD_SETBITS(bwlq, sfx, end, type) \ + \ +static inline void setbits_##sfx(volatile void __iomem *mem, type set) \ +{ \ + type __val = __raw_read##bwlq(mem); \ + __val = end##_to_cpu(__val);\ + __val |= set; \ + __val = cpu_to_##end(__val);\ + __raw_write##bwlq(__val, mem); \ +} + +#define __BUILD_CLRSETBITS(bwlq, sfx, end, type) \ + \ +static inline void clrsetbits_##sfx(volatile void __iomem *mem, \ + type clr, type set) \ +{ \ + type __val = __raw_read##bwlq(mem); \ + __val = end##_to_cpu(__val);\ + __val &= ~clr; \ + __val |= set; \ + __val = cpu_to_##end(__val);\ + __raw_write##bwlq(__val, mem); \ +} + +#define BUILD_CLRSETBITS(bwlq, sfx, end, type) \ + \ +__BUILD_CLRBITS(bwlq, sfx, end, type) \ +__BUILD_SETBITS(bwlq, sfx, end, type) \ +__BUILD_CLRSETBITS(bwlq, sfx, end, type) + +#define __to_cpu(v)(v) +#define cpu_to__(v)(v) + +BUILD_CLRSETBITS(b, 8, _, u8) +BUILD_CLRSETBITS(w, le16, le16, u16) +BUILD_CLRSETBITS(w, be16, be16, u16) +BUILD_CLRSETBITS(w, 16, _, u16) +BUILD_CLRSETBITS(l, le32, le32, u32) +BUILD_CLRSETBITS(l, be32, be32, u32) +BUILD_CLRSETBITS(l, 32, _, u32) +BUILD_CLRSETBITS(q, le64, le64, u64) +BUILD_CLRSETBITS(q, be64, be64, u64) +BUILD_CLRSETBITS(q, 64, _, u64) + #endif /* _ASM_IO_H */ -- 2.5.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v4 5/6] rockchip: kylin: Enable boot with android boot image
Am Freitag, den 15.01.2016, 09:42 -0500 schrieb Tom Rini: > On Fri, Jan 15, 2016 at 10:20:43AM +0800, Jeffy Chen wrote: > > Hi Tom, > > > > On 2016-1-15 8:59, Tom Rini wrote: > > > On Fri, Jan 15, 2016 at 08:53:06AM +0800, Jeffy Chen wrote: > > > > Hi Tom, > > > > > > > > On 2016-1-15 0:22, Tom Rini wrote: > > > > > On Thu, Jan 14, 2016 at 10:31:34AM +0800, Jeffy Chen wrote: > > > > > > Hi Tom, > > > > > > > > > > > > On 2016-1-13 23:28, Tom Rini wrote: > > > > > > > On Wed, Jan 13, 2016 at 04:53:19PM +0800, Jeffy Chen > > > > > > > wrote: > > > > > > > > > > > > > > > The android kernel is using appended dtb by default, > > > > > > > > and store > > > > > > > > ramdisk right after kernel & dtb. > > > > > > > > So we needs to relocate ramdisk, and use atags to pass > > > > > > > > params. > > > > > > > > > > > > > > > > Signed-off-by: Jeffy Chen > > > > > > > > Acked-by: Simon Glass > > > > > > > > --- > > > > > > > > > > > > > > > > Changes in v4: None > > > > > > > > Changes in v3: None > > > > > > > > Changes in v2: None > > > > > > > > > > > > > > > > include/configs/kylin_rk3036.h | 23 > > > > > > > > +++ > > > > > > > > 1 file changed, 23 insertions(+) > > > > > > > > > > > > > > > > diff --git a/include/configs/kylin_rk3036.h > > > > > > > > b/include/configs/kylin_rk3036.h > > > > > > > > index b750b26..49997ec 100644 > > > > > > > > --- a/include/configs/kylin_rk3036.h > > > > > > > > +++ b/include/configs/kylin_rk3036.h > > > > > > > > @@ -35,6 +35,29 @@ > > > > > > > > #undef CONFIG_EXTRA_ENV_SETTINGS > > > > > > > > #define CONFIG_EXTRA_ENV_SETTINGS \ > > > > > > > > "partitions=" PARTS_DEFAULT \ > > > > > > > > + "mmcdev=0\0" \ > > > > > > > > + "mmcpart=5\0" \ > > > > > > > > + "loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) > > > > > > > > "\0" \ > > > > > > > > + > > > > > > > > +#define CONFIG_ANDROID_BOOT_IMAGE > > > > > > > > +#define CONFIG_SYS_BOOT_RAMDISK_HIGH > > > > > > > This should already be set. > > > > > > Right, i'll remove it... > > > > > > > > +#define CONFIG_SYS_HUSH_PARSER > > > > > > > > + > > > > > > > > +#undef CONFIG_BOOTCOMMAND > > > > > > > > +#define CONFIG_BOOTCOMMAND \ > > > > > > > > + "mmc dev ${mmcdev}; if mmc rescan; then " \ > > > > > > > > + "part start mmc ${mmcdev} ${mmcpart} > > > > > > > > boot_start;" \ > > > > > > > > + "part size mmc ${mmcdev} ${mmcpart} > > > > > > > > boot_size;" \ > > > > > > > > + "mmc read ${loadaddr} ${boot_start} > > > > > > > > ${boot_size};" \ > > > > > > > > + "bootm start ${loadaddr}; bootm > > > > > > > > ramdisk;" \ > > > > > > > > + "bootm prep; bootm go;" \ > > > > > > > > + "fi;" \ > > > > > > > > + > > > > > > > > +/* Enable atags */ > > > > > > > > +#define CONFIG_SYS_BOOTPARAMS_LEN (64*1024) > > > > > > > > +#define CONFIG_INITRD_TAG > > > > > > > > +#define CONFIG_SETUP_MEMORY_TAGS > > > > > > > > +#define CONFIG_CMDLINE_TAG > > > > > > > But I'm confused as to what exactly is going on here. > > > > > > > Appended dtb is > > > > > > > not the same as ATAGS. And you shouldn't need to split > > > > > > > up bootm like > > > > > > > that. Can you please explain a bit more? Thanks! > > > > > > The u-boot will pass atags to kernel, and kernel will merge > > > > > > those > > > > > > atags into the appended dtb(fdt). > > > > > > > > > > > > The default bootm flow would not pass ramdisk state, but we > > > > > > need it, > > > > > > so we should add this state into default flow, or just use > > > > > > split > > > > > > bootm cmds :) > > > > > That seems very strange. Is the ramdisk concatenated with > > > > > the kernel > > > > > and dtb as well (and that's why bootm ramdisk somehow finds > > > > > it but > > > > > normal bootm doesn't as you aren't passing in a ramdisk > > > > > address) ? > > > > Yes, the ramdisk concatenated with the kernel and dtb as > > > > well(u-boot/include/android_image.h: struct andr_img_hdr). > > > > > > > > And the normal bootm cmd would find it by parsing andr_img_hdr > > > > struct. > > > > But we still need bootm ramdisk state, because it will call > > > > boot_ramdisk_high to relocate ramdisk area :) > > > > > > > > I found if not relocate it to somewhere else, it would be > > > > corrupted > > > > after kernel's decompressing(during update fdt area). > > > So 'bootm $loadaddr' of an Android image sees, but does not > > > relocate the > > > ramdisk that is included in the image, but bootm ramdisk does? > > > That > > > sounds like a bug in the regular bootm handling. > > Yep, the default bootm flow would not contain ramdisk relocate > > state: > > > > vi common/cmd_bootm.c > > return do_bootm_states(cmdtp, flag, argc, argv, > > BOOTM_STATE_START | > > BOOTM_STATE_FINDOS | BOOTM_STATE_FINDOTHER | > > BOOTM_STATE_LOADOS | > > #if defined(CONFIG_PPC) || defined(CONFIG_MIPS) > > BOOT
Re: [U-Boot] [PATCH] fdt: __of_translate_address(): check parent's 'ranges' before translate
On 01/15/2016 03:41 AM, Przemyslaw Marczak wrote: Hello Simon, On 01/14/2016 06:17 PM, Simon Glass wrote: Hi Przemyslaw, Stephen, On 13 January 2016 at 04:10, Przemyslaw Marczak wrote: Hello Stephen, On 01/12/2016 05:43 PM, Stephen Warren wrote: On 01/12/2016 03:25 AM, Przemyslaw Marczak wrote: Hello Stephen, On 01/11/2016 05:47 PM, Stephen Warren wrote: On 01/11/2016 04:21 AM, Przemyslaw Marczak wrote: Hello Stephen, On 01/07/2016 07:25 PM, Stephen Warren wrote: On 01/07/2016 04:40 AM, Przemyslaw Marczak wrote: The present implementation of __of_translate_address() taken from the Linux, is designed for translate bus/child address mappings by using 'ranges' property - and it doesn't allow for checking an address for a device's node with zero size-cells. The 'size-cells > 0' is required for bus/child address mapping, but is not required for non-memory mapped address, e.g.: I2C chip. Then when we need only raw 'reg' property's value. Since the I2C device address goes to a single-cell reg property, support for that case is welcome, but currently calling dev_get_addr() for I2C device will return 'FDT_ADDR_T_NONE', and print the warning: warning: __of_translate_address: Bad cell count for 'some-dev' This patch takes the wrong approach. It simply doesn't make sense to /attempt/ to translate an I2C address into an MMIO address space. It's a nonsensical operation; no such translation is possible under any circumstances because I2C and MMIO addresses mean completely different things and simply can't be translated to each-other. Rather than making this nonsensical operation succeed in a way that gives the desired no-op result, the nonsensical operation simply shouldn't be performed in the first place. Okay, the example with I2C may be little confusing - I could use some general naming convention. However, this patch updates FDT-related code only. In one of your previous e-mails, you well argued that we shouldn't use dev_get_reg() for some buses, since they have a different 'reg' meaning. You are right, using dev_get_addr() as universal function may be nonsensical. Please note, that the present implementation of function: '__of_translate_address()' - allows for 1:1 translation, but only if '#size-cells' exists. So the below case is possible: -- parent { address-cells = <1>; size-cells = <1>; reg = <0x1000 0x1000>; child { reg = <0xa00 0x100>; }; }; dev_get_reg(child) - will return '0xa00' -- If we don't need the address length, we can define: -- parent { address-cells = <1>; size-cells = <0>; reg = <0x1000 0x1000>; child { reg = <0xa00>; }; }; This case won't ever appear in a correctly written DT where reg represents an MMIO address; MMIO addresses always have sizes, and hence can't have size-cells=0. Hence, translating through a DT structures like that is an error case, and shouldn't work. As we found out, the 'reg' property can represent not only MMIO, but may have other meaning, Of course. so the above case is possible. Yes and no. That DT snippet is certainly possible. However, that's irrelevant to whether address translation should be attempted across that boundary. *That* is not legal and should not be attempted. Going through your suggestions I took your side. You are on Cc in the new patchset. > The 'reg' for the parent bus can represent MMIO (depends on what its parent defines) and the child is non-MMIO. Correct. You won't allow to use dev_get_addr() for other than MMIO addresses. Ok, I have no more arguments and no more time. "You" is incorrect. This has absolutely nothing to do with me, but rather the rule is imposed by the semantics of device tree. Also, I never said that dev_get_addr() must not be used for non-MMIO addresses. In fact, I offered a suggestion to make it work correctly. What I actually stated is that address translation must not be attempted across boundaries between address spaces, since it is semantically non-sensical. Ok, please don't take it personally:), it was just how I understood your opinion. As you know the specification is not so clean, I thought, that checking the existence of "ranges" in parent node - is enough to provide proper "translation" (or rather choosing the root address space), when size-cells == 0. However, checking this condition is probably not enough, but you didn't provide a device-tree example to give it some light. Also maybe the translation is a bad word here, since we know that it's not MMIO translatable address. For me, this patch is okay. If I call it for I2C chip and it returns the chip address in I2C address space - then I can assume, that this is correct. Since, at present I2C subsystem takes the 'reg' as property's value, it looks that there should be no difference when using modified dev_get_reg(). However the main reason fo
Re: [U-Boot] [PATCH 4/9] efi_loader: Add boot time services
On 15.01.16 15:21, Leif Lindholm wrote: > On Fri, Jan 15, 2016 at 03:14:54PM +0100, Alexander Graf wrote: >> On 15.01.16 14:02, Leif Lindholm wrote: > U-Boot question: is gd->relocaddr always the offset from start of RAM? > How does this work with gaps in memory map? U-Boot always relocates itself at TOM (or at least what we consider TOM here). gd->relocaddr is the physical address of the start of U-Boot which is right below TOM. >>> >>> Still ... would need additional handling if memory has holes (like, >>> fitted with multiple DIMMs smaller than the individual memory window >>> reserved for them). Or even on something like Juno, which has 2GB of >>> RAM at 0x00_8000_, and a further 6GB at 0x08_8000_ (I think). >> >> Yes. I think we'll have to just implement that when we hit the first >> board that does this (and has awareness in U-Boot for it). > > Yeah, sure. > >> With the UEFI entry path, Linux will ignore memory nodes in dt, right? > > Yep. > >> +#ifdef CONFIG_SYS_SDRAM_BASE >> +efi_memory_map[0].physical_start = CONFIG_SYS_SDRAM_BASE; >> +efi_memory_map[0].virtual_start = CONFIG_SYS_SDRAM_BASE; >> +efi_memory_map[0].num_pages -= CONFIG_SYS_SDRAM_BASE >> 12; > #else > #error "..." > ? If it's not defined, it's 0 :). >>> >>> Make it >>> #if CONFIG_SYS_SDRAM_BASE != 0 >>> for clarity? >> >> I really don't think we'll make it more readable with more #iffery here :). > > It isn't really the kind of thing I'm here to review, but ... > Current version requires knowledge of state of certain macros, the > alternative is explicit without familiarity with the codebase. Hrm. So how about a comment like this: /* RAM starts at an offset above 0 */ right before the #ifdef? Alex ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Enable snooping on transactions from CAAM block
On 01/15/2016 12:11 AM, Aneesh Bansal wrote: > To enable snooping on CAAM transactions following programmign is done > > 1. Enable core snooping (CCI interface, Core is Slave5 on CCI) > This setting is also required for making the system coherent > > 2. CAAM IP lies behind SMMU3 in teh system. Configure SMMU3 to do teh > following: > a) Program SCR to bypass transactions with stream ID other than taht of CAAM > b_ Program S2CR to change memroy attributes of transactions with CAAM's stream > ID (0x10) to cacheable. Multiple typos in commit message. York ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH V4 2/8] test/py: test that sandbox exits when asked
Test the sandbox port's implementation of the reset command and SIGHUP handling. These should both cause the U-Boot process to exit gracefully. Signed-off-by: Stephen Warren Signed-off-by: Stephen Warren Acked-by: Simon Glass --- v4: - No changes. v3: - Move test scripts into a sub-directory. Suggested by Michal Simek. - s/uboot/u[-_]boot/g. Suggested by Simon Glass. - Typo. - s/"/'/g. Suggested by Simon Glass. - Add more documentation. Suggested by Simon Glass. --- test/py/tests/test_sandbox_exit.py | 24 1 file changed, 24 insertions(+) create mode 100644 test/py/tests/test_sandbox_exit.py diff --git a/test/py/tests/test_sandbox_exit.py b/test/py/tests/test_sandbox_exit.py new file mode 100644 index ..2aa8eb4abc68 --- /dev/null +++ b/test/py/tests/test_sandbox_exit.py @@ -0,0 +1,24 @@ +# Copyright (c) 2015 Stephen Warren +# Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. +# +# SPDX-License-Identifier: GPL-2.0 + +import pytest +import signal + +@pytest.mark.boardspec('sandbox') +@pytest.mark.buildconfigspec('reset') +def test_reset(u_boot_console): +'''Test that the "reset" command exits sandbox process.''' + +u_boot_console.run_command('reset', wait_for_prompt=False) +assert(u_boot_console.validate_exited()) +u_boot_console.ensure_spawned() + +@pytest.mark.boardspec('sandbox') +def test_ctrl_c(u_boot_console): +'''Test that sending SIGINT to sandbox causes it to exit.''' + +u_boot_console.kill(signal.SIGINT) +assert(u_boot_console.validate_exited()) +u_boot_console.ensure_spawned() -- 2.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH V4 3/8] test/py: add test of setenv/printenv/echo
This tests basic environment variable functionality. Signed-off-by: Stephen Warren Signed-off-by: Stephen Warren Acked-by: Simon Glass --- v4: - Reformat function-level documentation. v3: - Handle environment values that contain an = sign. Reported by Michal Simek. - Move test scripts into a sub-directory. Suggested by Michal Simek. - s/uboot/u[-_]boot/g. Suggested by Simon Glass. - s/"/'/g. Suggested by Simon Glass. - Add more documentation. Suggested by Simon Glass. - Simplify command string construction. Suggested by Simon Glass. - Move relevant edits to command_ut.c into this patch from a later one. Suggested by Simon Glass. --- test/command_ut.c | 4 - test/py/tests/test_env.py | 221 ++ 2 files changed, 221 insertions(+), 4 deletions(-) create mode 100644 test/py/tests/test_env.py diff --git a/test/command_ut.c b/test/command_ut.c index 926573a39543..c086abe3ed3e 100644 --- a/test/command_ut.c +++ b/test/command_ut.c @@ -20,10 +20,6 @@ static int do_ut_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) printf("%s: Testing commands\n", __func__); run_command("env default -f -a", 0); - /* run a single command */ - run_command("setenv single 1", 0); - assert(!strcmp("1", getenv("single"))); - /* make sure that compound statements work */ #ifdef CONFIG_SYS_HUSH_PARSER run_command("if test -n ${single} ; then setenv check 1; fi", 0); diff --git a/test/py/tests/test_env.py b/test/py/tests/test_env.py new file mode 100644 index ..a3e8dd30330b --- /dev/null +++ b/test/py/tests/test_env.py @@ -0,0 +1,221 @@ +# Copyright (c) 2015 Stephen Warren +# Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. +# +# SPDX-License-Identifier: GPL-2.0 + +# Test operation of shell commands relating to environment variables. + +import pytest + +# FIXME: This might be useful for other tests; +# perhaps refactor it into ConsoleBase or some other state object? +class StateTestEnv(object): +'''Container that represents the state of all U-Boot environment variables. +This enables quick determination of existant/non-existant variable +names. +''' + +def __init__(self, u_boot_console): +'''Initialize a new StateTestEnv object. + +Args: +u_boot_console: A U-Boot console. + +Returns: +Nothing. +''' + +self.u_boot_console = u_boot_console +self.get_env() +self.set_var = self.get_non_existent_var() + +def get_env(self): +'''Read all current environment variables from U-Boot. + +Args: +None. + +Returns: +Nothing. +''' + +response = self.u_boot_console.run_command('printenv') +self.env = {} +for l in response.splitlines(): +if not '=' in l: +continue +(var, value) = l.strip().split('=', 1) +self.env[var] = value + +def get_existent_var(self): +'''Return the name of an environment variable that exists. + +Args: +None. + +Returns: +The name of an environment variable. +''' + +for var in self.env: +return var + +def get_non_existent_var(self): +'''Return the name of an environment variable that does not exist. + +Args: +None. + +Returns: +The name of an environment variable. +''' + +n = 0 +while True: +var = 'test_env_' + str(n) +if var not in self.env: +return var +n += 1 + +@pytest.fixture(scope='module') +def state_test_env(u_boot_console): +'''pytest fixture to provide a StateTestEnv object to tests.''' + +return StateTestEnv(u_boot_console) + +def unset_var(state_test_env, var): +'''Unset an environment variable. + +This both executes a U-Boot shell command and updates a StateTestEnv +object. + +Args: +state_test_env: The StateTestEnv object to updata. +var: The variable name to unset. + +Returns: +Nothing. +''' + +state_test_env.u_boot_console.run_command('setenv %s' % var) +if var in state_test_env.env: +del state_test_env.env[var] + +def set_var(state_test_env, var, value): +'''Set an environment variable. + +This both executes a U-Boot shell command and updates a StateTestEnv +object. + +Args: +state_test_env: The StateTestEnv object to updata. +var: The variable name to set. +value: The value to set the variable to. + +Returns: +Nothing. +''' + +state_test_env.u_boot_console.run_command('setenv %s "%s"' % (var, value)) +state_test_env.env[var] = value + +def validate_empty(state_test_env, var): +'''Validate that a variable is not set, using U-Boot shell commands. + +Args: +var: The variable
[U-Boot] [PATCH V4 4/8] test/py: test the md/mw commands
This tests whether md/mw work, and affect each-other. Command repeat is also tested. test/cmd_repeat.sh is removed, since the new Python-based test does everything it used to. Signed-off-by: Stephen Warren Signed-off-by: Stephen Warren Acked-by: Simon Glass --- v4: - No changes. v3: - Add extra mw during md test to account for the possibility that the test's write data may already be present in RAM. Suggested by Michal Simek. - Move test scripts into a sub-directory. Suggested by Michal Simek. - s/uboot/u[-_]boot/g. Suggested by Simon Glass. - s/"/'/g. Suggested by Simon Glass. - Add more documentation. Suggested by Simon Glass. --- test/cmd_repeat.sh | 29 - test/py/tests/test_md.py | 36 2 files changed, 36 insertions(+), 29 deletions(-) delete mode 100755 test/cmd_repeat.sh create mode 100644 test/py/tests/test_md.py diff --git a/test/cmd_repeat.sh b/test/cmd_repeat.sh deleted file mode 100755 index 990e79900f47.. --- a/test/cmd_repeat.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -# Test for U-Boot cli including command repeat - -BASE="$(dirname $0)" -. $BASE/common.sh - -run_test() { - ./${OUTPUT_DIR}/u-boot <${tmp} -check_results ${tmp} -rm ${tmp} -echo "Test passed" diff --git a/test/py/tests/test_md.py b/test/py/tests/test_md.py new file mode 100644 index ..94603c7df609 --- /dev/null +++ b/test/py/tests/test_md.py @@ -0,0 +1,36 @@ +# Copyright (c) 2015 Stephen Warren +# Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. +# +# SPDX-License-Identifier: GPL-2.0 + +import pytest + +@pytest.mark.buildconfigspec('cmd_memory') +def test_md(u_boot_console): +'''Test that md reads memory as expected, and that memory can be modified +using the mw command.''' + +ram_base = u_boot_console.find_ram_base() +addr = '%08x' % ram_base +val = 'a5f09876' +expected_response = addr + ': ' + val +u_boot_console.run_command('mw ' + addr + ' 0 10') +response = u_boot_console.run_command('md ' + addr + ' 10') +assert(not (expected_response in response)) +u_boot_console.run_command('mw ' + addr + ' ' + val) +response = u_boot_console.run_command('md ' + addr + ' 10') +assert(expected_response in response) + +@pytest.mark.buildconfigspec('cmd_memory') +def test_md_repeat(u_boot_console): +'''Test command repeat (via executing an empty command) operates correctly +for "md"; the command must repeat and dump an incrementing address.''' + +ram_base = u_boot_console.find_ram_base() +addr_base = '%08x' % ram_base +words = 0x10 +addr_repeat = '%08x' % (ram_base + (words * 4)) +u_boot_console.run_command('md %s %x' % (addr_base, words)) +response = u_boot_console.run_command('') +expected_response = addr_repeat + ': ' +assert(expected_response in response) -- 2.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH V4 1/8] test/py: Implement pytest infrastructure
This tool aims to test U-Boot by executing U-Boot shell commands using the console interface. A single top-level script exists to execute or attach to the U-Boot console, run the entire script of tests against it, and summarize the results. Advantages of this approach are: - Testing is performed in the same way a user or script would interact with U-Boot; there can be no disconnect. - There is no need to write or embed test-related code into U-Boot itself. It is asserted that writing test-related code in Python is simpler and more flexible that writing it all in C. - It is reasonably simple to interact with U-Boot in this way. A few simple tests are provided as examples. Soon, we should convert as many as possible of the other tests in test/* and test/cmd_ut.c too. The hook scripts, relay control utilities, and udev rules I use for my own HW setup are published at https://github.com/swarren/uboot-test-hooks. See README.md for more details! Signed-off-by: Stephen Warren Signed-off-by: Stephen Warren Tested-by: Michal Simek Tested-by: Simon Glass Acked-by: Simon Glass #v3 --- Apologies for the resend; I forgot to CC the list last time. v4: - Fix all users after ubspawn -> u_boot_spawn module rename. - Don't escape ^ in the HTML log file. - Fix u_boot_spawn.py Spawn.__init__ to set SIGHUP handler is set to SIG_DFL. This ensures that sandbox responds to SIGHUP when run non- interactively (e.g. under a daemon continuous integration server). - Fix logging of all child processes to make sure that all stdout/err, exit code, and exception data from all processes makes its way to both test stdout (for pytest to log to its stdout in case of error) and the HTML test log. This changed multiplexed_log.py RunAndLog.run() (a fair bit of change) and u_boot_console_exec_attach.py ConseolExecAttach.* (just passing sys.stdout to log.get_runner() everywhere). - Also mention kermit as a possible app to attach to a serial console. - Fix test_version to work correctly when BUILD_TAG is set, which causes U-Boot to print both the version string and BUILD_TAG value at startup, whereas the "version" shell command only prints the version string. - Reformat function-level documentation. v3: - Rework HTML log generation so that TAB characters render as expected. Suggested by Michal Simek. - Move test scripts into a sub-directory. Suggested by Michal Simek. - s/uboot/u[-_]boot/g. Suggested by Simon Glass. - s/"/'/g. Suggested by Simon Glass. - Typo fixes. - Add more documentation. Suggested by Simon Glass. - Make "notes" in the log file be so that their formatting is preserved. This is useful for large notes such as exception dumps. v2: - Many fixes and tweaks have been squashed in. Separated out some of the tests into separate commits, and added some more tests. --- test/py/.gitignore| 1 + test/py/README.md | 300 test/py/conftest.py | 422 test/py/multiplexed_log.css | 88 ++ test/py/multiplexed_log.py| 515 ++ test/py/pytest.ini| 11 + test/py/test.py | 32 +++ test/py/tests/test_000_version.py | 20 ++ test/py/tests/test_help.py| 9 + test/py/tests/test_unknown_cmd.py | 14 + test/py/u_boot_console_base.py| 360 test/py/u_boot_console_exec_attach.py | 65 + test/py/u_boot_console_sandbox.py | 79 ++ test/py/u_boot_spawn.py | 174 14 files changed, 2090 insertions(+) create mode 100644 test/py/.gitignore create mode 100644 test/py/README.md create mode 100644 test/py/conftest.py create mode 100644 test/py/multiplexed_log.css create mode 100644 test/py/multiplexed_log.py create mode 100644 test/py/pytest.ini create mode 100755 test/py/test.py create mode 100644 test/py/tests/test_000_version.py create mode 100644 test/py/tests/test_help.py create mode 100644 test/py/tests/test_unknown_cmd.py create mode 100644 test/py/u_boot_console_base.py create mode 100644 test/py/u_boot_console_exec_attach.py create mode 100644 test/py/u_boot_console_sandbox.py create mode 100644 test/py/u_boot_spawn.py diff --git a/test/py/.gitignore b/test/py/.gitignore new file mode 100644 index ..0d20b6487c61 --- /dev/null +++ b/test/py/.gitignore @@ -0,0 +1 @@ +*.pyc diff --git a/test/py/README.md b/test/py/README.md new file mode 100644 index ..8036299d0735 --- /dev/null +++ b/test/py/README.md @@ -0,0 +1,300 @@ +# U-Boot pytest suite + +## Introduction + +This tool aims to test U-Boot by executing U-Boot shell commands using the +console interface. A single top-level script exists to execute or attach to the +U-Boot console, run the entire script of tests against it, and summarize the +results. Advantages of this approach are: + +- Testing is performed in the same way
[U-Boot] [PATCH V4 5/8] test/py: add test of basic shell functionality
From: Stephen Warren This tests whether the following features of the U-Boot shell: - Execution of a directly entered command. - Compound commands (; delimiter). - Quoting of arguments containing spaces. - Executing commands from environment variables. Signed-off-by: Stephen Warren Acked-by: Simon Glass --- v4: - No changes. v3: - Move test scripts into a sub-directory. Suggested by Michal Simek. - s/uboot/u[-_]boot/g. Suggested by Simon Glass. - s/"/'/g. Suggested by Simon Glass. - Add more documentation. Suggested by Simon Glass. - Move relevant edits to command_ut.c into this patch from a later one. Suggested by Simon Glass. --- test/command_ut.c | 16 --- test/py/tests/test_shell_basics.py | 42 ++ 2 files changed, 42 insertions(+), 16 deletions(-) create mode 100644 test/py/tests/test_shell_basics.py diff --git a/test/command_ut.c b/test/command_ut.c index c086abe3ed3e..43bd2c1771fe 100644 --- a/test/command_ut.c +++ b/test/command_ut.c @@ -27,10 +27,6 @@ static int do_ut_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) run_command("setenv check", 0); #endif - /* commands separated by ; */ - run_command_list("setenv list 1; setenv list ${list}1", -1, 0); - assert(!strcmp("11", getenv("list"))); - /* commands separated by \n */ run_command_list("setenv list 1\n setenv list ${list}1", -1, 0); assert(!strcmp("11", getenv("list"))); @@ -39,11 +35,6 @@ static int do_ut_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) run_command_list("setenv list 1${list}\n", -1, 0); assert(!strcmp("111", getenv("list"))); - /* three commands in a row */ - run_command_list("setenv list 1\n setenv list ${list}2; " - "setenv list ${list}3", -1, 0); - assert(!strcmp("123", getenv("list"))); - /* a command string with \0 in it. Stuff after \0 should be ignored */ run_command("setenv list", 0); run_command_list(test_cmd, sizeof(test_cmd), 0); @@ -62,13 +53,6 @@ static int do_ut_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) assert(run_command_list("false", -1, 0) == 1); assert(run_command_list("echo", -1, 0) == 0); - run_command("setenv foo 'setenv monty 1; setenv python 2'", 0); - run_command("run foo", 0); - assert(getenv("monty") != NULL); - assert(!strcmp("1", getenv("monty"))); - assert(getenv("python") != NULL); - assert(!strcmp("2", getenv("python"))); - #ifdef CONFIG_SYS_HUSH_PARSER run_command("setenv foo 'setenv black 1\nsetenv adder 2'", 0); run_command("run foo", 0); diff --git a/test/py/tests/test_shell_basics.py b/test/py/tests/test_shell_basics.py new file mode 100644 index ..719ce611d71c --- /dev/null +++ b/test/py/tests/test_shell_basics.py @@ -0,0 +1,42 @@ +# Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. +# +# SPDX-License-Identifier: GPL-2.0 + +# Test basic shell functionality, such as commands separate by semi-colons. + +def test_shell_execute(u_boot_console): +'''Test any shell command.''' + +response = u_boot_console.run_command('echo hello') +assert response.strip() == 'hello' + +def test_shell_semicolon_two(u_boot_console): +'''Test two shell commands separate by a semi-colon.''' + +cmd = 'echo hello; echo world' +response = u_boot_console.run_command(cmd) +# This validation method ignores the exact whitespace between the strings +assert response.index('hello') < response.index('world') + +def test_shell_semicolon_three(u_boot_console): +'''Test three shell commands separate by a semi-colon, with variable +expansion dependencies between them.''' + +cmd = 'setenv list 1; setenv list ${list}2; setenv list ${list}3; ' + \ +'echo ${list}' +response = u_boot_console.run_command(cmd) +assert response.strip() == '123' +u_boot_console.run_command('setenv list') + +def test_shell_run(u_boot_console): +'''Test the "run" shell command.''' + +u_boot_console.run_command('setenv foo \"setenv monty 1; setenv python 2\"') +u_boot_console.run_command('run foo') +response = u_boot_console.run_command('echo $monty') +assert response.strip() == '1' +response = u_boot_console.run_command('echo $python') +assert response.strip() == '2' +u_boot_console.run_command('setenv foo') +u_boot_console.run_command('setenv monty') +u_boot_console.run_command('setenv python') -- 2.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH V4 6/8] test/py: test the shell if command
From: Stephen Warren Migrate all most tests from command_ut.c into the Python test system. This allows the tests to be run against any U-Boot binary that supports the if command (i.e. where hush is enabled) without requiring that binary to be permanently bloated with the code from command_ut. Some tests in command_ut.c can only be executed from C code, since they test internal (more unit-level) features of various U-Boot APIs. The migrated tests can all operate directly from the U-Boot console. Signed-off-by: Stephen Warren Acked-by: Simon Glass --- v4: - No changes. v3: - Move test scripts into a sub-directory. Suggested by Michal Simek. - s/uboot/u[-_]boot/g. Suggested by Simon Glass. - s/"/'/g. Suggested by Simon Glass. - Add more documentation. Suggested by Simon Glass. - Remove inclusion of . Suggested by Simon Glass. --- test/command_ut.c | 116 test/py/tests/test_hush_if_test.py | 154 + 2 files changed, 154 insertions(+), 116 deletions(-) create mode 100644 test/py/tests/test_hush_if_test.py diff --git a/test/command_ut.c b/test/command_ut.c index 43bd2c1771fe..54bf62b9bc30 100644 --- a/test/command_ut.c +++ b/test/command_ut.c @@ -7,9 +7,6 @@ #define DEBUG #include -#ifdef CONFIG_SANDBOX -#include -#endif static const char test_cmd[] = "setenv list 1\n setenv list ${list}2; " "setenv list ${list}3\0" @@ -20,13 +17,6 @@ static int do_ut_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) printf("%s: Testing commands\n", __func__); run_command("env default -f -a", 0); - /* make sure that compound statements work */ -#ifdef CONFIG_SYS_HUSH_PARSER - run_command("if test -n ${single} ; then setenv check 1; fi", 0); - assert(!strcmp("1", getenv("check"))); - run_command("setenv check", 0); -#endif - /* commands separated by \n */ run_command_list("setenv list 1\n setenv list ${list}1", -1, 0); assert(!strcmp("11", getenv("list"))); @@ -60,112 +50,6 @@ static int do_ut_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) assert(!strcmp("1", getenv("black"))); assert(getenv("adder") != NULL); assert(!strcmp("2", getenv("adder"))); - - /* Test the 'test' command */ - -#define HUSH_TEST(name, expr, expected_result) \ - run_command("if test " expr " ; then " \ - "setenv " #name "_" #expected_result " y; else " \ - "setenv " #name "_" #expected_result " n; fi", 0); \ - assert(!strcmp(#expected_result, getenv(#name "_" #expected_result))); \ - setenv(#name "_" #expected_result, NULL); - - /* Basic operators */ - HUSH_TEST(streq, "aaa = aaa", y); - HUSH_TEST(streq, "aaa = bbb", n); - - HUSH_TEST(strneq, "aaa != bbb", y); - HUSH_TEST(strneq, "aaa != aaa", n); - - HUSH_TEST(strlt, "aaa < bbb", y); - HUSH_TEST(strlt, "bbb < aaa", n); - - HUSH_TEST(strgt, "bbb > aaa", y); - HUSH_TEST(strgt, "aaa > bbb", n); - - HUSH_TEST(eq, "123 -eq 123", y); - HUSH_TEST(eq, "123 -eq 456", n); - - HUSH_TEST(ne, "123 -ne 456", y); - HUSH_TEST(ne, "123 -ne 123", n); - - HUSH_TEST(lt, "123 -lt 456", y); - HUSH_TEST(lt_eq, "123 -lt 123", n); - HUSH_TEST(lt, "456 -lt 123", n); - - HUSH_TEST(le, "123 -le 456", y); - HUSH_TEST(le_eq, "123 -le 123", y); - HUSH_TEST(le, "456 -le 123", n); - - HUSH_TEST(gt, "456 -gt 123", y); - HUSH_TEST(gt_eq, "123 -gt 123", n); - HUSH_TEST(gt, "123 -gt 456", n); - - HUSH_TEST(ge, "456 -ge 123", y); - HUSH_TEST(ge_eq, "123 -ge 123", y); - HUSH_TEST(ge, "123 -ge 456", n); - - HUSH_TEST(z, "-z \"\"", y); - HUSH_TEST(z, "-z \"aaa\"", n); - - HUSH_TEST(n, "-n \"aaa\"", y); - HUSH_TEST(n, "-n \"\"", n); - - /* Inversion of simple tests */ - HUSH_TEST(streq_inv, "! aaa = aaa", n); - HUSH_TEST(streq_inv, "! aaa = bbb", y); - - HUSH_TEST(streq_inv_inv, "! ! aaa = aaa", y); - HUSH_TEST(streq_inv_inv, "! ! aaa = bbb", n); - - /* Binary operators */ - HUSH_TEST(or_0_0, "aaa != aaa -o bbb != bbb", n); - HUSH_TEST(or_0_1, "aaa != aaa -o bbb = bbb", y); - HUSH_TEST(or_1_0, "aaa = aaa -o bbb != bbb", y); - HUSH_TEST(or_1_1, "aaa = aaa -o bbb = bbb", y); - - HUSH_TEST(and_0_0, "aaa != aaa -a bbb != bbb", n); - HUSH_TEST(and_0_1, "aaa != aaa -a bbb = bbb", n); - HUSH_TEST(and_1_0, "aaa = aaa -a bbb != bbb", n); - HUSH_TEST(and_1_1, "aaa = aaa -a bbb = bbb", y); - - /* Inversion within binary operators */ - HUSH_TEST(or_0_0_inv, "! aaa != aaa -o ! bbb != bbb", y); - HUSH_TEST(or_0_1_inv, "! aaa != aaa -o ! bbb = bbb", y); - HUSH_TEST(or_1_0_inv, "! aaa = aaa -o ! bbb != bbb", y); - HUSH_TEST(or_1_1_inv, "! aaa = aaa -o ! bbb = bbb", n); - -
[U-Boot] [PATCH V4 7/8] test/py: test the ums command
From: Stephen Warren This test invokes the "ums" command in U-Boot, and validates that a USB storage device is enumerated on the test host system, and can be read from. Signed-off-by: Stephen Warren Acked-by: Simon Glass --- v4: - No changes. v3: - Move test scripts into a sub-directory. Suggested by Michal Simek. - s/uboot/u[-_]boot/g. Suggested by Simon Glass. - s/"/'/g. Suggested by Simon Glass. - Add more documentation. Suggested by Simon Glass. - Rename boardenv USB device node variable to avoid naming conflicts if we add support for other types of USB device later (e.g. CDC ACM, CDC Ethernet, DFU). --- test/py/tests/test_ums.py | 94 +++ 1 file changed, 94 insertions(+) create mode 100644 test/py/tests/test_ums.py diff --git a/test/py/tests/test_ums.py b/test/py/tests/test_ums.py new file mode 100644 index ..a137221c7a5b --- /dev/null +++ b/test/py/tests/test_ums.py @@ -0,0 +1,94 @@ +# Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. +# +# SPDX-License-Identifier: GPL-2.0 + +# Test U-Boot's "ums" command. At present, this test only ensures that a UMS +# device can be enumerated by the host/test machine. In the future, this test +# should be enhanced to validate disk IO. + +import os +import pytest +import time + +''' +Note: This test relies on: + +a) boardenv_* to contain configuration values to define which USB ports are +available for testing. Without this, this test will be automatically skipped. +For example: + +env__usb_dev_ports = ( +{'tgt_usb_ctlr': '0', 'host_ums_dev_node': '/dev/disk/by-path/pci-:00:14.0-usb-0:13:1.0-scsi-0:0:0:0'}, +) + +env__block_devs = ( +{'type': 'mmc', 'id': '0'}, # eMMC; always present +{'type': 'mmc', 'id': '1'}, # SD card; present since I plugged one in +) + +b) udev rules to set permissions on devices nodes, so that sudo is not +required. For example: + +ACTION=="add", SUBSYSTEM=="block", SUBSYSTEMS=="usb", KERNELS=="3-13", MODE:="666" + +(You may wish to change the group ID instead of setting the permissions wide +open. All that matters is that the user ID running the test can access the +device.) +''' + +def open_ums_device(host_ums_dev_node): +'''Attempt to open a device node, returning either the opened file handle, +or None on any error.''' + +try: +return open(host_ums_dev_node, 'rb') +except: +return None + +def wait_for_ums_device(host_ums_dev_node): +'''Continually attempt to open the device node exported by the "ums" +command, and either return the opened file handle, or raise an exception +after a timeout.''' + +for i in xrange(100): +fh = open_ums_device(host_ums_dev_node) +if fh: +return fh +time.sleep(0.1) +raise Exception('UMS device did not appear') + +def wait_for_ums_device_gone(host_ums_dev_node): +'''Continually attempt to open the device node exported by the "ums" +command, and either return once the device has disappeared, or raise an +exception if it does not before a timeout occurs.''' + +for i in xrange(100): +fh = open_ums_device(host_ums_dev_node) +if not fh: +return +fh.close() +time.sleep(0.1) +raise Exception('UMS device did not disappear') + +@pytest.mark.buildconfigspec('cmd_usb_mass_storage') +def test_ums(u_boot_console, env__usb_dev_port, env__block_devs): +'''Test the "ums" command; the host system must be able to enumerate a UMS +device when "ums" is running, and this device must disappear when "ums" is +aborted.''' + +tgt_usb_ctlr = env__usb_dev_port['tgt_usb_ctlr'] +host_ums_dev_node = env__usb_dev_port['host_ums_dev_node'] + +# We're interested in testing USB device mode on each port, not the cross- +# product of that with each device. So, just pick the first entry in the +# device list here. We'll test each block device somewhere else. +tgt_dev_type = env__block_devs[0]['type'] +tgt_dev_id = env__block_devs[0]['id'] + +cmd = 'ums %s %s %s' % (tgt_usb_ctlr, tgt_dev_type, tgt_dev_id) +u_boot_console.run_command('ums 0 mmc 0', wait_for_prompt=False) +fh = wait_for_ums_device(host_ums_dev_node) +fh.read(4096) +fh.close() +u_boot_console.ctrlc() +wait_for_ums_device_gone(host_ums_dev_node) -- 2.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH V4 8/8] test/py: add a test for the sleep command
From: Stephen Warren Execute "sleep", and validate that it sleeps for approximately the correct amount of time. Signed-off-by: Stephen Warren Acked-by: Simon Glass --- v4: New patch. Note that this test won't pass for sandbox until the following patches is applied: timer: sandbox: work without device tree --- test/py/tests/test_sleep.py | 24 1 file changed, 24 insertions(+) create mode 100644 test/py/tests/test_sleep.py diff --git a/test/py/tests/test_sleep.py b/test/py/tests/test_sleep.py new file mode 100644 index ..64f1ddf9a09f --- /dev/null +++ b/test/py/tests/test_sleep.py @@ -0,0 +1,24 @@ +# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +# +# SPDX-License-Identifier: GPL-2.0 + +import pytest +import time + +def test_sleep(u_boot_console): +'''Test the sleep command, and validate that it sleeps for approximately +the correct amount of time.''' + +# Do this before we time anything, to make sure U-Boot is already running. +# Otherwise, the system boot time is included in the time measurement. +u_boot_console.ensure_spawned() + +# 3s isn't too long, but is enough to cross a few second boundaries. +sleep_time = 3 +tstart = time.time() +u_boot_console.run_command('sleep %d' % sleep_time) +tend = time.time() +elapsed = tend - tstart +delta_to_expected = abs(elapsed - sleep_time) +# 0.25s margin is hopefully enough to account for any system overhead. +assert delta_to_expected < 0.25 -- 2.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/3] test/py: add a test for the sleep command
On 01/06/2016 10:33 AM, Stephen Warren wrote: From: Stephen Warren Execute "sleep", and validate that it sleeps for approximately the correct amount of time. FYI, I've reposted the series that implements the test/py code, and bundled this patch 3/3 in this series into that series. As such, I believe patches 1/3 and 2/3 in this series can be applied through whatever path sandbox (or DM or timer) patches would normally go through. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v3 5/5] net: zynq_gem: Use shared wait_for_bit
On Thu, Jan 14, 2016 at 12:08 PM, Tom Rini wrote: > On Sun, Dec 27, 2015 at 06:28:12PM +0100, Mateusz Kulikowski wrote: > >> Use existing library function to poll bit(s). >> Signed-off-by: Mateusz Kulikowski > > Reviewed-by: Tom Rini Reviewed-by: Moritz Fischer Cheers, Moritz ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 16/26] dm: tegra: net: Convert tegra boards to driver model for Ethernet
On 12/13/2015 08:46 PM, Simon Glass wrote: Applied to u-boot-dm/next. This change has removed/disabled/... PCIe support on at least Jetson TK1. I haven't checked the other Tegra boards. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v4 5/6] rockchip: kylin: Enable boot with android boot image
Hi, On 15 January 2016 at 08:42, Daniel Schwierzeck wrote: > Am Freitag, den 15.01.2016, 09:42 -0500 schrieb Tom Rini: >> On Fri, Jan 15, 2016 at 10:20:43AM +0800, Jeffy Chen wrote: >> > Hi Tom, >> > >> > On 2016-1-15 8:59, Tom Rini wrote: >> > > On Fri, Jan 15, 2016 at 08:53:06AM +0800, Jeffy Chen wrote: >> > > > Hi Tom, >> > > > >> > > > On 2016-1-15 0:22, Tom Rini wrote: >> > > > > On Thu, Jan 14, 2016 at 10:31:34AM +0800, Jeffy Chen wrote: >> > > > > > Hi Tom, >> > > > > > >> > > > > > On 2016-1-13 23:28, Tom Rini wrote: >> > > > > > > On Wed, Jan 13, 2016 at 04:53:19PM +0800, Jeffy Chen >> > > > > > > wrote: >> > > > > > > >> > > > > > > > The android kernel is using appended dtb by default, >> > > > > > > > and store >> > > > > > > > ramdisk right after kernel & dtb. >> > > > > > > > So we needs to relocate ramdisk, and use atags to pass >> > > > > > > > params. >> > > > > > > > >> > > > > > > > Signed-off-by: Jeffy Chen >> > > > > > > > Acked-by: Simon Glass >> > > > > > > > --- >> > > > > > > > >> > > > > > > > Changes in v4: None >> > > > > > > > Changes in v3: None >> > > > > > > > Changes in v2: None >> > > > > > > > >> > > > > > > > include/configs/kylin_rk3036.h | 23 >> > > > > > > > +++ >> > > > > > > > 1 file changed, 23 insertions(+) >> > > > > > > > >> > > > > > > > diff --git a/include/configs/kylin_rk3036.h >> > > > > > > > b/include/configs/kylin_rk3036.h >> > > > > > > > index b750b26..49997ec 100644 >> > > > > > > > --- a/include/configs/kylin_rk3036.h >> > > > > > > > +++ b/include/configs/kylin_rk3036.h >> > > > > > > > @@ -35,6 +35,29 @@ >> > > > > > > > #undef CONFIG_EXTRA_ENV_SETTINGS >> > > > > > > > #define CONFIG_EXTRA_ENV_SETTINGS \ >> > > > > > > > "partitions=" PARTS_DEFAULT \ >> > > > > > > > + "mmcdev=0\0" \ >> > > > > > > > + "mmcpart=5\0" \ >> > > > > > > > + "loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) >> > > > > > > > "\0" \ >> > > > > > > > + >> > > > > > > > +#define CONFIG_ANDROID_BOOT_IMAGE >> > > > > > > > +#define CONFIG_SYS_BOOT_RAMDISK_HIGH >> > > > > > > This should already be set. >> > > > > > Right, i'll remove it... >> > > > > > > > +#define CONFIG_SYS_HUSH_PARSER >> > > > > > > > + >> > > > > > > > +#undef CONFIG_BOOTCOMMAND >> > > > > > > > +#define CONFIG_BOOTCOMMAND \ >> > > > > > > > + "mmc dev ${mmcdev}; if mmc rescan; then " \ >> > > > > > > > + "part start mmc ${mmcdev} ${mmcpart} >> > > > > > > > boot_start;" \ >> > > > > > > > + "part size mmc ${mmcdev} ${mmcpart} >> > > > > > > > boot_size;" \ >> > > > > > > > + "mmc read ${loadaddr} ${boot_start} >> > > > > > > > ${boot_size};" \ >> > > > > > > > + "bootm start ${loadaddr}; bootm >> > > > > > > > ramdisk;" \ >> > > > > > > > + "bootm prep; bootm go;" \ >> > > > > > > > + "fi;" \ >> > > > > > > > + >> > > > > > > > +/* Enable atags */ >> > > > > > > > +#define CONFIG_SYS_BOOTPARAMS_LEN (64*1024) >> > > > > > > > +#define CONFIG_INITRD_TAG >> > > > > > > > +#define CONFIG_SETUP_MEMORY_TAGS >> > > > > > > > +#define CONFIG_CMDLINE_TAG >> > > > > > > But I'm confused as to what exactly is going on here. >> > > > > > > Appended dtb is >> > > > > > > not the same as ATAGS. And you shouldn't need to split >> > > > > > > up bootm like >> > > > > > > that. Can you please explain a bit more? Thanks! >> > > > > > The u-boot will pass atags to kernel, and kernel will merge >> > > > > > those >> > > > > > atags into the appended dtb(fdt). >> > > > > > >> > > > > > The default bootm flow would not pass ramdisk state, but we >> > > > > > need it, >> > > > > > so we should add this state into default flow, or just use >> > > > > > split >> > > > > > bootm cmds :) >> > > > > That seems very strange. Is the ramdisk concatenated with >> > > > > the kernel >> > > > > and dtb as well (and that's why bootm ramdisk somehow finds >> > > > > it but >> > > > > normal bootm doesn't as you aren't passing in a ramdisk >> > > > > address) ? >> > > > Yes, the ramdisk concatenated with the kernel and dtb as >> > > > well(u-boot/include/android_image.h: struct andr_img_hdr). >> > > > >> > > > And the normal bootm cmd would find it by parsing andr_img_hdr >> > > > struct. >> > > > But we still need bootm ramdisk state, because it will call >> > > > boot_ramdisk_high to relocate ramdisk area :) >> > > > >> > > > I found if not relocate it to somewhere else, it would be >> > > > corrupted >> > > > after kernel's decompressing(during update fdt area). >> > > So 'bootm $loadaddr' of an Android image sees, but does not >> > > relocate the >> > > ramdisk that is included in the image, but bootm ramdisk does? >> > > That >> > > sounds like a bug in the regular bootm handling. >> > Yep, the default bootm flow would not contain ramdisk relocate >> > state: >> > >> > vi common/cmd_bootm.c >> > return do_bootm_states(cmdtp, flag, argc, argv, >> > BOOTM_STATE_START | >> >
Re: [U-Boot] x86: Bay Trail support with W83627DHG
Hi Stefan, On 15 January 2016 at 07:37, Stefan Roese wrote: > Hi Simon, Hi Bin! > > I'm currently busy with porting U-Boot to a Bay Trail board. > Equipped with an Intel Atom E3845 and additionally the > Nuvoton / Winbond W83627DHG Super IO chip. > > My staring point for this port is the Minnowboard MAX, which > works very well btw. I've used the same binaries as described > in the README.x86 as on the MinnowMAX for this new Bay Trail > board. But am not able yet to see any output on the DEBUG_UART. > > Bin, you already mentioned in a previous mail, that I need to > enable the legacy UART in the Super IO chip for this. I've > started adding a small driver for this, similar to the one > you've introduced for the SMSC: > > --< > #define WINBOND_ENTRY_KEY 0x87 > #define WINBOND_EXIT_KEY0xAA > > /* Enable configuration: pass entry key '0x87' into index port dev. */ > static void pnp_enter_conf_state(u16 dev) > { > u16 port = dev >> 8; > > outb(WINBOND_ENTRY_KEY, port); > outb(WINBOND_ENTRY_KEY, port); > } > > /* Disable configuration: pass exit key '0xAA' into index port dev. */ > static void pnp_exit_conf_state(u16 dev) > { > u16 port = dev >> 8; > > outb(WINBOND_EXIT_KEY, port); > } > > /* Bring up early serial debugging output before the RAM is initialized. */ > void winbond_enable_serial(uint dev, uint iobase, uint irq) > { > pnp_enter_conf_state(dev); > pnp_set_logical_device(dev); > pnp_set_enable(dev, 0); > pnp_set_iobase(dev, PNP_IDX_IO0, iobase); > pnp_set_irq(dev, PNP_IDX_IRQ0, irq); > pnp_set_enable(dev, 1); > pnp_exit_conf_state(dev); > } > --< > > This is called via: > --< > /* I/O address of Winbond Super IO chip */ > #define WINBOND_IO_PORT 0x2e > > /* Logical device number */ > #define W83627DHG_SP1 2 /* Com1 */ > > winbond_enable_serial(PNP_DEV(WINBOND_IO_PORT, W83627DHG_SP1), > UART0_BASE, UART0_IRQ); > --< > > As you may notice, this is ported from coreboot. But still, this > is not enough to get some output on the UART. > > Debugging (without JTAG debugger and without DEBUG_UART but with > POST output) shows, that the board hangs somewhere in the FSP code. > When called via fsp_init(). POST shows 0x2A in this case. And > FSP does not return to fsp_continue() at all. > > Do you have any hints what could be missing for the DEBUG > UART to work on this board? Or what might cause the board > to hang in the FSP code? Or what the meaning of the FSP 0x2A > POST code is? I have seen the FSP crash when the wrong microcode is provided. Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/2] dm: core: Provide uclass_find_device_by_phandle() only when needed
On 19 December 2015 at 19:38, Simon Glass wrote: > This function cannot be used unless support is enabled for device tree > control. Adjust the code to reflect that. > > Signed-off-by: Simon Glass > --- > > drivers/core/uclass.c | 4 > 1 file changed, 4 insertions(+) Applied to u-boot-dm. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] include stdint.h where mtd/mtd-user.h is included
Since linux 4.4 mtd/mtd-user.h does not include stdint.h any more, so it has to be included explicitly. See commit 137d36af4a53858b8db7ca83c8480247118b8bdf of the linux kernel. https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=137d36af4a53858b8db7ca83c8480247118b8bdf Signed-off-by: Gerhard Heift --- tools/env/fw_env.c | 1 + tools/palmtreo680/flash_u-boot.c | 1 + 2 files changed, 2 insertions(+) diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index 39f7333..098c7c7 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -29,6 +29,7 @@ # include #else # define __user /* nothing */ +# include # include #endif diff --git a/tools/palmtreo680/flash_u-boot.c b/tools/palmtreo680/flash_u-boot.c index 3d8296f..7a9b37d 100644 --- a/tools/palmtreo680/flash_u-boot.c +++ b/tools/palmtreo680/flash_u-boot.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include "libmtd.h" -- 2.7.0.rc3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] include stdint.h where mtd/mtd-user.h is included
Since linux 4.4 mtd/mtd-user.h does not include stdint.h any more, so it has to be included explicitly. See commit 137d36af4a53858b8db7ca83c8480247118b8bdf of the linux kernel. https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=137d36af4a53858b8db7ca83c8480247118b8bdf Signed-off-by: Gerhard Heift --- tools/env/fw_env.c | 1 + tools/palmtreo680/flash_u-boot.c | 1 + 2 files changed, 2 insertions(+) diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index 39f7333..098c7c7 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -29,6 +29,7 @@ # include #else # define __user /* nothing */ +# include # include #endif diff --git a/tools/palmtreo680/flash_u-boot.c b/tools/palmtreo680/flash_u-boot.c index 3d8296f..7a9b37d 100644 --- a/tools/palmtreo680/flash_u-boot.c +++ b/tools/palmtreo680/flash_u-boot.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include "libmtd.h" -- 2.7.0.rc3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/4] SECURE BOOT: separate function created for signature
> -Original Message- > From: Aneesh Bansal > Sent: Tuesday, December 08, 2015 2:14 PM > To: u-boot@lists.denx.de > Cc: Yusong Sun ; Ruchika Gupta > ; Prabhakar Kushwaha > ; Aneesh Bansal > ; Saksham Jain > Subject: [PATCH 3/4] SECURE BOOT: separate function created for signature > > The code for image hash calculation, hash calculation from RSA signature and > comparison of hashes has been mobed to a separate function. > > Signed-off-by: Saksham Jain > Signed-off-by: Aneesh Bansal > --- > board/freescale/common/fsl_validate.c | 98 +++--- > - > 1 file changed, 54 insertions(+), 44 deletions(-) > > diff --git a/board/freescale/common/fsl_validate.c > b/board/freescale/common/fsl_validate.c > index ef7a5ae..08a2f79 100644 > --- a/board/freescale/common/fsl_validate.c > +++ b/board/freescale/common/fsl_validate.c > @@ -721,6 +721,58 @@ static inline int str2longbe(const char *p, ulong > *num) > > return *p != '\0' && *endptr == '\0'; > } > +/* Function to calculate the ESBC Image Hash > + * and hash from Digital signature. > + * The Two hash's are compared to yield the > + * result of signature validation. > + */ > +static int calculate_cmp_img_sig(struct fsl_secboot_img_priv *img) { > + int ret; > + uint32_t key_len; > + struct key_prop prop; > +#if !defined(USE_HOSTCC) > + struct udevice *mod_exp_dev; > +#endif > + ret = calc_esbchdr_esbc_hash(img); > + if (ret) > + return ret; > + > + /* Construct encoded hash EM' wrt PKCSv1.5 */ > + construct_img_encoded_hash_second(img); > + > + /* Fill prop structure for public key */ > + memset(&prop, 0, sizeof(struct key_prop)); > + key_len = get_key_len(img) / 2; > + prop.modulus = img->img_key; > + prop.public_exponent = img->img_key + key_len; > + prop.num_bits = key_len * 8; > + prop.exp_len = key_len; > + > + ret = uclass_get_device(UCLASS_MOD_EXP, 0, &mod_exp_dev); > + if (ret) { > + printf("RSA: Can't find Modular Exp implementation\n"); > + return -EINVAL; > + } > + > + ret = rsa_mod_exp(mod_exp_dev, img->img_sign, img->hdr.sign_len, > + &prop, img->img_encoded_hash); > + if (ret) > + return ret; > + > + /* > + * compare the encoded messages EM' and EM wrt RSA PKCSv1.5 > + * memcmp returns zero on success > + * memcmp returns non-zero on failure > + */ > + ret = memcmp(&img->img_encoded_hash_second, &img- > >img_encoded_hash, > + img->hdr.sign_len); > + > + if (ret) > + return ERROR_ESBC_CLIENT_HASH_COMPARE_EM; > + > + return 0; > +} > > int fsl_secboot_validate(ulong haddr, char *arg_hash_str) { @@ -732,11 > +784,6 @@ int fsl_secboot_validate(ulong haddr, char *arg_hash_str) > void *esbc; > int ret, i, hash_cmd = 0; > u32 srk_hash[8]; > - uint32_t key_len; > - struct key_prop prop; > -#if !defined(USE_HOSTCC) > - struct udevice *mod_exp_dev; > -#endif > > if (arg_hash_str != NULL) { > const char *cp = arg_hash_str; > @@ -821,46 +868,9 @@ int fsl_secboot_validate(ulong haddr, char > *arg_hash_str) > goto exit; > } > > - ret = calc_esbchdr_esbc_hash(img); > - if (ret) { > - fsl_secblk_handle_error(ret); > - goto exit; > - } > - > - /* Construct encoded hash EM' wrt PKCSv1.5 */ > - construct_img_encoded_hash_second(img); > - > - /* Fill prop structure for public key */ > - memset(&prop, 0, sizeof(struct key_prop)); > - key_len = get_key_len(img) / 2; > - prop.modulus = img->img_key; > - prop.public_exponent = img->img_key + key_len; > - prop.num_bits = key_len * 8; > - prop.exp_len = key_len; > - > - ret = uclass_get_device(UCLASS_MOD_EXP, 0, &mod_exp_dev); > - if (ret) { > - printf("RSA: Can't find Modular Exp implementation\n"); > - return -EINVAL; > - } > - > - ret = rsa_mod_exp(mod_exp_dev, img->img_sign, img->hdr.sign_len, > - &prop, img->img_encoded_hash); > - if (ret) { > - fsl_secblk_handle_error(ret); > - goto exit; > - } > - > - /* > - * compare the encoded messages EM' and EM wrt RSA PKCSv1.5 > - * memcmp returns zero on success > - * memcmp returns non-zero on failure > - */ > - ret = memcmp(&img->img_encoded_hash_second, &img- > >img_encoded_hash, > - img->hdr.sign_len); > - > + ret = calculate_cmp_img_sig(img); > if (ret) { > - > fsl_secboot_handle_error(ERROR_ESBC_CLIENT_HASH_COMPARE_E > M); > + fsl_secboot_handle_error(ret); > goto exit; > } > > -- > 1.8.1.4 Acked-by: Ruchika Gupta ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] udoo:use load instead of fatload
That way the FS can also be ext2/3/4 Signed-off-by: Oscar Curero --- include/configs/udoo.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/configs/udoo.h b/include/configs/udoo.h index 8ec073d..3d0cafa 100644 --- a/include/configs/udoo.h +++ b/include/configs/udoo.h @@ -96,11 +96,11 @@ "mmcargs=setenv bootargs console=${console},${baudrate} " \ "root=${mmcroot}\0" \ "loadbootscript=" \ - "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ + "load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ "bootscript=echo Running bootscript from mmc ...; " \ "source\0" \ - "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ - "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ + "loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ + "loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ "mmcboot=echo Booting from mmc ...; " \ "run mmcargs; " \ "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ -- 2.1.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 01/19] arm: omap-common: do not build timer when CONFIG_TIMER defined
On 4 January 2016 at 12:57, Tom Rini wrote: > On Thu, Dec 24, 2015 at 04:08:04PM +0530, Mugunthan V N wrote: > >> To prepare timer driver to DM/DT conversion do not build the >> exiting timer driver when CONFIG_TIMER is defined. But since >> omap's SPL doesn't support DM yet so built timer driver only for >> SPL build when CONFIG_TIMER is defined. >> >> Signed-off-by: Mugunthan V N > > Reviewed-by: Tom Rini > > -- > Tom Applied to u-boot-dm, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v3 02/19] dm: timer: uclass: add timer init to add timer device
On 25 December 2015 at 06:08, Mugunthan V N wrote: > On Friday 25 December 2015 05:43 PM, Bin Meng wrote: >> Hi Mugunthan, >> >> On Fri, Dec 25, 2015 at 6:41 PM, Mugunthan V N wrote: >>> Adding timer_init function to create and initialize the timer >>> device on platforms where u-boot,dm-pre-reloc is not used. Since >>> there will be multiple timer devices in the system, adding a >>> tick-timer node in chosen node to know which timer device to be >>> used as tick timer in u-boot. >>> >>> Signed-off-by: Mugunthan V N >>> --- >>> >>> Submitting 02/19 only for v3 as there is no change on other >>> patches and to reduce traffic. >>> >>> This patch is verified on AM437x SK and DRA74 EVM logs [1] and >>> pushed a branch for testing >>> >>> [1] - http://pastebin.ubuntu.com/14205433/ >>> [2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git >>> dm-timer-v3 >>> >>> Changes from v2->v3: >>> * Fixed issue which is in v2 that if no chosen timer node is >>> present in DT then timer init always fails without trying >>> first available timer. >>> >>> --- >>> doc/device-tree-bindings/chosen.txt | 43 >>> + >>> drivers/timer/timer-uclass.c| 41 >>> +++ >>> lib/time.c | 13 ++- >>> 3 files changed, 86 insertions(+), 11 deletions(-) >>> create mode 100644 doc/device-tree-bindings/chosen.txt >>> >>> diff --git a/doc/device-tree-bindings/chosen.txt >>> b/doc/device-tree-bindings/chosen.txt >>> new file mode 100644 >>> index 000..bf9a30a >>> --- /dev/null >>> +++ b/doc/device-tree-bindings/chosen.txt >>> @@ -0,0 +1,43 @@ >>> +The chosen node >>> +--- >>> +The chosen node does not represent a real device, but serves as a place >>> +for passing data like which serial device to used to print the logs etc >>> + >>> + >>> +stdout-path property >>> + >>> +Device trees may specify the device to be used for boot console output >>> +with a stdout-path property under /chosen. >>> + >>> +Example >>> +--- >>> +/ { >>> + chosen { >>> + stdout-path = "/serial@f00:115200"; >>> + }; >>> + >>> + serial@f00 { >>> + compatible = "vendor,some-uart"; >>> + reg = <0xf00 0x10>; >>> + }; >>> +}; >>> + >>> +tick-timer property >>> +--- >>> +In a system there are multiple timers, specify which timer to be used >>> +as the tick-timer. Earlier it was hardcoded in the timer driver now >>> +since device tree has all the timer nodes. Specify which timer to be >>> +used as tick timer. >>> + >>> +Example >>> +--- >>> +/ { >>> + chosen { >>> + tick-timer = "/timer2@f00"; >>> + }; >>> + >>> + timer2@f00 { >>> + compatible = "vendor,some-timer"; >>> + reg = <0xf00 0x10>; >>> + }; >>> +}; >>> diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c >>> index aca421b..b6699f2 100644 >>> --- a/drivers/timer/timer-uclass.c >>> +++ b/drivers/timer/timer-uclass.c >>> @@ -6,6 +6,8 @@ >>> >>> #include >>> #include >>> +#include >>> +#include >>> #include >>> #include >>> >>> @@ -56,6 +58,45 @@ u64 timer_conv_64(u32 count) >>> return ((u64)gd->timebase_h << 32) | gd->timebase_l; >>> } >>> >>> +int timer_init(void) >>> +{ >>> + const void *blob = gd->fdt_blob; >>> + struct udevice *dev = NULL; >>> + int node; >>> + int ret; >>> + >>> + /* Check for a chosen timer to be used for tick */ >>> + node = fdtdec_get_chosen_node(blob, "tick-timer"); >>> + if (node < 0) { >>> + /* No chosen timer, trying first available timer */ >>> + ret = uclass_first_device(UCLASS_TIMER, &dev); >>> + if (ret) >>> + return ret; >>> + if (!dev) >>> + return -ENODEV; >> >> Thanks for the quick v3! >> >>> + } else { >>> + if (uclass_get_device_by_of_offset(UCLASS_TIMER, node, >>> &dev)) { >>> + /* >>> +* If the timer is not marked to be bound before >>> +* relocation, bind it anyway. >>> +*/ >>> + if (node > 0 && >>> + !lists_bind_fdt(gd->dm_root, blob, node, &dev)) >>> { >>> + int ret = device_probe(dev); >> >> nits: no need to declare another ret. Just "ret = device_probe(dev)". > > Hmmm, yep not needed. > >> >>> + if (ret) >>> + return ret; >>> + } >>> + } >>> + } >>> + >>> + if (dev) { >>> + gd->timer = dev; >>> + return 0; >>> + } >>> + >>> + return -ENODEV; >>> +} >>> + >>> UCLASS_DRIVER(timer) = { >>> .id = UCLASS_TIMER, >>>
Re: [U-Boot] [PATCH v2 3/9] serial: lpuart: Move CONFIG_FSL_LPUART to Kconfig
Looks good to me, Acked-by: Stefan Agner On 13.01.2016 19:39, Bin Meng wrote: > LPUART is seen on Freescale VF610 and QorIQ Layerscape devices. > Create a Kconfig option and move it to defconfig for all boards > that have this serial driver. > > Signed-off-by: Bin Meng > Reviewed-by: Simon Glass > --- > > Changes in v2: None > > configs/colibri_vf_defconfig | 1 + > configs/colibri_vf_dtb_defconfig | 1 + > configs/ls1021aqds_ddr4_nor_lpuart_defconfig | 1 + > configs/ls1021aqds_nor_lpuart_defconfig | 1 + > configs/ls1021atwr_nor_lpuart_defconfig | 1 + > configs/pcm052_defconfig | 1 + > configs/vf610twr_defconfig | 1 + > configs/vf610twr_nand_defconfig | 1 + > drivers/serial/Kconfig | 6 ++ > include/configs/colibri_vf.h | 1 - > include/configs/ls1021aqds.h | 1 - > include/configs/ls1021atwr.h | 1 - > include/configs/pcm052.h | 1 - > include/configs/vf610twr.h | 1 - > 14 files changed, 14 insertions(+), 5 deletions(-) > > diff --git a/configs/colibri_vf_defconfig b/configs/colibri_vf_defconfig > index f8441e3..45917c8 100644 > --- a/configs/colibri_vf_defconfig > +++ b/configs/colibri_vf_defconfig > @@ -8,3 +8,4 @@ CONFIG_CMD_GPIO=y > CONFIG_DM=y > CONFIG_NAND_VF610_NFC=y > CONFIG_SYS_NAND_VF610_NFC_60_ECC_BYTES=y > +CONFIG_FSL_LPUART=y > diff --git a/configs/colibri_vf_dtb_defconfig > b/configs/colibri_vf_dtb_defconfig > index 3596cec..b1a843a 100644 > --- a/configs/colibri_vf_dtb_defconfig > +++ b/configs/colibri_vf_dtb_defconfig > @@ -11,3 +11,4 @@ CONFIG_OF_CONTROL=y > CONFIG_DM=y > CONFIG_NAND_VF610_NFC=y > CONFIG_SYS_NAND_VF610_NFC_60_ECC_BYTES=y > +CONFIG_FSL_LPUART=y > diff --git a/configs/ls1021aqds_ddr4_nor_lpuart_defconfig > b/configs/ls1021aqds_ddr4_nor_lpuart_defconfig > index 68bd117..44b2a0d 100644 > --- a/configs/ls1021aqds_ddr4_nor_lpuart_defconfig > +++ b/configs/ls1021aqds_ddr4_nor_lpuart_defconfig > @@ -4,3 +4,4 @@ CONFIG_SYS_EXTRA_OPTIONS="SYS_FSL_DDR4,LPUART" > # CONFIG_CMD_SETEXPR is not set > CONFIG_NETDEVICES=y > CONFIG_E1000=y > +CONFIG_FSL_LPUART=y > diff --git a/configs/ls1021aqds_nor_lpuart_defconfig > b/configs/ls1021aqds_nor_lpuart_defconfig > index b2f6832..1186af2 100644 > --- a/configs/ls1021aqds_nor_lpuart_defconfig > +++ b/configs/ls1021aqds_nor_lpuart_defconfig > @@ -4,3 +4,4 @@ CONFIG_SYS_EXTRA_OPTIONS="LPUART" > # CONFIG_CMD_SETEXPR is not set > CONFIG_NETDEVICES=y > CONFIG_E1000=y > +CONFIG_FSL_LPUART=y > diff --git a/configs/ls1021atwr_nor_lpuart_defconfig > b/configs/ls1021atwr_nor_lpuart_defconfig > index d7afca9..58cd61f 100644 > --- a/configs/ls1021atwr_nor_lpuart_defconfig > +++ b/configs/ls1021atwr_nor_lpuart_defconfig > @@ -4,3 +4,4 @@ CONFIG_SYS_EXTRA_OPTIONS="LPUART" > # CONFIG_CMD_SETEXPR is not set > CONFIG_NETDEVICES=y > CONFIG_E1000=y > +CONFIG_FSL_LPUART=y > diff --git a/configs/pcm052_defconfig b/configs/pcm052_defconfig > index 9125645..26ab733 100644 > --- a/configs/pcm052_defconfig > +++ b/configs/pcm052_defconfig > @@ -3,3 +3,4 @@ CONFIG_TARGET_PCM052=y > > CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/phytec/pcm052/imximage.cfg,ENV_IS_IN_NAND" > CONFIG_NAND_VF610_NFC=y > CONFIG_SYS_NAND_BUSWIDTH_16BIT=y > +CONFIG_FSL_LPUART=y > diff --git a/configs/vf610twr_defconfig b/configs/vf610twr_defconfig > index dc8df5c..d51c93b 100644 > --- a/configs/vf610twr_defconfig > +++ b/configs/vf610twr_defconfig > @@ -6,3 +6,4 @@ > CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/vf610twr/imximage.cfg,ENV_I > CONFIG_NAND_VF610_NFC=y > CONFIG_SYS_NAND_BUSWIDTH_16BIT=y > CONFIG_SPI_FLASH=y > +CONFIG_FSL_LPUART=y > diff --git a/configs/vf610twr_nand_defconfig b/configs/vf610twr_nand_defconfig > index 98880f3..299fa8f 100644 > --- a/configs/vf610twr_nand_defconfig > +++ b/configs/vf610twr_nand_defconfig > @@ -6,3 +6,4 @@ > CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/vf610twr/imximage.cfg,ENV_I > CONFIG_NAND_VF610_NFC=y > CONFIG_SYS_NAND_BUSWIDTH_16BIT=y > CONFIG_SPI_FLASH=y > +CONFIG_FSL_LPUART=y > diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig > index 1fc287e..3b54511 100644 > --- a/drivers/serial/Kconfig > +++ b/drivers/serial/Kconfig > @@ -186,6 +186,12 @@ config ALTERA_UART > Select this to enable an UART for Altera devices. Please find > details on the "Embedded Peripherals IP User Guide" of Altera. > > +config FSL_LPUART > + bool "Freescale LPUART support" > + help > + Select this to enable a Low Power UART for Freescale VF610 and > + QorIQ Layerscape devices. > + > config SYS_NS16550 > bool "NS16550 UART or compatible" > help > diff --git a/include/configs/colibri_vf.h b/include/configs/colibri_vf.h > index 708c79a..5aed3a5 100644 > --- a/include/configs/colibri_vf.h > +++ b/include/configs/colibri_vf.h > @@ -36,7 +36,6 @@ > > #define CONFI
Re: [U-Boot] [PATCH v2 03/19] dm: timer: uclass: Add flag to control sequence numbering
On 5 January 2016 at 17:25, Simon Glass wrote: > On 24 December 2015 at 03:38, Mugunthan V N wrote: >> Like SPI and I2C, timer devices also have multiple chip >> instances. This patch adds the flag 'DM_UC_FLAG_SEQ_ALIAS' in >> timer_uclass driver to control device sequence numbering. >> >> Signed-off-by: Mugunthan V N >> Reviewed-by: Simon Glass >> Reviewed-by: Bin Meng >> --- >> drivers/timer/timer-uclass.c | 1 + >> 1 file changed, 1 insertion(+) > > Reviewed-by: Simon Glass Applied to u-boot-dm, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 04/19] drivers: timer: omap_timer: add timer driver for omap devices based on dm
On 24 December 2015 at 03:38, Mugunthan V N wrote: > Adding a timer driver for omap devices based on driver model > and device tree. > > Signed-off-by: Mugunthan V N > --- > drivers/timer/Kconfig | 6 +++ > drivers/timer/Makefile | 1 + > drivers/timer/omap-timer.c | 108 > + > 3 files changed, 115 insertions(+) > create mode 100644 drivers/timer/omap-timer.c Applied to u-boot-dm, thanks! Please address comments in a follow-up patch. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 05/19] am43xx_evm: timer: do not define CONFIG_TIMER for spl
On 24 December 2015 at 03:38, Mugunthan V N wrote: > Since OMAP's spl doesn't support DM currently, do not define > CONFIG_TIMER for spl build. > > Signed-off-by: Mugunthan V N > --- > include/configs/am43xx_evm.h | 1 + > 1 file changed, 1 insertion(+) Applied to u-boot-dm, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 07/19] defconfig: am437x_sk_evm: enable timer driver model
On 4 January 2016 at 12:58, Tom Rini wrote: > On Thu, Dec 24, 2015 at 04:08:10PM +0530, Mugunthan V N wrote: > >> Enable timer driver model for am437x_sk_evm as omap-timer supports >> driver model. >> >> Signed-off-by: Mugunthan V N > > Reviewed-by: Tom Rini > > -- > Tom Applied to u-boot-dm, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 06/19] arm: dts: am437x-sk-evm: add tick-timer to chosen node
On 24 December 2015 at 03:38, Mugunthan V N wrote: > Specify which timer to be used as tick-timer in chosen node. > > Signed-off-by: Mugunthan V N > --- > arch/arm/dts/am437x-sk-evm.dts | 1 + > 1 file changed, 1 insertion(+) Applied to u-boot-dm, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 08/19] arm: dts: am437x-gp-evm: add tick-timer to chosen node
On 4 January 2016 at 12:58, Tom Rini wrote: > On Thu, Dec 24, 2015 at 04:08:11PM +0530, Mugunthan V N wrote: > >> Specify which timer to be used as tick-timer in chosen node. >> >> Signed-off-by: Mugunthan V N > > Reviewed-by: Tom Rini > > -- > Tom Applied to u-boot-dm, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 11/19] arm: dts: am335x-boneblack: add tick-timer to chosen node
On 4 January 2016 at 12:58, Tom Rini wrote: > On Thu, Dec 24, 2015 at 04:08:14PM +0530, Mugunthan V N wrote: > >> Specify which timer to be used as tick-timer in chosen node. >> >> Signed-off-by: Mugunthan V N > > Reviewed-by: Tom Rini > > -- > Tom Applied to u-boot-dm, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 10/19] am335x_evm: timer: do not define CONFIG_TIMER for spl
On 4 January 2016 at 12:58, Tom Rini wrote: > On Thu, Dec 24, 2015 at 04:08:13PM +0530, Mugunthan V N wrote: > >> Since OMAP's spl doesn't support DM currently, do not define >> CONFIG_TIMER for spl build. >> >> Signed-off-by: Mugunthan V N > > Reviewed-by: Tom Rini > > -- > Tom Applied to u-boot-dm, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 09/19] defconfig: am437x_gp_evm: enable timer driver model
On 4 January 2016 at 12:58, Tom Rini wrote: > On Thu, Dec 24, 2015 at 04:08:12PM +0530, Mugunthan V N wrote: > >> Enable timer driver model for am437x_gp_evm as omap-timer supports >> driver model. >> >> Signed-off-by: Mugunthan V N > > Reviewed-by: Tom Rini > > -- > Tom Applied to u-boot-dm, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 12/19] defconfig: am335x_boneblack_vboot: enable timer driver model
On 4 January 2016 at 12:58, Tom Rini wrote: > On Thu, Dec 24, 2015 at 04:08:15PM +0530, Mugunthan V N wrote: > >> Enable timer driver model for am335x_boneblack_vboot as >> omap-timer supports driver model. >> >> Signed-off-by: Mugunthan V N > > Reviewed-by: Tom Rini > > -- > Tom Applied to u-boot-dm, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 14/19] defconfig: am335x_gp_evm: enable timer driver model
On 4 January 2016 at 12:58, Tom Rini wrote: > On Thu, Dec 24, 2015 at 04:08:17PM +0530, Mugunthan V N wrote: > >> Enable timer driver model for am335x_gp_evm as omap-timer supports >> driver model. >> >> Signed-off-by: Mugunthan V N > > Reviewed-by: Tom Rini > > -- > Tom Applied to u-boot-dm, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 15/19] ti_omap5_common: timer: do not define CONFIG_TIMER for spl
On 4 January 2016 at 12:58, Tom Rini wrote: > On Thu, Dec 24, 2015 at 04:08:18PM +0530, Mugunthan V N wrote: > >> Since OMAP's spl doesn't support DM currently, do not define >> CONFIG_TIMER for spl build. >> >> Signed-off-by: Mugunthan V N > > Reviewed-by: Tom Rini > > -- > Tom Applied to u-boot-dm, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 16/19] arm: dts: dra72-evm: add tick-timer to chosen node
On 4 January 2016 at 12:58, Tom Rini wrote: > On Thu, Dec 24, 2015 at 04:08:19PM +0530, Mugunthan V N wrote: > >> Specify timer2 to be used as tick-timer in chosen node. >> >> Signed-off-by: Mugunthan V N > > Reviewed-by: Tom Rini > > -- > Tom Applied to u-boot-dm, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 13/19] arm: dts: am335x-evm: add tick-timer to chosen node
On 4 January 2016 at 12:58, Tom Rini wrote: > On Thu, Dec 24, 2015 at 04:08:16PM +0530, Mugunthan V N wrote: > >> Specify timer2 to be used as tick-timer in chosen node. >> >> Signed-off-by: Mugunthan V N > > Reviewed-by: Tom Rini > > -- > Tom Applied to u-boot-dm, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 17/19] defconfig: dra72_evm: enable timer driver model
On 4 January 2016 at 12:58, Tom Rini wrote: > On Thu, Dec 24, 2015 at 04:08:20PM +0530, Mugunthan V N wrote: > >> Enable timer driver model for dra72_evm_defconfig as omap-timer >> supports driver model. >> >> Signed-off-by: Mugunthan V N > > Reviewed-by: Tom Rini > > -- > Tom Applied to u-boot-dm, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 18/19] arm: dts: dra7-evm: add tick-timer to chosen node
On 4 January 2016 at 12:59, Tom Rini wrote: > On Thu, Dec 24, 2015 at 04:08:21PM +0530, Mugunthan V N wrote: > >> Specify timer2 to be used as tick-timer in chosen node. >> >> Signed-off-by: Mugunthan V N > > Reviewed-by: Tom Rini > > -- > Tom Applied to u-boot-dm, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 19/19] defconfig: dra74_evm: enable timer driver model
On 4 January 2016 at 12:59, Tom Rini wrote: > On Thu, Dec 24, 2015 at 04:08:22PM +0530, Mugunthan V N wrote: > >> Enable timer driver model for dra74_evm_defconfig as omap-timer >> supports driver model. >> >> Signed-off-by: Mugunthan V N > > Reviewed-by: Tom Rini > > -- > Tom Applied to u-boot-dm, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 07/10] dm: mmc: Try to honour the sequence order
On 29 December 2015 at 05:22, Simon Glass wrote: > At present we add driver-model MMC devices in the order we find them. The > 'alias' order is not honoured. > > It is difficult to fix this for the case where we have holes in the > sequence. But for the common case where the devices are numbered from 0 > without any gaps, we can add the devices to the internal data structures > in this order. > > Signed-off-by: Simon Glass > --- > > drivers/mmc/mmc.c | 20 +++- > 1 file changed, 15 insertions(+), 5 deletions(-) Applied to u-boot-dm ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 06/10] dm: gpio: Allow the uclass to work without printf()
On 29 December 2015 at 05:22, Simon Glass wrote: > For SPL we don't really need sprintf() and with tiny-printf this is not > available. Allow this to be dropped in SPL when using tiny-printf. > > Signed-off-by: Simon Glass > --- > > drivers/gpio/gpio-uclass.c | 8 > 1 file changed, 8 insertions(+) Applied to u-boot-dm ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 04/10] tiny-printf: Avoid printing NULL strings
On 29 December 2015 at 06:23, Stefan Roese wrote: > On 29.12.2015 13:22, Simon Glass wrote: >> >> Add a check for NULL strings to avoid printing junk to the console. >> >> Signed-off-by: Simon Glass >> --- >> >> lib/tiny-printf.c | 6 -- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c >> index 403b134..efe5c25 100644 >> --- a/lib/tiny-printf.c >> +++ b/lib/tiny-printf.c >> @@ -108,8 +108,10 @@ int vprintf(const char *fmt, va_list va) >> w--; >> while (w-- > 0) >> putc(lz ? '0' : ' '); >> - while ((ch = *p++)) >> - putc(ch); >> + if (p) { >> + while ((ch = *p++)) >> + putc(ch); >> + } >> } >> } >> >> > > Reviewed-by: Stefan Roese Applied to u-boot-dm ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 08/10] i2c: Correct command return values
On 4 January 2016 at 00:08, Heiko Schocher wrote: > Hello Simon, > > Am 29.12.2015 um 13:22 schrieb Simon Glass: >> >> We should not return a -ve error code from command functions. Instead, >> return CMD_RET_FAILURE. This avoids the "exit not allowed from main input >> shell" error messages from the hush shell. >> >> Signed-off-by: Simon Glass >> --- >> >> common/cmd_i2c.c | 6 -- >> 1 file changed, 4 insertions(+), 2 deletions(-) > > > Thanks! As it is in a patchserie: > > Acked-by: Heiko Schocher > Applied to u-boot-dm! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 01/18] tiny-printf: Always print zeroes
On 13 January 2016 at 14:55, Tom Rini wrote: > On Tue, Jan 05, 2016 at 09:30:57AM -0700, Simon Glass wrote: > >> At present this does not print zero values in numeric format (hex and >> decimal). Add a special case for this. >> >> Signed-off-by: Simon Glass > > Reviewed-by: Tom Rini > > -- > Tom Applied to u-boot-dm ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 10/10] pinctrl: Avoid binding all pinconfig nodes before relocation
On 29 December 2015 at 05:22, Simon Glass wrote: > This can create a large number of pinctrl devices. It chews up early > malloc() memory and takes time. Only bind those which are marked as needed > before relocation. > > Signed-off-by: Simon Glass > --- > > drivers/pinctrl/pinctrl-uclass.c | 4 > 1 file changed, 4 insertions(+) Applied to u-boot-dm! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 02/18] sandbox: Support the bmp command
On 13 January 2016 at 14:55, Tom Rini wrote: > On Tue, Jan 05, 2016 at 09:30:58AM -0700, Simon Glass wrote: > >> Adjust this command to use map_sysmem() correctly so that it works on >> sandbox. >> >> Signed-off-by: Simon Glass > > Reviewed-by: Tom Rini > > -- > Tom Applied to u-boot-dm ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 03/18] dm: core: Call uclass post_bind() after the driver's bind() method
On 13 January 2016 at 14:55, Tom Rini wrote: > On Tue, Jan 05, 2016 at 09:30:59AM -0700, Simon Glass wrote: > >> At present the uclass's post_bind() method is called before the driver's >> bind() method. This means that the uclass cannot use any of the information >> set up by the driver. Move it later in the sequence to permit this. >> >> This is an ordering change which is always fairly major in nature. The main >> impact is that devices which have children will not see them appear in their >> bind() method. From what I can see, existing drivers do not look at their >> children in the bind() method, so this should be safe. >> >> Conceptually this change seems to result in a 'more correct' ordering, since >> the uclass (which is broader than the device) gets the last word. >> >> Signed-off-by: Simon Glass > > Reviewed-by: Tom Rini > > -- > Tom Applied to u-boot-dm ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 04/18] bzip2: Support compression for sandbox
On 13 January 2016 at 14:55, Tom Rini wrote: > On Tue, Jan 05, 2016 at 09:31:00AM -0700, Simon Glass wrote: > >> Add the missing code to allow bzip2 compression to be used. This is useful >> for sandbox tests. These files are taken from the bzip2 1.0.6 release. >> The license text is copied to the top of each file as is done with other >> bzip2 files in U-Boot. The only other change is to squash a compiler warning >> with nBytes. >> >> Signed-off-by: Simon Glass > > Reviewed-by: Tom Rini > > -- > Tom Applied to u-boot-dm ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/3] timer: sandbox: work without device tree
On 11 January 2016 at 09:58, Simon Glass wrote: > On 6 January 2016 at 10:33, Stephen Warren wrote: >> From: Stephen Warren >> >> A default invocation of sandbox U-Boot apparently uses no device tree, >> which means that no timer is registers, which in turn means that the >> sleep shell command hangs. >> >> Fix the sandbox timer code to register a device when there's no DT, just >> like e.g. the sandbox reset driver does. When there's no DT, the DM uclass >> can't initialize clock_rate from DT, so set a default value in the >> timer code instead. >> >> Signed-off-by: Stephen Warren >> --- >> drivers/timer/sandbox_timer.c | 10 ++ >> 1 file changed, 10 insertions(+) > > Acked-by: Simon Glass Applied to u-boot-dm, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot