Hello Aaron Durbin, Furquan Shaikh,
I'd like you to do a code review. Please visit
https://review.coreboot.org/19497
to review the following change.
Change subject: cbmem: Add new command line flag to dump console for one boot only
......................................................................
cbmem: Add new command line flag to dump console for one boot only
Even though the persistent CBMEM console is obviously awesome, there may
be cases where we only want to look at console output from the last boot.
It's easy to tell where one boot ends and another begins from the banner
message that coreboot prints at the start of every stage, but in order
to make it easier to find that point (especially for external tools),
let's put that functionality straight into the cbmem utility with a new
command line flag. Use the POSIX/libc regular expression API to find the
banner string for maximum compatilibity, even though it's kinda icky.
Change-Id: Ic17383507a884d84de9a2a880380cb15b25708a1
Signed-off-by: Julius Werner <jwerner(a)chromium.org>
---
M util/cbmem/cbmem.c
1 file changed, 37 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/97/19497/1
diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c
index 7b7f10d..c1b1caa 100644
--- a/util/cbmem/cbmem.c
+++ b/util/cbmem/cbmem.c
@@ -31,6 +31,7 @@
#include <sys/mman.h>
#include <libgen.h>
#include <assert.h>
+#include <regex.h>
#include <commonlib/cbmem_id.h>
#include <commonlib/timestamp_serialized.h>
#include <commonlib/coreboot_tables.h>
@@ -611,7 +612,7 @@
#define CBMC_OVERFLOW (1 << 31)
/* dump the cbmem console */
-static void dump_console(void)
+static void dump_console(int one_boot_only)
{
struct cbmem_console *console_p;
char *console_c;
@@ -659,8 +660,32 @@
for (cursor = 0; cursor < size; cursor++)
if (!isprint(console_c[cursor]) && !isspace(console_c[cursor]))
console_c[cursor] = '?';
- printf("%s\n", console_c);
+ /* We detect the last boot by looking for a bootblock, romstage or
+ ramstage banner, in that order (to account for platforms without
+ CONFIG_BOOTBLOCK_CONSOLE and/or CONFIG_EARLY_CONSOLE). Once we find
+ a banner, store the last match for that stage in cursor and stop. */
+ cursor = 0;
+ if (one_boot_only) {
+#define BANNER_REGEX(stage) "\n\ncoreboot-[^\n]* " stage " starting\\.\\.\\.\n"
+ const char *regex[] = { BANNER_REGEX("bootblock"),
+ BANNER_REGEX("romstage"),
+ BANNER_REGEX("ramstage")};
+ int i;
+
+ for (i = 0; !cursor && i < ARRAY_SIZE(regex); i++) {
+ regex_t re;
+ regmatch_t match;
+ assert(!regcomp(&re, regex[i], 0));
+
+ /* Keep looking for matches so we find the last one. */
+ while (!regexec(&re, console_c + cursor, 1, &match, 0))
+ cursor += match.rm_so + 1;
+ regfree(&re);
+ }
+ }
+
+ puts(console_c + cursor);
free(console_c);
unmap_memory();
}
@@ -936,6 +961,7 @@
printf("usage: %s [-cCltTxVvh?]\n", name);
printf("\n"
" -c | --console: print cbmem console\n"
+ " -1 | --oneboot: print cbmem console for last boot only\n"
" -C | --coverage: dump coverage information\n"
" -l | --list: print cbmem table of contents\n"
" -x | --hexdump: print hexdump of cbmem area\n"
@@ -1074,11 +1100,13 @@
int print_rawdump = 0;
int print_timestamps = 0;
int machine_readable_timestamps = 0;
+ int one_boot_only = 0;
unsigned int rawdump_id = 0;
int opt, option_index = 0;
static struct option long_options[] = {
{"console", 0, 0, 'c'},
+ {"oneboot", 0, 0, '1'},
{"coverage", 0, 0, 'C'},
{"list", 0, 0, 'l'},
{"timestamps", 0, 0, 't'},
@@ -1090,11 +1118,16 @@
{"help", 0, 0, 'h'},
{0, 0, 0, 0}
};
- while ((opt = getopt_long(argc, argv, "cCltTxVvh?r:",
+ while ((opt = getopt_long(argc, argv, "c1CltTxVvh?r:",
long_options, &option_index)) != EOF) {
switch (opt) {
case 'c':
print_console = 1;
+ print_defaults = 0;
+ break;
+ case '1':
+ print_console = 1;
+ one_boot_only = 1;
print_defaults = 0;
break;
case 'C':
@@ -1211,7 +1244,7 @@
#endif
if (print_console)
- dump_console();
+ dump_console(one_boot_only);
if (print_coverage)
dump_coverage();
--
To view, visit https://review.coreboot.org/19497
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic17383507a884d84de9a2a880380cb15b25708a1
Gerrit-PatchSet: 1
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Owner: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Aaron Durbin <adurbin(a)chromium.org>
Gerrit-Reviewer: Furquan Shaikh <furquan(a)google.com>
Julius Werner has posted comments on this change. ( https://review.coreboot.org/19477 )
Change subject: rockchip/rk3399: Add MIPI driver
......................................................................
Patch Set 2:
(6 comments)
https://review.coreboot.org/#/c/19477/2/src/soc/rockchip/rk3399/display.c
File src/soc/rockchip/rk3399/display.c:
Line 116: rkclk_configure_vop_aclk(vop_id, 200 * MHz);
> I am not sure,because i see it will be 384Mhz when hdmi output.
Okay, fair enough, then leave it here.
https://review.coreboot.org/#/c/19477/3/src/soc/rockchip/rk3399/display.c
File src/soc/rockchip/rk3399/display.c:
PS3, Line 63:
:
> If you're going to remove this (and HDMI down below), you should delete the
The header is shared with RK3288 code which still needs them, so please don't. ;)
https://review.coreboot.org/#/c/19477/2/src/soc/rockchip/rk3399/mipi.c
File src/soc/rockchip/rk3399/mipi.c:
Line 68: return dptdin_map[i].testdin;
> refer to 《MIPI D-PHY Bidir 4L for TSMC 28-nm HPC /1.8V Databook》
Okay, fair enough. But shouldn't the comparison be (dptdin_map[i].max_mbps >= max_mbps) (not '>' ), then?
Line 192: mpclk = DIV_ROUND_UP(edid->mode.pixel_clock, MSEC_PER_SEC);
> because i think porting from kernel code, and then we can refer to kernel p
That is not a good reason to have bad code, though. You're doing a lot of integer divisions on these numbers and you're loosing a lot of precision all over the place. I didn't review the kernel change so I can't comment on that, but here I can see that it is likely not ideal and I want you to change it. Please change these variables to hold Hz or at least KHz.
Line 193: /* take 1 / 0.8, since mbps must big than bandwidth of RGB */
> refer to kernel code
Hmm. It would be nice if we could get a better explanation for *why* the margin is not enough if calculations show it should be. (Maybe because you're calculating in MHz everywhere and getting giant rounding errors?)
https://review.coreboot.org/#/c/19477/3/src/soc/rockchip/rk3399/mipi.c
File src/soc/rockchip/rk3399/mipi.c:
PS3, Line 194: si->lanes) * 10 /
This is also a bad integer division in the 18bpp case, btw. You should probably write it
mpclk / dsi->lanes * bpp / 8 * 10;
(Assuming you'll change mpclk to Hz so doing the division first isn't as bad.)
--
To view, visit https://review.coreboot.org/19477
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I02475eefb187c619c614b1cd20e97074bc8d917f
Gerrit-PatchSet: 2
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Owner: nickey.yang(a)rock-chips.com
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: Sean Paul <seanpaul(a)chromium.org>
Gerrit-Reviewer: Shunqian Zheng <zhengsq(a)rock-chips.com>
Gerrit-Reviewer: build bot (Jenkins)
Gerrit-Reviewer: nickey.yang(a)rock-chips.com
Gerrit-HasComments: Yes
Julius Werner has posted comments on this change. ( https://review.coreboot.org/19474 )
Change subject: cbgfx: Add portrait screen support
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit https://review.coreboot.org/19474
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I66fee6d73654e736a2db4a3d191f030c52a23e0d
Gerrit-PatchSet: 2
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Owner: nickey.yang(a)rock-chips.com
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: Shunqian Zheng <zhengsq(a)rock-chips.com>
Gerrit-Reviewer: build bot (Jenkins)
Gerrit-Reviewer: nickey.yang(a)rock-chips.com
Gerrit-HasComments: No