Merge branch '2024-04-12-assorted-updates'
- Assorted sandbox fixes, cleanup some of the partition table code and a
few other fixes
diff --git a/arch/arm/mach-uniphier/dram_init.c b/arch/arm/mach-uniphier/dram_init.c
index 7f27531..e6f1286 100644
--- a/arch/arm/mach-uniphier/dram_init.c
+++ b/arch/arm/mach-uniphier/dram_init.c
@@ -265,14 +265,15 @@
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 @@
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 0ce77de..1c8353d 100644
--- a/arch/sandbox/Kconfig
+++ b/arch/sandbox/Kconfig
@@ -58,10 +58,15 @@
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 92c35ae..39ea3b3 100644
--- a/arch/sandbox/cpu/eth-raw-os.c
+++ b/arch/sandbox/cpu/eth-raw-os.c
@@ -105,7 +105,12 @@
/* 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 @@
/* 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 8dbcd9f..44ba8b5 100644
--- a/arch/sandbox/lib/bootm.c
+++ b/arch/sandbox/lib/bootm.c
@@ -85,5 +85,7 @@
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 090d82e..9844c70 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 @@
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 898df0f..b9637b3 100644
--- a/cmd/booti.c
+++ b/cmd/booti.c
@@ -74,7 +74,7 @@
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 a349382..1c33daf 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 @@
#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 36b8820..2bee669 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 @@
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 @@
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 95859a6..7c47790 100755
--- a/test/py/test.py
+++ b/test/py/test.py
@@ -11,7 +11,6 @@
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 be2e283..445693c 100644
--- a/test/py/tests/test_scsi.py
+++ b/test/py/tests/test_scsi.py
@@ -87,6 +87,6 @@
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 b2a0f2e..7bfc0cb 100644
--- a/tools/image-host.c
+++ b/tools/image-host.c
@@ -346,17 +346,17 @@
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);