aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/fdt_support.c9
-rw-r--r--common/malloc_simple.c2
-rw-r--r--common/usb_kbd.c31
3 files changed, 34 insertions, 8 deletions
diff --git a/common/fdt_support.c b/common/fdt_support.c
index daa24d4c10..ea18ea3f04 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -988,7 +988,7 @@ void fdt_fixup_mtdparts(void *blob, const struct node_info *node_info,
{
struct mtd_device *dev;
int i, idx;
- int noff;
+ int noff, parts;
bool inited = false;
for (i = 0; i < node_info_size; i++) {
@@ -1014,7 +1014,12 @@ void fdt_fixup_mtdparts(void *blob, const struct node_info *node_info,
dev = device_find(node_info[i].type, idx++);
if (dev) {
- if (fdt_node_set_part_info(blob, noff, dev))
+ parts = fdt_subnode_offset(blob, noff,
+ "partitions");
+ if (parts < 0)
+ parts = noff;
+
+ if (fdt_node_set_part_info(blob, parts, dev))
return; /* return on error */
}
}
diff --git a/common/malloc_simple.c b/common/malloc_simple.c
index 0267fb6bec..67ee623850 100644
--- a/common/malloc_simple.c
+++ b/common/malloc_simple.c
@@ -23,7 +23,7 @@ static void *alloc_simple(size_t bytes, int align)
addr = ALIGN(gd->malloc_base + gd->malloc_ptr, align);
new_ptr = addr + bytes - gd->malloc_base;
- log_debug("size=%zx, ptr=%lx, limit=%lx: ", bytes, new_ptr,
+ log_debug("size=%lx, ptr=%lx, limit=%lx: ", (ulong)bytes, new_ptr,
gd->malloc_limit);
if (new_ptr > gd->malloc_limit) {
log_err("alloc space exhausted\n");
diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index afad260d3d..352d86fb2e 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -17,6 +17,9 @@
#include <stdio_dev.h>
#include <watchdog.h>
#include <asm/byteorder.h>
+#ifdef CONFIG_SANDBOX
+#include <asm/state.h>
+#endif
#include <usb.h>
@@ -118,7 +121,7 @@ struct usb_kbd_pdata {
extern int __maybe_unused net_busy_flag;
/* The period of time between two calls of usb_kbd_testc(). */
-static unsigned long __maybe_unused kbd_testc_tms;
+static unsigned long kbd_testc_tms;
/* Puts character in the queue and sets up the in and out pointer. */
static void usb_kbd_put_queue(struct usb_kbd_pdata *data, u8 c)
@@ -394,21 +397,39 @@ static int usb_kbd_testc(struct stdio_dev *sdev)
struct usb_device *usb_kbd_dev;
struct usb_kbd_pdata *data;
+ /*
+ * Polling the keyboard for an event can take dozens of milliseconds.
+ * Add a delay between polls to avoid blocking activity which polls
+ * rapidly, like the UEFI console timer.
+ */
+ unsigned long poll_delay = CONFIG_SYS_HZ / 50;
+
#ifdef CONFIG_CMD_NET
/*
* If net_busy_flag is 1, NET transfer is running,
* then we check key-pressed every second (first check may be
* less than 1 second) to improve TFTP booting performance.
*/
- if (net_busy_flag && (get_timer(kbd_testc_tms) < CONFIG_SYS_HZ))
- return 0;
- kbd_testc_tms = get_timer(0);
+ if (net_busy_flag)
+ poll_delay = CONFIG_SYS_HZ;
+#endif
+
+#ifdef CONFIG_SANDBOX
+ /*
+ * Skip delaying polls if a test requests it.
+ */
+ if (state_get_skip_delays())
+ poll_delay = 0;
#endif
+
dev = stdio_get_by_name(sdev->name);
usb_kbd_dev = (struct usb_device *)dev->priv;
data = usb_kbd_dev->privptr;
- usb_kbd_poll_for_event(usb_kbd_dev);
+ if (get_timer(kbd_testc_tms) >= poll_delay) {
+ usb_kbd_poll_for_event(usb_kbd_dev);
+ kbd_testc_tms = get_timer(0);
+ }
return !(data->usb_in_pointer == data->usb_out_pointer);
}