Frans Hendriks has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/33463
Change subject: mainboard/facebook/fbg1701: Add verified boot tables
......................................................................
mainboard/facebook/fbg1701: Add verified boot tables
The vendorcode for verified boot is uploaded, but not used by a mainboard.
Add support to the mainboard for verified boot.
The items to be verifed are placed in board_verified_boot.c
BUG=N/A
TEST=Boot Embedded Linux 4.20 and verify logging on Facebook FBG-1701 rev 0-2
Change-Id: I3ea0a95287977df0dea13e05acedd5406538a6ee
Signed-off-by: Frans Hendriks <fhendriks(a)eltan.com>
---
M src/mainboard/facebook/fbg1701/Kconfig
M src/mainboard/facebook/fbg1701/Makefile.inc
A src/mainboard/facebook/fbg1701/board_verified_boot.c
A src/mainboard/facebook/fbg1701/board_verified_boot.h
A src/mainboard/facebook/fbg1701/manifest.h
M src/mainboard/facebook/fbg1701/onboard.h
6 files changed, 194 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/63/33463/1
diff --git a/src/mainboard/facebook/fbg1701/Kconfig b/src/mainboard/facebook/fbg1701/Kconfig
index 3f45194..9acfb42 100644
--- a/src/mainboard/facebook/fbg1701/Kconfig
+++ b/src/mainboard/facebook/fbg1701/Kconfig
@@ -78,6 +78,9 @@
bool
default n
+config VENDORCODE_ELTAN_OEM_MANIFEST_LOC
+ hex "OEM Manifest working dflt 0xFFFE9000"
+
config BOOTBLOCK_LOC
hex
default 0xFFFF0000
@@ -102,4 +105,16 @@
hex "C Bootblock Size"
default 0x4000
+
+config VENDORCODE_ELTAN_VBOOT_SIGNED_MANIFEST
+ bool
+ default y
+
+config VENDORCODE_ELTAN_VBOOT_MANIFEST
+ string
+ default "mainboard/facebook/fbg1701/manifest.h"
+
+config VENDORCODE_ELTAN_VBOOT_KEY_LOCATION
+ hex "Key Location working dflt 0xFFFF9C00"
+
endif # BOARD_FACEBOOK_FBG1701
diff --git a/src/mainboard/facebook/fbg1701/Makefile.inc b/src/mainboard/facebook/fbg1701/Makefile.inc
index 07309c5..c414470 100644
--- a/src/mainboard/facebook/fbg1701/Makefile.inc
+++ b/src/mainboard/facebook/fbg1701/Makefile.inc
@@ -15,6 +15,13 @@
## GNU General Public License for more details.
##
+ifneq ($(filter y,$(CONFIG_VENDORCODE_ELTAN_VBOOT) $(CONFIG_VENDORCODE_ELTAN_MBOOT)),)
+bootblock-$(CONFIG_C_ENVIRONMENT_BOOTBLOCK) += board_verified_boot.c
+postcar-y += board_verified_boot.c
+ramstage-y += board_verified_boot.c
+romstage-y += board_verified_boot.c
+endif
+
bootblock-$(CONFIG_C_ENVIRONMENT_BOOTBLOCK) += com_init.c
ramstage-y += gpio.c
diff --git a/src/mainboard/facebook/fbg1701/board_verified_boot.c b/src/mainboard/facebook/fbg1701/board_verified_boot.c
new file mode 100644
index 0000000..cea6558
--- /dev/null
+++ b/src/mainboard/facebook/fbg1701/board_verified_boot.c
@@ -0,0 +1,104 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2018-2019 Eltan B.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include "board_verified_boot.h"
+
+#ifdef __BOOTBLOCK__
+/* The items verified by the bootblock, the bootblock will not measure the
+ * items to the TPM
+ */
+const verify_item_t bootblock_verify_list[] = {
+ { VERIFY_FILE, ROMSTAGE, { { NULL, CBFS_TYPE_STAGE } },
+ HASH_IDX_ROM_STAGE, MBOOT_PCR_INDEX_0 },
+ { VERIFY_BLOCK, "BootBlock", { { (void *)CONFIG_BOOTBLOCK_LOC,
+ CONFIG_BOOTBLOCK_SIZE } }, HASH_IDX_BOOTBLOCK,
+ MBOOT_PCR_INDEX_0 },
+ { VERIFY_TERMINATOR, NULL, { { NULL, 0 } }, 0, 0 }
+};
+#endif
+
+#if defined(__ROMSTAGE__) || defined(__POSTCAR__)
+/* The FSP is already checked in romstage */
+static const verify_item_t ram_stage_additional_list[] = {
+ { VERIFY_FILE, OP_ROM_VBT, { { NULL, CBFS_TYPE_RAW } },
+ HASH_IDX_OPROM, MBOOT_PCR_INDEX_2 },
+ { VERIFY_FILE, "logo.bmp", { { NULL, CBFS_TYPE_RAW } },
+ HASH_IDX_LOGO, MBOOT_PCR_INDEX_2 },
+ { VERIFY_FILE, "fallback/dsdt.aml", { { NULL, CBFS_TYPE_RAW } },
+ HASH_IDX_DSDT, MBOOT_PCR_INDEX_2 },
+ { VERIFY_TERMINATOR, NULL, { { NULL, 0 } }, 0, 0 }
+ };
+#endif
+
+#ifdef __ROMSTAGE__
+/* The items used by the romstage */
+const verify_item_t romstage_verify_list[] = {
+ { VERIFY_FILE, ROMSTAGE, { { NULL, CBFS_TYPE_STAGE } },
+ HASH_IDX_ROM_STAGE, MBOOT_PCR_INDEX_0 },
+ { VERIFY_FILE, MICROCODE, { { NULL, CBFS_TYPE_MICROCODE } },
+ HASH_IDX_MICROCODE, MBOOT_PCR_INDEX_1 },
+ { VERIFY_FILE, FSP, { { NULL, CBFS_TYPE_FSP } }, HASH_IDX_FSP,
+ MBOOT_PCR_INDEX_1 },
+ { VERIFY_FILE, "spd.bin", { { NULL, CBFS_TYPE_SPD } },
+ HASH_IDX_SPD0, MBOOT_PCR_INDEX_1 },
+#if CONFIG(POSTCAR_STAGE)
+ { VERIFY_FILE, POSTCAR, { { NULL, CBFS_TYPE_STAGE } },
+ HASH_IDX_POSTCAR_STAGE, MBOOT_PCR_INDEX_0 },
+#endif
+ { VERIFY_BLOCK, "BootBlock", { { (void *) CONFIG_BOOTBLOCK_LOC,
+ CONFIG_BOOTBLOCK_SIZE } }, HASH_IDX_BOOTBLOCK,
+ MBOOT_PCR_INDEX_0 },
+ { VERIFY_TERMINATOR, NULL, { { NULL, 0 } }, 0, 0 }
+};
+
+/* The items used by the ramstage */
+const verify_item_t ramstage_verify_list[] = {
+ { VERIFY_FILE, RAMSTAGE, { { ram_stage_additional_list,
+ CBFS_TYPE_STAGE } }, HASH_IDX_RAM_STAGE,
+ MBOOT_PCR_INDEX_0 },
+ { VERIFY_TERMINATOR, NULL, { { NULL, 0 } }, 0, 0 }
+};
+#endif
+
+#ifdef __POSTCAR__
+/* POSTSTAGE */
+/* The items used by the postcar stage */
+const verify_item_t postcar_verify_list[] = {
+ { VERIFY_FILE, RAMSTAGE, { { ram_stage_additional_list,
+ CBFS_TYPE_STAGE } }, HASH_IDX_RAM_STAGE,
+ MBOOT_PCR_INDEX_0 },
+ { VERIFY_FILE, MICROCODE, { { NULL, CBFS_TYPE_MICROCODE } },
+ HASH_IDX_MICROCODE, MBOOT_PCR_INDEX_1 },
+ { VERIFY_FILE, FSP, { { NULL, CBFS_TYPE_FSP } }, HASH_IDX_FSP,
+ MBOOT_PCR_INDEX_1 },
+ { VERIFY_FILE, "spd.bin", { { NULL, CBFS_TYPE_SPD } },
+ HASH_IDX_SPD0, MBOOT_PCR_INDEX_1 },
+ { VERIFY_TERMINATOR, NULL, { { NULL, 0 } }, 0, 0 }
+};
+#endif
+
+#ifdef __RAMSTAGE__
+/* RAMSTAGE */
+const verify_item_t payload_verify_list[] = {
+ { VERIFY_FILE, PAYLOAD, { { NULL, CBFS_TYPE_SELF |
+ VERIFIED_BOOT_COPY_BLOCK } }, HASH_IDX_PAYLOAD,
+ MBOOT_PCR_INDEX_3 },
+ { VERIFY_TERMINATOR, NULL, { { NULL, 0 } }, 0, 0 }
+};
+
+const verify_item_t oprom_verify_list[] = {
+ { VERIFY_TERMINATOR, NULL, { { NULL, 0 } }, 0, 0 }
+};
+#endif
diff --git a/src/mainboard/facebook/fbg1701/board_verified_boot.h b/src/mainboard/facebook/fbg1701/board_verified_boot.h
new file mode 100644
index 0000000..30fcd8b
--- /dev/null
+++ b/src/mainboard/facebook/fbg1701/board_verified_boot.h
@@ -0,0 +1,23 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2018 Eltan B.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef BOARD_VERIFIED_BOOT_H
+#define BOARD_VERIFIED_BOOT_H
+
+#include <soc/romstage.h>
+#include <vboot_check.h>
+#include "onboard.h"
+
+#endif
diff --git a/src/mainboard/facebook/fbg1701/manifest.h b/src/mainboard/facebook/fbg1701/manifest.h
new file mode 100644
index 0000000..5a583f4
--- /dev/null
+++ b/src/mainboard/facebook/fbg1701/manifest.h
@@ -0,0 +1,35 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2018 Eltan B.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __MANIFEST_H__
+#define __MANIFEST_H__
+
+/**
+ * Make sure the index matches the actual order in the manifest generated
+ * using the HashCb.cmd file
+ */
+#define HASH_IDX_ROM_STAGE 0
+#define HASH_IDX_RAM_STAGE 1
+#define HASH_IDX_PAYLOAD 2
+#define HASH_IDX_OPROM 3
+#define HASH_IDX_FSP 4
+#define HASH_IDX_MICROCODE 5
+#define HASH_IDX_SPD0 6
+#define HASH_IDX_LOGO 7
+#define HASH_IDX_DSDT 8
+#define HASH_IDX_POSTCAR_STAGE 9
+#define HASH_IDX_BOOTBLOCK 10 /* Should always be the last one */
+
+#endif
diff --git a/src/mainboard/facebook/fbg1701/onboard.h b/src/mainboard/facebook/fbg1701/onboard.h
index d1fd050..330fe0f 100644
--- a/src/mainboard/facebook/fbg1701/onboard.h
+++ b/src/mainboard/facebook/fbg1701/onboard.h
@@ -33,4 +33,14 @@
#define CPLD_CMD_RESET_DSI_BRIDGE_ACTIVE 0x20
#define CPLD_CMD_RESET_DSI_BRIDGE_INACTIVE 0x00
+/* Define the items to be measured or verified */
+#define FSP (const char *)"fsp.bin"
+#define CMOS_LAYOUT (const char *)"cmos_layout.bin"
+#define RAMSTAGE (const char *)"fallback/ramstage"
+#define ROMSTAGE (const char *)"fallback/romstage"
+#define PAYLOAD (const char *)"fallback/payload"
+#define POSTCAR (const char *)"fallback/postcar"
+#define OP_ROM_VBT (const char *)"vbt.bin"
+#define MICROCODE (const char *)"cpu_microcode_blob.bin"
+
#endif
--
To view, visit https://review.coreboot.org/c/coreboot/+/33463
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I3ea0a95287977df0dea13e05acedd5406538a6ee
Gerrit-Change-Number: 33463
Gerrit-PatchSet: 1
Gerrit-Owner: Frans Hendriks <fhendriks(a)eltan.com>
Gerrit-MessageType: newchange
Nico Huber has uploaded this change for review. ( https://review.coreboot.org/c/libgfxinit/+/32730
Change subject: gma i2c: Rework GMBUS reset procedure
......................................................................
gma i2c: Rework GMBUS reset procedure
Once we tried to use the GMBUS controller with an unconnected pair of
I2C pins, it got stuck and a reset via the SOFTWARE_CLEAR_INTERRUPT
bit didn't suffice to recover. Further tests have shown that we are
able to recover, if we switch to a valid pin pair first and issue an
I2C stop cycle before the reset.
Change-Id: If737ffb35afa309de7746f0c16025b9598f69460
Signed-off-by: Nico Huber <nico.h(a)gmx.de>
---
M common/hw-gfx-gma-i2c.adb
1 file changed, 39 insertions(+), 31 deletions(-)
git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/30/32730/1
diff --git a/common/hw-gfx-gma-i2c.adb b/common/hw-gfx-gma-i2c.adb
index bc81734..3d41174 100644
--- a/common/hw-gfx-gma-i2c.adb
+++ b/common/hw-gfx-gma-i2c.adb
@@ -122,27 +122,39 @@
----------------------------------------------------------------------------
- procedure GMBUS_Ready (Result : out Boolean)
+ function GMBUS_Ready (GMBUS2 : Word32) return Boolean is
+ ((GMBUS2 and (GMBUS2_HARDWARE_WAIT_PHASE or
+ GMBUS2_SLAVE_STALL_TIMEOUT_ERROR or
+ GMBUS2_GMBUS_INTERRUPT_STATUS or
+ GMBUS2_NAK_INDICATOR or
+ GMBUS2_GMBUS_ACTIVE)) = 0);
+
+ procedure Check_And_Reset (Success : out Boolean)
is
GMBUS2 : Word32;
begin
- Registers.Read (GMBUS_Regs (2), GMBUS2);
- Result := (GMBUS2 and (GMBUS2_HARDWARE_WAIT_PHASE or
- GMBUS2_SLAVE_STALL_TIMEOUT_ERROR or
- GMBUS2_GMBUS_INTERRUPT_STATUS or
- GMBUS2_NAK_INDICATOR)) = 0;
- end GMBUS_Ready;
-
- procedure Reset_GMBUS (Success : out Boolean) is
- begin
pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
- Registers.Write (GMBUS_Regs (1), GMBUS1_SOFTWARE_CLEAR_INTERRUPT);
- Registers.Write (GMBUS_Regs (1), 0);
- Registers.Write (GMBUS_Regs (0), GMBUS0_PIN_PAIR_SELECT_NONE);
+ Registers.Read (GMBUS_Regs (2), GMBUS2);
+ if (GMBUS2 and GMBUS2_GMBUS_ACTIVE) /= 0 then
+ Registers.Write
+ (Register => GMBUS_Regs (1),
+ Value => GMBUS1_SOFTWARE_READY or GMBUS1_BUS_CYCLE_STOP);
+ Registers.Wait_Unset_Mask
+ (Register => GMBUS_Regs (2),
+ Mask => GMBUS2_GMBUS_ACTIVE,
+ TOut_MS => 1);
+ Registers.Read (GMBUS_Regs (2), GMBUS2);
+ end if;
+ Success := GMBUS_Ready (GMBUS2);
- GMBUS_Ready (Success);
- end Reset_GMBUS;
+ if not Success then
+ Registers.Write (GMBUS_Regs (1), GMBUS1_SOFTWARE_CLEAR_INTERRUPT);
+ Registers.Write (GMBUS_Regs (1), 0);
+ Registers.Read (GMBUS_Regs (2), GMBUS2);
+ Success := GMBUS_Ready (GMBUS2);
+ end if;
+ end Check_And_Reset;
procedure Init_GMBUS (Port : PCH_Port; Success : out Boolean) is
begin
@@ -157,23 +169,19 @@
-- TODO: Refactor + check for timeout.
Registers.Wait_Unset_Mask (GMBUS_Regs (2), GMBUS2_INUSE);
- GMBUS_Ready (Success);
- if not Success then
- Reset_GMBUS (Success);
- end if;
+ Registers.Write (GMBUS_Regs (4), 0);
+ Registers.Write (GMBUS_Regs (5), 0);
- if Success then
- Registers.Write
- (Register => GMBUS_Regs (0),
- Value => GMBUS0_GMBUS_RATE_SELECT_100KHZ or
- GMBUS0_PIN_PAIR_SELECT (Port));
- Registers.Write
- (Register => GMBUS_Regs (4),
- Value => 0);
- Registers.Write
- (Register => GMBUS_Regs (5),
- Value => 0);
- end if;
+ -- Resetting the state machine only works if a valid port
+ -- is selected and we don't always know which ports are
+ -- valid. So do the cleanup before we use the GMBUS with
+ -- the current port. If the port is valid, the reset should
+ -- work, if not, it shouldn't matter.
+ Registers.Write
+ (Register => GMBUS_Regs (0),
+ Value => GMBUS0_GMBUS_RATE_SELECT_100KHZ or
+ GMBUS0_PIN_PAIR_SELECT (Port));
+ Check_And_Reset (Success);
end Init_GMBUS;
procedure Release_GMBUS
--
To view, visit https://review.coreboot.org/c/libgfxinit/+/32730
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: libgfxinit
Gerrit-Branch: master
Gerrit-Change-Id: If737ffb35afa309de7746f0c16025b9598f69460
Gerrit-Change-Number: 32730
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-MessageType: newchange