mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
Merge tag 'dm-next-13dec23' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm into next
minor improvements to test, acpi updates for new PyPl release
This commit is contained in:
@@ -979,7 +979,7 @@ EFI APP
|
||||
M: Simon Glass <sjg@chromium.org>
|
||||
M: Heinrich Schuchardt <xypron.glpk@gmx.de>
|
||||
S: Maintained
|
||||
W: https://u-boot.readthedocs.io/en/latest/develop/uefi/u-boot_on_efi.html
|
||||
W: https://docs.u-boot.org/en/latest/develop/uefi/u-boot_on_efi.html
|
||||
F: board/efi/efi-x86_app
|
||||
F: configs/efi-x86_app*
|
||||
F: doc/develop/uefi/u-boot_on_efi.rst
|
||||
|
||||
1
Makefile
1
Makefile
@@ -1349,6 +1349,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
|
||||
$(foreach f,$(BINMAN_INDIRS),-I $(f)) \
|
||||
-a atf-bl31-path=${BL31} \
|
||||
-a tee-os-path=${TEE} \
|
||||
-a ti-dm-path=${TI_DM} \
|
||||
-a opensbi-path=${OPENSBI} \
|
||||
-a default-dt=$(default_dt) \
|
||||
-a scp-path=$(SCP) \
|
||||
|
||||
2
README
2
README
@@ -2659,5 +2659,5 @@ Contributing
|
||||
|
||||
The U-Boot projects depends on contributions from the user community.
|
||||
If you want to participate, please, have a look at the 'General'
|
||||
section of https://u-boot.readthedocs.io/en/latest/develop/index.html
|
||||
section of https://docs.u-boot.org/en/latest/develop/index.html
|
||||
where we describe coding standards and the patch submission process.
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
content = <&dm>;
|
||||
keyfile = "custMpk.pem";
|
||||
};
|
||||
dm: blob-ext {
|
||||
dm: ti-dm {
|
||||
filename = "ti-dm.bin";
|
||||
};
|
||||
};
|
||||
@@ -248,7 +248,7 @@
|
||||
images {
|
||||
|
||||
dm {
|
||||
blob-ext {
|
||||
ti-dm {
|
||||
filename = "ti-dm.bin";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -227,7 +227,7 @@
|
||||
content = <&dm>;
|
||||
keyfile = "custMpk.pem";
|
||||
};
|
||||
dm: blob-ext {
|
||||
dm: ti-dm {
|
||||
filename = "ti-dm.bin";
|
||||
};
|
||||
};
|
||||
@@ -310,7 +310,7 @@
|
||||
fit {
|
||||
images {
|
||||
dm {
|
||||
blob-ext {
|
||||
ti-dm {
|
||||
filename = "ti-dm.bin";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -164,7 +164,7 @@
|
||||
content = <&dm>;
|
||||
keyfile = "custMpk.pem";
|
||||
};
|
||||
dm: blob-ext {
|
||||
dm: ti-dm {
|
||||
filename = "ti-dm.bin";
|
||||
};
|
||||
};
|
||||
@@ -250,7 +250,7 @@
|
||||
fit {
|
||||
images {
|
||||
dm {
|
||||
blob-ext {
|
||||
ti-dm {
|
||||
filename = "ti-dm.bin";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -200,7 +200,7 @@
|
||||
content = <&dm>;
|
||||
keyfile = "custMpk.pem";
|
||||
};
|
||||
dm: blob-ext {
|
||||
dm: ti-dm {
|
||||
filename = "ti-dm.bin";
|
||||
};
|
||||
};
|
||||
@@ -285,7 +285,7 @@
|
||||
fit {
|
||||
images {
|
||||
dm {
|
||||
blob-ext {
|
||||
ti-dm {
|
||||
filename = "ti-dm.bin";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
content = <&dm>;
|
||||
keyfile = "custMpk.pem";
|
||||
};
|
||||
dm: blob-ext {
|
||||
dm: ti-dm {
|
||||
filename = "ti-dm.bin";
|
||||
};
|
||||
};
|
||||
@@ -282,7 +282,7 @@
|
||||
fit {
|
||||
images {
|
||||
dm {
|
||||
blob-ext {
|
||||
ti-dm {
|
||||
filename = "ti-dm.bin";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -164,7 +164,7 @@
|
||||
content = <&dm>;
|
||||
keyfile = "custMpk.pem";
|
||||
};
|
||||
dm: blob-ext {
|
||||
dm: ti-dm {
|
||||
filename = "ti-dm.bin";
|
||||
};
|
||||
};
|
||||
@@ -296,7 +296,7 @@
|
||||
fit {
|
||||
images {
|
||||
dm {
|
||||
blob-ext {
|
||||
ti-dm {
|
||||
filename = "ti-dm.bin";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -246,8 +246,8 @@ static int boot_setup_fdt(struct bootm_headers *images)
|
||||
{
|
||||
images->initrd_start = virt_to_phys((void *)images->initrd_start);
|
||||
images->initrd_end = virt_to_phys((void *)images->initrd_end);
|
||||
return image_setup_libfdt(images, images->ft_addr, images->ft_len,
|
||||
&images->lmb);
|
||||
|
||||
return image_setup_libfdt(images, images->ft_addr, &images->lmb);
|
||||
}
|
||||
|
||||
static void boot_prep_linux(struct bootm_headers *images)
|
||||
|
||||
@@ -78,3 +78,10 @@ int do_bootm_linux(int flag, int argc, char *argv[], struct bootm_headers *image
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* used for testing 'booti' command */
|
||||
int booti_setup(ulong image, ulong *relocated_addr, ulong *size,
|
||||
bool force_reloc)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -64,15 +64,6 @@ int acpi_write_dbg2_pci_uart(struct acpi_ctx *ctx, struct udevice *dev,
|
||||
*/
|
||||
int acpi_create_gnvs(struct acpi_global_nvs *gnvs);
|
||||
|
||||
/**
|
||||
* acpi_get_rsdp_addr() - get ACPI RSDP table address
|
||||
*
|
||||
* This routine returns the ACPI RSDP table address in the system memory.
|
||||
*
|
||||
* @return: ACPI RSDP table address
|
||||
*/
|
||||
ulong acpi_get_rsdp_addr(void);
|
||||
|
||||
/**
|
||||
* arch_read_sci_irq_select() - Read the system-control interrupt number
|
||||
*
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <dm.h>
|
||||
#include <efi_loader.h>
|
||||
#include <efi_variable.h>
|
||||
#include <malloc.h>
|
||||
|
||||
/**
|
||||
* struct efi_mgr_priv - private info for the efi-mgr driver
|
||||
@@ -65,6 +66,7 @@ static int efi_mgr_read_bootflow(struct udevice *dev, struct bootflow *bflow)
|
||||
bootorder = efi_get_var(u"BootOrder", &efi_global_variable_guid,
|
||||
&size);
|
||||
if (bootorder) {
|
||||
free(bootorder);
|
||||
bflow->state = BOOTFLOWST_READY;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -667,7 +667,6 @@ int fdt_record_loadable(void *blob, u32 index, const char *name,
|
||||
return node;
|
||||
}
|
||||
|
||||
/* Resize the fdt to its actual size + a bit of padding */
|
||||
int fdt_shrink_to_minimum(void *blob, uint extrasize)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -908,7 +908,7 @@ int image_setup_linux(struct bootm_headers *images)
|
||||
}
|
||||
|
||||
if (CONFIG_IS_ENABLED(OF_LIBFDT) && of_size) {
|
||||
ret = image_setup_libfdt(images, *of_flat_tree, of_size, lmb);
|
||||
ret = image_setup_libfdt(images, *of_flat_tree, lmb);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -24,9 +24,6 @@
|
||||
#include <dm/ofnode.h>
|
||||
#include <tee/optee.h>
|
||||
|
||||
/* adding a ramdisk needs 0x44 bytes in version 2008.10 */
|
||||
#define FDT_RAMDISK_OVERHEAD 0x80
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
static void fdt_error(const char *msg)
|
||||
@@ -575,12 +572,13 @@ __weak int arch_fixup_fdt(void *blob)
|
||||
}
|
||||
|
||||
int image_setup_libfdt(struct bootm_headers *images, void *blob,
|
||||
int of_size, struct lmb *lmb)
|
||||
struct lmb *lmb)
|
||||
{
|
||||
ulong *initrd_start = &images->initrd_start;
|
||||
ulong *initrd_end = &images->initrd_end;
|
||||
int ret = -EPERM;
|
||||
int fdt_ret;
|
||||
int of_size;
|
||||
|
||||
if (fdt_root(blob) < 0) {
|
||||
printf("ERROR: root node setup failed\n");
|
||||
@@ -637,6 +635,14 @@ int image_setup_libfdt(struct bootm_headers *images, void *blob,
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
if (fdt_initrd(blob, *initrd_start, *initrd_end))
|
||||
goto err;
|
||||
|
||||
if (!ft_verify_fdt(blob))
|
||||
goto err;
|
||||
|
||||
/* after here we are using a livetree */
|
||||
if (!of_live_active() && CONFIG_IS_ENABLED(EVENT)) {
|
||||
struct event_ft_fixup fixup;
|
||||
|
||||
@@ -654,25 +660,16 @@ int image_setup_libfdt(struct bootm_headers *images, void *blob,
|
||||
|
||||
/* Delete the old LMB reservation */
|
||||
if (lmb)
|
||||
lmb_free(lmb, (phys_addr_t)(u32)(uintptr_t)blob,
|
||||
(phys_size_t)fdt_totalsize(blob));
|
||||
lmb_free(lmb, map_to_sysmem(blob), fdt_totalsize(blob));
|
||||
|
||||
ret = fdt_shrink_to_minimum(blob, 0);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
of_size = ret;
|
||||
|
||||
if (*initrd_start && *initrd_end) {
|
||||
of_size += FDT_RAMDISK_OVERHEAD;
|
||||
fdt_set_totalsize(blob, of_size);
|
||||
}
|
||||
/* Create a new LMB reservation */
|
||||
if (lmb)
|
||||
lmb_reserve(lmb, (ulong)blob, of_size);
|
||||
|
||||
fdt_initrd(blob, *initrd_start, *initrd_end);
|
||||
if (!ft_verify_fdt(blob))
|
||||
goto err;
|
||||
lmb_reserve(lmb, map_to_sysmem(blob), of_size);
|
||||
|
||||
#if defined(CONFIG_ARCH_KEYSTONE)
|
||||
if (IS_ENABLED(CONFIG_OF_BOARD_SETUP))
|
||||
|
||||
@@ -285,7 +285,7 @@ config CMD_BOOTZ
|
||||
|
||||
config CMD_BOOTI
|
||||
bool "booti"
|
||||
depends on ARM64 || RISCV
|
||||
depends on ARM64 || RISCV || SANDBOX
|
||||
default y
|
||||
help
|
||||
Boot an AArch64 Linux Kernel image from memory.
|
||||
|
||||
87
cmd/acpi.c
87
cmd/acpi.c
@@ -17,7 +17,8 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||
/**
|
||||
* dump_hdr() - Dump an ACPI header
|
||||
*
|
||||
* If the header is for FACS then it shows the revision information as well
|
||||
* Except for the Firmware ACPI Control Structure (FACS)
|
||||
* additionally show the revision information.
|
||||
*
|
||||
* @hdr: ACPI header to dump
|
||||
*/
|
||||
@@ -25,7 +26,7 @@ static void dump_hdr(struct acpi_table_header *hdr)
|
||||
{
|
||||
bool has_hdr = memcmp(hdr->signature, "FACS", ACPI_NAME_LEN);
|
||||
|
||||
printf("%.*s %08lx %5x", ACPI_NAME_LEN, hdr->signature,
|
||||
printf("%.*s %16lx %5x", ACPI_NAME_LEN, hdr->signature,
|
||||
(ulong)map_to_sysmem(hdr), hdr->length);
|
||||
if (has_hdr) {
|
||||
printf(" v%02d %.6s %.8s %x %.4s %x\n", hdr->revision,
|
||||
@@ -43,7 +44,7 @@ static int dump_table_name(const char *sig)
|
||||
hdr = acpi_find_table(sig);
|
||||
if (!hdr)
|
||||
return -ENOENT;
|
||||
printf("%.*s @ %08lx\n", ACPI_NAME_LEN, hdr->signature,
|
||||
printf("%.*s @ %16lx\n", ACPI_NAME_LEN, hdr->signature,
|
||||
(ulong)map_to_sysmem(hdr));
|
||||
print_buffer(0, hdr, 1, hdr->length, 0);
|
||||
|
||||
@@ -58,47 +59,50 @@ static void list_fadt(struct acpi_fadt *fadt)
|
||||
dump_hdr(map_sysmem(fadt->firmware_ctrl, 0));
|
||||
}
|
||||
|
||||
static int list_rsdt(struct acpi_rsdt *rsdt, struct acpi_xsdt *xsdt)
|
||||
static void list_rsdt(struct acpi_rsdp *rsdp)
|
||||
{
|
||||
int len, i, count;
|
||||
|
||||
dump_hdr(&rsdt->header);
|
||||
if (xsdt)
|
||||
dump_hdr(&xsdt->header);
|
||||
len = rsdt->header.length - sizeof(rsdt->header);
|
||||
count = len / sizeof(u32);
|
||||
for (i = 0; i < count; i++) {
|
||||
struct acpi_table_header *hdr;
|
||||
|
||||
if (!rsdt->entry[i])
|
||||
break;
|
||||
hdr = map_sysmem(rsdt->entry[i], 0);
|
||||
dump_hdr(hdr);
|
||||
if (!memcmp(hdr->signature, "FACP", ACPI_NAME_LEN))
|
||||
list_fadt((struct acpi_fadt *)hdr);
|
||||
if (xsdt) {
|
||||
if (xsdt->entry[i] != rsdt->entry[i]) {
|
||||
printf(" (xsdt mismatch %llx)\n",
|
||||
xsdt->entry[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int list_rsdp(struct acpi_rsdp *rsdp)
|
||||
{
|
||||
struct acpi_rsdt *rsdt;
|
||||
struct acpi_xsdt *xsdt;
|
||||
|
||||
printf("RSDP %08lx %5x v%02d %.6s\n", (ulong)map_to_sysmem(rsdp),
|
||||
rsdp->length, rsdp->revision, rsdp->oem_id);
|
||||
rsdt = map_sysmem(rsdp->rsdt_address, 0);
|
||||
xsdt = map_sysmem(rsdp->xsdt_address, 0);
|
||||
list_rsdt(rsdt, xsdt);
|
||||
if (rsdp->rsdt_address) {
|
||||
rsdt = map_sysmem(rsdp->rsdt_address, 0);
|
||||
dump_hdr(&rsdt->header);
|
||||
}
|
||||
if (rsdp->xsdt_address) {
|
||||
xsdt = map_sysmem(rsdp->xsdt_address, 0);
|
||||
dump_hdr(&xsdt->header);
|
||||
len = xsdt->header.length - sizeof(xsdt->header);
|
||||
count = len / sizeof(u64);
|
||||
} else if (rsdp->rsdt_address) {
|
||||
len = rsdt->header.length - sizeof(rsdt->header);
|
||||
count = len / sizeof(u32);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
return 0;
|
||||
for (i = 0; i < count; i++) {
|
||||
struct acpi_table_header *hdr;
|
||||
u64 entry;
|
||||
|
||||
if (rsdp->xsdt_address)
|
||||
entry = xsdt->entry[i];
|
||||
else
|
||||
entry = rsdt->entry[i];
|
||||
if (!entry)
|
||||
break;
|
||||
hdr = map_sysmem(entry, 0);
|
||||
dump_hdr(hdr);
|
||||
if (!memcmp(hdr->signature, "FACP", ACPI_NAME_LEN))
|
||||
list_fadt((struct acpi_fadt *)hdr);
|
||||
}
|
||||
}
|
||||
|
||||
static void list_rsdp(struct acpi_rsdp *rsdp)
|
||||
{
|
||||
printf("RSDP %16lx %5x v%02d %.6s\n", (ulong)map_to_sysmem(rsdp),
|
||||
rsdp->length, rsdp->revision, rsdp->oem_id);
|
||||
list_rsdt(rsdp);
|
||||
}
|
||||
|
||||
static int do_acpi_list(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
@@ -111,8 +115,8 @@ static int do_acpi_list(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
printf("No ACPI tables present\n");
|
||||
return 0;
|
||||
}
|
||||
printf("Name Base Size Detail\n");
|
||||
printf("---- -------- ----- ------\n");
|
||||
printf("Name Base Size Detail\n"
|
||||
"---- ---------------- ----- ----------------------------\n");
|
||||
list_rsdp(rsdp);
|
||||
|
||||
return 0;
|
||||
@@ -156,6 +160,9 @@ static int do_acpi_dump(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
char sig[ACPI_NAME_LEN];
|
||||
int ret;
|
||||
|
||||
if (argc < 2)
|
||||
return CMD_RET_USAGE;
|
||||
|
||||
name = argv[1];
|
||||
if (strlen(name) != ACPI_NAME_LEN) {
|
||||
printf("Table name '%s' must be four characters\n", name);
|
||||
|
||||
@@ -309,7 +309,7 @@ efi_status_t efi_install_fdt(void *fdt)
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
if (image_setup_libfdt(&img, fdt, 0, NULL)) {
|
||||
if (image_setup_libfdt(&img, fdt, NULL)) {
|
||||
log_err("ERROR: failed to process device tree\n");
|
||||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ static int do_bootflow_scan(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
struct udevice *dev = NULL;
|
||||
struct bootflow bflow;
|
||||
bool all = false, boot = false, errors = false, no_global = false;
|
||||
bool list = false, no_hunter = false;
|
||||
bool list = false, no_hunter = false, menu = false, text_mode = false;
|
||||
int num_valid = 0;
|
||||
const char *label = NULL;
|
||||
bool has_args;
|
||||
@@ -155,6 +155,8 @@ static int do_bootflow_scan(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
no_global = strchr(argv[1], 'G');
|
||||
list = strchr(argv[1], 'l');
|
||||
no_hunter = strchr(argv[1], 'H');
|
||||
menu = strchr(argv[1], 'm');
|
||||
text_mode = strchr(argv[1], 't');
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
@@ -213,15 +215,32 @@ static int do_bootflow_scan(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
}
|
||||
if (list)
|
||||
show_bootflow(i, &bflow, errors);
|
||||
if (boot && !bflow.err)
|
||||
if (!menu && boot && !bflow.err)
|
||||
bootflow_run_boot(&iter, &bflow);
|
||||
}
|
||||
bootflow_iter_uninit(&iter);
|
||||
if (list)
|
||||
show_footer(i, num_valid);
|
||||
|
||||
if (IS_ENABLED(CONFIG_CMD_BOOTFLOW_FULL) && !num_valid && !list)
|
||||
printf("No bootflows found; try again with -l\n");
|
||||
if (IS_ENABLED(CONFIG_CMD_BOOTFLOW_FULL) && IS_ENABLED(CONFIG_EXPO)) {
|
||||
if (!num_valid && !list) {
|
||||
printf("No bootflows found; try again with -l\n");
|
||||
} else if (menu) {
|
||||
struct bootflow *sel_bflow;
|
||||
|
||||
ret = bootflow_handle_menu(std, text_mode, &sel_bflow);
|
||||
if (!ret && boot) {
|
||||
ret = console_clear();
|
||||
if (ret) {
|
||||
log_err("Failed to clear console: %dE\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bootflow_run_boot(NULL, sel_bflow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ static int booti_start(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
unmap_sysmem((void *)ld);
|
||||
|
||||
ret = booti_setup(ld, &relocated_addr, &image_size, false);
|
||||
if (ret != 0)
|
||||
if (ret || IS_ENABLED(CONFIG_SANDBOX))
|
||||
return 1;
|
||||
|
||||
/* Handle BOOTM_STATE_LOADOS */
|
||||
|
||||
25
cmd/cls.c
25
cmd/cls.c
@@ -7,33 +7,14 @@
|
||||
*/
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <console.h>
|
||||
#include <dm.h>
|
||||
#include <video_console.h>
|
||||
|
||||
#define CSI "\x1b["
|
||||
|
||||
static int do_video_clear(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
char *const argv[])
|
||||
{
|
||||
__maybe_unused struct udevice *dev;
|
||||
|
||||
/*
|
||||
* Send clear screen and home
|
||||
*
|
||||
* FIXME(Heinrich Schuchardt <xypron.glpk@gmx.de>): This should go
|
||||
* through an API and only be written to serial terminals, not video
|
||||
* displays
|
||||
*/
|
||||
printf(CSI "2J" CSI "1;1H");
|
||||
if (IS_ENABLED(CONFIG_VIDEO_ANSI))
|
||||
return 0;
|
||||
|
||||
if (IS_ENABLED(CONFIG_VIDEO)) {
|
||||
if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev))
|
||||
return CMD_RET_FAILURE;
|
||||
if (vidconsole_clear_and_reset(dev))
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
if (console_clear())
|
||||
return CMD_RET_FAILURE;
|
||||
|
||||
return CMD_RET_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -19,12 +19,15 @@
|
||||
#include <stdio_dev.h>
|
||||
#include <exports.h>
|
||||
#include <env_internal.h>
|
||||
#include <video_console.h>
|
||||
#include <watchdog.h>
|
||||
#include <asm/global_data.h>
|
||||
#include <linux/delay.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
#define CSI "\x1b["
|
||||
|
||||
static int on_console(const char *name, const char *value, enum env_op op,
|
||||
int flags)
|
||||
{
|
||||
@@ -1010,6 +1013,34 @@ int console_init_f(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int console_clear(void)
|
||||
{
|
||||
/*
|
||||
* Send clear screen and home
|
||||
*
|
||||
* FIXME(Heinrich Schuchardt <xypron.glpk@gmx.de>): This should go
|
||||
* through an API and only be written to serial terminals, not video
|
||||
* displays
|
||||
*/
|
||||
printf(CSI "2J" CSI "1;1H");
|
||||
if (IS_ENABLED(CONFIG_VIDEO_ANSI))
|
||||
return 0;
|
||||
|
||||
if (IS_ENABLED(CONFIG_VIDEO)) {
|
||||
struct udevice *dev;
|
||||
int ret;
|
||||
|
||||
ret = uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = vidconsole_clear_and_reset(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void stdio_print_current_devices(void)
|
||||
{
|
||||
char *stdinname, *stdoutname, *stderrname;
|
||||
|
||||
@@ -16,6 +16,7 @@ CONFIG_USE_BOOTCOMMAND=y
|
||||
CONFIG_BOOTCOMMAND="run distro_bootcmd"
|
||||
# CONFIG_CMD_BOOTD is not set
|
||||
# CONFIG_CMD_BOOTM is not set
|
||||
# CONFIG_CMD_BOOTI is not set
|
||||
# CONFIG_CMD_ELF is not set
|
||||
# CONFIG_CMD_EXTENSION is not set
|
||||
# CONFIG_CMD_DATE is not set
|
||||
|
||||
@@ -320,6 +320,13 @@ use the `lite` option.
|
||||
make CROSS_COMPILE=$CC64 BINMAN_INDIRS=$LNX_FW_PATH \
|
||||
BL31=$TFA_PATH/build/k3/$TFA_BOARD/release/bl31.bin \
|
||||
TEE=$OPTEE_PATH/out/arm-plat-k3/core/tee-raw.bin
|
||||
|
||||
.. note::
|
||||
It is also possible to pick up a custom DM binary by adding TI_DM argument
|
||||
pointing to the file. If not provided, it defaults to picking up the DM
|
||||
binary from BINMAN_INDIRS. This is only applicable to devices that utilize
|
||||
split firmware.
|
||||
|
||||
.. k3_rst_include_end_build_steps_uboot
|
||||
|
||||
At this point you should have every binary needed initialize both the
|
||||
|
||||
2
doc/build/documentation.rst
vendored
2
doc/build/documentation.rst
vendored
@@ -37,7 +37,7 @@ The *htmldocs* target is used to build the HTML documentation. It uses the
|
||||
# Display the documentation in a graphical web browser
|
||||
x-www-browser doc/output/index.html
|
||||
|
||||
The HTML documentation is published at https://u-boot.readthedocs.io. The build
|
||||
The HTML documentation is published at https://docs.u-boot.org. The build
|
||||
process for that site is controlled by the file *.readthedocs.yml*.
|
||||
|
||||
Infodoc documentation
|
||||
|
||||
@@ -52,6 +52,8 @@ Flags are:
|
||||
matters, since by then the system boots in the OS and U-Boot is no-longer
|
||||
running. `bootflow scan -b` is a quick way to boot the first available OS.
|
||||
A valid bootflow is one that made it all the way to the `loaded` state.
|
||||
Note that if `-m` is provided as well, booting is delayed until the user
|
||||
selects a bootflow.
|
||||
|
||||
-e
|
||||
Used with -l to also show errors for each bootflow. The shows detailed error
|
||||
@@ -71,6 +73,9 @@ Flags are:
|
||||
priority or label is tried, to see if more bootdevs can be discovered, but
|
||||
this flag disables that process.
|
||||
|
||||
-m
|
||||
Show a menu of available bootflows for the user to select. When used with
|
||||
-b it then boots the one that was selected, if any.
|
||||
|
||||
The optional argument specifies a particular bootdev to scan. This can either be
|
||||
the name of a bootdev or its sequence number (both shown with `bootdev list`).
|
||||
|
||||
@@ -83,6 +83,11 @@ static oftree oftree_ensure(void *fdt)
|
||||
if (check_tree_count())
|
||||
return oftree_null();
|
||||
|
||||
if (fdt_check_header(fdt)) {
|
||||
log_err("Invalid device tree blob header\n");
|
||||
return oftree_null();
|
||||
}
|
||||
|
||||
/* register the new tree */
|
||||
i = oftree_count++;
|
||||
oftree_list[i] = fdt;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#define LOG_CATEGORY UCLASS_QFW
|
||||
|
||||
#include <common.h>
|
||||
#include <acpi/acpi_table.h>
|
||||
#include <bootdev.h>
|
||||
#include <bootflow.h>
|
||||
#include <bootmeth.h>
|
||||
|
||||
@@ -80,7 +80,7 @@ struct acpi_rsdt {
|
||||
};
|
||||
|
||||
/* XSDT (Extended System Description Table) */
|
||||
struct acpi_xsdt {
|
||||
struct __packed acpi_xsdt {
|
||||
struct acpi_table_header header;
|
||||
u64 entry[MAX_ACPI_TABLES];
|
||||
};
|
||||
@@ -920,6 +920,15 @@ void acpi_fill_header(struct acpi_table_header *header, char *signature);
|
||||
*/
|
||||
int acpi_fill_csrt(struct acpi_ctx *ctx);
|
||||
|
||||
/**
|
||||
* acpi_get_rsdp_addr() - get ACPI RSDP table address
|
||||
*
|
||||
* This routine returns the ACPI RSDP table address in the system memory.
|
||||
*
|
||||
* @return: ACPI RSDP table address
|
||||
*/
|
||||
ulong acpi_get_rsdp_addr(void);
|
||||
|
||||
/**
|
||||
* write_acpi_tables() - Write out the ACPI tables
|
||||
*
|
||||
|
||||
@@ -156,6 +156,16 @@ int console_announce_r(void);
|
||||
*/
|
||||
void console_puts_select_stderr(bool serial_only, const char *s);
|
||||
|
||||
/**
|
||||
* console_clear() - Clear the console
|
||||
*
|
||||
* Uses an ANSI sequence to clear the display, failing back to clearing the
|
||||
* video display directly if !CONFIG_VIDEO_ANSI
|
||||
*
|
||||
* Return: 0 if OK, -ve on error
|
||||
*/
|
||||
int console_clear(void);
|
||||
|
||||
/*
|
||||
* CONSOLE multiplexing.
|
||||
*/
|
||||
|
||||
@@ -55,7 +55,17 @@ int fdt_chosen(void *fdt);
|
||||
/**
|
||||
* Add initrd information to the FDT before booting the OS.
|
||||
*
|
||||
* @param fdt FDT address in memory
|
||||
* Adds linux,initrd-start and linux,initrd-end properties to the /chosen node,
|
||||
* creating it if necessary.
|
||||
*
|
||||
* A memory reservation for the ramdisk is added to the FDT, or an existing one
|
||||
* (with matching @initrd_start) updated.
|
||||
*
|
||||
* If @initrd_start == @initrd_end this function does nothing and returns 0.
|
||||
*
|
||||
* @fdt: Pointer to FDT in memory
|
||||
* @initrd_start: Start of ramdisk
|
||||
* @initrd_end: End of ramdisk
|
||||
* Return: 0 if ok, or -FDT_ERR_... on error
|
||||
*/
|
||||
int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end);
|
||||
@@ -232,13 +242,23 @@ int ft_system_setup(void *blob, struct bd_info *bd);
|
||||
void set_working_fdt_addr(ulong addr);
|
||||
|
||||
/**
|
||||
* shrink down the given blob to minimum size + some extrasize if required
|
||||
* fdt_shrink_to_minimum() - shrink FDT while allowing for some margin
|
||||
*
|
||||
* Shrink down the given blob to 'minimum' size + some extrasize.
|
||||
*
|
||||
* The new size is enough to hold the existing contents plus @extrasize bytes,
|
||||
* plus 5 memory reservations. Also, the end of the FDT is aligned to a 4KB
|
||||
* boundary, so it might end up up to 4KB larger than needed.
|
||||
*
|
||||
* If there is an existing memory reservation for @blob in the FDT, it is
|
||||
* updated for the new size.
|
||||
*
|
||||
* @param blob FDT blob to update
|
||||
* @param extrasize additional bytes needed
|
||||
* Return: 0 if ok, or -FDT_ERR_... on error
|
||||
*/
|
||||
int fdt_shrink_to_minimum(void *blob, uint extrasize);
|
||||
|
||||
int fdt_increase_size(void *fdt, int add_len);
|
||||
|
||||
int fdt_delete_disabled_nodes(void *blob);
|
||||
|
||||
@@ -1028,12 +1028,11 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
|
||||
*
|
||||
* @images: Images information
|
||||
* @blob: FDT to update
|
||||
* @of_size: Size of the FDT
|
||||
* @lmb: Points to logical memory block structure
|
||||
* Return: 0 if ok, <0 on failure
|
||||
*/
|
||||
int image_setup_libfdt(struct bootm_headers *images, void *blob,
|
||||
int of_size, struct lmb *lmb);
|
||||
struct lmb *lmb);
|
||||
|
||||
/**
|
||||
* Set up the FDT to use for booting a kernel
|
||||
|
||||
15
include/test/cmd.h
Normal file
15
include/test/cmd.h
Normal file
@@ -0,0 +1,15 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright 2023 Google LLC
|
||||
* Written by Simon Glass <sjg@chromium.org>
|
||||
*/
|
||||
|
||||
#ifndef __TEST_CMD_H__
|
||||
#define __TEST_CMD_H__
|
||||
|
||||
#include <test/test.h>
|
||||
|
||||
/* Declare a new command test */
|
||||
#define CMD_TEST(_name, _flags) UNIT_TEST(_name, _flags, cmd_test)
|
||||
|
||||
#endif /* __TEST_CMD_H__ */
|
||||
@@ -34,6 +34,7 @@ int do_ut_bootstd(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
char *const argv[]);
|
||||
int do_ut_bloblist(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
char *const argv[]);
|
||||
int do_ut_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
|
||||
int do_ut_common(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
|
||||
int do_ut_compression(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
char *const argv[]);
|
||||
|
||||
@@ -97,6 +97,23 @@ int ut_check_skipline(struct unit_test_state *uts);
|
||||
*/
|
||||
int ut_check_skip_to_line(struct unit_test_state *uts, const char *fmt, ...);
|
||||
|
||||
/**
|
||||
* ut_check_skip_to_linen() - skip output until a partial line is found
|
||||
*
|
||||
* This creates a string and then checks it against the following lines of
|
||||
* console output obtained with console_record_readline() until it is found.
|
||||
* Only the characters up to the length of the string are checked, so the line
|
||||
* may extend further
|
||||
*
|
||||
* After the function returns, uts->expect_str holds the expected string and
|
||||
* uts->actual_str holds the actual string read from the console.
|
||||
*
|
||||
* @uts: Test state
|
||||
* @fmt: printf() format string to look for, followed by args
|
||||
* Return: 0 if OK, -ENOENT if not found, other value on error
|
||||
*/
|
||||
int ut_check_skip_to_linen(struct unit_test_state *uts, const char *fmt, ...);
|
||||
|
||||
/**
|
||||
* ut_check_console_end() - Check there is no more console output
|
||||
*
|
||||
@@ -359,6 +376,19 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes);
|
||||
__ret; \
|
||||
})
|
||||
|
||||
/* Assert that a following console output line matches */
|
||||
#define ut_assert_skip_to_linen(fmt, args...) ({ \
|
||||
int __ret = 0; \
|
||||
\
|
||||
if (ut_check_skip_to_linen(uts, fmt, ##args)) { \
|
||||
ut_failf(uts, __FILE__, __LINE__, __func__, \
|
||||
"console", "\nExpected '%s',\n got to '%s'", \
|
||||
uts->expect_str, uts->actual_str); \
|
||||
return CMD_RET_FAILURE; \
|
||||
} \
|
||||
__ret; \
|
||||
})
|
||||
|
||||
/* Assert that there is no more console output */
|
||||
#define ut_assert_console_end() ({ \
|
||||
int __ret = 0; \
|
||||
|
||||
@@ -16,18 +16,30 @@ struct acpi_table_header *acpi_find_table(const char *sig)
|
||||
{
|
||||
struct acpi_rsdp *rsdp;
|
||||
struct acpi_rsdt *rsdt;
|
||||
struct acpi_xsdt *xsdt;
|
||||
int len, i, count;
|
||||
|
||||
rsdp = map_sysmem(gd_acpi_start(), 0);
|
||||
if (!rsdp)
|
||||
return NULL;
|
||||
rsdt = map_sysmem(rsdp->rsdt_address, 0);
|
||||
len = rsdt->header.length - sizeof(rsdt->header);
|
||||
count = len / sizeof(u32);
|
||||
if (rsdp->xsdt_address) {
|
||||
xsdt = map_sysmem(rsdp->xsdt_address, 0);
|
||||
len = xsdt->header.length - sizeof(xsdt->header);
|
||||
count = len / sizeof(u64);
|
||||
} else {
|
||||
if (!rsdp->rsdt_address)
|
||||
return NULL;
|
||||
rsdt = map_sysmem(rsdp->rsdt_address, 0);
|
||||
len = rsdt->header.length - sizeof(rsdt->header);
|
||||
count = len / sizeof(u32);
|
||||
}
|
||||
for (i = 0; i < count; i++) {
|
||||
struct acpi_table_header *hdr;
|
||||
|
||||
hdr = map_sysmem(rsdt->entry[i], 0);
|
||||
if (rsdp->xsdt_address)
|
||||
hdr = map_sysmem(xsdt->entry[i], 0);
|
||||
else
|
||||
hdr = map_sysmem(rsdt->entry[i], 0);
|
||||
if (!memcmp(hdr->signature, sig, ACPI_NAME_LEN))
|
||||
return hdr;
|
||||
if (!memcmp(hdr->signature, "FACP", ACPI_NAME_LEN)) {
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <dm/acpi.h>
|
||||
#include <mapmem.h>
|
||||
#include <tables_csum.h>
|
||||
#include <linux/sizes.h>
|
||||
|
||||
void acpi_write_rsdp(struct acpi_rsdp *rsdp, struct acpi_rsdt *rsdt,
|
||||
struct acpi_xsdt *xsdt)
|
||||
@@ -21,10 +22,13 @@ void acpi_write_rsdp(struct acpi_rsdp *rsdp, struct acpi_rsdt *rsdt,
|
||||
memcpy(rsdp->signature, RSDP_SIG, 8);
|
||||
memcpy(rsdp->oem_id, OEM_ID, 6);
|
||||
|
||||
rsdp->length = sizeof(struct acpi_rsdp);
|
||||
rsdp->rsdt_address = map_to_sysmem(rsdt);
|
||||
if (rsdt)
|
||||
rsdp->rsdt_address = map_to_sysmem(rsdt);
|
||||
|
||||
rsdp->xsdt_address = map_to_sysmem(xsdt);
|
||||
if (xsdt)
|
||||
rsdp->xsdt_address = map_to_sysmem(xsdt);
|
||||
|
||||
rsdp->length = sizeof(struct acpi_rsdp);
|
||||
rsdp->revision = ACPI_RSDP_REV_ACPI_2_0;
|
||||
|
||||
/* Calculate checksums */
|
||||
@@ -68,11 +72,15 @@ static void acpi_write_xsdt(struct acpi_xsdt *xsdt)
|
||||
static int acpi_write_base(struct acpi_ctx *ctx,
|
||||
const struct acpi_writer *entry)
|
||||
{
|
||||
/* We need at least an RSDP and an RSDT Table */
|
||||
/* We need at least an RSDP and an XSDT Table */
|
||||
ctx->rsdp = ctx->current;
|
||||
acpi_inc_align(ctx, sizeof(struct acpi_rsdp));
|
||||
ctx->rsdt = ctx->current;
|
||||
acpi_inc_align(ctx, sizeof(struct acpi_rsdt));
|
||||
if (map_to_sysmem(ctx->current) < SZ_4G - SZ_64K) {
|
||||
ctx->rsdt = ctx->current;
|
||||
acpi_inc_align(ctx, sizeof(struct acpi_rsdt));
|
||||
} else {
|
||||
ctx->rsdt = 0;
|
||||
}
|
||||
ctx->xsdt = ctx->current;
|
||||
acpi_inc_align(ctx, sizeof(struct acpi_xsdt));
|
||||
|
||||
@@ -80,7 +88,8 @@ static int acpi_write_base(struct acpi_ctx *ctx,
|
||||
memset(ctx->base, '\0', ctx->current - ctx->base);
|
||||
|
||||
acpi_write_rsdp(ctx->rsdp, ctx->rsdt, ctx->xsdt);
|
||||
acpi_write_rsdt(ctx->rsdt);
|
||||
if (ctx->rsdt)
|
||||
acpi_write_rsdt(ctx->rsdt);
|
||||
acpi_write_xsdt(ctx->xsdt);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -18,10 +18,9 @@ int acpi_write_ssdt(struct acpi_ctx *ctx, const struct acpi_writer *entry)
|
||||
int ret;
|
||||
|
||||
ssdt = ctx->current;
|
||||
memset((void *)ssdt, '\0', sizeof(struct acpi_table_header));
|
||||
memset(ssdt, '\0', sizeof(struct acpi_table_header));
|
||||
|
||||
acpi_fill_header(ssdt, "SSDT");
|
||||
memcpy(ssdt->oem_table_id, OEM_TABLE_ID, sizeof(ssdt->oem_table_id));
|
||||
ssdt->revision = acpi_get_table_revision(ACPITAB_SSDT);
|
||||
ssdt->aslc_revision = 1;
|
||||
ssdt->length = sizeof(struct acpi_table_header);
|
||||
|
||||
@@ -173,7 +173,7 @@ efi_dt_fixup(struct efi_dt_fixup_protocol *this, void *dtb,
|
||||
}
|
||||
|
||||
fdt_set_totalsize(dtb, *buffer_size);
|
||||
if (image_setup_libfdt(&img, dtb, 0, NULL)) {
|
||||
if (image_setup_libfdt(&img, dtb, NULL)) {
|
||||
log_err("failed to process device tree\n");
|
||||
ret = EFI_INVALID_PARAMETER;
|
||||
goto out;
|
||||
|
||||
@@ -29,6 +29,9 @@ repo="--repository testpypi"
|
||||
# Non-empty to do the actual upload
|
||||
upload=1
|
||||
|
||||
# Non-empty to delete files used for testing
|
||||
delete_testfiles=1
|
||||
|
||||
tool="$1"
|
||||
shift
|
||||
flags="$*"
|
||||
@@ -36,7 +39,7 @@ flags="$*"
|
||||
if [[ "${tool}" =~ ^(patman|buildman|dtoc|binman|u_boot_pylib)$ ]]; then
|
||||
echo "Building dist package for tool ${tool}"
|
||||
else
|
||||
echo "Unknown tool ${tool}: use patman, buildman, dtoc or binman"
|
||||
echo "Unknown tool ${tool}: use u_boot_pylib, patman, buildman, dtoc or binman"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -58,6 +61,11 @@ if [ -n "${upload}" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "${tool}" =~ ^(patman|u_boot_pylib)$ ]]; then
|
||||
# Leave test_util.py and patman test files alone
|
||||
delete_testfiles=
|
||||
fi
|
||||
|
||||
# Create a temp dir to work in
|
||||
dir=$(mktemp -d)
|
||||
|
||||
@@ -91,7 +99,9 @@ find ${dest} -name __pycache__ -type f -exec rm {} \;
|
||||
find ${dest} -depth -name __pycache__ -exec rmdir 112 \;
|
||||
|
||||
# Remove test files
|
||||
rm -rf ${dest}/*test*
|
||||
if [ -n "${delete_testfiles}" ]; then
|
||||
rm -rfv ${dest}/*test*
|
||||
fi
|
||||
|
||||
mkdir ${dir}/tests
|
||||
cd ${dir}
|
||||
|
||||
@@ -32,6 +32,7 @@ if UT_LIB
|
||||
|
||||
config UT_LIB_ASN1
|
||||
bool "Unit test for asn1 compiler and decoder function"
|
||||
depends on SANDBOX
|
||||
default y
|
||||
imply ASYMMETRIC_KEY_TYPE
|
||||
imply ASYMMETRIC_PUBLIC_KEY_SUBTYPE
|
||||
@@ -64,6 +65,11 @@ config UT_LIB_RSA
|
||||
|
||||
endif
|
||||
|
||||
config UT_BOOTSTD
|
||||
bool "Unit tests for standard boot"
|
||||
depends on UNIT_TEST && SANDBOX
|
||||
default y
|
||||
|
||||
config UT_COMPRESSION
|
||||
bool "Unit test for compression"
|
||||
depends on UNIT_TEST
|
||||
|
||||
@@ -23,7 +23,7 @@ obj-$(CONFIG_UT_TIME) += time_ut.o
|
||||
obj-y += ut.o
|
||||
|
||||
ifeq ($(CONFIG_SPL_BUILD),)
|
||||
obj-$(CONFIG_UNIT_TEST) += boot/
|
||||
obj-$(CONFIG_$(SPL_)UT_BOOTSTD) += boot/
|
||||
obj-$(CONFIG_UNIT_TEST) += common/
|
||||
obj-y += log/
|
||||
obj-$(CONFIG_$(SPL_)UT_UNICODE) += unicode_ut.o
|
||||
|
||||
@@ -637,6 +637,88 @@ static int bootflow_cmd_menu(struct unit_test_state *uts)
|
||||
}
|
||||
BOOTSTD_TEST(bootflow_cmd_menu, UT_TESTF_DM | UT_TESTF_SCAN_FDT);
|
||||
|
||||
/* Check 'bootflow scan -m' to select a bootflow using a menu */
|
||||
static int bootflow_scan_menu(struct unit_test_state *uts)
|
||||
{
|
||||
struct bootstd_priv *std;
|
||||
const char **old_order, **new_order;
|
||||
char prev[3];
|
||||
|
||||
/* get access to the current bootflow */
|
||||
ut_assertok(bootstd_get_priv(&std));
|
||||
|
||||
ut_assertok(prep_mmc_bootdev(uts, "mmc4", false, &old_order));
|
||||
|
||||
/* Add keypresses to move to and select the second one in the list */
|
||||
prev[0] = CTL_CH('n');
|
||||
prev[1] = '\r';
|
||||
prev[2] = '\0';
|
||||
ut_asserteq(2, console_in_puts(prev));
|
||||
|
||||
ut_assertok(run_command("bootflow scan -lm", 0));
|
||||
new_order = std->bootdev_order;
|
||||
std->bootdev_order = old_order;
|
||||
|
||||
ut_assert_skip_to_line("No more bootdevs");
|
||||
ut_assert_nextlinen("--");
|
||||
ut_assert_nextline("(2 bootflows, 2 valid)");
|
||||
|
||||
ut_assert_nextline("Selected: Armbian");
|
||||
ut_assertnonnull(std->cur_bootflow);
|
||||
ut_assert_console_end();
|
||||
|
||||
/* Check not selecting anything */
|
||||
prev[0] = '\e';
|
||||
prev[1] = '\0';
|
||||
ut_asserteq(1, console_in_puts(prev));
|
||||
|
||||
std->bootdev_order = new_order; /* Blue Monday */
|
||||
ut_assertok(run_command("bootflow scan -lm", 0));
|
||||
std->bootdev_order = old_order;
|
||||
|
||||
ut_assertnull(std->cur_bootflow);
|
||||
ut_assert_skip_to_line("(2 bootflows, 2 valid)");
|
||||
ut_assert_nextline("Nothing chosen");
|
||||
ut_assert_console_end();
|
||||
|
||||
return 0;
|
||||
}
|
||||
BOOTSTD_TEST(bootflow_scan_menu,
|
||||
UT_TESTF_DM | UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC);
|
||||
|
||||
/* Check 'bootflow scan -mb' to select and boot a bootflow using a menu */
|
||||
static int bootflow_scan_menu_boot(struct unit_test_state *uts)
|
||||
{
|
||||
struct bootstd_priv *std;
|
||||
const char **old_order;
|
||||
char prev[3];
|
||||
|
||||
/* get access to the current bootflow */
|
||||
ut_assertok(bootstd_get_priv(&std));
|
||||
|
||||
ut_assertok(prep_mmc_bootdev(uts, "mmc4", false, &old_order));
|
||||
|
||||
/* Add keypresses to move to and select the second one in the list */
|
||||
prev[0] = CTL_CH('n');
|
||||
prev[1] = '\r';
|
||||
prev[2] = '\0';
|
||||
ut_asserteq(2, console_in_puts(prev));
|
||||
|
||||
ut_assertok(run_command("bootflow scan -lmb", 0));
|
||||
std->bootdev_order = old_order;
|
||||
|
||||
ut_assert_skip_to_line("(2 bootflows, 2 valid)");
|
||||
|
||||
ut_assert_nextline("Selected: Armbian");
|
||||
ut_assert_skip_to_line("Boot failed (err=-14)");
|
||||
ut_assertnonnull(std->cur_bootflow);
|
||||
ut_assert_console_end();
|
||||
|
||||
return 0;
|
||||
}
|
||||
BOOTSTD_TEST(bootflow_scan_menu_boot,
|
||||
UT_TESTF_DM | UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC);
|
||||
|
||||
/* Check searching for a single bootdev using the hunters */
|
||||
static int bootflow_cmd_hunt_single(struct unit_test_state *uts)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
# Copyright (c) 2013 Google, Inc
|
||||
# Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
|
||||
obj-y += cmd_ut_cmd.o
|
||||
|
||||
ifdef CONFIG_HUSH_PARSER
|
||||
obj-$(CONFIG_CONSOLE_RECORD) += test_echo.o
|
||||
endif
|
||||
|
||||
@@ -114,6 +114,18 @@ static int lmb_test_dump_region(struct unit_test_state *uts,
|
||||
end = base + size - 1;
|
||||
flags = rgn->region[i].flags;
|
||||
|
||||
/*
|
||||
* this entry includes the stack (get_sp()) on many platforms
|
||||
* so will different each time lmb_init_and_reserve() is called.
|
||||
* We could instead have the bdinfo command put its lmb region
|
||||
* in a known location, so we can check it directly, rather than
|
||||
* calling lmb_init_and_reserve() to create a new (and hopefully
|
||||
* identical one). But for now this seems good enough.
|
||||
*/
|
||||
if (!IS_ENABLED(CONFIG_SANDBOX) && i == 3) {
|
||||
ut_assert_nextlinen(" %s[%d]\t[", name, i);
|
||||
continue;
|
||||
}
|
||||
ut_assert_nextline(" %s[%d]\t[0x%llx-0x%llx], 0x%08llx bytes flags: %x",
|
||||
name, i, base, end, size, flags);
|
||||
}
|
||||
@@ -124,8 +136,8 @@ static int lmb_test_dump_region(struct unit_test_state *uts,
|
||||
static int lmb_test_dump_all(struct unit_test_state *uts, struct lmb *lmb)
|
||||
{
|
||||
ut_assert_nextline("lmb_dump_all:");
|
||||
lmb_test_dump_region(uts, &lmb->memory, "memory");
|
||||
lmb_test_dump_region(uts, &lmb->reserved, "reserved");
|
||||
ut_assertok(lmb_test_dump_region(uts, &lmb->memory, "memory"));
|
||||
ut_assertok(lmb_test_dump_region(uts, &lmb->reserved, "reserved"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -179,7 +191,7 @@ static int bdinfo_test_all(struct unit_test_state *uts)
|
||||
ut_assertok(test_num_l(uts, "fdt_size", (ulong)gd->fdt_size));
|
||||
|
||||
if (IS_ENABLED(CONFIG_VIDEO))
|
||||
test_video_info(uts);
|
||||
ut_assertok(test_video_info(uts));
|
||||
|
||||
/* The gd->multi_dtb_fit may not be available, hence, #if below. */
|
||||
#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
|
||||
@@ -190,7 +202,7 @@ static int bdinfo_test_all(struct unit_test_state *uts)
|
||||
struct lmb lmb;
|
||||
|
||||
lmb_init_and_reserve(&lmb, gd->bd, (void *)gd->fdt_blob);
|
||||
lmb_test_dump_all(uts, &lmb);
|
||||
ut_assertok(lmb_test_dump_all(uts, &lmb));
|
||||
if (IS_ENABLED(CONFIG_OF_REAL))
|
||||
ut_assert_nextline("devicetree = %s", fdtdec_get_srcname());
|
||||
}
|
||||
@@ -215,6 +227,9 @@ static int bdinfo_test_all(struct unit_test_state *uts)
|
||||
ut_assertok(test_num_l(uts, "malloc base", gd_malloc_start()));
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_X86))
|
||||
ut_check_skip_to_linen(uts, " high end =");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
20
test/cmd/cmd_ut_cmd.c
Normal file
20
test/cmd/cmd_ut_cmd.c
Normal file
@@ -0,0 +1,20 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright 2023 Google LLC
|
||||
* Written by Simon Glass <sjg@chromium.org>
|
||||
*
|
||||
* Unit tests for command functions
|
||||
*/
|
||||
|
||||
#include <command.h>
|
||||
#include <test/cmd.h>
|
||||
#include <test/suites.h>
|
||||
#include <test/ut.h>
|
||||
|
||||
int do_ut_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
|
||||
{
|
||||
struct unit_test *tests = UNIT_TEST_SUITE_START(cmd_test);
|
||||
const int n_ents = UNIT_TEST_SUITE_COUNT(cmd_test);
|
||||
|
||||
return cmd_ut_category("cmd", "cmd_test_", tests, n_ents, argc, argv);
|
||||
}
|
||||
@@ -160,7 +160,13 @@ static int fdt_test_addr(struct unit_test_state *uts)
|
||||
set_working_fdt_addr(0);
|
||||
ut_assert_nextline("Working FDT set to 0");
|
||||
ut_asserteq(CMD_RET_FAILURE, run_command("fdt addr", 0));
|
||||
ut_assert_nextline("libfdt fdt_check_header(): FDT_ERR_BADMAGIC");
|
||||
|
||||
/*
|
||||
* sandbox fails the check for !blob since the 0 pointer is mapped to
|
||||
* memory somewhere other than at 0x0
|
||||
*/
|
||||
if (IS_ENABLED(CONFIG_SANDBOX))
|
||||
ut_assert_nextline("libfdt fdt_check_header(): FDT_ERR_BADMAGIC");
|
||||
ut_assertok(ut_check_console_end(uts));
|
||||
|
||||
/* Set up a working FDT and try again */
|
||||
|
||||
@@ -30,13 +30,17 @@ static int font_test_base(struct unit_test_state *uts)
|
||||
ut_assertok(console_record_reset_enable());
|
||||
ut_assertok(run_command("font list", 0));
|
||||
ut_assert_nextline("nimbus_sans_l_regular");
|
||||
ut_assert_nextline("cantoraone_regular");
|
||||
if (IS_ENABLED(CONFIG_CONSOLE_TRUETYPE_CANTORAONE))
|
||||
ut_assert_nextline("cantoraone_regular");
|
||||
ut_assertok(ut_check_console_end(uts));
|
||||
|
||||
ut_assertok(vidconsole_get_font_size(dev, &name, &size));
|
||||
ut_asserteq_str("nimbus_sans_l_regular", name);
|
||||
ut_asserteq(18, size);
|
||||
|
||||
if (!IS_ENABLED(CONFIG_CONSOLE_TRUETYPE_CANTORAONE))
|
||||
return 0;
|
||||
|
||||
max_metrics = 1;
|
||||
if (IS_ENABLED(CONFIG_CONSOLE_TRUETYPE))
|
||||
max_metrics = IF_ENABLED_INT(CONFIG_CONSOLE_TRUETYPE,
|
||||
|
||||
@@ -57,9 +57,12 @@ static struct cmd_tbl cmd_ut_sub[] = {
|
||||
#ifdef CONFIG_CMD_BDI
|
||||
U_BOOT_CMD_MKENT(bdinfo, CONFIG_SYS_MAXARGS, 1, do_ut_bdinfo, "", ""),
|
||||
#endif
|
||||
#ifdef CONFIG_BOOTSTD
|
||||
#ifdef CONFIG_UT_BOOTSTD
|
||||
U_BOOT_CMD_MKENT(bootstd, CONFIG_SYS_MAXARGS, 1, do_ut_bootstd,
|
||||
"", ""),
|
||||
#endif
|
||||
#ifdef CONFIG_CMDLINE
|
||||
U_BOOT_CMD_MKENT(cmd, CONFIG_SYS_MAXARGS, 1, do_ut_cmd, "", ""),
|
||||
#endif
|
||||
U_BOOT_CMD_MKENT(common, CONFIG_SYS_MAXARGS, 1, do_ut_common, "", ""),
|
||||
#if defined(CONFIG_UT_DM)
|
||||
@@ -195,6 +198,9 @@ U_BOOT_LONGHELP(ut,
|
||||
#ifdef CONFIG_BOOTSTD
|
||||
"\nbootstd - standard boot implementation"
|
||||
#endif
|
||||
#ifdef CONFIG_CMDLINE
|
||||
"\ncmd - test various commands"
|
||||
#endif
|
||||
#ifdef CONFIG_SANDBOX
|
||||
"\ncompression - compressors and bootm decompression"
|
||||
#endif
|
||||
|
||||
@@ -92,6 +92,9 @@ static int test_event_probe(struct unit_test_state *uts)
|
||||
struct test_state state;
|
||||
struct udevice *dev;
|
||||
|
||||
if (!IS_ENABLED(SANDBOX))
|
||||
return -EAGAIN;
|
||||
|
||||
state.val = 0;
|
||||
ut_assertok(event_register("pre", EVT_DM_PRE_PROBE, h_probe, &state));
|
||||
ut_assertok(event_register("post", EVT_DM_POST_PROBE, h_probe, &state));
|
||||
|
||||
124
test/dm/acpi.c
124
test/dm/acpi.c
@@ -395,26 +395,26 @@ static int dm_test_acpi_cmd_list(struct unit_test_state *uts)
|
||||
|
||||
console_record_reset();
|
||||
run_command("acpi list", 0);
|
||||
ut_assert_nextline("Name Base Size Detail");
|
||||
ut_assert_nextline("---- -------- ----- ------");
|
||||
ut_assert_nextline("RSDP %08lx %5zx v02 U-BOOT", addr,
|
||||
ut_assert_nextline("Name Base Size Detail");
|
||||
ut_assert_nextline("---- ---------------- ----- ----------------------------");
|
||||
ut_assert_nextline("RSDP %16lx %5zx v02 U-BOOT", addr,
|
||||
sizeof(struct acpi_rsdp));
|
||||
addr = ALIGN(addr + sizeof(struct acpi_rsdp), 16);
|
||||
ut_assert_nextline("RSDT %08lx %5zx v01 U-BOOT U-BOOTBL %x INTL 0",
|
||||
ut_assert_nextline("RSDT %16lx %5zx v01 U-BOOT U-BOOTBL %x INTL 0",
|
||||
addr, sizeof(struct acpi_table_header) +
|
||||
3 * sizeof(u32), OEM_REVISION);
|
||||
addr = ALIGN(addr + sizeof(struct acpi_rsdt), 16);
|
||||
ut_assert_nextline("XSDT %08lx %5zx v01 U-BOOT U-BOOTBL %x INTL 0",
|
||||
ut_assert_nextline("XSDT %16lx %5zx v01 U-BOOT U-BOOTBL %x INTL 0",
|
||||
addr, sizeof(struct acpi_table_header) +
|
||||
3 * sizeof(u64), OEM_REVISION);
|
||||
addr = ALIGN(addr + sizeof(struct acpi_xsdt), 64);
|
||||
ut_assert_nextline("DMAR %08lx %5zx v01 U-BOOT U-BOOTBL %x INTL 0",
|
||||
ut_assert_nextline("DMAR %16lx %5zx v01 U-BOOT U-BOOTBL %x INTL 0",
|
||||
addr, sizeof(struct acpi_dmar), OEM_REVISION);
|
||||
addr = ALIGN(addr + sizeof(struct acpi_dmar), 16);
|
||||
ut_assert_nextline("DMAR %08lx %5zx v01 U-BOOT U-BOOTBL %x INTL 0",
|
||||
ut_assert_nextline("DMAR %16lx %5zx v01 U-BOOT U-BOOTBL %x INTL 0",
|
||||
addr, sizeof(struct acpi_dmar), OEM_REVISION);
|
||||
addr = ALIGN(addr + sizeof(struct acpi_dmar), 16);
|
||||
ut_assert_nextline("DMAR %08lx %5zx v01 U-BOOT U-BOOTBL %x INTL 0",
|
||||
ut_assert_nextline("DMAR %16lx %5zx v01 U-BOOT U-BOOTBL %x INTL 0",
|
||||
addr, sizeof(struct acpi_dmar), OEM_REVISION);
|
||||
ut_assert_console_end();
|
||||
|
||||
@@ -446,7 +446,7 @@ static int dm_test_acpi_cmd_dump(struct unit_test_state *uts)
|
||||
console_record_reset();
|
||||
run_command("acpi dump dmar", 0);
|
||||
addr = ALIGN(map_to_sysmem(ctx.xsdt) + sizeof(struct acpi_xsdt), 64);
|
||||
ut_assert_nextline("DMAR @ %08lx", addr);
|
||||
ut_assert_nextline("DMAR @ %16lx", addr);
|
||||
ut_assert_nextlines_are_dump(0x30);
|
||||
ut_assert_console_end();
|
||||
|
||||
@@ -651,3 +651,109 @@ static int dm_test_acpi_cmd_set(struct unit_test_state *uts)
|
||||
return 0;
|
||||
}
|
||||
DM_TEST(dm_test_acpi_cmd_set, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
|
||||
|
||||
/**
|
||||
* dm_test_write_test_table() - create test ACPI table
|
||||
*
|
||||
* Create an ACPI table TSTn, where n is given by @index.
|
||||
*
|
||||
* @ctx: ACPI table writing context
|
||||
* @index: table index
|
||||
* Return: generated table
|
||||
*/
|
||||
static struct acpi_table_header
|
||||
*dm_test_write_test_table(struct acpi_ctx *ctx, int index)
|
||||
{
|
||||
struct acpi_table_header *tbl = ctx->current;
|
||||
char signature[5];
|
||||
|
||||
snprintf(signature, sizeof(signature), "TST%1d", index);
|
||||
memset(tbl, 0, sizeof(*tbl));
|
||||
acpi_fill_header(tbl, signature);
|
||||
acpi_inc(ctx, sizeof(struct acpi_table_header));
|
||||
tbl->length = (u8 *)ctx->current - (u8 *)tbl;
|
||||
tbl->checksum = table_compute_checksum(tbl, tbl->length);
|
||||
acpi_add_table(ctx, tbl);
|
||||
|
||||
return tbl;
|
||||
}
|
||||
|
||||
/* Test acpi_find_table() */
|
||||
static int dm_test_acpi_find_table(struct unit_test_state *uts)
|
||||
{
|
||||
struct acpi_ctx ctx;
|
||||
ulong acpi_start, addr;
|
||||
void *buf;
|
||||
struct acpi_table_header *table, *table1, *table2, *table3;
|
||||
struct acpi_rsdp *rsdp;
|
||||
ulong rsdt;
|
||||
ulong xsdt;
|
||||
|
||||
/* Keep reference to original ACPI tables */
|
||||
acpi_start = gd_acpi_start();
|
||||
|
||||
/* Setup new ACPI tables */
|
||||
buf = memalign(16, BUF_SIZE);
|
||||
ut_assertnonnull(buf);
|
||||
addr = map_to_sysmem(buf);
|
||||
ut_assertok(setup_ctx_and_base_tables(uts, &ctx, addr));
|
||||
table3 = dm_test_write_test_table(&ctx, 3);
|
||||
table1 = dm_test_write_test_table(&ctx, 1);
|
||||
table2 = dm_test_write_test_table(&ctx, 2);
|
||||
|
||||
/* Retrieve RSDP, RSDT, XSDT */
|
||||
rsdp = map_sysmem(gd_acpi_start(), 0);
|
||||
ut_assertnonnull(rsdp);
|
||||
rsdt = rsdp->rsdt_address;
|
||||
ut_assert(rsdt);
|
||||
xsdt = rsdp->xsdt_address;
|
||||
ut_assert(xsdt);
|
||||
|
||||
/* Find with both RSDT and XSDT */
|
||||
table = acpi_find_table("TST1");
|
||||
ut_asserteq_ptr(table1, table);
|
||||
ut_asserteq_strn("TST1", table->signature);
|
||||
table = acpi_find_table("TST2");
|
||||
ut_asserteq_ptr(table2, table);
|
||||
ut_asserteq_strn("TST2", table->signature);
|
||||
table = acpi_find_table("TST3");
|
||||
ut_asserteq_ptr(table3, table);
|
||||
ut_asserteq_strn("TST3", table->signature);
|
||||
|
||||
/* Find with XSDT only */
|
||||
rsdp->rsdt_address = 0;
|
||||
table = acpi_find_table("TST1");
|
||||
ut_asserteq_ptr(table1, table);
|
||||
table = acpi_find_table("TST2");
|
||||
ut_asserteq_ptr(table2, table);
|
||||
table = acpi_find_table("TST3");
|
||||
ut_asserteq_ptr(table3, table);
|
||||
rsdp->rsdt_address = rsdt;
|
||||
|
||||
/* Find with RSDT only */
|
||||
rsdp->xsdt_address = 0;
|
||||
table = acpi_find_table("TST1");
|
||||
ut_asserteq_ptr(table1, table);
|
||||
table = acpi_find_table("TST2");
|
||||
ut_asserteq_ptr(table2, table);
|
||||
table = acpi_find_table("TST3");
|
||||
ut_asserteq_ptr(table3, table);
|
||||
rsdp->xsdt_address = xsdt;
|
||||
|
||||
/* Restore previous ACPI tables */
|
||||
gd_set_acpi_start(acpi_start);
|
||||
free(buf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
DM_TEST(dm_test_acpi_find_table, 0);
|
||||
|
||||
/* Test offsets in RSDT, XSDT */
|
||||
static int dm_test_acpi_offsets(struct unit_test_state *uts)
|
||||
{
|
||||
ut_asserteq(36, offsetof(struct acpi_rsdt, entry));
|
||||
ut_asserteq(36, offsetof(struct acpi_xsdt, entry));
|
||||
|
||||
return 0;
|
||||
}
|
||||
DM_TEST(dm_test_acpi_offsets, 0);
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <log.h>
|
||||
#include <malloc.h>
|
||||
#include <dm/test.h>
|
||||
#include <test/lib.h>
|
||||
#include <test/test.h>
|
||||
#include <test/ut.h>
|
||||
|
||||
@@ -205,8 +206,7 @@ static int lib_test_lmb_simple(struct unit_test_state *uts)
|
||||
/* simulate 512 MiB RAM beginning at 1.5GiB */
|
||||
return test_multi_alloc_512mb(uts, 0xE0000000);
|
||||
}
|
||||
|
||||
DM_TEST(lib_test_lmb_simple, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
|
||||
LIB_TEST(lib_test_lmb_simple, 0);
|
||||
|
||||
/* Create two memory regions with one reserved region and allocate */
|
||||
static int lib_test_lmb_simple_x2(struct unit_test_state *uts)
|
||||
@@ -221,8 +221,7 @@ static int lib_test_lmb_simple_x2(struct unit_test_state *uts)
|
||||
/* simulate 512 MiB RAM beginning at 3.5GiB and 1 GiB */
|
||||
return test_multi_alloc_512mb_x2(uts, 0xE0000000, 0x40000000);
|
||||
}
|
||||
|
||||
DM_TEST(lib_test_lmb_simple_x2, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
|
||||
LIB_TEST(lib_test_lmb_simple_x2, 0);
|
||||
|
||||
/* Simulate 512 MiB RAM, allocate some blocks that fit/don't fit */
|
||||
static int test_bigblock(struct unit_test_state *uts, const phys_addr_t ram)
|
||||
@@ -288,8 +287,7 @@ static int lib_test_lmb_big(struct unit_test_state *uts)
|
||||
/* simulate 512 MiB RAM beginning at 1.5GiB */
|
||||
return test_bigblock(uts, 0xE0000000);
|
||||
}
|
||||
|
||||
DM_TEST(lib_test_lmb_big, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
|
||||
LIB_TEST(lib_test_lmb_big, 0);
|
||||
|
||||
/* Simulate 512 MiB RAM, allocate a block without previous reservation */
|
||||
static int test_noreserved(struct unit_test_state *uts, const phys_addr_t ram,
|
||||
@@ -364,7 +362,7 @@ static int lib_test_lmb_noreserved(struct unit_test_state *uts)
|
||||
return test_noreserved(uts, 0xE0000000, 4, 1);
|
||||
}
|
||||
|
||||
DM_TEST(lib_test_lmb_noreserved, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
|
||||
LIB_TEST(lib_test_lmb_noreserved, 0);
|
||||
|
||||
static int lib_test_lmb_unaligned_size(struct unit_test_state *uts)
|
||||
{
|
||||
@@ -378,8 +376,8 @@ static int lib_test_lmb_unaligned_size(struct unit_test_state *uts)
|
||||
/* simulate 512 MiB RAM beginning at 1.5GiB */
|
||||
return test_noreserved(uts, 0xE0000000, 5, 8);
|
||||
}
|
||||
LIB_TEST(lib_test_lmb_unaligned_size, 0);
|
||||
|
||||
DM_TEST(lib_test_lmb_unaligned_size, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
|
||||
/*
|
||||
* Simulate a RAM that starts at 0 and allocate down to address 0, which must
|
||||
* fail as '0' means failure for the lmb_alloc functions.
|
||||
@@ -421,8 +419,7 @@ static int lib_test_lmb_at_0(struct unit_test_state *uts)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DM_TEST(lib_test_lmb_at_0, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
|
||||
LIB_TEST(lib_test_lmb_at_0, 0);
|
||||
|
||||
/* Check that calling lmb_reserve with overlapping regions fails. */
|
||||
static int lib_test_lmb_overlapping_reserve(struct unit_test_state *uts)
|
||||
@@ -470,9 +467,7 @@ static int lib_test_lmb_overlapping_reserve(struct unit_test_state *uts)
|
||||
0, 0, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DM_TEST(lib_test_lmb_overlapping_reserve,
|
||||
UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
|
||||
LIB_TEST(lib_test_lmb_overlapping_reserve, 0);
|
||||
|
||||
/*
|
||||
* Simulate 512 MiB RAM, reserve 3 blocks, allocate addresses in between.
|
||||
@@ -601,8 +596,7 @@ static int lib_test_lmb_alloc_addr(struct unit_test_state *uts)
|
||||
/* simulate 512 MiB RAM beginning at 1.5GiB */
|
||||
return test_alloc_addr(uts, 0xE0000000);
|
||||
}
|
||||
|
||||
DM_TEST(lib_test_lmb_alloc_addr, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
|
||||
LIB_TEST(lib_test_lmb_alloc_addr, 0);
|
||||
|
||||
/* Simulate 512 MiB RAM, reserve 3 blocks, check addresses in between */
|
||||
static int test_get_unreserved_size(struct unit_test_state *uts,
|
||||
@@ -672,9 +666,7 @@ static int lib_test_lmb_get_free_size(struct unit_test_state *uts)
|
||||
/* simulate 512 MiB RAM beginning at 1.5GiB */
|
||||
return test_get_unreserved_size(uts, 0xE0000000);
|
||||
}
|
||||
|
||||
DM_TEST(lib_test_lmb_get_free_size,
|
||||
UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
|
||||
LIB_TEST(lib_test_lmb_get_free_size, 0);
|
||||
|
||||
#ifdef CONFIG_LMB_USE_MAX_REGIONS
|
||||
static int lib_test_lmb_max_regions(struct unit_test_state *uts)
|
||||
@@ -743,11 +735,9 @@ static int lib_test_lmb_max_regions(struct unit_test_state *uts)
|
||||
|
||||
return 0;
|
||||
}
|
||||
LIB_TEST(lib_test_lmb_max_regions, 0);
|
||||
#endif
|
||||
|
||||
DM_TEST(lib_test_lmb_max_regions,
|
||||
UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
|
||||
|
||||
static int lib_test_lmb_flags(struct unit_test_state *uts)
|
||||
{
|
||||
const phys_addr_t ram = 0x40000000;
|
||||
@@ -833,6 +823,4 @@ static int lib_test_lmb_flags(struct unit_test_state *uts)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DM_TEST(lib_test_lmb_flags,
|
||||
UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
|
||||
LIB_TEST(lib_test_lmb_flags, 0);
|
||||
|
||||
@@ -170,6 +170,10 @@ static int print_display_buffer(struct unit_test_state *uts)
|
||||
u8 *buf;
|
||||
int i;
|
||||
|
||||
/* This test requires writable memory at zero */
|
||||
if (IS_ENABLED(CONFIG_X86))
|
||||
return -EAGAIN;
|
||||
|
||||
buf = map_sysmem(0, BUF_SIZE);
|
||||
memset(buf, '\0', BUF_SIZE);
|
||||
for (i = 0; i < 0x11; i++)
|
||||
@@ -275,6 +279,10 @@ static int print_do_hex_dump(struct unit_test_state *uts)
|
||||
u8 *buf;
|
||||
int i;
|
||||
|
||||
/* This test requires writable memory at zero */
|
||||
if (IS_ENABLED(CONFIG_X86))
|
||||
return -EAGAIN;
|
||||
|
||||
buf = map_sysmem(0, BUF_SIZE);
|
||||
memset(buf, '\0', BUF_SIZE);
|
||||
for (i = 0; i < 0x11; i++)
|
||||
|
||||
@@ -390,10 +390,10 @@ def test_fit(u_boot_console):
|
||||
|
||||
|
||||
cons = u_boot_console
|
||||
# We need to use our own device tree file. Remember to restore it
|
||||
# afterwards.
|
||||
old_dtb = cons.config.dtb
|
||||
try:
|
||||
# We need to use our own device tree file. Remember to restore it
|
||||
# afterwards.
|
||||
old_dtb = cons.config.dtb
|
||||
mkimage = cons.config.build_dir + '/tools/mkimage'
|
||||
run_fit_test(mkimage)
|
||||
finally:
|
||||
|
||||
@@ -533,10 +533,10 @@ def test_vboot(u_boot_console, name, sha_algo, padding, sign_options, required,
|
||||
with open(evil_kernel, 'wb') as fd:
|
||||
fd.write(500 * b'\x01')
|
||||
|
||||
# We need to use our own device tree file. Remember to restore it
|
||||
# afterwards.
|
||||
old_dtb = cons.config.dtb
|
||||
try:
|
||||
# We need to use our own device tree file. Remember to restore it
|
||||
# afterwards.
|
||||
old_dtb = cons.config.dtb
|
||||
cons.config.dtb = dtb
|
||||
if global_sign:
|
||||
test_global_sign(sha_algo, padding, sign_options)
|
||||
|
||||
27
test/ut.c
27
test/ut.c
@@ -121,6 +121,33 @@ int ut_check_skipline(struct unit_test_state *uts)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ut_check_skip_to_linen(struct unit_test_state *uts, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
int len;
|
||||
int ret;
|
||||
|
||||
va_start(args, fmt);
|
||||
len = vsnprintf(uts->expect_str, sizeof(uts->expect_str), fmt, args);
|
||||
va_end(args);
|
||||
if (len >= sizeof(uts->expect_str)) {
|
||||
ut_fail(uts, __FILE__, __LINE__, __func__,
|
||||
"unit_test_state->expect_str too small");
|
||||
return -EOVERFLOW;
|
||||
}
|
||||
while (1) {
|
||||
if (!console_record_avail())
|
||||
return -ENOENT;
|
||||
ret = readline_check(uts);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (!strncmp(uts->expect_str, uts->actual_str,
|
||||
strlen(uts->expect_str)))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int ut_check_skip_to_line(struct unit_test_state *uts, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
@@ -2060,7 +2060,7 @@ don't have access to the blobs.
|
||||
If the blobs are in a different directory, you can specify this with the `-I`
|
||||
option.
|
||||
|
||||
For U-Boot, you can use set the BINMAN_INDIRS environment variable to provide a
|
||||
For U-Boot, you can set the BINMAN_INDIRS environment variable to provide a
|
||||
space-separated list of directories to search for binary blobs::
|
||||
|
||||
BINMAN_INDIRS="odroid-c4/fip/g12a \
|
||||
|
||||
@@ -249,8 +249,8 @@ class TestElf(unittest.TestCase):
|
||||
|
||||
def testEmbedFail(self):
|
||||
"""Test calling GetSymbolFileOffset() without elftools"""
|
||||
old_val = elf.ELF_TOOLS
|
||||
try:
|
||||
old_val = elf.ELF_TOOLS
|
||||
elf.ELF_TOOLS = False
|
||||
fname = self.ElfTestFile('embed_data')
|
||||
with self.assertRaises(ValueError) as e:
|
||||
@@ -290,8 +290,8 @@ class TestElf(unittest.TestCase):
|
||||
|
||||
def test_read_segments_fail(self):
|
||||
"""Test for read_loadable_segments() without elftools"""
|
||||
old_val = elf.ELF_TOOLS
|
||||
try:
|
||||
old_val = elf.ELF_TOOLS
|
||||
elf.ELF_TOOLS = False
|
||||
fname = self.ElfTestFile('embed_data')
|
||||
with self.assertRaises(ValueError) as e:
|
||||
@@ -327,8 +327,8 @@ class TestElf(unittest.TestCase):
|
||||
|
||||
def test_get_file_offset_fail(self):
|
||||
"""Test calling GetFileOffset() without elftools"""
|
||||
old_val = elf.ELF_TOOLS
|
||||
try:
|
||||
old_val = elf.ELF_TOOLS
|
||||
elf.ELF_TOOLS = False
|
||||
fname = self.ElfTestFile('embed_data')
|
||||
with self.assertRaises(ValueError) as e:
|
||||
@@ -351,8 +351,8 @@ class TestElf(unittest.TestCase):
|
||||
|
||||
def test_get_symbol_from_address_fail(self):
|
||||
"""Test calling GetSymbolFromAddress() without elftools"""
|
||||
old_val = elf.ELF_TOOLS
|
||||
try:
|
||||
old_val = elf.ELF_TOOLS
|
||||
elf.ELF_TOOLS = False
|
||||
fname = self.ElfTestFile('embed_data')
|
||||
with self.assertRaises(ValueError) as e:
|
||||
|
||||
@@ -1906,6 +1906,20 @@ the included board config binaries. Example::
|
||||
|
||||
|
||||
|
||||
.. _etype_ti_dm:
|
||||
|
||||
Entry: ti-dm: TI Device Manager (DM) blob
|
||||
-----------------------------------------
|
||||
|
||||
Properties / Entry arguments:
|
||||
- ti-dm-path: Filename of file to read into the entry, typically ti-dm.bin
|
||||
|
||||
This entry holds the device manager responsible for resource and power management
|
||||
in K3 devices. See https://software-dl.ti.com/tisci/esd/latest/ for more information
|
||||
about TI DM.
|
||||
|
||||
|
||||
|
||||
.. _etype_ti_secure:
|
||||
|
||||
Entry: ti-secure: Entry containing a TI x509 certificate binary
|
||||
|
||||
22
tools/binman/etype/ti_dm.py
Normal file
22
tools/binman/etype/ti_dm.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
# Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
|
||||
# Written by Neha Malcom Francis <n-francis@ti.com>
|
||||
#
|
||||
# Entry-type module for TI Device Manager (DM)
|
||||
#
|
||||
|
||||
from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
|
||||
|
||||
class Entry_ti_dm(Entry_blob_named_by_arg):
|
||||
"""TI Device Manager (DM) blob
|
||||
|
||||
Properties / Entry arguments:
|
||||
- ti-dm-path: Filename of file to read into the entry, typically ti-dm.bin
|
||||
|
||||
This entry holds the device manager responsible for resource and power management
|
||||
in K3 devices. See https://software-dl.ti.com/tisci/esd/latest/ for more information
|
||||
about TI DM.
|
||||
"""
|
||||
def __init__(self, section, etype, node):
|
||||
super().__init__(section, etype, node, 'ti-dm')
|
||||
self.external = True
|
||||
@@ -88,6 +88,7 @@ FSP_S_DATA = b'fsp_s'
|
||||
FSP_T_DATA = b'fsp_t'
|
||||
ATF_BL31_DATA = b'bl31'
|
||||
TEE_OS_DATA = b'this is some tee OS data'
|
||||
TI_DM_DATA = b'tidmtidm'
|
||||
ATF_BL2U_DATA = b'bl2u'
|
||||
OPENSBI_DATA = b'opensbi'
|
||||
SCP_DATA = b'scp'
|
||||
@@ -221,6 +222,7 @@ class TestFunctional(unittest.TestCase):
|
||||
TestFunctional._MakeInputFile('compress_big', COMPRESS_DATA_BIG)
|
||||
TestFunctional._MakeInputFile('bl31.bin', ATF_BL31_DATA)
|
||||
TestFunctional._MakeInputFile('tee-pager.bin', TEE_OS_DATA)
|
||||
TestFunctional._MakeInputFile('dm.bin', TI_DM_DATA)
|
||||
TestFunctional._MakeInputFile('bl2u.bin', ATF_BL2U_DATA)
|
||||
TestFunctional._MakeInputFile('fw_dynamic.bin', OPENSBI_DATA)
|
||||
TestFunctional._MakeInputFile('scp.bin', SCP_DATA)
|
||||
@@ -5455,6 +5457,11 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
|
||||
data = self._DoReadFile('222_tee_os.dts')
|
||||
self.assertEqual(TEE_OS_DATA, data[:len(TEE_OS_DATA)])
|
||||
|
||||
def testPackTiDm(self):
|
||||
"""Test that an image with a TI DM binary can be created"""
|
||||
data = self._DoReadFile('225_ti_dm.dts')
|
||||
self.assertEqual(TI_DM_DATA, data[:len(TI_DM_DATA)])
|
||||
|
||||
def testFitFdtOper(self):
|
||||
"""Check handling of a specified FIT operation"""
|
||||
entry_args = {
|
||||
|
||||
@@ -4,11 +4,11 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "binary-manager"
|
||||
version = "0.0.2"
|
||||
version = "0.0.6"
|
||||
authors = [
|
||||
{ name="Simon Glass", email="sjg@chromium.org" },
|
||||
]
|
||||
dependencies = ["pylibfdt", "u_boot_pylib", "dtoc"]
|
||||
dependencies = ["pylibfdt", "u_boot_pylib >= 0.0.6", "dtoc >= 0.0.6"]
|
||||
description = "Binman firmware-packaging tool"
|
||||
readme = "README.rst"
|
||||
requires-python = ">=3.7"
|
||||
@@ -19,7 +19,7 @@ classifiers = [
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
"Homepage" = "https://u-boot.readthedocs.io/en/latest/develop/package/index.html"
|
||||
"Homepage" = "https://docs.u-boot.org/en/latest/develop/package/index.html"
|
||||
"Bug Tracker" = "https://source.denx.de/groups/u-boot/-/issues"
|
||||
|
||||
[project.scripts]
|
||||
|
||||
13
tools/binman/test/225_ti_dm.dts
Normal file
13
tools/binman/test/225_ti_dm.dts
Normal file
@@ -0,0 +1,13 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
|
||||
/dts-v1/;
|
||||
|
||||
/ {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
binman {
|
||||
ti-dm {
|
||||
filename = "dm.bin";
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -4,11 +4,11 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "buildman"
|
||||
version = "0.0.2"
|
||||
version = "0.0.6"
|
||||
authors = [
|
||||
{ name="Simon Glass", email="sjg@chromium.org" },
|
||||
]
|
||||
dependencies = ["u_boot_pylib", "patch-manager"]
|
||||
dependencies = ["u_boot_pylib >= 0.0.6", "patch-manager >= 0.0.6"]
|
||||
description = "Buildman build tool for U-Boot"
|
||||
readme = "README.rst"
|
||||
requires-python = ">=3.7"
|
||||
@@ -19,7 +19,7 @@ classifiers = [
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
"Homepage" = "https://u-boot.readthedocs.io/en/latest/build/buildman.html"
|
||||
"Homepage" = "https://docs.u-boot.org/en/latest/build/buildman.html"
|
||||
"Bug Tracker" = "https://source.denx.de/groups/u-boot/-/issues"
|
||||
|
||||
[project.scripts]
|
||||
|
||||
@@ -4,11 +4,11 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "dtoc"
|
||||
version = "0.0.2"
|
||||
version = "0.0.6"
|
||||
authors = [
|
||||
{ name="Simon Glass", email="sjg@chromium.org" },
|
||||
]
|
||||
dependencies = ["pylibfdt", "u_boot_pylib"]
|
||||
dependencies = ["pylibfdt", "u_boot_pylib >= 0.0.6"]
|
||||
description = "Devicetree-to-C generator"
|
||||
readme = "README.rst"
|
||||
requires-python = ">=3.7"
|
||||
@@ -19,7 +19,7 @@ classifiers = [
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
"Homepage" = "https://u-boot.readthedocs.io/en/latest/develop/driver-model/of-plat.html"
|
||||
"Homepage" = "https://docs.u-boot.org/en/latest/develop/driver-model/of-plat.html"
|
||||
"Bug Tracker" = "https://source.denx.de/groups/u-boot/-/issues"
|
||||
|
||||
[project.scripts]
|
||||
|
||||
@@ -4,11 +4,11 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "patch-manager"
|
||||
version = "0.0.2"
|
||||
version = "0.0.6"
|
||||
authors = [
|
||||
{ name="Simon Glass", email="sjg@chromium.org" },
|
||||
]
|
||||
dependencies = ["u_boot_pylib"]
|
||||
dependencies = ["u_boot_pylib >= 0.0.6"]
|
||||
description = "Patman patch manager"
|
||||
readme = "README.rst"
|
||||
requires-python = ">=3.7"
|
||||
@@ -19,11 +19,11 @@ classifiers = [
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
"Homepage" = "https://u-boot.readthedocs.io/en/latest/develop/patman.html"
|
||||
"Homepage" = "https://docs.u-boot.org/en/latest/develop/patman.html"
|
||||
"Bug Tracker" = "https://source.denx.de/groups/u-boot/-/issues"
|
||||
|
||||
[project.scripts]
|
||||
patman = "patman.__main__"
|
||||
patman = "patman.__main__:run_patman"
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
patman = ["*.rst"]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
.. SPDX-License-Identifier: GPL-2.0+
|
||||
|
||||
# U-Boot Python Library
|
||||
=====================
|
||||
=======================
|
||||
|
||||
This is a Python library used by various U-Boot tools, including patman,
|
||||
buildman and binman.
|
||||
|
||||
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "u_boot_pylib"
|
||||
version = "0.0.2"
|
||||
version = "0.0.6"
|
||||
authors = [
|
||||
{ name="Simon Glass", email="sjg@chromium.org" },
|
||||
]
|
||||
@@ -18,9 +18,8 @@ classifiers = [
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
"Homepage" = "https://u-boot.readthedocs.io"
|
||||
"Homepage" = "https://docs.u-boot.org"
|
||||
"Bug Tracker" = "https://source.denx.de/groups/u-boot/-/issues"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
where = [".."]
|
||||
include = ["u_boot_pylib*"]
|
||||
[tool.setuptools.package-data]
|
||||
u_boot_pylib = ["*.rst"]
|
||||
|
||||
Reference in New Issue
Block a user