summaryrefslogtreecommitdiff
path: root/common/bootstage.c
AgeCommit message (Collapse)Author
2017-06-05bootstage: Adjust to use const * where possibleSimon Glass
There are a few places that should use const *, such as bootstage_unstash(). Update these to make it clearer when parameters are changed. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05bootstage: Tidy up error return valuesSimon Glass
We should return a proper error number instead of just -1. This helps the caller to determine what when wrong. Update a few functions to fix this. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05bootstage: Support relocating boostage dataSimon Glass
Some boards cannot access pre-relocation data after relocation. Reserve space for this and copy it during preparation for relocation. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05bootstage: Use debug() for stashing messagesSimon Glass
We don't normally want to see these messages. Change them to debug-only. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05bootstage: Show records with a zero timeSimon Glass
We can now use the record count to determine whether a record is valid or not. Drop the test for a zero time. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05bootstage: Use rec_count as the array indexSimon Glass
At present bootstage has a large array with all possible bootstage IDs recorded. It adds times to the array element indexed by the ID. This is inefficient because many IDs are not used during boot. We can save space by only recording those IDs which actually have timestamps. Update the array to use a record count, which increments with each addition of a new timestamp. This takes longer to record a time, since it may involve an array search. Such a search may be particularly expensive before relocation when the CPU is running slowly or the cache is off. But at that stage there should be very few records. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05bootstage: Fix up code style and commentsSimon Glass
There are several code style and comment nits. Fix them and also remove the comment about passing bootstage to the kernel being TBD. This is already supported. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05bootstage: Convert to use malloc()Simon Glass
At present bootstage uses the data section of the image to store its information. There are a few problems with this: - It does not work on all boards (e.g. those which run from flash before relocation) - Allocated strings still point back to the pre-relocation data after relocation Now that U-Boot has a pre-relocation malloc() we can use this instead, with a pointer to the data in global_data. Update bootstage to do this and set up an init routine to allocate the memory. Now that we have a real init function, we can drop the fake 'reset' record and add a normal one instead. Note that part of the problem with allocated strings remains. They are reallocated but this will only work where pre-relocation memory is accessible after relocation. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05bootstage: Require timer_get_boot_us() to be definedSimon Glass
At present we provide a default version of this function for use by bootstage. However it uses the system timer and therefore likely requires driver model. This makes it impossible to time driver-model init. Drop the function and require boards to provide their own. Add a sandbox version also. There is a default implememtation in lib/time.c for boards which use CONFIG_SYS_TIMER_COUNTER. Signed-off-by: Simon Glass <sjg@chromium.org>
2013-07-24Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk
Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
2013-06-26Add function to print a number with grouped digitsSimon Glass
Move bootstage's numbering printing code into a generic place so that it can be used by tracing also. Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-26bootstage: Correct printf typesSimon Glass
The unstash code is a bit loose with its printf() types, which gives warnings on sandbox. Correct this. Signed-off-by: Simon Glass <sjg@chromium.org>
2013-05-13bootstage: Allow marking a particular line of codeSimon Glass
Add a function which allows a (file, function, line number) to be marked in bootstage. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
2013-05-13bootstage: Copy bootstage strings post-relocationDoug Anderson
Any pointers to name strings that were passed to bootstage_mark_name() pre-relocation should be copied post-relocation so that they don't get trashed as the original location of U-Boot is re-used for other purposes. This change introduces a new API call that should be called from board_init_r() after malloc has been initted on any board that uses bootstage. Signed-off-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2012-10-02bootstage: Add feature to stash/unstash bootstage infoSimon Glass
It is useful to be able to write the bootstage information to memory for use by a later utility, or the Linux kernel. Provide a function to do this as well as a function to read bootstage information back and incorporate it into the current table. This also makes it possible for U-Boot to chain to another U-Boot and pass on its bootstage information. Signed-off-by: Simon Glass <sjg@chromium.org>
2012-10-02bootstage: Store boot timings in device treeSimon Glass
Add an option, CONFIG_BOOTSTAGE_FDT to pass boot timings to the kernel in the device tree, if available. To use this, you must have CONFIG_OF_LIBFDT defined. Signed-off-by: Simon Glass <sjg@chromium.org>
2012-10-02bootstage: Add time accumulation featureSimon Glass
Sometimes we want to add up the amount of time spent in a particular activity when it is happening in a number of discrete chunks. Add bootstage_start() to mark the start of an acitivity and bootstage_accum() to accumulate the time since the last start. Calling these function in pairs results in the accumulated time being collected. Signed-off-by: Simon Glass <sjg@chromium.org>
2012-10-02bootstage: Export bootstage_add_record() functionSimon Glass
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>
2012-04-10Move bootstage timer out of lib/time.cSimon Glass
The standalone example does not have get_timer() defined, so we cannot rely on it being available. Move the timer function into boootstage.c to avoid this problem. This corrects a build breakage for the standalone example on some boards. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Matthias Fuchs <matthias.fuchs@esd.eu>
2012-03-18bootstage: Implement core microsecond boot time measurementSimon Glass
This defines the basics of a new boot time measurement feature. This allows logging of very accurate time measurements as the boot proceeds, by using an available microsecond counter. To enable the feature, define CONFIG_BOOTSTAGE in your board config file. Also available is CONFIG_BOOTSTAGE_REPORT which will cause a report to be printed just before handing off to the OS. Most IDs are not named at this stage. For that I would first like to renumber them all. Timer summary in microseconds: Mark Elapsed Stage 0 0 reset 205,000 205,000 board_init_f 6,053,000 5,848,000 bootm_start 6,053,000 0 id=1 6,058,000 5,000 id=101 6,058,000 0 id=100 6,061,000 3,000 id=103 6,064,000 3,000 id=104 6,093,000 29,000 id=107 6,093,000 0 id=106 6,093,000 0 id=105 6,093,000 0 id=108 7,089,000 996,000 id=7 7,089,000 0 id=15 7,089,000 0 id=8 7,097,000 8,000 start_kernel Signed-off-by: Simon Glass <sjg@chromium.org>