Re: [PATCH v2] riscv: Fix detecting FPU support in standard extension

2022-11-09 Thread Rick Chen
> From: U-Boot  On Behalf Of Yu Chien Peter Lin
> Sent: Saturday, November 05, 2022 2:02 PM
> To: u-boot@lists.denx.de
> Cc: sam...@sholland.org; Peter Yu-Chien Lin(林宇謙) 
> Subject: [PATCH v2] riscv: Fix detecting FPU support in standard extension
>
> We should check the string until it hits underscore, in case it searches for 
> the letters in the custom extension. For example, "rv64imac_xandes" will be 
> treated as D extension support since there is a "d" in "andes", resulting 
> illegal instruction caused by initializing FCSR.
>
> Signed-off-by: Yu Chien Peter Lin 
> ---
>  arch/riscv/cpu/cpu.c | 14 +++---
>  1 file changed, 11 insertions(+), 3 deletions(-)

Reviewed-by: Rick Chen 


[PATCH 1/1] sandbox: check lseek return value in handle_ufi_command

2022-11-09 Thread Heinrich Schuchardt
Invoking lseek() may result in an error. Handle it.

Addresses-Coverity-ID: 376212 ("Error handling issues  (CHECKED_RETURN)")
Signed-off-by: Heinrich Schuchardt 
---
 drivers/usb/emul/sandbox_flash.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/emul/sandbox_flash.c b/drivers/usb/emul/sandbox_flash.c
index 6e8cfe1650..01ccc4bc17 100644
--- a/drivers/usb/emul/sandbox_flash.c
+++ b/drivers/usb/emul/sandbox_flash.c
@@ -188,15 +188,19 @@ static int handle_ufi_command(struct sandbox_flash_priv 
*priv, const void *buff,
struct scsi_emul_info *info = &priv->eminfo;
const struct scsi_cmd *req = buff;
int ret;
+   off_t offset;
 
ret = sb_scsi_emul_command(info, req, len);
if (!ret) {
setup_response(priv);
} else if ((ret == SCSI_EMUL_DO_READ || ret == SCSI_EMUL_DO_WRITE) &&
   priv->fd != -1) {
-   os_lseek(priv->fd, info->seek_block * info->block_size,
-OS_SEEK_SET);
-   setup_response(priv);
+   offset = os_lseek(priv->fd, info->seek_block * info->block_size,
+ OS_SEEK_SET);
+   if (offset == (off_t)-1)
+   setup_fail_response(priv);
+   else
+   setup_response(priv);
} else {
setup_fail_response(priv);
}
-- 
2.37.2



[PATCH] efi_loader: initialize return values in efi_uninstall_multiple_protocol_interfaces_int()

2022-11-09 Thread Ilias Apalodimas
If the va_list we got handed over contains no protocols we must return
EFI_INVALID_PARAMETER.  However in that case the current code just returns
an unintialized value.

Addresses-Coverity: CID 376195:  ("Uninitialized variables  (UNINIT)")
---
 lib/efi_loader/efi_boottime.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index a56021559bbf..96aa36ef85de 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -2754,7 +2754,7 @@ 
efi_uninstall_multiple_protocol_interfaces_int(efi_handle_t handle,
 {
const efi_guid_t *protocol;
void *protocol_interface;
-   efi_status_t ret;
+   efi_status_t ret = EFI_INVALID_PARAMETER;
size_t i = 0;
efi_va_list argptr_copy;
 
@@ -2765,7 +2765,7 @@ 
efi_uninstall_multiple_protocol_interfaces_int(efi_handle_t handle,
for (;;) {
protocol = efi_va_arg(argptr, efi_guid_t*);
if (!protocol)
-   break;
+   goto out;
protocol_interface = efi_va_arg(argptr, void*);
ret = efi_uninstall_protocol(handle, protocol,
 protocol_interface);
-- 
2.38.1



[PATCH v3 1/2] arm: mediatek: add mt8195 SOC support

2022-11-09 Thread Macpaul Lin
From: Fabien Parent 

The MediaTek MT8195 is a ARM64-based SoC with a quad-core Cortex-A73 and
a quad-core Cortex-A53. It is including UART, SPI, USB3.0 device and hosts,
SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3
and LPDDR4 options.

Signed-off-by: Fabien Parent 
Signed-off-by: Macpaul Lin 

---
 MAINTAINERS|   2 +
 arch/arm/dts/mt8195.dtsi   | 370 +
 arch/arm/mach-mediatek/Kconfig |  13 +-
 arch/arm/mach-mediatek/Makefile|   1 +
 arch/arm/mach-mediatek/mt8195/Makefile |   3 +
 arch/arm/mach-mediatek/mt8195/init.c   |  81 ++
 6 files changed, 469 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/mt8195.dtsi
 create mode 100644 arch/arm/mach-mediatek/mt8195/Makefile
 create mode 100644 arch/arm/mach-mediatek/mt8195/init.c

Changes for v2:
 - Correct node name to t-phy for u3phy0.
 - Add platform compatible string "mediatek,mt8195-tphy" to all usb phy nodes.
 - remove clock nodes that software cannot controlled in phy nodes.
 - Test and add back "mac" for HOST only xhci nodes.

Changes for v3:
 - Revise device node name from "xhciX: xhciX@" to "xhciX: xhci@".

diff --git a/MAINTAINERS b/MAINTAINERS
index 1cf99c1393..5528dd28c3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -362,8 +362,10 @@ ARM MEDIATEK
 M: Ryder Lee 
 M: Weijie Gao 
 M: Chunfeng Yun 
+M: Macpaul Lin 
 R: GSS_MTK_Uboot_upstream 
 S: Maintained
+F: arch/arm/dts/mt8195.dtsi
 F: arch/arm/mach-mediatek/
 F: arch/arm/include/asm/arch-mediatek/
 F: board/mediatek/
diff --git a/arch/arm/dts/mt8195.dtsi b/arch/arm/dts/mt8195.dtsi
new file mode 100644
index 00..33282d21d1
--- /dev/null
+++ b/arch/arm/dts/mt8195.dtsi
@@ -0,0 +1,370 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2022 MediaTek Inc.
+ * Copyright (C) 2022 BayLibre, SAS
+ * Author: Ben Ho 
+ * Erin Lo 
+ * Fabien Parent 
+ * Macpaul Lin 
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+/ {
+   compatible = "mediatek,mt8195";
+   interrupt-parent = <&sysirq>;
+   #address-cells = <2>;
+   #size-cells = <2>;
+
+   cpus {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   cpu-map {
+   cluster0 {
+   core0 {
+   cpu = <&cpu0>;
+   };
+   core1 {
+   cpu = <&cpu1>;
+   };
+   core2 {
+   cpu = <&cpu2>;
+   };
+   core3 {
+   cpu = <&cpu3>;
+   };
+   };
+
+   cluster1 {
+   core0 {
+   cpu = <&cpu4>;
+   };
+   core1 {
+   cpu = <&cpu5>;
+   };
+   core2 {
+   cpu = <&cpu6>;
+   };
+   core3 {
+   cpu = <&cpu7>;
+   };
+   };
+   };
+
+   cpu0: cpu@0 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a53";
+   reg = <0x000>;
+   enable-method = "psci";
+   capacity-dmips-mhz = <741>;
+   };
+
+   cpu1: cpu@1 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a53";
+   reg = <0x001>;
+   enable-method = "psci";
+   capacity-dmips-mhz = <741>;
+   };
+
+   cpu2: cpu@2 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a53";
+   reg = <0x002>;
+   enable-method = "psci";
+   capacity-dmips-mhz = <741>;
+   };
+
+   cpu3: cpu@3 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a53";
+   reg = <0x003>;
+   enable-method = "psci";
+   capacity-dmips-mhz = <741>;
+   };
+
+   cpu4: cpu@100 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a73";
+   reg = <0x100>;
+   enable-method = "psci";
+   capacity-dmips-mhz = <1024>;
+   };
+
+   cpu5: cpu@101 {
+   

[PATCH v3 2/2] board: mediatek: add mt8195 demo board

2022-11-09 Thread Macpaul Lin
From: Fabien Parent 

Add mt8195-demo board support.
This demo purpose board uses MediaTek's MT8195 SoC.

Signed-off-by: Fabien Parent 
Signed-off-by: Amjad Ouled-Ameur 
Signed-off-by: Macpaul Lin 
---
 MAINTAINERS |   1 +
 arch/arm/dts/Makefile   |   1 +
 arch/arm/dts/mt8195-demo.dts| 109 
 board/mediatek/mt8195/MAINTAINERS   |   6 ++
 board/mediatek/mt8195/Makefile  |   3 +
 board/mediatek/mt8195/mt8195_demo.c |  38 ++
 configs/mt8195_demo_defconfig   |  89 +++
 include/configs/mt8195.h|  34 +
 8 files changed, 281 insertions(+)
 create mode 100644 arch/arm/dts/mt8195-demo.dts
 create mode 100644 board/mediatek/mt8195/MAINTAINERS
 create mode 100644 board/mediatek/mt8195/Makefile
 create mode 100644 board/mediatek/mt8195/mt8195_demo.c
 create mode 100644 configs/mt8195_demo_defconfig
 create mode 100644 include/configs/mt8195.h

Changes for v2 and v3:
 - no change.

diff --git a/MAINTAINERS b/MAINTAINERS
index 5528dd28c3..5aaeeb02cb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -389,6 +389,7 @@ F:  drivers/watchdog/mtk_wdt.c
 F: drivers/net/mtk_eth.c
 F: drivers/net/mtk_eth.h
 F: drivers/reset/reset-mediatek.c
+F: include/configs/mt8195.h
 F: tools/mtk_image.c
 F: tools/mtk_image.h
 F: tools/mtk_nand_headers.c
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 791838733c..994f7ebcc0 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -1271,6 +1271,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
mt7986a-emmc-rfb.dtb \
mt7986b-emmc-rfb.dtb \
mt8183-pumpkin.dtb \
+   mt8195-demo.dtb \
mt8512-bm1-emmc.dtb \
mt8516-pumpkin.dtb \
mt8518-ap1-emmc.dtb
diff --git a/arch/arm/dts/mt8195-demo.dts b/arch/arm/dts/mt8195-demo.dts
new file mode 100644
index 00..bd0952b248
--- /dev/null
+++ b/arch/arm/dts/mt8195-demo.dts
@@ -0,0 +1,109 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+/*
+ * Copyright (C) 2022 MediaTek Inc.
+ * Copyright (C) 2022 BayLibre SAS.
+ * Author: Macpaul Lin 
+ * Author: Fabien Parent 
+ */
+
+/dts-v1/;
+
+#include 
+#include "mt8195.dtsi"
+
+/ {
+   model = "MediaTek MT8195 demo board";
+   compatible = "mediatek,mt8195-demo", "mediatek,mt8195";
+
+   memory@4000 {
+   device_type = "memory";
+   reg = <0 0x4000 0 0x8000>;
+   };
+
+   reserved-memory {
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   /* 2 MiB reserved for ARM Trusted Firmware (BL31) */
+   bl31_secmon_reserved: secmon@5460 {
+   no-map;
+   reg = <0 0x5460 0x0 0x20>;
+   };
+
+   /* 12 MiB reserved for OP-TEE (BL32)
+* +---+ 0x43e0_
+* |  SHMEM 2MiB   |
+* +---+ 0x43c0_
+* || TA_RAM  8MiB |
+* + TZDRAM +--+ 0x4340_
+* || TEE_RAM 2MiB |
+* +---+ 0x4320_
+*/
+   optee_reserved: optee@4320 {
+   no-map;
+   reg = <0 0x4320 0 0x00c0>;
+   };
+   };
+
+   chosen {
+   stdout-path = &uart0;
+   };
+
+   reg_1p8v: regulator-1p8v {
+   compatible = "regulator-fixed";
+   regulator-name = "fixed-1.8V";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   regulator-boot-on;
+   regulator-always-on;
+   };
+
+   reg_3p3v: regulator-3p3v {
+   compatible = "regulator-fixed";
+   regulator-name = "fixed-3.3V";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   regulator-boot-on;
+   regulator-always-on;
+   };
+};
+
+&watchdog {
+   status = "okay";
+};
+
+&uart0 {
+   status = "okay";
+};
+
+&mmc0 {
+   bus-width = <4>;
+   max-frequency = <2>;
+   cap-mmc-highspeed;
+   mmc-hs200-1_8v;
+   cap-mmc-hw-reset;
+   vmmc-supply = <®_3p3v>;
+   vqmmc-supply = <®_1p8v>;
+   non-removable;
+   status = "okay";
+};
+
+&usb {
+   status = "okay";
+};
+
+&ssusb {
+   mediatek,force-vbus;
+   maximum-speed = "high-speed";
+   dr_mode = "peripheral";
+   status = "okay";
+};
+
+&xhci0 {
+   status = "okay";
+};
+
+&xhci3 {
+   status = "okay";
+};
diff --git a/board/mediatek/mt8195/MAINTAINERS 
b/board/mediatek/mt8195/MAINTAINERS
new file mode 100644
index 00..01fa25115d
--- /dev/null
+++ b/board/mediatek/mt8195/MAINTAINERS
@@ -0,0 +1,6 @@
+MT8195 Demo
+M: Macpaul Lin 

Re: [PATCH v7 4/5] eficonfig: add UEFI Secure Boot Key enrollment interface

2022-11-09 Thread Masahisa Kojima
On Thu, 10 Nov 2022 at 15:47, Ilias Apalodimas
 wrote:
>
> [...]
>
> > > > + goto out;
> > > > +
> > > > + ret = efi_open_volume_int(file_info.current_volume, &root);
> > > > + if (ret != EFI_SUCCESS)
> > > > + goto out;
> > > > +
> > > > + ret = efi_file_open_int(root, &f, file_info.current_path, 
> > > > EFI_FILE_MODE_READ, 0);
> > > > + if (ret != EFI_SUCCESS)
> > > > + goto out;
> > >
> > > I think it would be better here if we could use efi_file_from_path().
> > > I think we can't easily do that atm since we can't convert the filename to
> > > a device path with efi_dp_from_file() since we don't have the block info.
> >
> > Here we have a device path of volume(file_info.current_volume) and
> > filename(file_info.current_path), so we can create a full device path to 
> > call
> > efi_file_from_path().
> ># cmd/eficonfig.c::create_selected_device_path() create the full device 
> > path,
> >   we can reuse it.
> >
> > >
> > > Since that requires a further clean up, I am fine keeping it as-is for 
> > > now,
> > > but add a comment saying we should replace that with efi_file_from_path()
> > > eventually.
> >
> > Probably I don't understand what is improved when we replace current code
> > with efi_file_from_path().
>
> I just prefer using common functions to open a file, rather than open
> coding open_volume + file_open. OTOH efi_file_from_path() just
> converts that DP into a filepath and reads the file.  So on a second
> thought leave this as is, we don't need a comment.

Thank you for the confirmation.

Regards,
Masahisa Kojima

>
> [...]
>
> Regards
> /Ilias


Re: [PATCH v7 4/5] eficonfig: add UEFI Secure Boot Key enrollment interface

2022-11-09 Thread Ilias Apalodimas
[...]

> > > + goto out;
> > > +
> > > + ret = efi_open_volume_int(file_info.current_volume, &root);
> > > + if (ret != EFI_SUCCESS)
> > > + goto out;
> > > +
> > > + ret = efi_file_open_int(root, &f, file_info.current_path, 
> > > EFI_FILE_MODE_READ, 0);
> > > + if (ret != EFI_SUCCESS)
> > > + goto out;
> >
> > I think it would be better here if we could use efi_file_from_path().
> > I think we can't easily do that atm since we can't convert the filename to
> > a device path with efi_dp_from_file() since we don't have the block info.
>
> Here we have a device path of volume(file_info.current_volume) and
> filename(file_info.current_path), so we can create a full device path to call
> efi_file_from_path().
># cmd/eficonfig.c::create_selected_device_path() create the full device 
> path,
>   we can reuse it.
>
> >
> > Since that requires a further clean up, I am fine keeping it as-is for now,
> > but add a comment saying we should replace that with efi_file_from_path()
> > eventually.
>
> Probably I don't understand what is improved when we replace current code
> with efi_file_from_path().

I just prefer using common functions to open a file, rather than open
coding open_volume + file_open. OTOH efi_file_from_path() just
converts that DP into a filepath and reads the file.  So on a second
thought leave this as is, we don't need a comment.

[...]

Regards
/Ilias


[PATCH v5 05/16] buildman: Convert documentation to rST

2022-11-09 Thread Simon Glass
Convert the buildman documentation to rST format and include it in the
'build' section.

Signed-off-by: Simon Glass 
Reviewed-by: Quentin Schulz 
---

Changes in v5:
- Correct --- Warning --- section
- Convert the buildman args to a list

Changes in v3:
- Add new patch to convert documentation to rST

 doc/build/buildman.rst  |1 +
 doc/build/index.rst |1 +
 tools/buildman/README   | 1349 -
 tools/buildman/README.rst   |1 +
 tools/buildman/buildman.rst | 1406 +++
 tools/buildman/control.py   |4 +-
 tools/buildman/func_test.py |4 +-
 7 files changed, 1413 insertions(+), 1353 deletions(-)
 create mode 12 doc/build/buildman.rst
 delete mode 100644 tools/buildman/README
 create mode 12 tools/buildman/README.rst
 create mode 100644 tools/buildman/buildman.rst

diff --git a/doc/build/buildman.rst b/doc/build/buildman.rst
new file mode 12
index 000..beeaa425720
--- /dev/null
+++ b/doc/build/buildman.rst
@@ -0,0 +1 @@
+../../tools/buildman/buildman.rst
\ No newline at end of file
diff --git a/doc/build/index.rst b/doc/build/index.rst
index 69952f90d89..9a8105db21d 100644
--- a/doc/build/index.rst
+++ b/doc/build/index.rst
@@ -11,3 +11,4 @@ Build U-Boot
clang
docker
tools
+   buildman
diff --git a/tools/buildman/README b/tools/buildman/README
deleted file mode 100644
index a8357a804b3..000
--- a/tools/buildman/README
+++ /dev/null
@@ -1,1349 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-# Copyright (c) 2013 The Chromium OS Authors.
-
-(Please read 'How to change from MAKEALL' if you are used to that tool)
-
-Quick-start
-===
-
-If you just want to quickly set up buildman so you can build something (for
-example Raspberry Pi 2):
-
-   cd /path/to/u-boot
-   PATH=$PATH:`pwd`/tools/buildman
-   buildman --fetch-arch arm
-   buildman -k rpi_2
-   ls ../current/rpi_2
-   # u-boot.bin is the output image
-
-
-What is this?
-=
-
-This tool handles building U-Boot to check that you have not broken it
-with your patch series. It can build each individual commit and report
-which boards fail on which commits, and which errors come up. It aims
-to make full use of multi-processor machines.
-
-A key feature of buildman is its output summary, which allows warnings,
-errors or image size increases in a particular commit or board to be
-quickly identified and the offending commit pinpointed. This can be a big
-help for anyone working with >10 patches at a time.
-
-
-Caveats
-===
-
-Buildman can be stopped and restarted, in which case it will continue
-where it left off. This should happen cleanly and without side-effects.
-If not, it is a bug, for which a patch would be welcome.
-
-Buildman gets so tied up in its work that it can ignore the outside world.
-You may need to press Ctrl-C several times to quit it. Also it will print
-out various exceptions when stopped. You may have to kill it since the
-Ctrl-C handling is somewhat broken.
-
-
-Theory of Operation
-===
-
-(please read this section in full twice or you will be perpetually confused)
-
-Buildman is a builder. It is not make, although it runs make. It does not
-produce any useful output on the terminal while building, except for
-progress information (but see -v below). All the output (errors, warnings and
-binaries if you ask for them) is stored in output directories, which you can
-look at from a separate 'buildman -s' instance while the build is progressing,
-or when it is finished.
-
-Buildman is designed to build entire git branches, i.e. muliple commits. It
-can be run repeatedly on the same branch after making changes to commits on
-that branch. In this case it will automatically rebuild commits which have
-changed (and remove its old results for that commit). It is possible to build
-a branch for one board, then later build it for another board. This adds to
-the output, so now you have results for two boards. If you want buildman to
-re-build a commit it has already built (e.g. because of a toolchain update),
-use the -f flag.
-
-Buildman produces a concise summary of which boards succeeded and failed.
-It shows which commit introduced which board failure using a simple
-red/green colour coding (with yellow/cyan for warnings). Full error
-information can be requested, in which case it is de-duped and displayed
-against the commit that introduced the error. An example workflow is below.
-
-Buildman stores image size information and can report changes in image size
-from commit to commit. An example of this is below.
-
-Buildman starts multiple threads, and each thread builds for one board at
-a time. A thread starts at the first commit, configures the source for your
-board and builds it. Then it checks out the next commit and does an
-incremental build (i.e. not using 'make xxx_defconfig' unless you use -C).
-Eventually the thread reaches the last commit and stops. If a commit causes
-a

Re: [PATCH v7 4/5] eficonfig: add UEFI Secure Boot Key enrollment interface

2022-11-09 Thread Masahisa Kojima
Hi Ilias,

On Thu, 10 Nov 2022 at 01:04, Ilias Apalodimas
 wrote:
>
> Hi Kojima-san
>
>
> On Wed, Nov 09, 2022 at 12:37:27PM +0900, Masahisa Kojima wrote:
> > This commit adds the menu-driven UEFI Secure Boot Key
> > enrollment interface. User can enroll PK, KEK, db
> > and dbx by selecting file.
> > Only the signed EFI Signature List(s) with an authenticated
> > header, typically '.auth' file, is accepted.
> >
> > To clear the PK, KEK, db and dbx, user needs to enroll the null key
> > signed by PK or KEK.
> >
> > Signed-off-by: Masahisa Kojima 
> > ---
> > Changes in v7:
> > - only accept .auth file.
> > - remove creating time based authenticated variable
> > - update commit message
> > - use efi_file_size()
> >
> > Changes in v6:
> > - use efi_secure_boot_enabled()
> > - replace with WIN_CERT_REVISION_2_0 from pe.h
> > - call efi_build_signature_store() to check the valid EFI Signature List
> > - update comment
> >
> > Changes in v4:
> > - add CONFIG_EFI_MM_COMM_TEE dependency
> > - fix error handling
> >
> > Changes in v3:
> > - fix error handling
> >
> > Changes in v2:
> > - allow to enroll .esl file
> > - fix typos
> > - add function comments
> >
> >  cmd/Makefile  |   5 +
> >  cmd/eficonfig.c   |   3 +
> >  cmd/eficonfig_sbkey.c | 242 ++
> >  include/efi_config.h  |   5 +
> >  4 files changed, 255 insertions(+)
> >  create mode 100644 cmd/eficonfig_sbkey.c
> >
> > diff --git a/cmd/Makefile b/cmd/Makefile
> > index 2444d116c0..0b6a96c1d9 100644
> > --- a/cmd/Makefile
> > +++ b/cmd/Makefile
> > @@ -66,6 +66,11 @@ obj-$(CONFIG_CMD_EEPROM) += eeprom.o
> >  obj-$(CONFIG_EFI) += efi.o
> >  obj-$(CONFIG_CMD_EFIDEBUG) += efidebug.o
> >  obj-$(CONFIG_CMD_EFICONFIG) += eficonfig.o
> > +ifdef CONFIG_CMD_EFICONFIG
> > +ifdef CONFIG_EFI_MM_COMM_TEE
> > +obj-$(CONFIG_EFI_SECURE_BOOT) += eficonfig_sbkey.o
> > +endif
> > +endif
> >  obj-$(CONFIG_CMD_ELF) += elf.o
> >  obj-$(CONFIG_CMD_EROFS) += erofs.o
> >  obj-$(CONFIG_HUSH_PARSER) += exit.o
> > diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c
> > index 12babb76c2..d79194794b 100644
> > --- a/cmd/eficonfig.c
> > +++ b/cmd/eficonfig.c
> > @@ -2435,6 +2435,9 @@ static const struct eficonfig_item 
> > maintenance_menu_items[] = {
> >   {"Edit Boot Option", eficonfig_process_edit_boot_option},
> >   {"Change Boot Order", eficonfig_process_change_boot_order},
> >   {"Delete Boot Option", eficonfig_process_delete_boot_option},
> > +#if (CONFIG_IS_ENABLED(EFI_SECURE_BOOT) && 
> > CONFIG_IS_ENABLED(EFI_MM_COMM_TEE))
> > + {"Secure Boot Configuration", eficonfig_process_secure_boot_config},
> > +#endif
> >   {"Quit", eficonfig_process_quit},
> >  };
> >
> > diff --git a/cmd/eficonfig_sbkey.c b/cmd/eficonfig_sbkey.c
> > new file mode 100644
> > index 00..1e9eb3f51e
> > --- /dev/null
> > +++ b/cmd/eficonfig_sbkey.c
> > @@ -0,0 +1,242 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + *  Menu-driven UEFI Secure Boot Key Maintenance
> > + *
> > + *  Copyright (c) 2022 Masahisa Kojima, Linaro Limited
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +enum efi_sbkey_signature_type {
> > + SIG_TYPE_X509 = 0,
> > + SIG_TYPE_HASH,
> > + SIG_TYPE_CRL,
> > + SIG_TYPE_RSA2048,
> > +};
> > +
> > +struct eficonfig_sigtype_to_str {
> > + efi_guid_t sig_type;
> > + char *str;
> > + enum efi_sbkey_signature_type type;
> > +};
> > +
> > +static const struct eficonfig_sigtype_to_str sigtype_to_str[] = {
> > + {EFI_CERT_X509_GUID,"X509", 
> > SIG_TYPE_X509},
> > + {EFI_CERT_SHA256_GUID,  "SHA256",   
> > SIG_TYPE_HASH},
> > + {EFI_CERT_X509_SHA256_GUID, "X509_SHA256 CRL",  SIG_TYPE_CRL},
> > + {EFI_CERT_X509_SHA384_GUID, "X509_SHA384 CRL",  SIG_TYPE_CRL},
> > + {EFI_CERT_X509_SHA512_GUID, "X509_SHA512 CRL",  SIG_TYPE_CRL},
> > + /* U-Boot does not support the following signature types */
> > +/*   {EFI_CERT_RSA2048_GUID, "RSA2048",  
> > SIG_TYPE_RSA2048}, */
> > +/*   {EFI_CERT_RSA2048_SHA256_GUID,  "RSA2048_SHA256",   
> > SIG_TYPE_RSA2048}, */
> > +/*   {EFI_CERT_SHA1_GUID,"SHA1", 
> > SIG_TYPE_HASH}, */
> > +/*   {EFI_CERT_RSA2048_SHA_GUID, "RSA2048_SHA",  
> > SIG_TYPE_RSA2048 }, */
> > +/*   {EFI_CERT_SHA224_GUID,  "SHA224",   
> > SIG_TYPE_HASH}, */
> > +/*   {EFI_CERT_SHA384_GUID,  "SHA384",   
> > SIG_TYPE_HASH}, */
> > +/*   {EFI_CERT_SHA512_GUID,  "SHA512",   
> > SIG_TYPE_HASH}, */
> > +};
> > +
> > +/**
> > + * file_have_auth_header() - check file has EFI_VARIABLE_AUTHENTICATION_2 
> > header
> > + * @buf: pointer to file
> > + * @size:file size
> > + * Return:   true if file has auth header, false otherwise

[PATCH v5 15/16] buildman: Add --allow-missing flag to allow missing blobs

2022-11-09 Thread Simon Glass
From: Tom Rini 

Add a new flag to buildman so that we will in turn pass
BINMAN_ALLOW_MISSING=1 to 'make'. Make use of this flag in CI.

Allow the settings file to control this.

Cc: Rasmus Villemoes 
Cc: Simon Glass 
Signed-off-by: Tom Rini 
Signed-off-by: Simon Glass 
---

Changes in v5:
- Split out config_fname change into a separate patch
- Rename GetGlobalValue to GetGlobalItemValue
- Fix 'items' typo
- Simplify implementation of GetGlobalItemValue()
- Use '[global]' for the doc heading
- Use double tick for arguments
- Drop redundant allow_missing code
- Split out the tests more

Changes in v4:
- Various changes that were unfortunately not recorded

Changes in v3:
- Add tests docs and a settings-file option

 .azure-pipelines.yml|   2 +-
 .gitlab-ci.yml  |   6 +-
 tools/buildman/bsettings.py |  11 
 tools/buildman/builder.py   |   5 +-
 tools/buildman/builderthread.py |   2 +
 tools/buildman/buildman.rst |  43 +
 tools/buildman/cmdline.py   |   6 ++
 tools/buildman/control.py   |  24 +++-
 tools/buildman/func_test.py | 106 +++-
 9 files changed, 197 insertions(+), 8 deletions(-)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index bda762451fd..665b5d2026f 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -553,7 +553,7 @@ stages:
   cat << "EOF" >> build.sh
   if [[ "${BUILDMAN}" != "" ]]; then
   ret=0;
-  tools/buildman/buildman -o /tmp -P -E -W ${BUILDMAN} ${OVERRIDE} 
|| ret=$?;
+  tools/buildman/buildman -o /tmp -PEWM ${BUILDMAN} ${OVERRIDE} || 
ret=$?;
   if [[ $ret -ne 0 ]]; then
   tools/buildman/buildman -o /tmp -seP ${BUILDMAN};
   exit $ret;
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6f4c34fc4a3..3deaeca1cdd 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -81,7 +81,7 @@ build all 32bit ARM platforms:
   stage: world build
   script:
 - ret=0;
-  ./tools/buildman/buildman -o /tmp -P -E -W arm -x aarch64 || ret=$?;
+  ./tools/buildman/buildman -o /tmp -PEWM arm -x aarch64 || ret=$?;
   if [[ $ret -ne 0 ]]; then
 ./tools/buildman/buildman -o /tmp -seP;
 exit $ret;
@@ -93,7 +93,7 @@ build all 64bit ARM platforms:
 - virtualenv -p /usr/bin/python3 /tmp/venv
 - . /tmp/venv/bin/activate
 - ret=0;
-  ./tools/buildman/buildman -o /tmp -P -E -W aarch64 || ret=$?;
+  ./tools/buildman/buildman -o /tmp -PEWM aarch64 || ret=$?;
   if [[ $ret -ne 0 ]]; then
 ./tools/buildman/buildman -o /tmp -seP;
 exit $ret;
@@ -113,7 +113,7 @@ build all other platforms:
   stage: world build
   script:
 - ret=0;
-  ./tools/buildman/buildman -o /tmp -P -E -W -x arm,powerpc || ret=$?;
+  ./tools/buildman/buildman -o /tmp -PEWM -x arm,powerpc || ret=$?;
   if [[ $ret -ne 0 ]]; then
 ./tools/buildman/buildman -o /tmp -seP;
 exit $ret;
diff --git a/tools/buildman/bsettings.py b/tools/buildman/bsettings.py
index 9b93b7a51e1..0eb894a558c 100644
--- a/tools/buildman/bsettings.py
+++ b/tools/buildman/bsettings.py
@@ -47,6 +47,17 @@ def GetItems(section):
 except:
 raise
 
+def GetGlobalItemValue(name):
+"""Get an item from the 'global' section of the config.
+
+Args:
+name: name of item to retrieve
+
+Returns:
+str: Value of item, or None if not present
+"""
+return settings.get('global', name, fallback=None)
+
 def SetItem(section, tag, value):
 """Set an item and write it back to the settings file"""
 global settings
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 76252b90792..c2a69027f88 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -252,7 +252,8 @@ class Builder:
  mrproper=False, per_board_out_dir=False,
  config_only=False, squash_config_y=False,
  warnings_as_errors=False, work_in_output=False,
- test_thread_exceptions=False, adjust_cfg=None):
+ test_thread_exceptions=False, adjust_cfg=None,
+ allow_missing=False):
 """Create a new Builder object
 
 Args:
@@ -290,6 +291,7 @@ class Builder:
 ~C to disable C
 C=val to set the value of C (val must have quotes if C is
 a string Kconfig
+allow_missing: Run build with BINMAN_ALLOW_MISSING=1
 
 """
 self.toolchains = toolchains
@@ -327,6 +329,7 @@ class Builder:
 self.config_filenames = BASE_CONFIG_FILENAMES
 self.work_in_output = work_in_output
 self.adjust_cfg = adjust_cfg
+self.allow_missing = allow_missing
 self._ide = False
 
 if not self.squash_config_y:
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index 065d836d68c..680efae02d7 100644
--- a/tools/buildma

[PATCH v5 16/16] binman: Add documentation for the command line args

2022-11-09 Thread Simon Glass
Add command-line documentation for binman.

Signed-off-by: Simon Glass 
---

Changes in v5:
- Add new patch with documentation for the command line args

 tools/binman/binman.rst | 300 +++-
 1 file changed, 299 insertions(+), 1 deletion(-)

diff --git a/tools/binman/binman.rst b/tools/binman/binman.rst
index 92b21b1c017..e7b231e0712 100644
--- a/tools/binman/binman.rst
+++ b/tools/binman/binman.rst
@@ -505,7 +505,6 @@ be located anywhere in the image. An image header 
(typically at the start or end
 of the image) can be used to point to the FDT map. See fdtmap and image-header
 entries for more information.
 
-
 Map files
 -
 
@@ -1339,6 +1338,305 @@ generated from the source code using:
 
bintools
 
+Binman commands and arguments
+=
+
+Usage::
+
+binman [-h] [-B BUILD_DIR] [-D] [-H] [--toolpath TOOLPATH] [-T THREADS]
+[--test-section-timeout] [-v VERBOSITY] [-V]
+{build,bintool-docs,entry-docs,ls,extract,replace,test,tool} ...
+
+Binman provides the following commands:
+
+- **build** - build images
+- **bintools-docs** - generate documentation about bintools
+- **entry-docs** - generate documentation about entry types
+- **ls** - list an image
+- **extract** - extract files from an image
+- **replace** - replace one or more entries in an image
+- **test** - run tests
+- **tool** - manage bintools
+
+Options:
+
+-h, --help
+Show help message and exit
+
+-B BUILD_DIR, --build-dir BUILD_DIR
+Directory containing the build output
+
+-D, --debug
+Enabling debugging (provides a full traceback on error)
+
+-H, --full-help
+Display the README file
+
+--toolpath TOOLPATH
+Add a path to the directories containing tools
+
+-T THREADS, --threads THREADS
+Number of threads to use (0=single-thread). Note that -T0 is useful for
+debugging since everything runs in one thread.
+
+-v VERBOSITY, --verbosity VERBOSITY
+Control verbosity: 0=silent, 1=warnings, 2=notices, 3=info, 4=detail,
+5=debug
+
+-V, --version
+Show the binman version
+
+Test options:
+
+--test-section-timeout
+Use a zero timeout for section multi-threading (for testing)
+
+Commands are described below.
+
+binman build
+
+
+This builds one or more images using the provided image description.
+
+Usage::
+
+binman build [-h] [-a ENTRY_ARG] [-b BOARD] [-d DT] [--fake-dtb]
+[--fake-ext-blobs] [--force-missing-bintools FORCE_MISSING_BINTOOLS]
+[-i IMAGE] [-I INDIR] [-m] [-M] [-n] [-O OUTDIR] [-p] [-u]
+[--update-fdt-in-elf UPDATE_FDT_IN_ELF] [-W]
+
+Options:
+
+-h, --help
+Show help message and exit
+
+-a ENTRY_ARG, --entry-arg ENTRY_ARG
+Set argument value `arg=value`. See
+`Passing command-line arguments to entries`_.
+
+-b BOARD, --board BOARD
+Board name to build. This can be used instead of `-d`, in which case the
+file `u-boot.dtb` is used, within the build directory's board subdirectory.
+
+-d DT, --dt DT
+Configuration file (.dtb) to use. This must have a top-level node called
+`binman`. See `Image description format`_.
+
+-i IMAGE, --image IMAGE
+Image filename to build (if not specified, build all)
+
+-I INDIR, --indir INDIR
+Add a path to the list of directories to use for input files. This can be
+specified multiple times to add more than one path.
+
+-m, --map
+Output a map file for each image. See `Map files`_.
+
+-M, --allow-missing
+Allow external blobs and bintools to be missing. See `External blobs`_.
+
+-n, --no-expanded
+Don't use 'expanded' versions of entries where available; normally 'u-boot'
+becomes 'u-boot-expanded', for example. See `Expanded entries`_.
+
+-O OUTDIR, --outdir OUTDIR
+Path to directory to use for intermediate and output files
+
+-p, --preserve
+Preserve temporary output directory even if option -O is not given
+
+-u, --update-fdt
+Update the binman node with offset/size info. See
+`Access to binman entry offsets at run time (fdt)`_.
+
+--update-fdt-in-elf UPDATE_FDT_IN_ELF
+Update an ELF file with the output dtb. The argument is a string consisting
+of four parts, separated by commas. See `Updating an ELF file`_.
+
+-W, --ignore-missing
+Return success even if there are missing blobs/bintools (requires -M)
+
+Options used only for testing:
+
+--fake-dtb
+Use fake device tree contents
+
+--fake-ext-blobs
+Create fake ext blobs with dummy content
+
+--force-missing-bintools FORCE_MISSING_BINTOOLS
+Comma-separated list of bintools to consider missing
+
+binman bintool-docs
+---
+
+Usage::
+
+binman bintool-docs [-h]
+
+This outputs documentation for the bintools in rST format. See
+`Bintool Documentation`_.
+
+binman entry-docs
+-
+
+Usage::
+
+binman entry-docs [-h]
+
+This outputs documentation for the entry types in rST format. See
+`Entry Documentation`_.
+
+binman ls
+-
+
+Usage::
+
+binman ls 

[PATCH v5 14/16] buildman: Reinstate removal of temp output dir in tests

2022-11-09 Thread Simon Glass
This was dropped my mistake. Reinstate it.

Signed-off-by: Simon Glass 
Fixes: d829f1217c6 ("bulidman: Add support for a simple build")
---

Changes in v5:
- Add new patch to reinstate removal of temp output dir in tests

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

diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py
index b4f3b46fcb1..37535518d86 100644
--- a/tools/buildman/func_test.py
+++ b/tools/buildman/func_test.py
@@ -211,7 +211,7 @@ class TestFunctional(unittest.TestCase):
 
 def tearDown(self):
 shutil.rmtree(self._base_dir)
-#shutil.rmtree(self._output_dir)
+shutil.rmtree(self._output_dir)
 
 def setupToolchains(self):
 self._toolchains = toolchain.Toolchains()
-- 
2.38.1.431.g37b22c650d-goog



[PATCH v5 12/16] global: Do not default to faking missing binaries for buildman

2022-11-09 Thread Simon Glass
From: Tom Rini 

While it is possible and documented on how to re-run buildman to replace
faked required binary files after the fact, this behavior ends up being
more confusing than helpful in practice. Switch to requiring
BINMAN_ALLOW_MISSING=1 to be passed on the 'make' line to enable this
behavior.

Cc: Rasmus Villemoes 
Cc: Simon Glass 
Signed-off-by: Tom Rini 
Signed-off-by: Simon Glass 
---

(no changes since v1)

 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 93d5c064f4c..2c0433c73df 100644
--- a/Makefile
+++ b/Makefile
@@ -1333,8 +1333,8 @@ cmd_binman = $(srctree)/tools/binman/binman $(if 
$(BINMAN_DEBUG),-D) \
$(foreach f,$(BINMAN_TOOLPATHS),--toolpath $(f)) \
 --toolpath $(objtree)/tools \
$(if $(BINMAN_VERBOSE),-v$(BINMAN_VERBOSE)) \
-   build -u -d u-boot.dtb -O . -m --allow-missing \
-   --fake-ext-blobs \
+   build -u -d u-boot.dtb -O . -m \
+   $(if $(BINMAN_ALLOW_MISSING),--allow-missing --fake-ext-blobs) \
-I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
-I arch/$(ARCH)/dts -a of-list=$(CONFIG_OF_LIST) \
$(foreach f,$(BINMAN_INDIRS),-I $(f)) \
-- 
2.38.1.431.g37b22c650d-goog



[PATCH v5 11/16] binman: Add a separate section about environment variables

2022-11-09 Thread Simon Glass
These are documented in various several sections. Add a new section that
mentions them all in one place so it is easier to see what environment
variables can be used to control U-Boot's use of binman.

Signed-off-by: Simon Glass 
Suggested-by: Heinrich Schuchardt 
---

Changes in v5:
- Add new patch with a separate section about environment variables

 tools/binman/binman.rst | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/tools/binman/binman.rst b/tools/binman/binman.rst
index 16508d6ba58..92b21b1c017 100644
--- a/tools/binman/binman.rst
+++ b/tools/binman/binman.rst
@@ -1246,6 +1246,8 @@ You can also replace just a selection of entries::
 $ binman replace -i image.bin "*u-boot*" -I indir
 
 
+.. _`BinmanLogging`:
+
 Logging
 ---
 
@@ -1416,6 +1418,8 @@ what happens in this stage.
 final step.
 
 
+.. _`External tools`:
+
 External tools
 --
 
@@ -1437,6 +1441,8 @@ a space-separated list of paths to search, e.g.::
BINMAN_TOOLPATHS="/tools/g12a /tools/tegra" binman ...
 
 
+.. _`External blobs`:
+
 External blobs
 --
 
@@ -1494,6 +1500,30 @@ Binman produces the following exit codes:
 and will return an exit status of 0 instead.
 
 
+U-Boot environment variables for binman
+---
+
+The U-Boot Makefile supports various environment variables to control binman.
+All of these are set within the Makefile and result in passing various
+environment variables (or make flags) to binman:
+
+BINMAN_DEBUG
+Enables backtrace debugging by adding a `-D` argument. See
+:ref:`BinmanLogging`.
+
+BINMAN_INDIRS
+Sets the search path for input files used by binman by adding one or more
+`-I` arguments. See :ref:`External blobs`.
+
+BINMAN_TOOLPATHS
+Sets the search path for external tool used by binman by adding one or more
+`--toolpath` arguments. See :ref:`External tools`.
+
+BINMAN_VERBOSE
+Sets the logging verbosity of binman by adding a `-v` argument. See
+:ref:`BinmanLogging`.
+
+
 Error messages
 --
 
-- 
2.38.1.431.g37b22c650d-goog



[PATCH v5 09/16] buildman: Drop mention of old architectures

2022-11-09 Thread Simon Glass
Support for some architectures has been removed since buildman was first
written. Also all toolchains are now available at kernel.org so we don't
need the links, except for arc where the kernel.org toolchain fails to
build all boards.

Signed-off-by: Simon Glass 
---

(no changes since v4)

Changes in v4:
- Leave the arc toolchain in there

Changes in v3:
- Add new patch to drop mention of old architectures

 tools/buildman/bsettings.py |  2 --
 tools/buildman/buildman.rst | 18 +-
 2 files changed, 1 insertion(+), 19 deletions(-)

diff --git a/tools/buildman/bsettings.py b/tools/buildman/bsettings.py
index f53564e0f8a..dcc200ea79d 100644
--- a/tools/buildman/bsettings.py
+++ b/tools/buildman/bsettings.py
@@ -87,8 +87,6 @@ other = /
 riscv = riscv32
 sh = sh4
 x86 = i386
-blackfin = bfin
-openrisc = or1k
 
 [make-flags]
 # Special flags to pass to 'make' for certain boards, e.g. to pass a test
diff --git a/tools/buildman/buildman.rst b/tools/buildman/buildman.rst
index 4851a645602..2a7593d08b9 100644
--- a/tools/buildman/buildman.rst
+++ b/tools/buildman/buildman.rst
@@ -202,8 +202,6 @@ Setting up
riscv = riscv32
sh = sh4
x86: i386
-   blackfin: bfin
-   openrisc: or1k
 
 
This selects the available toolchain paths. Add the base directory for
@@ -480,21 +478,12 @@ Setting up
For those not available from kernel.org, download from the following links:
 
- `Arc Toolchain`_
-   - `Blackfin Toolchain`_
-   - `Nios2 Toolchain`_
-   - `SH Toolchain`_
-
-   Note openrisc kernel.org toolchain is out of date. Download the latest one
-   from `OpenRISC Toolchains`_, e.g. `OpenRISC 4.8.1`_.
 
Buildman should now be set up to use your new toolchain.
 
At the time of writing, U-Boot has these architectures:
 
-  arc, arm, blackfin, m68k, microblaze, mips, nios2, openrisc
-  powerpc, sandbox, sh, sparc, x86
-
-   Of these, only arc is not available at kernel.org.
+  arc, arm, m68k, microblaze, mips, nios2, powerpc, sandbox, sh, x86, 
xtensa
 
 
 How to run it
@@ -1286,11 +1275,6 @@ the build speed by building all commits for a board 
instead of the other
 way around.
 
 .. _`Arc Toolchain`: 
https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-2021.03-release/arc_gnu_2021.03_prebuilt_elf32_le_linux_install.tar.gz
-.. _`Blackfin Toolchain`: 
http://sourceforge.net/projects/adi-toolchain/files/blackfin-toolchain-elf-gcc-4.5-2014R1_45-RC2.x86_64.tar.bz2
-.. _`Nios2 Toolchain`: 
http://sourcery.mentor.com/public/gnu_toolchain/nios2-linux-gnu/sourceryg++-2015.11-27-nios2-linux-gnu-i686-pc-linux-gnu.tar.bz2
-.. _`SH Toolchain`: 
http://sourcery.mentor.com/public/gnu_toolchain/sh-linux-gnu/renesas-4.4-200-sh-linux-gnu-i686-pc-linux-gnu.tar.bz2
-.. _`OpenRISC Toolchains`: 
http://opencores.org/or1k/OpenRISC_GNU_tool_chain#Prebuilt_versions
-.. _`OpenRISC 4.8.1`: 
ftp://ocuser:ocu...@openrisc.opencores.org/toolchain/gcc-or1k-elf-4.8.1-x86.tar.bz2
 
 .. sectionauthor:: Simon Glass
 .. sectionauthor:: Copyright (c) 2013 The Chromium OS Authors.
-- 
2.38.1.431.g37b22c650d-goog



[PATCH v5 13/16] buildman: Ensure config_fname is inited

2022-11-09 Thread Simon Glass
Init this variable at the top level since it is a global.

Signed-off-by: Simon Glass 
---

Changes in v5:
- Add new patch to ensure config_fname is inited

 tools/buildman/bsettings.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/buildman/bsettings.py b/tools/buildman/bsettings.py
index dcc200ea79d..9b93b7a51e1 100644
--- a/tools/buildman/bsettings.py
+++ b/tools/buildman/bsettings.py
@@ -5,6 +5,7 @@ import configparser
 import os
 import io
 
+config_fname = None
 
 def Setup(fname=''):
 """Set up the buildman settings module by reading config files
-- 
2.38.1.431.g37b22c650d-goog



[PATCH v5 10/16] buildman: Detect binman reporting missing blobs

2022-11-09 Thread Simon Glass
Buildman should consider a build as a success (with warnings) if missing
blobs have been dealt with by binman, even though buildman itself returns
and error code overall. This is how other warnings are dealt with.

We cannot easily access the 103 exit code, so detect the problem in the
output.

With this change, missing blobs result in an exit code of 101, although
they still indicate failure.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 tools/buildman/builderthread.py | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index 6240e08c767..065d836d68c 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -288,10 +288,14 @@ class BuilderThread(threading.Thread):
 args.append('cfg')
 result = self.Make(commit, brd, 'build', cwd, *args,
 env=env)
+if (result.return_code == 2 and
+('Some images are invalid' in result.stderr)):
+# This is handled later by the check for output in
+# stderr
+result.return_code = 0
 if adjust_cfg:
 errs = cfgutil.check_cfg_file(cfg_file, adjust_cfg)
 if errs:
-print('errs', errs)
 result.stderr += errs
 result.return_code = 1
 result.stderr = result.stderr.replace(src_dir + '/', '')
-- 
2.38.1.431.g37b22c650d-goog



[PATCH v5 08/16] buildman: Update the default settings file

2022-11-09 Thread Simon Glass
The settings file omits a few lines which are useful for getting every
board building. Add these and update the documentation tool.

Signed-off-by: Simon Glass 
---

(no changes since v4)

Changes in v4:
- Add new patch to update the default settings file

 tools/buildman/bsettings.py | 3 +++
 tools/buildman/buildman.rst | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/tools/buildman/bsettings.py b/tools/buildman/bsettings.py
index 35bb2c1d03a..f53564e0f8a 100644
--- a/tools/buildman/bsettings.py
+++ b/tools/buildman/bsettings.py
@@ -79,10 +79,13 @@ other = /
 [toolchain-prefix]
 # name = path to prefix
 # e.g. x86 = /opt/gcc-4.6.3-nolibc/x86_64-linux/bin/x86_64-linux-
+# arc = /opt/arc/arc_gnu_2021.03_prebuilt_elf32_le_linux_install/bin/arc-elf32-
 
 [toolchain-alias]
 # arch = alias
 # Indicates which toolchain should be used to build for that arch
+riscv = riscv32
+sh = sh4
 x86 = i386
 blackfin = bfin
 openrisc = or1k
diff --git a/tools/buildman/buildman.rst b/tools/buildman/buildman.rst
index afdd65d184d..4851a645602 100644
--- a/tools/buildman/buildman.rst
+++ b/tools/buildman/buildman.rst
@@ -199,6 +199,8 @@ Setting up
arc = 
/opt/arc/arc_gnu_2021.03_prebuilt_elf32_le_linux_install/bin/arc-elf32-
 
[toolchain-alias]
+   riscv = riscv32
+   sh = sh4
x86: i386
blackfin: bfin
openrisc: or1k
-- 
2.38.1.431.g37b22c650d-goog



[PATCH v5 07/16] buildman: Update the arc toolchain

2022-11-09 Thread Simon Glass
There is one on kernel.org but it does not build the hsdk_4xd board. Add
a link to one which does.

Signed-off-by: Simon Glass 
---

(no changes since v4)

Changes in v4:
- Add a patch to update the arc toolchain

 tools/buildman/buildman.rst | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/buildman/buildman.rst b/tools/buildman/buildman.rst
index d0b7bbd2b0d..afdd65d184d 100644
--- a/tools/buildman/buildman.rst
+++ b/tools/buildman/buildman.rst
@@ -195,6 +195,9 @@ Setting up
arm: /opt/linaro/gcc-linaro-arm-linux-gnueabihf-4.8-2013.08_linux
aarch64: /opt/linaro/gcc-linaro-aarch64-none-elf-4.8-2013.10_linux
 
+   [toolchain-prefix]
+   arc = 
/opt/arc/arc_gnu_2021.03_prebuilt_elf32_le_linux_install/bin/arc-elf32-
+
[toolchain-alias]
x86: i386
blackfin: bfin
@@ -1280,7 +1283,7 @@ Thanks to Grant Grundler  for his 
ideas for improving
 the build speed by building all commits for a board instead of the other
 way around.
 
-.. _`Arc Toolchain`: 
https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-2016.09-release/arc_gnu_2016.09_prebuilt_uclibc_le_archs_linux_install.tar.gz
+.. _`Arc Toolchain`: 
https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-2021.03-release/arc_gnu_2021.03_prebuilt_elf32_le_linux_install.tar.gz
 .. _`Blackfin Toolchain`: 
http://sourceforge.net/projects/adi-toolchain/files/blackfin-toolchain-elf-gcc-4.5-2014R1_45-RC2.x86_64.tar.bz2
 .. _`Nios2 Toolchain`: 
http://sourcery.mentor.com/public/gnu_toolchain/nios2-linux-gnu/sourceryg++-2015.11-27-nios2-linux-gnu-i686-pc-linux-gnu.tar.bz2
 .. _`SH Toolchain`: 
http://sourcery.mentor.com/public/gnu_toolchain/sh-linux-gnu/renesas-4.4-200-sh-linux-gnu-i686-pc-linux-gnu.tar.bz2
-- 
2.38.1.431.g37b22c650d-goog



Re: [PATCH v2 00/25] bootstd: Add a boot menu

2022-11-09 Thread Simon Glass
Hi Heinrich,

On Mon, 7 Nov 2022 at 16:35, Simon Glass  wrote:
>
> Hi Heinrich,
>
> On Mon, 7 Nov 2022 at 12:15, Heinrich Schuchardt  wrote:
> >
> > On 11/4/22 23:48, Simon Glass wrote:
> > > So far standard boot lacks a boot menu, although it is possible to create
> > > a rudimentary one using the existing 'bootmenu' command.
> > >
> > > Even then, this text-based menu offer only basic functionality and does
> > > not take full advantage of the displays which are common on many devices.
> > >
> > > This series provides a 'bootflow menu' command which allows the user to
> > > select from the available bootflows. An attempt is made to show the name
> > > of the available operating systems, by reading more information into the
> > > bootflow. A logo can be read also, where supported, so that this can be
> > > presented to the user when an option is highlighted.
> > >
> > > Full use is made of TrueType fonts, if enabled. For cases where only a
> > > serial console is available, it falls back to a simple text-based menu.
> >
> > Please, add the link to your design document
> >
> > https://docs.google.com/document/d/1VQeApnLlH6xKm_OI36AhWkJLUEd9OXEvIJXB8aM2de8/edit?resourcekey=0-DwgHpR2S8vJEJzvvwPb-AQ#heading=h.17wg41voij6q
> > is broken.
>
> What happens when you click that? It works for me.
>
> >
> > in future version of this series.
> >
> > The series leaves us with duplicate code in
> >
> > bootmenu_choice_entry() and eficonfig_choice_entry() as well as
> > bootmenu_loop() and bootmenu_autoboot_loop().
>
> Yes OK, but that is the case today and my series actually removes some
> duplicated code, so perhaps that could be cleaned up later?
>
> >
> > The bootmenu command relies heavily on ANSI sequences but VIDEO_ANSI is
> > disabled by default for CONFIG_EFI_LOADER=n which means that the
> > bootmenu command will not work anymore.
>
> Does it not work, or does it just work but in a serial fashion? I
> don't see ANSI codes as being necessary to show a menu.
>
> >
> > >
> > > All of this is implementing using a new 'expo' construct, a collection of
> >
> > Expo is not an English word. Expo is typically used as name of trade
> > fairs. Transaction probably is the right word to use here.
>
> That is debatable I think. Transaction is quite generic and appears in
> U-Boot >400 times. I think it will just be confusing, like the word
> 'metadata' used in the FWU stuff.
>
> Expo is short for exposition. My use of it is somewhat archaic
> perhaps, but even for the meaning you mention, a public exposition is
> not a bad description of what is provided here.
>
> I am not 100% convinced about 'expo' either. Do you have any other ideas?
>
> >
> > Files expo.c and scene.c are in boot/ which does not match a generic GUI
> > feature. They should be placed in lib/.
>
> Yes I was wondering about that, but thought that boot/ made at least
> some sense since the menu will only ever be used for booting...?
>
> I can move it, but I am a little nervous about that, since lib/
> normally has utility libraries. Perhaps lib/expo would be better?

Just to say that I replied to your comments on the doc also, so let me
know what you think.

Regards,
Simon


[PATCH v5 04/16] binman: Use an exit code when blobs are missing

2022-11-09 Thread Simon Glass
At present binman returns success when told to handle missing/faked blobs
or missing bintools. This is confusing since in fact the resulting image
cannot work.

Use exit code 103 to signal this problem, with a -W option to convert
it to a warning.

Rename the flag to --ignore-missing since it controls bintools also.

Add documentation about exit codes while we are here.

Signed-off-by: Simon Glass 
---

Changes in v5:
- Add a note that -W requires -M
- Update ftest use of -W to avoid confusion
- Update exit-status docs to mention -W also
- Rename flag to --ignore-missing
- Update commit message
- Correct help for -M flag

 tools/binman/binman.rst | 22 ++
 tools/binman/cmdline.py |  5 -
 tools/binman/control.py |  9 -
 tools/binman/ftest.py   | 19 +--
 4 files changed, 51 insertions(+), 4 deletions(-)

diff --git a/tools/binman/binman.rst b/tools/binman/binman.rst
index fda16f1992d..16508d6ba58 100644
--- a/tools/binman/binman.rst
+++ b/tools/binman/binman.rst
@@ -1461,6 +1461,10 @@ space-separated list of directories to search for binary 
blobs::
odroid-c4/build/board/hardkernel/odroidc4/firmware \
odroid-c4/build/scp_task" binman ...
 
+Note that binman fails with exit code 103 when there are missing blobs. If you
+wish binman to continue anyway, you can pass `-W` to binman.
+
+
 Code coverage
 -
 
@@ -1472,6 +1476,24 @@ To enable Python test coverage on Debian-type 
distributions (e.g. Ubuntu)::
$ sudo apt-get install python-coverage python3-coverage python-pytest
 
 
+Exit status
+---
+
+Binman produces the following exit codes:
+
+0
+Success
+
+1
+Any sort of failure - see output for more details
+
+103
+There are missing external blobs or bintools. This is only returned if
+-M is passed to binman, otherwise missing blobs return an exit status of 1.
+Note, if -W is passed as well as -M, then this is converted into a warning
+and will return an exit status of 0 instead.
+
+
 Error messages
 --
 
diff --git a/tools/binman/cmdline.py b/tools/binman/cmdline.py
index 1d1ca43993d..986d6f1a315 100644
--- a/tools/binman/cmdline.py
+++ b/tools/binman/cmdline.py
@@ -114,7 +114,7 @@ controlled by a description in the board device tree.'''
 build_parser.add_argument('-m', '--map', action='store_true',
 default=False, help='Output a map file for each image')
 build_parser.add_argument('-M', '--allow-missing', action='store_true',
-default=False, help='Allow external blobs to be missing')
+default=False, help='Allow external blobs and bintools to be missing')
 build_parser.add_argument('-n', '--no-expanded', action='store_true',
 help="Don't use 'expanded' versions of entries where available; "
  "normally 'u-boot' becomes 'u-boot-expanded', for example")
@@ -128,6 +128,9 @@ controlled by a description in the board device tree.'''
 default=False, help='Update the binman node with offset/size info')
 build_parser.add_argument('--update-fdt-in-elf', type=str,
 help='Update an ELF file with the output dtb: 
infile,outfile,begin_sym,end_sym')
+build_parser.add_argument(
+'-W', '--ignore-missing', action='store_true', default=False,
+help='Return success even if there are missing blobs/bintools 
(requires -M)')
 
 subparsers.add_parser(
 'bintool-docs', help='Write out bintool documentation (see 
bintool.rst)')
diff --git a/tools/binman/control.py b/tools/binman/control.py
index bfe63a15204..964c6984f9b 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -741,8 +741,15 @@ def Binman(args):
 data = state.GetFdtForEtype('u-boot-dtb').GetContents()
 elf.UpdateFile(*elf_params, data)
 
+# This can only be True if -M is provided, since otherwise binman
+# would have raised an error already
 if invalid:
-tout.warning("\nSome images are invalid")
+msg = '\nSome images are invalid'
+if args.ignore_missing:
+tout.warning(msg)
+else:
+tout.error(msg)
+return 103
 
 # Use this to debug the time take to pack the image
 #state.TimingShow()
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index e849d96587c..62ee86b9b75 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -340,7 +340,7 @@ class TestFunctional(unittest.TestCase):
 use_expanded=False, verbosity=None, allow_missing=False,
 allow_fake_blobs=False, extra_indirs=None, threads=None,
 test_section_timeout=False, update_fdt_in_elf=None,
-force_missing_bintools=''):
+force_missing_bintools='', ignore_missing=False):
 """Run binman with a given test file
 
 Args:
@@ -403,6 +403,

[PATCH v5 06/16] buildman: Drop mention of MAKEALL

2022-11-09 Thread Simon Glass
This script was removed about 6 years ago so most people should be aware
that it is not needed anymore. Drop mention of it.

Signed-off-by: Simon Glass 
---

(no changes since v3)

Changes in v3:
- Add new patch to drop mention of MAKEALL

 tools/buildman/buildman.rst | 110 
 1 file changed, 110 deletions(-)

diff --git a/tools/buildman/buildman.rst b/tools/buildman/buildman.rst
index ae0b60648d9..d0b7bbd2b0d 100644
--- a/tools/buildman/buildman.rst
+++ b/tools/buildman/buildman.rst
@@ -3,8 +3,6 @@
 Buildman build tool
 ===
 
-(Please read 'How to change from MAKEALL' if you are used to that tool)
-
 Quick-start
 ---
 
@@ -1250,114 +1248,6 @@ latter number depends on the speed of your machine and 
the efficiency of the
 U-Boot build.
 
 
-How to change from MAKEALL
---
-
-Buildman includes most of the features of MAKEALL and is generally faster
-and easier to use. In particular it builds entire branches: if a particular
-commit introduces an error in a particular board, buildman can easily show
-you this, even if a later commit fixes that error.
-
-The reasons to deprecate MAKEALL are:
-- We don't want to maintain two build systems
-- Buildman is typically faster
-- Buildman has a lot more features
-
-But still, many people will be sad to lose MAKEALL. If you are used to
-MAKEALL, here are a few pointers.
-
-First you need to set up your tool chains - see the 'Setting up' section
-for details. Once you have your required toolchain(s) detected then you are
-ready to go.
-
-To build the current source tree, run buildman without a -b flag:
-
-.. code-block:: bash
-
-   ./tools/buildman/buildman 
-
-This will build the current source tree for the given boards and display
-the results and errors.
-
-However buildman usually works on entire branches, and for that you must
-specify a board flag:
-
-.. code-block:: bash
-
-   ./tools/buildman/buildman -b  
-
-followed by (afterwards, or perhaps concurrently in another terminal):
-
-.. code-block:: bash
-
-   ./tools/buildman/buildman -b  -s 
-
-to see the results of the build. Rather than showing you all the output,
-buildman just shows a summary, with red indicating that a commit introduced
-an error and green indicating that a commit fixed an error. Use the -e
-flag to see the full errors and -l to see which boards caused which errors.
-
-If you really want to see build results as they happen, use -v when doing a
-build (and -e to see the errors/warnings too).
-
-You don't need to stick around on that branch while buildman is running. It
-checks out its own copy of the source code, so you can change branches,
-add commits, etc. without affecting the build in progress.
-
-The  can include board names, architectures or the
-like. There are no flags to disambiguate since ambiguities are rare. Using
-the examples from MAKEALL:
-
-Examples::
-
-  - build all Power Architecture boards:
-  MAKEALL -a powerpc
-  MAKEALL --arch powerpc
-  MAKEALL powerpc
-  ** buildman -b  powerpc
-  - build all PowerPC boards manufactured by vendor "esd":
-  MAKEALL -a powerpc -v esd
-  ** buildman -b  esd
-  - build all PowerPC boards manufactured either by "keymile" or "siemens":
-  MAKEALL -a powerpc -v keymile -v siemens
-  ** buildman -b  keymile siemens
-  - build all Freescale boards with MPC83xx CPUs, plus all 4xx boards:
-  MAKEALL -c mpc83xx -v freescale 4xx
-  ** buildman -b  mpc83xx freescale 4xx
-
-Buildman automatically tries to use all the CPUs in your machine. If you
-are building a lot of boards it will use one thread for every CPU core
-it detects in your machine. This is like MAKEALL's BUILD_NBUILDS option.
-You can use the -T flag to change the number of threads. If you are only
-building a few boards, buildman will automatically run make with the -j
-flag to increase the number of concurrent make tasks. It isn't normally
-that helpful to fiddle with this option, but if you use the BUILD_NCPUS
-option in MAKEALL then -j is the equivalent in buildman.
-
-Buildman puts its output in ../ by default but you can change
-this with the -o option. Buildman normally does out-of-tree builds: use -i
-to disable that if you really want to. But be careful that once you have
-used -i you pollute buildman's copies of the source tree, and you will need
-to remove the build directory (normally ../) to run buildman
-in normal mode (without -i).
-
-Buildman doesn't keep the output result normally, but use the -k option to
-do this.
-
-Please read 'Theory of Operation' a few times as it will make a lot of
-things clearer.
-
-Some options you might like are::
-
-   -B shows which functions are growing/shrinking in which commit - great
-for finding code bloat.
-   -S shows image sizes for each commit (just an overall summary)
-   -u shows boards that you haven't built yet
-   --step 0 will build just the upstream commit and the last commit of 

[PATCH v5 03/16] doc: Correct the path to the Makefile documentation

2022-11-09 Thread Simon Glass
This is out-of-date now. Fix it.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 scripts/Kbuild.include | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 9c14310ad40..62e0207f91b 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -229,7 +229,7 @@ objectify = $(foreach o,$(1),$(if $(filter 
/%,$(o)),$(o),$(obj)/$(o)))
 # if_changed_dep  - as if_changed, but uses fixdep to reveal dependencies
 #   including used config symbols
 # if_changed_rule - as if_changed but execute rule instead
-# See Documentation/kbuild/makefiles.txt for more info
+# See doc/develop/makefiles.rst for more info
 
 ifneq ($(KBUILD_NOCMDDEP),1)
 # Check if both arguments are the same including their order. Result is empty
-- 
2.38.1.431.g37b22c650d-goog



[PATCH v5 02/16] Makefile: Correct the binman rule

2022-11-09 Thread Simon Glass
This currently uses if_changed on a phony target. Use a real file as the
target and add FORCE at the end, as required. Drop the 'inputs' phony
since it is not needed.

Signed-off-by: Simon Glass 
---

(no changes since v2)

Changes in v2:
- Use a separate rule for running binman

 Makefile | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index d6699a54dbb..93d5c064f4c 100644
--- a/Makefile
+++ b/Makefile
@@ -1108,18 +1108,15 @@ define deprecated
 
 endef
 
-PHONY += inputs
-inputs: $(INPUTS-y)
-
-all: .binman_stamp inputs
+# Timestamp file to make sure that binman always runs
+.binman_stamp: $(INPUTS-y) FORCE
 ifeq ($(CONFIG_BINMAN),y)
$(call if_changed,binman)
 endif
-
-# Timestamp file to make sure that binman always runs
-.binman_stamp: FORCE
@touch $@
 
+all: .binman_stamp
+
 ifeq ($(CONFIG_DEPRECATED),y)
$(warning "You have deprecated configuration options enabled in your 
.config! Please check your configuration.")
 endif
-- 
2.38.1.431.g37b22c650d-goog



[PATCH v5 01/16] image: Correct strncpy() warning with image_set_name()

2022-11-09 Thread Simon Glass
gcc 12 seems to warn on strncpy() as a matter of course. Rewrite the code
a different way to do the same thing, to avoid the warning.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 include/image.h | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/image.h b/include/image.h
index 65d0d4f4387..6f21dafba8c 100644
--- a/include/image.h
+++ b/include/image.h
@@ -853,7 +853,13 @@ image_set_hdr_b(comp)  /* image_set_comp */
 
 static inline void image_set_name(struct legacy_img_hdr *hdr, const char *name)
 {
-   strncpy(image_get_name(hdr), name, IH_NMLEN);
+   /*
+* This is equivalent to: strncpy(image_get_name(hdr), name, IH_NMLEN);
+*
+* Use the tortured code below to avoid a warning with gcc 12. We do not
+* want to include a nul terminator if the name is of length IH_NMLEN
+*/
+   memcpy(image_get_name(hdr), name, strnlen(name, IH_NMLEN));
 }
 
 int image_check_hcrc(const struct legacy_img_hdr *hdr);
-- 
2.38.1.431.g37b22c650d-goog



Re: [PATCH v4 11/11] buildman: Add --allow-missing flag to allow missing blobs

2022-11-09 Thread Simon Glass
Hi Quentin & Heinrich,

On Wed, 9 Nov 2022 at 09:03, Quentin Schulz
 wrote:
>
> Hi Simon,
>
> On 11/8/22 00:28, Simon Glass wrote:
> > From: Tom Rini 
> >
> > Add a new flag to buildman so that we will in turn pass
> > BINMAN_ALLOW_MISSING=1 to 'make'. Make use of this flag in CI.
> >
> > Allow the settings file to control this.
> >
> > Cc: Rasmus Villemoes 
> > Cc: Simon Glass 
> > Signed-off-by: Tom Rini 
> > Signed-off-by: Simon Glass 
> > ---
> >
> > (no changes since v3)
> >
>
> There were actually substantial changes between v3 and v4.
>
> > Changes in v3:
> > - Add tests docs and a settings-file option
> >
> >   .azure-pipelines.yml|  2 +-
> >   .gitlab-ci.yml  |  6 +--
> >   tools/buildman/bsettings.py | 16 ++
> >   tools/buildman/builder.py   |  5 +-
> >   tools/buildman/builderthread.py |  2 +
> >   tools/buildman/buildman.rst | 43 +++
> >   tools/buildman/cmdline.py   |  6 +++
> >   tools/buildman/control.py   | 29 +-
> >   tools/buildman/func_test.py | 96 +++--
> >   9 files changed, 196 insertions(+), 9 deletions(-)

Thanks for the reviews. I'll send v5 soon.

Regards,
Simon


Re: [PATCH v3 3/9] binman: Use an exit code when blobs are missing

2022-11-09 Thread Simon Glass
Hi Quentin,

On Mon, 7 Nov 2022 at 07:17, Quentin Schulz
 wrote:
>
> Hi Simon,
>
> On 11/6/22 00:04, Simon Glass wrote:
> > At present binman returns success when told to handle missing blobs.
> > This is confusing this in fact the resulting image cannot work.
> >
> > Use exit code 103 to signal this problem, with a -W option to convert
> > it to a warning.
> >
> > Add documentation about exit codes while we are here.
> >
> > Signed-off-by: Simon Glass 
> > ---
> >
> > (no changes since v1)
> >
> >   tools/binman/binman.rst | 21 +
> >   tools/binman/cmdline.py |  3 +++
> >   tools/binman/control.py |  7 ++-
> >   tools/binman/ftest.py   | 20 ++--
> >   4 files changed, 48 insertions(+), 3 deletions(-)
> >
> > diff --git a/tools/binman/binman.rst b/tools/binman/binman.rst
> > index fda16f1992d..30ced31e43b 100644
> > --- a/tools/binman/binman.rst
> > +++ b/tools/binman/binman.rst
> > @@ -1461,6 +1461,10 @@ space-separated list of directories to search for 
> > binary blobs::
> >  odroid-c4/build/board/hardkernel/odroidc4/firmware \
> >  odroid-c4/build/scp_task" binman ...
> >
> > +Note that binman fails with exit code 103 when there are missing blobs. If 
> > you
> > +wish binman to continue anyway, you can pass `-W` to binman.
> > +
> > +
> >   Code coverage
> >   -
> >
> > @@ -1472,6 +1476,23 @@ To enable Python test coverage on Debian-type 
> > distributions (e.g. Ubuntu)::
> >  $ sudo apt-get install python-coverage python3-coverage python-pytest
> >
> >
> > +Exit status
> > +---
> > +
> > +Binman produces the following exit codes:
> > +
> > +0
> > +Success
> > +
> > +1
> > +Any sort of failure - see output for more details
> > +
> > +103
> > +There are missing external blobs or bintools. This is only returned if
> > +-M is passed to binman, otherwise missing blobs return in an exit 
> > status of
>
> and if -W is *not* passed to binman, no?]

will update

>
> > +1.
> > +
> > +
> >   Error messages
> >   --
> >
> > diff --git a/tools/binman/cmdline.py b/tools/binman/cmdline.py
> > index 1d1ca43993d..144c0c916a2 100644
> > --- a/tools/binman/cmdline.py
> > +++ b/tools/binman/cmdline.py
> > @@ -128,6 +128,9 @@ controlled by a description in the board device tree.'''
> >   default=False, help='Update the binman node with offset/size 
> > info')
> >   build_parser.add_argument('--update-fdt-in-elf', type=str,
> >   help='Update an ELF file with the output dtb: 
> > infile,outfile,begin_sym,end_sym')
> > +build_parser.add_argument(
> > +'-W', '--ignore-missing-blobs', action='store_true', default=False,
> > +help='Return success even if there are missing blobs')
> >
>
> Is -W supposed to be able to be used without --allow-missing? If not, I
> think it could make sense to use a subparser here to have the -W option
> available only when -M is selected?

I am not sure how to do that, but have updated help.

>
> >   subparsers.add_parser(
> >   'bintool-docs', help='Write out bintool documentation (see 
> > bintool.rst)')
> > diff --git a/tools/binman/control.py b/tools/binman/control.py
> > index bfe63a15204..8b94db60113 100644
> > --- a/tools/binman/control.py
> > +++ b/tools/binman/control.py
> > @@ -742,7 +742,12 @@ def Binman(args):
> >   elf.UpdateFile(*elf_params, data)
> >
> >   if invalid:
> > -tout.warning("\nSome images are invalid")
> > +msg = '\nSome images are invalid'
> > +if args.ignore_missing_blobs:
> > +tout.warning(msg)
> > +else:
> > +tout.error(msg)
> > +return 103
>
> I think this could be an issue.
>
> invalid can mean either missing blob, faked blob or missing btool. Here,
> we only want to warn/fail in case of missing blob and not the other two?

I'll rename the option as the intent is to use it for missing blobs
and bintools, since they both result in the same thing. A faked blob
is just a subset of a missing blob, so there really just needs to be
an --allow-missing option.

>
> Also, shouldn't we have this only if we have allow_missing set?
>
> >
> >   # Use this to debug the time take to pack the image
> >   #state.TimingShow()
> > diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
> > index e849d96587c..fc38a2efccd 100644
> > --- a/tools/binman/ftest.py
> > +++ b/tools/binman/ftest.py
> > @@ -340,7 +340,7 @@ class TestFunctional(unittest.TestCase):
> >   use_expanded=False, verbosity=None, 
> > allow_missing=False,
> >   allow_fake_blobs=False, extra_indirs=None, 
> > threads=None,
> >   test_section_timeout=False, update_fdt_in_elf=None,
> > -force_missing_bintools=''):
> > +force_missing_bintools='', ignore_missing_blobs=False):
> >

Re: [PATCH v4 04/21] dm: blk: Add probe in blk_first_device/blk_next_device

2022-11-09 Thread Simon Glass
On Mon, 10 Oct 2022 at 16:33, Simon Glass  wrote:
>
> Hi Michal,
>
> On Mon, 10 Oct 2022 at 15:33, Michal Suchánek  wrote:
> >
> > On Mon, Oct 10, 2022 at 09:49:20PM +0200, Michal Suchánek wrote:
> > > On Sun, Oct 02, 2022 at 07:10:40PM -0600, Simon Glass wrote:
> > > > Hi Michal,
> > > >
> > > > On Sun, 2 Oct 2022 at 13:34, Michal Suchánek  wrote:
> > > > >
> > > > > On Thu, Sep 29, 2022 at 04:00:26AM -0600, Simon Glass wrote:
> > > > > > Hi Michal,
> > > > > >
> > > > > > On Sun, 25 Sept 2022 at 02:28, Michal Suchanek  
> > > > > > wrote:
> > > > > > >
> > > > > > > The description claims that the device is probed but it isn't.
> > > > > > >
> > > > > > > Add the device_probe() call.
> > > > > > >
> > > > > > > Also consolidate the iteration into one function.
> > > > > > >
> > > > > > > Fixes: 8a5cbc065d ("dm: blk: Use uclass_find_first/next_device() 
> > > > > > > in blk_first/next_device()")
> > > > > > > Signed-off-by: Michal Suchanek 
> > > > > > > ---
> > > > > > >  drivers/block/blk-uclass.c | 46 
> > > > > > > ++
> > > > > > >  1 file changed, 22 insertions(+), 24 deletions(-)
> > > > > > >
> > > > > > > diff --git a/drivers/block/blk-uclass.c 
> > > > > > > b/drivers/block/blk-uclass.c
> > > > > > > index 21c5209bb6..992f8ad3da 100644
> > > > > > > --- a/drivers/block/blk-uclass.c
> > > > > > > +++ b/drivers/block/blk-uclass.c
> > > > > > > @@ -361,45 +361,43 @@ int blk_dselect_hwpart(struct blk_desc 
> > > > > > > *desc, int hwpart)
> > > > > > > return blk_select_hwpart(desc->bdev, hwpart);
> > > > > > >  }
> > > > > > >
> > > > > > > -int blk_first_device(int if_type, struct udevice **devp)
> > > > > > > +static int _blk_next_device(int if_type, struct udevice **devp)
> > > > > > >  {
> > > > > > > struct blk_desc *desc;
> > > > > > > -   int ret;
> > > > > > > +   int ret = 0;
> > > > > > > +
> > > > > > > +   for (; *devp; uclass_find_next_device(devp)) {
> > > > > > > +   desc = dev_get_uclass_plat(*devp);
> > > > > > > +   if (desc->if_type == if_type) {
> > > > > > > +   ret = device_probe(*devp);
> > > > > > > +   if (!ret)
> > > > > > > +   return 0;
> > > > > > > +   }
> > > > > > > +   }
> > > > > > >
> > > > > > > -   ret = uclass_find_first_device(UCLASS_BLK, devp);
> > > > > > > if (ret)
> > > > > > > return ret;
> > > > > > > -   if (!*devp)
> > > > > > > -   return -ENODEV;
> > > > > > > -   do {
> > > > > > > -   desc = dev_get_uclass_plat(*devp);
> > > > > > > -   if (desc->if_type == if_type)
> > > > > > > -   return 0;
> > > > > > > -   ret = uclass_find_next_device(devp);
> > > > > > > -   if (ret)
> > > > > > > -   return ret;
> > > > > > > -   } while (*devp);
> > > > > >
> > > > > > This looks wrong since a media device may have other devices under 
> > > > > > it,
> > > > > > e.g. UCLASS_BOOTDEV so I think you should keep the existing code and
> > > > > > just call uclass_probe() at the end.
> > > > > >
> > > > > > You could add a test for this by checking that only the BLK device 
> > > > > > is probed.
> > > > >
> > > > > The description says that it returns ready to use device, and that's 
> > > > > not
> > > > > possible when the device is only probed at the end when it is to be
> > > > > returned.
> > > >
> > > > Why is that?
> > >
> > > There are two options:
> > >
> > >  - probe the device, and skip it if it fails, potentially probing
> > >multiple devices before returning one
> > >  - decide what device to return, probe it, and if it fails return
> > >non-activated device
> > >
> > > > > There are some tests of this function but very few users so it may be 
> > > > > OK
> > > > > to change the semantic again to resemble the _check variant uclass
> > > > > iterator and retorn broken devices but I don't think that was the 
> > > > > intent
> > > > > here with using uclass_first_device/uclass_next_device originally.
> > > >
> > > > I agree.
> > > >
> > > > >
> > > > > Also this change only makes a difference to the amount of devices 
> > > > > probed
> > > > > for callers that only call the blk_first_device and never move on to 
> > > > > the
> > > > > next. Callers that use the functions for iteration will move on to the
> > > > > next device and probe it anyway.
> > > >
> > > > OK, perhaps I understand this. But don't you need to update the
> > > > comment in the header file to say that devices that don't probe are
> > > > silently skipped?
> > >
> > > They are not ready to use so they cannot be returned by the current
> > > description?
> > >
> > > >
> > > > Also it really does need a test.
> > >
> > > Right, tests are good to prevent similar regression in the future.
> >
> > But we don't have the boilerplate for testing failure in block
> > device

[PATCH v5 00/16] buildman: Correct various issues with missing blobs

2022-11-09 Thread Simon Glass
This series attempts to tidy up the problem of missing blobs, making
U-Boot default to failing the build, but providing ways to configure this
so that buildman can still be used for build testing by people who don't
have the blobs or don't care about them.

This is based on discussion in [1] as well as some experimentation.

It also moves the buildman docs to rST and tidies up some toolchain
settings and documentation.

[1] 
https://patchwork.ozlabs.org/project/uboot/patch/20221010151831.3376759-2-tr...@konsulko.com/

Changes in v5:
- Add a note that -W requires -M
- Update ftest use of -W to avoid confusion
- Update exit-status docs to mention -W also
- Rename flag to --ignore-missing
- Update commit message
- Correct help for -M flag
- Correct --- Warning --- section
- Convert the buildman args to a list
- Add new patch with a separate section about environment variables
- Add new patch to ensure config_fname is inited
- Add new patch to reinstate removal of temp output dir in tests
- Split out config_fname change into a separate patch
- Rename GetGlobalValue to GetGlobalItemValue
- Fix 'items' typo
- Simplify implementation of GetGlobalItemValue()
- Use '[global]' for the doc heading
- Use double tick for arguments
- Drop redundant allow_missing code
- Split out the tests more
- Add new patch with documentation for the command line args

Changes in v4:
- Add a patch to update the arc toolchain
- Add new patch to update the default settings file
- Leave the arc toolchain in there
- Various changes that were unfortunately not recorded

Changes in v3:
- Add new patch to convert documentation to rST
- Add new patch to drop mention of MAKEALL
- Add new patch to drop mention of old architectures
- Add tests docs and a settings-file option

Changes in v2:
- Use a separate rule for running binman

Simon Glass (14):
  image: Correct strncpy() warning with image_set_name()
  Makefile: Correct the binman rule
  doc: Correct the path to the Makefile documentation
  binman: Use an exit code when blobs are missing
  buildman: Convert documentation to rST
  buildman: Drop mention of MAKEALL
  buildman: Update the arc toolchain
  buildman: Update the default settings file
  buildman: Drop mention of old architectures
  buildman: Detect binman reporting missing blobs
  binman: Add a separate section about environment variables
  buildman: Ensure config_fname is inited
  buildman: Reinstate removal of temp output dir in tests
  binman: Add documentation for the command line args

Tom Rini (2):
  global: Do not default to faking missing binaries for buildman
  buildman: Add --allow-missing flag to allow missing blobs

 .azure-pipelines.yml|2 +-
 .gitlab-ci.yml  |6 +-
 Makefile|   15 +-
 doc/build/buildman.rst  |1 +
 doc/build/index.rst |1 +
 include/image.h |8 +-
 scripts/Kbuild.include  |2 +-
 tools/binman/binman.rst |  352 +++-
 tools/binman/cmdline.py |5 +-
 tools/binman/control.py |9 +-
 tools/binman/ftest.py   |   19 +-
 tools/buildman/README   | 1349 ---
 tools/buildman/README.rst   |1 +
 tools/buildman/bsettings.py |   17 +-
 tools/buildman/builder.py   |5 +-
 tools/buildman/builderthread.py |8 +-
 tools/buildman/buildman.rst | 1328 ++
 tools/buildman/cmdline.py   |6 +
 tools/buildman/control.py   |   28 +-
 tools/buildman/func_test.py |  112 ++-
 20 files changed, 1893 insertions(+), 1381 deletions(-)
 create mode 12 doc/build/buildman.rst
 delete mode 100644 tools/buildman/README
 create mode 12 tools/buildman/README.rst
 create mode 100644 tools/buildman/buildman.rst

-- 
2.38.1.431.g37b22c650d-goog



Re: [PATCH 1/2] arm: mediatek: add mt8195 SOC support

2022-11-09 Thread Tom Rini
On Wed, Nov 09, 2022 at 09:09:28PM +0100, Pali Rohár wrote:
> + Tom
> - all
> 
> On Wednesday 09 November 2022 15:10:59 Macpaul Lin wrote:
> > On 11/8/22 15:57, Pali Rohár wrote:
> > > Hello! I'm not mediatek maintainer and if this patch series is not
> > > something important for me which should I review then please do not send
> > > me lot of these emails... As I would have time to review stuff which are
> > > important.
> > 
> > I'm so sorry for bothering you and other developers.
> > I've used ./scripts/get_maintainer.pl to check these 2 patches and found you
> > all in the suggestion list.
> > 
> > Result:
> > "Pali Rohár" 
> > (added_lines:16/253=6%,removed_lines:12/76=16%)
> > 
> > I'll remove Pali when I send next version.
> > Who else don't want to be involved in these reviewing activities of MediaTek
> > platforms, please let us know.
> > 
> > [deleted]
> > 
> > Thanks!
> > Macpaul Lin
> 
> I think that this is improper configuration of that get_maintainer.pl
> script. As it currently spams tons of people. And it is not really a
> good idea to spam people about unrelated stuff. Tom, could you do
> something with it?

I've been waiting for someone to submit a patch to tweak
.get_maintainers.conf based on what I think Sean suggested last time.
But in this case I'm not even sure what file was suggesting you.

-- 
Tom


signature.asc
Description: PGP signature


Re: [maemo-leste] Broken u-boot on n900 hw (possibly CONFIG_POSITION_INDEPENDENT)

2022-11-09 Thread Pali Rohár
On Wednesday 02 November 2022 01:08:26 Pali Rohár wrote:
> On Friday 21 October 2022 21:09:55 Pali Rohár wrote:
> > On Thursday 20 October 2022 22:06:58 Pali Rohár wrote:
> > > On Monday 10 October 2022 23:30:21 Sicelo wrote:
> > > > On Sun, Oct 09, 2022 at 09:33:17PM +0200, Pali Rohár wrote:
> > > > > Hello!
> > > > > 
> > > > > Current u-boot from master branch does not work on n900 hw. It does 
> > > > > not
> > > > > show anything on display, there just nokia logo.
> > > > > 
> > > > > In qemu it is working fine and all tests are passing. Also in qemu is
> > > > > display working without any problem.
> > > > > 
> > > > > Could you help me to debug it? Maybe something is printed to serial
> > > > > console? Or maybe serial console could be used for printf-debugging?
> > > > > 
> > > > > I just figured out that disabling CONFIG_POSITION_INDEPENDENT u-boot
> > > > > option make it working again. But it requires to restoring older 
> > > > > version
> > > > > of lowlevel_init.S file which does not depend on POSITION_INDEPENDENT:
> > > > > 
> > > > > git checkout 7c4ad9821758f98db127e9d6864671c906c02d3b -- 
> > > > > board/nokia/rx51/lowlevel_init.S
> > > > > 
> > > > > And also setting CONFIG_SYS_TEXT_BASE=0x80008000 (to some value in 
> > > > > RAM).
> > > > 
> > > > Hi
> > > > 
> > > > I have a really crude serial console setup in place now, but very little
> > > > time, and even less experience with u-boot. I should be able to do the
> > > > tests for you on Saturday night (UTC+2). Perhaps over IRC might be a
> > > > good idea, in case I need some hand-holding, and if you still need the
> > > > help by then.
> > > > 
> > > > Regards
> > > > Sicelo
> > > 
> > > Well, I do not know where to start or how to instruct somebody who is
> > > not experienced with u-boot debugging. I think that the first step
> > > should be to look if U-Boot prints something on the serial console or
> > > not. If it prints then try to find via printf-driven-debugging place
> > > where it stuck. If it does not print anything on the console then try to
> > > setup debug early console, check if it prints something now and do same
> > > type of debugging. And if even early debug console does not work then
> > > probably initialize serial console directly in lowlevel_init.S file,
> > > prints something to serial, then move code for printing to later stage
> > > and try to figure out what is broken...
> > 
> > Early debug uart console can be enabled by configs/nokia_rx51_defconfig 
> > options:
> > 
> > CONFIG_DEBUG_UART=y
> > CONFIG_DEBUG_UART_OMAP=y
> > CONFIG_DEBUG_UART_SHIFT=2
> > CONFIG_DEBUG_UART_BASE=0x4902
> > CONFIG_DEBUG_UART_CLOCK=4800
> > 
> > And all debug verbose logs can be enabled by configs/nokia_rx51_defconfig 
> > options:
> > 
> > CONFIG_DM_DEBUG=y
> > CONFIG_LOG=y
> > CONFIG_LOGLEVEL=9
> > CONFIG_LOG_MAX_LEVEL=9
> > CONFIG_LOG_DEFAULT_LEVEL=9
> > 
> > By compiling via 'make u-boot.bin KCPPFLAGS=-DLOG_DEBUG'
> 
> Can somebody with serial console provide this debug output if there is
> something useful?

Can somebody help me with this?

> > At least in qemu it is working and printing everything.
> > 
> > > Anybody else with serial console can look at it?
> > > 
> > > Or maybe look at the code if you spot some issue there?


Re: [PATCH 1/2] arm: mediatek: add mt8195 SOC support

2022-11-09 Thread Pali Rohár
+ Tom
- all

On Wednesday 09 November 2022 15:10:59 Macpaul Lin wrote:
> On 11/8/22 15:57, Pali Rohár wrote:
> > Hello! I'm not mediatek maintainer and if this patch series is not
> > something important for me which should I review then please do not send
> > me lot of these emails... As I would have time to review stuff which are
> > important.
> 
> I'm so sorry for bothering you and other developers.
> I've used ./scripts/get_maintainer.pl to check these 2 patches and found you
> all in the suggestion list.
> 
> Result:
> "Pali Rohár" 
> (added_lines:16/253=6%,removed_lines:12/76=16%)
> 
> I'll remove Pali when I send next version.
> Who else don't want to be involved in these reviewing activities of MediaTek
> platforms, please let us know.
> 
> [deleted]
> 
> Thanks!
> Macpaul Lin

I think that this is improper configuration of that get_maintainer.pl
script. As it currently spams tons of people. And it is not really a
good idea to spam people about unrelated stuff. Tom, could you do
something with it?


Re: [PATCH v2 8/8] imx: imx8: apalis: switch to binman

2022-11-09 Thread Marcel Ziswiler
Hi Oliver

Thanks for working on this.

On Fri, 2022-11-04 at 16:03 +0100, Oliver Graute wrote:
> Switch to use binman to pack images
> 
> Signed-off-by: Oliver Graute 
> ---
> Changes for v2
>  - use common imx8qm-u-boot.dtsi
>  - guard SPL nodes with CONFIG_SPL

I don't think it is that simple. Even after guarding them SPL nodes the 
flash.bin one still references them,
not? And yes, so far we never used SPL for them 8/8X as that honestly does not 
really make much sense given the
SCFW does the actual RAM initialisation. Anyway, I am not very clear on 
how/what exactly that all means now.

Another topic is that flash.bin is now just the SPL whereas previously 
u-boot-dtb.imx was the entire thing. But
again, that could have been related to us not using SPL.

>  arch/arm/dts/fsl-imx8qm-apalis-u-boot.dtsi | 2 ++
>  arch/arm/dts/imx8qm-u-boot.dtsi    | 2 ++
>  arch/arm/mach-imx/imx8/Kconfig | 1 +
>  configs/apalis-imx8_defconfig  | 1 +
>  4 files changed, 6 insertions(+)
> 
> diff --git a/arch/arm/dts/fsl-imx8qm-apalis-u-boot.dtsi 
> b/arch/arm/dts/fsl-imx8qm-apalis-u-boot.dtsi
> index 956d724979..8fd0e33d2b 100644
> --- a/arch/arm/dts/fsl-imx8qm-apalis-u-boot.dtsi
> +++ b/arch/arm/dts/fsl-imx8qm-apalis-u-boot.dtsi
> @@ -3,6 +3,8 @@
>   * Copyright 2019 Toradex AG
>   */
>  
> +#include "imx8qm-u-boot.dtsi"
> +
>  &mu {
> u-boot,dm-pre-proper;
>  };
> diff --git a/arch/arm/dts/imx8qm-u-boot.dtsi b/arch/arm/dts/imx8qm-u-boot.dtsi
> index f3fc90c9bb..3507489a81 100644
> --- a/arch/arm/dts/imx8qm-u-boot.dtsi
> +++ b/arch/arm/dts/imx8qm-u-boot.dtsi
> @@ -10,6 +10,7 @@
>  };
>  
>  &binman {
> +#ifdef CONFIG_SPL
> u-boot-spl-ddr {
> align = <4>;
> align-size = <4>;
> @@ -33,6 +34,7 @@
> };
> };
> };
> +#endif
>  
> itb {
> filename = "u-boot.itb";
> diff --git a/arch/arm/mach-imx/imx8/Kconfig b/arch/arm/mach-imx/imx8/Kconfig
> index 37d12d1895..91bd888308 100644
> --- a/arch/arm/mach-imx/imx8/Kconfig
> +++ b/arch/arm/mach-imx/imx8/Kconfig
> @@ -46,6 +46,7 @@ choice
>  
>  config TARGET_APALIS_IMX8
> bool "Support Apalis iMX8 module"
> +   select BINMAN
> select BOARD_LATE_INIT
> select IMX8QM
>  
> diff --git a/configs/apalis-imx8_defconfig b/configs/apalis-imx8_defconfig
> index 32e105a557..0c331b62cb 100644
> --- a/configs/apalis-imx8_defconfig
> +++ b/configs/apalis-imx8_defconfig
> @@ -17,6 +17,7 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
>  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x8020
>  CONFIG_REMAKE_ELF=y
>  CONFIG_FIT=y
> +CONFIG_FIT_EXTERNAL_OFFSET=0x3000

Also not quite sure what exactly that is now.

>  CONFIG_FIT_VERBOSE=y
>  CONFIG_OF_SYSTEM_SETUP=y
>  CONFIG_LOG=y

Cheers

Marcel


Re: [PATCH v2 0/8] imx8: switch missing boards to binman

2022-11-09 Thread Fabio Estevam
Hi Oliver and Stefano,

On Wed, Nov 9, 2022 at 1:19 PM Oliver Graute  wrote:

> For my imx8qm boards I need to manually place these imx firmware blobs with
> expected names for sucessfull image creation.
>
> As I understood the CI creates somes fakes. But I don't know where this
> is happening.

CI is falling with your series applied:

https://source.denx.de/u-boot/custodians/u-boot-imx/-/jobs/525787

It is easy to reproduce the failure locally. Just remove
ahab-container.img from the
U-Boot tree and try to build imx8qxp_mek_defconfig.

Prior to the binman conversion:

WARNING './ahab-container.img' not found, resulting binary is not-functional
make[1]: Nothing to be done for 'SPL'.

Only a warning is issued.

After the binman conversion:

WARNING './ahab-container.img' not found, resulting binary is not-functional
make[1]: Nothing to be done for 'SPL'.
  BINMAN  all
binman: Error 1 running 'mkimage -d ./mkimage.spl.mkimage -n
spl/u-boot-spl.cfgout -T imx8image -e 0x10
./mkimage-out.spl.mkimage': Fail open first container file
ahab-container.img

make: *** [Makefile:1116: all] Error 1

Maybe someone has any suggestions?


[PATCH v3 2/2] doc: board: j721e_evm: Fix code-block type and indents

2022-11-09 Thread Andrew Davis
 * BASH code should be labeled as such.
 * Code blocks should be indented by 4 spaces.

Fix these here.

Suggested-by: Heinrich Schuchardt 
Signed-off-by: Andrew Davis 
---

Changes from v2:
 - None

Changes from v1:
 - New patch with fixes suggested by Heinrich

 doc/board/ti/j721e_evm.rst | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/doc/board/ti/j721e_evm.rst b/doc/board/ti/j721e_evm.rst
index 8608373365..ad70f15b7a 100644
--- a/doc/board/ti/j721e_evm.rst
+++ b/doc/board/ti/j721e_evm.rst
@@ -154,37 +154,37 @@ Build procedure:
 
 1. SYSFW:
 
-.. code-block:: text
+.. code-block:: bash
 
- $ make CROSS_COMPILE=arm-linux-gnueabihf- SOC=j721e
+make CROSS_COMPILE=arm-linux-gnueabihf- SOC=j721e
 
 2. ATF:
 
-.. code-block:: text
+.. code-block:: bash
 
- $ make CROSS_COMPILE=aarch64-linux-gnu- ARCH=aarch64 PLAT=k3 
TARGET_BOARD=generic SPD=opteed
+make CROSS_COMPILE=aarch64-linux-gnu- ARCH=aarch64 PLAT=k3 
TARGET_BOARD=generic SPD=opteed
 
 3. OPTEE:
 
-.. code-block:: text
+.. code-block:: bash
 
- $ make PLATFORM=k3-j721e CFG_ARM64_core=y
+make PLATFORM=k3-j721e CFG_ARM64_core=y
 
 4. U-Boot:
 
 * 4.1 R5:
 
-.. code-block:: text
+.. code-block:: bash
 
- $ make CROSS_COMPILE=arm-linux-gnueabihf- j721e_evm_r5_defconfig O=build/r5
- $ make CROSS_COMPILE=arm-linux-gnueabihf- O=build/r5
+make CROSS_COMPILE=arm-linux-gnueabihf- j721e_evm_r5_defconfig O=build/r5
+make CROSS_COMPILE=arm-linux-gnueabihf- O=build/r5
 
 * 4.2 A72:
 
-.. code-block:: text
+.. code-block:: bash
 
- $ make CROSS_COMPILE=aarch64-linux-gnu- j721e_evm_a72_defconfig O=build/a72
- $ make CROSS_COMPILE=aarch64-linux-gnu- ATF=/build/k3/generic/release/bl31.bin TEE=/out/arm-plat-k3/core/tee-pager_v2.bin DM=/ti-dm/j721e/ipc_echo_testb_mcu1_0_release_strip.xer5f O=build/a72
+make CROSS_COMPILE=aarch64-linux-gnu- j721e_evm_a72_defconfig O=build/a72
+make CROSS_COMPILE=aarch64-linux-gnu- ATF=/build/k3/generic/release/bl31.bin TEE=/out/arm-plat-k3/core/tee-pager_v2.bin DM=/ti-dm/j721e/ipc_echo_testb_mcu1_0_release_strip.xer5f O=build/a72
 
 Target Images
 --
-- 
2.38.1



[PATCH v3 1/2] doc: board: j721e_evm: Add DM firmware steps

2022-11-09 Thread Andrew Davis
J721e needs DM firmware when using updated SYSFW. Add steps to fetch,
build, and deploy the same.

Signed-off-by: Andrew Davis 
---

Changes from v2:
 - s/DM/DM Firmware

Changes from v1:
 - None

 doc/board/ti/j721e_evm.rst | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/doc/board/ti/j721e_evm.rst b/doc/board/ti/j721e_evm.rst
index 44dc316afd..8608373365 100644
--- a/doc/board/ti/j721e_evm.rst
+++ b/doc/board/ti/j721e_evm.rst
@@ -142,7 +142,11 @@ Sources:
Tree: https://github.com/OP-TEE/optee_os.git
Branch: master
 
-4. U-Boot:
+4. DM Firmware:
+   Tree: git://git.ti.com/processor-firmware/ti-linux-firmware.git
+   Branch: ti-linux-firmware
+
+5. U-Boot:
Tree: https://source.denx.de/u-boot/u-boot
Branch: master
 
@@ -152,7 +156,7 @@ Build procedure:
 
 .. code-block:: text
 
- $ make CROSS_COMPILE=arm-linux-gnueabihf-
+ $ make CROSS_COMPILE=arm-linux-gnueabihf- SOC=j721e
 
 2. ATF:
 
@@ -172,15 +176,15 @@ Build procedure:
 
 .. code-block:: text
 
- $ make CROSS_COMPILE=arm-linux-gnueabihf- j721e_evm_r5_defconfig O=/tmp/r5
- $ make CROSS_COMPILE=arm-linux-gnueabihf- O=/tmp/r5
+ $ make CROSS_COMPILE=arm-linux-gnueabihf- j721e_evm_r5_defconfig O=build/r5
+ $ make CROSS_COMPILE=arm-linux-gnueabihf- O=build/r5
 
 * 4.2 A72:
 
 .. code-block:: text
 
- $ make CROSS_COMPILE=aarch64-linux-gnu- j721e_evm_a72_defconfig O=/tmp/a72
- $ make CROSS_COMPILE=aarch64-linux-gnu- ATF=/build/k3/generic/release/bl31.bin TEE=/out/arm-plat-k3/core/tee-pager_v2.bin DM= 
O=/tmp/a72
+ $ make CROSS_COMPILE=aarch64-linux-gnu- j721e_evm_a72_defconfig O=build/a72
+ $ make CROSS_COMPILE=aarch64-linux-gnu- ATF=/build/k3/generic/release/bl31.bin TEE=/out/arm-plat-k3/core/tee-pager_v2.bin DM=/ti-dm/j721e/ipc_echo_testb_mcu1_0_release_strip.xer5f O=build/a72
 
 Target Images
 --
-- 
2.38.1



Re: [PATCH] doc: board: j721e_evm: Add DM firmware steps

2022-11-09 Thread Andrew Davis

On 11/6/22 2:49 AM, Heinrich Schuchardt wrote:

On 11/1/22 15:06, Andrew Davis wrote:

On 10/7/22 6:47 PM, Heinrich Schuchardt wrote:

On 10/7/22 22:37, Andrew Davis wrote:

J721e needs DM firmware when using updated SYSFW. Add steps to fetch,
build, and deploy the same.

Signed-off-by: Andrew Davis 
---
  doc/board/ti/j721e_evm.rst | 16 ++--
  1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/doc/board/ti/j721e_evm.rst b/doc/board/ti/j721e_evm.rst
index 44dc316afd..a7d7229722 100644
--- a/doc/board/ti/j721e_evm.rst
+++ b/doc/board/ti/j721e_evm.rst
@@ -142,7 +142,11 @@ Sources:
  Tree: https://github.com/OP-TEE/optee_os.git
  Branch: master

-4. U-Boot:
+4. DM:


DM in the context of U-Boot is used as abbreviation for driver model.

Please, provide a meaningful title.



Will rename to "DM Firmware" for v3.

Thanks,
Andrew


Best regards

Heinrich


+    Tree: git://git.ti.com/processor-firmware/ti-linux-firmware.git
+    Branch: ti-linux-firmware
+
+5. U-Boot:
  Tree: https://source.denx.de/u-boot/u-boot
  Branch: master

@@ -152,7 +156,7 @@ Build procedure:

  .. code-block:: text


Thanks for updating the documentation.

The code-blocks look like bash and not text. Please, correct this
information to allow syntax highlighting.



- $ make CROSS_COMPILE=arm-linux-gnueabihf-
+ $ make CROSS_COMPILE=arm-linux-gnueabihf- SOC=j721e


Please, remove the leading $-signs which are not helpful when copying to
the console.

Please indent code blocks by 4 spaces. Otherwise Sphinx cannot recognize
them.




Will fix all the code blocks then in a single patch, add it to this as
a follow up in a series.

Thanks,
Andrew



Best regards

Heinrich



  2. ATF:

@@ -172,15 +176,15 @@ Build procedure:

  .. code-block:: text

- $ make CROSS_COMPILE=arm-linux-gnueabihf- j721e_evm_r5_defconfig
O=/tmp/r5
- $ make CROSS_COMPILE=arm-linux-gnueabihf- O=/tmp/r5
+ $ make CROSS_COMPILE=arm-linux-gnueabihf- j721e_evm_r5_defconfig
O=build/r5
+ $ make CROSS_COMPILE=arm-linux-gnueabihf- O=build/r5

  * 4.2 A72:

  .. code-block:: text

- $ make CROSS_COMPILE=aarch64-linux-gnu- j721e_evm_a72_defconfig
O=/tmp/a72
- $ make CROSS_COMPILE=aarch64-linux-gnu- ATF=/build/k3/generic/release/bl31.bin TEE=/out/arm-plat-k3/core/tee-pager_v2.bin DM= O=/tmp/a72
+ $ make CROSS_COMPILE=aarch64-linux-gnu- j721e_evm_a72_defconfig
O=build/a72
+ $ make CROSS_COMPILE=aarch64-linux-gnu- ATF=/build/k3/generic/release/bl31.bin TEE=/out/arm-plat-k3/core/tee-pager_v2.bin DM=DM=/ti-dm/j721e/ipc_echo_testb_mcu1_0_release_strip.xer5f
O=build/a72

  Target Images
  --






Re: [PATCH v2 0/8] imx8: switch missing boards to binman

2022-11-09 Thread Marcel Ziswiler
On Fri, 2022-11-04 at 13:31 -0300, Fabio Estevam wrote:
> Hi Oliver,
> 
> On Fri, Nov 4, 2022 at 12:19 PM Oliver Graute
>  wrote:
> > 
> > This patchsets switches the remaining imx8 boards to binman.
> > 
> > Oliver Graute (8):
> >   imx: imx8qm-rom7720: switch to binman
> >   imx: imx8qm: cgtqmx8: switch to binman
> >   imx: imx8qxp: imx8qxp_mek switch to binman
> >   imx: imx8qm: imx8qm_mek switch to binman
> >   imx: imx8qxp: giedi switch to binman
> >   imx: imx8qxp: deneb switch to binman
> >   imx: imx8x: colibri: switch to binman
> >   imx: imx8: apalis: switch to binman
> 
> Great work, thanks. This series looks good to me:
> 
> Reviewed-by: Fabio Estevam 
> 
> It would be nice to get some Tested-by from the board maintainers.

Sure, sorry. I'm at it. Expect our feedback promptly now.


Re: [PATCH v2 0/8] imx8: switch missing boards to binman

2022-11-09 Thread Oliver Graute
On 08/11/22, Stefano Babic wrote:
> Hi Fabio, Oliver,
> 
> On 04.11.22 17:31, Fabio Estevam wrote:
> > Hi Oliver,
> > 
> > On Fri, Nov 4, 2022 at 12:19 PM Oliver Graute
> >  wrote:
> > > 
> > > This patchsets switches the remaining imx8 boards to binman.
> > > 
> > > Oliver Graute (8):
> > >imx: imx8qm-rom7720: switch to binman
> > >imx: imx8qm: cgtqmx8: switch to binman
> > >imx: imx8qxp: imx8qxp_mek switch to binman
> > >imx: imx8qm: imx8qm_mek switch to binman
> > >imx: imx8qxp: giedi switch to binman
> > >imx: imx8qxp: deneb switch to binman
> > >imx: imx8x: colibri: switch to binman
> > >imx: imx8: apalis: switch to binman
> > 
> > Great work, thanks. This series looks good to me:
> > 
> > Reviewed-by: Fabio Estevam 
> > 
> > It would be nice to get some Tested-by from the board maintainers.
> 
> I have tried to merge the series, but I get build errors, see:
> 
> https://source.denx.de/u-boot/custodians/u-boot-imx/-/jobs/519510
> 
> Could you take a look ?

For my imx8qm boards I need to manually place these imx firmware blobs with
expected names for sucessfull image creation.

As I understood the CI creates somes fakes. But I don't know where this
is happening.

Best regards,

Oliver


Re: [PATCH v2 0/8] imx8: switch missing boards to binman

2022-11-09 Thread Oliver Graute
On 08/11/22, Fabio Estevam wrote:
> Hi Oliver and Stefano,
> 
> On Tue, Nov 8, 2022 at 1:43 PM Stefano Babic  wrote:
> 
> > I have tried to merge the series, but I get build errors, see:
> >
> > https://source.denx.de/u-boot/custodians/u-boot-imx/-/jobs/519510
> >
> > Could you take a look ?
> 
> One problem I noticed is the missing CONFIG_TEXT_BASE conversion:
> 
> diff --git a/arch/arm/dts/imx8qm-u-boot.dtsi b/arch/arm/dts/imx8qm-u-boot.dtsi
> index 3507489a813c..442e64badc39 100644
> --- a/arch/arm/dts/imx8qm-u-boot.dtsi
> +++ b/arch/arm/dts/imx8qm-u-boot.dtsi
> @@ -50,7 +50,7 @@
> arch = "arm64";
> compression = "none";
> description = "U-Boot (64-bit)";
> -   load = ;
> +   load = ;
> type = "standalone";
> 
> uboot-blob {
> diff --git a/arch/arm/dts/imx8qxp-u-boot.dtsi 
> b/arch/arm/dts/imx8qxp-u-boot.dtsi
> index 01183f8ade63..e8df5bb8bfea 100644
> --- a/arch/arm/dts/imx8qxp-u-boot.dtsi
> +++ b/arch/arm/dts/imx8qxp-u-boot.dtsi
> @@ -50,7 +50,7 @@
> arch = "arm64";
> compression = "none";
> description = "U-Boot (64-bit)";
> -   load = ;
> +   load = ;
> type = "standalone";
> 
> uboot-blob {
> 
> With this fix applied, I got:
> 
> WARNING './ahab-container.img' not found, resulting binary is not-functional
> make[1]: Nothing to be done for 'SPL'.
>   BINMAN  all
> binman: Error 1 running 'mkimage -d ./mkimage.spl.mkimage -n
> spl/u-boot-spl.cfgout -T imx8image -e 0x10
> ./mkimage-out.spl.mkimage': Fail open first container file
> ahab-container.img
> 
> make: *** [Makefile:1116: all] Error 1
> 
> 
> but if I manually copy the firmware, then the build succeeds.
> 
> binman should not thrown an error in case of missing firmware. Oliver,
> any ideas?
> 
> Also, some boards use ahab-container.img and others use
> mx8qxc0-ahab-container.img.

> 
> Is it OK to use mx8qxc0-ahab-container.img for all of them?

I'am not sure if that is possible. The seco firmware has explicit
different images for these cpu variants.

imx-seco-3.8.5/firmware/seco

mx8dxla0-ahab-container.img
mx8dxla1-ahab-container.img
mx8qmb0-ahab-container.img
mx8qxb0-ahab-container.img
mx8qxc0-ahab-container.img

Best Regards,

Oliver


Re: [PATCH v7 4/5] eficonfig: add UEFI Secure Boot Key enrollment interface

2022-11-09 Thread Ilias Apalodimas
Hi Kojima-san


On Wed, Nov 09, 2022 at 12:37:27PM +0900, Masahisa Kojima wrote:
> This commit adds the menu-driven UEFI Secure Boot Key
> enrollment interface. User can enroll PK, KEK, db
> and dbx by selecting file.
> Only the signed EFI Signature List(s) with an authenticated
> header, typically '.auth' file, is accepted.
> 
> To clear the PK, KEK, db and dbx, user needs to enroll the null key
> signed by PK or KEK.
> 
> Signed-off-by: Masahisa Kojima 
> ---
> Changes in v7:
> - only accept .auth file.
> - remove creating time based authenticated variable
> - update commit message
> - use efi_file_size()
> 
> Changes in v6:
> - use efi_secure_boot_enabled()
> - replace with WIN_CERT_REVISION_2_0 from pe.h
> - call efi_build_signature_store() to check the valid EFI Signature List
> - update comment
> 
> Changes in v4:
> - add CONFIG_EFI_MM_COMM_TEE dependency
> - fix error handling
> 
> Changes in v3:
> - fix error handling
> 
> Changes in v2:
> - allow to enroll .esl file
> - fix typos
> - add function comments
> 
>  cmd/Makefile  |   5 +
>  cmd/eficonfig.c   |   3 +
>  cmd/eficonfig_sbkey.c | 242 ++
>  include/efi_config.h  |   5 +
>  4 files changed, 255 insertions(+)
>  create mode 100644 cmd/eficonfig_sbkey.c
> 
> diff --git a/cmd/Makefile b/cmd/Makefile
> index 2444d116c0..0b6a96c1d9 100644
> --- a/cmd/Makefile
> +++ b/cmd/Makefile
> @@ -66,6 +66,11 @@ obj-$(CONFIG_CMD_EEPROM) += eeprom.o
>  obj-$(CONFIG_EFI) += efi.o
>  obj-$(CONFIG_CMD_EFIDEBUG) += efidebug.o
>  obj-$(CONFIG_CMD_EFICONFIG) += eficonfig.o
> +ifdef CONFIG_CMD_EFICONFIG
> +ifdef CONFIG_EFI_MM_COMM_TEE
> +obj-$(CONFIG_EFI_SECURE_BOOT) += eficonfig_sbkey.o
> +endif
> +endif
>  obj-$(CONFIG_CMD_ELF) += elf.o
>  obj-$(CONFIG_CMD_EROFS) += erofs.o
>  obj-$(CONFIG_HUSH_PARSER) += exit.o
> diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c
> index 12babb76c2..d79194794b 100644
> --- a/cmd/eficonfig.c
> +++ b/cmd/eficonfig.c
> @@ -2435,6 +2435,9 @@ static const struct eficonfig_item 
> maintenance_menu_items[] = {
>   {"Edit Boot Option", eficonfig_process_edit_boot_option},
>   {"Change Boot Order", eficonfig_process_change_boot_order},
>   {"Delete Boot Option", eficonfig_process_delete_boot_option},
> +#if (CONFIG_IS_ENABLED(EFI_SECURE_BOOT) && 
> CONFIG_IS_ENABLED(EFI_MM_COMM_TEE))
> + {"Secure Boot Configuration", eficonfig_process_secure_boot_config},
> +#endif
>   {"Quit", eficonfig_process_quit},
>  };
>  
> diff --git a/cmd/eficonfig_sbkey.c b/cmd/eficonfig_sbkey.c
> new file mode 100644
> index 00..1e9eb3f51e
> --- /dev/null
> +++ b/cmd/eficonfig_sbkey.c
> @@ -0,0 +1,242 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + *  Menu-driven UEFI Secure Boot Key Maintenance
> + *
> + *  Copyright (c) 2022 Masahisa Kojima, Linaro Limited
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +enum efi_sbkey_signature_type {
> + SIG_TYPE_X509 = 0,
> + SIG_TYPE_HASH,
> + SIG_TYPE_CRL,
> + SIG_TYPE_RSA2048,
> +};
> +
> +struct eficonfig_sigtype_to_str {
> + efi_guid_t sig_type;
> + char *str;
> + enum efi_sbkey_signature_type type;
> +};
> +
> +static const struct eficonfig_sigtype_to_str sigtype_to_str[] = {
> + {EFI_CERT_X509_GUID,"X509", SIG_TYPE_X509},
> + {EFI_CERT_SHA256_GUID,  "SHA256",   SIG_TYPE_HASH},
> + {EFI_CERT_X509_SHA256_GUID, "X509_SHA256 CRL",  SIG_TYPE_CRL},
> + {EFI_CERT_X509_SHA384_GUID, "X509_SHA384 CRL",  SIG_TYPE_CRL},
> + {EFI_CERT_X509_SHA512_GUID, "X509_SHA512 CRL",  SIG_TYPE_CRL},
> + /* U-Boot does not support the following signature types */
> +/*   {EFI_CERT_RSA2048_GUID, "RSA2048",  
> SIG_TYPE_RSA2048}, */
> +/*   {EFI_CERT_RSA2048_SHA256_GUID,  "RSA2048_SHA256",   
> SIG_TYPE_RSA2048}, */
> +/*   {EFI_CERT_SHA1_GUID,"SHA1", SIG_TYPE_HASH}, 
> */
> +/*   {EFI_CERT_RSA2048_SHA_GUID, "RSA2048_SHA",  
> SIG_TYPE_RSA2048 }, */
> +/*   {EFI_CERT_SHA224_GUID,  "SHA224",   SIG_TYPE_HASH}, 
> */
> +/*   {EFI_CERT_SHA384_GUID,  "SHA384",   SIG_TYPE_HASH}, 
> */
> +/*   {EFI_CERT_SHA512_GUID,  "SHA512",   SIG_TYPE_HASH}, 
> */
> +};
> +
> +/**
> + * file_have_auth_header() - check file has EFI_VARIABLE_AUTHENTICATION_2 
> header
> + * @buf: pointer to file
> + * @size:file size
> + * Return:   true if file has auth header, false otherwise
> + */
> +static bool file_have_auth_header(void *buf, efi_uintn_t size)
> +{
> + struct efi_variable_authentication_2 *auth = buf;
> +
> + if (auth->auth_info.hdr.wCertificateType != WIN_CERT_TYPE_EFI_GUID)
> + return false;
> +
> + if (guidcmp(&auth->auth_info.cert_type, &efi_guid_cert_type_pkcs7))
> + return false;

Re: [PATCH v4 11/11] buildman: Add --allow-missing flag to allow missing blobs

2022-11-09 Thread Quentin Schulz

Hi Simon,

On 11/8/22 00:28, Simon Glass wrote:

From: Tom Rini 

Add a new flag to buildman so that we will in turn pass
BINMAN_ALLOW_MISSING=1 to 'make'. Make use of this flag in CI.

Allow the settings file to control this.

Cc: Rasmus Villemoes 
Cc: Simon Glass 
Signed-off-by: Tom Rini 
Signed-off-by: Simon Glass 
---

(no changes since v3)



There were actually substantial changes between v3 and v4.


Changes in v3:
- Add tests docs and a settings-file option

  .azure-pipelines.yml|  2 +-
  .gitlab-ci.yml  |  6 +--
  tools/buildman/bsettings.py | 16 ++
  tools/buildman/builder.py   |  5 +-
  tools/buildman/builderthread.py |  2 +
  tools/buildman/buildman.rst | 43 +++
  tools/buildman/cmdline.py   |  6 +++
  tools/buildman/control.py   | 29 +-
  tools/buildman/func_test.py | 96 +++--
  9 files changed, 196 insertions(+), 9 deletions(-)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index bda762451fd..665b5d2026f 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -553,7 +553,7 @@ stages:
cat << "EOF" >> build.sh
if [[ "${BUILDMAN}" != "" ]]; then
ret=0;
-  tools/buildman/buildman -o /tmp -P -E -W ${BUILDMAN} ${OVERRIDE} 
|| ret=$?;
+  tools/buildman/buildman -o /tmp -PEWM ${BUILDMAN} ${OVERRIDE} || 
ret=$?;
if [[ $ret -ne 0 ]]; then
tools/buildman/buildman -o /tmp -seP ${BUILDMAN};
exit $ret;
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6f4c34fc4a3..3deaeca1cdd 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -81,7 +81,7 @@ build all 32bit ARM platforms:
stage: world build
script:
  - ret=0;
-  ./tools/buildman/buildman -o /tmp -P -E -W arm -x aarch64 || ret=$?;
+  ./tools/buildman/buildman -o /tmp -PEWM arm -x aarch64 || ret=$?;
if [[ $ret -ne 0 ]]; then
  ./tools/buildman/buildman -o /tmp -seP;
  exit $ret;
@@ -93,7 +93,7 @@ build all 64bit ARM platforms:
  - virtualenv -p /usr/bin/python3 /tmp/venv
  - . /tmp/venv/bin/activate
  - ret=0;
-  ./tools/buildman/buildman -o /tmp -P -E -W aarch64 || ret=$?;
+  ./tools/buildman/buildman -o /tmp -PEWM aarch64 || ret=$?;
if [[ $ret -ne 0 ]]; then
  ./tools/buildman/buildman -o /tmp -seP;
  exit $ret;
@@ -113,7 +113,7 @@ build all other platforms:
stage: world build
script:
  - ret=0;
-  ./tools/buildman/buildman -o /tmp -P -E -W -x arm,powerpc || ret=$?;
+  ./tools/buildman/buildman -o /tmp -PEWM -x arm,powerpc || ret=$?;
if [[ $ret -ne 0 ]]; then
  ./tools/buildman/buildman -o /tmp -seP;
  exit $ret;
diff --git a/tools/buildman/bsettings.py b/tools/buildman/bsettings.py
index dcc200ea79d..9df87f53e49 100644
--- a/tools/buildman/bsettings.py
+++ b/tools/buildman/bsettings.py
@@ -5,6 +5,7 @@ import configparser
  import os
  import io
  
+config_fname = None
  


This seems unrelated?


  def Setup(fname=''):
  """Set up the buildman settings module by reading config files
@@ -46,6 +47,21 @@ def GetItems(section):
  except:
  raise
  
+def GetGlobalItem(name):


I would rename this to GetGlobalItemValue or something more explicit, 
it's not clear that you're returning the value of a key from its name.



+"""Get an items from the 'global' section of the config.
+

s/items/item/


+Args:
+name: name of item to retrieve
+
+Returns:
+str: Value of item, or None if not present
+"""
+items = GetItems('global')
+for item in items:
+if item[0] == name:
+return item[1]


I had to run an example myself to see why this was done this way. 
configparser returns tuples with (key, value).


You could simply do:
return settings.get('global', name, fallback=None)


+return None
+
  def SetItem(section, tag, value):
  """Set an item and write it back to the settings file"""
  global settings
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 76252b90792..c2a69027f88 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -252,7 +252,8 @@ class Builder:
   mrproper=False, per_board_out_dir=False,
   config_only=False, squash_config_y=False,
   warnings_as_errors=False, work_in_output=False,
- test_thread_exceptions=False, adjust_cfg=None):
+ test_thread_exceptions=False, adjust_cfg=None,
+ allow_missing=False):
  """Create a new Builder object
  
  Args:

@@ -290,6 +291,7 @@ class Builder:
  ~C to disable C
  C=val to set the value of C (val must have quotes if C is
  a string Kconfig
+allow_missing: Run build with BINMAN_ALLOW_MISSING=1
  
  """

  self.toolchains =

Re: [PATCH v2 0/8] imx8: switch missing boards to binman

2022-11-09 Thread Stefano Babic

Hi Fabio,

On 08.11.22 23:16, Fabio Estevam wrote:

Hi Oliver and Stefano,

On Tue, Nov 8, 2022 at 1:43 PM Stefano Babic  wrote:


I have tried to merge the series, but I get build errors, see:

https://source.denx.de/u-boot/custodians/u-boot-imx/-/jobs/519510

Could you take a look ?


One problem I noticed is the missing CONFIG_TEXT_BASE conversion:

diff --git a/arch/arm/dts/imx8qm-u-boot.dtsi b/arch/arm/dts/imx8qm-u-boot.dtsi
index 3507489a813c..442e64badc39 100644
--- a/arch/arm/dts/imx8qm-u-boot.dtsi
+++ b/arch/arm/dts/imx8qm-u-boot.dtsi
@@ -50,7 +50,7 @@
 arch = "arm64";
 compression = "none";
 description = "U-Boot (64-bit)";
-   load = ;
+   load = ;
 type = "standalone";

 uboot-blob {
diff --git a/arch/arm/dts/imx8qxp-u-boot.dtsi b/arch/arm/dts/imx8qxp-u-boot.dtsi
index 01183f8ade63..e8df5bb8bfea 100644
--- a/arch/arm/dts/imx8qxp-u-boot.dtsi
+++ b/arch/arm/dts/imx8qxp-u-boot.dtsi
@@ -50,7 +50,7 @@
 arch = "arm64";
 compression = "none";
 description = "U-Boot (64-bit)";
-   load = ;
+   load = ;
 type = "standalone";

 uboot-blob {

With this fix applied, I got:

WARNING './ahab-container.img' not found, resulting binary is not-functional
make[1]: Nothing to be done for 'SPL'.
   BINMAN  all
binman: Error 1 running 'mkimage -d ./mkimage.spl.mkimage -n
spl/u-boot-spl.cfgout -T imx8image -e 0x10
./mkimage-out.spl.mkimage': Fail open first container file
ahab-container.img



This is normal, but CI creates fakes. Most of built boards have warnings 
that build does not run. It is nopt a problem.



make: *** [Makefile:1116: all] Error 1


but if I manually copy the firmware, then the build succeeds.

binman should not thrown an error in case of missing firmware. Oliver,
any ideas?

Also, some boards use ahab-container.img and others use
mx8qxc0-ahab-container.img.

Is it OK to use mx8qxc0-ahab-container.img for all of them?



I try a CI run with this fixed applied and I let you know.

Stefano

--
=
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=



Fwd: New Defects reported by Coverity Scan for Das U-Boot

2022-11-09 Thread Tom Rini
Here's the latest report.

-- Forwarded message -
From: 
Date: Mon, Nov 7, 2022 at 3:41 PM
Subject: New Defects reported by Coverity Scan for Das U-Boot
To: 


Hi,

Please find the latest report on new defect(s) introduced to Das
U-Boot found with Coverity Scan.

21 new defect(s) introduced to Das U-Boot found with Coverity Scan.
15 defect(s), reported by Coverity Scan earlier, were marked fixed in
the recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 20 of 21 defect(s)


** CID 376213:  Memory - illegal accesses  (UNINIT)
/lib/efi_loader/efi_boottime.c: 2642 in
efi_install_multiple_protocol_interfaces_int()



*** CID 376213:  Memory - illegal accesses  (UNINIT)
/lib/efi_loader/efi_boottime.c: 2642 in
efi_install_multiple_protocol_interfaces_int()
2636int i = 0;
2637efi_va_list argptr_copy;
2638
2639if (!handle)
2640return EFI_INVALID_PARAMETER;
2641
>>> CID 376213:  Memory - illegal accesses  (UNINIT)
>>> Using uninitialized value "argptr_copy" when calling 
>>> "__builtin_ms_va_copy".
2642efi_va_copy(argptr_copy, argptr);
2643for (;;) {
2644protocol = efi_va_arg(argptr, efi_guid_t*);
2645if (!protocol)
2646break;
2647protocol_interface = efi_va_arg(argptr, void*);

** CID 376212:  Error handling issues  (CHECKED_RETURN)



*** CID 376212:  Error handling issues  (CHECKED_RETURN)
/drivers/usb/emul/sandbox_flash.c: 197 in handle_ufi_command()
191
192 ret = sb_scsi_emul_command(info, req, len);
193 if (!ret) {
194 setup_response(priv);
195 } else if ((ret == SCSI_EMUL_DO_READ || ret ==
SCSI_EMUL_DO_WRITE) &&
196priv->fd != -1) {
>>> CID 376212:  Error handling issues  (CHECKED_RETURN)
>>> Calling "os_lseek(priv->fd, info->seek_block * info->block_size, 0)" 
>>> without checking return value. It wraps a library function that may fail 
>>> and return an error code.
197 os_lseek(priv->fd, info->seek_block * info->block_size,
198  OS_SEEK_SET);
199 setup_response(priv);
200 } else {
201 setup_fail_response(priv);
202 }

** CID 376211:(TAINTED_SCALAR)



*** CID 376211:(TAINTED_SCALAR)
/cmd/eficonfig.c: 1475 in eficonfig_edit_boot_option()
1469if (lo.file_path)
1470fill_file_info(lo.file_path,
&bo->file_info, device_dp);
1471
1472/* Initrd file path(optional) is placed at
second instance. */
1473initrd_dp = efi_dp_from_lo(&lo, &efi_lf2_initrd_guid);
1474if (initrd_dp) {
>>> CID 376211:(TAINTED_SCALAR)
>>> Passing tainted expression "initrd_dp->length" to "fill_file_info", 
>>> which uses it as an offset.
1475fill_file_info(initrd_dp,
&bo->initrd_info, initrd_device_dp);
1476efi_free_pool(initrd_dp);
1477}
1478
1479if (size > 0)
1480memcpy(bo->optional_data,
lo.optional_data, size);
/cmd/eficonfig.c: 1535 in eficonfig_edit_boot_option()
1529ret = eficonfig_set_boot_option(varname, final_dp,
final_dp_size, bo->description, tmp);
1530if (ret != EFI_SUCCESS)
1531goto out;
1532 out:
1533free(tmp);
1534free(bo->optional_data);
>>> CID 376211:(TAINTED_SCALAR)
>>> Passing tainted expression "*bo->description" to "dlfree", which uses 
>>> it as an offset.
1535free(bo->description);
1536free(bo->file_info.current_path);
1537free(bo->initrd_info.current_path);
1538efi_free_pool(device_dp);
1539efi_free_pool(initrd_device_dp);
1540efi_free_pool(initrd_dp);
/cmd/eficonfig.c: 1534 in eficonfig_edit_boot_option()
1528
1529ret = eficonfig_set_boot_option(varname, final_dp,
final_dp_size, bo->description, tmp);
1530if (ret != EFI_SUCCESS)
1531goto out;
1532 out:
1533free(tmp);
>>> CID 376211:(TAINTED_SCALAR)
>>> Passing tainted expression "*bo->optional_data" to "dlfree", which uses 
>>> it as an offset.
1534free(bo->optional_data);
1535free(bo->description);
1536free(bo->file_info.current_path);
1537free(bo->initrd_info.current_path);
1538efi_free_pool(device_dp);
153

Re: [PATCH v4 04/11] buildman: Convert documentation to rST

2022-11-09 Thread Quentin Schulz

Hi Simon,

On 11/8/22 00:28, Simon Glass wrote:

Convert the buildman documentation to rST format and include it in the
'build' section.

Signed-off-by: Simon Glass 
---


[...]

+Other options
+-
+
+Buildman has various other command-line options. Try --help to see them.
+
+To find out what toolchain prefix buildman will use for a build, use the -A
+option.
+
+To request that compiler warnings be promoted to errors, use -E. This passes 
the
+-Werror flag to the compiler. Note that the build can still produce warnings
+with -E, e.g. the migration warnings::
+
+   - WARNING --
+   This board does not use CONFIG_DM_MMC. Please update
+   ...
+   
+


s/-/=/

Cheers,
Quentin


Re: LX2106A U-Boot: board_eth_init() not called any more

2022-11-09 Thread Ioana Ciornei
On Wed, Nov 09, 2022 at 08:24:27AM -0500, Tom Rini wrote:
> On Wed, Nov 09, 2022 at 12:48:59PM +0200, Ioana Ciornei wrote:
> > > From: Stefan Roese 
> > > Subject: LX2106A U-Boot: board_eth_init() not called any more
> > >

[snip]

> 
> I suspect there's unused code in the board directory that should be
> removed then, can we please get that cleaned up? Thanks.
> 

Yes, there are a bunch of '#ifndef CONFIG_DM_ETH' in the board files.
I will put this cleanup on my list.

Ioana

Re: LX2106A U-Boot: board_eth_init() not called any more

2022-11-09 Thread Ioana Ciornei
On Wed, Nov 09, 2022 at 02:29:56PM +0100, Stefan Roese wrote:
> Hi Ioana,
> 

[snip]

> > fsl-mc: Booting Management Complex ... SUCCESS
> > fsl-mc: Management Complex booted (version: 10.24.0, boot status: 0x1)
> > Hit any key to stop autoboot:  0
> > => setenv ethact DPMAC3@usxgmii
> > => setenv ipaddr 10.0.0.1
> > => ping 10.0.0.2
> > DPMAC3@usxgmii Waiting for PHY auto negotiation to complete.Using 
> > DPMAC3@usxgmii device
> > host 10.0.0.2 is alive
> 
> Great. Many thanks for this testing this. I need to check what needs to
> be done on our custom LX2160 based board in the dts/dtsi files and
> corresponding drivers to fully support operation with DM_ETH enabled
> now.
> 

Mainly you would need to populate the dpmacX DTS nodes corresponding to
the interfaces enabled in your RCW setup and any PHY which they are
using. The 'fsl-lx2160a-rdb.dts' can be a reference for your board.

> BTW: You might want to send a patch removing the now obsolete
> board_eth_init() functions in board/freescale/*.
> 

Yes, I should do that since it's removed for good now.

Ioana



Re: [PATCH v2 1/2] spl: enable regulator-boot-on and disable regulator-force-boot-off

2022-11-09 Thread Quentin Schulz

Hi all,

Ping on the patch series. I don't need it for my boards anymore but I 
still think this is a nice to have for everybody. I won't ping again if 
there's no interest/feedback.


Cheers,
Quentin

On 7/22/22 12:09, Quentin Schulz wrote:

From: Quentin Schulz 

This makes sure regulators that need to be turned on or off at boot are
turned on or off in the SPL.

This may be required for the SPL to do some operations, such as finding
possible loading media for U-Boot proper.

Cc: Quentin Schulz 
Tested-by: Xavier Drudis Ferran 
Signed-off-by: Quentin Schulz 
---

v2:
  - added Tested-by,
  - fixed build for boards with SPL_DM_REGULATOR disabled by always
  included power/regulator.h and defining a dummy implementation for
  regulators_enable_boot_off,

  common/spl/spl.c  | 10 ++
  include/power/regulator.h |  5 +
  2 files changed, 15 insertions(+)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 29e0898f03..6ab997279d 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -39,6 +39,7 @@
  #include 
  #include 
  #include 
+#include 
  
  DECLARE_GLOBAL_DATA_PTR;

  DECLARE_BINMAN_MAGIC_SYM;
@@ -773,6 +774,15 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
if (CONFIG_IS_ENABLED(GPIO_HOG))
gpio_hog_probe_all();
  
+	if (CONFIG_IS_ENABLED(DM_REGULATOR)) {

+   if (regulators_enable_boot_on(false))
+   debug("%s: Cannot enable boot on regulator\n",
+ __func__);
+   if (regulators_enable_boot_off(false))
+   debug("%s: Cannot enable boot off regulator\n",
+ __func__);
+   }
+
  #if CONFIG_IS_ENABLED(BOARD_INIT)
spl_board_init();
  #endif
diff --git a/include/power/regulator.h b/include/power/regulator.h
index ff1bfc2435..4bce61dd9f 100644
--- a/include/power/regulator.h
+++ b/include/power/regulator.h
@@ -631,6 +631,11 @@ static inline int regulators_enable_boot_on(bool verbose)
return -ENOSYS;
  }
  
+static inline int regulators_enable_boot_off(bool verbose)

+{
+   return -ENOSYS;
+}
+
  static inline int regulator_autoset(struct udevice *dev)
  {
return -ENOSYS;


Re: [PATCH v7 3/5] eficonfig: refactor change boot order implementation

2022-11-09 Thread Ilias Apalodimas
On Wed, Nov 09, 2022 at 12:37:26PM +0900, Masahisa Kojima wrote:
> All the eficonfig menus other than "Change Boot Order"
> use 'eficonfig_entry' structure for each menu entry.
> This commit refactors change boot order implementation
> to use 'eficonfig_entry' structure same as other menus
> to have consistent menu handling.
> 
> This commit also simplifies the data->active handling when
> KEY_SPACE is pressed, and sizeof() parameter.
> 
> Signed-off-by: Masahisa Kojima 
> ---
> Changes in v7:
> - simplify the data->active handling
> - update sizeof() parameter
> - update commit message
> 
> Changes in v5:
> - remove direct access mode
> 
> newly created in v4
> 
>  cmd/eficonfig.c | 129 +---
>  1 file changed, 67 insertions(+), 62 deletions(-)
> 
> diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c
> index b392de7954..12babb76c2 100644
> --- a/cmd/eficonfig.c
> +++ b/cmd/eficonfig.c
> @@ -93,20 +93,14 @@ struct eficonfig_boot_selection_data {
>  };
>  
>  /**
> - * struct eficonfig_boot_order - structure to be used to update BootOrder 
> variable
> + * struct eficonfig_boot_order_data - structure to be used to update 
> BootOrder variable
>   *
> - * @num: index in the menu entry
> - * @description: pointer to the description string
>   * @boot_index:  boot option index
>   * @active:  flag to include the boot option into BootOrder variable
> - * @list:list structure
>   */
> -struct eficonfig_boot_order {
> - u32 num;
> - u16 *description;
> +struct eficonfig_boot_order_data {
>   u32 boot_index;
>   bool active;
> - struct list_head list;
>  };
>  
>  /**
> @@ -1802,7 +1796,7 @@ static void eficonfig_display_change_boot_order(struct 
> efimenu *efi_menu)
>  {
>   bool reverse;
>   struct list_head *pos, *n;
> - struct eficonfig_boot_order *entry;
> + struct eficonfig_entry *entry;
>  
>   printf(ANSI_CLEAR_CONSOLE ANSI_CURSOR_POSITION
>  "\n  ** Change Boot Order **\n"
> @@ -1818,7 +1812,7 @@ static void eficonfig_display_change_boot_order(struct 
> efimenu *efi_menu)
>  
>   /* draw boot option list */
>   list_for_each_safe(pos, n, &efi_menu->list) {
> - entry = list_entry(pos, struct eficonfig_boot_order, list);
> + entry = list_entry(pos, struct eficonfig_entry, list);
>   reverse = (entry->num == efi_menu->active);
>  
>   printf(ANSI_CURSOR_POSITION, entry->num + 4, 7);
> @@ -1827,13 +1821,13 @@ static void 
> eficonfig_display_change_boot_order(struct efimenu *efi_menu)
>   puts(ANSI_COLOR_REVERSE);
>  
>   if (entry->num < efi_menu->count - 2) {
> - if (entry->active)
> + if (((struct eficonfig_boot_order_data 
> *)entry->data)->active)
>   printf("[*]  ");
>   else
>   printf("[ ]  ");
>   }
>  
> - printf("%ls", entry->description);
> + printf("%s", entry->title);
>  
>   if (reverse)
>   puts(ANSI_COLOR_RESET);
> @@ -1850,9 +1844,8 @@ static efi_status_t 
> eficonfig_choice_change_boot_order(struct efimenu *efi_menu)
>  {
>   int esc = 0;
>   struct list_head *pos, *n;
> - struct eficonfig_boot_order *tmp;
>   enum bootmenu_key key = KEY_NONE;
> - struct eficonfig_boot_order *entry;
> + struct eficonfig_entry *entry, *tmp;
>  
>   while (1) {
>   bootmenu_loop(NULL, &key, &esc);
> @@ -1861,11 +1854,11 @@ static efi_status_t 
> eficonfig_choice_change_boot_order(struct efimenu *efi_menu)
>   case KEY_PLUS:
>   if (efi_menu->active > 0) {
>   list_for_each_safe(pos, n, &efi_menu->list) {
> - entry = list_entry(pos, struct 
> eficonfig_boot_order, list);
> + entry = list_entry(pos, struct 
> eficonfig_entry, list);
>   if (entry->num == efi_menu->active)
>   break;
>   }
> - tmp = list_entry(pos->prev, struct 
> eficonfig_boot_order, list);
> + tmp = list_entry(pos->prev, struct 
> eficonfig_entry, list);
>   entry->num--;
>   tmp->num++;
>   list_del(&tmp->list);
> @@ -1879,11 +1872,11 @@ static efi_status_t 
> eficonfig_choice_change_boot_order(struct efimenu *efi_menu)
>   case KEY_MINUS:
>   if (efi_menu->active < efi_menu->count - 3) {
>   list_for_each_safe(pos, n, &efi_menu->list) {
> - entry = list_entry(pos, struct 
> eficonfig_boot_order, list);
> +   

Re: [PATCH v7 1/5] eficonfig: refactor file selection handling

2022-11-09 Thread Ilias Apalodimas
On Wed, Nov 09, 2022 at 12:37:24PM +0900, Masahisa Kojima wrote:
> eficonfig_select_file_handler() is commonly used to select the
> file. eficonfig_display_select_file_option() adds an additional
> menu to clear the selected file.
> eficonfig_display_select_file_option() is not always necessary
> for the file selection process, so it must be outside of
> eficonfig_select_file_handler().
> 
> This commit also renames the following functions to avoid confusion.
>  eficonfig_select_file_handler() -> eficonfig_process_select_file()
>  eficonfig_select_file() -> eficonfig_show_file_selection()
>  eficonfig_display_select_file_option() -> 
> eficonfig_process_show_file_option()
> 
> Finally, test_eficonfig.py need to be updated to get aligned with
> the above modification.
> 
> Signed-off-by: Masahisa Kojima 
> ---
> Changes in v7:
> - rename functio name to avoid confusion
> - remove unused function
> - update commit message
> 
> newly created in v2
> 
>  cmd/eficonfig.c   | 37 ++-
>  include/efi_config.h  |  2 +-
>  .../py/tests/test_eficonfig/test_eficonfig.py |  1 +
>  3 files changed, 13 insertions(+), 27 deletions(-)
> 
> diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c
> index 2595dd9563..571e2b9ac0 100644
> --- a/cmd/eficonfig.c
> +++ b/cmd/eficonfig.c
> @@ -756,14 +756,14 @@ out:
>  }
>  
>  /**
> - * eficonfig_select_file() - construct the file selection menu
> + * eficonfig_show_file_selection() - construct the file selection menu
>   *
>   * @file_info:   pointer to the file selection structure
>   * @root:pointer to the file handle
>   * Return:   status code
>   */
> -static efi_status_t eficonfig_select_file(struct eficonfig_select_file_info 
> *file_info,
> -   struct efi_file_handle *root)
> +static efi_status_t eficonfig_show_file_selection(struct 
> eficonfig_select_file_info *file_info,
> +   struct efi_file_handle *root)
>  {
>   u32 count = 0, i;
>   efi_uintn_t len;
> @@ -938,17 +938,6 @@ static efi_status_t eficonfig_boot_edit_save(void *data)
>   return EFI_SUCCESS;
>  }
>  
> -/**
> - * eficonfig_process_select_file() - callback function for "Select File" 
> entry
> - *
> - * @data:pointer to the data
> - * Return:   status code
> - */
> -efi_status_t eficonfig_process_select_file(void *data)
> -{
> - return EFI_SUCCESS;
> -}
> -
>  /**
>   * eficonfig_process_clear_file_selection() - callback function for "Clear" 
> entry
>   *
> @@ -973,19 +962,19 @@ static struct eficonfig_item select_file_menu_items[] = 
> {
>   {"Quit", eficonfig_process_quit},
>  };
>  
> -
>  /**
> - * eficonfig_display_select_file_option() - display select file option
> + * eficonfig_process_show_file_option() - display select file option
>   *
>   * @file_info:   pointer to the file information structure
>   * Return:   status code
>   */
> -efi_status_t eficonfig_display_select_file_option(struct 
> eficonfig_select_file_info *file_info)
> +efi_status_t eficonfig_process_show_file_option(void *data)
>  {
>   efi_status_t ret;
>   struct efimenu *efi_menu;
>  
> - select_file_menu_items[1].data = file_info;
> + select_file_menu_items[0].data = data;
> + select_file_menu_items[1].data = data;
>   efi_menu = eficonfig_create_fixed_menu(select_file_menu_items,
>  
> ARRAY_SIZE(select_file_menu_items));
>   if (!efi_menu)
> @@ -1001,12 +990,12 @@ efi_status_t 
> eficonfig_display_select_file_option(struct eficonfig_select_file_i
>  }
>  
>  /**
> - * eficonfig_select_file_handler() - handle user file selection
> + * eficonfig_process_select_file() - handle user file selection
>   *
>   * @data:pointer to the data
>   * Return:   status code
>   */
> -efi_status_t eficonfig_select_file_handler(void *data)
> +efi_status_t eficonfig_process_select_file(void *data)
>  {
>   size_t len;
>   efi_status_t ret;
> @@ -1016,10 +1005,6 @@ efi_status_t eficonfig_select_file_handler(void *data)
>   struct eficonfig_select_file_info *tmp = NULL;
>   struct eficonfig_select_file_info *file_info = data;
>  
> - ret = eficonfig_display_select_file_option(file_info);
> - if (ret != EFI_SUCCESS)
> - return ret;
> -
>   tmp = calloc(1, sizeof(struct eficonfig_select_file_info));
>   if (!tmp)
>   return EFI_OUT_OF_RESOURCES;
> @@ -1046,7 +1031,7 @@ efi_status_t eficonfig_select_file_handler(void *data)
>   if (ret != EFI_SUCCESS)
>   goto out;
>  
> - ret = eficonfig_select_file(tmp, root);
> + ret = eficonfig_show_file_selection(tmp, root);
>   if (ret == EFI_ABORTED)
>   continue;
>   if (ret != EFI_SUCCESS)
> @@ -1284,7 +1269,7 @@ static efi_status_t prepare_file_selection_entry(struct 
> efimenu *efi_menu, char
>   utf8_

Re: LX2106A U-Boot: board_eth_init() not called any more

2022-11-09 Thread Stefan Roese

Hi Ioana,

On 09.11.22 11:48, Ioana Ciornei wrote:

From: Stefan Roese 
Subject: LX2106A U-Boot: board_eth_init() not called any more

Dear NXP LX2160 developers!



Hi!


With commit 94633c36f9eb ("net: Make DM_ETH be selected by NETDEVICE")
DM_ETH is now mandatory. And net/eth_legacy.c is not compiled anymore.
Resulting in board_eth_init() not being called anymore. On NXP LX2160
platforms (and some other NXP platforms as well), this functions and
the legacy net/eth infrastructure seems still to be used AFAICT.

So could you please let me know, if and how ethernet support on these
boards is supposed to work with recent U-Boot versions on LX2160? My
understanding is, that the current versions will result in an output
like this:

...
In:serial_pl01x
Out:   serial_pl01x
Err:   serial_pl01x
SEC0:  RNG instantiated
Net:   No ethernet found.
...

Or did I miss something?



I am not exactly sure what you missed but ethernet support under DM_ETH
for the DPAA2 based boards was added more than 2 years ago in the
upstream.

For example, the LX2160ARDB board does no longer rely on the
board_eth_init() function but rather it discovers its ethernet
interfaces, any connected PHY etc using the DTS file (just like Linux
does).

There are multiple patch sets that I submitted which made this support
available. For reference, I will list below just some patches which
added DM_ETH support for LX2160ARDB.
  8d3495023880 ("arm: dts: lx2160a: add external MDIO nodes")
  f660f7af1dcb ("arm: dts: lx2160ardb: add DPMAC and PHY nodes")
  643f5b47ec06 ("configs: lx2160ardb: enable CONFIG_DM_ETH and related")


Thanks for getting back to me. Yes, I completely missed this, as I
was only looking at board_eth_init() and using the LX2160 board with
DM_ETH disabled, which now is not supported any more.


And to double check, I just booted a LX2160ARDB board
(lx2160ardb_tfa_defconfig) with the latest u-boot from upstream and from
the log below you can see that the DPAA2 ethernet interfaces are
available.

U-Boot 2023.01-rc1-00019-g77b5cc2948f5 (Nov 09 2022 - 11:25:19 +0200)

SoC:  LX2160ACE Rev2.0 (0x87360020)
Clock Configuration:
CPU0(A72):2200 MHz  CPU1(A72):2200 MHz  CPU2(A72):2200 MHz
CPU3(A72):2200 MHz  CPU4(A72):2200 MHz  CPU5(A72):2200 MHz
CPU6(A72):2200 MHz  CPU7(A72):2200 MHz  CPU8(A72):2200 MHz
CPU9(A72):2200 MHz  CPU10(A72):2200 MHz  CPU11(A72):2200 MHz
CPU12(A72):2200 MHz  CPU13(A72):2200 MHz  CPU14(A72):2200 MHz
CPU15(A72):2200 MHz
Bus:  750  MHz  DDR:  3200 MT/s
Reset Configuration Word (RCW):
: 5883833c 24580058  
0010:  0c01  
0020: 036001a0 2580  0096
0030:    
0040:    
0050:    
0060:   00027000 
0070: 08b30010 00150020
Model: NXP Layerscape LX2160ARDB Board
Board: LX2160ACE Rev2.0-RDB, Board version: B, boot from FlexSPI DEV#1
FPGA: v4.0
SERDES1 Reference: Clock1 = 161.13MHz Clock2 = 161.13MHz
SERDES2 Reference: Clock1 = 100MHz Clock2 = 100MHz
SERDES3 Reference: Clock1 = 100MHz Clock2 = 100MHz
(...)
EEPROM: NXID v1
In:serial_pl01x
Out:   serial_pl01x
Err:   serial_pl01x
SEC0:  RNG instantiated
Net:   e1000: 68:05:ca:57:cc:c8

Warning: e1000#0 MAC addresses don't match:
Address in ROM is   68:05:ca:57:cc:c8
Address in environment is   00:04:9f:05:c4:27
eth0: DPMAC3@usxgmii, eth1: DPMAC4@usxgmii, eth2: DPMAC17@rgmii-id, eth3: 
DPMAC18@rgmii-id, eth4: e1000#0 [PRIME]
SF: Detected mt35xu512aba with page size 256 Bytes, erase size 128 KiB, total 
64 MiB
device 0 offset 0x64, size 0x8
SF: 524288 bytes @ 0x64 Read: OK
device 0 offset 0xf0, size 0x10
SF: 1048576 bytes @ 0xf0 Read: OK
device 0 offset 0xa0, size 0x30
SF: 3145728 bytes @ 0xa0 Read: OK
device 0 offset 0xe0, size 0x10
SF: 1048576 bytes @ 0xe0 Read: OK
crc32+ MC firmware version 10.24.0

fsl-mc: Booting Management Complex ... SUCCESS
fsl-mc: Management Complex booted (version: 10.24.0, boot status: 0x1)
Hit any key to stop autoboot:  0
=> setenv ethact DPMAC3@usxgmii
=> setenv ipaddr 10.0.0.1
=> ping 10.0.0.2
DPMAC3@usxgmii Waiting for PHY auto negotiation to complete.Using 
DPMAC3@usxgmii device
host 10.0.0.2 is alive


Great. Many thanks for this testing this. I need to check what needs to
be done on our custom LX2160 based board in the dts/dtsi files and
corresponding drivers to fully support operation with DM_ETH enabled
now.

BTW: You might want to send a patch removing the now obsolete
board_eth_init() functions in board/freescale/*.

Thanks,
Stefan


Re: LX2106A U-Boot: board_eth_init() not called any more

2022-11-09 Thread Tom Rini
On Wed, Nov 09, 2022 at 12:48:59PM +0200, Ioana Ciornei wrote:
> > From: Stefan Roese 
> > Subject: LX2106A U-Boot: board_eth_init() not called any more
> >
> > Dear NXP LX2160 developers!
> >
> 
> Hi!
> 
> > With commit 94633c36f9eb ("net: Make DM_ETH be selected by NETDEVICE")
> > DM_ETH is now mandatory. And net/eth_legacy.c is not compiled anymore.
> > Resulting in board_eth_init() not being called anymore. On NXP LX2160
> > platforms (and some other NXP platforms as well), this functions and
> > the legacy net/eth infrastructure seems still to be used AFAICT.
> >
> > So could you please let me know, if and how ethernet support on these
> > boards is supposed to work with recent U-Boot versions on LX2160? My
> > understanding is, that the current versions will result in an output
> > like this:
> >
> > ...
> > In:serial_pl01x
> > Out:   serial_pl01x
> > Err:   serial_pl01x
> > SEC0:  RNG instantiated
> > Net:   No ethernet found.
> > ...
> >
> > Or did I miss something?
> >
> 
> I am not exactly sure what you missed but ethernet support under DM_ETH
> for the DPAA2 based boards was added more than 2 years ago in the
> upstream.
> 
> For example, the LX2160ARDB board does no longer rely on the
> board_eth_init() function but rather it discovers its ethernet
> interfaces, any connected PHY etc using the DTS file (just like Linux
> does).
> 
> There are multiple patch sets that I submitted which made this support
> available. For reference, I will list below just some patches which
> added DM_ETH support for LX2160ARDB.
>   8d3495023880 ("arm: dts: lx2160a: add external MDIO nodes")
>   f660f7af1dcb ("arm: dts: lx2160ardb: add DPMAC and PHY nodes")
>   643f5b47ec06 ("configs: lx2160ardb: enable CONFIG_DM_ETH and related")
> 
> And to double check, I just booted a LX2160ARDB board
> (lx2160ardb_tfa_defconfig) with the latest u-boot from upstream and from
> the log below you can see that the DPAA2 ethernet interfaces are
> available.
> 
> U-Boot 2023.01-rc1-00019-g77b5cc2948f5 (Nov 09 2022 - 11:25:19 +0200)
> 
> SoC:  LX2160ACE Rev2.0 (0x87360020)
> Clock Configuration:
>CPU0(A72):2200 MHz  CPU1(A72):2200 MHz  CPU2(A72):2200 MHz
>CPU3(A72):2200 MHz  CPU4(A72):2200 MHz  CPU5(A72):2200 MHz
>CPU6(A72):2200 MHz  CPU7(A72):2200 MHz  CPU8(A72):2200 MHz
>CPU9(A72):2200 MHz  CPU10(A72):2200 MHz  CPU11(A72):2200 MHz
>CPU12(A72):2200 MHz  CPU13(A72):2200 MHz  CPU14(A72):2200 MHz
>CPU15(A72):2200 MHz
>Bus:  750  MHz  DDR:  3200 MT/s
> Reset Configuration Word (RCW):
>: 5883833c 24580058  
>0010:  0c01  
>0020: 036001a0 2580  0096
>0030:    
>0040:    
>0050:    
>0060:   00027000 
>0070: 08b30010 00150020
> Model: NXP Layerscape LX2160ARDB Board
> Board: LX2160ACE Rev2.0-RDB, Board version: B, boot from FlexSPI DEV#1
> FPGA: v4.0
> SERDES1 Reference: Clock1 = 161.13MHz Clock2 = 161.13MHz
> SERDES2 Reference: Clock1 = 100MHz Clock2 = 100MHz
> SERDES3 Reference: Clock1 = 100MHz Clock2 = 100MHz
> (...)
> EEPROM: NXID v1
> In:serial_pl01x
> Out:   serial_pl01x
> Err:   serial_pl01x
> SEC0:  RNG instantiated
> Net:   e1000: 68:05:ca:57:cc:c8
> 
> Warning: e1000#0 MAC addresses don't match:
> Address in ROM is   68:05:ca:57:cc:c8
> Address in environment is   00:04:9f:05:c4:27
> eth0: DPMAC3@usxgmii, eth1: DPMAC4@usxgmii, eth2: DPMAC17@rgmii-id, eth3: 
> DPMAC18@rgmii-id, eth4: e1000#0 [PRIME]
> SF: Detected mt35xu512aba with page size 256 Bytes, erase size 128 KiB, total 
> 64 MiB
> device 0 offset 0x64, size 0x8
> SF: 524288 bytes @ 0x64 Read: OK
> device 0 offset 0xf0, size 0x10
> SF: 1048576 bytes @ 0xf0 Read: OK
> device 0 offset 0xa0, size 0x30
> SF: 3145728 bytes @ 0xa0 Read: OK
> device 0 offset 0xe0, size 0x10
> SF: 1048576 bytes @ 0xe0 Read: OK
> crc32+ MC firmware version 10.24.0
> 
> fsl-mc: Booting Management Complex ... SUCCESS
> fsl-mc: Management Complex booted (version: 10.24.0, boot status: 0x1)
> Hit any key to stop autoboot:  0
> => setenv ethact DPMAC3@usxgmii
> => setenv ipaddr 10.0.0.1
> => ping 10.0.0.2
> DPMAC3@usxgmii Waiting for PHY auto negotiation to complete.Using 
> DPMAC3@usxgmii device
> host 10.0.0.2 is alive

I suspect there's unused code in the board directory that should be
removed then, can we please get that cleaned up? Thanks.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2 1/2] arm: mediatek: add mt8195 SOC support

2022-11-09 Thread 云春峰
On Wed, 2022-11-09 at 17:50 +0800, Macpaul Lin wrote:
> From: Fabien Parent 
> 
> The MediaTek MT8195 is a ARM64-based SoC with a quad-core Cortex-A73
> and
> a quad-core Cortex-A53. It is including UART, SPI, USB3.0 device and
> hosts,
> SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3
> and LPDDR4 options.
> 
> Signed-off-by: Fabien Parent 
> Signed-off-by: Macpaul Lin 
> 
> ---
>  MAINTAINERS|   2 +
>  arch/arm/dts/mt8195.dtsi   | 370
> +
>  arch/arm/mach-mediatek/Kconfig |  13 +-
>  arch/arm/mach-mediatek/Makefile|   1 +
>  arch/arm/mach-mediatek/mt8195/Makefile |   3 +
>  arch/arm/mach-mediatek/mt8195/init.c   |  81 ++
>  6 files changed, 469 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/dts/mt8195.dtsi
>  create mode 100644 arch/arm/mach-mediatek/mt8195/Makefile
>  create mode 100644 arch/arm/mach-mediatek/mt8195/init.c
> 
> Changes for v2:
>  - Correct node name to t-phy for u3phy0.
>  - Add platform compatible string "mediatek,mt8195-tphy" to all usb
> phy nodes.
>  - remove clock nodes that software cannot controlled in phy nodes.
>  - Test and add back "mac" for HOST only xhci nodes.
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 1cf99c1393..5528dd28c3 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -362,8 +362,10 @@ ARM MEDIATEK
>  M:   Ryder Lee 
>  M:   Weijie Gao 
>  M:   Chunfeng Yun 
> +M:   Macpaul Lin 
>  R:   GSS_MTK_Uboot_upstream 
>  S:   Maintained
> +F:   arch/arm/dts/mt8195.dtsi
>  F:   arch/arm/mach-mediatek/
>  F:   arch/arm/include/asm/arch-mediatek/
>  F:   board/mediatek/
> diff --git a/arch/arm/dts/mt8195.dtsi b/arch/arm/dts/mt8195.dtsi
> new file mode 100644
> index 00..33282d21d1
> --- /dev/null
> +++ b/arch/arm/dts/mt8195.dtsi
> @@ -0,0 +1,370 @@
> +// SPDX-License-Identifier: (GPL-2.0 OR MIT)
> +/*
> + * Copyright (C) 2022 MediaTek Inc.
> + * Copyright (C) 2022 BayLibre, SAS
> + * Author: Ben Ho 
> + * Erin Lo 
> + * Fabien Parent 
> + * Macpaul Lin 
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/ {
> + compatible = "mediatek,mt8195";
> + interrupt-parent = <&sysirq>;
> + #address-cells = <2>;
> + #size-cells = <2>;
> +
> + cpus {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + cpu-map {
> + cluster0 {
> + core0 {
> + cpu = <&cpu0>;
> + };
> + core1 {
> + cpu = <&cpu1>;
> + };
> + core2 {
> + cpu = <&cpu2>;
> + };
> + core3 {
> + cpu = <&cpu3>;
> + };
> + };
> +
> + cluster1 {
> + core0 {
> + cpu = <&cpu4>;
> + };
> + core1 {
> + cpu = <&cpu5>;
> + };
> + core2 {
> + cpu = <&cpu6>;
> + };
> + core3 {
> + cpu = <&cpu7>;
> + };
> + };
> + };
> +
> + cpu0: cpu@0 {
> + device_type = "cpu";
> + compatible = "arm,cortex-a53";
> + reg = <0x000>;
> + enable-method = "psci";
> + capacity-dmips-mhz = <741>;
> + };
> +
> + cpu1: cpu@1 {
> + device_type = "cpu";
> + compatible = "arm,cortex-a53";
> + reg = <0x001>;
> + enable-method = "psci";
> + capacity-dmips-mhz = <741>;
> + };
> +
> + cpu2: cpu@2 {
> + device_type = "cpu";
> + compatible = "arm,cortex-a53";
> + reg = <0x002>;
> + enable-method = "psci";
> + capacity-dmips-mhz = <741>;
> + };
> +
> + cpu3: cpu@3 {
> + device_type = "cpu";
> + compatible = "arm,cortex-a53";
> + reg = <0x003>;
> + enable-method = "psci";
> + capacity-dmips-mhz = <741>;
> + };
> +
> + cpu4: cpu@100 {
> + device_type = "cpu";
> + compatible = "arm,cortex-a73";
> + reg = <0x100>;
> + enable-method = "psci";
> +   

Re: [PATCH 1/2] arm: mediatek: add mt8195 SOC support

2022-11-09 Thread 云春峰
On Wed, 2022-11-09 at 17:33 +0800, Macpaul Lin wrote:
> On 11/9/22 15:32, Macpaul Lin wrote:
> > 
> > On 11/9/22 10:07, Chunfeng Yun (云春峰) wrote:
> > > On Tue, 2022-11-08 at 11:21 +0800, Macpaul Lin wrote:
> > > > From: Fabien Parent 
> > > > 
> > > > The MediaTek MT8195 is a ARM64-based SoC with a quad-core
> > > > Cortex-A73
> > > > and
> > > > a quad-core Cortex-A53. It is including UART, SPI, USB3.0
> > > > device and
> > > > hosts,
> > > > SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several
> > > > LPDDR3
> > > > and LPDDR4 options.
> > > > 
> > > > Signed-off-by: Fabien Parent 
> > > > Signed-off-by: Macpaul Lin 
> > > > ---
> > > >   MAINTAINERS|   2 +
> > > >   arch/arm/dts/mt8195.dtsi   | 317
> > > > +
> > > >   arch/arm/mach-mediatek/Kconfig |  13 +-
> > > >   arch/arm/mach-mediatek/Makefile|   1 +
> > > >   arch/arm/mach-mediatek/mt8195/Makefile |   3 +
> > > >   arch/arm/mach-mediatek/mt8195/init.c   |  81 +++
> > > >   6 files changed, 416 insertions(+), 1 deletion(-)
> > > >   create mode 100644 arch/arm/dts/mt8195.dtsi
> > > >   create mode 100644 arch/arm/mach-mediatek/mt8195/Makefile
> > > >   create mode 100644 arch/arm/mach-mediatek/mt8195/init.c
> 
> [deleted]
> 
> > > > +xhci3: xhci3@112b {
> > > 
> > > change node name as xhci? prefer to use the same name
> > > 
> > 
> > Since there are other board manufacturers will use the
> > other HOST ports, like xhci1 or xhci2 with USB mass storage
> > function by their needs.
> > I'll add these 2 node in dtsi in next version.
> > 
> > > > +compatible = "mediatek,mt8195-xhci",
> > > > + "mediatek,mtk-xhci";
> > > > +reg = <0 0x112b 0 0x1000>,
> > > > +  <0 0x112b3e00 0 0x0100>;
> > > > +reg-names = "mac", "ippc";
> > > 
> > > remove "mac"
> > 
> > Will fix it in next version.
> > 
> 
> Dear Chunfeng,
> 
> Unfortunately, if we remove "mac" register here for HOST only node
> like 
> xhci3, the driver will complain about probing fail. Please check the 
> following log.
My bad, do need it for host only mode, sorry

> 
> => usb start
> starting USB...
> Bus xhci3@112b: xhci-mtk xhci3@112b: failed to get xHCI base
> address
> probe failed, error -6
> No working controllers found
> 
> I'll add "mac" back to HOST only nodes.
> 
> Thanks!
> Macpaul Lin


Re: [PATCH v7 03/10] arm_ffa: introduce Arm FF-A low-level driver

2022-11-09 Thread Jens Wiklander
On Mon, Nov 07, 2022 at 07:20:48PM +, Abdellatif El Khlifi wrote:
> Add the core driver implementing Arm Firmware Framework for Armv8-A v1.0
> 
> The Firmware Framework for Arm A-profile processors (FF-A v1.0) [1]
> describes interfaces (ABIs) that standardize communication
> between the Secure World and Normal World leveraging TrustZone
> technology.
> 
> This driver uses 64-bit registers as per SMCCCv1.2 spec and comes
> on top of the SMCCC layer. The driver provides the FF-A ABIs needed for
> querying the FF-A framework from the secure world.
> 
> The driver uses SMC32 calling convention which means using the first
> 32-bit data of the Xn registers.
> 
> All supported ABIs come with their 32-bit version except FFA_RXTX_MAP
> which has 64-bit version supported.
> 
> Both 32-bit and 64-bit direct messaging are supported which allows both
> 32-bit and 64-bit clients to use the FF-A bus.
> 
> In U-Boot FF-A design, FF-A is considered as a discoverable bus.
> The Secure World is considered as one entity to communicate with
> using the FF-A bus. FF-A communication is handled by one device and
> one instance (the bus). This FF-A driver takes care of all the
> interactions between Normal world and Secure World.
> 
> The driver exports its operations to be used by upper layers.
> 
> Exported operations:
> 
> - partition_info_get
> - sync_send_receive
> - rxtx_unmap
> 
> For more details please refer to the driver documentation [2].
> 
> [1]: https://developer.arm.com/documentation/den0077/latest/
> [2]: doc/arch/arm64.ffa.rst
> 
> Signed-off-by: Abdellatif El Khlifi 
> Cc: Tom Rini 
> Cc: Simon Glass 
> Cc: Ilias Apalodimas 
> Cc: Jens Wiklander 
> 
> ---
> 
> Changelog:
> ===
> 
> v7:
> 
> * add support for 32-bit direct messaging
> * rename be_uuid_str_to_le_bin() to uuid_str_to_le_bin()
> * improve the declaration of error handling mapping
> * stating in doc/arch/arm64.ffa.rst that EFI runtime is not supported
> 
> v6:
> 
> * drop use of EFI runtime support (We decided with Linaro to add this later)
> * drop discovery from initcalls (discovery will be on demand by FF-A users)
> * set the alignment of the RX/TX buffers to the larger translation granule 
> size
> * move FF-A RX/TX buffers unmapping at ExitBootServices() to a separate commit
> * update the documentation and move it to doc/arch/arm64.ffa.rst
> 
> v4:
> 
> * add doc/README.ffa.drv
> * moving the FF-A driver work to drivers/firmware/arm-ffa
> * use less #ifdefs in lib/efi_loader/efi_boottime.c and replace
>   #if defined by #if CONFIG_IS_ENABLED
> * improving error handling by mapping the FF-A errors to standard errors
>   and logs
> * replacing panics with an error log and returning an error code
> * improving features discovery in FFA_FEATURES by introducing
>   rxtx_min_pages private data field
> * add ffa_remove and ffa_unbind functions
> * improve how the driver behaves when bus discovery is done more than
>   once
> 
> v3:
> 
> * align the interfaces of the U-Boot FF-A driver with those in the linux
>   FF-A driver
> * remove the FF-A helper layer
> * make the U-Boot FF-A driver independent from EFI
> * provide an optional config that enables copying the driver data to EFI
>   runtime section at ExitBootServices service
> * use 64-bit version of FFA_RXTX_MAP, FFA_MSG_SEND_DIRECT_{REQ, RESP}
> 
> v2:
> 
> * make FF-A bus discoverable using device_{bind, probe} APIs
> * remove device tree support
> 
> v1:
> 
> * introduce FF-A bus driver with device tree support
> 
> MAINTAINERS   |7 +
>  doc/arch/arm64.ffa.rst|  218 
>  doc/arch/index.rst|1 +
>  drivers/Kconfig   |2 +
>  drivers/Makefile  |1 +
>  drivers/firmware/arm-ffa/Kconfig  |   30 +
>  drivers/firmware/arm-ffa/Makefile |6 +
>  drivers/firmware/arm-ffa/arm-ffa-uclass.c |   16 +
>  drivers/firmware/arm-ffa/arm_ffa_prv.h|  205 
>  drivers/firmware/arm-ffa/core.c   | 1310 +
>  include/arm_ffa.h |   93 ++
>  include/dm/uclass-id.h|4 +
>  12 files changed, 1893 insertions(+)
>  create mode 100644 doc/arch/arm64.ffa.rst
>  create mode 100644 drivers/firmware/arm-ffa/Kconfig
>  create mode 100644 drivers/firmware/arm-ffa/Makefile
>  create mode 100644 drivers/firmware/arm-ffa/arm-ffa-uclass.c
>  create mode 100644 drivers/firmware/arm-ffa/arm_ffa_prv.h
>  create mode 100644 drivers/firmware/arm-ffa/core.c
>  create mode 100644 include/arm_ffa.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 1cf99c1393..450b5725ce 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -263,6 +263,13 @@ F:   drivers/net/cortina_ni.h
>  F:   drivers/net/phy/ca_phy.c
>  F:   configs/cortina_presidio-asic-pnand_defconfig
>  
> +ARM FF-A
> +M:   Abdellatif El Khlifi 
> +S:   Maintained
> +F:   doc/arch/arm64.ffa.rst
> +F:   drivers/firmware/arm-ffa/
> +F:  

Re: [RFC PATCH v5 09/24] cli: Add menu for hush parser

2022-11-09 Thread Francis Laniel
Hi.


Le mardi 8 novembre 2022, 21:15:12 CET Simon Glass a écrit :
> Hi,
> 
> On Tue, 8 Nov 2022 at 08:21, Tom Rini  wrote:
> > On Mon, Nov 07, 2022 at 08:28:42AM -0700, Simon Glass wrote:
> > > Hi Patrick,
> > > 
> > > On Mon, 7 Nov 2022 at 05:32, Patrick DELAUNAY
> > > 
> > >  wrote:
> > > > Hi,
> > > > 
> > > > On 11/1/22 20:20, Francis Laniel wrote:
> > > > > For the moment, the menu contains only entry: HUSH_OLD_PARSER which
> > > > > is the
> > > > > default.
> > > > > The goal is to prepare the field to add a new hush parser which
> > > > > guarantees
> > > > > actual behavior is still correct.
> > > > > 
> > > > > Signed-off-by: Francis Laniel 
> > > > > ---
> > > > > 
> > > > >   cmd/Kconfig | 21 +
> > > > >   common/Makefile |  3 ++-
> > > > >   2 files changed, 23 insertions(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/cmd/Kconfig b/cmd/Kconfig
> > > > > index 3f6bc70d43..c15d7c51f7 100644
> > > > > --- a/cmd/Kconfig
> > > > > +++ b/cmd/Kconfig
> > > > > @@ -23,6 +23,27 @@ config HUSH_PARSER
> > > > > 
> > > > > If disabled, you get the old, much simpler behaviour with a
> > > > > somewhat
> > > > > smaller memory footprint.
> > > > > 
> > > > > +menu "Hush flavor to use"
> > > > > + depends on HUSH_PARSER
> > > > > +
> > > > > + config HUSH_OLD_PARSER
> > > > > + bool "Use hush old parser"
> > > > > + default y
> > > > > + help
> > > > > +   This option enables the old flavor of hush based on
> > > > > hush Busybox from +   2005.
> > > > > +
> > > > > +   It is actually the default U-Boot shell when decided
> > > > > to use hush as shell. +
> > > > > + config HUSH_2021_PARSER
> > > > > + bool "Use hush 2021 parser"
> > > > > + help
> > > > > +   This option enables the new flavor of hush based on
> > > > > hush Busybox from +   2021.
> > > > > +
> > > > > +   For the moment, it is highly experimental and should
> > > > > be used at own risks. +endmenu
> > > > > +
> > > > 
> > > > I think "choice" can be made sense here
> > > > 
> > > > => only one version is used
> > > > 
> > > > 
> > > > choice
> > > > 
> > > >  prompt "Hush flavor to use"
> > > >  default HUSH_OLD_PARSER
> > > >  
> > > >  depends on HUSH_PARSER
> > > > 
> > > > config HUSH_OLD_PARSER
> > > > 
> > > >  bool  "Use hush old parser"
> > > > 
> > > > config HUSH_2021_PARSER
> > > > 
> > > >bool "Use hush 2021 parser"
> > > > 
> > > > endchoice
> > > 
> > > We need to be able to build both and then select the correct one at
> > > runtime, at least for sandbox. Otherwise we would need yet another
> > > sandbox build. So I think what we have here makes sense.
> > 
> > I think choice is fine, as that's for testing. Once we're ready to merge
> > this we'll not keep both around for long.
> 
> Oh that's good. I heard people worrying about compatibility and size
> of the new shell, so thought we might need both.

Thank all of you for your feedback!

I think being able to change the shell at run time with "parser set" could 
also be useful for people to test if they are worried their board will not 
work with the new one.
So, they can test a feature with the old shell, change at runtime to the new 
one and see if everything is correct.
 
> Regards,
> Simon


Best regards.




RE: LX2106A U-Boot: board_eth_init() not called any more

2022-11-09 Thread Ioana Ciornei
> From: Stefan Roese 
> Subject: LX2106A U-Boot: board_eth_init() not called any more
>
> Dear NXP LX2160 developers!
>

Hi!

> With commit 94633c36f9eb ("net: Make DM_ETH be selected by NETDEVICE")
> DM_ETH is now mandatory. And net/eth_legacy.c is not compiled anymore.
> Resulting in board_eth_init() not being called anymore. On NXP LX2160
> platforms (and some other NXP platforms as well), this functions and
> the legacy net/eth infrastructure seems still to be used AFAICT.
>
> So could you please let me know, if and how ethernet support on these
> boards is supposed to work with recent U-Boot versions on LX2160? My
> understanding is, that the current versions will result in an output
> like this:
>
> ...
> In:serial_pl01x
> Out:   serial_pl01x
> Err:   serial_pl01x
> SEC0:  RNG instantiated
> Net:   No ethernet found.
> ...
>
> Or did I miss something?
>

I am not exactly sure what you missed but ethernet support under DM_ETH
for the DPAA2 based boards was added more than 2 years ago in the
upstream.

For example, the LX2160ARDB board does no longer rely on the
board_eth_init() function but rather it discovers its ethernet
interfaces, any connected PHY etc using the DTS file (just like Linux
does).

There are multiple patch sets that I submitted which made this support
available. For reference, I will list below just some patches which
added DM_ETH support for LX2160ARDB.
  8d3495023880 ("arm: dts: lx2160a: add external MDIO nodes")
  f660f7af1dcb ("arm: dts: lx2160ardb: add DPMAC and PHY nodes")
  643f5b47ec06 ("configs: lx2160ardb: enable CONFIG_DM_ETH and related")

And to double check, I just booted a LX2160ARDB board
(lx2160ardb_tfa_defconfig) with the latest u-boot from upstream and from
the log below you can see that the DPAA2 ethernet interfaces are
available.

U-Boot 2023.01-rc1-00019-g77b5cc2948f5 (Nov 09 2022 - 11:25:19 +0200)

SoC:  LX2160ACE Rev2.0 (0x87360020)
Clock Configuration:
   CPU0(A72):2200 MHz  CPU1(A72):2200 MHz  CPU2(A72):2200 MHz
   CPU3(A72):2200 MHz  CPU4(A72):2200 MHz  CPU5(A72):2200 MHz
   CPU6(A72):2200 MHz  CPU7(A72):2200 MHz  CPU8(A72):2200 MHz
   CPU9(A72):2200 MHz  CPU10(A72):2200 MHz  CPU11(A72):2200 MHz
   CPU12(A72):2200 MHz  CPU13(A72):2200 MHz  CPU14(A72):2200 MHz
   CPU15(A72):2200 MHz
   Bus:  750  MHz  DDR:  3200 MT/s
Reset Configuration Word (RCW):
   : 5883833c 24580058  
   0010:  0c01  
   0020: 036001a0 2580  0096
   0030:    
   0040:    
   0050:    
   0060:   00027000 
   0070: 08b30010 00150020
Model: NXP Layerscape LX2160ARDB Board
Board: LX2160ACE Rev2.0-RDB, Board version: B, boot from FlexSPI DEV#1
FPGA: v4.0
SERDES1 Reference: Clock1 = 161.13MHz Clock2 = 161.13MHz
SERDES2 Reference: Clock1 = 100MHz Clock2 = 100MHz
SERDES3 Reference: Clock1 = 100MHz Clock2 = 100MHz
(...)
EEPROM: NXID v1
In:serial_pl01x
Out:   serial_pl01x
Err:   serial_pl01x
SEC0:  RNG instantiated
Net:   e1000: 68:05:ca:57:cc:c8

Warning: e1000#0 MAC addresses don't match:
Address in ROM is   68:05:ca:57:cc:c8
Address in environment is   00:04:9f:05:c4:27
eth0: DPMAC3@usxgmii, eth1: DPMAC4@usxgmii, eth2: DPMAC17@rgmii-id, eth3: 
DPMAC18@rgmii-id, eth4: e1000#0 [PRIME]
SF: Detected mt35xu512aba with page size 256 Bytes, erase size 128 KiB, total 
64 MiB
device 0 offset 0x64, size 0x8
SF: 524288 bytes @ 0x64 Read: OK
device 0 offset 0xf0, size 0x10
SF: 1048576 bytes @ 0xf0 Read: OK
device 0 offset 0xa0, size 0x30
SF: 3145728 bytes @ 0xa0 Read: OK
device 0 offset 0xe0, size 0x10
SF: 1048576 bytes @ 0xe0 Read: OK
crc32+ MC firmware version 10.24.0

fsl-mc: Booting Management Complex ... SUCCESS
fsl-mc: Management Complex booted (version: 10.24.0, boot status: 0x1)
Hit any key to stop autoboot:  0
=> setenv ethact DPMAC3@usxgmii
=> setenv ipaddr 10.0.0.1
=> ping 10.0.0.2
DPMAC3@usxgmii Waiting for PHY auto negotiation to complete.Using 
DPMAC3@usxgmii device
host 10.0.0.2 is alive

Ioana


[PATCH v2 2/2] board: mediatek: add mt8195 demo board

2022-11-09 Thread Macpaul Lin
From: Fabien Parent 

Add mt8195-demo board support.
This demo purpose board uses MediaTek's MT8195 SoC.

Signed-off-by: Fabien Parent 
Signed-off-by: Amjad Ouled-Ameur 
Signed-off-by: Macpaul Lin 
---
 MAINTAINERS |   1 +
 arch/arm/dts/Makefile   |   1 +
 arch/arm/dts/mt8195-demo.dts| 109 
 board/mediatek/mt8195/MAINTAINERS   |   6 ++
 board/mediatek/mt8195/Makefile  |   3 +
 board/mediatek/mt8195/mt8195_demo.c |  38 ++
 configs/mt8195_demo_defconfig   |  89 +++
 include/configs/mt8195.h|  34 +
 8 files changed, 281 insertions(+)
 create mode 100644 arch/arm/dts/mt8195-demo.dts
 create mode 100644 board/mediatek/mt8195/MAINTAINERS
 create mode 100644 board/mediatek/mt8195/Makefile
 create mode 100644 board/mediatek/mt8195/mt8195_demo.c
 create mode 100644 configs/mt8195_demo_defconfig
 create mode 100644 include/configs/mt8195.h

Changes for v2:
 - no change.

diff --git a/MAINTAINERS b/MAINTAINERS
index 5528dd28c3..5aaeeb02cb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -389,6 +389,7 @@ F:  drivers/watchdog/mtk_wdt.c
 F: drivers/net/mtk_eth.c
 F: drivers/net/mtk_eth.h
 F: drivers/reset/reset-mediatek.c
+F: include/configs/mt8195.h
 F: tools/mtk_image.c
 F: tools/mtk_image.h
 F: tools/mtk_nand_headers.c
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 791838733c..994f7ebcc0 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -1271,6 +1271,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
mt7986a-emmc-rfb.dtb \
mt7986b-emmc-rfb.dtb \
mt8183-pumpkin.dtb \
+   mt8195-demo.dtb \
mt8512-bm1-emmc.dtb \
mt8516-pumpkin.dtb \
mt8518-ap1-emmc.dtb
diff --git a/arch/arm/dts/mt8195-demo.dts b/arch/arm/dts/mt8195-demo.dts
new file mode 100644
index 00..bd0952b248
--- /dev/null
+++ b/arch/arm/dts/mt8195-demo.dts
@@ -0,0 +1,109 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+/*
+ * Copyright (C) 2022 MediaTek Inc.
+ * Copyright (C) 2022 BayLibre SAS.
+ * Author: Macpaul Lin 
+ * Author: Fabien Parent 
+ */
+
+/dts-v1/;
+
+#include 
+#include "mt8195.dtsi"
+
+/ {
+   model = "MediaTek MT8195 demo board";
+   compatible = "mediatek,mt8195-demo", "mediatek,mt8195";
+
+   memory@4000 {
+   device_type = "memory";
+   reg = <0 0x4000 0 0x8000>;
+   };
+
+   reserved-memory {
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   /* 2 MiB reserved for ARM Trusted Firmware (BL31) */
+   bl31_secmon_reserved: secmon@5460 {
+   no-map;
+   reg = <0 0x5460 0x0 0x20>;
+   };
+
+   /* 12 MiB reserved for OP-TEE (BL32)
+* +---+ 0x43e0_
+* |  SHMEM 2MiB   |
+* +---+ 0x43c0_
+* || TA_RAM  8MiB |
+* + TZDRAM +--+ 0x4340_
+* || TEE_RAM 2MiB |
+* +---+ 0x4320_
+*/
+   optee_reserved: optee@4320 {
+   no-map;
+   reg = <0 0x4320 0 0x00c0>;
+   };
+   };
+
+   chosen {
+   stdout-path = &uart0;
+   };
+
+   reg_1p8v: regulator-1p8v {
+   compatible = "regulator-fixed";
+   regulator-name = "fixed-1.8V";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   regulator-boot-on;
+   regulator-always-on;
+   };
+
+   reg_3p3v: regulator-3p3v {
+   compatible = "regulator-fixed";
+   regulator-name = "fixed-3.3V";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   regulator-boot-on;
+   regulator-always-on;
+   };
+};
+
+&watchdog {
+   status = "okay";
+};
+
+&uart0 {
+   status = "okay";
+};
+
+&mmc0 {
+   bus-width = <4>;
+   max-frequency = <2>;
+   cap-mmc-highspeed;
+   mmc-hs200-1_8v;
+   cap-mmc-hw-reset;
+   vmmc-supply = <®_3p3v>;
+   vqmmc-supply = <®_1p8v>;
+   non-removable;
+   status = "okay";
+};
+
+&usb {
+   status = "okay";
+};
+
+&ssusb {
+   mediatek,force-vbus;
+   maximum-speed = "high-speed";
+   dr_mode = "peripheral";
+   status = "okay";
+};
+
+&xhci0 {
+   status = "okay";
+};
+
+&xhci3 {
+   status = "okay";
+};
diff --git a/board/mediatek/mt8195/MAINTAINERS 
b/board/mediatek/mt8195/MAINTAINERS
new file mode 100644
index 00..01fa25115d
--- /dev/null
+++ b/board/mediatek/mt8195/MAINTAINERS
@@ -0,0 +1,6 @@
+MT8195 Demo
+M: Macpaul Lin 
+S:

[PATCH v2 1/2] arm: mediatek: add mt8195 SOC support

2022-11-09 Thread Macpaul Lin
From: Fabien Parent 

The MediaTek MT8195 is a ARM64-based SoC with a quad-core Cortex-A73 and
a quad-core Cortex-A53. It is including UART, SPI, USB3.0 device and hosts,
SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3
and LPDDR4 options.

Signed-off-by: Fabien Parent 
Signed-off-by: Macpaul Lin 

---
 MAINTAINERS|   2 +
 arch/arm/dts/mt8195.dtsi   | 370 +
 arch/arm/mach-mediatek/Kconfig |  13 +-
 arch/arm/mach-mediatek/Makefile|   1 +
 arch/arm/mach-mediatek/mt8195/Makefile |   3 +
 arch/arm/mach-mediatek/mt8195/init.c   |  81 ++
 6 files changed, 469 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/mt8195.dtsi
 create mode 100644 arch/arm/mach-mediatek/mt8195/Makefile
 create mode 100644 arch/arm/mach-mediatek/mt8195/init.c

Changes for v2:
 - Correct node name to t-phy for u3phy0.
 - Add platform compatible string "mediatek,mt8195-tphy" to all usb phy nodes.
 - remove clock nodes that software cannot controlled in phy nodes.
 - Test and add back "mac" for HOST only xhci nodes.

diff --git a/MAINTAINERS b/MAINTAINERS
index 1cf99c1393..5528dd28c3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -362,8 +362,10 @@ ARM MEDIATEK
 M: Ryder Lee 
 M: Weijie Gao 
 M: Chunfeng Yun 
+M: Macpaul Lin 
 R: GSS_MTK_Uboot_upstream 
 S: Maintained
+F: arch/arm/dts/mt8195.dtsi
 F: arch/arm/mach-mediatek/
 F: arch/arm/include/asm/arch-mediatek/
 F: board/mediatek/
diff --git a/arch/arm/dts/mt8195.dtsi b/arch/arm/dts/mt8195.dtsi
new file mode 100644
index 00..33282d21d1
--- /dev/null
+++ b/arch/arm/dts/mt8195.dtsi
@@ -0,0 +1,370 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2022 MediaTek Inc.
+ * Copyright (C) 2022 BayLibre, SAS
+ * Author: Ben Ho 
+ * Erin Lo 
+ * Fabien Parent 
+ * Macpaul Lin 
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+/ {
+   compatible = "mediatek,mt8195";
+   interrupt-parent = <&sysirq>;
+   #address-cells = <2>;
+   #size-cells = <2>;
+
+   cpus {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   cpu-map {
+   cluster0 {
+   core0 {
+   cpu = <&cpu0>;
+   };
+   core1 {
+   cpu = <&cpu1>;
+   };
+   core2 {
+   cpu = <&cpu2>;
+   };
+   core3 {
+   cpu = <&cpu3>;
+   };
+   };
+
+   cluster1 {
+   core0 {
+   cpu = <&cpu4>;
+   };
+   core1 {
+   cpu = <&cpu5>;
+   };
+   core2 {
+   cpu = <&cpu6>;
+   };
+   core3 {
+   cpu = <&cpu7>;
+   };
+   };
+   };
+
+   cpu0: cpu@0 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a53";
+   reg = <0x000>;
+   enable-method = "psci";
+   capacity-dmips-mhz = <741>;
+   };
+
+   cpu1: cpu@1 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a53";
+   reg = <0x001>;
+   enable-method = "psci";
+   capacity-dmips-mhz = <741>;
+   };
+
+   cpu2: cpu@2 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a53";
+   reg = <0x002>;
+   enable-method = "psci";
+   capacity-dmips-mhz = <741>;
+   };
+
+   cpu3: cpu@3 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a53";
+   reg = <0x003>;
+   enable-method = "psci";
+   capacity-dmips-mhz = <741>;
+   };
+
+   cpu4: cpu@100 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a73";
+   reg = <0x100>;
+   enable-method = "psci";
+   capacity-dmips-mhz = <1024>;
+   };
+
+   cpu5: cpu@101 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a73";

Re: [PATCH 2/2] spi: fsl_qspi: Support to use full AHB space on i.MX

2022-11-09 Thread Frieder Schrempf
Hi,

On 09.06.20 09:59, Ye Li wrote:
> i.MX platforms provide large AHB mapped space for QSPI, each
> controller has 256MB. However, current driver only maps small
> size (AHB buffer size) of AHB space, this implementation
> causes i.MX failed to boot M4 with QSPI XIP image.
> 
> Add config CONFIG_FSL_QSPI_AHB_FULL_MAP (default enabled for i.MX)
> to address above problem.
> 
> When the config is set:
> 1. Full AHB space is divided to each CS.
> 2. A dedicated LUT entry is used for AHB read only.
> 3. The MODE instruction in LUT is replaced to standard ADDR instruction
> 4. The address in spi_mem_op is used to SFAR and AHB read
> 
> Signed-off-by: Ye Li 
> Reviewed-by: Ashish Kumar 
> Reviewed-by: Kuldeep Singh 

I know I'm very late, but I seem to have missed this back in the days
when it was posted. Unfortunately there are some problems with this change.

1. The way the memory mapping of the attached flash (QSPI NOR?) is
implemented here is messy. In Linux we have a dirmap API for this kind
of things and it has recently been ported to U-Boot [1][2]. It would be
better to use this, similar to what was done here [3].

2. This change breaks reading from the SPI NAND flash used on the
Kontron SL i.MX6UL/ULL boards. The read operation returns garbage
instead of the actual data on the flash. When I revert this commit or set

# CONFIG_FSL_QSPI_AHB_FULL_MAP is not set

in the defconfig, it works.

Ye, can you come up with a solution for point 1 or if not can we change
the default of CONFIG_FSL_QSPI_AHB_FULL_MAP from enabled to disabled,
please?

For now I will disable CONFIG_FSL_QSPI_AHB_FULL_MAP in the boards
defconfig, but we should fix this globally.

What do you think?

Thanks
Frieder

[1]
https://source.denx.de/u-boot/u-boot/-/commit/f7e1de4c6a43beec438bce04571469145086efed
[2]
https://source.denx.de/u-boot/u-boot/-/commit/463cdf66632a0d67bf824cb43b6c1b41782d0765
[3]
https://source.denx.de/u-boot/u-boot/-/commit/992d02ea737895dc67246bbf7065084bb2721d6b


Re: [PATCH 1/2] arm: mediatek: add mt8195 SOC support

2022-11-09 Thread Macpaul Lin

On 11/9/22 15:32, Macpaul Lin wrote:


On 11/9/22 10:07, Chunfeng Yun (云春峰) wrote:

On Tue, 2022-11-08 at 11:21 +0800, Macpaul Lin wrote:

From: Fabien Parent 

The MediaTek MT8195 is a ARM64-based SoC with a quad-core Cortex-A73
and
a quad-core Cortex-A53. It is including UART, SPI, USB3.0 device and
hosts,
SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3
and LPDDR4 options.

Signed-off-by: Fabien Parent 
Signed-off-by: Macpaul Lin 
---
  MAINTAINERS    |   2 +
  arch/arm/dts/mt8195.dtsi   | 317
+
  arch/arm/mach-mediatek/Kconfig |  13 +-
  arch/arm/mach-mediatek/Makefile    |   1 +
  arch/arm/mach-mediatek/mt8195/Makefile |   3 +
  arch/arm/mach-mediatek/mt8195/init.c   |  81 +++
  6 files changed, 416 insertions(+), 1 deletion(-)
  create mode 100644 arch/arm/dts/mt8195.dtsi
  create mode 100644 arch/arm/mach-mediatek/mt8195/Makefile
  create mode 100644 arch/arm/mach-mediatek/mt8195/init.c


[deleted]


+    xhci3: xhci3@112b {

change node name as xhci? prefer to use the same name



Since there are other board manufacturers will use the
other HOST ports, like xhci1 or xhci2 with USB mass storage
function by their needs.
I'll add these 2 node in dtsi in next version.


+    compatible = "mediatek,mt8195-xhci",
+ "mediatek,mtk-xhci";
+    reg = <0 0x112b 0 0x1000>,
+  <0 0x112b3e00 0 0x0100>;
+    reg-names = "mac", "ippc";

remove "mac"


Will fix it in next version.



Dear Chunfeng,

Unfortunately, if we remove "mac" register here for HOST only node like 
xhci3, the driver will complain about probing fail. Please check the 
following log.


=> usb start
starting USB...
Bus xhci3@112b: xhci-mtk xhci3@112b: failed to get xHCI base address
probe failed, error -6
No working controllers found

I'll add "mac" back to HOST only nodes.

Thanks!
Macpaul Lin


Re: [PATCH v20 3/4] doc: cmd: wget: add documentation

2022-11-09 Thread Ramon Fried
On Tue, Nov 8, 2022 at 10:15 PM Simon Glass  wrote:
>
> On Mon, 7 Nov 2022 at 23:17, Ying-Chun Liu (PaulLiu)
>  wrote:
> >
> > From: "Ying-Chun Liu (PaulLiu)" 
> >
> > Add documentation for the wget command.
> >
> > Signed-off-by: Ying-Chun Liu (PaulLiu) 
> > Cc: Christian Gmeiner 
> > Cc: Joe Hershberger 
> > Cc: Michal Simek 
> > Cc: Ramon Fried 
> > Cc: Simon Glass 
> > ---
> >  doc/usage/cmd/wget.rst | 61 ++
> >  doc/usage/index.rst|  1 +
> >  2 files changed, 62 insertions(+)
> >  create mode 100644 doc/usage/cmd/wget.rst
> >
>
> Reviewed-by: Simon Glass 
Reviewed-by: Ramon Fried 


Re: [PATCH v20 4/4] test: cmd: add test for wget command.

2022-11-09 Thread Ramon Fried
On Tue, Nov 8, 2022 at 10:15 PM Simon Glass  wrote:
>
> On Mon, 7 Nov 2022 at 23:17, Ying-Chun Liu (PaulLiu)
>  wrote:
> >
> > From: "Ying-Chun Liu (PaulLiu)" 
> >
> > Simulate a TCP HTTP server's response for testing wget command.
> >
> > Signed-off-by: Ying-Chun Liu (PaulLiu) 
> > Cc: Christian Gmeiner 
> > Cc: Joe Hershberger 
> > Cc: Michal Simek 
> > Cc: Ramon Fried 
> > Cc: Simon Glass 
> > ---
> >  test/cmd/Makefile |   1 +
> >  test/cmd/wget.c   | 206 ++
> >  2 files changed, 207 insertions(+)
> >  create mode 100644 test/cmd/wget.c
> >
>
> Reviewed-by: Simon Glass 
Reviewed-by: Ramon Fried 


Re: [PATCH v6 2/6] net: mvneta: Add support for AlleyCat5

2022-11-09 Thread Stefan Roese

Hi Ramon,

On 09.11.22 09:22, Ramon Fried wrote:

On Sat, Nov 5, 2022 at 6:24 AM Chris Packham  wrote:


Add support for the AlleyCat5 SoC. This lacks the mbus from the other
users of the mvneta.c driver so a new compatible string is needed to
allow for a different window configuration.

Signed-off-by: Chris Packham 
Reviewed-by: Stefan Roese 
---

(no changes since v3)

Changes in v3:
- Remove unnecessary changes to RX descriptor handling
- Use dev_get_dma_range() to parse dma-ranges property from parent
   device.

  drivers/net/Kconfig  |  2 +-
  drivers/net/mvneta.c | 43 ++-
  2 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 6bbbadc5ee..8df3dce6df 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -448,7 +448,7 @@ config MVGBE

  config MVNETA
 bool "Marvell Armada XP/385/3700 network interface support"
-   depends on ARMADA_XP || ARMADA_38X || ARMADA_3700
+   depends on ARMADA_XP || ARMADA_38X || ARMADA_3700 || ALLEYCAT_5
 select PHYLIB
 select DM_MDIO
 help
diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
index d2c42c4396..0fbfad11d4 100644
--- a/drivers/net/mvneta.c
+++ b/drivers/net/mvneta.c
@@ -91,6 +91,8 @@ DECLARE_GLOBAL_DATA_PTR;
  #define MVNETA_WIN_SIZE_MASK   (0x)
  #define MVNETA_BASE_ADDR_ENABLE 0x2290
  #define  MVNETA_BASE_ADDR_ENABLE_BIT   0x1
+#define  MVNETA_AC5_CNM_DDR_TARGET 0x2
+#define  MVNETA_AC5_CNM_DDR_ATTR   0xb
  #define MVNETA_PORT_ACCESS_PROTECT  0x2294
  #define  MVNETA_PORT_ACCESS_PROTECT_WIN0_RW0x3
  #define MVNETA_PORT_CONFIG  0x2400
@@ -282,6 +284,8 @@ struct mvneta_port {
 struct gpio_desc phy_reset_gpio;
 struct gpio_desc sfp_tx_disable_gpio;
  #endif
+
+   uintptr_t dma_base; /* base address for DMA address decoding */
  };

  /* The mvneta_tx_desc and mvneta_rx_desc structures describe the
@@ -1343,6 +1347,29 @@ static void mvneta_conf_mbus_windows(struct mvneta_port 
*pp)
 mvreg_write(pp, MVNETA_BASE_ADDR_ENABLE, win_enable);
  }

+static void mvneta_conf_ac5_cnm_xbar_windows(struct mvneta_port *pp)
+{
+   int i;
+
+   /* Clear all windows */
+   for (i = 0; i < 6; i++) {
+   mvreg_write(pp, MVNETA_WIN_BASE(i), 0);
+   mvreg_write(pp, MVNETA_WIN_SIZE(i), 0);
+
+   if (i < 4)
+   mvreg_write(pp, MVNETA_WIN_REMAP(i), 0);
+   }
+
+   /*
+* Setup window #0 base 0x0 to target XBAR port 2 (AMB2), attribute 
0xb, size 4GB
+* AMB2 address decoder remaps 0x0 to DDR 64 bit base address
+*/
+   mvreg_write(pp, MVNETA_WIN_BASE(0),
+   (MVNETA_AC5_CNM_DDR_ATTR << 8) | MVNETA_AC5_CNM_DDR_TARGET);
+   mvreg_write(pp, MVNETA_WIN_SIZE(0), 0x);
+   mvreg_write(pp, MVNETA_BASE_ADDR_ENABLE, 0x3e);
+}
+
  /* Power up the port */
  static int mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
  {
@@ -1525,7 +1552,7 @@ static int mvneta_recv(struct udevice *dev, int flags, 
uchar **packetp)
  * No cache invalidation needed here, since the rx_buffer's are
  * located in a uncached memory region
  */
-   *packetp = data;
+   *packetp = data + pp->dma_base;

 /*
  * Only mark one descriptor as free
@@ -1544,6 +1571,10 @@ static int mvneta_probe(struct udevice *dev)
 struct ofnode_phandle_args sfp_args;
  #endif
 void *bd_space;
+   phys_addr_t cpu;
+   dma_addr_t bus;
+   u64 size;
+   int ret;

 /*
  * Allocate buffer area for descs and rx_buffers. This is only
@@ -1577,9 +1608,18 @@ static int mvneta_probe(struct udevice *dev)
 /* Configure MBUS address windows */
 if (device_is_compatible(dev, "marvell,armada-3700-neta"))
 mvneta_bypass_mbus_windows(pp);
+   else if (device_is_compatible(dev, "marvell,armada-ac5-neta"))
+   mvneta_conf_ac5_cnm_xbar_windows(pp);
 else
 mvneta_conf_mbus_windows(pp);

+   /* fetch dma ranges property */
+   ret = dev_get_dma_range(dev, &cpu, &bus, &size);
+   if (!ret)
+   pp->dma_base = cpu;
+   else
+   pp->dma_base = 0;
+
  #if CONFIG_IS_ENABLED(DM_GPIO)
 if (!dev_read_phandle_with_args(dev, "sfp", NULL, 0, 0, &sfp_args) &&
 ofnode_is_enabled(sfp_args.node))
@@ -1620,6 +1660,7 @@ static const struct eth_ops mvneta_ops = {

  static const struct udevice_id mvneta_ids[] = {
 { .compatible = "marvell,armada-370-neta" },
+   { .compatible = "marvell,armada-ac5-neta" },
 { .compatible = "marvell,armada-xp-neta" },
 { .compatible = "marvell,armada-3700-neta" },
 { }
--
2.38.1


Reviewed-by: Ramon Fr

Re: [PATCH v20 1/4] net: Add TCP protocol

2022-11-09 Thread Ramon Fried
On Tue, Nov 8, 2022 at 8:17 AM Ying-Chun Liu (PaulLiu)
 wrote:
>
> From: "Ying-Chun Liu (PaulLiu)" 
>
> Currently file transfers are done using tftp or NFS both
> over udp. This requires a request to be sent from client
> (u-boot) to the boot server.
>
> The current standard is TCP with selective acknowledgment.
>
> Signed-off-by: Duncan Hare 
> Signed-off-by: Duncan Hare 
> Signed-off-by: Ying-Chun Liu (PaulLiu) 
> Reviewed-by: Simon Glass 
> Cc: Christian Gmeiner 
> Cc: Joe Hershberger 
> Cc: Michal Simek 
> Cc: Ramon Fried 
> ---
> v1-v12: Made by Duncan, didn't tracked.
> v13: Fix some issues which is reviewed by Christian
> v14: Add options to enable/disable SACK.
> v15: Fix various syntax errors reviewed by Michal.
>  Remove magic numbers. Use kernel-doc format.
> v16: Add more kernel-doc. Fix more double spaces.
> v19: export tcp_set_pseudo_header() for unit test.
> ---
>  include/net.h |  36 ++-
>  include/net/tcp.h | 299 +++
>  net/Kconfig   |  16 ++
>  net/Makefile  |   1 +
>  net/net.c |  30 ++
>  net/tcp.c | 720 ++
>  6 files changed, 1093 insertions(+), 9 deletions(-)
>  create mode 100644 include/net/tcp.h
>  create mode 100644 net/tcp.c
>
> diff --git a/include/net.h b/include/net.h
> index 32364ed0ce..f4140523c2 100644
> --- a/include/net.h
> +++ b/include/net.h
> @@ -365,6 +365,7 @@ struct vlan_ethernet_hdr {
>  #define PROT_NCSI  0x88f8  /* NC-SI control packets*/
>
>  #define IPPROTO_ICMP1  /* Internet Control Message Protocol*/
> +#define IPPROTO_TCP6   /* Transmission Control Protocol*/
>  #define IPPROTO_UDP17  /* User Datagram Protocol   */
>
>  /*
> @@ -690,19 +691,36 @@ static inline void net_send_packet(uchar *pkt, int len)
> (void) eth_send(pkt, len);
>  }
>
> -/*
> - * Transmit "net_tx_packet" as UDP packet, performing ARP request if needed
> - *  (ether will be populated)
> - *
> - * @param ether Raw packet buffer
> - * @param dest IP address to send the datagram to
> - * @param dport Destination UDP port
> - * @param sport Source UDP port
> - * @param payload_len Length of data after the UDP header
> +/**
> + * net_send_ip_packet() - Transmit "net_tx_packet" as UDP or TCP packet,
> + *send ARP request if needed (ether will be 
> populated)
> + * @ether: Raw packet buffer
> + * @dest: IP address to send the datagram to
> + * @dport: Destination UDP port
> + * @sport: Source UDP port
> + * @payload_len: Length of data after the UDP header
> + * @action: TCP action to be performed
> + * @tcp_seq_num: TCP sequence number of this transmission
> + * @tcp_ack_num: TCP stream acknolegement number
> + *
> + * Return: 0 on success, other value on failure
>   */
>  int net_send_ip_packet(uchar *ether, struct in_addr dest, int dport, int 
> sport,
>int payload_len, int proto, u8 action, u32 tcp_seq_num,
>u32 tcp_ack_num);
> +/**
> + * net_send_tcp_packet() - Transmit TCP packet.
> + * @payload_len: length of payload
> + * @dport: Destination TCP port
> + * @sport: Source TCP port
> + * @action: TCP action to be performed
> + * @tcp_seq_num: TCP sequence number of this transmission
> + * @tcp_ack_num: TCP stream acknolegement number
> + *
> + * Return: 0 on success, other value on failure
> + */
> +int net_send_tcp_packet(int payload_len, int dport, int sport, u8 action,
> +   u32 tcp_seq_num, u32 tcp_ack_num);
>  int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport,
> int sport, int payload_len);
>
> diff --git a/include/net/tcp.h b/include/net/tcp.h
> new file mode 100644
> index 00..322551694f
> --- /dev/null
> +++ b/include/net/tcp.h
> @@ -0,0 +1,299 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * TCP Support with SACK for file transfer.
> + *
> + * Copyright 2017 Duncan Hare, All rights reserved.
> + */
> +
> +#define TCP_ACTIVITY 127   /* Number of packets received   */
> +   /* before console progress mark */
> +/**
> + * struct ip_tcp_hdr - IP and TCP header
> + * @ip_hl_v: header length and version
> + * @ip_tos: type of service
> + * @ip_len: total length
> + * @ip_id: identification
> + * @ip_off: fragment offset field
> + * @ip_ttl: time to live
> + * @ip_p: protocol
> + * @ip_sum: checksum
> + * @ip_src: Source IP address
> + * @ip_dst: Destination IP address
> + * @tcp_src: TCP source port
> + * @tcp_dst: TCP destination port
> + * @tcp_seq: TCP sequence number
> + * @tcp_ack: TCP Acknowledgment number
> + * @tcp_hlen: 4 bits TCP header Length/4, 4 bits reserved, 2 more bits 
> reserved
> + * @tcp_flag: flags of TCP
> + * @tcp_win: TCP windows size
> + * @tcp_xsum: Checksum
> + * @tcp_ugr: Pointer to urgent data
> + */
> +struct ip_tcp_hdr {
> +   u8  ip_hl_v;
> +   u8  ip_tos;
> + 

Re: [PATCH v20 2/4] net: Add wget application

2022-11-09 Thread Ramon Fried
On Wed, Nov 9, 2022 at 4:26 AM Ying-Chun Liu (PaulLiu)
 wrote:
>
>
>
> On 2022/11/9 05:03, Sean Anderson wrote:
> > On 11/8/22 01:17, Ying-Chun Liu (PaulLiu) wrote:
> >> From: "Ying-Chun Liu (PaulLiu)" 
> >>
> >> This commit adds a simple wget command that can download files
> >> from http server.
> >>
> >> The command syntax is
> >> wget ${loadaddr} 
> >>
> >> Signed-off-by: Duncan Hare 
> >> Signed-off-by: Ying-Chun Liu (PaulLiu) 
> >> Reviewed-by: Simon Glass 
> >> Cc: Christian Gmeiner 
> >> Cc: Joe Hershberger 
> >> Cc: Michal Simek 
> >> Cc: Ramon Fried 
> >> ---
> >> v1-v12: Made by Duncan, didn't tracked.
> >> v13: Fix some issues which is reviewed by Christian
> >> v14: Add options to enable/disable SACK.
> >> v15: Fix various syntax errors reviewed by Michal.
> >>   Remove magic numbers. Use kernel-doc format.
> >> v16: Add more kernel-doc. Fix more double spaces.
> >> v17: Fix wget with address timeout issue reported by Ramon.
> >> v20: Rebase to latest master and resolve conflict.
> >> ---
> >>   cmd/Kconfig|   7 +
> >>   cmd/net.c  |  13 ++
> >>   include/net.h  |   2 +-
> >>   include/net/wget.h |  22 +++
> >>   net/Makefile   |   1 +
> >>   net/net.c  |   6 +
> >>   net/wget.c | 438 +
> >>   7 files changed, 488 insertions(+), 1 deletion(-)
> >>   create mode 100644 include/net/wget.h
> >>   create mode 100644 net/wget.c
> >>
> >> diff --git a/cmd/Kconfig b/cmd/Kconfig
> >> index 105406496e..d093581b24 100644
> >> --- a/cmd/Kconfig
> >> +++ b/cmd/Kconfig
> >> @@ -1798,6 +1798,13 @@ config SYS_DISABLE_AUTOLOAD
> >>is complete.  Enable this option to disable this behavior and 
> >> instead
> >>require files to be loaded over the network by subsequent commands.
> >>
> >> +config CMD_WGET
> >> +bool "wget"
> >> +select TCP
> >> +help
> >> +  wget is a simple command to download kernel, or other files,
> >> +  from a http server over TCP.
> >> +
> >>   config CMD_MII
> >>  bool "mii"
> >>  imply CMD_MDIO
> >> diff --git a/cmd/net.c b/cmd/net.c
> >> index addcad3ac1..f6d9f5ea3a 100644
> >> --- a/cmd/net.c
> >> +++ b/cmd/net.c
> >> @@ -125,6 +125,19 @@ U_BOOT_CMD(
> >>   );
> >>   #endif
> >>
> >> +#if defined(CONFIG_CMD_WGET)
> >> +static int do_wget(struct cmd_tbl *cmdtp, int flag, int argc, char * 
> >> const argv[])
> >> +{
> >> +return netboot_common(WGET, cmdtp, argc, argv);
> >> +}
> >> +
> >> +U_BOOT_CMD(
> >> +wget,   3,  1,  do_wget,
> >> +"boot image via network using HTTP protocol",
> >> +"[loadAddress] [[hostIPaddr:]path and image name]"
> >> +);
> >> +#endif
> >> +
> >>   static void netboot_update_env(void)
> >>   {
> >>  char tmp[22];
> >> diff --git a/include/net.h b/include/net.h
> >> index f4140523c2..e0c7804827 100644
> >> --- a/include/net.h
> >> +++ b/include/net.h
> >> @@ -561,7 +561,7 @@ extern int   net_restart_wrap;   /* 
> >> Tried all network devices */
> >>
> >>   enum proto_t {
> >>  BOOTP, RARP, ARP, TFTPGET, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP,
> >> -TFTPSRV, TFTPPUT, LINKLOCAL, FASTBOOT, WOL, UDP, NCSI
> >> +TFTPSRV, TFTPPUT, LINKLOCAL, FASTBOOT, WOL, UDP, NCSI, WGET
> >>   };
> >>
> >>   extern charnet_boot_file_name[1024];/* Boot File name */
> >> diff --git a/include/net/wget.h b/include/net/wget.h
> >> new file mode 100644
> >> index 00..da0920de11
> >> --- /dev/null
> >> +++ b/include/net/wget.h
> >> @@ -0,0 +1,22 @@
> >> +/* SPDX-License-Identifier: GPL-2.0 */
> >> +/*
> >> + * Duncan Hare Copyright 2017
> >> + */
> >> +
> >> +/**
> >> + * wget_start() - begin wget
> >> + */
> >> +void wget_start(void);
> >> +
> >> +enum wget_state {
> >> +WGET_CLOSED,
> >> +WGET_CONNECTING,
> >> +WGET_CONNECTED,
> >> +WGET_TRANSFERRING,
> >> +WGET_TRANSFERRED
> >> +};
> >> +
> >> +#define DEBUG_WGET  0   /* Set to 1 for debug messages */
> >> +#define SERVER_PORT 80
> >> +#define WGET_RETRY_COUNT30
> >> +#define WGET_TIMEOUT2000UL
> >> diff --git a/net/Makefile b/net/Makefile
> >> index d131d1cb1a..4f757a224c 100644
> >> --- a/net/Makefile
> >> +++ b/net/Makefile
> >> @@ -31,6 +31,7 @@ obj-$(CONFIG_UDP_FUNCTION_FASTBOOT)  += fastboot.o
> >>   obj-$(CONFIG_CMD_WOL)  += wol.o
> >>   obj-$(CONFIG_PROT_UDP) += udp.o
> >>   obj-$(CONFIG_PROT_TCP) += tcp.o
> >> +obj-$(CONFIG_CMD_WGET) += wget.o
> >>
> >>   # Disable this warning as it is triggered by:
> >>   # sprintf(buf, index ? "foo%d" : "foo", index)
> >> diff --git a/net/net.c b/net/net.c
> >> index 7878a9970b..8c630f9467 100644
> >> --- a/net/net.c
> >> +++ b/net/net.c
> >> @@ -118,6 +118,7 @@
> >>   #include "wol.h"
> >>   #endif
> >>   #include 
> >> +#include 
> >>
> >>   /** BOOTP EXTENTIONS **/
> >>
> >> @@ -517,6 +518,11 @@ restart:
> >>  nfs_start();
> >>  break;
> >>   #endif
> >> +#if defined(CONFIG_CMD_WGET)
> >>

Re: [PATCH v6 2/6] net: mvneta: Add support for AlleyCat5

2022-11-09 Thread Ramon Fried
On Sat, Nov 5, 2022 at 6:24 AM Chris Packham  wrote:
>
> Add support for the AlleyCat5 SoC. This lacks the mbus from the other
> users of the mvneta.c driver so a new compatible string is needed to
> allow for a different window configuration.
>
> Signed-off-by: Chris Packham 
> Reviewed-by: Stefan Roese 
> ---
>
> (no changes since v3)
>
> Changes in v3:
> - Remove unnecessary changes to RX descriptor handling
> - Use dev_get_dma_range() to parse dma-ranges property from parent
>   device.
>
>  drivers/net/Kconfig  |  2 +-
>  drivers/net/mvneta.c | 43 ++-
>  2 files changed, 43 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> index 6bbbadc5ee..8df3dce6df 100644
> --- a/drivers/net/Kconfig
> +++ b/drivers/net/Kconfig
> @@ -448,7 +448,7 @@ config MVGBE
>
>  config MVNETA
> bool "Marvell Armada XP/385/3700 network interface support"
> -   depends on ARMADA_XP || ARMADA_38X || ARMADA_3700
> +   depends on ARMADA_XP || ARMADA_38X || ARMADA_3700 || ALLEYCAT_5
> select PHYLIB
> select DM_MDIO
> help
> diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
> index d2c42c4396..0fbfad11d4 100644
> --- a/drivers/net/mvneta.c
> +++ b/drivers/net/mvneta.c
> @@ -91,6 +91,8 @@ DECLARE_GLOBAL_DATA_PTR;
>  #define MVNETA_WIN_SIZE_MASK   (0x)
>  #define MVNETA_BASE_ADDR_ENABLE 0x2290
>  #define  MVNETA_BASE_ADDR_ENABLE_BIT   0x1
> +#define  MVNETA_AC5_CNM_DDR_TARGET 0x2
> +#define  MVNETA_AC5_CNM_DDR_ATTR   0xb
>  #define MVNETA_PORT_ACCESS_PROTECT  0x2294
>  #define  MVNETA_PORT_ACCESS_PROTECT_WIN0_RW0x3
>  #define MVNETA_PORT_CONFIG  0x2400
> @@ -282,6 +284,8 @@ struct mvneta_port {
> struct gpio_desc phy_reset_gpio;
> struct gpio_desc sfp_tx_disable_gpio;
>  #endif
> +
> +   uintptr_t dma_base; /* base address for DMA address decoding */
>  };
>
>  /* The mvneta_tx_desc and mvneta_rx_desc structures describe the
> @@ -1343,6 +1347,29 @@ static void mvneta_conf_mbus_windows(struct 
> mvneta_port *pp)
> mvreg_write(pp, MVNETA_BASE_ADDR_ENABLE, win_enable);
>  }
>
> +static void mvneta_conf_ac5_cnm_xbar_windows(struct mvneta_port *pp)
> +{
> +   int i;
> +
> +   /* Clear all windows */
> +   for (i = 0; i < 6; i++) {
> +   mvreg_write(pp, MVNETA_WIN_BASE(i), 0);
> +   mvreg_write(pp, MVNETA_WIN_SIZE(i), 0);
> +
> +   if (i < 4)
> +   mvreg_write(pp, MVNETA_WIN_REMAP(i), 0);
> +   }
> +
> +   /*
> +* Setup window #0 base 0x0 to target XBAR port 2 (AMB2), attribute 
> 0xb, size 4GB
> +* AMB2 address decoder remaps 0x0 to DDR 64 bit base address
> +*/
> +   mvreg_write(pp, MVNETA_WIN_BASE(0),
> +   (MVNETA_AC5_CNM_DDR_ATTR << 8) | 
> MVNETA_AC5_CNM_DDR_TARGET);
> +   mvreg_write(pp, MVNETA_WIN_SIZE(0), 0x);
> +   mvreg_write(pp, MVNETA_BASE_ADDR_ENABLE, 0x3e);
> +}
> +
>  /* Power up the port */
>  static int mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
>  {
> @@ -1525,7 +1552,7 @@ static int mvneta_recv(struct udevice *dev, int flags, 
> uchar **packetp)
>  * No cache invalidation needed here, since the rx_buffer's 
> are
>  * located in a uncached memory region
>  */
> -   *packetp = data;
> +   *packetp = data + pp->dma_base;
>
> /*
>  * Only mark one descriptor as free
> @@ -1544,6 +1571,10 @@ static int mvneta_probe(struct udevice *dev)
> struct ofnode_phandle_args sfp_args;
>  #endif
> void *bd_space;
> +   phys_addr_t cpu;
> +   dma_addr_t bus;
> +   u64 size;
> +   int ret;
>
> /*
>  * Allocate buffer area for descs and rx_buffers. This is only
> @@ -1577,9 +1608,18 @@ static int mvneta_probe(struct udevice *dev)
> /* Configure MBUS address windows */
> if (device_is_compatible(dev, "marvell,armada-3700-neta"))
> mvneta_bypass_mbus_windows(pp);
> +   else if (device_is_compatible(dev, "marvell,armada-ac5-neta"))
> +   mvneta_conf_ac5_cnm_xbar_windows(pp);
> else
> mvneta_conf_mbus_windows(pp);
>
> +   /* fetch dma ranges property */
> +   ret = dev_get_dma_range(dev, &cpu, &bus, &size);
> +   if (!ret)
> +   pp->dma_base = cpu;
> +   else
> +   pp->dma_base = 0;
> +
>  #if CONFIG_IS_ENABLED(DM_GPIO)
> if (!dev_read_phandle_with_args(dev, "sfp", NULL, 0, 0, &sfp_args) &&
> ofnode_is_enabled(sfp_args.node))
> @@ -1620,6 +1660,7 @@ static const struct eth_ops mvneta_ops = {
>
>  static const struct udevice_id mvneta_ids[] = {
> { .compatible = "marvell,armada-370-neta" },
> +   { .compatible = "marvell,armada-ac5-net

Re: [PATCH] drivers: net: aquantia: fix typos

2022-11-09 Thread Ramon Fried
On Thu, Nov 3, 2022 at 11:44 PM Tim Harvey  wrote:
>
> Fix a couple of typos:
> - s/Acquantia/Aquantia/
> - s/firmare/firmware/
>
> Signed-off-by: Tim Harvey 
> ---
>  drivers/net/phy/aquantia.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/phy/aquantia.c b/drivers/net/phy/aquantia.c
> index 7e950fe0c2fe..79fbc115368a 100644
> --- a/drivers/net/phy/aquantia.c
> +++ b/drivers/net/phy/aquantia.c
> @@ -136,7 +136,7 @@ static int aquantia_read_fw(u8 **fw_addr, size_t 
> *fw_length)
>
> *fw_addr = NULL;
> *fw_length = 0;
> -   debug("Loading Acquantia microcode from %s %s\n",
> +   debug("Loading Aquantia microcode from %s %s\n",
>   CONFIG_PHY_AQUANTIA_FW_PART, CONFIG_PHY_AQUANTIA_FW_NAME);
> ret = fs_set_blk_dev("mmc", CONFIG_PHY_AQUANTIA_FW_PART, FS_TYPE_ANY);
> if (ret < 0)
> @@ -163,7 +163,7 @@ static int aquantia_read_fw(u8 **fw_addr, size_t 
> *fw_length)
>
> *fw_addr = addr;
> *fw_length = length;
> -   debug("Found Acquantia microcode.\n");
> +   debug("Found Aquantia microcode.\n");
>
>  cleanup:
> if (ret < 0) {
> @@ -257,7 +257,7 @@ static int aquantia_upload_firmware(struct phy_device 
> *phydev)
>
> strlcpy(version, (char *)&addr[dram_offset + VERSION_STRING_OFFSET],
> VERSION_STRING_SIZE);
> -   printf("%s loading firmare version '%s'\n", phydev->dev->name, 
> version);
> +   printf("%s loading firmware version '%s'\n", phydev->dev->name, 
> version);
>
> /* stall the microcprocessor */
> phy_write(phydev, MDIO_MMD_VEND1, UP_CONTROL,
> @@ -288,7 +288,7 @@ static int aquantia_upload_firmware(struct phy_device 
> *phydev)
>
> phy_write(phydev, MDIO_MMD_VEND1, UP_CONTROL, UP_RUN_STALL_OVERRIDE);
>
> -   printf("%s firmare loading done.\n", phydev->dev->name);
> +   printf("%s firmware loading done.\n", phydev->dev->name);
>  done:
> free(addr);
> return ret;
> --
> 2.25.1
>
Reviewed-by: Ramon Fried