From ca9007fb2efce09d6bdaf85615e585c524414fab Mon Sep 17 00:00:00 2001 From: Mike Baiocchi Date: Tue, 25 Jun 2019 16:17:46 -0500 Subject: Add Support for new HDAT Slave Device Type for Nuvoton 75x The new HDAT spec added a new 'TCG_i2c_TPM' Slave Device Type for the Host I2C Device Entry Structure. This commit adds the use of it for Nuvoton 75x support. Change-Id: I01f75c919f255786e5b32dcde9b86b2e15d33986 RTC:204133 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/79527 Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: Nicholas E. Bofferding Reviewed-by: Ilya Smirnov Reviewed-by: Daniel M. Crowell --- src/usr/i2c/i2c.C | 9 ++--- src/usr/targeting/common/processMrw.pl | 17 +++++++++ .../targeting/common/xmltohb/attribute_types.xml | 40 ++++++++++++++++++++++ 3 files changed, 62 insertions(+), 4 deletions(-) diff --git a/src/usr/i2c/i2c.C b/src/usr/i2c/i2c.C index 8be749230..bf0560e73 100755 --- a/src/usr/i2c/i2c.C +++ b/src/usr/i2c/i2c.C @@ -5499,20 +5499,21 @@ void getDeviceInfo( TARGETING::Target* i_i2cMaster, l_currentDI.slavePort = 0xFF; l_currentDI.busFreqKhz = (tpmInfo.busFreq) / FREQ_CONVERSION::HZ_PER_KHZ; - l_currentDI.deviceType = - TARGETING::HDAT_I2C_DEVICE_TYPE_NUVOTON_TPM; l_currentDI.devicePurpose = TARGETING::HDAT_I2C_DEVICE_PURPOSE_TPM; - - // Read TPM Model attribute to determine the label + // Read TPM Model attribute to determine some values if (tpmInfo.model == TPMDD::TPM_MODEL_65x) { strcpy(l_currentDI.deviceLabel,"?nuvoton,npct601,tpm,host"); + l_currentDI.deviceType = + TARGETING::HDAT_I2C_DEVICE_TYPE_NUVOTON_TPM; } else if (tpmInfo.model == TPMDD::TPM_MODEL_75x) { strcpy(l_currentDI.deviceLabel,"?tcg,tpm_i2c_ptp,tpm,host"); + l_currentDI.deviceType = + TARGETING::HDAT_I2C_DEVICE_TYPE_TCG_I2C_TPM; } else { diff --git a/src/usr/targeting/common/processMrw.pl b/src/usr/targeting/common/processMrw.pl index 744eda2ef..24759589c 100755 --- a/src/usr/targeting/common/processMrw.pl +++ b/src/usr/targeting/common/processMrw.pl @@ -2952,6 +2952,23 @@ sub processI2C { $type = "0xFF"; } + # TPM types can vary by MODEL number + elsif ($type_str eq "NUVOTON_TPM") + { + # Model values can be found in tpmddif.H and are kept in + # sync with TPM_MODEL attribute in attribute_types_hb.xml + my $tpm_model = $targetObj->getAttribute($i2c->{DEST_PARENT},"TPM_MODEL"); + if ($tpm_model eq 1) + { + $type = $targetObj->getEnumValue("HDAT_I2C_DEVICE_TYPE",$type_str); + } + if ($tpm_model eq 2) + { + # @TODO RTC 212201 use proper enum when .xml supports it + #$type = $targetObj->getEnumValue("HDAT_I2C_DEVICE_TYPE","TCG_I2C_TPM"); + $type = 0x15; + } + } else { $type = $targetObj->getEnumValue("HDAT_I2C_DEVICE_TYPE",$type_str); diff --git a/src/usr/targeting/common/xmltohb/attribute_types.xml b/src/usr/targeting/common/xmltohb/attribute_types.xml index cce773a1e..ff9abf83b 100644 --- a/src/usr/targeting/common/xmltohb/attribute_types.xml +++ b/src/usr/targeting/common/xmltohb/attribute_types.xml @@ -2269,6 +2269,46 @@ SEEPROM_Atmel28c256 0xB + + THERMAL_SENSOR + 0x0C + + + SEEPROM_Atmel24c04 + 0x0D + + + SEEPROM_Atmel24c412 + 0x0E + + + SEEPROM_Atmel24c32 + 0x0F + + + SEEPROM_Atmel24c64 + 0x10 + + + SEEPROM_Atmel24c16 + 0x11 + + + NVDIA_GPU + 0x12 + + + NXP_LPC_Microcontroller_LPC11U35 + 0x13 + + + 9550 + 0x14 + + + TCG_I2C_TPM + 0x15 + UNKNOWN 0xFF -- cgit v1.2.1