]> git.sur5r.net Git - u-boot/blobdiff - include/bootstage.h
spi: exynos: Support SPI_PREAMBLE mode
[u-boot] / include / bootstage.h
index 127c94f1b25e25e51325c16f4ecf38ec190729a4..6dc0422bac42e5960e434559c6bd1b0587be8687 100644 (file)
@@ -187,6 +187,7 @@ enum bootstage_id {
         * rough boot timing information.
         */
        BOOTSTAGE_ID_AWAKE,
+       BOOTSTAGE_ID_START_SPL,
        BOOTSTAGE_ID_START_UBOOT_F,
        BOOTSTAGE_ID_START_UBOOT_R,
        BOOTSTAGE_ID_USB_START,
@@ -198,11 +199,15 @@ enum bootstage_id {
        BOOTSTAGE_ID_MAIN_LOOP,
        BOOTSTAGE_KERNELREAD_START,
        BOOTSTAGE_KERNELREAD_STOP,
+       BOOTSTAGE_ID_BOARD_INIT,
+       BOOTSTAGE_ID_BOARD_INIT_DONE,
 
        BOOTSTAGE_ID_CPU_AWAKE,
        BOOTSTAGE_ID_MAIN_CPU_AWAKE,
        BOOTSTAGE_ID_MAIN_CPU_READY,
 
+       BOOTSTAGE_ID_ACCUM_LCD,
+
        /* a few spare for the user, from here */
        BOOTSTAGE_ID_USER,
        BOOTSTAGE_ID_COUNT = BOOTSTAGE_ID_USER + CONFIG_BOOTSTAGE_USER_COUNT,
@@ -216,6 +221,7 @@ enum bootstage_id {
  */
 ulong timer_get_boot_us(void);
 
+#if !defined(CONFIG_SPL_BUILD) && !defined(USE_HOSTCC)
 /*
  * Board code can implement show_boot_progress() if needed.
  *
@@ -223,10 +229,24 @@ ulong timer_get_boot_us(void);
  *             has occurred.
  */
 void show_boot_progress(int val);
+#else
+#define show_boot_progress(val) do {} while (0)
+#endif
 
-#ifdef CONFIG_BOOTSTAGE
+#if defined(CONFIG_BOOTSTAGE) && !defined(CONFIG_SPL_BUILD) && \
+       !defined(USE_HOSTCC)
 /* This is the full bootstage implementation */
 
+/**
+ * Relocate existing bootstage records
+ *
+ * Call this after relocation has happened and after malloc has been initted.
+ * We need to copy any pointers in bootstage records that were added pre-
+ * relocation, since memory can be overritten later.
+ * @return Always returns 0, to indicate success
+ */
+int bootstage_relocate(void);
+
 /**
  * Add a new bootstage record
  *
@@ -247,6 +267,19 @@ ulong bootstage_error(enum bootstage_id id);
 
 ulong bootstage_mark_name(enum bootstage_id id, const char *name);
 
+/**
+ * Mark a time stamp in the given function and line number
+ *
+ * See BOOTSTAGE_MARKER() for a convenient macro.
+ *
+ * @param file         Filename to record (NULL if none)
+ * @param func         Function name to record
+ * @param linenum      Line number to record
+ * @return recorded time stamp
+ */
+ulong bootstage_mark_code(const char *file, const char *func,
+                         int linenum);
+
 /**
  * Mark the start of a bootstage activity. The end will be marked later with
  * bootstage_accum() and at that point we accumulate the time taken. Calling
@@ -277,12 +310,51 @@ uint32_t bootstage_accum(enum bootstage_id id);
 /* Print a report about boot time */
 void bootstage_report(void);
 
+/**
+ * Add bootstage information to the device tree
+ *
+ * @return 0 if ok, -ve on error
+ */
+int bootstage_fdt_add_report(void);
+
+/*
+ * Stash bootstage data into memory
+ *
+ * @param base Base address of memory buffer
+ * @param size Size of memory buffer
+ * @return 0 if stashed ok, -1 if out of space
+ */
+int bootstage_stash(void *base, int size);
+
+/**
+ * Read bootstage data from memory
+ *
+ * Bootstage data is read from memory and placed in the bootstage table
+ * in the user records.
+ *
+ * @param base Base address of memory buffer
+ * @param size Size of memory buffer (-1 if unknown)
+ * @return 0 if unstashed ok, -1 if bootstage info not found, or out of space
+ */
+int bootstage_unstash(void *base, int size);
+
 #else
+static inline ulong bootstage_add_record(enum bootstage_id id,
+               const char *name, int flags, ulong mark)
+{
+       return 0;
+}
+
 /*
  * This is a dummy implementation which just calls show_boot_progress(),
  * and won't even do that unless CONFIG_SHOW_BOOT_PROGRESS is defined
  */
 
+static inline int bootstage_relocate(void)
+{
+       return 0;
+}
+
 static inline ulong bootstage_mark(enum bootstage_id id)
 {
        show_boot_progress(id);
@@ -300,7 +372,35 @@ static inline ulong bootstage_mark_name(enum bootstage_id id, const char *name)
        return 0;
 }
 
+static inline ulong bootstage_mark_code(const char *file, const char *func,
+                                       int linenum)
+{
+       return 0;
+}
 
+static inline uint32_t bootstage_start(enum bootstage_id id, const char *name)
+{
+       return 0;
+}
+
+static inline uint32_t bootstage_accum(enum bootstage_id id)
+{
+       return 0;
+}
+
+static inline int bootstage_stash(void *base, int size)
+{
+       return 0;       /* Pretend to succeed */
+}
+
+static inline int bootstage_unstash(void *base, int size)
+{
+       return 0;       /* Pretend to succeed */
+}
 #endif /* CONFIG_BOOTSTAGE */
 
+/* Helper macro for adding a bootstage to a line of code */
+#define BOOTSTAGE_MARKER()     \
+               bootstage_mark_code(__FILE__, __func__, __LINE__)
+
 #endif