<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi Ben,</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Thanks for your answer! I've been able to trace the '<span>DxeTpm2MeasureBootHandler</span>' calls and it's called for each</p>
<p style="margin-top:0;margin-bottom:0">loaded driver, the GPT table parsing and PeImage loading. Making a full coreboot and tianocore recompiling has</p>
<p style="margin-top:0;margin-bottom:0">changed the extended values. The tianocore uses PCRs 1, 4, 5 and 7. Changing the boot media from USB device</p>
<p style="margin-top:0;margin-bottom:0">to SATA device changes the PCR5 value. I think it's all working ok.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Relating to the TPM device not sufficiently initialized and your side note, maybe is related to the message I get in</p>
<p style="margin-top:0;margin-bottom:0">dmesg:</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"></p>
<div>[    0.390995] tpm_tis 00:02: 2.0 TPM (device-id 0x1A, rev-id 16)<br>
[    0.399957] tpm tpm0: A TPM error (2314) occurred attempting the self test<br>
<br>
</div>
The ACPI table from dmesg is:<br>
<p></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"></p>
<div>[    0.000000] Secure boot could not be determined<br>
[    0.000000] RAMDISK: [mem 0x373bf000-0x379d6fff]<br>
[    0.000000] ACPI: Early table checksum verification disabled<br>
[    0.000000] ACPI: RSDP 0x000000008FDE9000 000024 (v02 CORE  )<br>
[    0.000000] ACPI: XSDT 0x000000008FDE90E0 00006C (v01 CORE   COREBOOT 00000000 CORE 00000000)<br>
[    0.000000] ACPI: FACP 0x000000008FDEACA0 0000F4 (v04 CORE   COREBOOT 00000000 CORE 00000000)<br>
[    0.000000] ACPI: DSDT 0x000000008FDE9280 001A11 (v02 AMD    COREBOOT 00010001 INTL 20161222)<br>
[    0.000000] ACPI: FACS 0x000000008FDE9240 000040<br>
[    0.000000] ACPI: SSDT 0x000000008FDEADA0 0001E1 (v02 CORE   COREBOOT 0000002A CORE 0000002A)<br>
[    0.000000] ACPI: TCPA 0x000000008FDEAF90 000032 (v02 CORE   COREBOOT 00000000 CORE 00000000)<br>
[    0.000000] ACPI: APIC 0x000000008FDEAFD0 00007E (v01 CORE   COREBOOT 00000000 CORE 00000000)<br>
[    0.000000] ACPI: VFCT 0x000000008FDEB050 00FC69 (v01 CORE   COREBOOT 00000000 CORE 00000000)<br>
[    0.000000] ACPI: HPET 0x000000008FDFACC0 000038 (v01 CORE   COREBOOT 00000000 CORE 00000000)<br>
[    0.000000] ACPI: HEST 0x000000008FDFAD00 000028 (v01 CORE   COREBOOT 00000000 CORE 00000000)<br>
[    0.000000] ACPI: SSDT 0x000000008FDFAD30 00873A (v02 AMD    AGESA    00000002 MSFT 04000000)<br>
[    0.000000] ACPI: SSDT 0x000000008FE03470 000854 (v01 AMD    AGESA    00000001 AMD  00000001)<br>
[    0.000000] ACPI: Local APIC address 0xfee00000<br>
<br>
</div>
The ACPI table I get from a different board with closed source BIOS/UEFI but the same processor:
<p></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"></p>
<div>[    0.000000] Secure boot could not be determined<br>
[    0.000000] RAMDISK: [mem 0x373bf000-0x379d6fff]<br>
[    0.000000] ACPI: Early table checksum verification disabled<br>
[    0.000000] ACPI: RSDP 0x00000000E4620000 000024 (v02 ALASKA)<br>
[    0.000000] ACPI: XSDT 0x00000000E4620088 00008C (v01 ALASKA A M I    01072009 AMI  00010013)<br>
[    0.000000] ACPI: FACP 0x00000000E46282F8 000114 (v06 ALASKA A M I    01072009 AMI  00010013)<br>
[    0.000000] ACPI BIOS Warning (bug): Optional FADT field Pm2ControlBlock has valid Length but zero Address: 0x0000000000000000/0x1 (20180313/tbfadt-624<br>
)<br>
[    0.000000] ACPI: DSDT 0x00000000E46201A8 008149 (v02 ALASKA A M I    01072009 INTL 20120913)<br>
[    0.000000] ACPI: FACS 0x00000000E594EF00 000040<br>
[    0.000000] ACPI: APIC 0x00000000E4628410 00007E (v03 ALASKA A M I    01072009 AMI  00010013)<br>
[    0.000000] ACPI: FPDT 0x00000000E4628490 000044 (v01 ALASKA A M I    01072009 AMI  00010013)<br>
[    0.000000] ACPI: FIDT 0x00000000E46284D8 00009C (v01 ALASKA A M I    01072009 AMI  00010013)<br>
[    0.000000] ACPI: MCFG 0x00000000E4628578 00003C (v01 ALASKA A M I    01072009 MSFT 00010013)<br>
[    0.000000] ACPI: HPET 0x00000000E46285B8 000038 (v01 ALASKA A M I    01072009 AMI  00000005)<br>
[    0.000000] ACPI: UEFI 0x00000000E46285F0 000042 (v01                 00000000      00000000)<br>
[    0.000000] ACPI: TPM2 0x00000000E4628638 000034 (v03 ALASKA A M I    00000001 AMI  00000000)<br>
[    0.000000] ACPI: SSDT 0x00000000E4628670 000614 (v01 AMD    AGESA    00000001 AMD  00000001)<br>
[    0.000000] ACPI: SSDT 0x00000000E4628C88 004B5B (v02 AMD    AGESA    00000002 MSFT 04000000)<br>
[    0.000000] ACPI: CRAT 0x00000000E462D7E8 0002E8 (v01 AMD    AGESA    00000001 AMD  00000001)<br>
[    0.000000] ACPI: SSDT 0x00000000E462DAD0 00165E (v01 AMD    CPMCMN   00000001 INTL 20120913)<br>
[    0.000000] ACPI: WSMT 0x00000000E462F130 000028 (v01 ALASKA A M I    01072009 AMI  00010013)<br>
[    0.000000] ACPI: Local APIC address 0xfee00000<br>
...<br>
[    0.557556] tpm_tis MSFT0101:00: 2.0 TPM (device-id 0x1A, rev-id 16)<br>
<br>
</div>
Where you can see an entry related to TPM2<br>
<p></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<div>[    0.000000] ACPI: TPM2 0x00000000E4628638 000034 (v03 ALASKA A M I    00000001 AMI  00000000)<br>
</div>
</div>
<div dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<br>
</div>
<div dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
and no error related to TPM2 initialization... It seems all is working ok, but I'll take a look to your side note.</div>
<div dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<br>
</div>
<div dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
Thanks!</div>
<div dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
Jorge<br>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>De:</b> You, Benjamin <benjamin.you@intel.com><br>
<b>Enviado:</b> martes, 25 de septiembre de 2018 8:29:39<br>
<b>Para:</b> Jorge Fernandez Monteagudo; coreboot@coreboot.org<br>
<b>Asunto:</b> RE: [coreboot] Tianocore and TPM</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Hi Jorge,<br>
<br>
Not sure what caused the issue with PCR values ... I am not an expert in TPM. I guess following might be looked at:<br>
<br>
- Is it possible that the TPM device is not sufficiently initialized?<br>
- I noticed SecurityPkg/Library/DxeTpm2MeasureBootLib contains a function DxeTpm2MeasureBootHandler() that measures EDK II drivers. You might trace this function to see if it runs correctly and PCRs are extended successfully for each loaded driver.<br>
<br>
A side note (not related to this issue) is on parsing TPM info from ACPI tables produced by Coreboot:
<br>
- The Coreboot Module Package in edk2 repo does *NOT* have the TPM parsing logic. You might refer to ParseTpmTable() in UEFI Payload in edk2-staging repo for codes that do this.<br>
<br>
Thanks,<br>
<br>
- ben<br>
<br>
From: Jorge Fernandez Monteagudo [<a href="mailto:jorgefm@cirsa.com">mailto:jorgefm@cirsa.com</a>]
<br>
Sent: Monday, September 24, 2018 5:36 PM<br>
To: You, Benjamin <benjamin.you@intel.com>; coreboot@coreboot.org<br>
Subject: Re: [coreboot] Tianocore and TPM<br>
<br>
Hi Ben,<br>
<br>
Changing gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid do the trick! Now when I boot my system I can see the PCRs 0 to 9 populated.<br>
<br>
I have some questions regarding the values I see in the PCRs (different versions of coreboot+tianocore populate the PCRs0-7 with the same values)<br>
but I'll ask in the UEFI/EDKII mailing list.<br>
<br>
Attached are the  changes I've imported into the tianocore master branch to make it works, if someone else wants to play with it...<br>
<br>
Thanks for your help! <br>
Jorge<br>
________________________________________<br>
De: You, Benjamin <benjamin.you@intel.com><br>
Enviado: sábado, 22 de septiembre de 2018 5:33:30<br>
Para: Jorge Fernandez Monteagudo; coreboot@coreboot.org<br>
Asunto: RE: [coreboot] Tianocore and TPM <br>
 <br>
Hi Jorge,<br>
<br>
Could you please try setting gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid to the expected value (0x286bf ...) in your .dsc file? Since there has been a change of the Tmp2IntanceLib, this GUID setting has to be changed accordingly.<br>
<br>
Since these are generic UEFI / EDKII questions and not Coreboot payload specific, could you please try posting further questions to the EDKII mailing list (<a href="https://lists.01.org/mailman/listinfo/edk2-devel">https://lists.01.org/mailman/listinfo/edk2-devel</a>)?
 -- there are much more EDKII expertise there.<br>
<br>
Thanks,<br>
<br>
- ben<br>
<br>
From: Jorge Fernandez Monteagudo [<a href="mailto:jorgefm@cirsa.com">mailto:jorgefm@cirsa.com</a>]
<br>
Sent: Friday, September 21, 2018 10:04 PM<br>
To: You, Benjamin <benjamin.you@intel.com>; coreboot@coreboot.org<br>
Subject: Re: [coreboot] Tianocore and TPM<br>
<br>
Hi Benjamin,<br>
<br>
Enabling debug messages I've found something:<br>
<br>
Loading driver FDFF263D-5F68-4591-87BA-B768F445A9AF<br>
InstallProtocolInterface: 5B1B31A1-9562-11D2-8E3F-00A0C969723B 8F3EE7C0<br>
    PDB = /mnt/develop/bettong/coreboot/master/coreboot_tiano_master/payloads/external/tianocore/tianocore/Build/CorebootPayloadPkgX64/DEBUG_COREBOOT/X64/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe/DEBUG/Tcg2Dxe.dll<br>
Loading driver at 0x0008F3D2000 EntryPoint=0x0008F3D2240 Tcg2Dxe.efi<br>
InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF 8F3EEA18<br>
ProtectUefiImageCommon - 0x8F3EE7C0<br>
  - 0x000000008F3D2000 - 0x000000000000D800<br>
PROGRESS CODE: V03040002 I0<br>
WARNING: Tpm2RegisterTpm2DeviceLib - does not support 286BF25A-C2C3-408C-B3B4-25E6758B7317 registration<br>
TPM2 not detected!<br>
Error: Image at 0008F3D2000 start failed: Unsupported<br>
    PDB = /mnt/develop/bettong/coreboot/master/coreboot_tiano_master/payloads/external/tianocore/tianocore/Build/CorebootPayloadPkgX64/DEBUG_COREBOOT/X64/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe/DEBUG/Tcg2Dxe.dll<br>
PROGRESS CODE: V03040003 I0<br>
I'll try to find more info about this warning and I'll try to see the code where the TPM2 is detected in the edk2-staging branch<br>
<br>
<br>
________________________________________<br>
De: coreboot <coreboot-bounces@coreboot.org> en nombre de Jorge Fernandez Monteagudo <jorgefm@cirsa.com><br>
Enviado: viernes, 21 de septiembre de 2018 13:01:23<br>
Para: You, Benjamin; coreboot@coreboot.org<br>
Asunto: Re: [coreboot] Tianocore and TPM <br>
 <br>
Hi,<br>
<br>
I'll try modifying the Setup/Miscs/Setup.ini from CustomizationSample/Boards/Qemu to enable ftpm<br>
and generate an external payload but when boot with this coreboot.rom flashed I only get a black<br>
screen once the tianocore is executed with the next traces:<br>
<br>
BS: BS_PAYLOAD_LOAD times (us): entry 0 run 101395 exit 0                                                                                                                  <br>
Jumping to boot code at 006009a0(8fe0f000)                                                                                                                                 <br>
CPU0: stack: 8ff20000 - 8ff21000, lowest used address 8ff205e0, stack used: 2592 bytes                                                                                     <br>
PROGRESS CODE: V03020003 I0                                                                                                                                                <br>
PROGRESS CODE: V03020002 I0                                                                                                                                                <br>
PROGRESS CODE: V03020003 I0                                                                                                                                                <br>
PROGRESS CODE: V03020002 I0                                                                                                                                                <br>
PROGRESS CODE: V03020003 I0                                                                                                                                                <br>
PROGRESS CODE: V03021001 I0                                                                                                                                                <br>
PROGRESS CODE: V03040003 I0                                                                                                                                                <br>
PROGRESS CODE: V03040002 I0                                                                                                                                                <br>
PROGRESS CODE: V03040003 I0                                                                                                                                                <br>
PROGRESS CODE: V03040002 I0                                                                                                                                                <br>
<br>
I've tried mixing the dsc, dec and fdf files from the edk2-staging and the CorebootPayloadPkg ones but
<br>
no TPM menu in the device manager menu is shown. I'm using <br>
<br>
NULL|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.inf <br>
<br>
instead of<br>
<br>
NULL|UefiPayloadPkg/Library/Tpm2InstanceLib/Tpm2InstanceLib.inf<br>
<br>
Is it correct? Or I have to integrate this library in the CorebootPayloadPkg?<br>
<br>
Now I'm trying with the tianocore master version instead of the stable one.<br>
<br>
Do you know if there is a TPM menu shown in the device manager menu once is detected? How the TPM2 is detected?<br>
Do you have a "generic" CustomizationSample/Board?<br>
<br>
I think it's more complicated that I expected!<br>
<br>
Any hint is welcome!<br>
Jorge<br>
________________________________________<br>
De: coreboot <coreboot-bounces@coreboot.org> en nombre de Jorge Fernandez Monteagudo <jorgefm@cirsa.com><br>
Enviado: jueves, 20 de septiembre de 2018 10:31:20<br>
Para: You, Benjamin; coreboot@coreboot.org<br>
Asunto: Re: [coreboot] Tianocore and TPM <br>
 <br>
Hi Ben,<br>
<br>
Adding the 'generic' board it's an interesting option as a starting point to develop/porting to new boards.<br>
<br>
I'll try your suggestion to incorporate the changes from dsc and fdf files to my current working Tianocore coreboot payload.<br>
I'll report back the results!<br>
<br>
Thanks!<br>
Jorge<br>
<br>
<br>
________________________________________<br>
De: You, Benjamin <benjamin.you@intel.com><br>
Enviado: jueves, 20 de septiembre de 2018 10:21:55<br>
Para: Jorge Fernandez Monteagudo; coreboot@coreboot.org<br>
Asunto: RE: [coreboot] Tianocore and TPM <br>
 <br>
Hi Jorge,<br>
<br>
You could use UEFI Payload's .dsc and .fdf files as a reference and modify the TianoCore CorebootPayload's .dsc and .fdf files accordingly for those TPM related modules.<br>
<br>
UEFI Payload is under development (in staging area) and hasn't reached the quality standard required by EDKII master.
<br>
<br>
On CustomizationSample/Boards, yes it is required. However, a board's content may be trivial (as in the Qemu folder). Per your suggestion, probably we can add a board named "generic" that has all the minimalized settings so user won't have to create a new one
 if the "generic" one meets the needs.<br>
<br>
Thanks!<br>
<br>
- ben<br>
<br>
From: Jorge Fernandez Monteagudo [<a href="mailto:jorgefm@cirsa.com">mailto:jorgefm@cirsa.com</a>]
<br>
Sent: Thursday, September 20, 2018 3:24 PM<br>
To: You, Benjamin <benjamin.you@intel.com>; coreboot@coreboot.org<br>
Subject: Re: Tianocore and TPM<br>
<br>
Hi Ben!<br>
<br>
Thanks for the info! I have one question. Have I to implement a CustomizationSample/Boards for my board? With the current<br>
tianocore payload I don't have to implement nothing to have a working UEFI...<br>
<br>
Thanks!<br>
Jorge<br>
<br>
<br>
________________________________________<br>
De: You, Benjamin <benjamin.you@intel.com><br>
Enviado: jueves, 20 de septiembre de 2018 3:42:33<br>
Para: Jorge Fernandez Monteagudo; coreboot@coreboot.org<br>
Asunto: RE: Tianocore and TPM <br>
 <br>
Hi, <br>
<br>
Another note is on the use of NULL|UefiPayloadPkg/Library/Tpm2InstanceLib/Tpm2InstanceLib.inf. This lib is not fully populated right now.<br>
<br>
Please consider using  NULL|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.inf depending on your needs.<br>
<br>
Thanks,<br>
<br>
- ben<br>
<br>
From: coreboot [<a href="mailto:coreboot-bounces@coreboot.org">mailto:coreboot-bounces@coreboot.org</a>] On Behalf Of You, Benjamin<br>
Sent: Thursday, September 20, 2018 8:44 AM<br>
To: Jorge Fernandez Monteagudo <jorgefm@cirsa.com>; coreboot@coreboot.org<br>
Subject: Re: [coreboot] Tianocore and TPM<br>
<br>
Hi Jorge,<br>
<br>
The staging UEFI Payload project (<a href="https://github.com/tianocore/edk2-staging/tree/UEFIPayload">https://github.com/tianocore/edk2-staging/tree/UEFIPayload</a>) has TPM support (although turned off by default, and using "FTPM" as the name (which needs
 to be fixed)).<br>
<br>
Please have a look at UefiPayloadPkgIA32X64.dsc for the components under tag "$(FTPM_ENABLE)". These components mainly do the measuring of firmware components and log the results.<br>
<br>
Also there is parsing logic in Library/PlatformInfoParseLib/ParseLib.c that parses TPM info in ACPI table passed from Coreboot. (This logic hasn't been sufficiently verified as this is still a "staging" project).<br>
<br>
You might have a try. Please let us know if you see any bugs / problems in these. You might also use the EDKII mailing list for discussing issues with the UEFI Payload.<br>
<br>
Thanks,<br>
<br>
- ben<br>
<br>
<br>
<br>
From: coreboot [<a href="mailto:coreboot-bounces@coreboot.org">mailto:coreboot-bounces@coreboot.org</a>] On Behalf Of Jorge Fernandez Monteagudo<br>
Sent: Wednesday, September 19, 2018 5:24 PM<br>
To: coreboot@coreboot.org<br>
Subject: [coreboot] Tianocore and TPM<br>
<br>
Hi all!<br>
<br>
I'm trying to enable the TPM2 support in the tianocore payload. The TPM2 device is working, because I've enabled the DEBUG_TPM and coreboot reports is up. I guess that I have to modify the 'CorebootPayloadPkgIa32X64.dsc' file to enable the TPM support but there
 are so many dependencies. Anybody has a working tianocore payload with TPM?<br>
<br>
Thanks!<br>
</div>
</span></font></div>
</body>
</html>