Merge branch '2024-04-12-assorted-updates'

- Assorted sandbox fixes, cleanup some of the partition table code and a
  few other fixes
This commit is contained in:
Tom Rini
2024-04-12 12:50:57 -06:00
11 changed files with 49 additions and 76 deletions

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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,

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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 */

View File

@@ -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");
}

View File

@@ -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 */

View File

@@ -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

View File

@@ -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')

View File

@@ -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);