diff options
author | Tom Rini <trini@konsulko.com> | 2024-04-12 12:50:57 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-04-12 12:50:57 -0600 |
commit | ef8ef5f77c9a998f76a48277a883af1645b54117 (patch) | |
tree | 52fdcdbbf87dfa777fa87e8ac9e27577003f5d0a | |
parent | d5e6401011a269328d3ea69468532b4125fd2bb9 (diff) | |
parent | 4341fb73326907faecfc9e3b711bbfcd3937b525 (diff) |
Merge branch '2024-04-12-assorted-updates'
- Assorted sandbox fixes, cleanup some of the partition table code and a
few other fixes
-rw-r--r-- | arch/arm/mach-uniphier/dram_init.c | 16 | ||||
-rw-r--r-- | arch/sandbox/Kconfig | 13 | ||||
-rw-r--r-- | arch/sandbox/cpu/eth-raw-os.c | 14 | ||||
-rw-r--r-- | arch/sandbox/lib/bootm.c | 4 | ||||
-rw-r--r-- | boot/fdt_support.c | 5 | ||||
-rw-r--r-- | cmd/booti.c | 2 | ||||
-rw-r--r-- | common/cli.c | 4 | ||||
-rw-r--r-- | disk/part.c | 54 | ||||
-rwxr-xr-x | test/py/test.py | 1 | ||||
-rw-r--r-- | test/py/tests/test_scsi.py | 2 | ||||
-rw-r--r-- | tools/image-host.c | 10 |
11 files changed, 49 insertions, 76 deletions
diff --git a/arch/arm/mach-uniphier/dram_init.c b/arch/arm/mach-uniphier/dram_init.c index 7f2753190c2..e6f1286e71f 100644 --- a/arch/arm/mach-uniphier/dram_init.c +++ b/arch/arm/mach-uniphier/dram_init.c @@ -265,14 +265,15 @@ int dram_init(void) if (uniphier_get_soc_id() == UNIPHIER_LD20_ID) gd->ram_size -= 64; + /* map all the DRAM regions */ + uniphier_mem_map_init(gd->ram_base, prev_top - gd->ram_base); + return 0; } int dram_init_banksize(void) { struct uniphier_dram_map dram_map[3] = {}; - unsigned long base, top; - bool valid_bank_found = false; int ret, i; ret = uniphier_dram_map_get(dram_map); @@ -287,18 +288,7 @@ int dram_init_banksize(void) if (!dram_map[i].size) continue; - - if (!valid_bank_found) - base = dram_map[i].base; - top = dram_map[i].base + dram_map[i].size; - valid_bank_found = true; } - if (!valid_bank_found) - return -EINVAL; - - /* map all the DRAM regions */ - uniphier_mem_map_init(base, top - base); - return 0; } diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig index 0ce77de2fcb..1c8353d6156 100644 --- a/arch/sandbox/Kconfig +++ b/arch/sandbox/Kconfig @@ -58,10 +58,15 @@ config SANDBOX_CRASH_RESET bool "Reset on crash" help If an illegal instruction or an illegal memory access occurs, the - sandbox by default writes a crash dump and exits. If you set this - flag, the sandbox is reset instead. This may be useful when running - test suites like the UEFI self certification test which continue - with the next test after a crash. + sandbox exits with an error by default. + + If the u-boot binary is invoked with --signals (or -S), U-Boot will + handle the signal writing a crash dump before exiting. + + If you additionally set the CONFIG_SANDBOX_CRASH_RESET flag, the + sandbox is reset after writing the crash dump. This may be useful + when running test suites like the UEFI self certification test which + continue with the next test after a crash. config SANDBOX_BITS_PER_LONG int diff --git a/arch/sandbox/cpu/eth-raw-os.c b/arch/sandbox/cpu/eth-raw-os.c index 92c35aed95d..39ea3b3f012 100644 --- a/arch/sandbox/cpu/eth-raw-os.c +++ b/arch/sandbox/cpu/eth-raw-os.c @@ -105,7 +105,12 @@ static int _raw_packet_start(struct eth_sandbox_raw_priv *priv, /* Make the socket non-blocking */ flags = fcntl(priv->sd, F_GETFL, 0); - fcntl(priv->sd, F_SETFL, flags | O_NONBLOCK); + ret = fcntl(priv->sd, F_SETFL, flags | O_NONBLOCK); + if (ret == -1) { + printf("Failed to make socket non-blocking: %d %s\n", errno, + strerror(errno)); + return -errno; + } /* Enable promiscuous mode to receive responses meant for us */ mr.mr_ifindex = device->sll_ifindex; @@ -172,7 +177,12 @@ static int _local_inet_start(struct eth_sandbox_raw_priv *priv) /* Make the socket non-blocking */ flags = fcntl(priv->sd, F_GETFL, 0); - fcntl(priv->sd, F_SETFL, flags | O_NONBLOCK); + ret = fcntl(priv->sd, F_SETFL, flags | O_NONBLOCK); + if (ret == -1) { + printf("Failed to make socket non-blocking: %d %s\n", errno, + strerror(errno)); + return -errno; + } /* Include the UDP/IP headers on send and receive */ ret = setsockopt(priv->sd, IPPROTO_IP, IP_HDRINCL, &one, diff --git a/arch/sandbox/lib/bootm.c b/arch/sandbox/lib/bootm.c index 8dbcd9ff7dd..44ba8b52e13 100644 --- a/arch/sandbox/lib/bootm.c +++ b/arch/sandbox/lib/bootm.c @@ -85,5 +85,7 @@ int do_bootm_linux(int flag, struct bootm_info *bmi) int booti_setup(ulong image, ulong *relocated_addr, ulong *size, bool force_reloc) { - return 0; + log_err("Booting is not supported on the sandbox.\n"); + + return 1; } diff --git a/boot/fdt_support.c b/boot/fdt_support.c index 090d82ee80a..9844c70be80 100644 --- a/boot/fdt_support.c +++ b/boot/fdt_support.c @@ -17,6 +17,7 @@ #include <linux/ctype.h> #include <linux/types.h> #include <asm/global_data.h> +#include <asm/unaligned.h> #include <linux/libfdt.h> #include <fdt_support.h> #include <exports.h> @@ -421,13 +422,13 @@ static int fdt_pack_reg(const void *fdt, void *buf, u64 *address, u64 *size, for (i = 0; i < n; i++) { if (address_cells == 2) - *(fdt64_t *)p = cpu_to_fdt64(address[i]); + put_unaligned_be64(address[i], p); else *(fdt32_t *)p = cpu_to_fdt32(address[i]); p += 4 * address_cells; if (size_cells == 2) - *(fdt64_t *)p = cpu_to_fdt64(size[i]); + put_unaligned_be64(size[i], p); else *(fdt32_t *)p = cpu_to_fdt32(size[i]); p += 4 * size_cells; diff --git a/cmd/booti.c b/cmd/booti.c index 898df0f8896..b9637b3ec3d 100644 --- a/cmd/booti.c +++ b/cmd/booti.c @@ -74,7 +74,7 @@ static int booti_start(struct bootm_info *bmi) unmap_sysmem((void *)ld); ret = booti_setup(ld, &relocated_addr, &image_size, false); - if (ret || IS_ENABLED(CONFIG_SANDBOX)) + if (ret) return 1; /* Handle BOOTM_STATE_LOADOS */ diff --git a/common/cli.c b/common/cli.c index a34938294ec..1c33daf1149 100644 --- a/common/cli.c +++ b/common/cli.c @@ -11,6 +11,7 @@ #define pr_fmt(fmt) "cli: %s: " fmt, __func__ #include <common.h> +#include <ansi.h> #include <bootstage.h> #include <cli.h> #include <cli_hush.h> @@ -336,4 +337,7 @@ void cli_init(void) #if defined(CONFIG_HUSH_INIT_VAR) hush_init_var(); #endif + + if (CONFIG_IS_ENABLED(VIDEO_ANSI)) + printf(ANSI_CURSOR_SHOW "\n"); } diff --git a/disk/part.c b/disk/part.c index 36b88205eca..2bee6695828 100644 --- a/disk/part.c +++ b/disk/part.c @@ -14,6 +14,7 @@ #include <malloc.h> #include <part.h> #include <ubifs_uboot.h> +#include <dm/uclass.h> #undef PART_DEBUG @@ -305,50 +306,8 @@ static void print_part_header(const char *type, struct blk_desc *desc) CONFIG_IS_ENABLED(ISO_PARTITION) || \ CONFIG_IS_ENABLED(AMIGA_PARTITION) || \ CONFIG_IS_ENABLED(EFI_PARTITION) - puts ("\nPartition Map for "); - switch (desc->uclass_id) { - case UCLASS_IDE: - puts ("IDE"); - break; - case UCLASS_AHCI: - puts ("SATA"); - break; - case UCLASS_SCSI: - puts ("SCSI"); - break; - case UCLASS_USB: - puts ("USB"); - break; - case UCLASS_MMC: - puts ("MMC"); - break; - case UCLASS_HOST: - puts ("HOST"); - break; - case UCLASS_NVME: - puts ("NVMe"); - break; - case UCLASS_PVBLOCK: - puts("PV BLOCK"); - break; - case UCLASS_RKMTD: - puts("RKMTD"); - break; - case UCLASS_VIRTIO: - puts("VirtIO"); - break; - case UCLASS_EFI_MEDIA: - puts("EFI"); - break; - case UCLASS_BLKMAP: - puts("BLKMAP"); - break; - default: - printf("UNKNOWN(%d)", desc->uclass_id); - break; - } - printf (" device %d -- Partition Type: %s\n\n", - desc->devnum, type); + printf("\nPartition Map for %s device %d -- Partition Type: %s\n\n", + uclass_get_name(desc->uclass_id), desc->devnum, type); #endif /* any CONFIG_..._PARTITION */ } @@ -717,8 +676,11 @@ int part_get_info_by_name(struct blk_desc *desc, const char *name, for (i = 1; i < part_drv->max_entries; i++) { ret = part_drv->get_info(desc, i, info); if (ret != 0) { - /* no more entries in table */ - break; + /* + * Partition with this index can't be obtained, but + * further partitions might be, so keep checking. + */ + continue; } if (strcmp(name, (const char *)info->name) == 0) { /* matched */ diff --git a/test/py/test.py b/test/py/test.py index 95859a66e29..7c477903d6b 100755 --- a/test/py/test.py +++ b/test/py/test.py @@ -11,7 +11,6 @@ import os import os.path import sys import pytest -from pkg_resources import load_entry_point if __name__ == '__main__': # argv; py.test test_directory_name user-supplied-arguments diff --git a/test/py/tests/test_scsi.py b/test/py/tests/test_scsi.py index be2e283e7d2..445693cafd7 100644 --- a/test/py/tests/test_scsi.py +++ b/test/py/tests/test_scsi.py @@ -87,6 +87,6 @@ def test_scsi_dev(u_boot_console): def test_scsi_part(u_boot_console): test_scsi_dev(u_boot_console) output = u_boot_console.run_command('scsi part') - assert 'Partition Map for SCSI device' in output + assert 'Partition Map for scsi device' in output output = u_boot_console.run_command('echo $?') assert output.endswith('0') diff --git a/tools/image-host.c b/tools/image-host.c index b2a0f2e6d16..7bfc0cb6b18 100644 --- a/tools/image-host.c +++ b/tools/image-host.c @@ -346,17 +346,17 @@ static int fit_image_read_key_iv_data(const char *keydir, const char *key_iv_nam unsigned char *key_iv_data, int expected_size) { char filename[PATH_MAX]; - int ret = -1; + int ret; ret = snprintf(filename, sizeof(filename), "%s/%s%s", keydir, key_iv_name, ".bin"); if (ret >= sizeof(filename)) { - printf("Can't format the key or IV filename when setting up the cipher: insufficient buffer space\n"); - ret = -1; + fprintf(stderr, "Can't format the key or IV filename when setting up the cipher: insufficient buffer space\n"); + return -1; } if (ret < 0) { - printf("Can't format the key or IV filename when setting up the cipher: snprintf error\n"); - ret = -1; + fprintf(stderr, "Can't format the key or IV filename when setting up the cipher: snprintf error\n"); + return -1; } ret = fit_image_read_data(filename, key_iv_data, expected_size); |