summaryrefslogtreecommitdiffstats
path: root/src/import/chips/p9/utils/imageProcs/p9_tor.C
diff options
context:
space:
mode:
authorClaus Michael Olsen <cmolsen@us.ibm.com>2017-04-05 05:16:51 -0500
committerSachin Gupta <sgupta2m@in.ibm.com>2017-12-04 22:37:05 -0500
commit871d02a4e2c66e7c0501812abd86a27009cc73e0 (patch)
tree65c6e1a17eb77bcf2ae63fc6bd0655327d9e1865 /src/import/chips/p9/utils/imageProcs/p9_tor.C
parentd77e05e938c7a6fdf71cdd00a8a88fe794d0cf37 (diff)
downloadtalos-sbe-871d02a4e2c66e7c0501812abd86a27009cc73e0.tar.gz
talos-sbe-871d02a4e2c66e7c0501812abd86a27009cc73e0.zip
Code restruct: TOR API
Key_Cronus_Test=XIP_REGRESS Code restructuring aiming at: - utilizing TOR magic header info - enforce a common approach for - extracting metadata for all image,chipType combinations - traversing images for all image,chipType combinations - shrinking code size by reusing common code segments - improve readability by - separating more clearly metadata extraction and image traversal - slight rearrange of certain code segments - remove leftover hardcoded assumptions about ring/TOR data and structs - variables appropriately renamed and now all using camel style Change-Id: I50ace8b2fdb340a97ce6d74ce545c5e1acd21c40 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/38863 Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com> Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Cronus HW CI <cronushw-ci+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: GIRISANKAR PAULRAJ <gpaulraj@in.ibm.com> Reviewed-by: Thi N. Tran <thi@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/43250 Reviewed-by: Hostboot Team <hostboot@us.ibm.com> Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Diffstat (limited to 'src/import/chips/p9/utils/imageProcs/p9_tor.C')
-rw-r--r--src/import/chips/p9/utils/imageProcs/p9_tor.C1689
1 files changed, 309 insertions, 1380 deletions
diff --git a/src/import/chips/p9/utils/imageProcs/p9_tor.C b/src/import/chips/p9/utils/imageProcs/p9_tor.C
index 33007852..ea454c0c 100644
--- a/src/import/chips/p9/utils/imageProcs/p9_tor.C
+++ b/src/import/chips/p9/utils/imageProcs/p9_tor.C
@@ -29,1080 +29,251 @@
#include <endian.h>
#endif
-// IMPORTANT notice on usage of io_RingType and io_instanceId arguments
-//
-// io_RingTyp
-// -------------
-// While using tor_access_ring API, it is used as pass by reference
-// While using tor_get_block_of_rings API, it is used as pass by value
-// io_instanceId
-// --------------
-// While using tor_access_ring API, it is used as pass by reference.
-// While using tor_tor_get_block_of_rings and tor_get_single_ring API,
-// it is used pass by value
-//
#include "p9_tor.H"
-namespace P9_RID
-{
-#include "p9_ringId.H"
-}
-namespace CEN_RID
-{
-#include "cen_ringId.H"
-}
#include "p9_scan_compression.H"
#include "p9_infrastruct_help.H"
-// These strings must adhere precisely to the enum of PpeType.
-const char* ppeTypeName[] = { "SBE",
- "CME",
- "SGPE"
- };
-
-// These strings must adhere precisely to the enum of RingVariant.
-const char* ringVariantName[] = { "BASE",
- "CC",
- "RL",
- "OVRD",
- "OVLY"
- };
-
-
///////////////////////////////////////////////////////////////////////////////////
//
-// GET RING FROM SBE IMAGE FUNCTION
+// GET RING FROM SECTION FUNCTION
//
//////////////////////////////////////////////////////////////////////////////////
static
-int get_ring_from_sbe_image( void* i_ringSection, // Ring section ptr
- RingId_t 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
+int get_ring_from_ring_section( void* i_ringSection, // Ring section ptr
+ RingId_t i_ringId, // Ring ID
+ RingVariant_t i_ringVariant, // Base,CC,RL (SBE,CME,SGPE only)
+ 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 rc = TOR_SUCCESS;
- uint32_t torMagic = 0xffffffff;
- ChipType_t chipType = INVALID_CHIP_TYPE;
- 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 ring section starts
- uint32_t ppe_cplt_offset = 0; // Local offset to where the pool of chiplets starts
- uint32_t cplt_offset = 0; // Local offset to where a specific 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.
- RingVariantOrder* ring_variant_order;
- GenRingIdList* ring_id_list_common;
- GenRingIdList* ring_id_list_instance;
- ChipletData_t* l_cpltData;
- uint8_t l_num_variant;
- ChipletType_t numChiplets = 0;
- const RingProperties_t* ringProperties;
-
- torMagic = be32toh( ((TorHeader_t*)i_ringSection)->magic );
- chipType = ((TorHeader_t*)i_ringSection)->chipType;
-
- // Calculate the offset (wrt start of ringSection) to the SBE PPE
- // ring section. This offset, ppe_offset, will point to the
- // TORB header of the SBE PPE ring section.
- if (torMagic == TOR_MAGIC_HW)
- {
- dd_level_offset = i_ddLevelOffset;
- ppe_offset = *(uint32_t*)((uint8_t*)i_ringSection + dd_level_offset);
- ppe_offset = be32toh(ppe_offset);
- numChiplets = P9_RID::SBE_NOOF_CHIPLETS;
- ringProperties = &P9_RID::RING_PROPERTIES[0];
- }
- else if (torMagic == TOR_MAGIC_SBE ||
- (torMagic == TOR_MAGIC_OVRD && (chipType == CT_P9N || chipType == CT_P9C)) ||
- torMagic == TOR_MAGIC_OVLY)
- {
- ppe_offset = 0;
- dd_level_offset = 0;
- numChiplets = P9_RID::SBE_NOOF_CHIPLETS;
- ringProperties = &P9_RID::RING_PROPERTIES[0];
- }
- else if (torMagic == TOR_MAGIC_CEN ||
- (torMagic == TOR_MAGIC_OVRD && chipType == CT_CEN))
- {
- ppe_offset = 0;
- dd_level_offset = 0;
- numChiplets = CEN_RID::CEN_NOOF_CHIPLETS;
- ringProperties = &CEN_RID::RING_PROPERTIES[0];
- }
- else
+ int rc = TOR_SUCCESS;
+ uint8_t iInst, iRing, iVariant;
+ TorHeader_t* torHeader;
+ uint32_t torMagic;
+ uint8_t chipType;
+ TorCpltBlock_t* cpltBlock;
+ TorCpltOffset_t cpltOffset; // Offset from ringSection to chiplet section
+ TorRingOffset_t ringOffset; // Offset to actual ring container
+ uint32_t torSlotNum; // TOR slot number (within a chiplet section)
+ uint32_t ringSize; // Size of whole ring container/block.
+ RingVariantOrder* ringVariantOrder;
+ RingId_t numRings;
+ GenRingIdList* ringIdListCommon;
+ GenRingIdList* ringIdListInstance;
+ GenRingIdList* ringIdList;
+ uint8_t bInstCase = 0;
+ ChipletData_t* cpltData;
+ uint8_t numVariants;
+ ChipletType_t numChiplets;
+ RingProperties_t* ringProps;
+
+ torHeader = (TorHeader_t*)i_ringSection;
+ torMagic = be32toh(torHeader->magic);
+ chipType = torHeader->chipType;
+
+ rc = ringid_get_noof_chiplets( chipType,
+ torMagic,
+ &numChiplets);
+
+ if (rc)
{
- MY_ERR("torMagic=0x%08x is not valid for SBE\n", torMagic);
- return TOR_INVALID_MAGIC_NUMBER;
+ MY_ERR("ringid_get_noof_chiplets() failed w/rc=0x%08x\n", rc);
+ return rc;
}
- // Calculate the offset (wrt start of ringSection) to where the
- // pool of chiplet offsets begins in the SBE PPE ring section,
- // which is right after the TORB header.
- ppe_cplt_offset = ppe_offset + sizeof(TorHeader_t);
-
- // Looper for each SBE chiplet
+ //
+ // Looper for each SBE chipleti
+ //
for (ChipletType_t iCplt = 0; iCplt < numChiplets; iCplt++)
{
- if (torMagic == TOR_MAGIC_CEN ||
- (torMagic == TOR_MAGIC_OVRD && chipType == CT_CEN))
- {
- CEN_RID::ringid_get_chiplet_properties(
- iCplt,
- &l_cpltData,
- &ring_id_list_common,
- &ring_id_list_instance,
- &ring_variant_order,
- &l_num_variant);
- }
- else
- {
- P9_RID::ringid_get_chiplet_properties(
- iCplt,
- &l_cpltData,
- &ring_id_list_common,
- &ring_id_list_instance,
- &ring_variant_order,
- &l_num_variant);
- }
-
- if (!ring_id_list_common && !ring_id_list_instance)
- {
- MY_ERR("Chiplet=%d is not valid for SBE. \n", iCplt);
- return TOR_INVALID_CHIPLET;
- }
+ rc = ringid_get_properties( chipType,
+ torMagic,
+ iCplt,
+ &cpltData,
+ &ringIdListCommon,
+ &ringIdListInstance,
+ &ringVariantOrder,
+ &ringProps,
+ &numVariants );
- l_num_variant = (torMagic == TOR_MAGIC_OVRD || torMagic == TOR_MAGIC_OVLY) ? 1 : l_num_variant;
-
- if (i_dbgl > 1)
+ if (rc)
{
- MY_INF(" No of CommonRing %d, No of InstanceRing %d, No of Variants %d \n",
- l_cpltData->iv_num_common_rings, l_cpltData->iv_num_instance_rings,
- l_num_variant);
+ MY_ERR("ringid_get_properties() failed w/rc=0x%08x\n", rc);
+ return rc;
}
-
//
- // Sequentially walk the TOR slots within the chiplet's COMMON section
+ // Sequentially traverse ring offset slots within a chiplet's CMN or INST section
//
- tor_slot_no = 0;
-
- for (uint8_t i = 0; i < l_cpltData->iv_num_common_rings ; i++)
+ for ( bInstCase = 0; bInstCase <= 1; bInstCase++ )
{
- for (uint8_t iVariant = 0; iVariant < l_num_variant ; iVariant++)
- {
- if (i_dbgl > 2)
- {
- 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,
- ringProperties[i_ringId].iv_name) == 0 ) &&
- ( i_RingVariant == ring_variant_order->variant[iVariant] ||
- torMagic == TOR_MAGIC_OVRD ||
- torMagic == TOR_MAGIC_OVLY ) )
- {
- strcpy(o_ringName, ringProperties[i_ringId].iv_name);
- acc_offset = dd_level_offset +
- ppe_cplt_offset +
- iCplt * sizeof(TorPpeBlock_t);
- cplt_offset = *(uint32_t*)( (uint8_t*)i_ringSection +
- acc_offset );
- cplt_offset = be32toh(cplt_offset);
- acc_offset = dd_level_offset + ppe_cplt_offset + cplt_offset;
- ring_offset = *(uint16_t*)( (uint8_t*)i_ringSection +
- acc_offset +
- tor_slot_no * sizeof(ring_offset) );
- ring_offset = be16toh(ring_offset);
-
- if (i_RingBlockType == GET_SINGLE_RING)
- {
- acc_offset = dd_level_offset +
- ppe_cplt_offset +
- cplt_offset +
- ring_offset;
- ring_size = be16toh( ((CompressedScanData*)
- ((uint8_t*)i_ringSection + acc_offset))->iv_size );
- io_RingType = COMMON_RING;
-
- if (ring_offset)
- {
- if (io_ringBlockSize == 0)
- {
- if (i_dbgl > 0)
- {
- MY_INF("\tio_ringBlockSize is zero. Returning required size.\n");
- }
-
- io_ringBlockSize = ring_size;
- return 0;
- }
-
- if (io_ringBlockSize < ring_size)
- {
- MY_ERR("\tio_ringBlockSize is less than required size.\n");
- return TOR_BUFFER_TOO_SMALL;
- }
+ numRings = bInstCase ? cpltData->iv_num_instance_rings : cpltData->iv_num_common_rings;
+ ringIdList = bInstCase ? ringIdListInstance : ringIdListCommon;
- if (i_dbgl > 0)
- {
- MY_INF(" Ring %s found in the SBE section \n", o_ringName);
- }
-
- memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + acc_offset,
- (size_t)ring_size);
-
- io_ringBlockSize = ring_size;
- io_instanceId = (ring_id_list_common + i)->instanceIdMin;
-
- rc = TOR_RING_FOUND;
- }
- else
- {
- if (i_dbgl > 0)
- {
- MY_INF(" Ring %s not found in the SBE section \n", o_ringName);
- }
-
- 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_cplt_offset, cplt_offset, ring_offset, acc_offset, ring_size);
- }
-
- return rc;
-
- }
- else if (i_RingBlockType == PUT_SINGLE_RING)
- {
- if (ring_offset)
- {
- MY_ERR("Ring container is already present in the SBE section \n");
- return TOR_RING_AVAILABLE_IN_RINGSECTION;
- }
-
- // 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;
- }
- }
-
- tor_slot_no++; // Next TOR slot
- }
- }
-
-
- //
- // Sequentially walk the TOR slots within the chiplet's INSTANCE section
- //
- if (ring_id_list_instance)
- {
-
- tor_slot_no = 0;
-
- for ( uint8_t i = (ring_id_list_instance + 0)->instanceIdMin;
- i < (ring_id_list_instance + 0)->instanceIdMax + 1 ; i++ )
+ if (ringIdList) // Only proceed if chiplet has [Common/Instance] rings.
{
- for (uint8_t j = 0; j < l_cpltData->iv_num_instance_rings; j++)
+ // Calc offset to chiplet's CMN or INST section, cpltOffset (steps 1-3)
+ //
+ // 1. Calc offset to TOR slot pointing to chiplet's COM or INST section
+ cpltOffset = sizeof(TorHeader_t) +
+ iCplt * sizeof(cpltBlock) +
+ bInstCase * sizeof(cpltBlock->cmnOffset);
+ // 2. Retrive offset, endian convert and make it relative to ring section origin
+ cpltOffset = *(uint32_t*)( (uint8_t*)i_ringSection + cpltOffset );
+ cpltOffset = be32toh(cpltOffset);
+ // 3. Make offset relative to ring section origin
+ cpltOffset = sizeof(TorHeader_t) + cpltOffset;
+
+ torSlotNum = 0;
+
+ for ( iInst = ringIdList->instanceIdMin;
+ iInst <= ringIdList->instanceIdMax;
+ iInst++ )
{
- for (uint8_t iVariant = 0; iVariant < l_num_variant ; iVariant++)
+ for ( iRing = 0; iRing < numRings; iRing++ )
{
- if (i_dbgl > 2)
+ for ( iVariant = 0; iVariant < numVariants; iVariant++ )
{
- MY_INF(" Ring name %s Cplt instance ring id %d Variant id %d Instance id %d\n",
- (ring_id_list_instance + j)->ringName, j, iVariant, i);
- }
-
- if (strcmp( (ring_id_list_instance + j)->ringName,
- ringProperties[i_ringId].iv_name) == 0)
- {
- if ( io_instanceId >= (ring_id_list_instance + 0)->instanceIdMin
- && io_instanceId <= (ring_id_list_instance + 0)->instanceIdMax )
+ if ( strcmp( (ringIdList + iRing)->ringName,
+ ringProps[i_ringId].iv_name ) == 0 &&
+ ( i_ringVariant == ringVariantOrder->variant[iVariant] ||
+ numVariants == 1 ) && // If no variants, ignore Variant
+ ( !bInstCase || ( bInstCase && iInst == io_instanceId) ) )
{
- if (i == io_instanceId && i_RingVariant == ring_variant_order->variant[iVariant])
- {
- strcpy(o_ringName, ringProperties[i_ringId].iv_name);
-
- acc_offset = dd_level_offset +
- ppe_cplt_offset +
- iCplt * sizeof(TorPpeBlock_t) +
- sizeof(cplt_offset); // Jump to instance offset
- cplt_offset = *(uint32_t*)( (uint8_t*)i_ringSection +
- acc_offset );
- cplt_offset = be32toh(cplt_offset);
-
- acc_offset = cplt_offset +
- dd_level_offset +
- ppe_cplt_offset;
- ring_offset = *(uint16_t*)( (uint8_t*)i_ringSection +
- acc_offset +
- tor_slot_no * sizeof(ring_offset) );
- ring_offset = be16toh(ring_offset);
-
- if (i_RingBlockType == GET_SINGLE_RING)
- {
- acc_offset = dd_level_offset +
- ppe_cplt_offset +
- cplt_offset +
- ring_offset;
- ring_size = be16toh( ((CompressedScanData*)
- ((uint8_t*)i_ringSection +
- acc_offset))->iv_size );
- io_RingType = INSTANCE_RING;
-
- if (ring_offset)
- {
- if (io_ringBlockSize == 0)
- {
- if (i_dbgl > 0)
- {
- MY_INF("\tio_ringBlockSize is zero. Returning required size.\n");
- }
+ strcpy(o_ringName, (ringIdList + iRing)->ringName);
- io_ringBlockSize = ring_size;
- return 0;
- }
+ // Calc offset to actual ring, ringOffset (steps 1-3)
+ //
+ // 1. Calc offset to TOR slot pointing to actual ring
+ ringOffset = cpltOffset + torSlotNum * sizeof(ringOffset);
+ // 2. Retrieve offset and endian convert
+ ringOffset = *(TorRingOffset_t*)( (uint8_t*)i_ringSection + ringOffset );
+ ringOffset = be16toh(ringOffset);
- if (io_ringBlockSize < ring_size)
- {
- MY_ERR("\tio_ringBlockSize is less than required size.\n");
- return TOR_BUFFER_TOO_SMALL;
- }
-
- if (i_dbgl > 0)
- {
- MY_INF(" ring container of %s is found in the SBE image container \n",
- o_ringName);
- }
-
- memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + acc_offset,
- (size_t)ring_size);
+ if (i_ringBlockType == GET_SINGLE_RING)
+ {
+ ringSize = 0;
- io_ringBlockSize = ring_size;
+ if (ringOffset)
+ {
+ // 3. Make offset relative to ring section origin
+ ringOffset = cpltOffset + ringOffset;
- if (i_dbgl > 0)
- {
- MY_INF(" After get_ring_from_sbe_image Size %d \n", io_ringBlockSize);
- }
+ ringSize = be16toh( ((CompressedScanData*)
+ ((uint8_t*)i_ringSection + ringOffset))->iv_size );
- rc = TOR_RING_FOUND;
- }
- else
+ if (io_ringBlockSize == 0)
{
if (i_dbgl > 0)
{
- MY_INF(" Ring %s not found in SBE section \n", o_ringName);
+ MY_DBG("io_ringBlockSize is zero. Returning required size.\n");
}
- rc = TOR_RING_NOT_FOUND;
+ io_ringBlockSize = ringSize;
+ return TOR_SUCCESS;
}
- if (i_dbgl > 0)
+ if (io_ringBlockSize < ringSize)
{
- 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_cplt_offset, cplt_offset, ring_offset, acc_offset, ring_size);
+ MY_ERR("io_ringBlockSize is less than required size.\n");
+ return TOR_BUFFER_TOO_SMALL;
}
- return rc;
- }
- else if (i_RingBlockType == PUT_SINGLE_RING)
- {
- if (ring_offset)
+ // Produce return parms
+ memcpy( *io_ringBlockPtr, (uint8_t*)i_ringSection + ringOffset, ringSize);
+ io_ringBlockSize = ringSize;
+ io_instanceId = (bInstCase) ? io_instanceId : (ringIdList + iRing)->instanceIdMin;
+
+ if (i_dbgl > 0)
{
- MY_ERR("Ring container is already present in the SBE section \n");
- return TOR_RING_AVAILABLE_IN_RINGSECTION;
+ MY_DBG("Found a ring:\n" \
+ " Name: %s\n" \
+ " Blocksize: %d\n",
+ o_ringName, io_ringBlockSize);
}
- // 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;
+ rc = TOR_SUCCESS;
}
else
{
- MY_ERR("Ring block type (i_RingBlockType=%d) is not supported for SBE \n", i_RingBlockType);
- return TOR_INVALID_RING_BLOCK_TYPE;
- }
- }
- }
- else
- {
- if (i_dbgl > 0)
- {
- MY_INF(" 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;
- }
- }
-
- tor_slot_no++;
- }
- }
- }
- } // if (ring_id_list_instance)
- }
-
- if (i_dbgl > 0)
- {
- MY_DBG("i_ringId=0x%x is an invalid ring ID for SBE\n", i_ringId);
- }
-
- return TOR_INVALID_RING_ID;
-
-} // End of get_ring_from_sbe_image()
-
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-//
-// GET RING FROM SGPE IMAGE FUNCTION
-//
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-static
-int get_ring_from_sgpe_image ( void* i_ringSection, // Ring section ptr
- RingId_t i_ringId, // Ring ID
- 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
- RingBlockType_t i_RingBlockType, // Single ring, Block
- void** io_ringBlockPtr, // Output ring data buffer
- uint32_t& io_ringBlockSize, // Size of ring data
- char* o_ringName, // Name of ring
- uint32_t i_dbgl ) // Debug option
-{
- uint32_t torMagic;
- uint32_t acc_offset = 0; // Accumulating offset to next TOR offset slot
- uint32_t ring_offset = 0;
- uint16_t chiplet_offset = 0;
- uint32_t ringSize = 0;
- int temp = (i_ddLevelOffset >> 2) + 4; // converting byte to word counter
- uint32_t spge_offset = 0;
- uint32_t ppe_cplt_offset = 0; // Local offset to where the pool of chiplets starts
-
- torMagic = be32toh( ((TorHeader_t*)i_ringSection)->magic );
-
- // Calculate the offset (wrt start of ringSection) to the SGPE PPE
- // ring section. This offset, inappropriately denoted "temp" here
- // but which needs to be renamed to "ppe_offset" asap, will point
- // to the TORG header of the SGPE PPE ring section.
- if (torMagic == TOR_MAGIC_HW)
- {
- spge_offset = *((uint32_t*)i_ringSection + temp); //DD level offset index
- temp = be32toh(spge_offset);
- }
- else if (torMagic == TOR_MAGIC_SGPE)
- {
- spge_offset = 0;
- i_ddLevelOffset = 0;
- temp = be32toh(spge_offset);
- }
- else
- {
- MY_ERR("torMagic=0x%08x is not valid for SGPE\n", torMagic);
- return TOR_INVALID_MAGIC_NUMBER;
- }
-
- // Calculate the offset (wrt start of ringSection) to where the
- // pool of chiplet offsets begins in the SGPE PPE ring section,
- // which is right after the TORG header.
- ppe_cplt_offset = temp + sizeof(TorHeader_t);
-
- GenRingIdList* ring_id_list_common = NULL;
- GenRingIdList* ring_id_list_instance = NULL;
- uint8_t l_num_variant = P9_RID::EQ::g_chipletData.iv_num_ring_variants;
- ring_id_list_common = (GenRingIdList*) P9_RID::EQ::RING_ID_LIST_COMMON;
- ring_id_list_instance = (GenRingIdList*) P9_RID::EQ::RING_ID_LIST_INSTANCE;
-
- uint32_t local = 0;
-
- for (uint8_t i = 0; i < P9_RID::EQ::g_chipletData.iv_num_common_rings ; i++)
- {
- for (uint8_t j = 0; j < l_num_variant ; j++)
- {
- if (i_dbgl > 2)
- {
- MY_INF(" Ring %s Cplt common ring id %d Variant id %d\n",
- (ring_id_list_common + i)->ringName, i, j);
- }
-
- if ((strcmp( (ring_id_list_common + i)->ringName,
- P9_RID::RING_PROPERTIES[i_ringId].iv_name) == 0) && ( i_RingVariant == j ))
- {
- strcpy(o_ringName, P9_RID::RING_PROPERTIES[i_ringId].iv_name);
- uint32_t var = 0 + i_ddLevelOffset + ppe_cplt_offset;
- int temp1 = var / sizeof(uint32_t);
- ring_offset = *((uint32_t*)i_ringSection + temp1);
- ring_offset = be32toh(ring_offset);
- var = ring_offset + i_ddLevelOffset + ppe_cplt_offset;
- temp1 = var / sizeof(uint16_t) + local;
- chiplet_offset = *((uint16_t*)i_ringSection + temp1);
- chiplet_offset = be16toh(chiplet_offset);
-
- if (i_RingBlockType == GET_SINGLE_RING)
- {
- var = ring_offset + chiplet_offset + i_ddLevelOffset + ppe_cplt_offset;
- ringSize = be16toh( ((CompressedScanData*)
- ((uint8_t*)i_ringSection +
- var))->iv_size );
- io_RingType = COMMON_RING;
-
- if (chiplet_offset)
- {
- if (io_ringBlockSize == 0)
- {
- if (i_dbgl > 0)
- {
- MY_INF("\tio_ringBlockSize is zero. Returning required size.\n");
- }
-
- io_ringBlockSize = ringSize;
- return 0;
- }
-
- if (io_ringBlockSize < ringSize)
- {
- MY_ERR("\tio_ringBlockSize is less than required size.\n");
- return TOR_BUFFER_TOO_SMALL;
- }
-
- if (i_dbgl > 0)
- {
- MY_INF(" Ring %s found in the SGPE section \n", o_ringName);
- }
-
- memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + var,
- (size_t)ringSize);
-
- io_ringBlockSize = ringSize;
- io_instanceId = (ring_id_list_common + i)->instanceIdMin;
-
- if (i_dbgl > 0)
- {
- 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, ppe_cplt_offset, ring_offset, chiplet_offset, ringSize);
- }
-
- return TOR_RING_FOUND;
- }
- else
- {
- if (i_dbgl > 0)
- {
- MY_INF(" Ring %s not found in the SGPE section \n", o_ringName);
- }
-
- return TOR_RING_NOT_FOUND;
- }
- }
- else if (i_RingBlockType == PUT_SINGLE_RING)
- {
- if (chiplet_offset)
- {
- MY_ERR("Ring container is already present in the SGPE section \n");
- return TOR_RING_AVAILABLE_IN_RINGSECTION;
- }
-
- acc_offset = var;
- io_ringBlockSize = acc_offset + (local * RING_OFFSET_SIZE);
- memcpy( (uint8_t*)(*io_ringBlockPtr), &acc_offset, sizeof(acc_offset));
-
- 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++;
- }
-
- }
-
- // Instance specific single ring extract loop
- local = 0;
-
- for(uint8_t i = (ring_id_list_instance + 0)->instanceIdMin;
- i < (ring_id_list_instance + 0)->instanceIdMax + 1 ; i++)
- {
- for (uint8_t j = 0; j < P9_RID::EQ::g_chipletData.iv_num_instance_rings; j++)
- {
- for(uint8_t k = 0; k < l_num_variant ; k++)
- {
- if (i_dbgl > 2)
- {
- MY_INF(" Ring name %s Cplt instance ring id %d Variant id %d",
- (ring_id_list_instance + j)->ringName, j, k);
- }
-
- if (strcmp( (ring_id_list_instance + j)->ringName,
- P9_RID::RING_PROPERTIES[i_ringId].iv_name) == 0)
- {
- if ( io_instanceId >= (ring_id_list_instance + 0)->instanceIdMin
- && io_instanceId <= (ring_id_list_instance + 0)->instanceIdMax )
- {
- if ( i == io_instanceId && k == i_RingVariant )
- {
- strcpy(o_ringName, P9_RID::RING_PROPERTIES[i_ringId].iv_name);
- uint32_t var = CPLT_OFFSET_SIZE + i_ddLevelOffset + ppe_cplt_offset;
- int temp1 = var / sizeof(uint32_t);
- ring_offset = *((uint32_t*)i_ringSection + temp1);
- ring_offset = be32toh(ring_offset);
- var = ring_offset + i_ddLevelOffset + ppe_cplt_offset;
- temp1 = var / sizeof(uint16_t) + local;
- chiplet_offset = *((uint16_t*)i_ringSection + temp1);
- chiplet_offset = be16toh(chiplet_offset);
-
- if (i_RingBlockType == GET_SINGLE_RING)
- {
- var = ring_offset + chiplet_offset + i_ddLevelOffset + ppe_cplt_offset;
- ringSize = be16toh( ((CompressedScanData*)
- ((uint8_t*)i_ringSection +
- var))->iv_size );
- io_RingType = INSTANCE_RING;
-
- if (chiplet_offset)
- {
- if (io_ringBlockSize == 0)
- {
if (i_dbgl > 0)
{
- MY_INF("\tio_ringBlockSize is zero. Returning required size.\n");
+ MY_DBG("Ring %s was not found.\n", o_ringName);
}
- io_ringBlockSize = ringSize;
- return 0;
- }
-
- if (io_ringBlockSize < ringSize)
- {
- MY_ERR("\tio_ringBlockSize is less than required size.\n");
- return TOR_BUFFER_TOO_SMALL;
+ rc = TOR_RING_NOT_FOUND;
}
if (i_dbgl > 0)
{
- MY_INF(" ring container of %s is found in the SGPE image container \n",
- o_ringName);
+ MY_DBG("Details for chiplet ring index=%d: \n"
+ " Full offset to chiplet section = 0x%08x \n"
+ " Full offset to RS4 header = 0x%08x \n"
+ " Ring size = 0x%08x \n",
+ iRing, cpltOffset, ringOffset, ringSize);
}
- memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + var,
- (size_t)ringSize);
+ return rc;
- io_ringBlockSize = ringSize;
-
- if (i_dbgl > 0)
+ }
+ else if (i_ringBlockType == PUT_SINGLE_RING)
+ {
+ if (ringOffset)
{
- MY_INF(" After get_ring_from_sgpe_image Size %d \n", io_ringBlockSize);
+ MY_ERR("Ring container is already present in image\n");
+ return TOR_RING_AVAILABLE_IN_RINGSECTION;
}
- if (i_dbgl > 0)
- {
- 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, ppe_cplt_offset, ring_offset, chiplet_offset, ringSize);
- }
+ // Special [mis]use of io_ringBlockPtr and io_ringBlockSize:
+ // Put location of chiplet's CMN or INST section into ringBlockPtr
+ memcpy( *io_ringBlockPtr, &cpltOffset, sizeof(cpltOffset));
+ // Put location of ringOffset slot into ringBlockSize
+ io_ringBlockSize = cpltOffset + (torSlotNum * sizeof(ringOffset));
- return TOR_RING_FOUND;
+ return TOR_SUCCESS;
}
else
{
- if (i_dbgl > 0)
- {
- MY_INF(" ring container of %s is not found in the SGPE image container \n",
- o_ringName);
- }
-
- return TOR_RING_NOT_FOUND;
+ MY_ERR("Ring block type (i_ringBlockType=%d) is not supported\n", i_ringBlockType);
+ return TOR_INVALID_RING_BLOCK_TYPE;
}
}
- else if (i_RingBlockType == PUT_SINGLE_RING)
- {
- if (chiplet_offset)
- {
- MY_ERR("Ring container is already present in the SGPE section \n");
- return TOR_RING_AVAILABLE_IN_RINGSECTION;
- }
-
- acc_offset = var;
- io_ringBlockSize = acc_offset + (local * RING_OFFSET_SIZE);
- memcpy( (uint8_t*)(*io_ringBlockPtr), &acc_offset, sizeof(acc_offset));
- 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
- {
- if (i_dbgl > 0)
- {
- MY_INF("SGPE ring instance ID %d is invalid, Valid ID is from %d to %d \n",
- io_instanceId, (ring_id_list_instance + 0)->instanceIdMin,
- (ring_id_list_instance + 0)->instanceIdMax);
+ torSlotNum++; // Next TOR ring slot
}
-
- return TOR_INVALID_INSTANCE_ID;
}
}
-
- local++;
- }
- }
- }
-
- return TOR_INVALID_RING_ID;
-
-} // End of get_ring_from_sgpe_image()
-
-
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-//
-// GET RING FROM CME IMAGE FUNCTION
-//
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-static
-int get_ring_from_cme_image ( void* i_ringSection, // Ring section ptr
- RingId_t i_ringId, // Ring ID
- 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
- RingBlockType_t i_RingBlockType, // Single ring, Block
- void** io_ringBlockPtr, // Output ring data buffer
- uint32_t& io_ringBlockSize, // Size of ring data
- char* o_ringName, // Name of ring
- uint32_t i_dbgl ) // Debug option
-{
- uint32_t torMagic;
- uint32_t acc_offset = 0; // Accumulating offset to next TOR offset slot
- uint32_t ring_offset = 0;
- uint16_t chiplet_offset = 0;
- uint32_t ringSize = 0;
- int temp = (i_ddLevelOffset >> 2) + 2; // converting byte to word counter
- uint32_t cme_offset = 0;
- uint32_t ppe_cplt_offset = 0; // Local offset to where the pool of chiplets starts
-
- torMagic = be32toh( ((TorHeader_t*)i_ringSection)->magic );
-
- if (torMagic == TOR_MAGIC_HW)
- {
- cme_offset = *((uint32_t*)i_ringSection + temp); //DD level offset index
- temp = be32toh(cme_offset);
- }
- else if (torMagic == TOR_MAGIC_CME)
- {
- cme_offset = 0;
- i_ddLevelOffset = 0;
- temp = be32toh(cme_offset);
- }
- else
- {
- MY_ERR("torMagic=0x%08x is not valid for CME\n", torMagic);
- return TOR_INVALID_MAGIC_NUMBER;
- }
-
- // Calculate the offset (wrt start of ringSection) to where the
- // pool of chiplet offsets begins in the CME PPE ring section,
- // which is right after the TORC header.
- ppe_cplt_offset = temp + sizeof(TorHeader_t);
-
- GenRingIdList* ring_id_list_common = NULL;
- GenRingIdList* ring_id_list_instance = NULL;
- uint8_t l_num_variant = P9_RID::EC::g_chipletData.iv_num_ring_variants;
- ring_id_list_common = (GenRingIdList*) P9_RID::EC::RING_ID_LIST_COMMON;
- ring_id_list_instance = (GenRingIdList*) P9_RID::EC::RING_ID_LIST_INSTANCE;
-
- uint32_t local = 0;
-
- for (uint8_t i = 0; i < P9_RID::EC::g_chipletData.iv_num_common_rings ; i++)
- {
- for (uint8_t j = 0; j < l_num_variant ; j++)
- {
- if (i_dbgl > 2)
- {
- MY_INF(" Ring %s Cplt common ring id %d Variant id %d\n",
- (ring_id_list_common + i)->ringName, i, j);
}
-
- if ((strcmp( (ring_id_list_common + i)->ringName,
- P9_RID::RING_PROPERTIES[i_ringId].iv_name) == 0) && ( i_RingVariant == j ))
+ else // Since there's no Common/Instance rings, set RING_NOT_FOUND
{
- strcpy(o_ringName, P9_RID::RING_PROPERTIES[i_ringId].iv_name);
- uint32_t var = 0 + i_ddLevelOffset + ppe_cplt_offset;
- int temp1 = var / sizeof(uint32_t);
- ring_offset = *((uint32_t*)i_ringSection + temp1);
- ring_offset = be32toh(ring_offset);
- var = ring_offset + i_ddLevelOffset + ppe_cplt_offset;
- temp1 = var / sizeof(uint16_t) + local;
- chiplet_offset = *((uint16_t*)i_ringSection + temp1);
- chiplet_offset = be16toh(chiplet_offset);
-
- if (i_RingBlockType == GET_SINGLE_RING)
- {
- var = ring_offset + chiplet_offset + i_ddLevelOffset + ppe_cplt_offset;
- ringSize = be16toh( ((CompressedScanData*)
- ((uint8_t*)i_ringSection +
- var))->iv_size );
- io_RingType = COMMON_RING;
-
- if (chiplet_offset)
- {
- if (io_ringBlockSize == 0)
- {
- if (i_dbgl > 0)
- {
- MY_INF("\tio_ringBlockSize is zero. Returning required size.\n");
- }
-
- io_ringBlockSize = ringSize;
- return 0;
- }
-
- if (io_ringBlockSize < ringSize)
- {
- MY_ERR("\tio_ringBlockSize is less than required size.\n");
- return TOR_BUFFER_TOO_SMALL;
- }
-
- if (i_dbgl > 0)
- {
- MY_INF(" Ring %s found in the CME section \n", o_ringName);
- }
-
- memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + var,
- (size_t)ringSize);
-
- io_ringBlockSize = ringSize;
- io_instanceId = (ring_id_list_common + i)->instanceIdMin;
-
- if (i_dbgl > 0)
- {
- 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, ppe_cplt_offset, ring_offset, chiplet_offset, ringSize);
- }
-
- return TOR_RING_FOUND;
- }
- else
- {
- if (i_dbgl > 0)
- {
- MY_INF(" Ring %s not found in the CME section \n", o_ringName);
- }
-
- return TOR_RING_NOT_FOUND;
- }
- }
- else if (i_RingBlockType == PUT_SINGLE_RING)
- {
- if (chiplet_offset)
- {
- MY_ERR("Ring container is already present in the CME section \n");
- return TOR_RING_AVAILABLE_IN_RINGSECTION;
- }
-
- acc_offset = var;
- io_ringBlockSize = acc_offset + (local * RING_OFFSET_SIZE);
- memcpy( (uint8_t*)(*io_ringBlockPtr), &acc_offset, sizeof(acc_offset));
-
- return TOR_RING_FOUND;
- }
- else
+ // Note that if we get here, it's because the chiplet doesn't have either
+ // a Common or Instance rings. This happens e.g. for Centaur which has
+ // no Instance rings. And theoretically, it's possible to only have
+ // Instance rings and no Common rings, so accommodating that as well here.
+ if (i_dbgl > 0)
{
- MY_ERR("Ring block type (i_RingBlockType=%d) is not supported for CME \n", i_RingBlockType);
- return TOR_INVALID_RING_BLOCK_TYPE;
+ MY_DBG("Chiplet=%d has no CMN(%d) or INST(%d) section\n",
+ iCplt, (1 - bInstCase), bInstCase);
}
- }
- local++;
- }
- }
+ rc = TOR_RING_NOT_FOUND;
- // Instance specific single ring extract loop
- local = 0;
+ } // if (ringIdList)
+ } // for (bInstCase)
+ } // for (iCplt)
- for ( uint8_t i = (ring_id_list_instance + 0)->instanceIdMin;
- i <= (ring_id_list_instance + 0)->instanceIdMax;
- i++ )
+ if (i_dbgl > 0)
{
- for (uint8_t j = 0; j < P9_RID::EC::g_chipletData.iv_num_instance_rings; j++)
- {
- for (uint8_t k = 0; k < l_num_variant ; k++)
- {
- if (i_dbgl > 2)
- {
- MY_INF(" Ring name %s Cplt instance ring id %d Variant id %d",
- (ring_id_list_instance + j)->ringName, j, k);
- }
-
- if (strcmp( (ring_id_list_instance + j)->ringName,
- P9_RID::RING_PROPERTIES[i_ringId].iv_name) == 0)
- {
- if ( io_instanceId >= (ring_id_list_instance + 0)->instanceIdMin
- && io_instanceId <= (ring_id_list_instance + 0)->instanceIdMax )
- {
- if ( i == io_instanceId && k == i_RingVariant )
- {
- strcpy(o_ringName, P9_RID::RING_PROPERTIES[i_ringId].iv_name);
- uint32_t var = i_ddLevelOffset + ppe_cplt_offset + CPLT_OFFSET_SIZE;
- int temp1 = var / CPLT_OFFSET_SIZE;
- ring_offset = *((uint32_t*)i_ringSection + temp1);
- ring_offset = be32toh(ring_offset);
- var = ring_offset + i_ddLevelOffset + ppe_cplt_offset;
- temp1 = var / sizeof(uint16_t) + local;
- chiplet_offset = *((uint16_t*)i_ringSection + temp1);
- chiplet_offset = be16toh(chiplet_offset);
-
- if (i_RingBlockType == GET_SINGLE_RING)
- {
- var = ring_offset + chiplet_offset + i_ddLevelOffset + ppe_cplt_offset;
- ringSize = be16toh( ((CompressedScanData*)
- ((uint8_t*)i_ringSection +
- var))->iv_size );
- io_RingType = INSTANCE_RING;
-
- if (chiplet_offset)
- {
- if (io_ringBlockSize == 0)
- {
- if (i_dbgl > 0)
- {
- MY_INF("\tio_ringBlockSize is zero. Returning required size.\n");
- }
-
- io_ringBlockSize = ringSize;
-
- return TOR_SUCCESS;
- }
-
- if (io_ringBlockSize < ringSize)
- {
- MY_ERR("\tio_ringBlockSize is less than required size.\n");
-
- return TOR_BUFFER_TOO_SMALL;
- }
-
- if (i_dbgl > 0)
- {
- 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, ppe_cplt_offset, ring_offset, chiplet_offset, ringSize);
- }
-
- memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + var,
- (size_t)ringSize);
-
- io_ringBlockSize = ringSize;
-
- if (i_dbgl > 0)
- {
- MY_INF(" After get_ring_from_cme_image Size %d \n", io_ringBlockSize);
- }
-
- return TOR_RING_FOUND;
- }
- else
- {
- if (i_dbgl > 0)
- {
- MY_INF(" ring container of %s is not found in the CME image container \n",
- o_ringName);
- }
-
- return TOR_RING_NOT_FOUND;
- }
- }
- else if (i_RingBlockType == PUT_SINGLE_RING)
- {
- if (chiplet_offset)
- {
- MY_ERR("Ring container is already present in the CME section \n");
-
- return TOR_RING_AVAILABLE_IN_RINGSECTION;
- }
-
- acc_offset = var;
- io_ringBlockSize = acc_offset + (local * RING_OFFSET_SIZE);
- memcpy( (uint8_t*)(*io_ringBlockPtr), &acc_offset, sizeof(acc_offset));
-
- 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
- {
- if (i_dbgl > 0)
- {
- MY_INF(" CME ring instance ID %d is invalid, Valid ID is from %d to %d \n",
- io_instanceId, (ring_id_list_instance + 0)->instanceIdMin,
- (ring_id_list_instance + 0)->instanceIdMax);
- }
-
- return TOR_INVALID_INSTANCE_ID;
- }
- }
-
- local++;
- }
- }
+ MY_DBG("i_ringId=0x%x is an invalid ring ID\n", i_ringId);
}
return TOR_INVALID_RING_ID;
-} // End of get_ring_from_cme_image()
+} // End of get_ring_from_ring_section()
@@ -1114,11 +285,10 @@ int get_ring_from_cme_image ( void* i_ringSection, // Ring section
int tor_access_ring( void* i_ringSection, // Ring section ptr
RingId_t i_ringId, // Ring ID
uint16_t i_ddLevel, // DD level
- PpeType_t i_PpeType, // SBE, CME, SGPE
- RingType_t& io_RingType, // Common, Instance
- RingVariant_t i_RingVariant, // Base,CC, RL, Ovrd, Ovly
+ PpeType_t i_ppeType, // SBE, CME, SGPE
+ RingVariant_t i_ringVariant, // Base,CC,RL (SBE,CME,SGPE only)
uint8_t& io_instanceId, // Instance ID
- RingBlockType_t i_RingBlockType, // Single ring, Block
+ RingBlockType_t i_ringBlockType, // Single ring, Block
void** io_ringBlockPtr, // Ring data buffer
uint32_t& io_ringBlockSize, // Size of ring data
char* o_ringName, // Ring name
@@ -1128,17 +298,17 @@ int tor_access_ring( void* i_ringSection, // Ring section ptr
uint32_t torMagic;
TorHeader_t* torHeader;
TorDdBlock_t* torDdBlock;
- uint8_t bDdCheck = 0;
- uint32_t ddLevelOffset = 0;
uint32_t ddLevelCount = 0;
- uint32_t ddLevel = 0;
+ uint32_t ddLevelOffset = 0;
uint32_t ddBlockSize = 0;
- uint32_t temp = 0;
+ void* ddBlockStart = NULL;
+ uint8_t bDdCheck = 0;
+ uint32_t ddLevel = 0;
if (i_dbgl > 1)
{
- MY_INF("Entering tor_access_ring()... \n");
+ MY_DBG("Entering tor_access_ring()...\n");
}
torHeader = (TorHeader_t*)i_ringSection;
@@ -1146,6 +316,7 @@ int tor_access_ring( void* i_ringSection, // Ring section ptr
if (torMagic == TOR_MAGIC_HW)
{
+
ddLevelCount = torHeader->numDdLevels;
if (ddLevelCount > MAX_NOOF_DD_LEVELS_IN_IMAGE)
@@ -1159,7 +330,7 @@ int tor_access_ring( void* i_ringSection, // Ring section ptr
}
else if (i_dbgl > 1)
{
- MY_INF("tor_access_ring(): No of DD levels: %d \n", ddLevelCount);
+ MY_DBG("tor_access_ring(): No of DD levels: %d \n", ddLevelCount);
}
for (uint8_t i = 0; i < ddLevelCount; i++)
@@ -1168,20 +339,22 @@ int tor_access_ring( void* i_ringSection, // Ring section ptr
sizeof(TorHeader_t) +
i * sizeof(TorDdBlock_t) );
ddLevel = torDdBlock->ddLevel;
- // Local ddLevelOffset
+ // Local ddLevelOffset (relative to where the DD blocks start)
ddLevelOffset = be32toh(torDdBlock->offset);
if (i_dbgl > 1)
{
- MY_INF( "tor_access_ring(): Local DD level offset: 0x%08x for DD level: 0x%x \n",
- ddLevelOffset, ddLevel );
+ MY_DBG("tor_access_ring(): Local DD level offset: 0x%08x for DD level: 0x%x \n",
+ ddLevelOffset, ddLevel );
}
- if ( ddLevel == i_ddLevel)
+ if (ddLevel == i_ddLevel)
{
- // Convert to global ddLevelOffset
- ddLevelOffset = ddLevelOffset +
- sizeof(TorHeader_t);
+ // Calc ddBlockStart from origin of the ringSection to where
+ // the DD block's PPE block starts.
+ ddBlockStart = (void*)((uint8_t*)i_ringSection +
+ sizeof(TorHeader_t) +
+ ddLevelOffset);
ddBlockSize = htobe32(torDdBlock->size);
bDdCheck = 1;
break;
@@ -1197,365 +370,116 @@ int tor_access_ring( void* i_ringSection, // Ring section ptr
return TOR_DD_LEVEL_NOT_FOUND;
}
- }
- else if ( torMagic == TOR_MAGIC_SBE ||
- torMagic == TOR_MAGIC_OVRD ||
- torMagic == TOR_MAGIC_OVLY ||
- torMagic == TOR_MAGIC_CEN )
- {
- if ( i_PpeType == PT_CME || i_PpeType == PT_SGPE
- || i_RingBlockType == GET_DD_LEVEL_RINGS
- || i_RingBlockType == GET_PPE_LEVEL_RINGS )
- {
- MY_ERR("Ambiguity on input PARMS for calling SEEPROM Ring copy API. \n");
- return TOR_AMBIGUOUS_API_PARMS;
- }
- else
- {
- ddLevelOffset = sizeof(TorHeader_t);
- ddBlockSize = 0;
- }
- }
- else if (torMagic == TOR_MAGIC_CME)
- {
- if ( i_PpeType == PT_SBE || i_PpeType == PT_SGPE
- || i_RingBlockType == GET_DD_LEVEL_RINGS
- || i_RingBlockType == GET_PPE_LEVEL_RINGS )
- {
- MY_ERR("Ambiguity on input PARMS for calling CME Ring copy API. \n");
- return TOR_AMBIGUOUS_API_PARMS;
- }
- else
- {
- ddLevelOffset = sizeof(TorHeader_t);
- ddBlockSize = 0;
- }
- }
- else if (torMagic == TOR_MAGIC_SGPE)
- {
- if ( i_PpeType == PT_SBE || i_PpeType == PT_CME
- || i_RingBlockType == GET_DD_LEVEL_RINGS
- || i_RingBlockType == GET_PPE_LEVEL_RINGS )
- {
- MY_ERR("Ambiguity on input PARMS for calling SGPE Ring copy API. \n");
- return TOR_AMBIGUOUS_API_PARMS;
- }
- else
- {
- ddLevelOffset = sizeof(TorHeader_t);
- ddBlockSize = 0;
- }
- }
- else
- {
- if (i_dbgl > 0)
- {
- MY_ERR("torMagic=0x%08x is not valid\n", torMagic);
- }
- return TOR_INVALID_MAGIC_NUMBER;
}
- if (i_RingBlockType == GET_DD_LEVEL_RINGS)
+ if ( ( i_ringBlockType == GET_SINGLE_RING ) || // All Magics supported for GET
+ ( i_ringBlockType == PUT_SINGLE_RING && // Can only append to SBE,CME,SGPE
+ ( torMagic == TOR_MAGIC_SBE ||
+ torMagic == TOR_MAGIC_CME ||
+ torMagic == TOR_MAGIC_SGPE ) ) )
{
- if (io_ringBlockSize == 0)
- {
- if (i_dbgl > 0)
- {
- MY_INF("\tio_ringBlockSize is zero. Returning required size.\n");
- }
-
- io_ringBlockSize = ddBlockSize;
- return 0;
- }
-
- if (io_ringBlockSize < ddBlockSize)
- {
- MY_ERR("\tio_ringBlockSize is less than required size.\n");
- return TOR_BUFFER_TOO_SMALL;
- }
-
- memcpy( (uint8_t*)(*io_ringBlockPtr),
- (uint8_t*)i_ringSection + ddLevelOffset, (size_t)ddBlockSize);
-
- if (i_dbgl > 1)
+ if ( torMagic == TOR_MAGIC_HW )
{
- MY_INF( "TOR_ACCESS_RING(5): DD offset = %d DD level = %d DD block size = %d \n",
- ddLevelOffset, ddLevel, ddBlockSize);
+ // Update i_ringSection:
+ // Extract the offset to the specified ppeType's ring section TOR header and update i_ringSection
+ TorPpeBlock_t* torPpeBlock;
+ torPpeBlock = (TorPpeBlock_t*)((uint8_t*)ddBlockStart + i_ppeType * sizeof(TorPpeBlock_t));
+ i_ringSection = (void*)((uint8_t*)ddBlockStart + be32toh(torPpeBlock->offset));
}
- io_ringBlockSize = ddBlockSize;
+ rc = get_ring_from_ring_section( i_ringSection,
+ i_ringId,
+ i_ringVariant,
+ io_instanceId,
+ i_ringBlockType,
+ io_ringBlockPtr,
+ io_ringBlockSize,
+ o_ringName,
+ i_dbgl );
- return TOR_RING_FOUND;
+ return rc;
}
- else if (i_RingBlockType == GET_PPE_LEVEL_RINGS)
+ else if ( i_ringBlockType == GET_DD_LEVEL_RINGS &&
+ torMagic == TOR_MAGIC_HW )
{
- uint32_t l_ppe_offset = 0;
- uint32_t l_ppe_size = 0;
-
- if (i_PpeType == PT_SBE)
+ if (io_ringBlockSize >= ddBlockSize)
{
- temp = ddLevelOffset >> 2;
-
- if (i_dbgl > 1)
- {
- MY_INF( "TOR_ACCESS_RING(6): SBE PPE_LEVEL_RING COPY called ... \n");
- }
+ memcpy( (uint8_t*)(*io_ringBlockPtr), ddBlockStart, ddBlockSize );
+ io_ringBlockSize = ddBlockSize;
- l_ppe_offset = *((uint32_t*)i_ringSection + temp);
- l_ppe_offset = be32toh(l_ppe_offset);
- l_ppe_size = *((uint32_t*)i_ringSection + temp + 1 );
- l_ppe_size = be32toh(l_ppe_size);
+ return TOR_SUCCESS;
}
- else if (i_PpeType == PT_CME)
+ else if (io_ringBlockSize == 0)
{
- temp = (ddLevelOffset >> 2) + 2;
-
- if (i_dbgl > 1)
+ if (i_dbgl > 0)
{
- MY_INF( "TOR_ACCESS_RING(7): CME PPE_LEVEL_RING COPY called... \n");
+ MY_DBG("io_ringBlockSize is zero. Returning required size.\n");
}
- l_ppe_offset = *((uint32_t*)i_ringSection + temp);
- l_ppe_offset = be32toh(l_ppe_offset);
- l_ppe_size = *((uint32_t*)i_ringSection + temp + 1 );
- l_ppe_size = be32toh(l_ppe_size);
- }
- else if (i_PpeType == PT_SGPE)
- {
-
- temp = (ddLevelOffset >> 2) + sizeof(uint32_t);
-
- if (i_dbgl > 1)
- {
- MY_INF( "TOR_ACCESS_RING(8): SPGE PPE_LEVEL_RING COPY called... \n");
- }
+ io_ringBlockSize = ddBlockSize;
- l_ppe_offset = *((uint32_t*)i_ringSection + temp);
- l_ppe_offset = be32toh(l_ppe_offset);
- l_ppe_size = *((uint32_t*)i_ringSection + temp + 1 );
- l_ppe_size = be32toh(l_ppe_size);
+ return TOR_SUCCESS;
}
-
- if (io_ringBlockSize == 0)
+ else
{
- if (i_dbgl > 0)
- {
- MY_INF("\tio_ringBlockSize is zero. Returning required size.\n");
- }
+ MY_ERR("io_ringBlockSize is less than required size.\n");
- io_ringBlockSize = l_ppe_size;
- return 0;
- }
-
- if (io_ringBlockSize < l_ppe_size)
- {
- MY_ERR("\tio_ringBlockSize is less than required size.\n");
return TOR_BUFFER_TOO_SMALL;
}
-
- memcpy( (uint8_t*)(*io_ringBlockPtr),
- (uint8_t*)i_ringSection + l_ppe_offset + ddLevelOffset,
- (size_t)l_ppe_size);
- io_ringBlockSize = l_ppe_size;
-
- return TOR_RING_FOUND;
}
- else if ( i_RingBlockType == GET_SINGLE_RING ||
- i_RingBlockType == PUT_SINGLE_RING )
+ else if ( i_ringBlockType == GET_PPE_LEVEL_RINGS &&
+ torMagic == TOR_MAGIC_HW &&
+ (i_ppeType == PT_SBE || i_ppeType == PT_CME || i_ppeType == PT_SGPE) )
{
- if ( i_PpeType == PT_SBE &&
- ( torMagic == TOR_MAGIC_HW ||
- torMagic == TOR_MAGIC_SBE ||
- torMagic == TOR_MAGIC_OVRD ||
- torMagic == TOR_MAGIC_OVLY ||
- torMagic == TOR_MAGIC_CEN ) )
- {
- rc = get_ring_from_sbe_image( i_ringSection,
- i_ringId,
- ddLevelOffset,
- io_RingType,
- i_RingVariant,
- io_instanceId,
- i_RingBlockType,
- io_ringBlockPtr,
- io_ringBlockSize,
- o_ringName,
- i_dbgl );
-
- if (rc)
- {
- if (i_dbgl > 0)
- {
- MY_ERR("get_ring_from_sbe_image failed w/rc=%d\n", rc);
- }
+ TorPpeBlock_t* torPpeBlock;
+ uint32_t ppeSize;
- return rc;
- }
- else
- {
- if (i_dbgl > 1)
- {
- MY_INF(" TOR_ACCESS_RING(10): After get_ring_from_sbe_image Size %d \n",
- io_ringBlockSize );
- }
+ torPpeBlock = (TorPpeBlock_t*)((uint8_t*)ddBlockStart + i_ppeType * sizeof(TorPpeBlock_t));
+ ppeSize = be32toh(torPpeBlock->size);
- return TOR_RING_FOUND;
- }
- }
- else if ( i_PpeType == PT_CME &&
- ( torMagic == TOR_MAGIC_HW ||
- torMagic == TOR_MAGIC_CME ) )
+ if (io_ringBlockSize >= ppeSize)
{
- rc = get_ring_from_cme_image( i_ringSection,
- i_ringId,
- ddLevelOffset,
- io_RingType,
- i_RingVariant,
- io_instanceId,
- i_RingBlockType,
- io_ringBlockPtr,
- io_ringBlockSize,
- o_ringName,
- i_dbgl );
-
- if (rc == TOR_RING_NOT_FOUND)
- {
- if (i_dbgl > 0)
- {
- MY_INF("\t After CME single ring call, %s ring container is not found \n",
- P9_RID::RING_PROPERTIES[i_ringId].iv_name);
- }
-
- return rc;
- }
- else if (rc == TOR_INVALID_INSTANCE_ID)
- {
- if (i_dbgl > 0)
- {
- MY_INF("\t After CME 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 CME single ring call, Ring container is available in the image \n");
- }
+ memcpy( (uint8_t*)(*io_ringBlockPtr),
+ (uint8_t*)ddBlockStart + be32toh(torPpeBlock->offset),
+ ppeSize );
+ io_ringBlockSize = ppeSize;
- return rc;
- }
- else if (rc == TOR_INVALID_RING_ID)
- {
- if (i_dbgl > 0)
- {
- MY_INF("\t After CME single ring call, There is no TOR slot for %s %d\n",
- P9_RID::RING_PROPERTIES[i_ringId].iv_name, i_ringId);
- }
-
- return rc;
- }
- else
- {
- if (i_dbgl > 1)
- {
- MY_INF("TOR_ACCESS_RING(11): After get_ring_from_cme_image Size %d \n",
- io_ringBlockSize );
- }
-
- return TOR_RING_FOUND;
- }
+ return TOR_SUCCESS;
}
- else if ( i_PpeType == PT_SGPE &&
- ( torMagic == TOR_MAGIC_HW ||
- torMagic == TOR_MAGIC_SGPE ) )
+ else if (io_ringBlockSize == 0)
{
- rc = get_ring_from_sgpe_image( i_ringSection,
- i_ringId,
- ddLevelOffset,
- io_RingType,
- i_RingVariant,
- io_instanceId,
- i_RingBlockType,
- io_ringBlockPtr,
- io_ringBlockSize,
- o_ringName,
- i_dbgl );
-
- if (rc == TOR_RING_NOT_FOUND)
+ if (i_dbgl > 0)
{
- if (i_dbgl > 0)
- {
- MY_INF("\t After SGPE single ring call, %s ring container is not found \n",
- P9_RID::RING_PROPERTIES[i_ringId].iv_name);
- }
-
- return rc;
+ MY_DBG("io_ringBlockSize is zero. Returning required size.\n");
}
- else if (rc == TOR_INVALID_INSTANCE_ID)
- {
- if (i_dbgl > 0)
- {
- MY_INF("\t After SGPE 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 SGPE single ring call, Ring container is available in the image \n");
- }
+ io_ringBlockSize = ppeSize;
- return rc;
- }
- else if (rc == TOR_INVALID_RING_ID)
- {
- if (i_dbgl > 0)
- {
- MY_INF("\t After SGPE single ring call, There is no TOR slot for %s %d\n",
- P9_RID::RING_PROPERTIES[i_ringId].iv_name, i_ringId);
- }
-
- return rc;
- }
- else
- {
- if (i_dbgl > 1)
- {
- MY_INF("TOR_ACCESS_RING(12): After get_ring_from_sgpe_image Size %d \n",
- io_ringBlockSize );
- }
-
- return TOR_RING_FOUND;
- }
+ return TOR_SUCCESS;
}
else
{
- if (i_dbgl > 0)
- {
- MY_ERR("\t Unsupported combination of i_PpeType=%d and torMagic=0x%08x\n",
- i_PpeType, torMagic);
- }
+ MY_ERR("io_ringBlockSize is less than required size.\n");
- return TOR_AMBIGUOUS_API_PARMS;
+ return TOR_BUFFER_TOO_SMALL;
}
-
}
else
{
- MY_ERR("\t RingBlockType=0x%x is not supported. Caller error.\n",
- i_RingBlockType);
+ MY_ERR("Ambiguity on input parms to tor_access_ring():\n" \
+ " Possibly invalid torMagic (=0x%08x)\n" \
+ " Possibly incompatible ringBlockType (=%d)\n" \
+ " Possibly unsupported ppeType (=%d)\n" \
+ " Note that we don't care about ppeType for non-HW TOR ring sections\n",
+ i_ringBlockType, torMagic, i_ppeType);
- return TOR_INVALID_RING_BLOCK_TYPE;
+ return TOR_AMBIGUOUS_API_PARMS;
}
- return TOR_AMBIGUOUS_API_PARMS;
+ MY_ERR("Code bug in tor_access_ring(): Should never be here\n");
+
+ return TOR_CODE_BUG;
} // End of tor_access_ring()
@@ -1569,8 +493,8 @@ int tor_access_ring( void* i_ringSection, // Ring section ptr
int tor_get_single_ring ( void* i_ringSection, // Ring section ptr
uint16_t i_ddLevel, // DD level
RingId_t i_ringId, // Ring ID
- PpeType_t i_PpeType, // SBE, CME, SGPE
- RingVariant_t i_RingVariant, // Base,CC, RL, Ovrd, Ovly
+ PpeType_t i_ppeType, // SBE, CME, SGPE
+ RingVariant_t i_ringVariant, // Base,CC,RL (SBE/CME/SGPE only)
uint8_t i_instanceId, // Instance ID
void** io_ringBlockPtr, // Output ring buffer
uint32_t& io_ringBlockSize, // Size of ring data
@@ -1578,22 +502,18 @@ int tor_get_single_ring ( void* i_ringSection, // Ring section ptr
{
uint32_t rc;
- char i_ringName[25];
- //@FIXME: This should really be ALLRING. But it's not used as input.
- RingType_t l_ringType;
- l_ringType = COMMON_RING;
+ char i_ringName[MAX_RING_NAME_LENGTH];
if (i_dbgl > 1)
{
- MY_INF(" TOR_GET_SINGLE_RING1: function call \n");
+ MY_DBG("Entering tor_get_single_ring()...\n");
}
rc = tor_access_ring( i_ringSection,
i_ringId,
i_ddLevel,
- i_PpeType,
- l_ringType,
- i_RingVariant,
+ i_ppeType,
+ i_ringVariant,
i_instanceId,
GET_SINGLE_RING,
io_ringBlockPtr,
@@ -1603,8 +523,7 @@ int tor_get_single_ring ( void* i_ringSection, // Ring section ptr
if (i_dbgl > 1)
{
- MY_INF(" TOR_GET_SINGLE_RING(2): after tor_access_ring function, Size %d \n",
- io_ringBlockSize );
+ MY_DBG("Exiting tor_get_single_ring() (ringBlockSize=%d)...\n", io_ringBlockSize );
}
return rc;
@@ -1619,65 +538,77 @@ int tor_get_single_ring ( void* i_ringSection, // Ring section ptr
///////////////////////////////////////////////////////////////////////////////////////
int tor_get_block_of_rings ( void* i_ringSection, // Ring section ptr
uint16_t i_ddLevel, // DD level
- PpeType_t i_PpeType, // SBE,CME,SGPE
- RingType_t i_ringType, // Common, Instance
- RingVariant_t i_RingVariant, // Base,CC, RL, Ovrd, Ovly
- uint8_t i_instanceId, // Instance ID
+ PpeType_t i_ppeType, // SBE,CME,SGPE
+ RingVariant_t i_ringVariant, // Base,CC,RL
void** io_ringBlockPtr, // Output ring buffer
uint32_t& io_ringBlockSize, // Size of ring data
uint32_t i_dbgl ) // Debug option
{
+ uint32_t rc = 0;
+ uint8_t l_instanceId;
+ char i_ringName[MAX_RING_NAME_LENGTH];
+ uint32_t torMagic;
+ ChipType_t chipType = UNDEFINED_CHIP_TYPE;
+ TorHeader_t* torHeader;
+
if (i_dbgl > 1)
{
- MY_INF(" TOR_GET_BLOCK_OF_RINGS(1): function call \n");
+ MY_DBG("Entering tor_get_block_of_rings()...\n");
}
- uint32_t rc = 0;
- char i_ringName[25];
-
- if (i_ringType == ALLRING && i_PpeType != NUM_PPE_TYPES)
- {
- // Get block of rings specific to a PPE type
- rc = tor_access_ring( i_ringSection,
- P9_RID::NUM_RING_IDS,
- i_ddLevel,
- i_PpeType,
- i_ringType,
- i_RingVariant,
- i_instanceId,
- GET_PPE_LEVEL_RINGS,
- io_ringBlockPtr,
- io_ringBlockSize,
- i_ringName,
- i_dbgl );
+ torHeader = (TorHeader_t*)i_ringSection;
+ torMagic = be32toh(torHeader->magic);
+ chipType = torHeader->chipType;
+
+ if ( torMagic == TOR_MAGIC_HW && chipType != CT_CEN )
+ {
+ if (i_ppeType == NUM_PPE_TYPES)
+ {
+ // Get DD level block of rings
+ rc = tor_access_ring( i_ringSection,
+ UNDEFINED_RING_ID,
+ i_ddLevel,
+ i_ppeType,
+ i_ringVariant,
+ l_instanceId,
+ GET_DD_LEVEL_RINGS,
+ io_ringBlockPtr,
+ io_ringBlockSize,
+ i_ringName,
+ i_dbgl );
+ }
+ else if (i_ppeType == PT_SBE || i_ppeType == PT_CME || i_ppeType == PT_SGPE)
+ {
+ // Get block of rings specific to a PPE type
+ rc = tor_access_ring( i_ringSection,
+ UNDEFINED_RING_ID,
+ i_ddLevel,
+ i_ppeType,
+ i_ringVariant,
+ l_instanceId,
+ GET_PPE_LEVEL_RINGS,
+ io_ringBlockPtr,
+ io_ringBlockSize,
+ i_ringName,
+ i_dbgl );
- }
- else if (i_ringType == ALLRING && i_PpeType == NUM_PPE_TYPES)
- {
- // Get DD level block of rings
- rc = tor_access_ring( i_ringSection,
- P9_RID::NUM_RING_IDS,
- i_ddLevel,
- i_PpeType,
- i_ringType,
- i_RingVariant,
- i_instanceId,
- GET_DD_LEVEL_RINGS,
- io_ringBlockPtr,
- io_ringBlockSize,
- i_ringName,
- i_dbgl );
+ }
+ else
+ {
+ MY_ERR("tor_get_block_of_rings(): Ambiguous API parameters\n");
+ return TOR_AMBIGUOUS_API_PARMS;
+ }
}
else
{
- MY_ERR("TOR_GET_BLOCK_OF_RINGS(2): Wrong input params. Please check passing params\n");
- return TOR_AMBIGUOUS_API_PARMS;
+ MY_ERR("tor_get_block_of_rings(): Only the P9 HW ring section is supported. However, torMagic=0x%08x and chipType=%d\n",
+ torMagic, chipType);
+ return TOR_UNSUPPORTED_RING_SECTION;
}
if (i_dbgl > 1)
{
- MY_INF(" TOR_GET_SINGLE_RING(2): after tor_access_ring function, Size %d \n",
- io_ringBlockSize );
+ MY_DBG("Exiting tor_get_block_of_rings() (ringBlockSize=%d)...\n", io_ringBlockSize);
}
return rc;
@@ -1696,15 +627,14 @@ int tor_append_ring( void* i_ringSection, // Ring section ptr
void* i_ringBuffer, // Ring work buffer
const uint32_t i_ringBufferSize, // Max size of ring work buffer
RingId_t i_ringId, // Ring ID
- PpeType_t i_PpeType, // SBE, CME, SGPE
- RingType_t i_RingType, // Common, Instance
- RingVariant_t i_RingVariant, // Base,CC, RL, Ovrd, Ovly
+ PpeType_t i_ppeType, // SBE, CME, SGPE
+ RingVariant_t i_ringVariant, // Base,CC,RL
uint8_t i_instanceId, // Instance ID
void* i_rs4Container, // RS4 ring container
uint32_t i_dbgl ) // Debug option
{
uint32_t rc = 0;
- char i_ringName[25];
+ char i_ringName[MAX_RING_NAME_LENGTH];
uint32_t l_buf = 0;
uint32_t* l_cpltSection = &l_buf;
uint32_t l_ringBlockSize;
@@ -1714,9 +644,8 @@ int tor_append_ring( void* i_ringSection, // Ring section ptr
rc = tor_access_ring( i_ringSection,
i_ringId,
0x00,
- i_PpeType,
- i_RingType,
- i_RingVariant,
+ i_ppeType,
+ i_ringVariant,
i_instanceId,
PUT_SINGLE_RING,
(void**)&l_cpltSection, // On return, contains offset (wrt ringSection) of
OpenPOWER on IntegriCloud