[PATCH v9 1/1] mtd: spi-nor-core: Add support for Macronix Octal flash
Adding Macronix Octal flash for Octal DTR support. The octaflash series can be divided into the following types: MX25 series : Serial NOR Flash. MX66 series : Serial NOR Flash with stacked die.(Size larger than 1Gb) LM/UM series : Up to 250MHz clock frequency with both DTR/STR operation. LW/UW series : Support simultaneous Read-while-Write operation in multiple bank architecture. Read-while-write feature which means read data one bank while another bank is programing or erasing. MX25LM : 3.0V Octal I/O -https://www.mxic.com.tw/Lists/Datasheet/Attachments/7841/MX25LM51245G,%203V,%20512Mb,%20v1.1.pdf MX25UM : 1.8V Octal I/O -https://www.mxic.com.tw/Lists/Datasheet/Attachments/7525/MX25UM51245G%20Extreme%20Speed,%201.8V,%20512Mb,%20v1.0.pdf MX66LM : 3.0V Octal I/O with stacked die -https://www.mxic.com.tw/Lists/Datasheet/Attachments/7929/MX66LM1G45G,%203V,%201Gb,%20v1.1.pdf MX66UM : 1.8V Octal I/O with stacked die -https://www.mxic.com.tw/Lists/Datasheet/Attachments/7721/MX66UM1G45G,%201.8V,%201Gb,%20v1.1.pdf MX25LW : 3.0V Octal I/O with Read-while-Write MX25UW : 1.8V Octal I/O with Read-while-Write MX66LW : 3.0V Octal I/O with Read-while-Write and stack die MX66UW : 1.8V Octal I/O with Read-while-Write and stack die About LW/UW series, please contact us freely if you have any questions. For adding Octal NOR Flash IDs, we have validated each Flash on plateform zynq-picozed. As below are the SFDP table dump. zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id c2943c zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer macronix zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/partname mx66uw2g345gx0 zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/sfdp > mx66uw2g345gx0 zynq> hexdump mx66uw2g345gx0 000 4653 5044 0108 fd04 0700 1401 0040 ff00 010 0187 1c01 0090 ff00 000a 0801 0100 ff00 020 0005 0501 0120 ff00 0084 0201 0134 ff00 030 040 20e5 ff8a 7fff ff00 ff00 ff00 ff00 050 ffee ff00 ff00 200c d810 060 ff00 ff00 7987 0001 1284 e200 04cc 4667 070 b030 b030 bdf4 5cd5 ff00 1010 2000 080 237c 0048 090 4000 d10f f3ff d10f f3ff 0a0 0500 9000 0500 b100 2b00 9500 2b00 9600 0b0 7172 b803 7172 b803 a390 8218 0c0 c000 9669 7172 9800 0d0 7172 b800 7172 9900 7172 9800 0e0 7172 f800 7172 9900 7172 f900 0f0 1501 d001 7172 d806 5086 100 0106 0002 0301 0200 110 0106 0672 0200 120 ee00 69c0 7272 7171 d800 f6f7 0a00 130 4514 8098 0643 001f dc21 140 zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id c2853b zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer macronix zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/partname mx66lm1g45g zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/sfdp > mx66lm1g45g zynq> hexdump mx66lm1g45g 000 4653 5044 0108 fd04 0700 1401 0040 ff00 010 0187 1c01 0090 ff00 000a 0801 0100 ff00 020 0005 0501 0120 ff00 0084 0201 0134 ff00 030 040 20e5 ff8a 3fff ff00 ff00 ff00 ff00 050 ffee ff00 ff00 200c d810 060 ff00 ff00 6987 0001 1282 e200 02cc 3867 070 b030 b030 bdf4 5cd5 ff00 1010 2000 080 a37c 0048 090 4000 d10f f3ff d10f f3ff 0a0 0500 9000 0500 b100 2b00 9500 2b00 9600 0b0 7172 b803 7172 b803 a390 8218 0c0 c000 9669 7172 9800 0d0 7172 b800 7172 9900 7172 9800 0e0 7172 f800 7172 9900 7172 f900 0f0 1501 d001 7172 d806 5086 100 0106 0002 0301 0200 110 0106 0672 0200 120 ee00 69c0 7272 7171 d800 f6f7 130 3514 001c 0643 000f dc21 140 zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id c2853a zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer macronix zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/partname mx25lm51245g zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/sfdp > mx25lm51245g zynq> hexdump mx25lm51245g 000 4653 5044 0108 fd04 0700 1401 0040 ff00 010 0187 1c01 0090 ff00 000a 0801 0100 ff00 020 0005 0501 0120 ff00 0084 0201 0134 ff00 030 040 20e5 ff8a 1fff ff00 ff00 ff00 ff00 050 ffee ff00 ff00 200c d810 060 ff00 ff00 7989 0001 128d e200 02cc 4467 070 b030 b030 bdf4 5cd5 ff00 1010 2000 080 a37c 0048 090 4000 d10f f3ff d10f f3ff 0a0 0500 9000 0500 b100 2b00 9500 2b00 9600 0b0 7172 b803 7172 b803 a390 8218 0c0 c000 9669 7172 9800 0
[PATCH v9 0/1] Add octal DTR support for Macronix flash
This series add support for Macronix octal DTR flash, add flag for Softreset with "INVERT" command extension type on boot and follow linux kernel to enable 4byte opcode when possible. v9: Follow version 2022-07 and re-send patch of "add support for Macronix Octal flash" v8: Correct spi nor flash information in IDs table. v7: Correct title and description of patchworks. Correct description for spi_nor_macronix_octal_dtr_enable. Add SFDP informations for flashes in commit log. v6: Parcing SCCR 22nd dword for checking Octal DTR mode support v5: Replace SPI_FLASH_MACRONIX_OCTAL with SPI_FLASH_MACRONIX. Remove patch of set_4byte opcode. v4: Add flag SPI_NOR_BOOT_SOFT_RESET_EXT_INVERT to seperate command extension types. Replace ifdef with CONFIG_IS_ENABLED and modify uncorrect descriptions. v3: Add flag SPI_NOR_CMD_EXT_INVERT to seperate command extension types. replace CONFIG_SPI_FLASH_MACRONIX with SPI_FLASH_MACRONIX_OCTAL for spi_nor_macronix_octal_dtr_enable function. v2: add ret checking for write enable in spi_nor_macronix_octal_dtr_enable function. JaimeLiao (1): mtd: spi-nor-core: Add support for Macronix Octal flash drivers/mtd/spi/spi-nor-ids.c | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) -- 2.17.1
Re: [PATCH v7 12/13] mkeficapsule: Add support for setting OEM flags in capsule header
hi Ilias, On Fri, 15 Jul 2022 at 22:11, Ilias Apalodimas wrote: > > Hi Sughosh, > > On Thu, 14 Jul 2022 at 21:40, Sughosh Ganu wrote: > > > > Add support for setting OEM flags in the capsule header. As per the > > UEFI specification, bits 0-15 of the flags member of the capsule > > header can be defined per capsule GUID. > > > > The oemflags will be used for the FWU Multi Bank update feature, as > > specified by the Dependable Boot specification[1]. Bit > > 15 of the flags member will be used to determine if the > > acceptance/rejection of the updated images is to be done by the > > firmware or an external component like the OS. > > Have we documented bit15 in the documentation? If not please add it. Yes, the use of bit15 has been added in the documentation for this feature. I will incorporate all your review comments, and in case I hit any issues while incorporating any review comment, I will respond to that. Thanks for the review. -sughosh > > > > > [1] - > > https://git.codelinaro.org/linaro/dependable-boot/mbfw/uploads/6f7ddfe3be24e18d4319e108a758d02e/mbfw.pdf > > > > Signed-off-by: Sughosh Ganu > > --- > > Changes since V6: None > > > > doc/mkeficapsule.1 | 4 > > tools/mkeficapsule.c | 17 ++--- > > 2 files changed, 18 insertions(+), 3 deletions(-) > > > > diff --git a/doc/mkeficapsule.1 b/doc/mkeficapsule.1 > > index 77ca061efd..6fb2dd0810 100644 > > --- a/doc/mkeficapsule.1 > > +++ b/doc/mkeficapsule.1 > > @@ -72,6 +72,10 @@ Generate a firmware acceptance empty capsule > > .BI "-R\fR,\fB --fw-revert " > > Generate a firmware revert empty capsule > > > > +.TP > > +.BI "-o\fR,\fB --capoemflag " > > +Capsule OEM flag, value between 0x to 0x > > + > > .TP > > .BR -h ", " --help > > Print a help message > > diff --git a/tools/mkeficapsule.c b/tools/mkeficapsule.c > > index 244c80e1f7..237c1218fd 100644 > > --- a/tools/mkeficapsule.c > > +++ b/tools/mkeficapsule.c > > @@ -29,7 +29,7 @@ static const char *tool_name = "mkeficapsule"; > > efi_guid_t efi_guid_fm_capsule = EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID; > > efi_guid_t efi_guid_cert_type_pkcs7 = EFI_CERT_TYPE_PKCS7_GUID; > > > > -static const char *opts_short = "g:i:I:v:p:c:m:dhAR"; > > +static const char *opts_short = "g:i:I:v:p:c:m:o:dhAR"; > > > > enum { > > CAPSULE_NORMAL_BLOB = 0, > > @@ -47,6 +47,7 @@ static struct option options[] = { > > {"dump-sig", no_argument, NULL, 'd'}, > > {"fw-accept", no_argument, NULL, 'A'}, > > {"fw-revert", no_argument, NULL, 'R'}, > > + {"capoemflag", required_argument, NULL, 'o'}, > > {"help", no_argument, NULL, 'h'}, > > {NULL, 0, NULL, 0}, > > }; > > @@ -65,6 +66,7 @@ static void print_usage(void) > > "\t-d, --dump_sig dump signature (*.p7)\n" > > "\t-A, --fw-accept firmware accept capsule, requires GUID, > > no image blob\n" > > "\t-R, --fw-revert firmware revert capsule, takes no GUID, > > no image blob\n" > > + "\t-o, --capoemflag Capsule OEM Flag, an integer between > > 0x and 0x\n" > > "\t-h, --help print a help message\n", > > tool_name); > > } > > @@ -387,6 +389,7 @@ static void free_sig_data(struct auth_context *ctx) > > * @mcount:Monotonic count in authentication information > > * @private_file: Path to a private key file > > * @cert_file: Path to a certificate file > > + * @oemflags: Capsule OEM Flags, bits 0-15 > > * > > * This function actually does the job of creating an uefi capsule file. > > * All the arguments must be supplied. > > @@ -399,7 +402,8 @@ static void free_sig_data(struct auth_context *ctx) > > */ > > static int create_fwbin(char *path, char *bin, efi_guid_t *guid, > > unsigned long index, unsigned long instance, > > - uint64_t mcount, char *privkey_file, char > > *cert_file) > > + uint64_t mcount, char *privkey_file, char > > *cert_file, > > + uint16_t oemflags) > > { > > struct efi_capsule_header header; > > struct efi_firmware_management_capsule_header capsule; > > @@ -464,6 +468,8 @@ static int create_fwbin(char *path, char *bin, > > efi_guid_t *guid, > > header.header_size = sizeof(header); > > /* TODO: The current implementation ignores flags */ > > header.flags = CAPSULE_FLAGS_PERSIST_ACROSS_RESET; > > + if (oemflags) > > + header.flags |= oemflags; > > header.capsule_image_size = sizeof(header) > > + sizeof(capsule) + sizeof(uint64_t) > > + sizeof(image) > > @@ -635,6 +641,7 @@ int main(int argc, char **argv) > > unsigned char uuid_buf[16]; > > unsigned long index, instance; > > uint64_t mcount; > > + uint16_t oemflags; > > char *privkey_file,
Re: [PATCH v7 01/13] dt/bindings: Add bindings for FWU Metadata storage device
On Sun, 17 Jul 2022 at 02:43, Jassi Brar wrote: > > On Thu, 14 Jul 2022 at 13:39, Sughosh Ganu wrote: > > > > Add bindings needed for accessing the FWU metadata partitions. These > > include the compatible string which point to the access method and the > > actual device which stores the FWU metadata. > > > > The current patch adds basic bindings needed for accessing the > > metadata structure on GPT partitioned block devices. > > > > Signed-off-by: Sughosh Ganu > > --- > > Changes since V6: None > > > > .../firmware/fwu-mdata.yaml | 32 +++ > > 1 file changed, 32 insertions(+) > > create mode 100644 doc/device-tree-bindings/firmware/fwu-mdata.yaml > > > > diff --git a/doc/device-tree-bindings/firmware/fwu-mdata.yaml > > b/doc/device-tree-bindings/firmware/fwu-mdata.yaml > > new file mode 100644 > > index 00..97d30bd1c1 > > --- /dev/null > > +++ b/doc/device-tree-bindings/firmware/fwu-mdata.yaml > > > I think we want to call it fwu-mdata-gpt.yaml ? Yes, makes sense. Will rename it. Thanks. -sughosh
[PATCH] bsh: imx6ulz_smm_m2: Add imx6ulz BSH SMM M2 boards
Introduce BSH SystemMaster (SMM) M2 board family, which consists of: imx6ulz SMM M2 and imx6ulz SMM M2 PRO boards. Add support for imx6ulz BSH SMM M2 board: - 128 MiB DDR3 RAM - 256MiB Nand - USBOTG1 peripheral - fastboot. Signed-off-by: Michael Trimarchi --- Changes V1->V2: - Adjust board due to the migrate CUSTOM_SYS_INIT_SP_ADDR to Kconfig using system-constants.h - Drop reference to freescale board in imx6ulz_smm_m2 include file --- arch/arm/dts/Makefile | 1 + arch/arm/dts/imx6ulz-bsh-smm-m2-u-boot.dtsi | 35 + arch/arm/dts/imx6ulz-bsh-smm-m2.dts | 146 arch/arm/mach-imx/mx6/Kconfig | 12 ++ board/bsh/imx6ulz_smm_m2/Kconfig| 12 ++ board/bsh/imx6ulz_smm_m2/MAINTAINERS| 6 + board/bsh/imx6ulz_smm_m2/Makefile | 6 + board/bsh/imx6ulz_smm_m2/imx6ulz_smm_m2.c | 53 +++ board/bsh/imx6ulz_smm_m2/spl.c | 130 + configs/imx6ulz_smm_m2_defconfig| 75 ++ include/configs/imx6ulz_smm_m2.h| 82 +++ 11 files changed, 558 insertions(+) create mode 100644 arch/arm/dts/imx6ulz-bsh-smm-m2-u-boot.dtsi create mode 100644 arch/arm/dts/imx6ulz-bsh-smm-m2.dts create mode 100644 board/bsh/imx6ulz_smm_m2/Kconfig create mode 100644 board/bsh/imx6ulz_smm_m2/MAINTAINERS create mode 100644 board/bsh/imx6ulz_smm_m2/Makefile create mode 100644 board/bsh/imx6ulz_smm_m2/imx6ulz_smm_m2.c create mode 100644 board/bsh/imx6ulz_smm_m2/spl.c create mode 100644 configs/imx6ulz_smm_m2_defconfig create mode 100644 include/configs/imx6ulz_smm_m2.h diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 8f7ecfd0f6..4010ee435a 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -887,6 +887,7 @@ dtb-$(CONFIG_MX6ULL) += \ imx6ull-phytec-segin-ff-rdk-emmc.dtb \ imx6ull-dart-6ul.dtb \ imx6ull-somlabs-visionsom.dtb \ + imx6ulz-bsh-smm-m2.dtb \ imx6ulz-14x14-evk.dtb dtb-$(CONFIG_ARCH_MX6) += \ diff --git a/arch/arm/dts/imx6ulz-bsh-smm-m2-u-boot.dtsi b/arch/arm/dts/imx6ulz-bsh-smm-m2-u-boot.dtsi new file mode 100644 index 00..75dbf6ed78 --- /dev/null +++ b/arch/arm/dts/imx6ulz-bsh-smm-m2-u-boot.dtsi @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2022 BSH Hausgeraete GmbH + * + * Author: Michael Trimarchi + */ + +&{/soc} { + u-boot,dm-pre-reloc; +}; + +&aips2 { + u-boot,dm-pre-reloc; +}; + +&iomuxc { + u-boot,dm-pre-reloc; +}; + +&iomuxc_snvs { + u-boot,dm-pre-reloc; +}; + +&uart4 { + u-boot,dm-pre-reloc; +}; + +&pinctrl_uart4 { + u-boot,dm-pre-reloc; +}; + +&gpmi { + u-boot,dm-spl; + u-boot,dm-pre-reloc; +}; diff --git a/arch/arm/dts/imx6ulz-bsh-smm-m2.dts b/arch/arm/dts/imx6ulz-bsh-smm-m2.dts new file mode 100644 index 00..59bcfc9a6b --- /dev/null +++ b/arch/arm/dts/imx6ulz-bsh-smm-m2.dts @@ -0,0 +1,146 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2021 BSH Hausgeraete GmbH + */ + +/dts-v1/; + +#include +#include "imx6ulz.dtsi" + +/ { + model = "BSH SMM M2"; + compatible = "bsh,imx6ulz-bsh-smm-m2", "fsl,imx6ull", "fsl,imx6ulz"; + + chosen { + stdout-path = &uart4; + }; + + usdhc2_pwrseq: usdhc2-pwrseq { + compatible = "mmc-pwrseq-simple"; + reset-gpios = <&gpio2 21 GPIO_ACTIVE_LOW>; + }; +}; + +&gpmi { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_gpmi_nand>; + nand-on-flash-bbt; + status = "okay"; +}; + +&uart3 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_uart3>; + uart-has-rtscts; + status = "okay"; + + bluetooth { + compatible = "brcm,bcm4330-bt"; + max-speed = <300>; + shutdown-gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>; + device-wakeup-gpios = <&gpio2 17 GPIO_ACTIVE_HIGH>; + host-wakeup-gpios = <&gpio2 13 GPIO_ACTIVE_HIGH>; + }; +}; + +&uart4 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_uart4>; + status = "okay"; +}; + +&usbotg1 { + dr_mode = "peripheral"; + srp-disable; + hnp-disable; + adp-disable; + status = "okay"; +}; + +&usbphy1 { + fsl,tx-d-cal = <106>; +}; + +&usdhc2 { + #address-cells = <1>; + #size-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_wlan>; + bus-width = <4>; + no-1-8-v; + non-removable; + cap-power-off-card; + keep-power-in-suspend; + cap-sdio-irq; + mmc-pwrseq = <&usdhc2_pwrseq>; + status = "okay"; + + brcmf: wifi@1 { + reg = <1>; + compatible = "brcm,bcm4329-fmac"; + interrupt-parent = <&gpio1>; + interrupts = <18 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "host-wa
[PATCH v2 1/1] gitdm: fix typo csets
The output should be human readable. %s/csets/changesets/ Signed-off-by: Heinrich Schuchardt --- v2: avoid typo in test --- gitdm | 2 +- tests/expected-results.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gitdm b/gitdm index 61318ad..aea16b0 100755 --- a/gitdm +++ b/gitdm @@ -546,7 +546,7 @@ for h in hlist: for e in elist: if e.count > 0: nempl += 1 -reports.Write('Processed %d csets from %d developers\n' % (CSCount, +reports.Write('Processed %d changesets from %d developers\n' % (CSCount, ndev)) reports.Write('%d employers found\n' % (nempl)) reports.Write('A total of %d lines added, %d removed (delta %d)\n' % diff --git a/tests/expected-results.txt b/tests/expected-results.txt index 049f887..03985f3 100644 --- a/tests/expected-results.txt +++ b/tests/expected-results.txt @@ -1,4 +1,4 @@ -Processed 10 csets from 4 developers +Processed 10 changesets from 4 developers 4 employers found A total of 24 lines added, 24 removed (delta 0) -- 2.36.1
[PATCH v2 1/1] gitdm: fix typo csets
The output should be human readable. %s/csets/changesets/ Signed-off-by: Heinrich Schuchardt --- v2: avoid typo in test --- gitdm | 2 +- tests/expected-results.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gitdm b/gitdm index 61318ad..aea16b0 100755 --- a/gitdm +++ b/gitdm @@ -546,7 +546,7 @@ for h in hlist: for e in elist: if e.count > 0: nempl += 1 -reports.Write('Processed %d csets from %d developers\n' % (CSCount, +reports.Write('Processed %d changesets from %d developers\n' % (CSCount, ndev)) reports.Write('%d employers found\n' % (nempl)) reports.Write('A total of %d lines added, %d removed (delta %d)\n' % diff --git a/tests/expected-results.txt b/tests/expected-results.txt index 049f887..03985f3 100644 --- a/tests/expected-results.txt +++ b/tests/expected-results.txt @@ -1,4 +1,4 @@ -Processed 10 csets from 4 developers +Processed 10 changesets from 4 developers 4 employers found A total of 24 lines added, 24 removed (delta 0) -- 2.36.1
[PATCH 1/1] gitdm: fix typo csets
The output should be human readable. %s/csets/changesets/ Signed-off-by: Heinrich Schuchardt --- gitdm | 2 +- tests/expected-results.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gitdm b/gitdm index 61318ad..aea16b0 100755 --- a/gitdm +++ b/gitdm @@ -546,7 +546,7 @@ for h in hlist: for e in elist: if e.count > 0: nempl += 1 -reports.Write('Processed %d csets from %d developers\n' % (CSCount, +reports.Write('Processed %d changesets from %d developers\n' % (CSCount, ndev)) reports.Write('%d employers found\n' % (nempl)) reports.Write('A total of %d lines added, %d removed (delta %d)\n' % diff --git a/tests/expected-results.txt b/tests/expected-results.txt index 049f887..03985f3 100644 --- a/tests/expected-results.txt +++ b/tests/expected-results.txt @@ -1,4 +1,4 @@ -Processed 10 csets from 4 developers +Processed 10 changesets sets from 4 developers 4 employers found A total of 24 lines added, 24 removed (delta 0) -- 2.36.1
[PATCH 1/1] gitdm: fix typo csets
The output should be human readable. %s/csets/changesets/ Signed-off-by: Heinrich Schuchardt --- gitdm | 2 +- tests/expected-results.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gitdm b/gitdm index 61318ad..aea16b0 100755 --- a/gitdm +++ b/gitdm @@ -546,7 +546,7 @@ for h in hlist: for e in elist: if e.count > 0: nempl += 1 -reports.Write('Processed %d csets from %d developers\n' % (CSCount, +reports.Write('Processed %d changesets from %d developers\n' % (CSCount, ndev)) reports.Write('%d employers found\n' % (nempl)) reports.Write('A total of %d lines added, %d removed (delta %d)\n' % diff --git a/tests/expected-results.txt b/tests/expected-results.txt index 049f887..03985f3 100644 --- a/tests/expected-results.txt +++ b/tests/expected-results.txt @@ -1,4 +1,4 @@ -Processed 10 csets from 4 developers +Processed 10 changesets sets from 4 developers 4 employers found A total of 24 lines added, 24 removed (delta 0) -- 2.36.1
Re: [EXT] [PATCH] doc: imx: habv4: Add Secure Boot guide for i.MX8M SPL targets
On 7/13/22 00:57, Utkarsh Gupta wrote: Hi Marek, The Secure/Encrypted boot guides for 8M exist in NXP BSP at https://source.codeaurora.org/external/imx/uboot-imx/tree/doc/imx?h=lf_v2022 .04. Looks like they need to be up streamed. @Peng Fan/@Ye Li - FYI Regards, Utkarsh G. -Original Message- From: Marek Vasut Sent: Tuesday, July 12, 2022 10:05 AM To: u-boot@lists.denx.de Cc: Marek Vasut ; Breno Matheus Lima ; Fabio Estevam ; Heiko Schocher ; Peng Fan ; Stefano Babic ; Utkarsh Gupta ; Ye Li Subject: [EXT] [PATCH] doc: imx: habv4: Add Secure Boot guide for i.MX8M SPL targets Caution: EXT Email Add HABv4 documentation extension for SPL targets covering the following topics: - How to sign an securely boot an flash.bin container image. - How to extend the root of trust for additional boot images. - Add SPL and fitImage CSF examples. - Add signature generation script example. Signed-off-by: Marek Vasut Cc: Breno Lima Cc: Fabio Estevam Cc: Heiko Schocher Cc: Peng Fan Cc: Stefano Babic Cc: Utkarsh Gupta Cc: Ye Li --- doc/imx/habv4/csf_examples/mx8m/csf.sh| 77 + doc/imx/habv4/csf_examples/mx8m/csf_fit.txt | 36 +++ doc/imx/habv4/csf_examples/mx8m/csf_spl.txt | 33 +++ doc/imx/habv4/guides/mx8m_spl_secure_boot.txt | 265 ++ 4 files changed, 411 insertions(+) create mode 100644 doc/imx/habv4/csf_examples/mx8m/csf.sh create mode 100644 doc/imx/habv4/csf_examples/mx8m/csf_fit.txt create mode 100644 doc/imx/habv4/csf_examples/mx8m/csf_spl.txt create mode 100644 doc/imx/habv4/guides/mx8m_spl_secure_boot.txt diff --git a/doc/imx/habv4/csf_examples/mx8m/csf.sh b/doc/imx/habv4/csf_examples/mx8m/csf.sh new file mode 100644 index 000..6898513be51 --- /dev/null +++ b/doc/imx/habv4/csf_examples/mx8m/csf.sh @@ -0,0 +1,77 @@ +#!/bin/sh + +# 0) Generate keys +# +# WARNING: ECDSA keys are only supported by HAB 4.5 and newer (i.e. +i.MX8M Plus) # # cd /path/to/cst-3.3.1/keys/ +#./hab4_pki_tree.sh -existing-ca n -use-ecc n -kl 4096 -duration 10 -num-srk 4 -srk-ca y +# cd /path/to/cst-3.3.1/crts/ +# ../linux64/bin/srktool -h 4 -t SRK_1_2_3_4_table.bin -e SRK_1_2_3_4_fuse.bin -d sha256 - c ./SRK1_sha256_4096_65537_v3_ca_crt.pem,./SRK2_sha256_4096_65537_v3_ ca_crt.pem,./SRK3_sha256_4096_65537_v3_ca_crt.pem,./SRK4_sha256_4096_ 65537_v3_ca_crt.pem -f 1 + +# 1) Build U-Boot (e.g. for i.MX8MM) +# +# export ATF_LOAD_ADDR=0x92 +# cp -Lv /path/to/arm-trusted-firmware/build/imx8mm/release/bl31.bin . +# cp -Lv /path/to/firmware-imx-8.14/firmware/ddr/synopsys/ddr3* . +# make -j imx8mm_board_defconfig +# make -j`nproc` flash.bin + +# 2) Sign SPL and DRAM blobs + +cp doc/imx/habv4/csf_examples/mx8m/csf_spl.txt csf_spl.tmp cp +doc/imx/habv4/csf_examples/mx8m/csf_fit.txt csf_fit.tmp + +spl_block_base=$(printf "0x%x" $(( $(sed -n "/CONFIG_SPL_TEXT_BASE=/ +s@.*=@@p" .config) - 0x40)) ) spl_block_size=$(printf "0x%x" $(stat -tc +%s u-boot-spl-ddr.bin)) sed -i "/Blocks = / s@.*@ Blocks = +$spl_block_base 0x0 $spl_block_size \"flash.bin\"@" csf_spl.tmp + +# Generate CSF blob +cst -i csf_spl.tmp -o csf_spl.bin + +# Patch CSF blob into flash.bin +spl_csf_offset=$(xxd -s 24 -l 4 -e flash.bin | cut -d " " -f 2 | sed +"s@^@0x@") spl_bin_offset=$(xxd -s 4 -l 4 -e flash.bin | cut -d " " -f +2 | sed "s@^@0x@") spl_dd_offset=$((${spl_csf_offset} - +${spl_bin_offset} + 0x40)) dd if=csf_spl.bin of=flash.bin bs=1 +seek=${spl_dd_offset} conv=notrunc + +# 3) Sign u-boot.itb + +# fitImage tree +fit_block_base=$(printf "0x%x" $(( $(sed -n "/CONFIG_SYS_TEXT_BASE=/ +s@.*=@@p" .config) - $(sed -n "/CONFIG_FIT_EXTERNAL_OFFSET=/ s@.*=@@p" +.config) - 0x200 - 0x40)) ) fit_block_offset=$(printf "0x%s" $(fdtget +-t x u-boot.dtb /binman/imx-boot/uboot offset)) fit_block_size=$(printf +"0x%x" $(( ( $(fdtdump u-boot.itb 2>/dev/null | sed -n +"/^...totalsize:/ s@.*\(0x[0-9a-f]\+\).*@\1@p") + 0x1000 - 0x1 ) & +~(0x1000 - 0x1) + 0x20 )) ) sed -i "/Blocks = / s@.*@ Blocks = +$fit_block_base $fit_block_offset $fit_block_size \"flash.bin\", @" +csf_fit.tmp + +# U-Boot +uboot_block_base=$(printf "0x%s" $(fdtget -t x u-boot.itb /images/uboot +load)) uboot_block_offset=$(printf "0x%x" $(( $(printf "0x%s" $(fdtget +-t x u-boot.itb /images/uboot data-position)) + ${fit_block_offset} ))) uboot_block_size=$(printf "0x%s" $(fdtget -t x u-boot.itb /images/uboot data- size)) +sed -i "/0x/ s@.*@ $uboot_block_base $uboot_block_offset $uboot_block_size \"flash.bin\", @" csf_fit.tmp + +# ATF +atf_block_base=$(printf "0x%s" $(fdtget -t x u-boot.itb /images/atf +load)) atf_block_offset=$(printf "0x%x" $(( $(printf "0x%s" $(fdtget -t +x u-boot.itb /images/atf data-position)) + ${fit_block_offset} ))) atf_block_size=$(printf "0x%s" $(fdtget -t x u-boot.itb /images/atf data-size)) +sed -i "/0x/ s@.*@ $atf_block_base $atf_block_offset $atf_block_size \"flash.bin\", @" csf_fit.tmp + +# DTB +dtb_block_base=$(printf "0x%x" $(( ${uboot_block_base} + +${uboot_block_si
Re: DWC3 host support
On 7/17/22 05:00, Angus Ainslie wrote: On 2022-07-16 11:37, Marek Vasut wrote: On 7/16/22 15:02, Angus Ainslie wrote: Hi Michal, I recently rebased my librem5 tree onto the latest u-boot-imx branch and the dwc3 host mode stopped working. I bisected it down to this commit: 142d50fbce7c364a74f5e8204dba491b9f066e6c usb: dwc3: Add support for usb3-phy PHY configuration Reverting that commit allows usb host mode to work on the librem5 again. Should this initialization go into an SOC specific glue_configure function ? Is the imx8mq.dtsi missing something that will keep usb host working with this patch ? Does this break usb host on other imx8mq devices ? Wasn't this fixed by: 868d58f69c ("usb: dwc3: Fix non-usb3 configurations") ? I've got that in my tree and it still fails to probe the USB2 hub and USB 2 storage. I assume you do have CONFIG_PHY_IMX8MQ_USB enabled ? What does generic_phy_get_by_name() return for you in drivers/usb/dwc3/dwc3-generic.c ?
Re: [PATCH] spl: Move check for SPL_LIBCOMMON support to header
On 7/16/22 7:00 AM, Simon Glass wrote: Hi Andrew, On Fri, 15 Jul 2022 at 09:35, Andrew Davis wrote: From: "Andrew F. Davis" Print statements in SPL depend on lib/common support, due to this many such print statements are ifdef'd. Instead of checking at each call site move the check to the common.h header and remove these inline checks. nit: stdio.h I think? Ah yes, looks like this header got renamed since I wrote this patch. Will fix if v2 is needed. Thanks, Andrew Signed-off-by: Andrew F. Davis Reviewed-by: Simon Glass --- boot/common_fit.c| 2 -- common/spl/spl.c | 4 +--- common/spl/spl_ext.c | 8 common/spl/spl_fat.c | 6 -- common/spl/spl_mmc.c | 18 -- common/spl/spl_usb.c | 2 -- drivers/mmc/mmc-uclass.c | 2 -- drivers/mmc/mmc.c| 12 drivers/mmc/mmc_legacy.c | 2 -- include/stdio.h | 5 ++--- 10 files changed, 3 insertions(+), 58 deletions(-) Regards, Simon
Re: [PATCH 5/6] mtd: nand: sunxi: Convert to the driver model
Hi On Thu, Jul 14, 2022 at 5:15 AM Samuel Holland wrote: > > Clocks, resets, and pinmuxes are now handled by the driver model, so the > only thing the "board" code needs to do is load the driver. This matches > the pattern used by other DM raw NAND drivers (there is no NAND uclass). > > The actual board code is now only needed in SPL. > > Signed-off-by: Samuel Holland > --- > > board/sunxi/board.c | 5 +- > drivers/mtd/nand/raw/sunxi_nand.c | 81 ++- > 2 files changed, 49 insertions(+), 37 deletions(-) > > diff --git a/board/sunxi/board.c b/board/sunxi/board.c > index 21a2407e062f..ea0f33ed31db 100644 > --- a/board/sunxi/board.c > +++ b/board/sunxi/board.c > @@ -315,7 +315,7 @@ int dram_init(void) > return 0; > } > > -#if defined(CONFIG_NAND_SUNXI) > +#if defined(CONFIG_NAND_SUNXI) && defined(CONFIG_SPL_BUILD) > static void nand_pinmux_setup(void) > { > unsigned int pin; > @@ -351,9 +351,6 @@ void board_nand_init(void) > { > nand_pinmux_setup(); > nand_clock_setup(); > -#ifndef CONFIG_SPL_BUILD > - sunxi_nand_init(); > -#endif > } > #endif > > diff --git a/drivers/mtd/nand/raw/sunxi_nand.c > b/drivers/mtd/nand/raw/sunxi_nand.c > index 7185efbebfdd..dda51a39b065 100644 > --- a/drivers/mtd/nand/raw/sunxi_nand.c > +++ b/drivers/mtd/nand/raw/sunxi_nand.c > @@ -24,11 +24,13 @@ > * GNU General Public License for more details. > */ > > +#include > #include > #include > #include > #include > #include > +#include > #include > #include > #include > @@ -260,7 +262,7 @@ static inline struct sunxi_nand_chip > *to_sunxi_nand(struct nand_chip *nand) > * NAND Controller structure: stores sunxi NAND controller information > * > * @controller:base controller structure > - * @dev: parent device (used to print error messages) > + * @dev: DM device (used to print error messages) > * @regs: NAND controller registers > * @ahb_clk: NAND Controller AHB clock > * @mod_clk: NAND Controller mod clock > @@ -273,7 +275,7 @@ static inline struct sunxi_nand_chip > *to_sunxi_nand(struct nand_chip *nand) > */ > struct sunxi_nfc { > struct nand_hw_control controller; > - struct device *dev; > + struct udevice *dev; > void __iomem *regs; > struct clk *ahb_clk; > struct clk *mod_clk; > @@ -1772,54 +1774,67 @@ static void sunxi_nand_chips_cleanup(struct sunxi_nfc > *nfc) > } > #endif /* __UBOOT__ */ > > -void sunxi_nand_init(void) > +static int sunxi_nand_probe(struct udevice *dev) > { > - struct sunxi_nfc *nfc; > - phys_addr_t regs; > - ofnode node; > + struct sunxi_nfc *nfc = dev_get_priv(dev); > + struct reset_ctl_bulk rst_bulk; > + struct clk_bulk clk_bulk; > int ret; > > - nfc = kzalloc(sizeof(*nfc), GFP_KERNEL); > - if (!nfc) > - return; > - > + nfc->dev = dev; > spin_lock_init(&nfc->controller.lock); > init_waitqueue_head(&nfc->controller.wq); > INIT_LIST_HEAD(&nfc->chips); > > - node = ofnode_by_compatible(ofnode_null(), > "allwinner,sun4i-a10-nand"); > - if (!ofnode_valid(node)) { > - pr_err("unable to find nfc node in device tree\n"); > - goto err; > - } > - > - if (!ofnode_is_enabled(node)) { > - pr_err("nfc disabled in device tree\n"); > - goto err; > - } > + nfc->regs = dev_read_addr_ptr(dev); > + if (!nfc->regs) > + return -EINVAL; > > - regs = ofnode_get_addr(node); > - if (regs == FDT_ADDR_T_NONE) { > - pr_err("unable to find nfc address in device tree\n"); > - goto err; > - } > + ret = reset_get_bulk(dev, &rst_bulk); > + if (!ret) > + reset_deassert_bulk(&rst_bulk); > > - nfc->regs = (void *)regs; > + ret = clk_get_bulk(dev, &clk_bulk); > + if (!ret) > + clk_enable_bulk(&clk_bulk); > > ret = sunxi_nfc_rst(nfc); > if (ret) > - goto err; > + return ret; > > - ret = sunxi_nand_chips_init(node, nfc); > + ret = sunxi_nand_chips_init(dev_ofnode(dev), nfc); > if (ret) { > - dev_err(nfc->dev, "failed to init nand chips\n"); > - goto err; > + dev_err(dev, "failed to init nand chips\n"); > + return ret; > } > > - return; > + return 0; > +} > > -err: > - kfree(nfc); > +static const struct udevice_id sunxi_nand_ids[] = { > + { > + .compatible = "allwinner,sun4i-a10-nand", > + }, > + { } > +}; > + > +U_BOOT_DRIVER(sunxi_nand) = { > + .name = "sunxi_nand", > + .id = UCLASS_MTD, > + .of_match = sunxi_nand_ids, > + .probe = sunxi_nand_probe, > +
Re: [PATCH 3/6] mtd: nand: sunxi: Remove an unnecessary check
Hi On Thu, Jul 14, 2022 at 5:15 AM Samuel Holland wrote: > > Each chip is required to have a unique CS number ("reg" property) in the > range 0-7, so there is no need to separately count the number of chips. > > Signed-off-by: Samuel Holland > --- > > drivers/mtd/nand/raw/sunxi_nand.c | 10 -- > 1 file changed, 10 deletions(-) > > diff --git a/drivers/mtd/nand/raw/sunxi_nand.c > b/drivers/mtd/nand/raw/sunxi_nand.c > index c378f08f6805..0f10edfdb208 100644 > --- a/drivers/mtd/nand/raw/sunxi_nand.c > +++ b/drivers/mtd/nand/raw/sunxi_nand.c > @@ -1766,16 +1766,6 @@ static int sunxi_nand_chips_init(int node, struct > sunxi_nfc *nfc) > int nand_node; > int ret, i = 0; > > - for (nand_node = fdt_first_subnode(blob, node); nand_node >= 0; > -nand_node = fdt_next_subnode(blob, nand_node)) > - i++; > - > - if (i > 8) { > - dev_err(nfc->dev, "too many NAND chips: %d (max = 8)\n", i); > - return -EINVAL; > - } > - > - i = 0; > for (nand_node = fdt_first_subnode(blob, node); nand_node >= 0; > nand_node = fdt_next_subnode(blob, nand_node)) { > ret = sunxi_nand_chip_init(nand_node, nfc, i++); > -- > 2.35.1 > Reviewed-by: Michael Trimarchi -- Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 mich...@amarulasolutions.com __ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 i...@amarulasolutions.com www.amarulasolutions.com
Re: [RESEND v9 1/9] efi_loader: move udevice pointer into struct efi_object
On 7/17/22 10:09, Heinrich Schuchardt wrote: On 7/15/22 16:47, Masahisa Kojima wrote: This is a preparation patch to provide the unified method to access udevice pointer associated with the block io device. The EFI handles of both EFI block io driver implemented in lib/efi_loader/efi_disk.c and EFI block io driver implemented as EFI payload can posess the udevice pointer in the struct efi_object. We can use this udevice pointer to get the U-Boot friendly block device name(e.g. mmc 0:1, nvme 0:1) through efi_handle_t. Signed-off-by: Masahisa Kojima --- Newly created in v9 include/efi_loader.h | 8 lib/efi_loader/efi_disk.c | 20 +--- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index 3a63a1f75f..bba5ffd482 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -226,6 +226,12 @@ const char *__efi_nesting_dec(void); #define EFI_CACHELINE_SIZE 128 #endif +/** + * efi_handle_to_udev - accessor to the DM device associated to the EFI handle + * @handle: pointer to the EFI handle + */ +#define efi_handle_to_udev(handle) (((struct efi_object *)handle)->dev) This conversion will hide errors if handle is not of type efi_handle_t. We should avoid the conversion and see build time errors instead. Please, remove the macro. For every handle of type efi_handle_t you can access the field handle->dev directly. For struct efi_disk_obj we can use disk->header.dev. + /* Key identifying current memory map */ extern efi_uintn_t efi_memory_map_key; @@ -375,6 +381,7 @@ enum efi_object_type { * @protocols: linked list with the protocol interfaces installed on this * handle * @type: image type if the handle relates to an image + * @dev: pointer to the DM device which is associated with this EFI handle * * UEFI offers a flexible and expandable object model. The objects in the UEFI * API are devices, drivers, and loaded images. struct efi_object is our storage @@ -392,6 +399,7 @@ struct efi_object { /* The list of protocols */ struct list_head protocols; enum efi_object_type type; + struct udevice *dev; }; enum efi_image_auth_status { diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index 1d700b2a6b..a8e8521e3e 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -46,7 +46,6 @@ struct efi_disk_obj { struct efi_device_path *dp; unsigned int part; struct efi_simple_file_system_protocol *volume; - struct udevice *dev; /* TODO: move it to efi_object */ ok }; /** @@ -124,16 +123,16 @@ static efi_status_t efi_disk_rw_blocks(struct efi_block_io *this, return EFI_BAD_BUFFER_SIZE; if (CONFIG_IS_ENABLED(PARTITIONS) && - device_get_uclass_id(diskobj->dev) == UCLASS_PARTITION) { + device_get_uclass_id(efi_handle_to_udev(diskobj)) == UCLASS_PARTITION) { device_get_uclass_id(diskobj->header.hdev)) == UCLASS_PARTITION) { if (direction == EFI_DISK_READ) - n = dev_read(diskobj->dev, lba, blocks, buffer); + n = dev_read(efi_handle_to_udev(diskobj), lba, blocks, buffer); dev_read(diskobj->header.hdev) else - n = dev_write(diskobj->dev, lba, blocks, buffer); + n = dev_write(efi_handle_to_udev(diskobj), lba, blocks, buffer); dev_write(diskobj->header.hdev) } else { /* dev is a block device (UCLASS_BLK) */ struct blk_desc *desc; - desc = dev_get_uclass_plat(diskobj->dev); + desc = dev_get_uclass_plat(efi_handle_to_udev(diskobj)); dev_get_uclass(diskobj->header.hdev) if (direction == EFI_DISK_READ) n = blk_dread(desc, lba, blocks, buffer); else @@ -552,7 +551,7 @@ static int efi_disk_create_raw(struct udevice *dev) return -1; } - disk->dev = dev; + efi_handle_to_udev(disk) = dev; if (dev_tag_set_ptr(dev, DM_TAG_EFI, &disk->header)) { efi_free_pool(disk->dp); efi_delete_handle(&disk->header); @@ -609,7 +608,7 @@ static int efi_disk_create_part(struct udevice *dev) log_err("Adding partition for %s failed\n", dev->name); return -1; } - disk->dev = dev; + efi_handle_to_udev(disk) = dev; disk->header.dev = dev; if (dev_tag_set_ptr(dev, DM_TAG_EFI, &disk->header)) { efi_free_pool(disk->dp); efi_delete_handle(&disk->header); @@ -656,6 +655,13 @@ static int efi_disk_probe(void *ctx, struct event *event) ret = efi_disk_create_raw(dev); if (ret) return -1; + } else { + efi_handle_t handle; + + if (dev_tag_get_ptr(dev, DM_TAG_EFI, (void **)&handle)) Setting handle->dev can be done more easily in efi_bl_bind(): handle->dev = bdev; We can further remove the field handle from struct blk_create_device as it is now available in handle->dev. Best regards Heinrich +
Re: [PATCH v3 3/5] patman: Make most bool arguments BooleanOptionalAction
Hi Doug, On Sat, 16 Jul 2022 at 11:47, Doug Anderson wrote: > > Hi, > > On Sat, Jul 16, 2022 at 4:55 AM Simon Glass wrote: > > > > Hi Doug, > > > > On Thu, 7 Jul 2022 at 09:26, Douglas Anderson wrote: > > > > > > For boolean arguments it's convenient to be able to specify both the > > > argument and its opposite on the command line. This is especially > > > convenient because you can change the default via the settings file > > > and being able express the opposite can be the only way to override > > > things. > > > > > > Luckily python handles this well--we just need to specify things with > > > BooleanOptionalAction. We'll do that for all options except > > > "full-help" (where it feels silly). This uglifies the help text a > > > little bit but does give maximum flexibility. > > > > > > Signed-off-by: Douglas Anderson > > > Tested-by: Brian Norris > > > Reviewed-by: Brian Norris > > > Reviewed-by: Simon Glass > > > --- > > > > > > (no changes since v2) > > > > > > Changes in v2: > > > - Fix doc string for --ignore-bad-tags > > > > > > tools/patman/main.py | 55 ++-- > > > 1 file changed, 28 insertions(+), 27 deletions(-) > > > > Sadly this patch triggers an error: > > > > Traceback (most recent call last): > > File "./tools/patman/patman", line 9, in > > from argparse import ArgumentParser, BooleanOptionalAction > > ImportError: cannot import name 'BooleanOptionalAction' from > > 'argparse' (/usr/lib/python3.8/argparse.py) > > > > > > I've dropped it and the next one. Can you please take a look? > > Ugh. I hadn't noticed that it was added in python 3.9. I guess we > don't want to require python 3.9+? Python 3.9 was released October > 2020... Not yet! It might be possible to do a little compatibility thing. We do sometimes have code that does things the old way and the new way. But it might be too intrusive in this case? Regards, Simon
Re: [PATCH 2/3] cmd: fdt: allow standalone "fdt move"
On Tue, 5 Jul 2022 at 11:14, Andre Przywara wrote: > > At the moment every subcommand of "fdt", except "addr" itself, requires > the DT address to be set first. We explicitly check for that before even > comparing against the subcommands' string. > This early bailout also affects the "move" subcommand, even though that > does not require or rely on a previous call to "fdt addr". In fact it > even sets the FDT address to the target of the move command, so is a > perfect beginning for a sequence of fdt commands. > > Move the check for a previously set FDT address to after we handle the > "move" command also, so we don't need a dummy call to "fdt addr" first, > before being able to move the devicetree. > > This skips one pointless "fdt addr" call in scripts which aim to alter > the control DT, but need to copy it to a safe location first (for > instance to $fdt_addr_r). > > Signed-off-by: Andre Przywara > --- > cmd/fdt.c | 28 +--- > 1 file changed, 17 insertions(+), 11 deletions(-) Reviewed-by: Simon Glass Applied to u-boot-dm, thanks!
Re: [PATCH 1/3] cmd: fdt: move: Use map_sysmem to convert pointers
On Tue, 5 Jul 2022 at 11:14, Andre Przywara wrote: > > The "fdt move" subcommand was using the provided DTB addresses directly, > without trying to "map" them into U-Boot's address space. This happened > to work since on the vast majority of "real" platforms there is a simple > 1:1 mapping of VA to PAs, so either value works fine. > > However this is not true on the sandbox, so the "fdt move" command fails > there miserably: > => fdt addr $fdtcontroladdr > => cp.l $fdtcontroladdr $fdt_addr_r 40 # simple memcpy works > => fdt move $fdtcontroladdr $fdt_addr_r > Segmentation fault > > Use the proper "map_sysmem" call to convert PAs to VAs, to make this > more robust in general and to enable operation in the sandbox. > > Signed-off-by: Andre Przywara > --- > cmd/fdt.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) Reviewed-by: Simon Glass Applied to u-boot-dm, thanks!
Re: [PATCH v3 2/5] patman: Don't look at sys.argv when parsing settings
If you call the parser and tell it to parse but don't pass arguments in then it will default to looking at sys.argv. This isn't really what was intended and seems to have some side effects. Let's not do it. NOTE: to see some of the side effects, note that this patch breaks "patman -c1" if you don't have the patch ("patman: Fix implicit command inserting") before it. Signed-off-by: Douglas Anderson Tested-by: Brian Norris Reviewed-by: Brian Norris Reviewed-by: Simon Glass --- Changes in v3: - Rebased atop ("patman: Fix defaults not propagating to subparsers") tools/patman/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Applied to u-boot-dm, thanks!
Re: [PATCH v3 1/5] patman: Fix implicit command inserting
The logic to insert an implicit command has always been a bit broken but it was masked by another bug fixed in the patch ("patman: Don't look at sys.argv when parsing settings"). Specifically, imagine that you're just calling patman like this: patman -c1 After the parse_known_args() command then the "-c1" will have been parsed and we'll have no command. The "rest" variable will be an empty list. Going into the logic you can see that nargs = 0. The implicit insertion of send ideally would create an argument list of: ['-c1', 'send'] ...but it doesn't because argv[:-0] is the same as argv[:0] and that's an empty list. Let's fix this little glitch. Signed-off-by: Douglas Anderson Tested-by: Brian Norris Reviewed-by: Brian Norris Reviewed-by: Simon Glass --- (no changes since v1) tools/patman/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Applied to u-boot-dm, thanks!
Re: [PATCH v3 5/5] patman: Take project defaults into account for --help
I'd like it so that when you do "patman send --help" and you're using Linux that it show it the proper defaults for Linux. Signed-off-by: Douglas Anderson Tested-by: Brian Norris Reviewed-by: Simon Glass --- (no changes since v2) Changes in v2: - Make comment about parsing three times less nonsensical. tools/patman/main.py | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) Applied to u-boot-dm, thanks!
Re: [PATCH] cmd: fdt: Add support for reading stringlist property values
Hi Marek, On Wed, 13 Jul 2022 at 09:30, Marek Vasut wrote: > > On 7/13/22 17:28, Simon Glass wrote: > > Hi Marek, > > > > On Tue, 12 Jul 2022 at 05:47, Marek Vasut wrote: > >> > >> On 7/12/22 12:58, Simon Glass wrote: > >>> Hi Marek, > >>> > >>> On Fri, 8 Jul 2022 at 15:50, Marek Vasut wrote: > > The fdt command currently handles stringlists as strings in 'fdt get > value' > subcommand. Since strings in FDT stringlists are separated by '\0', only > the first value gets inserted into the environment variable passed to the > 'fdt get value' command. > > Example, consider the following DT snippet: > > / { compatible = "foo", "bar" }; > > The following command only reports the first string in stringlist: > => fdt get value var / compatible ; print var > foo > > It is not possible to assign list of null-terminated strings into U-Boot > environment variable. Add optional 'index' parameter to the subcommand > 'fdt get value[]' which lets user specify > which > string within the stringlist should be assigned into the 'var' variable. > The default value of 'index' is 0 in case it is not present. This way the > 'fdt' command API does not change and existing scripts are not broken. > > The following command now reports the Nth string in stringlist, counting > from zero: > => fdt get value var / compatible 1 ; print var > bar > > Signed-off-by: Marek Vasut > Cc: Heinrich Schuchardt > Cc: Simon Glass > Cc: Tom Rini > --- > cmd/fdt.c | 34 -- > 1 file changed, 28 insertions(+), 6 deletions(-) > >>> > >>> Can you please add docs and a test? > >> > >> I was expecting this kind of question ... there is no test for the FDT > >> command. > >> > >>> I am happy to do a starting point for a test if you like. > >> > >> You can implement the test for this while at it. > > > > I sent a starting point for you, both docs and test. > > Thank you. > > Do I understand your remark correctly that you're blocking this > particular patch from going in until there is a test ? I'm not blocking anything, but turning it around the other way, how about having a crack at a test? You can try out 'ut fdt' to see the current tests (using the patches I sent). Regards, Simon Applied to u-boot-dm, thanks!
Re: [RESEND v9 1/9] efi_loader: move udevice pointer into struct efi_object
On 7/15/22 16:47, Masahisa Kojima wrote: This is a preparation patch to provide the unified method to access udevice pointer associated with the block io device. The EFI handles of both EFI block io driver implemented in lib/efi_loader/efi_disk.c and EFI block io driver implemented as EFI payload can posess the udevice pointer in the struct efi_object. We can use this udevice pointer to get the U-Boot friendly block device name(e.g. mmc 0:1, nvme 0:1) through efi_handle_t. Signed-off-by: Masahisa Kojima --- Newly created in v9 include/efi_loader.h | 8 lib/efi_loader/efi_disk.c | 20 +--- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index 3a63a1f75f..bba5ffd482 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -226,6 +226,12 @@ const char *__efi_nesting_dec(void); #define EFI_CACHELINE_SIZE 128 #endif +/** + * efi_handle_to_udev - accessor to the DM device associated to the EFI handle + * @handle:pointer to the EFI handle + */ +#define efi_handle_to_udev(handle) (((struct efi_object *)handle)->dev) This conversion will hide errors if handle is not of type efi_handle_t. We should avoid the conversion and see build time errors instead. Please, remove the macro. For every handle of type efi_handle_t you can access the field handle->dev directly. For struct efi_disk_obj we can use disk->header.dev. + /* Key identifying current memory map */ extern efi_uintn_t efi_memory_map_key; @@ -375,6 +381,7 @@ enum efi_object_type { * @protocols:linked list with the protocol interfaces installed on this *handle * @type: image type if the handle relates to an image + * @dev: pointer to the DM device which is associated with this EFI handle * * UEFI offers a flexible and expandable object model. The objects in the UEFI * API are devices, drivers, and loaded images. struct efi_object is our storage @@ -392,6 +399,7 @@ struct efi_object { /* The list of protocols */ struct list_head protocols; enum efi_object_type type; + struct udevice *dev; }; enum efi_image_auth_status { diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index 1d700b2a6b..a8e8521e3e 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -46,7 +46,6 @@ struct efi_disk_obj { struct efi_device_path *dp; unsigned int part; struct efi_simple_file_system_protocol *volume; - struct udevice *dev; /* TODO: move it to efi_object */ ok }; /** @@ -124,16 +123,16 @@ static efi_status_t efi_disk_rw_blocks(struct efi_block_io *this, return EFI_BAD_BUFFER_SIZE; if (CONFIG_IS_ENABLED(PARTITIONS) && - device_get_uclass_id(diskobj->dev) == UCLASS_PARTITION) { + device_get_uclass_id(efi_handle_to_udev(diskobj)) == UCLASS_PARTITION) { device_get_uclass_id(diskobj->header.hdev)) == UCLASS_PARTITION) { if (direction == EFI_DISK_READ) - n = dev_read(diskobj->dev, lba, blocks, buffer); + n = dev_read(efi_handle_to_udev(diskobj), lba, blocks, buffer); dev_read(diskobj->header.hdev) else - n = dev_write(diskobj->dev, lba, blocks, buffer); + n = dev_write(efi_handle_to_udev(diskobj), lba, blocks, buffer); dev_write(diskobj->header.hdev) } else { /* dev is a block device (UCLASS_BLK) */ struct blk_desc *desc; - desc = dev_get_uclass_plat(diskobj->dev); + desc = dev_get_uclass_plat(efi_handle_to_udev(diskobj)); dev_get_uclass(diskobj->header.hdev) if (direction == EFI_DISK_READ) n = blk_dread(desc, lba, blocks, buffer); else @@ -552,7 +551,7 @@ static int efi_disk_create_raw(struct udevice *dev) return -1; } - disk->dev = dev; + efi_handle_to_udev(disk) = dev; if (dev_tag_set_ptr(dev, DM_TAG_EFI, &disk->header)) { efi_free_pool(disk->dp); efi_delete_handle(&disk->header); @@ -609,7 +608,7 @@ static int efi_disk_create_part(struct udevice *dev) log_err("Adding partition for %s failed\n", dev->name); return -1; } - disk->dev = dev; + efi_handle_to_udev(disk) = dev; disk->header.dev = dev; if (dev_tag_set_ptr(dev, DM_TAG_EFI, &disk->header)) { efi_free_pool(disk->dp); efi_delete_handle(&disk->header); @@ -656,6 +655,13 @@ static int efi_disk_probe(void *ctx, struct event *event) ret = efi_disk_create_raw(dev); if (ret) return -1; + } else { + efi_handle_t handle; + + if (dev_tag_get_ptr(dev, DM_TAG_EFI, (void **)&handle)) +