diff options
author | Martin Peschke <mpeschke@de.ibm.com> | 2016-12-16 17:52:33 +0100 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2017-01-30 11:35:20 -0500 |
commit | 108b2c686505792772d1e6e3afb79071aa923bf3 (patch) | |
tree | 1f7fff5af748e8052ad571898b464ce383bfd7be /src/import/chips/p9/utils/imageProcs | |
parent | f95cc42d122a0cf2c004d33a22c061881d4a3473 (diff) | |
download | talos-hostboot-108b2c686505792772d1e6e3afb79071aa923bf3.tar.gz talos-hostboot-108b2c686505792772d1e6e3afb79071aa923bf3.zip |
TOR space reductions
These changes avoid some waste of valuable memory used to store
TOR and rings contained in TOR. This is mostly needed as a SEEPROM relief.
Contains:
- 12 byte ring header (former 31551 commit)
- less zero padding at the end of compressed ring (former 31524 commit)
- removed an additional ring meta data structure (former 31524 commit)
In addition, it contains these fixes:
- fixed a bunch of scan addresses (former 33969 commit)
- increased size of ring decompression buffer (former 32796 commit)
- zero byte ring padding up to 4 byte boundaries for SBE (former 33969
commit)
- added dbgl control of error trace after call to get_ring_from_sbe_image
- added enumerated ringId to the RS4v3 header
- fixed incorrect scan address masks for even/odd EX RS4 v3 ring handling
in MVPD accessor functions
- fixed incorrect scan address region bits for odd EX rings translated from
RS4 v2 to RS4 v3 in MVPD accessor functions
Change-Id: I8fd00760e6ac2b3760994d1ca819fffbf35188ca
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/33993
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com>
Reviewed-by: Prachi Gupta <pragupta@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/34058
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/import/chips/p9/utils/imageProcs')
-rw-r--r-- | src/import/chips/p9/utils/imageProcs/p9_ringId.C | 646 | ||||
-rw-r--r-- | src/import/chips/p9/utils/imageProcs/p9_ringId.H | 27 | ||||
-rw-r--r-- | src/import/chips/p9/utils/imageProcs/p9_scan_compression.C | 233 | ||||
-rw-r--r-- | src/import/chips/p9/utils/imageProcs/p9_scan_compression.H | 222 | ||||
-rw-r--r-- | src/import/chips/p9/utils/imageProcs/p9_tor.C | 627 | ||||
-rw-r--r-- | src/import/chips/p9/utils/imageProcs/p9_tor.H | 49 |
6 files changed, 933 insertions, 871 deletions
diff --git a/src/import/chips/p9/utils/imageProcs/p9_ringId.C b/src/import/chips/p9/utils/imageProcs/p9_ringId.C index 90f17753e..329791f61 100644 --- a/src/import/chips/p9/utils/imageProcs/p9_ringId.C +++ b/src/import/chips/p9/utils/imageProcs/p9_ringId.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ +/* Contributors Listed Below - COPYRIGHT 2016,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -30,29 +30,28 @@ namespace PERV { const GenRingIdList RING_ID_LIST_COMMON[] = { - {"perv_fure" , 0x00, 0x01, 0x01, NON_VPD_RING, 0, 0x0800000000009000}, - {"perv_gptr" , 0x01, 0x01, 0x01, NON_VPD_RING, 0, 0x0800000000002000}, - {"perv_time" , 0x02, 0x01, 0x01, NON_VPD_RING, 0, 0x0800000000000100}, - {"occ_fure" , 0x03, 0x01, 0x01, NON_VPD_RING, 0, 0x0100000000009000}, - {"occ_gptr" , 0x04, 0x01, 0x01, NON_VPD_RING, 0, 0x0100000000002000}, - {"occ_time" , 0x05, 0x01, 0x01, NON_VPD_RING, 0, 0x0100000000000100}, - {"perv_ana_func" , 0x06, 0x01, 0x01, NON_VPD_RING, 0, 0x0080000000008000}, - {"perv_ana_gptr" , 0x07, 0x01, 0x01, NON_VPD_RING, 0, 0x0080000000002000}, - {"perv_pll_gptr" , 0x08, 0x01, 0x01, NON_VPD_RING, 0, 0x0002000000002000}, - {"perv_pll_bndy_bucket_1" , 0x09, 0x01, 0x01, NON_VPD_PLL_RING, 5, 0x0002000000000080}, - {"perv_pll_bndy_bucket_2" , 0x0a, 0x01, 0x01, NON_VPD_PLL_RING, 5, 0x0002000000000080}, - {"perv_pll_bndy_bucket_3" , 0x0b, 0x01, 0x01, NON_VPD_PLL_RING, 5, 0x0002000000000080}, - {"perv_pll_bndy_bucket_4" , 0x0c, 0x01, 0x01, NON_VPD_PLL_RING, 5, 0x0002000000000080}, - {"perv_pll_bndy_bucket_5" , 0x0d, 0x01, 0x01, NON_VPD_PLL_RING, 5, 0x0002000000000080}, - {"perv_pll_func" , 0x0e, 0x01, 0x01, NON_VPD_RING, 0, 0x0002000000008000}, - + {"perv_fure" , 0x00, 0x01, 0x01, NON_VPD_RING , 0, 0x0103400F}, + {"perv_gptr" , 0x01, 0x01, 0x01, NON_VPD_RING , 0, 0x01034002}, + {"perv_time" , 0x02, 0x01, 0x01, NON_VPD_RING , 0, 0x01034007}, + {"occ_fure" , 0x03, 0x01, 0x01, NON_VPD_RING , 0, 0x0103080F}, + {"occ_gptr" , 0x04, 0x01, 0x01, NON_VPD_RING , 0, 0x01030802}, + {"occ_time" , 0x05, 0x01, 0x01, NON_VPD_RING , 0, 0x01030807}, + {"perv_ana_func" , 0x06, 0x01, 0x01, NON_VPD_RING , 0, 0x01030400}, + {"perv_ana_gptr" , 0x07, 0x01, 0x01, NON_VPD_RING , 0, 0x01030402}, + {"perv_pll_gptr" , 0x08, 0x01, 0x01, NON_VPD_RING , 0, 0x01030012}, + {"perv_pll_bndy_bucket_1", 0x09, 0x01, 0x01, NON_VPD_PLL_RING, 5, 0x01030018}, + {"perv_pll_bndy_bucket_2", 0x0a, 0x01, 0x01, NON_VPD_PLL_RING, 5, 0x01030018}, + {"perv_pll_bndy_bucket_3", 0x0b, 0x01, 0x01, NON_VPD_PLL_RING, 5, 0x01030018}, + {"perv_pll_bndy_bucket_4", 0x0c, 0x01, 0x01, NON_VPD_PLL_RING, 5, 0x01030018}, + {"perv_pll_bndy_bucket_5", 0x0d, 0x01, 0x01, NON_VPD_PLL_RING, 5, 0x01030018}, + {"perv_pll_func" , 0x0e, 0x01, 0x01, NON_VPD_RING , 0, 0x01030010}, }; const GenRingIdList RING_ID_LIST_INSTANCE[] = { - {"perv_repr" , 0x0f, 0x01, 0x01, NON_VPD_RING, 0, 0x0800000000000200}, - {"occ_repr" , 0x10, 0x01, 0x01, NON_VPD_RING, 0, 0x0100000000000200}, + {"perv_repr" , 0x0f, 0x01, 0x01, NON_VPD_RING , 0, 0x01034006}, + {"occ_repr" , 0x10, 0x01, 0x01, NON_VPD_RING , 0, 0x01030806}, }; -const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID}; +const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID }; }; @@ -60,21 +59,21 @@ namespace N0 { const GenRingIdList RING_ID_LIST_COMMON[] = { - {"n0_fure" , 0x00, 0x02, 0x02, NON_VPD_RING, 0, 0x09C0000000009000}, - {"n0_gptr" , 0x01, 0x02, 0x02, NON_VPD_RING, 0, 0x09C0000000002000}, - {"n0_time" , 0x02, 0x02, 0x02, NON_VPD_RING, 0, 0x09C0000000000100}, - {"n0_nx_fure" , 0x03, 0x02, 0x02, NON_VPD_RING, 0, 0x0400000000009000}, - {"n0_nx_gptr" , 0x04, 0x02, 0x02, NON_VPD_RING, 0, 0x0400000000002000}, - {"n0_nx_time" , 0x05, 0x02, 0x02, NON_VPD_RING, 0, 0x0400000000000100}, - {"n0_cxa0_fure" , 0x06, 0x02, 0x02, NON_VPD_RING, 0, 0x0200000000009000}, - {"n0_cxa0_gptr" , 0x07, 0x02, 0x02, NON_VPD_RING, 0, 0x0200000000002000}, - {"n0_cxa0_time" , 0x08, 0x02, 0x02, NON_VPD_RING, 0, 0x0200000000000100}, + {"n0_fure" , 0x00, 0x02, 0x02, NON_VPD_RING , 0, 0x02034E0F}, + {"n0_gptr" , 0x01, 0x02, 0x02, NON_VPD_RING , 0, 0x02034E02}, + {"n0_time" , 0x02, 0x02, 0x02, NON_VPD_RING , 0, 0x02034E07}, + {"n0_nx_fure" , 0x03, 0x02, 0x02, NON_VPD_RING , 0, 0x0203200F}, + {"n0_nx_gptr" , 0x04, 0x02, 0x02, NON_VPD_RING , 0, 0x02032002}, + {"n0_nx_time" , 0x05, 0x02, 0x02, NON_VPD_RING , 0, 0x02032007}, + {"n0_cxa0_fure" , 0x06, 0x02, 0x02, NON_VPD_RING , 0, 0x0203100F}, + {"n0_cxa0_gptr" , 0x07, 0x02, 0x02, NON_VPD_RING , 0, 0x02031002}, + {"n0_cxa0_time" , 0x08, 0x02, 0x02, NON_VPD_RING , 0, 0x02031007}, }; const GenRingIdList RING_ID_LIST_INSTANCE[] = { - {"n0_repr" , 0x09, 0x02, 0x02, NON_VPD_RING, 0, 0x09C0000000000200}, - {"n0_nx_repr" , 0x0a, 0x02, 0x02, NON_VPD_RING, 0, 0x0400000000000200}, - {"n0_cxa0_repr" , 0x0b, 0x02, 0x02, NON_VPD_RING, 0, 0x0200000000000200}, + {"n0_repr" , 0x09, 0x02, 0x02, NON_VPD_RING , 0, 0x02034E06}, + {"n0_nx_repr" , 0x0a, 0x02, 0x02, NON_VPD_RING , 0, 0x02032006}, + {"n0_cxa0_repr" , 0x0b, 0x02, 0x02, NON_VPD_RING , 0, 0x02031006}, }; const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID}; }; @@ -84,25 +83,25 @@ namespace N1 { const GenRingIdList RING_ID_LIST_COMMON[] = { - {"n1_fure" , 0x00, 0x03, 0x03, NON_VPD_RING, 0, 0x0E00000000009000}, - {"n1_gptr" , 0x01, 0x03, 0x03, NON_VPD_RING, 0, 0x0E00000000002000}, - {"n1_time" , 0x02, 0x03, 0x03, NON_VPD_RING, 0, 0x0E00000000000100}, - {"n1_ioo0_fure" , 0x03, 0x03, 0x03, NON_VPD_RING, 0, 0x0100000000009000}, - {"n1_ioo0_gptr" , 0x04, 0x03, 0x03, NON_VPD_RING, 0, 0x0100000000002000}, - {"n1_ioo0_time" , 0x05, 0x03, 0x03, NON_VPD_RING, 0, 0x0100000000000100}, - {"n1_ioo1_fure" , 0x06, 0x03, 0x03, NON_VPD_RING, 0, 0x0080000000009000}, - {"n1_ioo1_gptr" , 0x07, 0x03, 0x03, NON_VPD_RING, 0, 0x0080000000002000}, - {"n1_ioo1_time" , 0x08, 0x03, 0x03, NON_VPD_RING, 0, 0x0080000000000100}, - {"n1_mcs23_fure" , 0x09, 0x03, 0x03, NON_VPD_RING, 0, 0x0040000000009000}, - {"n1_mcs23_gptr" , 0x0a, 0x03, 0x03, NON_VPD_RING, 0, 0x0040000000002000}, - {"n1_mcs23_time" , 0x0b, 0x03, 0x03, NON_VPD_RING, 0, 0x0040000000000100}, + {"n1_fure" , 0x00, 0x03, 0x03, NON_VPD_RING , 0, 0x0303700F}, + {"n1_gptr" , 0x01, 0x03, 0x03, NON_VPD_RING , 0, 0x03037002}, + {"n1_time" , 0x02, 0x03, 0x03, NON_VPD_RING , 0, 0x03037007}, + {"n1_ioo0_fure" , 0x03, 0x03, 0x03, NON_VPD_RING , 0, 0x0303080F}, + {"n1_ioo0_gptr" , 0x04, 0x03, 0x03, NON_VPD_RING , 0, 0x03030802}, + {"n1_ioo0_time" , 0x05, 0x03, 0x03, NON_VPD_RING , 0, 0x03030807}, + {"n1_ioo1_fure" , 0x06, 0x03, 0x03, NON_VPD_RING , 0, 0x0303040F}, + {"n1_ioo1_gptr" , 0x07, 0x03, 0x03, NON_VPD_RING , 0, 0x03030402}, + {"n1_ioo1_time" , 0x08, 0x03, 0x03, NON_VPD_RING , 0, 0x03030407}, + {"n1_mcs23_fure" , 0x09, 0x03, 0x03, NON_VPD_RING , 0, 0x0303020F}, + {"n1_mcs23_gptr" , 0x0a, 0x03, 0x03, NON_VPD_RING , 0, 0x03030202}, + {"n1_mcs23_time" , 0x0b, 0x03, 0x03, NON_VPD_RING , 0, 0x03030207}, }; const GenRingIdList RING_ID_LIST_INSTANCE[] = { - {"n1_repr" , 0x0c, 0x03, 0x03, NON_VPD_RING, 0, 0x0E00000000000200}, - {"n1_ioo0_repr" , 0x0d, 0x03, 0x03, NON_VPD_RING, 0, 0x0100000000000200}, - {"n1_ioo1_repr" , 0x0e, 0x03, 0x03, NON_VPD_RING, 0, 0x0080000000000200}, - {"n1_mcs23_repr" , 0x0f, 0x03, 0x03, NON_VPD_RING, 0, 0x0040000000000200}, + {"n1_repr" , 0x0c, 0x03, 0x03, NON_VPD_RING , 0, 0x03037006}, + {"n1_ioo0_repr" , 0x0d, 0x03, 0x03, NON_VPD_RING , 0, 0x03030806}, + {"n1_ioo1_repr" , 0x0e, 0x03, 0x03, NON_VPD_RING , 0, 0x03030406}, + {"n1_mcs23_repr" , 0x0f, 0x03, 0x03, NON_VPD_RING , 0, 0x03030206}, }; const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID}; }; @@ -112,23 +111,23 @@ namespace N2 { const GenRingIdList RING_ID_LIST_COMMON[] = { - {"n2_fure" , 0x00, 0x04, 0x04, NON_VPD_RING, 0, 0x0B80000000009000}, - {"n2_gptr" , 0x01, 0x04, 0x04, NON_VPD_RING, 0, 0x0B80000000002000}, - {"n2_time" , 0x02, 0x04, 0x04, NON_VPD_RING, 0, 0x0B80000000000100}, - {"n2_cxa1_fure" , 0x03, 0x04, 0x04, NON_VPD_RING, 0, 0x0400000000009000}, - {"n2_cxa1_gptr" , 0x04, 0x04, 0x04, NON_VPD_RING, 0, 0x0400000000002000}, - {"n2_cxa1_time" , 0x05, 0x04, 0x04, NON_VPD_RING, 0, 0x0400000000000100}, - {"n2_psi_fure" , 0x06, 0x04, 0x04, NON_VPD_RING, 0, 0x0040000000009000}, - {"n2_psi_gptr" , 0x07, 0x04, 0x04, NON_VPD_RING, 0, 0x0040000000002000}, - {"n2_psi_time" , 0x08, 0x04, 0x04, NON_VPD_RING, 0, 0x0040000000000100}, + {"n2_fure" , 0x00, 0x04, 0x04, NON_VPD_RING , 0, 0x04035C0F}, + {"n2_gptr" , 0x01, 0x04, 0x04, NON_VPD_RING , 0, 0x04035C02}, + {"n2_time" , 0x02, 0x04, 0x04, NON_VPD_RING , 0, 0x04035C07}, + {"n2_cxa1_fure" , 0x03, 0x04, 0x04, NON_VPD_RING , 0, 0x0403200F}, + {"n2_cxa1_gptr" , 0x04, 0x04, 0x04, NON_VPD_RING , 0, 0x04032002}, + {"n2_cxa1_time" , 0x05, 0x04, 0x04, NON_VPD_RING , 0, 0x04032007}, + {"n2_psi_fure" , 0x06, 0x04, 0x04, NON_VPD_RING , 0, 0x0403020F}, + {"n2_psi_gptr" , 0x07, 0x04, 0x04, NON_VPD_RING , 0, 0x04030202}, + {"n2_psi_time" , 0x08, 0x04, 0x04, NON_VPD_RING , 0, 0x04030207}, }; const GenRingIdList RING_ID_LIST_INSTANCE[] = { - {"n2_repr" , 0x09, 0x04, 0x04, NON_VPD_RING, 0, 0x0B80000000000200}, - {"n2_cxa1_repr" , 0x0a, 0x04, 0x04, NON_VPD_RING, 0, 0x0400000000000200}, - {"n2_psi_repr" , 0x0b, 0x04, 0x04, NON_VPD_RING, 0, 0x0040000000000200}, + {"n2_repr" , 0x09, 0x04, 0x04, NON_VPD_RING , 0, 0x04035C06}, + {"n2_cxa1_repr" , 0x0a, 0x04, 0x04, NON_VPD_RING , 0, 0x04032006}, + {"n2_psi_repr" , 0x0b, 0x04, 0x04, NON_VPD_RING , 0, 0x04030206}, }; -const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID}; +const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID }; }; @@ -136,23 +135,23 @@ namespace N3 { const GenRingIdList RING_ID_LIST_COMMON[] = { - {"n3_fure" , 0x00, 0x05, 0x05, NON_VPD_RING, 0, 0x0CC0000000009000}, - {"n3_gptr" , 0x01, 0x05, 0x05, NON_VPD_RING, 0, 0x0EC0000000002000}, - {"n3_time" , 0x02, 0x05, 0x05, NON_VPD_RING, 0, 0x0EC0000000000100}, - {"n3_mcs01_fure" , 0x03, 0x05, 0x05, NON_VPD_RING, 0, 0x0020000000009000}, - {"n3_mcs01_gptr" , 0x04, 0x05, 0x05, NON_VPD_RING, 0, 0x0020000000002000}, - {"n3_mcs01_time" , 0x05, 0x05, 0x05, NON_VPD_RING, 0, 0x0020000000000100}, - {"n3_np_fure" , 0x06, 0x05, 0x05, NON_VPD_RING, 0, 0x0100000000009000}, - {"n3_np_gptr" , 0x07, 0x05, 0x05, NON_VPD_RING, 0, 0x0100000000002000}, - {"n3_np_time" , 0x08, 0x05, 0x05, NON_VPD_RING, 0, 0x0100000000000100}, + {"n3_fure" , 0x00, 0x05, 0x05, NON_VPD_RING , 0, 0x0503660F}, + {"n3_gptr" , 0x01, 0x05, 0x05, NON_VPD_RING , 0, 0x05037602}, + {"n3_time" , 0x02, 0x05, 0x05, NON_VPD_RING , 0, 0x05037607}, + {"n3_mcs01_fure" , 0x03, 0x05, 0x05, NON_VPD_RING , 0, 0x0503010F}, + {"n3_mcs01_gptr" , 0x04, 0x05, 0x05, NON_VPD_RING , 0, 0x05030102}, + {"n3_mcs01_time" , 0x05, 0x05, 0x05, NON_VPD_RING , 0, 0x05030107}, + {"n3_np_fure" , 0x06, 0x05, 0x05, NON_VPD_RING , 0, 0x0503080F}, + {"n3_np_gptr" , 0x07, 0x05, 0x05, NON_VPD_RING , 0, 0x05030802}, + {"n3_np_time" , 0x08, 0x05, 0x05, NON_VPD_RING , 0, 0x05030807}, }; const GenRingIdList RING_ID_LIST_INSTANCE[] = { - {"n3_repr" , 0x09, 0x05, 0x05, NON_VPD_RING, 0, 0x0EC0000000000200}, - {"n3_mcs01_repr" , 0x0a, 0x05, 0x05, NON_VPD_RING, 0, 0x0020000000000200}, - {"n3_np_repr" , 0x0b, 0x05, 0x05, NON_VPD_RING, 0, 0x0100000000000200}, + {"n3_repr" , 0x09, 0x05, 0x05, NON_VPD_RING , 0, 0x05037606}, + {"n3_mcs01_repr" , 0x0a, 0x05, 0x05, NON_VPD_RING , 0, 0x05030106}, + {"n3_np_repr" , 0x0b, 0x05, 0x05, NON_VPD_RING , 0, 0x05030806}, }; -const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID}; +const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID }; }; @@ -160,30 +159,30 @@ namespace XB { const GenRingIdList RING_ID_LIST_COMMON[] = { - {"xb_fure" , 0x00, 0x06, 0x06, NON_VPD_RING, 0, 0x0880000000009000}, - {"xb_gptr" , 0x01, 0x06, 0x06, NON_VPD_RING, 0, 0x0880000000002000}, - {"xb_time" , 0x02, 0x06, 0x06, NON_VPD_RING, 0, 0x0880000000000100}, - {"xb_io0_fure" , 0x03, 0x06, 0x06, NON_VPD_RING, 0, 0x0440000000009000}, - {"xb_io0_gptr" , 0x04, 0x06, 0x06, NON_VPD_RING, 0, 0x0440000000002000}, - {"xb_io0_time" , 0x05, 0x06, 0x06, NON_VPD_RING, 0, 0x0440000000000100}, - {"xb_io1_fure" , 0x06, 0x06, 0x06, NON_VPD_RING, 0, 0x0220000000009000}, - {"xb_io1_gptr" , 0x07, 0x06, 0x06, NON_VPD_RING, 0, 0x0220000000002000}, - {"xb_io1_time" , 0x08, 0x06, 0x06, NON_VPD_RING, 0, 0x0220000000000100}, - {"xb_io2_fure" , 0x09, 0x06, 0x06, NON_VPD_RING, 0, 0x0110000000009000}, - {"xb_io2_gptr" , 0x0a, 0x06, 0x06, NON_VPD_RING, 0, 0x0110000000002000}, - {"xb_io2_time" , 0x0b, 0x06, 0x06, NON_VPD_RING, 0, 0x0110000000000100}, - {"xb_pll_gptr" , 0x0c, 0x06, 0x06, NON_VPD_RING, 0, 0x0002000000002000}, - {"xb_pll_bndy" , 0x0d, 0x06, 0x06, NON_VPD_RING, 0, 0x0002000000000080}, - {"xb_pll_func" , 0x0e, 0x06, 0x06, NON_VPD_RING, 0, 0x0002000000008000}, + {"xb_fure" , 0x00, 0x06, 0x06, NON_VPD_RING , 0, 0x0603440F}, + {"xb_gptr" , 0x01, 0x06, 0x06, NON_VPD_RING , 0, 0x06034402}, + {"xb_time" , 0x02, 0x06, 0x06, NON_VPD_RING , 0, 0x06034407}, + {"xb_io0_fure" , 0x03, 0x06, 0x06, NON_VPD_RING , 0, 0x0603220F}, + {"xb_io0_gptr" , 0x04, 0x06, 0x06, NON_VPD_RING , 0, 0x06032202}, + {"xb_io0_time" , 0x05, 0x06, 0x06, NON_VPD_RING , 0, 0x06032207}, + {"xb_io1_fure" , 0x06, 0x06, 0x06, NON_VPD_RING , 0, 0x0603110F}, + {"xb_io1_gptr" , 0x07, 0x06, 0x06, NON_VPD_RING , 0, 0x06031102}, + {"xb_io1_time" , 0x08, 0x06, 0x06, NON_VPD_RING , 0, 0x06031107}, + {"xb_io2_fure" , 0x09, 0x06, 0x06, NON_VPD_RING , 0, 0x0603088F}, + {"xb_io2_gptr" , 0x0a, 0x06, 0x06, NON_VPD_RING , 0, 0x06030882}, + {"xb_io2_time" , 0x0b, 0x06, 0x06, NON_VPD_RING , 0, 0x06030887}, + {"xb_pll_gptr" , 0x0c, 0x06, 0x06, NON_VPD_RING , 0, 0x06030012}, + {"xb_pll_bndy" , 0x0d, 0x06, 0x06, NON_VPD_RING , 0, 0x06030018}, + {"xb_pll_func" , 0x0e, 0x06, 0x06, NON_VPD_RING , 0, 0x06030010}, }; const GenRingIdList RING_ID_LIST_INSTANCE[] = { - {"xb_repr" , 0x13, 0x06, 0x06, NON_VPD_RING, 0, 0x0880000000000200}, - {"xb_io0_repr" , 0x14, 0x06, 0x06, NON_VPD_RING, 0, 0x0440000000000200}, - {"xb_io1_repr" , 0x15, 0x06, 0x06, NON_VPD_RING, 0, 0x0220000000000200}, - {"xb_io2_repr" , 0x16, 0x06, 0x06, NON_VPD_RING, 0, 0x0110000000000200}, + {"xb_repr" , 0x13, 0x06, 0x06, NON_VPD_RING , 0, 0x06034406}, + {"xb_io0_repr" , 0x14, 0x06, 0x06, NON_VPD_RING , 0, 0x06032206}, + {"xb_io1_repr" , 0x15, 0x06, 0x06, NON_VPD_RING , 0, 0x06031106}, + {"xb_io2_repr" , 0x16, 0x06, 0x06, NON_VPD_RING , 0, 0x06030886}, }; -const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID}; +const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID }; }; @@ -191,30 +190,30 @@ namespace MC { const GenRingIdList RING_ID_LIST_COMMON[] = { - {"mc_fure" , 0x00, 0x07, 0x07, NON_VPD_RING, 0, 0x0C00000000009000}, - {"mc_gptr" , 0x01, 0x07, 0x07, NON_VPD_RING, 0, 0x0C00000000002000}, - {"mc_time" , 0x02, 0x07, 0x07, NON_VPD_RING, 0, 0x0C00000000000100}, - {"mc_iom01_fure" , 0x03, 0x07, 0x07, NON_VPD_RING, 0, 0x0200000000009000}, - {"mc_iom01_gptr" , 0x04, 0x07, 0x07, NON_VPD_RING, 0, 0x0200000000002000}, - {"mc_iom01_time" , 0x05, 0x07, 0x07, NON_VPD_RING, 0, 0x0200000000000100}, - {"mc_iom23_fure" , 0x06, 0x07, 0x07, NON_VPD_RING, 0, 0x0100000000009000}, - {"mc_iom23_gptr" , 0x07, 0x07, 0x07, NON_VPD_RING, 0, 0x0100000000002000}, - {"mc_iom23_time" , 0x08, 0x07, 0x07, NON_VPD_RING, 0, 0x0100000000000100}, - {"mc_pll_gptr" , 0x09, 0x07, 0x07, NON_VPD_RING, 0, 0x0002000000002000}, - {"mc_pll_bndy_bucket_1" , 0x0a, 0x07, 0x07, NON_VPD_PLL_RING, 0, 0x0002000000000080}, - {"mc_pll_bndy_bucket_2" , 0x0b, 0x07, 0x07, NON_VPD_PLL_RING, 0, 0x0002000000000080}, - {"mc_pll_bndy_bucket_3" , 0x0c, 0x07, 0x07, NON_VPD_PLL_RING, 0, 0x0002000000000080}, - {"mc_pll_bndy_bucket_4" , 0x0d, 0x07, 0x07, NON_VPD_PLL_RING, 0, 0x0002000000000080}, - {"mc_pll_bndy_bucket_5" , 0x0e, 0x07, 0x07, NON_VPD_PLL_RING, 0, 0x0002000000000080}, - {"mc_pll_func" , 0x0f, 0x07, 0x07, NON_VPD_RING, 0, 0x0002000000008000}, + {"mc_fure" , 0x00, 0x07, 0x07, NON_VPD_RING, 0, 0x0703600F}, + {"mc_gptr" , 0x01, 0x07, 0x07, NON_VPD_RING, 0, 0x07036002}, + {"mc_time" , 0x02, 0x07, 0x07, NON_VPD_RING, 0, 0x07036007}, + {"mc_iom01_fure" , 0x03, 0x07, 0x07, NON_VPD_RING, 0, 0x0703100F}, + {"mc_iom01_gptr" , 0x04, 0x07, 0x07, NON_VPD_RING, 0, 0x07031002}, + {"mc_iom01_time" , 0x05, 0x07, 0x07, NON_VPD_RING, 0, 0x07031007}, + {"mc_iom23_fure" , 0x06, 0x07, 0x07, NON_VPD_RING, 0, 0x0703080F}, + {"mc_iom23_gptr" , 0x07, 0x07, 0x07, NON_VPD_RING, 0, 0x07030802}, + {"mc_iom23_time" , 0x08, 0x07, 0x07, NON_VPD_RING, 0, 0x07030807}, + {"mc_pll_gptr" , 0x09, 0x07, 0x07, NON_VPD_RING, 0, 0x07030012}, + {"mc_pll_bndy_bucket_1", 0x0a, 0x07, 0x07, NON_VPD_PLL_RING, 0, 0x07030018}, + {"mc_pll_bndy_bucket_2", 0x0b, 0x07, 0x07, NON_VPD_PLL_RING, 0, 0x07030018}, + {"mc_pll_bndy_bucket_3", 0x0c, 0x07, 0x07, NON_VPD_PLL_RING, 0, 0x07030018}, + {"mc_pll_bndy_bucket_4", 0x0d, 0x07, 0x07, NON_VPD_PLL_RING, 0, 0x07030018}, + {"mc_pll_bndy_bucket_5", 0x0e, 0x07, 0x07, NON_VPD_PLL_RING, 0, 0x07030018}, + {"mc_pll_func" , 0x0f, 0x07, 0x07, NON_VPD_RING, 0, 0x07030010}, }; const GenRingIdList RING_ID_LIST_INSTANCE[] = { - {"mc_repr" , 0x10, 0x07, 0x08, NON_VPD_RING, 0, 0x0C00000000000200}, - {"mc_iom01_repr" , 0x11, 0x07, 0x08, NON_VPD_RING, 0, 0x0200000000000200}, - {"mc_iom23_repr" , 0x12, 0x07, 0x08, NON_VPD_RING, 0, 0x0100000000000200}, + {"mc_repr" , 0x10, 0x07, 0x08, NON_VPD_RING , 0, 0x07036006}, + {"mc_iom01_repr" , 0x11, 0x07, 0x08, NON_VPD_RING , 0, 0x07031006}, + {"mc_iom23_repr" , 0x12, 0x07, 0x08, NON_VPD_RING , 0, 0x07030806}, }; -const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID}; +const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID }; }; @@ -222,18 +221,18 @@ namespace OB0 { const GenRingIdList RING_ID_LIST_COMMON[] = { - {"ob0_fure" , 0x00, 0x09, 0x09, NON_VPD_RING, 0, 0x0E00000000009000}, - {"ob0_gptr" , 0x01, 0x09, 0x09, NON_VPD_RING, 0, 0x0E00000000002000}, - {"ob0_time" , 0x02, 0x09, 0x09, NON_VPD_RING, 0, 0x0E00000000000100}, - {"ob0_pll_gptr" , 0x03, 0x09, 0x09, NON_VPD_RING, 0, 0x0002000000002000}, - {"ob0_pll_bndy" , 0x04, 0x09, 0x09, NON_VPD_RING, 0, 0x0002000000000080}, - {"ob0_pll_func" , 0x05, 0x09, 0x09, NON_VPD_RING, 0, 0x0002000000008000}, + {"ob0_fure" , 0x00, 0x09, 0x09, NON_VPD_RING , 0, 0x0903700F}, + {"ob0_gptr" , 0x01, 0x09, 0x09, NON_VPD_RING , 0, 0x09037002}, + {"ob0_time" , 0x02, 0x09, 0x09, NON_VPD_RING , 0, 0x09037007}, + {"ob0_pll_gptr" , 0x03, 0x09, 0x09, NON_VPD_RING , 0, 0x09030012}, + {"ob0_pll_bndy" , 0x04, 0x09, 0x09, NON_VPD_RING , 0, 0x09030018}, + {"ob0_pll_func" , 0x05, 0x09, 0x09, NON_VPD_RING , 0, 0x09030010}, }; const GenRingIdList RING_ID_LIST_INSTANCE[] = { - {"ob0_repr" , 0x0a, 0x09, 0x09, NON_VPD_RING, 0, 0x0E00000000000200}, + {"ob0_repr" , 0x0a, 0x09, 0x09, NON_VPD_RING , 0, 0x09037006}, }; -const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID}; +const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID }; }; @@ -241,18 +240,18 @@ namespace OB1 { const GenRingIdList RING_ID_LIST_COMMON[] = { - {"ob1_fure" , 0x00, 0x0a, 0x0a, NON_VPD_RING, 0, 0x0E00000000009000}, - {"ob1_gptr" , 0x01, 0x0a, 0x0a, NON_VPD_RING, 0, 0x0E00000000002000}, - {"ob1_time" , 0x02, 0x0a, 0x0a, NON_VPD_RING, 0, 0x0E00000000000100}, - {"ob1_pll_gptr" , 0x03, 0x0a, 0x0a, NON_VPD_RING, 0, 0x0002000000002000}, - {"ob1_pll_bndy" , 0x04, 0x0a, 0x0a, NON_VPD_RING, 0, 0x0002000000000080}, - {"ob1_pll_func" , 0x05, 0x0a, 0x0a, NON_VPD_RING, 0, 0x0002000000008000}, + {"ob1_fure" , 0x00, 0x0a, 0x0a, NON_VPD_RING , 0, 0x0A03700F}, + {"ob1_gptr" , 0x01, 0x0a, 0x0a, NON_VPD_RING , 0, 0x0A037002}, + {"ob1_time" , 0x02, 0x0a, 0x0a, NON_VPD_RING , 0, 0x0A037007}, + {"ob1_pll_gptr" , 0x03, 0x0a, 0x0a, NON_VPD_RING , 0, 0x0A030012}, + {"ob1_pll_bndy" , 0x04, 0x0a, 0x0a, NON_VPD_RING , 0, 0x0A030018}, + {"ob1_pll_func" , 0x05, 0x0a, 0x0a, NON_VPD_RING , 0, 0x0A030010}, }; const GenRingIdList RING_ID_LIST_INSTANCE[] = { - {"ob1_repr" , 0x0a, 0x0a, 0x0a, NON_VPD_RING, 0, 0x0E00000000000200}, + {"ob1_repr" , 0x0a, 0x0a, 0x0a, NON_VPD_RING , 0, 0x0A037006}, }; -const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID}; +const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID }; }; @@ -260,18 +259,18 @@ namespace OB2 { const GenRingIdList RING_ID_LIST_COMMON[] = { - {"ob2_fure" , 0x00, 0x0b, 0x0b, NON_VPD_RING, 0, 0x0E00000000009000}, - {"ob2_gptr" , 0x01, 0x0b, 0x0b, NON_VPD_RING, 0, 0x0E00000000002000}, - {"ob2_time" , 0x02, 0x0b, 0x0b, NON_VPD_RING, 0, 0x0E00000000000100}, - {"ob2_pll_gptr" , 0x03, 0x0b, 0x0b, NON_VPD_RING, 0, 0x0002000000002000}, - {"ob2_pll_bndy" , 0x04, 0x0b, 0x0b, NON_VPD_RING, 0, 0x0002000000000080}, - {"ob2_pll_func" , 0x05, 0x0b, 0x0b, NON_VPD_RING, 0, 0x0002000000008000}, + {"ob2_fure" , 0x00, 0x0b, 0x0b, NON_VPD_RING , 0, 0x0B03700F}, + {"ob2_gptr" , 0x01, 0x0b, 0x0b, NON_VPD_RING , 0, 0x0B037002}, + {"ob2_time" , 0x02, 0x0b, 0x0b, NON_VPD_RING , 0, 0x0B037007}, + {"ob2_pll_gptr" , 0x03, 0x0b, 0x0b, NON_VPD_RING , 0, 0x0B030012}, + {"ob2_pll_bndy" , 0x04, 0x0b, 0x0b, NON_VPD_RING , 0, 0x0B030018}, + {"ob2_pll_func" , 0x05, 0x0b, 0x0b, NON_VPD_RING , 0, 0x0B030010}, }; const GenRingIdList RING_ID_LIST_INSTANCE[] = { - {"ob2_repr" , 0x0a, 0x0b, 0x0b, NON_VPD_RING, 0, 0x0E00000000000200}, + {"ob2_repr" , 0x0a, 0x0b, 0x0b, NON_VPD_RING , 0, 0x0B037006}, }; -const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID}; +const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID }; }; @@ -279,18 +278,18 @@ namespace OB3 { const GenRingIdList RING_ID_LIST_COMMON[] = { - {"ob3_fure" , 0x00, 0x0c, 0x0c, NON_VPD_RING, 0, 0x0E00000000009000}, - {"ob3_gptr" , 0x01, 0x0c, 0x0c, NON_VPD_RING, 0, 0x0E00000000002000}, - {"ob3_time" , 0x02, 0x0c, 0x0c, NON_VPD_RING, 0, 0x0E00000000000100}, - {"ob3_pll_gptr" , 0x03, 0x0c, 0x0c, NON_VPD_RING, 0, 0x0002000000002000}, - {"ob3_pll_bndy" , 0x04, 0x0c, 0x0c, NON_VPD_RING, 0, 0x0002000000000080}, - {"ob3_pll_func" , 0x05, 0x0c, 0x0c, NON_VPD_RING, 0, 0x0002000000008000}, + {"ob3_fure" , 0x00, 0x0c, 0x0c, NON_VPD_RING , 0, 0x0C03700F}, + {"ob3_gptr" , 0x01, 0x0c, 0x0c, NON_VPD_RING , 0, 0x0C037002}, + {"ob3_time" , 0x02, 0x0c, 0x0c, NON_VPD_RING , 0, 0x0C037007}, + {"ob3_pll_gptr" , 0x03, 0x0c, 0x0c, NON_VPD_RING , 0, 0x0C030012}, + {"ob3_pll_bndy" , 0x04, 0x0c, 0x0c, NON_VPD_RING , 0, 0x0C030018}, + {"ob3_pll_func" , 0x05, 0x0c, 0x0c, NON_VPD_RING , 0, 0x0C030010}, }; const GenRingIdList RING_ID_LIST_INSTANCE[] = { - {"ob3_repr" , 0x0a, 0x0c, 0x0c, NON_VPD_RING, 0, 0x0E00000000000200}, + {"ob3_repr" , 0x0a, 0x0c, 0x0c, NON_VPD_RING , 0, 0x0C037006}, }; -const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID}; +const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID }; }; @@ -298,17 +297,17 @@ namespace PCI0 { const GenRingIdList RING_ID_LIST_COMMON[] = { - {"pci0_fure" , 0x00, 0x0d, 0x0d, NON_VPD_RING, 0, 0x0E00000000009000}, - {"pci0_gptr" , 0x01, 0x0d, 0x0d, NON_VPD_RING, 0, 0x0E00000000002000}, - {"pci0_time" , 0x02, 0x0d, 0x0d, NON_VPD_RING, 0, 0x0E00000000000100}, - {"pci0_pll_bndy" , 0x03, 0x0d, 0x0d, NON_VPD_RING, 0, 0x0002000000000080}, - {"pci0_pll_gptr" , 0x04, 0x0d, 0x0d, NON_VPD_RING, 0, 0x0002000000002000}, + {"pci0_fure" , 0x00, 0x0d, 0x0d, NON_VPD_RING , 0, 0x0D03700F}, + {"pci0_gptr" , 0x01, 0x0d, 0x0d, NON_VPD_RING , 0, 0x0D037002}, + {"pci0_time" , 0x02, 0x0d, 0x0d, NON_VPD_RING , 0, 0x0D037007}, + {"pci0_pll_bndy" , 0x03, 0x0d, 0x0d, NON_VPD_RING , 0, 0x0D030018}, + {"pci0_pll_gptr" , 0x04, 0x0d, 0x0d, NON_VPD_RING , 0, 0x0D030012}, }; const GenRingIdList RING_ID_LIST_INSTANCE[] = { - {"pci0_repr" , 0x05, 0x0d, 0x0d, NON_VPD_RING, 0, 0x0E00000000000200}, + {"pci0_repr" , 0x05, 0x0d, 0x0d, NON_VPD_RING , 0, 0x0D037006}, }; -const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID}; +const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID }; }; @@ -316,17 +315,17 @@ namespace PCI1 { const GenRingIdList RING_ID_LIST_COMMON[] = { - {"pci1_fure" , 0x00, 0x0e, 0x0e, NON_VPD_RING, 0, 0x0F00000000009000}, - {"pci1_gptr" , 0x01, 0x0e, 0x0e, NON_VPD_RING, 0, 0x0F00000000002000}, - {"pci1_time" , 0x02, 0x0e, 0x0e, NON_VPD_RING, 0, 0x0F00000000000100}, - {"pci1_pll_bndy" , 0x03, 0x0e, 0x0e, NON_VPD_RING, 0, 0x0002000000000080}, - {"pci1_pll_gptr" , 0x04, 0x0e, 0x0e, NON_VPD_RING, 0, 0x0002000000002000}, + {"pci1_fure" , 0x00, 0x0e, 0x0e, NON_VPD_RING , 0, 0x0E03780F}, + {"pci1_gptr" , 0x01, 0x0e, 0x0e, NON_VPD_RING , 0, 0x0E037802}, + {"pci1_time" , 0x02, 0x0e, 0x0e, NON_VPD_RING , 0, 0x0E037807}, + {"pci1_pll_bndy" , 0x03, 0x0e, 0x0e, NON_VPD_RING , 0, 0x0E030018}, + {"pci1_pll_gptr" , 0x04, 0x0e, 0x0e, NON_VPD_RING , 0, 0x0E030012}, }; const GenRingIdList RING_ID_LIST_INSTANCE[] = { - {"pci1_repr" , 0x05, 0x0e, 0x0e, NON_VPD_RING, 0, 0x0F00000000000200}, + {"pci1_repr" , 0x05, 0x0e, 0x0e, NON_VPD_RING , 0, 0x0E037806}, }; -const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID}; +const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID }; }; @@ -334,17 +333,17 @@ namespace PCI2 { const GenRingIdList RING_ID_LIST_COMMON[] = { - {"pci2_fure" , 0x00, 0x0f, 0x0f, NON_VPD_RING, 0, 0x0F80000000009000}, - {"pci2_gptr" , 0x01, 0x0f, 0x0f, NON_VPD_RING, 0, 0x0F80000000002000}, - {"pci2_time" , 0x02, 0x0f, 0x0f, NON_VPD_RING, 0, 0x0F80000000000100}, - {"pci2_pll_bndy" , 0x03, 0x0f, 0x0f, NON_VPD_RING, 0, 0x0002000000000080}, - {"pci2_pll_gptr" , 0x04, 0x0f, 0x0f, NON_VPD_RING, 0, 0x0002000000002000}, + {"pci2_fure" , 0x00, 0x0f, 0x0f, NON_VPD_RING , 0, 0x0F037C0F}, + {"pci2_gptr" , 0x01, 0x0f, 0x0f, NON_VPD_RING , 0, 0x0F037C02}, + {"pci2_time" , 0x02, 0x0f, 0x0f, NON_VPD_RING , 0, 0x0F037C07}, + {"pci2_pll_bndy" , 0x03, 0x0f, 0x0f, NON_VPD_RING , 0, 0x0F030018}, + {"pci2_pll_gptr" , 0x04, 0x0f, 0x0f, NON_VPD_RING , 0, 0x0F030012}, }; const GenRingIdList RING_ID_LIST_INSTANCE[] = { - {"pci2_repr" , 0x05, 0x0F, 0x0F, NON_VPD_RING, 0, 0x0F80000000000200}, + {"pci2_repr" , 0x05, 0x0F, 0x0F, NON_VPD_RING , 0, 0x0F037C06}, }; -const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID}; +const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, RL, NOT_VALID }; }; @@ -352,64 +351,64 @@ namespace EQ { const GenRingIdList RING_ID_LIST_COMMON[] = { - {"eq_fure" , 0x00, 0x10, 0x10, NON_VPD_RING, 0, 0x0C10000000009000}, - {"eq_gptr" , 0x01, 0x10, 0x10, NON_VPD_RING, 0, 0x0C10000000002000}, - {"eq_time" , 0x02, 0x10, 0x10, NON_VPD_RING, 0, 0x0C10000000000100}, - {"eq_mode" , 0x03, 0x10, 0x10, NON_VPD_RING, 0, 0x0C10000000004000}, - {"ex_l3_fure" , 0x04, 0x10, 0x10, NON_VPD_RING, 0, 0x0200000000009000}, - {"ex_l3_gptr" , 0x05, 0x10, 0x10, NON_VPD_RING, 0, 0x0200000000002000}, - {"ex_l3_time" , 0x06, 0x10, 0x10, NON_VPD_RING, 0, 0x0200000000000100}, - {"ex_l2_mode" , 0x07, 0x10, 0x10, NON_VPD_RING, 0, 0x0080000000004000}, - {"ex_l2_fure" , 0x08, 0x10, 0x10, NON_VPD_RING, 0, 0x0080000000009000}, - {"ex_l2_gptr" , 0x09, 0x10, 0x10, NON_VPD_RING, 0, 0x0080000000002000}, - {"ex_l2_time" , 0x0a, 0x10, 0x10, NON_VPD_RING, 0, 0x0080000000000100}, - {"ex_l3_refr_fure" , 0x0b, 0x10, 0x10, NON_VPD_RING, 0, 0x0008000000009000}, - {"ex_l3_refr_gptr" , 0x0c, 0x10, 0x10, NON_VPD_RING, 0, 0x0008000000002000}, - {"eq_ana_func" , 0x0d, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000008000}, - {"eq_ana_gptr" , 0x0e, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000002000}, - {"eq_dpll_func" , 0x0f, 0x10, 0x10, NON_VPD_RING, 0, 0x0002000000008000}, - {"eq_dpll_gptr" , 0x10, 0x10, 0x10, NON_VPD_RING, 0, 0x0002000000002000}, - {"eq_dpll_mode" , 0x11, 0x10, 0x10, NON_VPD_RING, 0, 0x0002000000004000}, - {"eq_ana_bndy_bucket_0" , 0x12, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_1" , 0x13, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_2" , 0x14, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_3" , 0x15, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_4" , 0x16, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_5" , 0x17, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_6" , 0x18, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_7" , 0x19, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_8" , 0x1a, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_9" , 0x1b, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_10" , 0x1c, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_11" , 0x1d, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_12" , 0x1e, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_13" , 0x1f, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_14" , 0x20, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_15" , 0x21, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_16" , 0x22, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_17" , 0x23, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_18" , 0x24, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_19" , 0x25, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_20" , 0x26, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_21" , 0x27, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_22" , 0x28, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_23" , 0x29, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_24" , 0x2a, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_bucket_25" , 0x2b, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_bndy_l3dcc_bucket_26", 0x2c, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000000080}, - {"eq_ana_mode" , 0x2d, 0x10, 0x10, NON_VPD_RING, 0, 0x0020000000004000}, - {"ex_l2_fure_1" , 0x2e, 0x10, 0x10, NON_VPD_RING, 0, 0x0080000000009000}, - {"ex_l3_fure_1" , 0x2f, 0x10, 0x10, NON_VPD_RING, 0, 0x0200000000009000}, + {"eq_fure" , 0x00, 0x10, 0x10, NON_VPD_RING, 0, 0x1003608F}, + {"eq_gptr" , 0x01, 0x10, 0x10, NON_VPD_RING, 0, 0x10036082}, + {"eq_time" , 0x02, 0x10, 0x10, NON_VPD_RING, 0, 0x10036087}, + {"eq_mode" , 0x03, 0x10, 0x10, NON_VPD_RING, 0, 0x10036081}, + {"ex_l3_fure" , 0x04, 0x10, 0x10, NON_VPD_RING, 0, 0x1003100F}, + {"ex_l3_gptr" , 0x05, 0x10, 0x10, NON_VPD_RING, 0, 0x10031002}, + {"ex_l3_time" , 0x06, 0x10, 0x10, NON_VPD_RING, 0, 0x10031007}, + {"ex_l2_mode" , 0x07, 0x10, 0x10, NON_VPD_RING, 0, 0x10030401}, + {"ex_l2_fure" , 0x08, 0x10, 0x10, NON_VPD_RING, 0, 0x1003040F}, + {"ex_l2_gptr" , 0x09, 0x10, 0x10, NON_VPD_RING, 0, 0x10030402}, + {"ex_l2_time" , 0x0a, 0x10, 0x10, NON_VPD_RING, 0, 0x10030407}, + {"ex_l3_refr_fure" , 0x0b, 0x10, 0x10, NON_VPD_RING, 0, 0x1003004F}, + {"ex_l3_refr_gptr" , 0x0c, 0x10, 0x10, NON_VPD_RING, 0, 0x10030042}, + {"eq_ana_func" , 0x0d, 0x10, 0x10, NON_VPD_RING, 0, 0x10030100}, + {"eq_ana_gptr" , 0x0e, 0x10, 0x10, NON_VPD_RING, 0, 0x10030102}, + {"eq_dpll_func" , 0x0f, 0x10, 0x10, NON_VPD_RING, 0, 0x10030010}, + {"eq_dpll_gptr" , 0x10, 0x10, 0x10, NON_VPD_RING, 0, 0x10030012}, + {"eq_dpll_mode" , 0x11, 0x10, 0x10, NON_VPD_RING, 0, 0x10030011}, + {"eq_ana_bndy_bucket_0" , 0x12, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_1" , 0x13, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_2" , 0x14, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_3" , 0x15, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_4" , 0x16, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_5" , 0x17, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_6" , 0x18, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_7" , 0x19, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_8" , 0x1a, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_9" , 0x1b, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_10" , 0x1c, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_11" , 0x1d, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_12" , 0x1e, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_13" , 0x1f, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_14" , 0x20, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_15" , 0x21, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_16" , 0x22, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_17" , 0x23, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_18" , 0x24, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_19" , 0x25, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_20" , 0x26, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_21" , 0x27, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_22" , 0x28, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_23" , 0x29, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_24" , 0x2a, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_bucket_25" , 0x2b, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_bndy_l3dcc_bucket_26", 0x2c, 0x10, 0x10, NON_VPD_RING, 0, 0x10030108}, + {"eq_ana_mode" , 0x2d, 0x10, 0x10, NON_VPD_RING, 0, 0x10030101}, + {"ex_l2_fure_1" , 0x2e, 0x10, 0x10, NON_VPD_RING, 0, 0x1003040F}, + {"ex_l3_fure_1" , 0x2f, 0x10, 0x10, NON_VPD_RING, 0, 0x1003100F}, }; const GenRingIdList RING_ID_LIST_INSTANCE[] = { - {"eq_repr" , 0x30, 0x10, 0x1b, NON_VPD_RING, 0, 0x0C10000000000200}, - {"ex_l3_repr" , 0x31, 0x10, 0x1b, NON_VPD_RING, 0, 0x0200000000000200}, - {"ex_l2_repr" , 0x32, 0x10, 0x1b, NON_VPD_RING, 0, 0x0080000000000200}, - {"ex_l3_refr_repr" , 0x33, 0x10, 0x1b, NON_VPD_RING, 0, 0x0008000000000200}, - {"ex_l3_refr_time" , 0x34, 0x10, 0x1b, NON_VPD_RING, 0, 0x0008000000000100}, + {"eq_repr" , 0x30, 0x10, 0x1b, NON_VPD_RING , 0, 0x10036086}, + {"ex_l3_repr" , 0x31, 0x10, 0x1b, NON_VPD_RING , 0, 0x10031006}, + {"ex_l2_repr" , 0x32, 0x10, 0x1b, NON_VPD_RING , 0, 0x10030406}, + {"ex_l3_refr_repr" , 0x33, 0x10, 0x1b, NON_VPD_RING , 0, 0x10030046}, + {"ex_l3_refr_time" , 0x34, 0x10, 0x1b, NON_VPD_RING , 0, 0x10030047}, }; -const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, CC, RL}; +const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, CC, RL }; }; @@ -417,15 +416,202 @@ namespace EC { const GenRingIdList RING_ID_LIST_COMMON[] = { - { "ec_func" , 0x00, 0x20, 0x20, NON_VPD_RING, 0, 0x0E00000000009000}, - { "ec_gptr" , 0x01, 0x20, 0x20, NON_VPD_RING, 0, 0x0E00000000002000}, - { "ec_time" , 0x02, 0x20, 0x20, NON_VPD_RING, 0, 0x0E00000000000100}, - { "ec_mode" , 0x03, 0x20, 0x20, NON_VPD_RING, 0, 0x0E00000000004000}, + { "ec_func" , 0x00, 0x20, 0x20, NON_VPD_RING , 0, 0x2003700F}, + { "ec_gptr" , 0x01, 0x20, 0x20, NON_VPD_RING , 0, 0x20037002}, + { "ec_time" , 0x02, 0x20, 0x20, NON_VPD_RING , 0, 0x20037007}, + { "ec_mode" , 0x03, 0x20, 0x20, NON_VPD_RING , 0, 0x20037001}, }; const GenRingIdList RING_ID_LIST_INSTANCE[] = { - { "ec_repr" , 0x04, 0x20, 0x37, NON_VPD_RING, 0, 0x0E00000000000200}, -}; -const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, CC, RL}; -}; - + { "ec_repr" , 0x04, 0x20, 0x37, NON_VPD_RING , 0, 0x20037006}, +}; +const RingVariantOrder RING_VARIANT_ORDER[] = { BASE, CC, RL }; +}; + +CHIPLET_TYPE p9_ringid_get_chiplet(RingID i_ringId) +{ + return RING_PROPERTIES[i_ringId].iv_type; +} + +void p9_ringid_get_chiplet_properties( + CHIPLET_TYPE i_chiplet, + CHIPLET_DATA** o_cpltData, + GenRingIdList** o_ringComm, + GenRingIdList** o_ringInst, + RingVariantOrder** o_varOrder, + uint8_t* o_varNumb) +{ + switch (i_chiplet) + { + case PERV_TYPE : + *o_cpltData = (CHIPLET_DATA*) &PERV::g_pervData; + *o_ringComm = (GenRingIdList*) PERV::RING_ID_LIST_COMMON; + *o_ringInst = (GenRingIdList*) PERV::RING_ID_LIST_INSTANCE; + *o_varOrder = (RingVariantOrder*) PERV::RING_VARIANT_ORDER; + *o_varNumb = sizeof(PERV::RingVariants) / sizeof(uint16_t); + break; + + case N0_TYPE : + *o_cpltData = (CHIPLET_DATA*) &N0::g_n0Data; + *o_ringComm = (GenRingIdList*) N0::RING_ID_LIST_COMMON; + *o_ringInst = (GenRingIdList*) N0::RING_ID_LIST_INSTANCE; + *o_varOrder = (RingVariantOrder*) N0::RING_VARIANT_ORDER; + *o_varNumb = sizeof(N0::RingVariants) / sizeof(uint16_t); + break; + + case N1_TYPE : + *o_cpltData = (CHIPLET_DATA*) &N1::g_n1Data; + *o_ringComm = (GenRingIdList*) N1::RING_ID_LIST_COMMON; + *o_ringInst = (GenRingIdList*) N1::RING_ID_LIST_INSTANCE; + *o_varOrder = (RingVariantOrder*) N1::RING_VARIANT_ORDER; + *o_varNumb = sizeof(N1::RingVariants) / sizeof(uint16_t); + break; + + case N2_TYPE : + *o_cpltData = (CHIPLET_DATA*) &N2::g_n2Data; + *o_ringComm = (GenRingIdList*) N2::RING_ID_LIST_COMMON; + *o_ringInst = (GenRingIdList*) N2::RING_ID_LIST_INSTANCE; + *o_varOrder = (RingVariantOrder*) N2::RING_VARIANT_ORDER; + *o_varNumb = sizeof(N2::RingVariants) / sizeof(uint16_t); + break; + + case N3_TYPE : + *o_cpltData = (CHIPLET_DATA*) &N3::g_n3Data; + *o_ringComm = (GenRingIdList*) N3::RING_ID_LIST_COMMON; + *o_ringInst = (GenRingIdList*) N3::RING_ID_LIST_INSTANCE; + *o_varOrder = (RingVariantOrder*) N3::RING_VARIANT_ORDER; + *o_varNumb = sizeof(N3::RingVariants) / sizeof(uint16_t); + break; + + case XB_TYPE : + *o_cpltData = (CHIPLET_DATA*) &XB::g_xbData; + *o_ringComm = (GenRingIdList*) XB::RING_ID_LIST_COMMON; + *o_ringInst = (GenRingIdList*) XB::RING_ID_LIST_INSTANCE; + *o_varOrder = (RingVariantOrder*) XB::RING_VARIANT_ORDER; + *o_varNumb = sizeof(XB::RingVariants) / sizeof(uint16_t); + break; + + case MC_TYPE : + *o_cpltData = (CHIPLET_DATA*) &MC::g_mcData; + *o_ringComm = (GenRingIdList*) MC::RING_ID_LIST_COMMON; + *o_ringInst = (GenRingIdList*) MC::RING_ID_LIST_INSTANCE; + *o_varOrder = (RingVariantOrder*) MC::RING_VARIANT_ORDER; + *o_varNumb = sizeof(MC::RingVariants) / sizeof(uint16_t); + break; + + case OB0_TYPE : + *o_cpltData = (CHIPLET_DATA*) &OB0::g_ob0Data; + *o_ringComm = (GenRingIdList*) OB0::RING_ID_LIST_COMMON; + *o_ringInst = (GenRingIdList*) OB0::RING_ID_LIST_INSTANCE; + *o_varOrder = (RingVariantOrder*) OB0::RING_VARIANT_ORDER; + *o_varNumb = sizeof(OB0::RingVariants) / sizeof(uint16_t); + break; + + case OB1_TYPE : + *o_cpltData = (CHIPLET_DATA*) &OB1::g_ob1Data; + *o_ringComm = (GenRingIdList*) OB1::RING_ID_LIST_COMMON; + *o_ringInst = (GenRingIdList*) OB1::RING_ID_LIST_INSTANCE; + *o_varOrder = (RingVariantOrder*) OB1::RING_VARIANT_ORDER; + *o_varNumb = sizeof(OB1::RingVariants) / sizeof(uint16_t); + break; + + case OB2_TYPE : + *o_cpltData = (CHIPLET_DATA*) &OB2::g_ob2Data; + *o_ringComm = (GenRingIdList*) OB2::RING_ID_LIST_COMMON; + *o_ringInst = (GenRingIdList*) OB2::RING_ID_LIST_INSTANCE; + *o_varOrder = (RingVariantOrder*) OB2::RING_VARIANT_ORDER; + *o_varNumb = sizeof(OB2::RingVariants) / sizeof(uint16_t); + break; + + case OB3_TYPE : + *o_cpltData = (CHIPLET_DATA*) &OB3::g_ob3Data; + *o_ringComm = (GenRingIdList*) OB3::RING_ID_LIST_COMMON; + *o_ringInst = (GenRingIdList*) OB3::RING_ID_LIST_INSTANCE; + *o_varOrder = (RingVariantOrder*) OB3::RING_VARIANT_ORDER; + *o_varNumb = sizeof(OB3::RingVariants) / sizeof(uint16_t); + break; + + case PCI0_TYPE : + *o_cpltData = (CHIPLET_DATA*) &PCI0::g_pci0Data; + *o_ringComm = (GenRingIdList*) PCI0::RING_ID_LIST_COMMON; + *o_ringInst = (GenRingIdList*) PCI0::RING_ID_LIST_INSTANCE; + *o_varOrder = (RingVariantOrder*) PCI0::RING_VARIANT_ORDER; + *o_varNumb = sizeof(PCI0::RingVariants) / sizeof(uint16_t); + break; + + case PCI1_TYPE : + *o_cpltData = (CHIPLET_DATA*) &PCI1::g_pci1Data; + *o_ringComm = (GenRingIdList*) PCI1::RING_ID_LIST_COMMON; + *o_ringInst = (GenRingIdList*) PCI1::RING_ID_LIST_INSTANCE; + *o_varOrder = (RingVariantOrder*) PCI1::RING_VARIANT_ORDER; + *o_varNumb = sizeof(PCI1::RingVariants) / sizeof(uint16_t); + break; + + case PCI2_TYPE : + *o_cpltData = (CHIPLET_DATA*) &PCI2::g_pci2Data; + *o_ringComm = (GenRingIdList*) PCI2::RING_ID_LIST_COMMON; + *o_ringInst = (GenRingIdList*) PCI2::RING_ID_LIST_INSTANCE; + *o_varOrder = (RingVariantOrder*) PCI2::RING_VARIANT_ORDER; + *o_varNumb = sizeof(PCI2::RingVariants) / sizeof(uint16_t); + break; + + case EQ_TYPE : + *o_cpltData = (CHIPLET_DATA*) &EQ::g_eqData; + *o_ringComm = (GenRingIdList*) EQ::RING_ID_LIST_COMMON; + *o_ringInst = (GenRingIdList*) EQ::RING_ID_LIST_INSTANCE; + *o_varOrder = (RingVariantOrder*) EQ::RING_VARIANT_ORDER; + *o_varNumb = sizeof(EQ::RingVariants) / sizeof(uint16_t); + break; + + case EC_TYPE : + *o_cpltData = (CHIPLET_DATA*) &EC::g_ecData; + *o_ringComm = (GenRingIdList*) EC::RING_ID_LIST_COMMON; + *o_ringInst = (GenRingIdList*) EC::RING_ID_LIST_INSTANCE; + *o_varOrder = (RingVariantOrder*) EC::RING_VARIANT_ORDER; + *o_varNumb = sizeof(EC::RingVariants) / sizeof(uint16_t); + break; + + default : + *o_cpltData = NULL; + *o_ringComm = NULL; + *o_ringInst = NULL; + *o_varOrder = NULL; + *o_varNumb = 0; + break; + } +} + +GenRingIdList* p9_ringid_get_ring_properties(RingID i_ringId) +{ + CHIPLET_DATA* l_cpltData; + GenRingIdList* l_ringList[2]; // 0: common, 1: instance + RingVariantOrder* l_varOrder; + uint8_t l_varNumb; + int i, j, n; + + p9_ringid_get_chiplet_properties( + p9_ringid_get_chiplet(i_ringId), + &l_cpltData, &l_ringList[0], &l_ringList[1], &l_varOrder, &l_varNumb); + + if (!l_ringList[0]) + { + return NULL; + } + + for (j = 0; j < 2; j++) // 0: common, 1: instance + { + n = (j ? l_cpltData->iv_num_instance_rings + : l_cpltData->iv_num_common_rings); + + for (i = 0; i < n; i++) + { + if (!strcmp(l_ringList[j][i].ringName, + RING_PROPERTIES[i_ringId].iv_name)) + { + return &(l_ringList[j][i]); + } + } + } + + return NULL; +} diff --git a/src/import/chips/p9/utils/imageProcs/p9_ringId.H b/src/import/chips/p9/utils/imageProcs/p9_ringId.H index d8bdda634..325c3c0b5 100644 --- a/src/import/chips/p9/utils/imageProcs/p9_ringId.H +++ b/src/import/chips/p9/utils/imageProcs/p9_ringId.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ +/* Contributors Listed Below - COPYRIGHT 2016,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -27,6 +27,8 @@ #define _P9_RINGID_H_ #include <stdint.h> +#include <stddef.h> + #include <p9_ring_id.h> // General Ring ID list structure @@ -38,7 +40,7 @@ typedef struct uint8_t instanceIdMax; // the max instanceId uint8_t vpdKeyword; uint8_t pllCopy; // 0,1,2,3,4,5 -- No of PLL copies required - uint64_t scanRegionType; + uint32_t scanScomAddress; } GenRingIdList; typedef enum RingVariant // Base variables @@ -1303,4 +1305,25 @@ static const ringProperties_t RING_PROPERTIES[NUM_RING_IDS] = }; #endif +// returns our own chiplet enum value for this ringId +CHIPLET_TYPE +p9_ringid_get_chiplet( + RingID i_ringId); + +// returns data structures defined for chiplet type +// as determined by ringId +void +p9_ringid_get_chiplet_properties( + CHIPLET_TYPE i_chiplet, + CHIPLET_DATA** o_cpltData, + GenRingIdList** o_ringComm, + GenRingIdList** o_ringInst, + RingVariantOrder** o_varOrder, + uint8_t* o_varNumb); + +// returns properties of a ring as determined by ringId +GenRingIdList* +p9_ringid_get_ring_properties( + RingID i_ringId); + #endif diff --git a/src/import/chips/p9/utils/imageProcs/p9_scan_compression.C b/src/import/chips/p9/utils/imageProcs/p9_scan_compression.C index 8eb29d230..871d596fd 100644 --- a/src/import/chips/p9/utils/imageProcs/p9_scan_compression.C +++ b/src/import/chips/p9/utils/imageProcs/p9_scan_compression.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ +/* Contributors Listed Below - COPYRIGHT 2016,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -30,18 +30,14 @@ /// /// Scan strings are compressed using a simple run-length encoding called /// RS4. The string to be decompressed and scanned is the difference between -/// the current state of the ring and the desired final state of the ring. A -/// run-time optimization supports the case that the current state of the ring -/// is the flush state. +/// the current state of the ring and the desired final state of the ring. /// /// Both the data to be compressed and the final compressed data are treated -/// as strings of 4-bit nibbles. When packaged in the scan data structure -/// however the compressed string must begin on an 8-byte boundary and is -/// always read 8 bytes at a time. In the scan data structure the compressed -/// strings are also padded with 0x0 nibbles to the next even multiple of 8 -/// bytes. The compressed string consists of control nibbles and data nibbles. -/// The string format includes a special control/data sequence that marks the -/// end of the string and the final bits of scan data. +/// as strings of 4-bit nibbles. In the scan data structure the compressed +/// strings are padded with 0x0 nibbles to the next even multiple of 4. +/// The compressed string consists of control nibbles and data +/// nibbles. The string format includes a special control/data sequence that +/// marks the end of the string and the final bits of scan data. /// /// Special control/data sequences have been been added for RS4v2 to /// store pairs of care mask nibble and data nibble. This enhancement @@ -193,23 +189,20 @@ // unique names to support concurrent update. Most routines defined here have // some variant of 'rs4' in their names; others should be inherently unique. -#if COMPRESSED_SCAN_DATA_VERSION != 2 - #error This code assumes CompressedScanData structure version 2 layout +#if RS4_VERSION != 3 + #error This code assumes CompressedScanData structure version 3 layout #endif void -compressed_scan_data_translate(CompressedScanData* o_data, - CompressedScanData* i_data) +compressed_scan_data_translate(CompressedScanData* o_rs4, + CompressedScanData* i_rs4) { - o_data->iv_magic = htobe32(i_data->iv_magic); - o_data->iv_size = htobe32(i_data->iv_size); - o_data->iv_algorithmReserved = htobe32(i_data->iv_algorithmReserved); - o_data->iv_length = htobe32(i_data->iv_length); - o_data->iv_scanSelect = htobe64(i_data->iv_scanSelect); - o_data->iv_headerVersion = i_data->iv_headerVersion; - o_data->iv_flushOptimization = i_data->iv_flushOptimization; - o_data->iv_ringId = i_data->iv_ringId; - o_data->iv_chipletId = i_data->iv_chipletId; + o_rs4->iv_magic = htobe16(i_rs4->iv_magic); + o_rs4->iv_version = i_rs4->iv_version; + o_rs4->iv_type = i_rs4->iv_type; + o_rs4->iv_size = htobe16(i_rs4->iv_size); + o_rs4->iv_ringId = htobe16(i_rs4->iv_ringId); + o_rs4->iv_scanAddr = htobe32(i_rs4->iv_scanAddr); } @@ -350,7 +343,7 @@ stop_decode(uint32_t* o_count, const uint8_t* i_string, const uint32_t i_i) // Returns a scan compression return code. static int -__rs4_compress(CompressedScanData* o_data, +__rs4_compress(uint8_t* o_rs4_str, uint32_t* o_nibbles, const uint8_t* i_data_str, const uint8_t* i_care_str, @@ -360,10 +353,9 @@ __rs4_compress(CompressedScanData* o_data, uint32_t n; /* Number of whole nibbles in i_data */ uint32_t r; /* Number of reminaing bits in i_data */ uint32_t i; /* Nibble index in i_data_str/i_care_str */ - uint32_t j; /* Nibble index in data */ + uint32_t j; /* Nibble index in o_rs4_str */ uint32_t k; /* Location to place <scan_count(N)> */ uint32_t count; /* Counts rotate/scan nibbles */ - uint8_t* data; /* The compressed scan data area */ int care_nibble; int data_nibble; @@ -372,7 +364,6 @@ __rs4_compress(CompressedScanData* o_data, i = 0; j = 0; k = 0; /* Makes GCC happy */ - data = (uint8_t*)o_data + sizeof(CompressedScanData); care_nibble = 0; data_nibble = 0; count = 0; @@ -404,7 +395,7 @@ __rs4_compress(CompressedScanData* o_data, } else { - j += rs4_stop_encode(count, data, j); + j += rs4_stop_encode(count, o_rs4_str, j); count = 0; k = j; j++; @@ -432,7 +423,7 @@ __rs4_compress(CompressedScanData* o_data, { // Set the <scan_count(N)> in nibble k since no more data in // current AND next nibble (or next nibble might be last). - rs4_set_nibble(data, k, count); + rs4_set_nibble(o_rs4_str, k, count); count = 0; state = 0; } @@ -441,7 +432,7 @@ __rs4_compress(CompressedScanData* o_data, // Whether next nibble is last nibble or contains data, lets include the // current empty nibble in the scan_data(N) count because its // more efficient than inserting rotate go+stop nibbles. - rs4_set_nibble(data, j, 0); + rs4_set_nibble(o_rs4_str, j, 0); count++; i++; j++; @@ -450,7 +441,7 @@ __rs4_compress(CompressedScanData* o_data, else if ((care_nibble ^ data_nibble) == 0) { // Only one-data in nibble. Continue pilling on one-data nibbles. - rs4_set_nibble(data, j, data_nibble); + rs4_set_nibble(o_rs4_str, j, data_nibble); count++; i++; j++; @@ -460,14 +451,14 @@ __rs4_compress(CompressedScanData* o_data, // There is zero-data in nibble. // First set the <scan_count(N)> in nibble k to end current // sequence of one-data nibbles. - rs4_set_nibble(data, k, count); + rs4_set_nibble(o_rs4_str, k, count); count = 0; state = 0; } if ((state == 1) && (count == 14)) { - rs4_set_nibble(data, k, 14); + rs4_set_nibble(o_rs4_str, k, 14); count = 0; state = 0; } @@ -477,10 +468,10 @@ __rs4_compress(CompressedScanData* o_data, // Zero-data section // //-------------------// { - rs4_set_nibble(data, k, 15); - rs4_set_nibble(data, j, care_nibble); + rs4_set_nibble(o_rs4_str, k, 15); + rs4_set_nibble(o_rs4_str, j, care_nibble); j++; - rs4_set_nibble(data, j, data_nibble); + rs4_set_nibble(o_rs4_str, j, data_nibble); i++; j++; count = 0; @@ -493,12 +484,12 @@ __rs4_compress(CompressedScanData* o_data, if (state == 0) { - j += rs4_stop_encode(count, data, j); + j += rs4_stop_encode(count, o_rs4_str, j); } else if (state == 1) { - rs4_set_nibble(data, k, count); - j += rs4_stop_encode(0, data, j); + rs4_set_nibble(o_rs4_str, k, count); + j += rs4_stop_encode(0, o_rs4_str, j); } else { @@ -507,14 +498,14 @@ __rs4_compress(CompressedScanData* o_data, } // Indicate termination start - rs4_set_nibble(data, j, 0); + rs4_set_nibble(o_rs4_str, j, 0); j++; // Insert the remainder count nibble, and if r>0, the remainder data // nibble. Note that here we indicate the number of bits (0<=r<4). if (r == 0) { - rs4_set_nibble(data, j, r); + rs4_set_nibble(o_rs4_str, j, r); j++; } else @@ -531,19 +522,19 @@ __rs4_compress(CompressedScanData* o_data, if ((care_nibble ^ data_nibble) == 0) { // Only one-data in rem nibble. - rs4_set_nibble(data, j, r); + rs4_set_nibble(o_rs4_str, j, r); j++; - rs4_set_nibble(data, j, data_nibble); + rs4_set_nibble(o_rs4_str, j, data_nibble); j++; } else { // Zero-data in rem nibble. - rs4_set_nibble(data, j, r + 8); + rs4_set_nibble(o_rs4_str, j, r + 8); j++; - rs4_set_nibble(data, j, care_nibble); + rs4_set_nibble(o_rs4_str, j, care_nibble); j++; - rs4_set_nibble(data, j, data_nibble); + rs4_set_nibble(o_rs4_str, j, data_nibble); j++; } } @@ -609,58 +600,55 @@ rs4_max_compressed_bytes(uint32_t nibbles) bytes = ((nibbles + 1) / 2); // nibbles rounded up to full bytes bytes += sizeof(CompressedScanData); // plus rs4 header - bytes = ((bytes + 7) / 8) * 8; // rounded up to multiple of 8 bytes + bytes = ((bytes + 3) / 4) * 4; // rounded up to multiple of 4 bytes return bytes; } // We always require the worst-case amount of memory including the header and -// any rounding required to guarantee that the data size is a multiple of 8 -// bytes. The final image size is also rounded up to a multiple of 8 bytes. +// any rounding required to guarantee that the data size is a multiple of 4 +// bytes. The final image size is also rounded up to a multiple of 4 bytes. // // Returns a scan compression return code. int -_rs4_compress(CompressedScanData* io_data, - uint32_t i_dataSize, - uint32_t* o_imageSize, +_rs4_compress(CompressedScanData* io_rs4, + const uint32_t i_size, const uint8_t* i_data_str, const uint8_t* i_care_str, const uint32_t i_length, - const uint64_t i_scanSelect, - const uint8_t i_ringId, - const uint8_t i_chipletId, - const uint8_t i_flushOptimization) + const uint32_t i_scanAddr, + const uint8_t i_ringId) { int rc; uint32_t nibbles = rs4_max_compressed_nibbles(i_length); uint32_t bytes = rs4_max_compressed_bytes(nibbles); + uint8_t* rs4_str = (uint8_t*)io_rs4 + sizeof(CompressedScanData); - if (i_dataSize < bytes) + if (bytes > i_size) { return BUG(SCAN_COMPRESSION_BUFFER_OVERFLOW); } - memset(io_data, 0, bytes); + memset(io_rs4, 0, i_size); - rc = __rs4_compress(io_data, &nibbles, i_data_str, i_care_str, i_length); + rc = __rs4_compress(rs4_str, &nibbles, i_data_str, i_care_str, i_length); if (rc == SCAN_COMPRESSION_OK) { bytes = rs4_max_compressed_bytes(nibbles); - io_data->iv_magic = htobe32(RS4_MAGIC); - io_data->iv_size = htobe32(bytes); - io_data->iv_algorithmReserved = htobe32(nibbles); - io_data->iv_scanSelect = htobe64(i_scanSelect); - io_data->iv_length = htobe32(i_length); - io_data->iv_headerVersion = COMPRESSED_SCAN_DATA_VERSION; - io_data->iv_flushOptimization = i_flushOptimization; - io_data->iv_ringId = i_ringId; - io_data->iv_chipletId = i_chipletId; - - *o_imageSize = bytes; + io_rs4->iv_magic = htobe16(RS4_MAGIC); + io_rs4->iv_version = RS4_VERSION; + // For now this assumes non-CMSK scan data. + // For CMSK support, we would need to: + // - either add a CMSK function parameter and set type here, + // - or rely on caller to set type later. + io_rs4->iv_type = RS4_SCAN_DATA_TYPE_NON_CMSK; + io_rs4->iv_size = htobe16(bytes); + io_rs4->iv_ringId = htobe16(i_ringId); + io_rs4->iv_scanAddr = htobe32(i_scanAddr); } return rc; @@ -669,35 +657,32 @@ _rs4_compress(CompressedScanData* io_data, // We always allocate the worst-case amount of memory including the header // and any rounding required to guarantee that the allocated length is a -// multiple of 8 bytes. The final size is also rounded up to a multiple of 8 +// multiple of 4 bytes. The final size is also rounded up to a multiple of 4 // bytes. // // Returns a scan compression return code. int -rs4_compress(CompressedScanData** o_data, - uint32_t* o_size, +rs4_compress(CompressedScanData** o_rs4, const uint8_t* i_data_str, const uint8_t* i_care_str, const uint32_t i_length, - const uint64_t i_scanSelect, - const uint8_t i_ringId, - const uint8_t i_chipletId, - const uint8_t i_flushOptimization) + const uint32_t i_scanAddr, + const uint8_t i_ringId) { uint32_t nibbles = rs4_max_compressed_nibbles(i_length); uint32_t bytes = rs4_max_compressed_bytes(nibbles); - *o_data = (CompressedScanData*)malloc(bytes); + *o_rs4 = (CompressedScanData*)malloc(bytes); - if (*o_data == 0) + if (*o_rs4 == 0) { return BUG(SCAN_COMPRESSION_NO_MEMORY); } - return _rs4_compress(*o_data, bytes, o_size, i_data_str, - i_care_str, i_length, i_scanSelect, - i_ringId, i_chipletId, i_flushOptimization); + return _rs4_compress(*o_rs4, bytes, + i_data_str, i_care_str, i_length, + i_scanAddr, i_ringId); } @@ -709,8 +694,9 @@ rs4_compress(CompressedScanData** o_data, static int __rs4_decompress(uint8_t* io_data_str, uint8_t* io_care_str, - const uint8_t* i_rs4_str, - const uint32_t i_length) + uint32_t i_size, + uint32_t* o_length, + const uint8_t* i_rs4_str) { int state; /* 0 : Rotate, 1 : Scan */ uint32_t i; /* Nibble index in i_rs4_str */ @@ -738,9 +724,9 @@ __rs4_decompress(uint8_t* io_data_str, bits += 4 * count; - if (bits > i_length) + if (bits > i_size * 8) { - return BUG(SCAN_DECOMPRESSION_SIZE_ERROR); + return BUG(SCAN_COMPRESSION_BUFFER_OVERFLOW); } // keep 'count' zero care and data nibbles @@ -763,9 +749,9 @@ __rs4_decompress(uint8_t* io_data_str, nibbles = (masked ? 1 : nibbles); bits += 4 * nibbles; - if (bits > i_length) + if (bits > i_size * 8) { - return BUG(SCAN_DECOMPRESSION_SIZE_ERROR); + return BUG(SCAN_COMPRESSION_BUFFER_OVERFLOW); } for (k = 0; k < nibbles; k++) @@ -791,9 +777,9 @@ __rs4_decompress(uint8_t* io_data_str, r = nibbles & 0x3; bits += r; - if (bits != i_length) + if (bits > i_size * 8) { - return BUG(SCAN_DECOMPRESSION_SIZE_ERROR); + return BUG(SCAN_COMPRESSION_BUFFER_OVERFLOW); } if (r != 0) @@ -803,6 +789,7 @@ __rs4_decompress(uint8_t* io_data_str, rs4_set_nibble(io_data_str, j, rs4_get_nibble(i_rs4_str, i)); } + *o_length = bits; return SCAN_COMPRESSION_OK; } @@ -810,31 +797,27 @@ __rs4_decompress(uint8_t* io_data_str, int _rs4_decompress(uint8_t* io_data_str, uint8_t* io_care_str, - uint32_t i_stringSize, + uint32_t i_size, uint32_t* o_length, const CompressedScanData* i_rs4) { - uint32_t bytes; + uint8_t* rs4_str = (uint8_t*)i_rs4 + sizeof(CompressedScanData); - if (htobe32(i_rs4->iv_magic) != RS4_MAGIC) + if (htobe16(i_rs4->iv_magic) != RS4_MAGIC) { return BUG(SCAN_DECOMPRESSION_MAGIC_ERROR); } - *o_length = htobe32(i_rs4->iv_length); - bytes = (*o_length + 7) / 8; - - if (i_stringSize < bytes) + if (i_rs4->iv_version != RS4_VERSION) { - return BUG(SCAN_COMPRESSION_BUFFER_OVERFLOW); + return BUG(SCAN_COMPRESSION_VERSION_ERROR); } - memset(io_data_str, 0, bytes); - memset(io_care_str, 0, bytes); + memset(io_data_str, 0, i_size); + memset(io_care_str, 0, i_size); - return __rs4_decompress(io_data_str, io_care_str, - (uint8_t*)i_rs4 + sizeof(CompressedScanData), - *o_length); + return __rs4_decompress(io_data_str, io_care_str, i_size, + o_length, rs4_str); } @@ -844,25 +827,36 @@ rs4_decompress(uint8_t** o_data_str, uint32_t* o_length, const CompressedScanData* i_rs4) { - uint32_t length, bytes; + uint32_t size = 400000; + int rc; - if (htobe32(i_rs4->iv_magic) != RS4_MAGIC) + *o_data_str = (uint8_t*)malloc(size); + + if (*o_data_str == NULL) { - return BUG(SCAN_DECOMPRESSION_MAGIC_ERROR); + return BUG(SCAN_COMPRESSION_NO_MEMORY); } - length = htobe32(i_rs4->iv_length); - bytes = (length + 7) / 8; - - *o_data_str = (uint8_t*)malloc(bytes); - *o_care_str = (uint8_t*)malloc(bytes); + *o_care_str = (uint8_t*)malloc(size); - if (*o_data_str == 0 || *o_care_str == 0) + if (*o_care_str == NULL) { + free(*o_data_str); + *o_data_str = NULL; return BUG(SCAN_COMPRESSION_NO_MEMORY); } - return _rs4_decompress(*o_data_str, *o_care_str, bytes, o_length, i_rs4); + rc = _rs4_decompress(*o_data_str, *o_care_str, size, o_length, i_rs4); + + if (rc != SCAN_COMPRESSION_OK) + { + free(*o_data_str); + free(*o_care_str); + *o_data_str = NULL; + *o_care_str = NULL; + } + + return rc; } @@ -870,17 +864,16 @@ int rs4_redundant(const CompressedScanData* i_data, int* o_redundant) { uint8_t* data; - uint32_t length, stringLength, pos; + uint32_t length, pos; *o_redundant = 0; - if (htobe32(i_data->iv_magic) != RS4_MAGIC) + if (htobe16(i_data->iv_magic) != RS4_MAGIC) { return BUG(SCAN_DECOMPRESSION_MAGIC_ERROR); } data = (uint8_t*)i_data + sizeof(CompressedScanData); - stringLength = htobe32(i_data->iv_length); // A compressed scan string is redundant if the initial rotate is // followed by the end-of-string marker, and any remaining mod-4 bits @@ -906,12 +899,6 @@ rs4_redundant(const CompressedScanData* i_data, int* o_redundant) } } - if ((length > stringLength) || - (*o_redundant && (length != stringLength))) - { - return SCAN_DECOMPRESSION_SIZE_ERROR; - } - return SCAN_COMPRESSION_OK; } diff --git a/src/import/chips/p9/utils/imageProcs/p9_scan_compression.H b/src/import/chips/p9/utils/imageProcs/p9_scan_compression.H index 6845fc50d..360d70e99 100644 --- a/src/import/chips/p9/utils/imageProcs/p9_scan_compression.H +++ b/src/import/chips/p9/utils/imageProcs/p9_scan_compression.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ +/* Contributors Listed Below - COPYRIGHT 2016,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -36,92 +36,49 @@ /// Compressed Scan Chain Data Structure Format /// /// The compressed scan ring data structure must be 8-byte aligned in -/// memory. The container data structure consists of this 24-byte header +/// memory. The container data structure consists of a header /// followed by an arbitrary number of 8 byte doublewords containing the -/// compressed scan data. Images are always stored and processed in -/// big-endian byte order. This container format is common across all +/// compressed scan data. Images are always stored and processed in +/// big-endian byte order. The header format is common across all /// decompression algorithms. /// -/// Bytes - Content -/// -/// 0:3 - A 32-bit "magic number" that identifies and validates the -/// compression algorithm and algorithm version used to compress the data. -/// -/// 4:7 - The 32-bit size of the entire data structure in \e bytes. Thi -/// consists of this 24-byte header plus the compressed scan data. This value -/// is always a multiple of 8. +/// ATTENTION: +/// The RS4v2 CompressedScanData had a 4 byte magic value with 0x34 ("4") +/// within its third byte, which is at the same byte position as iv_version +/// now. Users of CompressedScanData which use the magic value to detect +/// a ring data structure won't be able to distingish old and new +/// CompressedScanData for iv_version being 0x34. In the very unlikely case +/// that we would have that many versions of ComprossedScanData, it is +/// strongly suggested to simply skip 0x34 as version number. /// -/// 8:11 - This 32-bit value is reserved to the compression -/// algorithm. Typically this field is used to record the 'size' of the -/// compressed string in units specific to each algorithm. -/// -/// 12:15 - The length of the original scan chain in \e bits. -/// -/// 16:23 - The 64 bit scan Region and type details +/// Bytes - Content /// +/// 0:1 - A 16-bit "magic number" that identifies and validates the +/// compression algorithm used to compress the data ("RS"). /// -/// 24:27 - The 32 high-order bits of the value written to the Scan Select -/// register to set up the scan. The Scan Select register only defines these -/// bits. (Planned to use scan scom register value) +/// 2 - An 8-bit version number (3 for the time being). /// -/// 28 - The Scan Chain Data Structure version number +/// 3 - An 8-bit type field distinguishing different scan data types +/// (0 for non-CMSK, 1 for CMSK). /// -/// 29 - Flush-optimize : Is this byte is non-zero, the ring state to be -/// modified is the flush state of the ring. +/// 4:5 - The 16-bit size of the uncompressed scan data with +/// this header in \e bytes. This is not the exact length of actual scan data +/// in bits, but the number of bytes used by the RS4 encoding to store those +/// compressed scan bits. /// -/// 30 - The ring ID uniquely identifying the repair ring name. +/// 6:7 - The 16-bit ring ID uniquely identifying the ring. /// -/// 31 - The 7-bit pervasive chiplet Id + Multicast bit of the chiplet to -/// scan. This value is loaded directly into P0. The decompression -/// algorithms provide two entry points - one that uses this value as the -/// chiplet Id, and another that allows the caller to specify the chiplet Id -/// in the call. - +/// 8:11 - scan scom register value typedef struct { - - /// Magic number - See \ref scan_compression_magic - uint32_t iv_magic; - - /// Total size in bytes, including the container header - uint32_t iv_size; - - /// Reserved to the algorithm - uint32_t iv_algorithmReserved; - - /// Length of the original scan chain in bits - uint32_t iv_length; - - /// 64 bit scan select register value - uint64_t iv_scanSelect; - - /// Data structure (header) version - uint8_t iv_headerVersion; - - /// Flush-state optimization - /// - /// Normally, modifying the state of the ring requires XOR-ing the - /// difference state (the compressed state) with the current ring state as - /// it will appear in the Scan Data Register. If the current state of the - /// ring is the scan-0 flush state, then by definition the Scan Data - /// Register is always 0. Therefore we can simply write the difference to - /// the Scan Data Register rather than using a read-XOR-write. - uint8_t iv_flushOptimization; - - /// Ring ID uniquely identifying the repair name. (See the list of ring - /// name vs ring IDs in p8_ring_identification.c). - uint8_t iv_ringId; - - /// 7-bit pervasive chiplet Id + Multicast bit - /// - /// This field is right-justified in an 8-byte aligned doubleword so that - /// the P0 register can be directly updated from the doubelword value in a - /// data register. - uint8_t iv_chipletId; - + uint16_t iv_magic; + uint8_t iv_version; + uint8_t iv_type; + uint16_t iv_size; + uint16_t iv_ringId; + uint32_t iv_scanAddr; } CompressedScanData; - /// Endian-translate a CompressedScanData structure /// /// \param o_data A pointer to a CompressedScanData structure to receive the @@ -141,17 +98,14 @@ compressed_scan_data_translate(CompressedScanData* o_data, /// Compress a scan string using the RS4 compression algorithm /// -/// \param[in,out] io_data This is a pointer to a memory area which must be -/// large enough to hold the worst-case result of compressing \a i_string (see -/// below). Note that the CompressedScanData is always created in big-endian -/// format, however the caller can use compresed_scan_data_translate() to -/// create a copy of the header in host format. -/// -/// \param[in] i_dataSize The size of \a io_data in bytes. +/// \param[in,out] io_rs4 This is a pointer to a memory area which must be +/// large enough to hold the worst-case result of compressing \a i_data_str +/// and \a i_care_str (see below). Note that the CompressedScanData is +/// always created in big-endian format, however the caller can use +/// compresed_scan_data_translate() to create a copy of the header in +/// host format. /// -/// \param[out] o_imageSize The effective size of the entire compressed scan -/// data structure (header + compressed data) created in \a io_data, in bytes. -/// This value will always be a multiple of 8. +/// \param[in] i_size The size of the buffer pointed to by \a io_rs4. /// /// \param[in] i_data_str The string to compress. Scan data to compress is /// left-justified in this input string. @@ -162,61 +116,42 @@ compressed_scan_data_translate(CompressedScanData* o_data, /// \param[in] i_length The length of the input string in \e bits. It is /// assumed the \a i_string contains at least (\a i_length + 7) / 8 bytes. /// -/// \param[in] i_scanSelect The 64-bit value written to the Scan Select -/// register to set up for the scan. +/// \param[in] i_scanAddr The 32-bit scan address. /// /// \param[in] i_ringId The ring ID that uniquely identifies the ring name of -/// a repair ring. (See p8_ring_identification.c for more info.) -/// -/// \param[in] i_chipletId The 7-bit value for the iv_chipletId field of the -/// CompressedScanData. -/// -/// \param[in] i_flushOptimization This input parameter should be set to a -/// non-0 value if it is known that this ring difference will be applied to a -/// scan-0 flush state. This will improve the performance of the -/// decompress-scan routine. If the initial state of the ring is unknown, set -/// this parameter to 0. +/// a repair ring. (See p9_ring_id.h for more info.) /// /// This API is required for integration with PHYP which does not support /// malloc(). Applications in environments supporting malloc() can use /// rs4_compress() instead. /// -/// The worst-case compression for RS4 requires 2 nibbles of control overhead -/// per 15 nibbles of data (17/15), plus a maximum of 2 nibbles of termination. -/// We always require this worst-case amount of memory including the header and +/// We always require the worst-case amount of memory including the header and /// any rounding required to guarantee that the data size is a multiple of 8 /// bytes. The final image size is also rounded up to a multiple of 8 bytes. -/// If the \a i_dataSize is less than this amount (based on \a i_length) the +/// If the \a io_size is less than this amount (based on \a i_length) the /// call will fail. /// /// \returns See \ref scan_compression_codes int -_rs4_compress(CompressedScanData* io_data, - uint32_t i_dataSize, - uint32_t* o_imageSize, +_rs4_compress(CompressedScanData* io_rs4, + const uint32_t i_size, const uint8_t* i_data_str, const uint8_t* i_care_str, const uint32_t i_length, - const uint64_t i_scanSelect, - const uint8_t i_ringId, - const uint8_t i_chipletId, - const uint8_t i_flushOptimization); + const uint32_t i_scanAddr, + const uint16_t i_ringId); /// Compress a scan string using the RS4 compression algorithm /// -/// \param[out] o_data This algorithm uses malloc() to allocate memory for the -/// compresed data, and returns a pointer to this memory in \a o_data. After +/// \param[out] o_rs4 This algorithm uses malloc() to allocate memory for the +/// compressed data, and returns a pointer to this memory in \a o_rs4. After /// the call this memory is owned by the caller who is responsible for /// free()-ing the data area once it is no longer required. Note that the /// CompressedScanData is always created in big-endian format, however the /// caller can use compresed_scan_data_translate() to create a copy of the /// header in host format. /// -/// \param[out] o_size The effective size of the entire compressed scan data -/// structure (header + compressed data) pointed to by \a o_data, in bytes. -/// This value will always be a multiple of 8. -/// /// \param[in] i_data_str The string to compress. Scan data to compress is /// left-justified in this input string. /// @@ -226,33 +161,19 @@ _rs4_compress(CompressedScanData* io_data, /// \param[in] i_length The length of the input string in \e bits. It is /// assumed the \a i_string contains at least (\a i_length + 7) / 8 bytes. /// -/// \param[in] i_scanSelect The 64-bit value written to the Scan Select -/// register to set up for the scan. Only the 32 high-order bits are actually -/// stored. +/// \param[in] i_scanAddr The 32-bit scan address. /// /// \param[in] i_ringId The ring ID that uniquely identifies the ring name of -/// a repair ring. (See p8_ring_identification.c for more info.) -/// -/// \param[in] i_chipletId The 7-bit value for the iv_chipletId field of the -/// CompressedScanData. -/// -/// \param[in] i_flushOptimization This input parameter should be set to a -/// non-0 value if it is known that this ring difference will be applied to a -/// scan-0 flush state. This will improve the performance of the -/// decompress-scan routine. If the initial state of the ring is unknown, set -/// this parameter to 0. +/// a repair ring. (See p9_ring_id.c for more info.) /// /// \returns See \ref scan_compression_codes int -rs4_compress(CompressedScanData** o_data, - uint32_t* o_size, +rs4_compress(CompressedScanData** o_rs4, const uint8_t* i_data_str, const uint8_t* i_care_str, const uint32_t i_length, - const uint64_t i_scanSelect, - const uint8_t i_ringId, - const uint8_t i_chipletId, - const uint8_t i_flushOptimization); + const uint32_t i_scanAddr, + const uint8_t i_ringId); /// Decompress a scan string compressed using the RS4 compression algorithm @@ -267,8 +188,7 @@ rs4_compress(CompressedScanData** o_data, /// the decompressed care mask, which is the size of the original string in /// bits rounded up to the nearest byte. /// -/// \param[in] i_stringSize The size (in bytes) of \a io_data_str and -/// \a io_care_str. +/// \param[in] i_size The size in \e bytes of \a io_data_str and \a io_care_str. /// /// \param[out] o_length The length of the decompressed string in \e bits. /// @@ -283,7 +203,7 @@ rs4_compress(CompressedScanData** o_data, int _rs4_decompress(uint8_t* io_data_str, uint8_t* io_care_str, - uint32_t i_stringSize, + uint32_t i_size, uint32_t* o_length, const CompressedScanData* i_rs4); @@ -302,7 +222,7 @@ _rs4_decompress(uint8_t* io_data_str, /// in \e bits. The caller may assume that \a o_data_str and o_care_str each /// contain at least (\a o_length + 7) / 8 \e bytes. /// -/// \param[in] i_rs4 A pointer to the CompressedScanData header + data to be +/// \param[in] i_rs4 A pointer to the CompressedScanData header and data to be /// decompressed. /// /// \returns See \ref scan_compression_codes @@ -328,25 +248,30 @@ rs4_redundant(const CompressedScanData* i_data, int* o_redundant); #endif // __ASSEMBLER__ -/// The current version of the CompressedScanData structure -/// -/// This constant is required to be a #define to guarantee consistency between -/// the header format and cmopiled code. -#define COMPRESSED_SCAN_DATA_VERSION 2 - -/// The size of the CompressedScanData structure -#define COMPRESSED_SCAN_DATA_SIZE (uint8_t)24 - - /// \defgroup scan_compression_magic Scan Compression Magic Numbers -///// +/// /// @ { /// RS4 Magic -#define RS4_MAGIC (uint32_t)0x52533402 /* "RS4" + Version 0x02 */ +#define RS4_MAGIC 0x5253 /* "RS" */ /// @} +/// \defgroup scan_compression_version_type version and type accessors +/// +/// @{ + +/// The current version of the CompressedScanData structure +/// +/// This constant is required to be a #define to guarantee consistency between +/// the header format and compiled code. +#define RS4_VERSION 3 + +/// Scan data types +#define RS4_SCAN_DATA_TYPE_CMSK 1 +#define RS4_SCAN_DATA_TYPE_NON_CMSK 0 + +/// @} /// \defgroup scan_compression_codes Scan Compression Return Codes /// @@ -388,6 +313,9 @@ rs4_redundant(const CompressedScanData* i_data, int* o_redundant); /// Invalid transition in state machine #define SCAN_COMPRESSION_STATE_ERROR 6 +/// wrong compression version +#define SCAN_COMPRESSION_VERSION_ERROR 7 + /// @} #endif // __P9_SCAN_COMPRESSION_H__ diff --git a/src/import/chips/p9/utils/imageProcs/p9_tor.C b/src/import/chips/p9/utils/imageProcs/p9_tor.C index aa8ef343d..df60e7d02 100644 --- a/src/import/chips/p9/utils/imageProcs/p9_tor.C +++ b/src/import/chips/p9/utils/imageProcs/p9_tor.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ +/* Contributors Listed Below - COPYRIGHT 2016,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -39,6 +39,7 @@ #include "p9_ringId.H" #include "p9_tor.H" #include "p9_xip_image.h" +#include "p9_scan_compression.H" #include "p9_infrastruct_help.H" namespace P9_TOR @@ -65,50 +66,56 @@ const char* ringVariantName[] = { "BASE", // ////////////////////////////////////////////////////////////////////////////////// static -int get_ring_from_sbe_image ( void* i_ringSection, // Ring section ptr - uint64_t i_magic, // Image Magic Number - RingID i_ringId, // Ring ID - uint16_t i_ddLevel, // DD level - RingType_t& io_RingType, // Common, Instance - RingVariant_t i_RingVariant, // Base,CC, RL, Ovrd, Ovly - uint8_t& io_instanceId, // Instance ID - RingBlockType_t i_RingBlockType, // Single ring, Block - void** io_ringBlockPtr, // Output ring buffer - uint32_t& io_ringBlockSize, // Size of ring data - char* o_ringName, // Name of ring - uint32_t i_dbgl ) // Debug option +int get_ring_from_sbe_image( void* i_ringSection, // Ring section ptr + uint64_t i_magic, // Image Magic Number + RingID i_ringId, // Ring ID + uint16_t i_ddLevelOffset, // DD level offset (wrt i_ringSection) + RingType_t& io_RingType, // Common, Instance + RingVariant_t i_RingVariant, // Base,CC, RL, Ovrd, Ovly + uint8_t& io_instanceId, // Instance ID + RingBlockType_t i_RingBlockType, // Single ring, Block + void** io_ringBlockPtr, // Output ring buffer + uint32_t& io_ringBlockSize, // Size of ring data + char* o_ringName, // Name of ring + uint32_t i_dbgl ) // Debug option { - uint32_t acc_offset = 0; // Accumulating offset to next TOR offset slot - 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; // converting byte to word counter - uint32_t* deltaRingRS4_4B; - uint32_t sbe_offset = 0; + int rc = TOR_SUCCESS; RingVariantOrder* ring_variant_order = NULL; + uint32_t tor_slot_no = 0; // TOR slot number (within a TOR chiplet section) + uint16_t dd_level_offset; // Local DD level offset, if any (wrt i_ringSection) + uint32_t acc_offset = 0; // Accumulating offset to next TOR offset + uint32_t ppe_offset = 0; // Local offset to where SBE PPE section starts + uint32_t cplt_offset = 0; // Local offset to where SBE chiplet section starts + uint16_t ring_offset = 0; // Local offset to where SBE ring container/block starts + uint32_t ring_size = 0; // Size of whole ring container/block. if (i_magic == P9_XIP_MAGIC_HW) { - sbe_offset = *((uint32_t*)i_ringSection + temp); //DD level offset index - temp = htobe32(sbe_offset); + dd_level_offset = i_ddLevelOffset; + ppe_offset = *(uint32_t*)((uint8_t*)i_ringSection + dd_level_offset); + ppe_offset = htobe32(ppe_offset); } else if (i_magic == P9_XIP_MAGIC_SEEPROM) { - sbe_offset = 0; - i_ddLevel = 0; - temp = htobe32(sbe_offset); + ppe_offset = 0; + dd_level_offset = 0; + ppe_offset = htobe32(ppe_offset); + } + else + { + MY_ERR("Magic number i_magic=0x%016lX is not valid for SBE\n", (uintptr_t)i_magic); + return TOR_INVALID_MAGIC_NUMBER; } // Looper for each SBE chiplet - for(int l = 0; l < SBE_NOOF_CHIPLETS; l++) + for(int iCplt = 0; iCplt < SBE_NOOF_CHIPLETS; iCplt++) { GenRingIdList* ring_id_list_common = NULL; GenRingIdList* ring_id_list_instance = NULL; CHIPLET_DATA l_cpltData; uint8_t l_num_variant = 1; - switch (l) + switch (iCplt) { case PERV_CPLT : l_cpltData = PERV::g_pervData; @@ -206,7 +213,6 @@ int get_ring_from_sbe_image ( void* i_ringSection, // Ring section ring_variant_order = (RingVariantOrder*) PCI0::RING_VARIANT_ORDER; break; - case PCI1_CPLT : l_cpltData = PCI1::g_pci1Data; l_num_variant = (uint8_t)sizeof(PCI1::RingVariants) / sizeof(uint16_t); @@ -240,7 +246,7 @@ int get_ring_from_sbe_image ( void* i_ringSection, // Ring section break; default : - MY_ERR("Chiplet=%d is not valid. \n", l); + MY_ERR("Chiplet=%d is not valid for SBE. \n", iCplt); return TOR_INVALID_CHIPLET; } @@ -253,43 +259,51 @@ int get_ring_from_sbe_image ( void* i_ringSection, // Ring section l_num_variant); } - uint32_t local = 0; + + // + // Sequentially walk the TOR slots within the chiplet's COMMON section + // + tor_slot_no = 0; for (uint8_t i = 0; i < l_cpltData.iv_num_common_rings ; i++) { - for (uint8_t j = 0; j < l_num_variant ; j++) + for (uint8_t iVariant = 0; iVariant < l_num_variant ; iVariant++) { if (i_dbgl > 2) { - MY_INF(" Ring name %s Cplt Common ring id %d Variant id %d", - (ring_id_list_common + i)->ringName, i, j); + MY_INF(" Ring %s Cplt common ring id %d Variant id %d\n", + (ring_id_list_common + i)->ringName, i, iVariant); } if ((strcmp( (ring_id_list_common + i)->ringName, RING_PROPERTIES[i_ringId].iv_name) == 0) - && ( i_RingVariant == ring_variant_order->variant[j] + && ( i_RingVariant == ring_variant_order->variant[iVariant] || (i_RingVariant == OVERRIDE && i_magic == P9_XIP_MAGIC_SEEPROM))) { strcpy(o_ringName, RING_PROPERTIES[i_ringId].iv_name); - uint32_t var = l * sizeof(TorPpeBlock_t) + i_ddLevel + temp; - int temp1 = var / sizeof(uint32_t); - ring_offset = *((uint32_t*)i_ringSection + temp1); - ring_offset = htobe32(ring_offset); - var = ring_offset + i_ddLevel + temp; - temp1 = var / sizeof(uint16_t) + local; - chiplet_offset = *((uint16_t*)i_ringSection + temp1); - chiplet_offset = htobe16(chiplet_offset); + + acc_offset = dd_level_offset + ppe_offset + iCplt * sizeof(TorPpeBlock_t); + cplt_offset = *(uint32_t*)( (uint8_t*)i_ringSection + + acc_offset ); + cplt_offset = htobe32(cplt_offset); + + acc_offset = dd_level_offset + ppe_offset + cplt_offset; + ring_offset = *(uint16_t*)( (uint8_t*)i_ringSection + + acc_offset + + tor_slot_no * sizeof(ring_offset) ); + ring_offset = htobe16(ring_offset); if (i_RingBlockType == GET_SINGLE_RING) { - var = ring_offset + (chiplet_offset - sizeof(TorPpeBlock_t)) + i_ddLevel + temp; - temp1 = var / sizeof(uint32_t); - next_ring_offset = *((uint32_t*)i_ringSection + temp1); - next_ring_offset = htobe32(next_ring_offset); - ringSize = next_ring_offset; + acc_offset = dd_level_offset + + ppe_offset + + cplt_offset + + ring_offset; + ring_size = htobe16( ((CompressedScanData*) + ((uint8_t*)i_ringSection + acc_offset))->iv_size ); io_RingType = COMMON; - if (chiplet_offset) + if (ring_offset) { if (io_ringBlockSize == 0) { @@ -298,11 +312,11 @@ int get_ring_from_sbe_image ( void* i_ringSection, // Ring section MY_INF("\tio_ringBlockSize is zero. Returning required size.\n"); } - io_ringBlockSize = ringSize; + io_ringBlockSize = ring_size; return 0; } - if (io_ringBlockSize < ringSize) + if (io_ringBlockSize < ring_size) { MY_ERR("\tio_ringBlockSize is less than required size.\n"); return TOR_BUFFER_TOO_SMALL; @@ -310,119 +324,124 @@ int get_ring_from_sbe_image ( void* i_ringSection, // Ring section if (i_dbgl > 0) { - MY_INF(" ring container of %s is found in the SBE image container \n", - o_ringName); + MY_INF(" Ring %s found in the SBE section \n", o_ringName); } - memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + var, - (size_t)ringSize); + memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + acc_offset, + (size_t)ring_size); - io_ringBlockSize = ringSize; + io_ringBlockSize = ring_size; io_instanceId = (ring_id_list_common + i)->instanceIdMin; - - if (i_dbgl > 0) - { - MY_INF(" After get_ring_from_sbe_image Size %d \n", io_ringBlockSize); - } - - if (i_dbgl > 1) - { - MY_INF("Hex details 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); - MY_INF("Chiplet %d ChipletRing TOR offset %d %d %d Size %d %d \t\n", - i, ring_offset, chiplet_offset, next_ring_offset, ringSize, temp); - } - - if (i_dbgl > 2) - { - deltaRingRS4_4B = (uint32_t*)(*io_ringBlockPtr); - - for (uint32_t m = 0; m < ringSize / sizeof(uint32_t); m++) - { - MY_INF("compressed data %d --- %08x \t", m, htobe32(deltaRingRS4_4B[m])); - } - - MY_INF("\n"); - } - - return TOR_RING_FOUND; + rc = TOR_RING_FOUND; } else { if (i_dbgl > 0) { - MY_INF(" ring container of %s is not found in the SBE image container \n", - o_ringName); + MY_INF(" Ring %s not found in the SBE section \n", o_ringName); } - return TOR_RING_NOT_FOUND; + rc = TOR_RING_NOT_FOUND; } + + if (i_dbgl > 0) + { + MY_INF(" Hex details (SBE) for Chiplet #%d: \n" + " DD number section's offset to DD level section = 0x%08x \n" + " DD level section's offset to PpeType = 0x%08x \n" + " PpeType section's offset to chiplet = 0x%08x \n" + " Chiplet section's offset to RS4 header = 0x%08x \n" + " Full offset to RS4 header = 0x%08x \n" + " Ring size = 0x%08x \n", + i, dd_level_offset, ppe_offset, cplt_offset, ring_offset, acc_offset, ring_size); + } + + return rc; + } else if (i_RingBlockType == PUT_SINGLE_RING) { - if (chiplet_offset) + if (ring_offset) { MY_ERR("Ring container is already present in the SBE section \n"); return TOR_RING_AVAILABLE_IN_RINGSECTION; } - acc_offset = var; - io_ringBlockSize = acc_offset + (local * RING_OFFSET_SIZE); + // Special [mis]use of io_ringBlockPtr and io_ringBlockSize: + // Put location of chiplet's common section into ringBlockPtr memcpy( (uint8_t*)(*io_ringBlockPtr), &acc_offset, sizeof(acc_offset)); + // Put location of ring_offset slot into ringBlockSize + io_ringBlockSize = acc_offset + (tor_slot_no * sizeof(ring_offset)); return TOR_RING_FOUND; } + else + { + MY_ERR("Ring block type (i_RingBlockType=%d) is not supported for SBE \n", i_RingBlockType); + return TOR_INVALID_RING_BLOCK_TYPE; + } } - local++; + tor_slot_no++; // Next TOR slot } } - local = 0; - for(uint8_t i = (ring_id_list_instance + 0)->instanceIdMin; - i < (ring_id_list_instance + 0)->instanceIdMax + 1 ; i++) + // + // Sequentially walk the TOR slots within the chiplet's INSTANCE section + // + tor_slot_no = 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 < l_num_variant ; k++) + for (uint8_t iVariant = 0; iVariant < l_num_variant ; iVariant++) { if (i_dbgl > 2) { MY_INF(" Ring name %s Cplt instance ring id %d Variant id %d Instance id %d\n", - (ring_id_list_instance + j)->ringName, j, k, i); + (ring_id_list_instance + j)->ringName, j, iVariant, i); } - if (strcmp( (ring_id_list_instance + j)->ringName, - RING_PROPERTIES[i_ringId].iv_name) == 0) + 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) + && io_instanceId <= (ring_id_list_instance + 0)->instanceIdMax ) { - if ( i == io_instanceId && i_RingVariant == ring_variant_order->variant[k] ) + if (i == io_instanceId && i_RingVariant == ring_variant_order->variant[iVariant]) { strcpy(o_ringName, RING_PROPERTIES[i_ringId].iv_name); - uint32_t var = l * sizeof(TorPpeBlock_t) + i_ddLevel + temp + CPLT_OFFSET_SIZE; - int temp1 = var / sizeof(uint32_t); - ring_offset = *((uint32_t*)i_ringSection + temp1); - ring_offset = htobe32(ring_offset); - var = ring_offset + i_ddLevel + temp; - temp1 = var / sizeof(uint16_t) + local; - chiplet_offset = *((uint16_t*)i_ringSection + temp1); - chiplet_offset = htobe16(chiplet_offset); + + acc_offset = dd_level_offset + + ppe_offset + + iCplt * sizeof(TorPpeBlock_t) + + sizeof(cplt_offset); // Jump to instance offset + cplt_offset = *(uint32_t*)( (uint8_t*)i_ringSection + + acc_offset ); + cplt_offset = htobe32(cplt_offset); + + acc_offset = cplt_offset + dd_level_offset + ppe_offset; + ring_offset = *(uint16_t*)( (uint8_t*)i_ringSection + + acc_offset + + tor_slot_no * sizeof(ring_offset) ); + ring_offset = htobe16(ring_offset); if (i_RingBlockType == GET_SINGLE_RING) { - var = ring_offset + (chiplet_offset - sizeof(TorPpeBlock_t)) + i_ddLevel + temp; - temp1 = var / sizeof(uint32_t); - next_ring_offset = *((uint32_t*)i_ringSection + temp1); - next_ring_offset = htobe32(next_ring_offset); - ringSize = next_ring_offset; + acc_offset = dd_level_offset + + ppe_offset + + cplt_offset + + ring_offset; + ring_size = htobe16( ((CompressedScanData*) + ((uint8_t*)i_ringSection + + acc_offset))->iv_size ); io_RingType = INSTANCE; - if (chiplet_offset) + if (ring_offset) { if (io_ringBlockSize == 0) { @@ -431,11 +450,11 @@ int get_ring_from_sbe_image ( void* i_ringSection, // Ring section MY_INF("\tio_ringBlockSize is zero. Returning required size.\n"); } - io_ringBlockSize = ringSize; + io_ringBlockSize = ring_size; return 0; } - if (io_ringBlockSize < ringSize) + if (io_ringBlockSize < ring_size) { MY_ERR("\tio_ringBlockSize is less than required size.\n"); return TOR_BUFFER_TOO_SMALL; @@ -447,85 +466,83 @@ int get_ring_from_sbe_image ( void* i_ringSection, // Ring section o_ringName); } - memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + var, - (size_t)ringSize); + memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + acc_offset, + (size_t)ring_size); - io_ringBlockSize = ringSize; + io_ringBlockSize = ring_size; if (i_dbgl > 0) { MY_INF(" After get_ring_from_sbe_image Size %d \n", io_ringBlockSize); } - if (i_dbgl > 1) - { - MY_INF(" 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x \n", - var, temp, ring_offset, chiplet_offset, next_ring_offset, ringSize); - MY_INF("Chiplet %d ChipletRing TOR offset %d %d %d Size %d %d \t\n", - i, ring_offset, chiplet_offset, next_ring_offset, ringSize, temp); - } - - if (i_dbgl > 2) - { - deltaRingRS4_4B = (uint32_t*)(*io_ringBlockPtr); - - for (uint32_t m = 0; m < ringSize / sizeof(uint32_t); m++) - { - MY_INF("compressed data %d --- %08x \t", - m, htobe32(deltaRingRS4_4B[m])); - } - - MY_INF("\n"); - } - - return TOR_RING_FOUND; + rc = TOR_RING_FOUND; } else { if (i_dbgl > 0) { - MY_INF(" ring container of %s is not found in the SBE image container \n", - o_ringName); + MY_INF(" Ring %s not found in SBE section \n", o_ringName); } - return TOR_RING_NOT_FOUND; + rc = TOR_RING_NOT_FOUND; + } + + if (i_dbgl > 0) + { + MY_INF(" Hex details (SBE) for Chiplet #%d: \n" + " DD number section's offset to DD level section = 0x%08x \n" + " DD level section's offset to PpeType = 0x%08x \n" + " PpeType section's offset to chiplet = 0x%08x \n" + " Chiplet section's offset to RS4 header = 0x%08x \n" + " Full offset to RS4 header = 0x%08x \n" + " Ring size = 0x%08x \n", + i, dd_level_offset, ppe_offset, cplt_offset, ring_offset, acc_offset, ring_size); } + + return rc; } else if (i_RingBlockType == PUT_SINGLE_RING) { - if (chiplet_offset) + if (ring_offset) { MY_ERR("Ring container is already present in the SBE section \n"); return TOR_RING_AVAILABLE_IN_RINGSECTION; } - acc_offset = var; - io_ringBlockSize = acc_offset + (local * RING_OFFSET_SIZE); + // Special [mis]use of io_ringBlockPtr and io_ringBlockSize: + // Put location of chiplet's instance section into ringBlockPtr memcpy( (uint8_t*)(*io_ringBlockPtr), &acc_offset, sizeof(acc_offset)); + // Put location of ring_offset slot into ringBlockSize + io_ringBlockSize = acc_offset + (tor_slot_no * sizeof(ring_offset)); return TOR_RING_FOUND; } + else + { + MY_ERR("Ring block type (i_RingBlockType=%d) is not supported for SBE \n", i_RingBlockType); + return TOR_INVALID_RING_BLOCK_TYPE; + } } - } else { MY_ERR(" 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 TOR_INVALID_INSTANCE_ID; } } - local++; + tor_slot_no++; } - } - } - } + MY_ERR("i_ringId=0x%x is an invalid ring ID for SBE", i_ringId); + return TOR_INVALID_RING_ID; } // End of get_ring_from_sbe_image() @@ -541,7 +558,7 @@ static int get_ring_from_sgpe_image ( void* i_ringSection, // Ring section ptr uint64_t i_magic, // Image Magic Number RingID i_ringId, // Ring ID - uint16_t i_ddLevel, // DD level details + uint16_t i_ddLevelOffset, // DD level offset RingType_t& io_RingType, // Common, Instance RingVariant_t i_RingVariant, // Base,CC, RL, Ovrd, Ovly uint8_t& io_instanceId, // Instance ID @@ -554,10 +571,8 @@ int get_ring_from_sgpe_image ( void* i_ringSection, // Ring sectio uint32_t acc_offset = 0; // Accumulating offset to next TOR offset slot 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; // converting byte to word counter - uint32_t* deltaRingRS4_4B; + int temp = (i_ddLevelOffset >> 2) + 4; // converting byte to word counter uint32_t spge_offset = 0; if (i_magic == P9_XIP_MAGIC_HW) @@ -568,7 +583,7 @@ int get_ring_from_sgpe_image ( void* i_ringSection, // Ring sectio else if (i_magic == P9_XIP_MAGIC_SGPE) { spge_offset = 0; - i_ddLevel = 0; + i_ddLevelOffset = 0; temp = htobe32(spge_offset); } @@ -586,7 +601,7 @@ int get_ring_from_sgpe_image ( void* i_ringSection, // Ring sectio { if (i_dbgl > 2) { - MY_INF(" Ring name %s Cplt Common ring id %d Variant id %d", + MY_INF(" Ring %s Cplt common ring id %d Variant id %d\n", (ring_id_list_common + i)->ringName, i, j); } @@ -594,22 +609,21 @@ int get_ring_from_sgpe_image ( void* i_ringSection, // Ring sectio RING_PROPERTIES[i_ringId].iv_name) == 0) && ( i_RingVariant == j )) { strcpy(o_ringName, RING_PROPERTIES[i_ringId].iv_name); - uint32_t var = 0 + i_ddLevel + temp; + uint32_t var = 0 + i_ddLevelOffset + temp; int temp1 = var / sizeof(uint32_t); ring_offset = *((uint32_t*)i_ringSection + temp1); ring_offset = htobe32(ring_offset); - var = ring_offset + i_ddLevel + temp; + var = ring_offset + i_ddLevelOffset + temp; temp1 = var / sizeof(uint16_t) + local; chiplet_offset = *((uint16_t*)i_ringSection + temp1); chiplet_offset = htobe16(chiplet_offset); if (i_RingBlockType == GET_SINGLE_RING) { - var = ring_offset + (chiplet_offset - sizeof(TorPpeBlock_t)) + i_ddLevel + temp; - temp1 = var / sizeof(uint32_t); - next_ring_offset = *((uint32_t*)i_ringSection + temp1); - next_ring_offset = htobe32(next_ring_offset); - ringSize = next_ring_offset; + var = ring_offset + chiplet_offset + i_ddLevelOffset + temp; + ringSize = htobe16( ((CompressedScanData*) + ((uint8_t*)i_ringSection + + var))->iv_size ); io_RingType = COMMON; if (chiplet_offset) @@ -633,8 +647,7 @@ int get_ring_from_sgpe_image ( void* i_ringSection, // Ring sectio if (i_dbgl > 0) { - MY_INF(" ring container of %s is found in the SGPE image container && ring offset %d \n", - o_ringName, chiplet_offset); + MY_INF(" Ring %s found in the SGPE section \n", o_ringName); } memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + var, @@ -645,28 +658,9 @@ int get_ring_from_sgpe_image ( void* i_ringSection, // Ring sectio if (i_dbgl > 0) { - MY_INF(" After get_ring_from_sgpe_image Size %d \n", io_ringBlockSize); - } - - if (i_dbgl > 1) - { - MY_INF("Hex details 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); - MY_INF("Chiplet %d ChipletRing TOR offset %d %d %d Size %d %d \t\n", - i, ring_offset, chiplet_offset, next_ring_offset, ringSize, temp); - } - - if (i_dbgl > 2) - { - deltaRingRS4_4B = (uint32_t*)(*io_ringBlockPtr); - - for (uint32_t m = 0; m < ringSize / sizeof(uint32_t); m++) - { - MY_INF("compressed data %d --- %08x \t", m, htobe32(deltaRingRS4_4B[m])); - } - - MY_INF("\n"); + MY_INF(" Hex details (SGPE): Chiplet #%d offset 0x%08x local offset 0x%08x " \ + "ring offset 0x%08x start adr 0x%08x ringSize=0x%08x \n", + i, var, temp, ring_offset, chiplet_offset, ringSize); } return TOR_RING_FOUND; @@ -675,8 +669,7 @@ int get_ring_from_sgpe_image ( void* i_ringSection, // Ring sectio { if (i_dbgl > 0) { - MY_INF(" ring container of %s is not found in the SGPE image container \n", - o_ringName); + MY_INF(" Ring %s not found in the SGPE section \n", o_ringName); } return TOR_RING_NOT_FOUND; @@ -696,6 +689,11 @@ int get_ring_from_sgpe_image ( void* i_ringSection, // Ring sectio return TOR_RING_FOUND; } + else + { + MY_ERR("Ring block type (i_RingBlockType=%d) is not supported for SGPE \n", i_RingBlockType); + return TOR_INVALID_RING_BLOCK_TYPE; + } } local++; @@ -728,22 +726,21 @@ int get_ring_from_sgpe_image ( void* i_ringSection, // Ring sectio if ( i == io_instanceId && k == i_RingVariant ) { strcpy(o_ringName, RING_PROPERTIES[i_ringId].iv_name); - uint32_t var = CPLT_OFFSET_SIZE + i_ddLevel + temp; + uint32_t var = CPLT_OFFSET_SIZE + i_ddLevelOffset + temp; int temp1 = var / sizeof(uint32_t); ring_offset = *((uint32_t*)i_ringSection + temp1); ring_offset = htobe32(ring_offset); - var = ring_offset + i_ddLevel + temp; + var = ring_offset + i_ddLevelOffset + temp; temp1 = var / sizeof(uint16_t) + local; chiplet_offset = *((uint16_t*)i_ringSection + temp1); chiplet_offset = htobe16(chiplet_offset); if (i_RingBlockType == GET_SINGLE_RING) { - var = ring_offset + (chiplet_offset - sizeof(TorPpeBlock_t)) + i_ddLevel + temp; - temp1 = var / sizeof(uint32_t); - next_ring_offset = *((uint32_t*)i_ringSection + temp1); - next_ring_offset = htobe32(next_ring_offset); - ringSize = next_ring_offset; + var = ring_offset + chiplet_offset + i_ddLevelOffset + temp; + ringSize = htobe16( ((CompressedScanData*) + ((uint8_t*)i_ringSection + + var))->iv_size ); io_RingType = INSTANCE; if (chiplet_offset) @@ -781,24 +778,11 @@ int get_ring_from_sgpe_image ( void* i_ringSection, // Ring sectio MY_INF(" After get_ring_from_sgpe_image Size %d \n", io_ringBlockSize); } - if (i_dbgl > 1) - { - MY_INF(" 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x \n", - var, temp, ring_offset, chiplet_offset, next_ring_offset, ringSize); - MY_INF("Chiplet %d ChipletRing TOR offset %d %d %d Size %d %d \t\n", - i, ring_offset, chiplet_offset, next_ring_offset, ringSize, temp); - } - - if (i_dbgl > 2) + if (i_dbgl > 0) { - deltaRingRS4_4B = (uint32_t*)(*io_ringBlockPtr); - - for (uint32_t m = 0; m < ringSize / sizeof(uint32_t); m++) - { - MY_INF("compressed data %d --- %08x \t", m, htobe32(deltaRingRS4_4B[m])); - } - - MY_INF("\n"); + MY_INF(" Hex details (SGPE): Chiplet #%d offset 0x%08x local offset 0x%08x " \ + "ring offset 0x%08x start adr 0x%08x ringSize=0x%08x \n", + i, var, temp, ring_offset, chiplet_offset, ringSize); } return TOR_RING_FOUND; @@ -828,6 +812,11 @@ int get_ring_from_sgpe_image ( void* i_ringSection, // Ring sectio return TOR_RING_FOUND; } + else + { + MY_ERR("Ring block type (i_RingBlockType=%d) is not supported for SGPE \n", i_RingBlockType); + return TOR_INVALID_RING_BLOCK_TYPE; + } } } else @@ -859,7 +848,7 @@ static int get_ring_from_cme_image ( void* i_ringSection, // Ring section ptr uint64_t i_magic, // Image Magic Number RingID i_ringId, // Ring ID - uint16_t i_ddLevel, // DD level + uint16_t i_ddLevelOffset, // DD level offset RingType_t& io_RingType, // Common, Instance RingVariant_t i_RingVariant, // Base,CC, RL, Ovrd, Ovly uint8_t& io_instanceId, // instance ID @@ -872,10 +861,8 @@ int get_ring_from_cme_image ( void* i_ringSection, // Ring section uint32_t acc_offset = 0; // Accumulating offset to next TOR offset slot 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; // converting byte to word counter - uint32_t* deltaRingRS4_4B; + int temp = (i_ddLevelOffset >> 2) + 2; // converting byte to word counter uint32_t cme_offset = 0; if (i_magic == P9_XIP_MAGIC_HW) @@ -886,7 +873,7 @@ int get_ring_from_cme_image ( void* i_ringSection, // Ring section else if (i_magic == P9_XIP_MAGIC_CME) { cme_offset = 0; - i_ddLevel = 0; + i_ddLevelOffset = 0; temp = htobe32(cme_offset); } @@ -904,7 +891,7 @@ int get_ring_from_cme_image ( void* i_ringSection, // Ring section { if (i_dbgl > 2) { - MY_INF(" Ring name %s Cplt Common ring id %d Variant id %d", + MY_INF(" Ring %s Cplt common ring id %d Variant id %d\n", (ring_id_list_common + i)->ringName, i, j); } @@ -912,22 +899,21 @@ int get_ring_from_cme_image ( void* i_ringSection, // Ring section RING_PROPERTIES[i_ringId].iv_name) == 0) && ( i_RingVariant == j )) { strcpy(o_ringName, RING_PROPERTIES[i_ringId].iv_name); - uint32_t var = 0 + i_ddLevel + temp; + uint32_t var = 0 + i_ddLevelOffset + temp; int temp1 = var / sizeof(uint32_t); ring_offset = *((uint32_t*)i_ringSection + temp1); ring_offset = htobe32(ring_offset); - var = ring_offset + i_ddLevel + temp; + var = ring_offset + i_ddLevelOffset + temp; temp1 = var / sizeof(uint16_t) + local; chiplet_offset = *((uint16_t*)i_ringSection + temp1); chiplet_offset = htobe16(chiplet_offset); if (i_RingBlockType == GET_SINGLE_RING) { - var = ring_offset + (chiplet_offset - sizeof(TorPpeBlock_t)) + i_ddLevel + temp; - temp1 = var / sizeof(uint32_t); - next_ring_offset = *((uint32_t*)i_ringSection + temp1); - next_ring_offset = htobe32(next_ring_offset); - ringSize = next_ring_offset; + var = ring_offset + chiplet_offset + i_ddLevelOffset + temp; + ringSize = htobe16( ((CompressedScanData*) + ((uint8_t*)i_ringSection + + var))->iv_size ); io_RingType = COMMON; if (chiplet_offset) @@ -951,8 +937,7 @@ int get_ring_from_cme_image ( void* i_ringSection, // Ring section if (i_dbgl > 0) { - MY_INF(" ring container of %s is found in the CME image container \n", - o_ringName); + MY_INF(" Ring %s found in the CME section \n", o_ringName); } memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + var, @@ -963,28 +948,9 @@ int get_ring_from_cme_image ( void* i_ringSection, // Ring section if (i_dbgl > 0) { - MY_INF(" After get_ring_from_cme_image Size %d \n", io_ringBlockSize); - } - - if (i_dbgl > 1) - { - MY_INF("Hex details 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); - MY_INF("Chiplet %d ChipletRing TOR offset %d %d %d Size %d %d \t\n", - i, ring_offset, chiplet_offset, next_ring_offset, ringSize, temp); - } - - if (i_dbgl > 2) - { - deltaRingRS4_4B = (uint32_t*)(*io_ringBlockPtr); - - for (uint32_t m = 0; m < ringSize / sizeof(uint32_t); m++) - { - MY_INF("compressed data %d --- %08x \t", m, htobe32(deltaRingRS4_4B[m])); - } - - MY_INF("\n"); + MY_INF(" Hex details (CME): Chiplet #%d offset 0x%08x local offset 0x%08x " \ + "ring offset 0x%08x start adr 0x%08x ringSize=0x%08x \n", + i, var, temp, ring_offset, chiplet_offset, ringSize); } return TOR_RING_FOUND; @@ -993,8 +959,7 @@ int get_ring_from_cme_image ( void* i_ringSection, // Ring section { if (i_dbgl > 0) { - MY_INF(" ring container of %s is not found in the CME image container \n", - o_ringName); + MY_INF(" Ring %s not found in the CME section \n", o_ringName); } return TOR_RING_NOT_FOUND; @@ -1014,6 +979,11 @@ int get_ring_from_cme_image ( void* i_ringSection, // Ring section return TOR_RING_FOUND; } + else + { + MY_ERR("Ring block type (i_RingBlockType=%d) is not supported for CME \n", i_RingBlockType); + return TOR_INVALID_RING_BLOCK_TYPE; + } } local++; @@ -1049,22 +1019,21 @@ int get_ring_from_cme_image ( void* i_ringSection, // Ring section if ( i == io_instanceId && k == i_RingVariant ) { strcpy(o_ringName, RING_PROPERTIES[i_ringId].iv_name); - uint32_t var = z * CPLT_OFFSET_SIZE + i_ddLevel + temp + CPLT_OFFSET_SIZE; + uint32_t var = z * CPLT_OFFSET_SIZE + i_ddLevelOffset + temp + CPLT_OFFSET_SIZE; int temp1 = var / CPLT_OFFSET_SIZE; ring_offset = *((uint32_t*)i_ringSection + temp1); ring_offset = htobe32(ring_offset); - var = ring_offset + i_ddLevel + temp; + var = ring_offset + i_ddLevelOffset + temp; temp1 = var / sizeof(uint16_t) + local; chiplet_offset = *((uint16_t*)i_ringSection + temp1); chiplet_offset = htobe16(chiplet_offset); if (i_RingBlockType == GET_SINGLE_RING) { - var = ring_offset + (chiplet_offset - sizeof(TorPpeBlock_t)) + i_ddLevel + temp; - temp1 = var / sizeof(uint32_t); - next_ring_offset = *((uint32_t*)i_ringSection + temp1); - next_ring_offset = htobe32(next_ring_offset); - ringSize = next_ring_offset; + var = ring_offset + chiplet_offset + i_ddLevelOffset + temp; + ringSize = htobe16( ((CompressedScanData*) + ((uint8_t*)i_ringSection + + var))->iv_size ); io_RingType = INSTANCE; if (chiplet_offset) @@ -1088,10 +1057,9 @@ int get_ring_from_cme_image ( void* i_ringSection, // Ring section if (i_dbgl > 0) { - MY_INF(" ring container of %s is found in the CME image container %d %d \n", - o_ringName, chiplet_offset, ringSize); - MY_INF(" 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x \n", - var, temp, ring_offset, chiplet_offset, next_ring_offset, ringSize); + MY_INF(" Hex details (CME): Chiplet #%d offset 0x%08x local offset 0x%08x " \ + "ring offset 0x%08x start adr 0x%08x ringSize=0x%08x \n", + i, var, temp, ring_offset, chiplet_offset, ringSize); } memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + var, @@ -1106,22 +1074,10 @@ int get_ring_from_cme_image ( void* i_ringSection, // Ring section if (i_dbgl > 1) { - MY_INF(" 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x \n", - var, temp, ring_offset, chiplet_offset, next_ring_offset, ringSize); - MY_INF("Chiplet %d ChipletRing TOR offset %d %d %d Size %d %d \t\n", - i, ring_offset, chiplet_offset, next_ring_offset, ringSize, temp); - } - - if (i_dbgl > 2) - { - deltaRingRS4_4B = (uint32_t*)(*io_ringBlockPtr); - - for (uint32_t m = 0; m < ringSize / sizeof(uint32_t); m++) - { - MY_INF("compressed data %d --- %08x \t", m, htobe32(deltaRingRS4_4B[m])); - } - - MY_INF("\n"); + MY_INF(" 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x \n", + var, temp, ring_offset, chiplet_offset, ringSize); + MY_INF("Chiplet %d ChipletRing TOR offset %d %d Size %d %d \t\n", + i, ring_offset, chiplet_offset, ringSize, temp); } return TOR_RING_FOUND; @@ -1151,6 +1107,11 @@ int get_ring_from_cme_image ( void* i_ringSection, // Ring section return TOR_RING_FOUND; } + else + { + MY_ERR("Ring block type (i_RingBlockType=%d) is not supported for CME \n", i_RingBlockType); + return TOR_INVALID_RING_BLOCK_TYPE; + } } } else @@ -1236,7 +1197,7 @@ int tor_access_ring( void* i_ringSection, // Ring section ptr if (i_dbgl > 1) { - MY_INF( "tor_access_ring(): DD level offset: 0x%08x DD level: 0x%x \n", + MY_INF( "tor_access_ring(): Local DD level offset: 0x%08x for DD level: 0x%x \n", ddLevelOffset, ddLevel ); } @@ -1915,41 +1876,11 @@ int tor_access_ring( void* i_ringSection, // Ring section ptr o_ringName, i_dbgl); - if (rc == TOR_RING_NOT_FOUND) - { - if (i_dbgl > 0) - { - MY_INF("\t After SBE single ring call, %s ring container is not found \n", - RING_PROPERTIES[i_ringId].iv_name); - } - - return rc; - } - else if (rc == TOR_INVALID_INSTANCE_ID) - { - if (i_dbgl > 0) - { - MY_INF("\t After SBE single ring call, Instance %d is invalid \n", - io_instanceId ); - } - - return rc; - } - else if (rc == TOR_RING_AVAILABLE_IN_RINGSECTION) - { - if (i_dbgl > 0) - { - MY_INF("\t After SBE single ring call, Ring container is available in the image \n"); - } - - return rc; - } - else if (rc == TOR_INVALID_RING_ID) + if (rc) { if (i_dbgl > 0) { - MY_INF("\t After SBE single ring call, There is no TOR slot for %s %d\n", - RING_PROPERTIES[i_ringId].iv_name, i_ringId); + MY_ERR("get_ring_from_sbe_image failed w/rc=%d\n", rc); } return rc; @@ -2271,7 +2202,8 @@ int tor_get_block_of_rings ( void* i_ringSection, // Ring section // /////////////////////////////////////////////////////////////////////////////////////// int tor_append_ring( void* i_ringSection, // Ring section ptr - uint32_t& io_ringSectionSize, // Max size of ring section buffer + uint32_t& io_ringSectionSize, // In: Exact size of ring section. + // Out: Updated size of ring section. void* i_ringBuffer, // Ring work buffer const uint32_t i_ringBufferSize, // Max size of ring work buffer RingID i_ringId, // Ring ID @@ -2284,12 +2216,12 @@ int tor_append_ring( void* i_ringSection, // Ring section ptr { uint32_t rc = 0; char i_ringName[25]; - uint32_t l_ringTypeBuf = 0; - uint32_t* l_ringTypeStart = &l_ringTypeBuf; + uint32_t l_buf = 0; + uint32_t* l_cpltSection = &l_buf; uint8_t l_instanceId = i_instanceId; RingType_t l_RingType = i_RingType; uint32_t l_ringBlockSize; - uint16_t l_ringOffsetAddr16; + uint16_t l_ringOffset16; uint64_t l_magic; uint32_t l_torOffsetSlot; @@ -2297,17 +2229,17 @@ int tor_append_ring( void* i_ringSection, // Ring section ptr { l_magic = P9_XIP_MAGIC_SEEPROM; } - else if (i_PpeType == CME ) // Assign i_magic variant as CME image + else if (i_PpeType == CME) // Assign i_magic variant as CME image { l_magic = P9_XIP_MAGIC_CME; } - else if (i_PpeType == SGPE ) // Assign i_magic variant as SGPE image + else if (i_PpeType == SGPE) // Assign i_magic variant as SGPE image { l_magic = P9_XIP_MAGIC_SGPE; } else { - MY_ERR("TOR_APPEND_RING(2): i_PpeType=%d is an unsupported PPE type\n", i_PpeType); + MY_ERR("PPE type (i_PpeType=%d) is not supported \n", i_PpeType); return TOR_AMBIGUOUS_API_PARMS; } @@ -2320,42 +2252,51 @@ int tor_append_ring( void* i_ringSection, // Ring section ptr i_RingVariant, l_instanceId, PUT_SINGLE_RING, - (void**)&l_ringTypeStart, // On return, contains absolute offset addr where RingType starts in TOR - l_torOffsetSlot, // On return, contains absolute offset addr where TOR offset slot is located + (void**)&l_cpltSection, // On return, contains offset (wrt ringSection) of + // chiplet section's common or instance section + l_torOffsetSlot, // On return, contains offset (wrt ringSection) of + // TOR offset slot i_ringName, i_dbgl); if (rc) { - MY_ERR("\tTOR_APPEND_RING(3): Failure on tor_access_ring function call ...\n"); + MY_ERR("tor_access_ring() failed w/rc=0x%x \n", rc); return rc; } if (i_dbgl > 1) { - MY_INF(" TOR_APPEND_RING(4): Ring offset address %d \n", - l_torOffsetSlot ); + MY_INF(" TOR offset slot for ring address %d \n", l_torOffsetSlot ); } - // Current ring offset address contains old rs4 image starting address. - // When tor_append_ring gets new RS4 ring data. It is appended at end of the - // .rings section and new ring pointer location is updated at ring offset address - l_ringOffsetAddr16 = (uint16_t)(*l_ringTypeStart); - l_ringOffsetAddr16 = io_ringSectionSize - l_ringOffsetAddr16; - l_ringOffsetAddr16 = htobe16(l_ringOffsetAddr16 + sizeof(RingLayout_t)); - memcpy( (uint8_t*)i_ringSection + l_torOffsetSlot, &l_ringOffsetAddr16, - sizeof(l_ringOffsetAddr16)); - - // Attaching RS4 image at end of the ring section - // reading first 4 byte of rs4_container which carries size of ring container - // memcpy appends rs4_container at end of the .rings section. - l_ringBlockSize = ((RingLayout_t*)i_rs4Container)->sizeOfThis; - l_ringBlockSize = htobe32(l_ringBlockSize); - memcpy( (uint8_t*)i_ringSection + io_ringSectionSize, (uint8_t*)i_rs4Container, - (size_t)l_ringBlockSize); + // Explanation to the following: + // tor_append_ring() appends a ring to the end of ringSection. The offset value to + // that ring is wrt the beginning of the chiplet's TOR section. Below we calculate + // the offset value and put it into the TOR slot. But first, check that the offset + // value can be contained within the 2B of the TOR slot. + if ( (io_ringSectionSize - *l_cpltSection) <= MAX_TOR_RING_OFFSET ) + { + l_ringOffset16 = htobe16(io_ringSectionSize - *l_cpltSection); + memcpy( (uint8_t*)i_ringSection + l_torOffsetSlot, + &l_ringOffset16, sizeof(l_ringOffset16) ); + } + else + { + MY_ERR("Code bug: TOR ring offset (=0x%x) exceeds MAX_TOR_RING_OFFSET (=0x%x)", + io_ringSectionSize - *l_cpltSection, MAX_TOR_RING_OFFSET); + return TOR_OFFSET_TOO_BIG; + } + + // Now append the ring to the end of ringSection. + l_ringBlockSize = htobe16( ((CompressedScanData*)i_rs4Container)->iv_size ); + memcpy( (uint8_t*)i_ringSection + io_ringSectionSize, + (uint8_t*)i_rs4Container, (size_t)l_ringBlockSize); + + // Update the ringSectionSize io_ringSectionSize += l_ringBlockSize; - return TOR_APPEND_RING_DONE; + return TOR_SUCCESS; } diff --git a/src/import/chips/p9/utils/imageProcs/p9_tor.H b/src/import/chips/p9/utils/imageProcs/p9_tor.H index 0ce738836..1dffba7ce 100644 --- a/src/import/chips/p9/utils/imageProcs/p9_tor.H +++ b/src/import/chips/p9/utils/imageProcs/p9_tor.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ +/* Contributors Listed Below - COPYRIGHT 2016,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -28,20 +28,15 @@ #include "p9_ring_id.h" #include "p9_ringId.H" +#define MAX_TOR_RING_OFFSET (256*256-1) // Max value of 2Byte uint + namespace P9_TOR { extern const char* ppeTypeName[]; extern const char* ringVariantName[]; -#define TOR_VERSION 1 - -typedef struct -{ - uint32_t sizeOfThis; - uint16_t sizeOfCmsk; - uint16_t sizeOfMeta; // Exact size of meta data. Arbitrary size. Not null terminated -} RingLayout_t; +#define TOR_VERSION 2 typedef struct { @@ -63,26 +58,28 @@ typedef struct typedef uint16_t TorRingOffset_t; // Ring offset value in TOR offset slot +#define TOR_SUCCESS 0 #define TOR_RING_FOUND 0 #define TOR_RING_BLOCKS_FOUND 0 -#define TOR_APPEND_RING_DONE 0 #define TOR_RING_NOT_FOUND 1 -#define TOR_INVALID_RING_ID 2 -#define TOR_AMBIGUOUS_API_PARMS 3 -#define TOR_SECTION_NOT_FOUND 4 -#define TOR_DD_LEVEL_NOT_FOUND 5 -#define TOR_OP_BUFFER_INVALID 6 -#define TOR_OP_BUFFER_SIZE_EXCEEDED 7 +#define TOR_AMBIGUOUS_API_PARMS 2 +#define TOR_SECTION_NOT_FOUND 3 +#define TOR_DD_LEVEL_NOT_FOUND 4 +#define TOR_OP_BUFFER_INVALID 5 +#define TOR_OP_BUFFER_SIZE_EXCEEDED 6 +#define TOR_INVALID_RING_ID 7 #define TOR_INVALID_INSTANCE_ID 8 #define TOR_INVALID_CHIPLET 9 -#define TOR_IMAGE_DOES_NOT_SUPPORT_CME 10 -#define TOR_IMAGE_DOES_NOT_SUPPORT_SGPE 11 -#define TOR_IMAGE_DOES_NOT_SUPPORT_DD_LEVEL 12 -#define TOR_IMAGE_DOES_NOT_SUPPORT_PPE_LEVEL 13 -#define TOR_RING_AVAILABLE_IN_RINGSECTION 14 // Ring is already present -#define TOR_BUFFER_TOO_SMALL 15 -#define TOR_TOO_MANY_DD_LEVELS 16 - +#define TOR_INVALID_RING_BLOCK_TYPE 10 +#define TOR_INVALID_MAGIC_NUMBER 11 +#define TOR_IMAGE_DOES_NOT_SUPPORT_CME 12 +#define TOR_IMAGE_DOES_NOT_SUPPORT_SGPE 13 +#define TOR_IMAGE_DOES_NOT_SUPPORT_DD_LEVEL 14 +#define TOR_IMAGE_DOES_NOT_SUPPORT_PPE_LEVEL 15 +#define TOR_RING_AVAILABLE_IN_RINGSECTION 16 // Ring is already present +#define TOR_BUFFER_TOO_SMALL 17 +#define TOR_TOO_MANY_DD_LEVELS 18 +#define TOR_OFFSET_TOO_BIG 19 // Different options to extract data using tor_access_ring API typedef enum RingBlockType @@ -387,8 +384,8 @@ int tor_get_block_of_rings ( void* i_ringSection, /// It contains details of p9 Ring which is used for scanning operation. /// TOR API supports SEEPROM image format. /// -/// \param[in/out] io_ringSectionSize A value to indicate actual size of -/// i_ringSection data passed in as input On return, updated size of section. +/// \param[in/out] io_ringSectionSize In: Exact size of i_ringSection. +/// Out: Updated size of i_ringSection. /// Note: Caller manages this buffer and must make sure the RS4 ring fits /// before making this call /// |