summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-02-11 10:58:41 -0500
committerTom Rini <trini@konsulko.com>2020-02-11 10:58:41 -0500
commit9a8942b53d57149754e0dfc975e0d92d1afd4087 (patch)
treede55e5352f3a8a79c413c0b8cb533428e5476841 /common
parentae347120eed8204b1fdf018ddf79131964e57016 (diff)
parent21d651fb29cf268b1a5f64d080e3d352ee32c87f (diff)
downloadu-boot-9a8942b53d57149754e0dfc975e0d92d1afd4087.tar.gz
Merge tag 'dm-pull-6feb20' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
sandbox conversion to SDL2 TPM TEE driver Various minor sandbox video enhancements New driver model core utility functions
Diffstat (limited to 'common')
-rw-r--r--common/android_ab.c1
-rw-r--r--common/autoboot.c1
-rw-r--r--common/bloblist.c27
-rw-r--r--common/cli.c7
-rw-r--r--common/console.c11
-rw-r--r--common/exports.c1
-rw-r--r--common/image-fdt.c3
-rw-r--r--common/image.c1
-rw-r--r--common/usb.c1
-rw-r--r--common/usb_hub.c1
10 files changed, 49 insertions, 5 deletions
diff --git a/common/android_ab.c b/common/android_ab.c
index 6c4df419b2..e0fe32d24d 100644
--- a/common/android_ab.c
+++ b/common/android_ab.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <android_ab.h>
#include <android_bootloader_message.h>
+#include <malloc.h>
#include <linux/err.h>
#include <memalign.h>
#include <u-boot/crc.h>
diff --git a/common/autoboot.c b/common/autoboot.c
index 94a1b4abeb..4ea9be6da9 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -13,6 +13,7 @@
#include <env.h>
#include <fdtdec.h>
#include <hash.h>
+#include <malloc.h>
#include <memalign.h>
#include <menu.h>
#include <post.h>
diff --git a/common/bloblist.c b/common/bloblist.c
index ccf5e4b6f6..99501951e0 100644
--- a/common/bloblist.c
+++ b/common/bloblist.c
@@ -59,11 +59,10 @@ static int bloblist_addrec(uint tag, int size, struct bloblist_rec **recp)
struct bloblist_rec *rec;
int new_alloced;
- new_alloced = hdr->alloced + sizeof(*rec) +
- ALIGN(size, BLOBLIST_ALIGN);
+ new_alloced = hdr->alloced + sizeof(*rec) + ALIGN(size, BLOBLIST_ALIGN);
if (new_alloced >= hdr->size) {
log(LOGC_BLOBLIST, LOGL_ERR,
- "Failed to allocate %x bytes size=%x, need size>=%x\n",
+ "Failed to allocate %x bytes size=%x, need size=%x\n",
size, hdr->size, new_alloced);
return log_msg_ret("bloblist add", -ENOSPC);
}
@@ -74,6 +73,9 @@ static int bloblist_addrec(uint tag, int size, struct bloblist_rec **recp)
rec->hdr_size = sizeof(*rec);
rec->size = size;
rec->spare = 0;
+
+ /* Zero the record data */
+ memset(rec + 1, '\0', rec->size);
*recp = rec;
return 0;
@@ -85,8 +87,10 @@ static int bloblist_ensurerec(uint tag, struct bloblist_rec **recp, int size)
rec = bloblist_findrec(tag);
if (rec) {
- if (size && size != rec->size)
+ if (size && size != rec->size) {
+ *recp = rec;
return -ESPIPE;
+ }
} else {
int ret;
@@ -145,6 +149,21 @@ void *bloblist_ensure(uint tag, int size)
return (void *)rec + rec->hdr_size;
}
+int bloblist_ensure_size_ret(uint tag, int *sizep, void **blobp)
+{
+ struct bloblist_rec *rec;
+ int ret;
+
+ ret = bloblist_ensurerec(tag, &rec, *sizep);
+ if (ret == -ESPIPE)
+ *sizep = rec->size;
+ else if (ret)
+ return ret;
+ *blobp = (void *)rec + rec->hdr_size;
+
+ return 0;
+}
+
static u32 bloblist_calc_chksum(struct bloblist_hdr *hdr)
{
struct bloblist_rec *rec;
diff --git a/common/cli.c b/common/cli.c
index 7ffe902b88..38bba17585 100644
--- a/common/cli.c
+++ b/common/cli.c
@@ -71,6 +71,13 @@ int run_command_repeatable(const char *cmd, int flag)
return 0;
#endif
}
+#else
+__weak int board_run_command(const char *cmdline)
+{
+ printf("## Commands are disabled. Please enable CONFIG_CMDLINE.\n");
+
+ return 1;
+}
#endif /* CONFIG_CMDLINE */
int run_command_list(const char *cmd, int len, int flag)
diff --git a/common/console.c b/common/console.c
index 168ba60d0d..7681da19a2 100644
--- a/common/console.c
+++ b/common/console.c
@@ -621,6 +621,17 @@ void console_record_reset_enable(void)
console_record_reset();
gd->flags |= GD_FLG_RECORD;
}
+
+int console_record_readline(char *str, int maxlen)
+{
+ return membuff_readline(&gd->console_out, str, maxlen, ' ');
+}
+
+int console_record_avail(void)
+{
+ return membuff_avail(&gd->console_out);
+}
+
#endif
/* test if ctrl-c was pressed */
diff --git a/common/exports.c b/common/exports.c
index b4f1f7af15..18af38a5f6 100644
--- a/common/exports.c
+++ b/common/exports.c
@@ -1,5 +1,6 @@
#include <common.h>
#include <exports.h>
+#include <malloc.h>
#include <spi.h>
#include <i2c.h>
diff --git a/common/image-fdt.c b/common/image-fdt.c
index dbb1e6e131..3002948b6b 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -14,6 +14,7 @@
#include <env.h>
#include <errno.h>
#include <image.h>
+#include <malloc.h>
#include <linux/libfdt.h>
#include <mapmem.h>
#include <asm/io.h>
@@ -122,7 +123,7 @@ void boot_fdt_add_mem_rsv_regions(struct lmb *lmb, void *fdt_blob)
/* check if this subnode has a reg property */
ret = fdt_get_resource(fdt_blob, subnode, "reg", 0,
&res);
- if (!ret) {
+ if (!ret && fdtdec_get_is_enabled(fdt_blob, subnode)) {
addr = res.start;
size = res.end - res.start + 1;
boot_fdt_reserve_region(lmb, addr, size);
diff --git a/common/image.c b/common/image.c
index 2288cff126..94873cb6ed 100644
--- a/common/image.c
+++ b/common/image.c
@@ -10,6 +10,7 @@
#include <common.h>
#include <cpu_func.h>
#include <env.h>
+#include <malloc.h>
#include <u-boot/crc.h>
#include <watchdog.h>
diff --git a/common/usb.c b/common/usb.c
index d9bcb5a57e..349e838f1d 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -28,6 +28,7 @@
#include <common.h>
#include <command.h>
#include <dm.h>
+#include <malloc.h>
#include <memalign.h>
#include <asm/processor.h>
#include <linux/compiler.h>
diff --git a/common/usb_hub.c b/common/usb_hub.c
index 25c2ac4345..c642b683e7 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -26,6 +26,7 @@
#include <dm.h>
#include <env.h>
#include <errno.h>
+#include <malloc.h>
#include <memalign.h>
#include <asm/processor.h>
#include <asm/unaligned.h>