Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protectli vault ehl/pop up fix #362

Merged
merged 5 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 3rdparty/vboot
Submodule vboot updated from b76cd8 to def2f5
2 changes: 1 addition & 1 deletion configs/config.protectli_vp2420
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ CONFIG_POST_DEVICE_LPC=y
CONFIG_POST_IO_PORT=0x80
CONFIG_PAYLOAD_EDK2=y
CONFIG_EDK2_REPOSITORY="https://github.com/Dasharo/edk2"
CONFIG_EDK2_TAG_OR_REV="746b760876708faf438b2d89cfeb4b3798606d5f"
CONFIG_EDK2_TAG_OR_REV="91d01a5e577475894e7cce06d59e392cbbffba22"
CONFIG_EDK2_USE_EDK2_PLATFORMS=y
CONFIG_EDK2_PLATFORMS_REPOSITORY="https://github.com/Dasharo/edk2-platforms"
CONFIG_EDK2_PLATFORMS_TAG_OR_REV="3323ed481d35096fb6a7eae7b49f35eff00f86cf"
Expand Down
1 change: 1 addition & 0 deletions src/mainboard/protectli/vault_ehl/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ config VBOOT
select VBOOT_VBNV_CMOS
select VBOOT_VBNV_CMOS_BACKUP_TO_FLASH
select VBOOT_SEPARATE_VERSTAGE
select HAS_RECOVERY_MRC_CACHE

config VBOOT_SLOTS_RW_A
default y if VBOOT
Expand Down
4 changes: 0 additions & 4 deletions src/mainboard/protectli/vault_ehl/mainboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@
#include <device/device.h>
#include <fsp/api.h>
#include <pc80/i8254.h>
#include <security/vboot/vboot_common.h>
#include <soc/ramstage.h>

static void mainboard_final(void *chip_info)
{
if (CONFIG(VBOOT))
vboot_clear_recovery_request();

beep(1500, 200);
}

Expand Down
28 changes: 12 additions & 16 deletions src/security/vboot/bootmode.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,6 @@ int vboot_check_recovery_request(void)
return vb2api_get_recovery_reason(vboot_get_context());
}

void vboot_clear_recovery_request(void)
{
struct vb2_context *ctx;

/* No point in clearing the recovery request if we are not in recovery. */
if (!vboot_recovery_mode_enabled())
return;

ctx = vboot_get_context();
vb2api_clear_recovery(ctx);
save_vbnv(ctx->nvdata);

if (CONFIG(VBOOT_VBNV_CMOS_BACKUP_TO_FLASH))
save_vbnv_flash(ctx->nvdata);
}

int vboot_recovery_mode_enabled(void)
{
return vboot_get_context()->flags & VB2_CONTEXT_RECOVERY_MODE;
Expand Down Expand Up @@ -68,6 +52,18 @@ static void do_clear_recovery_mode_switch(void *unused)
BOOT_STATE_INIT_ENTRY(BS_WRITE_TABLES, BS_ON_ENTRY,
do_clear_recovery_mode_switch, NULL);

static void vboot_clear_recovery_request(void *unused)
{
struct vb2_context *ctx;

ctx = vboot_get_context();
vb2api_clear_recovery(ctx);
save_vbnv(ctx->nvdata);
}

BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE, BS_ON_ENTRY,
vboot_clear_recovery_request, NULL);

int __weak get_recovery_mode_retrain_switch(void)
{
return 0;
Expand Down
4 changes: 0 additions & 4 deletions src/security/vboot/vboot_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
*/
int vboot_check_recovery_request(void);

/*
* Function to clear the recovery request and update the VBNV.
*/
void vboot_clear_recovery_request(void);

/* ============================ VBOOT REBOOT ============================== */
/*
Expand Down
3 changes: 3 additions & 0 deletions src/security/vboot/vboot_logic.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ void verstage_main(void)
/* Initialize and read nvdata from non-volatile storage. */
vbnv_init(ctx->nvdata);

if (!CONFIG(VBOOT_SLOTS_RW_AB))
ctx->flags |= VB2_CONTEXT_SLOT_A_ONLY;

/* Set S3 resume flag if vboot should behave differently when selecting
* which slot to boot. This is only relevant to vboot if the platform
* does verification of memory init and thus must ensure it resumes with
Expand Down