Re: [U-Boot] [PATCH] Fix unreliable detection of DRAM size on Orange Pi 3

2019-08-24 Thread Ondřej Jirman
Hi Jagan,

can you please apply this patch to the sunxi tree, so that it
doesn't get lost.

thank you,
Ondrej

On Mon, Jul 29, 2019 at 01:39:42AM +0200, megous hlavni wrote:
> From: Ondrej Jirman 
> 
> Orange Pi 3 has 2 GiB of DRAM, that sometime get misdetected
> as 4 GiB, due to false negative result from mctl_mem_matches()
> when detecting number of column address bits. This leads to
> u-boot detecting more address bits than there are and the
> boot process hangs shortly after.
> 
> In mctl_mem_matches() we need to wait for each write to finish,
> separately. Without this, the check is not reliable for some
> unknown reason, probably having to do with unpredictable memory
> access ordering.
> 
> Patch was made with help from André Przywara, who noticed that
> my original idea about detection failing due to read-back from
> cache without involving DRAM was false, because data cache is
> still of at the time of the DRAM size autodetection.
> 
> Signed-off-by: Ondrej Jirman 
> Cc: André Przywara 
> ---
>  arch/arm/mach-sunxi/dram_helpers.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/mach-sunxi/dram_helpers.c 
> b/arch/arm/mach-sunxi/dram_helpers.c
> index 239ab421a8..6dba448638 100644
> --- a/arch/arm/mach-sunxi/dram_helpers.c
> +++ b/arch/arm/mach-sunxi/dram_helpers.c
> @@ -30,6 +30,7 @@ bool mctl_mem_matches(u32 offset)
>  {
>   /* Try to write different values to RAM at two addresses */
>   writel(0, CONFIG_SYS_SDRAM_BASE);
> + dsb();
>   writel(0xaa55aa55, (ulong)CONFIG_SYS_SDRAM_BASE + offset);
>   dsb();
>   /* Check if the same value is actually observed when reading back */
> -- 
> 2.22.0
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] Kconfig: Varios: Fix more SPL, TPL dependencies

2019-08-24 Thread Adam Ford
Several options are presenting themselves on a various boards
where the options are clearly not used.  (ie, SPL/TPL options
when SPL or TPL are not defined)

This patch is not attempting to be a complete list of items, but
more like low hanging fruit.  In some instances, I wasn't sure
of DM was required, so I simply made them SPL or TPL.

This patch attempts to reduce some of the menuconfig noise
by defining dependencies so they don't appear when not used.

Signed-off-by: Adam Ford 

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 660aa66d84..5b70f1e4ff 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -435,6 +435,7 @@ config SPL_HASH_SUPPORT
 
 config TPL_HASH_SUPPORT
bool "Support hashing drivers in TPL"
+   depends on TPL
select SHA1
select SHA256
help
diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 82cd8f623c..95fe0aea2c 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -48,6 +48,7 @@ config CLK_BOSTON
 
 config SPL_CLK_CCF
bool "SPL Common Clock Framework [CCF] support "
+   depends on SPL
help
  Enable this option if you want to (re-)use the Linux kernel's Common
  Clock Framework [CCF] code in U-Boot's SPL.
diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig
index 2d195ae35e..3b95b5387b 100644
--- a/drivers/core/Kconfig
+++ b/drivers/core/Kconfig
@@ -92,7 +92,7 @@ config DM_SEQ_ALIAS
 
 config SPL_DM_SEQ_ALIAS
bool "Support numbered aliases in device tree in SPL"
-   depends on DM
+   depends on SPL_DM
default n
help
  Most boards will have a '/aliases' node containing the path to
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index cb8b5c04db..8037b6ee2d 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -88,6 +88,7 @@ config CROS_EC
 
 config SPL_CROS_EC
bool "Enable Chrome OS EC in SPL"
+   depends on SPL
help
  Enable access to the Chrome OS EC in SPL. This is a separate
  microcontroller typically available on a SPI bus on Chromebooks. It
@@ -97,6 +98,7 @@ config SPL_CROS_EC
 
 config TPL_CROS_EC
bool "Enable Chrome OS EC in TPL"
+   depends on TPL
help
  Enable access to the Chrome OS EC in TPL. This is a separate
  microcontroller typically available on a SPI bus on Chromebooks. It
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 3942f035eb..02312273e2 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -19,7 +19,7 @@ config PHY
 
 config SPL_PHY
bool "PHY Core in SPL"
-   depends on DM
+   depends on DM && SPL
help
  PHY support in SPL.
 
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 8a447fd6e3..ae2d819ba9 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -45,7 +45,7 @@ config SERIAL_PRESENT
 
 config SPL_SERIAL_PRESENT
bool "Provide a serial driver in SPL"
-   depends on DM_SERIAL
+   depends on DM_SERIAL && SPL
default y
help
  In very space-constrained devices even the full UART driver is too
@@ -55,7 +55,7 @@ config SPL_SERIAL_PRESENT
 
 config TPL_SERIAL_PRESENT
bool "Provide a serial driver in TPL"
-   depends on DM_SERIAL
+   depends on DM_SERIAL && TPL
default y
help
  In very space-constrained devices even the full UART driver is too
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH V2] Convert CONFIG_FSL_USDHC to Kconfig

2019-08-24 Thread Tom Rini
On Wed, Aug 14, 2019 at 07:23:43AM -0500, Adam Ford wrote:

> This converts the following to Kconfig:
>CONFIG_FSL_USDHC
> 
> Signed-off-by: Adam Ford 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] Convert CONFIG_MX_CYCLIC to Kconfig

2019-08-24 Thread Tom Rini
On Wed, Aug 14, 2019 at 07:54:34AM -0500, Adam Ford wrote:

> This converts the following to Kconfig:
>CONFIG_MX_CYCLIC
> 
> Signed-off-by: Adam Ford 
> Acked-by: David Lechner 
> 
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index 041de1d831..05872fa0d7 100644

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Pull request: u-boot-rockchip-20190823

2019-08-24 Thread Tom Rini
On Sat, Aug 24, 2019 at 08:27:30AM +0800, Kever Yang wrote:

> Hi Tom,
> 
> Please pull the rockchip update:
> - remove rk3288 fennec board
> - remove SPL raw image support for Rockchip SoCs
> - add common misc_init_r() for ethaddr from cpuid
> - enable USB HOST support for rk3328
> - unify code for finding a valid gpt in part driver
> 
> Gitlab CI:
> https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip/pipelines/506
> 
> Thanks,
> - Kever
> 
> The following changes since commit c399dca83434290ac502207f2d6db13c59d89267:
> 
>   Merge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq (2019-08-22 
> 07:29:54 -0400)
> 
> are available in the Git repository at:
> 
>   https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip.git 
> tags/u-boot-rockchip-20190823
> 
> for you to fetch changes up to cbd298b6ee78f3a1187798a30ecdca339df8c65d:
> 
>   evb_rk3399: revert CONFIG_SYS_MMC_ENV_DEV to 0 (2019-08-23 18:15:31 +0800)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] Kconfigs: Various: Fix some SPL, TPL and ARM64 dependencies

2019-08-24 Thread Tom Rini
On Tue, Aug 13, 2019 at 02:32:30PM -0500, Adam Ford wrote:

> Several options are presenting themselves on a various boards
> where the options are clearly not used.  (ie, arm64 options on
> arm9, or SPL/TPL options when SPL or TPL are not defined)
> 
> This patch is not attempting to be a complete list of items, but
> more like low hanging fruit.
> 
> This patch attempts to reduce some of the menuconfig noise
> by defining dependencies so they don't appear when not used.
> 
> Signed-off-by: Adam Ford 
> 
> diff --git a/Kconfig b/Kconfig
> index d2eb744e70..643bb8cc01 100644

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] kconfig: Convert CONFIG_MXS_GPIO to Kconfig

2019-08-24 Thread Tom Rini
On Tue, Aug 13, 2019 at 06:10:39PM +0200, Lukasz Majewski wrote:

> This converts the following to Kconfig:
>CONFIG_MXS_GPIO
> 
> Travis-CI: https://travis-ci.org/lmajewski/u-boot-dfu/builds/571260789
> 
> Signed-off-by: Lukasz Majewski 
> Acked-by: Peng Fan 
> Acked-by: Jagan Teki 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [GIT] Pull request: u-boot-clk (22.08.2019)

2019-08-24 Thread Tom Rini
On Thu, Aug 22, 2019 at 05:14:57PM +0200, Lukasz Majewski wrote:

> Dear Tom,
> 
> Please find a PR for u-boot-clk branch:
> 
> The following changes since commit
> 753e5385ca6d0fe5b5f5a3a97cc96b0f2469ca94:

Can you please provide at least a summary in the future, if not a tag?

> 
>   test/py: Add cmd_memory dependency back to test_mmc_wr (2019-08-22
>   00:09:58 +0200)
> 
> are available in the git repository at:
> 
>https://gitlab.denx.de/u-boot/custodians/u-boot-clk
> 
> for you to fetch changes up to f62ec5c4bba2556202523b0f48655dacbe90753a:
> 
>   clk: imx: add i.MX8MM clk driver (2019-08-22 00:10:15 +0200)
> 

Applied to u-boot/master, thanks!



-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] sunxi: H6: DRAM: Add support for half DQ

2019-08-24 Thread Thomas Graichen
hi jernej,

On Mon, Aug 19, 2019 at 8:29 PM Jernej Škrabec  wrote:
>
> +CC: Thomas
>
> Dne četrtek, 18. julij 2019 ob 00:16:17 CEST je Jernej Skrabec napisal(a):
> > Half DQ configuration seems to be very rare for H6 based boards/STBs,
> > but exists nevertheless. Currently the only known product which needs
> > this support is Tanix TX6 mini.
> >
> > This commit adds support for half DQ configuration. Code was tested
> > for regressions on other configurations (OrangePi 3 1 GiB/LPDDR3, Tanix
> > TX6 4 GiB/DDR3) and none were found.
> >
> > Thanks to Icenowy Zheng for help with this code.
> >
> > Signed-off-by: Jernej Skrabec 
>
> Thomas, please test this.

Tested-by: thomas graichen 

BEFORE (no patches applied or other earlier h6 patches applied):
the tanix tx6 mini tv box did not boot

AFTER (this patch applied):
the tanix tx6 mini tv box is booting fine now. also cross tested to
boot fine on a non-half-dq eachlink h6 mini tv box as well.

best wishes - thomas

> Best regards,
> Jernej
>
> > ---
> >  .../include/asm/arch-sunxi/dram_sun50i_h6.h   |  1 +
> >  arch/arm/mach-sunxi/dram_sun50i_h6.c  | 74 ---
> >  2 files changed, 50 insertions(+), 25 deletions(-)
> >
> > diff --git a/arch/arm/include/asm/arch-sunxi/dram_sun50i_h6.h
> > b/arch/arm/include/asm/arch-sunxi/dram_sun50i_h6.h index
> > 0a1da02376..49a8a66f7b 100644
> > --- a/arch/arm/include/asm/arch-sunxi/dram_sun50i_h6.h
> > +++ b/arch/arm/include/asm/arch-sunxi/dram_sun50i_h6.h
> > @@ -315,6 +315,7 @@ struct dram_para {
> >   u8 cols;
> >   u8 rows;
> >   u8 ranks;
> > + u8 bus_full_width;
> >   const u8 dx_read_delays[NR_OF_BYTE_LANES][RD_LINES_PER_BYTE_LANE];
> >   const u8 dx_write_delays[NR_OF_BYTE_LANES]
> [WR_LINES_PER_BYTE_LANE];
> >  };
> > diff --git a/arch/arm/mach-sunxi/dram_sun50i_h6.c
> > b/arch/arm/mach-sunxi/dram_sun50i_h6.c index 2a8275da3a..0d65327d35 100644
> > --- a/arch/arm/mach-sunxi/dram_sun50i_h6.c
> > +++ b/arch/arm/mach-sunxi/dram_sun50i_h6.c
> > @@ -201,6 +201,9 @@ static void mctl_set_addrmap(struct dram_para *para)
> >   u8 rows = para->rows;
> >   u8 ranks = para->ranks;
> >
> > + if (!para->bus_full_width)
> > + cols -= 1;
> > +
> >   /* Ranks */
> >   if (ranks == 2)
> >   mctl_ctl->addrmap[0] = rows + cols - 3;
> > @@ -213,6 +216,10 @@ static void mctl_set_addrmap(struct dram_para *para)
> >   /* Columns */
> >   mctl_ctl->addrmap[2] = 0;
> >   switch (cols) {
> > + case 7:
> > + mctl_ctl->addrmap[3] = 0x1F1F1F00;
> > + mctl_ctl->addrmap[4] = 0x1F1F;
> > + break;
> >   case 8:
> >   mctl_ctl->addrmap[3] = 0x1F1F;
> >   mctl_ctl->addrmap[4] = 0x1F1F;
> > @@ -300,13 +307,16 @@ static void mctl_com_init(struct dram_para *para)
> >   reg_val = 0x3f00;
> >   clrsetbits_le32(_com->unk_0x008, 0x3f00, reg_val);
> >
> > - /* TODO: half DQ, DDR4 */
> > - reg_val = MSTR_BUSWIDTH_FULL | MSTR_BURST_LENGTH(8) |
> > -   MSTR_ACTIVE_RANKS(para->ranks);
> > + /* TODO: DDR4 */
> > + reg_val = MSTR_BURST_LENGTH(8) | MSTR_ACTIVE_RANKS(para->ranks);
> >   if (para->type == SUNXI_DRAM_TYPE_LPDDR3)
> >   reg_val |= MSTR_DEVICETYPE_LPDDR3;
> >   if (para->type == SUNXI_DRAM_TYPE_DDR3)
> >   reg_val |= MSTR_DEVICETYPE_DDR3 | MSTR_2TMODE;
> > + if (para->bus_full_width)
> > + reg_val |= MSTR_BUSWIDTH_FULL;
> > + else
> > + reg_val |= MSTR_BUSWIDTH_HALF;
> >   writel(reg_val | BIT(31), _ctl->mstr);
> >
> >   if (para->type == SUNXI_DRAM_TYPE_LPDDR3)
> > @@ -333,7 +343,10 @@ static void mctl_com_init(struct dram_para *para)
> >   }
> >   writel(reg_val, _ctl->odtcfg);
> >
> > - /* TODO: half DQ */
> > + if (!para->bus_full_width) {
> > + writel(0x0, _phy->dx[2].gcr[0]);
> > + writel(0x0, _phy->dx[3].gcr[0]);
> > + }
> >  }
> >
> >  static void mctl_bit_delay_set(struct dram_para *para)
> > @@ -514,22 +527,31 @@ static void mctl_channel_init(struct dram_para *para)
> >
> >   if (readl(_phy->pgsr[0]) & 0x40)
> >   {
> > - /*
> > -  * Detect single rank.
> > -  * TODO: also detect half DQ.
> > -  */
> > + /* Check for single rank and optionally half DQ. */
> >   if ((readl(_phy->dx[0].rsr[0]) & 0x3) == 2 &&
> > - (readl(_phy->dx[1].rsr[0]) & 0x3) == 2 &&
> > - (readl(_phy->dx[2].rsr[0]) & 0x3) == 2 &&
> > - (readl(_phy->dx[3].rsr[0]) & 0x3) == 2) {
> > + (readl(_phy->dx[1].rsr[0]) & 0x3) == 2) {
> >   para->ranks = 1;
> > +
> > + if ((readl(_phy->dx[2].rsr[0]) & 0x3) !=
> 2 ||
> > + (readl(_phy->dx[3].rsr[0]) & 0x3) !=
> 2)
> > + para->bus_full_width = 0;
> > +
> >   

[U-Boot] [PATCH] mailmap: Update mail address

2019-08-24 Thread Ricardo Ribalda Delgado
Update my email address from gmail to my domain.

Signed-off-by: Ricardo Ribalda Delgado 
---
 .mailmap | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.mailmap b/.mailmap
index dc72f24688..63afce3774 100644
--- a/.mailmap
+++ b/.mailmap
@@ -31,8 +31,8 @@ Markus Klotzbuecher 
 Paul Burton  
 Prabhakar Kushwaha 
 Rajeshwari Shinde 
-Ricardo Ribalda 
-Ricardo Ribalda 
+Ricardo Ribalda  
+Ricardo Ribalda  
 Sandeep Paulraj 
 Shaohui Xie 
 Stefan Roese 
-- 
2.23.0.rc1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] cmd: pxe: Use internal FDT if external one cannot be retrieved

2019-08-24 Thread Anton Leontiev
From: Anton Leontiev 

Original commit c61d94d86035 ("pxe: implement fdtdir extlinux.conf tag")
states, that if FDT file cannot be retrieved then FDT packaged in
firmware should be used.

If FDT file cannot be retrieved and it is specified explicitly using
FDT keyword then the label is skipped. If it cannot be found in
FDTDIR then internal FDT is tried first.

Signed-off-by: Anton Leontiev 
---
 cmd/pxe.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/cmd/pxe.c b/cmd/pxe.c
index 2059975446..28390c114c 100644
--- a/cmd/pxe.c
+++ b/cmd/pxe.c
@@ -795,9 +795,13 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label 
*label)
int err = get_relfile_envaddr(cmdtp, fdtfile, 
"fdt_addr_r");
free(fdtfilefree);
if (err < 0) {
-   printf("Skipping %s for failure retrieving 
fdt\n",
-   label->name);
-   goto cleanup;
+   bootm_argv[3] = NULL;
+
+   if (label->fdt) {
+   printf("Skipping %s for failure 
retrieving FDT\n",
+  label->name);
+   goto cleanup;
+   }
}
} else {
bootm_argv[3] = NULL;
-- 
2.22.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 03/10] x86: Create a new fsp_arch.h header

2019-08-24 Thread Simon Glass
At present fsp_support.h includes fsp_vpd.h which is an FPSv1 concept
(VPD means Vital Product Data). For FSPv2 only UPD (Updatable Product
Data) is used.

To avoid mangling header files, put these two includes in a separate
header which we can adjust as necessary for FSPv2.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v2: None

 arch/x86/include/asm/fsp1/fsp_support.h |  3 +--
 arch/x86/include/asm/fsp_arch.h | 20 
 2 files changed, 21 insertions(+), 2 deletions(-)
 create mode 100644 arch/x86/include/asm/fsp_arch.h

diff --git a/arch/x86/include/asm/fsp1/fsp_support.h 
b/arch/x86/include/asm/fsp1/fsp_support.h
index 487c751fcf..a50a21ca8b 100644
--- a/arch/x86/include/asm/fsp1/fsp_support.h
+++ b/arch/x86/include/asm/fsp1/fsp_support.h
@@ -14,9 +14,8 @@
 #include "fsp_api.h"
 #include "fsp_infoheader.h"
 #include "fsp_bootmode.h"
+#include 
 #include 
-#include 
-#include 
 
 #define FSP_LOWMEM_BASE0x10UL
 #define FSP_HIGHMEM_BASE   0x1ULL
diff --git a/arch/x86/include/asm/fsp_arch.h b/arch/x86/include/asm/fsp_arch.h
new file mode 100644
index 00..fb7f9109f7
--- /dev/null
+++ b/arch/x86/include/asm/fsp_arch.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2019 Google LLC
+ * Written by Simon Glass 
+ *
+ * Architecture-specific definitions (FSP config and VPD/UPD)
+ */
+
+#ifndef __FSP_ARCH_H__
+#define __FSP_ARCH_H__
+
+/*
+ * Note: use #ifndef __ASSEMBLY__ around any struct definitions or other C code
+ * since this file can be included from assembly.
+ */
+
+#include 
+#include 
+
+#endif
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 02/10] x86: Move fsp_azalia.h to the generic fsp directory

2019-08-24 Thread Simon Glass
This header file is the same for FSP v1 and v2. Move it into the general
fsp directory.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Rewrite to make azalia a common file for FSP1 and FSP2

 arch/x86/include/asm/{fsp1 => fsp}/fsp_azalia.h | 0
 arch/x86/include/asm/fsp1/fsp_support.h | 5 -
 2 files changed, 4 insertions(+), 1 deletion(-)
 rename arch/x86/include/asm/{fsp1 => fsp}/fsp_azalia.h (100%)

diff --git a/arch/x86/include/asm/fsp1/fsp_azalia.h 
b/arch/x86/include/asm/fsp/fsp_azalia.h
similarity index 100%
rename from arch/x86/include/asm/fsp1/fsp_azalia.h
rename to arch/x86/include/asm/fsp/fsp_azalia.h
diff --git a/arch/x86/include/asm/fsp1/fsp_support.h 
b/arch/x86/include/asm/fsp1/fsp_support.h
index 7b92392a27..487c751fcf 100644
--- a/arch/x86/include/asm/fsp1/fsp_support.h
+++ b/arch/x86/include/asm/fsp1/fsp_support.h
@@ -14,7 +14,7 @@
 #include "fsp_api.h"
 #include "fsp_infoheader.h"
 #include "fsp_bootmode.h"
-#include "fsp_azalia.h"
+#include 
 #include 
 #include 
 
@@ -22,6 +22,9 @@
 #define FSP_HIGHMEM_BASE   0x1ULL
 #define UPD_TERMINATOR 0x55AA
 
+struct efi_guid;
+struct fspinit_rtbuf;
+struct fsp_config_data;
 
 /**
  * FSP Continuation assembly helper routine
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 04/10] x86: Move fsp_api.h inclusion out of fsp_support.h

2019-08-24 Thread Simon Glass
This header file is different for each version of FSP. Move it into the
fsp_arch.h header file.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v2: None

 arch/x86/include/asm/fsp1/fsp_support.h | 1 -
 arch/x86/include/asm/fsp_arch.h | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/fsp1/fsp_support.h 
b/arch/x86/include/asm/fsp1/fsp_support.h
index a50a21ca8b..f2ac8acdc9 100644
--- a/arch/x86/include/asm/fsp1/fsp_support.h
+++ b/arch/x86/include/asm/fsp1/fsp_support.h
@@ -11,7 +11,6 @@
 #include "fsp_hob.h"
 #include "fsp_fv.h"
 #include "fsp_ffs.h"
-#include "fsp_api.h"
 #include "fsp_infoheader.h"
 #include "fsp_bootmode.h"
 #include 
diff --git a/arch/x86/include/asm/fsp_arch.h b/arch/x86/include/asm/fsp_arch.h
index fb7f9109f7..b223141c44 100644
--- a/arch/x86/include/asm/fsp_arch.h
+++ b/arch/x86/include/asm/fsp_arch.h
@@ -14,6 +14,7 @@
  * since this file can be included from assembly.
  */
 
+#include 
 #include 
 #include 
 
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 08/10] x86: Move fsp_infoheader.h to the generic fsp directory

2019-08-24 Thread Simon Glass
This header file is the same for FSP v1 and v2. Move it into the general
fsp directory.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v2: None

 arch/x86/include/asm/fsp1/fsp_support.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/fsp1/fsp_support.h 
b/arch/x86/include/asm/fsp1/fsp_support.h
index 91ba48f94a..9543b8b563 100644
--- a/arch/x86/include/asm/fsp1/fsp_support.h
+++ b/arch/x86/include/asm/fsp1/fsp_support.h
@@ -9,10 +9,10 @@
 
 #include 
 #include 
+#include 
 #include 
 #include "fsp_hob.h"
 #include "fsp_ffs.h"
-#include "fsp_infoheader.h"
 #include "fsp_bootmode.h"
 #include 
 #include 
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 09/10] x86: Move fsp_bootmode.h to the generic fsp directory

2019-08-24 Thread Simon Glass
This header file is the same for FSP v1 and v2, although there may be
some additions to come. Move it into the generic fsp directory.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v2: None

 arch/x86/include/asm/{fsp1 => fsp}/fsp_bootmode.h | 0
 arch/x86/include/asm/fsp1/fsp_support.h   | 3 +--
 2 files changed, 1 insertion(+), 2 deletions(-)
 rename arch/x86/include/asm/{fsp1 => fsp}/fsp_bootmode.h (100%)

diff --git a/arch/x86/include/asm/fsp1/fsp_bootmode.h 
b/arch/x86/include/asm/fsp/fsp_bootmode.h
similarity index 100%
rename from arch/x86/include/asm/fsp1/fsp_bootmode.h
rename to arch/x86/include/asm/fsp/fsp_bootmode.h
diff --git a/arch/x86/include/asm/fsp1/fsp_support.h 
b/arch/x86/include/asm/fsp1/fsp_support.h
index 9543b8b563..d0f053fea4 100644
--- a/arch/x86/include/asm/fsp1/fsp_support.h
+++ b/arch/x86/include/asm/fsp1/fsp_support.h
@@ -7,13 +7,12 @@
 #ifndef __FSP_SUPPORT_H__
 #define __FSP_SUPPORT_H__
 
+#include 
 #include 
 #include 
 #include 
 #include 
-#include "fsp_hob.h"
 #include "fsp_ffs.h"
-#include "fsp_bootmode.h"
 #include 
 #include 
 
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 07/10] x86: Move fsp_hob.h to the generic fsp directory

2019-08-24 Thread Simon Glass
This header file is the same for FSP v1 and v2. Move it into the general
fsp directory.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v2: None

 arch/x86/include/asm/{fsp1 => fsp}/fsp_hob.h| 0
 arch/x86/include/asm/{fsp1 => fsp}/fsp_infoheader.h | 0
 arch/x86/include/asm/fsp1/fsp_support.h | 1 +
 3 files changed, 1 insertion(+)
 rename arch/x86/include/asm/{fsp1 => fsp}/fsp_hob.h (100%)
 rename arch/x86/include/asm/{fsp1 => fsp}/fsp_infoheader.h (100%)

diff --git a/arch/x86/include/asm/fsp1/fsp_hob.h 
b/arch/x86/include/asm/fsp/fsp_hob.h
similarity index 100%
rename from arch/x86/include/asm/fsp1/fsp_hob.h
rename to arch/x86/include/asm/fsp/fsp_hob.h
diff --git a/arch/x86/include/asm/fsp1/fsp_infoheader.h 
b/arch/x86/include/asm/fsp/fsp_infoheader.h
similarity index 100%
rename from arch/x86/include/asm/fsp1/fsp_infoheader.h
rename to arch/x86/include/asm/fsp/fsp_infoheader.h
diff --git a/arch/x86/include/asm/fsp1/fsp_support.h 
b/arch/x86/include/asm/fsp1/fsp_support.h
index f0f1cea599..91ba48f94a 100644
--- a/arch/x86/include/asm/fsp1/fsp_support.h
+++ b/arch/x86/include/asm/fsp1/fsp_support.h
@@ -8,6 +8,7 @@
 #define __FSP_SUPPORT_H__
 
 #include 
+#include 
 #include 
 #include "fsp_hob.h"
 #include "fsp_ffs.h"
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 10/10] x86: Move fsp_ffs.h include to fsp_arch.h

2019-08-24 Thread Simon Glass
This include file is only used for FSP v1. Avoid including it from
fdt_support.h so we can use the latter with FSP v2.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v2: None

 arch/x86/include/asm/fsp_arch.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/include/asm/fsp_arch.h b/arch/x86/include/asm/fsp_arch.h
index b223141c44..3b2077b392 100644
--- a/arch/x86/include/asm/fsp_arch.h
+++ b/arch/x86/include/asm/fsp_arch.h
@@ -15,6 +15,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 06/10] x86: Move fsp_fv.h to the generic fsp directory

2019-08-24 Thread Simon Glass
This header file is the same for FSP v1 and v2. Move it into the general
fsp directory.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v2: None

 arch/x86/include/asm/{fsp1 => fsp}/fsp_fv.h | 0
 arch/x86/include/asm/fsp1/fsp_support.h | 2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename arch/x86/include/asm/{fsp1 => fsp}/fsp_fv.h (100%)

diff --git a/arch/x86/include/asm/fsp1/fsp_fv.h 
b/arch/x86/include/asm/fsp/fsp_fv.h
similarity index 100%
rename from arch/x86/include/asm/fsp1/fsp_fv.h
rename to arch/x86/include/asm/fsp/fsp_fv.h
diff --git a/arch/x86/include/asm/fsp1/fsp_support.h 
b/arch/x86/include/asm/fsp1/fsp_support.h
index c55119448b..f0f1cea599 100644
--- a/arch/x86/include/asm/fsp1/fsp_support.h
+++ b/arch/x86/include/asm/fsp1/fsp_support.h
@@ -7,9 +7,9 @@
 #ifndef __FSP_SUPPORT_H__
 #define __FSP_SUPPORT_H__
 
+#include 
 #include 
 #include "fsp_hob.h"
-#include "fsp_fv.h"
 #include "fsp_ffs.h"
 #include "fsp_infoheader.h"
 #include "fsp_bootmode.h"
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 05/10] x86: Move fsp_types.h to the generic fsp directory

2019-08-24 Thread Simon Glass
This header file is the same for FSP v1 and v2. Move it into the general
fsp directory.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v2: None

 arch/x86/include/asm/{fsp1 => fsp}/fsp_types.h | 0
 arch/x86/include/asm/fsp1/fsp_support.h| 2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename arch/x86/include/asm/{fsp1 => fsp}/fsp_types.h (100%)

diff --git a/arch/x86/include/asm/fsp1/fsp_types.h 
b/arch/x86/include/asm/fsp/fsp_types.h
similarity index 100%
rename from arch/x86/include/asm/fsp1/fsp_types.h
rename to arch/x86/include/asm/fsp/fsp_types.h
diff --git a/arch/x86/include/asm/fsp1/fsp_support.h 
b/arch/x86/include/asm/fsp1/fsp_support.h
index f2ac8acdc9..c55119448b 100644
--- a/arch/x86/include/asm/fsp1/fsp_support.h
+++ b/arch/x86/include/asm/fsp1/fsp_support.h
@@ -7,7 +7,7 @@
 #ifndef __FSP_SUPPORT_H__
 #define __FSP_SUPPORT_H__
 
-#include "fsp_types.h"
+#include 
 #include "fsp_hob.h"
 #include "fsp_fv.h"
 #include "fsp_ffs.h"
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 01/10] x86: Rename existing FSP code to fsp1

2019-08-24 Thread Simon Glass
Since there is now a new version of the FSP and it is incompatible with
the existing version, move the code into an fsp1 directory. This will
allow us to put FSP v2 code into an fsp2 directory.

Add a Kconfig which defines which version is in use.

Some of the code in this new fsp1/ directory is generic across both FSPv1
and FSPv2. Future patches will address this.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v2:
- Correct Intel FSP web link

 arch/x86/Kconfig  | 25 ++-
 arch/x86/cpu/baytrail/acpi.c  |  2 +-
 arch/x86/cpu/baytrail/fsp_configs.c   |  2 +-
 arch/x86/cpu/braswell/fsp_configs.c   |  2 +-
 arch/x86/cpu/ivybridge/fsp_configs.c  |  2 +-
 arch/x86/cpu/queensbay/fsp_configs.c  |  2 +-
 arch/x86/cpu/queensbay/tnc.c  |  2 +-
 arch/x86/include/asm/{fsp => fsp1}/fsp_api.h  |  0
 .../include/asm/{fsp => fsp1}/fsp_azalia.h|  0
 .../include/asm/{fsp => fsp1}/fsp_bootmode.h  |  0
 arch/x86/include/asm/{fsp => fsp1}/fsp_ffs.h  |  0
 arch/x86/include/asm/{fsp => fsp1}/fsp_fv.h   |  0
 arch/x86/include/asm/{fsp => fsp1}/fsp_hob.h  |  0
 .../asm/{fsp => fsp1}/fsp_infoheader.h|  0
 .../include/asm/{fsp => fsp1}/fsp_support.h   |  0
 .../x86/include/asm/{fsp => fsp1}/fsp_types.h |  0
 arch/x86/include/asm/u-boot-x86.h |  2 +-
 arch/x86/lib/Makefile |  3 ++-
 arch/x86/lib/{fsp => fsp1}/Makefile   |  0
 arch/x86/lib/{fsp => fsp1}/fsp_car.S  |  0
 arch/x86/lib/{fsp => fsp1}/fsp_common.c   |  2 +-
 arch/x86/lib/{fsp => fsp1}/fsp_dram.c |  2 +-
 arch/x86/lib/{fsp => fsp1}/fsp_graphics.c |  2 +-
 arch/x86/lib/{fsp => fsp1}/fsp_support.c  |  2 +-
 .../som-db5800-som-6867/som-db5800-som-6867.c |  2 +-
 board/intel/cherryhill/cherryhill.c   |  2 +-
 cmd/x86/fsp.c |  2 +-
 drivers/pci/pci-uclass.c  |  2 +-
 28 files changed, 41 insertions(+), 17 deletions(-)
 rename arch/x86/include/asm/{fsp => fsp1}/fsp_api.h (100%)
 rename arch/x86/include/asm/{fsp => fsp1}/fsp_azalia.h (100%)
 rename arch/x86/include/asm/{fsp => fsp1}/fsp_bootmode.h (100%)
 rename arch/x86/include/asm/{fsp => fsp1}/fsp_ffs.h (100%)
 rename arch/x86/include/asm/{fsp => fsp1}/fsp_fv.h (100%)
 rename arch/x86/include/asm/{fsp => fsp1}/fsp_hob.h (100%)
 rename arch/x86/include/asm/{fsp => fsp1}/fsp_infoheader.h (100%)
 rename arch/x86/include/asm/{fsp => fsp1}/fsp_support.h (100%)
 rename arch/x86/include/asm/{fsp => fsp1}/fsp_types.h (100%)
 rename arch/x86/lib/{fsp => fsp1}/Makefile (100%)
 rename arch/x86/lib/{fsp => fsp1}/fsp_car.S (100%)
 rename arch/x86/lib/{fsp => fsp1}/fsp_common.c (99%)
 rename arch/x86/lib/{fsp => fsp1}/fsp_dram.c (98%)
 rename arch/x86/lib/{fsp => fsp1}/fsp_graphics.c (98%)
 rename arch/x86/lib/{fsp => fsp1}/fsp_support.c (99%)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 218e817cf3..314f8def7a 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -364,6 +364,29 @@ config HAVE_FSP
  Note: Without this binary U-Boot will not be able to set up its
  SDRAM so will not boot.
 
+choice
+   prompt "FSP version"
+   depends on HAVE_FSP
+   default FSP_VERSION1
+   help
+ Selects the FSP version to use. Intel has published several versions
+ of the FSP External Architecture Specification and this allows
+ selection of the version number used by a particular SoC.
+
+config FSP_VERSION1
+   bool "FSP version 1.x"
+   help
+ This covers versions 1.0 and 1.1a. See here for details:
+ https://github.com/IntelFsp/fsp/wiki
+
+config FSP_VERSION2
+   bool "FSP version 2.x"
+   help
+ This covers versions 2.0 and 2.1. See here for details:
+ https://github.com/IntelFsp/fsp/wiki
+
+endchoice
+
 config FSP_FILE
string "Firmware Support Package binary filename"
depends on HAVE_FSP
@@ -429,7 +452,7 @@ config ENABLE_MRC_CACHE
 
  For platforms that use Intel FSP for the memory initialization,
  please check FSP output HOB via U-Boot command 'fsp hob' to see
- if there is FSP_NON_VOLATILE_STORAGE_HOB_GUID (asm/fsp/fsp_hob.h).
+ if there is FSP_NON_VOLATILE_STORAGE_HOB_GUID (asm/fsp1/fsp_hob.h).
  If such GUID does not exist, MRC cache is not available on such
  platform (eg: Intel Queensbay), which means selecting this option
  here does not make any difference.
diff --git a/arch/x86/cpu/baytrail/acpi.c b/arch/x86/cpu/baytrail/acpi.c
index 445e4ba2d7..1e3829a433 100644
--- a/arch/x86/cpu/baytrail/acpi.c
+++ b/arch/x86/cpu/baytrail/acpi.c
@@ -167,7 +167,7 @@ void acpi_create_gnvs(struct acpi_global_nvs *gnvs)
  * and PMC_BASE_ADDRESS are accessed, so we need make sure the base addresses
  * of these two blocks are programmed by either U-Boot or FSP.
  *
- * It has been verified that 1st phase API 

[U-Boot] [PATCH v2 00/10] x86: Prepare for adding FSP2 code

2019-08-24 Thread Simon Glass
At present the x86 FSP (Firmware Support Package) code assumes that FSP
version 1 is used. Since this code was added to U-Boot a new version
(FSP2) has been produced by Intel.

In preparation for adding support for FSP2, move the existing code into
a directory that indicates it is used for FSP1.

Changes in v2:
- Correct Intel FSP web link
- Rewrite to make azalia a common file for FSP1 and FSP2

Simon Glass (10):
  x86: Rename existing FSP code to fsp1
  x86: Move fsp_azalia.h to the generic fsp directory
  x86: Create a new fsp_arch.h header
  x86: Move fsp_api.h inclusion out of fsp_support.h
  x86: Move fsp_types.h to the generic fsp directory
  x86: Move fsp_fv.h to the generic fsp directory
  x86: Move fsp_hob.h to the generic fsp directory
  x86: Move fsp_infoheader.h to the generic fsp directory
  x86: Move fsp_bootmode.h to the generic fsp directory
  x86: Move fsp_ffs.h include to fsp_arch.h

 arch/x86/Kconfig  | 25 ++-
 arch/x86/cpu/baytrail/acpi.c  |  2 +-
 arch/x86/cpu/baytrail/fsp_configs.c   |  2 +-
 arch/x86/cpu/braswell/fsp_configs.c   |  2 +-
 arch/x86/cpu/ivybridge/fsp_configs.c  |  2 +-
 arch/x86/cpu/queensbay/fsp_configs.c  |  2 +-
 arch/x86/cpu/queensbay/tnc.c  |  2 +-
 arch/x86/include/asm/{fsp => fsp1}/fsp_api.h  |  0
 arch/x86/include/asm/{fsp => fsp1}/fsp_ffs.h  |  0
 .../include/asm/{fsp => fsp1}/fsp_support.h   | 19 +++---
 arch/x86/include/asm/fsp_arch.h   | 22 
 arch/x86/include/asm/u-boot-x86.h |  2 +-
 arch/x86/lib/Makefile |  3 ++-
 arch/x86/lib/{fsp => fsp1}/Makefile   |  0
 arch/x86/lib/{fsp => fsp1}/fsp_car.S  |  0
 arch/x86/lib/{fsp => fsp1}/fsp_common.c   |  2 +-
 arch/x86/lib/{fsp => fsp1}/fsp_dram.c |  2 +-
 arch/x86/lib/{fsp => fsp1}/fsp_graphics.c |  2 +-
 arch/x86/lib/{fsp => fsp1}/fsp_support.c  |  2 +-
 .../som-db5800-som-6867/som-db5800-som-6867.c |  2 +-
 board/intel/cherryhill/cherryhill.c   |  2 +-
 cmd/x86/fsp.c |  2 +-
 drivers/pci/pci-uclass.c  |  2 +-
 23 files changed, 73 insertions(+), 26 deletions(-)
 rename arch/x86/include/asm/{fsp => fsp1}/fsp_api.h (100%)
 rename arch/x86/include/asm/{fsp => fsp1}/fsp_ffs.h (100%)
 rename arch/x86/include/asm/{fsp => fsp1}/fsp_support.h (94%)
 create mode 100644 arch/x86/include/asm/fsp_arch.h
 rename arch/x86/lib/{fsp => fsp1}/Makefile (100%)
 rename arch/x86/lib/{fsp => fsp1}/fsp_car.S (100%)
 rename arch/x86/lib/{fsp => fsp1}/fsp_common.c (99%)
 rename arch/x86/lib/{fsp => fsp1}/fsp_dram.c (98%)
 rename arch/x86/lib/{fsp => fsp1}/fsp_graphics.c (98%)
 rename arch/x86/lib/{fsp => fsp1}/fsp_support.c (99%)

-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 18/34] binman: Use the Makefile for u_boot_binman_syms_bad

2019-08-24 Thread Simon Glass
Remove this file from git and instead build it using the Makefile.

Signed-off-by: Simon Glass 
---

 tools/binman/elf_test.py |   4 ++--
 tools/binman/test/Makefile   |   2 +-
 tools/binman/test/u_boot_binman_syms_bad | Bin 4890 -> 0 bytes
 3 files changed, 3 insertions(+), 3 deletions(-)
 delete mode 100755 tools/binman/test/u_boot_binman_syms_bad

diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index a913970150..1ee5d9d57c 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -72,7 +72,7 @@ def BuildElfTestFiles(target_dir):
   os.path.join(testdir, 'Makefile'), 'SRC=%s/' % testdir,
   'bss_data', 'u_boot_ucode_ptr', 'u_boot_no_ucode_ptr',
   'u_boot_binman_syms', 'u_boot_binman_syms.bin',
-  'u_boot_binman_syms_size')
+  'u_boot_binman_syms_size', 'u_boot_binman_syms_bad')
 
 
 class TestElf(unittest.TestCase):
@@ -134,7 +134,7 @@ class TestElf(unittest.TestCase):
 """
 entry = FakeEntry(10)
 section = FakeSection()
-elf_fname = os.path.join(binman_dir, 'test', 'u_boot_binman_syms_bad')
+elf_fname = self.ElfTestFile('u_boot_binman_syms_bad')
 self.assertEqual(elf.LookupAndWriteSymbols(elf_fname, entry, section),
  None)
 
diff --git a/tools/binman/test/Makefile b/tools/binman/test/Makefile
index 7af5459793..593bbe9bd9 100644
--- a/tools/binman/test/Makefile
+++ b/tools/binman/test/Makefile
@@ -13,7 +13,7 @@ CFLAGS := -march=i386 -m32 -nostdlib -I 
$(SRC)../../../include \
 
 LDS_UCODE := -T $(SRC)u_boot_ucode_ptr.lds
 LDS_BINMAN := -T $(SRC)u_boot_binman_syms.lds
-LDS_BINMAN_BAD := -T u_boot_binman_syms_bad.lds
+LDS_BINMAN_BAD := -T $(SRC)u_boot_binman_syms_bad.lds
 
 TARGETS = u_boot_ucode_ptr u_boot_no_ucode_ptr bss_data \
u_boot_binman_syms u_boot_binman_syms.bin u_boot_binman_syms_bad \
diff --git a/tools/binman/test/u_boot_binman_syms_bad 
b/tools/binman/test/u_boot_binman_syms_bad
deleted file mode 100755
index 
8da3d9d48f388a9be53e92590984411691f6721f..
GIT binary patch
literal 0
HcmV?d1

literal 4890
zcmeHLJ!=$E6up~WjOjLFrOg^`2yqpRVv#}#JZ3VBF6_=MJ8y(ENwASv
zTZuow-an8(k|ITFk^BHXXW!gp@?m5BF5I~v=e#@bo!MsJ-ulaDjYdP%=A?|UEab!>$^ba;d9Esg+fF-hI
zYC2Er>!RM|@O-r9g*UTShR0j-`;X7g>pMufp8HzF`iCBxJ=-|V6J$O3O*rv)h}25?
zACdEJh}H)F8BzDcT1uPbxwGeAzOYH0nr+cmMJOgCJDKJaJIM>Ng^Q=|8p>*oQ;n?F
U$JtH|)8YK34YE{hz2S%d1wo~NOaK4?

-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 24/34] binman: Increase size of TPL and SPL test data

2019-08-24 Thread Simon Glass
At present these are large enough to hold 20 bytes of symbol data. Add
four more bytes so we can add another test.

Unfortunately at present this involves changing a few test files to make
room. We could adjust the test files to not specify sizes for entries.
Then we could make the tests check the actual sizes. But for now, leave it
as it is, since the effort is minor.

Signed-off-by: Simon Glass 
---

 tools/binman/ftest.py  | 14 +++---
 tools/binman/test/021_image_pad.dts|  2 +-
 tools/binman/test/024_sorted.dts   |  2 +-
 tools/binman/test/028_pack_4gb_outside.dts |  2 +-
 tools/binman/test/029_x86_rom.dts  |  2 +-
 tools/binman/test/053_symbols.dts  |  2 +-
 tools/binman/test/149_symbols_tpl.dts  |  4 ++--
 7 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 1eb0d3b684..65d3ad59ea 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -39,8 +39,8 @@ import tout
 # Contents of test files, corresponding to different entry types
 U_BOOT_DATA   = b'1234'
 U_BOOT_IMG_DATA   = b'img'
-U_BOOT_SPL_DATA   = b'56780123456789abcde'
-U_BOOT_TPL_DATA   = b'tpl9876543210fedcb'
+U_BOOT_SPL_DATA   = b'56780123456789abcdefghi'
+U_BOOT_TPL_DATA   = b'tpl9876543210fedcbazyw'
 BLOB_DATA = b'89'
 ME_DATA   = b'0abcd'
 VGA_DATA  = b'vga'
@@ -922,7 +922,7 @@ class TestFunctional(unittest.TestCase):
 """Test that a basic x86 ROM can be created"""
 self._SetupSplElf()
 data = self._DoReadFile('029_x86_rom.dts')
-self.assertEqual(U_BOOT_DATA + tools.GetBytes(0, 7) + U_BOOT_SPL_DATA +
+self.assertEqual(U_BOOT_DATA + tools.GetBytes(0, 3) + U_BOOT_SPL_DATA +
  tools.GetBytes(0, 2), data)
 
 def testPackX86RomMeNoDesc(self):
@@ -1236,7 +1236,7 @@ class TestFunctional(unittest.TestCase):
 
 self._SetupSplElf('u_boot_binman_syms')
 data = self._DoReadFile('053_symbols.dts')
-sym_values = struct.pack(';
+   offset = <24>;
};
};
 };
diff --git a/tools/binman/test/024_sorted.dts b/tools/binman/test/024_sorted.dts
index d35d39f077..b79d9adf68 100644
--- a/tools/binman/test/024_sorted.dts
+++ b/tools/binman/test/024_sorted.dts
@@ -7,7 +7,7 @@
binman {
sort-by-offset;
u-boot {
-   offset = <22>;
+   offset = <26>;
};
 
u-boot-spl {
diff --git a/tools/binman/test/028_pack_4gb_outside.dts 
b/tools/binman/test/028_pack_4gb_outside.dts
index 2216abfb70..11a1f6059e 100644
--- a/tools/binman/test/028_pack_4gb_outside.dts
+++ b/tools/binman/test/028_pack_4gb_outside.dts
@@ -13,7 +13,7 @@
};
 
u-boot-spl {
-   offset = <0xffeb>;
+   offset = <0xffe7>;
};
};
 };
diff --git a/tools/binman/test/029_x86_rom.dts 
b/tools/binman/test/029_x86_rom.dts
index d5c69f9d4a..88aa007bba 100644
--- a/tools/binman/test/029_x86_rom.dts
+++ b/tools/binman/test/029_x86_rom.dts
@@ -13,7 +13,7 @@
};
 
u-boot-spl {
-   offset = <0xffeb>;
+   offset = <0xffe7>;
};
};
 };
diff --git a/tools/binman/test/053_symbols.dts 
b/tools/binman/test/053_symbols.dts
index 9f135676cb..8af575158f 100644
--- a/tools/binman/test/053_symbols.dts
+++ b/tools/binman/test/053_symbols.dts
@@ -10,7 +10,7 @@
};
 
u-boot {
-   offset = <20>;
+   offset = <24>;
};
 
u-boot-spl2 {
diff --git a/tools/binman/test/149_symbols_tpl.dts 
b/tools/binman/test/149_symbols_tpl.dts
index 087e10f292..dfc84af5e7 100644
--- a/tools/binman/test/149_symbols_tpl.dts
+++ b/tools/binman/test/149_symbols_tpl.dts
@@ -11,12 +11,12 @@
};
 
u-boot-spl2 {
-   offset = <0x18>;
+   offset = <0x1c>;
type = "u-boot-spl";
};
 
u-boot {
-   offset = <0x30>;
+   offset = <0x34>;
};
 
section {
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 20/34] binman: Allow symbols to be resolved inside sections

2019-08-24 Thread Simon Glass
At present we only support symbols inside binaries which are at the top
level of an image. This restrictions seems unreasonable since more complex
images may want to group binaries within different sections.

Relax the restriction.

Also fix a typo in the comment for testTpl().

Signed-off-by: Simon Glass 
---

 tools/binman/etype/u_boot_spl.py  |  2 +-
 tools/binman/etype/u_boot_tpl.py  |  2 +-
 tools/binman/ftest.py | 35 +--
 tools/binman/test/149_symbols_tpl.dts | 28 +
 4 files changed, 63 insertions(+), 4 deletions(-)
 create mode 100644 tools/binman/test/149_symbols_tpl.dts

diff --git a/tools/binman/etype/u_boot_spl.py b/tools/binman/etype/u_boot_spl.py
index ab78714c8d..7fedd00021 100644
--- a/tools/binman/etype/u_boot_spl.py
+++ b/tools/binman/etype/u_boot_spl.py
@@ -40,4 +40,4 @@ class Entry_u_boot_spl(Entry_blob):
 return 'spl/u-boot-spl.bin'
 
 def WriteSymbols(self, section):
-elf.LookupAndWriteSymbols(self.elf_fname, self, section)
+elf.LookupAndWriteSymbols(self.elf_fname, self, section.GetImage())
diff --git a/tools/binman/etype/u_boot_tpl.py b/tools/binman/etype/u_boot_tpl.py
index 4d4bb92596..1b69c4f4a7 100644
--- a/tools/binman/etype/u_boot_tpl.py
+++ b/tools/binman/etype/u_boot_tpl.py
@@ -40,4 +40,4 @@ class Entry_u_boot_tpl(Entry_blob):
 return 'tpl/u-boot-tpl.bin'
 
 def WriteSymbols(self, section):
-elf.LookupAndWriteSymbols(self.elf_fname, self, section)
+elf.LookupAndWriteSymbols(self.elf_fname, self, section.GetImage())
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 1d774e28e5..008e747270 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -40,7 +40,7 @@ import tout
 U_BOOT_DATA   = b'1234'
 U_BOOT_IMG_DATA   = b'img'
 U_BOOT_SPL_DATA   = b'56780123456789abcde'
-U_BOOT_TPL_DATA   = b'tpl'
+U_BOOT_TPL_DATA   = b'tpl9876543210fedcb'
 BLOB_DATA = b'89'
 ME_DATA   = b'0abcd'
 VGA_DATA  = b'vga'
@@ -491,6 +491,16 @@ class TestFunctional(unittest.TestCase):
 TestFunctional._MakeInputFile('spl/u-boot-spl',
 tools.ReadFile(cls.ElfTestFile(src_fname)))
 
+@classmethod
+def _SetupTplElf(cls, src_fname='bss_data'):
+"""Set up an ELF file with a '_dt_ucode_base_size' symbol
+
+Args:
+Filename of ELF file to use as TPL
+"""
+TestFunctional._MakeInputFile('tpl/u-boot-tpl',
+tools.ReadFile(cls.ElfTestFile(src_fname)))
+
 @classmethod
 def TestFile(cls, fname):
 return os.path.join(cls._binman_dir, 'test', fname)
@@ -1557,7 +1567,7 @@ class TestFunctional(unittest.TestCase):
   "'other'", str(e.exception))
 
 def testTpl(self):
-"""Test that an image with TPL and ots device tree can be created"""
+"""Test that an image with TPL and its device tree can be created"""
 # ELF file with a '__bss_size' symbol
 with open(self.ElfTestFile('bss_data'), 'rb') as fd:
 TestFunctional._MakeInputFile('tpl/u-boot-tpl', fd.read())
@@ -3292,6 +3302,27 @@ class TestFunctional(unittest.TestCase):
 self.assertIn("'intel-fit-ptr' section must have an 'intel-fit' 
sibling",
   str(e.exception))
 
+def testSymbolsTplSection(self):
+"""Test binman can assign symbols embedded in U-Boot TPL in a 
section"""
+self._SetupSplElf('u_boot_binman_syms')
+self._SetupTplElf('u_boot_binman_syms')
+data = self._DoReadFile('149_symbols_tpl.dts')
+sym_values = struct.pack(';
+   #size-cells = <1>;
+
+   binman {
+   pad-byte = <0xff>;
+   u-boot-spl {
+   offset = <4>;
+   };
+
+   u-boot-spl2 {
+   offset = <0x18>;
+   type = "u-boot-spl";
+   };
+
+   u-boot {
+   offset = <0x30>;
+   };
+
+   section {
+   u-boot-tpl {
+   type = "u-boot-tpl";
+   };
+   };
+   };
+};
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 14/34] binman: Use the Makefile for u_boot_ucode_ptr

2019-08-24 Thread Simon Glass
Remove this file from git and instead build it using the Makefile.

Update tools.GetInputFilename() to support reading files from an absolute
path, so that we can read the Elf test files easily. Also make sure that
the temp directory is report in ELF tests as this was commented out.

Signed-off-by: Simon Glass 
---

 tools/binman/elf_test.py   |  19 +++
 tools/binman/ftest.py  |  14 +++---
 tools/binman/test/Makefile |   2 +-
 tools/binman/test/u_boot_ucode_ptr | Bin 4175 -> 0 bytes
 tools/binman/test/u_boot_ucode_ptr.lds |   3 ++-
 tools/patman/tools.py  |   2 +-
 6 files changed, 26 insertions(+), 14 deletions(-)
 delete mode 100755 tools/binman/test/u_boot_ucode_ptr

diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index 736b931fd5..403ca2b412 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -75,18 +75,29 @@ def BuildElfTestFiles(target_dir):
 
 class TestElf(unittest.TestCase):
 @classmethod
-def setUpClass(self):
+def setUpClass(cls):
+cls._indir = tempfile.mkdtemp(prefix='elf.')
 tools.SetInputDirs(['.'])
+BuildElfTestFiles(cls._indir)
+
+@classmethod
+def tearDownClass(cls):
+if cls._indir:
+shutil.rmtree(cls._indir)
+
+@classmethod
+def ElfTestFile(cls, fname):
+return os.path.join(cls._indir, fname)
 
 def testAllSymbols(self):
 """Test that we can obtain a symbol from the ELF file"""
-fname = os.path.join(binman_dir, 'test', 'u_boot_ucode_ptr')
+fname = self.ElfTestFile('u_boot_ucode_ptr')
 syms = elf.GetSymbols(fname, [])
 self.assertIn('.ucode', syms)
 
 def testRegexSymbols(self):
 """Test that we can obtain from the ELF file by regular expression"""
-fname = os.path.join(binman_dir, 'test', 'u_boot_ucode_ptr')
+fname = self.ElfTestFile('u_boot_ucode_ptr')
 syms = elf.GetSymbols(fname, ['ucode'])
 self.assertIn('.ucode', syms)
 syms = elf.GetSymbols(fname, ['missing'])
@@ -201,7 +212,7 @@ class TestElf(unittest.TestCase):
 self.assertEqual(elf.ElfInfo(b'\0\0' + expected[2:],
  load, entry, len(expected)),
  elf.DecodeElf(data, load + 2))
-#shutil.rmtree(outdir)
+shutil.rmtree(outdir)
 
 
 if __name__ == '__main__':
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index fad62bb04f..e7ade0fddf 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -152,8 +152,8 @@ class TestFunctional(unittest.TestCase):
 elf_test.BuildElfTestFiles(cls._elf_testdir)
 
 # ELF file with a '_dt_ucode_base_size' symbol
-with open(cls.TestFile('u_boot_ucode_ptr'), 'rb') as fd:
-TestFunctional._MakeInputFile('u-boot', fd.read())
+TestFunctional._MakeInputFile('u-boot',
+tools.ReadFile(cls.ElfTestFile('u_boot_ucode_ptr')))
 
 # Intel flash descriptor file
 with open(cls.TestFile('descriptor.bin'), 'rb') as fd:
@@ -489,7 +489,7 @@ class TestFunctional(unittest.TestCase):
 Filename of ELF file to use as SPL
 """
 # TODO(s...@chromium.org): Drop this when all Elf files use 
ElfTestFile()
-if src_fname in ['bss_data']:
+if src_fname in ['bss_data', 'u_boot_ucode_ptr']:
 fname = cls.ElfTestFile(src_fname)
 else:
 fname = cls.TestFile(src_fname)
@@ -1101,8 +1101,8 @@ class TestFunctional(unittest.TestCase):
 
 finally:
 # Put the original file back
-with open(self.TestFile('u_boot_ucode_ptr'), 'rb') as fd:
-TestFunctional._MakeInputFile('u-boot', fd.read())
+TestFunctional._MakeInputFile('u-boot',
+tools.ReadFile(self.ElfTestFile('u_boot_ucode_ptr')))
 
 def testMicrocodeNotInImage(self):
 """Test that microcode must be placed within the image"""
@@ -1818,8 +1818,8 @@ class TestFunctional(unittest.TestCase):
 u-boot-tpl.dtb with the microcode removed
 the microcode
 """
-with open(self.TestFile('u_boot_ucode_ptr'), 'rb') as fd:
-TestFunctional._MakeInputFile('tpl/u-boot-tpl', fd.read())
+TestFunctional._MakeInputFile('tpl/u-boot-tpl',
+tools.ReadFile(self.ElfTestFile('u_boot_ucode_ptr')))
 first, pos_and_size = self._RunMicrocodeTest('093_x86_tpl_ucode.dts',
  U_BOOT_TPL_NODTB_DATA)
 self.assertEqual(b'tplnodtb with microc' + pos_and_size +
diff --git a/tools/binman/test/Makefile b/tools/binman/test/Makefile
index ce1c2f900c..fd660eac6e 100644
--- a/tools/binman/test/Makefile
+++ b/tools/binman/test/Makefile
@@ -10,7 +10,7 @@
 VPATH := $(SRC)
 CFLAGS := -march=i386 -m32 -nostdlib -I ../../../include
 
-LDS_UCODE := -T u_boot_ucode_ptr.lds
+LDS_UCODE := -T 

[U-Boot] [PATCH 26/34] binman: Correct symbol calculation with non-zero image base

2019-08-24 Thread Simon Glass
At present binman adds the image base address to the symbol value before
it writes it to the binary. This is not correct since the symbol value
itself (e.g. image position) has no relationship to the image base.

Fix this and update the tests to cover this case.

Signed-off-by: Simon Glass 
---

 tools/binman/elf.py  | 4 +---
 tools/binman/test/u_boot_binman_syms.lds | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/binman/elf.py b/tools/binman/elf.py
index 7bc7cf61b5..0c1a5b44b6 100644
--- a/tools/binman/elf.py
+++ b/tools/binman/elf.py
@@ -135,9 +135,7 @@ def LookupAndWriteSymbols(elf_fname, entry, section):
 
 # Look up the symbol in our entry tables.
 value = section.LookupSymbol(name, sym.weak, msg)
-if value is not None:
-value += base.address
-else:
+if value is None:
 value = -1
 pack_string = pack_string.lower()
 value_bytes = struct.pack(pack_string, value)
diff --git a/tools/binman/test/u_boot_binman_syms.lds 
b/tools/binman/test/u_boot_binman_syms.lds
index 926df873cb..825fc3f649 100644
--- a/tools/binman/test/u_boot_binman_syms.lds
+++ b/tools/binman/test/u_boot_binman_syms.lds
@@ -9,7 +9,7 @@ ENTRY(_start)
 
 SECTIONS
 {
-   . = 0x;
+   . = 0x0010;
_start = .;
 
. = ALIGN(4);
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 31/34] binman: Support writing symbols into entries within an IFWI

2019-08-24 Thread Simon Glass
The Intel IFWI (Integrated Firmware Image) is effectively a section with
other entries inside it. Support writing symbol information into entries
within it.

Signed-off-by: Simon Glass 
---

 tools/binman/etype/intel_ifwi.py | 5 +
 1 file changed, 5 insertions(+)

diff --git a/tools/binman/etype/intel_ifwi.py b/tools/binman/etype/intel_ifwi.py
index 17792defe9..36aadc210c 100644
--- a/tools/binman/etype/intel_ifwi.py
+++ b/tools/binman/etype/intel_ifwi.py
@@ -118,3 +118,8 @@ class Entry_intel_ifwi(Entry_blob):
 entry._ifwi_subpart = fdt_util.GetString(node, 'ifwi-subpart')
 entry._ifwi_entry_name = fdt_util.GetString(node, 'ifwi-entry')
 self._ifwi_entries[entry._ifwi_subpart] = entry
+
+def WriteSymbols(self, section):
+"""Write symbol values into binary files for access at run time"""
+for entry in self._ifwi_entries.values():
+entry.WriteSymbols(self)
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 23/34] binman: Avoid needing the section size in advance

2019-08-24 Thread Simon Glass
Entries which include a section and need to obtain its contents call
GetData(), as with any other entry. But the current implementation of this
method in entry_Section requires the size of the section to be known. If
it is unknown, an error is produced, since size is None:

   TypeError: can't multiply sequence by non-int of type 'NoneType'

There is no need to know the size in advance since the code can be
adjusted to build up the section piece by piece, instead of patching each
entry into an existing bytearray.

Update the code to handle this and add a test.

Signed-off-by: Simon Glass 
---

 tools/binman/etype/section.py | 14 +---
 tools/binman/ftest.py |  6 
 .../binman/test/151_x86_rom_ifwi_section.dts  | 33 +++
 3 files changed, 49 insertions(+), 4 deletions(-)
 create mode 100644 tools/binman/test/151_x86_rom_ifwi_section.dts

diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
index 5d34fc546a..ff5d30f3fa 100644
--- a/tools/binman/etype/section.py
+++ b/tools/binman/etype/section.py
@@ -142,13 +142,19 @@ class Entry_section(Entry):
 return self.GetEntryContents()
 
 def GetData(self):
-section_data = tools.GetBytes(self._pad_byte, self.size)
+section_data = b''
 
 for entry in self._entries.values():
 data = entry.GetData()
-base = self.pad_before + entry.offset - self._skip_at_start
-section_data = (section_data[:base] + data +
-section_data[base + len(data):])
+base = self.pad_before + (entry.offset or 0) - self._skip_at_start
+pad = base - len(section_data)
+if pad > 0:
+section_data += tools.GetBytes(self._pad_byte, pad)
+section_data += data
+if self.size:
+pad = self.size - len(section_data)
+if pad > 0:
+section_data += tools.GetBytes(self._pad_byte, pad)
 self.Detail('GetData: %d entries, total size %#x' %
 (len(self._entries), len(section_data)))
 return section_data
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 75e25f3e23..1eb0d3b684 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -3323,6 +3323,12 @@ class TestFunctional(unittest.TestCase):
 expected4 = sym_values + U_BOOT_TPL_DATA[16:]
 self.assertEqual(expected4, data[upto3:])
 
+def testPackX86RomIfwiSectiom(self):
+"""Test that a section can be placed in an IFWI region"""
+self._SetupIfwi('fitimage.bin')
+data = self._DoReadFile('151_x86_rom_ifwi_section.dts')
+self._CheckIfwi(data)
+
 
 if __name__ == "__main__":
 unittest.main()
diff --git a/tools/binman/test/151_x86_rom_ifwi_section.dts 
b/tools/binman/test/151_x86_rom_ifwi_section.dts
new file mode 100644
index 00..7e455c3a4b
--- /dev/null
+++ b/tools/binman/test/151_x86_rom_ifwi_section.dts
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   binman {
+   sort-by-offset;
+   end-at-4gb;
+   size = <0x80>;
+   intel-descriptor {
+   filename = "descriptor.bin";
+   };
+
+   intel-ifwi {
+   offset-unset;
+   filename = "fitimage.bin";
+   convert-fit;
+
+   section {
+   ifwi-replace;
+   ifwi-subpart = "IBBP";
+   ifwi-entry = "IBBL";
+   u-boot-tpl {
+   };
+   u-boot-dtb {
+   };
+   };
+   };
+   };
+};
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 17/34] binman: Use the Makefile for u_boot_binman_syms_size

2019-08-24 Thread Simon Glass
Remove this file from git and instead build it using the Makefile.

Signed-off-by: Simon Glass 
---

 tools/binman/elf_test.py  |   5 +++--
 tools/binman/ftest.py |   2 +-
 tools/binman/test/u_boot_binman_syms_size | Bin 4825 -> 0 bytes
 3 files changed, 4 insertions(+), 3 deletions(-)
 delete mode 100755 tools/binman/test/u_boot_binman_syms_size

diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index ff036cb655..a913970150 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -71,7 +71,8 @@ def BuildElfTestFiles(target_dir):
 tools.Run('make', '-C', target_dir, '-f',
   os.path.join(testdir, 'Makefile'), 'SRC=%s/' % testdir,
   'bss_data', 'u_boot_ucode_ptr', 'u_boot_no_ucode_ptr',
-  'u_boot_binman_syms', 'u_boot_binman_syms.bin')
+  'u_boot_binman_syms', 'u_boot_binman_syms.bin',
+  'u_boot_binman_syms_size')
 
 
 class TestElf(unittest.TestCase):
@@ -145,7 +146,7 @@ class TestElf(unittest.TestCase):
 """
 entry = FakeEntry(10)
 section = FakeSection()
-elf_fname = os.path.join(binman_dir, 'test', 'u_boot_binman_syms_size')
+elf_fname =self.ElfTestFile('u_boot_binman_syms_size')
 with self.assertRaises(ValueError) as e:
 syms = elf.LookupAndWriteSymbols(elf_fname, entry, section)
 self.assertIn('has size 1: only 4 and 8 are supported',
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 507c481881..51eab6fbfa 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -490,7 +490,7 @@ class TestFunctional(unittest.TestCase):
 """
 # TODO(s...@chromium.org): Drop this when all Elf files use 
ElfTestFile()
 if src_fname in ['bss_data', 'u_boot_ucode_ptr', 'u_boot_no_ucode_ptr',
- 'u_boot_binman_syms']:
+ 'u_boot_binman_syms', 'u_boot_binman_syms_size']:
 fname = cls.ElfTestFile(src_fname)
 else:
 fname = cls.TestFile(src_fname)
diff --git a/tools/binman/test/u_boot_binman_syms_size 
b/tools/binman/test/u_boot_binman_syms_size
deleted file mode 100755
index 
d691e897c0f1842cb82efbc67f57d9f62853b99c..
GIT binary patch
literal 0
HcmV?d1

literal 4825
zcmeHLyKWOv5FI~+mChk_G%jq(2>Hq;D?t(oMY4z$2|-f0i*)7nuFOi_hrD+Sryze|
zet;iH2NGo(I=XcH0Tm7Tf^f#WV{DlQ>O0c$+?hEuyZ6|Q=jzq#lTxWfVr8n3L=KW4
z>v_eY1}bf;Q8lj@d9Jn!Jm3KNYT?=D=W*Agf^anP^*B!EMcZ%C
C$!_BS

-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 07/34] binman: Correct use of 'replace' in IFWI tests

2019-08-24 Thread Simon Glass
At present the Intel IFWI entry uses 'replace' without the 'ifwi-' prefix.
This is a fairly generic name which might conflict with the main Entry
base class at some point, if more features are added. Add a prefix.

Signed-off-by: Simon Glass 
---

 tools/binman/README.entries   | 6 ++
 tools/binman/etype/intel_ifwi.py  | 8 +++-
 tools/binman/test/111_x86-rom-ifwi.dts| 2 +-
 tools/binman/test/112_x86-rom-ifwi-nodesc.dts | 2 +-
 tools/binman/test/113_x86-rom-ifwi-nodata.dts | 2 +-
 5 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index 0f0e367d02..11c55fd8c8 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -432,6 +432,12 @@ The contents of the IFWI are specified by the subnodes of 
the IFWI node.
 Each subnode describes an entry which is placed into the IFWFI with a given
 sub-partition (and optional entry name).
 
+Properties for subnodes:
+ifwi-subpart - sub-parition to put this entry into, e.g. "IBBP"
+ifwi-entry - entry name t use, e.g. "IBBL"
+ifwi-replace - if present, indicates that the item should be replaced
+in the IFWI. Otherwise it is added.
+
 See README.x86 for information about x86 binary blobs.
 
 
diff --git a/tools/binman/etype/intel_ifwi.py b/tools/binman/etype/intel_ifwi.py
index 9cbdf3698a..f3745f7a8c 100644
--- a/tools/binman/etype/intel_ifwi.py
+++ b/tools/binman/etype/intel_ifwi.py
@@ -36,6 +36,12 @@ class Entry_intel_ifwi(Entry_blob):
 Each subnode describes an entry which is placed into the IFWFI with a given
 sub-partition (and optional entry name).
 
+Properties for subnodes:
+ifwi-subpart - sub-parition to put this entry into, e.g. "IBBP"
+ifwi-entry - entry name t use, e.g. "IBBL"
+ifwi-replace - if present, indicates that the item should be replaced
+in the IFWI. Otherwise it is added.
+
 See README.x86 for information about x86 binary blobs.
 """
 def __init__(self, section, etype, node):
@@ -95,7 +101,7 @@ class Entry_intel_ifwi(Entry_blob):
 for node in self._node.subnodes:
 entry = Entry.Create(self.section, node)
 entry.ReadNode()
-entry._ifwi_replace = fdt_util.GetBool(node, 'replace')
+entry._ifwi_replace = fdt_util.GetBool(node, 'ifwi-replace')
 entry._ifwi_subpart = fdt_util.GetString(node, 'ifwi-subpart')
 entry._ifwi_entry_name = fdt_util.GetString(node, 'ifwi-entry')
 self._ifwi_entries[entry._ifwi_subpart] = entry
diff --git a/tools/binman/test/111_x86-rom-ifwi.dts 
b/tools/binman/test/111_x86-rom-ifwi.dts
index 63b5972cc8..c0ba4f2ea4 100644
--- a/tools/binman/test/111_x86-rom-ifwi.dts
+++ b/tools/binman/test/111_x86-rom-ifwi.dts
@@ -20,7 +20,7 @@
convert-fit;
 
u-boot-tpl {
-   replace;
+   ifwi-replace;
ifwi-subpart = "IBBP";
ifwi-entry = "IBBL";
};
diff --git a/tools/binman/test/112_x86-rom-ifwi-nodesc.dts 
b/tools/binman/test/112_x86-rom-ifwi-nodesc.dts
index 21ec4654ff..0874440ab5 100644
--- a/tools/binman/test/112_x86-rom-ifwi-nodesc.dts
+++ b/tools/binman/test/112_x86-rom-ifwi-nodesc.dts
@@ -19,7 +19,7 @@
filename = "ifwi.bin";
 
u-boot-tpl {
-   replace;
+   ifwi-replace;
ifwi-subpart = "IBBP";
ifwi-entry = "IBBL";
};
diff --git a/tools/binman/test/113_x86-rom-ifwi-nodata.dts 
b/tools/binman/test/113_x86-rom-ifwi-nodata.dts
index 62486fd990..82a4bc8cdd 100644
--- a/tools/binman/test/113_x86-rom-ifwi-nodata.dts
+++ b/tools/binman/test/113_x86-rom-ifwi-nodata.dts
@@ -20,7 +20,7 @@
 
_testing {
return-unknown-contents;
-   replace;
+   ifwi-replace;
ifwi-subpart = "IBBP";
ifwi-entry = "IBBL";
};
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 27/34] binman: Add support for Intel FSP meminit

2019-08-24 Thread Simon Glass
The Intel FSP supports initialising memory early during boot using a binary
blob called 'fspm'. Add support for this.

Signed-off-by: Simon Glass 
---

 tools/binman/README.entries   | 17 +
 tools/binman/etype/intel_fsp_m.py | 27 +++
 tools/binman/ftest.py |  8 
 tools/binman/test/152_intel_fsp_m.dts | 14 ++
 4 files changed, 66 insertions(+)
 create mode 100644 tools/binman/etype/intel_fsp_m.py
 create mode 100644 tools/binman/test/152_intel_fsp_m.dts

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index dba51e6daa..bce2244596 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -427,6 +427,23 @@ See README.x86 for information about x86 binary blobs.
 
 
 
+Entry: intel-fsp-m: Entry containing Intel Firmware Support Package (FSP) 
memory init
+-
+
+Properties / Entry arguments:
+- filename: Filename of file to read into entry
+
+This file contains a binary blob which is used on some devices to set up
+SDRAM. U-Boot executes this code in SPL so that it can make full use of
+memory. Documentation is typically not available in sufficient detail to
+allow U-Boot do this this itself..
+
+An example filename is 'fsp_m.bin'
+
+See README.x86 for information about x86 binary blobs.
+
+
+
 Entry: intel-ifwi: Entry containing an Intel Integrated Firmware Image (IFWI) 
file
 
--
 
diff --git a/tools/binman/etype/intel_fsp_m.py 
b/tools/binman/etype/intel_fsp_m.py
new file mode 100644
index 00..2d6b2b6621
--- /dev/null
+++ b/tools/binman/etype/intel_fsp_m.py
@@ -0,0 +1,27 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2019 Google LLC
+# Written by Simon Glass 
+#
+# Entry-type module for Intel Firmware Support Package binary blob (T section)
+#
+
+from entry import Entry
+from blob import Entry_blob
+
+class Entry_intel_fsp_m(Entry_blob):
+"""Entry containing Intel Firmware Support Package (FSP) memory init
+
+Properties / Entry arguments:
+- filename: Filename of file to read into entry
+
+This file contains a binary blob which is used on some devices to set up
+SDRAM. U-Boot executes this code in SPL so that it can make full use of
+memory. Documentation is typically not available in sufficient detail to
+allow U-Boot do this this itself..
+
+An example filename is 'fsp_m.bin'
+
+See README.x86 for information about x86 binary blobs.
+"""
+def __init__(self, section, etype, node):
+Entry_blob.__init__(self, section, etype, node)
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index a740c3e03d..b0b942dfdc 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -72,6 +72,7 @@ FILES_DATA= (b"sorry I'm late\nOh, don't bother 
apologising, I'm " +
  b"sorry you're alive\n")
 COMPRESS_DATA = b'compress xx data'
 REFCODE_DATA  = b'refcode'
+FSP_M_DATA= b'fsp_m'
 
 # The expected size for the device tree in some tests
 EXTRACT_DTB_SIZE = 0x3c9
@@ -147,6 +148,7 @@ class TestFunctional(unittest.TestCase):
 TestFunctional._MakeInputDir('devkeys')
 TestFunctional._MakeInputFile('bmpblk.bin', BMPBLK_DATA)
 TestFunctional._MakeInputFile('refcode.bin', REFCODE_DATA)
+TestFunctional._MakeInputFile('fsp_m.bin', FSP_M_DATA)
 
 cls._elf_testdir = os.path.join(cls._indir, 'elftest')
 elf_test.BuildElfTestFiles(cls._elf_testdir)
@@ -3329,6 +3331,12 @@ class TestFunctional(unittest.TestCase):
 data = self._DoReadFile('151_x86_rom_ifwi_section.dts')
 self._CheckIfwi(data)
 
+def testPackFspM(self):
+"""Test that an image with a FSP memory-init binary can be created"""
+data = self._DoReadFile('152_intel_fsp_m.dts')
+self.assertEqual(FSP_M_DATA, data[:len(FSP_M_DATA)])
+
+
 
 if __name__ == "__main__":
 unittest.main()
diff --git a/tools/binman/test/152_intel_fsp_m.dts 
b/tools/binman/test/152_intel_fsp_m.dts
new file mode 100644
index 00..b6010f31c2
--- /dev/null
+++ b/tools/binman/test/152_intel_fsp_m.dts
@@ -0,0 +1,14 @@
+/dts-v1/;
+
+/ {
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   binman {
+   size = <16>;
+
+   intel-fsp-m {
+   filename = "fsp_m.bin";
+   };
+   };
+};
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 06/34] binman: Handle hidden symbols in ELF files

2019-08-24 Thread Simon Glass
Some versions of binutils generate hidden symbols which are currently not
parsed by binman. Correct this.

Signed-off-by: Simon Glass 
---

 tools/binman/elf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/binman/elf.py b/tools/binman/elf.py
index c7ef74ce7d..66cfe796a2 100644
--- a/tools/binman/elf.py
+++ b/tools/binman/elf.py
@@ -72,7 +72,7 @@ def GetSymbols(fname, patterns):
 parts = rest[7:].split()
 section, size =  parts[:2]
 if len(parts) > 2:
-name = parts[2]
+name = parts[2] if parts[2] != '.hidden' else parts[3]
 syms[name] = Symbol(section, int(value, 16), int(size,16),
 flags[1] == 'w')
 
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 12/34] binman: Use tools.Run() to run objdump

2019-08-24 Thread Simon Glass
At present this command silently fails if something goes wrong. Use the
tools.Run() function instead, since it reports errors.

Signed-off-by: Simon Glass 
---

 tools/binman/elf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/binman/elf.py b/tools/binman/elf.py
index 66cfe796a2..7bc7cf61b5 100644
--- a/tools/binman/elf.py
+++ b/tools/binman/elf.py
@@ -49,7 +49,7 @@ def GetSymbols(fname, patterns):
   key: Name of symbol
   value: Hex value of symbol
 """
-stdout = command.Output('objdump', '-t', fname, raise_on_error=False)
+stdout = tools.Run('objdump', '-t', fname)
 lines = stdout.splitlines()
 if patterns:
 re_syms = re.compile('|'.join(patterns))
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 30/34] binman: Update IFWI entry to support updates

2019-08-24 Thread Simon Glass
Add support for the ProcessContents() method in this entry so that it is
possible to support entries which change after initial creation.

Signed-off-by: Simon Glass 
---

 tools/binman/etype/intel_ifwi.py | 46 +++-
 1 file changed, 28 insertions(+), 18 deletions(-)

diff --git a/tools/binman/etype/intel_ifwi.py b/tools/binman/etype/intel_ifwi.py
index ef2b35706f..17792defe9 100644
--- a/tools/binman/etype/intel_ifwi.py
+++ b/tools/binman/etype/intel_ifwi.py
@@ -53,22 +53,8 @@ class Entry_intel_ifwi(Entry_blob):
 self._ReadSubnodes()
 Entry_blob.ReadNode(self)
 
-def ObtainContents(self):
-"""Get the contects for the IFWI
-
-Unfortunately we cannot create anything from scratch here, as Intel has
-tools which create precursor binaries with lots of data and settings,
-and these are not incorporated into binman.
-
-The first step is to get a file in the IFWI format. This is either
-supplied directly or is extracted from a fitimage using the 'create'
-subcommand.
-
-After that we delete the OBBP sub-partition and add each of the files
-that we want in the IFWI file, one for each sub-entry of the IWFI node.
-"""
-self._pathname = tools.GetInputFilename(self._filename)
-
+def _BuildIfwi(self):
+"""Build the contents of the IFWI and write it to the 'data' 
property"""
 # Create the IFWI file if needed
 if self._convert_fit:
 inname = self._pathname
@@ -85,8 +71,6 @@ class Entry_intel_ifwi(Entry_blob):
 
 for entry in self._ifwi_entries.values():
 # First get the input data and put it in a file
-if not entry.ObtainContents():
-return False
 data = entry.GetData()
 uniq = self.GetUniqueName()
 input_fname = tools.GetOutputFilename('input.%s' % uniq)
@@ -99,6 +83,32 @@ class Entry_intel_ifwi(Entry_blob):
 self.ReadBlobContents()
 return True
 
+def ObtainContents(self):
+"""Get the contects for the IFWI
+
+Unfortunately we cannot create anything from scratch here, as Intel has
+tools which create precursor binaries with lots of data and settings,
+and these are not incorporated into binman.
+
+The first step is to get a file in the IFWI format. This is either
+supplied directly or is extracted from a fitimage using the 'create'
+subcommand.
+
+After that we delete the OBBP sub-partition and add each of the files
+that we want in the IFWI file, one for each sub-entry of the IWFI node.
+"""
+self._pathname = tools.GetInputFilename(self._filename)
+for entry in self._ifwi_entries.values():
+if not entry.ObtainContents():
+return False
+return self._BuildIfwi()
+
+def ProcessContents(self):
+orig_data = self.data
+self._BuildIfwi()
+same = orig_data == self.data
+return same
+
 def _ReadSubnodes(self):
 """Read the subnodes to find out what should go in this IFWI"""
 for node in self._node.subnodes:
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 33/34] binman: Add logging for the number of pack passes

2019-08-24 Thread Simon Glass
Sometimes binman takes multiple passes to complete packing an image. Add
logging to indicate this.

Signed-off-by: Simon Glass 
---

 tools/binman/control.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/binman/control.py b/tools/binman/control.py
index 07dffbd89c..d1ca798cfb 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -439,6 +439,7 @@ def ProcessImage(image, update_fdt, write_map, 
get_contents=True,
 if sizes_ok:
 break
 image.ResetForPack()
+tout.Info('Pack completed after %d pass(es)' % (pack_pass + 1))
 if not sizes_ok:
 image.Raise('Entries changed size after packing (tried %s passes)' %
 passes)
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 22/34] binman: Rename some two-digit test files

2019-08-24 Thread Simon Glass
Two of the test files somehow were not converted to three digits. Fix
them, using the next available numbers.

Signed-off-by: Simon Glass 
---

 tools/binman/ftest.py | 4 ++--
 ...rt_together.dts => 098_4gb_and_skip_at_start_together.dts} | 0
 ...g_resetvec.dts => 150_powerpc_mpc85xx_bootpg_resetvec.dts} | 0
 3 files changed, 2 insertions(+), 2 deletions(-)
 rename tools/binman/test/{80_4gb_and_skip_at_start_together.dts => 
098_4gb_and_skip_at_start_together.dts} (100%)
 rename tools/binman/test/{81_powerpc_mpc85xx_bootpg_resetvec.dts => 
150_powerpc_mpc85xx_bootpg_resetvec.dts} (100%)

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index d0ec2f1f5c..75e25f3e23 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -906,7 +906,7 @@ class TestFunctional(unittest.TestCase):
 """Test that the end-at-4gb and skip-at-size property can't be used
 together"""
 with self.assertRaises(ValueError) as e:
-self._DoTestFile('80_4gb_and_skip_at_start_together.dts')
+self._DoTestFile('098_4gb_and_skip_at_start_together.dts')
 self.assertIn("Image '/binman': Provide either 'end-at-4gb' or "
   "'skip-at-start'", str(e.exception))
 
@@ -962,7 +962,7 @@ class TestFunctional(unittest.TestCase):
 def testPackPowerpcMpc85xxBootpgResetvec(self):
 """Test that an image with powerpc-mpc85xx-bootpg-resetvec can be
 created"""
-data = self._DoReadFile('81_powerpc_mpc85xx_bootpg_resetvec.dts')
+data = self._DoReadFile('150_powerpc_mpc85xx_bootpg_resetvec.dts')
 self.assertEqual(PPC_MPC85XX_BR_DATA, data[:len(PPC_MPC85XX_BR_DATA)])
 
 def _RunMicrocodeTest(self, dts_fname, nodtb_data, ucode_second=False):
diff --git a/tools/binman/test/80_4gb_and_skip_at_start_together.dts 
b/tools/binman/test/098_4gb_and_skip_at_start_together.dts
similarity index 100%
rename from tools/binman/test/80_4gb_and_skip_at_start_together.dts
rename to tools/binman/test/098_4gb_and_skip_at_start_together.dts
diff --git a/tools/binman/test/81_powerpc_mpc85xx_bootpg_resetvec.dts 
b/tools/binman/test/150_powerpc_mpc85xx_bootpg_resetvec.dts
similarity index 100%
rename from tools/binman/test/81_powerpc_mpc85xx_bootpg_resetvec.dts
rename to tools/binman/test/150_powerpc_mpc85xx_bootpg_resetvec.dts
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 11/34] binman: Fix IFWI output when using an Intel FIT image

2019-08-24 Thread Simon Glass
At present this entry does not work correctly when a FIT image is used as
the input. It updates the FIT instead of the output image. The test passed
because the FIT image happened to have the right data already.

Fix it.

Signed-off-by: Simon Glass 
---

 tools/binman/etype/intel_ifwi.py | 6 +++---
 tools/binman/ftest.py| 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/binman/etype/intel_ifwi.py b/tools/binman/etype/intel_ifwi.py
index f3745f7a8c..e4da3e498a 100644
--- a/tools/binman/etype/intel_ifwi.py
+++ b/tools/binman/etype/intel_ifwi.py
@@ -75,10 +75,10 @@ class Entry_intel_ifwi(Entry_blob):
 self._pathname = outname
 else:
 # Provide a different code path here to ensure we have test 
coverage
-inname = self._pathname
+outname = self._pathname
 
 # Delete OBBP if it is there, then add the required new items.
-tools.RunIfwiTool(inname, tools.CMD_DELETE, subpart='OBBP')
+tools.RunIfwiTool(outname, tools.CMD_DELETE, subpart='OBBP')
 
 for entry in self._ifwi_entries.values():
 # First get the input data and put it in a file
@@ -89,7 +89,7 @@ class Entry_intel_ifwi(Entry_blob):
 input_fname = tools.GetOutputFilename('input.%s' % uniq)
 tools.WriteFile(input_fname, data)
 
-tools.RunIfwiTool(inname,
+tools.RunIfwiTool(outname,
 tools.CMD_REPLACE if entry._ifwi_replace else tools.CMD_ADD,
 input_fname, entry._ifwi_subpart, entry._ifwi_entry_name)
 
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 080599fee3..bba07e7275 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -2044,7 +2044,7 @@ class TestFunctional(unittest.TestCase):
   subpart='IBBP', entry_name='IBBL')
 
 tpl_data = tools.ReadFile(tpl_fname)
-self.assertEqual(tpl_data[:len(U_BOOT_TPL_DATA)], U_BOOT_TPL_DATA)
+self.assertEqual(U_BOOT_TPL_DATA, tpl_data[:len(U_BOOT_TPL_DATA)])
 
 def testPackX86RomIfwi(self):
 """Test that an x86 ROM with Integrated Firmware Image can be 
created"""
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 16/34] binman: Use the Makefile for u_boot_binman_syms

2019-08-24 Thread Simon Glass
Remove this file from git and instead build it using the Makefile.

With this change a few things need to be adjusted:

1. The 'notes' section no-longer appears at the start of the ELF file
(before the code), so update testSymbols to adjust the offsets.

2. The dynamic linker is disabled to avoid errors like:

"Not enough room for program headers, try linking with -N"

3. The interpreter note is moved to the end of the image, so that the
binman symbols appear first.

Signed-off-by: Simon Glass 
---

 tools/binman/elf_test.py |   9 +
 tools/binman/ftest.py|   7 ---
 tools/binman/test/Makefile   |   5 +++--
 tools/binman/test/u_boot_binman_syms | Bin 4924 -> 0 bytes
 tools/binman/test/u_boot_binman_syms.lds |   1 +
 5 files changed, 13 insertions(+), 9 deletions(-)
 delete mode 100755 tools/binman/test/u_boot_binman_syms

diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index c7f51bb86a..ff036cb655 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -70,7 +70,8 @@ def BuildElfTestFiles(target_dir):
 del os.environ['MAKEFLAGS']
 tools.Run('make', '-C', target_dir, '-f',
   os.path.join(testdir, 'Makefile'), 'SRC=%s/' % testdir,
-  'bss_data', 'u_boot_ucode_ptr', 'u_boot_no_ucode_ptr')
+  'bss_data', 'u_boot_ucode_ptr', 'u_boot_no_ucode_ptr',
+  'u_boot_binman_syms', 'u_boot_binman_syms.bin')
 
 
 class TestElf(unittest.TestCase):
@@ -118,7 +119,7 @@ class TestElf(unittest.TestCase):
 """Test a symbol which extends outside the entry area is detected"""
 entry = FakeEntry(10)
 section = FakeSection()
-elf_fname = os.path.join(binman_dir, 'test', 'u_boot_binman_syms')
+elf_fname = self.ElfTestFile('u_boot_binman_syms')
 with self.assertRaises(ValueError) as e:
 syms = elf.LookupAndWriteSymbols(elf_fname, entry, section)
 self.assertIn('entry_path has offset 4 (size 8) but the contents size '
@@ -158,7 +159,7 @@ class TestElf(unittest.TestCase):
 """
 entry = FakeEntry(20)
 section = FakeSection(sym_value=None)
-elf_fname = os.path.join(binman_dir, 'test', 'u_boot_binman_syms')
+elf_fname = self.ElfTestFile('u_boot_binman_syms')
 syms = elf.LookupAndWriteSymbols(elf_fname, entry, section)
 self.assertEqual(tools.GetBytes(255, 16) + tools.GetBytes(ord('a'), 4),
   entry.data)
@@ -169,7 +170,7 @@ class TestElf(unittest.TestCase):
 tout.Init(tout.DEBUG)
 entry = FakeEntry(20)
 section = FakeSection()
-elf_fname = os.path.join(binman_dir, 'test', 'u_boot_binman_syms')
+elf_fname = self.ElfTestFile('u_boot_binman_syms')
 with test_util.capture_sys_output() as (stdout, stderr):
 syms = elf.LookupAndWriteSymbols(elf_fname, entry, section)
 self.assertTrue(len(stdout.getvalue()) > 0)
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 30a8b0b14c..507c481881 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -489,7 +489,8 @@ class TestFunctional(unittest.TestCase):
 Filename of ELF file to use as SPL
 """
 # TODO(s...@chromium.org): Drop this when all Elf files use 
ElfTestFile()
-if src_fname in ['bss_data', 'u_boot_ucode_ptr', 
'u_boot_no_ucode_ptr']:
+if src_fname in ['bss_data', 'u_boot_ucode_ptr', 'u_boot_no_ucode_ptr',
+ 'u_boot_binman_syms']:
 fname = cls.ElfTestFile(src_fname)
 else:
 fname = cls.TestFile(src_fname)
@@ -1223,14 +1224,14 @@ class TestFunctional(unittest.TestCase):
 
 def testSymbols(self):
 """Test binman can assign symbols embedded in U-Boot"""
-elf_fname = self.TestFile('u_boot_binman_syms')
+elf_fname = self.ElfTestFile('u_boot_binman_syms')
 syms = elf.GetSymbols(elf_fname, ['binman', 'image'])
 addr = elf.GetSymbolAddress(elf_fname, '__image_copy_start')
 self.assertEqual(syms['_binman_u_boot_spl_prop_offset'].address, addr)
 
 self._SetupSplElf('u_boot_binman_syms')
 data = self._DoReadFile('053_symbols.dts')
-sym_values = struct.pack('b@{x4c
zE5;WsFm2Hg^@?wr9YU~>YH4`}5c1&=kmIE-njg7@cOGNIMMrEqY*0%Jew;7a^sB_W@r02_y_o5))_MHhhw82$s+oLkVEs6T@@=QIAe5MwG*swm5}
ziUwu9lN4Ibsc9FJs@4
ncxM85*3jr@_lETl{jT6ScUlE_F7M+JFyC(j{k|b*%=G^

diff --git a/tools/binman/test/u_boot_binman_syms.lds 
b/tools/binman/test/u_boot_binman_syms.lds
index 29cf9d0e54..926df873cb 100644
--- a/tools/binman/test/u_boot_binman_syms.lds
+++ b/tools/binman/test/u_boot_binman_syms.lds
@@ -25,5 +25,6 @@ SECTIONS
KEEP(*(SORT(.binman_sym*)));
__binman_sym_end = .;
}
+   .interp : { *(.interp*) }
 
 }
-- 
2.23.0.187.g17f5b7556c-goog


[U-Boot] [PATCH 08/34] binman: Add support for an x86 'reset' section

2019-08-24 Thread Simon Glass
At present binman has a single entry type for the 16-bit code code needed
to start up an x86 processor. This entry is intended to include both the
reset vector itself as well as the code to move to 32-bit mode.

However this is not very flexible since in some cases other data needs to
be included at the top of the SPI flash, in between these two pieces. For
example Intel requires that a FIT (Firmware Image Table) pointer be placed
0x40 bytes before the end of the ROM.

To deal with this, add a new reset entry for just the reset vector. A
subsequent change will adjust the existing 'start16' entry.

Signed-off-by: Simon Glass 
---

 tools/binman/README.entries   | 48 +++
 tools/binman/etype/x86_reset16.py | 29 ++
 tools/binman/etype/x86_reset16_spl.py | 29 ++
 tools/binman/etype/x86_reset16_tpl.py | 29 ++
 tools/binman/ftest.py | 30 +-
 tools/binman/test/144_x86_reset16.dts | 13 ++
 tools/binman/test/145_x86_reset16_spl.dts | 13 ++
 tools/binman/test/146_x86_reset16_tpl.dts | 13 ++
 8 files changed, 203 insertions(+), 1 deletion(-)
 create mode 100644 tools/binman/etype/x86_reset16.py
 create mode 100644 tools/binman/etype/x86_reset16_spl.py
 create mode 100644 tools/binman/etype/x86_reset16_tpl.py
 create mode 100644 tools/binman/test/144_x86_reset16.dts
 create mode 100644 tools/binman/test/145_x86_reset16_spl.dts
 create mode 100644 tools/binman/test/146_x86_reset16_tpl.dts

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index 11c55fd8c8..55e3fa0dcc 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -937,6 +937,54 @@ and kernel are genuine.
 
 
 
+Entry: x86-reset16: x86 16-bit reset code for U-Boot
+
+
+Properties / Entry arguments:
+- filename: Filename of u-boot-x86-reset16.bin (default
+'u-boot-x86-reset16.bin')
+
+x86 CPUs start up in 16-bit mode, even if they are 32-bit CPUs. This code
+must be placed at a particular address. This entry holds that code. It is
+typically placed at offset CONFIG_RESET_VEC_LOC. The code is responsible
+for jumping to the x86-start16 code, which continues execution.
+
+For 64-bit U-Boot, the 'x86_reset16_spl' entry type is used instead.
+
+
+
+Entry: x86-reset16-spl: x86 16-bit reset code for U-Boot
+
+
+Properties / Entry arguments:
+- filename: Filename of u-boot-x86-reset16.bin (default
+'u-boot-x86-reset16.bin')
+
+x86 CPUs start up in 16-bit mode, even if they are 32-bit CPUs. This code
+must be placed at a particular address. This entry holds that code. It is
+typically placed at offset CONFIG_RESET_VEC_LOC. The code is responsible
+for jumping to the x86-start16 code, which continues execution.
+
+For 32-bit U-Boot, the 'x86_reset_spl' entry type is used instead.
+
+
+
+Entry: x86-reset16-tpl: x86 16-bit reset code for U-Boot
+
+
+Properties / Entry arguments:
+- filename: Filename of u-boot-x86-reset16.bin (default
+'u-boot-x86-reset16.bin')
+
+x86 CPUs start up in 16-bit mode, even if they are 32-bit CPUs. This code
+must be placed at a particular address. This entry holds that code. It is
+typically placed at offset CONFIG_RESET_VEC_LOC. The code is responsible
+for jumping to the x86-start16 code, which continues execution.
+
+For 32-bit U-Boot, the 'x86_reset_tpl' entry type is used instead.
+
+
+
 Entry: x86-start16: x86 16-bit start-up code for U-Boot
 ---
 
diff --git a/tools/binman/etype/x86_reset16.py 
b/tools/binman/etype/x86_reset16.py
new file mode 100644
index 00..54eb814ea3
--- /dev/null
+++ b/tools/binman/etype/x86_reset16.py
@@ -0,0 +1,29 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2016 Google, Inc
+# Written by Simon Glass 
+#
+# Entry-type module for the 16-bit x86 reset code for U-Boot
+#
+
+from entry import Entry
+from blob import Entry_blob
+
+class Entry_x86_reset16(Entry_blob):
+"""x86 16-bit reset code for U-Boot
+
+Properties / Entry arguments:
+- filename: Filename of u-boot-x86-reset16.bin (default
+'u-boot-x86-reset16.bin')
+
+x86 CPUs start up in 16-bit mode, even if they are 32-bit CPUs. This code
+must be placed at a particular address. This entry holds that code. It is
+typically placed at offset CONFIG_RESET_VEC_LOC. The code is responsible
+for jumping to the x86-start16 code, which continues execution.
+
+For 64-bit U-Boot, the 'x86_reset16_spl' entry type is used instead.
+"""
+def __init__(self, section, etype, node):
+Entry_blob.__init__(self, section, etype, node)
+
+def GetDefaultFilename(self):
+return 'u-boot-x86-reset16.bin'
diff --git a/tools/binman/etype/x86_reset16_spl.py 

[U-Boot] [PATCH 28/34] binman: Fix entry comment for Intel descriptor

2019-08-24 Thread Simon Glass
This comment references another entry type. Fix it.

Signed-off-by: Simon Glass 
---

 tools/binman/etype/intel_descriptor.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/binman/etype/intel_descriptor.py 
b/tools/binman/etype/intel_descriptor.py
index fb5e889ebf..b6477931d6 100644
--- a/tools/binman/etype/intel_descriptor.py
+++ b/tools/binman/etype/intel_descriptor.py
@@ -2,7 +2,7 @@
 # Copyright (c) 2016 Google, Inc
 # Written by Simon Glass 
 #
-# Entry-type module for 'u-boot'
+# Entry-type module for Intel flash descriptor
 #
 
 import struct
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 10/34] binman: Add support for Intel FIT

2019-08-24 Thread Simon Glass
A Firmware Image Table (FIT) is a data structure defined by Intel which
contains information about various things needed by the SoC, such as
microcode.

Add support for this entry as well as the pointer to it. The contents of
FIT are fixed at present. Future work is needed to support adding
microcode, etc.

Signed-off-by: Simon Glass 
---

 tools/binman/README.entries | 19 ++
 tools/binman/etype/intel_fit.py | 32 
 tools/binman/etype/intel_fit_ptr.py | 41 +
 tools/binman/ftest.py   | 20 ++
 tools/binman/test/147_intel_fit.dts | 20 ++
 tools/binman/test/148_intel_fit_missing.dts | 17 +
 6 files changed, 149 insertions(+)
 create mode 100644 tools/binman/etype/intel_fit.py
 create mode 100644 tools/binman/etype/intel_fit_ptr.py
 create mode 100644 tools/binman/test/147_intel_fit.dts
 create mode 100644 tools/binman/test/148_intel_fit_missing.dts

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index d17b3cb078..dba51e6daa 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -391,6 +391,25 @@ See README.x86 for information about x86 binary blobs.
 
 
 
+Entry: intel-fit: Intel Firmware Image Table (FIT)
+--
+
+This entry contains a dummy FIT as required by recent Intel CPUs. The FIT
+contains information about the firmware and microcode available in the
+image.
+
+At present binman only supports a basic FIT with no microcode.
+
+
+
+Entry: intel-fit-ptr: Intel Firmware Image Table (FIT) pointer
+--
+
+This entry contains a pointer to the FIT. It is required to be at address
+0xffc0 in the image.
+
+
+
 Entry: intel-fsp: Entry containing an Intel Firmware Support Package (FSP) file
 ---
 
diff --git a/tools/binman/etype/intel_fit.py b/tools/binman/etype/intel_fit.py
new file mode 100644
index 00..23606d27d0
--- /dev/null
+++ b/tools/binman/etype/intel_fit.py
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2016 Google, Inc
+# Written by Simon Glass 
+#
+# Entry-type module for Intel Firmware Image Table
+#
+
+import struct
+
+from blob import Entry_blob
+
+class Entry_intel_fit(Entry_blob):
+"""Intel Firmware Image Table (FIT)
+
+This entry contains a dummy FIT as required by recent Intel CPUs. The FIT
+contains information about the firmware and microcode available in the
+image.
+
+At present binman only supports a basic FIT with no microcode.
+"""
+def __init__(self, section, etype, node):
+Entry_blob.__init__(self, section, etype, node)
+
+def ReadNode(self):
+"""Force 16-byte alignment as required by FIT pointer"""
+Entry_blob.ReadNode(self)
+self.align = 16
+
+def ObtainContents(self):
+data = struct.pack('<8sIHBB', '_FIT_   ', 1, 0x100, 0x80, 0x7d)
+self.SetContents(data)
+return True
diff --git a/tools/binman/etype/intel_fit_ptr.py 
b/tools/binman/etype/intel_fit_ptr.py
new file mode 100644
index 00..148b206c3c
--- /dev/null
+++ b/tools/binman/etype/intel_fit_ptr.py
@@ -0,0 +1,41 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2016 Google, Inc
+# Written by Simon Glass 
+#
+# Entry-type module for a pointer to an Intel Firmware Image Table
+#
+
+import struct
+
+from blob import Entry_blob
+
+class Entry_intel_fit_ptr(Entry_blob):
+"""Intel Firmware Image Table (FIT) pointer
+
+This entry contains a pointer to the FIT. It is required to be at address
+0xffc0 in the image.
+"""
+def __init__(self, section, etype, node):
+Entry_blob.__init__(self, section, etype, node)
+if self.HasSibling('intel-fit') is False:
+self.Raise("'intel-fit-ptr' section must have an 'intel-fit' 
sibling")
+
+def _GetContents(self):
+fit_pos = self.GetSiblingImagePos('intel-fit')
+return struct.pack(';
+   #size-cells = <1>;
+
+   binman {
+   end-at-4gb;
+   size = <0x80>;
+
+   u-boot {
+   };
+
+   intel-fit {
+   };
+
+   intel-fit-ptr {
+   };
+   };
+};
diff --git a/tools/binman/test/148_intel_fit_missing.dts 
b/tools/binman/test/148_intel_fit_missing.dts
new file mode 100644
index 00..388c76b1ab
--- /dev/null
+++ b/tools/binman/test/148_intel_fit_missing.dts
@@ -0,0 +1,17 @@
+/dts-v1/;
+
+/ {
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   binman {
+   end-at-4gb;
+   size = <0x80>;
+
+   u-boot {
+   };
+
+   intel-fit-ptr {
+   };
+   };
+};
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list

[U-Boot] [PATCH 15/34] binman: Use the Makefile for u_boot_no_ucode_ptr

2019-08-24 Thread Simon Glass
Remove this file from git and instead build it using the Makefile.

Signed-off-by: Simon Glass 
---

 tools/binman/elf_test.py  |   2 +-
 tools/binman/ftest.py |  10 +-
 tools/binman/test/u_boot_no_ucode_ptr | Bin 4182 -> 0 bytes
 3 files changed, 6 insertions(+), 6 deletions(-)
 delete mode 100755 tools/binman/test/u_boot_no_ucode_ptr

diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index 403ca2b412..c7f51bb86a 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -70,7 +70,7 @@ def BuildElfTestFiles(target_dir):
 del os.environ['MAKEFLAGS']
 tools.Run('make', '-C', target_dir, '-f',
   os.path.join(testdir, 'Makefile'), 'SRC=%s/' % testdir,
-  'bss_data', 'u_boot_ucode_ptr')
+  'bss_data', 'u_boot_ucode_ptr', 'u_boot_no_ucode_ptr')
 
 
 class TestElf(unittest.TestCase):
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index e7ade0fddf..30a8b0b14c 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -489,7 +489,7 @@ class TestFunctional(unittest.TestCase):
 Filename of ELF file to use as SPL
 """
 # TODO(s...@chromium.org): Drop this when all Elf files use 
ElfTestFile()
-if src_fname in ['bss_data', 'u_boot_ucode_ptr']:
+if src_fname in ['bss_data', 'u_boot_ucode_ptr', 
'u_boot_no_ucode_ptr']:
 fname = cls.ElfTestFile(src_fname)
 else:
 fname = cls.TestFile(src_fname)
@@ -1091,8 +1091,8 @@ class TestFunctional(unittest.TestCase):
 """Test that a U-Boot binary without the microcode symbol is 
detected"""
 # ELF file without a '_dt_ucode_base_size' symbol
 try:
-with open(self.TestFile('u_boot_no_ucode_ptr'), 'rb') as fd:
-TestFunctional._MakeInputFile('u-boot', fd.read())
+TestFunctional._MakeInputFile('u-boot',
+tools.ReadFile(self.ElfTestFile('u_boot_no_ucode_ptr')))
 
 with self.assertRaises(ValueError) as e:
 self._RunPackUbootSingleMicrocode()
@@ -1114,8 +1114,8 @@ class TestFunctional(unittest.TestCase):
 
 def testWithoutMicrocode(self):
 """Test that we can cope with an image without microcode (e.g. qemu)"""
-with open(self.TestFile('u_boot_no_ucode_ptr'), 'rb') as fd:
-TestFunctional._MakeInputFile('u-boot', fd.read())
+TestFunctional._MakeInputFile('u-boot',
+tools.ReadFile(self.ElfTestFile('u_boot_no_ucode_ptr')))
 data, dtb, _, _ = self._DoReadFileDtb('044_x86_optional_ucode.dts', 
True)
 
 # Now check the device tree has no microcode
diff --git a/tools/binman/test/u_boot_no_ucode_ptr 
b/tools/binman/test/u_boot_no_ucode_ptr
deleted file mode 100755
index 
f72462f0be41a934d468481bf627d6c1ec9a8e1c..
GIT binary patch
literal 0
HcmV?d1

literal 4182
zcmeHKy-EW?5T5*Cv``}iEVQ^HMMSbDdWK+O6Euwq7AdTbT<(Ygb0^7OVG6bMF|2$8
zpFw;En;;05iM_7#<+2d5v9R2MkJ51hV9kJT?hJ(n9X3>XFs1BL;^fMLKe
zU>GnA7zPXjhJk-z0Q*;tkz&+O8uWhlJbWr0zYHsC`1(-IehePl*#DA<*J^uKq2We>
zj4WGJgSdDb~a)^k?3D_Wz%IXd$B&(ry!KRXa|vSqt1m_?06)iR_OU8
zT4A^A2a>P)v#fDuhJp8Cx5S>ApQ*-t5W^1gKRF3!4c|L2=dAsaDUTGS@9=oZN
zrZL1<80e*?~TA=ewpZ&4eYjfH}1ubyTF+3XR))wJ}tVRwr4fwh8=I}
z@qDp8do$uXBd$)(xO`84NJ_C$;LPaVgT
TQ=i-H`%b?z@X6`RW>3;L6WVxU

-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 34/34] binman: Drop comment-out code in testUpdateFdtOutput()

2019-08-24 Thread Simon Glass
This code is not needed so drop it.

Signed-off-by: Simon Glass 
---

 tools/binman/ftest.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index b0b942dfdc..0a66369cbd 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -1669,8 +1669,6 @@ class TestFunctional(unittest.TestCase):
 # source file (e.g. test/075_fdt_update_all.dts) thus does not 
enter
 # binman as a file called u-boot.dtb. To fix this, copy the file
 # over to the expected place.
-#tools.WriteFile(os.path.join(self._indir, 'u-boot.dtb'),
-#tools.ReadFile(tools.GetOutputFilename('source.dtb')))
 start = 0
 for fname in ['u-boot.dtb.out', 'spl/u-boot-spl.dtb.out',
   'tpl/u-boot-tpl.dtb.out']:
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 29/34] binman: Update IFWI entry to read entries outside constructor

2019-08-24 Thread Simon Glass
At present this class reads its entries in the constructor. This is not
how things should be done now. Update it.

Signed-off-by: Simon Glass 
---

 tools/binman/etype/intel_ifwi.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/binman/etype/intel_ifwi.py b/tools/binman/etype/intel_ifwi.py
index e4da3e498a..ef2b35706f 100644
--- a/tools/binman/etype/intel_ifwi.py
+++ b/tools/binman/etype/intel_ifwi.py
@@ -48,7 +48,10 @@ class Entry_intel_ifwi(Entry_blob):
 Entry_blob.__init__(self, section, etype, node)
 self._convert_fit = fdt_util.GetBool(self._node, 'convert-fit')
 self._ifwi_entries = OrderedDict()
+
+def ReadNode(self):
 self._ReadSubnodes()
+Entry_blob.ReadNode(self)
 
 def ObtainContents(self):
 """Get the contects for the IFWI
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 21/34] binman: Use underscore in test filenames

2019-08-24 Thread Simon Glass
At present a small number of test files use hyphens instead of
underscores. Rename them for consistency.

Signed-off-by: Simon Glass 
---

 tools/binman/ftest.py | 28 +--
 .../test/{029_x86-rom.dts => 029_x86_rom.dts} |  0
 ...no-desc.dts => 030_x86_rom_me_no_desc.dts} |  0
 ...{031_x86-rom-me.dts => 031_x86_rom_me.dts} |  0
 .../{032_intel-vga.dts => 032_intel_vga.dts}  |  0
 ...33_x86-start16.dts => 033_x86_start16.dts} |  0
 .../{042_intel-fsp.dts => 042_intel_fsp.dts}  |  0
 .../{043_intel-cmc.dts => 043_intel_cmc.dts}  |  0
 .../{046_intel-vbt.dts => 046_intel_vbt.dts}  |  0
 ...tart16-spl.dts => 048_x86_start16_spl.dts} |  0
 ...tart16-tpl.dts => 081_x86_start16_tpl.dts} |  0
 ..._x86-rom-ifwi.dts => 111_x86_rom_ifwi.dts} |  0
 ...nodesc.dts => 112_x86_rom_ifwi_nodesc.dts} |  0
 ...nodata.dts => 113_x86_rom_ifwi_nodata.dts} |  0
 14 files changed, 14 insertions(+), 14 deletions(-)
 rename tools/binman/test/{029_x86-rom.dts => 029_x86_rom.dts} (100%)
 rename tools/binman/test/{030_x86-rom-me-no-desc.dts => 
030_x86_rom_me_no_desc.dts} (100%)
 rename tools/binman/test/{031_x86-rom-me.dts => 031_x86_rom_me.dts} (100%)
 rename tools/binman/test/{032_intel-vga.dts => 032_intel_vga.dts} (100%)
 rename tools/binman/test/{033_x86-start16.dts => 033_x86_start16.dts} (100%)
 rename tools/binman/test/{042_intel-fsp.dts => 042_intel_fsp.dts} (100%)
 rename tools/binman/test/{043_intel-cmc.dts => 043_intel_cmc.dts} (100%)
 rename tools/binman/test/{046_intel-vbt.dts => 046_intel_vbt.dts} (100%)
 rename tools/binman/test/{048_x86-start16-spl.dts => 048_x86_start16_spl.dts} 
(100%)
 rename tools/binman/test/{081_x86-start16-tpl.dts => 081_x86_start16_tpl.dts} 
(100%)
 rename tools/binman/test/{111_x86-rom-ifwi.dts => 111_x86_rom_ifwi.dts} (100%)
 rename tools/binman/test/{112_x86-rom-ifwi-nodesc.dts => 
112_x86_rom_ifwi_nodesc.dts} (100%)
 rename tools/binman/test/{113_x86-rom-ifwi-nodata.dts => 
113_x86_rom_ifwi_nodata.dts} (100%)

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 008e747270..d0ec2f1f5c 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -921,7 +921,7 @@ class TestFunctional(unittest.TestCase):
 def testPackX86Rom(self):
 """Test that a basic x86 ROM can be created"""
 self._SetupSplElf()
-data = self._DoReadFile('029_x86-rom.dts')
+data = self._DoReadFile('029_x86_rom.dts')
 self.assertEqual(U_BOOT_DATA + tools.GetBytes(0, 7) + U_BOOT_SPL_DATA +
  tools.GetBytes(0, 2), data)
 
@@ -929,21 +929,21 @@ class TestFunctional(unittest.TestCase):
 """Test that an invalid Intel descriptor entry is detected"""
 TestFunctional._MakeInputFile('descriptor.bin', b'')
 with self.assertRaises(ValueError) as e:
-self._DoTestFile('031_x86-rom-me.dts')
+self._DoTestFile('031_x86_rom_me.dts')
 self.assertIn("Node '/binman/intel-descriptor': Cannot find Intel 
Flash Descriptor (FD) signature",
   str(e.exception))
 
 def testPackX86RomBadDesc(self):
 """Test that the Intel requires a descriptor entry"""
 with self.assertRaises(ValueError) as e:
-self._DoTestFile('030_x86-rom-me-no-desc.dts')
+self._DoTestFile('030_x86_rom_me_no_desc.dts')
 self.assertIn("Node '/binman/intel-me': No offset set with "
   "offset-unset: should another entry provide this correct 
"
   "offset?", str(e.exception))
 
 def testPackX86RomMe(self):
 """Test that an x86 ROM with an ME region can be created"""
-data = self._DoReadFile('031_x86-rom-me.dts')
+data = self._DoReadFile('031_x86_rom_me.dts')
 expected_desc = tools.ReadFile(self.TestFile('descriptor.bin'))
 if data[:0x1000] != expected_desc:
 self.fail('Expected descriptor binary at start of image')
@@ -951,12 +951,12 @@ class TestFunctional(unittest.TestCase):
 
 def testPackVga(self):
 """Test that an image with a VGA binary can be created"""
-data = self._DoReadFile('032_intel-vga.dts')
+data = self._DoReadFile('032_intel_vga.dts')
 self.assertEqual(VGA_DATA, data[:len(VGA_DATA)])
 
 def testPackStart16(self):
 """Test that an image with an x86 start16 region can be created"""
-data = self._DoReadFile('033_x86-start16.dts')
+data = self._DoReadFile('033_x86_start16.dts')
 self.assertEqual(X86_START16_DATA, data[:len(X86_START16_DATA)])
 
 def testPackPowerpcMpc85xxBootpgResetvec(self):
@@ -1144,17 +1144,17 @@ class TestFunctional(unittest.TestCase):
 
 def testPackFsp(self):
 """Test that an image with a FSP binary can be created"""
-data = self._DoReadFile('042_intel-fsp.dts')
+data = self._DoReadFile('042_intel_fsp.dts')
 self.assertEqual(FSP_DATA, data[:len(FSP_DATA)])
 
 def testPackCmc(self):
 

[U-Boot] [PATCH 25/34] binman: Allow support for writing a size symbol to binaries

2019-08-24 Thread Simon Glass
It is useful to be able to access the size of an image in SPL, with
something like:

binman_sym_declare(unsigned long, u_boot_any, size);

...
   ulong u_boot_size = binman_sym(ulong, u_boot_any, size);

Add support for this and update the tests.

Signed-off-by: Simon Glass 
---

 tools/binman/elf_test.py   |  4 ++--
 tools/binman/etype/section.py  |  2 ++
 tools/binman/ftest.py  | 14 +++---
 tools/binman/test/u_boot_binman_syms.c |  1 +
 4 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index f05545bcb1..c0c11cb340 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -155,11 +155,11 @@ class TestElf(unittest.TestCase):
 This should produce -1 values for all thress symbols, taking up the
 first 16 bytes of the image.
 """
-entry = FakeEntry(20)
+entry = FakeEntry(24)
 section = FakeSection(sym_value=None)
 elf_fname = self.ElfTestFile('u_boot_binman_syms')
 syms = elf.LookupAndWriteSymbols(elf_fname, entry, section)
-self.assertEqual(tools.GetBytes(255, 16) + tools.GetBytes(ord('a'), 4),
+self.assertEqual(tools.GetBytes(255, 20) + tools.GetBytes(ord('a'), 4),
   entry.data)
 
 def testDebug(self):
diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
index ff5d30f3fa..d39c6ad81e 100644
--- a/tools/binman/etype/section.py
+++ b/tools/binman/etype/section.py
@@ -344,6 +344,8 @@ class Entry_section(Entry):
 return entry.offset
 elif prop_name == 'image_pos':
 return entry.image_pos
+if prop_name == 'size':
+return entry.size
 else:
 raise ValueError("%s: No such property '%s'" % (msg, prop_name))
 
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 65d3ad59ea..a740c3e03d 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -1236,10 +1236,10 @@ class TestFunctional(unittest.TestCase):
 
 self._SetupSplElf('u_boot_binman_syms')
 data = self._DoReadFile('053_symbols.dts')
-sym_values = struct.pack('https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 32/34] binman: Write symbol info before image inclusion

2019-08-24 Thread Simon Glass
At present the symbol information is written to binaries just before
binman exits. This is fine for entries within sections since the section
contents is calculated when it is needed, so the updated symbol values are
included in the image that is written.

However some binaries are inside entries which have already generated
their contents and do not notice that the entries have changed (e.g. Intel
IFWI).

Move the symbol writing earlier to cope with this.

Signed-off-by: Simon Glass 
---

 tools/binman/control.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/binman/control.py b/tools/binman/control.py
index 43f5d49406..07dffbd89c 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -434,6 +434,7 @@ def ProcessImage(image, update_fdt, write_map, 
get_contents=True,
 for dtb_item in state.GetAllFdts():
 dtb_item.Sync()
 dtb_item.Flush()
+image.WriteSymbols()
 sizes_ok = image.ProcessEntryContents()
 if sizes_ok:
 break
@@ -442,7 +443,6 @@ def ProcessImage(image, update_fdt, write_map, 
get_contents=True,
 image.Raise('Entries changed size after packing (tried %s passes)' %
 passes)
 
-image.WriteSymbols()
 image.BuildImage()
 if write_map:
 image.WriteMap()
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 19/34] binman: Clean up unnecessary code related to ELF test files

2019-08-24 Thread Simon Glass
We use the Makefile for all ELF test files now, so drop all the code that
checks whether to get the test file from the Makefile or from the git
repo.

Also add a comment to the Makefile indicating that it is run from binman.

Signed-off-by: Simon Glass 
---

 tools/binman/elf_test.py   | 5 +
 tools/binman/ftest.py  | 9 ++---
 tools/binman/test/Makefile | 2 +-
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index 1ee5d9d57c..f05545bcb1 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -69,10 +69,7 @@ def BuildElfTestFiles(target_dir):
 if 'MAKEFLAGS' in os.environ:
 del os.environ['MAKEFLAGS']
 tools.Run('make', '-C', target_dir, '-f',
-  os.path.join(testdir, 'Makefile'), 'SRC=%s/' % testdir,
-  'bss_data', 'u_boot_ucode_ptr', 'u_boot_no_ucode_ptr',
-  'u_boot_binman_syms', 'u_boot_binman_syms.bin',
-  'u_boot_binman_syms_size', 'u_boot_binman_syms_bad')
+  os.path.join(testdir, 'Makefile'), 'SRC=%s/' % testdir)
 
 
 class TestElf(unittest.TestCase):
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 51eab6fbfa..1d774e28e5 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -488,13 +488,8 @@ class TestFunctional(unittest.TestCase):
 Args:
 Filename of ELF file to use as SPL
 """
-# TODO(s...@chromium.org): Drop this when all Elf files use 
ElfTestFile()
-if src_fname in ['bss_data', 'u_boot_ucode_ptr', 'u_boot_no_ucode_ptr',
- 'u_boot_binman_syms', 'u_boot_binman_syms_size']:
-fname = cls.ElfTestFile(src_fname)
-else:
-fname = cls.TestFile(src_fname)
-TestFunctional._MakeInputFile('spl/u-boot-spl', tools.ReadFile(fname))
+TestFunctional._MakeInputFile('spl/u-boot-spl',
+tools.ReadFile(cls.ElfTestFile(src_fname)))
 
 @classmethod
 def TestFile(cls, fname):
diff --git a/tools/binman/test/Makefile b/tools/binman/test/Makefile
index 593bbe9bd9..bdbb009874 100644
--- a/tools/binman/test/Makefile
+++ b/tools/binman/test/Makefile
@@ -1,5 +1,5 @@
 #
-# Builds test programs
+# Builds test programs. This is launched from elf_test.BuildElfTestFiles()
 #
 # Copyright (C) 2017 Google, Inc
 # Written by Simon Glass 
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 02/34] patman: Update command.Run() to handle failure better

2019-08-24 Thread Simon Glass
At present tools are not expected to fail. If they do an exception is
raised but there is no detail about what went wrong. This makes it hard
to debug if something does actually go wrong.

Fix this by outputting both stderr and stdout on failure.

Signed-off-by: Simon Glass 
---

 tools/patman/tools.py | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/patman/tools.py b/tools/patman/tools.py
index 97441ca796..0952681579 100644
--- a/tools/patman/tools.py
+++ b/tools/patman/tools.py
@@ -205,8 +205,14 @@ def Run(name, *args):
 if tool_search_paths:
 env = dict(os.environ)
 env['PATH'] = ':'.join(tool_search_paths) + ':' + env['PATH']
-return command.Run(name, *args, capture=True, capture_stderr=True,
-   env=env)
+all_args = (name,) + args
+result = command.RunPipe([all_args], capture=True, capture_stderr=True,
+ env=env, raise_on_error=False)
+if result.return_code:
+raise Exception("Error %d running '%s': %s" %
+   (result.return_code,' '.join(all_args),
+result.stderr))
+return result.stdout
 except:
 if env and not PathHasFile(env['PATH'], name):
 msg = "Please install tool '%s'" % name
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 13/34] binman: Use the Makefile to build ELF test files

2019-08-24 Thread Simon Glass
At present the ELF test files are checked into the U-Boot tree. This is
covenient since the files never change and can be used on non-x86
platforms. However it is not good practice to check in binaries and in
this case it does not seem essential.

Update the binman test-file Makefile to support having source in a
different directory. Adjust binman to run it to build bss_data, as a
start. We can add other files as needed.

Signed-off-by: Simon Glass 
---

 tools/binman/elf_test.py   |  23 +++
 tools/binman/ftest.py  |  24 ++--
 tools/binman/test/Makefile |   3 ++-
 tools/binman/test/bss_data | Bin 5020 -> 0 bytes
 4 files changed, 43 insertions(+), 7 deletions(-)
 delete mode 100755 tools/binman/test/bss_data

diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index cc6e9c5128..736b931fd5 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -50,6 +50,29 @@ class FakeSection:
 return self.sym_value
 
 
+def BuildElfTestFiles(target_dir):
+"""Build ELF files used for testing in binman
+
+This compiles and links the test files into the specified directory. It the
+Makefile and source files in the binman test/ directory.
+
+Args:
+target_dir: Directory to put the files into
+"""
+if not os.path.exists(target_dir):
+os.mkdir(target_dir)
+testdir = os.path.join(binman_dir, 'test')
+
+# If binman is involved from the main U-Boot Makefile the -r and -R
+# flags are set in MAKEFLAGS. This prevents this Makefile from working
+# correctly. So drop any make flags here.
+if 'MAKEFLAGS' in os.environ:
+del os.environ['MAKEFLAGS']
+tools.Run('make', '-C', target_dir, '-f',
+  os.path.join(testdir, 'Makefile'), 'SRC=%s/' % testdir,
+  'bss_data', 'u_boot_ucode_ptr')
+
+
 class TestElf(unittest.TestCase):
 @classmethod
 def setUpClass(self):
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index bba07e7275..fad62bb04f 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -23,6 +23,7 @@ import cmdline
 import command
 import control
 import elf
+import elf_test
 import fdt
 from etype import fdtmap
 from etype import image_header
@@ -147,6 +148,9 @@ class TestFunctional(unittest.TestCase):
 TestFunctional._MakeInputFile('bmpblk.bin', BMPBLK_DATA)
 TestFunctional._MakeInputFile('refcode.bin', REFCODE_DATA)
 
+cls._elf_testdir = os.path.join(cls._indir, 'elftest')
+elf_test.BuildElfTestFiles(cls._elf_testdir)
+
 # ELF file with a '_dt_ucode_base_size' symbol
 with open(cls.TestFile('u_boot_ucode_ptr'), 'rb') as fd:
 TestFunctional._MakeInputFile('u-boot', fd.read())
@@ -484,13 +488,21 @@ class TestFunctional(unittest.TestCase):
 Args:
 Filename of ELF file to use as SPL
 """
-with open(cls.TestFile(src_fname), 'rb') as fd:
-TestFunctional._MakeInputFile('spl/u-boot-spl', fd.read())
+# TODO(s...@chromium.org): Drop this when all Elf files use 
ElfTestFile()
+if src_fname in ['bss_data']:
+fname = cls.ElfTestFile(src_fname)
+else:
+fname = cls.TestFile(src_fname)
+TestFunctional._MakeInputFile('spl/u-boot-spl', tools.ReadFile(fname))
 
 @classmethod
 def TestFile(cls, fname):
 return os.path.join(cls._binman_dir, 'test', fname)
 
+@classmethod
+def ElfTestFile(cls, fname):
+return os.path.join(cls._elf_testdir, fname)
+
 def AssertInList(self, grep_list, target):
 """Assert that at least one of a list of things is in a target
 
@@ -1551,7 +1563,7 @@ class TestFunctional(unittest.TestCase):
 def testTpl(self):
 """Test that an image with TPL and ots device tree can be created"""
 # ELF file with a '__bss_size' symbol
-with open(self.TestFile('bss_data'), 'rb') as fd:
+with open(self.ElfTestFile('bss_data'), 'rb') as fd:
 TestFunctional._MakeInputFile('tpl/u-boot-tpl', fd.read())
 data = self._DoReadFile('078_u_boot_tpl.dts')
 self.assertEqual(U_BOOT_TPL_DATA + U_BOOT_TPL_DTB_DATA, data)
@@ -1861,16 +1873,16 @@ class TestFunctional(unittest.TestCase):
 def testElf(self):
 """Basic test of ELF entries"""
 self._SetupSplElf()
-with open(self.TestFile('bss_data'), 'rb') as fd:
+with open(self.ElfTestFile('bss_data'), 'rb') as fd:
 TestFunctional._MakeInputFile('tpl/u-boot-tpl', fd.read())
-with open(self.TestFile('bss_data'), 'rb') as fd:
+with open(self.ElfTestFile('bss_data'), 'rb') as fd:
 TestFunctional._MakeInputFile('-boot', fd.read())
 data = self._DoReadFile('096_elf.dts')
 
 def testElfStrip(self):
 """Basic test of ELF entries"""
 self._SetupSplElf()
-with open(self.TestFile('bss_data'), 'rb') as fd:
+with 

[U-Boot] [PATCH 09/34] binman: x86: Separate out 16-bit reset and init code

2019-08-24 Thread Simon Glass
At present these two sections of code are linked together into a single
2KB chunk in a single file. Some Intel SoCs like to have a FIT (Firmware
Interface Table) in the ROM and the pointer for this needs to go at
0xffc0 which is in the middle of these two sections.

Make use of the new 'reset' entry and change the existing 16-bit entry to
include just the 16-bit data.

Signed-off-by: Simon Glass 
---

 Makefile  | 10 --
 arch/x86/dts/u-boot.dtsi  |  9 ++
 scripts/Makefile.spl  | 22 +
 tools/binman/README.entries   | 46 +++
 tools/binman/etype/x86_start16.py | 15 +
 tools/binman/etype/x86_start16_spl.py | 19 +--
 tools/binman/etype/x86_start16_tpl.py | 18 ++-
 tools/binman/ftest.py |  6 ++--
 8 files changed, 88 insertions(+), 57 deletions(-)

diff --git a/Makefile b/Makefile
index 3b0864ae8e..df4a54e204 100644
--- a/Makefile
+++ b/Makefile
@@ -1402,14 +1402,18 @@ quiet_cmd_ldr = LD  $@
 cmd_ldr = $(LD) $(LDFLAGS_$(@F)) \
   $(filter-out FORCE,$^) -o $@
 
-u-boot.rom: u-boot-x86-16bit.bin u-boot.bin \
+u-boot.rom: u-boot-x86-start16.bin u-boot-x86-reset16.bin u-boot.bin \
$(if $(CONFIG_SPL_X86_16BIT_INIT),spl/u-boot-spl.bin) \
$(if $(CONFIG_TPL_X86_16BIT_INIT),tpl/u-boot-tpl.bin) \
$(if $(CONFIG_HAVE_REFCODE),refcode.bin) FORCE
$(call if_changed,binman)
 
-OBJCOPYFLAGS_u-boot-x86-16bit.bin := -O binary -j .start16 -j .resetvec
-u-boot-x86-16bit.bin: u-boot FORCE
+OBJCOPYFLAGS_u-boot-x86-start16.bin := -O binary -j .start16
+u-boot-x86-start16.bin: u-boot FORCE
+   $(call if_changed,objcopy)
+
+OBJCOPYFLAGS_u-boot-x86-reset16.bin := -O binary -j .resetvec
+u-boot-x86-reset16.bin: u-boot FORCE
$(call if_changed,objcopy)
 endif
 
diff --git a/arch/x86/dts/u-boot.dtsi b/arch/x86/dts/u-boot.dtsi
index daeb168b65..0e87b88e10 100644
--- a/arch/x86/dts/u-boot.dtsi
+++ b/arch/x86/dts/u-boot.dtsi
@@ -120,14 +120,23 @@
x86-start16-tpl {
offset = ;
};
+   x86-reset16-tpl {
+   offset = ;
+   };
 #elif defined(CONFIG_SPL)
x86-start16-spl {
offset = ;
};
+   x86-reset16-spl {
+   offset = ;
+   };
 #else
x86-start16 {
offset = ;
};
+   x86-reset16 {
+   offset = ;
+   };
 #endif
 };
 #endif
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 7af6b120b6..0f3d89b215 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -229,9 +229,11 @@ ALL-y  += $(obj)/boot.bin
 endif
 
 ifdef CONFIG_TPL_BUILD
-ALL-$(CONFIG_TPL_X86_16BIT_INIT) += $(obj)/u-boot-x86-16bit-tpl.bin
+ALL-$(CONFIG_TPL_X86_16BIT_INIT) += $(obj)/u-boot-x86-start16-tpl.bin \
+   $(obj)/u-boot-x86-reset16-tpl.bin
 else
-ALL-$(CONFIG_SPL_X86_16BIT_INIT) += $(obj)/u-boot-x86-16bit-spl.bin
+ALL-$(CONFIG_SPL_X86_16BIT_INIT) += $(obj)/u-boot-x86-start16-spl.bin \
+   $(obj)/u-boot-x86-reset16-spl.bin
 endif
 
 ALL-$(CONFIG_ARCH_ZYNQ)+= $(obj)/boot.bin
@@ -337,12 +339,20 @@ OBJCOPYFLAGS_$(SPL_BIN)-nodtb.bin = $(SPL_OBJCFLAGS) -O 
binary \
 $(obj)/$(SPL_BIN)-nodtb.bin: $(obj)/$(SPL_BIN) FORCE
$(call if_changed,objcopy)
 
-OBJCOPYFLAGS_u-boot-x86-16bit-spl.bin := -O binary -j .start16 -j .resetvec
-$(obj)/u-boot-x86-16bit-spl.bin: $(obj)/u-boot-spl FORCE
+OBJCOPYFLAGS_u-boot-x86-start16-spl.bin := -O binary -j .start16
+$(obj)/u-boot-x86-start16-spl.bin: $(obj)/u-boot-spl FORCE
$(call if_changed,objcopy)
 
-OBJCOPYFLAGS_u-boot-x86-16bit-tpl.bin := -O binary -j .start16 -j .resetvec
-$(obj)/u-boot-x86-16bit-tpl.bin: $(obj)/u-boot-tpl FORCE
+OBJCOPYFLAGS_u-boot-x86-start16-tpl.bin := -O binary -j .start16
+$(obj)/u-boot-x86-start16-tpl.bin: $(obj)/u-boot-tpl FORCE
+   $(call if_changed,objcopy)
+
+OBJCOPYFLAGS_u-boot-x86-reset16-spl.bin := -O binary -j .resetvec
+$(obj)/u-boot-x86-reset16-spl.bin: $(obj)/u-boot-spl FORCE
+   $(call if_changed,objcopy)
+
+OBJCOPYFLAGS_u-boot-x86-reset16-tpl.bin := -O binary -j .resetvec
+$(obj)/u-boot-x86-reset16-tpl.bin: $(obj)/u-boot-tpl FORCE
$(call if_changed,objcopy)
 
 LDFLAGS_$(SPL_BIN) += -T u-boot-spl.lds $(LDFLAGS_FINAL)
diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index 55e3fa0dcc..d17b3cb078 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -989,14 +989,15 @@ Entry: x86-start16: x86 16-bit start-up code for U-Boot
 ---
 
 Properties / Entry arguments:
-- filename: Filename of u-boot-x86-16bit.bin (default
-'u-boot-x86-16bit.bin')
+- filename: Filename of u-boot-x86-start16.bin (default
+'u-boot-x86-start16.bin')
 
 x86 CPUs start up in 16-bit mode, even if they are 32-bit CPUs. This code
-must be placed at a particular address. This 

[U-Boot] [PATCH 05/34] binman: Drop .note section from ELF

2019-08-24 Thread Simon Glass
Recent versions of binutils add a '.note.gnu.property' into the ELF file.
This is not required and interferes with the expected output. Drop it.

Also fix testMakeElf() to use a different file for input and output.

Signed-off-by: Simon Glass 
---

 tools/binman/elf.py  | 3 +++
 tools/binman/elf_test.py | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/binman/elf.py b/tools/binman/elf.py
index af40024cea..c7ef74ce7d 100644
--- a/tools/binman/elf.py
+++ b/tools/binman/elf.py
@@ -221,6 +221,9 @@ SECTIONS
 .empty : {
 *(.empty)
 } :empty
+/DISCARD/ : {
+*(.note.gnu.property)
+}
 .note : {
 *(.comment)
 } :note
diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index 416e43baf0..cc6e9c5128 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -148,7 +148,7 @@ class TestElf(unittest.TestCase):
 expected_text = b'1234'
 expected_data = b'wxyz'
 elf_fname = os.path.join(outdir, 'elf')
-bin_fname = os.path.join(outdir, 'elf')
+bin_fname = os.path.join(outdir, 'bin')
 
 # Make an Elf file and then convert it to a fkat binary file. This
 # should produce the original data.
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 04/34] binman: Allow use of help and entry-docs without libfdt

2019-08-24 Thread Simon Glass
At present if libfdt is not available binman can't do anything much.
Improve the situation a little.

Ideally there should be a test to cover this, but I'm not quite sure how
to fake this.

Signed-off-by: Simon Glass 
---

 tools/binman/control.py | 10 --
 tools/binman/entry.py   |  5 -
 tools/binman/etype/blob.py  |  1 -
 tools/binman/etype/blob_dtb.py  |  6 --
 tools/binman/etype/cbfs.py  |  5 -
 tools/binman/etype/fdtmap.py| 13 +
 tools/binman/etype/files.py |  5 -
 tools/binman/etype/u_boot_dtb_with_ucode.py |  5 -
 8 files changed, 37 insertions(+), 13 deletions(-)

diff --git a/tools/binman/control.py b/tools/binman/control.py
index 9e7587864c..43f5d49406 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -15,8 +15,6 @@ import tools
 import cbfs_util
 import command
 import elf
-from image import Image
-import state
 import tout
 
 # List of images we plan to create
@@ -459,6 +457,10 @@ def Binman(args):
 Args:
 args: Command line arguments Namespace object
 """
+# Put these here so that we can import this module without libfdt
+global state
+global Image
+
 if args.full_help:
 pager = os.getenv('PAGER')
 if not pager:
@@ -468,6 +470,10 @@ def Binman(args):
 command.Run(pager, fname)
 return 0
 
+# Put these here so that we can import this module without libfdt
+from image import Image
+import state
+
 if args.cmd == 'ls':
 try:
 tools.PrepareOutputDir(None)
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index 6a2c6e0d92..04c26f9e50 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -21,7 +21,6 @@ import os
 import sys
 
 import fdt_util
-import state
 import tools
 from tools import ToHex, ToHexSize
 import tout
@@ -71,6 +70,10 @@ class Entry(object):
 orig_size: Original size value read from node
 """
 def __init__(self, section, etype, node, name_prefix=''):
+# Put this here to allow entry-docs and help to work without libfdt
+global state
+import state
+
 self.section = section
 self.etype = etype
 self._node = node
diff --git a/tools/binman/etype/blob.py b/tools/binman/etype/blob.py
index d15d0789e5..d34c7b51bf 100644
--- a/tools/binman/etype/blob.py
+++ b/tools/binman/etype/blob.py
@@ -7,7 +7,6 @@
 
 from entry import Entry
 import fdt_util
-import state
 import tools
 import tout
 
diff --git a/tools/binman/etype/blob_dtb.py b/tools/binman/etype/blob_dtb.py
index 5b559967d7..b2afa064c1 100644
--- a/tools/binman/etype/blob_dtb.py
+++ b/tools/binman/etype/blob_dtb.py
@@ -5,8 +5,6 @@
 # Entry-type module for U-Boot device tree files
 #
 
-import state
-
 from entry import Entry
 from blob import Entry_blob
 
@@ -18,6 +16,10 @@ class Entry_blob_dtb(Entry_blob):
 'state' module.
 """
 def __init__(self, section, etype, node):
+# Put this here to allow entry-docs and help to work without libfdt
+global state
+import state
+
 Entry_blob.__init__(self, section, etype, node)
 
 def ObtainContents(self):
diff --git a/tools/binman/etype/cbfs.py b/tools/binman/etype/cbfs.py
index 28a9c81a8a..35b78370b2 100644
--- a/tools/binman/etype/cbfs.py
+++ b/tools/binman/etype/cbfs.py
@@ -11,7 +11,6 @@ import cbfs_util
 from cbfs_util import CbfsWriter
 from entry import Entry
 import fdt_util
-import state
 
 class Entry_cbfs(Entry):
 """Entry containing a Coreboot Filesystem (CBFS)
@@ -164,6 +163,10 @@ class Entry_cbfs(Entry):
 both of size 1MB.
 """
 def __init__(self, section, etype, node):
+# Put this here to allow entry-docs and help to work without libfdt
+global state
+import state
+
 Entry.__init__(self, section, etype, node)
 self._cbfs_arg = fdt_util.GetString(node, 'cbfs-arch', 'x86')
 self._cbfs_entries = OrderedDict()
diff --git a/tools/binman/etype/fdtmap.py b/tools/binman/etype/fdtmap.py
index b1810b9ddb..5dc08b8289 100644
--- a/tools/binman/etype/fdtmap.py
+++ b/tools/binman/etype/fdtmap.py
@@ -8,11 +8,7 @@ This handles putting an FDT into the image with just the 
information about the
 image.
 """
 
-import libfdt
-
 from entry import Entry
-from fdt import Fdt
-import state
 import tools
 import tout
 
@@ -80,6 +76,15 @@ class Entry_fdtmap(Entry):
 added as necessary. See the binman README.
 """
 def __init__(self, section, etype, node):
+# Put these here to allow entry-docs and help to work without libfdt
+global libfdt
+global state
+global Fdt
+
+import libfdt
+import state
+from fdt import Fdt
+
 Entry.__init__(self, section, etype, node)
 
 def _GetFdtmap(self):
diff --git a/tools/binman/etype/files.py b/tools/binman/etype/files.py
index 

[U-Boot] [PATCH 03/34] binman: Use cls instead of self for class methods

2019-08-24 Thread Simon Glass
It is more common to use the name 'cls' for the class object of a class
method, to distinguish it from normal methods, which use 'self' Update the
binman tests accordingly.

Signed-off-by: Simon Glass 
---

 tools/binman/ftest.py | 54 +--
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 0f3b70b3bb..acf361fa84 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -94,16 +94,16 @@ class TestFunctional(unittest.TestCase):
 the test/ diurectory.
 """
 @classmethod
-def setUpClass(self):
+def setUpClass(cls):
 global entry
 import entry
 
 # Handle the case where argv[0] is 'python'
-self._binman_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
-self._binman_pathname = os.path.join(self._binman_dir, 'binman')
+cls._binman_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
+cls._binman_pathname = os.path.join(cls._binman_dir, 'binman')
 
 # Create a temporary directory for input files
-self._indir = tempfile.mkdtemp(prefix='binmant.')
+cls._indir = tempfile.mkdtemp(prefix='binmant.')
 
 # Create some test files
 TestFunctional._MakeInputFile('u-boot.bin', U_BOOT_DATA)
@@ -113,7 +113,7 @@ class TestFunctional(unittest.TestCase):
 TestFunctional._MakeInputFile('blobfile', BLOB_DATA)
 TestFunctional._MakeInputFile('me.bin', ME_DATA)
 TestFunctional._MakeInputFile('vga.bin', VGA_DATA)
-self._ResetDtbs()
+cls._ResetDtbs()
 TestFunctional._MakeInputFile('u-boot-x86-16bit.bin', X86_START16_DATA)
 TestFunctional._MakeInputFile('u-boot-br.bin', PPC_MPC85XX_BR_DATA)
 TestFunctional._MakeInputFile('spl/u-boot-x86-16bit-spl.bin',
@@ -135,35 +135,35 @@ class TestFunctional(unittest.TestCase):
 TestFunctional._MakeInputFile('refcode.bin', REFCODE_DATA)
 
 # ELF file with a '_dt_ucode_base_size' symbol
-with open(self.TestFile('u_boot_ucode_ptr'), 'rb') as fd:
+with open(cls.TestFile('u_boot_ucode_ptr'), 'rb') as fd:
 TestFunctional._MakeInputFile('u-boot', fd.read())
 
 # Intel flash descriptor file
-with open(self.TestFile('descriptor.bin'), 'rb') as fd:
+with open(cls.TestFile('descriptor.bin'), 'rb') as fd:
 TestFunctional._MakeInputFile('descriptor.bin', fd.read())
 
-shutil.copytree(self.TestFile('files'),
-os.path.join(self._indir, 'files'))
+shutil.copytree(cls.TestFile('files'),
+os.path.join(cls._indir, 'files'))
 
 TestFunctional._MakeInputFile('compress', COMPRESS_DATA)
 
 # Travis-CI may have an old lz4
-self.have_lz4 = True
+cls.have_lz4 = True
 try:
 tools.Run('lz4', '--no-frame-crc', '-c',
-  os.path.join(self._indir, 'u-boot.bin'))
+  os.path.join(cls._indir, 'u-boot.bin'))
 except:
-self.have_lz4 = False
+cls.have_lz4 = False
 
 @classmethod
-def tearDownClass(self):
+def tearDownClass(cls):
 """Remove the temporary input directory and its contents"""
-if self.preserve_indir:
-print('Preserving input dir: %s' % self._indir)
+if cls.preserve_indir:
+print('Preserving input dir: %s' % cls._indir)
 else:
-if self._indir:
-shutil.rmtree(self._indir)
-self._indir = None
+if cls._indir:
+shutil.rmtree(cls._indir)
+cls._indir = None
 
 @classmethod
 def setup_test_args(cls, preserve_indir=False, preserve_outdirs=False,
@@ -226,7 +226,7 @@ class TestFunctional(unittest.TestCase):
 return tmpdir, updated_fname
 
 @classmethod
-def _ResetDtbs(self):
+def _ResetDtbs(cls):
 TestFunctional._MakeInputFile('u-boot.dtb', U_BOOT_DTB_DATA)
 TestFunctional._MakeInputFile('spl/u-boot-spl.dtb', 
U_BOOT_SPL_DTB_DATA)
 TestFunctional._MakeInputFile('tpl/u-boot-tpl.dtb', 
U_BOOT_TPL_DTB_DATA)
@@ -432,7 +432,7 @@ class TestFunctional(unittest.TestCase):
 return self._DoReadFileDtb(fname, use_real_dtb)[0]
 
 @classmethod
-def _MakeInputFile(self, fname, contents):
+def _MakeInputFile(cls, fname, contents):
 """Create a new test input file, creating directories as needed
 
 Args:
@@ -441,7 +441,7 @@ class TestFunctional(unittest.TestCase):
 Returns:
 Full pathname of file created
 """
-pathname = os.path.join(self._indir, fname)
+pathname = os.path.join(cls._indir, fname)
 dirname = os.path.dirname(pathname)
 if dirname and not os.path.exists(dirname):
 os.makedirs(dirname)
@@ -450,7 +450,7 @@ class TestFunctional(unittest.TestCase):
 return pathname
 
 @classmethod

[U-Boot] [PATCH 01/34] patman: Drop binary parameter

2019-08-24 Thread Simon Glass
Since cros_subprocess use bytestrings now, this feature not needed. Drop
it.

Signed-off-by: Simon Glass 
---

 tools/patman/cros_subprocess.py |  3 +--
 tools/patman/tools.py   | 15 +++
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/tools/patman/cros_subprocess.py b/tools/patman/cros_subprocess.py
index 06be64cc2c..0f0d60dfb7 100644
--- a/tools/patman/cros_subprocess.py
+++ b/tools/patman/cros_subprocess.py
@@ -54,7 +54,7 @@ class Popen(subprocess.Popen):
 """
 
 def __init__(self, args, stdin=None, stdout=PIPE_PTY, stderr=PIPE_PTY,
- shell=False, cwd=None, env=None, binary=False, **kwargs):
+ shell=False, cwd=None, env=None, **kwargs):
 """Cut-down constructor
 
 Args:
@@ -72,7 +72,6 @@ class Popen(subprocess.Popen):
 """
 stdout_pty = None
 stderr_pty = None
-self.binary = binary
 
 if stdout == PIPE_PTY:
 stdout_pty = pty.openpty()
diff --git a/tools/patman/tools.py b/tools/patman/tools.py
index 0d4705db76..97441ca796 100644
--- a/tools/patman/tools.py
+++ b/tools/patman/tools.py
@@ -186,7 +186,7 @@ def PathHasFile(path_spec, fname):
 return True
 return False
 
-def Run(name, *args, **kwargs):
+def Run(name, *args):
 """Run a tool with some arguments
 
 This runs a 'tool', which is a program used by binman to process files and
@@ -196,7 +196,6 @@ def Run(name, *args, **kwargs):
 Args:
 name: Command name to run
 args: Arguments to the tool
-kwargs: Options to pass to command.run()
 
 Returns:
 CommandResult object
@@ -206,8 +205,8 @@ def Run(name, *args, **kwargs):
 if tool_search_paths:
 env = dict(os.environ)
 env['PATH'] = ':'.join(tool_search_paths) + ':' + env['PATH']
-return command.Run(name, *args, capture=True,
-   capture_stderr=True, env=env, **kwargs)
+return command.Run(name, *args, capture=True, capture_stderr=True,
+   env=env)
 except:
 if env and not PathHasFile(env['PATH'], name):
 msg = "Please install tool '%s'" % name
@@ -401,14 +400,14 @@ def Compress(indata, algo, with_header=True):
 fname = GetOutputFilename('%s.comp.tmp' % algo)
 WriteFile(fname, indata)
 if algo == 'lz4':
-data = Run('lz4', '--no-frame-crc', '-c', fname, binary=True)
+data = Run('lz4', '--no-frame-crc', '-c', fname)
 # cbfstool uses a very old version of lzma
 elif algo == 'lzma':
 outfname = GetOutputFilename('%s.comp.otmp' % algo)
 Run('lzma_alone', 'e', fname, outfname, '-lc1', '-lp0', '-pb0', '-d8')
 data = ReadFile(outfname)
 elif algo == 'gzip':
-data = Run('gzip', '-c', fname, binary=True)
+data = Run('gzip', '-c', fname)
 else:
 raise ValueError("Unknown algorithm '%s'" % algo)
 if with_header:
@@ -441,13 +440,13 @@ def Decompress(indata, algo, with_header=True):
 with open(fname, 'wb') as fd:
 fd.write(indata)
 if algo == 'lz4':
-data = Run('lz4', '-dc', fname, binary=True)
+data = Run('lz4', '-dc', fname)
 elif algo == 'lzma':
 outfname = GetOutputFilename('%s.decomp.otmp' % algo)
 Run('lzma_alone', 'd', fname, outfname)
 data = ReadFile(outfname)
 elif algo == 'gzip':
-data = Run('gzip', '-cd', fname, binary=True)
+data = Run('gzip', '-cd', fname)
 else:
 raise ValueError("Unknown algorithm '%s'" % algo)
 return data
-- 
2.23.0.187.g17f5b7556c-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 00/34] binman: Various improvements and tidy-ups

2019-08-24 Thread Simon Glass
This series includes a number of minor improvements to binman, including:

- Dropping some test Elf files and building them from source instead
- Refactoring of x86 16-bit entries
- Support for SPL symbols within sections
- Handle the 'notes' sections and hidden symbols in recent binutils
- Improved error reporting with a tool fails


Simon Glass (34):
  patman: Drop binary parameter
  patman: Update command.Run() to handle failure better
  binman: Use cls instead of self for class methods
  binman: Allow use of help and entry-docs without libfdt
  binman: Drop .note section from ELF
  binman: Handle hidden symbols in ELF files
  binman: Correct use of 'replace' in IFWI tests
  binman: Add support for an x86 'reset' section
  binman: x86: Separate out 16-bit reset and init code
  binman: Add support for Intel FIT
  binman: Fix IFWI output when using an Intel FIT image
  binman: Use tools.Run() to run objdump
  binman: Use the Makefile to build ELF test files
  binman: Use the Makefile for u_boot_ucode_ptr
  binman: Use the Makefile for u_boot_no_ucode_ptr
  binman: Use the Makefile for u_boot_binman_syms
  binman: Use the Makefile for u_boot_binman_syms_size
  binman: Use the Makefile for u_boot_binman_syms_bad
  binman: Clean up unnecessary code related to ELF test files
  binman: Allow symbols to be resolved inside sections
  binman: Use underscore in test filenames
  binman: Rename some two-digit test files
  binman: Avoid needing the section size in advance
  binman: Increase size of TPL and SPL test data
  binman: Allow support for writing a size symbol to binaries
  binman: Correct symbol calculation with non-zero image base
  binman: Add support for Intel FSP meminit
  binman: Fix entry comment for Intel descriptor
  binman: Update IFWI entry to read entries outside constructor
  binman: Update IFWI entry to support updates
  binman: Support writing symbols into entries within an IFWI
  binman: Write symbol info before image inclusion
  binman: Add logging for the number of pack passes
  binman: Drop comment-out code in testUpdateFdtOutput()

 Makefile  |  10 +-
 arch/x86/dts/u-boot.dtsi  |   9 +
 scripts/Makefile.spl  |  22 +-
 tools/binman/README.entries   | 136 --
 tools/binman/control.py   |  13 +-
 tools/binman/elf.py   |  11 +-
 tools/binman/elf_test.py  |  57 -
 tools/binman/entry.py |   5 +-
 tools/binman/etype/blob.py|   1 -
 tools/binman/etype/blob_dtb.py|   6 +-
 tools/binman/etype/cbfs.py|   5 +-
 tools/binman/etype/fdtmap.py  |  13 +-
 tools/binman/etype/files.py   |   5 +-
 tools/binman/etype/intel_descriptor.py|   2 +-
 tools/binman/etype/intel_fit.py   |  32 +++
 tools/binman/etype/intel_fit_ptr.py   |  41 +++
 tools/binman/etype/intel_fsp_m.py |  27 ++
 tools/binman/etype/intel_ifwi.py  |  68 +++--
 tools/binman/etype/section.py |  16 +-
 tools/binman/etype/u_boot_dtb_with_ucode.py   |   5 +-
 tools/binman/etype/u_boot_spl.py  |   2 +-
 tools/binman/etype/u_boot_tpl.py  |   2 +-
 tools/binman/etype/x86_reset16.py |  29 +++
 tools/binman/etype/x86_reset16_spl.py |  29 +++
 tools/binman/etype/x86_reset16_tpl.py |  29 +++
 tools/binman/etype/x86_start16.py |  15 +-
 tools/binman/etype/x86_start16_spl.py |  19 +-
 tools/binman/etype/x86_start16_tpl.py |  18 +-
 tools/binman/ftest.py | 241 --
 tools/binman/test/021_image_pad.dts   |   2 +-
 tools/binman/test/024_sorted.dts  |   2 +-
 tools/binman/test/028_pack_4gb_outside.dts|   2 +-
 .../test/{029_x86-rom.dts => 029_x86_rom.dts} |   2 +-
 ...no-desc.dts => 030_x86_rom_me_no_desc.dts} |   0
 ...{031_x86-rom-me.dts => 031_x86_rom_me.dts} |   0
 .../{032_intel-vga.dts => 032_intel_vga.dts}  |   0
 ...33_x86-start16.dts => 033_x86_start16.dts} |   0
 .../{042_intel-fsp.dts => 042_intel_fsp.dts}  |   0
 .../{043_intel-cmc.dts => 043_intel_cmc.dts}  |   0
 .../{046_intel-vbt.dts => 046_intel_vbt.dts}  |   0
 ...tart16-spl.dts => 048_x86_start16_spl.dts} |   0
 tools/binman/test/053_symbols.dts |   2 +-
 ...tart16-tpl.dts => 081_x86_start16_tpl.dts} |   0
 ...=> 098_4gb_and_skip_at_start_together.dts} |   0
 ..._x86-rom-ifwi.dts => 111_x86_rom_ifwi.dts} |   2 +-
 ...nodesc.dts => 112_x86_rom_ifwi_nodesc.dts} |   2 +-
 ...nodata.dts => 113_x86_rom_ifwi_nodata.dts} |   2 +-
 tools/binman/test/144_x86_reset16.dts |  13 +
 tools/binman/test/145_x86_reset16_spl.dts |  13 +
 tools/binman/test/146_x86_reset16_tpl.dts |  13 +
 tools/binman/test/147_intel_fit.dts   |  20 ++
 tools/binman/test/148_intel_fit_missing.dts   |  17 ++
 

Re: [U-Boot] [PATCH 3/4] env: add missing header file

2019-08-24 Thread Joris OFFOUGA
Hi Pierre-Jean

It's work on my side.

Tested-by Joris Offouga 

Best Regards,
Joris Offouga

Le ven. 23 août 2019 à 23:05, Pierre-Jean Texier  a
écrit :

> Since commit af95f20 ("env: Create a new file for environment functions"),
> a new header file exists.
>
> So, this commit add a missing header file.
>
> Fixes:
>
> include/env.h:158:1: error: unknown type name ‘ulong’; did you mean ‘long’?
>  ulong env_get_ulong(const char *name, int base, ulong default_val);
>  ^
>  long
> include/env.h:158:49: error: unknown type name ‘ulong’; did you mean
> ‘long’?
>  ulong env_get_ulong(const char *name, int base, ulong default_val);
>
> Signed-off-by: Pierre-Jean Texier 
> ---
>  include/env.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/include/env.h b/include/env.h
> index a74a261..b72239f 100644
> --- a/include/env.h
> +++ b/include/env.h
> @@ -9,6 +9,7 @@
>  #ifndef __ENV_H
>  #define __ENV_H
>
> +#include 
>  #include 
>  #include 
>
> --
> 2.7.4
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] fw_env: remove duplicated definitions

2019-08-24 Thread Joris OFFOUGA
Hi Pierre-Jean

It's work on my side.

Tested-by Joris Offouga 

Best Regards,
Joris Offouga

Le ven. 23 août 2019 à 23:04, Pierre-Jean Texier  a
écrit :

> Since commit d3716dd ("env: Rename the redundancy flags"), the
> definitions of ENV_REDUND_OBSOLETE & ENV_REDUND_ACTIVE was moved
> to env.h.
>
> Fixes:
>
> tools/env/fw_env.c:122:22: error: ‘ENV_REDUND_ACTIVE’ redeclared as
> different kind of symbol
>  static unsigned char ENV_REDUND_ACTIVE = 1;
>   ^
> In file included from tools/env/fw_env.c:13:
> include/env.h:63:2: note: previous definition of ‘ENV_REDUND_ACTIVE’ was
> here
>   ENV_REDUND_ACTIVE = 1,
>   ^
> tools/env/fw_env.c:127:22: error: ‘ENV_REDUND_OBSOLETE’ redeclared as
> different kind of symbol
>  static unsigned char ENV_REDUND_OBSOLETE;
>   ^~~
> In file included from tools/env/fw_env.c:13:
> include/env.h:62:2: note: previous definition of ‘ENV_REDUND_OBSOLETE’ was
> here
>   ENV_REDUND_OBSOLETE = 0,
>
> Signed-off-by: Pierre-Jean Texier 
> ---
>  tools/env/fw_env.c | 7 ---
>  1 file changed, 7 deletions(-)
>
> diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
> index 95c9984..876bf2b 100644
> --- a/tools/env/fw_env.c
> +++ b/tools/env/fw_env.c
> @@ -119,13 +119,6 @@ static struct environment environment = {
>
>  static int have_redund_env;
>
> -static unsigned char ENV_REDUND_ACTIVE = 1;
> -/*
> - * ENV_REDUND_OBSOLETE must be 0 to efficiently set it on NOR flash
> without
> - * erasing
> - */
> -static unsigned char ENV_REDUND_OBSOLETE;
> -
>  #define DEFAULT_ENV_INSTANCE_STATIC
>  #include 
>
> --
> 2.7.4
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/4] fw_env: fix build error

2019-08-24 Thread Joris OFFOUGA
Hi Pierre-Jean

It's work on my side.

Tested-by Joris Offouga 

Best Regards,
Joris Offouga

Le ven. 23 août 2019 à 23:04, Pierre-Jean Texier  a
écrit :

> The following error appears:
>
> tools/env/fw_env.c:1149:25: error: lvalue required as unary ‘&’ operand
>   rc = write(fd, _REDUND_OBSOLETE, sizeof(ENV_REDUND_OBSOLETE));
>
> Fixes: d3716dd ("env: Rename the redundancy flags")
>
> Signed-off-by: Pierre-Jean Texier 
> ---
>  tools/env/fw_env.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
> index 876bf2b..b8b936f 100644
> --- a/tools/env/fw_env.c
> +++ b/tools/env/fw_env.c
> @@ -1146,7 +1146,7 @@ static int flash_flag_obsolete(int dev, int fd,
> off_t offset)
> return rc;
> }
> ioctl(fd, MEMUNLOCK, );
> -   rc = write(fd, _REDUND_OBSOLETE, sizeof(ENV_REDUND_OBSOLETE));
> +   rc = write(fd, ENV_REDUND_OBSOLETE, sizeof(ENV_REDUND_OBSOLETE));
> ioctl(fd, MEMLOCK, );
> if (rc < 0)
> perror("Could not set obsolete flag");
> --
> 2.7.4
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] mips: bmips: remove unneeded definitions

2019-08-24 Thread Álvaro Fernández Rojas
These are no longer needed.

Signed-off-by: Álvaro Fernández Rojas 
---
 include/configs/bmips_common.h | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/include/configs/bmips_common.h b/include/configs/bmips_common.h
index 788f4af70d..e86393a34b 100644
--- a/include/configs/bmips_common.h
+++ b/include/configs/bmips_common.h
@@ -14,17 +14,10 @@
 #define CONFIG_SYS_BAUDRATE_TABLE  { 9600, 19200, 38400, 57600, 115200, \
  230400, 50, 150 }
 
-/* RAM */
-#define CONFIG_SYS_MEMTEST_START   0xa000
-#define CONFIG_SYS_MEMTEST_END 0xa200
-
 /* Memory usage */
 #define CONFIG_SYS_MAXARGS 24
 #define CONFIG_SYS_MALLOC_LEN  (2 * 1024 * 1024)
 #define CONFIG_SYS_BOOTPARAMS_LEN  (128 * 1024)
 #define CONFIG_SYS_CBSIZE  512
 
-/* U-Boot */
-#define CONFIG_SYS_MONITOR_BASECONFIG_SYS_TEXT_BASE
-
 #endif /* __CONFIG_BMIPS_COMMON_H */
-- 
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot