summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/bootstage.c12
-rw-r--r--common/log.c1
-rw-r--r--common/menu.c16
3 files changed, 17 insertions, 12 deletions
diff --git a/common/bootstage.c b/common/bootstage.c
index c7bb204501a..4532100acea 100644
--- a/common/bootstage.c
+++ b/common/bootstage.c
@@ -249,6 +249,8 @@ static uint32_t print_time_record(struct bootstage_record *rec, uint32_t prev)
printf("%11s", "");
print_grouped_ull(rec->time_us, BOOTSTAGE_DIGITS);
} else {
+ if (prev > rec->time_us)
+ prev = 0;
print_grouped_ull(rec->time_us, BOOTSTAGE_DIGITS);
print_grouped_ull(rec->time_us - prev, BOOTSTAGE_DIGITS);
}
@@ -257,13 +259,6 @@ static uint32_t print_time_record(struct bootstage_record *rec, uint32_t prev)
return rec->time_us;
}
-static int h_compare_record(const void *r1, const void *r2)
-{
- const struct bootstage_record *rec1 = r1, *rec2 = r2;
-
- return rec1->time_us > rec2->time_us ? 1 : -1;
-}
-
#ifdef CONFIG_OF_LIBFDT
/**
* Add all bootstage timings to a device tree.
@@ -342,9 +337,6 @@ void bootstage_report(void)
prev = print_time_record(rec, 0);
- /* Sort records by increasing time */
- qsort(data->record, data->rec_count, sizeof(*rec), h_compare_record);
-
for (i = 1, rec++; i < data->rec_count; i++, rec++) {
if (rec->id && !rec->start_us)
prev = print_time_record(rec, prev);
diff --git a/common/log.c b/common/log.c
index b83a6618900..c9fe35230d6 100644
--- a/common/log.c
+++ b/common/log.c
@@ -32,6 +32,7 @@ static const char *const log_cat_name[] = {
"fs",
"expo",
"console",
+ "test",
};
_Static_assert(ARRAY_SIZE(log_cat_name) == LOGC_COUNT - LOGC_NONE,
diff --git a/common/menu.c b/common/menu.c
index 8cc9bf06d9c..5a2126aa01a 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -43,6 +43,7 @@ struct menu {
void (*display_statusline)(struct menu *);
void (*item_data_print)(void *);
char *(*item_choice)(void *);
+ bool (*need_reprint)(void *);
void *item_choice_data;
struct list_head items;
int item_cnt;
@@ -117,6 +118,11 @@ static inline void *menu_item_destroy(struct menu *m,
*/
static inline void menu_display(struct menu *m)
{
+ if (m->need_reprint) {
+ if (!m->need_reprint(m->item_choice_data))
+ return;
+ }
+
if (m->title) {
puts(m->title);
putc('\n');
@@ -362,6 +368,9 @@ int menu_item_add(struct menu *m, char *item_key, void *item_data)
* item. Returns a key string corresponding to the chosen item or NULL if
* no item has been selected.
*
+ * need_reprint - If not NULL, will be called before printing the menu.
+ * Returning FALSE means the menu does not need reprint.
+ *
* item_choice_data - Will be passed as the argument to the item_choice function
*
* Returns a pointer to the menu if successful, or NULL if there is
@@ -371,6 +380,7 @@ struct menu *menu_create(char *title, int timeout, int prompt,
void (*display_statusline)(struct menu *),
void (*item_data_print)(void *),
char *(*item_choice)(void *),
+ bool (*need_reprint)(void *),
void *item_choice_data)
{
struct menu *m;
@@ -386,6 +396,7 @@ struct menu *menu_create(char *title, int timeout, int prompt,
m->display_statusline = display_statusline;
m->item_data_print = item_data_print;
m->item_choice = item_choice;
+ m->need_reprint = need_reprint;
m->item_choice_data = item_choice_data;
m->item_cnt = 0;
@@ -525,14 +536,15 @@ enum bootmenu_key bootmenu_loop(struct bootmenu_data *menu,
struct cli_ch_state *cch)
{
enum bootmenu_key key;
- int c;
+ int c, errchar = 0;
c = cli_ch_process(cch, 0);
if (!c) {
while (!c && !tstc()) {
schedule();
mdelay(10);
- c = cli_ch_process(cch, -ETIMEDOUT);
+ c = cli_ch_process(cch, errchar);
+ errchar = -ETIMEDOUT;
}
if (!c) {
c = getchar();