summaryrefslogtreecommitdiffstats
path: root/import/chips/common/utils
diff options
context:
space:
mode:
authorClaus Michael Olsen <cmolsen@us.ibm.com>2017-04-05 05:16:51 -0500
committerJoshua Hunsberger <jahunsbe@us.ibm.com>2018-02-02 14:39:24 -0600
commitfbc60965fc837cae27c13cc79d8b4821d24fbe48 (patch)
tree569c5d18b60950c830242f9fb502efa5b58738b2 /import/chips/common/utils
parente009db7aa5ef5d0b431a3b7cd6cc36661a5a6f27 (diff)
downloadtalos-hcode-fbc60965fc837cae27c13cc79d8b4821d24fbe48.tar.gz
talos-hcode-fbc60965fc837cae27c13cc79d8b4821d24fbe48.zip
Code restruct: TOR API
Key_Cronus_Test=XIP_REGRESS Code restructuring aiming at: - utilizing TOR magic header info - enforce a common approach for - extracting metadata for all image,chipType combinations - traversing images for all image,chipType combinations - shrinking code size by reusing common code segments - improve readability by - separating more clearly metadata extraction and image traversal - slight rearrange of certain code segments - remove leftover hardcoded assumptions about ring/TOR data and structs - variables appropriately renamed and now all using camel style Change-Id: I81ab15aae820ac9cca78ae9c519a5c2599b95584 Original-Change-Id: I50ace8b2fdb340a97ce6d74ce545c5e1acd21c40 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/38863 Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com> Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Cronus HW CI <cronushw-ci+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: GIRISANKAR PAULRAJ <gpaulraj@in.ibm.com> Reviewed-by: Thi N. Tran <thi@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Diffstat (limited to 'import/chips/common/utils')
-rw-r--r--import/chips/common/utils/imageProcs/common_ringId.C198
1 files changed, 198 insertions, 0 deletions
diff --git a/import/chips/common/utils/imageProcs/common_ringId.C b/import/chips/common/utils/imageProcs/common_ringId.C
new file mode 100644
index 00000000..a99cddab
--- /dev/null
+++ b/import/chips/common/utils/imageProcs/common_ringId.C
@@ -0,0 +1,198 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: import/chips/common/utils/imageProcs/common_ringId.C $ */
+/* */
+/* OpenPOWER HCODE Project */
+/* */
+/* COPYRIGHT 2017,2018 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+#include <common_ringId.H>
+
+namespace P9_RID
+{
+#include <p9_ringId.H>
+};
+namespace CEN_RID
+{
+#include <cen_ringId.H>
+};
+#include <p9_infrastruct_help.H>
+
+// These strings must adhere precisely to the enum of ppeType.
+const char* ppeTypeName[] = { "SBE",
+ "CME",
+ "SGPE"
+ };
+
+// These strings must adhere precisely to the enum of RingVariant.
+const char* ringVariantName[] = { "BASE",
+ "CC",
+ "RL",
+ "OVRD",
+ "OVLY"
+ };
+
+
+
+int ringid_get_noof_chiplets( ChipType_t i_chipType,
+ uint32_t i_torMagic,
+ uint8_t* o_numChiplets )
+{
+ switch (i_chipType)
+ {
+ case CT_P9N:
+ case CT_P9C:
+ if ( i_torMagic == TOR_MAGIC_SBE ||
+ i_torMagic == TOR_MAGIC_OVRD ||
+ i_torMagic == TOR_MAGIC_OVLY )
+ {
+ *o_numChiplets = P9_RID::SBE_NOOF_CHIPLETS;
+ }
+ else if ( i_torMagic == TOR_MAGIC_CME )
+ {
+ *o_numChiplets = P9_RID::CME_NOOF_CHIPLETS;
+ }
+ else if ( i_torMagic == TOR_MAGIC_SGPE )
+ {
+ *o_numChiplets = P9_RID::SGPE_NOOF_CHIPLETS;
+ }
+ else
+ {
+ MY_ERR("Invalid torMagic (=0x%08x) for chipType (=CT_P9x=%d)\n", i_torMagic, i_chipType);
+ return TOR_INVALID_MAGIC_NUMBER;
+ }
+
+ break;
+
+ case CT_CEN:
+ if ( i_torMagic == TOR_MAGIC_CEN ||
+ i_torMagic == TOR_MAGIC_OVRD )
+ {
+ *o_numChiplets = CEN_RID::CEN_NOOF_CHIPLETS;
+ }
+ else
+ {
+ MY_ERR("Invalid torMagic (=0x%08x) for chipType (=CT_CEN)\n", i_torMagic);
+ return TOR_INVALID_MAGIC_NUMBER;
+ }
+
+ break;
+
+ default:
+ MY_ERR("Invalid chipType (=0x%02x)\n", i_chipType);
+ return TOR_INVALID_CHIPTYPE;
+ }
+
+ return TOR_SUCCESS;
+}
+
+
+int ringid_get_properties( ChipType_t i_chipType,
+ uint32_t i_torMagic,
+ ChipletType_t i_chiplet,
+ ChipletData_t** o_chipletData,
+ GenRingIdList** o_ringIdListCommon,
+ GenRingIdList** o_ringIdListInstance,
+ RingVariantOrder** o_ringVariantOrder,
+ RingProperties_t** o_ringProps,
+ uint8_t* o_numVariants )
+{
+ switch (i_chipType)
+ {
+ case CT_P9N:
+ case CT_P9C:
+ if ( i_torMagic == TOR_MAGIC_SBE ||
+ i_torMagic == TOR_MAGIC_OVRD ||
+ i_torMagic == TOR_MAGIC_OVLY )
+ {
+ P9_RID::ringid_get_chiplet_properties(
+ i_chiplet,
+ o_chipletData,
+ o_ringIdListCommon,
+ o_ringIdListInstance,
+ o_ringVariantOrder,
+ o_numVariants );
+
+ if ( i_torMagic == TOR_MAGIC_OVRD ||
+ i_torMagic == TOR_MAGIC_OVLY )
+ {
+ *o_numVariants = 1;
+ }
+ }
+ else if ( i_torMagic == TOR_MAGIC_CME )
+ {
+ *o_chipletData = (ChipletData_t*)&P9_RID::EC::g_chipletData;
+ *o_ringIdListCommon = (GenRingIdList*)P9_RID::EC::RING_ID_LIST_COMMON;
+ *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;
+ }
+ else if ( i_torMagic == TOR_MAGIC_SGPE )
+ {
+ *o_chipletData = (ChipletData_t*)&P9_RID::EQ::g_chipletData;
+ *o_ringIdListCommon = (GenRingIdList*)P9_RID::EQ::RING_ID_LIST_COMMON;
+ *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;
+ }
+ else
+ {
+ MY_ERR("Invalid torMagic (=0x%08x) for chipType=CT_P9x=%d\n", i_torMagic, i_chipType);
+ return TOR_INVALID_MAGIC_NUMBER;
+ }
+
+ *o_ringProps = (RingProperties_t*)P9_RID::RING_PROPERTIES;
+
+ break;
+
+ case CT_CEN:
+ if ( i_torMagic == TOR_MAGIC_CEN ||
+ i_torMagic == TOR_MAGIC_OVRD )
+ {
+ CEN_RID::ringid_get_chiplet_properties(
+ i_chiplet,
+ o_chipletData,
+ o_ringIdListCommon,
+ o_ringIdListInstance,
+ o_ringVariantOrder,
+ o_numVariants );
+
+ if ( i_torMagic == TOR_MAGIC_OVRD)
+ {
+ *o_numVariants = 1;
+ }
+ }
+ else
+ {
+ MY_ERR("Invalid torMagic (=0x%08x) for chipType=CT_CEN\n", i_torMagic);
+ return TOR_INVALID_MAGIC_NUMBER;
+ }
+
+ *o_ringProps = (RingProperties_t*)CEN_RID::RING_PROPERTIES;
+
+ break;
+
+ default:
+ MY_ERR("Invalid chipType (=0x%02x)\n", i_chipType);
+ return TOR_INVALID_CHIPTYPE;
+
+ }
+
+ return TOR_SUCCESS;
+}
OpenPOWER on IntegriCloud