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>
This commit is contained in:
Bill Richardson
2011-09-13 15:28:55 -07:00
parent c55f0f6c7a
commit 518d4f39b4
4 changed files with 26 additions and 3 deletions

View File

@@ -43,6 +43,13 @@
#define VbAssert(expr) #define VbAssert(expr)
#endif #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 /* Combine [msw] and [lsw] uint16s to a uint32_t with its [msw] and
* [lsw] forming the most and least signficant 16-bit words. * [lsw] forming the most and least signficant 16-bit words.
*/ */

View File

@@ -19,5 +19,7 @@ VbError_t VbDisplayDebugInfo(VbCommonParams* cparams, VbNvContext *vncptr);
VbError_t VbCheckDisplayKey(VbCommonParams* cparams, uint32_t key, VbError_t VbCheckDisplayKey(VbCommonParams* cparams, uint32_t key,
VbNvContext *vncptr); VbNvContext *vncptr);
void VbExEasterEgg(VbCommonParams* cparams, VbNvContext *vncptr);
#endif /* VBOOT_REFERENCE_VBOOT_DISPLAY_H_ */ #endif /* VBOOT_REFERENCE_VBOOT_DISPLAY_H_ */

View File

@@ -109,7 +109,7 @@ VbError_t VbBootNormal(VbCommonParams* cparams, LoadKernelParams* p) {
/* Developer mode delays. All must be multiples of DEV_DELAY_INCREMENT */ /* Developer mode delays. All must be multiples of DEV_DELAY_INCREMENT */
#define DEV_DELAY_INCREMENT 250 /* Delay each loop, in msec */ #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_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 30000 /* Give up at this time */
#define DEV_DELAY_TIMEOUT_SHORT 2000 /* Give up at this time (short delay) */ #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 ' ':
case 0x1B: case 0x1B:
/* Enter, space, or ESC = reboot to recovery */ /* 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); VbSetRecoveryRequest(VBNV_RECOVERY_RW_DEV_SCREEN);
return 1; return 1;
case 0x04: case 0x04:
@@ -185,7 +185,6 @@ VbError_t VbBootDeveloper(VbCommonParams* cparams, LoadKernelParams* p) {
default: default:
VbCheckDisplayKey(cparams, key, &vnc); VbCheckDisplayKey(cparams, key, &vnc);
break; break;
/* TODO: xyzzy easter egg check */
} }
} }

View File

@@ -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, VbError_t VbCheckDisplayKey(VbCommonParams* cparams, uint32_t key,
VbNvContext *vncptr) { 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) { if ('\t' == key) {
/* Tab = display debug info */ /* Tab = display debug info */
@@ -488,5 +499,9 @@ VbError_t VbCheckDisplayKey(VbCommonParams* cparams, uint32_t key,
return VbDisplayScreen(cparams, disp_current_screen, 1, vncptr); return VbDisplayScreen(cparams, disp_current_screen, 1, vncptr);
} }
if (0 == Memcmp(MagicBuffer, MAGIC_WORD, MAGIC_WORD_LEN)) {
VBEASTEREGG(cparams, vncptr);
}
return VBERROR_SUCCESS; return VBERROR_SUCCESS;
} }