summaryrefslogtreecommitdiffstats
path: root/src/import/chips/common
diff options
context:
space:
mode:
authorClaus Michael Olsen <cmolsen@us.ibm.com>2018-01-24 17:48:37 -0600
committerChristian R. Geddes <crgeddes@us.ibm.com>2018-02-11 14:00:50 -0500
commitc9ad324035c7889d2fbb10e99844fd8148d05bbb (patch)
tree82be984d3c06135b86cde44ecd6687e22587a5fc /src/import/chips/common
parent093246224655865346ec1353383f1f96f9f403d9 (diff)
downloadtalos-hostboot-c9ad324035c7889d2fbb10e99844fd8148d05bbb.tar.gz
talos-hostboot-c9ad324035c7889d2fbb10e99844fd8148d05bbb.zip
Additional risk level support - (step 1) Backward compatibility
The purpose of this commit is to avoid a coreq situation by ensuring this commit is fully propagated through our repos and test drivers before introducing the change to the new HW image with two RLs. The commit enables simultaneous support for producing a HW image and retrieving rings from an image that has either one or two risk level (RL) rings in the .rings section. The commit however does NOT actually, yet, make any changes to the image which is the aim of the (step 2) commit 53292. Nor does this commit generate any raw ring files or process any RL2 level rings yet. Again this will happen in 53292. The commit also includes, - various related cleanups in data naming and ring file processing, - some data and invironment specific parts in ring_apply.C have been moved to common_ringId.C. Key_Cronus_Test=XIP_REGRESS HW-Image-Prereq=53292 - This commit (52659) must be fully merged before merging 53292. Change-Id: I402d53c4a3ca6a084c958321069cc6f60e04ad24 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/53019 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Diffstat (limited to 'src/import/chips/common')
-rw-r--r--src/import/chips/common/utils/imageProcs/common_ringId.C232
-rw-r--r--src/import/chips/common/utils/imageProcs/common_ringId.H52
2 files changed, 261 insertions, 23 deletions
diff --git a/src/import/chips/common/utils/imageProcs/common_ringId.C b/src/import/chips/common/utils/imageProcs/common_ringId.C
index 28a2f630e..8ee9441f1 100644
--- a/src/import/chips/common/utils/imageProcs/common_ringId.C
+++ b/src/import/chips/common/utils/imageProcs/common_ringId.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2017 */
+/* Contributors Listed Below - COPYRIGHT 2017,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -44,11 +44,212 @@ const char* ppeTypeName[] = { "SBE",
const char* ringVariantName[] = { "BASE",
"CC",
"RL",
- "OVRD",
- "OVLY"
+ "RL2",
};
+#ifndef __HOSTBOOT_MODULE // This is only used by ring_apply in EKB
+static int get_ipl_base_param( char*& l_ringPath )
+{
+ l_ringPath = getenv("IPL_BASE");
+
+ if (l_ringPath == NULL)
+ {
+ MY_ERR("p9_ring_apply.C: ring path: IPL_BASE environment parameter not set.\n");
+ return INFRASTRUCT_RC_ENV_ERROR;
+ }
+
+ return INFRASTRUCT_RC_SUCCESS;
+}
+
+static int get_ipl_cache_contained_param( char*& l_ringPath)
+{
+ l_ringPath = getenv("IPL_CACHE_CONTAINED");
+
+ if (l_ringPath == NULL)
+ {
+ MY_ERR("p9_ring_apply.C: ring path: IPL_CACHE_CONTAINED environment parameter not set.\n");
+ return INFRASTRUCT_RC_ENV_ERROR;
+ }
+
+ return INFRASTRUCT_RC_SUCCESS;
+}
+
+static int get_ipl_risk_param( char*& l_ringPath)
+{
+ l_ringPath = getenv("IPL_RISK");
+
+ if (l_ringPath == NULL)
+ {
+ MY_ERR("p9_ring_apply.C: ring path: IPL_RISK environment parameter not set.\n");
+ return INFRASTRUCT_RC_ENV_ERROR;
+ }
+
+ return INFRASTRUCT_RC_SUCCESS;
+}
+
+static int get_runtime_base_param( char*& l_ringPath)
+{
+ l_ringPath = getenv("RUNTIME_BASE");
+
+ if (l_ringPath == NULL)
+ {
+ MY_ERR("p9_ring_apply.C: ring path: RUNTIME_BASE environment parameter not set.\n");
+ return INFRASTRUCT_RC_ENV_ERROR;
+ }
+
+ return INFRASTRUCT_RC_SUCCESS;
+}
+static int get_runtime_risk_param( char*& l_ringPath)
+{
+ l_ringPath = getenv("RUNTIME_RISK");
+
+ if (l_ringPath == NULL)
+ {
+ MY_ERR("p9_ring_apply.C: ring path: RUNTIME_RISK environment parameter not set.\n");
+ return INFRASTRUCT_RC_ENV_ERROR;
+ }
+
+ return INFRASTRUCT_RC_SUCCESS;
+}
+
+static int get_runtime_risk2_param( char*& l_ringPath)
+{
+ l_ringPath = getenv("RUNTIME_RISK2");
+
+ if (l_ringPath == NULL)
+ {
+ MY_ERR("p9_ring_apply.C: ring path: RUNTIME_RISK2 environment parameter not set.\n");
+ return INFRASTRUCT_RC_ENV_ERROR;
+ }
+
+ return INFRASTRUCT_RC_SUCCESS;
+}
+
+int ringid_get_raw_ring_file_path( uint32_t i_magic,
+ RingVariant_t i_ringVariant,
+ char* io_ringPath )
+{
+ int rc = INFRASTRUCT_RC_SUCCESS;
+ char* l_ringDir = NULL;
+
+ do
+ {
+
+ if ( i_magic == TOR_MAGIC_SBE )
+ {
+ if ( i_ringVariant == RV_BASE )
+ {
+ rc = get_ipl_base_param(l_ringDir);
+ }
+ else if ( i_ringVariant == RV_CC )
+ {
+ rc = get_ipl_cache_contained_param(l_ringDir);
+ }
+ else if ( i_ringVariant == RV_RL )
+ {
+ rc = get_ipl_risk_param(l_ringDir);
+ }
+ else if ( i_ringVariant == RV_RL2 )
+ {
+ // Valid RV for Quad chiplets but there's just no RL2 rings for SBE phase (by convention).
+ rc = TOR_NO_RINGS_FOR_VARIANT;
+ break;
+ }
+ else
+ {
+ MY_ERR("Invalid ringVariant(=%d) for TOR magic=0x%08x\n",
+ i_ringVariant, i_magic);
+ rc = TOR_INVALID_VARIANT;
+ }
+
+ if (rc)
+ {
+ break;
+ }
+
+ strcat(io_ringPath, l_ringDir);
+ strcat(io_ringPath, "/");
+ }
+ else if ( i_magic == TOR_MAGIC_CME ||
+ i_magic == TOR_MAGIC_SGPE )
+ {
+ if ( i_ringVariant == RV_BASE )
+ {
+ rc = get_runtime_base_param(l_ringDir);
+ }
+ else if ( i_ringVariant == RV_CC )
+ {
+ // Valid RV for Quad chiplets but there's just no CC rings for runtime phases (by convention).
+ rc = TOR_NO_RINGS_FOR_VARIANT;
+ break;
+ }
+ else if ( i_ringVariant == RV_RL )
+ {
+ rc = get_runtime_risk_param(l_ringDir);
+ }
+ else if ( i_ringVariant == RV_RL2 )
+ {
+ rc = get_runtime_risk2_param(l_ringDir);
+ }
+ else
+ {
+ MY_ERR("Invalid ringVariant(=%d) for TOR magic=0x%08x\n",
+ i_ringVariant, i_magic);
+ rc = TOR_INVALID_VARIANT;
+ }
+
+ if (rc)
+ {
+ break;
+ }
+
+ strcat(io_ringPath, l_ringDir);
+ strcat(io_ringPath, "/");
+ }
+ else if ( i_magic == TOR_MAGIC_CEN )
+ {
+ if ( i_ringVariant == RV_BASE )
+ {
+ rc = get_ipl_base_param(l_ringDir);
+ }
+ else if ( i_ringVariant == RV_RL )
+ {
+ rc = get_ipl_risk_param(l_ringDir);
+ }
+ else
+ {
+ MY_ERR("Invalid ringVariant(=%d) for TOR magic=0x%08x\n",
+ i_ringVariant, i_magic);
+ rc = TOR_INVALID_VARIANT;
+ }
+
+ if (rc)
+ {
+ break;
+ }
+
+ strcat(io_ringPath, l_ringDir);
+ strcat(io_ringPath, "/");
+ }
+ else if ( i_magic == TOR_MAGIC_OVRD ||
+ i_magic == TOR_MAGIC_OVLY )
+ {
+ // Path already fully qualified. Return io_ringPath as is.
+ }
+ else
+ {
+ MY_ERR("Unsupported value of TOR magic(=0x%X)\n", i_magic);
+ rc = TOR_INVALID_MAGIC_NUMBER;
+ }
+
+ }
+ while(0);
+
+ return rc;
+}
+
+#endif // End of ifndef __HOSTBOOT_MODULE
int ringid_get_noof_chiplets( ChipType_t i_chipType,
uint32_t i_torMagic,
@@ -58,6 +259,7 @@ int ringid_get_noof_chiplets( ChipType_t i_chipType,
{
case CT_P9N:
case CT_P9C:
+ case CT_P9A:
if ( i_torMagic == TOR_MAGIC_SBE ||
i_torMagic == TOR_MAGIC_OVRD ||
i_torMagic == TOR_MAGIC_OVLY )
@@ -105,7 +307,8 @@ int ringid_get_noof_chiplets( ChipType_t i_chipType,
int ringid_get_properties( ChipType_t i_chipType,
uint32_t i_torMagic,
- ChipletType_t i_chiplet,
+ uint8_t i_torVersion,
+ ChipletType_t i_chipletType,
ChipletData_t** o_chipletData,
GenRingIdList** o_ringIdListCommon,
GenRingIdList** o_ringIdListInstance,
@@ -117,18 +320,25 @@ int ringid_get_properties( ChipType_t i_chipType,
{
case CT_P9N:
case CT_P9C:
+ case CT_P9A:
if ( i_torMagic == TOR_MAGIC_SBE ||
i_torMagic == TOR_MAGIC_OVRD ||
i_torMagic == TOR_MAGIC_OVLY )
{
P9_RID::ringid_get_chiplet_properties(
- i_chiplet,
+ i_chipletType,
o_chipletData,
o_ringIdListCommon,
o_ringIdListInstance,
o_ringVariantOrder,
o_numVariants );
+ if ( i_torVersion < 6 &&
+ (i_chipletType == P9_RID::EQ_TYPE || i_chipletType == P9_RID::EC_TYPE) )
+ {
+ *o_numVariants = *o_numVariants - 1;
+ }
+
if ( i_torMagic == TOR_MAGIC_OVRD ||
i_torMagic == TOR_MAGIC_OVLY )
{
@@ -142,6 +352,11 @@ int ringid_get_properties( ChipType_t i_chipType,
*o_ringIdListInstance = (GenRingIdList*)P9_RID::EC::RING_ID_LIST_INSTANCE;
*o_ringVariantOrder = (RingVariantOrder*)P9_RID::EC::RING_VARIANT_ORDER;
*o_numVariants = P9_RID::EC::g_chipletData.iv_num_ring_variants;
+
+ if (i_torVersion < 6)
+ {
+ *o_numVariants = *o_numVariants - 1;
+ }
}
else if ( i_torMagic == TOR_MAGIC_SGPE )
{
@@ -150,6 +365,11 @@ int ringid_get_properties( ChipType_t i_chipType,
*o_ringIdListInstance = (GenRingIdList*)P9_RID::EQ::RING_ID_LIST_INSTANCE;
*o_ringVariantOrder = (RingVariantOrder*)P9_RID::EQ::RING_VARIANT_ORDER;
*o_numVariants = P9_RID::EQ::g_chipletData.iv_num_ring_variants;
+
+ if (i_torVersion < 6)
+ {
+ *o_numVariants = *o_numVariants - 1;
+ }
}
else
{
@@ -166,7 +386,7 @@ int ringid_get_properties( ChipType_t i_chipType,
i_torMagic == TOR_MAGIC_OVRD )
{
CEN_RID::ringid_get_chiplet_properties(
- i_chiplet,
+ i_chipletType,
o_chipletData,
o_ringIdListCommon,
o_ringIdListInstance,
diff --git a/src/import/chips/common/utils/imageProcs/common_ringId.H b/src/import/chips/common/utils/imageProcs/common_ringId.H
index 74edacb0f..de2b13930 100644
--- a/src/import/chips/common/utils/imageProcs/common_ringId.H
+++ b/src/import/chips/common/utils/imageProcs/common_ringId.H
@@ -54,14 +54,20 @@ typedef uint32_t TorCpltOffset_t; // Type for offset value to chiplet's CMN or
typedef uint8_t myBoolean_t; // false:0, true:1, undefined:UNDEFINED_BOOLEAN
#define UNDEFINED_RING_ID (RingId_t)0xffff
-#define INVALID_RING_TYPE (RingType_t)0xff
-#define INVALID_CHIPLET_TYPE (ChipletType_t)0xff
+#define UNDEFINED_CHIPLET_TYPE (ChipletType_t)0xff
#define UNDEFINED_PPE_TYPE (PpeType_t)0xff
#define UNDEFINED_CHIP_TYPE (ChipType_t)0xff
+#define INVALID_RING_TYPE (RingType_t)0xff
+#define UNDEFINED_RING_VARIANT (RingVariant_t)0xff
#define UNDEFINED_RING_BLOCK_TYPE (RingBlockType_t)0xff;
+
+#define UNDEFINED_DD_LEVEL (uint8_t)0xff
+
#define MAX_TOR_RING_OFFSET (uint16_t)(256*256-1) // Max val of uint16
+
+#define MAX_RING_PATH_LENGTH (uint8_t)500
#define MAX_RING_NAME_LENGTH (uint8_t)50
-#define UNDEFINED_DD_LEVEL (uint8_t)0xff
+
#define UNDEFINED_BOOLEAN (myBoolean_t)0xff
// //
@@ -132,6 +138,7 @@ typedef uint16_t TorRingOffset_t; // Offset value to actual ring
//#define TOR_VERSION 3 // Added TOR magic header.
//#define TOR_VERSION 4 // TOR API code restructuring.
#define TOR_VERSION 5 // Removed TOR-level DD handling.
+//#define TOR_VERSION 6 // Added additional runtime risk level (RL2)
// TOR Magic values for top-level TOR ringSection and sub-ringSections
enum TorMagicNum
@@ -206,8 +213,9 @@ typedef struct
uint32_t scanScomAddress;
} GenRingIdList;
-// PPE types supported. Note that this enum also reflects the
-// order with which they appear in the HW image's .rings section.
+// P9 PPE types supported.
+// - This enum also reflects the order with which they appear in the HW image's .rings section.
+// - Do NOT make changes to the values or order of this enum.
enum PpeType
{
PT_SBE = 0x00,
@@ -216,17 +224,16 @@ enum PpeType
NUM_PPE_TYPES = 0x03
};
-// Do NOT make changes to the values or order of this enum. Some user
-// codes, like xip_tool, make assumptions about range and order.
+// P9 ring variants supported.
+// - This enum also reflects the order with which they appear in various images' .rings section.
+// - Do NOT make changes to the values or order of this enum.
enum RingVariant
{
- BASE = 0x00,
- CC = 0x01,
- RL = 0x02,
- OVERRIDE = 0x03,
- OVERLAY = 0x04,
- NUM_RING_VARIANTS = 0x05,
- NOT_VALID = 0xff
+ RV_BASE = 0x00,
+ RV_CC = 0x01,
+ RV_RL = 0x02,
+ RV_RL2 = 0x03,
+ NUM_RING_VARIANTS = 0x04,
};
extern const char* ppeTypeName[];
@@ -234,10 +241,13 @@ extern const char* ringVariantName[];
typedef struct
{
- RingVariant_t variant[3];
+ RingVariant_t variant[4];
} RingVariantOrder;
+// P9 ring types supported.
+// - This enum also reflects the order with which they appear in various images' .rings section.
+// - Do NOT make changes to the values or order of this enum.
enum RingType
{
COMMON_RING = 0,
@@ -289,7 +299,7 @@ typedef struct
{
uint8_t iv_torOffSet;
#ifndef __PPE__
- char iv_name[50];
+ char iv_name[MAX_RING_NAME_LENGTH];
#endif
ChipletType_t iv_type;
} RingProperties_t;
@@ -302,6 +312,7 @@ typedef struct
#define INFRASTRUCT_RC_FAILURE 1
#define INFRASTRUCT_RC_CODE_BUG 2
#define INFRASTRUCT_RC_USER_ERROR 3
+#define INFRASTRUCT_RC_ENV_ERROR 4
#define INFRASTRUCT_RC_NOOF_CODES 5 // Do not use as RC code
//
// TOR specific error codes
@@ -332,7 +343,13 @@ typedef struct
#define TOR_BUFFER_TOO_SMALL INFRASTRUCT_RC_NOOF_CODES + 21
#define TOR_TOO_MANY_DD_LEVELS INFRASTRUCT_RC_NOOF_CODES + 22
#define TOR_OFFSET_TOO_BIG INFRASTRUCT_RC_NOOF_CODES + 23
+#define TOR_NO_RINGS_FOR_VARIANT INFRASTRUCT_RC_NOOF_CODES + 24
+#ifndef __HOSTBOOT_MODULE // Only needed by ring_apply in EKB
+int ringid_get_raw_ring_file_path( uint32_t i_magic,
+ RingVariant_t i_ringVariant,
+ char* io_directory );
+#endif
int ringid_get_noof_chiplets( ChipType_t i_chipType,
uint32_t i_torMagic,
@@ -340,7 +357,8 @@ int ringid_get_noof_chiplets( ChipType_t i_chipType,
int ringid_get_properties( ChipType_t i_chipType,
uint32_t i_torMagic,
- ChipletType_t i_chiplet,
+ uint8_t i_torVersion,
+ ChipletType_t i_chipletType,
ChipletData_t** o_chipletData,
GenRingIdList** o_ringIdListCommon,
GenRingIdList** o_ringIdListInstance,
OpenPOWER on IntegriCloud