summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/board_f.c3
-rw-r--r--common/board_r.c17
-rw-r--r--common/cli.c2
-rw-r--r--common/event.c2
-rw-r--r--common/fdt_simplefb.c2
-rw-r--r--common/hash.c4
-rw-r--r--common/log.c1
-rw-r--r--common/menu.c3
-rw-r--r--common/qfw.c66
-rw-r--r--common/spl/spl_fit.c1
-rw-r--r--common/splash.c2
-rw-r--r--common/usb_hub.c6
12 files changed, 91 insertions, 18 deletions
diff --git a/common/board_f.c b/common/board_f.c
index 2b4edf30c93..f3c1ab53b1c 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -290,7 +290,10 @@ static int setup_mon_len(void)
{
#if defined(__ARM__) || defined(__MICROBLAZE__)
gd->mon_len = (ulong)&__bss_end - (ulong)_start;
+#elif defined(CONFIG_SANDBOX) && !defined(__riscv)
+ gd->mon_len = (ulong)&_end - (ulong)_init;
#elif defined(CONFIG_SANDBOX)
+ /* gcc does not provide _init in crti.o on RISC-V */
gd->mon_len = 0;
#elif defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;
diff --git a/common/board_r.c b/common/board_r.c
index 3618acad437..e45003353f7 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -155,7 +155,7 @@ static int initr_reloc_global_data(void)
* The fdt_blob needs to be moved to new relocation address
* incase of FDT blob is embedded with in image
*/
- if (CONFIG_IS_ENABLED(OF_EMBED) && CONFIG_IS_ENABLED(NEEDS_MANUAL_RELOC))
+ if (IS_ENABLED(CONFIG_OF_EMBED) && IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC))
gd->fdt_blob += gd->reloc_off;
#ifdef CONFIG_EFI_LOADER
@@ -452,8 +452,8 @@ static int initr_env(void)
env_set_hex("fdtcontroladdr",
(unsigned long)map_to_sysmem(gd->fdt_blob));
- #if (CONFIG_IS_ENABLED(SAVE_PREV_BL_INITRAMFS_START_ADDR) || \
- CONFIG_IS_ENABLED(SAVE_PREV_BL_FDT_ADDR))
+ #if (IS_ENABLED(CONFIG_SAVE_PREV_BL_INITRAMFS_START_ADDR) || \
+ IS_ENABLED(CONFIG_SAVE_PREV_BL_FDT_ADDR))
save_prev_bl_data();
#endif
@@ -609,7 +609,7 @@ static init_fnc_t init_sequence_r[] = {
*/
#endif
initr_reloc_global_data,
-#if CONFIG_IS_ENABLED(NEEDS_MANUAL_RELOC) && CONFIG_IS_ENABLED(EVENT)
+#if IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC) && CONFIG_IS_ENABLED(EVENT)
event_manual_reloc,
#endif
#if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500)
@@ -797,6 +797,15 @@ static init_fnc_t init_sequence_r[] = {
void board_init_r(gd_t *new_gd, ulong dest_addr)
{
/*
+ * The pre-relocation drivers may be using memory that has now gone
+ * away. Mark serial as unavailable - this will fall back to the debug
+ * UART if available.
+ *
+ * Do the same with log drivers since the memory may not be available.
+ */
+ gd->flags &= ~(GD_FLG_SERIAL_READY | GD_FLG_LOG_READY);
+
+ /*
* Set up the new global data pointer. So far only x86 does this
* here.
* TODO(sjg@chromium.org): Consider doing this for all archs, or
diff --git a/common/cli.c b/common/cli.c
index ba45dad2db5..9451e6a1426 100644
--- a/common/cli.c
+++ b/common/cli.c
@@ -31,7 +31,7 @@
*/
int run_command(const char *cmd, int flag)
{
-#if !CONFIG_IS_ENABLED(HUSH_PARSER)
+#if !IS_ENABLED(CONFIG_HUSH_PARSER)
/*
* cli_run_command can return 0 or 1 for success, so clean up
* its result.
diff --git a/common/event.c b/common/event.c
index c312556490e..164c95f8f52 100644
--- a/common/event.c
+++ b/common/event.c
@@ -155,7 +155,7 @@ void event_show_spy_list(void)
}
}
-#if CONFIG_IS_ENABLED(NEEDS_MANUAL_RELOC)
+#if IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC)
int event_manual_reloc(void)
{
struct evspy_info *spy, *end;
diff --git a/common/fdt_simplefb.c b/common/fdt_simplefb.c
index 71d4c8fde90..282c34fe0b9 100644
--- a/common/fdt_simplefb.c
+++ b/common/fdt_simplefb.c
@@ -82,7 +82,7 @@ int fdt_simplefb_enable_existing_node(void *blob)
return fdt_simplefb_configure_node(blob, off);
}
-#if CONFIG_IS_ENABLED(VIDEO)
+#if IS_ENABLED(CONFIG_VIDEO)
int fdt_simplefb_enable_and_mem_rsv(void *blob)
{
struct fdt_memory mem;
diff --git a/common/hash.c b/common/hash.c
index 9e53545dbde..9a52d6073ce 100644
--- a/common/hash.c
+++ b/common/hash.c
@@ -326,8 +326,8 @@ static struct hash_algo hash_algo[] = {
};
/* Try to minimize code size for boards that don't want much hashing */
-#if CONFIG_IS_ENABLED(SHA256) || CONFIG_IS_ENABLED(CMD_SHA1SUM) || \
- CONFIG_IS_ENABLED(CRC32_VERIFY) || CONFIG_IS_ENABLED(CMD_HASH) || \
+#if CONFIG_IS_ENABLED(SHA256) || IS_ENABLED(CONFIG_CMD_SHA1SUM) || \
+ CONFIG_IS_ENABLED(CRC32_VERIFY) || IS_ENABLED(CONFIG_CMD_HASH) || \
CONFIG_IS_ENABLED(SHA384) || CONFIG_IS_ENABLED(SHA512)
#define multi_hash() 1
#else
diff --git a/common/log.c b/common/log.c
index 57b71ed1b36..7cfc49bc28a 100644
--- a/common/log.c
+++ b/common/log.c
@@ -30,6 +30,7 @@ static const char *const log_cat_name[] = {
"acpi",
"boot",
"event",
+ "fs",
};
_Static_assert(ARRAY_SIZE(log_cat_name) == LOGC_COUNT - LOGC_NONE,
diff --git a/common/menu.c b/common/menu.c
index cdcdbb2a185..94514177e4e 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -503,6 +503,9 @@ enum bootmenu_key bootmenu_conv_key(int ichar)
case CTL_CH('n'):
key = BKEY_DOWN;
break;
+ case CTL_CH('s'):
+ key = BKEY_SAVE;
+ break;
case '+':
key = BKEY_PLUS;
break;
diff --git a/common/qfw.c b/common/qfw.c
index 90cbb8c5dd4..45e87d3ae28 100644
--- a/common/qfw.c
+++ b/common/qfw.c
@@ -5,9 +5,11 @@
*/
#include <dm.h>
-#include <dm/uclass.h>
+#include <env.h>
+#include <mapmem.h>
#include <qfw.h>
#include <stdlib.h>
+#include <dm/uclass.h>
int qfw_get_dev(struct udevice **devp)
{
@@ -102,3 +104,65 @@ bool qfw_file_iter_end(struct fw_cfg_file_iter *iter)
{
return iter->entry == iter->end;
}
+
+int qemu_fwcfg_setup_kernel(struct udevice *qfw_dev, ulong load_addr,
+ ulong initrd_addr)
+{
+ char *data_addr;
+ u32 setup_size, kernel_size, cmdline_size, initrd_size;
+
+ qfw_read_entry(qfw_dev, FW_CFG_SETUP_SIZE, 4, &setup_size);
+ qfw_read_entry(qfw_dev, FW_CFG_KERNEL_SIZE, 4, &kernel_size);
+
+ if (!kernel_size) {
+ printf("fatal: no kernel available\n");
+ return -ENOENT;
+ }
+
+ data_addr = map_sysmem(load_addr, 0);
+ if (setup_size) {
+ qfw_read_entry(qfw_dev, FW_CFG_SETUP_DATA,
+ le32_to_cpu(setup_size), data_addr);
+ data_addr += le32_to_cpu(setup_size);
+ }
+
+ qfw_read_entry(qfw_dev, FW_CFG_KERNEL_DATA,
+ le32_to_cpu(kernel_size), data_addr);
+ data_addr += le32_to_cpu(kernel_size);
+ env_set_hex("filesize", le32_to_cpu(kernel_size));
+
+ data_addr = map_sysmem(initrd_addr, 0);
+ qfw_read_entry(qfw_dev, FW_CFG_INITRD_SIZE, 4, &initrd_size);
+ if (!initrd_size) {
+ printf("warning: no initrd available\n");
+ } else {
+ qfw_read_entry(qfw_dev, FW_CFG_INITRD_DATA,
+ le32_to_cpu(initrd_size), data_addr);
+ data_addr += le32_to_cpu(initrd_size);
+ env_set_hex("filesize", le32_to_cpu(initrd_size));
+ }
+
+ qfw_read_entry(qfw_dev, FW_CFG_CMDLINE_SIZE, 4, &cmdline_size);
+ if (cmdline_size) {
+ qfw_read_entry(qfw_dev, FW_CFG_CMDLINE_DATA,
+ le32_to_cpu(cmdline_size), data_addr);
+ /*
+ * if kernel cmdline only contains '\0', (e.g. no -append
+ * when invoking qemu), do not update bootargs
+ */
+ if (*data_addr) {
+ if (env_set("bootargs", data_addr) < 0)
+ printf("warning: unable to change bootargs\n");
+ }
+ }
+
+ printf("loading kernel to address %lx size %x", load_addr,
+ le32_to_cpu(kernel_size));
+ if (initrd_size)
+ printf(" initrd %lx size %x\n", initrd_addr,
+ le32_to_cpu(initrd_size));
+ else
+ printf("\n");
+
+ return 0;
+}
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 9ae3e5e35d4..c51482b3b65 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -591,7 +591,6 @@ static int spl_fit_upload_fpga(struct spl_fit_info *ctx, int node,
debug("Ignoring compatible = %s property\n",
compatible);
}
- return 0;
ret = fpga_load(devnum, (void *)fpga_image->load_addr,
fpga_image->size, BIT_FULL, flags);
diff --git a/common/splash.c b/common/splash.c
index 2e466a8a0f5..245ff680ebd 100644
--- a/common/splash.c
+++ b/common/splash.c
@@ -89,7 +89,7 @@ static inline int splash_video_logo_load(void) { return -ENOSYS; }
__weak int splash_screen_prepare(void)
{
- if (CONFIG_IS_ENABLED(SPLASH_SOURCE))
+ if (IS_ENABLED(CONFIG_SPLASH_SOURCE))
return splash_source_load(default_splash_locations,
ARRAY_SIZE(default_splash_locations));
diff --git a/common/usb_hub.c b/common/usb_hub.c
index f7fd12c0450..85c0822d8b7 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -507,11 +507,6 @@ static int usb_scan_port(struct usb_device_scan *usb_scan)
debug("port %d enable change, status %x\n", i + 1, portstatus);
usb_clear_port_feature(dev, i + 1, USB_PORT_FEAT_C_ENABLE);
/*
- * The following hack causes a ghost device problem
- * to Faraday EHCI
- */
-#ifndef CONFIG_USB_EHCI_FARADAY
- /*
* EM interference sometimes causes bad shielded USB
* devices to be shutdown by the hub, this hack enables
* them again. Works at least with mouse driver
@@ -523,7 +518,6 @@ static int usb_scan_port(struct usb_device_scan *usb_scan)
i + 1);
usb_hub_port_connect_change(dev, i);
}
-#endif
}
if (portstatus & USB_PORT_STAT_SUSPEND) {