summaryrefslogtreecommitdiffstats
path: root/src/import
diff options
context:
space:
mode:
authorMartin Peschke <mpeschke@de.ibm.com>2016-05-19 13:09:47 +0200
committerSachin Gupta <sgupta2m@in.ibm.com>2016-09-26 02:05:36 -0400
commitcdf3cd00b9e44bafedf30ffa62c733609fb599e2 (patch)
treed8f3f44fb0734d89fe1141fe5b19b599aa57bcd7 /src/import
parent2f21c8cdb1b36b58a1f0f392a03f8d9ff42e4dbb (diff)
downloadtalos-sbe-cdf3cd00b9e44bafedf30ffa62c733609fb599e2.tar.gz
talos-sbe-cdf3cd00b9e44bafedf30ffa62c733609fb599e2.zip
move production code from tools/imageProcs to chips/p9/utils/imageProcs
Change-Id: Idc79d3047e7adfd7bcd639d1803da0d3f4e76958 Original-Change-Id: I516c770ec7fd6d1fb2f8f7933a2579038c13ce6d Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/24786 Tested-by: Jenkins Server Reviewed-by: Claus M. Olsen <cmolsen@us.ibm.com> Reviewed-by: Richard J. Knight <rjknight@us.ibm.com> Reviewed-by: Martin Peschke <mpeschke@de.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/30235 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Diffstat (limited to 'src/import')
-rw-r--r--src/import/chips/p9/utils/imageProcs/p9_ringId.C310
-rw-r--r--src/import/chips/p9/utils/imageProcs/p9_tor.C1833
-rw-r--r--src/import/chips/p9/utils/imageProcs/p9_tor.H261
3 files changed, 2404 insertions, 0 deletions
diff --git a/src/import/chips/p9/utils/imageProcs/p9_ringId.C b/src/import/chips/p9/utils/imageProcs/p9_ringId.C
new file mode 100644
index 00000000..aefc5977
--- /dev/null
+++ b/src/import/chips/p9/utils/imageProcs/p9_ringId.C
@@ -0,0 +1,310 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/import/chips/p9/utils/imageProcs/p9_ringId.C $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2016 */
+/* [+] 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 "p9_ringId.H"
+#include "p9_ring_identification.H"
+
+namespace PERV
+{
+const GenRingIdList RING_ID_LIST_COMMON[] =
+{
+ {"perv_fure" , 0x00, 0x01, 0x01, "perv_fure_ring" , NON_VPD_RING, 0, 0x0800000000009000},
+ {"perv_gptr" , 0x01, 0x01, 0x01, "perv_gptr_ring" , NON_VPD_RING, 0, 0x0800000000002000},
+ {"perv_time" , 0x02, 0x01, 0x01, "perv_time_ring" , NON_VPD_RING, 0, 0x0800000000000100},
+ {"occ_fure" , 0x03, 0x01, 0x01, "occ_fure_ring" , NON_VPD_RING, 0, 0x0100000000009000},
+ {"occ_gptr" , 0x04, 0x01, 0x01, "occ_gptr_ring" , NON_VPD_RING, 0, 0x0100000000002000},
+ {"occ_time" , 0x05, 0x01, 0x01, "occ_time_ring" , NON_VPD_RING, 0, 0x0100000000000100},
+ {"perv_ana_func" , 0x06, 0x01, 0x01, "perv_ana_func_ring" , NON_VPD_RING, 0, 0x0080000000008000},
+ {"perv_ana_gptr" , 0x07, 0x01, 0x01, "perv_ana_gptr_ring" , NON_VPD_RING, 0, 0x0080000000002000},
+ {"perv_pll_gptr" , 0x08, 0x01, 0x01, "perv_pll_gptr_ring" , NON_VPD_PLL_RING, 0, 0x0002000000002000},
+ {"perv_pll_bndy_bucket_1" , 0x09, 0x01, 0x01, "perv_pll_bndy_bucket_1_ring" , NON_VPD_PLL_RING, 5, 0x0002000000000080},
+ {"perv_pll_bndy_bucket_2" , 0x0a, 0x01, 0x01, "perv_pll_bndy_bucket_2_ring" , NON_VPD_PLL_RING, 5, 0x0002000000000080},
+ {"perv_pll_bndy_bucket_3" , 0x0b, 0x01, 0x01, "perv_pll_bndy_bucket_3_ring" , NON_VPD_PLL_RING, 5, 0x0002000000000080},
+ {"perv_pll_bndy_bucket_4" , 0x0c, 0x01, 0x01, "perv_pll_bndy_bucket_4_ring" , NON_VPD_PLL_RING, 5, 0x0002000000000080},
+ {"perv_pll_bndy_bucket_5" , 0x0d, 0x01, 0x01, "perv_pll_bndy_bucket_5_ring" , NON_VPD_PLL_RING, 5, 0x0002000000000080},
+};
+const GenRingIdList RING_ID_LIST_INSTANCE[] =
+{
+ {"perv_repr" , 0x0f, 0x01, 0x01, "perv_repr_ring" , NON_VPD_RING, 0, 0x0800000000000200},
+ {"occ_repr" , 0x10, 0x01, 0x01, "occ_repr_ring" , NON_VPD_RING, 0, 0x0100000000000200},
+};
+};
+namespace N0
+{
+const GenRingIdList RING_ID_LIST_COMMON[] =
+{
+ {"n0_fure" , 0x00, 0x02, 0x02, "n0_fure_ring" , NON_VPD_RING, 0, 0x09C0000000009000},
+ {"n0_gptr" , 0x01, 0x02, 0x02, "n0_gptr_ring" , NON_VPD_RING, 0, 0x09C0000000002000},
+ {"n0_time" , 0x02, 0x02, 0x02, "n0_time_ring" , NON_VPD_RING, 0, 0x09C0000000000100},
+ {"n0_nx_fure" , 0x03, 0x02, 0x02, "n0_nx_fure_ring" , NON_VPD_RING, 0, 0x0400000000009000},
+ {"n0_nx_gptr" , 0x04, 0x02, 0x02, "n0_nx_gptr_ring" , NON_VPD_RING, 0, 0x0400000000002000},
+ {"n0_nx_time" , 0x05, 0x02, 0x02, "n0_nx_time_ring" , NON_VPD_RING, 0, 0x0400000000000100},
+ {"n0_cxa0_fure" , 0x06, 0x02, 0x02, "n0_cxa0_fure_ring" , NON_VPD_RING, 0, 0x0200000000009000},
+ {"n0_cxa0_gptr" , 0x07, 0x02, 0x02, "n0_cxa0_gptr_ring" , NON_VPD_RING, 0, 0x0200000000002000},
+ {"n0_cxa0_time" , 0x08, 0x02, 0x02, "n0_cxa0_time_ring" , NON_VPD_RING, 0, 0x0200000000000100},
+};
+const GenRingIdList RING_ID_LIST_INSTANCE[] =
+{
+ {"n0_repr" , 0x09, 0x02, 0x02, "n0_repr_ring" , NON_VPD_RING, 0, 0x09C0000000000200},
+ {"n0_nx_repr" , 0x0A, 0x02, 0x02, "n0_nx_repr_ring" , NON_VPD_RING, 0, 0x0400000000000200},
+ {"n0_cxa0_repr" , 0x0B, 0x02, 0x02, "n0_cxa0_repr_ring" , NON_VPD_RING, 0, 0x0200000000000200},
+};
+};
+namespace N1
+{
+const GenRingIdList RING_ID_LIST_COMMON[] =
+{
+ {"n1_fure" , 0x00, 0x03, 0x03, "n1_fure_ring" , NON_VPD_RING, 0, 0x0E00000000009000},
+ {"n1_gptr" , 0x01, 0x03, 0x03, "n1_gptr_ring" , NON_VPD_RING, 0, 0x0E00000000002000},
+ {"n1_time" , 0x02, 0x03, 0x03, "n1_time_ring" , NON_VPD_RING, 0, 0x0E00000000000100},
+ {"n1_ioo0_fure" , 0x03, 0x03, 0x03, "n1_ioo0_fure_ring" , NON_VPD_RING, 0, 0x0100000000009000},
+ {"n1_ioo0_gptr" , 0x04, 0x03, 0x03, "n1_ioo0_gptr_ring" , NON_VPD_RING, 0, 0x0100000000002000},
+ {"n1_ioo0_time" , 0x05, 0x03, 0x03, "n1_ioo0_time_ring" , NON_VPD_RING, 0, 0x0100000000000100},
+ {"n1_ioo1_fure" , 0x06, 0x03, 0x03, "n1_ioo1_fure_ring" , NON_VPD_RING, 0, 0x0080000000009000},
+ {"n1_ioo1_gptr" , 0x07, 0x03, 0x03, "n1_ioo1_gptr_ring" , NON_VPD_RING, 0, 0x0080000000002000},
+ {"n1_ioo1_time" , 0x08, 0x03, 0x03, "n1_ioo1_time_ring" , NON_VPD_RING, 0, 0x0080000000000100},
+ {"n1_mcs23_fure" , 0x09, 0x03, 0x03, "n1_mcs23_fure_ring" , NON_VPD_RING, 0, 0x0040000000009000},
+ {"n1_mcs23_gptr" , 0x0A, 0x03, 0x03, "n1_mcs23_gptr_ring" , NON_VPD_RING, 0, 0x0040000000002000},
+ {"n1_mcs23_time" , 0x0B, 0x03, 0x03, "n1_mcs23_time_ring" , NON_VPD_RING, 0, 0x0040000000000100},
+};
+const GenRingIdList RING_ID_LIST_INSTANCE[] =
+{
+ {"n1_repr" , 0x0C, 0x03, 0x03, "n1_repr_ring" , NON_VPD_RING, 0, 0x0E00000000000200},
+ {"n1_ioo0_repr" , 0x0D, 0x03, 0x03, "n1_ioo0_repr_ring" , NON_VPD_RING, 0, 0x0100000000000200},
+ {"n1_ioo1_repr" , 0x0E, 0x03, 0x03, "n1_ioo1_repr_ring" , NON_VPD_RING, 0, 0x0080000000000200},
+ {"n1_mcs23_repr" , 0x0F, 0x03, 0x03, "n1_mcs23_repr_ring" , NON_VPD_RING, 0, 0x0040000000000200},
+};
+};
+namespace N2
+{
+const GenRingIdList RING_ID_LIST_COMMON[] =
+{
+ {"n2_fure" , 0x00, 0x04, 0x04, "n2_fure_ring" , NON_VPD_RING, 0, 0x0BC0000000009000},
+ {"n2_gptr" , 0x01, 0x04, 0x04, "n2_gptr_ring" , NON_VPD_RING, 0, 0x0BC0000000002000},
+ {"n2_time" , 0x02, 0x04, 0x04, "n2_time_ring" , NON_VPD_RING, 0, 0x0BC0000000000100},
+ {"n2_cxa1_fure" , 0x03, 0x04, 0x04, "n2_cxa1_fure_ring" , NON_VPD_RING, 0, 0x0400000000009000},
+ {"n2_cxa1_gptr" , 0x04, 0x04, 0x04, "n2_cxa1_gptr_ring" , NON_VPD_RING, 0, 0x0400000000002000},
+ {"n2_cxa1_time" , 0x05, 0x04, 0x04, "n2_cxa1_time_ring" , NON_VPD_RING, 0, 0x0400000000000100},
+};
+const GenRingIdList RING_ID_LIST_INSTANCE[] =
+{
+ {"n2_repr" , 0x06, 0x04, 0x04, "n2_repr_ring" , NON_VPD_RING, 0, 0x0BC0000000000200},
+ {"n2_cxa1_repr" , 0x07, 0x04, 0x04, "n2_cxa1_repr_ring" , NON_VPD_RING, 0, 0x0400000000000200},
+};
+};
+namespace N3
+{
+const GenRingIdList RING_ID_LIST_COMMON[] =
+{
+ {"n3_fure" , 0x00, 0x05, 0x05, "n3_fure_ring" , NON_VPD_RING, 0, 0x0EC0000000009000},
+ {"n3_gptr" , 0x01, 0x05, 0x05, "n3_gptr_ring" , NON_VPD_RING, 0, 0x0EC0000000002000},
+ {"n3_time" , 0x02, 0x05, 0x05, "n3_time_ring" , NON_VPD_RING, 0, 0x0EC0000000000100},
+ {"n3_mcs01_fure" , 0x03, 0x05, 0x05, "n3_mcs01_fure_ring" , NON_VPD_RING, 0, 0x0020000000009000},
+ {"n3_mcs01_gptr" , 0x04, 0x05, 0x05, "n3_mcs01_gptr_ring" , NON_VPD_RING, 0, 0x0020000000002000},
+ {"n3_mcs01_time" , 0x05, 0x05, 0x05, "n3_mcs01_time_ring" , NON_VPD_RING, 0, 0x0020000000000100},
+};
+const GenRingIdList RING_ID_LIST_INSTANCE[] =
+{
+ {"n3_repr" , 0x06, 0x05, 0x05, "n3_repr_ring" , NON_VPD_RING, 0, 0x0EC0000000000200},
+ {"n3_mcs01_repr" , 0x07, 0x05, 0x05, "n3_mcs01_repr-ring" , NON_VPD_RING, 0, 0x0020000000000200},
+};
+};
+namespace XB
+{
+const GenRingIdList RING_ID_LIST_COMMON[] =
+{
+ {"xb_fure" , 0x00, 0x06, 0x06, "xb_fure_ring" , NON_VPD_RING, 0, 0x0880000000009000},
+ {"xb_gptr" , 0x01, 0x06, 0x06, "xb_gptr_ring" , NON_VPD_RING, 0, 0x0880000000002000},
+ {"xb_time" , 0x02, 0x06, 0x06, "xb_time_ring" , NON_VPD_RING, 0, 0x0880000000000100},
+ {"xb_io0_fure" , 0x03, 0x06, 0x06, "xb_io0_fure_ring" , NON_VPD_RING, 0, 0x0440000000009000},
+ {"xb_io0_gptr" , 0x04, 0x06, 0x06, "xb_io0_gptr_ring" , NON_VPD_RING, 0, 0x0440000000002000},
+ {"xb_io0_time" , 0x05, 0x06, 0x06, "xb_io0_time_ring" , NON_VPD_RING, 0, 0x0440000000000100},
+ {"xb_io1_fure" , 0x06, 0x06, 0x06, "xb_io1_fure_ring" , NON_VPD_RING, 0, 0x0220000000009000},
+ {"xb_io1_gptr" , 0x07, 0x06, 0x06, "xb_io1_gptr_ring" , NON_VPD_RING, 0, 0x0220000000002000},
+ {"xb_io1_time" , 0x08, 0x06, 0x06, "xb_io1_time_ring" , NON_VPD_RING, 0, 0x0220000000000100},
+ {"xb_io2_fure" , 0x09, 0x06, 0x06, "xb_io2_fure_ring" , NON_VPD_RING, 0, 0x0110000000009000},
+ {"xb_io2_gptr" , 0x0A, 0x06, 0x06, "xb_io2_gptr_ring" , NON_VPD_RING, 0, 0x0110000000002000},
+ {"xb_io2_time" , 0x0B, 0x06, 0x06, "xb_io2_time_ring" , NON_VPD_RING, 0, 0x0110000000000100},
+ {"xb_pll_gptr" , 0x0C, 0x06, 0x06, "xb_pll_gptr_ring" , NON_VPD_PLL_RING, 0, 0x0002000000002000},
+ {"xb_pll_other" , 0x0D, 0x06, 0x06, "xb_pll_other_ring" , NON_VPD_PLL_RING, 0, 0x0002000000005F70},
+ {"xb_pll_bndy_bucket_1" , 0x0E, 0x06, 0x06, "xb_pll_bndy_bucket_1_ring" , NON_VPD_PLL_RING, 5, 0x0002000000000080},
+ {"xb_pll_bndy_bucket_2" , 0x0F, 0x06, 0x06, "xb_pll_bndy_bucket_2_ring" , NON_VPD_PLL_RING, 5, 0x0002000000000080},
+ {"xb_pll_bndy_bucket_3" , 0x10, 0x06, 0x06, "xb_pll_bndy_bucket_3_ring" , NON_VPD_PLL_RING, 5, 0x0002000000000080},
+ {"xb_pll_bndy_bucket_4" , 0x11, 0x06, 0x06, "xb_pll_bndy_bucket_4_ring" , NON_VPD_PLL_RING, 5, 0x0002000000000080},
+ {"xb_pll_bndy_bucket_5" , 0x12, 0x06, 0x06, "xb_pll_bndy_bucket_5_ring" , NON_VPD_PLL_RING, 5, 0x0002000000000080},
+};
+const GenRingIdList RING_ID_LIST_INSTANCE[] =
+{
+ {"xb_repr" , 0x13, 0x06, 0x06, "xb_repr_ring" , NON_VPD_RING, 0, 0x0880000000000200},
+ {"xb_io0_repr" , 0x14, 0x06, 0x06, "xb_io0_repr_ring" , NON_VPD_RING, 0, 0x0440000000000200},
+ {"xb_io1_repr" , 0x15, 0x06, 0x06, "xb_io1_repr_ring" , NON_VPD_RING, 0, 0x0220000000000200},
+ {"xb_io2_repr" , 0x16, 0x06, 0x06, "xb_io2_repr_ring" , NON_VPD_RING, 0, 0x0110000000000200},
+};
+};
+namespace MC
+{
+const GenRingIdList RING_ID_LIST_COMMON[] =
+{
+ {"mc_fure" , 0x00, 0x07, 0x07, "mc_fure_ring" , NON_VPD_RING, 0, 0x0C00000000009000},
+ {"mc_gptr" , 0x01, 0x07, 0x07, "mc_gptr_ring" , NON_VPD_RING, 0, 0x0C00000000002000},
+ {"mc_time" , 0x02, 0x07, 0x07, "mc_time_ring" , NON_VPD_RING, 0, 0x0C00000000000100},
+ {"mc_iom01_fure" , 0x03, 0x07, 0x07, "mc_iom01_fure_ring" , NON_VPD_RING, 0, 0x0200000000009000},
+ {"mc_iom01_gptr" , 0x04, 0x07, 0x07, "mc_iom01_gptr_ring" , NON_VPD_RING, 0, 0x0200000000002000},
+ {"mc_iom01_time" , 0x05, 0x07, 0x07, "mc_iom01_time_ring" , NON_VPD_RING, 0, 0x0200000000000100},
+ {"mc_iom23_fure" , 0x06, 0x07, 0x07, "mc_iom23_fure_ring" , NON_VPD_RING, 0, 0x0100000000009000},
+ {"mc_iom23_gptr" , 0x07, 0x07, 0x07, "mc_iom23_gptr_ring" , NON_VPD_RING, 0, 0x0100000000002000},
+ {"mc_iom23_time" , 0x08, 0x07, 0x07, "mc_iom23_time_ring" , NON_VPD_RING, 0, 0x0100000000000100},
+ {"mc_pll_gptr" , 0x09, 0x07, 0x07, "mc_pll_gptr_ring" , NON_VPD_PLL_RING, 0, 0x0002000000002000},
+ {"mc_pll_other" , 0x0A, 0x07, 0x07, "mc_pll_other_ring" , NON_VPD_PLL_RING, 0, 0x0002000000005F70},
+ {"mc_pll_bndy_bucket_1" , 0x0B, 0x07, 0x07, "mc_pll_bndy_bucket_1_ring" , NON_VPD_PLL_RING, 5, 0x0002000000000080},
+ {"mc_pll_bndy_bucket_2" , 0x0C, 0x07, 0x07, "mc_pll_bndy_bucket_2_ring" , NON_VPD_PLL_RING, 5, 0x0002000000000080},
+ {"mc_pll_bndy_bucket_3" , 0x0D, 0x07, 0x07, "mc_pll_bndy_bucket_3_ring" , NON_VPD_PLL_RING, 5, 0x0002000000000080},
+ {"mc_pll_bndy_bucket_4" , 0x0E, 0x07, 0x07, "mc_pll_bndy_bucket_4_ring" , NON_VPD_PLL_RING, 5, 0x0002000000000080},
+ {"mc_pll_bndy_bucket_5" , 0x0F, 0x07, 0x07, "mc_pll_bndy_bucket_5_ring" , NON_VPD_PLL_RING, 5, 0x0002000000000080},
+};
+const GenRingIdList RING_ID_LIST_INSTANCE[] =
+{
+ {"mc_repr" , 0x10, 0x07, 0x08, "mc_repr_ring" , NON_VPD_RING, 0, 0x0C00000000000200},
+ {"mc_iom01_repr" , 0x11, 0x07, 0x08, "mc_iom01_repr_ring" , NON_VPD_RING, 0, 0x0200000000000200},
+ {"mc_iom23_repr" , 0x12, 0x07, 0x08, "mc_iom23_repr_ring" , NON_VPD_RING, 0, 0x0100000000000200},
+};
+};
+namespace OB
+{
+const GenRingIdList RING_ID_LIST_COMMON[] =
+{
+ {"ob_fure" , 0x00, 0x09, 0x09, "ob_fure_ring" , NON_VPD_RING, 0, 0x0E00000000009000},
+ {"ob_gptr" , 0x01, 0x09, 0x09, "ob_gptr_ring" , NON_VPD_RING, 0, 0x0E00000000002000},
+ {"ob_time" , 0x02, 0x09, 0x09, "ob_time_ring" , NON_VPD_RING, 0, 0x0E00000000000100},
+ {"ob_pll_gptr" , 0x03, 0x09, 0x09, "ob_pll_gptr_ring" , NON_VPD_PLL_RING, 0, 0x0002000000008000},
+ {"ob_pll_other" , 0x04, 0x09, 0x09, "ob_pll_other_ring" , NON_VPD_PLL_RING, 0, 0x0002000000005F70},
+ {"ob_pll_bndy_bucket_1" , 0x05, 0x09, 0x09, "ob_pll_bndy_bucket_1_ring" , NON_VPD_PLL_RING, 0, 0x0002000000008000},
+ {"ob_pll_bndy_bucket_2" , 0x06, 0x09, 0x09, "ob_pll_bndy_bucket_2_ring" , NON_VPD_PLL_RING, 0, 0x0002000000008000},
+ {"ob_pll_bndy_bucket_3" , 0x07, 0x09, 0x09, "ob_pll_bndy_bucket_3_ring" , NON_VPD_PLL_RING, 0, 0x0002000000008000},
+ {"ob_pll_bndy_bucket_4" , 0x08, 0x09, 0x09, "ob_pll_bndy_bucket_4_ring" , NON_VPD_PLL_RING, 0, 0x0002000000008000},
+ {"ob_pll_bndy_bucket_5" , 0x09, 0x09, 0x09, "ob_pll_bndy_bucket_5_ring" , NON_VPD_PLL_RING, 0, 0x0002000000008000},
+};
+const GenRingIdList RING_ID_LIST_INSTANCE[] =
+{
+ {"ob_repr" , 0x0a, 0x09, 0x0C, "ob_repr_ring" , NON_VPD_RING, 0, 0x0E00000000000200},
+};
+};
+namespace PCI0
+{
+const GenRingIdList RING_ID_LIST_COMMON[] =
+{
+ {"pci0_fure" , 0x00, 0x0D, 0x0D, "pci0_fure_ring" , NON_VPD_RING, 0, 0x0E00000000009000},
+ {"pci0_gptr" , 0x01, 0x0D, 0x0D, "pci0_gptr_ring" , NON_VPD_RING, 0, 0x0E00000000002000},
+ {"pci0_time" , 0x02, 0x0D, 0x0D, "pci0_time_ring" , NON_VPD_RING, 0, 0x0E00000000000100},
+};
+const GenRingIdList RING_ID_LIST_INSTANCE[] =
+{
+ {"pci0_repr" , 0x03, 0x0D, 0x0D, "pci0_repr_ring" , NON_VPD_RING, 0, 0x0E00000000000200},
+};
+};
+namespace PCI1
+{
+const GenRingIdList RING_ID_LIST_COMMON[] =
+{
+ {"pci1_fure" , 0x00, 0x0E, 0x0E, "pci1_fure_ring" , NON_VPD_RING, 0, 0x0F00000000009000},
+ {"pci1_gptr" , 0x01, 0x0E, 0x0E, "pci1_gptr_ring" , NON_VPD_RING, 0, 0x0F00000000002000},
+ {"pci1_time" , 0x02, 0x0E, 0x0E, "pci1_time_ring" , NON_VPD_RING, 0, 0x0F00000000000100},
+};
+const GenRingIdList RING_ID_LIST_INSTANCE[] =
+{
+ {"pci1_repr" , 0x03, 0x0E, 0x0E, "pci1_repr_ring" , NON_VPD_RING, 0, 0x0F00000000000200},
+};
+};
+namespace PCI2
+{
+const GenRingIdList RING_ID_LIST_COMMON[] =
+{
+ {"pci2_fure" , 0x00, 0x0F, 0x0F, "pci2_fure_ring" , NON_VPD_RING, 0, 0x0F80000000009000},
+ {"pci2_gptr" , 0x01, 0x0F, 0x0F, "pci2_gptr_ring" , NON_VPD_RING, 0, 0x0F80000000002000},
+ {"pci2_time" , 0x02, 0x0F, 0x0F, "pci2_time_ring" , NON_VPD_RING, 0, 0x0F80000000000100},
+};
+const GenRingIdList RING_ID_LIST_INSTANCE[] =
+{
+ {"pci2_repr" , 0x03, 0x0F, 0x0F, "pci2_repr_ring" , NON_VPD_RING, 0, 0x0F80000000000200},
+};
+};
+namespace EQ
+{
+const GenRingIdList RING_ID_LIST_COMMON[] =
+{
+ {"eq_fure" , 0x00, 0x10, 0x10, "eq_fure_ring" , NON_VPD_RING, 0, 0x0C10000000009000},
+ {"eq_gptr" , 0x01, 0x10, 0x10, "eq_gptr_ring" , NON_VPD_RING, 0, 0x0C10000000004000},
+ {"eq_time" , 0x02, 0x10, 0x10, "eq_time_ring" , NON_VPD_RING, 0, 0x0C10000000000100},
+ {"ex_l3_fure" , 0x03, 0x10, 0x10, "ex_l3_fure_ring" , NON_VPD_RING, 0, 0x0200000000009000},
+ {"ex_l3_gptr" , 0x04, 0x10, 0x10, "ex_l3_gptr_ring" , NON_VPD_RING, 0, 0x0200000000004000},
+ {"ex_l3_time" , 0x05, 0x10, 0x10, "ex_l3_time_ring" , NON_VPD_RING, 0, 0x0200000000000100},
+ {"ex_l2_fure" , 0x06, 0x10, 0x10, "ex_l2_fure_ring" , NON_VPD_RING, 0, 0x0080000000009000},
+ {"ex_l2_gptr" , 0x07, 0x10, 0x10, "ex_l2_gptr_ring" , NON_VPD_RING, 0, 0x0080000000004000},
+ {"ex_l2_time" , 0x08, 0x10, 0x10, "ex_l2_time_ring" , NON_VPD_RING, 0, 0x0080000000000100},
+ {"ex_l3_refr_fure" , 0x09, 0x10, 0x10, "ex_l3_refr_fure_ring" , NON_VPD_RING, 0, 0x0008000000009000},
+ {"ex_l3_refr_gptr" , 0x0A, 0x10, 0x10, "ex_l3_refr_gptr_ring" , NON_VPD_RING, 0, 0x0008000000004000},
+ {"ex_l3_refr_time" , 0x0B, 0x10, 0x10, "ex_l3_refr_time_ring" , NON_VPD_RING, 0, 0x0008000000000100},
+ {"eq_ana_func" , 0x0C, 0x10, 0x10, "eq_ana_func_ring" , NON_VPD_RING, 0, 0x002000000000C000},
+ {"eq_ana_gptr" , 0x0D, 0x10, 0x10, "eq_ana_gptr_ring" , NON_VPD_RING, 0, 0x0020000000002000},
+ {"eq_dpll_func_bucket_1" , 0x0E, 0x10, 0x10, "eq_dpll_func_bucket_1" , NON_VPD_PLL_RING, 0, 0x0002000000000080},
+ {"eq_dpll_func_bucket_2" , 0x0F, 0x10, 0x10, "eq_dpll_func_bucket_2" , NON_VPD_PLL_RING, 0, 0x0002000000000080},
+ {"eq_dpll_func_bucket_3" , 0x10, 0x10, 0x10, "eq_dpll_func_bucket_3" , NON_VPD_PLL_RING, 0, 0x0002000000000080},
+ {"eq_dpll_func_bucket_4" , 0x11, 0x10, 0x10, "eq_dpll_func_bucket_4" , NON_VPD_PLL_RING, 0, 0x0002000000000080},
+ {"eq_dpll_func_bucket_5" , 0x12, 0x10, 0x10, "eq_dpll_func_bucket_5" , NON_VPD_PLL_RING, 0, 0x0002000000000080},
+ {"eq_dpll_gptr" , 0x13, 0x10, 0x10, "eq_dpll_gptr_ring" , NON_VPD_PLL_RING, 0, 0x0002000000002000},
+ {"eq_dpll_other" , 0x14, 0x10, 0x10, "eq_dpll_other_ring" , NON_VPD_PLL_RING, 0, 0x0002000000005F70},
+ {"eq_ana_bndy" , 0x15, 0x10, 0x10, "eq_ana_bndy_ring" , NON_VPD_PLL_RING, 0, 0x0002000000000080},
+
+};
+const GenRingIdList RING_ID_LIST_INSTANCE[] =
+{
+ {"eq_repr" , 0x16, 0x10, 0x15, "eq_repr_ring" , NON_VPD_RING, 0, 0x0237516800000512},
+ {"ex_l3_repr" , 0x17, 0x10, 0x15, "ex_l3_repr_ring" , NON_VPD_RING, 0, 0x3355443200000512},
+ {"ex_l2_repr" , 0x18, 0x10, 0x15, "ex_l2_repr_ring" , NON_VPD_RING, 0, 0x0838860800000512},
+ {"ex_l3_refr_repr" , 0x19, 0x10, 0x15, "ex_l3_refr_repr_ring" , NON_VPD_RING, 0, 0x0052428800000512},
+};
+};
+namespace EC
+{
+const GenRingIdList RING_ID_LIST_COMMON[] =
+{
+ /* ringName rinngId chipIdMin chipIdMax ringNameImg mvpdKeyword */
+ { "ec_func" , 0x00, 0x20, 0x20, "ec_func_ring", NON_VPD_RING, 0, 0x0E00000000009000},
+ { "ec_time" , 0x01, 0x20, 0x20, "ec_time_ring", NON_VPD_RING, 0, 0x0E00000000000100},
+ { "ec_gptr" , 0x02, 0x20, 0x20, "ec_gptr_ring", NON_VPD_RING, 0, 0x0E00000000002000},
+ { "ec_mode" , 0x03, 0x20, 0x20, "ec_mode_ring", NON_VPD_RING, 0, 0x0E00000000004000},
+};
+const GenRingIdList RING_ID_LIST_INSTANCE[] =
+{
+ { "ec_repr" , 0x04, 0x20, 0x37, "ec_repr_ring", NON_VPD_RING, 0, 0x0E00000000000200},
+};
+};
+
+
+
+
+
+
+
+
diff --git a/src/import/chips/p9/utils/imageProcs/p9_tor.C b/src/import/chips/p9/utils/imageProcs/p9_tor.C
new file mode 100644
index 00000000..f281b165
--- /dev/null
+++ b/src/import/chips/p9/utils/imageProcs/p9_tor.C
@@ -0,0 +1,1833 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/import/chips/p9/utils/imageProcs/p9_tor.C $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2016 */
+/* [+] 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 "p9_tor.H"
+
+//
+// PPE type names:
+// These strings must adhere precisely to the enum of PpeType.
+//
+const char* ppeTypeName[] = { "SBE",
+ "CME",
+ "SGPE",
+ "DEADBEAF"
+ };
+
+//
+// Ring variant names:
+// These strings must adhere precisely to the enum of RingVariant.
+//
+const char* ringVariantName[] = { "Base",
+ "CacheContained",
+ "RiskLevel"
+ "Override",
+ "Overlay",
+ "DEADBEAF"
+ };
+
+
+
+///////////////////////////////////////////////////////////////////////////////////
+///
+/// extract RS4 extract from HW image
+///
+//////////////////////////////////////////////////////////////////////////////////
+int get_ring_from_sbe_image ( void* i_ringSectionPtr, // Image pointer
+ uint64_t i_magic, // Image Magic Number
+ RingID i_ringId, // Unique ring I
+ uint16_t i_ddLevel, // DD level details
+ RingType_t& io_RingType, // 0: Common 1: Instance
+ RingVariant_t
+ i_RingVariant, // Base, cache contained, Risk level, Override and Overlay
+ uint8_t& io_instanceId, // chiplet Instance id indo
+ RingBlockType_t i_RingBlockType, // 0: single ring, 1: ddLevel block
+ void** io_ringBlockPtr, // RS4 Container data or block data
+ uint32_t& io_ringBlockSize, // size of data copied into ring block pointer
+ char* o_ringName, // Name of ring
+ uint32_t dbgl) // Debug option
+{
+
+ uint32_t ring_offset = 0;
+ uint16_t chiplet_offset = 0;
+ uint32_t next_ring_offset = 0;
+ uint32_t ringSize = 0;
+ int temp = i_ddLevel >> 2;
+ uint32_t* deltaRingRS4_4B;
+ uint32_t sbe_offset = 0;
+
+ if (i_magic == P9_XIP_MAGIC_HW)
+ {
+ sbe_offset = *((uint32_t*)i_ringSectionPtr + temp);
+ temp = myRev32(sbe_offset);
+ }
+ else if (i_magic == P9_XIP_MAGIC_SEEPROM)
+ {
+ sbe_offset = 0;
+ i_ddLevel = 0;
+ temp = myRev32(sbe_offset);
+ }
+
+ // Looper for each SBE chiplet
+ for(int l = 0; l < MAX_CPLT_SBE; l++) //MAX_CPLT_SBE
+ {
+ GenRingIdList* ring_id_list_common = NULL;
+ GenRingIdList* ring_id_list_instance = NULL;
+ CHIPLET_DATA l_cpltData;
+ uint8_t iv_num_variant = 0;
+
+ switch (l)
+ {
+ case 0 :
+ l_cpltData = PERV::g_pervData;
+ iv_num_variant = (uint8_t)sizeof(PERV::RingVariants) / sizeof(uint16_t);
+ ring_id_list_common = (GenRingIdList*) PERV::RING_ID_LIST_COMMON;
+ ring_id_list_instance = (GenRingIdList*) PERV::RING_ID_LIST_INSTANCE;
+ break;
+
+ case 1 :
+ l_cpltData = N0::g_n0Data;
+ iv_num_variant = (uint8_t)sizeof(N0::RingVariants) / sizeof(uint16_t);
+ ring_id_list_common = (GenRingIdList*) N0::RING_ID_LIST_COMMON;
+ ring_id_list_instance = (GenRingIdList*) N0::RING_ID_LIST_INSTANCE;
+ break;
+
+ case 2 :
+ l_cpltData = N1::g_n1Data;
+ iv_num_variant = (uint8_t)sizeof(N1::RingVariants) / sizeof(uint16_t);
+ ring_id_list_common = (GenRingIdList*) N1::RING_ID_LIST_COMMON;
+ ring_id_list_instance = (GenRingIdList*) N1::RING_ID_LIST_INSTANCE;
+ break;
+
+ case 3 :
+ l_cpltData = N2::g_n2Data;
+ iv_num_variant = (uint8_t)sizeof(N2::RingVariants) / sizeof(uint16_t);
+ ring_id_list_common = (GenRingIdList*) N2::RING_ID_LIST_COMMON;
+ ring_id_list_instance = (GenRingIdList*) N2::RING_ID_LIST_INSTANCE;
+ break;
+
+ case 4 :
+ l_cpltData = N3::g_n3Data;
+ iv_num_variant = (uint8_t)sizeof(N3::RingVariants) / sizeof(uint16_t);
+ ring_id_list_common = (GenRingIdList*) N3::RING_ID_LIST_COMMON;
+ ring_id_list_instance = (GenRingIdList*) N3::RING_ID_LIST_INSTANCE;
+ break;
+
+ case 5 :
+ l_cpltData = XB::g_xbData;
+ iv_num_variant = (uint8_t)sizeof(XB::RingVariants) / sizeof(uint16_t);
+ ring_id_list_common = (GenRingIdList*) XB::RING_ID_LIST_COMMON;
+ ring_id_list_instance = (GenRingIdList*) XB::RING_ID_LIST_INSTANCE;
+ break;
+
+ case 6 :
+ l_cpltData = MC::g_mcData;
+ iv_num_variant = (uint8_t)sizeof(MC::RingVariants) / sizeof(uint16_t);
+ ring_id_list_common = (GenRingIdList*) MC::RING_ID_LIST_COMMON;
+ ring_id_list_instance = (GenRingIdList*) MC::RING_ID_LIST_INSTANCE;
+ break;
+
+ case 7 :
+ l_cpltData = OB::g_obData;
+ iv_num_variant = (uint8_t)sizeof(OB::RingVariants) / sizeof(uint16_t);
+ ring_id_list_common = (GenRingIdList*) OB::RING_ID_LIST_COMMON;
+ ring_id_list_instance = (GenRingIdList*) OB::RING_ID_LIST_INSTANCE;
+ break;
+
+ case 8 :
+ l_cpltData = PCI0::g_pci0Data;
+ iv_num_variant = (uint8_t)sizeof(PCI0::RingVariants) / sizeof(uint16_t);
+ ring_id_list_common = (GenRingIdList*) PCI0::RING_ID_LIST_COMMON;
+ ring_id_list_instance = (GenRingIdList*) PCI0::RING_ID_LIST_INSTANCE;
+ break;
+
+ case 9 :
+ l_cpltData = PCI1::g_pci1Data;
+ iv_num_variant = (uint8_t)sizeof(PCI1::RingVariants) / sizeof(uint16_t);
+ ring_id_list_common = (GenRingIdList*) PCI1::RING_ID_LIST_COMMON;
+ ring_id_list_instance = (GenRingIdList*) PCI1::RING_ID_LIST_INSTANCE;
+ break;
+
+ case 10 :
+ l_cpltData = PCI2::g_pci2Data;
+ iv_num_variant = (uint8_t)sizeof(PCI2::RingVariants) / sizeof(uint16_t);
+ ring_id_list_common = (GenRingIdList*) PCI2::RING_ID_LIST_COMMON;
+ ring_id_list_instance = (GenRingIdList*) PCI2::RING_ID_LIST_INSTANCE;
+ break;
+
+ case 11 :
+ l_cpltData = EQ::g_eqData;
+ iv_num_variant = (uint8_t)sizeof(EQ::RingVariants) / sizeof(uint16_t);
+ ring_id_list_common = (GenRingIdList*) EQ::RING_ID_LIST_COMMON;
+ ring_id_list_instance = (GenRingIdList*) EQ::RING_ID_LIST_INSTANCE;
+ break;
+
+ case 12 :
+ l_cpltData = EC::g_ecData;
+ iv_num_variant = (uint8_t)sizeof(EC::RingVariants) / sizeof(uint16_t);
+ ring_id_list_common = (GenRingIdList*) EC::RING_ID_LIST_COMMON;
+ ring_id_list_instance = (GenRingIdList*) EC::RING_ID_LIST_INSTANCE;
+ break;
+
+ default :
+ printf("Not valid selection\n");
+ }
+
+ if(dbgl > 1)
+ {
+ printf(" No of CommonRing %d, No of InstanceRing %d, No of Variants %d \n",
+ l_cpltData.iv_num_common_rings, l_cpltData.iv_num_instance_rings,
+ iv_num_variant);
+ }
+
+ uint32_t local = 0;
+
+ for (uint8_t i = 0; i < l_cpltData.iv_num_common_rings ; i++)
+ {
+ for (uint8_t j = 0; j < iv_num_variant ; j++)
+ {
+ if(dbgl > 2)
+ {
+ printf(" Ring name %s Cplt Common ring id %d Variant id %d",
+ (ring_id_list_common + i)->ringNameImg, i, j);
+ }
+
+ if((strcmp( (ring_id_list_common + i)->ringName,
+ RING_PROPERTIES[i_ringId].iv_name) == 0)
+ && ( i_RingVariant == j ))
+ {
+ strcpy(o_ringName, RING_PROPERTIES[i_ringId].iv_name);
+ int var = l * 8 + i_ddLevel + temp;
+ int temp1 = var / 4;
+ ring_offset = *((uint32_t*)i_ringSectionPtr + temp1);
+ ring_offset = myRev32(ring_offset);
+ var = ring_offset + i_ddLevel + temp;
+ temp1 = var / 2 + local;
+ chiplet_offset = *((uint16_t*)i_ringSectionPtr + temp1);
+ chiplet_offset = myRev16(chiplet_offset);
+
+ if(i_RingBlockType == SINGLE_RING)
+ {
+ var = ring_offset + (chiplet_offset - 8) + i_ddLevel + temp;
+ temp1 = var / 4;
+ next_ring_offset = *((uint32_t*)i_ringSectionPtr + temp1);
+ next_ring_offset = myRev32(next_ring_offset);
+ ringSize = next_ring_offset;
+
+ if (chiplet_offset)
+ {
+ if ((*io_ringBlockPtr) == NULL)
+ {
+ printf("\tmalloc() of initf buffer failed...\n");
+ io_ringBlockSize = ringSize;
+ return 0;
+ }
+ else if (io_ringBlockSize < ringSize)
+ {
+ printf("\tio_ringBlockSize is less than required size ...\n");
+ io_ringBlockSize = ringSize;
+ return 0;
+ }
+
+ if(dbgl > 1)
+ {
+ printf(" ring container of %s is found in the SBE image container \n",
+ o_ringName);
+ }
+
+ // Copying single ring into ring block pointer
+ memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSectionPtr + var,
+ (size_t)ringSize);
+ io_ringBlockSize = ringSize;
+ io_instanceId = (ring_id_list_common + i)->instanceIdMin;
+ io_RingType = COMMON;
+
+ if(dbgl > 0)
+ {
+ printf(" After get_ring_from_sbe_image Size %d \n", io_ringBlockSize);
+ }
+
+ // Debug details for each offset address in DD TOR, DD TOR, SBE TOP TOR, SBE common/instance TOR, ring size
+ if(dbgl > 1)
+ {
+ printf("Hexdetalis Chiplet offset 0x%08x local offset 0x%08x " \
+ "ring offset 0x%08x start adr 0x%08x size 0x%08x size 0x%08x \n",
+ var, temp, ring_offset, chiplet_offset, next_ring_offset, ringSize);
+ printf("Chiplet %d ChipletRing TOR offset %d %d %d Size %d %d \t\n",
+ i, ring_offset, chiplet_offset, next_ring_offset, ringSize, temp);
+ }
+
+ if(dbgl > 2)
+ {
+ deltaRingRS4_4B = (uint32_t*)(*io_ringBlockPtr);
+
+ for (uint32_t m = 0; m < ringSize / 4; m++)
+ {
+ printf("compressed data %d --- %08x \t", m, myRev32(deltaRingRS4_4B[m]));
+ }
+
+ printf("\n");
+ }
+
+ return IMGBUILD_TGR_RING_FOUND;
+ }
+ else
+ {
+ printf(" ring container of %s is not found in the SBE image container \n",
+ o_ringName);
+ return IMGBUILD_TGR_RING_NOT_FOUND;
+ }
+ }
+ }
+
+ local++;
+ }
+ }
+
+ local = 0;
+
+ for(uint8_t i = (ring_id_list_instance + 0)->instanceIdMin;
+ i < (ring_id_list_instance + 0)->instanceIdMax + 1 ; i++)
+ {
+ for (uint8_t j = 0; j < l_cpltData.iv_num_instance_rings; j++)
+ {
+ for(uint8_t k = 0; k < iv_num_variant ; k++)
+ {
+ if(dbgl > 2)
+ {
+ printf(" Ring name %s Cplt instance ring id %d Variant id %d Instance id %d\n",
+ (ring_id_list_instance + j)->ringNameImg, j, k, i);
+ }
+
+ if (strcmp( (ring_id_list_instance + j)->ringName,
+ RING_PROPERTIES[i_ringId].iv_name) == 0)
+ {
+ if( io_instanceId >= (ring_id_list_instance + 0)->instanceIdMin
+ && io_instanceId <= (ring_id_list_instance + 0)->instanceIdMax)
+ {
+ if( i == io_instanceId && k == i_RingVariant )
+ {
+ strcpy(o_ringName, RING_PROPERTIES[i_ringId].iv_name);
+ uint32_t var = l * 8 + i_ddLevel + temp + 4;
+ int temp1 = var / 4;
+ ring_offset = *((uint32_t*)i_ringSectionPtr + temp1);
+ ring_offset = myRev32(ring_offset);
+ var = ring_offset + i_ddLevel + temp;
+ temp1 = var / 2 + local;
+ chiplet_offset = *((uint16_t*)i_ringSectionPtr + temp1);
+ chiplet_offset = myRev16(chiplet_offset);
+
+ if(i_RingBlockType == SINGLE_RING)
+ {
+ var = ring_offset + (chiplet_offset - 8) + i_ddLevel + temp;
+ temp1 = var / 4;
+ next_ring_offset = *((uint32_t*)i_ringSectionPtr + temp1);
+ next_ring_offset = myRev32(next_ring_offset);
+ ringSize = next_ring_offset;
+
+ if (chiplet_offset)
+ {
+ if ((*io_ringBlockPtr) == NULL)
+ {
+ printf("\tmalloc() of initf buffer failed...\n");
+ io_ringBlockSize = ringSize;
+ return 0;
+ }
+ else if (io_ringBlockSize < ringSize)
+ {
+ printf("\tio_ringBlockSize is less than required size ...\n");
+ io_ringBlockSize = ringSize;
+ return 0;
+ }
+
+ if(dbgl > 0)
+ {
+ printf(" ring container of %s is found in the SBE image container \n",
+ o_ringName);
+ }
+
+ memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSectionPtr + var,
+ (size_t)ringSize);
+ io_ringBlockSize = ringSize;
+ io_RingType = INSTANCE;
+
+ if(dbgl > 0)
+ {
+ printf(" After get_ring_from_sbe_image Size %d \n", io_ringBlockSize);
+ }
+
+ // Debug details for each offset address in DD TOR, DD TOR, SBE TOP TOR, SBE common/instance TOR, ring size
+ if(dbgl > 1)
+ {
+ printf(" 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x \n",
+ var, temp, ring_offset, chiplet_offset, next_ring_offset, ringSize);
+ printf("Chiplet %d ChipletRing TOR offset %d %d %d Size %d %d \t\n",
+ i, ring_offset, chiplet_offset, next_ring_offset, ringSize, temp);
+ }
+
+ if(dbgl > 2)
+ {
+ deltaRingRS4_4B = (uint32_t*)(*io_ringBlockPtr);
+
+ for (uint32_t m = 0; m < ringSize / 4; m++)
+ {
+ printf("compressed data %d --- %08x \t",
+ m, myRev32(deltaRingRS4_4B[m]));
+ }
+
+ printf("\n");
+ }
+
+ return IMGBUILD_TGR_RING_FOUND;
+ }
+ else
+ {
+ printf(" ring container of %s is not found in the SBE image container \n",
+ o_ringName);
+ //*io_ringBlockSize = 0;
+ //ringSize = 0;
+ //(*io_ringBlockPtr) = malloc(ringSize);
+ return IMGBUILD_TGR_RING_NOT_FOUND;
+ }
+ }
+ }
+
+ }
+ else
+ {
+ printf(" SBE ring instance ID %d is invalid, Valid ID is from %d to %d \n",
+ io_instanceId, (ring_id_list_instance + 0)->instanceIdMin,
+ (ring_id_list_instance + 0)->instanceIdMax);
+ return IMGBUILD_INVALID_INSTANCEID;
+ }
+ }
+
+ local++;
+ }
+
+ //printf("\n");
+ }
+
+ }
+
+ }
+
+ return IMGBUILD_TGR_RING_NOT_FOUND;
+}
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+int get_ring_from_sgpe_image ( void*
+ i_ringSectionPtr, // Image pointer
+ RingID i_ringId, // Unique ring I
+ uint16_t i_ddLevel, // DD level details
+ RingType_t& io_RingType, // 0: Common 1: Instance
+ RingVariant_t
+ i_RingVariant, // Variant -> Base, cache contained, Risk level,
+ // Override and Overlay
+ uint8_t& io_instanceId, // required Instance
+ RingBlockType_t i_RingBlockType, // 0: single ring, 1: ddLevel block
+ void** io_ringBlockPtr, // RS4 Container data or block data
+ uint32_t&
+ io_ringBlockSize, // size of data copied into ring block pointer
+ char* o_ringName, // Name of ring
+ uint32_t dbgl) // Debug option
+{
+ uint32_t ring_offset = 0;
+ uint16_t chiplet_offset = 0;
+ uint32_t next_ring_offset = 0;
+ uint32_t ringSize = 0;
+ int temp = (i_ddLevel >> 2) + 4;
+ uint32_t* deltaRingRS4_4B;
+ uint32_t spge_offset = *((uint32_t*)i_ringSectionPtr + temp);
+ temp = myRev32(spge_offset);
+ GenRingIdList* ring_id_list_common = NULL;
+ GenRingIdList* ring_id_list_instance = NULL;
+ uint8_t iv_num_variant = (uint8_t)sizeof(EQ::RingVariants) / sizeof(uint16_t);
+ ring_id_list_common = (GenRingIdList*) EQ::RING_ID_LIST_COMMON;
+ ring_id_list_instance = (GenRingIdList*) EQ::RING_ID_LIST_INSTANCE;
+
+ uint32_t local = 0;
+
+ for (uint8_t i = 0; i < EQ::g_eqData.iv_num_common_rings ; i++)
+ {
+ for (uint8_t j = 0; j < iv_num_variant ; j++)
+ {
+ if(dbgl > 2)
+ {
+ printf(" Ring name %s Cplt Common ring id %d Variant id %d",
+ (ring_id_list_common + i)->ringNameImg, i, j);
+ }
+
+ if((strcmp( (ring_id_list_common + i)->ringName,
+ RING_PROPERTIES[i_ringId].iv_name) == 0) && ( i_RingVariant == j ))
+ {
+ strcpy(o_ringName, RING_PROPERTIES[i_ringId].iv_name);
+ int var = 0 + i_ddLevel + temp;
+ int temp1 = var / 4;
+ ring_offset = *((uint32_t*)i_ringSectionPtr + temp1);
+ ring_offset = myRev32(ring_offset);
+ var = ring_offset + i_ddLevel + temp;
+ temp1 = var / 2 + local;
+ chiplet_offset = *((uint16_t*)i_ringSectionPtr + temp1);
+ chiplet_offset = myRev16(chiplet_offset);
+
+ if (i_RingBlockType == SINGLE_RING)
+ {
+ var = ring_offset + (chiplet_offset - 8) + i_ddLevel + temp;
+ temp1 = var / 4;
+ next_ring_offset = *((uint32_t*)i_ringSectionPtr + temp1);
+ next_ring_offset = myRev32(next_ring_offset);
+ ringSize = next_ring_offset;
+
+ if (chiplet_offset)
+ {
+ if ((*io_ringBlockPtr) == NULL)
+ {
+ printf("\tmalloc() of initf buffer failed...\n");
+ io_ringBlockSize = ringSize;
+ return 0;
+ }
+ else if (io_ringBlockSize < ringSize)
+ {
+ printf("\tio_ringBlockSize is less than required size ...\n");
+ io_ringBlockSize = ringSize;
+ return 0;
+ }
+
+ if(dbgl > 0)
+ {
+ printf(" ring container of %s is found in the SGPE image container && ring offset %d \n",
+ o_ringName, chiplet_offset);
+ }
+
+ // Copying ring data into io buffer
+ memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSectionPtr + var,
+ (size_t)ringSize);
+ io_ringBlockSize = ringSize;
+ io_instanceId = (ring_id_list_common + i)->instanceIdMin;
+ io_RingType = COMMON;
+
+ // Debug details for each offset address in DD TOR, DD TOR, SBE TOP TOR, SBE common/instance TOR, ring size
+ if(dbgl > 0)
+ {
+ printf(" After get_ring_from_sbe_image Size %d \n", io_ringBlockSize);
+ }
+
+ if(dbgl > 1)
+ {
+ printf("Hexdetalis Chiplet offset 0x%08x local offset 0x%08x " \
+ "ring offset 0x%08x start adr 0x%08x size 0x%08x size 0x%08x \n",
+ var, temp, ring_offset, chiplet_offset, next_ring_offset, ringSize);
+ printf("Chiplet %d ChipletRing TOR offset %d %d %d Size %d %d \t\n",
+ i, ring_offset, chiplet_offset, next_ring_offset, ringSize, temp);
+ }
+
+ if(dbgl > 2)
+ {
+ deltaRingRS4_4B = (uint32_t*)(*io_ringBlockPtr);
+
+ for (uint32_t m = 0; m < ringSize / 4; m++)
+ {
+ printf("compressed data %d --- %08x \t", m, myRev32(deltaRingRS4_4B[m]));
+ }
+
+ printf("\n");
+ }
+
+ return IMGBUILD_TGR_RING_FOUND;
+ }
+ else
+ {
+ printf(" ring container of %s is not found in the SGPE image container \n",
+ o_ringName);
+ return IMGBUILD_TGR_RING_NOT_FOUND;
+ }
+ }
+ }
+
+ local++;
+ }
+
+ //printf ("\n");
+ }
+
+ // Instance specific single ring extract loop
+ local = 0;
+
+ for(uint8_t i = (ring_id_list_instance + 0)->instanceIdMin;
+ i < (ring_id_list_instance + 0)->instanceIdMax + 1 ; i++)
+ {
+ for (uint8_t j = 0; j < EQ::g_eqData.iv_num_instance_rings; j++)
+ {
+ for(uint8_t k = 0; k < iv_num_variant ; k++)
+ {
+ if(dbgl > 2)
+ {
+ printf(" Ring name %s Cplt instance ring id %d Variant id %d",
+ (ring_id_list_instance + j)->ringNameImg, j, k);
+ }
+
+ if (strcmp( (ring_id_list_instance + j)->ringName,
+ RING_PROPERTIES[i_ringId].iv_name) == 0)
+ {
+ if( io_instanceId >= (ring_id_list_instance + 0)->instanceIdMin
+ && io_instanceId <= (ring_id_list_instance + 0)->instanceIdMax)
+ {
+ if( i == io_instanceId && k == i_RingVariant )
+ {
+ strcpy(o_ringName, RING_PROPERTIES[i_ringId].iv_name);
+ uint32_t var = 4 + i_ddLevel + temp;
+ int temp1 = var / 4;
+ ring_offset = *((uint32_t*)i_ringSectionPtr + temp1);
+ ring_offset = myRev32(ring_offset);
+ var = ring_offset + i_ddLevel + temp;
+ temp1 = var / 2 + local;
+ chiplet_offset = *((uint16_t*)i_ringSectionPtr + temp1);
+ chiplet_offset = myRev16(chiplet_offset);
+
+ if (i_RingBlockType == SINGLE_RING)
+ {
+ var = ring_offset + (chiplet_offset - 8) + i_ddLevel + temp;
+ temp1 = var / 4;
+ next_ring_offset = *((uint32_t*)i_ringSectionPtr + temp1);
+ next_ring_offset = myRev32(next_ring_offset);
+ ringSize = next_ring_offset;
+
+ if (chiplet_offset)
+ {
+ if ((*io_ringBlockPtr) == NULL)
+ {
+ printf("\tmalloc() of initf buffer failed...\n");
+ io_ringBlockSize = ringSize;
+ return 0;
+ }
+ else if (io_ringBlockSize < ringSize)
+ {
+ printf("\tio_ringBlockSize is less than required size ...\n");
+ io_ringBlockSize = ringSize;
+ return 0;
+ }
+
+ if(dbgl > 0)
+ {
+ printf(" ring container of %s is found in the SGPE image container \n",
+ o_ringName);
+ }
+
+ // Copying ring data into io_buffer
+ memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSectionPtr + var,
+ (size_t)ringSize);
+ io_ringBlockSize = ringSize;
+ io_RingType = INSTANCE;
+
+ if(dbgl > 0)
+ {
+ printf(" After get_ring_from_sbe_image Size %d \n", io_ringBlockSize);
+ }
+
+ // Debug details for each offset address in DD TOR, DD TOR, SBE TOP TOR, SBE common/instance TOR, ring size
+ if(dbgl > 1)
+ {
+ printf(" 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x \n",
+ var, temp, ring_offset, chiplet_offset, next_ring_offset, ringSize);
+ printf("Chiplet %d ChipletRing TOR offset %d %d %d Size %d %d \t\n",
+ i, ring_offset, chiplet_offset, next_ring_offset, ringSize, temp);
+ }
+
+ if(dbgl > 2)
+ {
+ deltaRingRS4_4B = (uint32_t*)(*io_ringBlockPtr);
+
+ for (uint32_t m = 0; m < ringSize / 4; m++)
+ {
+ printf("compressed data %d --- %08x \t", m, myRev32(deltaRingRS4_4B[m]));
+ }
+
+ printf("\n");
+ }
+
+ return IMGBUILD_TGR_RING_FOUND;
+ }
+ else
+ {
+ printf(" ring container of %s is not found in the SGPE image container \n",
+ o_ringName);
+ return IMGBUILD_TGR_RING_NOT_FOUND;
+ }
+ }
+ }
+ }
+ else
+ {
+ printf(" SGPE ring instance ID %d is invalid, Valid ID is from %d to %d \n",
+ io_instanceId, (ring_id_list_instance + 0)->instanceIdMin,
+ (ring_id_list_instance + 0)->instanceIdMax);
+ return IMGBUILD_INVALID_INSTANCEID;
+ }
+ }
+
+ local++;
+ }
+ }
+ }
+
+ return IMGBUILD_TGR_RING_NOT_FOUND;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// Get ring container from CME ring section
+//
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+int get_ring_from_cme_image ( void*
+ i_ringSectionPtr, // Image pointer
+ RingID i_ringId, // Unique ring I
+ uint16_t i_ddLevel, // DD level details
+ RingType_t& io_RingType, // 0: Common 1: Instance
+ RingVariant_t
+ i_RingVariant, // Variant -> Base, cache contained, Risk level, Override and Overlay
+ uint8_t& io_instanceId, // required Instance
+ RingBlockType_t i_RingBlockType, // 0: single ring, 1: ddLevel block
+ void** io_ringBlockPtr, // RS4 Container data or block data
+ uint32_t&
+ io_ringBlockSize, // size of data copied into ring block pointer
+ char* o_ringName, // Name of ring
+ uint32_t dbgl) // Debug option
+{
+ uint32_t ring_offset = 0;
+ uint16_t chiplet_offset = 0;
+ uint32_t next_ring_offset = 0;
+ uint32_t ringSize = 0;
+ int temp = (i_ddLevel >> 2) + 2;
+ uint32_t* deltaRingRS4_4B;
+ uint32_t spge_offset = *((uint32_t*)i_ringSectionPtr + temp);
+ temp = myRev32(spge_offset);
+ GenRingIdList* ring_id_list_common = NULL;
+ GenRingIdList* ring_id_list_instance = NULL;
+ uint8_t iv_num_variant = (uint8_t)sizeof(EC::RingVariants) / sizeof(uint16_t);
+ ring_id_list_common = (GenRingIdList*) EC::RING_ID_LIST_COMMON;
+ ring_id_list_instance = (GenRingIdList*) EC::RING_ID_LIST_INSTANCE;
+ //printf(" C %d I %d V %d \n",l_cpltData.iv_num_common_rings,l_cpltData.iv_num_instance_rings,iv_num_variant);
+ uint32_t local = 0;
+
+ for (uint8_t i = 0; i < EC::g_ecData.iv_num_common_rings ; i++)
+ {
+ for (uint8_t j = 0; j < iv_num_variant ; j++)
+ {
+ if(dbgl > 2)
+ {
+ printf(" Ring name %s Cplt Common ring id %d Variant id %d",
+ (ring_id_list_common + i)->ringNameImg, i, j);
+ }
+
+ if((strcmp( (ring_id_list_common + i)->ringName,
+ RING_PROPERTIES[i_ringId].iv_name) == 0) && ( i_RingVariant == j ))
+ {
+ strcpy(o_ringName, RING_PROPERTIES[i_ringId].iv_name);
+ int var = 0 + i_ddLevel + temp;
+ int temp1 = var / 4;
+ ring_offset = *((uint32_t*)i_ringSectionPtr + temp1);
+ ring_offset = myRev32(ring_offset);
+ var = ring_offset + i_ddLevel + temp;
+ temp1 = var / 2 + local;
+ chiplet_offset = *((uint16_t*)i_ringSectionPtr + temp1);
+ chiplet_offset = myRev16(chiplet_offset);
+
+ if (i_RingBlockType == SINGLE_RING)
+ {
+ var = ring_offset + (chiplet_offset - 8) + i_ddLevel + temp;
+ temp1 = var / 4;
+ next_ring_offset = *((uint32_t*)i_ringSectionPtr + temp1);
+ next_ring_offset = myRev32(next_ring_offset);
+ ringSize = next_ring_offset;
+
+ if (chiplet_offset)
+ {
+ if ((*io_ringBlockPtr) == NULL)
+ {
+ printf("\tmalloc() of initf buffer failed...\n");
+ io_ringBlockSize = ringSize;
+ return 0;
+ }
+ else if (io_ringBlockSize < ringSize)
+ {
+ printf("\tio_ringBlockSize is less than required size ...\n");
+ io_ringBlockSize = ringSize;
+ return 0;
+ }
+
+ if(dbgl > 0)
+ {
+ printf(" ring container of %s is found in the CME image container \n",
+ o_ringName);
+ }
+
+ // Copying ring data into io_buffer
+ memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSectionPtr + var,
+ (size_t)ringSize);
+ io_ringBlockSize = ringSize;
+ io_instanceId = (ring_id_list_common + i)->instanceIdMin;
+ io_RingType = COMMON;
+
+ // Debug details for each offset address in DD TOR, DD TOR, SBE TOP TOR, SBE common/instance TOR, ring size
+ if(dbgl > 0)
+ {
+ printf(" After get_ring_from_sbe_image Size %d \n", io_ringBlockSize);
+ }
+
+ if(dbgl > 1)
+ {
+ printf("Hexdetalis Chiplet offset 0x%08x local offset 0x%08x " \
+ "ring offset 0x%08x start adr 0x%08x size 0x%08x size 0x%08x \n",
+ var, temp, ring_offset, chiplet_offset, next_ring_offset, ringSize);
+ printf("Chiplet %d ChipletRing TOR offset %d %d %d Size %d %d \t\n",
+ i, ring_offset, chiplet_offset, next_ring_offset, ringSize, temp);
+ }
+
+ if(dbgl > 2)
+ {
+ deltaRingRS4_4B = (uint32_t*)(*io_ringBlockPtr);
+
+ for (uint32_t m = 0; m < ringSize / 4; m++)
+ {
+ printf("compressed data %d --- %08x \t", m, myRev32(deltaRingRS4_4B[m]));
+ }
+
+ printf("\n");
+ }
+
+ return IMGBUILD_TGR_RING_FOUND;
+ }
+ else
+ {
+ printf(" ring container of %s is not found in the CME image container \n",
+ o_ringName);
+ return IMGBUILD_TGR_RING_NOT_FOUND;
+ }
+ }
+ }
+
+ local++;
+ }
+ }
+
+ // Instance specific single ring extract loop
+ local = 0;
+
+ for(uint8_t z = 0; z < 12; z++)
+ {
+ for(uint8_t i = z * 2 + (ring_id_list_instance + 0)->instanceIdMin;
+ i < z * 2 + 2 + (ring_id_list_instance + 0)->instanceIdMin ; i++)
+ {
+ for (uint8_t j = 0; j < EC::g_ecData.iv_num_instance_rings; j++)
+ {
+ for(uint8_t k = 0; k < iv_num_variant ; k++)
+ {
+ if(dbgl > 2)
+ {
+ printf(" Ring name %s Cplt instance ring id %d Variant id %d",
+ (ring_id_list_instance + j)->ringNameImg, j, k);
+ }
+
+ if (strcmp( (ring_id_list_instance + j)->ringName,
+ RING_PROPERTIES[i_ringId].iv_name) == 0)
+ {
+ if( io_instanceId >= (ring_id_list_instance + 0)->instanceIdMin
+ && io_instanceId <= (ring_id_list_instance + 0)->instanceIdMax)
+ {
+ if( i == io_instanceId && k == i_RingVariant )
+ {
+ strcpy(o_ringName, RING_PROPERTIES[i_ringId].iv_name);
+ uint32_t var = z * 4 + i_ddLevel + temp + 4;
+ int temp1 = var / 4;
+ ring_offset = *((uint32_t*)i_ringSectionPtr + temp1);
+ ring_offset = myRev32(ring_offset);
+ var = ring_offset + i_ddLevel + temp;
+ temp1 = var / 2 + local;
+ chiplet_offset = *((uint16_t*)i_ringSectionPtr + temp1);
+ chiplet_offset = myRev16(chiplet_offset);
+
+ if (i_RingBlockType == SINGLE_RING)
+ {
+ var = ring_offset + (chiplet_offset - 8) + i_ddLevel + temp;
+ temp1 = var / 4;
+ next_ring_offset = *((uint32_t*)i_ringSectionPtr + temp1);
+ next_ring_offset = myRev32(next_ring_offset);
+ ringSize = next_ring_offset;
+
+ if (chiplet_offset)
+ {
+ if ((*io_ringBlockPtr) == NULL)
+ {
+ printf("\tmalloc() of initf buffer failed...\n");
+ io_ringBlockSize = ringSize;
+ return 0;
+ }
+ else if (io_ringBlockSize < ringSize)
+ {
+ printf("\tio_ringBlockSize is less than required size ...\n");
+ io_ringBlockSize = ringSize;
+ return 0;
+ }
+
+ if(dbgl > 0)
+ {
+ printf(" ring container of %s is found in the CME image container %d %d \n",
+ o_ringName, chiplet_offset, ringSize);
+ printf(" 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x \n",
+ var, temp, ring_offset, chiplet_offset, next_ring_offset, ringSize);
+ }
+
+ // Copying ring data into io_buffer
+ memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSectionPtr + var,
+ (size_t)ringSize);
+ io_ringBlockSize = ringSize;
+ io_RingType = INSTANCE;
+
+ // Debug details for each offset address in DD TOR, DD TOR, SBE TOP TOR, SBE common/instance TOR, ring size
+ if(dbgl > 0)
+ {
+ printf(" After get_ring_from_sbe_image Size %d \n", io_ringBlockSize);
+ }
+
+ if(dbgl > 1)
+ {
+ printf(" 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x \n",
+ var, temp, ring_offset, chiplet_offset, next_ring_offset, ringSize);
+ printf("Chiplet %d ChipletRing TOR offset %d %d %d Size %d %d \t\n",
+ i, ring_offset, chiplet_offset, next_ring_offset, ringSize, temp);
+ }
+
+ if(dbgl > 2)
+ {
+ deltaRingRS4_4B = (uint32_t*)(*io_ringBlockPtr);
+
+ for (uint32_t m = 0; m < ringSize / 4; m++)
+ {
+ printf("compressed data %d --- %08x \t", m, myRev32(deltaRingRS4_4B[m]));
+ }
+
+ printf("\n");
+ }
+
+ return IMGBUILD_TGR_RING_FOUND;
+ }
+ else
+ {
+ printf(" ring container of %s is not found in the CME image container \n",
+ o_ringName);
+ return IMGBUILD_TGR_RING_NOT_FOUND;
+ }
+ }
+ }
+ }
+ else
+ {
+ printf(" CME ring instance ID %d is invalid, Valid ID is from %d to %d \n",
+ io_instanceId, (ring_id_list_instance + 0)->instanceIdMin,
+ (ring_id_list_instance + 0)->instanceIdMax);
+ return IMGBUILD_INVALID_INSTANCEID;
+ }
+ }
+
+ local++;
+ }
+ }
+ }
+ }
+
+ return IMGBUILD_TGR_RING_NOT_FOUND;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+///
+/// TOR GET RING API
+//////////////////////////////////////////////////////////////////////////////////////////
+
+int tor_get_ring( void*
+ i_ringSectionPtr, // Ring address Ptr any of .rings, .overrides and .overlays.
+ uint64_t i_magic, // Image Magic Number
+ RingID i_ringId, // Unique ring ID
+ uint16_t i_ddLevel, // DD level info
+ PpeType_t i_PpeType, // PPE type : SBE, CME, etc
+ RingType_t& io_RingType, // 0: Common 1: Instance
+ RingVariant_t i_RingVariant, // Base, Cache etc
+ uint8_t& io_instanceId, // chiplet instance ID
+ RingBlockType_t i_RingBlockType, // 0: single ring, 1: ring block
+ void** io_ringBlockPtr, // Addr of ring buffer
+ uint32_t& io_ringBlockSize, // size of ring data
+ char* o_ringName // Ring name
+ )
+{
+ int rc = 0;
+ uint32_t dbgl = 2;
+
+ if(dbgl > 1)
+ {
+ printf( "TOR_GET_RING(1): function call \n");
+ }
+
+ uint32_t ddLevelOffset = 0;
+ uint32_t ddLevelCount = 0;
+ uint32_t temp = 0, temp1 = 0, local = 0;
+
+ if(dbgl > 1)
+ {
+ printf( "TOR_GET_RING(2):DD Level info extracting from TOR \n");
+ }
+
+ if (i_magic == P9_XIP_MAGIC_HW)
+ {
+ ddLevelCount = *((uint32_t*)i_ringSectionPtr + 0);
+ ddLevelCount = myRev32(ddLevelCount);
+
+ if(dbgl > 1)
+ {
+ printf("TOR_GET_RING(3): No of DD levels in the TOR is %d \n", ddLevelCount);
+ }
+
+ for (uint8_t i = 0; i < ddLevelCount; i++)
+ {
+ local = 2;
+ ddLevelOffset = *((uint32_t*)i_ringSectionPtr + local);
+ temp = myRev32(ddLevelOffset) >> 24 & 0x000000FF;
+ ddLevelOffset = myRev32(ddLevelOffset) & 0x00FFFFFF;
+
+ if(dbgl > 1)
+ {
+ printf( "TOR_GET_RING(4): DD level offset %d DD %d level Copy \n",
+ ddLevelOffset, temp );
+ }
+
+ if ( temp == i_ddLevel)
+ {
+ ddLevelOffset = *((uint32_t*)i_ringSectionPtr + local);
+ ddLevelOffset = ddLevelOffset & 0xFFFFFF00;
+ ddLevelOffset = myRev32(ddLevelOffset);
+ ddLevelOffset = ddLevelOffset + 8;
+ local = local + 1;
+ temp1 = *((uint32_t*)i_ringSectionPtr + local);
+ temp1 = myRev32(temp1);
+ break;
+ }
+ }
+ }
+ else if( i_magic == P9_XIP_MAGIC_SEEPROM)
+ {
+ if ( i_PpeType == CME || i_PpeType == SGPE
+ || i_RingBlockType == DD_LEVEL_RINGS || i_RingBlockType == PPE_LEVEL_RINGS )
+ {
+ printf("Ambiguity on input PARMS for calling SEEPROM Ring copy API. \n "\
+ " DD level or ppe level ring copy are not allowed. As well " \
+ " CME and SGPE rings not populated on SEEPROM image \n");
+ return IMGBUILD_TGR_AMBIGUOUS_API_PARMS;
+ }
+
+ ddLevelOffset = 0;
+ temp1 = 0;
+ }
+
+ if(i_RingBlockType == DD_LEVEL_RINGS) // DD_LEVEL_COPY
+ {
+ //(*io_ringBlockPtr) = malloc(temp1);
+ if ((*io_ringBlockPtr) == NULL)
+ {
+ printf("\tmalloc() of initf buffer failed...\n");
+ io_ringBlockSize = temp1;
+ return 0;
+ }
+ else if (io_ringBlockSize < temp1)
+ {
+ printf("\tio_ringBlockSize is less than required size ...\n");
+ io_ringBlockSize = temp1;
+ return 0;
+ }
+
+ memcpy( (uint8_t*)(*io_ringBlockPtr),
+ (uint8_t*)i_ringSectionPtr + ddLevelOffset, (size_t)temp1);
+
+ if(dbgl > 1)
+ {
+ printf( " TOR_GET_RING(5): DD level offset %d DD %d size 0x%08x %d \n",
+ ddLevelOffset, temp, temp1, temp1);
+ }
+
+ io_ringBlockSize = temp1;
+ return IMGBUILD_TGR_RING_BLOCKS_FOUND;
+
+ }
+ else if (i_RingBlockType == PPE_LEVEL_RINGS)
+ {
+ uint32_t l_ppe_offset = 0;
+ uint32_t l_ppe_size = 0;
+
+ if(i_PpeType == SBE)
+ {
+ int temp = ddLevelOffset >> 2;
+
+ if(dbgl > 1)
+ {
+ printf( "TOR_GET_RING(6): SBE PPE_LEVEL_RING COPY called ... \n");
+ }
+
+ l_ppe_offset = *((uint32_t*)i_ringSectionPtr + temp);
+ l_ppe_offset = myRev32(l_ppe_offset);
+ l_ppe_size = *((uint32_t*)i_ringSectionPtr + temp + 1 );
+ l_ppe_size = myRev32(l_ppe_size);
+ }
+ else if (i_PpeType == CME)
+ {
+ int temp = (ddLevelOffset >> 2) + 2;
+
+ if(dbgl > 1)
+ {
+ printf( "TOR_GET_RING(7): CME PPE_LEVEL_RING COPY called... \n");
+ }
+
+ l_ppe_offset = *((uint32_t*)i_ringSectionPtr + temp);
+ l_ppe_offset = myRev32(l_ppe_offset);
+ l_ppe_size = *((uint32_t*)i_ringSectionPtr + temp + 1 );
+ l_ppe_size = myRev32(l_ppe_size);
+ }
+ else if (i_PpeType == SGPE)
+ {
+
+ int temp = (ddLevelOffset >> 2) + 4;
+
+ if(dbgl > 1)
+ {
+ printf( "TOR_GET_RING(8): SPGE PPE_LEVEL_RING COPY called... \n");
+ }
+
+ l_ppe_offset = *((uint32_t*)i_ringSectionPtr + temp);
+ l_ppe_offset = myRev32(l_ppe_offset);
+ l_ppe_size = *((uint32_t*)i_ringSectionPtr + temp + 1 );
+ l_ppe_size = myRev32(l_ppe_size);
+ }
+
+ if ((*io_ringBlockPtr) == NULL)
+ {
+ printf("\tmalloc() of initf buffer failed...\n");
+ io_ringBlockSize = l_ppe_size;
+ return 0;
+ }
+ else if (io_ringBlockSize < l_ppe_size)
+ {
+ printf("\tio_ringBlockSize is less than required size ....\n");
+ io_ringBlockSize = l_ppe_size;
+ return 0;
+ }
+
+ memcpy( (uint8_t*)(*io_ringBlockPtr),
+ (uint8_t*)i_ringSectionPtr + l_ppe_offset + ddLevelOffset,
+ (size_t)l_ppe_size);
+ io_ringBlockSize = l_ppe_size;
+ return IMGBUILD_TGR_RING_BLOCKS_FOUND;
+ }
+ else if (i_RingBlockType == CPLT_LEVEL_RINGS)
+ {
+ if(dbgl > 1)
+ {
+ printf( "TOR_GET_RING(9): CPLT_LEVEL_RING COPY called... \n");
+ }
+
+ if(io_RingType == ALLRING)
+ {
+ printf("Ambiguity on input PARMS. ALLRING RingType is invalid for CPLT level ring copy \n");
+ return IMGBUILD_TGR_AMBIGUOUS_API_PARMS;
+
+ }
+
+ uint32_t l_cplt_offset = 0;
+ uint32_t l_ppe_offset = 0;
+ uint32_t l_cplt_size = 0;
+
+ if(i_PpeType == SBE)
+ {
+ SbeTorId_t l_sbeTorId = SBEALL;
+
+ switch (io_instanceId)
+ {
+ case 1 :
+ l_sbeTorId = PERV_CPLT;
+ break;
+
+ case 2 :
+ l_sbeTorId = N0_CPLT;
+ break;
+
+ case 3 :
+ l_sbeTorId = N1_CPLT;
+ break;
+
+ case 4 :
+ l_sbeTorId = N2_CPLT;
+ break;
+
+ case 5 :
+ l_sbeTorId = N3_CPLT;
+ break;
+
+ case 6 :
+ l_sbeTorId = XB_CPLT;
+ break;
+
+ case 7 :
+ l_sbeTorId = MC_CPLT;
+ break;
+
+ case 9 :
+ l_sbeTorId = OB_CPLT;
+ break;
+
+ case 13 :
+ l_sbeTorId = PCI0_CPLT;
+ break;
+
+ case 14 :
+ l_sbeTorId = PCI1_CPLT;
+ break;
+
+ case 15 :
+ l_sbeTorId = PCI2_CPLT;
+ break;
+
+ case 16:
+ case 17:
+ case 18:
+ case 19:
+ case 20:
+ case 21:
+ l_sbeTorId = EQ_CPLT;
+ break;
+
+ case 32:
+ case 33:
+ case 34:
+ case 35:
+ case 36:
+ case 37:
+ case 38:
+ case 39:
+ case 40:
+ case 41:
+ case 42:
+ case 43:
+ case 44:
+ case 45:
+ case 46:
+ case 47:
+ case 48:
+ case 49:
+ case 50:
+ case 51:
+ case 52:
+ case 53:
+ case 54:
+ case 55:
+ l_sbeTorId = EC_CPLT;
+ break;
+
+ default :
+ printf("Not valid chiplet ID\n");
+ }
+
+ temp = (ddLevelOffset >> 2);
+ int l_word;
+
+ if (i_magic == P9_XIP_MAGIC_HW)
+ {
+ l_cplt_offset = *((uint32_t*)i_ringSectionPtr + temp);
+ }
+ else
+ {
+ l_cplt_offset = 0;
+ }
+
+ if(dbgl > 1)
+ {
+ printf("SBE(1):Offset 0x%08x \n", l_cplt_offset);
+ }
+
+ l_cplt_offset = myRev32(l_cplt_offset);
+ uint32_t l_ppe_cplt_offset = l_cplt_offset;
+ temp = temp + 2;
+ l_ppe_offset = *((uint32_t*)i_ringSectionPtr + temp);
+ l_ppe_offset = myRev32(l_ppe_offset);
+ temp1 = l_cplt_offset;
+
+ if(dbgl > 1)
+ {
+ printf("SBE(2):Offset 0x%08x 0x%08x 0x%08x 0x%08x\n", l_cplt_offset,
+ l_ppe_offset, temp, ddLevelOffset);
+ }
+
+ if (io_RingType == COMMON)
+ {
+ temp = l_cplt_offset + ddLevelOffset + (l_sbeTorId * 8);
+ l_word = temp >> 2;
+ temp = l_cplt_offset + ddLevelOffset;
+
+ if(dbgl > 1)
+ {
+ printf("SBE(3):COMMON Offset 0x%08x 0x%08x 0x%08x \n", l_cplt_offset,
+ l_ppe_offset, temp);
+ }
+ }
+ else
+ {
+ temp = l_cplt_offset + ddLevelOffset + (l_sbeTorId * 8) + 4;
+ l_word = temp >> 2;
+ temp = l_cplt_offset + ddLevelOffset;
+
+ if(dbgl > 1)
+ {
+ printf("SBE(4):INSTANCE Offset 0x%08x 0x%08x 0x%08x \n", l_cplt_offset,
+ l_ppe_offset, temp);
+ }
+ }
+
+ l_cplt_offset = *((uint32_t*)i_ringSectionPtr + l_word);
+ l_cplt_offset = myRev32(l_cplt_offset);
+ l_word++;
+
+ if(dbgl > 1)
+ {
+ printf("SBE(5):Offset 0x%08x size 0x%08x \n", l_cplt_offset, l_ppe_offset);
+ }
+
+ l_cplt_size = *((uint32_t*)i_ringSectionPtr + l_word );
+ l_cplt_size = myRev32(l_cplt_size);
+
+ if(l_sbeTorId == EC_CPLT && io_RingType == INSTANCE)
+ {
+ if(i_magic == P9_XIP_MAGIC_SEEPROM)
+ {
+ l_cplt_size = io_ringBlockSize - (l_cplt_offset + l_ppe_cplt_offset);
+ }
+ else
+ {
+ l_cplt_size = l_ppe_offset - (l_cplt_offset + l_ppe_cplt_offset);
+ }
+ }
+ else
+ {
+ l_cplt_size = l_cplt_size - l_cplt_offset;
+ }
+
+ l_cplt_offset = l_cplt_offset + ddLevelOffset;
+
+ if(dbgl > 1)
+ {
+ printf("SBE(6): Ring pointer Offset 0x%08x size 0x%08x \n", l_cplt_offset,
+ l_cplt_size);
+ }
+ }
+ else if (i_PpeType == CME)
+ {
+ CmeTorId_t l_cmeTorId = CMEALL;
+
+ switch (io_instanceId)
+ {
+ case 32:
+ case 33:
+ l_cmeTorId = CME0_CPLT;
+ break;
+
+ case 34:
+ case 35:
+ l_cmeTorId = CME1_CPLT;
+ break;
+
+ case 36:
+ case 37:
+ l_cmeTorId = CME2_CPLT;
+ break;
+
+ case 38:
+ case 39:
+ l_cmeTorId = CME3_CPLT;
+ break;
+
+ case 40:
+ case 41:
+ l_cmeTorId = CME4_CPLT;
+ break;
+
+ case 42:
+ case 43:
+ l_cmeTorId = CME5_CPLT;
+ break;
+
+ case 44:
+ case 45:
+ l_cmeTorId = CME6_CPLT;
+ break;
+
+ case 46:
+ case 47:
+ l_cmeTorId = CME7_CPLT;
+ break;
+
+ case 48:
+ case 49:
+ l_cmeTorId = CME8_CPLT;
+ break;
+
+ case 50:
+ case 51:
+ l_cmeTorId = CME9_CPLT;
+ break;
+
+ case 52:
+ case 53:
+ l_cmeTorId = CME10_CPLT;
+ break;
+
+ case 54:
+ case 55:
+ l_cmeTorId = CME11_CPLT;
+ break;
+
+ default :
+ printf("Not valid chiplet ID\n");
+ }
+
+ temp = (ddLevelOffset >> 2) + 2;
+ int l_word;
+ l_cplt_offset = *((uint32_t*)i_ringSectionPtr + temp);
+
+ if(dbgl > 1)
+ {
+ printf("CME(1):ppe type Offset 0x%08x \n", l_cplt_offset);
+ }
+
+ l_cplt_offset = myRev32(l_cplt_offset);
+ uint32_t l_ppe_cplt_offset = l_cplt_offset;
+ temp = temp + 2;
+ l_ppe_offset = *((uint32_t*)i_ringSectionPtr + temp);
+ l_ppe_offset = myRev32(l_ppe_offset);
+ temp1 = l_cplt_offset;
+
+ if(dbgl > 1)
+ {
+ printf("CME(2): Offsets 0x%08x 0x%08x 0x%08x \n", l_cplt_offset, l_ppe_offset,
+ temp);
+ }
+
+ if (io_RingType == COMMON)
+ {
+ temp = l_cplt_offset + ddLevelOffset;
+ l_word = temp >> 2;
+ temp = l_cplt_offset + ddLevelOffset;
+
+ if(dbgl > 1)
+ {
+ printf("CME(3):COMMON Offsets 0x%08x 0x%08x 0x%08x \n", l_cplt_offset,
+ l_ppe_offset, temp);
+ }
+ }
+ else
+ {
+ temp = l_cplt_offset + ddLevelOffset + (l_cmeTorId * 4) + 4;
+ l_word = temp >> 2;
+ temp = l_cplt_offset + ddLevelOffset;
+
+ if(dbgl > 1)
+ {
+ printf("CME(4):INSTANCE Offset 0x%08x 0x%08x 0x%08x 0x%08x \n", l_cplt_offset,
+ l_ppe_offset, l_ppe_cplt_offset, temp);
+ }
+ }
+
+ l_cplt_offset = *((uint32_t*)i_ringSectionPtr + l_word);
+ l_cplt_offset = myRev32(l_cplt_offset);
+ l_word++;
+
+ if(dbgl > 1)
+ {
+ printf("CME(5):Offset 0x%08x size 0x%08x \n", l_cplt_offset, l_ppe_offset);
+ }
+
+ l_cplt_size = *((uint32_t*)i_ringSectionPtr + l_word );
+ l_cplt_size = myRev32(l_cplt_size);
+
+ if(l_cmeTorId == CME11_CPLT && io_RingType == INSTANCE)
+ {
+ l_cplt_size = l_ppe_offset - (l_cplt_offset + l_ppe_cplt_offset);
+ }
+ else
+ {
+ l_cplt_size = l_cplt_size - l_cplt_offset;
+ }
+
+ l_cplt_offset = l_cplt_offset + ddLevelOffset;
+
+ if(dbgl > 1)
+ {
+ printf("CME(6): Ring pointer Offset 0x%08x size 0x%08x \n", l_cplt_offset,
+ l_cplt_size);
+ }
+ }
+ else if (i_PpeType == SGPE)
+ {
+
+ temp = (ddLevelOffset >> 2) + 4;
+ int l_word;
+ l_cplt_offset = *((uint32_t*)i_ringSectionPtr + temp);
+
+ if(dbgl > 1)
+ {
+ printf("SGPE(1):Offset 0x%08x \n", l_cplt_offset);
+ }
+
+ l_cplt_offset = myRev32(l_cplt_offset);
+
+ temp = temp + 1;
+ l_ppe_offset = *((uint32_t*)i_ringSectionPtr + temp);
+ l_ppe_offset = myRev32(l_ppe_offset);
+ temp1 = l_cplt_offset;
+
+ if(dbgl > 1)
+ {
+ printf("SGPE(2):Offset 0x%08x 0x%08x 0x%08x \n", l_cplt_offset, l_ppe_offset,
+ temp);
+ }
+
+ if (io_RingType == COMMON)
+ {
+ temp = l_cplt_offset + ddLevelOffset;
+ l_word = temp >> 2;
+ temp = l_cplt_offset + ddLevelOffset;
+
+ if(dbgl > 1)
+ {
+ printf("SGPE(3):COMMON Offset 0x%08x 0x%08x 0x%08x \n", l_cplt_offset,
+ l_ppe_offset, temp);
+ }
+ }
+ else
+ {
+ temp = l_cplt_offset + ddLevelOffset + 4;
+ l_word = temp >> 2;
+ temp = l_cplt_offset + ddLevelOffset;
+
+ if(dbgl > 1)
+ {
+ printf("SGPE(4):INSTANCE Offset 0x%08x 0x%08x 0x%08x \n", l_cplt_offset,
+ l_ppe_offset, temp);
+ }
+ }
+
+ l_cplt_offset = *((uint32_t*)i_ringSectionPtr + l_word);
+ l_cplt_offset = myRev32(l_cplt_offset);
+ l_word++;
+ l_cplt_size = *((uint32_t*)i_ringSectionPtr + l_word );
+ l_cplt_size = myRev32(l_cplt_size);
+
+ if( io_RingType == INSTANCE)
+ {
+ l_cplt_size = l_ppe_offset - l_cplt_offset;
+ }
+ else
+ {
+ l_cplt_size = l_cplt_size - l_cplt_offset;
+ }
+
+ l_cplt_offset = l_cplt_offset + ddLevelOffset;
+
+ if(dbgl > 1)
+ {
+ printf("SGPE(5): Ring pointer Offset 0x%08x size 0x%08x \n", l_cplt_offset,
+ l_cplt_size);
+ }
+ }
+
+ if ((*io_ringBlockPtr) == NULL)
+ {
+ printf("\tmalloc() of initf buffer failed...\n");
+ io_ringBlockSize = l_cplt_size;
+ return 0;
+ }
+ else if (io_ringBlockSize < l_cplt_size)
+ {
+ printf("\tio_ringBlockSize is less than required size ...\n");
+ io_ringBlockSize = l_cplt_size;
+ return 0;
+ }
+
+ //(*io_ringBlockPtr) = malloc(l_cplt_size);
+ memcpy( (uint8_t*)(*io_ringBlockPtr),
+ (uint8_t*)i_ringSectionPtr + l_cplt_offset + temp1,
+ (size_t)l_cplt_size);
+ io_ringBlockSize = l_cplt_size;
+ return IMGBUILD_TGR_RING_BLOCKS_FOUND;
+ }
+ else
+ {
+ if(i_PpeType == SBE)
+ {
+ rc = get_ring_from_sbe_image ( i_ringSectionPtr,
+ i_magic,
+ i_ringId,
+ ddLevelOffset,
+ io_RingType,
+ i_RingVariant,
+ io_instanceId,
+ i_RingBlockType,
+ io_ringBlockPtr,
+ io_ringBlockSize,
+ o_ringName,
+ dbgl);
+
+ if (rc == IMGBUILD_TGR_RING_NOT_FOUND)
+ {
+ printf("\t After SBE single ring call, %s ring container is not found \n",
+ RING_PROPERTIES[i_ringId].iv_name);
+ return rc;
+ }
+ else if ( rc == IMGBUILD_INVALID_INSTANCEID)
+ {
+ printf("\t After SBE single ring call, Instance %d is invalid \n",
+ io_instanceId );
+ return rc;
+ }
+
+ if(dbgl > 1)
+ {
+ printf(" TOR_GET_RING(10): After get_ring_from_sbe_image Size %d \n",
+ io_ringBlockSize );
+ }
+ }
+ else if (i_PpeType == CME)
+ {
+ rc = get_ring_from_cme_image ( i_ringSectionPtr,
+ i_ringId,
+ ddLevelOffset,
+ io_RingType,
+ i_RingVariant,
+ io_instanceId,
+ i_RingBlockType,
+ io_ringBlockPtr,
+ io_ringBlockSize,
+ o_ringName,
+ dbgl);
+
+ if (rc == IMGBUILD_TGR_RING_NOT_FOUND)
+ {
+ printf("\t After CME single ring call, %s ring container is not found \n",
+ RING_PROPERTIES[i_ringId].iv_name);
+ return rc;
+ }
+ else if ( rc == IMGBUILD_INVALID_INSTANCEID)
+ {
+ printf("\t After CME single ring call, Instance %d is invalid \n",
+ io_instanceId );
+ return rc;
+ }
+
+ if(dbgl > 1)
+ {
+ printf(" TOR_GET_RING(11): After get_ring_from_sbe_image Size %d \n",
+ io_ringBlockSize );
+ }
+ }
+ else if (i_PpeType == SGPE)
+ {
+ rc = get_ring_from_sgpe_image ( i_ringSectionPtr,
+ i_ringId,
+ ddLevelOffset,
+ io_RingType,
+ i_RingVariant,
+ io_instanceId,
+ i_RingBlockType,
+ io_ringBlockPtr,
+ io_ringBlockSize,
+ o_ringName,
+ dbgl);
+
+ if (rc == IMGBUILD_TGR_RING_NOT_FOUND)
+ {
+ printf("\t After SGPE single ring call, %s ring container is not found \n",
+ RING_PROPERTIES[i_ringId].iv_name);
+ return rc;
+ }
+ else if ( rc == IMGBUILD_INVALID_INSTANCEID)
+ {
+ printf("\t After SGPE single ring call, Instance %d is invalid \n",
+ io_instanceId );
+ return rc;
+ }
+
+ if(dbgl > 1)
+ {
+ printf("TOR_GET_RING(12): After get_ring_from_sbe_image Size %d \n",
+ io_ringBlockSize );
+ }
+ }
+
+ return IMGBUILD_TGR_RING_BLOCKS_FOUND;
+ }
+
+ return IMGBUILD_TGR_AMBIGUOUS_API_PARMS;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////
+// Pulling single ring from ring section of HW image
+/////////////////////////////////////////////////////////////////////////////////////
+
+int tor_get_single_ring ( void*
+ i_ringSectionPt, // ring section pointer
+ uint16_t i_ddLevel, // DD level info
+ RingID i_ringId, // Ring ID info
+ PpeType_t i_PpeType, // ppe Type info
+ RingVariant_t i_RingVariant, // ring variant info -Base, CC, RL,OR,OL
+ uint8_t& io_instanceId, // chiplet Instance Id
+ void** io_ringBlockPtr, // Output void pointer
+ uint32_t& io_ringBlockSize // size of ring
+ )
+{
+
+ uint32_t rc;
+ uint32_t dbgl = 1;
+ char i_ringName[25];
+ RingType_t l_RingType;
+ l_RingType = COMMON;
+
+ if(dbgl > 1)
+ {
+ printf(" TOR_GET_SINGLE_RING1: function call \n");
+ }
+
+ rc = tor_get_ring(
+ i_ringSectionPt,
+ P9_XIP_MAGIC_HW,
+ i_ringId,
+ i_ddLevel,
+ i_PpeType,
+ l_RingType,
+ i_RingVariant,
+ io_instanceId,
+ SINGLE_RING,
+ io_ringBlockPtr,
+ io_ringBlockSize,
+ i_ringName );
+
+ if(dbgl > 1)
+ {
+ printf(" TOR_GET_SINGLE_RING(2): after tor_get_ring function, Size %d \n",
+ io_ringBlockSize );
+ }
+
+ return rc;
+}
+////////////////////////////////////////////////////////////////////////////////////////
+// Extract block of rings from ring section of HW image
+///////////////////////////////////////////////////////////////////////////////////////
+
+
+int tor_get_block_of_rings ( void* i_ringSectionPt,
+ uint16_t i_ddLevel,
+ PpeType_t i_PpeType,
+ RingType_t& io_RingType,
+ RingVariant_t i_RingVariant,
+ uint8_t& io_instanceId,
+ void** io_ringBlockPtr,
+ uint32_t& io_ringBlockSize
+ )
+{
+ uint32_t dbgl = 1;
+
+ if(dbgl > 1)
+ {
+ printf(" TOR_GET_BLOCK_OF_RINGS(1): function call \n");
+ }
+
+ uint32_t rc = 0;
+ char i_ringName[25];
+
+ if(io_RingType == ALLRING && i_PpeType != NUM_PPE_TYPES)
+ {
+ //ppe level copy
+ rc = tor_get_ring( i_ringSectionPt,
+ P9_XIP_MAGIC_HW,
+ P9_NUM_RINGS,
+ i_ddLevel,
+ i_PpeType,
+ io_RingType,
+ i_RingVariant,
+ io_instanceId,
+ PPE_LEVEL_RINGS,
+ io_ringBlockPtr,
+ io_ringBlockSize,
+ i_ringName );
+
+ }
+ else if (io_RingType == ALLRING && i_PpeType == NUM_PPE_TYPES)
+ {
+ //dd level Copy
+ rc = tor_get_ring( i_ringSectionPt,
+ P9_XIP_MAGIC_HW,
+ P9_NUM_RINGS,
+ i_ddLevel,
+ i_PpeType,
+ io_RingType,
+ i_RingVariant,
+ io_instanceId,
+ DD_LEVEL_RINGS,
+ io_ringBlockPtr,
+ io_ringBlockSize,
+ i_ringName );
+ }
+ else if(io_RingType == COMMON || io_RingType == INSTANCE)
+ {
+ // Chiplet level copy
+ rc = tor_get_ring( i_ringSectionPt,
+ P9_XIP_MAGIC_HW,
+ P9_NUM_RINGS,
+ i_ddLevel,
+ i_PpeType,
+ io_RingType,
+ i_RingVariant,
+ io_instanceId,
+ CPLT_LEVEL_RINGS,
+ io_ringBlockPtr,
+ io_ringBlockSize,
+ i_ringName );
+ }
+ else
+ {
+ printf("TOR_GET_BLOCK_OF_RINGS(2): Wrong input params. Please check passing params\n");
+ return IMGBUILD_TGR_AMBIGUOUS_API_PARMS;
+ }
+
+ if(dbgl > 1)
+ {
+ printf(" TOR_GET_SINGLE_RING(2): after tor_get_ring function, Size %d \n",
+ io_ringBlockSize );
+ }
+
+ return rc;
+}
diff --git a/src/import/chips/p9/utils/imageProcs/p9_tor.H b/src/import/chips/p9/utils/imageProcs/p9_tor.H
new file mode 100644
index 00000000..5220144a
--- /dev/null
+++ b/src/import/chips/p9/utils/imageProcs/p9_tor.H
@@ -0,0 +1,261 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/import/chips/p9/utils/imageProcs/p9_tor.H $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2016 */
+/* [+] 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 */
+#ifndef _P9_TOR_H_
+#define _P9_TOR_H_
+
+#include "p9_ring_identification.H"
+#include "p9_ringId.H"
+#include "p9_infrastruct_help.H"
+#include "p9_xip_image.h"
+
+#define NUM_RING_IDS P9_NUM_RINGS
+
+typedef struct
+{
+ uint32_t sizeOfThis;
+ uint16_t sizeOfCmsk;
+ uint16_t sizeOfMeta; // Exact size of meta data. Arbitrary size. Not null terminated.
+} RingLayout_t;
+
+
+//
+// Temporary define until in TOR header by Giri.
+//
+//
+// Temporary define until in TOR header by Giri.
+//
+typedef struct
+{
+ uint32_t TorNumDdLevels;
+ uint32_t reserved;
+} TorNumDdLevels_t;
+
+typedef struct
+{
+ uint32_t TorDdLevelAndOffset;
+ uint32_t TorDdBlockSize;
+} TorDdLevelBlock_t;
+
+typedef struct
+{
+ uint32_t TorPpeTypeOffset;
+ uint32_t TorPpeBlockSize;
+} TorPpeBlock_t;
+
+
+#define MAX_CPLT_SBE 13
+#define IMGBUILD_TGR_RING_FOUND 0
+#define IMGBUILD_TGR_RING_BLOCKS_FOUND 0
+#define IMGBUILD_TGR_RING_NOT_FOUND 1 // Ring is not found in HW image.
+#define IMGBUILD_TGR_INVALID_RING_ID 2 // Ring is invalid or mismatch.
+#define IMGBUILD_TGR_AMBIGUOUS_API_PARMS 3 // Ring search in HW iamge got ambiguous condition.
+#define IMGBUILD_TGR_SECTION_NOT_FOUND 4
+#define IMGBUILD_TGR_DD_LVL_INFO_NOT_FOUND 5
+#define IMGBUILD_TGR_OP_BUFFER_INVALID 6
+#define IMGBUILD_TGR_OP_BUFFER_SIZE_EXCEEDED 7
+#define IMGBUILD_INVALID_INSTANCEID 8
+
+#define MY_INF(_fmt_, _args_...) printf(_fmt_, ##_args_)
+#define MY_ERR(_fmt_, _args_...) printf(_fmt_, ##_args_)
+#define MY_DBG(_fmt_, _args_...) printf(_fmt_, ##_args_)
+
+
+extern const char* ringVariantName[];
+extern const char* ppeTypeName[];
+
+
+typedef enum
+RingBlockType // Different options to extract data using tor_get_ring API
+{
+ SINGLE_RING = 0x00,
+ DD_LEVEL_RINGS = 0x01,
+ PPE_LEVEL_RINGS = 0x02,
+ CPLT_LEVEL_RINGS = 0x03
+} RingBlockType_t;
+
+
+typedef enum RingType // Different type of Rings
+{
+ COMMON = 0x00,
+ INSTANCE = 0x01,
+ ALLRING = 0x02
+} RingType_t;
+
+
+
+typedef enum RingVariant // Base variables
+{
+ BASE = 0x00,
+ CC = 0x01,
+ RL = 0x02,
+ OVERRIDE = 0x03,
+ OVERLAY = 0x04,
+ NUM_RING_VARIANTS = 0x05
+} RingVariant_t;
+
+
+//
+// PPE types
+//
+typedef enum PpeType
+{
+ SBE = 0x00, // Ppe type partition in Ringsection
+ CME = 0x01,
+ SGPE = 0x02,
+ NUM_PPE_TYPES = 0x03
+} PpeType_t;
+
+
+
+typedef enum RingSectionId
+{
+ SECTION_RING = 0x00, //.ring section ID
+ SECTION_OVRD = 0x01, //.Override section ID
+ SECTION_OVRL = 0x02 //.Overlay section ID
+} RingSectionId_t;
+
+typedef enum SbeTorId
+{
+ PERV_CPLT = 0,
+ N0_CPLT = 1,
+ N1_CPLT = 2,
+ N2_CPLT = 3,
+ N3_CPLT = 4,
+ XB_CPLT = 5,
+ MC_CPLT = 6,
+ OB_CPLT = 7,
+ PCI0_CPLT = 8,
+ PCI1_CPLT = 9,
+ PCI2_CPLT = 10,
+ EQ_CPLT = 11,
+ EC_CPLT = 12,
+ SBEALL = 13
+} SbeTorId_t;
+typedef enum CmeTorId
+{
+ CME0_CPLT = 0,
+ CME1_CPLT = 1,
+ CME2_CPLT = 2,
+ CME3_CPLT = 3,
+ CME4_CPLT = 4,
+ CME5_CPLT = 5,
+ CME6_CPLT = 6,
+ CME7_CPLT = 7,
+ CME8_CPLT = 8,
+ CME9_CPLT = 9,
+ CME10_CPLT = 10,
+ CME11_CPLT = 11,
+ CMEALL = 12
+} CmeTorId_t;
+///
+/// ****************************************************************************
+/// Function declares.
+/// ****************************************************************************
+///
+
+
+int get_ring_from_sbe_image ( void*
+ i_ringSectionPtr, // Image pointer
+ uint64_t i_magic, // Image Magic Number
+ RingID i_ringId, // Unique ring ID
+ uint16_t i_ddLevel, // DD level details
+ RingType_t& io_RingType, // 0: Common 1: Instance
+ RingVariant_t i_RingVariant, // Base, cache contained, Risk level,
+ // Override and Overlay
+ uint8_t& io_instanceId, // required Instance
+ RingBlockType_t RingBlockType, // 0: single ring, 1: ddLevel block
+ void** io_ringBlockPtr, // RS4 Container data or block data
+ uint32_t& io_ringBlockSize, // size of data copied into ring block pointer
+ char* o_ringName, // Name of ring
+ uint32_t dbgl); // Debug option
+
+int get_ring_from_sgpe_image ( void*
+ i_ringSectionPtr, // Image pointer
+ RingID i_ringId, // Unique ring ID
+ uint16_t i_ddLevel, // DD level details
+ RingType_t& io_RingType, // 0: Common 1: Instance
+ RingVariant_t i_RingVariant, // Base, cache contained, Risk level,
+ // Override and Overlay
+ uint8_t& io_instanceId, // required Instance
+ RingBlockType_t RingBlockType, // 0: single ring, 1: ddLevel block
+ void** io_ringBlockPtr, // RS4 Container data or block data
+ uint32_t& io_ringBlockSize, // size of data copied into ring block pointer
+ char* o_ringName, // Name of ring
+ uint32_t dbgl); // Debug option
+
+int get_ring_from_cme_image ( void* i_ringSectionPtr, // Image pointer
+ RingID i_ringId, // Unique ring ID
+ uint16_t i_ddLevel, // DD level details
+ RingType_t& io_RingType, // 0: Common 1: Instance
+ RingVariant_t i_RingVariant, // Base, cache contained, Risk level,
+ // Override and Overlay
+ uint8_t& io_instanceId, // required Instance
+ RingBlockType_t RingBlockType, // 0: single ring, 1: ddLevel block
+ void** io_ringBlockPtr, // RS4 Container data or block data
+ uint32_t& io_ringBlockSize, // size of data copied into ring block pointer
+ char* o_ringName, // Name of ring
+ uint32_t dbgl); // Debug option
+
+int tor_get_ring( void*
+ i_ringSectionPtr, // Ring address Ptr any of .rings, .overrides and .overlays.
+ uint64_t i_magic, // Image Magic Number
+ RingID i_ringId, // Unique ring ID
+ uint16_t i_ddLevel, // DD level info
+ PpeType_t i_PpeType, // PPE type : SBE, CME, etc
+ RingType_t& io_RingType, // 0: Common 1: Instance
+ RingVariant_t i_RingVariant, // Base, Cache etc
+ uint8_t& io_instanceId, // chiplet instance ID
+ RingBlockType_t i_RingBlockType, // 0: single ring, 1: ring block
+ //uint8_t i_bBuffer, // 0: No buffer, 1: Yes buffer.
+ void** io_ringBlockPtr, // Addr of ring buffer
+ uint32_t& io_ringBlockSize, // size of ring data
+ char* o_ringName // Ring name
+ );
+
+int tor_get_single_ring ( void*
+ i_ringSectionPt, // Ring address Ptr any of .rings, .overrides and .overlays.
+ uint16_t i_ddLevel, // DD level info
+ RingID i_ringId, // Unique ring ID
+ PpeType_t i_PpeType, // ppe Type
+ RingVariant_t
+ i_RingVariant, // Base, cache contained, Risk level, Override and Overlay
+ uint8_t& io_instanceId, // Chiplet Instance ID
+ void** io_ringBlockPtr, // Addr of ring buffer
+ uint32_t& io_ringBlockSize ); // size of ring data
+
+
+int tor_get_block_of_rings ( void*
+ i_ringSectionPt, // Ring address Ptr any of .rings, .overrides and .overlays.
+ uint16_t i_ddLevel, // DD level
+ PpeType_t i_PpeType, // ppe Type
+ RingType_t& io_RingType, // Common Or Instance
+ RingVariant_t i_RingVariant, // base,cache,etc
+ uint8_t& io_instanceId, // Chiplet Instance ID
+ void** io_ringBlockPtr, // Addr of ring buffer
+ uint32_t& io_ringBlockSize // size of ring data
+ );
+
+
+#endif //_P9_TOR_H_
OpenPOWER on IntegriCloud