summaryrefslogtreecommitdiffstats
path: root/src/hwpf
diff options
context:
space:
mode:
authorClaus Michael Olsen <cmolsen@us.ibm.com>2017-08-23 10:23:28 -0500
committerSachin Gupta <sgupta2m@in.ibm.com>2017-08-30 06:40:06 -0400
commit902c1c4cba786a5d3714ab297a5d605dc33e5d3b (patch)
tree40fc5a924e257df89472977a5e37ca28badaf8d6 /src/hwpf
parent00b05338bf315d05eca094eebf61a22b2783d3bc (diff)
downloadtalos-sbe-902c1c4cba786a5d3714ab297a5d605dc33e5d3b.tar.gz
talos-sbe-902c1c4cba786a5d3714ab297a5d605dc33e5d3b.zip
TOR magic header commit: Primer for commit 35372
To prevent a co-req situation between the HW image and the SBE image in connection with the merging of the TOR magic header commit 35372, the following code updates have been made: - Updated the TOR header file to define the data and structures needed on the ppe side in plat_ring_traverse.C to make SBE putRing code backward HW image compatible. Change-Id: I14cae65911938c4ae8e853ea9149f10e0d2fe9b8 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/45046 Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com> Reviewed-by: Richard J. Knight <rjknight@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/45049 Reviewed-by: Hostboot Team <hostboot@us.ibm.com> Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Diffstat (limited to 'src/hwpf')
-rw-r--r--src/hwpf/plat_ring_traverse.C168
1 files changed, 110 insertions, 58 deletions
diff --git a/src/hwpf/plat_ring_traverse.C b/src/hwpf/plat_ring_traverse.C
index 1a000e87..41ce2fe7 100644
--- a/src/hwpf/plat_ring_traverse.C
+++ b/src/hwpf/plat_ring_traverse.C
@@ -6,6 +6,7 @@
/* OpenPOWER sbe Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016,2017 */
+/* [+] International Business Machines Corp. */
/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
@@ -28,6 +29,7 @@
#include <sbeXipUtils.H>
#include <fapi2_attribute_service.H> // for FAPI_ATTR_GET
#include <plat_target_utils.H> // for plat_getChipTarget
+#include <p9_tor.H>
// SEEPROM start address
const uint32_t g_seepromAddr = SBE_SEEPROM_BASE_ORIGIN;
@@ -48,9 +50,9 @@ const uint32_t RISK_LEVEL_MODE = 1;
/// @return FAPI2_RC_SUCCESS on success, else error code.
///
fapi2::ReturnCode findRS4InImageAndApply(
- const fapi2::Target<fapi2::TARGET_TYPE_ALL>& i_target,
- const RingID i_ringID,
- const fapi2::RingMode i_ringMode)
+ const fapi2::Target<fapi2::TARGET_TYPE_ALL>& i_target,
+ const RingID i_ringID,
+ const fapi2::RingMode i_ringMode)
{
SBE_TRACE(">> findRS4InImageAndApply");
@@ -59,11 +61,11 @@ fapi2::ReturnCode findRS4InImageAndApply(
do
{
- //Apply scanring from .ring section
+ //Apply scanring from .ring section
// Get the address of the Section-TOR
- P9XipHeader *l_hdr = getXipHdr();
- P9XipSection *l_section =
+ P9XipHeader* l_hdr = getXipHdr();
+ P9XipSection* l_section =
&(l_hdr->iv_section[P9_XIP_SECTION_SBE_RINGS]);
if (!(l_section->iv_offset))
@@ -72,12 +74,32 @@ fapi2::ReturnCode findRS4InImageAndApply(
break;
}
- SectionTOR *l_sectionTOR = (SectionTOR *)(g_seepromAddr +
- l_section->iv_offset);
+ uint8_t l_torHdrSz;
+ P9_TOR::TorHeader_t* torHeader = (P9_TOR::TorHeader_t*)(g_seepromAddr +
+ l_section->iv_offset);
- l_rc = getRS4ImageFromTor(i_target,i_ringID,l_sectionTOR,
+ if (torHeader->magic == P9_TOR::TOR_MAGIC_SBE)
+ {
+ l_torHdrSz = sizeof(P9_TOR::TorHeader_t);
+ }
+ else
+ {
+ // Note that after the merge of this code and after the TOR
+ // magic merge on the HB side has settled down, the code
+ // inside these bracket will be replaced with the return of
+ // an error.
+ l_torHdrSz = 0;
+ SBE_TRACE("TOR magic header (=0x%08x) != TOR_MAGIC_SBE (=0x%08x)",
+ torHeader->magic, P9_TOR::TOR_MAGIC_SBE);
+ }
+
+ SectionTOR* l_sectionTOR = (SectionTOR*)(g_seepromAddr +
+ l_section->iv_offset +
+ l_torHdrSz);
+
+ l_rc = getRS4ImageFromTor(i_target, i_ringID, l_sectionTOR,
l_applyOverride,
- l_section->iv_offset,
+ l_section->iv_offset + l_torHdrSz,
i_ringMode);
if(l_rc != fapi2::FAPI2_RC_SUCCESS)
@@ -85,7 +107,7 @@ fapi2::ReturnCode findRS4InImageAndApply(
break;
}
- //Apply scanring from .ring section
+ //Apply scanring from .ring section
l_applyOverride = true;
l_section = NULL;
l_section =
@@ -98,26 +120,28 @@ fapi2::ReturnCode findRS4InImageAndApply(
}
l_sectionTOR = NULL;
- l_sectionTOR = (SectionTOR *)(g_seepromAddr +
- l_section->iv_offset);
+ l_sectionTOR = (SectionTOR*)(g_seepromAddr +
+ l_section->iv_offset +
+ l_torHdrSz);
- l_rc = getRS4ImageFromTor(i_target,i_ringID,l_sectionTOR,
+ l_rc = getRS4ImageFromTor(i_target, i_ringID, l_sectionTOR,
l_applyOverride,
- l_section->iv_offset,
+ l_section->iv_offset + l_torHdrSz,
i_ringMode);
- }while(0);
+ }
+ while(0);
return l_rc;
}
fapi2::ReturnCode getRS4ImageFromTor(
- const fapi2::Target<fapi2::TARGET_TYPE_ALL>& i_target,
- const RingID i_ringID,
- SectionTOR *i_sectionTOR,
- bool i_applyOverride,
- const uint32_t i_sectionOffset,
- const fapi2::RingMode i_ringMode)
+ const fapi2::Target<fapi2::TARGET_TYPE_ALL>& i_target,
+ const RingID i_ringID,
+ SectionTOR* i_sectionTOR,
+ bool i_applyOverride,
+ const uint32_t i_sectionOffset,
+ const fapi2::RingMode i_ringMode)
{
// Determine the Offset ID and Ring Type for the given Ring ID.
@@ -125,10 +149,12 @@ fapi2::ReturnCode getRS4ImageFromTor(
RINGTYPE l_ringType = COMMON_RING;
CHIPLET_TYPE l_chipLetType;
fapi2::ReturnCode l_rc = fapi2::FAPI2_RC_SUCCESS;
+
do
{
- getRingProperties(i_ringID, l_torOffset, l_ringType,l_chipLetType);
+ getRingProperties(i_ringID, l_torOffset, l_ringType, l_chipLetType);
+
if(INVALID_RING == l_torOffset)
{
SBE_TRACE("Invalid Ring ID - %d", i_ringID);
@@ -146,6 +172,7 @@ fapi2::ReturnCode getRS4ImageFromTor(
uint32_t l_sectionOffset = 0;
uint8_t l_CC_offset = 0;
uint8_t l_RL_offset = 1;
+
switch(l_chipLetType)
{
case PERV_TYPE: // PERV
@@ -155,6 +182,7 @@ fapi2::ReturnCode getRS4ImageFromTor(
sizeof(l_cpltRingVariantSz));
l_sectionOffset = i_sectionTOR->TOC_PERV_COMMON_RING;
+
if(INSTANCE_RING == l_ringType)
{
l_sectionOffset = i_sectionTOR->TOC_PERV_INSTANCE_RING;
@@ -166,9 +194,10 @@ fapi2::ReturnCode getRS4ImageFromTor(
l_chipletData = N0::g_n0Data;
l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
(sizeof(N0::RingVariants) /
- sizeof(l_cpltRingVariantSz));
+ sizeof(l_cpltRingVariantSz));
l_sectionOffset = i_sectionTOR->TOC_N0_COMMON_RING;
+
if(INSTANCE_RING == l_ringType)
{
l_sectionOffset = i_sectionTOR->TOC_N0_INSTANCE_RING;
@@ -180,9 +209,10 @@ fapi2::ReturnCode getRS4ImageFromTor(
l_chipletData = N1::g_n1Data;
l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
(sizeof(N1::RingVariants) /
- sizeof(l_cpltRingVariantSz));
+ sizeof(l_cpltRingVariantSz));
l_sectionOffset = i_sectionTOR->TOC_N1_COMMON_RING;
+
if(INSTANCE_RING == l_ringType)
{
l_sectionOffset = i_sectionTOR->TOC_N1_INSTANCE_RING;
@@ -193,10 +223,11 @@ fapi2::ReturnCode getRS4ImageFromTor(
case N2_TYPE: // Nest - N2
l_chipletData = N2::g_n2Data;
l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
- (sizeof(N2::RingVariants) /
- sizeof(l_cpltRingVariantSz));
+ (sizeof(N2::RingVariants) /
+ sizeof(l_cpltRingVariantSz));
l_sectionOffset = i_sectionTOR->TOC_N2_COMMON_RING;
+
if(INSTANCE_RING == l_ringType)
{
l_sectionOffset = i_sectionTOR->TOC_N2_INSTANCE_RING;
@@ -211,6 +242,7 @@ fapi2::ReturnCode getRS4ImageFromTor(
sizeof(l_cpltRingVariantSz));
l_sectionOffset = i_sectionTOR->TOC_N3_COMMON_RING;
+
if(INSTANCE_RING == l_ringType)
{
l_sectionOffset = i_sectionTOR->TOC_N3_INSTANCE_RING;
@@ -225,6 +257,7 @@ fapi2::ReturnCode getRS4ImageFromTor(
sizeof(l_cpltRingVariantSz));
l_sectionOffset = i_sectionTOR->TOC_XB_COMMON_RING;
+
if(INSTANCE_RING == l_ringType)
{
l_sectionOffset = i_sectionTOR->TOC_XB_INSTANCE_RING;
@@ -235,10 +268,11 @@ fapi2::ReturnCode getRS4ImageFromTor(
case MC_TYPE: // MC - MC23
l_chipletData = MC::g_mcData;
l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
- (sizeof(MC::RingVariants)/
- sizeof(l_cpltRingVariantSz));
+ (sizeof(MC::RingVariants) /
+ sizeof(l_cpltRingVariantSz));
l_sectionOffset = i_sectionTOR->TOC_MC_COMMON_RING;
+
if(INSTANCE_RING == l_ringType)
{
l_sectionOffset = i_sectionTOR->TOC_MC_INSTANCE_RING;
@@ -253,12 +287,14 @@ fapi2::ReturnCode getRS4ImageFromTor(
sizeof(l_cpltRingVariantSz));
l_sectionOffset = i_sectionTOR->TOC_OB0_COMMON_RING;
+
if(INSTANCE_RING == l_ringType)
{
l_sectionOffset = i_sectionTOR->TOC_OB0_INSTANCE_RING;
}
break;
+
case OB1_TYPE: // OB1
l_chipletData = OB1::g_ob1Data;
l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
@@ -266,32 +302,37 @@ fapi2::ReturnCode getRS4ImageFromTor(
sizeof(l_cpltRingVariantSz));
l_sectionOffset = i_sectionTOR->TOC_OB1_COMMON_RING;
+
if(INSTANCE_RING == l_ringType)
{
l_sectionOffset = i_sectionTOR->TOC_OB1_INSTANCE_RING;
}
break;
+
case OB2_TYPE: // OB2
l_chipletData = OB2::g_ob2Data;
l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
- (sizeof(OB2::RingVariants) /
- sizeof(l_cpltRingVariantSz));
+ (sizeof(OB2::RingVariants) /
+ sizeof(l_cpltRingVariantSz));
l_sectionOffset = i_sectionTOR->TOC_OB2_COMMON_RING;
+
if(INSTANCE_RING == l_ringType)
{
l_sectionOffset = i_sectionTOR->TOC_OB2_INSTANCE_RING;
}
break;
+
case OB3_TYPE: // OB3
l_chipletData = OB3::g_ob3Data;
l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
(sizeof(OB3::RingVariants) /
- sizeof(l_cpltRingVariantSz));
+ sizeof(l_cpltRingVariantSz));
l_sectionOffset = i_sectionTOR->TOC_OB3_COMMON_RING;
+
if(INSTANCE_RING == l_ringType)
{
l_sectionOffset = i_sectionTOR->TOC_OB3_INSTANCE_RING;
@@ -304,9 +345,10 @@ fapi2::ReturnCode getRS4ImageFromTor(
l_chipletData = PCI0::g_pci0Data;
l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
(sizeof(PCI0::RingVariants) /
- sizeof(l_cpltRingVariantSz));
+ sizeof(l_cpltRingVariantSz));
l_sectionOffset = i_sectionTOR->TOC_PCI0_COMMON_RING;
+
if(INSTANCE_RING == l_ringType)
{
l_sectionOffset = i_sectionTOR->TOC_PCI0_INSTANCE_RING;
@@ -318,9 +360,10 @@ fapi2::ReturnCode getRS4ImageFromTor(
l_chipletData = PCI1::g_pci1Data;
l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
(sizeof(PCI1::RingVariants) /
- sizeof(l_cpltRingVariantSz));
+ sizeof(l_cpltRingVariantSz));
l_sectionOffset = i_sectionTOR->TOC_PCI1_COMMON_RING;
+
if(INSTANCE_RING == l_ringType)
{
l_sectionOffset = i_sectionTOR->TOC_PCI1_INSTANCE_RING;
@@ -332,9 +375,10 @@ fapi2::ReturnCode getRS4ImageFromTor(
l_chipletData = PCI2::g_pci2Data;
l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
(sizeof(PCI2::RingVariants) /
- sizeof(l_cpltRingVariantSz));
+ sizeof(l_cpltRingVariantSz));
l_sectionOffset = i_sectionTOR->TOC_PCI2_COMMON_RING;
+
if(INSTANCE_RING == l_ringType)
{
l_sectionOffset = i_sectionTOR->TOC_PCI2_INSTANCE_RING;
@@ -347,11 +391,12 @@ fapi2::ReturnCode getRS4ImageFromTor(
l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
( sizeof(EQ::RingVariants) /
sizeof(l_cpltRingVariantSz));
-
+
l_sectionOffset = i_sectionTOR->TOC_EQ_COMMON_RING;
l_CC_offset = 1;
l_RL_offset = 2;
+
if(INSTANCE_RING == l_ringType)
{
l_sectionOffset = i_sectionTOR->TOC_EQ_INSTANCE_RING;
@@ -368,6 +413,7 @@ fapi2::ReturnCode getRS4ImageFromTor(
l_sectionOffset = i_sectionTOR->TOC_EC_COMMON_RING;
l_CC_offset = 1;
l_RL_offset = 2;
+
if(INSTANCE_RING == l_ringType)
{
l_sectionOffset = i_sectionTOR->TOC_EC_INSTANCE_RING;
@@ -387,14 +433,14 @@ fapi2::ReturnCode getRS4ImageFromTor(
break;
}
- FAPI_INF("l_sectionOffset %08x",l_sectionOffset);
+ FAPI_INF("l_sectionOffset %08x", l_sectionOffset);
// Determine the section TOR address for the ring
- uint32_t *l_sectionAddr = reinterpret_cast<uint32_t *>(g_seepromAddr +
+ uint32_t* l_sectionAddr = reinterpret_cast<uint32_t*>(g_seepromAddr +
i_sectionOffset + l_sectionOffset);
- SBE_TRACE ("l_sectionAddr %08X",(uint32_t)l_sectionAddr);
+ SBE_TRACE ("l_sectionAddr %08X", (uint32_t)l_sectionAddr);
- uint16_t *l_ringTorAddr = NULL;
+ uint16_t* l_ringTorAddr = NULL;
if(INSTANCE_RING == l_ringType)
@@ -403,31 +449,33 @@ fapi2::ReturnCode getRS4ImageFromTor(
{
uint8_t l_chipletOffset =
(l_chipletID - l_chipletData.iv_base_chiplet_number);
+
if (l_chipLetType == EQ_TYPE)
{
if (fapi2::TARGET_TYPE_EX & (i_target.get().getFapiTargetType()))
{
uint32_t l_ex_number = i_target.get().getTargetInstance();
l_chipletOffset = l_ex_number;
- SBE_TRACE ("l_chipletID %d l_ex_number %d",l_chipletID,l_ex_number);
+ SBE_TRACE ("l_chipletID %d l_ex_number %d", l_chipletID, l_ex_number);
}
}
- SBE_TRACE ("l_chipletID %u l_chipletOffset %u",l_chipletID, l_chipletOffset);
- l_ringTorAddr = reinterpret_cast<uint16_t *>(l_sectionAddr )+ ((l_chipletOffset *
- (l_chipletData.iv_num_instance_rings *l_cpltRingVariantSz)) + (l_torOffset * l_cpltRingVariantSz));
+
+ SBE_TRACE ("l_chipletID %u l_chipletOffset %u", l_chipletID, l_chipletOffset);
+ l_ringTorAddr = reinterpret_cast<uint16_t*>(l_sectionAddr ) + ((l_chipletOffset *
+ (l_chipletData.iv_num_instance_rings * l_cpltRingVariantSz)) + (l_torOffset * l_cpltRingVariantSz));
}
else
{
- l_ringTorAddr = reinterpret_cast<uint16_t *>(l_sectionAddr) +
- (l_torOffset * l_cpltRingVariantSz);
+ l_ringTorAddr = reinterpret_cast<uint16_t*>(l_sectionAddr) +
+ (l_torOffset * l_cpltRingVariantSz);
}
}
else
{
// TOR records of Ring TOR are 2 bytes in size.
- l_ringTorAddr = reinterpret_cast<uint16_t *>(l_sectionAddr) +
- (l_torOffset * l_cpltRingVariantSz);
+ l_ringTorAddr = reinterpret_cast<uint16_t*>(l_sectionAddr) +
+ (l_torOffset * l_cpltRingVariantSz);
}
// The ring variants in section TOR are expected to be in the sequence -
@@ -436,7 +484,7 @@ fapi2::ReturnCode getRS4ImageFromTor(
// 3. Risk Level
- SBE_TRACE ("ring tor address %08X",(uint32_t)l_ringTorAddr);
+ SBE_TRACE ("ring tor address %08X", (uint32_t)l_ringTorAddr);
// If there are non-base variants of the ring, we'll have to check
// attributes to determine the sequence of ring apply.
@@ -463,6 +511,7 @@ fapi2::ReturnCode getRS4ImageFromTor(
FAPI_ATTR_GET(fapi2::ATTR_RISK_LEVEL,
fapi2::Target<fapi2::TARGET_TYPE_SYSTEM> (),
l_riskLevel);
+
if((RISK_LEVEL_MODE == l_riskLevel) &&
*(l_ringTorAddr + l_RL_offset))
{
@@ -471,15 +520,17 @@ fapi2::ReturnCode getRS4ImageFromTor(
}
}
- SBE_TRACE("l_ringTorAddr %u",*l_ringTorAddr);
+ SBE_TRACE("l_ringTorAddr %u", *l_ringTorAddr);
+
if(*l_ringTorAddr != 0)
{
- uint8_t *l_addr = reinterpret_cast<uint8_t *>(l_sectionAddr);
- uint8_t *l_rs4Address = reinterpret_cast<uint8_t *>
+ uint8_t* l_addr = reinterpret_cast<uint8_t*>(l_sectionAddr);
+ uint8_t* l_rs4Address = reinterpret_cast<uint8_t*>
(l_addr + *l_ringTorAddr);
- SBE_TRACE("l_rs4Address %08x",(uint32_t)l_rs4Address);
- l_rc = rs4DecompressionSvc(i_target,l_rs4Address,
- i_applyOverride,i_ringMode,l_ringType);
+ SBE_TRACE("l_rs4Address %08x", (uint32_t)l_rs4Address);
+ l_rc = rs4DecompressionSvc(i_target, l_rs4Address,
+ i_applyOverride, i_ringMode, l_ringType);
+
if(l_rc != fapi2::FAPI2_RC_SUCCESS)
{
SBE_TRACE("Error from applyRS4_SS");
@@ -488,11 +539,12 @@ fapi2::ReturnCode getRS4ImageFromTor(
}
else
{
- SBE_TRACE("Ring image is not found for this is ringId %u",i_ringID);
+ SBE_TRACE("Ring image is not found for this is ringId %u", i_ringID);
}
- }while(0);
+ }
+ while(0);
- SBE_TRACE("<< findRS4InImageAndApply Exit for ringId %d",i_ringID);
+ SBE_TRACE("<< findRS4InImageAndApply Exit for ringId %d", i_ringID);
return l_rc;
}
OpenPOWER on IntegriCloud