Re: [PATCH v2] efi_loader: Fix memory corruption on 32bit systems
Am 28. Juli 2023 03:51:55 MESZ schrieb Simon Glass : >Hi, > >On Thu, 27 Jul 2023 at 08:36, Dan Carpenter wrote: >> >> On Thu, Jul 27, 2023 at 11:22:15AM +0300, Ilias Apalodimas wrote: >> > Hi Dan, >> > >> > [...] >> > >> > > @@ -313,7 +313,7 @@ static int cmp_pe_section(const void *arg1, const >> > > void *arg2) >> > > * >> > > * Return: valid pointer to a image, return NULL if allocation fails. >> > > */ >> > > -void *efi_prepare_aligned_image(void *efi, u64 *efi_size) >> > > +void *efi_prepare_aligned_image(void *efi, size_t *efi_size) >> > > { >> > > size_t new_efi_size; >> > > void *new_efi; >> > > @@ -600,7 +600,7 @@ static bool efi_image_authenticate(void *efi, size_t >> > > efi_size) >> > > if (!efi_secure_boot_enabled()) >> > > return true; >> > > >> > > - new_efi = efi_prepare_aligned_image(efi, (u64 *)_size); >> > > + new_efi = efi_prepare_aligned_image(efi, _size); >> > > if (!new_efi) >> > > return false; >> > > >> > > diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c >> > > index 49f8a5e77cbf..d57afd0c498b 100644 >> > > --- a/lib/efi_loader/efi_tcg2.c >> > > +++ b/lib/efi_loader/efi_tcg2.c >> > > @@ -882,7 +882,7 @@ out: >> > > * >> > > * Return: status code >> > > */ >> > > -static efi_status_t tcg2_hash_pe_image(void *efi, u64 efi_size, >> > > +static efi_status_t tcg2_hash_pe_image(void *efi, size_t efi_size, >> > >struct tpml_digest_values >> > > *digest_list) >> > >> > Unfortunately the rabbit hole is a bit deeper with this one. >> > tcg2_hash_pe_image() is called in >> > - tcg2_measure_pe_image(). This one is called in efi_load_pe() and the type >> > is indeed a size_t there, so that's fine >> > - efi_tcg2_hash_log_extend_event(), this one is different... >> > The function is described by the EFI spec [0] which mandates a u64... I >> > think that was the reason efi_prepare_aligned_image() is using a u64 to >> > begin with. This one uses the size only though not the pointer, but in a >> > 32bit platform it would truncate s size > UINT_MAX. >> > >> > [0] >> > https://trustedcomputinggroup.org/wp-content/uploads/EFI-Protocol-Specification-rev13-160330final.pdf >> >> I have maybe misread something... I don't think this is a real issue. >> 32bit systems aren't going to be able to allocate that much memory >> anyway. Also there are a lot of size_t parameters already so it's not >> a new issue. > >We should really use ulong for addresses and malloc() sizes. Please, do not abuse long. According to the C specification the size of long is independent of the size of pointers. Addresses should be pointers and sizes should be size_t. Best regards Heinrich
Re: [PATCH 15/20] sunxi: add R528/T113-s3/D1(s) DRAM initialisation code
I've had countless successful boots of a T113-s3 using this DRAM controller code, so: On 7/21/23 07:46, Andre Przywara wrote: Signed-off-by: Andre Przywara Tested-by: Sam Edwards
Re: [PATCH v5 3/6] mips: add a ls1c300 based board
On Thu, Jul 27, 2023 at 03:05:28PM -0400, Tom Rini wrote: > On Wed, Jul 26, 2023 at 08:30:24PM +0800, Du Huanpeng wrote: > > > - devicetree for ls1c300 SoC and board this devicetree was writen from scratch, I read the SoC's manual and devicetree-specification-v0.3.pdf, and write a Excel to generate it. the v0.3 was lastest version when I wrote it. https://www.devicetree.org/specifications/ the manual seens not available now from official site, https://www.loongson.cn/product/list?id=2 here is my backup: https://github.com/hodcarrier/ls1c300_bsp > > What linux kernel release is this from? > > [snip] > > + u-boot,dm-pre-reloc; > > Here and elsewhere, these are "bootph-" now and also upstreamable. > > [snip] > > +LS1C300_EVAL BOARD > > +M: Du Huanpeng > > Missing space. > > -- > Tom --- du huanpeng
[PATCH 6/8] x86: coreboot: Add IDE and SATA
Add these options to permit access to more disk types. Add some documentation as well. Signed-off-by: Simon Glass --- configs/coreboot64_defconfig| 1 + configs/coreboot_defconfig | 9 + doc/board/coreboot/coreboot.rst | 20 3 files changed, 30 insertions(+) diff --git a/configs/coreboot64_defconfig b/configs/coreboot64_defconfig index 8aadaa68c279..ded0e6f2422d 100644 --- a/configs/coreboot64_defconfig +++ b/configs/coreboot64_defconfig @@ -26,6 +26,7 @@ CONFIG_SYS_PBSIZE=532 CONFIG_CMD_IDE=y CONFIG_CMD_MMC=y CONFIG_CMD_PART=y +CONFIG_CMD_SATA=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_DHCP=y diff --git a/configs/coreboot_defconfig b/configs/coreboot_defconfig index 8e11de663819..56cc542df6c6 100644 --- a/configs/coreboot_defconfig +++ b/configs/coreboot_defconfig @@ -22,8 +22,10 @@ CONFIG_LOGF_FUNC=y CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_LAST_STAGE_INIT=y CONFIG_PCI_INIT_R=y +CONFIG_CMD_IDE=y CONFIG_CMD_MMC=y CONFIG_CMD_PART=y +CONFIG_CMD_SATA=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_DHCP=y @@ -48,6 +50,13 @@ CONFIG_USE_ROOTPATH=y CONFIG_REGMAP=y CONFIG_SYSCON=y # CONFIG_ACPIGEN is not set +CONFIG_SYS_IDE_MAXDEVICE=4 +CONFIG_SYS_ATA_DATA_OFFSET=0 +CONFIG_SYS_ATA_REG_OFFSET=0 +CONFIG_SYS_ATA_ALT_OFFSET=0 +CONFIG_ATAPI=y +CONFIG_LBA48=y +CONFIG_SYS_64BIT_LBA=y CONFIG_NVME_PCI=y # CONFIG_PCI_PNP is not set CONFIG_SOUND=y diff --git a/doc/board/coreboot/coreboot.rst b/doc/board/coreboot/coreboot.rst index 0fe95af56d2d..8e638a3c74cf 100644 --- a/doc/board/coreboot/coreboot.rst +++ b/doc/board/coreboot/coreboot.rst @@ -41,6 +41,26 @@ At present it seems that for Minnowboard Max, coreboot does not pass through the video information correctly (it always says the resolution is 0x0). This works correctly for link though. +You can run via QEMU using:: + + qemu-system-x86_64 -bios build/coreboot.rom -serial mon:stdio + +The `-serial mon:stdio` part shows both output in the display and on the +console. It is optional. You can add `nographic` as well to *only* get console +output. + +To run with a SATA drive called `$DISK`:: + + qemu-system-x86_64 -bios build/coreboot.rom -serial mon:stdio \ + -drive id=disk,file=$DISK,if=none \ + -device ahci,id=ahci \ + -device ide-hd,drive=disk,bus=ahci.0 + +Then you can scan it with `scsi scan` and access it normally. + +To use 4GB of memory, typically necessary for booting Linux distros, add +`-m 4GB`. + 64-bit U-Boot - -- 2.41.0.487.g6d72f3e995-goog
[PATCH 8/8] x86: coreboot: Enable support for CBFS
This is normally used with coreboot, so enable support for it in the coreboot builds. Add an example to show how it is used. Signed-off-by: Simon Glass --- configs/coreboot64_defconfig| 1 + configs/coreboot_defconfig | 1 + doc/board/coreboot/coreboot.rst | 34 + 3 files changed, 36 insertions(+) diff --git a/configs/coreboot64_defconfig b/configs/coreboot64_defconfig index 602465175d20..55064d1ce66f 100644 --- a/configs/coreboot64_defconfig +++ b/configs/coreboot64_defconfig @@ -56,3 +56,4 @@ CONFIG_SOUND=y CONFIG_SOUND_I8254=y CONFIG_CONSOLE_SCROLL_LINES=5 # CONFIG_GZIP is not set +CONFIG_CMD_CBFS=y diff --git a/configs/coreboot_defconfig b/configs/coreboot_defconfig index 735cd6eb4c22..77214f1b4c06 100644 --- a/configs/coreboot_defconfig +++ b/configs/coreboot_defconfig @@ -66,3 +66,4 @@ CONFIG_CONSOLE_SCROLL_LINES=5 CONFIG_CMD_DHRYSTONE=y # CONFIG_GZIP is not set CONFIG_SMBIOS_PARSER=y +CONFIG_CMD_CBFS=y diff --git a/doc/board/coreboot/coreboot.rst b/doc/board/coreboot/coreboot.rst index d09dfc553c87..11e461a2ae0b 100644 --- a/doc/board/coreboot/coreboot.rst +++ b/doc/board/coreboot/coreboot.rst @@ -83,6 +83,40 @@ build in `$CBDIR`:: -device ide-hd,drive=disk,bus=ahci.0 \ +CBFS access +--- + +You can use the 'cbfs' commands to access the Coreboot filesystem:: + + => cbfsinit + => cbfsinfo + + CBFS version: 0x31313132 + ROM size: 0x10 + Boot block size: 0x4 + CBFS size: 0xffdfc + Alignment: 64 + Offset: 0x200 + + => cbfsls +size type name + -- + 32 cbfs header cbfs master header + 1672017 fallback/romstage + 5305217 fallback/ramstage + 398 raw config + 715 raw revision + 117 raw build_info +4044 raw fallback/dsdt.aml + 640 cmos layout cmos_layout.bin + 1780417 fallback/postcar + 335797 payload fallback/payload + 607000 null (empty) + 10752 bootblock bootblock + + 12 file(s) + + => Memory map -- -- 2.41.0.487.g6d72f3e995-goog
[PATCH 3/8] bootstd: Rename bootdev_setup_sibling_blk()
This name is a little confusing since it suggests that it sets up the sibling block device. In fact it sets up a bootdev for it. Rename the function to make this clearer. Signed-off-by: Simon Glass --- boot/bootdev-uclass.c | 8 +--- common/usb_storage.c | 2 +- doc/develop/bootstd.rst| 4 ++-- drivers/mmc/mmc-uclass.c | 2 +- drivers/nvme/nvme.c| 2 +- drivers/scsi/scsi.c| 2 +- drivers/virtio/virtio-uclass.c | 2 +- include/bootdev.h | 8 8 files changed, 16 insertions(+), 14 deletions(-) diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c index 9660ff75676d..114853ffb72a 100644 --- a/boot/bootdev-uclass.c +++ b/boot/bootdev-uclass.c @@ -262,7 +262,7 @@ static int bootdev_get_suffix_start(struct udevice *dev, const char *suffix) return len; } -int bootdev_setup_sibling_blk(struct udevice *blk, const char *drv_name) +int bootdev_setup_for_sibling_blk(struct udevice *blk, const char *drv_name) { struct udevice *parent, *dev; char dev_name[50]; @@ -305,7 +305,9 @@ int bootdev_get_sibling_blk(struct udevice *dev, struct udevice **blkp) if (device_get_uclass_id(dev) != UCLASS_BOOTDEV) return -EINVAL; - /* This should always work if bootdev_setup_sibling_blk() was used */ + /* +* This should always work if bootdev_setup_for_sibling_blk() was used +*/ len = bootdev_get_suffix_start(dev, ".bootdev"); ret = device_find_child_by_namelen(parent, dev->name, len, ); if (ret) { @@ -335,7 +337,7 @@ static int bootdev_get_from_blk(struct udevice *blk, struct udevice **bootdevp) if (device_get_uclass_id(blk) != UCLASS_BLK) return -EINVAL; - /* This should always work if bootdev_setup_sibling_blk() was used */ + /* This should always work if bootdev_setup_for_sibling_blk() was used */ len = bootdev_get_suffix_start(blk, ".blk"); snprintf(dev_name, sizeof(dev_name), "%.*s.%s", len, blk->name, "bootdev"); diff --git a/common/usb_storage.c b/common/usb_storage.c index ac6427577379..85774220ef2a 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -246,7 +246,7 @@ static int usb_stor_probe_device(struct usb_device *udev) if (ret) return ret; - ret = bootdev_setup_sibling_blk(dev, "usb_bootdev"); + ret = bootdev_setup_for_sibling_blk(dev, "usb_bootdev"); if (ret) { int ret2; diff --git a/doc/develop/bootstd.rst b/doc/develop/bootstd.rst index 7a2a69fdfcec..ec3136535783 100644 --- a/doc/develop/bootstd.rst +++ b/doc/develop/bootstd.rst @@ -306,7 +306,7 @@ media device:: The bootdev device is typically created automatically in the media uclass' `post_bind()` method by calling `bootdev_setup_for_dev()` or -`bootdev_setup_sibling_blk()`. The code typically something like this:: +`bootdev_setup_for_sibling_blk()`. The code typically something like this:: /* dev is the Ethernet device */ ret = bootdev_setup_for_dev(dev, "eth_bootdev"); @@ -316,7 +316,7 @@ The bootdev device is typically created automatically in the media uclass' or:: /* blk is the block device (child of MMC device) -ret = bootdev_setup_sibling_blk(blk, "mmc_bootdev"); +ret = bootdev_setup_for_sibling_blk(blk, "mmc_bootdev"); if (ret) return log_msg_ret("bootdev", ret); diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c index 01d9b0201f2c..0e157672eae0 100644 --- a/drivers/mmc/mmc-uclass.c +++ b/drivers/mmc/mmc-uclass.c @@ -421,7 +421,7 @@ int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg) mmc->cfg = cfg; mmc->priv = dev; - ret = bootdev_setup_sibling_blk(bdev, "mmc_bootdev"); + ret = bootdev_setup_for_sibling_blk(bdev, "mmc_bootdev"); if (ret) return log_msg_ret("bootdev", ret); diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c index a7add66ab4d1..20dc910d8a33 100644 --- a/drivers/nvme/nvme.c +++ b/drivers/nvme/nvme.c @@ -910,7 +910,7 @@ int nvme_init(struct udevice *udev) if (ret) goto free_id; - ret = bootdev_setup_sibling_blk(ns_udev, "nvme_bootdev"); + ret = bootdev_setup_for_sibling_blk(ns_udev, "nvme_bootdev"); if (ret) return log_msg_ret("bootdev", ret); diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 6caeb3fcdd0d..0a3420b7fbc2 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -607,7 +607,7 @@ static int do_scsi_scan_one(struct udevice *dev, int id, int lun, bool verbose) /* TODO: undo create */ return log_msg_ret("pro", ret); - ret = bootdev_setup_sibling_blk(bdev, "scsi_bootdev"); + ret = bootdev_setup_for_sibling_blk(bdev,
[PATCH 5/8] bootstd: Add some more debugging in the bootdev uclass
Add some more output to make it easier to see what is going wrong when a bootdev hunter fails. Signed-off-by: Simon Glass --- boot/bootdev-uclass.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c index 114853ffb72a..a3661b18e28d 100644 --- a/boot/bootdev-uclass.c +++ b/boot/bootdev-uclass.c @@ -537,6 +537,8 @@ static int default_get_bootflow(struct udevice *dev, struct bootflow_iter *iter, int ret; ret = bootdev_get_sibling_blk(dev, ); + log_debug("sibling_blk ret=%d, blk=%s\n", ret, + ret ? "(none)" : blk->name); /* * If there is no media, indicate that no more partitions should be * checked @@ -662,7 +664,8 @@ int bootdev_next_prio(struct bootflow_iter *iter, struct udevice **devp) ret = bootdev_hunt_prio(iter->cur_prio, iter->flags & BOOTFLOWIF_SHOW); - log_debug("- hunt ret %d\n", ret); + log_debug("- bootdev_hunt_prio() ret %d\n", + ret); if (ret) return log_msg_ret("hun", ret); } @@ -698,6 +701,7 @@ int bootdev_setup_iter(struct bootflow_iter *iter, const char *label, /* hunt for any pre-scan devices */ if (iter->flags & BOOTFLOWIF_HUNT) { ret = bootdev_hunt_prio(BOOTDEVP_1_PRE_SCAN, show); + log_debug("- bootdev_hunt_prio() ret %d\n", ret); if (ret) return log_msg_ret("pre", ret); } @@ -768,6 +772,7 @@ static int bootdev_hunt_drv(struct bootdev_hunter *info, uint seq, bool show) log_debug("Hunting with: %s\n", name); if (info->hunt) { ret = info->hunt(info, show); + log_debug(" - hunt result %d\n", ret); if (ret) return ret; } @@ -833,9 +838,11 @@ int bootdev_hunt_prio(enum bootdev_prio_t prio, bool show) if (prio != info->prio) continue; ret = bootdev_hunt_drv(info, i, show); + log_debug("bootdev_hunt_drv() return %d\n", ret); if (ret && ret != -ENOENT) result = ret; } + log_debug("exit %d\n", result); return result; } -- 2.41.0.487.g6d72f3e995-goog
[PATCH 4/8] bootstd: Correct creating of bootdev sibling
Use the correct function here, since there may be multiple IDE devices available. Signed-off-by: Simon Glass --- drivers/block/ide.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/block/ide.c b/drivers/block/ide.c index 89201dd4d229..c698f9cbd558 100644 --- a/drivers/block/ide.c +++ b/drivers/block/ide.c @@ -1059,9 +1059,9 @@ static int ide_probe(struct udevice *udev) desc->lba48 = pdesc.lba48; desc->type = pdesc.type; - ret = bootdev_setup_for_dev(udev, "ide_bootdev"); + ret = bootdev_setup_for_sibling_blk(blk, "ide_bootdev"); if (ret) - return log_msg_ret("bootdev", ret); + return log_msg_ret("bd", ret); } return 0; -- 2.41.0.487.g6d72f3e995-goog
[PATCH 7/8] x86: coreboot: Enable standard boot
Enable bootstd options and provide instructions on how to boot a linux distro using coreboot. Signed-off-by: Simon Glass --- configs/coreboot64_defconfig| 14 ++ configs/coreboot_defconfig | 1 + doc/board/coreboot/coreboot.rst | 16 ++-- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/configs/coreboot64_defconfig b/configs/coreboot64_defconfig index ded0e6f2422d..602465175d20 100644 --- a/configs/coreboot64_defconfig +++ b/configs/coreboot64_defconfig @@ -10,40 +10,30 @@ CONFIG_VENDOR_COREBOOT=y CONFIG_TARGET_COREBOOT=y CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y +CONFIG_BOOTSTD_FULL=y +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_SYS_MONITOR_BASE=0x0112 CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro" -CONFIG_USE_BOOTCOMMAND=y -CONFIG_BOOTCOMMAND="ext2load scsi 0:3 0100 /boot/vmlinuz; zboot 0100" CONFIG_PRE_CONSOLE_BUFFER=y CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_LAST_STAGE_INIT=y CONFIG_SPL_NO_BSS_LIMIT=y -CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 CONFIG_CMD_IDE=y CONFIG_CMD_MMC=y -CONFIG_CMD_PART=y CONFIG_CMD_SATA=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set -CONFIG_CMD_DHCP=y CONFIG_BOOTP_BOOTFILESIZE=y -CONFIG_CMD_PING=y CONFIG_CMD_TIME=y CONFIG_CMD_SOUND=y -CONFIG_CMD_EXT2=y -CONFIG_CMD_EXT4=y CONFIG_CMD_EXT4_WRITE=y -CONFIG_CMD_FAT=y -CONFIG_CMD_FS_GENERIC=y CONFIG_MAC_PARTITION=y # CONFIG_SPL_MAC_PARTITION is not set # CONFIG_SPL_DOS_PARTITION is not set -CONFIG_ISO_PARTITION=y -CONFIG_EFI_PARTITION=y # CONFIG_SPL_EFI_PARTITION is not set CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y diff --git a/configs/coreboot_defconfig b/configs/coreboot_defconfig index 56cc542df6c6..735cd6eb4c22 100644 --- a/configs/coreboot_defconfig +++ b/configs/coreboot_defconfig @@ -10,6 +10,7 @@ CONFIG_TARGET_COREBOOT=y CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y CONFIG_BOOTSTD_FULL=y +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_SYS_MONITOR_BASE=0x0111 CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_USE_BOOTARGS=y diff --git a/doc/board/coreboot/coreboot.rst b/doc/board/coreboot/coreboot.rst index 8e638a3c74cf..d09dfc553c87 100644 --- a/doc/board/coreboot/coreboot.rst +++ b/doc/board/coreboot/coreboot.rst @@ -67,9 +67,21 @@ To use 4GB of memory, typically necessary for booting Linux distros, add In addition to the 32-bit 'coreboot' build there is a 'coreboot64' build. This produces an image which can be booted from coreboot (32-bit). Internally it works by using a 32-bit SPL binary to switch to 64-bit for running U-Boot. It -can be useful for running UEFI applications, for example. +can be useful for running UEFI applications, for example with the coreboot +build in `$CBDIR`:: + + DISK=ubuntu-23.04-desktop-amd64.iso + CBDIR=~/coreboot/build + + cp $CBDIR/coreboot.rom.in coreboot.rom + cbfstool coreboot.rom add-flat-binary -f u-boot-x86-with-spl.bin \ + -n fallback/payload -c LZMA -l 0x111 -e 0x111 + + qemu-system-x86_64 -m 2G -smp 4 -bios coreboot.rom \ + -drive id=disk,file=$DISK,if=none \ + -device ahci,id=ahci \ + -device ide-hd,drive=disk,bus=ahci.0 \ -This has only been lightly tested. Memory map -- 2.41.0.487.g6d72f3e995-goog
[PATCH 1/8] usb: Return -ENOENT when no devices are found
When USB finds no devices it currently returns -EPERM which bootstd does not understand. This causes other bootdevs of the same priority to be skipped. Fix this by returning the correct error code. Signed-off-by: Simon Glass --- drivers/usb/host/usb-uclass.c | 2 +- include/usb.h | 9 - 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c index 02c0138a2065..7a03435ba773 100644 --- a/drivers/usb/host/usb-uclass.c +++ b/drivers/usb/host/usb-uclass.c @@ -346,7 +346,7 @@ int usb_init(void) if (controllers_initialized == 0) printf("No working controllers found\n"); - return usb_started ? 0 : -1; + return usb_started ? 0 : -ENOENT; } int usb_setup_ehci_gadget(struct ehci_ctrl **ctlrp) diff --git a/include/usb.h b/include/usb.h index 42b001c3dd5e..09e3f0cb309c 100644 --- a/include/usb.h +++ b/include/usb.h @@ -257,7 +257,14 @@ int usb_kbd_deregister(int force); #endif /* routines */ -int usb_init(void); /* initialize the USB Controller */ + +/* + * usb_init() - initialize the USB Controllers + * + * Returns: 0 if OK, -ENOENT if there are no USB devices + */ +int usb_init(void); + int usb_stop(void); /* stop the USB Controller */ int usb_detect_change(void); /* detect if a USB device has been (un)plugged */ -- 2.41.0.487.g6d72f3e995-goog
[PATCH 2/8] lib: Suppress E when writing error-string output
When CONFIG_ERRNO_STR is not enabled this shows a spurious 'E' from the format string. Fix this. Signed-off-by: Simon Glass Fixes: 7f331941321 ("lib: Support printing an error string") --- lib/vsprintf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/vsprintf.c b/lib/vsprintf.c index e87503e41ada..e14c6ca9f966 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -680,8 +680,10 @@ repeat: break; case 'd': - if (fmt[1] == 'E') + if (fmt[1] == 'E') { flags |= ERRSTR; + fmt++; + } /* fallthrough */ case 'i': flags |= SIGN; @@ -725,7 +727,6 @@ repeat: ADDCH(str, ' '); for (p = errno_str(num); *p; p++) ADDCH(str, *p); - fmt++; } } -- 2.41.0.487.g6d72f3e995-goog
[PATCH 0/8] x86: Improve bootstd support
This series provides some bootstd fixes so that IDE can be used reliably for booting a distro. It also includes some documentation on how to boot from coreboot in various scenarios, using QEMU. With this it is possible to boot Ubuntu 2023.04 from coreboot64, for example. Simon Glass (8): usb: Return -ENOENT when no devices are found lib: Suppress E when writing error-string output bootstd: Rename bootdev_setup_sibling_blk() bootstd: Correct creating of bootdev sibling bootstd: Add some more debugging in the bootdev uclass x86: coreboot: Add IDE and SATA x86: coreboot: Enable standard boot x86: coreboot: Enable support for CBFS boot/bootdev-uclass.c | 17 ++-- common/usb_storage.c| 2 +- configs/coreboot64_defconfig| 16 ++- configs/coreboot_defconfig | 11 + doc/board/coreboot/coreboot.rst | 74 +++-- doc/develop/bootstd.rst | 4 +- drivers/block/ide.c | 4 +- drivers/mmc/mmc-uclass.c| 2 +- drivers/nvme/nvme.c | 2 +- drivers/scsi/scsi.c | 2 +- drivers/usb/host/usb-uclass.c | 2 +- drivers/virtio/virtio-uclass.c | 2 +- include/bootdev.h | 8 ++-- include/usb.h | 9 +++- lib/vsprintf.c | 5 ++- 15 files changed, 123 insertions(+), 37 deletions(-) -- 2.41.0.487.g6d72f3e995-goog
Re: [PATCH RFC 2/3] WIP: getting signing nodes to work in FIT generator node
Hi Neha, On Thu, 27 Jul 2023 at 06:12, Neha Malcom Francis wrote: > > They need to get the contents of the FIT section beforehand, process > them and prepend the signing certificate to the FIT contents > > Signed-off-by: Neha Malcom Francis > --- > tools/binman/etype/collection.py | 38 +++- > tools/binman/etype/fit.py| 1 + > tools/binman/etype/ti_secure.py | 13 --- > tools/binman/etype/x509_cert.py | 9 ++-- > 4 files changed, 46 insertions(+), 15 deletions(-) I am not quite sure about this, but it seems there is a bit too much magic? >From what I can tell, you want: @fdt-SEQ { ti-secure { content = <>; } dtb: blob-ext { filename = "u-boot-spl.dtb"; } }; where the 'dtb' phande can work even though it is in a generated node. Is that right? If so, I suspect it could be done. Re the fit,fdt-indir that is where I get confused...you want it to affect the generator somehow? How is that? The last patch gives me some clues but I don't understand why some nodes have the fit,fdt-indir property and some do not? I suspect what would help me understand is to write a test .dts and a test that doesn't work, but illustrates what you want...then we might get closer to a suitable design. Once the design is clean, the impl should follow. Regards, Simon
Re: [PATCH RFC 1/3] tools: binman: Enable getting file from specific directory
Hi Neha, On Thu, 27 Jul 2023 at 06:12, Neha Malcom Francis wrote: > > While we have the option of using '-a to grab a file from a > specific directory, this is problematic when searching for a filename > shared by multiple files across directories. An example would be FDT > generated in SPL_BUILD vs. non-SPL_BUILD that is present in spl/dts and > arch/arm/dts respectively with the same DTB name. Maybe running binman Do you mean spl/arch/arm/dts and arch/arch/dts ? > twice could also solve this issue, but this seems like a valid > implementation. > > Signed-off-by: Neha Malcom Francis > --- > tools/binman/etype/blob.py | 12 ++-- > tools/binman/etype/fit.py | 15 ++- > tools/u_boot_pylib/tools.py | 7 ++- > 3 files changed, 30 insertions(+), 4 deletions(-) > I don't fully understand this, but perhaps it would make sense to give the indirs names, like: binman -I spl:path/to/spl -I name2:path/to/somewhere-else then you could use the names below, instead of the paths. It provide at least a little separation. Perhaps if you listed out the two dirs and the files they contain, that would help me understand better. > diff --git a/tools/binman/etype/blob.py b/tools/binman/etype/blob.py > index 064fae5036..eccf6f87ac 100644 > --- a/tools/binman/etype/blob.py > +++ b/tools/binman/etype/blob.py > @@ -19,6 +19,8 @@ class Entry_blob(Entry): > > Properties / Entry arguments: > - filename: Filename of file to read into entry > +- indir-path: Specific directory to fetch file from, if not provided > +default indir paths will be searched > - compress: Compression algorithm to use: > none: No compression > lz4: Use lz4 compression (via 'lz4' command-line utility) > @@ -35,6 +37,7 @@ class Entry_blob(Entry): > super().__init__(section, etype, node, > auto_write_symbols=auto_write_symbols) > self._filename = fdt_util.GetString(self._node, 'filename', > self.etype) > +self._indir_path = fdt_util.GetString(self._node, 'indir-path', None) > self.elf_fname = fdt_util.GetString(self._node, 'elf-filename', > self.elf_fname) > self.elf_base_sym = fdt_util.GetString(self._node, 'elf-base-sym') > @@ -44,8 +47,13 @@ class Entry_blob(Entry): > > def ObtainContents(self, fake_size=0): > self._filename = self.GetDefaultFilename() > -self._pathname = tools.get_input_filename(self._filename, > -self.external and (self.optional or > self.section.GetAllowMissing())) > +if self._indir_path: > +self._pathname = tools.get_input_filename(self._filename, > +self.external and (self.optional or > self.section.GetAllowMissing()), > +self._indir_path) I think this might as well just read the file, rather than calling tools.get_input_filename() > +else: > +self._pathname = tools.get_input_filename(self._filename, > +self.external and (self.optional or > self.section.GetAllowMissing())) > # Allow the file to be missing > if not self._pathname: > self._pathname, faked = self.check_fake_fname(self._filename, > diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py > index ef4d066757..46db816370 100644 > --- a/tools/binman/etype/fit.py > +++ b/tools/binman/etype/fit.py > @@ -87,6 +87,15 @@ class Entry_fit(Entry_section): > > fit,fdt-list-val = "dtb1", "dtb2"; > > +fit,fdt-indir > +Indicates the specific directory (if any) to be used to pick up > fdts > +generated in the gen-fdt-nodes property. For example, picking > fdt from > +spl/dts instead of arch/arm/dts. This is equivalent to '-a > spl/dts' but > +helps when multiple directories contain same named fdt to choose > a > +specific one > + > +fit,fdt-indir = "spl/dts" Should this be a named indir? Otherwise you have to use the actual dirs and that could be come quite brittle when things change. > + > Substitutions > ~ > > @@ -362,6 +371,7 @@ class Entry_fit(Entry_section): > if pname.startswith('fit,'): > self._fit_props[pname] = prop > self._fit_list_prop = self._fit_props.get('fit,fdt-list') > +self._fit_indir = fdt_util.GetString(self._node, 'fit,fdt-indir', > None) > if self._fit_list_prop: > fdts, = self.GetEntryArgsOrProps( > [EntryArg(self._fit_list_prop.value, str)]) > @@ -583,7 +593,10 @@ class Entry_fit(Entry_section): > # Generate nodes for each FDT > for seq, fdt_fname in enumerate(self._fdts): > node_name = node.name[1:].replace('SEQ', str(seq + 1)) > -fname = tools.get_input_filename(fdt_fname + '.dtb') > +
Re: [PATCH] efi_loader: capsule: enforce guid check in api and capsule_on_disk
Hi Michal, On Thu, Jul 27, 2023 at 10:53:44AM +0200, Michal Simek wrote: > > > On 7/27/23 02:38, AKASHI Takahiro wrote: > > While UPDATE_CAPSULE api is not fully implemented, this interface and > > capsule-on-disk feature should behave in the same way, especially in > > handling an empty capsule for fwu multibank, for future enhancement. > > > > So move the guid check into efi_capsule_update_firmware(). > > > > Fixed: commit a6aafce494ab ("efi_loader: use efi_update_capsule_firmware() > > for capsule on disk") > > just fyi: b4 mess this. > You should likely put it on the same line and ignore line limit. > > This is how this ends up. > > handling an empty capsule for fwu multibank, for future enhancement. > > So move the guid check into efi_capsule_update_firmware(). > > for capsule on disk") > > Fixed: commit a6aafce494ab ("efi_loader: use efi_update_capsule_firmware() > Reported-by: Michal Simek > Signed-off-by: AKASHI Takahiro > Link: > https://lore.kernel.org/r/20230727003800.25105-1-takahiro.aka...@linaro.org > > > > > > Reported-by: Michal Simek > > Signed-off-by: AKASHI Takahiro > > --- > > lib/efi_loader/efi_capsule.c | 17 - > > 1 file changed, 8 insertions(+), 9 deletions(-) > > > > diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c > > index 7a6f195cbc02..ddf8153e0982 100644 > > --- a/lib/efi_loader/efi_capsule.c > > +++ b/lib/efi_loader/efi_capsule.c > > @@ -581,6 +581,13 @@ static efi_status_t efi_capsule_update_firmware( > > fw_accept_os = capsule_data->flags & FW_ACCEPT_OS ? 0x1 : 0x0; > > } > > + if (guidcmp(_data->capsule_guid, > > + _guid_firmware_management_capsule_id)) { > > + log_err("Unsupported capsule type: %pUs\n", > > + _data->capsule_guid); > > + return EFI_UNSUPPORTED; > > + } > > + > > /* sanity check */ > > if (capsule_data->header_size < sizeof(*capsule) || > > capsule_data->header_size >= capsule_data->capsule_image_size) > > @@ -751,15 +758,7 @@ efi_status_t EFIAPI efi_update_capsule( > > log_debug("Capsule[%d] (guid:%pUs)\n", > > i, >capsule_guid); > > - if (!guidcmp(>capsule_guid, > > -_guid_firmware_management_capsule_id)) { > > - ret = efi_capsule_update_firmware(capsule); > > - } else { > > - log_err("Unsupported capsule type: %pUs\n", > > - >capsule_guid); > > - ret = EFI_UNSUPPORTED; > > - } > > - > > + ret = efi_capsule_update_firmware(capsule); > > if (ret != EFI_SUCCESS) > > goto out; > > } > > I have no problem with this patch because it works as the previous one. When > commit message is fixed feel free to add > Tested-by: Michal Simek I hope that the maintainer would take care of it when he tries to merge the patch. > And regarding empty capsule functionality with A/B. > I boot from A. Download capsules and run disk-update to get to Image B and > trial state and I can download and apply acceptance capsule by hand via > efidebug capsule update . That works fine for acceptance capsule is > reflected via fwu in mdata. > When I apply revert capsule there is nothing visible in mdata and I think it > should. The only visibility is that it resets to A system. Is this the only > intention of revert capsules? > (keep in mind that I use two images per bank). > > Empty capsules are just accepted only in trial state which is understandable. > > And I also see that with latest master branch capsule on disk feature is not > working properly. Capsule are not processed at all. Can you please double > check it? I locally ran the pytest with v2023.10-rc1, and - test_capsule_firmware_raw passed - test_capsule_firmware_signed_raw failed but it seems to me that 'signed_raw' failure is not directly related to efi implementation (I didn't dig into details, though). Can you describe more about your environment? -Takahiro Akashi > Thanks, > Michal > >
Re: bootstd regression from distro_bootcmd for removable EFI boot and weird return codes for fs
Hi Da, On Mon, 24 Jul 2023 at 10:49, Da Xue wrote: > > On Mon, Jul 24, 2023 at 11:48 AM Da Xue wrote: > > > > I forgot to attach some additional details: > > > > ``` > > sudo fdisk -l /dev/sda > > Disk /dev/sda: 58.24 GiB, 62534975488 bytes, 122138624 sectors > > Disk model: STORAGE DEVICE > > Units: sectors of 1 * 512 = 512 bytes > > Sector size (logical/physical): 512 bytes / 512 bytes > > I/O size (minimum/optimal): 512 bytes / 512 bytes > > Disklabel type: dos > > Disk identifier: 0x > > > > Device Boot StartEnd Sectors Size Id Type > > /dev/sda1 * 2048 524287 522240 255M ef EFI (FAT-12/16/32) > > ``` > > > > The image was generated via buildroot using genimage: > > > > ``` > > image boot.vfat { > > vfat { > > file EFI/BOOT/BOOTAA64.EFI { > > image = "Image" > > } > > extraargs = "-F32" # tried with and without this flag, > > same issue. > > } > > size = 255M > > } > > > > image sdcard.img { > > hdimage { > > } > > partition bootloader { > > in-partition-table = false > > offset = 512 > > image = "u-boot.bin" > > } > > partition rootfs { > > partition-type = 0xEF > > bootable = "true" > > image = "boot.vfat" > > offset = 1M > > } > > } > > ``` > > > > bootflow -la without the debug messages: > > > > ``` > > => bootflow scan -la > > Scanning for bootflows in all bootdevs > > Seq Method State UclassPart Name Filename > > --- --- -- > > > > Scanning global bootmeth 'efi_mgr': > > 0 efi_mgr base(none) 0 > > Scanning bootdev 'mmc@74000.bootdev': > > 1 efi media mmc 0 mmc@74000.bootdev.whole > > 2 extlinux media mmc 0 mmc@74000.bootdev.whole > > 3 script media mmc 0 mmc@74000.bootdev.whole > > Scanning bootdev 'mmc@72000.bootdev': > > 4 efi media mmc 0 mmc@72000.bootdev.whole > > 5 extlinux media mmc 0 mmc@72000.bootdev.whole > > 6 script media mmc 0 mmc@72000.bootdev.whole > > 7 efi filemmc 1 mmc@72000.bootdev.part_1 > > efi/boot/bootaa64.efi > > 8 extlinux fs mmc 1 mmc@72000.bootdev.part_1 > > /boot/extlinux/extlinux.conf > > 9 script fs mmc 1 mmc@72000.bootdev.part_1 > > /boot/boot.scr > > a efi media mmc 2 mmc@72000.bootdev.part_2 > > b extlinux media mmc 2 mmc@72000.bootdev.part_2 > > c script media mmc 2 mmc@72000.bootdev.part_2 > > d efi media mmc 3 mmc@72000.bootdev.part_3 > > e extlinux media mmc 3 mmc@72000.bootdev.part_3 > > f script media mmc 3 mmc@72000.bootdev.part_3 > > 10 efi media mmc 4 mmc@72000.bootdev.part_4 > > 11 extlinux media mmc 4 mmc@72000.bootdev.part_4 > > 12 script media mmc 4 mmc@72000.bootdev.part_4 > > 13 efi media mmc 5 mmc@72000.bootdev.part_5 > > 14 extlinux media mmc 5 mmc@72000.bootdev.part_5 > > 15 script media mmc 5 mmc@72000.bootdev.part_5 > > 16 efi media mmc 6 mmc@72000.bootdev.part_6 > > 17 extlinux media mmc 6 mmc@72000.bootdev.part_6 > > 18 script media mmc 6 mmc@72000.bootdev.part_6 > > 19 efi media mmc 7 mmc@72000.bootdev.part_7 > > 1a extlinux media mmc 7 mmc@72000.bootdev.part_7 > > 1b script media mmc 7 mmc@72000.bootdev.part_7 > > 1c efi media mmc 8 mmc@72000.bootdev.part_8 > > 1d extlinux media mmc 8 mmc@72000.bootdev.part_8 > > 1e script media mmc 8 mmc@72000.bootdev.part_8 > > 1f efi media mmc 9 mmc@72000.bootdev.part_9 > > 20 extlinux media mmc 9 mmc@72000.bootdev.part_9 > > 21 script media mmc 9 mmc@72000.bootdev.part_9 > > 22 efi media mmc a mmc@72000.bootdev.part_a > > 23 extlinux media mmc a mmc@72000.bootdev.part_a > > 24 script media mmc a mmc@72000.bootdev.part_a > > 25 efi media mmc b mmc@72000.bootdev.part_b > > 26 extlinux media mmc b mmc@72000.bootdev.part_b > > 27 script media mmc b mmc@72000.bootdev.part_b > > 28 efi media mmc c mmc@72000.bootdev.part_c > > 29 extlinux media mmc c
Re: [PATCH 2/6] arm_ffa: introduce armffa command
Hi Abdellatif, On Thu, 27 Jul 2023 at 03:00, Abdellatif El Khlifi wrote: > > Hi Heinrich, > > On Thu, Jul 27, 2023 at 07:51:42AM +0200, Heinrich Schuchardt wrote: > > On 3/29/22 17:16, abdellatif.elkhl...@arm.com wrote: > > > From: Abdellatif El Khlifi > > > > > > Provide armffa command showcasing the use of the FF-A driver > > > > > > The armffa command allows to query secure partitions data from > > > the secure world and exchanging messages with the partitions. > > > > > > Signed-off-by: Abdellatif El Khlifi > > > Cc: Tom Rini > > > --- > > > MAINTAINERS | 1 + > > > cmd/Kconfig | 10 ++ > > > cmd/Makefile| 2 + > > > cmd/armffa.c| 266 > > > drivers/arm-ffa/Kconfig | 1 + > > > > We want to have all commands to be documented in /doc/usage/cmd/. > > > > Could you, please, provide the missing /doc/usage/cmd/armffa.rst file. > > > > It's here [1]. I'd suggest mentioning that in the commit message for this patch, or even putting the testin the same patch, along with the test for the command. I find it hard to keep track of this too. > > [1]: > https://lore.kernel.org/all/20230726094503.100497-6-abdellatif.elkhl...@arm.com/#Z31doc:usage:cmd:armffa.rst > > Cheers, > Abdellatif Regards, Simon
Re: [PATCH 1/1] pci: correct function name in message
On Thu, 27 Jul 2023 at 10:50, Heinrich Schuchardt wrote: > > If an error message contains a function name, it should match the name of > the function throwing the message. > > Fixes: 7739d93d8288 ("pci: Match region flags using a mask") > Signed-off-by: Heinrich Schuchardt > --- > drivers/pci/pci-uclass.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Reviewed-by: Simon Glass Can you revert some of that change? It needs to go back to returning an error code, not a phys_addr_ t, so the caller can detect the error. > > diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c > index 632c1a63cf..7f3d6ddf91 100644 > --- a/drivers/pci/pci-uclass.c > +++ b/drivers/pci/pci-uclass.c > @@ -1446,7 +1446,7 @@ phys_addr_t dm_pci_bus_to_phys(struct udevice *dev, > pci_addr_t bus_addr, > return res->phys_start + offset; > } > > - puts("pci_hose_bus_to_phys: invalid physical address\n"); > + puts("dm_pci_bus_to_phys: invalid physical address\n"); > return 0; > } > > @@ -1486,7 +1486,7 @@ pci_addr_t dm_pci_phys_to_bus(struct udevice *dev, > phys_addr_t phys_addr, > return res->bus_start + offset; > } > > - puts("pci_hose_phys_to_bus: invalid physical address\n"); > + puts("dm_pci_phys_to_bus: invalid physical address\n"); > return 0; > } > > -- > 2.40.1 > Regards, Simon
Re: [PATCH v2] efi_loader: Fix memory corruption on 32bit systems
Hi, On Thu, 27 Jul 2023 at 08:36, Dan Carpenter wrote: > > On Thu, Jul 27, 2023 at 11:22:15AM +0300, Ilias Apalodimas wrote: > > Hi Dan, > > > > [...] > > > > > @@ -313,7 +313,7 @@ static int cmp_pe_section(const void *arg1, const > > > void *arg2) > > > * > > > * Return: valid pointer to a image, return NULL if allocation fails. > > > */ > > > -void *efi_prepare_aligned_image(void *efi, u64 *efi_size) > > > +void *efi_prepare_aligned_image(void *efi, size_t *efi_size) > > > { > > > size_t new_efi_size; > > > void *new_efi; > > > @@ -600,7 +600,7 @@ static bool efi_image_authenticate(void *efi, size_t > > > efi_size) > > > if (!efi_secure_boot_enabled()) > > > return true; > > > > > > - new_efi = efi_prepare_aligned_image(efi, (u64 *)_size); > > > + new_efi = efi_prepare_aligned_image(efi, _size); > > > if (!new_efi) > > > return false; > > > > > > diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c > > > index 49f8a5e77cbf..d57afd0c498b 100644 > > > --- a/lib/efi_loader/efi_tcg2.c > > > +++ b/lib/efi_loader/efi_tcg2.c > > > @@ -882,7 +882,7 @@ out: > > > * > > > * Return: status code > > > */ > > > -static efi_status_t tcg2_hash_pe_image(void *efi, u64 efi_size, > > > +static efi_status_t tcg2_hash_pe_image(void *efi, size_t efi_size, > > >struct tpml_digest_values *digest_list) > > > > Unfortunately the rabbit hole is a bit deeper with this one. > > tcg2_hash_pe_image() is called in > > - tcg2_measure_pe_image(). This one is called in efi_load_pe() and the type > > is indeed a size_t there, so that's fine > > - efi_tcg2_hash_log_extend_event(), this one is different... > > The function is described by the EFI spec [0] which mandates a u64... I > > think that was the reason efi_prepare_aligned_image() is using a u64 to > > begin with. This one uses the size only though not the pointer, but in a > > 32bit platform it would truncate s size > UINT_MAX. > > > > [0] > > https://trustedcomputinggroup.org/wp-content/uploads/EFI-Protocol-Specification-rev13-160330final.pdf > > I have maybe misread something... I don't think this is a real issue. > 32bit systems aren't going to be able to allocate that much memory > anyway. Also there are a lot of size_t parameters already so it's not > a new issue. We should really use ulong for addresses and malloc() sizes. Regards, Simon
Re: [PATCH] cramfs: clean up some error messages
On Thu, 27 Jul 2023 at 08:32, Dan Carpenter wrote: > > This line break is not done correctly. We don't want to have all those > tabs in the printed output. > > Signed-off-by: Dan Carpenter > --- > fs/cramfs/cramfs.c | 6 ++ > 1 file changed, 2 insertions(+), 4 deletions(-) Reviewed-by: Simon Glass
Re: [PATCH 1/1] i2c: designware: build PCI support only for X86
Hi Maxim, On Thu, 27 Jul 2023 at 01:17, Maxim Kochetkov wrote: > > designware_i2c_pci.c includes which is located at > arch/x86/include/asm/lpss.h and available only for X86. > So enable CONFIG_SYS_I2C_DW only for X86. > > Fixes: 070a94600855 ("i2c: designware: Add Apollo Lake support") > Signed-off-by: Maxim Kochetkov > --- > drivers/i2c/Makefile | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile > index 99545df2e5..7320e7a80e 100644 > --- a/drivers/i2c/Makefile > +++ b/drivers/i2c/Makefile > @@ -18,9 +18,11 @@ obj-$(CONFIG_SYS_I2C_CADENCE) += i2c-cdns.o > obj-$(CONFIG_SYS_I2C_CA) += i2c-cortina.o > obj-$(CONFIG_SYS_I2C_DAVINCI) += davinci_i2c.o > obj-$(CONFIG_SYS_I2C_DW) += designware_i2c.o > +ifdef CONFIG_X86 > ifdef CONFIG_PCI > obj-$(CONFIG_SYS_I2C_DW) += designware_i2c_pci.o Can you add a new CONFIG_I2C_DW_PCI and have it depend on PCI && X86? These sorts of things should be done in Kconfig, with just simple one-line rules in Makefiles. > endif > +endif > obj-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o > obj-$(CONFIG_SYS_I2C_IHS) += ihs_i2c.o > obj-$(CONFIG_SYS_I2C_INTEL) += intel_i2c.o > -- > 2.40.1 > Regards, Simon
Re: [PATCH 3/5] boards: siemens: iot2050: Unify PG1 and PG2/M.2 configurations again
On Wed, 26 Jul 2023 at 22:35, Jan Kiszka wrote: > > From: Jan Kiszka > > This avoids having to maintain to defconfigs that are 99% equivalent. > The approach is to use binman to generate two flash images, > flash-pg1.bin and flash-pg2.bin. With the help of a template dtsi, we > can avoid duplicating the common binman image definitions. > > Suggested-by: Andrew Davis > Signed-off-by: Jan Kiszka > > --- > CC: Andrew Davis > --- > arch/arm/dts/k3-am65-iot2050-boot-image.dtsi | 155 +++--- > board/siemens/iot2050/Kconfig | 30 +--- > board/siemens/iot2050/MAINTAINERS | 3 +- > board/siemens/iot2050/board.c | 25 ++- > ...ot2050_pg1_defconfig => iot2050_defconfig} | 3 +- > configs/iot2050_pg2_defconfig | 151 - > doc/board/siemens/iot2050.rst | 27 ++- > tools/iot2050-sign-fw.sh | 6 +- > 8 files changed, 138 insertions(+), 262 deletions(-) > rename configs/{iot2050_pg1_defconfig => iot2050_defconfig} (97%) > delete mode 100644 configs/iot2050_pg2_defconfig Reviewed-by: Simon Glass
Re: [PATCH] gpio: Use separate bitfield array to indicate GPIO is claimed
Hi Marek, On Thu, 27 Jul 2023 at 09:50, Marek Vasut wrote: > > The current gpio-uclass design uses name field in struct gpio_dev_priv as > an indicator that GPIO is claimed by consumer. This overloads the function > of name field and does not work well for named pins not configured as GPIO > pins. > > Introduce separate bitfield array as the claim indicator. > > This unbreaks dual-purpose AF and GPIO operation on STM32MP since commit > 2c38f7c31806 ("pinctrl: pinctrl_stm32: Populate uc_priv->name[] with pinmux > node's name") > where any pin which has already been configured as AF could no longer be > claimed as dual-purpose GPIO. This is important for pins like STM32 MMCI > st,cmd-gpios . > > Signed-off-by: Marek Vasut > --- > Cc: Michal Suchanek > Cc: Patrice Chotard > Cc: Patrick Delaunay > Cc: Rasmus Villemoes > Cc: Samuel Holland > Cc: Simon Glass > --- > drivers/gpio/gpio-uclass.c | 35 ++- > include/asm-generic/gpio.h | 2 ++ > 2 files changed, 32 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c > index 712119c3415..25873f07bd4 100644 > --- a/drivers/gpio/gpio-uclass.c > +++ b/drivers/gpio/gpio-uclass.c > @@ -75,6 +75,20 @@ static int gpio_to_device(unsigned int gpio, struct > gpio_desc *desc) > return -ENOENT; > } > > +/** > + * gpio_is_claimed() - Test whether GPIO is claimed by consumer > + * > + * Test whether GPIO is claimed by consumer already. > + * > + * @uc_priv: gpio_dev_priv pointer. > + * @offset:gpio offset within the device > + * @return:true if claimed, false if not claimed > + */ > +static bool gpio_is_claimed(struct gpio_dev_priv *uc_priv, unsigned int > offset) > +{ > + return !!(uc_priv->claimed[offset / 32] & BIT(offset % 32)); > +} Can you add a helper to set is_claimed as well? That avoids open-coding it in two places below. > + > #if CONFIG_IS_ENABLED(DM_GPIO_LOOKUP_LABEL) > /** > * dm_gpio_lookup_label() - look for name in gpio device > @@ -94,7 +108,7 @@ static int dm_gpio_lookup_label(const char *name, > > *offset = -1; > for (i = 0; i < uc_priv->gpio_count; i++) { > - if (!uc_priv->name[i]) > + if (!gpio_is_claimed(uc_priv, i)) > continue; > if (!strcmp(name, uc_priv->name[i])) { > *offset = i; > @@ -350,7 +364,7 @@ int dm_gpio_request(struct gpio_desc *desc, const char > *label) > int ret; > > uc_priv = dev_get_uclass_priv(dev); > - if (uc_priv->name[desc->offset]) > + if (gpio_is_claimed(uc_priv, desc->offset)) > return -EBUSY; > str = strdup(label); > if (!str) > @@ -362,6 +376,8 @@ int dm_gpio_request(struct gpio_desc *desc, const char > *label) > return ret; > } > } > + > + uc_priv->claimed[desc->offset / 32] |= BIT(desc->offset % 32); > uc_priv->name[desc->offset] = str; > > return 0; > @@ -438,7 +454,7 @@ int _dm_gpio_free(struct udevice *dev, uint offset) > int ret; > > uc_priv = dev_get_uclass_priv(dev); > - if (!uc_priv->name[offset]) > + if (!gpio_is_claimed(uc_priv, offset)) > return -ENXIO; > if (ops->rfree) { > ret = ops->rfree(dev, offset); > @@ -446,6 +462,7 @@ int _dm_gpio_free(struct udevice *dev, uint offset) > return ret; > } > > + uc_priv->claimed[offset / 32] &= ~BIT(offset % 32); > free(uc_priv->name[offset]); > uc_priv->name[offset] = NULL; > > @@ -480,7 +497,7 @@ static int check_reserved(const struct gpio_desc *desc, > const char *func) > return -ENOENT; > > uc_priv = dev_get_uclass_priv(desc->dev); > - if (!uc_priv->name[desc->offset]) { > + if (!gpio_is_claimed(uc_priv, desc->offset)) { > printf("%s: %s: error: gpio %s%d not reserved\n", >desc->dev->name, func, >uc_priv->bank_name ? uc_priv->bank_name : "", > @@ -826,7 +843,7 @@ static int get_function(struct udevice *dev, int offset, > bool skip_unused, > return -EINVAL; > if (namep) > *namep = uc_priv->name[offset]; > - if (skip_unused && !uc_priv->name[offset]) > + if (skip_unused && !gpio_is_claimed(uc_priv, offset)) > return GPIOF_UNUSED; > if (ops->get_function) { > int ret; > @@ -1341,6 +1358,13 @@ static int gpio_post_probe(struct udevice *dev) > if (!uc_priv->name) > return -ENOMEM; > > + uc_priv->claimed = calloc(DIV_ROUND_UP(uc_priv->gpio_count, 32), > + sizeof(*uc_priv->claimed)); > + if (!uc_priv->claimed) { > + free(uc_priv->name); > + return -ENOMEM; > + } We already have the name[] array which holds the
Re: [PATCHv4 0/5] net/lwip: add lwip library for the network stack
Hi Maxim, On Fri, 14 Jul 2023 at 08:22, Maxim Uvarov wrote: > > changelog: > v4: - tested with tests/py/ did some minor fixes (out of tree > build, variables set after downloads). > - accounted review comments for documentation. > - implemented dns command > - corrected wget command to not use serverip variable and use just > url string. > v3: - use lwip commands for ping,tftp,wget,dhcp if this patch > applied. Drop CONFIG_LIB_LWIP_REPLACE_ option. > - docs: use rst variant and drop references to RFC. > > build: > git submodule init > git submodule update > make > > I tested with qemu and ubuntu host for the server manually and with > ./test/py/test -bd qemu_arm64 --build -k net. If we are moving to a new stack we should take this oppty to create unit tests that deal with error paths as well, as it done in test/dm/eth.c What unit tests does lwip have? Regards, Simon
Re: [PATCH] addrmap: Fix off by one in addrmap_set_entry()
Hi Dan, On Thu, 27 Jul 2023 at 04:56, Dan Carpenter wrote: > > On Wed, Jul 26, 2023 at 06:49:44PM -0600, Simon Glass wrote: > > Hi Dan, > > > > On Tue, 25 Jul 2023 at 09:40, Dan Carpenter > > wrote: > > > > > > The > comparison needs to be changed to >= to prevent an out of bounds > > > write on th next line. > > > > > > Signed-off-by: Dan Carpenter > > > --- > > > lib/addr_map.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/lib/addr_map.c b/lib/addr_map.c > > > index 9b3e0a544e47..86e932e4b561 100644 > > > --- a/lib/addr_map.c > > > +++ b/lib/addr_map.c > > > @@ -59,7 +59,7 @@ void *addrmap_phys_to_virt(phys_addr_t paddr) > > > void addrmap_set_entry(unsigned long vaddr, phys_addr_t paddr, > > > phys_size_t size, int idx) > > > { > > > - if (idx > CONFIG_SYS_NUM_ADDR_MAP) > > > + if (idx >= CONFIG_SYS_NUM_ADDR_MAP) > > > return; > > > > It looks like this function should return an error. > > > > If we hit this error path there probably isn't a reasonable way to > recover. Maybe we could add a WARN()? When we get an error we should report it. For leaf functions like this, WARN adds to code size for a case that should not happen. The caller will need to check the error and fail. The function should always have had an error-return code, by the look of it. If we adopt the approach of warning instead of returning error codes, +Bin Meng +Kumar Gala Regards, Simon
[RFC 3/3] firmware: scmi: add a sanity check against protocol version
SCMI_PROTOCOL_VERSION is a mandatory command for all the SCMI protocols. With this patch, this command is implemented on each protocol. Then, we can assure that the feature set implemented by SCMI Server (firmware) is compatible with U-Boot, that is, each protocol's version must be equal to or higher than the one that U-Boot's corresponding driver expects. Signed-off-by: AKASHI Takahiro --- drivers/clk/clk_scmi.c | 6 ++ drivers/power/regulator/scmi_regulator.c | 6 ++ drivers/reset/reset-scmi.c | 14 +- include/scmi_protocols.h | 6 ++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk_scmi.c b/drivers/clk/clk_scmi.c index 34a49363a51a..3591acb6d3a9 100644 --- a/drivers/clk/clk_scmi.c +++ b/drivers/clk/clk_scmi.c @@ -138,12 +138,18 @@ static int scmi_clk_probe(struct udevice *dev) { struct clk *clk; size_t num_clocks, i; + u32 version; int ret; ret = devm_scmi_of_get_channel(dev); if (ret) return ret; + ret = scmi_generic_protocol_version(dev, SCMI_PROTOCOL_ID_CLOCK, + ); + if (ret || version < SCMI_CLOCK_PROTOCOL_VERSION) + return -EINVAL; + if (!CONFIG_IS_ENABLED(CLK_CCF)) return 0; diff --git a/drivers/power/regulator/scmi_regulator.c b/drivers/power/regulator/scmi_regulator.c index 08918b20872c..936768d0eeeb 100644 --- a/drivers/power/regulator/scmi_regulator.c +++ b/drivers/power/regulator/scmi_regulator.c @@ -138,12 +138,18 @@ static int scmi_regulator_probe(struct udevice *dev) .out_msg = (u8 *), .out_msg_sz = sizeof(out), }; + u32 version; int ret; ret = devm_scmi_of_get_channel(dev); if (ret) return ret; + ret = scmi_generic_protocol_version(dev, SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN, + ); + if (ret || version < SCMI_VOLTDOM_PROTOCOL_VERSION) + return -EINVAL; + /* Check voltage domain is known from SCMI server */ in.domain_id = pdata->domain_id; diff --git a/drivers/reset/reset-scmi.c b/drivers/reset/reset-scmi.c index b76711f0a8fb..dbd98dbdbc4f 100644 --- a/drivers/reset/reset-scmi.c +++ b/drivers/reset/reset-scmi.c @@ -73,7 +73,19 @@ static const struct reset_ops scmi_reset_domain_ops = { static int scmi_reset_probe(struct udevice *dev) { - return devm_scmi_of_get_channel(dev); + u32 version; + int ret; + + ret = devm_scmi_of_get_channel(dev); + if (ret) + return ret; + + ret = scmi_generic_protocol_version(dev, SCMI_PROTOCOL_ID_RESET_DOMAIN, + ); + if (ret || version < SCMI_RESETDOM_PROTOCOL_VERSION) + return -EINVAL; + + return 0; } U_BOOT_DRIVER(scmi_reset_domain) = { diff --git a/include/scmi_protocols.h b/include/scmi_protocols.h index 64fd740472b5..6ab16efd49cc 100644 --- a/include/scmi_protocols.h +++ b/include/scmi_protocols.h @@ -398,6 +398,8 @@ int scmi_generic_protocol_version(struct udevice *dev, * SCMI Clock Protocol */ +#define SCMI_CLOCK_PROTOCOL_VERSION 0x2 + enum scmi_clock_message_id { SCMI_CLOCK_ATTRIBUTES = 0x3, SCMI_CLOCK_RATE_SET = 0x5, @@ -509,6 +511,8 @@ struct scmi_clk_rate_set_out { * SCMI Reset Domain Protocol */ +#define SCMI_RESETDOM_PROTOCOL_VERSION 0x3 + enum scmi_reset_domain_message_id { SCMI_RESET_DOMAIN_ATTRIBUTES = 0x3, SCMI_RESET_DOMAIN_RESET = 0x4, @@ -569,6 +573,8 @@ struct scmi_rd_reset_out { * SCMI Voltage Domain Protocol */ +#define SCMI_VOLTDOM_PROTOCOL_VERSION 0x2 + enum scmi_voltage_domain_message_id { SCMI_VOLTAGE_DOMAIN_ATTRIBUTES = 0x3, SCMI_VOLTAGE_DOMAIN_CONFIG_SET = 0x5, -- 2.41.0
[RFC 2/3] firmware: scmi: add PROTOCOL_VERSION support for existing protocols on sandbox
In the next patch, SCMI_PROTOCOL_VERSION support is added on the existing SCMI protocols and the version check will be introduced. To finish "ut dm scmi_[clocks|resets|voltage_domains]" tests, sandbox SCMI agent should also implement/mimic this command. Signed-off-by: AKASHI Takahiro --- drivers/firmware/scmi/sandbox-scmi_agent.c | 80 ++ 1 file changed, 80 insertions(+) diff --git a/drivers/firmware/scmi/sandbox-scmi_agent.c b/drivers/firmware/scmi/sandbox-scmi_agent.c index ab8afb01de40..a99fcb0ad4a9 100644 --- a/drivers/firmware/scmi/sandbox-scmi_agent.c +++ b/drivers/firmware/scmi/sandbox-scmi_agent.c @@ -43,6 +43,10 @@ #define SANDBOX_SCMI_AGENT_NAME "OSPM" #define SANDBOX_SCMI_PLATFORM_NAME "platform" +#define SANDBOX_SCMI_CLOCK_PROTOCOL_VERSION SCMI_CLOCK_PROTOCOL_VERSION +#define SANDBOX_SCMI_RD_PROTOCOL_VERSION SCMI_RESETDOM_PROTOCOL_VERSION +#define SANDBOX_SCMI_VOLTD_PROTOCOL_VERSION SCMI_VOLTDOM_PROTOCOL_VERSION + static u8 protocols[] = { SCMI_PROTOCOL_ID_CLOCK, SCMI_PROTOCOL_ID_RESET_DOMAIN, @@ -440,6 +444,28 @@ static int sandbox_scmi_base_reset_agent_configuration(struct udevice *dev, /* Clock Protocol */ +/** + * sandbox_scmi_clock_protocol_version - implement SCMI_PROTOCOL_VERSION + * @udevice: SCMI device + * @msg: SCMI message + * + * Implement SCMI_PROTOCOL_VERSION command. + */ +static int sandbox_scmi_clock_protocol_version(struct udevice *dev, + struct scmi_msg *msg) +{ + struct scmi_protocol_version_out *out = NULL; + + if (!msg->out_msg || msg->out_msg_sz < sizeof(*out)) + return -EINVAL; + + out = (struct scmi_protocol_version_out *)msg->out_msg; + out->version = SANDBOX_SCMI_CLOCK_PROTOCOL_VERSION; + out->status = SCMI_SUCCESS; + + return 0; +} + static int sandbox_scmi_clock_protocol_attribs(struct udevice *dev, struct scmi_msg *msg) { @@ -577,6 +603,30 @@ static int sandbox_scmi_clock_gate(struct udevice *dev, struct scmi_msg *msg) return 0; } +/* Reset Domain Protocol */ + +/** + * sandbox_scmi_rd_protocol_version - implement SCMI_PROTOCOL_VERSION + * @udevice: SCMI device + * @msg: SCMI message + * + * Implement SCMI_PROTOCOL_VERSION command. + */ +static int sandbox_scmi_rd_protocol_version(struct udevice *dev, + struct scmi_msg *msg) +{ + struct scmi_protocol_version_out *out = NULL; + + if (!msg->out_msg || msg->out_msg_sz < sizeof(*out)) + return -EINVAL; + + out = (struct scmi_protocol_version_out *)msg->out_msg; + out->version = SANDBOX_SCMI_RD_PROTOCOL_VERSION; + out->status = SCMI_SUCCESS; + + return 0; +} + static int sandbox_scmi_rd_attribs(struct udevice *dev, struct scmi_msg *msg) { struct scmi_rd_attr_in *in = NULL; @@ -647,6 +697,30 @@ static int sandbox_scmi_rd_reset(struct udevice *dev, struct scmi_msg *msg) return 0; } +/* Voltage Domain Protocol */ + +/** + * sandbox_scmi_voltd_protocol_version - implement SCMI_PROTOCOL_VERSION + * @udevice: SCMI device + * @msg: SCMI message + * + * Implement SCMI_PROTOCOL_VERSION command. + */ +static int sandbox_scmi_voltd_protocol_version(struct udevice *dev, + struct scmi_msg *msg) +{ + struct scmi_protocol_version_out *out = NULL; + + if (!msg->out_msg || msg->out_msg_sz < sizeof(*out)) + return -EINVAL; + + out = (struct scmi_protocol_version_out *)msg->out_msg; + out->version = SANDBOX_SCMI_VOLTD_PROTOCOL_VERSION; + out->status = SCMI_SUCCESS; + + return 0; +} + static int sandbox_scmi_voltd_attribs(struct udevice *dev, struct scmi_msg *msg) { struct scmi_voltd_attr_in *in = NULL; @@ -833,6 +907,8 @@ static int sandbox_scmi_test_process_msg(struct udevice *dev, break; case SCMI_PROTOCOL_ID_CLOCK: switch (msg->message_id) { + case SCMI_PROTOCOL_VERSION: + return sandbox_scmi_clock_protocol_version(dev, msg); case SCMI_PROTOCOL_ATTRIBUTES: return sandbox_scmi_clock_protocol_attribs(dev, msg); case SCMI_CLOCK_ATTRIBUTES: @@ -849,6 +925,8 @@ static int sandbox_scmi_test_process_msg(struct udevice *dev, break; case SCMI_PROTOCOL_ID_RESET_DOMAIN: switch (msg->message_id) { + case SCMI_PROTOCOL_VERSION: + return sandbox_scmi_rd_protocol_version(dev, msg); case SCMI_RESET_DOMAIN_ATTRIBUTES: return sandbox_scmi_rd_attribs(dev, msg); case SCMI_RESET_DOMAIN_RESET: @@ -859,6 +937,8 @@ static int sandbox_scmi_test_process_msg(struct udevice *dev, break; case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
[RFC 1/3] firmware: scmi: add a check against availability of protocols
Now that we have Base protocol support, we will be able to check if a given protocol is really supported by the SCMI server (firmware). Signed-off-by: AKASHI Takahiro --- drivers/firmware/scmi/scmi_agent-uclass.c | 41 +-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/scmi/scmi_agent-uclass.c b/drivers/firmware/scmi/scmi_agent-uclass.c index 91cb172f3005..9494dca95bca 100644 --- a/drivers/firmware/scmi/scmi_agent-uclass.c +++ b/drivers/firmware/scmi/scmi_agent-uclass.c @@ -44,6 +44,38 @@ static const struct error_code scmi_linux_errmap[] = { */ struct udevice *scmi_agent; +/** + * scmi_protocol_is_supported - check availability of protocol + * @dev: SCMI agent device + * @proto_id: Identifier of protocol + * + * check if the protocol, @proto_id, is provided by the SCMI agent, + * @dev. + * + * Return: 0 on success, error code otherwise + */ +static bool scmi_protocol_is_supported(struct udevice *dev, + enum scmi_std_protocol proto_id) +{ + struct scmi_agent_priv *priv; + int i; + + if (proto_id == SCMI_PROTOCOL_ID_BASE) + return true; + + priv = dev_get_uclass_plat(dev); + if (!priv) { + dev_err(dev, "No priv data found\n"); + return false; + } + + for (i = 0; i < priv->num_protocols; i++) + if (priv->protocols[i] == proto_id) + return true; + + return false; +} + struct udevice *scmi_get_protocol(struct udevice *dev, enum scmi_std_protocol id) { @@ -372,15 +404,18 @@ static int scmi_bind_protocols(struct udevice *dev) name = ofnode_get_name(node); switch (protocol_id) { case SCMI_PROTOCOL_ID_CLOCK: - if (CONFIG_IS_ENABLED(CLK_SCMI)) + if (CONFIG_IS_ENABLED(CLK_SCMI) && + scmi_protocol_is_supported(dev, protocol_id)) drv = DM_DRIVER_GET(scmi_clock); break; case SCMI_PROTOCOL_ID_RESET_DOMAIN: - if (IS_ENABLED(CONFIG_RESET_SCMI)) + if (IS_ENABLED(CONFIG_RESET_SCMI) && + scmi_protocol_is_supported(dev, protocol_id)) drv = DM_DRIVER_GET(scmi_reset_domain); break; case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN: - if (IS_ENABLED(CONFIG_DM_REGULATOR_SCMI)) { + if (IS_ENABLED(CONFIG_DM_REGULATOR_SCMI) && + scmi_protocol_is_supported(dev, protocol_id)) { node = ofnode_find_subnode(node, "regulators"); if (!ofnode_valid(node)) { dev_err(dev, "no regulators node\n"); -- 2.41.0
[RFC 0/3] firmware: scmi: add sanity checks for protocols
Now that we have the Base protocol support, we will be able to add a couple of checks so that we will make sure that U-Boot scmi drivers work as expected. - check if SCMI server (firmware) supports the protocol - check if SCMI server implements an expected version of protocol Although adding these checks was one of my objectives in supporting the Base protocol, this patch series is marked as RFC for now because I have no confidence about what exact version the existing drivers are based on. (I temporarily assigned the version numbers in [1].) Test The patch series was tested on the following platforms: * sandbox Prerequisite: = * This patch series is based on my previous patch of base protocol support[1] [1] https://lists.denx.de/pipermail/u-boot/2023-July/524811.html Change history: === RFC (Jul, 28, 2023) * initial release AKASHI Takahiro (3): firmware: scmi: add a check against availability of protocols firmware: scmi: add PROTOCOL_VERSION support for existing protocols on sandbox firmware: scmi: add a sanity check against protocol version drivers/clk/clk_scmi.c | 6 ++ drivers/firmware/scmi/sandbox-scmi_agent.c | 80 ++ drivers/firmware/scmi/scmi_agent-uclass.c | 41 ++- drivers/power/regulator/scmi_regulator.c | 6 ++ drivers/reset/reset-scmi.c | 14 +++- include/scmi_protocols.h | 6 ++ 6 files changed, 149 insertions(+), 4 deletions(-) -- 2.41.0
Re: [PATCH v4 32/45] fs: fat: Support reading from a larger block size
Hi Bin, On Wed, 19 Jul 2023 at 01:58, Bin Meng wrote: > > Hi Simon, > > On Wed, Jul 19, 2023 at 9:11 AM Simon Glass wrote: > > > > Hi Bin, > > > > On Sun, 16 Jul 2023 at 09:19, Bin Meng wrote: > > > > > > Hi Simon, > > > > > > On Sun, Jul 16, 2023 at 7:42 AM Simon Glass wrote: > > > > > > > > Hi Bin, > > > > > > > > On Thu, 13 Jul 2023 at 04:49, Bin Meng wrote: > > > > > > > > > > Hi Simon, > > > > > > > > > > On Mon, Jun 19, 2023 at 8:02 PM Simon Glass wrote: > > > > > > > > > > > > At present it is not possible to read from some CDROM drives since > > > > > > the > > > > > > FAT sector size does not match the media's block size. Add a > > > > > > conversion > > > > > > option for this, so that reading is possible. > > > > > > > > > > I am completely confused. The CDROM uses iso9660 file system. This has > > > > > nothing to do with FAT. > > > > > > > > It actually can use both - this is the -cdrom option in QEMU which can > > > > emulate an old-style CDROM, with a FAT filesystem on it! > > > > > > > > > > What QEMU command line is this to enable a CDROM with FAT file system? > > > > > > If that is the case, what you changed in this commit only works with > > > QEMU, not with any real-world devices, I believe? > > > > > > Could you use iso9660 instead? > > > > Sure, but the image I am using has an MSDOS partition name, an EFI > > partition table, a FAT filesystem and an ISO9660 filesystem! I was > > trying to look at the FAT filesystem via the MSDOS partition table. > > > > Is that a released installer iso that I can download somewhere? > > Which QEMU command line should I use for reproducing the issue? Here is what I did: qemu-system-x86_64 -m 2G -smp 4 -bios /tmp/b/qemu-x86/u-boot.rom -cdrom /vid/software/linux/debian/debian-11.5.0-i386-DVD-1.iso -serial mon:stdio => part set ide 2 iso Partition Map for IDE device 2 -- Partition Type: ISO Part Start Sect x Size Type 1 69121 2048 U-Boot 2 5912 1000 2048 U-Boot => ls ide 2:2 FAT sector size mismatch (fs=512, dev=2048): translating for read-only efi/ 160 ubootefi.var 1 file(s), 1 dir(s) => Without this patch we cannot enable translation and it is not possible to read the files. Regards, Simon
[PATCH V2 2/5] arm: dts: Add k3-am625-beagleplay
From: Robert Nelson BeagleBoard.org BeaglePlay is an easy to use, affordable open source hardware single board computer based on the Texas Instruments AM625 SoC that allows you to create connected devices that work even at long distances using IEEE 802.15.4g LR-WPAN and IEEE 802.3cg 10Base-T1L. Expansion is provided over open standards based mikroBUS, Grove and QWIIC headers among other interfaces. This board family can be identified by the 24c32 eeprom: [aa 55 33 ee 01 37 00 10 2e 00 42 45 41 47 4c 45 |.U3..7BEAGLE|] [50 4c 41 59 2d 41 30 2d 00 00 30 32 30 30 37 38 |PLAY-A0-..020078|] https://beagleplay.org/ https://git.beagleboard.org/beagleplay/beagleplay baseline of base device tree is v6.5-rc1. Reviewed-by: Tom Rini Signed-off-by: Robert Nelson Co-developed-by: Nishanth Menon Signed-off-by: Nishanth Menon --- Changes since V1: - None V1: https://lore.kernel.org/all/20230725185253.2123433-5...@ti.com/ arch/arm/dts/Makefile |4 +- .../dts/k3-am625-beagleplay-ddr4-1600MTs.dtsi | 2195 + arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi | 172 ++ arch/arm/dts/k3-am625-beagleplay.dts | 758 ++ arch/arm/dts/k3-am625-r5-beagleplay.dts | 87 + 5 files changed, 3215 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/k3-am625-beagleplay-ddr4-1600MTs.dtsi create mode 100644 arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi create mode 100644 arch/arm/dts/k3-am625-beagleplay.dts create mode 100644 arch/arm/dts/k3-am625-r5-beagleplay.dts diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index b7780de776b6..1c83a2a576c3 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -1304,7 +1304,9 @@ dtb-$(CONFIG_SOC_K3_AM642) += k3-am642-evm.dtb \ k3-am642-r5-sk.dtb dtb-$(CONFIG_SOC_K3_AM625) += k3-am625-sk.dtb \ - k3-am625-r5-sk.dtb + k3-am625-r5-sk.dtb \ + k3-am625-beagleplay.dtb \ + k3-am625-r5-beagleplay.dtb dtb-$(CONFIG_SOC_K3_AM62A7) += k3-am62a7-sk.dtb \ k3-am62a7-r5-sk.dtb diff --git a/arch/arm/dts/k3-am625-beagleplay-ddr4-1600MTs.dtsi b/arch/arm/dts/k3-am625-beagleplay-ddr4-1600MTs.dtsi new file mode 100644 index ..3d7a41c27d7e --- /dev/null +++ b/arch/arm/dts/k3-am625-beagleplay-ddr4-1600MTs.dtsi @@ -0,0 +1,2195 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * https://beagleboard.org/play + * + * Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/ + * Copyright (C) 2022-2023 Robert Nelson, BeagleBoard.org Foundation + * + * This file was generated with the + * AM62x SysConfig DDR Subsystem Register Configuration Tool v0.09.06 + * Thu Feb 09 2023 11:57:18 GMT-0600 (Central Standard Time) + * DDR Part number: K4AAG165WA-BCWE K4A4G165WF-BCTD + * DDR Type: DDR4 + * Frequency = 800MHz (1600MTs) + * Density: 16Gb + * Number of Ranks: 1 + */ + +#define DDRSS_PLL_FHS_CNT 6 +#define DDRSS_PLL_FREQUENCY_1 4 +#define DDRSS_PLL_FREQUENCY_2 4 + +#define DDRSS_CTL_0_DATA 0x0A00 +#define DDRSS_CTL_1_DATA 0x +#define DDRSS_CTL_2_DATA 0x +#define DDRSS_CTL_3_DATA 0x +#define DDRSS_CTL_4_DATA 0x +#define DDRSS_CTL_5_DATA 0x +#define DDRSS_CTL_6_DATA 0x +#define DDRSS_CTL_7_DATA 0x000890B8 +#define DDRSS_CTL_8_DATA 0x +#define DDRSS_CTL_9_DATA 0x +#define DDRSS_CTL_10_DATA 0x +#define DDRSS_CTL_11_DATA 0x000890B8 +#define DDRSS_CTL_12_DATA 0x +#define DDRSS_CTL_13_DATA 0x +#define DDRSS_CTL_14_DATA 0x +#define DDRSS_CTL_15_DATA 0x000890B8 +#define DDRSS_CTL_16_DATA 0x +#define DDRSS_CTL_17_DATA 0x +#define DDRSS_CTL_18_DATA 0x +#define DDRSS_CTL_19_DATA 0x01010100 +#define DDRSS_CTL_20_DATA 0x01000100 +#define DDRSS_CTL_21_DATA 0x01000110 +#define DDRSS_CTL_22_DATA 0x02010002 +#define DDRSS_CTL_23_DATA 0x00027100 +#define DDRSS_CTL_24_DATA 0x00061A80 +#define DDRSS_CTL_25_DATA 0x04000400 +#define DDRSS_CTL_26_DATA 0x0400 +#define DDRSS_CTL_27_DATA 0x +#define DDRSS_CTL_28_DATA 0x +#define DDRSS_CTL_29_DATA 0x +#define DDRSS_CTL_30_DATA 0x +#define DDRSS_CTL_31_DATA 0x +#define DDRSS_CTL_32_DATA 0x +#define DDRSS_CTL_33_DATA 0x +#define DDRSS_CTL_34_DATA 0x +#define DDRSS_CTL_35_DATA 0x +#define DDRSS_CTL_36_DATA 0x +#define DDRSS_CTL_37_DATA 0x +#define DDRSS_CTL_38_DATA 0x0400091C +#define DDRSS_CTL_39_DATA 0x1C1C1C1C +#define DDRSS_CTL_40_DATA 0x0400091C +#define DDRSS_CTL_41_DATA 0x1C1C1C1C +#define DDRSS_CTL_42_DATA 0x0400091C +#define DDRSS_CTL_43_DATA 0x1C1C1C1C +#define DDRSS_CTL_44_DATA 0x05050404 +#define DDRSS_CTL_45_DATA 0x2706 +#define DDRSS_CTL_46_DATA 0x0602001D +#define DDRSS_CTL_47_DATA 0x05001D0B +#define DDRSS_CTL_48_DATA 0x00270605 +#define
[PATCH V2 5/5] TMP: board: ti: am62x: Switch over to config fragments
Removes the largely duplicated A53 and R5 defconfigs and reuses the am62x_evm_*_defconfig with minor platform specific changes. Cc: Simon Glass Signed-off-by: Nishanth Menon --- New Patch This depends on the RFC (and hence "TMP") and debated upon patch (to introduce config fragments) https://lore.kernel.org/all/20230711212048.1340990-2-j-kaci...@ti.com/ But this can be fixed up if the fragments support is getting into master (even if buildman follows later). board/ti/am62x/beagleplay_a53.config | 20 + board/ti/am62x/beagleplay_r5.config| 11 +++ configs/am62x_beagleplay_a53_defconfig | 90 configs/am62x_beagleplay_r5_defconfig | 110 - doc/board/ti/am62x_beagleplay.rst | 4 +- 5 files changed, 33 insertions(+), 202 deletions(-) create mode 100644 board/ti/am62x/beagleplay_a53.config create mode 100644 board/ti/am62x/beagleplay_r5.config delete mode 100644 configs/am62x_beagleplay_a53_defconfig delete mode 100644 configs/am62x_beagleplay_r5_defconfig diff --git a/board/ti/am62x/beagleplay_a53.config b/board/ti/am62x/beagleplay_a53.config new file mode 100644 index ..4889e1bc6f2b --- /dev/null +++ b/board/ti/am62x/beagleplay_a53.config @@ -0,0 +1,20 @@ +# Defconfig fragment to apply on top of am62x_evm_a53_defconfig + +CONFIG_DEFAULT_DEVICE_TREE="k3-am625-beagleplay" +CONFIG_OF_LIST="k3-am625-beagleplay" +CONFIG_SPL_OF_LIST="k3-am625-beagleplay" +CONFIG_BOOTCOMMAND="run findfdt; run envboot; run distro_bootcmd" +CONFIG_EXT4_WRITE=y +CONFIG_LZO=y +CONFIG_AUTOBOOT_KEYED=y +CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n" +CONFIG_AUTOBOOT_DELAY_STR="d" +CONFIG_AUTOBOOT_STOP_STR=" " +# Uses Realtek phy rather than TI phy +CONFIG_PHY_TI_DP83867=n +CONFIG_PHY_REALTEK=y +# No SPI flash on Beagleplay +CONFIG_SPI=n +CONFIG_SPI_FLASH=n +CONFIG_SPL_DM_SPI_FLASH=n +CONFIG_SPL_SPI_FLASH_SUPPORT=n diff --git a/board/ti/am62x/beagleplay_r5.config b/board/ti/am62x/beagleplay_r5.config new file mode 100644 index ..ce64561bee92 --- /dev/null +++ b/board/ti/am62x/beagleplay_r5.config @@ -0,0 +1,11 @@ +# Defconfig fragment to apply on top of: +# am62x_evm_r5_defconfig +# +CONFIG_DEFAULT_DEVICE_TREE="k3-am625-r5-beagleplay" +CONFIG_OF_LIST="k3-am625-r5-beagleplay" +CONFIG_SPL_OF_LIST="k3-am625-r5-beagleplay" +# No SPI flash on Beagleplay +CONFIG_SPI=n +CONFIG_SPI_FLASH=n +CONFIG_SPL_DM_SPI_FLASH=n +CONFIG_SPL_SPI_FLASH_SUPPORT=n diff --git a/configs/am62x_beagleplay_a53_defconfig b/configs/am62x_beagleplay_a53_defconfig deleted file mode 100644 index e45cb2782579.. --- a/configs/am62x_beagleplay_a53_defconfig +++ /dev/null @@ -1,90 +0,0 @@ -CONFIG_ARM=y -CONFIG_ARCH_K3=y -CONFIG_TI_SECURE_DEVICE=y -CONFIG_SYS_MALLOC_F_LEN=0x8000 -CONFIG_SPL_LIBCOMMON_SUPPORT=y -CONFIG_SPL_LIBGENERIC_SUPPORT=y -CONFIG_NR_DRAM_BANKS=2 -CONFIG_SOC_K3_AM625=y -CONFIG_K3_ATF_LOAD_ADDR=0x9e78 -CONFIG_TARGET_AM625_A53_EVM=y -CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y -CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80b8 -CONFIG_SPL_DM_SPI=y -CONFIG_DEFAULT_DEVICE_TREE="k3-am625-beagleplay" -CONFIG_SPL_TEXT_BASE=0x8008 -CONFIG_OF_LIBFDT_OVERLAY=y -CONFIG_DM_RESET=y -CONFIG_SPL_MMC=y -CONFIG_SPL_SERIAL=y -CONFIG_SPL_STACK_R_ADDR=0x8200 -CONFIG_SPL_SIZE_LIMIT=0x4 -CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x800 -CONFIG_SPL_FS_FAT=y -CONFIG_SPL_LIBDISK_SUPPORT=y -CONFIG_SPL_SPI=y -# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set -CONFIG_SPL_LOAD_FIT=y -CONFIG_SPL_LOAD_FIT_ADDRESS=0x8100 -CONFIG_DISTRO_DEFAULTS=y -CONFIG_AUTOBOOT_KEYED=y -CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n" -CONFIG_AUTOBOOT_DELAY_STR="d" -CONFIG_AUTOBOOT_STOP_STR=" " -CONFIG_BOOTCOMMAND="run findfdt; run envboot; run distro_bootcmd" -CONFIG_SPL_HAS_BSS_LINKER_SECTION=y -CONFIG_SPL_BSS_START_ADDR=0x80c8 -CONFIG_SPL_BSS_MAX_SIZE=0x8 -CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y -CONFIG_SPL_SYS_MALLOC_SIMPLE=y -CONFIG_SPL_STACK_R=y -CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y -CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400 -CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img" -CONFIG_SPL_DM_MAILBOX=y -CONFIG_SPL_POWER_DOMAIN=y -CONFIG_SPL_YMODEM_SUPPORT=y -CONFIG_SYS_BOOTM_LEN=0x80 -CONFIG_CMD_MMC=y -CONFIG_OF_CONTROL=y -CONFIG_SPL_OF_CONTROL=y -CONFIG_MULTI_DTB_FIT=y -CONFIG_SPL_MULTI_DTB_FIT=y -CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y -CONFIG_NET_RANDOM_ETHADDR=y -CONFIG_SPL_DM=y -CONFIG_SPL_DM_SEQ_ALIAS=y -CONFIG_REGMAP=y -CONFIG_SPL_REGMAP=y -CONFIG_SPL_OF_TRANSLATE=y -CONFIG_CLK=y -CONFIG_SPL_CLK=y -CONFIG_CLK_TI_SCI=y -CONFIG_DMA_CHANNELS=y -CONFIG_TI_K3_NAVSS_UDMA=y -CONFIG_TI_SCI_PROTOCOL=y -CONFIG_DM_MAILBOX=y -CONFIG_K3_SEC_PROXY=y -CONFIG_MMC_SDHCI=y -CONFIG_MMC_SDHCI_ADMA=y -CONFIG_SPL_MMC_SDHCI_ADMA=y -CONFIG_MMC_SDHCI_AM654=y -CONFIG_PHY=y -CONFIG_PINCTRL=y -CONFIG_SPL_PINCTRL=y -CONFIG_PINCTRL_SINGLE=y -CONFIG_POWER_DOMAIN=y -CONFIG_TI_SCI_POWER_DOMAIN=y -CONFIG_K3_SYSTEM_CONTROLLER=y
[PATCH V2 4/5] doc: board: ti: Add BeaglePlay documentation
Add base documentation for BeaglePlay Signed-off-by: Nishanth Menon --- Changes Since V1: - Dependency added on top of doc cleanup https://lore.kernel.org/all/20230727185902.3310543-1...@ti.com/ - Mostly rewrite.. hopefully for the better V1: https://lore.kernel.org/all/20230725185253.2123433-7...@ti.com/ doc/board/ti/am62x_beagleplay.rst | 120 ++ doc/board/ti/k3.rst | 1 + 2 files changed, 121 insertions(+) create mode 100644 doc/board/ti/am62x_beagleplay.rst diff --git a/doc/board/ti/am62x_beagleplay.rst b/doc/board/ti/am62x_beagleplay.rst new file mode 100644 index ..b97d8cead7fb --- /dev/null +++ b/doc/board/ti/am62x_beagleplay.rst @@ -0,0 +1,120 @@ +.. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause +.. sectionauthor:: Nishanth Menon + +Beagleboard.org Beagleplay +== + +Introduction: +- + +BeagleBoard.org BeaglePlay is an easy to use, affordable open source +hardware single board computer based on the Texas Instruments AM625 +SoC that allows you to create connected devices that work even at long +distances using IEEE 802.15.4g LR-WPAN and IEEE 802.3cg 10Base-T1L. +Expansion is provided over open standards based mikroBUS, Grove and +QWIIC headers among other interfaces. + +Further information can be found at: +https://beagleplay.org/ +https://git.beagleboard.org/beagleplay/beagleplay + +Boot Flow: +-- +Below is the pictorial representation of boot flow: + +.. image:: img/boot_diagram_k3_current.svg + +- On this platform, 'TI Foundational Security' (TIFS) functions as the + security enclave master while 'Device Manager' (DM), also known as the + 'TISCI server' in "TI terminology", offers all the essential services. + The A53/M4F (Aux core) sends requests to TIFS/DM to accomplish these + services, as illustrated in the diagram above. + +Sources: + +.. include:: k3.rst +:start-after: .. k3_rst_include_start_boot_sources +:end-before: .. k3_rst_include_end_boot_sources + +Build procedure: + +0. Setup the environment variables: + +.. include:: k3.rst +:start-after: .. k3_rst_include_start_common_env_vars_desc +:end-before: .. k3_rst_include_end_common_env_vars_desc + +.. include:: k3.rst +:start-after: .. k3_rst_include_start_board_env_vars_desc +:end-before: .. k3_rst_include_end_board_env_vars_desc + +Set the variables corresponding to this platform: + +.. include:: k3.rst +:start-after: .. k3_rst_include_start_common_env_vars_defn +:end-before: .. k3_rst_include_end_common_env_vars_defn +.. code-block:: bash + + $ export UBOOT_CFG_CORTEXR=am62x_beagleplay_r5_defconfig + $ export UBOOT_CFG_CORTEXA=am62x_beagleplay_a53_defconfig + $ export TFA_BOARD=lite + $ # we dont use any extra TFA parameters + $ unset TFA_EXTRA_ARGS + $ export OPTEE_PLATFORM=k3-am62x + $ export OPTEE_EXTRA_ARGS="CFG_WITH_SOFTWARE_PRNG=y" + +.. include:: am62x_sk.rst +:start-after: .. am62x_evm_rst_include_start_build_steps +:end-before: .. am62x_evm_rst_include_end_build_steps + +Target Images +-- +Copy the below images to an SD card and boot: + +* tiboot3-am62x-gp-evm.bin from R5 build as tiboot3.bin +* tispl.bin_unsigned from Cortex-A build as tispl.bin +* u-boot.img_unsigned from Cortex-A build as uboot.img + +Image formats: +-- + +- tiboot3.bin + +.. image:: img/multi_cert_tiboot3.bin.svg + +- tispl.bin + +.. image:: img/dm_tispl.bin.svg + +A53 SPL DDR Memory Layout +- + +.. include:: am62x_sk.rst +:start-after: .. am62x_evm_rst_include_start_ddr_mem_layout +:end-before: .. am62x_evm_rst_include_end_ddr_mem_layout + +Switch Setting for Boot Mode + + +The boot time option is configured via "USR" button on the board. +See https://git.beagleboard.org/beagleplay/beagleplay/-/blob/main/BeaglePlay_sch.pdf +for details. + +.. list-table:: Boot Modes + :widths: 16 16 16 + :header-rows: 1 + + * - USR Switch Position + - Primary Boot + - Secondary Boot + + * - Not Pressed + - eMMC + - UART + + * - Pressed + - SD/MMC File System (FS) mode + - USB Device Firmware Upgrade (DFU) mode + +To switch to SD card boot mode, hold the USR button while powering on +with Type-C power supply, then release when power LED lights up. diff --git a/doc/board/ti/k3.rst b/doc/board/ti/k3.rst index 9d40675b6007..2876ec842a18 100644 --- a/doc/board/ti/k3.rst +++ b/doc/board/ti/k3.rst @@ -30,6 +30,7 @@ K3 Based SoCs .. toctree:: :maxdepth: 1 + am62x_beagleplay am62x_sk am65x_evm j7200_evm -- 2.40.0
[PATCH V2 0/5] board: ti: Add support for BeaglePlay
Add support for BeaglePlay - rev 2 Boot log: https://gist.github.com/nmenon/bee1ab7cbfd188574cfb843e336fbe40 Full series(including dependencies) can be found at: https://github.com/nmenon/fix-k3-dt-u-boot/commits/beagleplay-v2.2 Depends on: a) https://lore.kernel.org/all/20230727090331.2834463-1...@ti.com/ (with it's dependencies) b) https://lore.kernel.org/all/20230727185902.3310543-1...@ti.com/ (for the documentation patch) c) The last patch in the series (labelled TMP), depends on the RFC and debated upon patch (to introduce config fragments) https://lore.kernel.org/all/20230711212048.1340990-2-j-kaci...@ti.com/ Caveats: * I have kept networking out of picture for now as it is still evolving. Changes since V1: * I moved the documentation patches over to the documentation improvement series * Fixes the documentation comments provided and reworked wording a bit * Dropped the controversial voltage and 32k settings patch for now while we figure out how to get it in properly * Added config fragments as an add-on patch - I'd rather see us migrate there at some near term point. V1: https://lore.kernel.org/all/20230725185253.2123433-1...@ti.com/ Nishanth Menon (4): arm: dts: k3-am625-sk-binman: Add labels for unsigned binary configs: Add am62x_beagleplay_* defconfigs doc: board: ti: Add BeaglePlay documentation TMP: board: ti: am62x: Switch over to config fragments Robert Nelson (1): arm: dts: Add k3-am625-beagleplay arch/arm/dts/Makefile |4 +- .../dts/k3-am625-beagleplay-ddr4-1600MTs.dtsi | 2195 + arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi | 172 ++ arch/arm/dts/k3-am625-beagleplay.dts | 758 ++ arch/arm/dts/k3-am625-r5-beagleplay.dts | 87 + arch/arm/dts/k3-am625-sk-binman.dtsi |4 +- board/ti/am62x/beagleplay_a53.config | 20 + board/ti/am62x/beagleplay_r5.config | 11 + doc/board/ti/am62x_beagleplay.rst | 120 + doc/board/ti/k3.rst |1 + 10 files changed, 3369 insertions(+), 3 deletions(-) create mode 100644 arch/arm/dts/k3-am625-beagleplay-ddr4-1600MTs.dtsi create mode 100644 arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi create mode 100644 arch/arm/dts/k3-am625-beagleplay.dts create mode 100644 arch/arm/dts/k3-am625-r5-beagleplay.dts create mode 100644 board/ti/am62x/beagleplay_a53.config create mode 100644 board/ti/am62x/beagleplay_r5.config create mode 100644 doc/board/ti/am62x_beagleplay.rst -- 2.40.0
[PATCH V2 1/5] arm: dts: k3-am625-sk-binman: Add labels for unsigned binary
Add labels for unsigned binary to permit over-ride. Cc: Simon Glass Signed-off-by: Nishanth Menon --- I think we might also want to review Neha's approach in RFC stage if this is not acceptable, but I suspect other boards will have similar challenges: https://lore.kernel.org/all/20230727121205.405956-1-n-fran...@ti.com/ Changes since V1: None V1: https://lore.kernel.org/all/20230725185253.2123433-3...@ti.com/ arch/arm/dts/k3-am625-sk-binman.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/dts/k3-am625-sk-binman.dtsi b/arch/arm/dts/k3-am625-sk-binman.dtsi index a35d6418c25f..41277bf4bfdb 100644 --- a/arch/arm/dts/k3-am625-sk-binman.dtsi +++ b/arch/arm/dts/k3-am625-sk-binman.dtsi @@ -389,7 +389,7 @@ type = "flat_dt"; arch = "arm"; compression = "none"; - blob { + spl_am625_sk_dtb_unsigned: blob { filename = SPL_AM625_SK_DTB; }; }; @@ -438,7 +438,7 @@ type = "flat_dt"; arch = "arm"; compression = "none"; - blob { + am625_sk_dtb_unsigned: blob { filename = AM625_SK_DTB; }; hash { -- 2.40.0
[PATCH V2 3/5] configs: Add am62x_beagleplay_* defconfigs
Add defconfigs for am625 based beagleplay Signed-off-by: Nishanth Menon --- Changes since V1: - None V1: https://lore.kernel.org/all/20230725185253.2123433-6...@ti.com/ configs/am62x_beagleplay_a53_defconfig | 90 configs/am62x_beagleplay_r5_defconfig | 110 + 2 files changed, 200 insertions(+) create mode 100644 configs/am62x_beagleplay_a53_defconfig create mode 100644 configs/am62x_beagleplay_r5_defconfig diff --git a/configs/am62x_beagleplay_a53_defconfig b/configs/am62x_beagleplay_a53_defconfig new file mode 100644 index ..e45cb2782579 --- /dev/null +++ b/configs/am62x_beagleplay_a53_defconfig @@ -0,0 +1,90 @@ +CONFIG_ARM=y +CONFIG_ARCH_K3=y +CONFIG_TI_SECURE_DEVICE=y +CONFIG_SYS_MALLOC_F_LEN=0x8000 +CONFIG_SPL_LIBCOMMON_SUPPORT=y +CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_NR_DRAM_BANKS=2 +CONFIG_SOC_K3_AM625=y +CONFIG_K3_ATF_LOAD_ADDR=0x9e78 +CONFIG_TARGET_AM625_A53_EVM=y +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80b8 +CONFIG_SPL_DM_SPI=y +CONFIG_DEFAULT_DEVICE_TREE="k3-am625-beagleplay" +CONFIG_SPL_TEXT_BASE=0x8008 +CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y +CONFIG_SPL_MMC=y +CONFIG_SPL_SERIAL=y +CONFIG_SPL_STACK_R_ADDR=0x8200 +CONFIG_SPL_SIZE_LIMIT=0x4 +CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x800 +CONFIG_SPL_FS_FAT=y +CONFIG_SPL_LIBDISK_SUPPORT=y +CONFIG_SPL_SPI=y +# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +CONFIG_SPL_LOAD_FIT=y +CONFIG_SPL_LOAD_FIT_ADDRESS=0x8100 +CONFIG_DISTRO_DEFAULTS=y +CONFIG_AUTOBOOT_KEYED=y +CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n" +CONFIG_AUTOBOOT_DELAY_STR="d" +CONFIG_AUTOBOOT_STOP_STR=" " +CONFIG_BOOTCOMMAND="run findfdt; run envboot; run distro_bootcmd" +CONFIG_SPL_HAS_BSS_LINKER_SECTION=y +CONFIG_SPL_BSS_START_ADDR=0x80c8 +CONFIG_SPL_BSS_MAX_SIZE=0x8 +CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y +CONFIG_SPL_SYS_MALLOC_SIMPLE=y +CONFIG_SPL_STACK_R=y +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400 +CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img" +CONFIG_SPL_DM_MAILBOX=y +CONFIG_SPL_POWER_DOMAIN=y +CONFIG_SPL_YMODEM_SUPPORT=y +CONFIG_SYS_BOOTM_LEN=0x80 +CONFIG_CMD_MMC=y +CONFIG_OF_CONTROL=y +CONFIG_SPL_OF_CONTROL=y +CONFIG_MULTI_DTB_FIT=y +CONFIG_SPL_MULTI_DTB_FIT=y +CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y +CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_SPL_DM=y +CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_REGMAP=y +CONFIG_SPL_REGMAP=y +CONFIG_SPL_OF_TRANSLATE=y +CONFIG_CLK=y +CONFIG_SPL_CLK=y +CONFIG_CLK_TI_SCI=y +CONFIG_DMA_CHANNELS=y +CONFIG_TI_K3_NAVSS_UDMA=y +CONFIG_TI_SCI_PROTOCOL=y +CONFIG_DM_MAILBOX=y +CONFIG_K3_SEC_PROXY=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_ADMA=y +CONFIG_SPL_MMC_SDHCI_ADMA=y +CONFIG_MMC_SDHCI_AM654=y +CONFIG_PHY=y +CONFIG_PINCTRL=y +CONFIG_SPL_PINCTRL=y +CONFIG_PINCTRL_SINGLE=y +CONFIG_POWER_DOMAIN=y +CONFIG_TI_SCI_POWER_DOMAIN=y +CONFIG_K3_SYSTEM_CONTROLLER=y +CONFIG_REMOTEPROC_TI_K3_ARM64=y +CONFIG_RESET_TI_SCI=y +CONFIG_DM_SERIAL=y +CONFIG_SOC_DEVICE=y +CONFIG_SOC_DEVICE_TI_K3=y +CONFIG_SOC_TI=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_TI_SCI=y +CONFIG_EXT4_WRITE=y +CONFIG_FS_FAT_MAX_CLUSTSIZE=16384 +CONFIG_LZO=y diff --git a/configs/am62x_beagleplay_r5_defconfig b/configs/am62x_beagleplay_r5_defconfig new file mode 100644 index ..acc24f46b3b4 --- /dev/null +++ b/configs/am62x_beagleplay_r5_defconfig @@ -0,0 +1,110 @@ +CONFIG_ARM=y +CONFIG_ARCH_K3=y +CONFIG_TI_SECURE_DEVICE=y +CONFIG_SYS_MALLOC_LEN=0x0800 +CONFIG_SYS_MALLOC_F_LEN=0x9000 +CONFIG_SPL_LIBCOMMON_SUPPORT=y +CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_NR_DRAM_BANKS=2 +CONFIG_SOC_K3_AM625=y +CONFIG_TARGET_AM625_R5_EVM=y +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x43c3a7f0 +CONFIG_ENV_SIZE=0x2 +CONFIG_DM_GPIO=y +CONFIG_SPL_DM_SPI=y +CONFIG_DEFAULT_DEVICE_TREE="k3-am625-r5-beagleplay" +CONFIG_SPL_TEXT_BASE=0x43c0 +CONFIG_DM_RESET=y +CONFIG_SPL_MMC=y +CONFIG_SPL_SERIAL=y +CONFIG_SPL_DRIVERS_MISC=y +CONFIG_SPL_STACK_R_ADDR=0x8200 +CONFIG_SPL_SYS_MALLOC_F_LEN=0x7000 +CONFIG_SPL_SIZE_LIMIT=0x3A7F0 +CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x3500 +CONFIG_SPL_FS_FAT=y +CONFIG_SPL_LIBDISK_SUPPORT=y +CONFIG_SPL_SPI=y +CONFIG_SPL_LOAD_FIT=y +CONFIG_SPL_LOAD_FIT_ADDRESS=0x8008 +# CONFIG_DISPLAY_CPUINFO is not set +CONFIG_SPL_SIZE_LIMIT_SUBTRACT_GD=y +CONFIG_SPL_SIZE_LIMIT_SUBTRACT_MALLOC=y +CONFIG_SPL_MAX_SIZE=0x3B000 +CONFIG_SPL_PAD_TO=0x0 +CONFIG_SPL_HAS_BSS_LINKER_SECTION=y +CONFIG_SPL_BSS_START_ADDR=0x43c3b000 +CONFIG_SPL_BSS_MAX_SIZE=0x3000 +CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y +CONFIG_SPL_SYS_MALLOC_SIMPLE=y +CONFIG_SPL_STACK_R=y +CONFIG_SPL_SEPARATE_BSS=y +CONFIG_SYS_SPL_MALLOC=y +CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y +CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x8400 +CONFIG_SYS_SPL_MALLOC_SIZE=0x100 +CONFIG_SPL_EARLY_BSS=y +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
Re: [PATCH] net: ksz9477: add support for KSZ9893 GbE switch
Hello, Can I know what are the changes required to integrate ksz9477 with Intel x86 based systems ? Regards Simon Sent from my iPhone > On Jul 27, 2023, at 1:47 PM, Tom Rini wrote: > > On Wed, Jun 28, 2023 at 04:54:45PM +0200, Karsten Wiese wrote: > >> Copy and tweak the required code from the linux kernel. >> Only the KSZ9893 has been tested. >> >> Signed-off-by: Karsten Wiese >> Reviewed-by: Ramon Fried > > Applied to u-boot/master, thanks! > > -- > Tom
[RESEND PATCH v3 3/3] arm: rpi: Switch to a text environment
Use the new environment format so we can drop most of the config.h file. Signed-off-by: Simon Glass --- (no changes since v1) board/raspberrypi/rpi/rpi.env | 77 ++ include/configs/rpi.h | 100 -- 2 files changed, 77 insertions(+), 100 deletions(-) create mode 100644 board/raspberrypi/rpi/rpi.env diff --git a/board/raspberrypi/rpi/rpi.env b/board/raspberrypi/rpi/rpi.env new file mode 100644 index ..30228285edde --- /dev/null +++ b/board/raspberrypi/rpi/rpi.env @@ -0,0 +1,77 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +/* environment for Raspberry Pi boards */ + +dhcpuboot=usb start; dhcp u-boot.uimg; bootm + +/* Environment */ +stdin=serial,usbkbd +stdout=serial,vidconsole +stderr=serial,vidconsole + +/* DFU over USB/UDC */ +#ifdef CONFIG_CMD_DFU +dfu_alt_info=u-boot.bin fat 0 1;uboot.env fat 0 1; + config.txt fat 0 1; +#ifdef CONFIG_ARM64 +dfu_alt_info+=Image fat 0 1 +#else +dfu_alt_info+=zImage fat 0 1 +#endif +#endif /* CONFIG_CMD_DFU */ + +/* + * Memory layout for where various images get loaded by boot scripts: + * + * I suspect address 0 is used as the SMP pen on the RPi2, so avoid this. + * + * Older versions of the boot firmware place the firmware-loaded DTB at 0x100, + * newer versions place it in high memory. So prevent U-Boot from doing its own + * DTB + initrd relocation so that we won't accidentally relocate the initrd + * over the firmware-loaded DTB and generally try to lay out things starting + * from the bottom of RAM. + * + * kernel_addr_r has different constraints on ARM and Aarch64. For 32-bit ARM, + * it must be within the first 128M of RAM in order for the kernel's + * CONFIG_AUTO_ZRELADDR option to work. The kernel itself will be decompressed + * to 0x8000 but the decompressor clobbers 0x4000-0x8000 as well. The + * decompressor also likes to relocate itself to right past the end of the + * decompressed kernel, so in total the sum of the compressed and + * decompressed kernel needs to be reserved. + * + * For Aarch64, the kernel image is uncompressed and must be loaded at + * text_offset bytes (specified in the header of the Image) into a 2MB + * boundary. The 'booti' command relocates the image if necessary. Linux uses + * a default text_offset of 0x8. In summary, loading at 0x8 + * satisfies all these constraints and reserving memory up to 0x0240 + * permits fairly large (roughly 36M) kernels. + * + * scriptaddr and pxefile_addr_r can be pretty much anywhere that doesn't + * conflict with something else. Reserving 1M for each of them at + * 0x0240-0x0250 and 0x0250-0x0260 should be plenty. + * + * On ARM, both the DTB and any possible initrd must be loaded such that they + * fit inside the lowmem mapping in Linux. In practice, this usually means not + * more than ~700M away from the start of the kernel image but this number can + * be larger OR smaller depending on e.g. the 'vmalloc=xxxM' command line + * parameter given to the kernel. So reserving memory from low to high + * satisfies this constraint again. Reserving 1M at 0x0260-0x0270 for + * the DTB leaves rest of the free RAM to the initrd starting at 0x0270. + * Even with the smallest possible CPU-GPU memory split of the CPU getting + * only 64M, the remaining 25M starting at 0x0270 should allow quite + * large initrds before they start colliding with U-Boot. + */ +#ifdef CONFIG_ARM64 +fdt_high= +initrd_high= +#else +fdt_high= +initrd_high= +#endif +kernel_addr_r=0x0008 +scriptaddr=0x0240 +pxefile_addr_r=0x0250 +fdt_addr_r=0x0260 +ramdisk_addr_r=0x0270 + +boot_targets=mmc usb pxe dhcp diff --git a/include/configs/rpi.h b/include/configs/rpi.h index 4160db2d8e14..8e56bdc84a89 100644 --- a/include/configs/rpi.h +++ b/include/configs/rpi.h @@ -13,8 +13,6 @@ #include #endif -/* Architecture, CPU, etc.*/ - /* Use SoC timer for AArch32, but architected timer for AArch64 */ #ifndef CONFIG_ARM64 #define CFG_SYS_TIMER_RATE 100 @@ -33,102 +31,4 @@ */ #define CFG_SYS_SDRAM_SIZE SZ_128M -/* Devices */ -/* LCD */ - -/* DFU over USB/UDC */ -#ifdef CONFIG_CMD_DFU -#ifdef CONFIG_ARM64 -#define KERNEL_FILENAME"Image" -#else -#define KERNEL_FILENAME"zImage" -#endif - -#define ENV_DFU_SETTINGS \ - "dfu_alt_info=u-boot.bin fat 0 1;uboot.env fat 0 1;" \ - "config.txt fat 0 1;" \ - KERNEL_FILENAME " fat 0 1\0" -#else -#define ENV_DFU_SETTINGS "" -#endif - -/* Console configuration */ - -/* Environment */ - -/* Shell */ - -/* Environment */ -#define ENV_DEVICE_SETTINGS \ - "stdin=serial,usbkbd\0" \ - "stdout=serial,vidconsole\0" \ - "stderr=serial,vidconsole\0" - -#ifdef CONFIG_ARM64 -#define FDT_HIGH "" -#define INITRD_HIGH "" -#else -#define FDT_HIGH "" -#define
[RESEND PATCH v3 2/3] rpi: Disable DISTRO_DEFAULTS
Disable this option to reclaim some space, since bootstd requires less functionality to operate (e.g. hush parser). Signed-off-by: Simon Glass --- (no changes since v2) Changes in v2: - Add new patch to disable DISTRO_DEFAULTS configs/rpi_0_w_defconfig | 1 - configs/rpi_2_defconfig| 1 - configs/rpi_3_32b_defconfig| 1 - configs/rpi_3_b_plus_defconfig | 1 - configs/rpi_3_defconfig| 1 - configs/rpi_4_32b_defconfig| 1 - configs/rpi_4_defconfig| 1 - configs/rpi_arm64_defconfig| 1 - configs/rpi_defconfig | 1 - 9 files changed, 9 deletions(-) diff --git a/configs/rpi_0_w_defconfig b/configs/rpi_0_w_defconfig index 7554e671e2ca..3167bfbe48f7 100644 --- a/configs/rpi_0_w_defconfig +++ b/configs/rpi_0_w_defconfig @@ -14,7 +14,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x100 CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y -CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig index 653f78bec1e8..883dab161702 100644 --- a/configs/rpi_2_defconfig +++ b/configs/rpi_2_defconfig @@ -15,7 +15,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x100 CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y -CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig index 305f1dacfd46..5ff7d987a431 100644 --- a/configs/rpi_3_32b_defconfig +++ b/configs/rpi_3_32b_defconfig @@ -14,7 +14,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x100 CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y -CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set diff --git a/configs/rpi_3_b_plus_defconfig b/configs/rpi_3_b_plus_defconfig index f36f1258aa6d..31f2a6eb310c 100644 --- a/configs/rpi_3_b_plus_defconfig +++ b/configs/rpi_3_b_plus_defconfig @@ -13,7 +13,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x100 CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y -CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig index a0d8be42537f..fa6e1507d640 100644 --- a/configs/rpi_3_defconfig +++ b/configs/rpi_3_defconfig @@ -13,7 +13,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x100 CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y -CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig index 71f61c52e52d..55bf6c0770f0 100644 --- a/configs/rpi_4_32b_defconfig +++ b/configs/rpi_4_32b_defconfig @@ -13,7 +13,6 @@ CONFIG_SYS_LOAD_ADDR=0x100 CONFIG_BOOTSTD_DEFAULTS=y CONFIG_PCI=y CONFIG_OF_BOARD_SETUP=y -CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y CONFIG_PREBOOT="pci enum; usb start;" # CONFIG_DISPLAY_CPUINFO is not set diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig index fa2c05da21e8..6679cce9a165 100644 --- a/configs/rpi_4_defconfig +++ b/configs/rpi_4_defconfig @@ -13,7 +13,6 @@ CONFIG_SYS_LOAD_ADDR=0x100 CONFIG_BOOTSTD_DEFAULTS=y CONFIG_PCI=y CONFIG_OF_BOARD_SETUP=y -CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y CONFIG_PREBOOT="pci enum; usb start;" # CONFIG_DISPLAY_CPUINFO is not set diff --git a/configs/rpi_arm64_defconfig b/configs/rpi_arm64_defconfig index 3e64573b70b1..26e29ffb5a1f 100644 --- a/configs/rpi_arm64_defconfig +++ b/configs/rpi_arm64_defconfig @@ -13,7 +13,6 @@ CONFIG_SYS_LOAD_ADDR=0x100 CONFIG_BOOTSTD_DEFAULTS=y CONFIG_PCI=y CONFIG_OF_BOARD_SETUP=y -CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y CONFIG_PREBOOT="pci enum; usb start;" # CONFIG_DISPLAY_CPUINFO is not set diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig index 4b8e402c89d4..0ac5efec717b 100644 --- a/configs/rpi_defconfig +++ b/configs/rpi_defconfig @@ -14,7 +14,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x100 CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y -CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set -- 2.41.0.487.g6d72f3e995-goog
[RESEND PATCH v3 1/3] arm: rpi: Switch to standard boot
Drop use of the distro scripts and use standard boot instead. We don't need to specify the mmc devices individually, since they are used in order from 0 to 2, and standard boot uses that order anyway. Signed-off-by: Simon Glass --- Changes in v3: - Rebase to -master Changes in v2: - Rebase to -next configs/rpi_0_w_defconfig | 1 + configs/rpi_2_defconfig| 1 + configs/rpi_3_32b_defconfig| 1 + configs/rpi_3_b_plus_defconfig | 1 + configs/rpi_3_defconfig| 1 + configs/rpi_4_32b_defconfig| 1 + configs/rpi_4_defconfig| 1 + configs/rpi_arm64_defconfig| 1 + configs/rpi_defconfig | 1 + include/configs/rpi.h | 38 ++ 10 files changed, 11 insertions(+), 36 deletions(-) diff --git a/configs/rpi_0_w_defconfig b/configs/rpi_0_w_defconfig index 5da334a8bcf9..7554e671e2ca 100644 --- a/configs/rpi_0_w_defconfig +++ b/configs/rpi_0_w_defconfig @@ -12,6 +12,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2835-rpi-zero-w" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x100 +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig index 990862160712..653f78bec1e8 100644 --- a/configs/rpi_2_defconfig +++ b/configs/rpi_2_defconfig @@ -13,6 +13,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2836-rpi-2-b" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x100 +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig index 80885aa9488d..305f1dacfd46 100644 --- a/configs/rpi_3_32b_defconfig +++ b/configs/rpi_3_32b_defconfig @@ -12,6 +12,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x100 +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y diff --git a/configs/rpi_3_b_plus_defconfig b/configs/rpi_3_b_plus_defconfig index 0acce8b883f8..f36f1258aa6d 100644 --- a/configs/rpi_3_b_plus_defconfig +++ b/configs/rpi_3_b_plus_defconfig @@ -11,6 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b-plus" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x100 +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig index bb6fe128061b..a0d8be42537f 100644 --- a/configs/rpi_3_defconfig +++ b/configs/rpi_3_defconfig @@ -11,6 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x100 +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig index f6213340971e..71f61c52e52d 100644 --- a/configs/rpi_4_32b_defconfig +++ b/configs/rpi_4_32b_defconfig @@ -10,6 +10,7 @@ CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_DM_RESET=y CONFIG_SYS_LOAD_ADDR=0x100 +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_PCI=y CONFIG_OF_BOARD_SETUP=y CONFIG_DISTRO_DEFAULTS=y diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig index bbc0fd6c649a..fa2c05da21e8 100644 --- a/configs/rpi_4_defconfig +++ b/configs/rpi_4_defconfig @@ -10,6 +10,7 @@ CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_DM_RESET=y CONFIG_SYS_LOAD_ADDR=0x100 +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_PCI=y CONFIG_OF_BOARD_SETUP=y CONFIG_DISTRO_DEFAULTS=y diff --git a/configs/rpi_arm64_defconfig b/configs/rpi_arm64_defconfig index 5d9a273cb920..3e64573b70b1 100644 --- a/configs/rpi_arm64_defconfig +++ b/configs/rpi_arm64_defconfig @@ -10,6 +10,7 @@ CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_DM_RESET=y CONFIG_SYS_LOAD_ADDR=0x100 +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_PCI=y CONFIG_OF_BOARD_SETUP=y CONFIG_DISTRO_DEFAULTS=y diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig index 550b8dcb9587..4b8e402c89d4 100644 --- a/configs/rpi_defconfig +++ b/configs/rpi_defconfig @@ -12,6 +12,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2835-rpi-b" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x100 +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y diff --git a/include/configs/rpi.h b/include/configs/rpi.h index 4da982f73578..4160db2d8e14 100644 --- a/include/configs/rpi.h +++ b/include/configs/rpi.h @@ -122,47 +122,13 @@ "fdt_addr_r=0x0260\0" \ "ramdisk_addr_r=0x0270\0" -#if IS_ENABLED(CONFIG_CMD_MMC) - #define BOOT_TARGET_MMC(func) \ - func(MMC, mmc, 0) \ - func(MMC, mmc, 1) \ - func(MMC, mmc, 2) -#else - #define BOOT_TARGET_MMC(func) -#endif - -#if
[RESEND PATCH v3 0/3] rpi: Convert to standard boot
This series moves Raspberry Pi boards over to use standard boot. It also moves rpi over to use a text-based environment. Unfortunately it is not possible to empty the header file due to several CFG options. Fix the repeated "and and" while we are here. Note that this reduces rodata size by about 4.5KB. We could get another for a total image-size saving of about 15KB. This is mostly because HUSH_PARSER is not enabled anymore and the environment shrinks down by about 3.5K. Hush is not actually needed anymore, since standard boot does not use it. Also CMD_SYSBOOT is dropped since standard boot calls the pxe_utils code directly in that case. Changes in v3: - Rebase to -master Changes in v2: - Rebase to -next - Add new patch to disable DISTRO_DEFAULTS Simon Glass (3): arm: rpi: Switch to standard boot rpi: Disable DISTRO_DEFAULTS arm: rpi: Switch to a text environment board/raspberrypi/rpi/rpi.env | 77 +++ configs/rpi_0_w_defconfig | 2 +- configs/rpi_2_defconfig| 2 +- configs/rpi_3_32b_defconfig| 2 +- configs/rpi_3_b_plus_defconfig | 2 +- configs/rpi_3_defconfig| 2 +- configs/rpi_4_32b_defconfig| 2 +- configs/rpi_4_defconfig| 2 +- configs/rpi_arm64_defconfig| 2 +- configs/rpi_defconfig | 2 +- include/configs/rpi.h | 134 - 11 files changed, 86 insertions(+), 143 deletions(-) create mode 100644 board/raspberrypi/rpi/rpi.env -- 2.41.0.487.g6d72f3e995-goog
Re: [PATCH] phy: adin: add readext and writeext support for mdio cmd
On Tue, Jul 11, 2023 at 04:59:15PM -0500, Nate Drude wrote: > The adin phy has extended registers that can be accessed using > adin_ext_read and adin_ext_write. These registers can be read directly > using the mdio command using readext and writext. For example: > > => mdio rx ethernet@428a 0xff23 > Reading from bus ethernet@428a > PHY at address 0: > 65315 - 0xe01 > > Signed-off-by: Nate Drude > Reviewed-by: Marek Vasut Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH] net: ksz9477: add support for KSZ9893 GbE switch
On Wed, Jun 28, 2023 at 04:54:45PM +0200, Karsten Wiese wrote: > Copy and tweak the required code from the linux kernel. > Only the KSZ9893 has been tested. > > Signed-off-by: Karsten Wiese > Reviewed-by: Ramon Fried Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 2/2] net: ipv6: network protocol structures should be packed
On Thu, May 18, 2023 at 11:24:39AM -0700, emohand...@linux.microsoft.com wrote: > From: Ehsan Mohandesi > > The structure icmp6_ra_prefix_info needs to be packed because it is read > from a network stream. > > Signed-off-by: Ehsan Mohandesi > Reviewed-by: Viacheslav Mitrofanov > Reviewed-by: Ramon Fried Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 1/2] net: ipv6: router advertisement message length should be within limits
On Thu, May 18, 2023 at 11:24:38AM -0700, emohand...@linux.microsoft.com wrote: > From: Ehsan Mohandesi > > The argument len passed to function process_ra is the length of the IPv6 > router advertisement message and needs to be between 0 and MTU because > it is assigned to remaining_option_len and used as a loop variable. > > Addresses-Coverity-ID: 450971 ("TAINTED_SCALAR") > Signed-off-by: Ehsan Mohandesi > Reviewed-by: Viacheslav Mitrofanov > Reviewed-by: Ramon Fried Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH v5 2/6] mips: ls1c300: add base support
On Wed, Jul 26, 2023 at 08:30:23PM +0800, Du Huanpeng wrote: > - pinmux setup functions for debug uart > - lowlevel initialization: sdram, pll, spi, debug uart [snip] > +/* Serial SPL */ > +#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_SERIAL) > +#define CFG_SYS_NS16550_CLK 6600 > +#define CFG_SYS_NS16550_COM1 0xbfe44000 > +#define CFG_SYS_NS16550_COM2 0xbfe48000 > +#define CFG_SYS_NS16550_COM3 0xbfe4c000 > +#define CFG_SYS_NS16550_COM4 0xbfe4c400 > +#define CFG_SYS_NS16550_COM5 0xbfe4c500 > +#define CFG_SYS_NS16550_COM6 0xbfe4c600 > +#endif No guards around these please. -- Tom signature.asc Description: PGP signature
Re: [PATCH v5 0/6] add loongson mips ls1c300 initial support
On Wed, Jul 26, 2023 at 08:30:21PM +0800, Du Huanpeng wrote: > --- > Changelog for v5: >- add detail commit message >- small fix in watchdog driver Please run the whole series through checkpatch.pl and address the issues raised there, thanks. -- Tom signature.asc Description: PGP signature
Re: [PATCH] CI: Add automatic retry for test.py jobs
On Thu, Jul 27, 2023 at 01:18:12PM -0600, Simon Glass wrote: > Hi Tom, > > On Sun, 16 Jul 2023 at 12:18, Tom Rini wrote: > > > > On Sat, Jul 15, 2023 at 05:40:25PM -0600, Simon Glass wrote: > > > Hi Tom, > > > > > > On Thu, 13 Jul 2023 at 15:57, Tom Rini wrote: > > > > > > > > On Thu, Jul 13, 2023 at 03:03:57PM -0600, Simon Glass wrote: > > > > > Hi Tom, > > > > > > > > > > On Wed, 12 Jul 2023 at 14:38, Tom Rini wrote: > > > > > > > > > > > > On Wed, Jul 12, 2023 at 02:32:18PM -0600, Simon Glass wrote: > > > > > > > Hi Tom, > > > > > > > > > > > > > > On Wed, 12 Jul 2023 at 11:09, Tom Rini wrote: > > > > > > > > > > > > > > > > On Wed, Jul 12, 2023 at 08:00:23AM -0600, Simon Glass wrote: > > > > > > > > > Hi Tom, > > > > > > > > > > > > > > > > > > On Tue, 11 Jul 2023 at 20:33, Tom Rini > > > > > > > > > wrote: > > > > > > > > > > > > > > > > > > > > It is not uncommon for some of the QEMU-based jobs to fail > > > > > > > > > > not because > > > > > > > > > > of a code issue but rather because of a timing issue or > > > > > > > > > > similar problem > > > > > > > > > > that is out of our control. Make use of the keywords that > > > > > > > > > > Azure and > > > > > > > > > > GitLab provide so that we will automatically re-run these > > > > > > > > > > when they fail > > > > > > > > > > 2 times. If they fail that often it is likely we have found > > > > > > > > > > a real issue > > > > > > > > > > to investigate. > > > > > > > > > > > > > > > > > > > > Signed-off-by: Tom Rini > > > > > > > > > > --- > > > > > > > > > > .azure-pipelines.yml | 1 + > > > > > > > > > > .gitlab-ci.yml | 1 + > > > > > > > > > > 2 files changed, 2 insertions(+) > > > > > > > > > > > > > > > > > > This seems like a slippery slope. Do we know why things fail? > > > > > > > > > I wonder > > > > > > > > > if we should disable the tests / builders instead, until it > > > > > > > > > can be > > > > > > > > > corrected? > > > > > > > > > > > > > > > > It happens in Azure, so it's not just the broken runner problem > > > > > > > > we have > > > > > > > > in GitLab. And the problem is timing, as I said in the commit. > > > > > > > > Sometimes we still get the RTC test failing. Other times we > > > > > > > > don't get > > > > > > > > QEMU + U-Boot spawned in time (most often m68k, but sometimes > > > > > > > > x86). > > > > > > > > > > > > > > How do we keep this list from growing? > > > > > > > > > > > > Do we need to? The problem is in essence since we rely on free > > > > > > resources, sometimes some heavy lifts take longer. That's what this > > > > > > flag is for. > > > > > > > > > > I'm fairly sure the RTC thing could be made deterministic. > > > > > > > > We've already tried that once, and it happens a lot less often. If we > > > > make it even looser we risk making the test itself useless. > > > > > > For sleep, yes, but for rtc it should be deterministic now...next time > > > you get a failure could you send me the trace? > > > > Found one: > > https://dev.azure.com/u-boot/u-boot/_build/results?buildId=6592=logs=b6c47816-145c-5bfe-20a7-c6a2572e6c41=0929c28c-6e32-5635-9624-54eaa917d713=599 > > I don't seem to have access to that...but it is rtc or sleep? It was the RTC one, and has since rolled off and been deleted. > > And note that we have a different set of timeout problems that may or may > > not > > be configurable, which is in the upload of the pytest results. I haven't > > seen > > if there's a knob for this one yet, within Azure (or the python project > > we're > > adding for it). > > Oh dear. > > > > > > > > The spawning thing...is there a timeout for that? What actually fails? > > > > > > > > It doesn't spawn in time for the framework to get to the prompt. We > > > > could maybe increase the timeout value. It's always the version test > > > > that fails. > > > > > > Ah OK, yes increasing the timeout makes sense. > > > > > > > > > > > > > > > > I'll note that we don't have this problem with sandbox tests. > > > > > > > > > > > > > > > > OK, but that's not relevant? > > > > > > > > > > > > > > It is relevant to the discussion about using QEMU instead of > > > > > > > sandbox, > > > > > > > e.g. with the TPM. I recall a discussion with Ilias a while back. > > > > > > > > > > > > I'm sure we could make sandbox take too long to start as well, if > > > > > > enough > > > > > > other things are going on with the system. And sandbox has its own > > > > > > set > > > > > > of super frustrating issues instead, so I don't think this is a > > > > > > great > > > > > > argument to have right here (I have to run it in docker, to get > > > > > > around > > > > > > some application version requirements and exclude event_dump, > > > > > > bootmgr, > > > > > > abootimg and gpt tests, which could otherwise run, but fail for me). > > > > > > > > > > I haven't heard about this before. Is there anything that could be > > > > > done? > > > > > > > > I have no idea what could be done about it since
Re: [PATCH] CI: Add automatic retry for test.py jobs
Hi Tom, On Sun, 16 Jul 2023 at 12:18, Tom Rini wrote: > > On Sat, Jul 15, 2023 at 05:40:25PM -0600, Simon Glass wrote: > > Hi Tom, > > > > On Thu, 13 Jul 2023 at 15:57, Tom Rini wrote: > > > > > > On Thu, Jul 13, 2023 at 03:03:57PM -0600, Simon Glass wrote: > > > > Hi Tom, > > > > > > > > On Wed, 12 Jul 2023 at 14:38, Tom Rini wrote: > > > > > > > > > > On Wed, Jul 12, 2023 at 02:32:18PM -0600, Simon Glass wrote: > > > > > > Hi Tom, > > > > > > > > > > > > On Wed, 12 Jul 2023 at 11:09, Tom Rini wrote: > > > > > > > > > > > > > > On Wed, Jul 12, 2023 at 08:00:23AM -0600, Simon Glass wrote: > > > > > > > > Hi Tom, > > > > > > > > > > > > > > > > On Tue, 11 Jul 2023 at 20:33, Tom Rini > > > > > > > > wrote: > > > > > > > > > > > > > > > > > > It is not uncommon for some of the QEMU-based jobs to fail > > > > > > > > > not because > > > > > > > > > of a code issue but rather because of a timing issue or > > > > > > > > > similar problem > > > > > > > > > that is out of our control. Make use of the keywords that > > > > > > > > > Azure and > > > > > > > > > GitLab provide so that we will automatically re-run these > > > > > > > > > when they fail > > > > > > > > > 2 times. If they fail that often it is likely we have found a > > > > > > > > > real issue > > > > > > > > > to investigate. > > > > > > > > > > > > > > > > > > Signed-off-by: Tom Rini > > > > > > > > > --- > > > > > > > > > .azure-pipelines.yml | 1 + > > > > > > > > > .gitlab-ci.yml | 1 + > > > > > > > > > 2 files changed, 2 insertions(+) > > > > > > > > > > > > > > > > This seems like a slippery slope. Do we know why things fail? I > > > > > > > > wonder > > > > > > > > if we should disable the tests / builders instead, until it can > > > > > > > > be > > > > > > > > corrected? > > > > > > > > > > > > > > It happens in Azure, so it's not just the broken runner problem > > > > > > > we have > > > > > > > in GitLab. And the problem is timing, as I said in the commit. > > > > > > > Sometimes we still get the RTC test failing. Other times we don't > > > > > > > get > > > > > > > QEMU + U-Boot spawned in time (most often m68k, but sometimes > > > > > > > x86). > > > > > > > > > > > > How do we keep this list from growing? > > > > > > > > > > Do we need to? The problem is in essence since we rely on free > > > > > resources, sometimes some heavy lifts take longer. That's what this > > > > > flag is for. > > > > > > > > I'm fairly sure the RTC thing could be made deterministic. > > > > > > We've already tried that once, and it happens a lot less often. If we > > > make it even looser we risk making the test itself useless. > > > > For sleep, yes, but for rtc it should be deterministic now...next time > > you get a failure could you send me the trace? > > Found one: > https://dev.azure.com/u-boot/u-boot/_build/results?buildId=6592=logs=b6c47816-145c-5bfe-20a7-c6a2572e6c41=0929c28c-6e32-5635-9624-54eaa917d713=599 I don't seem to have access to that...but it is rtc or sleep? > > And note that we have a different set of timeout problems that may or may not > be configurable, which is in the upload of the pytest results. I haven't seen > if there's a knob for this one yet, within Azure (or the python project we're > adding for it). Oh dear. > > > > > The spawning thing...is there a timeout for that? What actually fails? > > > > > > It doesn't spawn in time for the framework to get to the prompt. We > > > could maybe increase the timeout value. It's always the version test > > > that fails. > > > > Ah OK, yes increasing the timeout makes sense. > > > > > > > > > > > > > I'll note that we don't have this problem with sandbox tests. > > > > > > > > > > > > > > OK, but that's not relevant? > > > > > > > > > > > > It is relevant to the discussion about using QEMU instead of > > > > > > sandbox, > > > > > > e.g. with the TPM. I recall a discussion with Ilias a while back. > > > > > > > > > > I'm sure we could make sandbox take too long to start as well, if > > > > > enough > > > > > other things are going on with the system. And sandbox has its own > > > > > set > > > > > of super frustrating issues instead, so I don't think this is a great > > > > > argument to have right here (I have to run it in docker, to get around > > > > > some application version requirements and exclude event_dump, bootmgr, > > > > > abootimg and gpt tests, which could otherwise run, but fail for me). > > > > > > > > I haven't heard about this before. Is there anything that could be done? > > > > > > I have no idea what could be done about it since I believe all of them > > > run fine in CI, including on this very host, when gitlab invokes it > > > rather than when I invoke it. My point here is that sandbox tests are > > > just a different kind of picky about things and need their own kind of > > > "just hit retry". > > > > Perhaps this is Python dependencies? I'm not sure, but if you see it > > again, please let me know in case we can actually fix
Re: [PATCH v5 1/6] mips: initial build infrastructure for loongson SoCs
On Wed, Jul 26, 2023 at 08:30:22PM +0800, Du Huanpeng wrote: > Loongson 1C is a cost-effective SOC chip for industrial control and > the Internet of Things. The Loongson 1C includes a floating-point > processing unit, supports multiple types of memory, and supports > high-capacity MLC NAND Flash. Loongson 1C provides developers with a > wealth of peripheral interfaces and on-chip modules, including Camera > controller, USB OTG and USB HOST interfaces, AC97/I2S controller, LCD > controller, SPI interface, UART interface, etc., providing sufficient > computing power and multi-application connectivity. > > Some highlights of this SoC are: > - Single core LS232, MIPS32 instruction set compatible, main frequency > 300MHZ > - 16KB data cache and 16KB instruction cache > - 64 bit float unit, hardware division > - 8/16 bit SDRAM controller, 45 ~ 133MHz > - 8/16 bit SRAM, NAND > - I2S/AC97, LCD, MAC, USB, OTG, SPI, I2C, PWM, CAN, SDIO, ADC > - 12 UARTs > > See Techinical Reference Manual for details: > https://www.loongson.cn/ > https://github.com/hodcarrier/ls1c300_bsp > > Signed-off-by: Du Huanpeng > --- > MAINTAINERS| 15 + > arch/mips/Kconfig | 11 > arch/mips/Makefile | 1 + > arch/mips/dts/Makefile | 1 + > arch/mips/mach-lsmips/Kconfig | 76 ++ > arch/mips/mach-lsmips/Makefile | 6 ++ > arch/mips/mach-lsmips/ls1c300/Makefile | 7 +++ > configs/ls1c300_defconfig | 53 ++ > 8 files changed, 170 insertions(+) > create mode 100644 arch/mips/mach-lsmips/Kconfig > create mode 100644 arch/mips/mach-lsmips/Makefile > create mode 100644 arch/mips/mach-lsmips/ls1c300/Makefile > create mode 100644 configs/ls1c300_defconfig > > diff --git a/MAINTAINERS b/MAINTAINERS > index 87991cccdd..91d6d714d8 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -1116,6 +1116,21 @@ F: drivers/net/cortina_ni.c > F: drivers/net/cortina_ni.h > F: drivers/net/phy/ca_phy.c > > +MIPS LOONGSON LS1C300 > +M: Du Huanpeng > +S: Maintained > +F: arch/mips/dts/loongson32-ls1c300b.dtsi > +F: arch/mips/dts/ls1c300-eval.dts > +F: arch/mips/mach-lsmips/ > +F: board/loongson/ls1c300-eval/ > +F: configs/ls1c300_defconfig > +F: drivers/clk/lsmips/ > +F: drivers/reset/reset-lsmips.c > +F: drivers/watchdog/lsmips_wdt.c > +F: include/configs/ls1c300.h > +F: include/dt-bindings/clock/ls1c300-clk.h > +F: include/dt-bindings/reset/ls1c300-reset.h The board specific parts should be in the board MAINTAINER file. > +++ b/arch/mips/mach-lsmips/Kconfig > @@ -0,0 +1,76 @@ > +menu "Loongson MIPS platforms" > + depends on ARCH_LSMIPS > + > +config SYS_MALLOC_F_LEN > + default 0x1000 > + > +config SYS_SOC > + default "ls1c300" if SOC_LS1C300 > + > +config SYS_DCACHE_SIZE > + default 16384 > + > +config SYS_DCACHE_LINE_SIZE > + default 32 > + > +config SYS_ICACHE_SIZE > + default 16384 > + > +config SYS_ICACHE_LINE_SIZE > + default 32 > + > +config TEXT_BASE > + default 0xbfc0 if !SPL > + default 0x8020 if SPL > + > +config SPL_TEXT_BASE > + default 0xbfc0 > + > +config SPL_PAYLOAD > + default "u-boot-lzma.img" if SPL_LZMA > + > +config BUILD_TARGET > + default "u-boot-with-spl.bin" if SPL > + default "u-boot.bin" if !SPL As most of these are defined in common Kconfig files, the defaults for this arch should be there too. -- Tom signature.asc Description: PGP signature
Re: [PATCH v5 3/6] mips: add a ls1c300 based board
On Wed, Jul 26, 2023 at 08:30:24PM +0800, Du Huanpeng wrote: > - devicetree for ls1c300 SoC and board What linux kernel release is this from? [snip] > + u-boot,dm-pre-reloc; Here and elsewhere, these are "bootph-" now and also upstreamable. [snip] > +LS1C300_EVAL BOARD > +M: Du Huanpeng Missing space. -- Tom signature.asc Description: PGP signature
[PATCH V2 14/19] doc: board: ti: am65/j721e: Convert OSPI memory map to svg
Convert the memory map for OSPI as a common memory map Signed-off-by: Nishanth Menon --- Changes since V1 * No Change V1: https://lore.kernel.org/all/20230727080027.2817701-14...@ti.com/ doc/board/ti/am65x_evm.rst | 27 +- doc/board/ti/img/ospi_sysfw.svg | 721 doc/board/ti/j721e_evm.rst | 27 +- 3 files changed, 723 insertions(+), 52 deletions(-) create mode 100644 doc/board/ti/img/ospi_sysfw.svg diff --git a/doc/board/ti/am65x_evm.rst b/doc/board/ti/am65x_evm.rst index 5a72814035ae..fa76d38a10bb 100644 --- a/doc/board/ti/am65x_evm.rst +++ b/doc/board/ti/am65x_evm.rst @@ -229,32 +229,7 @@ addresses. Flash layout for OSPI: -.. code-block:: text - - 0x0 ++ - | ospi.tiboot3(512K) | - || - 0x8 ++ - | ospi.tispl(2M) | - || -0x28 ++ - | ospi.u-boot(4M)| - || -0x68 ++ - | ospi.env(128K) | - || -0x6A ++ - | ospi.env.backup (128K) | - || -0x6C ++ - | ospi.sysfw(1M)| - || -0x7C ++ - | padding (256k)| -0x80 ++ - | ospi.rootfs(UBIFS) | - || - ++ +.. image:: img/ospi_sysfw.svg Kernel Image and DT are expected to be present in the /boot folder of UBIFS ospi.rootfs just like in SD card case. U-Boot looks for UBI volume named diff --git a/doc/board/ti/img/ospi_sysfw.svg b/doc/board/ti/img/ospi_sysfw.svg new file mode 100644 index ..e7a0fd248247 --- /dev/null +++ b/doc/board/ti/img/ospi_sysfw.svg @@ -0,0 +1,721 @@ + +http://www.inkscape.org/namespaces/inkscape; + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd; + xmlns:xlink="http://www.w3.org/1999/xlink; + xmlns="http://www.w3.org/2000/svg; + xmlns:svg="http://www.w3.org/2000/svg; + xmlns:xhtml="http://www.w3.org/1999/xhtml;> + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + ospi.tiboot3(512k) + + + +ospi.tiboot3(512k) + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + +0x0 + + + + +0x0 + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + ospi.tispl(2M) + + + +ospi.tispl(2M) + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + +0x8 + + + + +0x8 + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + ospi.u-boot(4M) + + + +ospi.u-boot(4M) + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + +0x28 + + + + +0x28 + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + ospi.env(128K) + + + +ospi.env(128K) + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + +0x68 + + + + +0x68 + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + ospi.env.backup(128K) + + + +ospi.env.backup(128K) + + + +
[PATCH V2 02/19] doc: board: ti: am62x/j7200: Update with common boot flow diagram
Update the bootflow svg diagram and reuse across the platforms as they are common. Reviewed-by: Neha Malcom Francis Signed-off-by: Nishanth Menon --- Changes since V1 * Picked up reviewed-by V1: https://lore.kernel.org/all/20230727080027.2817701-3...@ti.com/ doc/board/ti/am62x_sk.rst| 68 +- doc/board/ti/img/boot_diagram_k3_current.svg | 1925 ++ doc/board/ti/j7200_evm.rst | 85 +- 3 files changed, 1927 insertions(+), 151 deletions(-) create mode 100644 doc/board/ti/img/boot_diagram_k3_current.svg diff --git a/doc/board/ti/am62x_sk.rst b/doc/board/ti/am62x_sk.rst index ba017a2b489e..f511b5935c16 100644 --- a/doc/board/ti/am62x_sk.rst +++ b/doc/board/ti/am62x_sk.rst @@ -42,73 +42,7 @@ Boot Flow: -- Below is the pictorial representation of boot flow: -.. code-block:: text - - ++ - |TIFS| Main R5 |A53| - ++ - |++ | | | - || Reset | | | | - |++ | | | - | : | | | - |++ | +---+ | | - || *ROM* |--|-->| Reset rls | | | - |++ | +---+ | | - ||| | : | | - || ROM | | : | | - ||services| | : | | - ||| | +-+ | | - ||| | | *R5 ROM* | | | - ||| | +-+ | | - |||<-|---|Load and auth| | | - ||| | | tiboot3.bin | | | - |++ | +-+ | | - |||<-|---| Load sysfw | | | - ||| | | part to TIFS| | | - ||| | | core| | | - ||| | +-+ | | - ||| | : | | - ||| | : | | - ||| | : | | - ||| | +-+ | | - ||| | | *R5 SPL* | | | - ||| | +-+ | | - ||| | |DDR | | | - ||| | | config| | | - ||| | +-+ | | - ||| | |Load | | | - ||| | | tispl.bin | | | - ||| | +-+ | | - ||| | | Load R5 | | | - ||| | | firmware | | | - ||| | +-+ | | - |||<-|---| Start A53 | | | - ||| | | and jump to | | | - ||| | | DM fw image | | | - ||| | +-+ | | - ||| | | +---+ | - |||--|---|>| Reset rls | | - ||| | | +---+ | - || TIFS | | | :| - ||Services| | | +-+ | - |||<-|---|>|*TF-A/OP-TEE*| | - ||| | | +-+ | - ||| | | :| - ||| | | +---+ | - |||<-|---|>| *A53 SPL* | | - ||| | | +---+ | - ||| | |
[PATCH V2 15/19] doc: board: ti: am65x_evm: Convert the emmc layout to svg
Convert the emmc memory layout to svg Signed-off-by: Nishanth Menon --- Changes since V1 * No Change V1: https://lore.kernel.org/all/20230727080027.2817701-15...@ti.com/ doc/board/ti/am65x_evm.rst| 17 +- doc/board/ti/img/emmc_am65x_evm_boot0.svg | 748 ++ 2 files changed, 749 insertions(+), 16 deletions(-) create mode 100644 doc/board/ti/img/emmc_am65x_evm_boot0.svg diff --git a/doc/board/ti/am65x_evm.rst b/doc/board/ti/am65x_evm.rst index fa76d38a10bb..4bb23e547b6c 100644 --- a/doc/board/ti/am65x_evm.rst +++ b/doc/board/ti/am65x_evm.rst @@ -179,22 +179,7 @@ used: eMMC layout: -.. code-block:: text - -boot0 partition (8 MB)user partition -0x0+--+ 0x0+-+ - | tiboot3.bin (512 KB) | | | - 0x400+--+ | | - | tispl.bin (2 MB) | | | - 0x1400+--+ |rootfs | - | u-boot.img (4 MB) | | | - 0x3400+--+ | | - | environment (128 KB)| | | - 0x3500+--+ | | - | backup environment (128 KB)| | | - 0x3600+--+ | | - | sysfw (1 MB)| | | - 0x3E00+--+ +-+ +.. image:: img/emmc_am65x_evm_boot0.svg Kernel image and DT are expected to be present in the /boot folder of rootfs. To boot kernel from eMMC, use the following commands: diff --git a/doc/board/ti/img/emmc_am65x_evm_boot0.svg b/doc/board/ti/img/emmc_am65x_evm_boot0.svg new file mode 100644 index ..ff5c7bf74b25 --- /dev/null +++ b/doc/board/ti/img/emmc_am65x_evm_boot0.svg @@ -0,0 +1,748 @@ + +http://www.inkscape.org/namespaces/inkscape; + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd; + xmlns:xlink="http://www.w3.org/1999/xlink; + xmlns="http://www.w3.org/2000/svg; + xmlns:svg="http://www.w3.org/2000/svg; + xmlns:xhtml="http://www.w3.org/1999/xhtml;> + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + tiboot3.bin (512KB) + + + +tiboot3.bin (512KB) + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + + + 0x0 + + + + + +0x0 + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + tispl.bin (2MB) + + + +tispl.bin (2MB) + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + + + 0x400 + + + + + +0x400 + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + U-boot.img (4MB) + + + +U-boot.img (4MB) + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + + + 0x1400 + + + + + +0x1400 + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + environment (128KB) + + + +environment (128KB) + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + + + 0x3400 + + + + + +0x3400 + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow:
[PATCH V2 09/19] doc: board: ti: am62x: Convert the image format to svg
Convert the image format into svg that can be reused across platforms as needed. Signed-off-by: Nishanth Menon --- Changes since V1 * Dia updates V1: https://lore.kernel.org/all/20230727080027.2817701-10...@ti.com/ doc/board/ti/am62x_sk.rst | 52 +--- doc/board/ti/img/multi_cert_tiboot3.bin.svg | 287 2 files changed, 291 insertions(+), 48 deletions(-) create mode 100644 doc/board/ti/img/multi_cert_tiboot3.bin.svg diff --git a/doc/board/ti/am62x_sk.rst b/doc/board/ti/am62x_sk.rst index 080c15b1fe10..dff10df41c7d 100644 --- a/doc/board/ti/am62x_sk.rst +++ b/doc/board/ti/am62x_sk.rst @@ -133,57 +133,13 @@ Copy the below images to an SD card and boot: Image formats: -- -- tiboot3.bin: - -.. code-block:: text - -+---+ -|X.509 | -| Certificate | -| +---+ | -| | | | -| |R5 | | -| | u-boot-spl.bin | | -| | | | -| +---+ | -| | | | -| |TIFS with board cfg| | -| | | | -| +---+ | -| | | | -| | | | -| | FIT header| | -| | +---+ | | -| | | | | | -| | | DTB 1...N | | | -| | +---+ | | -| +---+ | -+---+ +- tiboot3.bin + +.. image:: img/multi_cert_tiboot3.bin.svg - tispl.bin -.. code-block:: text - -+---+ -| | -| FIT HEADER | -| +---+ | -| | | | -| | A53 TF-A | | -| +---+ | -| | | | -| | A53 OP-TEE| | -| +---+ | -| | | | -| | R5 DM FW | | -| +---+ | -| | | | -| | A53 SPL | | -| +---+ | -| | | | -| | SPL DTB 1...N | | -| +---+ | -+---+ +.. image:: img/dm_tispl.bin.svg A53 SPL DDR Memory Layout - diff --git a/doc/board/ti/img/multi_cert_tiboot3.bin.svg b/doc/board/ti/img/multi_cert_tiboot3.bin.svg new file mode 100644 index ..a210d66ca6df --- /dev/null +++ b/doc/board/ti/img/multi_cert_tiboot3.bin.svg @@ -0,0 +1,287 @@ + +http://www.inkscape.org/namespaces/inkscape; + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd; + xmlns:xlink="http://www.w3.org/1999/xlink; + xmlns="http://www.w3.org/2000/svg; + xmlns:svg="http://www.w3.org/2000/svg; + xmlns:xhtml="http://www.w3.org/1999/xhtml;> + + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + X.509 Certificate + + + +X.509 Cert... + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + R5 +u-boot-spl.bin + + + +R5... + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + DTB 1..N + + + +DTB 1..N + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + FIT Header + + + +FIT Header + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + TIFS with board cfg + + + +TIFS with board cfg + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + id="g52" /> +https://www.drawio.com/doc/faq/svg-export-text-problems; + target="_blank" + id="a56"> + Text is not SVG - cannot display + + + -- 2.40.0
[PATCH V2 18/19] doc: board: ti: k3: Sort the boards in alphabetical order
Keep the boards sorted in alphabetical order. Signed-off-by: Nishanth Menon --- New patch doc/board/ti/k3.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/board/ti/k3.rst b/doc/board/ti/k3.rst index 7933c955e07e..eb1896b06cd5 100644 --- a/doc/board/ti/k3.rst +++ b/doc/board/ti/k3.rst @@ -30,10 +30,10 @@ K3 Based SoCs .. toctree:: :maxdepth: 1 - j721e_evm - j7200_evm am62x_sk am65x_evm + j7200_evm + j721e_evm Boot Flow Overview -- -- 2.40.0
[PATCH V2 04/19] doc: board: ti: j721e: Update with boot flow diagram
Update the bootflow svg diagram instead of the ascii version Reviewed-by: Neha Malcom Francis Signed-off-by: Nishanth Menon --- Changes since V1 * Picked up reviewed by, boot dia updates V1: https://lore.kernel.org/all/20230727080027.2817701-5...@ti.com/ doc/board/ti/img/boot_diagram_j721e.svg | 2012 +++ doc/board/ti/j721e_evm.rst | 91 +- 2 files changed, 2013 insertions(+), 90 deletions(-) create mode 100644 doc/board/ti/img/boot_diagram_j721e.svg diff --git a/doc/board/ti/img/boot_diagram_j721e.svg b/doc/board/ti/img/boot_diagram_j721e.svg new file mode 100644 index ..e61af5b76708 --- /dev/null +++ b/doc/board/ti/img/boot_diagram_j721e.svg @@ -0,0 +1,2012 @@ + +http://www.inkscape.org/namespaces/inkscape; + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd; + xmlns:xlink="http://www.w3.org/1999/xlink; + xmlns="http://www.w3.org/2000/svg; + xmlns:svg="http://www.w3.org/2000/svg; + xmlns:xhtml="http://www.w3.org/1999/xhtml;> + + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + Cortex-R + + + +Cortex-R + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + ROM + + + +ROM + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + Load and auth tiboot3.bin + + + +Load and auth t... + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + Cortex-A + + + +Cortex-A + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + Load system +config data + + + +Load system... + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + DDR Config + + + +DDR Config + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + Load tispl.bin + + + +Load tispl.bin + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + Start Cortex-A + + + +Start Cortex-A + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + Start DM + + + +Start DM + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + Device Mgr + + + +Device Mgr + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + Start Cortex-A + + + +Start Cort... + + + + + + + + + + + + + + + + + + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + Aux f/w + + + +Aux f/w + + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + Start TIFS + + + +Start TIFS + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + TIFS + + + +TIFS + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + Load system config data + + + +Load syste... + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + Start TIFS + + + +Start TIFS + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + Load DM f/w + + + +Load DM f/w + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + branch + + + +branch + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + +
[PATCH V2 16/19] doc: board: ti: j7200_evm: Convert the emmc layout to svg
Convert the emmc memory layout to svg Signed-off-by: Nishanth Menon --- Changes since V1 * No change V1: https://lore.kernel.org/all/20230727080027.2817701-16...@ti.com/ doc/board/ti/img/emmc_j7200_evm_boot01.svg | 662 + doc/board/ti/img/emmc_j7200_evm_udafs.svg | 505 doc/board/ti/j7200_evm.rst | 32 +- 3 files changed, 1169 insertions(+), 30 deletions(-) create mode 100644 doc/board/ti/img/emmc_j7200_evm_boot01.svg create mode 100644 doc/board/ti/img/emmc_j7200_evm_udafs.svg diff --git a/doc/board/ti/img/emmc_j7200_evm_boot01.svg b/doc/board/ti/img/emmc_j7200_evm_boot01.svg new file mode 100644 index ..43e8b254a828 --- /dev/null +++ b/doc/board/ti/img/emmc_j7200_evm_boot01.svg @@ -0,0 +1,662 @@ + +http://www.inkscape.org/namespaces/inkscape; + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd; + xmlns:xlink="http://www.w3.org/1999/xlink; + xmlns="http://www.w3.org/2000/svg; + xmlns:svg="http://www.w3.org/2000/svg; + xmlns:xhtml="http://www.w3.org/1999/xhtml;> + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + tiboot3.bin (1MB) + + + +tiboot3.bin (1MB) + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + + + 0x0 + + + + + +0x0 + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + tispl.bin (2MB) + + + +tispl.bin (2MB) + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + + + 0x800 + + + + + +0x800 + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + U-boot.img (4MB) + + + +U-boot.img (4MB) + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + + + 0x1800 + + + + + +0x1800 + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + environment (128KB) + + + +environment (128KB) + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + + + 0x3800 + + + + + +0x3800 + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + backup environment (128KB) + + + +backup environment (128KB) + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + + + 0x3900 + + + + + +0x3900 + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + + + 0x3A00 + + + + + +0x3A00 + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + UDA Partition + + + +UDA Partition + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + Boot0/1 partition (8MB) + + + +Boot0/1 partition (8MB) + + + + + +
[PATCH V2 08/19] doc: board: ti: am65x: Convert the image format to svg
Convert the image format into svg that can be reused across platforms as needed. Signed-off-by: Nishanth Menon --- Changes since V1 * Dia updates V1: https://lore.kernel.org/all/20230727080027.2817701-9...@ti.com/ doc/board/ti/am65x_evm.rst | 65 +-- doc/board/ti/img/nodm_tispl.bin.svg | 277 2 files changed, 281 insertions(+), 61 deletions(-) create mode 100644 doc/board/ti/img/nodm_tispl.bin.svg diff --git a/doc/board/ti/am65x_evm.rst b/doc/board/ti/am65x_evm.rst index 812fbc3f5093..4132dd98e1ad 100644 --- a/doc/board/ti/am65x_evm.rst +++ b/doc/board/ti/am65x_evm.rst @@ -128,74 +128,17 @@ Copy the below images to an SD card and boot: Image formats: -- -- tiboot3.bin: +- tiboot3.bin -.. code-block:: text - -+---+ -|X.509 | -| Certificate | -| +---+ | -| | | | -| |R5 | | -| | u-boot-spl.bin | | -| | | | -| +---+ | -| | | | -| | FIT header| | -| | +---+ | | -| | | | | | -| | | DTB 1...N | | | -| | +---+ | | -| +---+ | -+---+ +.. image:: img/no_multi_cert_tiboot3.bin.svg - tispl.bin -.. code-block:: text - -+---+ -| | -| FIT HEADER | -| +---+ | -| | | | -| | A53 ATF | | -| +---+ | -| | | | -| | A53 OP-TEE| | -| +---+ | -| | | | -| | A53 SPL | | -| +---+ | -| | | | -| | SPL DTB 1...N | | -| +---+ | -+---+ +.. image:: img/nodm_tispl.bin.svg - sysfw.itb -.. code-block:: text - -+---+ -| | -| FIT HEADER | -| +---+ | -| | | | -| | sysfw.bin | | -| +---+ | -| | | | -| |board config | | -| +---+ | -| | | | -| | PM config | | -| +---+ | -| | | | -| | RM config | | -| +---+ | -| | | | -| |Secure config | | -| +---+ | -+---+ +.. image:: img/sysfw.itb.svg eMMC: - diff --git a/doc/board/ti/img/nodm_tispl.bin.svg b/doc/board/ti/img/nodm_tispl.bin.svg new file mode 100644 index ..040676400aa9 --- /dev/null +++ b/doc/board/ti/img/nodm_tispl.bin.svg @@ -0,0 +1,277 @@ + +http://www.inkscape.org/namespaces/inkscape; + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd; + xmlns:xlink="http://www.w3.org/1999/xlink; + xmlns="http://www.w3.org/2000/svg; + xmlns:svg="http://www.w3.org/2000/svg; + xmlns:xhtml="http://www.w3.org/1999/xhtml;> + + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + FIT Header + + + +FIT Header + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + TF-A + + + +TF-A + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + OP-TEE + + + +OP-TEE + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + Cortex-A SPL + + + +Cortex-A SPL + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + SPL DTB 1..N + + + +SPL DTB 1..N + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + id="g50" /> +https://www.drawio.com/doc/faq/svg-export-text-problems; +
[PATCH V2 19/19] board: ti: k3: Convert boot flow ascii flow to svg
Replace the ascii flow diagram with svg. Signed-off-by: Nishanth Menon --- New Patch from review comments doc/board/ti/img/boot_flow_01.svg | 220 +++ doc/board/ti/img/boot_flow_02.svg | 459 +++ doc/board/ti/img/boot_flow_03.svg | 583 ++ doc/board/ti/k3.rst | 15 +- 4 files changed, 1265 insertions(+), 12 deletions(-) create mode 100644 doc/board/ti/img/boot_flow_01.svg create mode 100644 doc/board/ti/img/boot_flow_02.svg create mode 100644 doc/board/ti/img/boot_flow_03.svg diff --git a/doc/board/ti/img/boot_flow_01.svg b/doc/board/ti/img/boot_flow_01.svg new file mode 100644 index ..b5bd0ac2774f --- /dev/null +++ b/doc/board/ti/img/boot_flow_01.svg @@ -0,0 +1,220 @@ + +http://www.inkscape.org/namespaces/inkscape; + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd; + xmlns:xlink="http://www.w3.org/1999/xlink; + xmlns="http://www.w3.org/2000/svg; + xmlns:svg="http://www.w3.org/2000/svg; + xmlns:xhtml="http://www.w3.org/1999/xhtml;> + + + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + WKUP Domain + + + +WKUP Domain + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + ROM + + + +ROM + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + WKUP SPL + + + +WKUP SPL + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + id="g42" /> +https://www.diagrams.net/doc/faq/svg-export-text-problems; + target="_blank" + id="a46"> + Text is not SVG - cannot display + + + diff --git a/doc/board/ti/img/boot_flow_02.svg b/doc/board/ti/img/boot_flow_02.svg new file mode 100644 index ..4e282d8baf04 --- /dev/null +++ b/doc/board/ti/img/boot_flow_02.svg @@ -0,0 +1,459 @@ + +http://www.inkscape.org/namespaces/inkscape; + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd; + xmlns:xlink="http://www.w3.org/1999/xlink; + xmlns="http://www.w3.org/2000/svg; + xmlns:svg="http://www.w3.org/2000/svg; + xmlns:xhtml="http://www.w3.org/1999/xhtml;> + + + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + WKUP Domain + + + +WKUP Domain + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + ROM + + + +ROM + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + WKUP SPL + + + +WKUP SPL + + + + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + Main Domain + + + +Main Domain + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + TF-A + + + +TF-A + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + OP-TEE + + + +OP-TEE + + + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + Main SPL + + + +Main SPL + + + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + id="g96" /> +https://www.diagrams.net/doc/faq/svg-export-text-problems; + target="_blank" + id="a100"> + Text is not SVG - cannot display + + + diff --git a/doc/board/ti/img/boot_flow_03.svg b/doc/board/ti/img/boot_flow_03.svg new file mode 100644 index ..b77d679926d4 --- /dev/null +++ b/doc/board/ti/img/boot_flow_03.svg @@ -0,0 +1,583 @@ +
[PATCH V2 07/19] doc: board: ti: j721e: Convert the image format to svg
Convert the image format into svg that can be reused across platforms as needed. Signed-off-by: Nishanth Menon --- Changes since V1 * Dia updates V1: https://lore.kernel.org/all/20230727080027.2817701-8...@ti.com/ .../ti/img/no_multi_cert_tiboot3.bin.svg | 238 + doc/board/ti/img/sysfw.itb.svg| 317 ++ doc/board/ti/j721e_evm.rst| 68 +--- 3 files changed, 559 insertions(+), 64 deletions(-) create mode 100644 doc/board/ti/img/no_multi_cert_tiboot3.bin.svg create mode 100644 doc/board/ti/img/sysfw.itb.svg diff --git a/doc/board/ti/img/no_multi_cert_tiboot3.bin.svg b/doc/board/ti/img/no_multi_cert_tiboot3.bin.svg new file mode 100644 index ..557dbf0c0402 --- /dev/null +++ b/doc/board/ti/img/no_multi_cert_tiboot3.bin.svg @@ -0,0 +1,238 @@ + +http://www.inkscape.org/namespaces/inkscape; + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd; + xmlns:xlink="http://www.w3.org/1999/xlink; + xmlns="http://www.w3.org/2000/svg; + xmlns:svg="http://www.w3.org/2000/svg; + xmlns:xhtml="http://www.w3.org/1999/xhtml;> + + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + X.509 Certificate + + + +X.509 Cert... + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + R5 +u-boot-spl.bin + + + +R5... + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + DTB 1..N + + + +DTB 1..N + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + FIT Header + + + +FIT Header + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + id="g42" /> +https://www.drawio.com/doc/faq/svg-export-text-problems; + target="_blank" + id="a46"> + Text is not SVG - cannot display + + + diff --git a/doc/board/ti/img/sysfw.itb.svg b/doc/board/ti/img/sysfw.itb.svg new file mode 100644 index ..2d6640a6e2d0 --- /dev/null +++ b/doc/board/ti/img/sysfw.itb.svg @@ -0,0 +1,317 @@ + +http://www.inkscape.org/namespaces/inkscape; + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd; + xmlns:xlink="http://www.w3.org/1999/xlink; + xmlns="http://www.w3.org/2000/svg; + xmlns:svg="http://www.w3.org/2000/svg; + xmlns:xhtml="http://www.w3.org/1999/xhtml;> + + + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + FIT Header + + + +FIT Header + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + sysfw.bin + + + +sysfw.bin + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + board config + + + +board config + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + PM config + + + +PM config + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + RM config + + + +RM config + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + style="overflow: visible; text-align: left;"> + + + Secure config + + + +Secure config + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + id="g925" /> +https://www.diagrams.net/doc/faq/svg-export-text-problems; + target="_blank" + id="a929"> + Text is not SVG - cannot display + + + diff --git a/doc/board/ti/j721e_evm.rst b/doc/board/ti/j721e_evm.rst index 45d80fc6ef44..64cdfc396ac4 100644 --- a/doc/board/ti/j721e_evm.rst +++ b/doc/board/ti/j721e_evm.rst @@ -126,77 +126,17 @@ Copy the below images to an SD card and boot: Image formats: -- -- tiboot3.bin: +- tiboot3.bin -.. code-block:: text - -+---+ -|X.509 | -| Certificate |
[PATCH V2 01/19] doc: board: ti: Optimize sources references
We have duplication of sources which makes it hard to sustain across the board, but at the same time, we'd like to ensure readers get specific information without having to cross refer to different documentation to get piecemeal information that they need to put together. Reviewed-by: Neha Malcom Francis Reviewed-by: Tom Rini Signed-off-by: Nishanth Menon --- Changes since V1 * just picked reviewed-by V1: https://lore.kernel.org/all/20230727080027.2817701-2...@ti.com/ doc/board/ti/am62x_sk.rst | 17 +++-- doc/board/ti/am65x_evm.rst | 17 +++-- doc/board/ti/j7200_evm.rst | 17 +++-- doc/board/ti/j721e_evm.rst | 17 +++-- doc/board/ti/k3.rst| 4 5 files changed, 16 insertions(+), 56 deletions(-) diff --git a/doc/board/ti/am62x_sk.rst b/doc/board/ti/am62x_sk.rst index 3a122b075641..ba017a2b489e 100644 --- a/doc/board/ti/am62x_sk.rst +++ b/doc/board/ti/am62x_sk.rst @@ -115,21 +115,10 @@ Below is the pictorial representation of boot flow: Sources: -1. Trusted Firmware-A: - Tree: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/ - Branch: master - -2. OP-TEE: - Tree: https://github.com/OP-TEE/optee_os.git - Branch: master - -3. U-Boot: - Tree: https://source.denx.de/u-boot/u-boot - Branch: master -4. TI Linux Firmware: - Tree: git://git.ti.com/processor-firmware/ti-linux-firmware.git - Branch: ti-linux-firmware +.. include:: k3.rst +:start-after: .. k3_rst_include_start_boot_sources +:end-before: .. k3_rst_include_end_boot_sources Build procedure: diff --git a/doc/board/ti/am65x_evm.rst b/doc/board/ti/am65x_evm.rst index 300cd3e9b960..466f720116b2 100644 --- a/doc/board/ti/am65x_evm.rst +++ b/doc/board/ti/am65x_evm.rst @@ -117,21 +117,10 @@ instead use Falcon boot flow to reduce boot time. Sources: -1. Trusted Firmware-A: -Tree: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/ -Branch: master - -2. OP-TEE: -Tree: https://github.com/OP-TEE/optee_os.git -Branch: master - -3. U-Boot: -Tree: https://source.denx.de/u-boot/u-boot -Branch: master -4. TI Linux Firmware: -Tree: git://git.ti.com/processor-firmware/ti-linux-firmware.git -Branch: ti-linux-firmware +.. include:: k3.rst +:start-after: .. k3_rst_include_start_boot_sources +:end-before: .. k3_rst_include_end_boot_sources Build procedure: diff --git a/doc/board/ti/j7200_evm.rst b/doc/board/ti/j7200_evm.rst index 5e3d75059ca5..f81e3f43b7d7 100644 --- a/doc/board/ti/j7200_evm.rst +++ b/doc/board/ti/j7200_evm.rst @@ -120,21 +120,10 @@ Below is the pictorial representation of boot flow: Sources: -1. Trusted Firmware-A: - Tree: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/ - Branch: master - -2. OP-TEE: - Tree: https://github.com/OP-TEE/optee_os.git - Branch: master - -3. U-Boot: - Tree: https://source.denx.de/u-boot/u-boot - Branch: master -4. TI Linux Firmware: - Tree: git://git.ti.com/processor-firmware/ti-linux-firmware.git - Branch: ti-linux-firmware +.. include:: k3.rst +:start-after: .. k3_rst_include_start_boot_sources +:end-before: .. k3_rst_include_end_boot_sources Build procedure: diff --git a/doc/board/ti/j721e_evm.rst b/doc/board/ti/j721e_evm.rst index 46244197f346..1cc32a242dde 100644 --- a/doc/board/ti/j721e_evm.rst +++ b/doc/board/ti/j721e_evm.rst @@ -130,21 +130,10 @@ support. Below is the pictorial representation of boot flow: Sources: -1. Trusted Firmware-A: - Tree: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/ - Branch: master - -2. OP-TEE: - Tree: https://github.com/OP-TEE/optee_os.git - Branch: master - -3. U-Boot: - Tree: https://source.denx.de/u-boot/u-boot - Branch: master -4. TI Linux Firmware: - Tree: git://git.ti.com/processor-firmware/ti-linux-firmware.git - Branch: ti-linux-firmware +.. include:: k3.rst +:start-after: .. k3_rst_include_start_boot_sources +:end-before: .. k3_rst_include_end_boot_sources Build procedure: diff --git a/doc/board/ti/k3.rst b/doc/board/ti/k3.rst index 2db7bbdb42ec..2df57c9850ae 100644 --- a/doc/board/ti/k3.rst +++ b/doc/board/ti/k3.rst @@ -111,6 +111,8 @@ All scripts and code needed to build the `tiboot3.bin`, `tispl.bin` and `u-boot.img` for all K3 SoCs can be located at the following places online +.. k3_rst_include_start_boot_sources + * **Das U-Boot** | **source:** https://source.denx.de/u-boot/u-boot.git @@ -131,6 +133,8 @@ online | **source:** https://git.ti.com/git/processor-firmware/ti-linux-firmware.git | **branch:** ti-linux-firmware +.. k3_rst_include_end_boot_sources + Build Procedure --- -- 2.40.0
[PATCH V2 00/19] doc: board: ti: Cleanup documentation
As requested in the thread[1] and irc[2], this series cleansup board/ti documentation a bit. Highlights: * Reuse from k3.rst sources and build instructions at the same time satisfy needs of users to have a single page documentation on all the steps needed to build for a given platform. * Replace ascii diagrams with actual svg diagrams (I have used a mix of drawio and inkscape to develop these, though inkscape should be sufficient to keep it updated). This also allows reuse based on common patterns. * Convert all pending tables into list-tables * Add information for folks who are looking for board information incontext of the documentation itself. (ever wondered what board is this documentation talking about?) Changes from V1: * Document update to drop ARCH=arm and various fixes identified during review of V1 * Added a couple of patches (sorting board names and adding labels to reuse-memory maps) * Few reviewed by pickups from Neha and Tom * 3 new patches (bootflow cleanup, sorting boards in alpha order and labels to reuse memory map) V1: https://lore.kernel.org/all/20230727080027.2817701-1...@ti.com/ Nishanth Menon (19): doc: board: ti: Optimize sources references doc: board: ti: am62x/j7200: Update with common boot flow diagram doc: board: ti: am65x: Update with boot flow diagram doc: board: ti: j721e: Update with boot flow diagram doc: board: ti: k3: Reuse build instructions doc: board: ti: j7200: Convert the image format to svg doc: board: ti: j721e: Convert the image format to svg doc: board: ti: am65x: Convert the image format to svg doc: board: ti: am62x: Convert the image format to svg doc: board: ti: am62x_sk: Add labels to reuse memory map doc: board: ti: am62x_sk: Convert switch settings to list tables doc: board: ti: j7200_evm: Convert switch settings to list tables doc: board: ti: am65x_evm: Convert the UART boot responsibility to list table doc: board: ti: am65/j721e: Convert OSPI memory map to svg doc: board: ti: am65x_evm: Convert the emmc layout to svg doc: board: ti: j7200_evm: Convert the emmc layout to svg doc: board: ti: *: Add platform information doc: board: ti: k3: Sort the boards in alphabetical order board: ti: k3: Convert boot flow ascii flow to svg doc/board/ti/am62x_sk.rst | 243 +- doc/board/ti/am65x_evm.rst| 298 +-- doc/board/ti/img/boot_diagram_am65.svg| 1779 +++ doc/board/ti/img/boot_diagram_j721e.svg | 2012 + doc/board/ti/img/boot_diagram_k3_current.svg | 1925 doc/board/ti/img/boot_flow_01.svg | 220 ++ doc/board/ti/img/boot_flow_02.svg | 459 doc/board/ti/img/boot_flow_03.svg | 583 + doc/board/ti/img/dm_tispl.bin.svg | 317 +++ doc/board/ti/img/emmc_am65x_evm_boot0.svg | 748 ++ doc/board/ti/img/emmc_j7200_evm_boot01.svg| 662 ++ doc/board/ti/img/emmc_j7200_evm_udafs.svg | 505 + doc/board/ti/img/j7200_tiboot3.bin.svg| 447 doc/board/ti/img/multi_cert_tiboot3.bin.svg | 287 +++ .../ti/img/no_multi_cert_tiboot3.bin.svg | 238 ++ doc/board/ti/img/nodm_tispl.bin.svg | 277 +++ doc/board/ti/img/ospi_sysfw.svg | 721 ++ doc/board/ti/img/sysfw.itb.svg| 317 +++ doc/board/ti/j7200_evm.rst| 298 +-- doc/board/ti/j721e_evm.rst| 267 +-- doc/board/ti/k3.rst | 136 +- 21 files changed, 11895 insertions(+), 844 deletions(-) create mode 100644 doc/board/ti/img/boot_diagram_am65.svg create mode 100644 doc/board/ti/img/boot_diagram_j721e.svg create mode 100644 doc/board/ti/img/boot_diagram_k3_current.svg create mode 100644 doc/board/ti/img/boot_flow_01.svg create mode 100644 doc/board/ti/img/boot_flow_02.svg create mode 100644 doc/board/ti/img/boot_flow_03.svg create mode 100644 doc/board/ti/img/dm_tispl.bin.svg create mode 100644 doc/board/ti/img/emmc_am65x_evm_boot0.svg create mode 100644 doc/board/ti/img/emmc_j7200_evm_boot01.svg create mode 100644 doc/board/ti/img/emmc_j7200_evm_udafs.svg create mode 100644 doc/board/ti/img/j7200_tiboot3.bin.svg create mode 100644 doc/board/ti/img/multi_cert_tiboot3.bin.svg create mode 100644 doc/board/ti/img/no_multi_cert_tiboot3.bin.svg create mode 100644 doc/board/ti/img/nodm_tispl.bin.svg create mode 100644 doc/board/ti/img/ospi_sysfw.svg create mode 100644 doc/board/ti/img/sysfw.itb.svg [1] https://lore.kernel.org/all/20230726164942.GW3630934@bill-the-cat/ [2] https://libera.irclog.whitequark.org/u-boot/2023-07-26 Regards, Nishanth Menon -- 2.40.0
[PATCH V2 12/19] doc: board: ti: j7200_evm: Convert switch settings to list tables
Use list tables to map up the dip switch settings Signed-off-by: Nishanth Menon --- Changes since V1 * No Change V1: https://lore.kernel.org/all/20230727080027.2817701-12...@ti.com/ doc/board/ti/j7200_evm.rst | 37 ++--- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/doc/board/ti/j7200_evm.rst b/doc/board/ti/j7200_evm.rst index 4786dc19d0d8..883e39949961 100644 --- a/doc/board/ti/j7200_evm.rst +++ b/doc/board/ti/j7200_evm.rst @@ -143,18 +143,33 @@ The following table shows some common boot modes used on J7200 platform. More details can be found in the Technical Reference Manual: https://www.ti.com/lit/pdf/spruiu1 under the `Boot Mode Pins` section. +.. list-table:: Boot Modes + :widths: 16 16 16 + :header-rows: 1 -*Boot Modes* - - = = -Switch Label SW9: 12345678 SW8: 12345678 - = = -SD 1010 -EMMC 0100 1000 -OSPI 0100 0110 -UART 0111 -USB DFU 0010 1000 - = = + * - Switch Label + - SW9: 12345678 + - SW8: 12345678 + + * - SD + - + - 1010 + + * - EMMC + - 0100 + - 1000 + + * - OSPI + - 0100 + - 0110 + + * - UART + - 0111 + - + + * - USB DFU + - 0010 + - 1000 For SW8 and SW9, the switch state in the "ON" position = 1. -- 2.40.0
[PATCH V2 17/19] doc: board: ti: *: Add platform information
Add link to the actual platform for folks to find details about the board in addition to the SoC's TRM. Signed-off-by: Nishanth Menon --- Changes since V1 * No Change V1: https://lore.kernel.org/all/20230727080027.2817701-17...@ti.com/ doc/board/ti/am62x_sk.rst | 4 doc/board/ti/am65x_evm.rst | 4 doc/board/ti/j7200_evm.rst | 4 doc/board/ti/j721e_evm.rst | 5 + 4 files changed, 17 insertions(+) diff --git a/doc/board/ti/am62x_sk.rst b/doc/board/ti/am62x_sk.rst index 6a88b694f826..045b312e8518 100644 --- a/doc/board/ti/am62x_sk.rst +++ b/doc/board/ti/am62x_sk.rst @@ -38,6 +38,10 @@ Some highlights of this SoC are: More details can be found in the Technical Reference Manual: https://www.ti.com/lit/pdf/spruiv7 +Platform information: + +* https://www.ti.com/tool/SK-AM62B + Boot Flow: -- Below is the pictorial representation of boot flow: diff --git a/doc/board/ti/am65x_evm.rst b/doc/board/ti/am65x_evm.rst index 4bb23e547b6c..8c13d5eb2fcd 100644 --- a/doc/board/ti/am65x_evm.rst +++ b/doc/board/ti/am65x_evm.rst @@ -24,6 +24,10 @@ cores, voltage domains and peripherals: More info can be found in TRM: http://www.ti.com/lit/pdf/spruid7 +Platform information: + +* https://www.ti.com/tool/TMDX654GPEVM + Boot Flow: -- On AM65x family devices, ROM supports boot only via MCU(R5). This means that diff --git a/doc/board/ti/j7200_evm.rst b/doc/board/ti/j7200_evm.rst index e335ff552ae5..1d62b33ae4df 100644 --- a/doc/board/ti/j7200_evm.rst +++ b/doc/board/ti/j7200_evm.rst @@ -26,6 +26,10 @@ specific processing cores and peripherals: More info can be found in TRM: https://www.ti.com/lit/pdf/spruiu1 +Platform information: + +* https://www.ti.com/tool/J7200XSOMXEVM + Boot Flow: -- Below is the pictorial representation of boot flow: diff --git a/doc/board/ti/j721e_evm.rst b/doc/board/ti/j721e_evm.rst index c8de97744b31..83aa8f8d2102 100644 --- a/doc/board/ti/j721e_evm.rst +++ b/doc/board/ti/j721e_evm.rst @@ -29,6 +29,11 @@ specific processing cores and peripherals: More info can be found in TRM: http://www.ti.com/lit/pdf/spruil1 +Platform information: + +* https://www.ti.com/tool/J721EXSOMXEVM +* https://www.ti.com/tool/SK-TDA4VM + Boot Flow: -- Boot flow is similar to that of AM65x SoC and extending it with remoteproc -- 2.40.0
[PATCH V2 03/19] doc: board: ti: am65x: Update with boot flow diagram
Update the bootflow svg diagram instead of the ascii version Reviewed-by: Neha Malcom Francis Signed-off-by: Nishanth Menon --- Changes since V1 * Picked up Reviewed-by, Dia updates V1: https://lore.kernel.org/all/20230727080027.2817701-4...@ti.com/ doc/board/ti/am65x_evm.rst | 71 +- doc/board/ti/img/boot_diagram_am65.svg | 1779 2 files changed, 1780 insertions(+), 70 deletions(-) create mode 100644 doc/board/ti/img/boot_diagram_am65.svg diff --git a/doc/board/ti/am65x_evm.rst b/doc/board/ti/am65x_evm.rst index 466f720116b2..7876886bc0d3 100644 --- a/doc/board/ti/am65x_evm.rst +++ b/doc/board/ti/am65x_evm.rst @@ -41,76 +41,7 @@ applications. This should happen before running Linux. 3. In production boot flow, we might not like to use full U-Boot, instead use Falcon boot flow to reduce boot time. -.. code-block:: text - - ++ - |DMSC| R5|A53| - ++ - |++ | | | - || Reset | | | | - |++ | | | - | : | | | - |++ | +---+ | | - || *ROM* |--|-->| Reset rls | | | - |++ | +---+ | | - ||| | : | | - || ROM | | : | | - ||services| | : | | - ||| | +-+ | | - ||| | | *R5 ROM* | | | - ||| | +-+ | | - |||<-|---|Load and auth| | | - ||| | | tiboot3.bin | | | - ||| | +-+ | | - ||| | : | | - ||| | : | | - ||| | : | | - ||| | +-+ | | - ||| | | *R5 SPL* | | | - ||| | +-+ | | - ||| | |Load | | | - ||| | | sysfw.itb | | | - || Start | | +-+ | | - || System |<-|---|Start| | | - ||Firmware| | |SYSFW| | | - |++ | +-+ | | - |: | | | | | - |+-+ | | Load | | | - || *SYSFW* | | | system| | | - |+-+ | | Config data | | | - || |<|---| | | | - || | | +-+ | | - || | | | | | | - || | | |DDR | | | - || | | | config| | | - || | | +-+ | | - || | | | | | | - || |<|---| Start A53 | | | - || | | | and Reset | | | - || | | +-+ | | - || | | | +---+ | - || |-|---|>| Reset rls | | - || | | | +---+ | - || DMSC | | | :| - ||Services | | | ++| - || |<|---|>|*ATF/OP-TEE*|| - || | | | ++| - || | | | :| - || | |
[PATCH V2 06/19] doc: board: ti: j7200: Convert the image format to svg
Convert the image format into svg that can be reused across platforms as needed. Signed-off-by: Nishanth Menon --- Changes since V1 * Doc updates V1: https://lore.kernel.org/all/20230727080027.2817701-7...@ti.com/ doc/board/ti/img/dm_tispl.bin.svg | 317 ++ doc/board/ti/img/j7200_tiboot3.bin.svg | 447 + doc/board/ti/j7200_evm.rst | 63 +--- 3 files changed, 767 insertions(+), 60 deletions(-) create mode 100644 doc/board/ti/img/dm_tispl.bin.svg create mode 100644 doc/board/ti/img/j7200_tiboot3.bin.svg diff --git a/doc/board/ti/img/dm_tispl.bin.svg b/doc/board/ti/img/dm_tispl.bin.svg new file mode 100644 index ..ffca67d0269e --- /dev/null +++ b/doc/board/ti/img/dm_tispl.bin.svg @@ -0,0 +1,317 @@ + +http://www.inkscape.org/namespaces/inkscape; + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd; + xmlns:xlink="http://www.w3.org/1999/xlink; + xmlns="http://www.w3.org/2000/svg; + xmlns:svg="http://www.w3.org/2000/svg; + xmlns:xhtml="http://www.w3.org/1999/xhtml;> + + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + FIT Header + + + +FIT Header + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + TF-A + + + +TF-A + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + OP-TEE + + + +OP-TEE + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + R5 DM FW + + + +R5 DM FW + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + Cortex-A SPL + + + +Cortex-A SPL + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + SPL DTB 1..N + + + +SPL DTB 1..N + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; + id="g58" /> +https://www.drawio.com/doc/faq/svg-export-text-problems; + target="_blank" + id="a62"> + Text is not SVG - cannot display + + + diff --git a/doc/board/ti/img/j7200_tiboot3.bin.svg b/doc/board/ti/img/j7200_tiboot3.bin.svg new file mode 100644 index ..f535310f76df --- /dev/null +++ b/doc/board/ti/img/j7200_tiboot3.bin.svg @@ -0,0 +1,447 @@ + +http://www.inkscape.org/namespaces/inkscape; + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd; + xmlns:xlink="http://www.w3.org/1999/xlink; + xmlns="http://www.w3.org/2000/svg; + xmlns:svg="http://www.w3.org/2000/svg; + xmlns:xhtml="http://www.w3.org/1999/xhtml;> + + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + X.509 Certificate + + + +X.509 Cert... + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + R5 +u-boot-spl.bin + + + +R5... + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + FIT Header + + + +FIT Header + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + DTB 1..N + + + +DTB 1..N + + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + sysfw.bin + + + +sysfw.bin + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + board config + + + +board config + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + PM config + + + +PM config + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + RM config + + + +RM config + + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility;> + + + Secure config + + + +Secure config + + + + +http://www.w3.org/TR/SVG11/feature#Extensibility; +
[PATCH V2 05/19] doc: board: ti: k3: Reuse build instructions
Introduce common variables to define a generic build instruction that is then used in specific board specific description. Labels are introduced in the evm.rst files to be then reused in variant board documentation as well. While at this, drop using ARCH=arm when building u-boot sources. This practice has been discouraged for some time and can potentially create problems with Kconfig rules related to aarch64. It's best to avoid this approach. Signed-off-by: Nishanth Menon --- Changes since V1 * Updates to fix up typos, ARCH=arm space before \ and misc. V1: https://lore.kernel.org/all/20230727080027.2817701-6...@ti.com/ doc/board/ti/am62x_sk.rst | 61 +--- doc/board/ti/am65x_evm.rst | 59 +-- doc/board/ti/j7200_evm.rst | 58 +-- doc/board/ti/j721e_evm.rst | 59 +-- doc/board/ti/k3.rst| 113 - 5 files changed, 251 insertions(+), 99 deletions(-) diff --git a/doc/board/ti/am62x_sk.rst b/doc/board/ti/am62x_sk.rst index f511b5935c16..080c15b1fe10 100644 --- a/doc/board/ti/am62x_sk.rst +++ b/doc/board/ti/am62x_sk.rst @@ -56,39 +56,60 @@ Sources: Build procedure: -1. Trusted Firmware-A: +0. Setup the environment variables: -.. code-block:: bash +.. include:: k3.rst +:start-after: .. k3_rst_include_start_common_env_vars_desc +:end-before: .. k3_rst_include_end_common_env_vars_desc - $ make CROSS_COMPILE=aarch64-none-linux-gnu- ARCH=aarch64 PLAT=k3 \ -TARGET_BOARD=lite SPD=opteed +.. include:: k3.rst +:start-after: .. k3_rst_include_start_board_env_vars_desc +:end-before: .. k3_rst_include_end_board_env_vars_desc -2. OP-TEE: +Set the variables corresponding to this platform: +.. include:: k3.rst +:start-after: .. k3_rst_include_start_common_env_vars_defn +:end-before: .. k3_rst_include_end_common_env_vars_defn .. code-block:: bash - $ make PLATFORM=k3 CFG_ARM64_core=y CROSS_COMPILE=arm-none-linux-gnueabihf- \ -CROSS_COMPILE64=aarch64-none-linux-gnu- + $ export UBOOT_CFG_CORTEXR=am62x_evm_r5_defconfig + $ export UBOOT_CFG_CORTEXA=am62x_evm_a53_defconfig + $ export TFA_BOARD=lite + $ # we dont use any extra TFA parameters + $ unset TFA_EXTRA_ARGS + $ export OPTEE_PLATFORM=k3-am62x + $ export OPTEE_EXTRA_ARGS="CFG_WITH_SOFTWARE_PRNG=y" -3. U-Boot: +.. am62x_evm_rst_include_start_build_steps -* 3.1 R5: +1. Trusted Firmware-A: -.. code-block:: bash +.. include:: k3.rst +:start-after: .. k3_rst_include_start_build_steps_tfa +:end-before: .. k3_rst_include_end_build_steps_tfa - $ make ARCH=arm am62x_evm_r5_defconfig - $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- \ -BINMAN_INDIRS= -* 3.2 A53: +2. OP-TEE: -.. code-block:: bash +.. include:: k3.rst +:start-after: .. k3_rst_include_start_build_steps_optee +:end-before: .. k3_rst_include_end_build_steps_optee + +3. U-Boot: - $ make ARCH=arm am62x_evm_a53_defconfig - $ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- \ -BL31=/build/k3/lite/release/bl31.bin \ -TEE=/out/arm-plat-k3/core/tee-raw.bin \ -BINMAN_INDIRS= +* 4.1 R5: + +.. include:: k3.rst +:start-after: .. k3_rst_include_start_build_steps_spl_r5 +:end-before: .. k3_rst_include_end_build_steps_spl_r5 + +* 4.2 A53: + +.. include:: k3.rst +:start-after: .. k3_rst_include_start_build_steps_uboot +:end-before: .. k3_rst_include_end_build_steps_uboot +.. am62x_evm_rst_include_end_build_steps Target Images -- diff --git a/doc/board/ti/am65x_evm.rst b/doc/board/ti/am65x_evm.rst index 7876886bc0d3..812fbc3f5093 100644 --- a/doc/board/ti/am65x_evm.rst +++ b/doc/board/ti/am65x_evm.rst @@ -55,38 +55,61 @@ Sources: Build procedure: -1. Trusted Firmware-A: +0. Setup the environment variables: -.. code-block:: bash +.. include:: k3.rst +:start-after: .. k3_rst_include_start_common_env_vars_desc +:end-before: .. k3_rst_include_end_common_env_vars_desc - $ make CROSS_COMPILE=aarch64-linux-gnu- ARCH=aarch64 PLAT=k3 \ -TARGET_BOARD=generic SPD=opteed +.. include:: k3.rst +:start-after: .. k3_rst_include_start_board_env_vars_desc +:end-before: .. k3_rst_include_end_board_env_vars_desc -2. OP-TEE: +Set the variables corresponding to this platform: +.. include:: k3.rst +:start-after: .. k3_rst_include_start_common_env_vars_defn +:end-before: .. k3_rst_include_end_common_env_vars_defn .. code-block:: bash - $ make PLATFORM=k3-am65x CFG_ARM64_core=y + $ export UBOOT_CFG_CORTEXR=am65x_evm_r5_defconfig + $ export UBOOT_CFG_CORTEXA=am65x_evm_a53_defconfig + $ export TFA_BOARD=generic + $ # we dont use any extra TFA parameters + $ unset TFA_EXTRA_ARGS + $ export OPTEE_PLATFORM=k3-am65x + $ # we dont use any extra OP-TEE parameters + $ unset OPTEE_EXTRA_ARGS + +.. am65x_evm_rst_include_start_build_steps + +1. Trusted Firmware-A: + +.. include:: k3.rst +:start-after: ..
[PATCH V2 13/19] doc: board: ti: am65x_evm: Convert the UART boot responsibility to list table
Use list tables to map up the UART Boot responsibility table. Signed-off-by: Nishanth Menon --- Changes since V1 * No Change V1: https://lore.kernel.org/all/20230727080027.2817701-13...@ti.com/ doc/board/ti/am65x_evm.rst | 38 -- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/doc/board/ti/am65x_evm.rst b/doc/board/ti/am65x_evm.rst index 4132dd98e1ad..5a72814035ae 100644 --- a/doc/board/ti/am65x_evm.rst +++ b/doc/board/ti/am65x_evm.rst @@ -273,16 +273,34 @@ ROM supports booting from MCU_UART0 via X-Modem protocol. The entire UART-based boot process up to U-Boot (proper) prompt goes through different stages and uses different UART peripherals as follows: -.. code-block:: text - - +-+---+-++ - | WHO | Loading WHAT | HW Module | Protocol | - +-+---+-++ - |Boot ROM | tiboot3.bin | MCU_UART0 | X-Modem(*)| - |R5 SPL | sysfw.itb| MCU_UART0 | Y-Modem(*)| - |R5 SPL | tispl.bin| MAIN_UART0 | Y-Modem | - |A53 SPL | u-boot.img | MAIN_UART0 | Y-Modem | - +-+---+-++ +.. list-table:: ROM UART Boot Responsibilities + :widths: 16 16 16 16 + :header-rows: 1 + + * - Who + - Loading What + - Hardware Module + - Protocol + + * - Boot ROM + - tiboot3.bin + - MCU_UART0 + - X-Modem(*) + + * - R5 SPL + - sysfw.itb + - MCU_UART0 + - Y-Modem(*) + + * - R5 SPL + - tispl.bin + - MAIN_UART0 + - Y-Modem + + * - A53 SPL + - u-boot.img + - MAIN_UART0 + - Y-Modem Note that in addition to X/Y-Modem related protocol timeouts the DMSC watchdog timeout of 3min (typ.) needs to be observed until System Firmware -- 2.40.0
[PATCH V2 11/19] doc: board: ti: am62x_sk: Convert switch settings to list tables
Use list tables to map up the dip switch settings Signed-off-by: Nishanth Menon --- Changes since V1 * No Change V1: https://lore.kernel.org/all/20230727080027.2817701-11...@ti.com/ doc/board/ti/am62x_sk.rst | 38 +++--- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/doc/board/ti/am62x_sk.rst b/doc/board/ti/am62x_sk.rst index 7deb61a3be52..6a88b694f826 100644 --- a/doc/board/ti/am62x_sk.rst +++ b/doc/board/ti/am62x_sk.rst @@ -212,16 +212,32 @@ The following table shows some common boot modes used on AM62 platform. More details can be found in the Technical Reference Manual: https://www.ti.com/lit/pdf/spruiv7 under the `Boot Mode Pins` section. -*Boot Modes* - - = = -Switch Label SW2: 12345678 SW3: 12345678 - = = -SD 0100 1110 -OSPI 11001110 -EMMC 11010010 -UART 11011100 -USB DFU 11001010 - = = +.. list-table:: Boot Modes + :widths: 16 16 16 + :header-rows: 1 + + * - Switch Label + - SW2: 12345678 + - SW3: 12345678 + + * - SD + - 0100 + - 1110 + + * - OSPI + - + - 11001110 + + * - EMMC + - + - 11010010 + + * - UART + - + - 11011100 + + * - USB DFU + - + - 11001010 For SW2 and SW1, the switch state in the "ON" position = 1. -- 2.40.0
[PATCH V2 10/19] doc: board: ti: am62x_sk: Add labels to reuse memory map
Add labels around the A53 SPL DDR memory layout to be able to reuse the memory map. Signed-off-by: Nishanth Menon --- New patch to help keep things easy for new am62x platforms to reuse memory map doc/board/ti/am62x_sk.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/board/ti/am62x_sk.rst b/doc/board/ti/am62x_sk.rst index dff10df41c7d..7deb61a3be52 100644 --- a/doc/board/ti/am62x_sk.rst +++ b/doc/board/ti/am62x_sk.rst @@ -144,6 +144,8 @@ Image formats: A53 SPL DDR Memory Layout - +.. am62x_evm_rst_include_start_ddr_mem_layout + This provides an overview memory usage in A53 SPL stage. .. list-table:: @@ -197,6 +199,7 @@ This provides an overview memory usage in A53 SPL stage. * - EMPTY - 0x80d00400 - 0x8100 +.. am62x_evm_rst_include_end_ddr_mem_layout Switch Setting for Boot Mode -- 2.40.0
Re: [PATCH 1/2] net: phy: Factor out PHY GPIO reset code
On Tue, Jun 20, 2023 at 12:45:54AM +0200, Marek Vasut wrote: > Pull the PHY GPIO reset code into separate function, since > this is and will be reused multiple times. Set up default > reset assert and deassert timing to generous 20ms and 1ms > for maximum compatibility in case those DT properties are > missing. > > Signed-off-by: Marek Vasut > Reviewed-by: Ramon Fried > --- > Cc: Joe Hershberger > Cc: Marek Vasut > Cc: Michal Simek > Cc: Nishanth Menon > Cc: Ramon Fried > --- > drivers/net/phy/ethernet_id.c | 37 --- > drivers/net/phy/phy.c | 47 +++ > include/phy.h | 9 +++ > 3 files changed, 61 insertions(+), 32 deletions(-) This introduces a fail to build on am335x_evm (and others) as before thee code was guarded by CONFIG_DM_ETH_PHY (which I haven't seen how then leads to DM_GPIO/SPL_DM_GPIO/etc being set) and now does not. -- Tom signature.asc Description: PGP signature
Re: [PATCH 5/9] board_f: Fix corruption of relocaddr
Hi Nikhil, On Wed, 26 Jul 2023 at 23:22, Nikhil M Jain wrote: > > Hi Simon, > > On 27/07/23 06:23, Simon Glass wrote: > > Hi Devarsh, > > > > On Wed, 26 Jul 2023 at 05:09, Devarsh Thakkar wrote: > >> > >> Hi Simon, > >> > >> On 26/07/23 02:58, Simon Glass wrote: > >>> Hi Devarsh, > >>> > >>> On Tue, 25 Jul 2023 at 03:21, Devarsh Thakkar wrote: > > Hi Simon, > > On 24/07/23 20:22, Simon Glass wrote: > > When the video framebuffer comes from the bloblist, we should not change > > relocaddr to this address, since it interfers with the normal memory > > allocation. > > > > This fixes a boot loop in qemu-x86_64 > > > > Signed-off-by: Simon Glass > > Fixes: 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL > > to u-boot") > > --- > > > > common/board_f.c | 1 - > > 1 file changed, 1 deletion(-) > > > > diff --git a/common/board_f.c b/common/board_f.c > > index 7d2c380e91e2..5c8646b22283 100644 > > --- a/common/board_f.c > > +++ b/common/board_f.c > > @@ -419,7 +419,6 @@ static int reserve_video(void) > >if (!ho) > >return log_msg_ret("blf", -ENOENT); > >video_reserve_from_bloblist(ho); > > - gd->relocaddr = ho->fb; > > I think this change was done as relocaddr pointer was required to be > updated > to move after frame-buffer reserved area to ensure that any further > memory > reservations done using gd->relocaddr (for e.g. in > reserve_trace/uboot/malloc) > don't overlap with frame-buffer reserved area passed from blob, so I > think > removing this line may cause further memory reservations to overlap with > reserved framebuffer. > > Could you please confirm? > >>> > >>> SPL and U-Boot have different memory layouts. The current code is > >>> interrupting U-Boot's careful building up of chunks of memory used for > >>> different purposes. > >>> > >> > >> But it is possible they could be using similar memory layout for some > >> components like framebuffer. > >> For e.g. in our case we are using same video_reserve func in A53 SPL too > >> and which allocates framebuffer from gd->relocaddr as seen here: > >> > >> https://source.denx.de/u-boot/u-boot/-/blob/v2023.10-rc1/common/board_f.c?ref_type=tags#L427 > > > > Even if it is similar, the point is that U-Boot proper needs to do its > > own allocation stuff. > > > > Of course, if SPL sets up the video, it will provide the framebuffer > > address, but only that. The other addresses need to be done using the > > normal mechanism. > > > >> > >>> The video memory has already been allocated by SPL, so we don't need > >>> to insert a new one here, as your code demonstrates. > >>> > >> > >> Agreed. > >> > >>> But also we have no way of knowing if it is legal to relocate U-Boot > >>> (and various other things) just below the frame buffer chosen by SPL. > >>> > >> > >> Yes, so i suppose your case is that framebuffer address which is being > >> passed > >> by SPL is totally disjoint and too far away from gd->relocaddr, for e.g. > >> it is > >> at the start (or bottom of DDR) and doesn't interfere with gd->relocaddr in > >> any manner since relocaddr points to ramtop (i.e. near to end address of > >> DDR). > >> > >> In that case I agree it doesn't make sense to move relocaddr to ho->fb. > >> > >> But for the scenario where gd->relocaddr and ho->fb are nearby there is > >> every > >> possibility that gd->relocaddr may overlap with framebuffer, also the code > >> in > >> reserve_trace, reserve_uboot doesn't have any intelligence or check that > >> it is > >> overlapping with framebuffer area or not. > >> > >> I think one thing that can probably be done here is to have a check that if > >> passed framebuffer area falls within current relocaddr region, then update > >> the > >> relocaddr else don't touch relocaddr : > >> > >> if (ho->fb <= gd->relocaddr - ho->size) > >>//It means framebuffer are is overlapping with current relocaddr so > >> update > >> relocaddr > >> gd->relocaddr = ho->fb > >> else > >>//don't update gd->relocaddr since ho->fb is disjoint to gd->relocaddr > >> > >> Could you please share your opinion on this and if above logic suffice your > >> case too ? > > > > I don't think this line is needed at all, which is why this patch > > removes it. What problem are you seeing? > > > Across SPL stage and U-boot we are keeping same memory layout and > ensuring that same memory regions are used, this way it doesn't > interfere in the way of u-boot while allocating memory regions for > various purposes. This allowed us to display splash screen without any > flicker across the stages. > > Now if you remove the line gd->relocaddr = ho->fb, the frame buffer > region will be used for reserving memory for other purposes which > corrupts the frame buffer. > > One solution which we are
[tom.r...@gmail.com: Fwd: New Defects reported by Coverity Scan for Das U-Boot]
Here's the latest report. -- Forwarded message - From: Date: Tue, Jul 25, 2023 at 5:29 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. 5 new defect(s) introduced to Das U-Boot found with Coverity Scan. 30 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 5 of 5 defect(s) ** CID 463147: Insecure data handling (TAINTED_SCALAR) *** CID 463147: Insecure data handling (TAINTED_SCALAR) /common/fdt_support.c: 1115 in fdt_copy_fixed_partitions() 1109res = fdt_setprop_string(blob, suboff, "label", 1110 ofnode_read_string(subnode, "label")); if (res) 1112return res; 1113 1114reg = ofnode_get_property(subnode, "reg", ); >>> CID 463147: Insecure data handling (TAINTED_SCALAR) >>> Passing tainted expression "len" to "fdt_setprop", which uses it as an >>> offset. 1115res = fdt_setprop(blob, suboff, "reg", reg, len); 1116if (res) 1117return res; 1118} 1119 1120/* go to next fixed-partitions node */ ** CID 463146: Null pointer dereferences (NULL_RETURNS) *** CID 463146: Null pointer dereferences (NULL_RETURNS) /common/fdt_support.c: 1115 in fdt_copy_fixed_partitions() 1109res = fdt_setprop_string(blob, suboff, "label", 1110 ofnode_read_string(subnode, "label")); if (res) 1112return res; 1113 1114reg = ofnode_get_property(subnode, "reg", ); >>> CID 463146: Null pointer dereferences (NULL_RETURNS) >>> Dereferencing a pointer that might be "NULL" "reg" when calling >>> "fdt_setprop". 1115res = fdt_setprop(blob, suboff, "reg", reg, len); 1116if (res) 1117return res; 1118} 1119 1120/* go to next fixed-partitions node */ ** CID 463145: Error handling issues (CHECKED_RETURN) /lib/efi_loader/efi_firmware.c: 176 in efi_firmware_get_lsv_from_dtb() *** CID 463145: Error handling issues (CHECKED_RETURN) /lib/efi_loader/efi_firmware.c: 176 in efi_firmware_get_lsv_from_dtb() 170 fdt_for_each_subnode(offset, fdt, parent) { 171 efi_guid_t guid; 172 173 guid_str = fdt_getprop(fdt, offset, "image-type-id", ); 174 if (!guid_str) 175 continue; >>> CID 463145: Error handling issues (CHECKED_RETURN) >>> Calling "uuid_str_to_bin" without checking return value (as is done >>> elsewhere 7 out of 8 times). 176 uuid_str_to_bin(guid_str, guid.b, UUID_STR_FORMAT_GUID); 177 178 val = fdt_getprop(fdt, offset, "image-index", ); 179 if (!val) 180 continue; 181 index = fdt32_to_cpu(*val); ** CID 463144:(CHECKED_RETURN) /boot/expo.c: 257 in expo_apply_theme() /boot/expo.c: 258 in expo_apply_theme() /boot/expo.c: 259 in expo_apply_theme() *** CID 463144:(CHECKED_RETURN) /boot/expo.c: 257 in expo_apply_theme() 251 struct expo_theme *theme = >theme; 252 int ret; 253 254 log_debug("Applying theme %s\n", ofnode_get_name(node)); 255 256 memset(theme, '\0', sizeof(struct expo_theme)); >>> CID 463144:(CHECKED_RETURN) >>> Calling "ofnode_read_u32" without checking return value (as is done >>> elsewhere 33 out of 41 times). 257 ofnode_read_u32(node, "font-size", >font_size); 258 ofnode_read_u32(node, "menu-inset", >menu_inset); 259 ofnode_read_u32(node, "menuitem-gap-y", >menuitem_gap_y); 260 261 list_for_each_entry(scn, >scene_head, sibling) { 262 ret = scene_apply_theme(scn, theme); /boot/expo.c: 258 in expo_apply_theme() 252 int ret; 253 254 log_debug("Applying theme %s\n", ofnode_get_name(node)); 255 256 memset(theme, '\0', sizeof(struct expo_theme)); 257 ofnode_read_u32(node, "font-size", >font_size); >>> CID 463144:(CHECKED_RETURN) >>>
Re: [PATCH v4 1/9] spl: Add generic spl_load function
On 7/27/23 02:17, Heinrich Schuchardt wrote: > On 7/24/23 19:12, Sean Anderson wrote: >> Implementers of SPL_LOAD_IMAGE_METHOD have to correctly determine what >> type of image is being loaded and then call the appropriate image load >> function correctly. This is tricky, because some image load functions >> expect the whole image to already be loaded (CONFIG_SPL_LOAD_FIT_FULL), >> some will load the image automatically using spl_load_info.read() >> (CONFIG_SPL_LOAD_FIT/CONFIG_SPL_LOAD_IMX_CONTAINER), and some just parse >> the header and expect the caller to do the actual loading afterwards >> (legacy/raw images). Load methods often only support a subset of the >> above methods, meaning that not all image types can be used with all >> load methods. Further, the code to invoke these functions is >> duplicated between different load functions. >> >> To address this problem, this commit introduces a "spl_load" function. >> It aims to handle image detection and correct invocation of each of the >> parse/load functions. spl_simple_read is a wrapper around >> spl_load_info.read with get_aligned_image* functions inlined for size >> purposes. Additionally, we assume that bl_len is a power of 2 so we can >> do bitshifts instead of divisions (which is smaller and faster). >> >> Signed-off-by: Sean Anderson >> Reviewed-by: Stefan Roese >> --- >> >> Changes in v4: >> - Fix format specifiers in debug prints >> - Reword/fix some of the doc comments for spl_load >> >> Changes in v3: >> - Fix using ffs instead of fls >> - Fix using not initializing bl_len when info->filename was NULL >> >> Changes in v2: >> - Use reverse-xmas-tree style for locals in spl_simple_read. This is not >> complete, since overhead depends on bl_mask. >> >> common/spl/spl.c | 68 >> include/spl.h | 29 - >> 2 files changed, 96 insertions(+), 1 deletion(-) >> >> diff --git a/common/spl/spl.c b/common/spl/spl.c >> index f09bb977814..3ef064009e8 100644 >> --- a/common/spl/spl.c >> +++ b/common/spl/spl.c >> @@ -450,6 +450,74 @@ int spl_parse_image_header(struct spl_image_info >> *spl_image, >> return 0; >> } >> >> +static int spl_simple_read(struct spl_load_info *info, void *buf, size_t >> size, >> + size_t offset) >> +{ >> + size_t bl_len = info->filename ? ARCH_DMA_MINALIGN : info->bl_len; >> + size_t bl_mask = bl_len - 1; >> + size_t overhead = offset & bl_mask; >> + size_t bl_shift = fls(bl_mask); >> + int ret; >> + >> + debug("%s: buf=%p size=%lx offset=%lx\n", __func__, buf, (long)size, >> + (long)offset); >> + debug("%s: bl_len=%lx bl_mask=%lx bl_shift=%lx\n", __func__, >> (long)bl_len, >> + (long)bl_mask, (long)bl_shift); >> + >> + buf -= overhead; >> + size = (size + overhead + bl_mask) >> bl_shift; >> + offset = offset >> bl_shift; >> + >> + debug("info->read(info, %lx, %lx, %p)\n", (ulong)offset, (ulong)size, >> + buf); >> + ret = info->read(info, offset, size, buf); >> + return ret == size ? 0 : -EIO; >> +} >> + >> +int spl_load(struct spl_image_info *spl_image, >> + const struct spl_boot_device *bootdev, struct spl_load_info *info, >> + struct legacy_img_hdr *header, size_t size, size_t sector) > > Hello Sean, > > carving out common functionality is really a good path forward. > > This function spl_load() receives a pointer to a read function in > info->read() and additionally the file header. > > Why can't we move the reading of the header to spl_load() too? That looks promising. The only downside is that FAT grows a bit since we can't determine the file size when we load the whole image. --Sean > >> +{ >> + int ret; >> + size_t offset = sector * info->bl_len; >> + >> + if (image_get_magic(header) == FDT_MAGIC) { >> + if (IS_ENABLED(CONFIG_SPL_LOAD_FIT_FULL)) { >> + void *buf; >> + >> + /* >> + * In order to support verifying images in the FIT, we >> + * need to load the whole FIT into memory. Try and >> + * guess how much we need to load by using the total >> + * size. This will fail for FITs with external data, >> + * but there's not much we can do about that. >> + */ >> + if (!size) >> + size = roundup(fdt_totalsize(header), 4); >> + buf = spl_get_load_buffer(0, size); >> + ret = spl_simple_read(info, buf, size, offset); >> + if (ret) >> + return ret; >> + >> + return spl_parse_image_header(spl_image, bootdev, buf); >> + } >> + >> + if (IS_ENABLED(CONFIG_SPL_LOAD_FIT)) >> + return spl_load_simple_fit(spl_image, info, sector, >> + header); >> + } >> + >> + if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER)) >> + return spl_load_imx_container(spl_image, info, sector); >> + >> + ret =
[PATCH 1/1] pci: correct function name in message
If an error message contains a function name, it should match the name of the function throwing the message. Fixes: 7739d93d8288 ("pci: Match region flags using a mask") Signed-off-by: Heinrich Schuchardt --- drivers/pci/pci-uclass.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index 632c1a63cf..7f3d6ddf91 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -1446,7 +1446,7 @@ phys_addr_t dm_pci_bus_to_phys(struct udevice *dev, pci_addr_t bus_addr, return res->phys_start + offset; } - puts("pci_hose_bus_to_phys: invalid physical address\n"); + puts("dm_pci_bus_to_phys: invalid physical address\n"); return 0; } @@ -1486,7 +1486,7 @@ pci_addr_t dm_pci_phys_to_bus(struct udevice *dev, phys_addr_t phys_addr, return res->bus_start + offset; } - puts("pci_hose_phys_to_bus: invalid physical address\n"); + puts("dm_pci_phys_to_bus: invalid physical address\n"); return 0; } -- 2.40.1
Re: [PULL] u-boot-usb/master
On Thu, Jul 27, 2023 at 12:22:23PM +0200, Marek Vasut wrote: > The following changes since commit 0274eb61e1f2a8e053fb028b6c668c67c0b75b9c: > > Merge tag 'efi-2023-10-rc1-2' of > https://source.denx.de/u-boot/custodians/u-boot-efi (2023-07-20 10:19:04 > -0400) > > are available in the Git repository at: > > git://source.denx.de/u-boot-usb.git master > > for you to fetch changes up to 3aba92c9dd2302a91b56d49791041766dcc7dfeb: > > usb: xhci: Fix double free on failure (2023-07-27 03:59:38 +0200) > Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH v17 09/10] arm_ffa: efi: introduce FF-A MM communication
On Thu, Jul 27, 2023 at 05:07:11PM +0100, Abdellatif El Khlifi wrote: > Add MM communication support using FF-A transport > > This feature allows accessing MM partitions services through > EFI MM communication protocol. MM partitions such as StandAlonneMM > or smm-gateway secure partitions which reside in secure world. > > An MM shared buffer and a door bell event are used to exchange > the data. > > The data is used by EFI services such as GetVariable()/SetVariable() > and copied from the communication buffer to the MM shared buffer. > > The secure partition is notified about availability of data in the > MM shared buffer by an FF-A message (door bell). > > On such event, MM SP can read the data and updates the MM shared > buffer with the response data. > > The response data is copied back to the communication buffer and > consumed by the EFI subsystem. > > MM communication protocol supports FF-A 64-bit direct messaging. > > Signed-off-by: Abdellatif El Khlifi > Tested-by: Gowtham Suresh Kumar > Reviewed-by: Simon Glass > Cc: Tom Rini > Cc: Ilias Apalodimas > Cc: Jens Wiklander > > --- > > Changelog: > === > > v17: > > * show a debug message rather than an error when FF-A is not detected [snip] > diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig > index c5835e6ef6..8fbadb9201 100644 > --- a/lib/efi_loader/Kconfig > +++ b/lib/efi_loader/Kconfig > @@ -55,13 +55,53 @@ config EFI_VARIABLE_FILE_STORE > stored as file /ubootefi.var on the EFI system partition. > > config EFI_MM_COMM_TEE > - bool "UEFI variables storage service via OP-TEE" > - depends on OPTEE > + bool "UEFI variables storage service via the trusted world" > + depends on OPTEE && ARM_FFA_TRANSPORT You didn't get my changes in here however. If you can do EFI_MM_COMM_TEE without ARM_FFA_TRANSPORT (as lx2160ardb_tfa_stmm_defconfig does) then you don't make this option depend on EFI_MM_COMM_TEE. If FF-A is only for use here, you make FF-A depend on this, and the FF-A specific variable depend on ARM_FFA_TRANSPORT. -- Tom signature.asc Description: PGP signature
[PATCH] configs: rock64-rk3328_defconfig: Enable ROCKCHIP_EFUSE
Enable missed CONFIG_ROCKCHIP_EFUSE to use fixed Ethernet MAC address. Signed-off-by: Matwey V. Kornilov --- configs/rock64-rk3328_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/rock64-rk3328_defconfig b/configs/rock64-rk3328_defconfig index 74a9cc0a7d..aba488bed0 100644 --- a/configs/rock64-rk3328_defconfig +++ b/configs/rock64-rk3328_defconfig @@ -71,6 +71,8 @@ CONFIG_FASTBOOT_BUF_ADDR=0x800800 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y +CONFIG_MISC=y +CONFIG_ROCKCHIP_EFUSE=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_SPI_FLASH_GIGADEVICE=y -- 2.26.2
Re: [PATCH v4.1 10/9] spl: Convert NVMe to spl_load
On 7/27/23 11:06, Heinrich Schuchardt wrote: > On 24.07.23 20:09, Sean Anderson wrote: >> This converts the blk load method (used exclusively by NVMe) to use >> spl_load. As a consequence, it also adds support for LOAD_FIT_FULL and >> IMX images. >> >> Signed-off-by: Sean Anderson >> --- >> As suggested by Heinrich. >> >> common/spl/spl_blk_fs.c | 62 ++--- >> 1 file changed, 14 insertions(+), 48 deletions(-) >> >> diff --git a/common/spl/spl_blk_fs.c b/common/spl/spl_blk_fs.c >> index d97adc4d39a..a0992f3838a 100644 >> --- a/common/spl/spl_blk_fs.c >> +++ b/common/spl/spl_blk_fs.c >> @@ -50,6 +50,12 @@ int spl_blk_load_image(struct spl_image_info *spl_image, >> loff_t actlen, filesize; >> struct blk_dev dev; >> int ret; >> + struct spl_load_info load = { >> + .read = spl_fit_read, >> + .bl_len = 1, >> + .filename = filename, >> + .priv = , >> + }; >> >> blk_desc = blk_get_devnum_by_uclass_id(uclass_id, devnum); >> if (!blk_desc) { >> @@ -75,6 +81,13 @@ int spl_blk_load_image(struct spl_image_info *spl_image, >> goto out; >> } >> >> + ret = fs_size(filename, ); >> + if (ret) { >> + printf("spl: unable to get file size: %s. Err - %d\n", >> + filename, ret); >> + goto out; >> + } >> + >> ret = fs_read(filename, (ulong)header, 0, >> sizeof(struct legacy_img_hdr), ); >> if (ret) { >> @@ -83,52 +96,5 @@ int spl_blk_load_image(struct spl_image_info *spl_image, >> goto out > > Hello Sean, > > Unfortunately this does not build. > > Here you have a goto out but below you delete the label. > > +common/spl/spl_blk_fs.c: In function 'spl_blk_load_image': > +common/spl/spl_blk_fs.c:96:17: error: label 'out' used but not defined > + 96 | goto out; > + | ^~~~ Ah, I thought I had build-tested this with sandbox_spl, but it enables SPL_NVMEM and not SPL_NVME. We really should have an in-tree config which enables this boot method. > Could you respin the complete series with all 10 patches, please. OK. --Sean > ; >> } >> >> - if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) && >> - image_get_magic(header) == FDT_MAGIC) { >> - struct spl_load_info load; >> - >> - debug("Found FIT\n"); >> - load.read = spl_fit_read; >> - load.bl_len = 1; >> - load.filename = (void *)filename; >> - load.priv = >> - >> - return spl_load_simple_fit(spl_image, , 0, header); >> - } >> - >> - ret = spl_parse_image_header(spl_image, bootdev, header); >> - if (ret) { >> - printf("spl: unable to parse image header. Err - %d\n", >> - ret); >> - goto out; >> - } >> - >> - ret = fs_set_blk_dev(dev.ifname, dev.dev_part_str, FS_TYPE_ANY); >> - if (ret) { >> - printf("spl: unable to set blk_dev %s %s. Err - %d\n", >> - dev.ifname, dev.dev_part_str, ret); >> - goto out; >> - } >> - >> - ret = fs_size(filename, ); >> - if (ret) { >> - printf("spl: unable to get file size: %s. Err - %d\n", >> - filename, ret); >> - goto out; >> - } >> - >> - ret = fs_set_blk_dev(dev.ifname, dev.dev_part_str, FS_TYPE_ANY); >> - if (ret) { >> - printf("spl: unable to set blk_dev %s %s. Err - %d\n", >> - dev.ifname, dev.dev_part_str, ret); >> - goto out; >> - } >> - >> - ret = fs_read(filename, (ulong)spl_image->load_addr, 0, filesize, >> - ); >> - if (ret) >> - printf("spl: unable to read file %s. Err - %d\n", >> - filename, ret); >> -out: >> - return ret; >> + return spl_load(spl_image, bootdev, , header, filesize, 0); >> } >
[PATCH v17 04/10] arm_ffa: introduce Arm FF-A support
Add Arm FF-A support 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. FF-A is a discoverable bus and similar to architecture features. FF-A bus is discovered using ARM_SMCCC_FEATURES mechanism performed by the PSCI driver. Clients are able to probe then use the FF-A bus by calling the DM class searching APIs (e.g: uclass_first_device). 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: - ffa_partition_info_get - ffa_sync_send_receive - ffa_rxtx_unmap Generic FF-A methods are implemented in the Uclass (arm-ffa-uclass.c). Arm specific methods are implemented in the Arm driver (arm-ffa.c). 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 Reviewed-by: Simon Glass Reviewed-by: Ilias Apalodimas Cc: Tom Rini Cc: Jens Wiklander Cc: Heinrich Schuchardt --- Changelog: === v13: * doc minor change: specify in the readme that the user should call ffa_rxtx_unmap() driver operation to unmap the RX/TX buffers on demand. v12: * remove dscvry_info * replace dscvry_info.invoke_ffa_fn() with a weak invoke_ffa_fn (user drivers can override it) * improve FFA_PARTITION_INFO_GET implementation (clients no longer need to calloc a buffer) * address nits v11: * move ffa_try_discovery() from the uclass to the Arm FF-A driver * rename ffa_try_discovery() to arm_ffa_discover() * pass dev as an argument of arm_ffa_discover() * add arm_ prefix to the Arm FF-A driver functions * add emul field in struct ffa_discovery_info * address nits v10: * provide the driver operations through the Uclass * move the generic FF-A methods to the Uclass * keep Arm specific methods in the Arm driver (arm-ffa.c) * rename core.c to arm-ffa.c * address nits v9: * integrate the FF-A bus discovery in the DM and use ARM_SMCCC_FEATURES for binding v8: * make ffa_get_partitions_info() second argument to be an SP count in both modes * update ffa_bus_prvdata_get() to return a pointer rather than a pointer address * remove packing from ffa_partition_info and ffa_send_direct_data structures * pass the FF-A bus device to the bus operations 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 |8 + doc/arch/arm64.ffa.rst
[PATCH v17 06/10] arm_ffa: introduce sandbox FF-A support
Emulate Secure World's FF-A ABIs and allow testing U-Boot FF-A support Features of the sandbox FF-A support: - Introduce an FF-A emulator - Introduce an FF-A device driver for FF-A comms with emulated Secure World - Provides test methods allowing to read the status of the inspected ABIs The sandbox FF-A emulator supports only 64-bit direct messaging. Signed-off-by: Abdellatif El Khlifi Reviewed-by: Simon Glass Cc: Tom Rini Cc: Ilias Apalodimas Cc: Jens Wiklander Cc: Heinrich Schuchardt --- Changelog: === v12: * remove reparenting by making the emulator parent of the FF-A device in the DT * add invoke_ffa_fn() * address nits v11: * rename ffa_try_discovery() to sandbox_ffa_discover() * rename sandbox_ffa_query_core_state() to sandbox_query_ffa_emul_state() * store the sandbox emulator pointer in the FF-A device uc_priv (struct ffa_priv) * set the emulator as parent of the sandbox FF-A device v10: * split the FF-A sandbox support into an emulator and a driver * read FFA_VERSION and FFA_PARTITION_INFO_GET state using sandbox_ffa_query_core_state() * drop CONFIG_SANDBOX_FFA config * address nits v9: align FF-A sandbox driver with FF-A discovery through DM v8: update ffa_bus_prvdata_get() to return a pointer rather than a pointer address v7: state that sandbox driver supports only 64-bit direct messaging v4: align sandbox driver with the new FF-A driver interfaces and new way of error handling v1: introduce the sandbox driver MAINTAINERS | 3 +- arch/sandbox/dts/sandbox.dtsi | 9 + arch/sandbox/dts/test.dts | 8 + arch/sandbox/include/asm/sandbox_arm_ffa.h| 72 ++ .../include/asm/sandbox_arm_ffa_priv.h| 121 +++ configs/sandbox64_defconfig | 1 + configs/sandbox_defconfig | 1 + doc/arch/arm64.ffa.rst| 19 +- doc/arch/sandbox/sandbox.rst | 1 + drivers/firmware/arm-ffa/Kconfig | 13 +- drivers/firmware/arm-ffa/Makefile | 10 +- drivers/firmware/arm-ffa/ffa-emul-uclass.c| 720 ++ .../firmware/arm-ffa/sandbox_arm_ffa_priv.h | 14 - drivers/firmware/arm-ffa/sandbox_ffa.c| 110 +++ include/dm/uclass-id.h| 1 + 15 files changed, 1081 insertions(+), 22 deletions(-) create mode 100644 arch/sandbox/include/asm/sandbox_arm_ffa.h create mode 100644 arch/sandbox/include/asm/sandbox_arm_ffa_priv.h create mode 100644 drivers/firmware/arm-ffa/ffa-emul-uclass.c delete mode 100644 drivers/firmware/arm-ffa/sandbox_arm_ffa_priv.h create mode 100644 drivers/firmware/arm-ffa/sandbox_ffa.c diff --git a/MAINTAINERS b/MAINTAINERS index 7bfac78e59..7f4efb6358 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -269,12 +269,13 @@ F:configs/cortina_presidio-asic-pnand_defconfig ARM FF-A M: Abdellatif El Khlifi S: Maintained +F: arch/sandbox/include/asm/sandbox_arm_ffa.h +F: arch/sandbox/include/asm/sandbox_arm_ffa_priv.h F: cmd/armffa.c F: doc/arch/arm64.ffa.rst F: doc/usage/cmd/armffa.rst F: drivers/firmware/arm-ffa/ F: include/arm_ffa.h -F: include/sandbox_arm_ffa.h ARM FREESCALE IMX M: Stefano Babic diff --git a/arch/sandbox/dts/sandbox.dtsi b/arch/sandbox/dts/sandbox.dtsi index 30a305c4d2..94a08814b8 100644 --- a/arch/sandbox/dts/sandbox.dtsi +++ b/arch/sandbox/dts/sandbox.dtsi @@ -445,6 +445,15 @@ thermal { compatible = "sandbox,thermal"; }; + + arm-ffa-emul { + compatible = "sandbox,arm-ffa-emul"; + + sandbox-arm-ffa { + compatible = "sandbox,arm-ffa"; + }; + }; + }; _ec { diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index ff9f9222e6..96b5404991 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -1820,6 +1820,14 @@ extcon { compatible = "sandbox,extcon"; }; + + arm-ffa-emul { + compatible = "sandbox,arm-ffa-emul"; + + sandbox-arm-ffa { + compatible = "sandbox,arm-ffa"; + }; + }; }; #include "sandbox_pmic.dtsi" diff --git a/arch/sandbox/include/asm/sandbox_arm_ffa.h b/arch/sandbox/include/asm/sandbox_arm_ffa.h new file mode 100644 index 00..be2790f496 --- /dev/null +++ b/arch/sandbox/include/asm/sandbox_arm_ffa.h @@ -0,0 +1,72 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2022-2023 Arm Limited and/or its affiliates + * + * Authors: + * Abdellatif El Khlifi + */ + +#ifndef __SANDBOX_ARM_FFA_H +#define __SANDBOX_ARM_FFA_H + +#include + +/* + * This header provides public sandbox FF-A emulator declarations + * and declarations needed by FF-A sandbox clients + */ + +/* UUIDs strings of the emulated services */ +#define SANDBOX_SERVICE1_UUID
[PATCH v17 09/10] arm_ffa: efi: introduce FF-A MM communication
Add MM communication support using FF-A transport This feature allows accessing MM partitions services through EFI MM communication protocol. MM partitions such as StandAlonneMM or smm-gateway secure partitions which reside in secure world. An MM shared buffer and a door bell event are used to exchange the data. The data is used by EFI services such as GetVariable()/SetVariable() and copied from the communication buffer to the MM shared buffer. The secure partition is notified about availability of data in the MM shared buffer by an FF-A message (door bell). On such event, MM SP can read the data and updates the MM shared buffer with the response data. The response data is copied back to the communication buffer and consumed by the EFI subsystem. MM communication protocol supports FF-A 64-bit direct messaging. Signed-off-by: Abdellatif El Khlifi Tested-by: Gowtham Suresh Kumar Reviewed-by: Simon Glass Cc: Tom Rini Cc: Ilias Apalodimas Cc: Jens Wiklander --- Changelog: === v17: * show a debug message rather than an error when FF-A is not detected v16: * lib/efi_loader/Kconfig: rather than automatically selecting OPTEE and ARM_FFA_TRANSPORT configs by EFI_MM_COMM_TEE, set them as dependencies (Otherwise FF-A will be automatically enabled for boards that don't need it). v15: Simon: * replace FFA_SHARED_MM_BUFFER_* defines with configs v14: Ilias: * drop truncating var_payload->size when using FF-A * map the MM SP return codes to errnos v13: * remove FF-A and Optee ifdefs v12: * drop use of calloc when querying SPs * address nits v11: * rename select_ffa_mm_comms() to select_mm_comms() * improve the logic of MM transport selection in mm_communicate() * addressing nits v10: * use the FF-A driver Uclass operations * use uclass_first_device() * addressing nits v9: align how FF-A is used with FF-A discovery through DM v8: * isolate the compilation choices between FF-A and OP-TEE * update partition_info_get() second argument to be an SP count * pass NULL device pointer to the FF-A bus discovery and operations v7: * set the MM door bell event to use 64-bit direct messaging * issue a compile time error when one of these macros are not found : FFA_SHARED_MM_BUFFER_SIZE, FFA_SHARED_MM_BUFFER_OFFSET, FFA_SHARED_MM_BUFFER_ADDR * make mm_sp_svc_uuid static * replace EINVAL with ENOMEM in ffa_discover_mm_sp_id() when calloc() fails * improve use of unmap_sysmem() in ffa_mm_communicate() v6: * add FF-A runtime discovery at MM communication level * drop EFI runtime support for FF-A MM communication * revert the changes in include/mm_communication.h for efi_mm_communicate_header and smm_variable_access structures v4: * use the new FF-A driver interfaces * discover MM partitions at runtime * copy FF-A driver private data to EFI runtime section at ExitBootServices() * drop use of FFA_ERR_STAT_SUCCESS error code * replace EFI_BUFFER_TOO_SMALL with EFI_OUT_OF_RESOURCES in ffa_mm_communicate(). No need for efi_memcpy_runtime() anymore * revert the error log in mm_communicate() in case of failure * remove packed attribute from efi_mm_communicate_header and smm_variable_communicate_header v2: * set default values to 0 for FFA_SHARED_MM_BUFFER_SIZE, FFA_SHARED_MM_BUFFER_ADDR and MM_SP_UUID_DATA and add warnings v1: * introduce FF-A MM communication include/mm_communication.h| 13 ++ lib/efi_loader/Kconfig| 44 - lib/efi_loader/efi_variable_tee.c | 257 +- 3 files changed, 307 insertions(+), 7 deletions(-) diff --git a/include/mm_communication.h b/include/mm_communication.h index e65fbde60d..f17847583b 100644 --- a/include/mm_communication.h +++ b/include/mm_communication.h @@ -6,6 +6,9 @@ * Copyright (c) 2017, Intel Corporation. All rights reserved. * Copyright (C) 2020 Linaro Ltd. * Copyright (C) 2020 Linaro Ltd. + * Copyright 2022-2023 Arm Limited and/or its affiliates + *Authors: + * Abdellatif El Khlifi */ #ifndef _MM_COMMUNICATION_H_ @@ -13,6 +16,9 @@ #include +/* MM service UUID string (big-endian format). This UUID is common across all MM SPs */ +#define MM_SP_UUID "33d532ed-e699-0942-c09c-a798d9cd722d" + /* * Interface to the pseudo Trusted Application (TA), which provides a * communication channel with the Standalone MM (Management Mode) @@ -248,4 +254,11 @@ struct smm_variable_var_check_property { u16 name[]; }; +/* supported MM transports */ +enum mm_comms_select { + MM_COMMS_UNDEFINED, + MM_COMMS_FFA, + MM_COMMS_OPTEE +}; + #endif /* _MM_COMMUNICATION_H_ */ diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index c5835e6ef6..8fbadb9201 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -55,13 +55,53 @@ config EFI_VARIABLE_FILE_STORE stored as file /ubootefi.var on the EFI system partition. config EFI_MM_COMM_TEE - bool "UEFI variables storage
[PATCH v17 01/10] arm64: smccc: add support for SMCCCv1.2 x0-x17 registers
add support for x0-x17 registers used by the SMC calls In SMCCC v1.2 [1] arguments are passed in registers x1-x17. Results are returned in x0-x17. This work is inspired from the following kernel commit: arm64: smccc: Add support for SMCCCv1.2 extended input/output registers [1]: https://documentation-service.arm.com/static/5f8edaeff86e16515cdbe4c6?token= Signed-off-by: Abdellatif El Khlifi Reviewed-by: Ilias Apalodimas Reviewed-by: Jens Wiklander Reviewed-by: Simon Glass Cc: Tom Rini --- Changelog: === v9: * update the copyright string v7: * improve indentation of ARM_SMCCC_1_2_REGS_Xn_OFFS v4: * rename the commit title and improve description new commit title: the current v3: * port x0-x17 registers support from linux kernel as defined by SMCCCv1.2 commit title: arm64: smccc: add Xn registers support used by SMC calls arch/arm/cpu/armv8/smccc-call.S | 57 - arch/arm/lib/asm-offsets.c | 16 + include/linux/arm-smccc.h | 45 ++ 3 files changed, 117 insertions(+), 1 deletion(-) diff --git a/arch/arm/cpu/armv8/smccc-call.S b/arch/arm/cpu/armv8/smccc-call.S index dc92b28777..93f66d3366 100644 --- a/arch/arm/cpu/armv8/smccc-call.S +++ b/arch/arm/cpu/armv8/smccc-call.S @@ -1,7 +1,11 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (c) 2015, Linaro Limited - */ + * Copyright 2022-2023 Arm Limited and/or its affiliates + * + * Authors: + * Abdellatif El Khlifi +*/ #include #include #include @@ -45,3 +49,54 @@ ENDPROC(__arm_smccc_smc) ENTRY(__arm_smccc_hvc) SMCCC hvc ENDPROC(__arm_smccc_hvc) + +#ifdef CONFIG_ARM64 + + .macro SMCCC_1_2 instr + /* Save `res` and free a GPR that won't be clobbered */ + stp x1, x19, [sp, #-16]! + + /* Ensure `args` won't be clobbered while loading regs in next step */ + mov x19, x0 + + /* Load the registers x0 - x17 from the struct arm_smccc_1_2_regs */ + ldp x0, x1, [x19, #ARM_SMCCC_1_2_REGS_X0_OFFS] + ldp x2, x3, [x19, #ARM_SMCCC_1_2_REGS_X2_OFFS] + ldp x4, x5, [x19, #ARM_SMCCC_1_2_REGS_X4_OFFS] + ldp x6, x7, [x19, #ARM_SMCCC_1_2_REGS_X6_OFFS] + ldp x8, x9, [x19, #ARM_SMCCC_1_2_REGS_X8_OFFS] + ldp x10, x11, [x19, #ARM_SMCCC_1_2_REGS_X10_OFFS] + ldp x12, x13, [x19, #ARM_SMCCC_1_2_REGS_X12_OFFS] + ldp x14, x15, [x19, #ARM_SMCCC_1_2_REGS_X14_OFFS] + ldp x16, x17, [x19, #ARM_SMCCC_1_2_REGS_X16_OFFS] + + \instr #0 + + /* Load the `res` from the stack */ + ldr x19, [sp] + + /* Store the registers x0 - x17 into the result structure */ + stp x0, x1, [x19, #ARM_SMCCC_1_2_REGS_X0_OFFS] + stp x2, x3, [x19, #ARM_SMCCC_1_2_REGS_X2_OFFS] + stp x4, x5, [x19, #ARM_SMCCC_1_2_REGS_X4_OFFS] + stp x6, x7, [x19, #ARM_SMCCC_1_2_REGS_X6_OFFS] + stp x8, x9, [x19, #ARM_SMCCC_1_2_REGS_X8_OFFS] + stp x10, x11, [x19, #ARM_SMCCC_1_2_REGS_X10_OFFS] + stp x12, x13, [x19, #ARM_SMCCC_1_2_REGS_X12_OFFS] + stp x14, x15, [x19, #ARM_SMCCC_1_2_REGS_X14_OFFS] + stp x16, x17, [x19, #ARM_SMCCC_1_2_REGS_X16_OFFS] + + /* Restore original x19 */ + ldp xzr, x19, [sp], #16 + ret + .endm + +/* + * void arm_smccc_1_2_smc(const struct arm_smccc_1_2_regs *args, + * struct arm_smccc_1_2_regs *res); + */ +ENTRY(arm_smccc_1_2_smc) + SMCCC_1_2 smc +ENDPROC(arm_smccc_1_2_smc) + +#endif diff --git a/arch/arm/lib/asm-offsets.c b/arch/arm/lib/asm-offsets.c index 6de0ce9152..181a8ac4c2 100644 --- a/arch/arm/lib/asm-offsets.c +++ b/arch/arm/lib/asm-offsets.c @@ -9,6 +9,11 @@ * generate asm statements containing #defines, * compile this file to assembler, and then extract the * #defines from the assembly-language output. + * + * Copyright 2022-2023 Arm Limited and/or its affiliates + * + * Authors: + * Abdellatif El Khlifi */ #include @@ -90,6 +95,17 @@ int main(void) DEFINE(ARM_SMCCC_RES_X2_OFFS, offsetof(struct arm_smccc_res, a2)); DEFINE(ARM_SMCCC_QUIRK_ID_OFFS, offsetof(struct arm_smccc_quirk, id)); DEFINE(ARM_SMCCC_QUIRK_STATE_OFFS, offsetof(struct arm_smccc_quirk, state)); +#ifdef CONFIG_ARM64 + DEFINE(ARM_SMCCC_1_2_REGS_X0_OFFS, offsetof(struct arm_smccc_1_2_regs, a0)); + DEFINE(ARM_SMCCC_1_2_REGS_X2_OFFS, offsetof(struct arm_smccc_1_2_regs, a2)); + DEFINE(ARM_SMCCC_1_2_REGS_X4_OFFS, offsetof(struct arm_smccc_1_2_regs, a4)); + DEFINE(ARM_SMCCC_1_2_REGS_X6_OFFS, offsetof(struct arm_smccc_1_2_regs, a6)); + DEFINE(ARM_SMCCC_1_2_REGS_X8_OFFS, offsetof(struct arm_smccc_1_2_regs, a8)); + DEFINE(ARM_SMCCC_1_2_REGS_X10_OFFS, offsetof(struct arm_smccc_1_2_regs, a10)); + DEFINE(ARM_SMCCC_1_2_REGS_X12_OFFS, offsetof(struct arm_smccc_1_2_regs, a12)); +
[PATCH v17 10/10] arm_ffa: efi: corstone1000: enable MM communication
turn on EFI MM communication On Corstone-1000 platform MM communication between u-boot and the secure world (Optee) is done using the FF-A bus. Changes made are generated using savedefconfig. Signed-off-by: Abdellatif El Khlifi Cc: Tom Rini Cc: Simon Glass Cc: Ilias Apalodimas Cc: Jens Wiklander --- Changelog: === v17: * use savedefconfig to generate corstone1000_defconfig with FF-A MM comms enabled v16: * configs/corstone1000_defconfig: enable MM communication by setting the configs: ARM_FFA_TRANSPORT, OPTEE, TEE v15: Simon: * use CONFIG_FFA_SHARED_MM_BUF_* configs in place of FFA_SHARED_MM_BUFFER_* v13: * remove FF-A config in the defconfig (because it's enabled automatically by CONFIG_EFI_MM_COMM_TEE) v9: * update copyright string v8: * drop OP-TEE configs from Corstone-1000 defconfig v7: * improve the definition of FFA_SHARED_MM_BUFFER_ADDR and FFA_SHARED_MM_BUFFER_OFFSET * update FFA_SHARED_MM_BUFFER_ADDR value v6: * corstone-1000: enable optee driver * corstone-1000: remove CONFIG_ARM_FFA_EFI_RUNTIME_MODE from the defconfig v4: * corstone-1000: turn on EFI MM communication configs/corstone1000_defconfig | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig index a8a79fd105..67684e114d 100644 --- a/configs/corstone1000_defconfig +++ b/configs/corstone1000_defconfig @@ -28,12 +28,10 @@ CONFIG_CMD_FWU_METADATA=y CONFIG_CMD_BOOTZ=y CONFIG_SYS_BOOTM_LEN=0x80 # CONFIG_CMD_XIMG is not set -CONFIG_CMD_NVMXIP=y CONFIG_CMD_GPT=y # CONFIG_RANDOM_UUID is not set CONFIG_CMD_LOADM=y # CONFIG_CMD_LOADS is not set -CONFIG_CMD_MMC=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set # CONFIG_CMD_NFS is not set @@ -45,8 +43,7 @@ CONFIG_OF_CONTROL=y CONFIG_VERSION_VARIABLE=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_REGMAP=y -CONFIG_FWU_MDATA=y -CONFIG_FWU_MDATA_GPT_BLK=y +CONFIG_ARM_FFA_TRANSPORT=y CONFIG_MISC=y # CONFIG_MMC is not set CONFIG_NVMXIP_QSPI=y @@ -59,9 +56,14 @@ CONFIG_DM_RTC=y CONFIG_RTC_EMULATION=y CONFIG_DM_SERIAL=y CONFIG_SYSRESET=y +CONFIG_TEE=y +CONFIG_OPTEE=y CONFIG_USB=y CONFIG_USB_ISP1760=y +CONFIG_ERRNO_STR=y +CONFIG_EFI_MM_COMM_TEE=y +CONFIG_FFA_SHARED_MM_BUF_SIZE=4096 +CONFIG_FFA_SHARED_MM_BUF_ADDR=0x0200 CONFIG_EFI_CAPSULE_ON_DISK=y CONFIG_EFI_IGNORE_OSINDICATIONS=y CONFIG_FWU_MULTI_BANK_UPDATE=y -CONFIG_ERRNO_STR=y -- 2.25.1
[PATCH v17 05/10] arm_ffa: introduce armffa command
Provide armffa command showcasing the use of the U-Boot FF-A support armffa is a command showcasing how to invoke FF-A operations. This provides a guidance to the client developers on how to call the FF-A bus interfaces. The command also allows to gather secure partitions information and ping these partitions. The command is also helpful in testing the communication with secure partitions. For more details please refer to the command documentation [1]. [1]: doc/usage/cmd/armffa.rst Signed-off-by: Abdellatif El Khlifi Reviewed-by: Simon Glass Cc: Tom Rini Cc: Ilias Apalodimas Cc: Jens Wiklander Cc: Heinrich Schuchardt --- Changelog: === v15: Simon: * armffa.c : integrate PHYS_ADDR_LN v14: Ilias: * address nits * in do_ffa_ping() reject the SP ID if it's 0 * use PHYS_ADDR_LN in formatting the physical addresses v12: * add subcommands argument checks * usage documentation: update command return codes * remove calloc when querying SPs * address nits v11: * use U_BOOT_CMD_WITH_SUBCMDS * address nits v10: * use the FF-A driver Uclass operations * use uclass_first_device() * address nits v9: * remove manual FF-A discovery and use DM * use DM class APIs to probe and interact with the FF-A bus * add doc/usage/cmd/armffa.rst v8: * update partition_info_get() second argument to be an SP count * pass NULL device pointer to the FF-A bus discovery and operations v7: * adapt do_ffa_dev_list() following the recent update on uclass_first_device/uclass_next_device functions (they return void now) * set armffa command to use 64-bit direct messaging v4: * remove pattern data in do_ffa_msg_send_direct_req v3: * use the new driver interfaces (partition_info_get, sync_send_receive) in armffa command v2: * replace use of ffa_helper_init_device function by ffa_helper_bus_discover v1: * introduce armffa command MAINTAINERS | 2 + cmd/Kconfig | 10 ++ cmd/Makefile | 1 + cmd/armffa.c | 202 +++ doc/arch/arm64.ffa.rst | 7 ++ doc/usage/cmd/armffa.rst | 94 ++ doc/usage/index.rst | 1 + drivers/firmware/arm-ffa/Kconfig | 1 + 8 files changed, 318 insertions(+) create mode 100644 cmd/armffa.c create mode 100644 doc/usage/cmd/armffa.rst diff --git a/MAINTAINERS b/MAINTAINERS index 4fd5768de0..7bfac78e59 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -269,7 +269,9 @@ F: configs/cortina_presidio-asic-pnand_defconfig ARM FF-A M: Abdellatif El Khlifi S: Maintained +F: cmd/armffa.c F: doc/arch/arm64.ffa.rst +F: doc/usage/cmd/armffa.rst F: drivers/firmware/arm-ffa/ F: include/arm_ffa.h F: include/sandbox_arm_ffa.h diff --git a/cmd/Kconfig b/cmd/Kconfig index 02e54f1e50..79b4f8367a 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -935,6 +935,16 @@ endmenu menu "Device access commands" +config CMD_ARMFFA + bool "Arm FF-A test command" + depends on ARM_FFA_TRANSPORT + help + Provides a test command for the FF-A support + supported options: + - Listing the partition(s) info + - Sending a data pattern to the specified partition + - Displaying the arm_ffa device info + config CMD_ARMFLASH #depends on FLASH_CFI_DRIVER bool "armflash" diff --git a/cmd/Makefile b/cmd/Makefile index 6c37521b4e..7d20a85a46 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -12,6 +12,7 @@ obj-y += panic.o obj-y += version.o # command +obj-$(CONFIG_CMD_ARMFFA) += armffa.o obj-$(CONFIG_CMD_2048) += 2048.o obj-$(CONFIG_CMD_ACPI) += acpi.o obj-$(CONFIG_CMD_ADDRMAP) += addrmap.o diff --git a/cmd/armffa.c b/cmd/armffa.c new file mode 100644 index 00..7e6eafc03a --- /dev/null +++ b/cmd/armffa.c @@ -0,0 +1,202 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2022-2023 Arm Limited and/or its affiliates + * + * Authors: + * Abdellatif El Khlifi + */ +#include +#include +#include +#include +#include +#include +#include + +/* Select the right physical address formatting according to the platform */ +#ifdef CONFIG_PHYS_64BIT +#define PhysAddrLength "ll" +#else +#define PhysAddrLength "" +#endif +#define PHYS_ADDR_LN "%" PhysAddrLength "x" + +/** + * ffa_get_dev() - Return the FF-A device + * @devp: pointer to the FF-A device + * + * Search for the FF-A device. + * + * Return: + * 0 on success. Otherwise, failure + */ +static int ffa_get_dev(struct udevice **devp) +{ + int ret; + + ret = uclass_first_device_err(UCLASS_FFA, devp); + if (ret) { + log_err("Cannot find FF-A bus device\n"); + return ret; + } + + return 0; +} + +/** + * do_ffa_getpart() - implementation of the getpart subcommand + * @cmdtp: Command Table + * @flag: flags + * @argc: number of arguments + * @argv: arguments +
[PATCH v17 07/10] arm_ffa: introduce sandbox test cases for UCLASS_FFA
Add functional test cases for the FF-A support These tests rely on the FF-A sandbox emulator and FF-A sandbox driver which help in inspecting the FF-A communication. Signed-off-by: Abdellatif El Khlifi Reviewed-by: Simon Glass Cc: Tom Rini Cc: Ilias Apalodimas Cc: Jens Wiklander Cc: Heinrich Schuchardt --- Changelog: === v12: * remove use of dscvry_info * drop use of calloc when querying SPs * address nits v11: * drop unmapping test (taken care of by the DM when removing the device) * address nits v10: * use the FF-A driver Uclass operations * use uclass_first_device() * replace CONFIG_SANDBOX_FFA with CONFIG_ARM_FFA_TRANSPORT * address nits v9: align FF-A sandbox tests with FF-A discovery through DM v8: * update partition_info_get() second argument to be an SP count * pass NULL device pointer to the FF-A bus discovery and operations v7: set the tests to use 64-bit direct messaging v4: align sandbox tests with the new FF-A driver interfaces and new way of error handling v1: introduce sandbox tests MAINTAINERS| 1 + doc/arch/arm64.ffa.rst | 1 + test/dm/Makefile | 3 +- test/dm/ffa.c | 261 + 4 files changed, 265 insertions(+), 1 deletion(-) create mode 100644 test/dm/ffa.c diff --git a/MAINTAINERS b/MAINTAINERS index 7f4efb6358..a79e3a8429 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -276,6 +276,7 @@ F: doc/arch/arm64.ffa.rst F: doc/usage/cmd/armffa.rst F: drivers/firmware/arm-ffa/ F: include/arm_ffa.h +F: test/dm/ffa.c ARM FREESCALE IMX M: Stefano Babic diff --git a/doc/arch/arm64.ffa.rst b/doc/arch/arm64.ffa.rst index b7c754fa3d..325fb80346 100644 --- a/doc/arch/arm64.ffa.rst +++ b/doc/arch/arm64.ffa.rst @@ -37,6 +37,7 @@ The U-Boot FF-A support provides the following parts: FF-A ABIs inspection methods. - An FF-A sandbox device driver for FF-A communication with the emulated Secure World. The driver leverages the FF-A Uclass to establish FF-A communication. +- Sandbox FF-A test cases. FF-A and SMC specifications --- diff --git a/test/dm/Makefile b/test/dm/Makefile index 3799b1ae8f..7ed00733c1 100644 --- a/test/dm/Makefile +++ b/test/dm/Makefile @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0+ # # Copyright (c) 2013 Google, Inc -# Copyright 2023 Arm Limited and/or its affiliates +# Copyright 2022-2023 Arm Limited and/or its affiliates obj-$(CONFIG_UT_DM) += test-dm.o @@ -92,6 +92,7 @@ obj-$(CONFIG_POWER_DOMAIN) += power-domain.o obj-$(CONFIG_ACPI_PMC) += pmc.o obj-$(CONFIG_DM_PMIC) += pmic.o obj-$(CONFIG_DM_PWM) += pwm.o +obj-$(CONFIG_ARM_FFA_TRANSPORT) += ffa.o obj-$(CONFIG_QFW) += qfw.o obj-$(CONFIG_RAM) += ram.o obj-y += regmap.o diff --git a/test/dm/ffa.c b/test/dm/ffa.c new file mode 100644 index 00..6912666bb4 --- /dev/null +++ b/test/dm/ffa.c @@ -0,0 +1,261 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Functional tests for UCLASS_FFA class + * + * Copyright 2022-2023 Arm Limited and/or its affiliates + * + * Authors: + * Abdellatif El Khlifi + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +/* Functional tests for the UCLASS_FFA */ + +static int check_fwk_version(struct ffa_priv *uc_priv, struct unit_test_state *uts) +{ + struct ffa_sandbox_data func_data; + u32 fwk_version = 0; + + func_data.data0 = _version; + func_data.data0_size = sizeof(fwk_version); + ut_assertok(sandbox_query_ffa_emul_state(FFA_VERSION, _data)); + ut_asserteq(uc_priv->fwk_version, fwk_version); + + return 0; +} + +static int check_endpoint_id(struct ffa_priv *uc_priv, struct unit_test_state *uts) +{ + ut_asserteq(0, uc_priv->id); + + return 0; +} + +static int check_rxtxbuf(struct ffa_priv *uc_priv, struct unit_test_state *uts) +{ + ut_assertnonnull(uc_priv->pair.rxbuf); + ut_assertnonnull(uc_priv->pair.txbuf); + + return 0; +} + +static int check_features(struct ffa_priv *uc_priv, struct unit_test_state *uts) +{ + ut_assert(uc_priv->pair.rxtx_min_pages == RXTX_4K || + uc_priv->pair.rxtx_min_pages == RXTX_16K || + uc_priv->pair.rxtx_min_pages == RXTX_64K); + + return 0; +} + +static int check_rxbuf_mapped_flag(u32 queried_func_id, + u8 rxbuf_mapped, + struct unit_test_state *uts) +{ + switch (queried_func_id) { + case FFA_RXTX_MAP: + ut_asserteq(1, rxbuf_mapped); + break; + case FFA_RXTX_UNMAP: + ut_asserteq(0, rxbuf_mapped); + break; + default: + ut_assert(false); + } + + return 0; +} + +static int check_rxbuf_release_flag(u8 rxbuf_owned, struct unit_test_state *uts) +{ + ut_asserteq(0, rxbuf_owned); + + return 0; +} + +static int
[PATCH v17 08/10] arm_ffa: introduce armffa command Sandbox test
Add Sandbox test for the armffa command Signed-off-by: Abdellatif El Khlifi Reviewed-by: Simon Glass Cc: Tom Rini Cc: Ilias Apalodimas Cc: Jens Wiklander --- Changelog: === v12: * address nits v10: * replace CMD_RET_SUCCESS with 0 * replace CONFIG_SANDBOX_FFA with CONFIG_ARM_FFA_TRANSPORT v9: align the test with FF-A discovery through DM v4: drop use of helper APIs v1: introduce armffa command sandbox test MAINTAINERS | 1 + test/cmd/Makefile | 2 ++ test/cmd/armffa.c | 33 + 3 files changed, 36 insertions(+) create mode 100644 test/cmd/armffa.c diff --git a/MAINTAINERS b/MAINTAINERS index a79e3a8429..bd3dba3d95 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -276,6 +276,7 @@ F: doc/arch/arm64.ffa.rst F: doc/usage/cmd/armffa.rst F: drivers/firmware/arm-ffa/ F: include/arm_ffa.h +F: test/cmd/armffa.c F: test/dm/ffa.c ARM FREESCALE IMX diff --git a/test/cmd/Makefile b/test/cmd/Makefile index a3cf983739..6e3d7e919e 100644 --- a/test/cmd/Makefile +++ b/test/cmd/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0+ # # Copyright (c) 2013 Google, Inc +# Copyright 2022-2023 Arm Limited and/or its affiliates ifdef CONFIG_HUSH_PARSER obj-$(CONFIG_CONSOLE_RECORD) += test_echo.o @@ -24,6 +25,7 @@ obj-$(CONFIG_CMD_SEAMA) += seama.o ifdef CONFIG_SANDBOX obj-$(CONFIG_CMD_READ) += rw.o obj-$(CONFIG_CMD_SETEXPR) += setexpr.o +obj-$(CONFIG_ARM_FFA_TRANSPORT) += armffa.o endif obj-$(CONFIG_CMD_TEMPERATURE) += temperature.o obj-$(CONFIG_CMD_WGET) += wget.o diff --git a/test/cmd/armffa.c b/test/cmd/armffa.c new file mode 100644 index 00..9a44a397e8 --- /dev/null +++ b/test/cmd/armffa.c @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Test for armffa command + * + * Copyright 2022-2023 Arm Limited and/or its affiliates + * + * Authors: + * Abdellatif El Khlifi + */ + +#include +#include +#include +#include +#include +#include + +/* Basic test of 'armffa' command */ +static int dm_test_armffa_cmd(struct unit_test_state *uts) +{ + /* armffa getpart */ + ut_assertok(run_command("armffa getpart " SANDBOX_SERVICE1_UUID, 0)); + + /* armffa ping */ + ut_assertok(run_commandf("armffa ping 0x%x", SANDBOX_SP1_ID)); + + /* armffa devlist */ + ut_assertok(run_command("armffa devlist", 0)); + + return 0; +} + +DM_TEST(dm_test_armffa_cmd, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC); -- 2.25.1
[PATCH v17 02/10] lib: uuid: introduce uuid_str_to_le_bin function
convert UUID string to little endian binary data Signed-off-by: Abdellatif El Khlifi Reviewed-by: Simon Glass Cc: Tom Rini Cc: Ilias Apalodimas Cc: Jens Wiklander --- Changelog: === v9: * add a full function prototype description in uuid.h v8: * use simple_strtoull() in uuid_str_to_le_bin() to support 32-bit platforms v7: * rename be_uuid_str_to_le_bin() to uuid_str_to_le_bin() * make uuid_str_to_le_bin() implementation similar to uuid_str_to_bin() by using same APIs v4: * rename ffa_uuid_str_to_bin to be_uuid_str_to_le_bin and put in a standalone commit (the current) v3: * introduce ffa_uuid_str_to_bin (provided by arm_ffa: introduce Arm FF-A low-level driver) include/uuid.h | 15 +++ lib/uuid.c | 48 2 files changed, 63 insertions(+) diff --git a/include/uuid.h b/include/uuid.h index 4a4883d3b5..89b93e642b 100644 --- a/include/uuid.h +++ b/include/uuid.h @@ -2,6 +2,10 @@ /* * Copyright (C) 2014 Samsung Electronics * Przemyslaw Marczak + * Copyright 2022-2023 Arm Limited and/or its affiliates + * + * Authors: + * Abdellatif El Khlifi */ #ifndef __UUID_H__ #define __UUID_H__ @@ -44,4 +48,15 @@ int uuid_guid_get_bin(const char *guid_str, unsigned char *guid_bin); const char *uuid_guid_get_str(const unsigned char *guid_bin); void gen_rand_uuid(unsigned char *uuid_bin); void gen_rand_uuid_str(char *uuid_str, int str_format); + +/** + * uuid_str_to_le_bin() - Convert string UUID to little endian binary data. + * @uuid_str: pointer to UUID string + * @uuid_bin: pointer to allocated array for little endian output [16B] + * Return: + *uuid_bin filled with little endian UUID data + *On success 0 is returned. Otherwise, failure code. + */ +int uuid_str_to_le_bin(const char *uuid_str, unsigned char *uuid_bin); + #endif diff --git a/lib/uuid.c b/lib/uuid.c index 96e1af3c8b..45f325d964 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -1,6 +1,10 @@ // SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2011 Calxeda, Inc. + * Copyright 2022-2023 Arm Limited and/or its affiliates + * + * Authors: + * Abdellatif El Khlifi */ #include @@ -354,6 +358,50 @@ int uuid_str_to_bin(const char *uuid_str, unsigned char *uuid_bin, return 0; } +/** + * uuid_str_to_le_bin() - Convert string UUID to little endian binary data. + * @uuid_str: pointer to UUID string + * @uuid_bin: pointer to allocated array for little endian output [16B] + * + * UUID string is 36 characters (36 bytes): + * + * ---- + * + * where x is a hexadecimal character. Fields are separated by '-'s. + * When converting to a little endian binary UUID, the string fields are reversed. + * + * Return: + * + *uuid_bin filled with little endian UUID data + *On success 0 is returned. Otherwise, failure code. + */ +int uuid_str_to_le_bin(const char *uuid_str, unsigned char *uuid_bin) +{ + u16 tmp16; + u32 tmp32; + u64 tmp64; + + if (!uuid_str_valid(uuid_str) || !uuid_bin) + return -EINVAL; + + tmp32 = cpu_to_le32(hextoul(uuid_str, NULL)); + memcpy(uuid_bin, , 4); + + tmp16 = cpu_to_le16(hextoul(uuid_str + 9, NULL)); + memcpy(uuid_bin + 4, , 2); + + tmp16 = cpu_to_le16(hextoul(uuid_str + 14, NULL)); + memcpy(uuid_bin + 6, , 2); + + tmp16 = cpu_to_le16(hextoul(uuid_str + 19, NULL)); + memcpy(uuid_bin + 8, , 2); + + tmp64 = cpu_to_le64(simple_strtoull(uuid_str + 24, NULL, 16)); + memcpy(uuid_bin + 10, , 6); + + return 0; +} + /* * uuid_bin_to_str() - convert big endian binary data to string UUID or GUID. * -- 2.25.1
[PATCH v17 03/10] lib: uuid: introduce testcase for uuid_str_to_le_bin
provide a test case Signed-off-by: Abdellatif El Khlifi Reviewed-by: Simon Glass Cc: Tom Rini --- Changelog: === v16: * MAINTAINERS: place the UUID part in an alphabetical order v11: * use ut_asserteq_mem() MAINTAINERS | 5 + test/lib/Makefile | 1 + test/lib/uuid.c | 41 + 3 files changed, 47 insertions(+) create mode 100644 test/lib/uuid.c diff --git a/MAINTAINERS b/MAINTAINERS index d724b64673..4324965d26 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1555,6 +1555,11 @@ T: git https://source.denx.de/u-boot/custodians/u-boot-usb.git topic-xhci F: drivers/usb/host/xhci* F: include/usb/xhci.h +UUID testing +M: Abdellatif El Khlifi +S: Maintained +F: test/lib/uuid.c + VIDEO M: Anatolij Gustschin S: Maintained diff --git a/test/lib/Makefile b/test/lib/Makefile index e0bd9e04e8..e75a263e6a 100644 --- a/test/lib/Makefile +++ b/test/lib/Makefile @@ -22,6 +22,7 @@ obj-$(CONFIG_AES) += test_aes.o obj-$(CONFIG_GETOPT) += getopt.o obj-$(CONFIG_CRC8) += test_crc8.o obj-$(CONFIG_UT_LIB_CRYPT) += test_crypt.o +obj-$(CONFIG_LIB_UUID) += uuid.o else obj-$(CONFIG_SANDBOX) += kconfig_spl.o endif diff --git a/test/lib/uuid.c b/test/lib/uuid.c new file mode 100644 index 00..e24331a136 --- /dev/null +++ b/test/lib/uuid.c @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Functional tests for UCLASS_FFA class + * + * Copyright 2022-2023 Arm Limited and/or its affiliates + * + * Authors: + * Abdellatif El Khlifi + */ + +#include +#include +#include +#include +#include + +/* test UUID */ +#define TEST_SVC_UUID "ed32d533-4209-99e6-2d72-cdd998a79cc0" + +#define UUID_SIZE 16 + +/* The UUID binary data (little-endian format) */ +static const u8 ref_uuid_bin[UUID_SIZE] = { + 0x33, 0xd5, 0x32, 0xed, + 0x09, 0x42, 0xe6, 0x99, + 0x72, 0x2d, 0xc0, 0x9c, + 0xa7, 0x98, 0xd9, 0xcd +}; + +static int lib_test_uuid_to_le(struct unit_test_state *uts) +{ + const char *uuid_str = TEST_SVC_UUID; + u8 ret_uuid_bin[UUID_SIZE] = {0}; + + ut_assertok(uuid_str_to_le_bin(uuid_str, ret_uuid_bin)); + ut_asserteq_mem(ref_uuid_bin, ret_uuid_bin, UUID_SIZE); + + return 0; +} + +LIB_TEST(lib_test_uuid_to_le, 0); -- 2.25.1
[PATCH v17 00/10] introduce Arm FF-A support
Adding support for Arm FF-A v1.0 (Arm Firmware Framework for Armv8-A) [A]. FF-A specifies interfaces that enable a pair of software execution environments aka partitions to communicate with each other. A partition could be a VM in the Normal or Secure world, an application in S-EL0, or a Trusted OS in S-EL1. FF-A is a discoverable bus and similar to architecture features. FF-A bus is discovered using ARM_SMCCC_FEATURES mechanism performed by the PSCI driver. => dm tree Class Index Probed DriverName --- ... firmware 0 [ + ] psci |-- psci ffa 0 [ ] arm_ffa | `-- arm_ffa ... Clients are able to probe then use the FF-A bus by calling the DM class searching APIs (e.g: uclass_first_device). This implementation of the specification provides support for Aarch64. The FF-A driver uses the SMC ABIs defined by the FF-A specification to: - Discover the presence of secure partitions (SPs) of interest - Access an SP's service through communication protocols (e.g: EFI MM communication protocol) The FF-A support provides the following features: - Being generic by design and can be used by any Arm 64-bit platform - FF-A support can be compiled and used without EFI - Support for SMCCCv1.2 x0-x17 registers - Support for SMC32 calling convention - Support for 32-bit and 64-bit FF-A direct messaging - Support for FF-A MM communication (compatible with EFI boot time) - Enabling FF-A and MM communication in Corstone1000 platform as a use case - A Uclass driver providing generic FF-A methods. - An Arm FF-A device driver providing Arm-specific methods and reusing the Uclass methods. - A sandbox emulator for Arm FF-A, emulates the FF-A side of the Secure World and provides FF-A ABIs inspection methods. - An FF-A sandbox device driver for FF-A communication with the emulated Secure World. The driver leverages the FF-A Uclass to establish FF-A communication. - Sandbox FF-A test cases. - A new command called armffa is provided as an example of how to access the FF-A bus For more details about the FF-A support please refer to [B] and refer to [C] for how to use the armffa command. Please find at [D] an example of the expected boot logs when enabling FF-A support for a platform. In this example the platform is Corstone1000. But it can be any Arm 64-bit platform. Changelog of changes: === v17: Ilias: * show a debug message rather than an error when FF-A is not detected Tom: * use savedefconfig to generate corstone1000_defconfig with FF-A MM comms enabled v16: [16] Tom: * lib/efi_loader/Kconfig: rather than automatically selecting OPTEE and ARM_FFA_TRANSPORT configs by EFI_MM_COMM_TEE, set them as dependencies (Otherwise FF-A will be automatically enabled for boards that don't need it). * configs/corstone1000_defconfig: enable MM communication by setting the configs: ARM_FFA_TRANSPORT, OPTEE, TEE v15: [15] Simon: * drop commit "log: select physical address formatting in a generic way", this will be sent as a follow-up commit independently from this patchset * armffa.c : integrate PHYS_ADDR_LN * replace FFA_SHARED_MM_BUFFER_* defines with configs v14: [14] Simon: * add to log.h a generic physical address formatting Ilias: * armffa command: in do_ffa_ping() reject the SP ID if it's 0 * MM comms: drop truncating var_payload->size when using FF-A * MM comms: map the MM SP return codes to errnos * address nits v13: [13] Ilias: * remove FF-A and Optee ifdefs in efi_variable_tee.c * doc minor change: specify in the readme that the user should call ffa_rxtx_unmap() driver operation to unmap the RX/TX buffers on demand. v12: [12] * remove the global variable (dscvry_info), use uc_priv instead * replace dscvry_info.invoke_ffa_fn() with a weak invoke_ffa_fn (user drivers can override it) * improve FFA_PARTITION_INFO_GET implementation (clients no longer need to calloc a buffer) * remove reparenting by making the sandbox emulator parent of the FF-A device in the DT * improve argument checks for the armffa command * address nits v11: [11] * move ffa_try_discovery() from the uclass to the Arm FF-A driver * rename ffa_try_discovery() to arm_ffa_discover() * add arm_ prefix to the Arm FF-A driver functions * use U_BOOT_CMD_WITH_SUBCMDS for armffa command * store the sandbox emulator pointer in the FF-A device uc_priv (struct ffa_priv) * set the emulator as parent of the sandbox FF-A device * rename select_ffa_mm_comms() to select_mm_comms() * improve the logic of MM transport selection in mm_communicate() * use ut_asserteq_mem() in uuid_str_to_le_bin test case * address nits v10: [10] * provide the FF-A driver operations through the Uclass (arm-ffa-uclass.c) * move the
[PATCH] gpio: Use separate bitfield array to indicate GPIO is claimed
The current gpio-uclass design uses name field in struct gpio_dev_priv as an indicator that GPIO is claimed by consumer. This overloads the function of name field and does not work well for named pins not configured as GPIO pins. Introduce separate bitfield array as the claim indicator. This unbreaks dual-purpose AF and GPIO operation on STM32MP since commit 2c38f7c31806 ("pinctrl: pinctrl_stm32: Populate uc_priv->name[] with pinmux node's name") where any pin which has already been configured as AF could no longer be claimed as dual-purpose GPIO. This is important for pins like STM32 MMCI st,cmd-gpios . Signed-off-by: Marek Vasut --- Cc: Michal Suchanek Cc: Patrice Chotard Cc: Patrick Delaunay Cc: Rasmus Villemoes Cc: Samuel Holland Cc: Simon Glass --- drivers/gpio/gpio-uclass.c | 35 ++- include/asm-generic/gpio.h | 2 ++ 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index 712119c3415..25873f07bd4 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -75,6 +75,20 @@ static int gpio_to_device(unsigned int gpio, struct gpio_desc *desc) return -ENOENT; } +/** + * gpio_is_claimed() - Test whether GPIO is claimed by consumer + * + * Test whether GPIO is claimed by consumer already. + * + * @uc_priv: gpio_dev_priv pointer. + * @offset:gpio offset within the device + * @return:true if claimed, false if not claimed + */ +static bool gpio_is_claimed(struct gpio_dev_priv *uc_priv, unsigned int offset) +{ + return !!(uc_priv->claimed[offset / 32] & BIT(offset % 32)); +} + #if CONFIG_IS_ENABLED(DM_GPIO_LOOKUP_LABEL) /** * dm_gpio_lookup_label() - look for name in gpio device @@ -94,7 +108,7 @@ static int dm_gpio_lookup_label(const char *name, *offset = -1; for (i = 0; i < uc_priv->gpio_count; i++) { - if (!uc_priv->name[i]) + if (!gpio_is_claimed(uc_priv, i)) continue; if (!strcmp(name, uc_priv->name[i])) { *offset = i; @@ -350,7 +364,7 @@ int dm_gpio_request(struct gpio_desc *desc, const char *label) int ret; uc_priv = dev_get_uclass_priv(dev); - if (uc_priv->name[desc->offset]) + if (gpio_is_claimed(uc_priv, desc->offset)) return -EBUSY; str = strdup(label); if (!str) @@ -362,6 +376,8 @@ int dm_gpio_request(struct gpio_desc *desc, const char *label) return ret; } } + + uc_priv->claimed[desc->offset / 32] |= BIT(desc->offset % 32); uc_priv->name[desc->offset] = str; return 0; @@ -438,7 +454,7 @@ int _dm_gpio_free(struct udevice *dev, uint offset) int ret; uc_priv = dev_get_uclass_priv(dev); - if (!uc_priv->name[offset]) + if (!gpio_is_claimed(uc_priv, offset)) return -ENXIO; if (ops->rfree) { ret = ops->rfree(dev, offset); @@ -446,6 +462,7 @@ int _dm_gpio_free(struct udevice *dev, uint offset) return ret; } + uc_priv->claimed[offset / 32] &= ~BIT(offset % 32); free(uc_priv->name[offset]); uc_priv->name[offset] = NULL; @@ -480,7 +497,7 @@ static int check_reserved(const struct gpio_desc *desc, const char *func) return -ENOENT; uc_priv = dev_get_uclass_priv(desc->dev); - if (!uc_priv->name[desc->offset]) { + if (!gpio_is_claimed(uc_priv, desc->offset)) { printf("%s: %s: error: gpio %s%d not reserved\n", desc->dev->name, func, uc_priv->bank_name ? uc_priv->bank_name : "", @@ -826,7 +843,7 @@ static int get_function(struct udevice *dev, int offset, bool skip_unused, return -EINVAL; if (namep) *namep = uc_priv->name[offset]; - if (skip_unused && !uc_priv->name[offset]) + if (skip_unused && !gpio_is_claimed(uc_priv, offset)) return GPIOF_UNUSED; if (ops->get_function) { int ret; @@ -1341,6 +1358,13 @@ static int gpio_post_probe(struct udevice *dev) if (!uc_priv->name) return -ENOMEM; + uc_priv->claimed = calloc(DIV_ROUND_UP(uc_priv->gpio_count, 32), + sizeof(*uc_priv->claimed)); + if (!uc_priv->claimed) { + free(uc_priv->name); + return -ENOMEM; + } + return gpio_renumber(NULL); } @@ -1353,6 +1377,7 @@ static int gpio_pre_remove(struct udevice *dev) if (uc_priv->name[i]) free(uc_priv->name[i]); } + free(uc_priv->claimed); free(uc_priv->name); return gpio_renumber(dev); diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index c4a7fd28439..a21c606f2b8 100644 --- a/include/asm-generic/gpio.h +++
Re: [PATCH v16 09/10] arm_ffa: efi: introduce FF-A MM communication
Hi Ilias, On Thu, Jul 27, 2023 at 12:58:57PM +0300, Ilias Apalodimas wrote: > On Wed, Jul 26, 2023 at 10:45:02AM +0100, Abdellatif El Khlifi wrote: > > Add MM communication support using FF-A transport > > > > This feature allows accessing MM partitions services through > > EFI MM communication protocol. MM partitions such as StandAlonneMM > > or smm-gateway secure partitions which reside in secure world. > > > > An MM shared buffer and a door bell event are used to exchange > > the data. > > > > The data is used by EFI services such as GetVariable()/SetVariable() > > and copied from the communication buffer to the MM shared buffer. > > > > The secure partition is notified about availability of data in the > > MM shared buffer by an FF-A message (door bell). > > > > On such event, MM SP can read the data and updates the MM shared > > buffer with the response data. > > > > The response data is copied back to the communication buffer and > > consumed by the EFI subsystem. > > > > MM communication protocol supports FF-A 64-bit direct messaging. > > > > Signed-off-by: Abdellatif El Khlifi > > Tested-by: Gowtham Suresh Kumar > > Is there a public record of thise tested-by? If not please don't inject > them like this or have Gowtham respond on the mailing list Yes, we tested the FF-A MM communication on the Corstone-1000 platform. We ran the UEFI SCT test suite containing EFI setVariable, getVariable and getNextVariable tests which involve FF-A MM communication and all tests are passing with the current changes. We made the SCT test reports (part of the ACS results) public following the latest Corstone-1000 release. Please find the test reports at [1]. Kind regards, Gowtham Suresh Kumar [1]: https://gitlab.arm.com/arm-reference-solutions/arm-reference-solutions-test-report/-/tree/master/embedded-a/corstone1000/CORSTONE1000-2023.06/acs_results_fpga.zip
Re: [PATCH v4.1 10/9] spl: Convert NVMe to spl_load
On 24.07.23 20:09, Sean Anderson wrote: This converts the blk load method (used exclusively by NVMe) to use spl_load. As a consequence, it also adds support for LOAD_FIT_FULL and IMX images. Signed-off-by: Sean Anderson --- As suggested by Heinrich. common/spl/spl_blk_fs.c | 62 ++--- 1 file changed, 14 insertions(+), 48 deletions(-) diff --git a/common/spl/spl_blk_fs.c b/common/spl/spl_blk_fs.c index d97adc4d39a..a0992f3838a 100644 --- a/common/spl/spl_blk_fs.c +++ b/common/spl/spl_blk_fs.c @@ -50,6 +50,12 @@ int spl_blk_load_image(struct spl_image_info *spl_image, loff_t actlen, filesize; struct blk_dev dev; int ret; + struct spl_load_info load = { + .read = spl_fit_read, + .bl_len = 1, + .filename = filename, + .priv = , + }; blk_desc = blk_get_devnum_by_uclass_id(uclass_id, devnum); if (!blk_desc) { @@ -75,6 +81,13 @@ int spl_blk_load_image(struct spl_image_info *spl_image, goto out; } + ret = fs_size(filename, ); + if (ret) { + printf("spl: unable to get file size: %s. Err - %d\n", + filename, ret); + goto out; + } + ret = fs_read(filename, (ulong)header, 0, sizeof(struct legacy_img_hdr), ); if (ret) { @@ -83,52 +96,5 @@ int spl_blk_load_image(struct spl_image_info *spl_image, goto out Hello Sean, Unfortunately this does not build. Here you have a goto out but below you delete the label. +common/spl/spl_blk_fs.c: In function 'spl_blk_load_image': +common/spl/spl_blk_fs.c:96:17: error: label 'out' used but not defined + 96 | goto out; + | ^~~~ Could you respin the complete series with all 10 patches, please. Best regards Heinrich ; } - if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) && - image_get_magic(header) == FDT_MAGIC) { - struct spl_load_info load; - - debug("Found FIT\n"); - load.read = spl_fit_read; - load.bl_len = 1; - load.filename = (void *)filename; - load.priv = - - return spl_load_simple_fit(spl_image, , 0, header); - } - - ret = spl_parse_image_header(spl_image, bootdev, header); - if (ret) { - printf("spl: unable to parse image header. Err - %d\n", - ret); - goto out; - } - - ret = fs_set_blk_dev(dev.ifname, dev.dev_part_str, FS_TYPE_ANY); - if (ret) { - printf("spl: unable to set blk_dev %s %s. Err - %d\n", - dev.ifname, dev.dev_part_str, ret); - goto out; - } - - ret = fs_size(filename, ); - if (ret) { - printf("spl: unable to get file size: %s. Err - %d\n", - filename, ret); - goto out; - } - - ret = fs_set_blk_dev(dev.ifname, dev.dev_part_str, FS_TYPE_ANY); - if (ret) { - printf("spl: unable to set blk_dev %s %s. Err - %d\n", - dev.ifname, dev.dev_part_str, ret); - goto out; - } - - ret = fs_read(filename, (ulong)spl_image->load_addr, 0, filesize, - ); - if (ret) - printf("spl: unable to read file %s. Err - %d\n", - filename, ret); -out: - return ret; + return spl_load(spl_image, bootdev, , header, filesize, 0); }
Re: [PATCHv4 2/5] net/lwip: add lwip library for the network stack
On Thu, 27 Jul 2023 at 19:29, Ilias Apalodimas wrote: > Hi Maxim, > > > This is too much for a single patch review. Can you pleas split it in > something that's easier to review and comment. > > For example, > #1 add the lwip library only > #2-#5 add ping, wget, tcp and ping > > Some random comments below as well. > > On Fri, Jul 14, 2023 at 08:19:57PM +0600, Maxim Uvarov wrote: > > This commit adds lwip library for the U-boot network > > stack. Supported commands: ping, tftp, dhcp and wget. > > > > Signed-off-by: Maxim Uvarov > > --- > > .gitignore| 9 + > > boot/bootmeth_pxe.c | 2 +- > > cmd/net.c | 48 + > > cmd/pxe.c | 2 +- > > include/net.h | 8 +- > > lib/Kconfig | 2 + > > lib/Makefile | 2 + > > lib/lwip/Kconfig | 63 ++ > > lib/lwip/Makefile | 101 ++ > > lib/lwip/apps/dhcp/lwip-dhcp.c| 52 + > > lib/lwip/apps/http/lwip-wget.c| 74 +++ > > lib/lwip/apps/ping/lwip_ping.c| 37 > > lib/lwip/apps/ping/lwip_ping.h| 24 +++ > > lib/lwip/apps/ping/ping.h | 35 > > lib/lwip/apps/tftp/lwip-tftp.c| 124 > > lib/lwip/cmd-lwip.c | 269 ++ > > lib/lwip/lwipopts.h | 203 +++ > > lib/lwip/port/if.c| 260 + > > lib/lwip/port/include/arch/cc.h | 46 + > > lib/lwip/port/include/arch/sys_arch.h | 59 ++ > > lib/lwip/port/include/limits.h| 0 > > lib/lwip/port/sys-arch.c | 20 ++ > > lib/lwip/ulwip.h | 9 + > > net/Kconfig | 1 + > > net/net.c | 24 +++ > > 25 files changed, 1430 insertions(+), 44 deletions(-) > > create mode 100644 lib/lwip/Kconfig > > create mode 100644 lib/lwip/Makefile > > create mode 100644 lib/lwip/apps/dhcp/lwip-dhcp.c > > create mode 100644 lib/lwip/apps/http/lwip-wget.c > > create mode 100644 lib/lwip/apps/ping/lwip_ping.c > > create mode 100644 lib/lwip/apps/ping/lwip_ping.h > > create mode 100644 lib/lwip/apps/ping/ping.h > > create mode 100644 lib/lwip/apps/tftp/lwip-tftp.c > > create mode 100644 lib/lwip/cmd-lwip.c > > create mode 100644 lib/lwip/lwipopts.h > > create mode 100644 lib/lwip/port/if.c > > create mode 100644 lib/lwip/port/include/arch/cc.h > > create mode 100644 lib/lwip/port/include/arch/sys_arch.h > > create mode 100644 lib/lwip/port/include/limits.h > > create mode 100644 lib/lwip/port/sys-arch.c > > create mode 100644 lib/lwip/ulwip.h > > > > diff --git a/.gitignore b/.gitignore > > index eb769f144c..be3676c59e 100644 > > --- a/.gitignore > > +++ b/.gitignore > > @@ -104,3 +104,12 @@ __pycache__ > > # pylint files > > /pylint.cur > > /pylint.out/ > > + > > +lib/lwip/lwip-external > > +lib/lwip/apps/ping/ping.c > > +lib/lwip/apps/http/http_client.c > > +lib/lwip/apps/http/http_client.h > > +lib/lwip/apps/tftp/tftp.c > > +lib/lwip/apps/tftp/tftp_client.h > > +lib/lwip/apps/tftp/tftp_common.h > > +lib/lwip/apps/tftp/tftp_example.h > > diff --git a/boot/bootmeth_pxe.c b/boot/bootmeth_pxe.c > > index e6992168c0..30331a9806 100644 > > --- a/boot/bootmeth_pxe.c > > +++ b/boot/bootmeth_pxe.c > > @@ -118,7 +118,7 @@ static int distro_pxe_read_file(struct udevice *dev, > struct bootflow *bflow, > > tftp_argv[1] = file_addr; > > tftp_argv[2] = (void *)file_path; > > > > - if (do_tftpb(ctx->cmdtp, 0, 3, tftp_argv)) > > + if (do_lwip_tftp(ctx->cmdtp, 0, 3, tftp_argv)) > > return -ENOENT; > > ret = pxe_get_file_size(); > > if (ret) > > diff --git a/cmd/net.c b/cmd/net.c > > index 0e9f200ca9..6d704fba86 100644 > > --- a/cmd/net.c > > +++ b/cmd/net.c > > @@ -36,19 +36,9 @@ U_BOOT_CMD( > > #endif > > > > #ifdef CONFIG_CMD_TFTPBOOT > > -int do_tftpb(struct cmd_tbl *cmdtp, int flag, int argc, char *const > argv[]) > > -{ > > - int ret; > > - > > - bootstage_mark_name(BOOTSTAGE_KERNELREAD_START, "tftp_start"); > > - ret = netboot_common(TFTPGET, cmdtp, argc, argv); > > - bootstage_mark_name(BOOTSTAGE_KERNELREAD_STOP, "tftp_done"); > > - return ret; > > -} > > - > > #if IS_ENABLED(CONFIG_IPV6) > > U_BOOT_CMD( > > - tftpboot, 4, 1, do_tftpb, > > + tftpboot, 4, 1, do_lwip_tftp, > > "boot image via network using TFTP protocol\n" > > "To use IPv6 add -ipv6 parameter or use IPv6 hostIPaddr framed " > > "with [] brackets", > > @@ -56,7 +46,7 @@ U_BOOT_CMD( > > ); > > #else > > U_BOOT_CMD( > > - tftpboot, 3, 1, do_tftpb, > > + tftpboot, 3, 1, do_lwip_tftp, > > "load file via network using TFTP protocol", > > "[loadAddress]
Re: [PATCH] addrmap: Fix off by one in addrmap_set_entry()
On Wed, Jul 26, 2023 at 06:49:44PM -0600, Simon Glass wrote: > Hi Dan, > > On Tue, 25 Jul 2023 at 09:40, Dan Carpenter wrote: > > > > The > comparison needs to be changed to >= to prevent an out of bounds > > write on th next line. > > > > Signed-off-by: Dan Carpenter > > --- > > lib/addr_map.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/lib/addr_map.c b/lib/addr_map.c > > index 9b3e0a544e47..86e932e4b561 100644 > > --- a/lib/addr_map.c > > +++ b/lib/addr_map.c > > @@ -59,7 +59,7 @@ void *addrmap_phys_to_virt(phys_addr_t paddr) > > void addrmap_set_entry(unsigned long vaddr, phys_addr_t paddr, > > phys_size_t size, int idx) > > { > > - if (idx > CONFIG_SYS_NUM_ADDR_MAP) > > + if (idx >= CONFIG_SYS_NUM_ADDR_MAP) > > return; > > It looks like this function should return an error. > If we hit this error path there probably isn't a reasonable way to recover. Maybe we could add a WARN()? regards, dan carpenter
Re: [PATCH v2] efi_loader: Fix memory corruption on 32bit systems
On Thu, Jul 27, 2023 at 11:22:15AM +0300, Ilias Apalodimas wrote: > Hi Dan, > > [...] > > > @@ -313,7 +313,7 @@ static int cmp_pe_section(const void *arg1, const void > > *arg2) > > * > > * Return: valid pointer to a image, return NULL if allocation fails. > > */ > > -void *efi_prepare_aligned_image(void *efi, u64 *efi_size) > > +void *efi_prepare_aligned_image(void *efi, size_t *efi_size) > > { > > size_t new_efi_size; > > void *new_efi; > > @@ -600,7 +600,7 @@ static bool efi_image_authenticate(void *efi, size_t > > efi_size) > > if (!efi_secure_boot_enabled()) > > return true; > > > > - new_efi = efi_prepare_aligned_image(efi, (u64 *)_size); > > + new_efi = efi_prepare_aligned_image(efi, _size); > > if (!new_efi) > > return false; > > > > diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c > > index 49f8a5e77cbf..d57afd0c498b 100644 > > --- a/lib/efi_loader/efi_tcg2.c > > +++ b/lib/efi_loader/efi_tcg2.c > > @@ -882,7 +882,7 @@ out: > > * > > * Return: status code > > */ > > -static efi_status_t tcg2_hash_pe_image(void *efi, u64 efi_size, > > +static efi_status_t tcg2_hash_pe_image(void *efi, size_t efi_size, > >struct tpml_digest_values *digest_list) > > Unfortunately the rabbit hole is a bit deeper with this one. > tcg2_hash_pe_image() is called in > - tcg2_measure_pe_image(). This one is called in efi_load_pe() and the type > is indeed a size_t there, so that's fine > - efi_tcg2_hash_log_extend_event(), this one is different... > The function is described by the EFI spec [0] which mandates a u64... I > think that was the reason efi_prepare_aligned_image() is using a u64 to > begin with. This one uses the size only though not the pointer, but in a > 32bit platform it would truncate s size > UINT_MAX. > > [0] > https://trustedcomputinggroup.org/wp-content/uploads/EFI-Protocol-Specification-rev13-160330final.pdf I have maybe misread something... I don't think this is a real issue. 32bit systems aren't going to be able to allocate that much memory anyway. Also there are a lot of size_t parameters already so it's not a new issue. regards, dan carpenter
Re: Trying to boot JH7110 RISCV-V CPU from MMC
> Hi, > > > Did you find what's caused? It seems it's not working fine with latest yet. > It seems that your analysis is right way. > > When I have tested on v2023.07-rc1, it's booting fine. > So I did the git bisect from v2023.07-rc1 to master. I reverted the same commit, and it successfully fixes the issue for me as well in upstream. The question is, if this issue affects other RISC-V based socs using the default arch provided timer. From my understanding, this should actually break all of them? Best Regards, Roland Ruckerbauer
[PATCH 1/1] i2c: designware: build PCI support only for X86
designware_i2c_pci.c includes which is located at arch/x86/include/asm/lpss.h and available only for X86. So enable CONFIG_SYS_I2C_DW only for X86. Fixes: 070a94600855 ("i2c: designware: Add Apollo Lake support") Signed-off-by: Maxim Kochetkov --- drivers/i2c/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index 99545df2e5..7320e7a80e 100644 --- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile @@ -18,9 +18,11 @@ obj-$(CONFIG_SYS_I2C_CADENCE) += i2c-cdns.o obj-$(CONFIG_SYS_I2C_CA) += i2c-cortina.o obj-$(CONFIG_SYS_I2C_DAVINCI) += davinci_i2c.o obj-$(CONFIG_SYS_I2C_DW) += designware_i2c.o +ifdef CONFIG_X86 ifdef CONFIG_PCI obj-$(CONFIG_SYS_I2C_DW) += designware_i2c_pci.o endif +endif obj-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o obj-$(CONFIG_SYS_I2C_IHS) += ihs_i2c.o obj-$(CONFIG_SYS_I2C_INTEL) += intel_i2c.o -- 2.40.1
[PATCH] net: ftgmac100: Add reset control
Add optional reset control, especially for the Aspeed SOC. For the hardware without a reset line, the reset assertion/deassertion will be skipped. Signed-off-by: Dylan Hung --- drivers/net/ftgmac100.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c index a50cde338a..886b97119d 100644 --- a/drivers/net/ftgmac100.c +++ b/drivers/net/ftgmac100.c @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -90,6 +91,7 @@ struct ftgmac100_data { u32 max_speed; struct clk_bulk clks; + struct reset_ctl *reset_ctl; /* End of RX/TX ring buffer bits. Depend on model */ u32 rxdes0_edorr_mask; @@ -568,6 +570,8 @@ static int ftgmac100_of_to_plat(struct udevice *dev) priv->txdes0_edotr_mask = BIT(15); } + priv->reset_ctl = devm_reset_control_get_optional(dev, NULL); + return clk_get_bulk(dev, >clks); } @@ -593,6 +597,12 @@ static int ftgmac100_probe(struct udevice *dev) if (ret) goto out; + if (priv->reset_ctl) { + ret = reset_deassert(priv->reset_ctl); + if (ret) + goto out; + } + /* * If DM MDIO is enabled, the MDIO bus will be initialized later in * dm_eth_phy_connect @@ -628,6 +638,8 @@ static int ftgmac100_remove(struct udevice *dev) free(priv->phydev); mdio_unregister(priv->bus); mdio_free(priv->bus); + if (priv->reset_ctl) + reset_assert(priv->reset_ctl); clk_release_bulk(>clks); return 0; -- 2.25.1