Hello Mike Banon,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/31357
to review the following change.
Change subject: src/mainboard/lenovo/g505s: Disable SeaBIOS options not supported by hardware
......................................................................
src/mainboard/lenovo/g505s: Disable SeaBIOS options not supported by hardware
G505S does not have any SAS or NVMe controllers and could not have a TPM,
so it makes sense to disable the related SeaBIOS options for this laptop.
Signed-off-by: Mike Banon <mikebdp2(a)gmail.com>
Change-Id: I5b2ee6403d7d2298725729d8d833e37627a4f202
---
M src/mainboard/lenovo/g505s/Kconfig
A src/mainboard/lenovo/g505s/config_seabios
2 files changed, 10 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/57/31357/1
diff --git a/src/mainboard/lenovo/g505s/Kconfig b/src/mainboard/lenovo/g505s/Kconfig
index 883ef27..71ab909 100644
--- a/src/mainboard/lenovo/g505s/Kconfig
+++ b/src/mainboard/lenovo/g505s/Kconfig
@@ -55,4 +55,8 @@
string
default "1002,990b"
+config PAYLOAD_CONFIGFILE
+ string
+ default "$(top)/src/mainboard/$(MAINBOARDDIR)/config_seabios" if PAYLOAD_SEABIOS
+
endif # BOARD_LENOVO_G505S
diff --git a/src/mainboard/lenovo/g505s/config_seabios b/src/mainboard/lenovo/g505s/config_seabios
new file mode 100644
index 0000000..8d3957b
--- /dev/null
+++ b/src/mainboard/lenovo/g505s/config_seabios
@@ -0,0 +1,6 @@
+#
+# SeaBIOS custom configuration for Lenovo G505S
+#
+# CONFIG_MEGASAS is not set
+# CONFIG_NVME is not set
+# CONFIG_TCGBIOS is not set
--
To view, visit https://review.coreboot.org/c/coreboot/+/31357
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I5b2ee6403d7d2298725729d8d833e37627a4f202
Gerrit-Change-Number: 31357
Gerrit-PatchSet: 1
Gerrit-Owner: mikeb mikeb <mikebdp2(a)gmail.com>
Gerrit-Reviewer: Mike Banon <mikebdp2(a)gmail.com>
Gerrit-MessageType: newchange
Keith Short has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/31800
Change subject: security/vboot: Add VBNV flags to save the Cr50 recovery switch state
......................................................................
security/vboot: Add VBNV flags to save the Cr50 recovery switch state
Add flags to save the Cr50 recovery switch state. This ensures that the
Cr50 recovery switch state is only read during verstage.
BUG=b:123360379
BRANCH=none
TEST=build coreboot on sarien and arcada. Test normal boot and recovery
boot on arcada - confirm that that tpm transaction errors are gone.
Change-Id: Id30a7b203e5aac8631971eb102986427b8362a71
Signed-off-by: Keith Short <keithshort(a)chromium.org>
---
M src/mainboard/google/sarien/chromeos.c
M src/security/vboot/vbnv.c
M src/security/vboot/vbnv.h
M src/security/vboot/vbnv_layout.h
4 files changed, 71 insertions(+), 20 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/00/31800/1
diff --git a/src/mainboard/google/sarien/chromeos.c b/src/mainboard/google/sarien/chromeos.c
index 1e363fd..308b682 100644
--- a/src/mainboard/google/sarien/chromeos.c
+++ b/src/mainboard/google/sarien/chromeos.c
@@ -20,18 +20,12 @@
#include <variant/gpio.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include <security/tpm/tss.h>
+#include <security/vboot/vbnv.h>
#include <device/device.h>
#include <intelblocks/pmclib.h>
#include <soc/pmc.h>
#include <soc/pci_devs.h>
-enum rec_mode_state {
- REC_MODE_UNINITIALIZED,
- REC_MODE_NOT_REQUESTED,
- REC_MODE_REQUESTED,
-};
-static enum rec_mode_state saved_rec_mode;
-
void fill_lb_gpios(struct lb_gpios *gpios)
{
struct lb_gpio chromeos_gpios[] = {
@@ -84,30 +78,33 @@
int get_recovery_mode_switch(void)
{
- enum rec_mode_state state = saved_rec_mode;
+ int rec_switch;
uint8_t recovery_button_state = 0;
- /* Check the global variable first. */
- if (state == REC_MODE_NOT_REQUESTED)
- return 0;
- else if (state == REC_MODE_REQUESTED)
- return 1;
+ /*
+ * Only verstage performs a real check of the Cr50 recovery switch.
+ * The recovery switch state is cleared on the first access by the AP
+ * so there's no point in querying the Cr50 at later stages. All other
+ * stages use the state saved in VBNV.
+ */
+ if (!ENV_VERSTAGE &&
+ !get_recovery_switch_from_vbnv(&rec_switch))
+ return rec_switch;
- state = REC_MODE_NOT_REQUESTED;
+ rec_switch = 0;
/* Read state from the GPIO controlled by servo. */
if (cros_get_gpio_value(CROS_GPIO_REC))
- state = REC_MODE_REQUESTED;
+ rec_switch = 1;
/* Read one-time recovery request from cr50. */
else if (tlcl_cr50_get_recovery_button(&recovery_button_state)
== TPM_SUCCESS)
- state = recovery_button_state ?
- REC_MODE_REQUESTED : REC_MODE_NOT_REQUESTED;
+ rec_switch = !!recovery_button_state;
/* Store the state in case this is called again in verstage. */
- saved_rec_mode = state;
+ set_recovery_switch_into_vbnv(rec_switch);
- return state == REC_MODE_REQUESTED;
+ return rec_switch;
}
int get_lid_switch(void)
diff --git a/src/security/vboot/vbnv.c b/src/security/vboot/vbnv.c
index 636e5e3..8156fc5 100644
--- a/src/security/vboot/vbnv.c
+++ b/src/security/vboot/vbnv.c
@@ -140,6 +140,42 @@
return vbnv_data(RECOVERY_OFFSET);
}
+/* Save the recovery switch state into VBNV. */
+void set_recovery_switch_into_vbnv(int recovery_switch)
+{
+ uint8_t vbnv_copy[VBOOT_VBNV_BLOCK_SIZE];
+
+ read_vbnv(vbnv_copy);
+
+ vbnv_copy[MISC_FLAGS_OFFSET] |= MISC_FLAGS_RECOVERY_SWITCH_VALID_MASK;
+ if (recovery_switch)
+ vbnv_copy[MISC_FLAGS_OFFSET] |=
+ MISC_FLAGS_RECOVERY_SWITCH_STATE_MASK;
+ else
+ vbnv_copy[MISC_FLAGS_OFFSET] &=
+ ~MISC_FLAGS_RECOVERY_SWITCH_STATE_MASK;
+
+ vbnv_copy[CRC_OFFSET] = crc8_vbnv(vbnv_copy, CRC_OFFSET);
+
+ save_vbnv(vbnv_copy);
+}
+
+/* Read the recovery switch state from VBNV. */
+int get_recovery_switch_from_vbnv(int *recovery_switch)
+{
+ uint8_t misc_flags;
+ vbnv_setup();
+ misc_flags = vbnv_data(MISC_FLAGS_OFFSET);
+
+ if (!(misc_flags & MISC_FLAGS_RECOVERY_SWITCH_VALID_MASK))
+ return -1;
+
+ *recovery_switch =
+ !!(misc_flags & MISC_FLAGS_RECOVERY_SWITCH_STATE_MASK);
+
+ return 0;
+}
+
/* Read the BOOT_OPROM_NEEDED flag from VBNV. */
int vboot_wants_oprom(void)
{
diff --git a/src/security/vboot/vbnv.h b/src/security/vboot/vbnv.h
index c8e689f..367a376 100644
--- a/src/security/vboot/vbnv.h
+++ b/src/security/vboot/vbnv.h
@@ -25,6 +25,22 @@
void regen_vbnv_crc(uint8_t *vbnv_copy);
int get_recovery_mode_from_vbnv(void);
void set_recovery_mode_into_vbnv(int recovery_reason);
+
+/**
+ * Save the recovery switch state into VBNV
+ *
+ * @param recovery_switch Current state of the recovery switch.
+ */
+void set_recovery_switch_into_vbnv(int recovery_switch);
+/**
+ * Get the recovery switch date from VBNV
+ *
+ * @param recovery_switch On success, set to the saved recovery switch state.
+ *
+ * @return 0 on success, !=0 if recovery switch state not saved.
+ */
+int get_recovery_switch_from_vbnv(int *recovery_switch);
+
int vboot_wants_oprom(void);
/* Read the USB Device Controller(UDC) enable flag from VBNV. */
diff --git a/src/security/vboot/vbnv_layout.h b/src/security/vboot/vbnv_layout.h
index a9326e4..322fcf7 100644
--- a/src/security/vboot/vbnv_layout.h
+++ b/src/security/vboot/vbnv_layout.h
@@ -43,7 +43,9 @@
#define DEV_ENABLE_UDC 0x40
#define MISC_FLAGS_OFFSET 8
-#define MISC_FLAGS_BATTERY_CUTOFF_MASK 0x08
+#define MISC_FLAGS_BATTERY_CUTOFF_MASK 0x08
+#define MISC_FLAGS_RECOVERY_SWITCH_VALID_MASK 0x10
+#define MISC_FLAGS_RECOVERY_SWITCH_STATE_MASK 0x20
#define KERNEL_FIELD_OFFSET 11
#define CRC_OFFSET 15
--
To view, visit https://review.coreboot.org/c/coreboot/+/31800
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Id30a7b203e5aac8631971eb102986427b8362a71
Gerrit-Change-Number: 31800
Gerrit-PatchSet: 1
Gerrit-Owner: Keith Short <keithshort(a)chromium.org>
Gerrit-MessageType: newchange
Keith Short has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/31801
Change subject: mainboard/sarien: Save the Cr50 recovery switch state in VBNV
......................................................................
mainboard/sarien: Save the Cr50 recovery switch state in VBNV
Update sarien so the Cr50 recovery switch is only read during verstage
and save the recovery switch state to VBNV.
BUG=b:123360379
BRANCH=none
TEST=build coreboot on sarien and arcada. Test normal boot and recovery
boot on arcada - confirm that that tpm transaction errors are gone.
Change-Id: Iadf0cec651b3a26ceebadfeb637e189805c328bf
Signed-off-by: Keith Short <keithshort(a)chromium.org>
---
M src/mainboard/google/sarien/chromeos.c
1 file changed, 16 insertions(+), 19 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/01/31801/1
diff --git a/src/mainboard/google/sarien/chromeos.c b/src/mainboard/google/sarien/chromeos.c
index 1e363fd..308b682 100644
--- a/src/mainboard/google/sarien/chromeos.c
+++ b/src/mainboard/google/sarien/chromeos.c
@@ -20,18 +20,12 @@
#include <variant/gpio.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include <security/tpm/tss.h>
+#include <security/vboot/vbnv.h>
#include <device/device.h>
#include <intelblocks/pmclib.h>
#include <soc/pmc.h>
#include <soc/pci_devs.h>
-enum rec_mode_state {
- REC_MODE_UNINITIALIZED,
- REC_MODE_NOT_REQUESTED,
- REC_MODE_REQUESTED,
-};
-static enum rec_mode_state saved_rec_mode;
-
void fill_lb_gpios(struct lb_gpios *gpios)
{
struct lb_gpio chromeos_gpios[] = {
@@ -84,30 +78,33 @@
int get_recovery_mode_switch(void)
{
- enum rec_mode_state state = saved_rec_mode;
+ int rec_switch;
uint8_t recovery_button_state = 0;
- /* Check the global variable first. */
- if (state == REC_MODE_NOT_REQUESTED)
- return 0;
- else if (state == REC_MODE_REQUESTED)
- return 1;
+ /*
+ * Only verstage performs a real check of the Cr50 recovery switch.
+ * The recovery switch state is cleared on the first access by the AP
+ * so there's no point in querying the Cr50 at later stages. All other
+ * stages use the state saved in VBNV.
+ */
+ if (!ENV_VERSTAGE &&
+ !get_recovery_switch_from_vbnv(&rec_switch))
+ return rec_switch;
- state = REC_MODE_NOT_REQUESTED;
+ rec_switch = 0;
/* Read state from the GPIO controlled by servo. */
if (cros_get_gpio_value(CROS_GPIO_REC))
- state = REC_MODE_REQUESTED;
+ rec_switch = 1;
/* Read one-time recovery request from cr50. */
else if (tlcl_cr50_get_recovery_button(&recovery_button_state)
== TPM_SUCCESS)
- state = recovery_button_state ?
- REC_MODE_REQUESTED : REC_MODE_NOT_REQUESTED;
+ rec_switch = !!recovery_button_state;
/* Store the state in case this is called again in verstage. */
- saved_rec_mode = state;
+ set_recovery_switch_into_vbnv(rec_switch);
- return state == REC_MODE_REQUESTED;
+ return rec_switch;
}
int get_lid_switch(void)
--
To view, visit https://review.coreboot.org/c/coreboot/+/31801
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Iadf0cec651b3a26ceebadfeb637e189805c328bf
Gerrit-Change-Number: 31801
Gerrit-PatchSet: 1
Gerrit-Owner: Keith Short <keithshort(a)chromium.org>
Gerrit-MessageType: newchange
Xiang Wang has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/31477
Change subject: riscv: currently riscv does not support fit payload, remove redundant code
......................................................................
riscv: currently riscv does not support fit payload, remove redundant code
This code is not necessary and will trigger an error when I try to boot linux
with bbl.If you want to add this code, it is recommended to add it with the
support code of the fit payload.
Change-Id: If6929897c7f12d8acb079eeebaef512ae506ca8b
Signed-off-by: Xiang Wang <wxjstz(a)126.com>
---
M src/arch/riscv/boot.c
1 file changed, 1 insertion(+), 8 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/77/31477/1
diff --git a/src/arch/riscv/boot.c b/src/arch/riscv/boot.c
index 29064b1..0c8143f 100644
--- a/src/arch/riscv/boot.c
+++ b/src/arch/riscv/boot.c
@@ -32,14 +32,7 @@
{
void (*doit)(int hart_id, void *fdt);
int hart_id;
- void *fdt = prog_entry_arg(prog);
-
- /*
- * If prog_entry_arg is not set (e.g. by fit_payload), use fdt from HLS
- * instead.
- */
- if (fdt == NULL)
- fdt = HLS()->fdt;
+ void *fdt = HLS()->fdt;
if (ENV_RAMSTAGE && prog_type(prog) == PROG_PAYLOAD) {
run_payload(prog, fdt, RISCV_PAYLOAD_MODE_S);
--
To view, visit https://review.coreboot.org/c/coreboot/+/31477
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: If6929897c7f12d8acb079eeebaef512ae506ca8b
Gerrit-Change-Number: 31477
Gerrit-PatchSet: 1
Gerrit-Owner: Xiang Wang <wxjstz(a)126.com>
Gerrit-MessageType: newchange