diff options
author | Bill Richardson <wfrichar@chromium.org> | 2011-09-13 15:28:55 -0700 |
---|---|---|
committer | Bill Richardson <wfrichar@chromium.org> | 2011-09-14 15:22:15 -0700 |
commit | 518d4f39b4ab5fa7d516de397795bc146250c51b (patch) | |
tree | 5766896f89936307b43bc403ff759bc9422d591e | |
parent | c55f0f6c7adc8fcaf612f64b94265fc0eceaa765 (diff) | |
download | vboot-518d4f39b4ab5fa7d516de397795bc146250c51b.tar.gz |
Stub out easter egg, in case BIOS wants to implement one.
BUG=none
TEST=manual
Type 'xyzzy' at dev-mode BIOS screen. What happens next depends on the BIOS.
Change-Id: Ifdb49eb6cb53ecee91f576be91679bd5a232f008
Reviewed-on: http://gerrit.chromium.org/gerrit/7656
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r-- | firmware/include/utility.h | 7 | ||||
-rw-r--r-- | firmware/lib/include/vboot_display.h | 2 | ||||
-rw-r--r-- | firmware/lib/vboot_api_kernel.c | 5 | ||||
-rw-r--r-- | firmware/lib/vboot_display.c | 15 |
4 files changed, 26 insertions, 3 deletions
diff --git a/firmware/include/utility.h b/firmware/include/utility.h index ddfd3d18..931789cb 100644 --- a/firmware/include/utility.h +++ b/firmware/include/utility.h @@ -43,6 +43,13 @@ #define VbAssert(expr) #endif +/* Optional, up to the BIOS */ +#ifdef VBOOT_EASTER_EGG +#define VBEASTEREGG(A,B) VbExEasterEgg(A,B) +#else +#define VBEASTEREGG(A,B) +#endif + /* Combine [msw] and [lsw] uint16s to a uint32_t with its [msw] and * [lsw] forming the most and least signficant 16-bit words. */ diff --git a/firmware/lib/include/vboot_display.h b/firmware/lib/include/vboot_display.h index 57688aed..8dc22606 100644 --- a/firmware/lib/include/vboot_display.h +++ b/firmware/lib/include/vboot_display.h @@ -19,5 +19,7 @@ VbError_t VbDisplayDebugInfo(VbCommonParams* cparams, VbNvContext *vncptr); VbError_t VbCheckDisplayKey(VbCommonParams* cparams, uint32_t key, VbNvContext *vncptr); +void VbExEasterEgg(VbCommonParams* cparams, VbNvContext *vncptr); + #endif /* VBOOT_REFERENCE_VBOOT_DISPLAY_H_ */ diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c index 99ad7999..ed288103 100644 --- a/firmware/lib/vboot_api_kernel.c +++ b/firmware/lib/vboot_api_kernel.c @@ -109,7 +109,7 @@ VbError_t VbBootNormal(VbCommonParams* cparams, LoadKernelParams* p) { /* Developer mode delays. All must be multiples of DEV_DELAY_INCREMENT */ #define DEV_DELAY_INCREMENT 250 /* Delay each loop, in msec */ #define DEV_DELAY_BEEP1 20000 /* Beep for first time at this time */ -#define DEV_DELAY_BEEP2 21000 /* Beep for second time at this time */ +#define DEV_DELAY_BEEP2 20500 /* Beep for second time at this time */ #define DEV_DELAY_TIMEOUT 30000 /* Give up at this time */ #define DEV_DELAY_TIMEOUT_SHORT 2000 /* Give up at this time (short delay) */ @@ -153,7 +153,7 @@ VbError_t VbBootDeveloper(VbCommonParams* cparams, LoadKernelParams* p) { case ' ': case 0x1B: /* Enter, space, or ESC = reboot to recovery */ - VBDEBUG(("VbBootDeveloper() - user pressed ENTER/SPACE/ESC")); + VBDEBUG(("VbBootDeveloper() - user pressed ENTER/SPACE/ESC\n")); VbSetRecoveryRequest(VBNV_RECOVERY_RW_DEV_SCREEN); return 1; case 0x04: @@ -185,7 +185,6 @@ VbError_t VbBootDeveloper(VbCommonParams* cparams, LoadKernelParams* p) { default: VbCheckDisplayKey(cparams, key, &vnc); break; - /* TODO: xyzzy easter egg check */ } } diff --git a/firmware/lib/vboot_display.c b/firmware/lib/vboot_display.c index 9d759a86..b09c7748 100644 --- a/firmware/lib/vboot_display.c +++ b/firmware/lib/vboot_display.c @@ -461,8 +461,19 @@ VbError_t VbDisplayDebugInfo(VbCommonParams* cparams, VbNvContext *vncptr) { } +#define MAGIC_WORD_LEN 5 +#define MAGIC_WORD "xyzzy" +static uint8_t MagicBuffer[MAGIC_WORD_LEN]; + VbError_t VbCheckDisplayKey(VbCommonParams* cparams, uint32_t key, VbNvContext *vncptr) { + int i; + + /* Update key buffer */ + for(i=1; i<MAGIC_WORD_LEN; i++) + MagicBuffer[i-1] = MagicBuffer[i]; + /* Save as lower-case ASCII */ + MagicBuffer[MAGIC_WORD_LEN-1] = (key | 0x20) & 0xFF; if ('\t' == key) { /* Tab = display debug info */ @@ -488,5 +499,9 @@ VbError_t VbCheckDisplayKey(VbCommonParams* cparams, uint32_t key, return VbDisplayScreen(cparams, disp_current_screen, 1, vncptr); } + if (0 == Memcmp(MagicBuffer, MAGIC_WORD, MAGIC_WORD_LEN)) { + VBEASTEREGG(cparams, vncptr); + } + return VBERROR_SUCCESS; } |