summaryrefslogtreecommitdiffstats
path: root/src/import/chips/p9/utils/imageProcs/p9_tor.C
diff options
context:
space:
mode:
authorSachin Gupta <sgupta2m@in.ibm.com>2016-12-15 13:49:39 -0500
committerspashabk-in <shakeebbk@in.ibm.com>2016-12-20 05:18:56 -0600
commit3b3ebd1701ff73de280498858c97812db9153928 (patch)
tree70bce1b89f150498bfc6e3d20c4f69659f4e1600 /src/import/chips/p9/utils/imageProcs/p9_tor.C
parent1a3a8543f8c589f8f1ecb633798096e1d21417b0 (diff)
downloadtalos-sbe-3b3ebd1701ff73de280498858c97812db9153928.tar.gz
talos-sbe-3b3ebd1701ff73de280498858c97812db9153928.zip
Reverting RS4v3 changes
Revert "TOR reduction: Ditching DeltaRingLayout and RingLayout_t" This reverts commit 0ea8cddae37eb5186571e6c66469dad694de9c5a. Revert "Shrinking RS4 header" This reverts commit c1a7c86e800e8bb38f6549b443bb4801feb4f1e3. Change-Id: I7832e23491ea34f86db3cbdc5d25c98e3a9f1821 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/33985 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/33990 Reviewed-by: Hostboot Team <hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+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.C629
1 files changed, 346 insertions, 283 deletions
diff --git a/src/import/chips/p9/utils/imageProcs/p9_tor.C b/src/import/chips/p9/utils/imageProcs/p9_tor.C
index 4c1018f1..17e3d838 100644
--- a/src/import/chips/p9/utils/imageProcs/p9_tor.C
+++ b/src/import/chips/p9/utils/imageProcs/p9_tor.C
@@ -39,7 +39,6 @@
#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
@@ -66,56 +65,50 @@ 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_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_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 rc = TOR_SUCCESS;
+ 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;
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)
{
- dd_level_offset = i_ddLevelOffset;
- ppe_offset = *(uint32_t*)((uint8_t*)i_ringSection + dd_level_offset);
- ppe_offset = htobe32(ppe_offset);
+ sbe_offset = *((uint32_t*)i_ringSection + temp); //DD level offset index
+ temp = htobe32(sbe_offset);
}
else if (i_magic == P9_XIP_MAGIC_SEEPROM)
{
- 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;
+ sbe_offset = 0;
+ i_ddLevel = 0;
+ temp = htobe32(sbe_offset);
}
// Looper for each SBE chiplet
- for(int iCplt = 0; iCplt < SBE_NOOF_CHIPLETS; iCplt++)
+ for(int l = 0; l < SBE_NOOF_CHIPLETS; l++)
{
GenRingIdList* ring_id_list_common = NULL;
GenRingIdList* ring_id_list_instance = NULL;
CHIPLET_DATA l_cpltData;
uint8_t l_num_variant = 1;
- switch (iCplt)
+ switch (l)
{
case PERV_CPLT :
l_cpltData = PERV::g_pervData;
@@ -213,6 +206,7 @@ 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);
@@ -246,7 +240,7 @@ int get_ring_from_sbe_image( void* i_ringSection, // Ring section
break;
default :
- MY_ERR("Chiplet=%d is not valid for SBE. \n", iCplt);
+ MY_ERR("Chiplet=%d is not valid. \n", l);
return TOR_INVALID_CHIPLET;
}
@@ -259,51 +253,43 @@ int get_ring_from_sbe_image( void* i_ringSection, // Ring section
l_num_variant);
}
-
- //
- // Sequentially walk the TOR slots within the chiplet's COMMON section
- //
- tor_slot_no = 0;
+ uint32_t local = 0;
for (uint8_t i = 0; i < l_cpltData.iv_num_common_rings ; i++)
{
- for (uint8_t iVariant = 0; iVariant < l_num_variant ; iVariant++)
+ 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, iVariant);
+ MY_INF(" Ring name %s Cplt Common ring id %d Variant id %d",
+ (ring_id_list_common + i)->ringName, i, j);
}
if ((strcmp( (ring_id_list_common + i)->ringName,
RING_PROPERTIES[i_ringId].iv_name) == 0)
- && ( i_RingVariant == ring_variant_order->variant[iVariant]
+ && ( i_RingVariant == ring_variant_order->variant[j]
|| (i_RingVariant == OVERRIDE && i_magic == P9_XIP_MAGIC_SEEPROM)))
{
strcpy(o_ringName, RING_PROPERTIES[i_ringId].iv_name);
-
- 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);
+ 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);
if (i_RingBlockType == GET_SINGLE_RING)
{
- acc_offset = dd_level_offset +
- ppe_offset +
- cplt_offset +
- ring_offset;
- ring_size = htobe16( ((CompressedScanData*)
- ((uint8_t*)i_ringSection + acc_offset))->iv_size );
+ 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;
io_RingType = COMMON;
- if (ring_offset)
+ if (chiplet_offset)
{
if (io_ringBlockSize == 0)
{
@@ -312,11 +298,11 @@ int get_ring_from_sbe_image( void* i_ringSection, // Ring section
MY_INF("\tio_ringBlockSize is zero. Returning required size.\n");
}
- io_ringBlockSize = ring_size;
+ io_ringBlockSize = ringSize;
return 0;
}
- if (io_ringBlockSize < ring_size)
+ if (io_ringBlockSize < ringSize)
{
MY_ERR("\tio_ringBlockSize is less than required size.\n");
return TOR_BUFFER_TOO_SMALL;
@@ -324,124 +310,119 @@ int get_ring_from_sbe_image( void* i_ringSection, // Ring section
if (i_dbgl > 0)
{
- MY_INF(" Ring %s found in the SBE section \n", o_ringName);
+ 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);
+ memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + var,
+ (size_t)ringSize);
- io_ringBlockSize = ring_size;
+ io_ringBlockSize = ringSize;
io_instanceId = (ring_id_list_common + i)->instanceIdMin;
- rc = TOR_RING_FOUND;
+
+ 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;
}
else
{
if (i_dbgl > 0)
{
- MY_INF(" Ring %s not found in the SBE section \n", o_ringName);
+ MY_INF(" ring container of %s is not found in the SBE image container \n",
+ o_ringName);
}
- rc = TOR_RING_NOT_FOUND;
+ return 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 (ring_offset)
+ if (chiplet_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
+ acc_offset = var;
+ io_ringBlockSize = acc_offset + (local * RING_OFFSET_SIZE);
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
+ local++;
}
}
+ local = 0;
- //
- // 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 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 iVariant = 0; iVariant < l_num_variant ; iVariant++)
+ 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 Instance id %d\n",
- (ring_id_list_instance + j)->ringName, j, iVariant, i);
+ (ring_id_list_instance + j)->ringName, j, k, 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[iVariant])
+ if ( i == io_instanceId && i_RingVariant == ring_variant_order->variant[k] )
{
strcpy(o_ringName, RING_PROPERTIES[i_ringId].iv_name);
-
- 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);
+ 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);
if (i_RingBlockType == GET_SINGLE_RING)
{
- acc_offset = dd_level_offset +
- ppe_offset +
- cplt_offset +
- ring_offset;
- ring_size = htobe16( ((CompressedScanData*)
- ((uint8_t*)i_ringSection +
- acc_offset))->iv_size );
+ 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;
io_RingType = INSTANCE;
- if (ring_offset)
+ if (chiplet_offset)
{
if (io_ringBlockSize == 0)
{
@@ -450,11 +431,11 @@ int get_ring_from_sbe_image( void* i_ringSection, // Ring section
MY_INF("\tio_ringBlockSize is zero. Returning required size.\n");
}
- io_ringBlockSize = ring_size;
+ io_ringBlockSize = ringSize;
return 0;
}
- if (io_ringBlockSize < ring_size)
+ if (io_ringBlockSize < ringSize)
{
MY_ERR("\tio_ringBlockSize is less than required size.\n");
return TOR_BUFFER_TOO_SMALL;
@@ -466,82 +447,84 @@ int get_ring_from_sbe_image( void* i_ringSection, // Ring section
o_ringName);
}
- memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + acc_offset,
- (size_t)ring_size);
+ memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + var,
+ (size_t)ringSize);
- io_ringBlockSize = ring_size;
+ io_ringBlockSize = ringSize;
if (i_dbgl > 0)
{
MY_INF(" After get_ring_from_sbe_image Size %d \n", io_ringBlockSize);
}
- rc = TOR_RING_FOUND;
+ 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;
}
else
{
if (i_dbgl > 0)
{
- MY_INF(" Ring %s not found in SBE section \n", o_ringName);
+ MY_INF(" ring container of %s is not found in the SBE image container \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_offset, cplt_offset, ring_offset, acc_offset, ring_size);
+ return TOR_RING_NOT_FOUND;
}
-
- return rc;
}
else if (i_RingBlockType == PUT_SINGLE_RING)
{
- if (ring_offset)
+ if (chiplet_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 instance section into ringBlockPtr
+ acc_offset = var;
+ io_ringBlockSize = acc_offset + (local * RING_OFFSET_SIZE);
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;
}
}
- tor_slot_no++;
+ local++;
}
+
}
+
}
- }
- MY_ERR("i_ringId=0x%x is an invalid ring ID for SBE", i_ringId);
+ }
return TOR_INVALID_RING_ID;
@@ -558,7 +541,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_ddLevelOffset, // DD level offset
+ uint16_t i_ddLevel, // DD level details
RingType_t& io_RingType, // Common, Instance
RingVariant_t i_RingVariant, // Base,CC, RL, Ovrd, Ovly
uint8_t& io_instanceId, // Instance ID
@@ -571,8 +554,10 @@ 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_ddLevelOffset >> 2) + 4; // converting byte to word counter
+ int temp = (i_ddLevel >> 2) + 4; // converting byte to word counter
+ uint32_t* deltaRingRS4_4B;
uint32_t spge_offset = 0;
if (i_magic == P9_XIP_MAGIC_HW)
@@ -583,7 +568,7 @@ int get_ring_from_sgpe_image ( void* i_ringSection, // Ring sectio
else if (i_magic == P9_XIP_MAGIC_SGPE)
{
spge_offset = 0;
- i_ddLevelOffset = 0;
+ i_ddLevel = 0;
temp = htobe32(spge_offset);
}
@@ -601,7 +586,7 @@ int get_ring_from_sgpe_image ( void* i_ringSection, // Ring sectio
{
if (i_dbgl > 2)
{
- MY_INF(" Ring %s Cplt common ring id %d Variant id %d\n",
+ MY_INF(" Ring name %s Cplt Common ring id %d Variant id %d",
(ring_id_list_common + i)->ringName, i, j);
}
@@ -609,21 +594,22 @@ 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_ddLevelOffset + temp;
+ uint32_t var = 0 + 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_ddLevelOffset + temp;
+ var = ring_offset + i_ddLevel + 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 + i_ddLevelOffset + temp;
- ringSize = htobe16( ((CompressedScanData*)
- ((uint8_t*)i_ringSection +
- var))->iv_size );
+ 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;
io_RingType = COMMON;
if (chiplet_offset)
@@ -647,7 +633,8 @@ int get_ring_from_sgpe_image ( void* i_ringSection, // Ring sectio
if (i_dbgl > 0)
{
- MY_INF(" Ring %s found in the SGPE section \n", o_ringName);
+ MY_INF(" ring container of %s is found in the SGPE image container && ring offset %d \n",
+ o_ringName, chiplet_offset);
}
memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + var,
@@ -658,9 +645,28 @@ int get_ring_from_sgpe_image ( void* i_ringSection, // Ring sectio
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, temp, ring_offset, chiplet_offset, ringSize);
+ 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");
}
return TOR_RING_FOUND;
@@ -669,7 +675,8 @@ int get_ring_from_sgpe_image ( void* i_ringSection, // Ring sectio
{
if (i_dbgl > 0)
{
- MY_INF(" Ring %s not found in the SGPE section \n", o_ringName);
+ MY_INF(" ring container of %s is not found in the SGPE image container \n",
+ o_ringName);
}
return TOR_RING_NOT_FOUND;
@@ -689,11 +696,6 @@ 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++;
@@ -726,21 +728,22 @@ 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_ddLevelOffset + temp;
+ uint32_t var = CPLT_OFFSET_SIZE + 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_ddLevelOffset + temp;
+ var = ring_offset + i_ddLevel + 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 + i_ddLevelOffset + temp;
- ringSize = htobe16( ((CompressedScanData*)
- ((uint8_t*)i_ringSection +
- var))->iv_size );
+ 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;
io_RingType = INSTANCE;
if (chiplet_offset)
@@ -778,11 +781,24 @@ 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 > 0)
+ 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)
{
- 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);
+ 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;
@@ -812,11 +828,6 @@ 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
@@ -848,7 +859,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_ddLevelOffset, // DD level offset
+ 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
@@ -861,8 +872,10 @@ 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_ddLevelOffset >> 2) + 2; // converting byte to word counter
+ int temp = (i_ddLevel >> 2) + 2; // converting byte to word counter
+ uint32_t* deltaRingRS4_4B;
uint32_t cme_offset = 0;
if (i_magic == P9_XIP_MAGIC_HW)
@@ -873,7 +886,7 @@ int get_ring_from_cme_image ( void* i_ringSection, // Ring section
else if (i_magic == P9_XIP_MAGIC_CME)
{
cme_offset = 0;
- i_ddLevelOffset = 0;
+ i_ddLevel = 0;
temp = htobe32(cme_offset);
}
@@ -891,7 +904,7 @@ int get_ring_from_cme_image ( void* i_ringSection, // Ring section
{
if (i_dbgl > 2)
{
- MY_INF(" Ring %s Cplt common ring id %d Variant id %d\n",
+ MY_INF(" Ring name %s Cplt Common ring id %d Variant id %d",
(ring_id_list_common + i)->ringName, i, j);
}
@@ -899,21 +912,22 @@ 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_ddLevelOffset + temp;
+ uint32_t var = 0 + 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_ddLevelOffset + temp;
+ var = ring_offset + i_ddLevel + 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 + i_ddLevelOffset + temp;
- ringSize = htobe16( ((CompressedScanData*)
- ((uint8_t*)i_ringSection +
- var))->iv_size );
+ 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;
io_RingType = COMMON;
if (chiplet_offset)
@@ -937,7 +951,8 @@ int get_ring_from_cme_image ( void* i_ringSection, // Ring section
if (i_dbgl > 0)
{
- MY_INF(" Ring %s found in the CME section \n", o_ringName);
+ MY_INF(" ring container of %s is found in the CME image container \n",
+ o_ringName);
}
memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + var,
@@ -948,9 +963,28 @@ int get_ring_from_cme_image ( void* i_ringSection, // Ring section
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, temp, ring_offset, chiplet_offset, ringSize);
+ 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");
}
return TOR_RING_FOUND;
@@ -959,7 +993,8 @@ int get_ring_from_cme_image ( void* i_ringSection, // Ring section
{
if (i_dbgl > 0)
{
- MY_INF(" Ring %s not found in the CME section \n", o_ringName);
+ MY_INF(" ring container of %s is not found in the CME image container \n",
+ o_ringName);
}
return TOR_RING_NOT_FOUND;
@@ -979,11 +1014,6 @@ 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++;
@@ -1019,21 +1049,22 @@ 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_ddLevelOffset + temp + CPLT_OFFSET_SIZE;
+ uint32_t var = z * CPLT_OFFSET_SIZE + i_ddLevel + 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_ddLevelOffset + temp;
+ var = ring_offset + i_ddLevel + 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 + i_ddLevelOffset + temp;
- ringSize = htobe16( ((CompressedScanData*)
- ((uint8_t*)i_ringSection +
- var))->iv_size );
+ 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;
io_RingType = INSTANCE;
if (chiplet_offset)
@@ -1057,9 +1088,10 @@ int get_ring_from_cme_image ( void* i_ringSection, // Ring section
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, temp, ring_offset, chiplet_offset, ringSize);
+ 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);
}
memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + var,
@@ -1074,10 +1106,22 @@ 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 \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);
+ 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;
@@ -1107,11 +1151,6 @@ 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
@@ -1197,7 +1236,7 @@ int tor_access_ring( void* i_ringSection, // Ring section ptr
if (i_dbgl > 1)
{
- MY_INF( "tor_access_ring(): Local DD level offset: 0x%08x for DD level: 0x%x \n",
+ MY_INF( "tor_access_ring(): DD level offset: 0x%08x DD level: 0x%x \n",
ddLevelOffset, ddLevel );
}
@@ -1876,9 +1915,43 @@ int tor_access_ring( void* i_ringSection, // Ring section ptr
o_ringName,
i_dbgl);
- if (rc)
+ if (rc == TOR_RING_NOT_FOUND)
{
- MY_ERR("get_ring_from_sbe_image failed w/rc=%d\n", rc);
+ 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 (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);
+ }
+
return rc;
}
else
@@ -2198,8 +2271,7 @@ 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, // In: Exact size of ring section.
- // Out: Updated size of ring section.
+ uint32_t& io_ringSectionSize, // Max size of ring section buffer
void* i_ringBuffer, // Ring work buffer
const uint32_t i_ringBufferSize, // Max size of ring work buffer
RingID i_ringId, // Ring ID
@@ -2212,12 +2284,12 @@ int tor_append_ring( void* i_ringSection, // Ring section ptr
{
uint32_t rc = 0;
char i_ringName[25];
- uint32_t l_buf = 0;
- uint32_t* l_cpltSection = &l_buf;
+ uint32_t l_ringTypeBuf = 0;
+ uint32_t* l_ringTypeStart = &l_ringTypeBuf;
uint8_t l_instanceId = i_instanceId;
RingType_t l_RingType = i_RingType;
uint32_t l_ringBlockSize;
- uint16_t l_ringOffset16;
+ uint16_t l_ringOffsetAddr16;
uint64_t l_magic;
uint32_t l_torOffsetSlot;
@@ -2225,17 +2297,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("PPE type (i_PpeType=%d) is not supported \n", i_PpeType);
+ MY_ERR("TOR_APPEND_RING(2): i_PpeType=%d is an unsupported PPE type\n", i_PpeType);
return TOR_AMBIGUOUS_API_PARMS;
}
@@ -2248,51 +2320,42 @@ int tor_append_ring( void* i_ringSection, // Ring section ptr
i_RingVariant,
l_instanceId,
PUT_SINGLE_RING,
- (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
+ (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
i_ringName,
i_dbgl);
if (rc)
{
- MY_ERR("tor_access_ring() failed w/rc=0x%x \n", rc);
+ MY_ERR("\tTOR_APPEND_RING(3): Failure on tor_access_ring function call ...\n");
return rc;
}
if (i_dbgl > 1)
{
- MY_INF(" TOR offset slot for ring address %d \n", l_torOffsetSlot );
+ MY_INF(" TOR_APPEND_RING(4): Ring offset address %d \n",
+ l_torOffsetSlot );
}
- // 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
+ // 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);
io_ringSectionSize += l_ringBlockSize;
- return TOR_SUCCESS;
+ return TOR_APPEND_RING_DONE;
}
OpenPOWER on IntegriCloud