bootstage: Export bootstage_add_record() function

This function is not static, but not exported either. Add a prototype
in the header file and move the required enum to the header also.

Signed-off-by: Simon Glass <sjg@chromium.org>
master
Simon Glass 12 years ago committed by Anatolij Gustschin
parent 221953d41d
commit 094e06a523
  1. 16
      common/bootstage.c
  2. 17
      include/bootstage.h

@ -33,13 +33,9 @@
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
enum bootstage_flags {
BOOTSTAGEF_ERROR = 1 << 0, /* Error record */
BOOTSTAGEF_ALLOC = 1 << 1, /* Allocate an id */
};
struct bootstage_record { struct bootstage_record {
ulong time_us; ulong time_us;
uint32_t start_us;
const char *name; const char *name;
int flags; /* see enum bootstage_flags */ int flags; /* see enum bootstage_flags */
enum bootstage_id id; enum bootstage_id id;
@ -49,10 +45,9 @@ static struct bootstage_record record[BOOTSTAGE_ID_COUNT] = { {1} };
static int next_id = BOOTSTAGE_ID_USER; static int next_id = BOOTSTAGE_ID_USER;
ulong bootstage_add_record(enum bootstage_id id, const char *name, ulong bootstage_add_record(enum bootstage_id id, const char *name,
int flags) int flags, ulong mark)
{ {
struct bootstage_record *rec; struct bootstage_record *rec;
ulong mark = timer_get_boot_us();
if (flags & BOOTSTAGEF_ALLOC) if (flags & BOOTSTAGEF_ALLOC)
id = next_id++; id = next_id++;
@ -77,12 +72,13 @@ ulong bootstage_add_record(enum bootstage_id id, const char *name,
ulong bootstage_mark(enum bootstage_id id) ulong bootstage_mark(enum bootstage_id id)
{ {
return bootstage_add_record(id, NULL, 0); return bootstage_add_record(id, NULL, 0, timer_get_boot_us());
} }
ulong bootstage_error(enum bootstage_id id) ulong bootstage_error(enum bootstage_id id)
{ {
return bootstage_add_record(id, NULL, BOOTSTAGEF_ERROR); return bootstage_add_record(id, NULL, BOOTSTAGEF_ERROR,
timer_get_boot_us());
} }
ulong bootstage_mark_name(enum bootstage_id id, const char *name) ulong bootstage_mark_name(enum bootstage_id id, const char *name)
@ -91,7 +87,7 @@ ulong bootstage_mark_name(enum bootstage_id id, const char *name)
if (id == BOOTSTAGE_ID_ALLOC) if (id == BOOTSTAGE_ID_ALLOC)
flags = BOOTSTAGEF_ALLOC; flags = BOOTSTAGEF_ALLOC;
return bootstage_add_record(id, name, flags); return bootstage_add_record(id, name, flags, timer_get_boot_us());
} }
static void print_time(unsigned long us_time) static void print_time(unsigned long us_time)

@ -31,6 +31,12 @@
#define CONFIG_BOOTSTAGE_USER_COUNT 20 #define CONFIG_BOOTSTAGE_USER_COUNT 20
#endif #endif
/* Flags for each bootstage record */
enum bootstage_flags {
BOOTSTAGEF_ERROR = 1 << 0, /* Error record */
BOOTSTAGEF_ALLOC = 1 << 1, /* Allocate an id */
};
/* /*
* A list of boot stages that we know about. Each of these indicates the * A list of boot stages that we know about. Each of these indicates the
* state that we are at, and the action that we are about to perform. For * state that we are at, and the action that we are about to perform. For
@ -221,6 +227,17 @@ void show_boot_progress(int val);
#ifdef CONFIG_BOOTSTAGE #ifdef CONFIG_BOOTSTAGE
/* This is the full bootstage implementation */ /* This is the full bootstage implementation */
/**
* Add a new bootstage record
*
* @param id Bootstage ID to use (ignored if flags & BOOTSTAGEF_ALLOC)
* @param name Name of record, or NULL for none
* @param flags Flags (BOOTSTAGEF_...)
* @param mark Time to record in this record, in microseconds
*/
ulong bootstage_add_record(enum bootstage_id id, const char *name,
int flags, ulong mark);
/* /*
* Mark a time stamp for the current boot stage. * Mark a time stamp for the current boot stage.
*/ */

Loading…
Cancel
Save