summaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
Diffstat (limited to 'boot')
-rw-r--r--boot/Kconfig8
-rw-r--r--boot/bootdev-uclass.c7
-rw-r--r--boot/bootflow.c7
-rw-r--r--boot/bootmeth_extlinux.c8
-rw-r--r--boot/fdt_support.c39
-rw-r--r--boot/image-fdt.c7
-rw-r--r--boot/image-pre-load.c57
7 files changed, 114 insertions, 19 deletions
diff --git a/boot/Kconfig b/boot/Kconfig
index c09a98c3233..f101200ba7a 100644
--- a/boot/Kconfig
+++ b/boot/Kconfig
@@ -1436,14 +1436,6 @@ config NAND_BOOT
booted via NAND flash. This is not a must, some SoCs need this,
some not.
-config ONENAND_BOOT
- bool "Support for booting from ONENAND"
- imply MTD_RAW_NAND
- help
- Enabling this will make a U-Boot binary that is capable of being
- booted via ONENAND. This is not a must, some SoCs need this,
- some not.
-
config QSPI_BOOT
bool "Support for booting from QSPI flash"
help
diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c
index c39147940b6..3791ebfcb42 100644
--- a/boot/bootdev-uclass.c
+++ b/boot/bootdev-uclass.c
@@ -168,8 +168,10 @@ int bootdev_find_in_blk(struct udevice *dev, struct udevice *blk,
*/
/* if there are bootable partitions, scan only those */
- } else if (iter->first_bootable >= 0 &&
+ } else if ((iter->flags & BOOTFLOWIF_ONLY_BOOTABLE) &&
+ iter->first_bootable >= 0 &&
(iter->first_bootable ? !info.bootable : iter->part != 1)) {
+ log_debug("Skipping non-bootable partition %d\n", iter->part);
return log_msg_ret("boot", -EINVAL);
} else {
ret = fs_set_blk_dev_with_part(desc, bflow->part);
@@ -577,6 +579,9 @@ int bootdev_next_label(struct bootflow_iter *iter, struct udevice **devp,
struct udevice *dev;
log_debug("next\n");
+ if (iter->cur_label >= 0 && !iter->labels[iter->cur_label])
+ return log_msg_ret("fil", -ENODEV);
+
for (dev = NULL; !dev && iter->labels[++iter->cur_label];) {
const char *label = iter->labels[iter->cur_label];
int ret;
diff --git a/boot/bootflow.c b/boot/bootflow.c
index 58a1afa7a75..4054a966af8 100644
--- a/boot/bootflow.c
+++ b/boot/bootflow.c
@@ -942,8 +942,9 @@ int bootflow_cmdline_auto(struct bootflow *bflow, const char *arg)
*buf = '\0';
if (!strcmp("earlycon", arg) && info.type == SERIAL_CHIP_16550_COMPATIBLE) {
snprintf(buf, sizeof(buf),
- "uart8250,mmio32,%#lx,%dn8", info.addr,
- info.baudrate);
+ "uart8250,%s,%#lx,%dn8",
+ info.addr_space == SERIAL_ADDRESS_SPACE_IO ? "io" :
+ "mmio", info.addr, info.baudrate);
} else if (!strcmp("earlycon", arg) && info.type == SERIAL_CHIP_PL01X) {
snprintf(buf, sizeof(buf),
"pl011,mmio32,%#lx,%dn8", info.addr,
@@ -954,7 +955,7 @@ int bootflow_cmdline_auto(struct bootflow *bflow, const char *arg)
}
if (!*buf) {
- printf("Unknown param '%s\n", arg);
+ printf("Unknown param '%s'\n", arg);
return -ENOENT;
}
diff --git a/boot/bootmeth_extlinux.c b/boot/bootmeth_extlinux.c
index 17c6cebd2f4..921d721a27b 100644
--- a/boot/bootmeth_extlinux.c
+++ b/boot/bootmeth_extlinux.c
@@ -108,15 +108,15 @@ static int extlinux_check(struct udevice *dev, struct bootflow_iter *iter)
*/
static int extlinux_fill_info(struct bootflow *bflow)
{
- struct membuff mb;
+ struct membuf mb;
char line[200];
char *data;
int len;
log_debug("parsing bflow file size %x\n", bflow->size);
- membuff_init(&mb, bflow->buf, bflow->size);
- membuff_putraw(&mb, bflow->size, true, &data);
- while (len = membuff_readline(&mb, line, sizeof(line) - 1, ' ', true), len) {
+ membuf_init(&mb, bflow->buf, bflow->size);
+ membuf_putraw(&mb, bflow->size, true, &data);
+ while (len = membuf_readline(&mb, line, sizeof(line) - 1, ' ', true), len) {
char *tok, *p = line;
tok = strsep(&p, " ");
diff --git a/boot/fdt_support.c b/boot/fdt_support.c
index 49efeec3681..92f2f534ee0 100644
--- a/boot/fdt_support.c
+++ b/boot/fdt_support.c
@@ -18,6 +18,7 @@
#include <dm/ofnode.h>
#include <linux/ctype.h>
#include <linux/types.h>
+#include <linux/sizes.h>
#include <asm/global_data.h>
#include <asm/unaligned.h>
#include <linux/libfdt.h>
@@ -464,7 +465,6 @@ void do_fixup_by_compat_u32(void *fdt, const char *compat,
do_fixup_by_compat(fdt, compat, prop, &tmp, 4, create);
}
-#ifdef CONFIG_ARCH_FIXUP_FDT_MEMORY
/*
* fdt_pack_reg - pack address and size array into the "reg"-suitable stream
*/
@@ -493,6 +493,7 @@ static int fdt_pack_reg(const void *fdt, void *buf, u64 *address, u64 *size,
return p - (char *)buf;
}
+#ifdef CONFIG_ARCH_FIXUP_FDT_MEMORY
#if CONFIG_NR_DRAM_BANKS > 4
#define MEMORY_BANKS_MAX CONFIG_NR_DRAM_BANKS
#else
@@ -2222,3 +2223,39 @@ int fdt_valid(struct fdt_header **blobp)
}
return 1;
}
+
+int fdt_fixup_pmem_region(void *fdt, u64 pmem_start, u64 pmem_size)
+{
+ char node_name[32];
+ int nodeoffset, len;
+ int err;
+ u8 tmp[4 * 16]; /* Up to 64-bit address + 64-bit size */
+
+ if (!IS_ALIGNED(pmem_start, SZ_2M) ||
+ !IS_ALIGNED(pmem_start + pmem_size, SZ_2M)) {
+ printf("Start and end address must be 2MiB aligned\n");
+ return -1;
+ }
+
+ snprintf(node_name, sizeof(node_name), "pmem@%llx", pmem_start);
+ nodeoffset = fdt_find_or_add_subnode(fdt, 0, node_name);
+ if (nodeoffset < 0)
+ return nodeoffset;
+
+ err = fdt_setprop_string(fdt, nodeoffset, "compatible", "pmem-region");
+ if (err)
+ return err;
+ err = fdt_setprop_empty(fdt, nodeoffset, "volatile");
+ if (err)
+ return err;
+
+ len = fdt_pack_reg(fdt, tmp, &pmem_start, &pmem_size, 1);
+ err = fdt_setprop(fdt, nodeoffset, "reg", tmp, len);
+ if (err < 0) {
+ printf("WARNING: could not set pmem %s %s.\n", "reg",
+ fdt_strerror(err));
+ return err;
+ }
+
+ return 0;
+}
diff --git a/boot/image-fdt.c b/boot/image-fdt.c
index 9d1598b1a93..8f718ad29f6 100644
--- a/boot/image-fdt.c
+++ b/boot/image-fdt.c
@@ -11,6 +11,7 @@
#include <command.h>
#include <fdt_support.h>
#include <fdtdec.h>
+#include <efi.h>
#include <env.h>
#include <errno.h>
#include <image.h>
@@ -649,6 +650,12 @@ int image_setup_libfdt(struct bootm_headers *images, void *blob, bool lmb)
if (!ft_verify_fdt(blob))
goto err;
+ if (CONFIG_IS_ENABLED(BLKMAP) && CONFIG_IS_ENABLED(EFI_LOADER)) {
+ fdt_ret = fdt_efi_pmem_setup(blob);
+ if (fdt_ret)
+ goto err;
+ }
+
/* after here we are using a livetree */
if (!of_live_active() && CONFIG_IS_ENABLED(EVENT)) {
struct event_ft_fixup fixup;
diff --git a/boot/image-pre-load.c b/boot/image-pre-load.c
index cc19017404c..adf3b341a20 100644
--- a/boot/image-pre-load.c
+++ b/boot/image-pre-load.c
@@ -3,13 +3,24 @@
* Copyright (C) 2021 Philippe Reynes <philippe.reynes@softathome.com>
*/
+#ifdef USE_HOSTCC
+#include "mkimage.h"
+#else
#include <asm/global_data.h>
-DECLARE_GLOBAL_DATA_PTR;
-#include <image.h>
#include <mapmem.h>
+DECLARE_GLOBAL_DATA_PTR;
+#endif /* !USE_HOSTCC*/
+#include <image.h>
#include <u-boot/sha256.h>
+#ifdef USE_HOSTCC
+/* Define compat stuff for use in tools. */
+typedef uint8_t u8;
+typedef uint16_t u16;
+typedef uint32_t u32;
+#endif
+
/*
* Offset of the image
*
@@ -17,6 +28,47 @@ DECLARE_GLOBAL_DATA_PTR;
*/
ulong image_load_offset;
+#ifdef USE_HOSTCC
+/* Host tools use these implementations to setup information related to the
+ * pre-load signatures
+ */
+static struct image_sig_info *host_info;
+
+#define log_info(fmt, args...) printf(fmt, ##args)
+#define log_err(fmt, args...) printf(fmt, ##args)
+
+void image_pre_load_sig_set_info(struct image_sig_info *info)
+{
+ host_info = info;
+}
+
+/*
+ * This function sets a pointer to information for the signature check.
+ * It expects that host_info has been initially provision by the host
+ * application.
+ *
+ * return:
+ * < 0 => an error has occurred
+ * 0 => OK
+ */
+static int image_pre_load_sig_setup(struct image_sig_info *info)
+{
+ if (!info) {
+ log_err("ERROR: info is NULL\n");
+ return -EINVAL;
+ }
+
+ if (!host_info) {
+ log_err("ERROR: host_info is NULL\n");
+ log_err("ERROR: Set it with image_pre_load_sig_set_info()\n");
+ return -EINVAL;
+ }
+
+ memcpy(info, host_info, sizeof(struct image_sig_info));
+
+ return 0;
+}
+#else
/*
* This function gathers information about the signature check
* that could be done before launching the image.
@@ -106,6 +158,7 @@ static int image_pre_load_sig_setup(struct image_sig_info *info)
out:
return ret;
}
+#endif /* !USE_HOSTCC */
static int image_pre_load_sig_get_magic(ulong addr, u32 *magic)
{