Re: [U-Boot] [RESEND PATCH 1/2] dm: core: add missing dev_count_phandle_with_args()

2017-12-04 Thread Patrice CHOTARD
Hi Simon

On 12/02/2017 04:28 AM, Simon Glass wrote:
> Hi Patrice,
> 
> On 29 November 2017 at 01:06,   wrote:
>> From: Patrice Chotard 
>>
>> Add missing dev_count_phandle_with_args() to avoid
>> compilation issue.
>>
>> Signed-off-by: Patrice Chotard 
>> ---
>>   drivers/core/read.c | 7 +++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/drivers/core/read.c b/drivers/core/read.c
>> index 5d440ce..f346cc1 100644
>> --- a/drivers/core/read.c
>> +++ b/drivers/core/read.c
>> @@ -103,6 +103,13 @@ int dev_read_phandle_with_args(struct udevice *dev, 
>> const char *list_name,
>>out_args);
>>   }
>>
>> +int dev_count_phandle_with_args(struct udevice *dev, const char *list_name,
>> +   const char *cells_name)
> 
> Is there a declaration of this in the header file?

yes

Patrice

> 
>> +{
>> +   return ofnode_count_phandle_with_args(dev_ofnode(dev), list_name,
>> + cells_name);
>> +}
>> +
>>   int dev_read_addr_cells(struct udevice *dev)
>>   {
>>  return ofnode_read_addr_cells(dev_ofnode(dev));
>> --
>> 1.9.1
>>
> 
> Regards,
> Simon
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v2] efi_loader: initialise partition_signature memory

2017-12-04 Thread Alexander Graf
> Zero partition_signature in the efi_device_path_hard_drive_path
> structure when signature_type is 0 (no signature) as required by the
> UEFI specification.
> 
> This is required so that efi_dp_match() will work as expected
> when doing memcmp() comparisons.  Previously uninitialised memory
> would cause it not match nodes when it should have when the signature
> type was not GUID.
> 
> Corrects a problem where the loaded image protocol would not return a
> device path with MEDIA_DEVICE causing the OpenBSD bootloader to fail
> on rpi_3 and other targets.
> 
> v2: Also handle signature_type 1 (MBR) as described in the specification
> 
> Signed-off-by: Jonathan Gray 
> Tested-by: Artturi Alm 

Thanks, applied to efi-next

Alex

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


Re: [U-Boot] efi_loader helloworld.efi: Fix building with -Os

2017-12-04 Thread Alexander Graf
> Depending on your compiler, when compiling the hello world efi binary
> with -Os, gcc might think it's a smart idea to replace common patterns
> such as memory copies with explicit calls to memcpy().
> 
> While that sounds great at first, we don't have any memcpy() available
> in our helloworld build target. So let's indicate to gcc that we really
> do want to have the code be built as freestanding.
> 
> Fixes: bbf75dd9 ("efi_loader: output load options in helloworld")
> Signed-off-by: Alexander Graf 

Thanks, applied to efi-next

Alex

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


Re: [U-Boot] efi_loader: add missing breaks

2017-12-04 Thread Alexander Graf
> Otherwise with GUID partition types you would end up with things like:
> 
>   
> .../HD(Part0,Sig6252c819-4624-4995-8d16-abc9cd5d4130)/HD(Part0,MBRType=02,SigType=02)
> 
> Signed-off-by: Rob Clark 

Thanks, applied to efi-next

Alex

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


Re: [U-Boot] efi_loader: Fix partition offsets

2017-12-04 Thread Alexander Graf
> Commit 884bcf6f65 (efi_loader: use proper device-paths for partitions) tried
> to introduce the el torito scheme to all partition table types: Spawn
> individual disk objects for each partition on a disk.
> 
> Unfortunately, that code ended up creating partitions with offset=0 which 
> meant
> that anyone accessing these objects gets data from the raw block device 
> instead
> of the partition.
> 
> Furthermore, all the el torito logic to spawn devices for partitions was
> duplicated. So let's merge the two code paths and give partition disk objects
> good offsets to work from, so that payloads can actually make use of them.
> 
> Fixes: 884bcf6f65 (efi_loader: use proper device-paths for partitions)
> Reported-by: Yousaf Kaukab 
> Signed-off-by: Alexander Graf 

Thanks, applied to efi-next

Alex

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


Re: [U-Boot] efi_loader: Exit in efi_set_bootdev() upon invalid "desc"

2017-12-04 Thread Alexander Graf
> When trying to load an image from a non-existent USB key, U-Boot v2017.11
> crashes on my x86 platform:
> 
> => load usb 0:1 0300 abc
> General Protection
> EIP: 0010:[<7b59030d>] EFLAGS: 00010286
> Original EIP :[]
> ...
> 
> This used to work in v2017.09. Testing has shown, that this bug was
> introduced with patch 95c5553e [efi_loader: refactor boot device and
> loaded_image handling].
> 
> This patch now checks if a valid "desc" is returned from blk_get_dev()
> and only continues when "desc" is available. Resulting in this cmd
> output (again):
> 
> => load usb 0:1 0300 abc
> ** Bad device usb 0 **
> 
> Signed-off-by: Stefan Roese 
> Cc: Rob Clark 
> Cc: Heinrich Schuchardt 
> Cc: Alexander Graf 
> Cc: Marek Vasut 
> Cc: Bin Meng 
> Reviewed-by: Heinrich Schuchardt 

Thanks, applied to efi-next

Alex

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


[U-Boot] [PATCH] armv8: layerscape: refine port register configuration

2017-12-04 Thread Yuantian Tang
These PP2C and PP3C registers control the configuration of the PHY
control OOB timing for the COMINIT/COMWAKE parameters respectively
for sata port. Overwrite default values with calculated ones to get
better OOB timing.

Signed-off-by: Tang Yuantian 
---
 arch/arm/cpu/armv8/fsl-layerscape/soc.c| 6 ++
 arch/arm/include/asm/arch-fsl-layerscape/soc.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/soc.c 
b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
index 497a4b541d..b52653929c 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/soc.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
@@ -328,6 +328,8 @@ int sata_init(void)
 #ifdef CONFIG_SYS_SATA2
ccsr_ahci  = (void *)CONFIG_SYS_SATA2;
out_le32(&ccsr_ahci->ppcfg, AHCI_PORT_PHY_1_CFG);
+   out_le32(&ccsr_ahci->pp2c, AHCI_PORT_PHY2_CFG);
+   out_le32(&ccsr_ahci->pp3c, AHCI_PORT_PHY3_CFG);
out_le32(&ccsr_ahci->ptc, AHCI_PORT_TRANS_CFG);
out_le32(&ccsr_ahci->axicc, AHCI_PORT_AXICC_CFG);
 #endif
@@ -335,6 +337,8 @@ int sata_init(void)
 #ifdef CONFIG_SYS_SATA1
ccsr_ahci  = (void *)CONFIG_SYS_SATA1;
out_le32(&ccsr_ahci->ppcfg, AHCI_PORT_PHY_1_CFG);
+   out_le32(&ccsr_ahci->pp2c, AHCI_PORT_PHY2_CFG);
+   out_le32(&ccsr_ahci->pp3c, AHCI_PORT_PHY3_CFG);
out_le32(&ccsr_ahci->ptc, AHCI_PORT_TRANS_CFG);
out_le32(&ccsr_ahci->axicc, AHCI_PORT_AXICC_CFG);
 
@@ -355,6 +359,8 @@ int sata_init(void)
/* Disable SATA ECC */
out_le32((void *)CONFIG_SYS_DCSR_DCFG_ADDR + 0x520, 0x8000);
out_le32(&ccsr_ahci->ppcfg, AHCI_PORT_PHY_1_CFG);
+   out_le32(&ccsr_ahci->pp2c, AHCI_PORT_PHY2_CFG);
+   out_le32(&ccsr_ahci->pp3c, AHCI_PORT_PHY3_CFG);
out_le32(&ccsr_ahci->ptc, AHCI_PORT_TRANS_CFG);
out_le32(&ccsr_ahci->axicc, AHCI_PORT_AXICC_CFG);
 
diff --git a/arch/arm/include/asm/arch-fsl-layerscape/soc.h 
b/arch/arm/include/asm/arch-fsl-layerscape/soc.h
index 247f09e0f5..664d847e9c 100644
--- a/arch/arm/include/asm/arch-fsl-layerscape/soc.h
+++ b/arch/arm/include/asm/arch-fsl-layerscape/soc.h
@@ -88,6 +88,8 @@ struct cpu_type {
 
 /* ahci port register default value */
 #define AHCI_PORT_PHY_1_CFG0xa003fffe
+#define AHCI_PORT_PHY2_CFG 0x28184d1f
+#define AHCI_PORT_PHY3_CFG 0x0e081509
 #define AHCI_PORT_TRANS_CFG0x0829
 #define AHCI_PORT_AXICC_CFG0x3fff
 
-- 
2.14.1

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


Re: [U-Boot] [RFC PATCH 01/13] serial: s5p: rework Samsung UART driver to get rid of uart.h

2017-12-04 Thread Andre Przywara
Hi Simon,

On 02/12/17 03:30, Simon Glass wrote:
> On 29 November 2017 at 18:24, Andre Przywara  wrote:
>> At the moment the serial_s5p driver takes care of both Exynos UARTs
>> as well as those from older Samsung SoCs (s3c/s5p series).
>> Looking more closely the only difference between those two groups is
>> how the fractional baud rate is programmed: via a "divslot" (s3c) or as
>> a proper fractional value (Exynos).
>> Instead of intricately expressing this via a special header file (which
>> is otherwise identical), let's use the blessings of DT to tackle this:
>> The S5P series of SoCs use their own compatible string, in line with
>> what the official DTs from the Linux kernel do. We then switch between
>> divslot and fractional value based on the compatible string used.
>> This allows us to get rid of the uart.h header files and make the
>> driver more flexible.
>>
>> Signed-off-by: Andre Przywara 
>> ---
>>  arch/arm/dts/s5pc1xx-goni.dts |  2 +-
>>  arch/arm/dts/s5pc1xx-smdkc100.dts |  2 +-
>>  arch/arm/mach-exynos/include/mach/uart.h  | 44 
>> --
>>  arch/arm/mach-s5pc1xx/include/mach/uart.h | 44 
>> --
>>  drivers/serial/serial_s5p.c   | 45 
>> +++
>>  5 files changed, 42 insertions(+), 95 deletions(-)
>>  delete mode 100644 arch/arm/mach-exynos/include/mach/uart.h
>>  delete mode 100644 arch/arm/mach-s5pc1xx/include/mach/uart.h
>>
>> diff --git a/arch/arm/dts/s5pc1xx-goni.dts b/arch/arm/dts/s5pc1xx-goni.dts
>> index 182325a091..964c7a6b67 100644
>> --- a/arch/arm/dts/s5pc1xx-goni.dts
>> +++ b/arch/arm/dts/s5pc1xx-goni.dts
>> @@ -28,7 +28,7 @@
>> };
>>
>> serial@e2900800 {
>> -   compatible = "samsung,exynos4210-uart";
>> +   compatible = "samsung,s5pv210-uart";
> 
> Does this match linux?

Yes, this is where I got the compatible from:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/s5pv210.dtsi#n331

And s5pv210.dtsi is included by s5pv210-goni.dts.

> Apart from that:
> 
> Reviewed-by: Simon Glass 

Thanks a ton for the complete review! This is much appreciated!

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


[U-Boot] [PATCH v2 4/5] treewide: convert assert() to BUG_ON()

2017-12-04 Thread Masahiro Yamada
We do not need multiple ways to do the same thing.  Instead of
assert(), use BUG_ON() from Linux.  The logic is opposite, but
Coccinelle is of great help for such a conversion.  We could
simply convert assert(x) to BUG_ON(!x) for all expressions "x",
but I did a bit better job by converting assert(a == b) to
BUG_ON(a != b), etc.

The semantic patch I used is as follows:

// 

-assert(0)
+BUG()
@@
expression a;
@@
-assert((a))
+assert(a)
@@
expression a;
@@
-assert(a == 0)
+BUG_ON(a)
@@
expression a;
@@
-assert(a == NULL)
+BUG_ON(a)
@@
expression a;
@@
-assert(a != 0)
+BUG_ON(!a)
@@
expression a;
@@
-assert(a != NULL)
+BUG_ON(!a)
@@
expression a, b;
@@
-assert(a == b)
+BUG_ON(a != b)
@@
expression a, b;
@@
-assert(a != b)
+BUG_ON(a == b)
@@
expression a, b;
@@
-assert(a < b)
+BUG_ON(a >= b)
@@
expression a, b;
@@
-assert(a <= b)
+BUG_ON(a > b)
@@
expression a;
@@
-assert(!a)
+BUG_ON(a)
@@
expression a;
@@
-assert(a)
+BUG_ON(!a)
// 

Signed-off-by: Masahiro Yamada 
Reviewed-by: Simon Glass 
---

Changes in v2:
  - Improve semantic patch and re-run coccinelle based on commit 02907004294d98

 arch/arm/mach-exynos/clock.c|  4 +-
 arch/arm/mach-tegra/clock.c | 10 ++--
 arch/arm/mach-tegra/pinmux-common.c | 80 +--
 arch/arm/mach-tegra/tegra114/clock.c| 10 ++--
 arch/arm/mach-tegra/tegra124/clock.c| 10 ++--
 arch/arm/mach-tegra/tegra20/clock.c | 14 ++---
 arch/arm/mach-tegra/tegra210/clock.c| 10 ++--
 arch/arm/mach-tegra/tegra30/clock.c | 10 ++--
 arch/sandbox/cpu/state.c|  4 +-
 arch/x86/cpu/intel_common/mrc.c |  2 +-
 arch/x86/lib/efi/efi.c  |  2 +-
 arch/x86/lib/fsp/fsp_support.c  |  6 +-
 arch/x86/lib/physmem.c  |  5 +-
 board/freescale/qemu-ppce500/qemu-ppce500.c |  8 +--
 cmd/bootefi.c   |  2 +-
 cmd/mtdparts.c  |  2 +-
 cmd/tpm_test.c  | 28 +-
 common/dlmalloc.c   | 86 ++---
 common/fdt_support.c|  2 +-
 common/hwconfig.c   | 36 ++--
 drivers/clk/clk-uclass.c|  2 +-
 drivers/clk/rockchip/clk_rk3036.c   | 23 
 drivers/clk/rockchip/clk_rk3128.c   | 27 -
 drivers/clk/rockchip/clk_rk3188.c   | 28 --
 drivers/clk/rockchip/clk_rk322x.c   | 23 
 drivers/clk/rockchip/clk_rk3288.c   | 36 +---
 drivers/clk/rockchip/clk_rk3328.c   |  8 +--
 drivers/clk/rockchip/clk_rk3368.c   |  4 +-
 drivers/clk/rockchip/clk_rk3399.c   | 51 +++--
 drivers/clk/rockchip/clk_rv1108.c   |  2 +-
 drivers/core/device-remove.c|  8 +--
 drivers/core/device.c   |  2 +-
 drivers/core/ofnode.c   | 24 
 drivers/core/uclass.c   |  4 +-
 drivers/gpio/gpio-uclass.c  |  2 +-
 drivers/i2c/i2c-uclass.c|  2 +-
 drivers/input/input.c   |  4 +-
 drivers/input/key_matrix.c  |  2 +-
 drivers/misc/cros_ec.c  | 10 ++--
 drivers/misc/cros_ec_i2c.c  |  4 +-
 drivers/mtd/nand/tegra_nand.c   |  2 +-
 drivers/mtd/spi/sandbox.c   |  4 +-
 drivers/net/fsl-mc/mc.c |  2 +-
 drivers/phy/phy-uclass.c|  2 +-
 drivers/power/tps6586x.c|  4 +-
 drivers/rtc/rtc-uclass.c| 10 ++--
 drivers/sound/sound.c   |  2 +-
 drivers/spi/exynos_spi.c|  6 +-
 drivers/usb/emul/sandbox_flash.c|  2 +-
 drivers/usb/host/usb-uclass.c   |  4 +-
 drivers/video/stb_truetype.h|  2 +-
 fs/ext4/dev.c   |  2 +-
 fs/ext4/ext4_common.c   |  2 +-
 fs/ext4/ext4_journal.c  |  2 +-
 fs/fat/fat.c|  2 +-
 include/dm/ofnode.h |  4 +-
 include/efi_loader.h| 12 ++--
 lib/circbuf.c   | 16 +++---
 lib/efi_loader/efi_boottime.c   |  2 +-
 lib/efi_loader/efi_device_path.c|  2 +-
 lib/efi_loader/efi_file.c   |  2 +-
 lib/efi_loader/efi_memory.c |  2 +-
 lib/fdtdec.c|  8 +--
 lib/membuff.c   |  4 +-
 lib/physmem.c   |  4 +-
 lib/qsort.c |  2 +-
 lib/slre.c  |  8 +--
 net/eth-uclass.c|  2 +-
 net/eth_legacy.c|  2 +-
 net/net.c   |  2 +-
 test/command_ut.c  

[U-Boot] [PATCH v2 0/5] Remove assert()

2017-12-04 Thread Masahiro Yamada

assert() is almost used in the same way as BUG_ON(), except:
  - the logic is opposite
  - currently, assert() is compiled only when DEBUG is defined

Coccinelle can easily convert assert() to BUG_ON(),
but the problem is it would grow the image size.

In v2, I introduced CONFIG_ENABLE_BUG_CHECKS.
This option is 'n' by default, and makes it BUG_ON etc. into no-op.


Masahiro Yamada (5):
  Move CONFIG_PANIC_HANG to Kconfig
  Enable CONFIG_PANIC_HANG for boards without do_reset()
  Introduce CONFIG_ENABLE_BUG_CHECKS to disable BUG{_ON} by default
  treewide: convert assert() to BUG_ON()
  Remove assert()

 README  | 10 
 arch/arm/cpu/armv8/fsl-layerscape/Kconfig   |  3 +
 arch/arm/mach-exynos/clock.c|  4 +-
 arch/arm/mach-tegra/clock.c | 10 ++--
 arch/arm/mach-tegra/pinmux-common.c | 80 +--
 arch/arm/mach-tegra/tegra114/clock.c| 10 ++--
 arch/arm/mach-tegra/tegra124/clock.c| 10 ++--
 arch/arm/mach-tegra/tegra20/clock.c | 14 ++---
 arch/arm/mach-tegra/tegra210/clock.c| 10 ++--
 arch/arm/mach-tegra/tegra30/clock.c | 10 ++--
 arch/powerpc/cpu/mpc85xx/Kconfig| 37 +
 arch/sandbox/cpu/state.c|  4 +-
 arch/x86/cpu/intel_common/mrc.c |  2 +-
 arch/x86/lib/efi/efi.c  |  2 +-
 arch/x86/lib/fsp/fsp_support.c  |  6 +-
 arch/x86/lib/physmem.c  |  5 +-
 board/freescale/qemu-ppce500/qemu-ppce500.c |  8 +--
 cmd/bootefi.c   |  2 +-
 cmd/mtdparts.c  |  2 +-
 cmd/tpm_test.c  | 28 +-
 common/dlmalloc.c   | 86 ++---
 common/fdt_support.c|  2 +-
 common/hwconfig.c   | 36 ++--
 configs/TWR-P1025_defconfig |  1 +
 configs/UCP1020_SPIFLASH_defconfig  |  1 +
 configs/UCP1020_defconfig   |  1 +
 configs/adp-ae3xx_defconfig |  1 +
 configs/cl-som-imx7_defconfig   |  1 +
 configs/evb-rk3229_defconfig|  1 +
 configs/mccmon6_sd_defconfig|  1 +
 configs/opos6uldev_defconfig|  1 +
 configs/qemu-ppce500_defconfig  |  1 +
 configs/tricorder_defconfig |  1 +
 configs/tricorder_flash_defconfig   |  1 +
 configs/uniphier_ld4_sld8_defconfig |  1 +
 configs/uniphier_v7_defconfig   |  1 +
 configs/uniphier_v8_defconfig   |  1 +
 configs/xpedite517x_defconfig   |  1 +
 configs/xpedite520x_defconfig   |  1 +
 configs/xpedite537x_defconfig   |  1 +
 configs/xpedite550x_defconfig   |  1 +
 drivers/clk/clk-uclass.c|  2 +-
 drivers/clk/rockchip/clk_rk3036.c   | 23 
 drivers/clk/rockchip/clk_rk3128.c   | 27 -
 drivers/clk/rockchip/clk_rk3188.c   | 28 --
 drivers/clk/rockchip/clk_rk322x.c   | 23 
 drivers/clk/rockchip/clk_rk3288.c   | 36 +---
 drivers/clk/rockchip/clk_rk3328.c   |  8 +--
 drivers/clk/rockchip/clk_rk3368.c   |  4 +-
 drivers/clk/rockchip/clk_rk3399.c   | 51 +++--
 drivers/clk/rockchip/clk_rv1108.c   |  2 +-
 drivers/core/device-remove.c|  8 +--
 drivers/core/device.c   |  2 +-
 drivers/core/ofnode.c   | 24 
 drivers/core/uclass.c   |  4 +-
 drivers/gpio/gpio-uclass.c  |  2 +-
 drivers/i2c/i2c-uclass.c|  2 +-
 drivers/input/input.c   |  4 +-
 drivers/input/key_matrix.c  |  2 +-
 drivers/misc/cros_ec.c  | 10 ++--
 drivers/misc/cros_ec_i2c.c  |  4 +-
 drivers/mtd/nand/tegra_nand.c   |  2 +-
 drivers/mtd/spi/sandbox.c   |  4 +-
 drivers/net/fsl-mc/mc.c |  2 +-
 drivers/phy/phy-uclass.c|  2 +-
 drivers/power/tps6586x.c|  4 +-
 drivers/rtc/rtc-uclass.c| 10 ++--
 drivers/sound/sound.c   |  2 +-
 drivers/spi/exynos_spi.c|  6 +-
 drivers/usb/emul/sandbox_flash.c|  2 +-
 drivers/usb/host/usb-uclass.c   |  4 +-
 drivers/video/stb_truetype.h|  2 +-
 fs/ext4/dev.c   |  2 +-
 fs/ext4/ext4_common.c   |  2 +-
 fs/ext4/ext4_journal.c  |  2 +-
 fs/fat/fat.c|  2 +-
 include/common.h| 15 -
 include/configs/B4860QDS.h  |  1 -
 include/configs/C29XPCIE.h  |  1 -
 include/configs/MPC8536DS.h |  1 -
 incl

Re: [U-Boot] efi_loader: Exit in efi_set_bootdev() upon invalid "desc"

2017-12-04 Thread Stefan Roese

Hi Alex,

On 04.12.2017 09:59, Alexander Graf wrote:

When trying to load an image from a non-existent USB key, U-Boot v2017.11
crashes on my x86 platform:

=> load usb 0:1 0300 abc
General Protection
EIP: 0010:[<7b59030d>] EFLAGS: 00010286
Original EIP :[]
...

This used to work in v2017.09. Testing has shown, that this bug was
introduced with patch 95c5553e [efi_loader: refactor boot device and
loaded_image handling].

This patch now checks if a valid "desc" is returned from blk_get_dev()
and only continues when "desc" is available. Resulting in this cmd
output (again):

=> load usb 0:1 0300 abc
** Bad device usb 0 **

Signed-off-by: Stefan Roese 
Cc: Rob Clark 
Cc: Heinrich Schuchardt 
Cc: Alexander Graf 
Cc: Marek Vasut 
Cc: Bin Meng 
Reviewed-by: Heinrich Schuchardt 


Thanks, applied to efi-next


Thanks. Does "efi-next" mean this patch will not go into v2018.01?
As it fixes a regression, I would really like to see it included in
the release.

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


[U-Boot] [PATCH 1/1] efi_loader: comments for dp_part_fill()

2017-12-04 Thread Heinrich Schuchardt
Add a description for dp_part_fill().
Reword a comment in the function.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_device_path.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
index 6461ea9abc..31cdd38773 100644
--- a/lib/efi_loader/efi_device_path.c
+++ b/lib/efi_loader/efi_device_path.c
@@ -384,6 +384,13 @@ static unsigned dp_part_size(struct blk_desc *desc, int 
part)
return dpsize;
 }
 
+/*
+ * Create a device path for a block device or one of its partitions.
+ *
+ * @bufbuffer to which the device path is wirtten
+ * @desc   block device descriptor
+ * @part   partition number, 0 identifies a block device
+ */
 static void *dp_part_fill(void *buf, struct blk_desc *desc, int part)
 {
disk_partition_t info;
@@ -396,7 +403,7 @@ static void *dp_part_fill(void *buf, struct blk_desc *desc, 
int part)
 * and handling all the different cases like we do for non-
 * legacy (ie CONFIG_BLK=y) case.  But most important thing
 * is just to have a unique device-path for if_type+devnum.
-* So map things to a fictional USB device:
+* So map things to a fictitious USB device.
 */
struct efi_device_path_usb *udp;
 
-- 
2.14.2

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


Re: [U-Boot] EFI: incorrect device paths

2017-12-04 Thread Heinrich Schuchardt
On 11/25/2017 02:49 AM, Heinrich Schuchardt wrote:
> Hello Emmanuel,
> 
> yesterday you reported on the u-boot ICS channel that you saw an
> incorrect device path for the SD card on your BananaPi M2
> (/venHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Usb(0x6,0x0)/HD(Part0,MBRType=01)).
> 
> 
> In dp_fill() both mass storage (UCLASS_MASS_STORAGE) and USB hubs
> (UCLASS_USB_HUB) are mapped to USB devices. Maybe that is what happened
> to you.

For CONFIG_BLK=n a fictitious USB node is created in the device path.
See function dp_part_fill().

Best regards

Heinrich

> 
> On my Odroid C2 the following devices paths are created:
> 
> Installed device path protocols:
> /MemoryMapped(0x0,0x7ff9c604,0x7ff9c604)
> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/MMC(Slot0)/HD(Part0,Sig6fe3)
> 
> 
> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/MMC(Slot0)/HD(Part1,Sig6fe3)
> 
> 
> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/MMC(Slot0)/HD(Part2,Sig6fe3)
> 
> 
> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/MMC(Slot0)/HD(Part3,Sig6fe3)
> 
> 
> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/MMC(Slot0)
> 
> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/
> /VenHw(dbca4c98-6cb0-694d-0872-819c650cbbb1)
> 
> /VenHw(dbca4c98-6cb0-694d-0872-819c650cbbb1)/
> VenHw(dbca4c98-6cb0-694d-0872-819c650cbba2)
> 
> /VenHw(dbca4c98-6cb0-694d-0872-819c650cbbb1)/
> VenHw(dbca4c98-6cb0-694d-0872-819c650cbba2)/VenHw(dbca4c9...
> 
> I have an SD card with four partitions.
> 
> The entry with partition number 0 should match to the whole disk. So
> obviously one device path is missing.
> 
> eMMC should be reported as eMMC(SlotNumber) where slot number is a
> number only, e.g. eMMC(1).
> 
> SD cards should be reported as SD(SlotNumber), e.g. SD(1).
> 
> Partions should be reported as
> HD(Partition,Type,Signature,Start,Size) or
> HD(Partition,Type,Signature) (display only)
> e.g.
> HD(1,GPT,15E39A00-1DD2-1000-8D7F-00A0C92408FC,0x22,0x271000)
> 
> So there seems to be still a lot to be fixed.
> 
> Best regards
> 
> Heinrich
> 

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


Re: [U-Boot] efi_loader: Exit in efi_set_bootdev() upon invalid "desc"

2017-12-04 Thread Alexander Graf


> Am 04.12.2017 um 12:52 schrieb Stefan Roese :
> 
> Hi Alex,
> 
> On 04.12.2017 09:59, Alexander Graf wrote:
>>> When trying to load an image from a non-existent USB key, U-Boot v2017.11
>>> crashes on my x86 platform:
>>> 
>>> => load usb 0:1 0300 abc
>>> General Protection
>>> EIP: 0010:[<7b59030d>] EFLAGS: 00010286
>>> Original EIP :[]
>>> ...
>>> 
>>> This used to work in v2017.09. Testing has shown, that this bug was
>>> introduced with patch 95c5553e [efi_loader: refactor boot device and
>>> loaded_image handling].
>>> 
>>> This patch now checks if a valid "desc" is returned from blk_get_dev()
>>> and only continues when "desc" is available. Resulting in this cmd
>>> output (again):
>>> 
>>> => load usb 0:1 0300 abc
>>> ** Bad device usb 0 **
>>> 
>>> Signed-off-by: Stefan Roese 
>>> Cc: Rob Clark 
>>> Cc: Heinrich Schuchardt 
>>> Cc: Alexander Graf 
>>> Cc: Marek Vasut 
>>> Cc: Bin Meng 
>>> Reviewed-by: Heinrich Schuchardt 
>> Thanks, applied to efi-next
> 
> Thanks. Does "efi-next" mean this patch will not go into v2018.01?

Yes, sorry for the confusion :)

Alex

> As it fixes a regression, I would really like to see it included in
> the release.
> 
> Thanks,
> Stefan
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] imx: Unify CONFIG_BOOTDELAY

2017-12-04 Thread Stefano Babic
On 01/12/2017 21:33, Fabio Estevam wrote:
> Hi Stefano,
> 
> On Mon, Nov 20, 2017 at 11:54 AM, Fabio Estevam  wrote:
>> In order to provide a consistent user experience for imx board users,
>> remove the custom CONFIG_BOOTDELAY values from defconfig files, so that
>> all boards can use the default two second delay.
>>
>> Signed-off-by: Fabio Estevam 
> 
> Are you happy with this one?

I had already set the status to "Awaiting upstream", it was not yet
merged - sorry. I have picked it up.

Regards,
Stefano


-- 
=
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 00/23] imx: add i.MX8M support and i.MX8MQ EVK

2017-12-04 Thread Stefano Babic
Hi Peng,

On 01/12/2017 04:28, Peng Fan wrote:
> Hi Stefano,
> 
> I plan to send out V2 patchset today or tommorw. 
> 

Sorry for late answer - I gon on with review for V2.

> About 
> https://patchwork.ozlabs.org/patch/842122/  imx: mx8m: add ddr 
> register memory map
> https://patchwork.ozlabs.org/patch/842167/   imx: add i.MX8MQ EVK 
> support
> 
> it is hard for me to convert using structure about the ddr script.
> It was released by SoC team, and lots registers there.
> For now, even if I struggle to convert to use structure, it will be pain
> if SoC team released new script.
> 
> So is it possible that ddr_init in spl_dram_init is marked as "TODO" in the 
> board patch,
> and ddr related part is removed this V2 patchset?
> 

I understand your point, but on the other side merging this stuff is
messy and IMHO is worse for the project and for MX8M itself. In fact, a
big advantage for current i.MX tree is that it is easy and
straightforward to add a new board. Of course, the big number of i.MX6
boards (89 in 2017.11) is first due to the fact that this SOC has well
matched customer's expectations, but it also because it is not obscured
to add a new custom board, even if it is not strictly derived from a NXP
Eval Board. And this is a big advantage in the long term because NXP
customers rely on the fact that a SOC is well supported, not just if it
is in a couple of eval boards.

The patches (at least V1, I will start now with V2) show a "dump" of
registers for the DDR controller - there is no logic and, you can guess,
it does not help a lot if further boards are added. And even worse,
users are looking to NXP boards as reference, and new boards will be
just a copy&paste of the first one. And nobody will easy understand
issues, because a hex dump is not really helpful.

So I have to say, no, I won't be happy if blobs are pushed to U-Boot tree.

Best regards,
Stefano



> I hope the i.MX8M patchset could be in next release.
> 
> Thanks,
> Peng.
> 
>> -Original Message-
>> From: U-Boot [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Peng Fan
>> Sent: Wednesday, November 29, 2017 1:31 PM
>> To: Stefano Babic ; Fabio Estevam
>> 
>> Cc: u-boot@lists.denx.de
>> Subject: Re: [U-Boot] [PATCH 00/23] imx: add i.MX8M support and i.MX8MQ
>> EVK
>>
>> Hi Stefano,
>>
>>> -Original Message-
>>> From: Stefano Babic [mailto:sba...@denx.de]
>>> Sent: Tuesday, November 28, 2017 10:46 PM
>>> To: Peng Fan ; sba...@denx.de; Fabio Estevam
>>> 
>>> Cc: u-boot@lists.denx.de; van.free...@gmail.com
>>> Subject: Re: [PATCH 00/23] imx: add i.MX8M support and i.MX8MQ EVK
>>>
>>> Hi Peng,
>>>
>>> On 28/11/2017 13:31, Peng Fan wrote:
 This patchset is to add i.MX8M and i.MX8MQ-EVK support

>>>
>>> Thanks for sharing this.
>>>
 patch: "power: pmic.h: include dm/ofnode.h" and
 "power: pmic/regulator allow dm be omited by SPL" is previously
 reviewed in mailist to not merged. Pick it up.
>>>
>>>
>>> Ok, I'll merge these two independently from the rest.
>>
>> Thanks. I should say if no issue, you may pick it up. Then I'll not include 
>> these
>> two patches in V2.
>>
>>>
>>>
 The board support is a large patch because of the ddr related code.
 If it is not good,
>>>
>>> You agree, it is not good. Anyway, I think one goal will be to have a
>>> platform like we have for i.MX6. Nowadays, it is easy and
>>> straightforward to add a new
>>> i.MX6 board. I set this goal for i.MX8, too.
>>
>> i.MX8M is actually like i.MX6/7, it is different from i.MX8QM and else. You 
>> could
>> see there is no scu api in this patchset.
>>
>>>
 please first review/pick-up other patches if they  are ok.
>>>
>>> I'll do it.
>>
>> Thanks,
>> Peng.
>>
>>>

 Peng Fan (23):
   imx: add i.MX8M into Kconfig
   imx: mx8m: add register definition header file
   imx: mx8m: add pin header file
   imx: mx8m: add clock driver
   imx: add sip function
   imx: boot_mode: add USB_BOOT entry
   imx: cpu: update cpu file to support i.MX8M
   imx: spl: implement spl_boot_device for i.MX8M
   power: pmic.h: include dm/ofnode.h
   imx: add i.MX8MQ SoC Revision and is_mx8m helper
   imx: add pad settings bit definition for i.MX8M
   imx: mx8m: add soc related settings and files
   imx: makefile: compile files for i.MX8M
   misc: ocotp: add i.MX8M support
   mmc: fsl_esdhc: support i.MX8M
   imx: lcdif: include i.MX8M
   gpio: mxc: add i.MX8M support
   imx: mx8m: add ddr register memory map
   net: fec: do not access reserved register for i.MX8M
   net: fec: fix build warnings for 64bits support
   power: pmic/regulator allow dm be omitted by SPL
   imx: imx8mq: add dtsi file
   imx: add i.MX8MQ EVK support

  arch/arm/Kconfig   |8 +
  arch/arm/Makefile  |4 +-
  arch/arm/dts/Makefile  |2 +
  arch/arm/

Re: [U-Boot] [PATCH] ARM: uniphier: clean up board_init

2017-12-04 Thread Masahiro Yamada
2017-11-29 15:01 GMT+09:00 Masahiro Yamada :
> Remove unnecessary DECLARE_GLOBAL_DATA_PTR and header includes.
>
>  has been replaced with  and .
>
> Signed-off-by: Masahiro Yamada 
> ---
>


Applied to u-boot-uniphier.


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


Re: [U-Boot] [PATCH] mtd: nand: denali: remove bogus __maybe_unused

2017-12-04 Thread Masahiro Yamada
2017-11-29 19:18 GMT+09:00 Masahiro Yamada :
> denali_setup_data_interface() is always used.
>
> I put __maybe_unused for a temporal use, then forgot to delete it.
>
> Signed-off-by: Masahiro Yamada 
> ---
>
Applied to u-boot-uniphier.



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


Re: [U-Boot] [PATCH] mtd: nand: denali: remove ad-hoc board_nand_init() entry

2017-12-04 Thread Masahiro Yamada
2017-11-29 19:19 GMT+09:00 Masahiro Yamada :
> This driver is highly dependent on the configuration from denali_dt.c
> Please enable CONFIG_NAND_DENALI_DT if you use this driver.
>
> Signed-off-by: Masahiro Yamada 



Applied to u-boot-uniphier.


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


Re: [U-Boot] [PATCH 1/4] mtd: nand: Rename nand.h into rawnand.h

2017-12-04 Thread Masahiro Yamada
2017-11-30 13:45 GMT+09:00 Masahiro Yamada :
> This header was renamed to rawnand.h in Linux.
>
> The following is the corresponding commit in Linux.
>
>   commit d4092d76a4a4e57b65910899948a83cc8646c5a5
>   Author: Boris Brezillon 
>   Date:   Fri Aug 4 17:29:10 2017 +0200
>
>   mtd: nand: Rename nand.h into rawnand.h
>
>   We are planning to share more code between different NAND based
>   devices (SPI NAND, OneNAND and raw NANDs), but before doing that
>   we need to move the existing include/linux/mtd/nand.h file into
>   include/linux/mtd/rawnand.h so we can later create a nand.h header
>   containing all common structure and function prototypes.
>
> Signed-off-by: Masahiro Yamada 
> ---
>


Applied to u-boot-uniphier.



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


Re: [U-Boot] arm socfpga: Revert "spi: cadence_qspi_apb: Support 32 bit AHB address"

2017-12-04 Thread Frank Mori Hess
Since your commit broke my platform to fix yours, shouldn't it be reverted
and TI platforms use your pending patch queue?

On Dec 3, 2017 23:14, "Vignesh R"  wrote:



On Sunday 03 December 2017 09:29 PM, Frank Mori Hess wrote:
> This reverts commit dac3bf20fb2c9b03476be0d73db620f62ab3cee1.
>
> My u-boot spl crashes in a loop when I boot off a
> cadence qspi flash.  I narrowed it down to the changes from commit
> dac3bf20fb2c9b03476be0d73db620f62ab3cee1 which removes
> CQSPI_INDIRECTTRIGGER_ADDR_MASK.  Restoring the mask allows the spl to
> successfully load the main u-boot.  My board is an Altera HPS cyclone
> V socfpga.  It has an ahb base address of 0xffa0 and for some
> reason, without the CQSPI_INDIRECTTRIGGER_ADDR_MASK the board reboots
> when cadence_qspi_apb_indirect_read_execute tries to read from the ahb
> base address.  I'm was using version 2016.11 of u-boot.

This breaks TI platforms where INDIRECTTRIGGER_ADDR is 32bit wide.
Instead please try this patch series which adds cdns,trigger-address DT
property: http://patchwork.ozlabs.org/patch/838589/

Regards
Vignesh

>
> Signed-off-by: Frank Mori Hess 
> ---
>  drivers/spi/cadence_qspi_apb.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/spi/cadence_qspi_apb.c b/drivers/spi/cadence_qspi_apb
.c
> index e02f2217f4..b300f36607 100644
> --- a/drivers/spi/cadence_qspi_apb.c
> +++ b/drivers/spi/cadence_qspi_apb.c
> @@ -47,6 +47,7 @@
>  #define CQSPI_INST_TYPE_QUAD 2
>
>  #define CQSPI_STIG_DATA_LEN_MAX  8
> +#define CQSPI_INDIRECTTRIGGER_ADDR_MASK  0xF
>
>  #define CQSPI_DUMMY_CLKS_PER_BYTE8
>  #define CQSPI_DUMMY_BYTES_MAX4
> @@ -560,7 +561,7 @@ int cadence_qspi_apb_indirect_read_setup(struct
cadence_spi_platdata *plat,
>   addr_bytes = cmdlen - 1;
>
>   /* Setup the indirect trigger address */
> - writel((u32)plat->ahbbase,
> + writel(((u32)plat->ahbbase & CQSPI_INDIRECTTRIGGER_ADDR_MASK),
>  plat->regbase + CQSPI_REG_INDIRECTTRIGGER);
>
>   /* Configure the opcode */
> @@ -710,7 +711,7 @@ int cadence_qspi_apb_indirect_write_setup(struct
cadence_spi_platdata *plat,
>   return -EINVAL;
>   }
>   /* Setup the indirect trigger address */
> - writel((u32)plat->ahbbase,
> + writel(((u32)plat->ahbbase & CQSPI_INDIRECTTRIGGER_ADDR_MASK),
>  plat->regbase + CQSPI_REG_INDIRECTTRIGGER);
>
>   /* Configure the opcode */
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [GIT PULL] u-boot-uniphier/master

2017-12-04 Thread Masahiro Yamada
Hi Tom,

Please pull a little more NAND and UniPhier updates.



The following changes since commit 02907004294d981fff9a7305ad9c6d8a0138f205:

  Merge git://git.denx.de/u-boot-rockchip (2017-12-01 19:08:30 -0500)

are available in the git repository at:

  git://git.dex.de/u-boot-uniphier.git master

for you to fetch changes up to 0faef2eba946a95f9c78d2b3db47e15bac04b52e:

  mtd: nand: denali: consolidate include directives (2017-12-04 22:00:03 +0900)


Masahiro Yamada (7):
  ARM: uniphier: clean up board_init
  mtd: nand: denali: remove bogus __maybe_unused
  mtd: nand: denali: remove ad-hoc board_nand_init() entry
  mtd: nand: Rename nand.h into rawnand.h
  mtd: nand: include  from include/linux/mtd/rawnand.h
  mtd: nand: denali_dt: replace printf() with pr_err()
  mtd: nand: denali: consolidate include directives

 arch/arm/include/asm/ti-common/davinci_nand.h   |  2 +-
 arch/arm/mach-omap2/omap3/spl_id_nand.c |  2 +-
 arch/arm/mach-uniphier/board_init.c |  7 ++
 board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c |  2 +-
 board/isee/igep00x0/common.c|  2 +-
 board/isee/igep00x0/igep00x0.c  |  2 +-
 board/isee/igep00x0/spl.c   |  2 +-
 board/logicpd/omap3som/omap3logic.c |  2 +-
 board/mini-box/picosam9g45/picosam9g45.c|  2 +-
 board/overo/overo.c |  2 +-
 board/siemens/taurus/taurus.c   |  2 +-
 board/ti/beagle/beagle.c|  2 +-
 board/ti/evm/evm.c  |  2 +-
 cmd/jffs2.c |  2 +-
 cmd/mtdparts.c  |  2 +-
 drivers/mtd/nand/arasan_nfc.c   |  2 +-
 drivers/mtd/nand/denali.c   | 34
-
 drivers/mtd/nand/denali.h   |  2 +-
 drivers/mtd/nand/denali_dt.c|  4 ++--
 drivers/mtd/nand/denali_spl.c   |  2 +-
 drivers/mtd/nand/fsl_elbc_nand.c|  2 +-
 drivers/mtd/nand/fsl_ifc_nand.c |  2 +-
 drivers/mtd/nand/fsl_ifc_spl.c  |  2 +-
 drivers/mtd/nand/mxs_nand.c |  2 +-
 drivers/mtd/nand/nand_base.c|  2 +-
 drivers/mtd/nand/nand_bbt.c |  2 +-
 drivers/mtd/nand/nand_bch.c |  2 +-
 drivers/mtd/nand/nand_ids.c |  2 +-
 drivers/mtd/nand/nand_timings.c |  2 +-
 drivers/mtd/nand/pxa3xx_nand.c  |  2 +-
 drivers/mtd/nand/sunxi_nand.c   |  2 +-
 drivers/mtd/nand/vf610_nfc.c|  2 +-
 drivers/mtd/nand/zynq_nand.c|  2 +-
 fs/yaffs2/yaffs_mtdif.c |  2 +-
 include/linux/mtd/fsl_upm.h |  2 +-
 include/linux/mtd/fsmc_nand.h   |  2 +-
 include/linux/mtd/{nand.h => rawnand.h} | 10 -
 include/nand.h  |  2 +-
 38 files changed, 46 insertions(+), 77 deletions(-)
 rename include/linux/mtd/{nand.h => rawnand.h} (99%)


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


Re: [U-Boot] [PATCH v3 5/6] binman: add ROM image signing for Bay Trail SoC

2017-12-04 Thread Anatolij Gustschin
Hi Bin,

On Mon, 4 Dec 2017 14:30:03 +0800
Bin Meng bmeng...@gmail.com wrote:
...
> > diff --git a/arch/x86/dts/u-boot.dtsi b/arch/x86/dts/u-boot.dtsi
> > index 7e37d4f394..98e2309108 100644
> > --- a/arch/x86/dts/u-boot.dtsi
> > +++ b/arch/x86/dts/u-boot.dtsi
> > @@ -15,6 +15,13 @@
> > sort-by-pos;
> > pad-byte = <0xff>;
> > size = ;
> > +#ifdef CONFIG_BAYTRAIL_SECURE_BOOT  
> 
> This needs to be a generic macro like CONFIG_SECURE_BOOT as this
> affects all x86 rom images.

OK, will fix it.
 
> > +   sign;
> > +#ifdef CONFIG_SYS_SOC  
> 
> I believe CONFIG_SYS_SOC is defined by every board, so no need to do
> #ifdef here.

OK, I can drop it.

...
> > +OEM_PRIV_KEY_FILE_NAME = 'oemkey.pem'
> > +OEM_PUB_KEY_FILE_NAME = 'pub_oemkey.pem'
> > +OEM_PUBKEY_BIN_FILE_NAME = 'pub_oemkey.bin'
> > +OEM_PUBKEY_AND_SIG_FILE_NAME = 'oem_pub_sig.bin'  
> 
> This deserves a comment block on how there files are generated on the host.

OK.

...
> > +# FSP Stage2 size is 0x1f400. For debug FSP it is 0x2f400,
> > +# you must change it here wenn building with debug FSP image!  
> 
> typo: wenn -> when

OK, thanks.

> > +FSP_STAGE_2_SIZE = 0x1f400
> > +FSP_UPD_SIZE = 0xc00
> > +IBB_SIZE = 0x1fc00
> > +MANIFEST_SIZE = 0x400
> > +OEM_BLOCK_MAX_SIZE = 0x190
> > +U_BOOT_ROM_SIZE = 0x80  
> 
> Can this file size be determined from the CONFIG_ROM_SIZE?
> 
> > +ROMFILE_SYS_TEXT_BASE = 0x0070  
> 
> and calculate this by ourselves?

I cannot invest more time on this, I'm having many issues to add
coverage tests for this file, so I'll give it up. We are far beyond
the planned efforts for this topic and I cannot spend time to polish
this further, sorry.

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


Re: [U-Boot] [PATCH 2/3] efi_loader: correctly setup device paths for block devices

2017-12-04 Thread Mark Kettenis

xypron.g...@gmx.de schreef op 2017-12-03 22:20:

On Sunday, December 3, 2017 8:24:39 PM CET Mark Kettenis wrote:

Heinrich Schuchardt schreef op 2017-12-02 13:42:
> For each block device we have to setup:
> - a device path for the block device
> - a partition device path for the block device with
>
>   partition number 0

Do x86 UEFI implementations actually generate these partition number 0
paths?


Thanks for reviewing.

I do not have access the an x86 computer with UEFI firmware.
Maybe somebody else on the list has.

Another reference point is EDK2.

Part of the relevant coding is in function 
PartitionInstallMbrChildHandles(),

MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c:47.

Another part is in PartitionInstallChildHandle(),
MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c.

I could not identify any line referring to partition 0.

The standard says that 0 can be used in tis fashion but doesn't seem 
to

prescribe their use.


A partition number of  zero can be used to represent the raw hard 
drive

or a raw extended partition.

Do you think we should not generate this entry?


I think it would be better to not generate this entry if other UEFI 
implementations don't generate it either.
Your analysis of the EDK2 code suggests that they don't, so U-Boot 
probably shouldn't do this either.


Was going to check whether the EDK2-based firmware on my Overdrive 1000 
provides a partition 0, but I managed
to hang it in the process and I'll have to power-cycle it when I get 
home later today...



> - a partition device path for each partition
>
> Signed-off-by: Heinrich Schuchardt 
> ---
>
>  lib/efi_loader/efi_device_path.c | 11 +++
>  lib/efi_loader/efi_disk.c|  7 +--
>  2 files changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/lib/efi_loader/efi_device_path.c
> b/lib/efi_loader/efi_device_path.c
> index 42fe6e1185..d0d62ff428 100644
> --- a/lib/efi_loader/efi_device_path.c
> +++ b/lib/efi_loader/efi_device_path.c
> @@ -412,15 +412,18 @@ static void *dp_part_fill(void *buf, struct
> blk_desc *desc, int part)
>
>buf = &udp[1];
>
>  #endif
>
> -  if (part == 0) /* the actual disk, not a partition */
> +  if (part == -1) /* the actual disk, not a partition */
>
>return buf;
>
> -  part_get_info(desc, part, &info);
> +  if (part == 0)
> +  part_get_info_whole_disk(desc, &info);
> +  else
> +  part_get_info(desc, part, &info);
>
>if (desc->part_type == PART_TYPE_ISO) {
>
>struct efi_device_path_cdrom_path *cddp = buf;
>
> -  cddp->boot_entry = part - 1;
> +  cddp->boot_entry = part;
>
>cddp->dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE;
>cddp->dp.sub_type = DEVICE_PATH_SUB_TYPE_CDROM_PATH;
>cddp->dp.length = sizeof(*cddp);
>
> @@ -434,7 +437,7 @@ static void *dp_part_fill(void *buf, struct
> blk_desc *desc, int part)
>
>hddp->dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE;
>hddp->dp.sub_type = DEVICE_PATH_SUB_TYPE_HARD_DRIVE_PATH;
>hddp->dp.length = sizeof(*hddp);
>
> -  hddp->partition_number = part - 1;
> +  hddp->partition_number = part;
>
>hddp->partition_start = info.start;
>hddp->partition_end = info.size;
>if (desc->part_type == PART_TYPE_EFI)
>
> diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> index 4e457a841b..19f75aa919 100644
> --- a/lib/efi_loader/efi_disk.c
> +++ b/lib/efi_loader/efi_disk.c
> @@ -274,6 +274,9 @@ static int efi_disk_create_partitions(struct
> blk_desc *desc,
>
>disk_partition_t info;
>int part;
>
> +  /* Add devices for disk */
> +  snprintf(devname, sizeof(devname), "%s", pdevname);
> +  efi_disk_add_dev(devname, if_typename, desc, diskid, info.start, 0);
>
>/* Add devices for each partition */
>for (part = 1; part <= MAX_SEARCH_PARTITIONS; part++) {
>
>if (part_get_info(desc, part, &info))
>
> @@ -315,7 +318,7 @@ int efi_disk_register(void)
>
>/* Add block device for the full device */
>efi_disk_add_dev(dev->name, if_typename, desc,
>
> -   desc->devnum, 0, 0);
> +   desc->devnum, 0, -1);
>
>disks++;
>
> @@ -351,7 +354,7 @@ int efi_disk_register(void)
>
> if_typename, i);
>
>/* Add block device for the full device */
>
> -  efi_disk_add_dev(devname, if_typename, desc, i, 0, 0);
> +  efi_disk_add_dev(devname, if_typename, desc, i, 0, -1);
>
>disks++;
>
>/* Partitions show up as block devices in EFI */

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


Re: [U-Boot] [RFC PATCH] test: py: Disable sleep test for qemu targets

2017-12-04 Thread Michal Simek
On 1.12.2017 23:44, Tom Rini wrote:
> On Fri, Dec 01, 2017 at 10:07:54AM -0700, Stephen Warren wrote:
>> On 12/01/2017 08:19 AM, Michal Simek wrote:
>>> Hi,
>>>
>>> On 1.12.2017 16:06, Heinrich Schuchardt wrote:


 On 12/01/2017 03:46 PM, Michal Simek wrote:
> Qemu for arm32/arm64 has a problem with time setup.

 Wouldn't it be preferable to fix the root cause?
>>>
>>> Definitely that would be the best and IIRC I have tried to convince our
>>> qemu guy to do that but they have never done that.
>>
>> What is the exact failure condition? Is it simply that the test is still
>> slightly too strict about which delays it accepts, or is sleep outright
>> broken?
>>
>> You can use command-line option -k to avoid some tests. For example "-k not
>> sleep". That way, we don't have to hard-code the dependency into the test
>> source. Depending on the root cause (issue in U-Boot, or issue in just your
>> local version of qemu, or something that will never work) this might be
>> better?
> 
> Even with the most recent relaxing of the sleep test requirements, I can
> still (depending on overall system load) have 'sleep' take too long, on
> QEMU.  I think it might have been half a second slow, but I don't have
> the log handy anymore.  Both locally and in travis we -k not sleep all
> of the qemu instances.

ok. By locally do you mean just using -k not sleep?
Or is there any other way how to put this to
uboot-test-hooks/py//*.py

We are talking about one test here but there could be different issues
with different tests in connection to qemu.

Thanks,
Michal



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


Re: [U-Boot] [RFC PATCH] test: py: Disable sleep test for qemu targets

2017-12-04 Thread Tom Rini
On Mon, Dec 04, 2017 at 02:55:45PM +0100, Michal Simek wrote:
> On 1.12.2017 23:44, Tom Rini wrote:
> > On Fri, Dec 01, 2017 at 10:07:54AM -0700, Stephen Warren wrote:
> >> On 12/01/2017 08:19 AM, Michal Simek wrote:
> >>> Hi,
> >>>
> >>> On 1.12.2017 16:06, Heinrich Schuchardt wrote:
> 
> 
>  On 12/01/2017 03:46 PM, Michal Simek wrote:
> > Qemu for arm32/arm64 has a problem with time setup.
> 
>  Wouldn't it be preferable to fix the root cause?
> >>>
> >>> Definitely that would be the best and IIRC I have tried to convince our
> >>> qemu guy to do that but they have never done that.
> >>
> >> What is the exact failure condition? Is it simply that the test is still
> >> slightly too strict about which delays it accepts, or is sleep outright
> >> broken?
> >>
> >> You can use command-line option -k to avoid some tests. For example "-k not
> >> sleep". That way, we don't have to hard-code the dependency into the test
> >> source. Depending on the root cause (issue in U-Boot, or issue in just your
> >> local version of qemu, or something that will never work) this might be
> >> better?
> > 
> > Even with the most recent relaxing of the sleep test requirements, I can
> > still (depending on overall system load) have 'sleep' take too long, on
> > QEMU.  I think it might have been half a second slow, but I don't have
> > the log handy anymore.  Both locally and in travis we -k not sleep all
> > of the qemu instances.
> 
> ok. By locally do you mean just using -k not sleep?

Yes, I have that in my CI scripts and similar.

-- 
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] ARM: zynq: Fix SPL SD boot mode

2017-12-04 Thread Michal Simek
Hi,

On 1.12.2017 18:30, Gerald Van Baren wrote:
> Hi Michal,
> 
> On Fri, Dec 1, 2017 at 8:13 AM, Michal Simek 
> wrote:
> 
>> This patch is fixing two issues:
>> 1. Insufficient stack size for fat fs buffers
>> 2. Insufficient space in malloc area
>>
>> Tested on zc702 and zc706.
>>
>> Signed-off-by: Michal Simek 
>>
> 
> What are the symptoms of this bug?
> 
> I am running on a custom board and have been bedeviled by the behavior
> where I can boot off a SD Card with the SPL loading U-Boot also off the SD
> Card for many new build / copy to SD Card / boot iterations and then it
> stops with an error message that the SD Card did not respond to the voltage
> select command. Adding debugging printouts indicate the SD Card does not
> respond to commands right at the start of the capabilities read operations
> for no apparent reason.
> 
> Once it fails for a given image, it always fails for that SD Card until I
> load a new image... then it might work or might not. Sometimes if I
> reformat the SD Card it works again (presumably due to shifting where the
> images are on the SD Card), sometimes not.
> 
> This has been driving me CRAZY.
> 
> I've applied your changes and will see if my problem goes away, but it is a
> "halting problem" in that I don't know how many time it has to succeed
> before I'm sure it will never fail. :-/

There were a lot of changes in fat implementation.
Ad 2) of that issue was that one patch moved buffers to malloc area from
stack

Here is sha1: 2460098cffacd18729262e3ed36656e6943783ed

Also look at:
"arm64: zynqmp: Do not use SPL_SYS_MALLOC_SIMPLE allocator"

This is the log I am getting.

U-Boot SPL 2017.11-00056-gb06c46de632c-dirty (Dec 04 2017 - 15:04:05)
mmc boot
Trying to boot from MMC1
spl_load_image_fat_os: error reading image system.dtb, err - -12
spl_load_image_fat: error reading image u-boot.img, err - -12
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

And the ad 1) issue I found was that if you debug
ALLOC_CACHE_ALIGN_BUFFER() size then you will find out that this buffer
allocated on the stack is quite huge.

It should be maybe enough just to extend Malloc space and don't care
about stack but moving stack to DDR after init makes also sense.
If you want I am happy to separate it.

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


Re: [U-Boot] [RFC PATCH] test: py: Disable sleep test for qemu targets

2017-12-04 Thread Michal Simek
On 4.12.2017 15:03, Tom Rini wrote:
> On Mon, Dec 04, 2017 at 02:55:45PM +0100, Michal Simek wrote:
>> On 1.12.2017 23:44, Tom Rini wrote:
>>> On Fri, Dec 01, 2017 at 10:07:54AM -0700, Stephen Warren wrote:
 On 12/01/2017 08:19 AM, Michal Simek wrote:
> Hi,
>
> On 1.12.2017 16:06, Heinrich Schuchardt wrote:
>>
>>
>> On 12/01/2017 03:46 PM, Michal Simek wrote:
>>> Qemu for arm32/arm64 has a problem with time setup.
>>
>> Wouldn't it be preferable to fix the root cause?
>
> Definitely that would be the best and IIRC I have tried to convince our
> qemu guy to do that but they have never done that.

 What is the exact failure condition? Is it simply that the test is still
 slightly too strict about which delays it accepts, or is sleep outright
 broken?

 You can use command-line option -k to avoid some tests. For example "-k not
 sleep". That way, we don't have to hard-code the dependency into the test
 source. Depending on the root cause (issue in U-Boot, or issue in just your
 local version of qemu, or something that will never work) this might be
 better?
>>>
>>> Even with the most recent relaxing of the sleep test requirements, I can
>>> still (depending on overall system load) have 'sleep' take too long, on
>>> QEMU.  I think it might have been half a second slow, but I don't have
>>> the log handy anymore.  Both locally and in travis we -k not sleep all
>>> of the qemu instances.
>>
>> ok. By locally do you mean just using -k not sleep?
> 
> Yes, I have that in my CI scripts and similar.

Wouldn't be easier to keep this in uboot-test-hooks repo with other
target setting?
What we are trying to do is that our testing group will run these tests
for me that's why it is just easier for me to change local
uboot-test-hooks repo instead of communicate with them what -k not XXX
parameters to add to certain scripts.

It means in loop they will just run all tests on qemu, local targets and
in boardfarm. It is probably not big deal to tell them to add -k not
sleep for all qemu runs but I know that for some i2c testing qemu
doesn't emulate these devices that's why these tests fails. And the
amount of tests which we shouldn't run on qemu will probably grow.

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


Re: [U-Boot] [PATCH] fpga: allow programming fpga from FIT image for all FPGA drivers

2017-12-04 Thread Michal Simek
Hi,

On 2.12.2017 04:29, Simon Glass wrote:
> Hi Michal,
> 
> On 29 November 2017 at 03:00, Michal Simek  wrote:
>> On 29.11.2017 06:20, Goldschmidt Simon wrote:
>>> On 28.11.2017 14:46, Michal Simek wrote:
 On 28.11.2017 10:08, Goldschmidt Simon wrote:
> Simon Goldschmidt wrote:
>> Hi Simon,
>>
>> Simon Glass wrote:
>>> I see that, although it is adding to the fpga header so presumably
>>> making it harder for someone to move this over.
>>
>> Yes, I'm not happy with changing the header and even xilinx C file to
>> add functionality for altera. However, this is due to the fact that a
>> core file still depends on an dogs implementation, which I removed.
>
> This should have meant "on an fpga implementation". No dogs or offences 
> here.
> My mobile phone does not know the word "fpga", obviously.
>
>>
>>> Does anyone on cc know the plan fr conversion of FPGA to driver model?
>>> It does not look too tricky from a quick look at the header file.
>>
>> It does not look tricky, indeed. However, we should try to match this
>> to the Linux implementation regarding what's needed in the device
>> tree. And I just don't know that part, yet ;-)

 I have not a problem to enable others fpgas to use this functionality.
 And transition should be done for all these drivers when someone has a 
 time to do
 it.
>>>
>>> Great, thanks! So via which tree would this be included?
>>
>> Origin code was applied via my tree. It means it shouldn't be an issue
>> to do that again.
>> Anyway I have tested it on zynqmp and this feature is still working
>> without any issue when this patch is applied.
>>
>> sjg: Do you see any other issue with this patch?
> 
> No other issues.

ok. Then applied to my xilinx tree.

Thanks,
Michal

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


Re: [U-Boot] [PULL] efi patch queue 2017-12-04

2017-12-04 Thread Tom Rini
On Mon, Dec 04, 2017 at 12:08:30AM +0100, Alexander Graf wrote:

> Hi Tom,
> 
> This is my current patch queue for efi.  Please pull.
> 
> Alex
> 
> 
> The following changes since commit 9804d88630cdb22f5f0ace05ac05942928410fd9:
> 
>   Merge branch 'rmobile-mx' of git://git.denx.de/u-boot-sh (2017-11-30 
> 10:39:04 -0500)
> 
> are available in the git repository at:
> 
>   git://github.com/agraf/u-boot.git tags/signed-efi-next
> 
> for you to fetch changes up to 3bb74f9800cdc4cf10a87f2725242c2565256654:
> 
>   efi_loader helloworld.efi: Fix building with -Os (2017-12-01 22:31:00 +0100)
> 

NAK.  New warnings on at least qemu-x86_efi_payload32 qemu-x86_efi_payload64:
/home/trini/work/u-boot/u-boot/lib/efi/efi_stub.c: In function ‘efi_main’:
/home/trini/work/u-boot/u-boot/lib/efi/efi_stub.c:298:29: warning: passing 
argument 1 of ‘boot->get_memory_map’ from incompatible pointer type 
[-Wincompatible-pointer-types]
  ret = boot->get_memory_map(&size, NULL, &key, &desc_size, &version);
 ^
/home/trini/work/u-boot/u-boot/lib/efi/efi_stub.c:298:29: note: expected 
‘size_t * {aka unsigned int *}’ but argument is of type ‘ulong * {aka long 
unsigned int *}’
/home/trini/work/u-boot/u-boot/lib/efi/efi_stub.c:298:42: warning: passing 
argument 3 of ‘boot->get_memory_map’ from incompatible pointer type 
[-Wincompatible-pointer-types]
  ret = boot->get_memory_map(&size, NULL, &key, &desc_size, &version);
  ^
/home/trini/work/u-boot/u-boot/lib/efi/efi_stub.c:298:42: note: expected 
‘size_t * {aka unsigned int *}’ but argument is of type ‘ulong * {aka long 
unsigned int *}’
/home/trini/work/u-boot/u-boot/lib/efi/efi_stub.c:298:48: warning: passing 
argument 4 of ‘boot->get_memory_map’ from incompatible pointer type 
[-Wincompatible-pointer-types]
  ret = boot->get_memory_map(&size, NULL, &key, &desc_size, &version);
^
/home/trini/work/u-boot/u-boot/lib/efi/efi_stub.c:298:48: note: expected 
‘size_t * {aka unsigned int *}’ but argument is of type ‘ulong * {aka long 
unsigned int *}’
/home/trini/work/u-boot/u-boot/lib/efi/efi_stub.c:316:29: warning: passing 
argument 1 of ‘boot->get_memory_map’ from incompatible pointer type 
[-Wincompatible-pointer-types]
  ret = boot->get_memory_map(&size, desc, &key, &desc_size, &version);
 ^
/home/trini/work/u-boot/u-boot/lib/efi/efi_stub.c:316:29: note: expected 
‘size_t * {aka unsigned int *}’ but argument is of type ‘ulong * {aka long 
unsigned int *}’
/home/trini/work/u-boot/u-boot/lib/efi/efi_stub.c:316:42: warning: passing 
argument 3 of ‘boot->get_memory_map’ from incompatible pointer type 
[-Wincompatible-pointer-types]
  ret = boot->get_memory_map(&size, desc, &key, &desc_size, &version);
  ^
/home/trini/work/u-boot/u-boot/lib/efi/efi_stub.c:316:42: note: expected 
‘size_t * {aka unsigned int *}’ but argument is of type ‘ulong * {aka long 
unsigned int *}’
/home/trini/work/u-boot/u-boot/lib/efi/efi_stub.c:316:48: warning: passing 
argument 4 of ‘boot->get_memory_map’ from incompatible pointer type 
[-Wincompatible-pointer-types]
  ret = boot->get_memory_map(&size, desc, &key, &desc_size, &version);
^
/home/trini/work/u-boot/u-boot/lib/efi/efi_stub.c:316:48: note: expected 
‘size_t * {aka unsigned int *}’ but argument is of type ‘ulong * {aka long 
unsigned int *}’
/home/trini/work/u-boot/u-boot/lib/efi/efi_stub.c:334:30: warning: passing 
argument 1 of ‘boot->get_memory_map’ from incompatible pointer type 
[-Wincompatible-pointer-types]
   ret = boot->get_memory_map(&size, desc, &key, &desc_size,
  ^
/home/trini/work/u-boot/u-boot/lib/efi/efi_stub.c:334:30: note: expected 
‘size_t * {aka unsigned int *}’ but argument is of type ‘ulong * {aka long 
unsigned int *}’
/home/trini/work/u-boot/u-boot/lib/efi/efi_stub.c:334:43: warning: passing 
argument 3 of ‘boot->get_memory_map’ from incompatible pointer type 
[-Wincompatible-pointer-types]
   ret = boot->get_memory_map(&size, desc, &key, &desc_size,
   ^
/home/trini/work/u-boot/u-boot/lib/efi/efi_stub.c:334:43: note: expected 
‘size_t * {aka unsigned int *}’ but argument is of type ‘ulong * {aka long 
unsigned int *}’
/home/trini/work/u-boot/u-boot/lib/efi/efi_stub.c:334:49: warning: passing 
argument 4 of ‘boot->get_memory_map’ from incompatible pointer type 
[-Wincompatible-pointer-types]
   ret = boot->get_memory_map(&size, desc, &key, &desc_size,
 ^
/home/trini/work/u-boot/u-boot/lib/efi/efi_stub.c:334:49: note: expected 
‘size_t * {aka unsigned int *}’ but argument is of type ‘ulong * {aka long 
unsigned int *}’

-- 
Tom


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

Re: [U-Boot] [U-Boot, PATCHv4] env: enable accessing the environment in an EXT4 partition

2017-12-04 Thread Tom Rini
On Mon, Nov 27, 2017 at 08:19:20PM +0100, Jorge Ramirez-Ortiz wrote:

> For example to store the environment in a file named "/uboot.env" in MMC
> "0", where partition "1" contains the EXT4 filesystem, the following
> configs should be added to the board's default config:
> 
>   CONFIG_ENV_IS_IN_EXT4=y
>   CONFIG_ENV_EXT4_DEVICE_AND_PART="0:1"
>   CONFIG_ENV_EXT4_FILE="/uboot.env"
>   CONFIG_ENV_EXT4_INTERFACE="mmc"
> Reviewed-by: Tom Rini 

The code is fine, but you forgot a Signed-off-by line, so NAK without
one, sorry!

-- 
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] [RFC PATCH] test: py: Disable sleep test for qemu targets

2017-12-04 Thread Tom Rini
On Mon, Dec 04, 2017 at 03:21:04PM +0100, Michal Simek wrote:
> On 4.12.2017 15:03, Tom Rini wrote:
> > On Mon, Dec 04, 2017 at 02:55:45PM +0100, Michal Simek wrote:
> >> On 1.12.2017 23:44, Tom Rini wrote:
> >>> On Fri, Dec 01, 2017 at 10:07:54AM -0700, Stephen Warren wrote:
>  On 12/01/2017 08:19 AM, Michal Simek wrote:
> > Hi,
> >
> > On 1.12.2017 16:06, Heinrich Schuchardt wrote:
> >>
> >>
> >> On 12/01/2017 03:46 PM, Michal Simek wrote:
> >>> Qemu for arm32/arm64 has a problem with time setup.
> >>
> >> Wouldn't it be preferable to fix the root cause?
> >
> > Definitely that would be the best and IIRC I have tried to convince our
> > qemu guy to do that but they have never done that.
> 
>  What is the exact failure condition? Is it simply that the test is still
>  slightly too strict about which delays it accepts, or is sleep outright
>  broken?
> 
>  You can use command-line option -k to avoid some tests. For example "-k 
>  not
>  sleep". That way, we don't have to hard-code the dependency into the test
>  source. Depending on the root cause (issue in U-Boot, or issue in just 
>  your
>  local version of qemu, or something that will never work) this might be
>  better?
> >>>
> >>> Even with the most recent relaxing of the sleep test requirements, I can
> >>> still (depending on overall system load) have 'sleep' take too long, on
> >>> QEMU.  I think it might have been half a second slow, but I don't have
> >>> the log handy anymore.  Both locally and in travis we -k not sleep all
> >>> of the qemu instances.
> >>
> >> ok. By locally do you mean just using -k not sleep?
> > 
> > Yes, I have that in my CI scripts and similar.
> 
> Wouldn't be easier to keep this in uboot-test-hooks repo with other
> target setting?

Or do as you did did and mark the tests as not allowed for qemu, yes.

> What we are trying to do is that our testing group will run these tests
> for me that's why it is just easier for me to change local
> uboot-test-hooks repo instead of communicate with them what -k not XXX
> parameters to add to certain scripts.
> 
> It means in loop they will just run all tests on qemu, local targets and
> in boardfarm. It is probably not big deal to tell them to add -k not
> sleep for all qemu runs but I know that for some i2c testing qemu
> doesn't emulate these devices that's why these tests fails. And the
> amount of tests which we shouldn't run on qemu will probably grow.

Well, I'm still open to possibly tweaking the allowed variance in the
sleep test.  OTOH, if we just say "no QEMU" here, we can then go back to
"sleep should be pretty darn accurate on HW" for the test too, and
perhaps that's best.

-- 
Tom


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


[U-Boot] [PATCH] efi_stub: Fix GDT_NOTSYS check

2017-12-04 Thread Alexander Graf
The get_codeseg32() wants to know if a passed in descriptor has
flag GDT_NOTSYS set (desc & GDT_NOTSYS), not whether desc and
GDT_NOTSYS are not != 0 (desk && GDT_NOTSYS).

This is an obvious typo. Fix it up.

Signed-off-by: Alexander Graf 
---
 lib/efi/efi_stub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/efi/efi_stub.c b/lib/efi/efi_stub.c
index 1814960572..9788dedba7 100644
--- a/lib/efi/efi_stub.c
+++ b/lib/efi/efi_stub.c
@@ -182,7 +182,7 @@ static int get_codeseg32(void)
<< 16;
base <<= 12;/* 4KB granularity */
limit <<= 12;
-   if ((desc & GDT_PRESENT) && (desc && GDT_NOTSYS) &&
+   if ((desc & GDT_PRESENT) && (desc & GDT_NOTSYS) &&
!(desc & GDT_LONG) && (desc & GDT_4KB) &&
(desc & GDT_32BIT) && (desc & GDT_CODE) &&
CONFIG_SYS_TEXT_BASE > base &&
-- 
2.12.3

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


[U-Boot] [PATCH] efi_stub: Use efi_uintn_t

2017-12-04 Thread Alexander Graf
Commit f5a2a93892f ("efi_loader: consistently use efi_uintn_t in boot
services") changed the internal EFI API header without adapting its existing
EFI stub users. Let's adapt the EFI stub as well.

Fixes: f5a2a93892f ("efi_loader: consistently use efi_uintn_t in boot services")
Signed-off-by: Alexander Graf 
---
 lib/efi/efi_stub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/efi/efi_stub.c b/lib/efi/efi_stub.c
index 9788dedba7..205aa19947 100644
--- a/lib/efi/efi_stub.c
+++ b/lib/efi/efi_stub.c
@@ -277,7 +277,7 @@ efi_status_t efi_main(efi_handle_t image, struct 
efi_system_table *sys_table)
struct efi_boot_services *boot = sys_table->boottime;
struct efi_mem_desc *desc;
struct efi_entry_memmap map;
-   ulong key, desc_size, size;
+   efi_uintn_t key, desc_size, size;
efi_status_t ret;
u32 version;
int cs32;
-- 
2.12.3

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


[U-Boot] [PATCH] tools: omapimage: fix corner-case in byteswap path

2017-12-04 Thread Philipp Tomsich
Since commit 2614a208471e ("common: command: tempory buffer should
have size of command line buf"), there have been consistent Travis CI
failures on my builds (interestingly not for Tom, even though building
the same commit id) due to a SEGV in building the byteswapped
omapimage:
arm: pcm051_rev3
 make[2]: *** [MLO.byteswap] Error 139
   ^^^ error code for a SEGV

Turns out that the word-based byte-swapping loop in omapimage.c is to
blame. With the loop condition
   while (swapped <= (sbuf->st_size / sizeof(uint32_t)))
there had been one-too-many iterations for all file sizes divisible by
the sizeof(uint32_t).  I.e. we had 1 iteration for 0 bytes (and also 1
through 3 bytes) and 2 iterations at 4 bytes... clearly overshooting
on 0 and 4 bytes.

This commit fixes the calculation of an up-rounded word-count and
makes sure to keep the zero-based loop-counter below the number of
words to be processed.

References: 2614a20 ("common: command: tempory buffer should have size of 
command line buf")
Fixes: 79b9ebb ("omapimage: Add support for byteswapped SPI images")
Signed-off-by: Philipp Tomsich 
Reviewed-by: Martin Elshuber 

---

 tools/omapimage.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/omapimage.c b/tools/omapimage.c
index e31b94a..e7c4638 100644
--- a/tools/omapimage.c
+++ b/tools/omapimage.c
@@ -20,6 +20,8 @@
 #include "gpheader.h"
 #include "omapimage.h"
 
+#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
+
 /* Header size is CH header rounded up to 512 bytes plus GP header */
 #define OMAP_CH_HDR_SIZE 512
 #define OMAP_FILE_HDR_SIZE (OMAP_CH_HDR_SIZE + GPIMAGE_HDR_SIZE)
@@ -150,8 +152,10 @@ static void omapimage_set_header(void *ptr, struct stat 
*sbuf, int ifd,
do_swap32 = 1;
int swapped = 0;
uint32_t *data = (uint32_t *)ptr;
+   const off_t size_in_words =
+   DIV_ROUND_UP(sbuf->st_size, sizeof(uint32_t));
 
-   while (swapped <= (sbuf->st_size / sizeof(uint32_t))) {
+   while (swapped < size_in_words) {
*data = cpu_to_be32(*data);
swapped++;
data++;
-- 
2.1.4

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


Re: [U-Boot] arm socfpga: Revert "spi: cadence_qspi_apb: Support 32 bit AHB address"

2017-12-04 Thread Vignesh R
Hi,

On 04-Dec-17 6:41 PM, Frank Mori Hess wrote:
> Since your commit broke my platform to fix yours, shouldn't it be
> reverted and TI platforms use your pending patch queue?
> 

Socfpga DT defined ahb base as 0xffa0 while masked upper bits in the
code, which was confusing. And seems that my patch did work on some
socfgpa board looking at the original commit message.
If the patch is reverted then, applying pending patches alone will not
help because my patch would be needed anyway to make sure we don't mask
31-20 bits on TI platforms.
Therefore instead of reverting and the re-applying, I would recommend to
ping SPI maintainer to get http://patchwork.ozlabs.org/patch/838589/
merged as early as possible.

> On Dec 3, 2017 23:14, "Vignesh R"  > wrote:
> 
> 
> 
> On Sunday 03 December 2017 09:29 PM, Frank Mori Hess wrote:
> > This reverts commit dac3bf20fb2c9b03476be0d73db620f62ab3cee1.
> >
> > My u-boot spl crashes in a loop when I boot off a
> > cadence qspi flash.  I narrowed it down to the changes from commit
> > dac3bf20fb2c9b03476be0d73db620f62ab3cee1 which removes
> > CQSPI_INDIRECTTRIGGER_ADDR_MASK.  Restoring the mask allows the spl to
> > successfully load the main u-boot.  My board is an Altera HPS cyclone
> > V socfpga.  It has an ahb base address of 0xffa0 and for some
> > reason, without the CQSPI_INDIRECTTRIGGER_ADDR_MASK the board reboots
> > when cadence_qspi_apb_indirect_read_execute tries to read from the ahb
> > base address.  I'm was using version 2016.11 of u-boot.
> 
> This breaks TI platforms where INDIRECTTRIGGER_ADDR is 32bit wide.
> Instead please try this patch series which adds cdns,trigger-address DT
> property: http://patchwork.ozlabs.org/patch/838589/
> 
> 
> Regards
> Vignesh
> 
> >
> > Signed-off-by: Frank Mori Hess  >
> > ---
> >  drivers/spi/cadence_qspi_apb.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/spi/cadence_qspi_apb.c
> b/drivers/spi/cadence_qspi_apb.c
> > index e02f2217f4..b300f36607 100644
> > --- a/drivers/spi/cadence_qspi_apb.c
> > +++ b/drivers/spi/cadence_qspi_apb.c
> > @@ -47,6 +47,7 @@
> >  #define CQSPI_INST_TYPE_QUAD                 2
> >
> >  #define CQSPI_STIG_DATA_LEN_MAX                      8
> > +#define CQSPI_INDIRECTTRIGGER_ADDR_MASK              0xF
> >
> >  #define CQSPI_DUMMY_CLKS_PER_BYTE            8
> >  #define CQSPI_DUMMY_BYTES_MAX                        4
> > @@ -560,7 +561,7 @@ int
> cadence_qspi_apb_indirect_read_setup(struct cadence_spi_platdata *plat,
> >               addr_bytes = cmdlen - 1;
> >
> >       /* Setup the indirect trigger address */
> > -     writel((u32)plat->ahbbase,
> > +     writel(((u32)plat->ahbbase & CQSPI_INDIRECTTRIGGER_ADDR_MASK),
> >              plat->regbase + CQSPI_REG_INDIRECTTRIGGER);
> >
> >       /* Configure the opcode */
> > @@ -710,7 +711,7 @@ int
> cadence_qspi_apb_indirect_write_setup(struct cadence_spi_platdata *plat,
> >               return -EINVAL;
> >       }
> >       /* Setup the indirect trigger address */
> > -     writel((u32)plat->ahbbase,
> > +     writel(((u32)plat->ahbbase & CQSPI_INDIRECTTRIGGER_ADDR_MASK),
> >              plat->regbase + CQSPI_REG_INDIRECTTRIGGER);
> >
> >       /* Configure the opcode */
> >
> 
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] armv8: layerscape: refine port register configuration

2017-12-04 Thread York Sun
On 12/04/2017 01:31 AM, Yuantian Tang wrote:
> These PP2C and PP3C registers control the configuration of the PHY
> control OOB timing for the COMINIT/COMWAKE parameters respectively
> for sata port. Overwrite default values with calculated ones to get
> better OOB timing.
> 
> Signed-off-by: Tang Yuantian 
> ---
>  arch/arm/cpu/armv8/fsl-layerscape/soc.c| 6 ++
>  arch/arm/include/asm/arch-fsl-layerscape/soc.h | 2 ++
>  2 files changed, 8 insertions(+)

Andy,

Maybe it was obvious to you, but I couldn't understand why and what you
are changing, except you overwrite two registers.

By the way, you may want to add SATA (in upper case) in the subject.

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


Re: [U-Boot] [PATCH v2 1/5] Move CONFIG_PANIC_HANG to Kconfig

2017-12-04 Thread York Sun
On 12/03/2017 07:39 PM, Masahiro Yamada wrote:
> Freescale (NXP) boards have lots of defconfig files per board.
> I used "imply PANIC_HANG" for them.
> 
> Signed-off-by: Masahiro Yamada 
> ---
> 
> Changes in v2:
>   - Re-run tools/moveconfig.py based on commit 02907004294d9

Freescape/NXP has multiple configuration for each board, and sometimes
multiple boards for each SoC. I am not objecting "imply PANIC_HANG" for
all of them.

Reviewed-by: York Sun 

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


Re: [U-Boot] arm socfpga: Revert "spi: cadence_qspi_apb: Support 32 bit AHB address"

2017-12-04 Thread Frank Mori Hess
On Mon, Dec 4, 2017 at 11:41 AM, Vignesh R  wrote:
> Hi,
>
> On 04-Dec-17 6:41 PM, Frank Mori Hess wrote:
>> Since your commit broke my platform to fix yours, shouldn't it be
>> reverted and TI platforms use your pending patch queue?
>>
>
> Socfpga DT defined ahb base as 0xffa0 while masked upper bits in the
> code, which was confusing. And seems that my patch did work on some
> socfgpa board looking at the original commit message.

There is nothing in the original commit message that suggests it
worked on any socfpga board, unless you mean

"Since AHB address is passed from DT
   and read as u32 value, it anyway does not make sense to mask upper bits."

which is simply wrong.

> If the patch is reverted then, applying pending patches alone will not
> help because my patch would be needed anyway to make sure we don't mask
> 31-20 bits on TI platforms.

No it won't needed, see http://patchwork.ozlabs.org/patch/838592/ that
patch series writes plat->trigger_address instead of ahbbase (masked
or not).
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/3] efi_loader: return status from efi_setup_loaded_image()

2017-12-04 Thread Heinrich Schuchardt
efi_setup_loaded_image() should return an error code indicating if
an error has occurred.

An error occurs if a protocol cannot be installed.

Signed-off-by: Heinrich Schuchardt 
---
 include/efi_loader.h  |  8 +---
 lib/efi_loader/efi_boottime.c | 11 +++
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index c0caabddb1..78237f14ae 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -249,9 +249,11 @@ uint64_t efi_add_memory_map(uint64_t start, uint64_t 
pages, int memory_type,
 int efi_memory_init(void);
 /* Adds new or overrides configuration table entry to the system table */
 efi_status_t efi_install_configuration_table(const efi_guid_t *guid, void 
*table);
-void efi_setup_loaded_image(struct efi_loaded_image *info, struct efi_object 
*obj,
-   struct efi_device_path *device_path,
-   struct efi_device_path *file_path);
+/* Sets up a loaded image */
+efi_status_t efi_setup_loaded_image(
+   struct efi_loaded_image *info, struct efi_object *obj,
+   struct efi_device_path *device_path,
+   struct efi_device_path *file_path);
 efi_status_t efi_load_image_from_path(struct efi_device_path *file_path,
  void **buffer);
 
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index a37fb25638..a9ba1ac394 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -1170,10 +1170,12 @@ static efi_status_t EFIAPI 
efi_install_configuration_table_ext(efi_guid_t *guid,
  * @objinternal object associated with the loaded image
  * @device_pathdevice path of the loaded image
  * @file_path  file path of the loaded image
+ * @return status code
  */
-void efi_setup_loaded_image(struct efi_loaded_image *info, struct efi_object 
*obj,
-   struct efi_device_path *device_path,
-   struct efi_device_path *file_path)
+efi_status_t efi_setup_loaded_image(
+   struct efi_loaded_image *info, struct efi_object *obj,
+   struct efi_device_path *device_path,
+   struct efi_device_path *file_path)
 {
efi_status_t ret;
 
@@ -1213,9 +1215,10 @@ void efi_setup_loaded_image(struct efi_loaded_image 
*info, struct efi_object *ob
if (ret != EFI_SUCCESS)
goto failure;
 
-   return;
+   return ret;
 failure:
printf("ERROR: Failure to install protocols for loaded image\n");
+   return ret;
 }
 
 /*
-- 
2.14.2

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


[U-Boot] [PATCH 2/3] efi_loader: new function efi_delete_handle()

2017-12-04 Thread Heinrich Schuchardt
Provide a function to remove a handle from the object list
after removing all protocols.

To avoid forward declarations other functions have to move up
in the coding.

Signed-off-by: Heinrich Schuchardt 
---
 include/efi_loader.h  |   2 +
 lib/efi_loader/efi_boottime.c | 186 +++---
 2 files changed, 102 insertions(+), 86 deletions(-)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index 78237f14ae..6185055e78 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -190,6 +190,8 @@ void efi_set_bootdev(const char *dev, const char *devnr, 
const char *path);
 void efi_add_handle(struct efi_object *obj);
 /* Create handle */
 efi_status_t efi_create_handle(void **handle);
+/* Delete handle */
+void efi_delete_handle(struct efi_object *obj);
 /* Call this to validate a handle and find the EFI object for it */
 struct efi_object *efi_search_obj(const void *handle);
 /* Find a protocol on a handle */
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index a9ba1ac394..7c8f3134d1 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -359,6 +359,106 @@ efi_status_t efi_create_handle(void **handle)
return r;
 }
 
+/*
+ * Find a protocol on a handle.
+ *
+ * @handle handle
+ * @protocol_guid  GUID of the protocol
+ * @handlerreference to the protocol
+ * @return status code
+ */
+efi_status_t efi_search_protocol(const void *handle,
+const efi_guid_t *protocol_guid,
+struct efi_handler **handler)
+{
+   struct efi_object *efiobj;
+   struct list_head *lhandle;
+
+   if (!handle || !protocol_guid)
+   return EFI_INVALID_PARAMETER;
+   efiobj = efi_search_obj(handle);
+   if (!efiobj)
+   return EFI_INVALID_PARAMETER;
+   list_for_each(lhandle, &efiobj->protocols) {
+   struct efi_handler *protocol;
+
+   protocol = list_entry(lhandle, struct efi_handler, link);
+   if (!guidcmp(protocol->guid, protocol_guid)) {
+   if (handler)
+   *handler = protocol;
+   return EFI_SUCCESS;
+   }
+   }
+   return EFI_NOT_FOUND;
+}
+
+/*
+ * Delete protocol from a handle.
+ *
+ * @handle handle from which the protocol shall be deleted
+ * @protocol   GUID of the protocol to be deleted
+ * @protocol_interface interface of the protocol implementation
+ * @return status code
+ */
+efi_status_t efi_remove_protocol(const void *handle, const efi_guid_t 
*protocol,
+void *protocol_interface)
+{
+   struct efi_handler *handler;
+   efi_status_t ret;
+
+   ret = efi_search_protocol(handle, protocol, &handler);
+   if (ret != EFI_SUCCESS)
+   return ret;
+   if (guidcmp(handler->guid, protocol))
+   return EFI_INVALID_PARAMETER;
+   list_del(&handler->link);
+   free(handler);
+   return EFI_SUCCESS;
+}
+
+/*
+ * Delete all protocols from a handle.
+ *
+ * @handle handle from which the protocols shall be deleted
+ * @return status code
+ */
+efi_status_t efi_remove_all_protocols(const void *handle)
+{
+   struct efi_object *efiobj;
+   struct list_head *lhandle;
+   struct list_head *pos;
+
+   efiobj = efi_search_obj(handle);
+   if (!efiobj)
+   return EFI_INVALID_PARAMETER;
+   list_for_each_safe(lhandle, pos, &efiobj->protocols) {
+   struct efi_handler *protocol;
+   efi_status_t ret;
+
+   protocol = list_entry(lhandle, struct efi_handler, link);
+
+   ret = efi_remove_protocol(handle, protocol->guid,
+ protocol->protocol_interface);
+   if (ret != EFI_SUCCESS)
+   return ret;
+   }
+   return EFI_SUCCESS;
+}
+
+/*
+ * Delete handle.
+ *
+ * @handle handle to delete
+ */
+void efi_delete_handle(struct efi_object *obj)
+{
+   if (!obj)
+   return;
+   efi_remove_all_protocols(obj->handle);
+   list_del(&obj->link);
+   free(obj);
+}
+
 /*
  * Our event capabilities are very limited. Only a small limited
  * number of events is allowed to coexist.
@@ -717,39 +817,6 @@ struct efi_object *efi_search_obj(const void *handle)
return NULL;
 }
 
-/*
- * Find a protocol on a handle.
- *
- * @handle handle
- * @protocol_guid  GUID of the protocol
- * @handlerreference to the protocol
- * @return status code
- */
-efi_status_t efi_search_protocol(const void *handle,
-const efi_guid_t *protocol_guid,
-struct efi_handler **handler)
-{
-   struct efi_object *efiobj;
-   struct list_head *lhandle

[U-Boot] [PATCH 0/3] efi_loader: avoid use after free

2017-12-04 Thread Heinrich Schuchardt
A use after free may occur if efi_load_image() fails.

Heinrich Schuchardt (3):
  efi_loader: return status from efi_setup_loaded_image()
  efi_loader: new function efi_delete_handle()
  efi_loader: error handling in efi_load_image()

 include/efi_loader.h  |  10 +-
 lib/efi_loader/efi_boottime.c | 228 ++
 2 files changed, 129 insertions(+), 109 deletions(-)

-- 
2.14.2

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


[U-Boot] [PATCH 3/3] efi_loader: error handling in efi_load_image()

2017-12-04 Thread Heinrich Schuchardt
If a failure occurs when trying to load an image, it is insufficient
to free() the EFI object. We must remove it from the object list,
too. Otherwise a use after free will occur the next time we
iterate over the object list.

Furthermore errors in setting up the image should be handled.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_boottime.c | 31 +++
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 7c8f3134d1..b90bd0b426 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -1308,6 +1308,7 @@ static efi_status_t EFIAPI efi_load_image(bool 
boot_policy,
 {
struct efi_loaded_image *info;
struct efi_object *obj;
+   efi_status_t ret;
 
EFI_ENTRY("%d, %p, %p, %p, %ld, %p", boot_policy, parent_image,
  file_path, source_buffer, source_size, image_handle);
@@ -1317,41 +1318,39 @@ static efi_status_t EFIAPI efi_load_image(bool 
boot_policy,
 
if (!source_buffer) {
struct efi_device_path *dp, *fp;
-   efi_status_t ret;
 
ret = efi_load_image_from_path(file_path, &source_buffer);
-   if (ret != EFI_SUCCESS) {
-   free(info);
-   free(obj);
-   return EFI_EXIT(ret);
-   }
-
+   if (ret != EFI_SUCCESS)
+   goto failure;
/*
 * split file_path which contains both the device and
 * file parts:
 */
efi_dp_split_file_path(file_path, &dp, &fp);
-
-   efi_setup_loaded_image(info, obj, dp, fp);
+   ret = efi_setup_loaded_image(info, obj, dp, fp);
+   if (ret != EFI_SUCCESS)
+   goto failure;
} else {
/* In this case, file_path is the "device" path, ie.
 * something like a HARDWARE_DEVICE:MEMORY_MAPPED
 */
-   efi_setup_loaded_image(info, obj, file_path, NULL);
+   ret = efi_setup_loaded_image(info, obj, file_path, NULL);
+   if (ret != EFI_SUCCESS)
+   goto failure;
}
-
info->reserved = efi_load_pe(source_buffer, info);
if (!info->reserved) {
-   free(info);
-   free(obj);
-   return EFI_EXIT(EFI_UNSUPPORTED);
+   ret = EFI_UNSUPPORTED;
+   goto failure;
}
-
info->system_table = &systab;
info->parent_handle = parent_image;
*image_handle = obj->handle;
-
return EFI_EXIT(EFI_SUCCESS);
+failure:
+   free(info);
+   efi_delete_handle(obj);
+   return EFI_EXIT(ret);
 }
 
 /*
-- 
2.14.2

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


Re: [U-Boot] arm socfpga: Revert "spi: cadence_qspi_apb: Support 32 bit AHB address"

2017-12-04 Thread Vignesh R


On 04-Dec-17 10:31 PM, Frank Mori Hess wrote:
> On Mon, Dec 4, 2017 at 11:41 AM, Vignesh R  wrote:
>> Hi,
>>
>> On 04-Dec-17 6:41 PM, Frank Mori Hess wrote:
>>> Since your commit broke my platform to fix yours, shouldn't it be
>>> reverted and TI platforms use your pending patch queue?
>>>
>>
>> Socfpga DT defined ahb base as 0xffa0 while masked upper bits in the
>> code, which was confusing. And seems that my patch did work on some
>> socfgpa board looking at the original commit message.
> 
> There is nothing in the original commit message that suggests it
> worked on any socfpga board, unless you mean
> 
> "Since AHB address is passed from DT
>and read as u32 value, it anyway does not make sense to mask upper bits."
> 
> which is simply wrong.
> 

There is a "Tested-by:" tag in the commit as well as:
https://patchwork.ozlabs.org/patch/609955/

>> If the patch is reverted then, applying pending patches alone will not
>> help because my patch would be needed anyway to make sure we don't mask
>> 31-20 bits on TI platforms.
> 
> No it won't needed, see http://patchwork.ozlabs.org/patch/838592/ that
> patch series writes plat->trigger_address instead of ahbbase (masked
> or not).
> 

Okay, but reverting this patch would mean Jason has to rebase above
patch. Instead applying that patch would anyway fix the issue.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RFC PATCH] test: py: Disable sleep test for qemu targets

2017-12-04 Thread Stephen Warren

On 12/04/2017 08:30 AM, Tom Rini wrote:

On Mon, Dec 04, 2017 at 03:21:04PM +0100, Michal Simek wrote:

On 4.12.2017 15:03, Tom Rini wrote:

On Mon, Dec 04, 2017 at 02:55:45PM +0100, Michal Simek wrote:

On 1.12.2017 23:44, Tom Rini wrote:

On Fri, Dec 01, 2017 at 10:07:54AM -0700, Stephen Warren wrote:

On 12/01/2017 08:19 AM, Michal Simek wrote:

Hi,

On 1.12.2017 16:06, Heinrich Schuchardt wrote:



On 12/01/2017 03:46 PM, Michal Simek wrote:

Qemu for arm32/arm64 has a problem with time setup.


Wouldn't it be preferable to fix the root cause?


Definitely that would be the best and IIRC I have tried to convince our
qemu guy to do that but they have never done that.


What is the exact failure condition? Is it simply that the test is still
slightly too strict about which delays it accepts, or is sleep outright
broken?

You can use command-line option -k to avoid some tests. For example "-k not
sleep". That way, we don't have to hard-code the dependency into the test
source. Depending on the root cause (issue in U-Boot, or issue in just your
local version of qemu, or something that will never work) this might be
better?


Even with the most recent relaxing of the sleep test requirements, I can
still (depending on overall system load) have 'sleep' take too long, on
QEMU.  I think it might have been half a second slow, but I don't have
the log handy anymore.  Both locally and in travis we -k not sleep all
of the qemu instances.


ok. By locally do you mean just using -k not sleep?


Yes, I have that in my CI scripts and similar.


Wouldn't be easier to keep this in uboot-test-hooks repo with other
target setting?


Or do as you did did and mark the tests as not allowed for qemu, yes.


What we are trying to do is that our testing group will run these tests
for me that's why it is just easier for me to change local
uboot-test-hooks repo instead of communicate with them what -k not XXX
parameters to add to certain scripts.

It means in loop they will just run all tests on qemu, local targets and
in boardfarm. It is probably not big deal to tell them to add -k not
sleep for all qemu runs but I know that for some i2c testing qemu
doesn't emulate these devices that's why these tests fails. And the
amount of tests which we shouldn't run on qemu will probably grow.


Well, I'm still open to possibly tweaking the allowed variance in the
sleep test.  OTOH, if we just say "no QEMU" here, we can then go back to
"sleep should be pretty darn accurate on HW" for the test too, and
perhaps that's best.


The fundamental problem of "over-sleeping" due to host system load/.. 
exists with all boards. There's nothing specific to qemu here except 
that running U-Boot on qemu on the host rather than on separate HW might 
more easily trigger the "high load on the host" condition; I see the 
issue now and then and manually retry that test, although that is a bit 
annoying.


The original test was mostly intended to make sure that e U-Boot clock 
didn't run at a significantly different rate to the host, since I had 
seen that issue during development of some board support or as a 
regression sometime. Perhaps the definition of "significantly different" 
should be more like "1/2 rate or twice rate or more" rather than "off by 
a small fraction of a second". That might avoid so many false positives.

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


Re: [U-Boot] [PATCH v4 0/5] spi: cadence_spi: Adopt Linux DT bindings

2017-12-04 Thread Vignesh R
+ Jagan,

On 16-Nov-17 7:33 PM, Jason Rush wrote:
> Adopt the Linux DT bindings. This also fixes an issue
> with the indaddrtrig register on the Cadence QSPI
> device being programmed with the wrong value for the
> socfpga arch.
> 

Could we get these fixes in v2018.01-rc1/rc2?

> Tested on Terasic SoCKit dev board (Altera Cyclone V)
> 
> Jason Rush (5):
>   spi: cadence_spi: Sync DT bindings with Linux
>   dts: cadence_spi: Sync DT bindings with Linux
>   config: cadence_spi: Remove defines read from DT
>   dts: k2g: Clean-up indentation
>   dts: cadence_spi: Update documentation for DT bindings
> 
>  arch/arm/dts/keystone-k2g-evm.dts | 75 
> +--
>  arch/arm/dts/keystone-k2g.dtsi|  5 +-
>  arch/arm/dts/socfpga.dtsi |  5 +-
>  arch/arm/dts/socfpga_arria10.dtsi |  4 +-
>  arch/arm/dts/socfpga_arria5_socdk.dts |  9 ++--
>  arch/arm/dts/socfpga_cyclone5_is1.dts |  9 ++--
>  arch/arm/dts/socfpga_cyclone5_socdk.dts   |  9 ++--
>  arch/arm/dts/socfpga_cyclone5_sockit.dts  |  9 ++--
>  arch/arm/dts/socfpga_cyclone5_socrates.dts|  9 ++--
>  arch/arm/dts/socfpga_cyclone5_sr1500.dts  |  9 ++--
>  arch/arm/dts/socfpga_cyclone5_vining_fpga.dts | 18 +++
>  arch/arm/dts/stv0991.dts  | 12 +++--
>  doc/device-tree-bindings/spi/spi-cadence.txt  | 13 +++--
>  drivers/spi/cadence_qspi.c| 20 ---
>  drivers/spi/cadence_qspi.h|  6 ++-
>  drivers/spi/cadence_qspi_apb.c| 15 ++
>  include/configs/k2g_evm.h |  1 -
>  include/configs/socfpga_common.h  |  1 -
>  include/configs/stv0991.h |  1 -
>  19 files changed, 113 insertions(+), 117 deletions(-)
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2] test/py: Setup variables based on HUSH selection

2017-12-04 Thread Stephen Warren

On 11/30/2017 09:25 AM, Michal Simek wrote:

From: Stephen Warren 

After adding our small zynq uboot which has hush parser off same
variable tests start to failed. Use quotes only when hush is enabled.

Reported-by: Michal Simek 
Signed-off-by: Stephen Warren 
---

Changes in v2:
- code taken from v1 review from Stephen

Stephen: it is your code that's why I have added your SoB line. Tests
are passing for hush and !hush cases


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


Re: [U-Boot] [PATCH] gpt: add part-uuid and part-num subcommands

2017-12-04 Thread Andrey Yurovsky
Hi Lukasz,

On Tue, Nov 14, 2017 at 1:45 AM, Lukasz Majewski  wrote:
> Hi Andrey,
>
>> Hi Lukasz,
>>
>> On Thu, Nov 9, 2017 at 2:28 PM, Lukasz Majewski
>>  wrote:
>> > On Thu, 9 Nov 2017 07:34:44 -0800
>> > Andrey Yurovsky  wrote:
>> >
>> >> On Thu, Nov 9, 2017 at 1:55 AM, Lukasz Majewski
>> >>  wrote:
>> >> > Hi Andrey,
>> >> >
>> >> >> Hi Otavio,
>> >> >>
>> >> >> On Wed, Nov 8, 2017 at 2:47 AM, Otavio Salvador
>> >> >>  wrote:
>> >> >> > On Tue, Nov 7, 2017 at 10:43 PM, your name
>> >> >> >  wrote:
>> >> >> >> From: Andrey Yurovsky 
>> >> >> >>
>> >> >> >> It is useful to be able to retrieve a partition UUID or
>> >> >> >> number given the partition label, for instance some systems
>> >> >> >> use the partition label to indicate the purpose of the
>> >> >> >> partition (such as "rootfs0" being the 0th root file system
>> >> >> >> in an A/B image scheme).
>> >> >> >>
>> >> >> >> Add "gpt part-uuid" to retrieve the partition UUID for a
>> >> >> >> given label and "gpt part-num" to retrieve the partition
>> >> >> >> number for a given label along with some documentation.
>> >> >> >>
>> >> >> >> Signed-off-by: Andrey Yurovsky 
>> >> >> >
>> >> >> > Why not use the 'part' cmd? it provides it.
>> >> >>
>> >> >> Sorry, I missed the part cmd, it doesn't seem to be documented
>> >> >> in doc/ and it's unclear what  means there.
>> >> >
>> >> > If I may ask - Andrey, if you are now on this "topic" - would you
>> >> > dare to add some ./doc entry for 'part' command?
>> >>
>> >> Yes, I will do that.
>> >
>> > Thanks :-)
>>
>> On further investigation I am not sure that it's possible to extend
>> the part command to retrieve UUIDs by label because of the design of
>> the partition type drivers. Here is how I understand it to work:
>> 1. the "part" command uses part_get_info() and in turn gets a
>> partition driver and can call print() there (which is how EFI/GPT
>> disks are printed with "part list"). The right information (including
>> label) is printed but it's not tied to the caller in any way.
>
> Maybe you can set some env variable with proper data?
>
> For example, please refer to ./cmd/part.c do_part_start() function.
>
> Example call from envs (include/configs/display5.h):
> "part start mmc ${mmcdev} ${kernel_part} lba_start; " \
>

Again that assumes the partition is referred to by number, I need it
to be by label, and the part/disk interface does not seem to have any
way to utilize labels. Unfortunately it looks like my original
approach with the gpt command is the only way to implement this with
the current design (at least from what I see here). Please let me know
if I've missed something. Thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, PATCHv4] env: enable accessing the environment in an EXT4 partition

2017-12-04 Thread Jorge Ramirez

On 12/04/2017 04:23 PM, Tom Rini wrote:

On Mon, Nov 27, 2017 at 08:19:20PM +0100, Jorge Ramirez-Ortiz wrote:


For example to store the environment in a file named "/uboot.env" in MMC
"0", where partition "1" contains the EXT4 filesystem, the following
configs should be added to the board's default config:

   CONFIG_ENV_IS_IN_EXT4=y
   CONFIG_ENV_EXT4_DEVICE_AND_PART="0:1"
   CONFIG_ENV_EXT4_FILE="/uboot.env"
   CONFIG_ENV_EXT4_INTERFACE="mmc"
Reviewed-by: Tom Rini 

The code is fine, but you forgot a Signed-off-by line, so NAK without
one, sorry!




ok my fault. will post a new one as part of the patchset for the 
dragonboard820 support

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


[U-Boot] [PATCH] api: bootelf: go: flush cache before starting

2017-12-04 Thread Emmanuel Vadot
From: Warner Losh 

Some application might load some code at location that contain stale
cache entries. Before running a elf or raw binary, flush the caches
if they are enabled.

Reviewed-by: Tom Rini 
Signed-off-by: Emmanuel Vadot 
---
 api/api.c  | 5 +
 cmd/boot.c | 4 
 cmd/elf.c  | 5 +
 3 files changed, 14 insertions(+)

diff --git a/api/api.c b/api/api.c
index 7eee2fc083..853a3f7b0a 100644
--- a/api/api.c
+++ b/api/api.c
@@ -290,6 +290,11 @@ static int API_dev_close(va_list ap)
if (!err)
di->state = DEV_STA_CLOSED;
 
+   if (dcache_status())
+   flush_dcache_all();
+   if (icache_status())
+   invalidate_icache_all();
+
return err;
 }
 
diff --git a/cmd/boot.c b/cmd/boot.c
index 72f2cf362d..b66ae67fcb 100644
--- a/cmd/boot.c
+++ b/cmd/boot.c
@@ -19,6 +19,10 @@ __attribute__((weak))
 unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc,
 char * const argv[])
 {
+   if (dcache_status())
+   flush_dcache_all();
+   if (icache_status())
+   invalidate_icache_all();
return entry (argc, argv);
 }
 
diff --git a/cmd/elf.c b/cmd/elf.c
index 5745a389da..5126c0e57d 100644
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -109,6 +109,11 @@ static unsigned long do_bootelf_exec(ulong (*entry)(int, 
char * const[]),
 {
unsigned long ret;
 
+   if (dcache_status())
+   flush_dcache_all();
+   if (icache_status())
+   invalidate_icache_all();
+
/*
 * pass address parameter as argv[0] (aka command name),
 * and all remaining args
-- 
2.15.0

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


Re: [U-Boot] [PATCH] arm: Make gcc 6.0 or later a hard requirement now.

2017-12-04 Thread Tom Rini
On Sat, Dec 02, 2017 at 08:12:02PM -0500, Tom Rini wrote:

> Move the warning to an error as we have been promising would happen in
> this release.
> 
> Signed-off-by: Tom Rini 

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] omap2: set the ethaddr as well as the usbethaddr env var to ensure static MAC

2017-12-04 Thread Tom Rini
On Thu, Nov 23, 2017 at 01:14:17PM +, Peter Robinson wrote:

> The kernel gets the ethernet MAC from the ethaddr variable, the omap boards 
> for
> devices with USB based eth adapters just set the usbethaddr which doesn't 
> appear
> to get passed to the kernel. The same Raspberry Pi code sets both ethaddr and
> usbethaddr so lets do that so linux (tested 4.13 and 4.14) get a static rather
> than a random MAC address, while not regressing users of usbethaddr.
> 
> Signed-off-by: Peter Robinson 

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] [U-Boot,2/5] test: overlay: Use cmd_ut_category()

2017-12-04 Thread Tom Rini
On Sat, Nov 25, 2017 at 11:57:30AM -0700, Simon Glass wrote:

> Adjust the code to use the common test-execution function.
> 
> Signed-off-by: Simon Glass 

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] [U-Boot, u-boot, v3, 3/5] board: p212: use common ethernet init function

2017-12-04 Thread Tom Rini
On Mon, Nov 27, 2017 at 10:16:18AM +0100, Neil Armstrong wrote:

> Switch P212 Ethernet init to the common Ethernet init function.
> 
> Reviewed-by: Simon Glass 
> Signed-off-by: Neil Armstrong 

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] [U-Boot, u-boot, v3, 1/5] ARM: arch-meson: add ethernet common init function

2017-12-04 Thread Tom Rini
On Mon, Nov 27, 2017 at 10:16:16AM +0100, Neil Armstrong wrote:

> Introduce a generic common Ethernet Hardware init function
> common to all Amlogic GX SoCs with support for the
> Internal PHY enable for GXL SoCs.
> 
> Signed-off-by: Neil Armstrong 

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] [U-Boot, 1/5] test: Add a command function for test execution

2017-12-04 Thread Tom Rini
On Sat, Nov 25, 2017 at 11:57:29AM -0700, Simon Glass wrote:

> The logic to either iterate through a list of tests or pick a named test
> is common to at lest two test suits. Move this logic into a new function
> and call it from the environment tests.
> 
> Signed-off-by: Simon Glass 

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] armv8: shrink exception table code

2017-12-04 Thread Tom Rini
On Mon, Nov 27, 2017 at 12:47:09AM +, Andre Przywara wrote:

> In the moment our exception entry code needs 34 instructions, so we
> can't use put it directly into the table entry, which offers "only"
> 32 instructions there. Right now we just put an unconditional branch
> there, then use a macro to place the 34 instructions *per entry* after
> that. That effectivly doubles the size of our exception table, which
> is quite a waste, given that we use it mostly for debugging purposes.
> 
> Since the register saving part is actually identical, let's just convert
> that macro into a function, and "bl" into it directly from the exception
> slot, of course after having saved at least the original LR.
> This saves us about 950 bytes of code, which is quite a relief for some
> tight SPLs, in particular the 64-bit Allwinner ones.
> 
> Signed-off-by: Andre Przywara 

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] [U-Boot, u-boot, v3, 4/5] arm: Add LibreTech CC support based on Meson GXL family

2017-12-04 Thread Tom Rini
On Mon, Nov 27, 2017 at 10:16:19AM +0100, Neil Armstrong wrote:

> This adds platform code for the Libre Computer CC "Le Potato" board based on a
> Meson GXL (S905X) SoC with the Meson GXL configuration.
> 
> This initial submission supports UART, MMC/SDCard and Ethernet with the
> Internal RMII PHY.
> 
> The meson-gxl-s905x-libretech-cc.dts is synchronised from the linux 4.13
> stable tree as of 4.13.8.
> 
> Reviewed-by: Simon Glass 
> Signed-off-by: Neil Armstrong 

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] [U-Boot, 3/5] test: compression: Put test variables in a struct

2017-12-04 Thread Tom Rini
On Sat, Nov 25, 2017 at 11:57:31AM -0700, Simon Glass wrote:

> At present the test setup is somewhat mixed with the test itself. But if
> the test setup fails (which it should not) then the test is actually
> invalid. Put all the test buffers and sizes in a struct and separate out
> the core code into a function.
> 
> This will make it easier to move the code to use the unit test framework.
> 
> Signed-off-by: Simon Glass 

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] [U-Boot, 1/2] libfdt: move fdt_find_regions() to fdt_region.c from fdt_wip.c

2017-12-04 Thread Tom Rini
On Mon, Nov 27, 2017 at 04:06:06PM +0900, Masahiro Yamada wrote:

> All the other fdt_*_region() functions are located in fdt_region.c,
> while only fdt_find_regions() was added to fdt_wip.c, strangely.
> 
> Move it to the suitable place.
> 
> Signed-off-by: Masahiro Yamada 
> Reviewed-by: Simon Glass 

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] drivers: firmware: psci: use pr_* log functions instead of printf()

2017-12-04 Thread Tom Rini
On Wed, Nov 29, 2017 at 03:04:40PM +0900, Masahiro Yamada wrote:

> In Linux, the warning messages are printed out by pr_warn().
> 
> We can use Linux-like log functions in tree-wide.
> 
> Signed-off-by: Masahiro Yamada 
> Reviewed-by: Simon Glass 

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] [U-Boot, u-boot, v3, 5/5] arm: Add Khadas VIM support based on Meson GXL family

2017-12-04 Thread Tom Rini
On Mon, Nov 27, 2017 at 10:16:20AM +0100, Neil Armstrong wrote:

> This adds platform code for the Khadas VIM board based on a
> Meson GXL (S905X) SoC with the Meson GXL configuration.
> 
> This initial submission supports UART, MMC/SDCard and Ethernet with the
> Internal RMII PHY.
> 
> The meson-gxl-s905x-khadas-vim.dts is synchronised from the linux 4.13
> stable tree as of 4.13.8.
> 
> Reviewed-by: Simon Glass 
> Signed-off-by: Neil Armstrong 

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] [U-Boot,2/5] test: overlay: Use cmd_ut_category()

2017-12-04 Thread Tom Rini
On Sat, Nov 25, 2017 at 11:57:30AM -0700, Simon Glass wrote:

> Adjust the code to use the common test-execution function.
> 
> Signed-off-by: Simon Glass 

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] [U-Boot, 2/2] libfdt: migrate fdt_wip.c to a wrapper of scripts/dtc/libfdt/fdt_wip.c

2017-12-04 Thread Tom Rini
On Mon, Nov 27, 2017 at 04:06:07PM +0900, Masahiro Yamada wrote:

> Now, lib/libfdt/fdt_wip.c is the same as scripts/dtc/libfdt/fdt_wip.c
> 
> Change the former to a wrapper of the latter.
> 
> Signed-off-by: Masahiro Yamada 
> Reviewed-by: Simon Glass 

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] [U-Boot, 4/5] test/py: Allow any unit test suite to be found

2017-12-04 Thread Tom Rini
On Sat, Nov 25, 2017 at 11:57:32AM -0700, Simon Glass wrote:

> The u-boot.sym file is scanned to find unit test suites for execution. At
> present it only finds those whose names start with 'dm' or 'env'. This
> code is buried in the bowels of the test code so when adding a new suite
> it is not easy to discover why it is ignored by the test framework.
> 
> There seems to be no need to make this restriction. Drop it.
> 
> Signed-off-by: Simon Glass 
> Acked-by: Stephen Warren 

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] omap3: evm: Explicitly use DISTRO_DEFAULTS features at startup

2017-12-04 Thread Tom Rini
On Wed, Nov 29, 2017 at 03:28:55AM +, Derald D. Woods wrote:

> [primary] Check MMC 0:1 for /extlinux/extlinux.conf and boot
> [fallback 1] Check MMC 0:1 zImage and run mmcbootz
> [fallback 2] Check MMC 0:1 uImage and run mmcboot
> [fallback 3] Check NAND partitions and run nandboot
> 
> If 'extlinux.conf' is not found on MMC 0, the previous boot behavior is
> followed.
> 
> Signed-off-by: Derald D. Woods 

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] [U-Boot, 5/5] test: compression: Convert to unit test framework

2017-12-04 Thread Tom Rini
On Sat, Nov 25, 2017 at 11:57:33AM -0700, Simon Glass wrote:

> Adjust this test to use the unit test framework. Drop the two existing
> commands for running the tests and replace them with a single
> 'ut compression' command, with sub-commands.
> 
> Signed-off-by: Simon Glass 

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] [U-Boot, u-boot, v3, 2/5] board: odroid-c2: use common ethernet init function

2017-12-04 Thread Tom Rini
On Mon, Nov 27, 2017 at 10:16:17AM +0100, Neil Armstrong wrote:

> Switch Odroid-C2 Ethernet init to the common Ethernet init function.
> 
> Reviewed-by: Simon Glass 
> Signed-off-by: Neil Armstrong 

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] [U-Boot,v3,1/1] add support for Raspberry Pi Zero W

2017-12-04 Thread Tom Rini
On Sun, Nov 26, 2017 at 01:38:53PM +0400, Dmitry Korunov wrote:

> Signed-off-by: Dmitry Korunov 

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] armv8: mmu: fix page table mapping

2017-12-04 Thread Tom Rini
On Tue, Nov 28, 2017 at 10:31:28AM +0800, Peng Fan wrote:

> To page mapping the lowest 2 bits needs to be 0x3.
> If not fix this, the final lowest 3 bits for page mapping is 0x1
> which is marked as reserved.
> 
> Signed-off-by: Peng Fan 
> Reviewed-by: York Sun 

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] u-boot-uniphier/master

2017-12-04 Thread Tom Rini
On Mon, Dec 04, 2017 at 10:23:11PM +0900, Masahiro Yamada wrote:

> Hi Tom,
> 
> Please pull a little more NAND and UniPhier updates.
> 
> 
> 
> The following changes since commit 02907004294d981fff9a7305ad9c6d8a0138f205:
> 
>   Merge git://git.denx.de/u-boot-rockchip (2017-12-01 19:08:30 -0500)
> 
> are available in the git repository at:
> 
>   git://git.dex.de/u-boot-uniphier.git master
> 
> for you to fetch changes up to 0faef2eba946a95f9c78d2b3db47e15bac04b52e:
> 
>   mtd: nand: denali: consolidate include directives (2017-12-04 22:00:03 
> +0900)
> 

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] arm64 :show_regs: show the address before relocation

2017-12-04 Thread Tom Rini
On Tue, Nov 28, 2017 at 10:08:08AM +0800, Peng Fan wrote:

> After relocation, when error happends, it is hard to track
> ELR and LR with asm file objdumped from elf file.
> 
> So subtract the gd->reloc_off the reflect the compliation address.
> 
> Signed-off-by: Peng Fan 
> Reviewed-by: Simon Glass 

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] Please pull u-boot-cfi-flash/master

2017-12-04 Thread Tom Rini
On Mon, Dec 04, 2017 at 07:44:50AM +0100, Stefan Roese wrote:

> Hi Tom,
> 
> please pull this one CFI driver fix from York.
> 
> Thanks,
> Stefan
> 
> The following changes since commit b06c46de632c55f4c39d404c6f0f65e414b31050:
> 
>   Merge tag 'xilinx-for-v2018.01' of git://www.denx.de/git/u-boot-microblaze 
> (2017-11-29 08:26:07 -0500)
> 
> are available in the Git repository at:
> 
>   git://www.denx.de/git/u-boot-cfi-flash.git 
> 
> for you to fetch changes up to 2544f47078635958bacb106684a2f81f57a4ed80:
> 
>   mtd: cfi: Fix checking status register feature (2017-12-04 07:41:32 +0100)
> 

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] scripts: spl: fix typo

2017-12-04 Thread Tom Rini
On Thu, Nov 30, 2017 at 10:07:07AM +0800, Peng Fan wrote:

> Typo fix: CONIFG->CONFIG
> 
> Signed-off-by: Peng Fan 
> Cc: Tom Rini 
> Cc: Simon Glass 
> Reviewed-by: Simon Glass 

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] [U-Boot, u-boot, v2] ARM: arch-meson: build memory banks using reported memory from registers

2017-12-04 Thread Tom Rini
On Mon, Nov 27, 2017 at 10:35:46AM +0100, Neil Armstrong wrote:

> As discussed at [1], the Amlogic Meson GX SoCs can embed a BL31 firmware
> and a secondary BL32 firmware.
> Since mid-2017, the reserved memory address of the BL31 firmware was moved
> and grown for security reasons.
> 
> But mainline U-Boot and Linux has the old address and size fixed.
> 
> These SoCs have a register interface to get the two firmware reserved
> memory start and sizes.
> 
> This patch adds a dynamic reservation of the memory zones in the device tree 
> bootmem
> reserved memory zone used by the kernel in early boot.
> To be complete, the memory zones are also added to the EFI reserved zones.
> 
> Depends on patchset "Add support for Amlogic GXL Based SBCs" at [2].
> 
> [1] 
> http://lists.infradead.org/pipermail/linux-amlogic/2017-October/004860.html
> [2] 
> http://lists.infradead.org/pipermail/linux-amlogic/2017-November/005410.html
> 
> Changes since v1:
> - switched the #if to if(IS_ENABLED()) to compile all code paths
> - renamed function to meson_board_add_reserved_memory()
> - added a mem.h header with comment
> - updated all boards ft_board_setup()
> 
> Changes since RFC v2:
> - reduced preprocessor load
> - kept Odroid-C2 static memory mapping as exception
> 
> Changes since RFC v1:
> - switch to fdt rsv mem table and efi reserve memory
> - replaced in_le32 by readl()
> 
> Reviewed-by: Simon Glass 
> Signed-off-by: Neil Armstrong 
> Reviewed-by: Simon Glass 

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] arm: Make gcc 6.0 or later a hard requirement now.

2017-12-04 Thread Stephen Warren

On 12/02/2017 06:12 PM, Tom Rini wrote:

Move the warning to an error as we have been promising would happen in
this release.


Oh. This has broken my U-Boot build/test system. I guess it's entirely 
my fault for interpreting the "2018.01" warning as "you'll need to fix 
this in Jan 2018", not "you'll need to fix this as soon as development 
starts for 2018.01":-(


Is there a reason for requiring such an extremely new gcc, as opposed to 
simply something not ancient? For example, no LTS version of Ubuntu 
packages a compiler that's new enough to build U-Boot now:-(

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


[U-Boot] [PATCH 1/2] distro_bootcmd: Add command to run FreeBSD

2017-12-04 Thread Emmanuel Vadot
Add commands that scans for the FreeBSD loader and run it if found.
FreeBSD has two loader: ubldr which is an ELF binary and ubldr.bin which
is a PIE binary.

Signed-off-by: Emmanuel Vadot 
---
 include/config_distro_bootcmd.h | 32 
 1 file changed, 32 insertions(+)

diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index 5c469a23fa..424d63a355 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -158,6 +158,36 @@
 #define SCAN_DEV_FOR_EFI
 #endif
 
+#ifdef CONFIG_DISTRO_FREEBSD
+#define BOOTENV_SHARED_FREEBSD\
+   "boot_freebsd_binary="\
+   "load ${devtype} ${devnum}:${distro_bootpart} "   \
+   "${kernel_addr_r} ubldr.bin; "\
+   "go ${kernel_addr_r}\0"   \
+   \
+   "boot_freebsd_elf="   \
+   "load ${devtype} ${devnum}:${distro_bootpart} "   \
+   "${kernel_addr_r} ubldr; "\
+   "bootelf ${kernel_addr_r}\0"  \
+   \
+   "scan_dev_for_freebsd="   \
+   "if test -e ${devtype} ${devnum}:${distro_bootpart} " \
+   "ubldr.bin; then "\
+   "echo Found FreeBSD U-Boot Loader (bin);" \
+   "run boot_freebsd_binary; "   \
+   "echo FREEBSD FAILED: continuing...; "\
+   "elif test -e ${devtype} ${devnum}:${distro_bootpart} "   \
+   "ubldr; then "\
+   "echo Found FreeBSD U-Boot Loader (elf);" \
+   "run boot_freebsd_elf; "  \
+   "echo FREEBSD FAILED: continuing...; "\
+   "fi;\0"
+#define SCAN_DEV_FOR_FREEBSD "run scan_dev_for_freebsd;"
+#else
+#define BOOTENV_SHARED_FREEBSD
+#define SCAN_DEV_FOR_FREEBSD
+#endif
+
 #ifdef CONFIG_SATA
 #define BOOTENV_SHARED_SATABOOTENV_SHARED_BLKDEV(sata)
 #define BOOTENV_DEV_SATA   BOOTENV_DEV_BLKDEV
@@ -331,6 +361,7 @@
BOOTENV_SHARED_IDE \
BOOTENV_SHARED_UBIFS \
BOOTENV_SHARED_EFI \
+   BOOTENV_SHARED_FREEBSD \
"boot_prefixes=/ /boot/\0" \
"boot_scripts=boot.scr.uimg boot.scr\0" \
"boot_script_dhcp=boot.scr.uimg\0" \
@@ -374,6 +405,7 @@
"run scan_dev_for_scripts; "  \
"done;"   \
SCAN_DEV_FOR_EFI  \
+   SCAN_DEV_FOR_FREEBSD  \
"\0"  \
\
"scan_dev_for_boot_part=" \
-- 
2.15.0

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


[U-Boot] [PATCH 2/2] kconfig: Add a DISTRO_FREEBSD option

2017-12-04 Thread Emmanuel Vadot
Add a FreeBSD option that enables the API and the data cache command
as both are needed to boot the FreeBSD loader.

Signed-off-by: Emmanuel Vadot 
---
 common/Kconfig | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/common/Kconfig b/common/Kconfig
index c50d6ebb2a..acf20ade1d 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -502,4 +502,15 @@ config HASH
 
 endmenu
 
+config DISTRO_FREEBSD
+   bool "Enable FreeBSD boot"
+   select API if !ARM64
+   select CMD_CACHE
+   default n
+   help
+ This options adds boot configuration that can run the FreeBSD
+ loader. When enabled the distro_bootcmd will be expanded to
+ include scan_dev_for_freebsd which search for the FreeBSD loader
+ and if found run it.
+
 source "common/spl/Kconfig"
-- 
2.15.0

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


Re: [U-Boot] [PATCH] arm: Make gcc 6.0 or later a hard requirement now.

2017-12-04 Thread Tom Rini
On Mon, Dec 04, 2017 at 12:02:20PM -0700, Stephen Warren wrote:
> On 12/02/2017 06:12 PM, Tom Rini wrote:
> >Move the warning to an error as we have been promising would happen in
> >this release.
> 
> Oh. This has broken my U-Boot build/test system. I guess it's entirely my
> fault for interpreting the "2018.01" warning as "you'll need to fix this in
> Jan 2018", not "you'll need to fix this as soon as development starts for
> 2018.01":-(

I'm tagging v2018.01-rc1 later today, so I think this is about the time
to enforce the warning.

> Is there a reason for requiring such an extremely new gcc, as opposed to
> simply something not ancient? For example, no LTS version of Ubuntu packages
> a compiler that's new enough to build U-Boot now:-(

There's always the Free Electrons toolchains, as well as Linaro.  And
yes, we've been having size problems and having to play various games to
allow for older gcc versions to still fit things in.  GCC-6 is where
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54303 was resolved and we
get a lot of space saved, and a number of platforms simply won't work
with older.

-- 
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 1/2] distro_bootcmd: Add command to run FreeBSD

2017-12-04 Thread Heinrich Schuchardt
On 12/04/2017 08:06 PM, Emmanuel Vadot wrote:
> Add commands that scans for the FreeBSD loader and run it if found.
> FreeBSD has two loader: ubldr which is an ELF binary and ubldr.bin which
> is a PIE binary.
> 
> Signed-off-by: Emmanuel Vadot 
> ---
>  include/config_distro_bootcmd.h | 32 
>  1 file changed, 32 insertions(+)
> 
> diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
> index 5c469a23fa..424d63a355 100644
> --- a/include/config_distro_bootcmd.h
> +++ b/include/config_distro_bootcmd.h
> @@ -158,6 +158,36 @@
>  #define SCAN_DEV_FOR_EFI
>  #endif
>  
> +#ifdef CONFIG_DISTRO_FREEBSD
> +#define BOOTENV_SHARED_FREEBSD\
> + "boot_freebsd_binary="\
> + "load ${devtype} ${devnum}:${distro_bootpart} "   \
> + "${kernel_addr_r} ubldr.bin; "\
> + "go ${kernel_addr_r}\0"   \
> + \
> + "boot_freebsd_elf="   \
> + "load ${devtype} ${devnum}:${distro_bootpart} "   \
> + "${kernel_addr_r} ubldr; "\
> + "bootelf ${kernel_addr_r}\0"  \
> + \
> + "scan_dev_for_freebsd="   \
> + "if test -e ${devtype} ${devnum}:${distro_bootpart} " \
> + "ubldr.bin; then "\

Your commit message does not provide any reason why you need this.

Couldn't you simply create a boot.scr that invokes ubldr.bin or ubldr as
other distros do?

E.g. Debian has a package flash-boot which generates a new boot.scr
every time a new kernel is installed.

Best

> + "echo Found FreeBSD U-Boot Loader (bin);" \
> + "run boot_freebsd_binary; "   \
> + "echo FREEBSD FAILED: continuing...; "\
> + "elif test -e ${devtype} ${devnum}:${distro_bootpart} "   \
> + "ubldr; then "\
> + "echo Found FreeBSD U-Boot Loader (elf);" \
> + "run boot_freebsd_elf; "  \
> + "echo FREEBSD FAILED: continuing...; "\
> + "fi;\0"
> +#define SCAN_DEV_FOR_FREEBSD "run scan_dev_for_freebsd;"
> +#else
> +#define BOOTENV_SHARED_FREEBSD
> +#define SCAN_DEV_FOR_FREEBSD
> +#endif
> +
>  #ifdef CONFIG_SATA
>  #define BOOTENV_SHARED_SATA  BOOTENV_SHARED_BLKDEV(sata)
>  #define BOOTENV_DEV_SATA BOOTENV_DEV_BLKDEV
> @@ -331,6 +361,7 @@
>   BOOTENV_SHARED_IDE \
>   BOOTENV_SHARED_UBIFS \
>   BOOTENV_SHARED_EFI \
> + BOOTENV_SHARED_FREEBSD \
>   "boot_prefixes=/ /boot/\0" \
>   "boot_scripts=boot.scr.uimg boot.scr\0" \
>   "boot_script_dhcp=boot.scr.uimg\0" \
> @@ -374,6 +405,7 @@
>   "run scan_dev_for_scripts; "  \
>   "done;"   \
>   SCAN_DEV_FOR_EFI  \
> + SCAN_DEV_FOR_FREEBSD  \
>   "\0"  \
>   \
>   "scan_dev_for_boot_part=" \
> 

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


[U-Boot] [PATCH 1/1] efi_loader: add comments to memory functions

2017-12-04 Thread Heinrich Schuchardt
Add comments describing memory functions.

Fix the formatting of a function declaration.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_memory.c | 44 ++--
 1 file changed, 42 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 0aa3e0881d..aaf64421a3 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -275,6 +275,15 @@ static uint64_t efi_find_free_memory(uint64_t len, 
uint64_t max_addr)
return 0;
 }
 
+/*
+ * Allocate memory pages.
+ *
+ * @type   type of allocation to be performed
+ * @memory_typeusage type of the allocated memory
+ * @pages  number of pages to be allocated
+ * @memory allocated memory
+ * @return status code
+ */
 efi_status_t efi_allocate_pages(int type, int memory_type,
efi_uintn_t pages, uint64_t *memory)
 {
@@ -338,6 +347,13 @@ void *efi_alloc(uint64_t len, int memory_type)
return NULL;
 }
 
+/*
+ * Free memory pages.
+ *
+ * @memory start of the memory area to be freed
+ * @pages  number of pages to be freed
+ * @return status code
+ */
 efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t pages)
 {
uint64_t r = 0;
@@ -351,8 +367,15 @@ efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t 
pages)
return EFI_NOT_FOUND;
 }
 
-efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size,
-  void **buffer)
+/*
+ * Allocate memory from pool.
+ *
+ * @pool_type  type of the pool from which memory is to be allocated
+ * @size   number of bytes to be allocated
+ * @buffer allocated memory
+ * @return status code
+ */
+efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size, void **buffer)
 {
efi_status_t r;
efi_physical_addr_t t;
@@ -375,6 +398,12 @@ efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t 
size,
return r;
 }
 
+/*
+ * Free memory from pool.
+ *
+ * @buffer start of memory to be freed
+ * @return status code
+ */
 efi_status_t efi_free_pool(void *buffer)
 {
efi_status_t r;
@@ -392,6 +421,17 @@ efi_status_t efi_free_pool(void *buffer)
return r;
 }
 
+/*
+ * Get map describing memory usage.
+ *
+ * @memory_map_sizeon entry the size, in bytes, of the memory map buffer,
+ * on exit the size of the copied memory map
+ * @memory_map buffer to which the memory map is written
+ * @map_keykey for the memory map
+ * @descriptor_sizesize of an individual memory descriptor
+ * @descriptor_version version number of the memory descriptor structure
+ * @return status code
+ */
 efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size,
struct efi_mem_desc *memory_map,
efi_uintn_t *map_key,
-- 
2.14.2

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


Re: [U-Boot] [PATCH] efi_stub: Use efi_uintn_t

2017-12-04 Thread Heinrich Schuchardt
On 12/04/2017 04:33 PM, Alexander Graf wrote:
> Commit f5a2a93892f ("efi_loader: consistently use efi_uintn_t in boot
> services") changed the internal EFI API header without adapting its existing
> EFI stub users. Let's adapt the EFI stub as well.
> 
> Fixes: f5a2a93892f ("efi_loader: consistently use efi_uintn_t in boot 
> services")
> Signed-off-by: Alexander Graf 
> ---
>  lib/efi/efi_stub.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/efi/efi_stub.c b/lib/efi/efi_stub.c
> index 9788dedba7..205aa19947 100644
> --- a/lib/efi/efi_stub.c
> +++ b/lib/efi/efi_stub.c
> @@ -277,7 +277,7 @@ efi_status_t efi_main(efi_handle_t image, struct 
> efi_system_table *sys_table)
>   struct efi_boot_services *boot = sys_table->boottime;
>   struct efi_mem_desc *desc;
>   struct efi_entry_memmap map;
> - ulong key, desc_size, size;
> + efi_uintn_t key, desc_size, size;
>   efi_status_t ret;
>   u32 version;
>   int cs32;
> 
Reviewed-by: Heinrich Schuchardt 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] fpga: allow programming fpga from FIT image for all FPGA drivers

2017-12-04 Thread Goldschmidt Simon

Hi,

On 4.12.2017 15:27, Michal Simek wrote:
> [..]
> ok. Then applied to my xilinx tree.

Great to hear that, thanks!

Which release will this be in? Does it fit into 2018.01 or has that
window already closed?

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


Re: [U-Boot] [PATCH 1/5] mx6slevk: imximage.cfg: Handle the CONFIG_SECURE_BOOT case

2017-12-04 Thread Breno Matheus Lima
Hi Stefano,

Just a gentle ping on this series.

Thanks,
Breno Lima

2017-11-27 23:34 GMT-02:00 Peng Fan :
>
>
>> -Original Message-
>> From: Breno Lima [mailto:brenomath...@gmail.com]
>> Sent: Tuesday, November 28, 2017 7:03 AM
>> To: Fabio Estevam ; sba...@denx.de
>> Cc: Peng Fan ; u-boot@lists.denx.de; Breno Matheus
>> Lima 
>> Subject: [PATCH 1/5] mx6slevk: imximage.cfg: Handle the
>> CONFIG_SECURE_BOOT case
>>
>> From: Breno Lima 
>>
>> Secure boot is not enabled in mx6slevk imximage.cfg, add support for it.
>>
>> Signed-off-by: Breno Lima 
>> ---
>>  board/freescale/mx6slevk/imximage.cfg | 9 +
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/board/freescale/mx6slevk/imximage.cfg
>> b/board/freescale/mx6slevk/imximage.cfg
>> index 024de9c..9722eb5 100644
>> --- a/board/freescale/mx6slevk/imximage.cfg
>> +++ b/board/freescale/mx6slevk/imximage.cfg
>> @@ -8,6 +8,8 @@
>>   *
>>   * The syntax is taken as close as possible with the kwbimage
>>   */
>> +#define __ASSEMBLY__
>> +#include 
>>
>>  /* image version */
>>
>> @@ -21,6 +23,13 @@ IMAGE_VERSION 2
>>  BOOT_FROMsd
>>
>>  /*
>> + * Secure boot support
>> + */
>> +#ifdef CONFIG_SECURE_BOOT
>> +CSF CONFIG_CSF_SIZE
>> +#endif
>> +
>> +/*
>
> Acked-by: Peng Fan 
>
>
>>   * Device Configuration Data (DCD)
>>   *
>>   * Each entry must have the format:
>> --
>> 2.7.4
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] u-boot Licensing exception with OpenSSL

2017-12-04 Thread Tom Rini
On Sat, Nov 25, 2017 at 12:50:47PM -0800, Vagrant Cascadian wrote:

> There are a few targets (clearfog, turris_omnia) and features (signing
> in mkimage) in the Debian build of u-boot that have been avoided due to
> lack of clarity on Licensing issues regarding GPL and OpenSSL
> compatibility issues.
> 
> A reasonable description of the issue GPL linking against OpenSSL issue:
> 
>   https://people.gnome.org/~markmc/openssl-and-the-gpl.html
> 
> 
> It seems like Licenses/Exceptions might be attempting to address this
> issue, but it is not absolutely clear that this applies to linking
> against OpenSSL:
> 
> GPL License Exception:
> 
>   Even though U-Boot in general is covered by the GPL-2.0/GPL-2.0+,
>   this does *not* cover the so-called "standalone" applications that
>   use U-Boot services by means of the jump table provided by U-Boot
>   exactly for this purpose - this is merely considered normal use of
>   U-Boot, and does *not* fall under the heading of "derived work".
> 
> The header files "include/image.h" and "arch/*/include/asm/u-boot.h"
>   define interfaces to U-Boot.  Including these (unmodified) header
>   files in another file is considered normal use of U-Boot, and does
>   *not* fall under the heading of "derived work".
>   -- Wolfgang Denk
> 
> 
> Some recommended text to apply an explicit exemption for GPL+OpenSSL:
> 
>   https://lists.debian.org/debian-legal/2004/05/msg00595.html
>   https://doc.qt.io/qt-5/qtnetwork-index.html#licenses-and-attributions
> 
> Some example text taken from
> https://sources.debian.net/src/offlineimap/7.1.2%2Bdfsg1-1/COPYING/#L353
> 
>  In addition, as a special exception, the copyright holders give
>  permission to link the code of portions of this program with the OpenSSL
>  library under certain conditions as described in each individual source
>  file, and distribute linked combinations including the two.
>  .
>  You must obey the GNU General Public License in all respects for all of
>  the code used other than OpenSSL. If you modify file(s) with this
>  exception, you may extend this exception to your version of the file(s),
>  but you are not obligated to do so. If you do not wish to do so, delete
>  this exception statement from your version. If you delete this exception
>  statement from all source files in the program, then also delete it
>  here.
> 
> 
> If most explicit clarification could be made on this issue, ideally
> through commits to u-boot git, I would be able to enable more features
> in the u-boot packages in Debian!

So, the most likely thing that could be accomplished (as I don't see how
we could add exemptions without some legal consult) would be to re-write
the small areas in question to use libgnutls rather than openssl for
checking the certificates, etc.

-- 
Tom


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


[U-Boot] [PATCH v4 00/15] log: Add a new logging feature

2017-12-04 Thread Simon Glass
U-Boot currently has fairly rudimentary logging features. A basic printf()
provides console output and debug() provides debug output which is
activated if DEBUG is defined in the file containing the debug()
statements.

It would be useful to have a few more features:

- control of debug output at runtime, so  problems can potentially be
debugged without recompiling U-Boot
- control of which subsystems output debug information, so that (for
example) it is possible to enable debugging for MMC or SATA at runtime
- indication of severity with each message, so that the user can control
whether just errors are displayed, warnings, or all debug messages
- sending logging information to different destinations, such as console,
memory, linux, etc,

At present U-Boot has a logbuffer feature which records output in a memory
buffer for later display or storage. This is useful but is not at present
enabled for any board.

This series introduced a new logging system which supports:
- various log levels from panic to debug
- log categories including all uclasses and a few others
- log drivers to which all log records can be sent
- log filters which control which log records make it to which drivers

Enabling logging with the default options does not add much to code size.
By default the maximum recorded log level is LOGL_INFO, meaning that debug
messages (and above) are discarded a build-time. Increasing this level
provides more run-time flexibility to enable/disable logging at the cost
of increased code size.

This feature is by no means finished. The README provides a long list of
features and clean-ups that could be done. But hopefully this is a
starting point for improving this important area in U-Boot.

The series is available at u-boot-dm/log-working

Changes in v4:
- Add an extra tab in the debug_cond() macro
- Add new patch to correct use of debug() in usb_hub.c
- Handle casting uclass ID to lgo category (for clang)

Changes in v3:
- Rebase to master

Changes in v2:
- Add a comment as to why CONFIG_LOG_MAX_LEVEL is not defined
- Change log levels to match new header
- Change sandbox log level to 6
- Drop MAINTAINERS entries for files not added by this patch
- Drop the special log() functions from the README
- Drop the use of 'continue' in the macro
- Fix LOG_SPL_MAX_LEVEL typo (should be SPL_LOG_MAX_LEVEL)
- Fix function called when test command is selected
- Fix help output for 'log test'
- Fix up bad use of #if CONFIG_VAL() - use #ifdef instead
- Line up log levels with Linux
- Only execute log tests if CONFIG_LOG is enabled
- Rename LOGL_WARN to LOGL_WARNING
- Split pre-console address change into a separate patch
- Update commit message to explain that this is not just for serial output

Simon Glass (15):
  Revert "sandbox: remove os_putc() and os_puts()"
  sandbox: Adjust pre-console address to avoid conflict
  Revert "sandbox: Drop special case console code for sandbox"
  Move debug and logging support to a separate header
  mtdparts: Correct use of debug()
  usb: Correct use of debug()
  Drop the log buffer
  log: Add an implementation of logging
  log: Add a console driver
  log: Add a 'log level' command
  log: Add a test command
  log: Plumb logging into the init sequence
  log: sandbox: Enable logging
  log: test: Add a pytest for logging
  log: Add documentation

 MAINTAINERS   |   9 ++
 arch/sandbox/cpu/os.c |  11 ++
 cmd/Kconfig   |   8 +
 cmd/Makefile  |   2 +-
 cmd/log.c | 326 +-
 cmd/mtdparts.c|   3 -
 common/Kconfig|  86 ++
 common/Makefile   |   2 +
 common/board_f.c  |  23 +--
 common/board_r.c  |  27 +---
 common/console.c  |   7 +
 common/image.c|   9 --
 common/log.c  | 245 
 common/log_console.c  |  23 +++
 common/stdio.c|   6 -
 common/usb_hub.c  |   4 +-
 configs/sandbox_defconfig |   5 +-
 doc/README.log| 214 +
 include/asm-generic/global_data.h |   8 +-
 include/common.h  |  46 +-
 include/log.h | 304 +++
 include/logbuff.h |  49 --
 include/os.h  |  20 +++
 include/post.h|   4 +-
 post/post.c   |   9 --
 post/tests.c  |   4 -
 scripts/config_whitelist.txt  |   1 -
 test/Makefile |   1 +
 test/log/Makefile |   7 +
 test/log/log_test.c   | 205 
 test/py/tests/test_log.py | 101 
 31 files changed, 1304 insertions(+), 465 deletions(-)
 create mode 100644 common/log.c
 create mode 100644 common/log_console.c
 create mode 1

[U-Boot] [PATCH v4 01/15] Revert "sandbox: remove os_putc() and os_puts()"

2017-12-04 Thread Simon Glass
While sandbox works OK without the special-case code, it does result in
console output being stored in the pre-console buffer while sandbox starts
up. If there is a crash or a problem then there is no indication of what
is going on.

For ease of debugging it seems better to revert this change.

This reverts commit 47b98ad0f6779485d0f0c14f337c3eece273eb54.

Signed-off-by: Simon Glass 
---

Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/sandbox/cpu/os.c | 11 +++
 include/os.h  | 20 
 2 files changed, 31 insertions(+)

diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index c524957b6c..9dd90a1b30 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -421,6 +421,17 @@ int os_get_filesize(const char *fname, loff_t *size)
return 0;
 }
 
+void os_putc(int ch)
+{
+   putchar(ch);
+}
+
+void os_puts(const char *str)
+{
+   while (*str)
+   os_putc(*str++);
+}
+
 int os_write_ram_buf(const char *fname)
 {
struct sandbox_state *state = state_get_current();
diff --git a/include/os.h b/include/os.h
index 2bf4bdb1b8..049b248c5b 100644
--- a/include/os.h
+++ b/include/os.h
@@ -240,6 +240,26 @@ const char *os_dirent_get_typename(enum os_dirent_t type);
  */
 int os_get_filesize(const char *fname, loff_t *size);
 
+/**
+ * Write a character to the controlling OS terminal
+ *
+ * This bypasses the U-Boot console support and writes directly to the OS
+ * stdout file descriptor.
+ *
+ * @param ch   Character to write
+ */
+void os_putc(int ch);
+
+/**
+ * Write a string to the controlling OS terminal
+ *
+ * This bypasses the U-Boot console support and writes directly to the OS
+ * stdout file descriptor.
+ *
+ * @param str  String to write (note that \n is not appended)
+ */
+void os_puts(const char *str);
+
 /**
  * Write the sandbox RAM buffer to a existing file
  *
-- 
2.15.0.531.g2ccb3012c9-goog

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


[U-Boot] [PATCH v4 04/15] Move debug and logging support to a separate header

2017-12-04 Thread Simon Glass
Before adding new features, move these definitions to a separate header
to avoid further cluttering common.h.

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

Changes in v4: None
Changes in v3: None
Changes in v2: None

 include/common.h | 46 +--
 include/log.h| 59 
 2 files changed, 60 insertions(+), 45 deletions(-)
 create mode 100644 include/log.h

diff --git a/include/common.h b/include/common.h
index 6e24545178..436200044f 100644
--- a/include/common.h
+++ b/include/common.h
@@ -45,51 +45,7 @@ typedef volatile unsigned char   vu_char;
 #define CONFIG_SYS_SUPPORT_64BIT_DATA
 #endif
 
-#ifdef DEBUG
-#define _DEBUG 1
-#else
-#define _DEBUG 0
-#endif
-
-#ifdef CONFIG_SPL_BUILD
-#define _SPL_BUILD 1
-#else
-#define _SPL_BUILD 0
-#endif
-
-/*
- * Output a debug text when condition "cond" is met. The "cond" should be
- * computed by a preprocessor in the best case, allowing for the best
- * optimization.
- */
-#define debug_cond(cond, fmt, args...) \
-   do {\
-   if (cond)   \
-   printf(pr_fmt(fmt), ##args);\
-   } while (0)
-
-/* Show a message if DEBUG is defined in a file */
-#define debug(fmt, args...)\
-   debug_cond(_DEBUG, fmt, ##args)
-
-/* Show a message if not in SPL */
-#define warn_non_spl(fmt, args...) \
-   debug_cond(!_SPL_BUILD, fmt, ##args)
-
-/*
- * An assertion is run-time check done in debug mode only. If DEBUG is not
- * defined then it is skipped. If DEBUG is defined and the assertion fails,
- * then it calls panic*( which may or may not reset/halt U-Boot (see
- * CONFIG_PANIC_HANG), It is hoped that all failing assertions are found
- * before release, and after release it is hoped that they don't matter. But
- * in any case these failing assertions cannot be fixed with a reset (which
- * may just do the same assertion again).
- */
-void __assert_fail(const char *assertion, const char *file, unsigned line,
-  const char *function);
-#define assert(x) \
-   ({ if (!(x) && _DEBUG) \
-   __assert_fail(#x, __FILE__, __LINE__, __func__); })
+#include 
 
 typedef void (interrupt_handler_t)(void *);
 
diff --git a/include/log.h b/include/log.h
new file mode 100644
index 00..08ad44cf49
--- /dev/null
+++ b/include/log.h
@@ -0,0 +1,59 @@
+/*
+ * Logging support
+ *
+ * Copyright (c) 2017 Google, Inc
+ * Written by Simon Glass 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#ifndef __LOG_H
+#define __LOG_H
+
+#ifdef DEBUG
+#define _DEBUG 1
+#else
+#define _DEBUG 0
+#endif
+
+#ifdef CONFIG_SPL_BUILD
+#define _SPL_BUILD 1
+#else
+#define _SPL_BUILD 0
+#endif
+
+/*
+ * Output a debug text when condition "cond" is met. The "cond" should be
+ * computed by a preprocessor in the best case, allowing for the best
+ * optimization.
+ */
+#define debug_cond(cond, fmt, args...) \
+   do {\
+   if (cond)   \
+   printf(pr_fmt(fmt), ##args);\
+   } while (0)
+
+/* Show a message if DEBUG is defined in a file */
+#define debug(fmt, args...)\
+   debug_cond(_DEBUG, fmt, ##args)
+
+/* Show a message if not in SPL */
+#define warn_non_spl(fmt, args...) \
+   debug_cond(!_SPL_BUILD, fmt, ##args)
+
+/*
+ * An assertion is run-time check done in debug mode only. If DEBUG is not
+ * defined then it is skipped. If DEBUG is defined and the assertion fails,
+ * then it calls panic*( which may or may not reset/halt U-Boot (see
+ * CONFIG_PANIC_HANG), It is hoped that all failing assertions are found
+ * before release, and after release it is hoped that they don't matter. But
+ * in any case these failing assertions cannot be fixed with a reset (which
+ * may just do the same assertion again).
+ */
+void __assert_fail(const char *assertion, const char *file, unsigned int line,
+  const char *function);
+#define assert(x) \
+   ({ if (!(x) && _DEBUG) \
+   __assert_fail(#x, __FILE__, __LINE__, __func__); })
+
+#endif
-- 
2.15.0.531.g2ccb3012c9-goog

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


[U-Boot] [PATCH v4 07/15] Drop the log buffer

2017-12-04 Thread Simon Glass
This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

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

Changes in v4: None
Changes in v3: None
Changes in v2: None

 cmd/Makefile  |   1 -
 cmd/log.c | 313 --
 common/board_f.c  |  18 ---
 common/board_r.c  |  25 +--
 common/image.c|   9 --
 common/stdio.c|   6 -
 include/asm-generic/global_data.h |   2 +-
 include/logbuff.h |  49 --
 include/post.h|   4 +-
 post/post.c   |   9 --
 post/tests.c  |   4 -
 scripts/config_whitelist.txt  |   1 -
 12 files changed, 5 insertions(+), 436 deletions(-)
 delete mode 100644 cmd/log.c
 delete mode 100644 include/logbuff.h

diff --git a/cmd/Makefile b/cmd/Makefile
index 2b0444d5b7..f9eb76090d 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -76,7 +76,6 @@ obj-$(CONFIG_LED_STATUS_CMD) += legacy_led.o
 obj-$(CONFIG_CMD_LED) += led.o
 obj-$(CONFIG_CMD_LICENSE) += license.o
 obj-y += load.o
-obj-$(CONFIG_LOGBUFFER) += log.o
 obj-$(CONFIG_ID_EEPROM) += mac.o
 obj-$(CONFIG_CMD_MD5SUM) += md5sum.o
 obj-$(CONFIG_CMD_MEMORY) += mem.o
diff --git a/cmd/log.c b/cmd/log.c
deleted file mode 100644
index 7a3bd5cd69..00
--- a/cmd/log.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * (C) Copyright 2002-2007
- * Detlev Zundel, DENX Software Engineering, d...@denx.de.
- *
- * Code used from linux/kernel/printk.c
- * Copyright (C) 1991, 1992  Linus Torvalds
- *
- * SPDX-License-Identifier:GPL-2.0+
- *
- * Comments:
- *
- * After relocating the code, the environment variable "loglevel" is
- * copied to console_loglevel.  The functionality is similar to the
- * handling in the Linux kernel, i.e. messages logged with a priority
- * less than console_loglevel are also output to stdout.
- *
- * If you want messages with the default level (e.g. POST messages) to
- * appear on stdout also, make sure the environment variable
- * "loglevel" is set at boot time to a number higher than
- * default_message_loglevel below.
- */
-
-/*
- * Logbuffer handling routines
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-DECLARE_GLOBAL_DATA_PTR;
-
-/* Local prototypes */
-static void logbuff_putc(struct stdio_dev *dev, const char c);
-static void logbuff_puts(struct stdio_dev *dev, const char *s);
-static int logbuff_printk(const char *line);
-
-static char buf[1024];
-
-/* This combination will not print messages with the default loglevel */
-static unsigned console_loglevel = 3;
-static unsigned default_message_loglevel = 4;
-static unsigned log_version = 1;
-#ifdef CONFIG_ALT_LB_ADDR
-static volatile logbuff_t *log;
-#else
-static logbuff_t *log;
-#endif
-static char *lbuf;
-
-unsigned long __logbuffer_base(void)
-{
-   return CONFIG_SYS_SDRAM_BASE + get_effective_memsize() - LOGBUFF_LEN;
-}
-unsigned long logbuffer_base(void)
-__attribute__((weak, alias("__logbuffer_base")));
-
-void logbuff_init_ptrs(void)
-{
-   unsigned long tag, post_word;
-   char *s;
-
-#ifdef CONFIG_ALT_LB_ADDR
-   log = (logbuff_t *)CONFIG_ALT_LH_ADDR;
-   lbuf = (char *)CONFIG_ALT_LB_ADDR;
-#else
-   log = (logbuff_t *)(logbuffer_base()) - 1;
-   lbuf = (char *)log->buf;
-#endif
-
-   /* Set up log version */
-   s = env_get("logversion");
-   if (s)
-   log_version = (int)simple_strtoul(s, NULL, 10);
-
-   if (log_version == 2)
-   tag = log->v2.tag;
-   else
-   tag = log->v1.tag;
-   post_word = post_word_load();
-#ifdef CONFIG_POST
-   /* The post routines have setup the word so we can simply test it */
-   if (tag != LOGBUFF_MAGIC || (post_word & POST_COLDBOOT))
-   logbuff_reset();
-#else
-   /* No post routines, so we do our own checking*/
-   if (tag != LOGBUFF_MAGIC || post_word != LOGBUFF_MAGIC) {
-   logbuff_reset ();
-   post_word_store (LOGBUFF_MAGIC);
-   }
-#endif
-   if (log_version == 2 && (long)log->v2.start > (long)log->v2.con)
-   log->v2.start = log->v2.con;
-
-   /* Initialize default loglevel if present */
-   s = env_get("loglevel");
-   if (s)
-   console_loglevel = (int)simple_strtoul(s, NULL, 10);
-
-   gd->flags |= GD_FLG_LOGINIT;
-}
-
-void logbuff_reset(void)
-{
-#ifndef CONFIG_ALT_LB_ADDR
-   memset(log, 0, sizeof(logbuff_t));
-#endif
-   if (log_version == 2) {
-   log->v2.tag = LOGBUFF_MAGIC;
-#ifdef CONFIG_ALT_LB_ADDR
-   log->v2.start = 0;
-   log->v2.con = 0;
-   log->v2.end = 0;
-   log->v2.chars = 0;
-#endif
-   } else {
-   log->v1.tag = LOGBUFF_MAGIC;
-#ifdef CONFIG_ALT_LB_ADDR
-   log->v1.dummy = 0;
-   log->v1.start = 0;
- 

[U-Boot] [PATCH v4 12/15] log: Plumb logging into the init sequence

2017-12-04 Thread Simon Glass
Set up logging both before and after relocation.

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

Changes in v4: None
Changes in v3: None
Changes in v2: None

 common/board_f.c  | 5 -
 common/board_r.c  | 2 ++
 common/log.c  | 1 +
 include/asm-generic/global_data.h | 1 +
 4 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/common/board_f.c b/common/board_f.c
index 1e8bf63ec1..e46eceda7d 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -751,6 +751,7 @@ static const init_fnc_t init_sequence_f[] = {
trace_early_init,
 #endif
initf_malloc,
+   log_init,
initf_bootstage,/* uses its own timer, so does not need DM */
initf_console_record,
 #if defined(CONFIG_HAVE_FSP)
@@ -932,8 +933,10 @@ void board_init_f_r(void)
 * The pre-relocation drivers may be using memory that has now gone
 * away. Mark serial as unavailable - this will fall back to the debug
 * UART if available.
+*
+* Do the same with log drivers since the memory may not be available.
 */
-   gd->flags &= ~GD_FLG_SERIAL_READY;
+   gd->flags &= ~(GD_FLG_SERIAL_READY | GD_FLG_LOG_READY);
 #ifdef CONFIG_TIMER
gd->timer = NULL;
 #endif
diff --git a/common/board_r.c b/common/board_r.c
index 89729d7736..09167c13cc 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -691,6 +691,7 @@ static init_fnc_t init_sequence_r[] = {
 #endif
initr_barrier,
initr_malloc,
+   log_init,
initr_bootstage,/* Needs malloc() but has its own timer */
initr_console_record,
 #ifdef CONFIG_SYS_NONCACHED_MEMORY
@@ -884,6 +885,7 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
 #if !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
gd = new_gd;
 #endif
+   gd->flags &= ~GD_FLG_LOG_READY;
 
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
for (i = 0; i < ARRAY_SIZE(init_sequence_r); i++)
diff --git a/common/log.c b/common/log.c
index 8f36c79c26..45e46dd520 100644
--- a/common/log.c
+++ b/common/log.c
@@ -238,6 +238,7 @@ int log_init(void)
  (struct list_head *)&gd->log_head);
drv++;
}
+   gd->flags |= GD_FLG_LOG_READY;
gd->default_log_level = LOGL_INFO;
 
return 0;
diff --git a/include/asm-generic/global_data.h 
b/include/asm-generic/global_data.h
index 77755dbb06..73e036d6fd 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -146,5 +146,6 @@ typedef struct global_data {
 #define GD_FLG_RECORD  0x01000 /* Record console  */
 #define GD_FLG_ENV_DEFAULT 0x02000 /* Default variable flag   */
 #define GD_FLG_SPL_EARLY_INIT  0x04000 /* Early SPL init is done  */
+#define GD_FLG_LOG_READY   0x08000 /* Log system is ready for use */
 
 #endif /* __ASM_GENERIC_GBL_DATA_H */
-- 
2.15.0.531.g2ccb3012c9-goog

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


[U-Boot] [PATCH v4 05/15] mtdparts: Correct use of debug()

2017-12-04 Thread Simon Glass
The debug() macro now evaluates its expression so does not need #ifdef
protection. In fact the current code causes a warning with the new log
implementation. Adjust the code to fix this.

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

Changes in v4: None
Changes in v3: None
Changes in v2: None

 cmd/mtdparts.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c
index 3275eb919b..13677faf4b 100644
--- a/cmd/mtdparts.c
+++ b/cmd/mtdparts.c
@@ -873,15 +873,12 @@ static int device_parse(const char *const mtd_dev, const 
char **ret, struct mtd_
return 1;
}
 
-#ifdef DEBUG
pend = strchr(p, ';');
-#endif
debug("dev type = %d (%s), dev num = %d, mtd-id = %s\n",
id->type, MTD_DEV_TYPE(id->type),
id->num, id->mtd_id);
debug("parsing partitions %.*s\n", (int)(pend ? pend - p : strlen(p)), 
p);
 
-
/* parse partitions */
num_parts = 0;
 
-- 
2.15.0.531.g2ccb3012c9-goog

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


[U-Boot] [PATCH v4 09/15] log: Add a console driver

2017-12-04 Thread Simon Glass
It is useful to display log messages on the console. Add a simple driver
to handle this.

Note that this driver outputs to the console, which may be serial or
video. It does not specifically select serial output.

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

Changes in v4: None
Changes in v3: None
Changes in v2:
- Update commit message to explain that this is not just for serial output

 common/Kconfig   | 20 
 common/Makefile  |  1 +
 common/log_console.c | 23 +++
 3 files changed, 44 insertions(+)
 create mode 100644 common/log_console.c

diff --git a/common/Kconfig b/common/Kconfig
index 9747443feb..1b157e47c3 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -474,6 +474,26 @@ config SPL_LOG_MAX_LEVEL
6 - detail
7 - debug
 
+config LOG_CONSOLE
+   bool "Allow log output to the console"
+   depends on LOG
+   default y
+   help
+ Enables a log driver which writes log records to the console.
+ Generally the console is the serial port or LCD display. Only the
+ log message is shown - other details like level, category, file and
+ line number are omitted.
+
+config LOG_SPL_CONSOLE
+   bool "Allow log output to the console in SPL"
+   depends on LOG_SPL
+   default y
+   help
+ Enables a log driver which writes log records to the console.
+ Generally the console is the serial port or LCD display. Only the
+ log message is shown - other details like level, category, file and
+ line number are omitted.
+
 endmenu
 
 config DEFAULT_FDT_FILE
diff --git a/common/Makefile b/common/Makefile
index f4b632761f..14166209fe 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -129,5 +129,6 @@ obj-$(CONFIG_FSL_DDR_INTERACTIVE) += cli_simple.o 
cli_readline.o
 obj-$(CONFIG_CMD_DFU) += dfu.o
 obj-y += command.o
 obj-$(CONFIG_$(SPL_)LOG) += log.o
+obj-$(CONFIG_$(SPL_)LOG_CONSOLE) += log_console.o
 obj-y += s_record.o
 obj-y += xyzModem.o
diff --git a/common/log_console.c b/common/log_console.c
new file mode 100644
index 00..5af73bd8be
--- /dev/null
+++ b/common/log_console.c
@@ -0,0 +1,23 @@
+/*
+ * Logging support
+ *
+ * Copyright (c) 2017 Google, Inc
+ * Written by Simon Glass 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+
+static int log_console_emit(struct log_device *ldev, struct log_rec *rec)
+{
+   puts(rec->msg);
+
+   return 0;
+}
+
+LOG_DRIVER(console) = {
+   .name   = "console",
+   .emit   = log_console_emit,
+};
-- 
2.15.0.531.g2ccb3012c9-goog

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


[U-Boot] [PATCH v4 03/15] Revert "sandbox: Drop special case console code for sandbox"

2017-12-04 Thread Simon Glass
While sandbox works OK without the special-case code, it does result in
console output being stored in the pre-console buffer while sandbox starts
up. If there is a crash or a problem then there is no indication of what
is going on.

For ease of debugging it seems better to revert this change also.

This reverts commit d8c6fb8cedbc35eee27730a7fa544e499b3c81cc.

Signed-off-by: Simon Glass 
---

Changes in v4: None
Changes in v3: None
Changes in v2: None

 common/console.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/common/console.c b/common/console.c
index d763f2c684..0e0295514b 100644
--- a/common/console.c
+++ b/common/console.c
@@ -489,6 +489,13 @@ static inline void print_pre_console_buffer(int 
flushpoint) {}
 
 void putc(const char c)
 {
+#ifdef CONFIG_SANDBOX
+   /* sandbox can send characters to stdout before it has a console */
+   if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) {
+   os_putc(c);
+   return;
+   }
+#endif
 #ifdef CONFIG_DEBUG_UART
/* if we don't have a console yet, use the debug UART */
if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) {
-- 
2.15.0.531.g2ccb3012c9-goog

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


[U-Boot] [PATCH v4 02/15] sandbox: Adjust pre-console address to avoid conflict

2017-12-04 Thread Simon Glass
We cannot use sandbox memory at 0 since other things use memory at that
address. Move it up out of the way.

Note that the pre-console buffer is currently disabled with sandbox, but
this change will avoid confusion if it is manually enabled.

Signed-off-by: Simon Glass 
---

Changes in v4: None
Changes in v3: None
Changes in v2:
- Split pre-console address change into a separate patch

 configs/sandbox_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 08eec8ecc6..b8d1e8cf31 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -15,7 +15,7 @@ CONFIG_CONSOLE_RECORD=y
 CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000
 CONFIG_SILENT_CONSOLE=y
 CONFIG_PRE_CONSOLE_BUFFER=y
-CONFIG_PRE_CON_BUF_ADDR=0
+CONFIG_PRE_CON_BUF_ADDR=0x10
 CONFIG_CMD_CPU=y
 CONFIG_CMD_LICENSE=y
 CONFIG_CMD_BOOTZ=y
-- 
2.15.0.531.g2ccb3012c9-goog

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


[U-Boot] [PATCH v4 08/15] log: Add an implementation of logging

2017-12-04 Thread Simon Glass
Add the logging header file and implementation with some configuration
options to control it.

Signed-off-by: Simon Glass 
---

Changes in v4:
- Add an extra tab in the debug_cond() macro
- Handle casting uclass ID to lgo category (for clang)

Changes in v3: None
Changes in v2:
- Add a comment as to why CONFIG_LOG_MAX_LEVEL is not defined
- Drop MAINTAINERS entries for files not added by this patch
- Drop the use of 'continue' in the macro
- Fix LOG_SPL_MAX_LEVEL typo (should be SPL_LOG_MAX_LEVEL)
- Fix up bad use of #if CONFIG_VAL() - use #ifdef instead
- Line up log levels with Linux

 MAINTAINERS   |   7 ++
 common/Kconfig|  56 +
 common/Makefile   |   1 +
 common/log.c  | 244 ++
 include/asm-generic/global_data.h |   5 +
 include/log.h | 242 +
 6 files changed, 555 insertions(+)
 create mode 100644 common/log.c

diff --git a/MAINTAINERS b/MAINTAINERS
index c024b41f13..7cda6896ea 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -310,6 +310,13 @@ S: Maintained
 T: git git://git.denx.de/u-boot-i2c.git
 F: drivers/i2c/
 
+LOGGING
+M: Simon Glass 
+S: Maintained
+T: git git://git.denx.de/u-boot.git
+F: common/log.c
+F: cmd/log.c
+
 MICROBLAZE
 M: Michal Simek 
 S: Maintained
diff --git a/common/Kconfig b/common/Kconfig
index c50d6ebb2a..9747443feb 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -420,6 +420,62 @@ config SYS_STDIO_DEREGISTER
 
 endmenu
 
+menu "Logging"
+
+config LOG
+   bool "Enable logging support"
+   help
+ This enables support for logging of status and debug messages. These
+ can be displayed on the console, recorded in a memory buffer, or
+ discarded if not needed. Logging supports various categories and
+ levels of severity.
+
+config SPL_LOG
+   bool "Enable logging support in SPL"
+   help
+ This enables support for logging of status and debug messages. These
+ can be displayed on the console, recorded in a memory buffer, or
+ discarded if not needed. Logging supports various categories and
+ levels of severity.
+
+config LOG_MAX_LEVEL
+   int "Maximum log level to record"
+   depends on LOG
+   default 5
+   help
+ This selects the maximum log level that will be recorded. Any value
+ higher than this will be ignored. If possible log statements below
+ this level will be discarded at build time. Levels:
+
+   0 - panic
+   1 - critical
+   2 - error
+   3 - warning
+   4 - note
+   5 - info
+   6 - detail
+   7 - debug
+
+config SPL_LOG_MAX_LEVEL
+   int "Maximum log level to record in SPL"
+   depends on SPL_LOG
+   default 3
+   help
+ This selects the maximum log level that will be recorded. Any value
+ higher than this will be ignored. If possible log statements below
+ this level will be discarded at build time. Levels:
+
+   0 - panic
+   1 - critical
+   2 - error
+   3 - warning
+   4 - note
+   5 - info
+   6 - detail
+   7 - debug
+
+endmenu
+
 config DEFAULT_FDT_FILE
string "Default fdt file"
help
diff --git a/common/Makefile b/common/Makefile
index cec506fe3e..f4b632761f 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -128,5 +128,6 @@ obj-y += cli.o
 obj-$(CONFIG_FSL_DDR_INTERACTIVE) += cli_simple.o cli_readline.o
 obj-$(CONFIG_CMD_DFU) += dfu.o
 obj-y += command.o
+obj-$(CONFIG_$(SPL_)LOG) += log.o
 obj-y += s_record.o
 obj-y += xyzModem.o
diff --git a/common/log.c b/common/log.c
new file mode 100644
index 00..8f36c79c26
--- /dev/null
+++ b/common/log.c
@@ -0,0 +1,244 @@
+/*
+ * Logging support
+ *
+ * Copyright (c) 2017 Google, Inc
+ * Written by Simon Glass 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static struct log_device *log_device_find_by_name(const char *drv_name)
+{
+   struct log_device *ldev;
+
+   list_for_each_entry(ldev, &gd->log_head, sibling_node) {
+   if (!strcmp(drv_name, ldev->drv->name))
+   return ldev;
+   }
+
+   return NULL;
+}
+
+/**
+ * log_has_cat() - check if a log category exists within a list
+ *
+ * @cat_list: List of categories to check, at most LOGF_MAX_CATEGORIES entries
+ * long, terminated by LC_END if fewer
+ * @cat: Category to search for
+ * @return true if @cat is in @cat_list, else false
+ */
+static bool log_has_cat(enum log_category_t cat_list[], enum log_category_t 
cat)
+{
+   int i;
+
+   for (i = 0; i < LOGF_MAX_CATEGORIES && cat_list[i] != LOGC_END; i++) {
+   if (cat_list[i] == cat)
+   return true;
+   }
+
+   return false;
+}
+

[U-Boot] [PATCH v4 06/15] usb: Correct use of debug()

2017-12-04 Thread Simon Glass
With clang this gives a warning because hubsts appears to be used before
it is set, even if ultimately it is not used. Simplify the code to avoid
this problem.

Signed-off-by: Simon Glass 
---

Changes in v4:
- Add new patch to correct use of debug() in usb_hub.c

Changes in v3: None
Changes in v2: None

 common/usb_hub.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/common/usb_hub.c b/common/usb_hub.c
index 024dadb277..b46dfa16cc 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -625,7 +625,7 @@ static int usb_hub_configure(struct usb_device *dev)
short hubCharacteristics;
struct usb_hub_descriptor *descriptor;
struct usb_hub_device *hub;
-   __maybe_unused struct usb_hub_status *hubsts;
+   struct usb_hub_status *hubsts;
int ret;
 
hub = usb_get_hub_device(dev);
@@ -779,9 +779,7 @@ static int usb_hub_configure(struct usb_device *dev)
return ret;
}
 
-#ifdef DEBUG
hubsts = (struct usb_hub_status *)buffer;
-#endif
 
debug("get_hub_status returned status %X, change %X\n",
  le16_to_cpu(hubsts->wHubStatus),
-- 
2.15.0.531.g2ccb3012c9-goog

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


[U-Boot] [PATCH v4 10/15] log: Add a 'log level' command

2017-12-04 Thread Simon Glass
Add a command for adjusting the log level.

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

Changes in v4: None
Changes in v3: None
Changes in v2: None

 cmd/Kconfig  |  7 +++
 cmd/Makefile |  1 +
 cmd/log.c| 55 +++
 3 files changed, 63 insertions(+)
 create mode 100644 cmd/log.c

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 5a6afab99b..b745a7e977 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1502,6 +1502,13 @@ config CMD_KGDB
  single-stepping, inspecting variables, etc. This is supported only
  on PowerPC at present.
 
+config CMD_LOG
+   bool "log - Generation, control and access to logging"
+   help
+ This provides access to logging features. It allows the output of
+ log data to be controlled to a limited extent (setting up the default
+ maximum log level for emitting of records).
+
 config CMD_TRACE
bool "trace - Support tracing of function calls and timing"
help
diff --git a/cmd/Makefile b/cmd/Makefile
index f9eb76090d..00e38696da 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -76,6 +76,7 @@ obj-$(CONFIG_LED_STATUS_CMD) += legacy_led.o
 obj-$(CONFIG_CMD_LED) += led.o
 obj-$(CONFIG_CMD_LICENSE) += license.o
 obj-y += load.o
+obj-$(CONFIG_CMD_LOG) += log.o
 obj-$(CONFIG_ID_EEPROM) += mac.o
 obj-$(CONFIG_CMD_MD5SUM) += md5sum.o
 obj-$(CONFIG_CMD_MEMORY) += mem.o
diff --git a/cmd/log.c b/cmd/log.c
new file mode 100644
index 00..44e04ab16a
--- /dev/null
+++ b/cmd/log.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017 Google, Inc
+ * Written by Simon Glass 
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+static int do_log_level(cmd_tbl_t *cmdtp, int flag, int argc,
+   char * const argv[])
+{
+   if (argc > 1)
+   gd->default_log_level = simple_strtol(argv[1], NULL, 10);
+   else
+   printf("Default log level: %d\n", gd->default_log_level);
+
+   return 0;
+}
+
+static cmd_tbl_t log_sub[] = {
+   U_BOOT_CMD_MKENT(level, CONFIG_SYS_MAXARGS, 1, do_log_level, "", ""),
+};
+
+static int do_log(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+   cmd_tbl_t *cp;
+
+   if (argc < 2)
+   return CMD_RET_USAGE;
+
+   /* drop initial "log" arg */
+   argc--;
+   argv++;
+
+   cp = find_cmd_tbl(argv[0], log_sub, ARRAY_SIZE(log_sub));
+   if (cp)
+   return cp->cmd(cmdtp, flag, argc, argv);
+
+   return CMD_RET_USAGE;
+}
+
+#ifdef CONFIG_SYS_LONGHELP
+static char log_help_text[] =
+   "level - get/set log level\n"
+   ;
+#endif
+
+U_BOOT_CMD(
+   log, CONFIG_SYS_MAXARGS, 1, do_log,
+   "log system", log_help_text
+);
-- 
2.15.0.531.g2ccb3012c9-goog

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


[U-Boot] [PATCH v4 11/15] log: Add a test command

2017-12-04 Thread Simon Glass
Add a command which exercises the logging system.

Signed-off-by: Simon Glass 
---

Changes in v4:
- Handle casting uclass ID to lgo category (for clang)

Changes in v3: None
Changes in v2:
- Fix function called when test command is selected
- Fix help output for 'log test'
- Rename LOGL_WARN to LOGL_WARNING

 MAINTAINERS |   1 +
 cmd/Kconfig |   3 +-
 cmd/log.c   |   6 ++
 common/Kconfig  |  10 +++
 include/log.h   |   3 +
 test/Makefile   |   1 +
 test/log/Makefile   |   7 ++
 test/log/log_test.c | 205 
 8 files changed, 235 insertions(+), 1 deletion(-)
 create mode 100644 test/log/Makefile
 create mode 100644 test/log/log_test.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 7cda6896ea..9d8a82eaa9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -316,6 +316,7 @@ S:  Maintained
 T: git git://git.denx.de/u-boot.git
 F: common/log.c
 F: cmd/log.c
+F: test/log/log_test.c
 
 MICROBLAZE
 M: Michal Simek 
diff --git a/cmd/Kconfig b/cmd/Kconfig
index b745a7e977..c033223526 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1507,7 +1507,8 @@ config CMD_LOG
help
  This provides access to logging features. It allows the output of
  log data to be controlled to a limited extent (setting up the default
- maximum log level for emitting of records).
+ maximum log level for emitting of records). It also provides access
+ to a command used for testing the log system.
 
 config CMD_TRACE
bool "trace - Support tracing of function calls and timing"
diff --git a/cmd/log.c b/cmd/log.c
index 44e04ab16a..abc523b497 100644
--- a/cmd/log.c
+++ b/cmd/log.c
@@ -23,6 +23,9 @@ static int do_log_level(cmd_tbl_t *cmdtp, int flag, int argc,
 
 static cmd_tbl_t log_sub[] = {
U_BOOT_CMD_MKENT(level, CONFIG_SYS_MAXARGS, 1, do_log_level, "", ""),
+#ifdef CONFIG_LOG_TEST
+   U_BOOT_CMD_MKENT(test, 2, 1, do_log_test, "", ""),
+#endif
 };
 
 static int do_log(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
@@ -46,6 +49,9 @@ static int do_log(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
 #ifdef CONFIG_SYS_LONGHELP
 static char log_help_text[] =
"level - get/set log level\n"
+#ifdef CONFIG_LOG_TEST
+   "log test - run log tests\n"
+#endif
;
 #endif
 
diff --git a/common/Kconfig b/common/Kconfig
index 1b157e47c3..4da095a4fd 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -494,6 +494,16 @@ config LOG_SPL_CONSOLE
  log message is shown - other details like level, category, file and
  line number are omitted.
 
+config LOG_TEST
+   bool "Provide a test for logging"
+   depends on LOG
+   default y if SANDBOX
+   help
+ This enables a 'log test' command to test logging. It is normally
+ executed from a pytest and simply outputs logging information
+ in various different ways to test that the logging system works
+ correctly with varoius settings.
+
 endmenu
 
 config DEFAULT_FDT_FILE
diff --git a/include/log.h b/include/log.h
index 1e9124c3f8..8083b64831 100644
--- a/include/log.h
+++ b/include/log.h
@@ -256,6 +256,9 @@ struct log_filter {
 #define LOG_DRIVER(_name) \
ll_entry_declare(struct log_driver, _name, log_driver)
 
+/* Handle the 'log test' command */
+int do_log_test(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
+
 /**
  * log_add_filter() - Add a new filter to a log device
  *
diff --git a/test/Makefile b/test/Makefile
index 6305afb211..40f2244b79 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -10,3 +10,4 @@ obj-$(CONFIG_SANDBOX) += command_ut.o
 obj-$(CONFIG_SANDBOX) += compression.o
 obj-$(CONFIG_SANDBOX) += print_ut.o
 obj-$(CONFIG_UT_TIME) += time_ut.o
+obj-$(CONFIG_$(SPL_)LOG) += log/
diff --git a/test/log/Makefile b/test/log/Makefile
new file mode 100644
index 00..b0da8dee28
--- /dev/null
+++ b/test/log/Makefile
@@ -0,0 +1,7 @@
+#
+# Copyright (c) 2017 Google, Inc
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-$(CONFIG_LOG_TEST) += log_test.o
diff --git a/test/log/log_test.c b/test/log/log_test.c
new file mode 100644
index 00..2c6227703f
--- /dev/null
+++ b/test/log/log_test.c
@@ -0,0 +1,205 @@
+/*
+ * Logging support test program
+ *
+ * Copyright (c) 2017 Google, Inc
+ * Written by Simon Glass 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+
+/* emit some sample log records in different ways, for testing */
+static int log_run(enum uclass_id cat, const char *file)
+{
+   int i;
+
+   debug("debug\n");
+   for (i = LOGL_FIRST; i < LOGL_COUNT; i++) {
+   log(cat, i, "log %d\n", i);
+   _log(log_uc_cat(cat), i, file, 100 + i, "func", "_log %d\n",
+i);
+   }
+
+   return 0;
+}
+
+static int log_test(int testnum)
+{
+   int ret;
+
+   printf("test %d\n", testnum);
+   switch (testnum) {
+   case 0: {
+   /

[U-Boot] [PATCH v4 15/15] log: Add documentation

2017-12-04 Thread Simon Glass
Add documentation for the log system.

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

Changes in v4: None
Changes in v3:
- Rebase to master

Changes in v2:
- Drop the special log() functions from the README

 doc/README.log | 214 +
 1 file changed, 214 insertions(+)
 create mode 100644 doc/README.log

diff --git a/doc/README.log b/doc/README.log
new file mode 100644
index 00..f653fe7d79
--- /dev/null
+++ b/doc/README.log
@@ -0,0 +1,214 @@
+Logging in U-Boot
+=
+
+Introduction
+
+
+U-Boot's internal operation involves many different steps and actions. From
+setting up the board to displaying a start-up screen to loading an Operating
+System, there are many component parts each with many actions.
+
+Most of the time this internal detail is not useful. Displaying it on the
+console would delay booting (U-Boot's primary purpose) and confuse users.
+
+But for digging into what is happening in a particular area, or for debugging
+a problem it is often useful to see what U-Boot is doing in more detail than
+is visible from the basic console output.
+
+U-Boot's logging feature aims to satisfy this goal for both users and
+developers.
+
+
+Logging levels
+--
+
+There are a number logging levels available, in increasing order of verbosity:
+
+   LOGL_EMERG  - Printed before U-Boot halts
+   LOGL_ALERT  - Indicates action must be taken immediate or U-Boot will crash
+   LOGL_CRIT   - Indicates a critical error that will cause boot failure
+   LOGL_ERR- Indicates an error that may cause boot failure
+   LOGL_WARNING- Warning about an unexpected condition
+   LOGL_NOTE   - Important information about progress
+   LOGL_INFO   - Information about normal boot progress
+   LOGL_DEBUG  - Debug information (useful for debugging a driver or subsystem)
+   LOGL_DEBUG_CONTENT  - Debug message showing full message content
+   LOGL_DEBUG_IO   - Debug message showing hardware I/O access
+
+
+Logging category
+
+
+Logging can come from a wide variety of places within U-Boot. Each log message
+has a category which is intended to allow messages to be filtered according to
+their source.
+
+The following main categories are defined:
+
+   LOGC_NONE   - Unknown category (e.g. a debug() statement)
+   UCLASS_...  - Related to a particular uclass (e.g. UCLASS_USB)
+   LOGC_ARCH   - Related to architecture-specific code
+   LOGC_BOARD  - Related to board-specific code
+   LOGC_CORE   - Related to core driver-model support
+   LOGC_DT - Related to device tree control
+
+
+Enabling logging
+
+
+The following options are used to enable logging at compile time:
+
+   CONFIG_LOG  - Enables the logging system
+   CONFIG_MAX_LOG_LEVEL - Max log level to build (anything higher is compiled
+   out)
+   CONFIG_LOG_CONSOLE  - Enable writing log records to the console
+
+If CONFIG_LOG is not set, then no logging will be available.
+
+The above have SPL versions also, e.g. CONFIG_SPL_MAX_LOG_LEVEL.
+
+
+Using DEBUG
+---
+
+U-Boot has traditionally used a #define called DEBUG to enable debugging on a
+file-by-file basis. The debug() macro compiles to a printf() statement if
+DEBUG is enabled, and an empty statement if not.
+
+With logging enabled, debug() statements are interpreted as logging output
+with a level of LOGL_DEBUG and a category of LOGC_NONE.
+
+The logging facilities are intended to replace DEBUG, but if DEBUG is defined
+at the top of a file, then it takes precedence. This means that debug()
+statements will result in output to the console and this output will not be
+logged.
+
+
+Logging destinations
+
+
+If logging information goes nowhere then it serves no purpose. U-Boot provides
+several possible determinations for logging information, all of which can be
+enabled or disabled independently:
+
+   console - goes to stdout
+
+
+Filters
+---
+
+Filters are attached to log drivers to control what those drivers emit. Only
+records that pass through the filter make it to the driver.
+
+Filters can be based on several criteria:
+
+   - maximum log level
+   - in a set of categories
+   - in a set of files
+
+If no filters are attached to a driver then a default filter is used, which
+limits output to records with a level less than CONFIG_LOG_MAX_LEVEL.
+
+
+Logging statements
+--
+
+The main logging function is:
+
+   log(category, level, format_string, ...)
+
+Also debug() and error() will generate log records  - these use LOG_CATEGORY
+as the category, so you should #define this right at the top of the source
+file to ensure the category is correct.
+
+
+Code size
+-
+
+Code size impact depends largely on what is enabled. The following numbers are
+for snow, which is a Thumb-2 board:
+
+This series: adds bss +20.0 data +4.0 rodata +4.0 text +44.0
+CONFIG_LOG: bss -52.0 data +92.0 rodat

[U-Boot] [PATCH v4 14/15] log: test: Add a pytest for logging

2017-12-04 Thread Simon Glass
Add a test which tries out various filters and options to make sure that
logging works as expected.

Signed-off-by: Simon Glass 
---

Changes in v4: None
Changes in v3: None
Changes in v2:
- Change log levels to match new header
- Only execute log tests if CONFIG_LOG is enabled
- Rename LOGL_WARN to LOGL_WARNING

 MAINTAINERS   |   1 +
 test/py/tests/test_log.py | 101 ++
 2 files changed, 102 insertions(+)
 create mode 100644 test/py/tests/test_log.py

diff --git a/MAINTAINERS b/MAINTAINERS
index 9d8a82eaa9..e1227f847c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -317,6 +317,7 @@ T:  git git://git.denx.de/u-boot.git
 F: common/log.c
 F: cmd/log.c
 F: test/log/log_test.c
+F: test/py/tests/test_log.py
 
 MICROBLAZE
 M: Michal Simek 
diff --git a/test/py/tests/test_log.py b/test/py/tests/test_log.py
new file mode 100644
index 00..fa9a25e8dc
--- /dev/null
+++ b/test/py/tests/test_log.py
@@ -0,0 +1,101 @@
+# Copyright (c) 2016, Google Inc.
+#
+# SPDX-License-Identifier:  GPL-2.0+
+#
+# U-Boot Verified Boot Test
+
+"""
+This tests U-Boot logging. It uses the 'log test' command with various options
+and checks that the output is correct.
+"""
+
+import pytest
+
+LOGL_FIRST, LOGL_WARNING, LOGL_INFO = (0, 4, 6)
+
+@pytest.mark.buildconfigspec('log')
+def test_log(u_boot_console):
+"""Test that U-Boot logging works correctly."""
+def check_log_entries(lines, mask, max_level=LOGL_INFO):
+"""Check that the expected log records appear in the output
+
+Args:
+lines: iterator containing lines to check
+mask: bit mask to select which lines to check for:
+bit 0: standard log line
+bit 1: _log line
+max_level: maximum log level to expect in the output
+"""
+for i in range(max_level):
+if mask & 1:
+assert 'log %d' % i == lines.next()
+if mask & 3:
+assert '_log %d' % i == lines.next()
+
+def run_test(testnum):
+"""Run a particular test number (the 'log test' command)
+
+Args:
+testnum: Test number to run
+Returns:
+iterator containing the lines output from the command
+"""
+
+with cons.log.section('basic'):
+   output = u_boot_console.run_command('log test %d' % testnum)
+split = output.replace('\r', '').splitlines()
+lines = iter(split)
+assert 'test %d' % testnum == lines.next()
+return lines
+
+def test0():
+lines = run_test(0)
+check_log_entries(lines, 3)
+
+def test1():
+lines = run_test(1)
+check_log_entries(lines, 3)
+
+def test2():
+lines = run_test(2)
+
+def test3():
+lines = run_test(3)
+check_log_entries(lines, 2)
+
+def test4():
+lines = run_test(4)
+assert next(lines, None) == None
+
+def test5():
+lines = run_test(5)
+check_log_entries(lines, 2)
+
+def test6():
+lines = run_test(6)
+check_log_entries(lines, 3)
+
+def test7():
+lines = run_test(7)
+check_log_entries(lines, 3, LOGL_WARNING)
+
+def test8():
+lines = run_test(8)
+check_log_entries(lines, 3)
+
+def test9():
+lines = run_test(9)
+check_log_entries(lines, 3)
+
+# TODO(s...@chromium.org): Consider structuring this as separate tests
+cons = u_boot_console
+test0()
+test1()
+test2()
+test3()
+test4()
+test5()
+test6()
+test7()
+test8()
+test9()
-- 
2.15.0.531.g2ccb3012c9-goog

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


  1   2   >