Skip to content

Commit 584690f

Browse files
committed
Fixed TPM romstage measurements.
1 parent 41e5301 commit 584690f

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
diff --git ./src/northbridge/intel/sandybridge/romstage.c ./src/northbridge/intel/sandybridge/romstage.c
2+
index 0426b83..d348b9e 100644
3+
--- ./src/northbridge/intel/sandybridge/romstage.c
4+
+++ ./src/northbridge/intel/sandybridge/romstage.c
5+
@@ -29,6 +29,8 @@
6+
#include <device/device.h>
7+
#include <halt.h>
8+
#include <security/tpm/tis.h>
9+
+#include <security/tpm/tss.h>
10+
+#include <program_loading.h>
11+
#include <northbridge/intel/sandybridge/chip.h>
12+
#include "southbridge/intel/bd82x6x/pch.h"
13+
#include <southbridge/intel/common/gpio.h>
14+
@@ -72,6 +74,19 @@ void mainboard_romstage_entry(unsigned long bist)
15+
/* Initialize superio */
16+
mainboard_config_superio();
17+
18+
+ if (IS_ENABLED(CONFIG_MEASURED_BOOT) && IS_ENABLED(CONFIG_LPC_TPM)) {
19+
+ // we don't know if we are coming out of a resume
20+
+ // at this point, but want to setup the tpm ASAP
21+
+ init_tpm(0);
22+
+ tlcl_lib_init();
23+
+ const void * const bootblock = (const void*) 0xFFFFF800;
24+
+ const unsigned bootblock_size = 0x800;
25+
+ tlcl_measure(0, bootblock, bootblock_size);
26+
+
27+
+ extern char _romstage, _eromstage;
28+
+ tlcl_measure(1, _romstage, _eromstage - _romstage);
29+
+ }
30+
+
31+
/* USB is initialized in MRC if MRC is used. */
32+
if (CONFIG_USE_NATIVE_RAMINIT) {
33+
early_usb_init(mainboard_usb_ports);
34+
@@ -117,9 +132,23 @@ void mainboard_romstage_entry(unsigned long bist)
35+
36+
northbridge_romstage_finalize(s3resume);
37+
38+
- if (IS_ENABLED(CONFIG_LPC_TPM)) {
39+
+ // the normal TPM init happens here, if we haven't already
40+
+ // set it up as part of the measured boot.
41+
+ if (!IS_ENABLED(CONFIG_MEASURED_BOOT) && IS_ENABLED(CONFIG_LPC_TPM)) {
42+
init_tpm(s3resume);
43+
}
44+
45+
+ printk(BIOS_DEBUG, "%s: romstage complete\n", __FILE__);
46+
+
47+
post_code(0x3f);
48+
}
49+
+
50+
+
51+
+void platform_segment_loaded(uintptr_t start, size_t size, int flags)
52+
+{
53+
+ if (IS_ENABLED(CONFIG_MEASURED_BOOT) && !(flags & SEG_NO_MEASURE))
54+
+ {
55+
+ tlcl_measure(2, (const void*) start, size);
56+
+ }
57+
+}
58+
+

0 commit comments

Comments
 (0)