diff options
-rw-r--r-- | firmware/include/vboot_struct.h | 3 | ||||
-rw-r--r-- | firmware/lib/vboot_ui.c | 4 | ||||
-rw-r--r-- | firmware/lib/vboot_ui_menu.c | 3 | ||||
-rw-r--r-- | host/arch/arm/lib/crossystem_arch.c | 6 | ||||
-rw-r--r-- | host/arch/x86/lib/crossystem_arch.c | 6 | ||||
-rw-r--r-- | tests/vboot_api_kernel2_tests.c | 42 | ||||
-rw-r--r-- | tests/vboot_detach_menu_tests.c | 3 |
7 files changed, 21 insertions, 46 deletions
diff --git a/firmware/include/vboot_struct.h b/firmware/include/vboot_struct.h index fc993712..82ebdb4c 100644 --- a/firmware/include/vboot_struct.h +++ b/firmware/include/vboot_struct.h @@ -227,7 +227,8 @@ typedef struct VbKernelPreambleHeader { #define VBSD_BOOT_S3_RESUME 0x00000100 /* Read-only firmware supports the normal/developer code path */ #define VBSD_BOOT_RO_NORMAL_SUPPORT 0x00000200 -/* VbInit() was told that the system has a virtual dev-switch */ +/* VbInit() was told that the system has a virtual dev-switch; + * Deprecated as part of chromium:942901. */ #define VBSD_HONOR_VIRT_DEV_SWITCH 0x00000400 /* VbInit() was told the system supports EC software sync */ #define VBSD_EC_SOFTWARE_SYNC 0x00000800 diff --git a/firmware/lib/vboot_ui.c b/firmware/lib/vboot_ui.c index 14f8aabe..6ba46682 100644 --- a/firmware/lib/vboot_ui.c +++ b/firmware/lib/vboot_ui.c @@ -601,8 +601,7 @@ VbError_t vb2_developer_ui(struct vb2_context *ctx) case ' ': /* See if we should disable virtual dev-mode switch. */ VB2_DEBUG("shared->flags=0x%x\n", shared->flags); - if (shared->flags & VBSD_HONOR_VIRT_DEV_SWITCH && - shared->flags & VBSD_BOOT_DEV_SWITCH_ON) { + if (shared->flags & VBSD_BOOT_DEV_SWITCH_ON) { /* Stop the countdown while we go ask... */ if (sd->gbb_flags & GBB_FLAG_FORCE_DEV_SWITCH_ON) { @@ -875,7 +874,6 @@ static VbError_t recovery_ui(struct vb2_context *ctx) * - user forced recovery mode */ if (key == VB_KEY_CTRL('D') && - shared->flags & VBSD_HONOR_VIRT_DEV_SWITCH && !(shared->flags & VBSD_BOOT_DEV_SWITCH_ON) && (shared->flags & VBSD_BOOT_REC_SWITCH_ON)) { if (!(shared->flags & diff --git a/firmware/lib/vboot_ui_menu.c b/firmware/lib/vboot_ui_menu.c index 5ac4bb40..8ee27701 100644 --- a/firmware/lib/vboot_ui_menu.c +++ b/firmware/lib/vboot_ui_menu.c @@ -356,8 +356,7 @@ static VbError_t to_dev_action(struct vb2_context *ctx) uint32_t vbsd_flags = vb2_get_sd(ctx)->vbsd->flags; /* Sanity check, should never happen. */ - if (!(vbsd_flags & VBSD_HONOR_VIRT_DEV_SWITCH) || - (vbsd_flags & VBSD_BOOT_DEV_SWITCH_ON) || + if ((vbsd_flags & VBSD_BOOT_DEV_SWITCH_ON) || !vb2_allow_recovery(ctx)) return VBERROR_KEEP_LOOPING; diff --git a/host/arch/arm/lib/crossystem_arch.c b/host/arch/arm/lib/crossystem_arch.c index 539d765b..4dabb287 100644 --- a/host/arch/arm/lib/crossystem_arch.c +++ b/host/arch/arm/lib/crossystem_arch.c @@ -541,11 +541,7 @@ int VbGetArchPropertyInt(const char* name) } else if (!strcasecmp(name, "devsw_cur")) { /* Systems with virtual developer switches return at-boot * value */ - int flags = VbGetSystemPropertyInt("vdat_flags"); - if ((flags != -1) && (flags & VBSD_HONOR_VIRT_DEV_SWITCH)) - return VbGetSystemPropertyInt("devsw_boot"); - - return VbGetVarGpio("developer-switch"); + return VbGetSystemPropertyInt("devsw_boot"); } else if (!strcasecmp(name, "recoverysw_cur")) { int value; /* Try GPIO chardev API first. */ diff --git a/host/arch/x86/lib/crossystem_arch.c b/host/arch/x86/lib/crossystem_arch.c index 7de84dc5..41d601ca 100644 --- a/host/arch/x86/lib/crossystem_arch.c +++ b/host/arch/x86/lib/crossystem_arch.c @@ -791,11 +791,7 @@ int VbGetArchPropertyInt(const char* name) if (!strcasecmp(name,"devsw_cur")) { /* Systems with virtual developer switches return at-boot * value */ - int flags = VbGetSystemPropertyInt("vdat_flags"); - if ((flags != -1) && (flags & VBSD_HONOR_VIRT_DEV_SWITCH)) - value = VbGetSystemPropertyInt("devsw_boot"); - else - value = ReadGpio(GPIO_SIGNAL_TYPE_DEV); + value = VbGetSystemPropertyInt("devsw_boot"); } else if (!strcasecmp(name,"recoverysw_cur")) { value = ReadGpio(GPIO_SIGNAL_TYPE_RECOVERY); } else if (!strcasecmp(name,"wpsw_cur")) { diff --git a/tests/vboot_api_kernel2_tests.c b/tests/vboot_api_kernel2_tests.c index 93eeb816..fc13362b 100644 --- a/tests/vboot_api_kernel2_tests.c +++ b/tests/vboot_api_kernel2_tests.c @@ -440,7 +440,7 @@ static void VbBootDevTest(void) /* Space asks to disable virtual dev switch */ ResetMocks(); - shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_DEV_SWITCH_ON; + shared->flags = VBSD_BOOT_DEV_SWITCH_ON; mock_keypress[0] = ' '; mock_keypress[1] = VB_KEY_ENTER; TEST_EQ(VbBootDeveloper(&ctx), VBERROR_REBOOT_REQUIRED, @@ -456,7 +456,7 @@ static void VbBootDevTest(void) /* Space-space doesn't disable it */ ResetMocks(); - shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_DEV_SWITCH_ON; + shared->flags = VBSD_BOOT_DEV_SWITCH_ON; mock_keypress[0] = ' '; mock_keypress[1] = ' '; mock_keypress[2] = VB_KEY_ESC; @@ -470,14 +470,14 @@ static void VbBootDevTest(void) /* Enter doesn't by default */ ResetMocks(); - shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_DEV_SWITCH_ON; + shared->flags = VBSD_BOOT_DEV_SWITCH_ON; mock_keypress[0] = VB_KEY_ENTER; mock_keypress[1] = VB_KEY_ENTER; TEST_EQ(VbBootDeveloper(&ctx), 1002, "Enter ignored"); /* Enter does if GBB flag set */ ResetMocks(); - shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_DEV_SWITCH_ON; + shared->flags = VBSD_BOOT_DEV_SWITCH_ON; sd->gbb_flags |= VB2_GBB_FLAG_ENTER_TRIGGERS_TONORM; mock_keypress[0] = VB_KEY_ENTER; mock_keypress[1] = VB_KEY_ENTER; @@ -486,7 +486,7 @@ static void VbBootDevTest(void) /* Tonorm ignored if GBB forces dev switch on */ ResetMocks(); - shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_DEV_SWITCH_ON; + shared->flags = VBSD_BOOT_DEV_SWITCH_ON; sd->gbb_flags |= VB2_GBB_FLAG_FORCE_DEV_SWITCH_ON; mock_keypress[0] = ' '; mock_keypress[1] = VB_KEY_ENTER; @@ -495,7 +495,7 @@ static void VbBootDevTest(void) /* Shutdown requested at tonorm screen */ ResetMocks(); - shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_DEV_SWITCH_ON; + shared->flags = VBSD_BOOT_DEV_SWITCH_ON; mock_keypress[0] = ' '; shutdown_request_calls_left = 2; TEST_EQ(VbBootDeveloper(&ctx), @@ -508,7 +508,7 @@ static void VbBootDevTest(void) /* Shutdown requested by keyboard at tonorm screen */ ResetMocks(); - shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_DEV_SWITCH_ON; + shared->flags = VBSD_BOOT_DEV_SWITCH_ON; mock_keypress[0] = VB_BUTTON_POWER_SHORT_PRESS; TEST_EQ(VbBootDeveloper(&ctx), VBERROR_SHUTDOWN_REQUESTED, @@ -858,7 +858,7 @@ static void VbBootDevTest(void) /* Shutdown requested when dev disabled */ ResetMocks(); - shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_DEV_SWITCH_ON; + shared->flags = VBSD_BOOT_DEV_SWITCH_ON; VbApiKernelGetFwmp()->flags |= FWMP_DEV_DISABLE_BOOT; shutdown_request_calls_left = 1; TEST_EQ(VbBootDeveloper(&ctx), @@ -869,7 +869,7 @@ static void VbBootDevTest(void) /* Shutdown requested by keyboard when dev disabled */ ResetMocks(); - shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_DEV_SWITCH_ON; + shared->flags = VBSD_BOOT_DEV_SWITCH_ON; VbApiKernelGetFwmp()->flags |= FWMP_DEV_DISABLE_BOOT; mock_keypress[0] = VB_BUTTON_POWER_SHORT_PRESS; TEST_EQ(VbBootDeveloper(&ctx), @@ -1001,7 +1001,7 @@ static void VbBootRecTest(void) /* Ctrl+D ignored for many reasons... */ ResetMocks(); - shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_REC_SWITCH_ON; + shared->flags = VBSD_BOOT_REC_SWITCH_ON; shutdown_request_calls_left = 100; mock_keypress[0] = VB_KEY_CTRL('D'); trust_ec = 0; @@ -1013,8 +1013,7 @@ static void VbBootRecTest(void) " todev screen"); ResetMocks(); - shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_REC_SWITCH_ON | - VBSD_BOOT_DEV_SWITCH_ON; + shared->flags = VBSD_BOOT_REC_SWITCH_ON | VBSD_BOOT_DEV_SWITCH_ON; trust_ec = 1; shutdown_request_calls_left = 100; mock_keypress[0] = VB_KEY_CTRL('D'); @@ -1026,7 +1025,6 @@ static void VbBootRecTest(void) " todev screen"); ResetMocks(); - shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH; trust_ec = 1; shutdown_request_calls_left = 100; mock_keypress[0] = VB_KEY_CTRL('D'); @@ -1037,18 +1035,6 @@ static void VbBootRecTest(void) TEST_NEQ(screens_displayed[1], VB_SCREEN_RECOVERY_TO_DEV, " todev screen"); - ResetMocks(); - shared->flags = VBSD_BOOT_REC_SWITCH_ON; - trust_ec = 1; - shutdown_request_calls_left = 100; - mock_keypress[0] = VB_KEY_CTRL('D'); - TEST_EQ(VbBootRecovery(&ctx), - VBERROR_SHUTDOWN_REQUESTED, - "Ctrl+D ignored if no virtual dev switch"); - TEST_EQ(virtdev_set, 0, " virtual dev mode off"); - TEST_NEQ(screens_displayed[1], VB_SCREEN_RECOVERY_TO_DEV, - " todev screen"); - /* Ctrl+D ignored because the physical recovery switch is still pressed * and we don't like that. */ @@ -1066,7 +1052,7 @@ static void VbBootRecTest(void) /* Ctrl+D then space means don't enable */ ResetMocks(); - shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_REC_SWITCH_ON; + shared->flags = VBSD_BOOT_REC_SWITCH_ON; shutdown_request_calls_left = 100; vbtlk_retval = VBERROR_NO_DISK_FOUND - VB_DISK_FLAG_REMOVABLE; trust_ec = 1; @@ -1085,7 +1071,7 @@ static void VbBootRecTest(void) /* Ctrl+D then enter means enable */ ResetMocks(); - shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_REC_SWITCH_ON; + shared->flags = VBSD_BOOT_REC_SWITCH_ON; shutdown_request_calls_left = 100; vbtlk_retval = VBERROR_NO_DISK_FOUND - VB_DISK_FLAG_REMOVABLE; trust_ec = 1; @@ -1098,7 +1084,7 @@ static void VbBootRecTest(void) /* Handle TPM error in enabling dev mode */ ResetMocks(); - shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_REC_SWITCH_ON; + shared->flags = VBSD_BOOT_REC_SWITCH_ON; shutdown_request_calls_left = 100; vbtlk_retval = VBERROR_NO_DISK_FOUND - VB_DISK_FLAG_REMOVABLE; trust_ec = 1; diff --git a/tests/vboot_detach_menu_tests.c b/tests/vboot_detach_menu_tests.c index 3bfc0b27..182ba3e2 100644 --- a/tests/vboot_detach_menu_tests.c +++ b/tests/vboot_detach_menu_tests.c @@ -69,8 +69,7 @@ static void ResetMocks(void) memset(&shared_data, 0, sizeof(shared_data)); VbSharedDataInit(shared, sizeof(shared_data)); - shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | - VBSD_BOOT_FIRMWARE_VBOOT2; + shared->flags = VBSD_BOOT_FIRMWARE_VBOOT2; memset(&lkp, 0, sizeof(lkp)); |