summaryrefslogtreecommitdiffstats
path: root/src/import
diff options
context:
space:
mode:
authorGirisankar Paulraj <gpaulraj@in.ibm.com>2016-05-10 05:46:07 -0500
committerSachin Gupta <sgupta2m@in.ibm.com>2016-09-26 02:21:24 -0400
commit695df887af244e356192ecfd4b285072a6f07a01 (patch)
treee9f122e55c4b4190cb156b5161f80843d869aae4 /src/import
parent52f8cfb292b1d742bfc4631e3e1b328b6a86c9dd (diff)
downloadtalos-sbe-695df887af244e356192ecfd4b285072a6f07a01.tar.gz
talos-sbe-695df887af244e356192ecfd4b285072a6f07a01.zip
TOR2 fixed code bug
Removed pass by reference on hcode API ticket - 153483 153484 Change-Id: I29f8a5910ad816e6e9a2024352a06c6a7bd10361 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/24309 Reviewed-by: Claus M. Olsen <cmolsen@us.ibm.com> Tested-by: Jenkins Server Reviewed-by: Prachi Gupta <pragupta@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/30237 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Diffstat (limited to 'src/import')
-rw-r--r--src/import/chips/p9/utils/imageProcs/p9_tor.C178
-rw-r--r--src/import/chips/p9/utils/imageProcs/p9_tor.H33
2 files changed, 97 insertions, 114 deletions
diff --git a/src/import/chips/p9/utils/imageProcs/p9_tor.C b/src/import/chips/p9/utils/imageProcs/p9_tor.C
index f281b165..0a87f55b 100644
--- a/src/import/chips/p9/utils/imageProcs/p9_tor.C
+++ b/src/import/chips/p9/utils/imageProcs/p9_tor.C
@@ -22,6 +22,18 @@
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
+// IMPORTANT notice on usage of io_RingType and io_instanceId arguments
+//
+// io_RingTyp
+// -------------
+// While using tor_get_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_get_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"
//
@@ -40,7 +52,7 @@ const char* ppeTypeName[] = { "SBE",
//
const char* ringVariantName[] = { "Base",
"CacheContained",
- "RiskLevel"
+ "RiskLevel",
"Override",
"Overlay",
"DEADBEAF"
@@ -233,16 +245,11 @@ int get_ring_from_sbe_image ( void* i_ringSectionPtr, // Image pointer
next_ring_offset = *((uint32_t*)i_ringSectionPtr + temp1);
next_ring_offset = myRev32(next_ring_offset);
ringSize = next_ring_offset;
+ io_RingType = COMMON;
if (chiplet_offset)
{
- if ((*io_ringBlockPtr) == NULL)
- {
- printf("\tmalloc() of initf buffer failed...\n");
- io_ringBlockSize = ringSize;
- return 0;
- }
- else if (io_ringBlockSize < ringSize)
+ if (io_ringBlockSize < ringSize)
{
printf("\tio_ringBlockSize is less than required size ...\n");
io_ringBlockSize = ringSize;
@@ -260,7 +267,7 @@ int get_ring_from_sbe_image ( void* i_ringSectionPtr, // Image pointer
(size_t)ringSize);
io_ringBlockSize = ringSize;
io_instanceId = (ring_id_list_common + i)->instanceIdMin;
- io_RingType = COMMON;
+
if(dbgl > 0)
{
@@ -344,16 +351,11 @@ int get_ring_from_sbe_image ( void* i_ringSectionPtr, // Image pointer
next_ring_offset = *((uint32_t*)i_ringSectionPtr + temp1);
next_ring_offset = myRev32(next_ring_offset);
ringSize = next_ring_offset;
+ io_RingType = INSTANCE;
if (chiplet_offset)
{
- if ((*io_ringBlockPtr) == NULL)
- {
- printf("\tmalloc() of initf buffer failed...\n");
- io_ringBlockSize = ringSize;
- return 0;
- }
- else if (io_ringBlockSize < ringSize)
+ if (io_ringBlockSize < ringSize)
{
printf("\tio_ringBlockSize is less than required size ...\n");
io_ringBlockSize = ringSize;
@@ -369,7 +371,6 @@ int get_ring_from_sbe_image ( void* i_ringSectionPtr, // Image pointer
memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSectionPtr + var,
(size_t)ringSize);
io_ringBlockSize = ringSize;
- io_RingType = INSTANCE;
if(dbgl > 0)
{
@@ -404,9 +405,6 @@ int get_ring_from_sbe_image ( void* i_ringSectionPtr, // Image pointer
{
printf(" ring container of %s is not found in the SBE image container \n",
o_ringName);
- //*io_ringBlockSize = 0;
- //ringSize = 0;
- //(*io_ringBlockPtr) = malloc(ringSize);
return IMGBUILD_TGR_RING_NOT_FOUND;
}
}
@@ -499,16 +497,11 @@ int get_ring_from_sgpe_image ( void*
next_ring_offset = *((uint32_t*)i_ringSectionPtr + temp1);
next_ring_offset = myRev32(next_ring_offset);
ringSize = next_ring_offset;
+ io_RingType = COMMON;
if (chiplet_offset)
{
- if ((*io_ringBlockPtr) == NULL)
- {
- printf("\tmalloc() of initf buffer failed...\n");
- io_ringBlockSize = ringSize;
- return 0;
- }
- else if (io_ringBlockSize < ringSize)
+ if (io_ringBlockSize < ringSize)
{
printf("\tio_ringBlockSize is less than required size ...\n");
io_ringBlockSize = ringSize;
@@ -526,7 +519,6 @@ int get_ring_from_sgpe_image ( void*
(size_t)ringSize);
io_ringBlockSize = ringSize;
io_instanceId = (ring_id_list_common + i)->instanceIdMin;
- io_RingType = COMMON;
// Debug details for each offset address in DD TOR, DD TOR, SBE TOP TOR, SBE common/instance TOR, ring size
if(dbgl > 0)
@@ -613,16 +605,11 @@ int get_ring_from_sgpe_image ( void*
next_ring_offset = *((uint32_t*)i_ringSectionPtr + temp1);
next_ring_offset = myRev32(next_ring_offset);
ringSize = next_ring_offset;
+ io_RingType = INSTANCE;
if (chiplet_offset)
{
- if ((*io_ringBlockPtr) == NULL)
- {
- printf("\tmalloc() of initf buffer failed...\n");
- io_ringBlockSize = ringSize;
- return 0;
- }
- else if (io_ringBlockSize < ringSize)
+ if (io_ringBlockSize < ringSize)
{
printf("\tio_ringBlockSize is less than required size ...\n");
io_ringBlockSize = ringSize;
@@ -639,7 +626,6 @@ int get_ring_from_sgpe_image ( void*
memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSectionPtr + var,
(size_t)ringSize);
io_ringBlockSize = ringSize;
- io_RingType = INSTANCE;
if(dbgl > 0)
{
@@ -762,16 +748,11 @@ int get_ring_from_cme_image ( void*
next_ring_offset = *((uint32_t*)i_ringSectionPtr + temp1);
next_ring_offset = myRev32(next_ring_offset);
ringSize = next_ring_offset;
+ io_RingType = COMMON;
if (chiplet_offset)
{
- if ((*io_ringBlockPtr) == NULL)
- {
- printf("\tmalloc() of initf buffer failed...\n");
- io_ringBlockSize = ringSize;
- return 0;
- }
- else if (io_ringBlockSize < ringSize)
+ if (io_ringBlockSize < ringSize)
{
printf("\tio_ringBlockSize is less than required size ...\n");
io_ringBlockSize = ringSize;
@@ -789,7 +770,6 @@ int get_ring_from_cme_image ( void*
(size_t)ringSize);
io_ringBlockSize = ringSize;
io_instanceId = (ring_id_list_common + i)->instanceIdMin;
- io_RingType = COMMON;
// Debug details for each offset address in DD TOR, DD TOR, SBE TOP TOR, SBE common/instance TOR, ring size
if(dbgl > 0)
@@ -838,6 +818,8 @@ int get_ring_from_cme_image ( void*
for(uint8_t z = 0; z < 12; z++)
{
+ local = 0;
+
for(uint8_t i = z * 2 + (ring_id_list_instance + 0)->instanceIdMin;
i < z * 2 + 2 + (ring_id_list_instance + 0)->instanceIdMin ; i++)
{
@@ -876,16 +858,11 @@ int get_ring_from_cme_image ( void*
next_ring_offset = *((uint32_t*)i_ringSectionPtr + temp1);
next_ring_offset = myRev32(next_ring_offset);
ringSize = next_ring_offset;
+ io_RingType = INSTANCE;
if (chiplet_offset)
{
- if ((*io_ringBlockPtr) == NULL)
- {
- printf("\tmalloc() of initf buffer failed...\n");
- io_ringBlockSize = ringSize;
- return 0;
- }
- else if (io_ringBlockSize < ringSize)
+ if (io_ringBlockSize < ringSize)
{
printf("\tio_ringBlockSize is less than required size ...\n");
io_ringBlockSize = ringSize;
@@ -904,7 +881,6 @@ int get_ring_from_cme_image ( void*
memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSectionPtr + var,
(size_t)ringSize);
io_ringBlockSize = ringSize;
- io_RingType = INSTANCE;
// Debug details for each offset address in DD TOR, DD TOR, SBE TOP TOR, SBE common/instance TOR, ring size
if(dbgl > 0)
@@ -1036,29 +1012,41 @@ int tor_get_ring( void*
}
else if( i_magic == P9_XIP_MAGIC_SEEPROM)
{
- if ( i_PpeType == CME || i_PpeType == SGPE
- || i_RingBlockType == DD_LEVEL_RINGS || i_RingBlockType == PPE_LEVEL_RINGS )
+ if ( i_PpeType == CME)
{
printf("Ambiguity on input PARMS for calling SEEPROM Ring copy API. \n "\
- " DD level or ppe level ring copy are not allowed. As well " \
- " CME and SGPE rings not populated on SEEPROM image \n");
- return IMGBUILD_TGR_AMBIGUOUS_API_PARMS;
+ " CME rings not populated on SEEPROM image \n");
+ return IMGBUILD_TGR_IMAGE_DOES_NOT_SUPPORT_CME;
+ }
+ else if (i_PpeType == SGPE)
+ {
+ printf("Ambiguity on input PARMS for calling SEEPROM Ring copy API. \n "\
+ "SGPE rings not populated on SEEPROM image \n");
+ return IMGBUILD_TGR_IMAGE_DOES_NOT_SUPPORT_SGPE;
+ }
+ else if (i_RingBlockType == DD_LEVEL_RINGS)
+ {
+ printf("Ambiguity on input PARMS for calling SEEPROM Ring copy API. \n "\
+ " DD level ring copy are not supported \n");
+ return IMGBUILD_TGR_IMAGE_DOES_NOT_SUPPORT_DD_LEVEL;
+ }
+ else if (i_RingBlockType == PPE_LEVEL_RINGS )
+ {
+ printf("Ambiguity on input PARMS for calling SEEPROM Ring copy API. \n "\
+ " PPE level ring copy are not supported \n");
+ return IMGBUILD_TGR_IMAGE_DOES_NOT_SUPPORT_PPE_LEVEL;
+ }
+ else
+ {
+ ddLevelOffset = 0;
+ temp1 = 0;
}
-
- ddLevelOffset = 0;
- temp1 = 0;
}
if(i_RingBlockType == DD_LEVEL_RINGS) // DD_LEVEL_COPY
{
- //(*io_ringBlockPtr) = malloc(temp1);
- if ((*io_ringBlockPtr) == NULL)
- {
- printf("\tmalloc() of initf buffer failed...\n");
- io_ringBlockSize = temp1;
- return 0;
- }
- else if (io_ringBlockSize < temp1)
+
+ if (io_ringBlockSize < temp1)
{
printf("\tio_ringBlockSize is less than required size ...\n");
io_ringBlockSize = temp1;
@@ -1127,13 +1115,7 @@ int tor_get_ring( void*
l_ppe_size = myRev32(l_ppe_size);
}
- if ((*io_ringBlockPtr) == NULL)
- {
- printf("\tmalloc() of initf buffer failed...\n");
- io_ringBlockSize = l_ppe_size;
- return 0;
- }
- else if (io_ringBlockSize < l_ppe_size)
+ if (io_ringBlockSize < l_ppe_size)
{
printf("\tio_ringBlockSize is less than required size ....\n");
io_ringBlockSize = l_ppe_size;
@@ -1565,20 +1547,14 @@ int tor_get_ring( void*
}
}
- if ((*io_ringBlockPtr) == NULL)
- {
- printf("\tmalloc() of initf buffer failed...\n");
- io_ringBlockSize = l_cplt_size;
- return 0;
- }
- else if (io_ringBlockSize < l_cplt_size)
+ if (io_ringBlockSize < l_cplt_size)
{
printf("\tio_ringBlockSize is less than required size ...\n");
io_ringBlockSize = l_cplt_size;
return 0;
}
- //(*io_ringBlockPtr) = malloc(l_cplt_size);
+
memcpy( (uint8_t*)(*io_ringBlockPtr),
(uint8_t*)i_ringSectionPtr + l_cplt_offset + temp1,
(size_t)l_cplt_size);
@@ -1704,7 +1680,7 @@ int tor_get_single_ring ( void*
RingID i_ringId, // Ring ID info
PpeType_t i_PpeType, // ppe Type info
RingVariant_t i_RingVariant, // ring variant info -Base, CC, RL,OR,OL
- uint8_t& io_instanceId, // chiplet Instance Id
+ uint8_t i_instanceId, // chiplet Instance Id
void** io_ringBlockPtr, // Output void pointer
uint32_t& io_ringBlockSize // size of ring
)
@@ -1713,8 +1689,10 @@ int tor_get_single_ring ( void*
uint32_t rc;
uint32_t dbgl = 1;
char i_ringName[25];
- RingType_t l_RingType;
- l_RingType = COMMON;
+ uint8_t l_instanceId = i_instanceId;
+ RingType_t l_ringType;
+ l_ringType = COMMON;
+
if(dbgl > 1)
{
@@ -1727,9 +1705,9 @@ int tor_get_single_ring ( void*
i_ringId,
i_ddLevel,
i_PpeType,
- l_RingType,
+ l_ringType,
i_RingVariant,
- io_instanceId,
+ l_instanceId,
SINGLE_RING,
io_ringBlockPtr,
io_ringBlockSize,
@@ -1751,9 +1729,9 @@ int tor_get_single_ring ( void*
int tor_get_block_of_rings ( void* i_ringSectionPt,
uint16_t i_ddLevel,
PpeType_t i_PpeType,
- RingType_t& io_RingType,
+ RingType_t i_RingType,
RingVariant_t i_RingVariant,
- uint8_t& io_instanceId,
+ uint8_t i_instanceId,
void** io_ringBlockPtr,
uint32_t& io_ringBlockSize
)
@@ -1767,8 +1745,10 @@ int tor_get_block_of_rings ( void* i_ringSectionPt,
uint32_t rc = 0;
char i_ringName[25];
+ uint8_t l_instanceId = i_instanceId;
+ RingType_t l_ringType = i_RingType;
- if(io_RingType == ALLRING && i_PpeType != NUM_PPE_TYPES)
+ if(l_ringType == ALLRING && i_PpeType != NUM_PPE_TYPES)
{
//ppe level copy
rc = tor_get_ring( i_ringSectionPt,
@@ -1776,16 +1756,16 @@ int tor_get_block_of_rings ( void* i_ringSectionPt,
P9_NUM_RINGS,
i_ddLevel,
i_PpeType,
- io_RingType,
+ l_ringType,
i_RingVariant,
- io_instanceId,
+ l_instanceId,
PPE_LEVEL_RINGS,
io_ringBlockPtr,
io_ringBlockSize,
i_ringName );
}
- else if (io_RingType == ALLRING && i_PpeType == NUM_PPE_TYPES)
+ else if (l_ringType == ALLRING && i_PpeType == NUM_PPE_TYPES)
{
//dd level Copy
rc = tor_get_ring( i_ringSectionPt,
@@ -1793,15 +1773,15 @@ int tor_get_block_of_rings ( void* i_ringSectionPt,
P9_NUM_RINGS,
i_ddLevel,
i_PpeType,
- io_RingType,
+ l_ringType,
i_RingVariant,
- io_instanceId,
+ l_instanceId,
DD_LEVEL_RINGS,
io_ringBlockPtr,
io_ringBlockSize,
i_ringName );
}
- else if(io_RingType == COMMON || io_RingType == INSTANCE)
+ else if(l_ringType == COMMON || l_ringType == INSTANCE)
{
// Chiplet level copy
rc = tor_get_ring( i_ringSectionPt,
@@ -1809,9 +1789,9 @@ int tor_get_block_of_rings ( void* i_ringSectionPt,
P9_NUM_RINGS,
i_ddLevel,
i_PpeType,
- io_RingType,
+ l_ringType,
i_RingVariant,
- io_instanceId,
+ l_instanceId,
CPLT_LEVEL_RINGS,
io_ringBlockPtr,
io_ringBlockSize,
diff --git a/src/import/chips/p9/utils/imageProcs/p9_tor.H b/src/import/chips/p9/utils/imageProcs/p9_tor.H
index 5220144a..80a7b4f6 100644
--- a/src/import/chips/p9/utils/imageProcs/p9_tor.H
+++ b/src/import/chips/p9/utils/imageProcs/p9_tor.H
@@ -65,17 +65,21 @@ typedef struct
} TorPpeBlock_t;
-#define MAX_CPLT_SBE 13
-#define IMGBUILD_TGR_RING_FOUND 0
-#define IMGBUILD_TGR_RING_BLOCKS_FOUND 0
-#define IMGBUILD_TGR_RING_NOT_FOUND 1 // Ring is not found in HW image.
-#define IMGBUILD_TGR_INVALID_RING_ID 2 // Ring is invalid or mismatch.
-#define IMGBUILD_TGR_AMBIGUOUS_API_PARMS 3 // Ring search in HW iamge got ambiguous condition.
-#define IMGBUILD_TGR_SECTION_NOT_FOUND 4
-#define IMGBUILD_TGR_DD_LVL_INFO_NOT_FOUND 5
-#define IMGBUILD_TGR_OP_BUFFER_INVALID 6
-#define IMGBUILD_TGR_OP_BUFFER_SIZE_EXCEEDED 7
-#define IMGBUILD_INVALID_INSTANCEID 8
+#define MAX_CPLT_SBE 13
+#define IMGBUILD_TGR_RING_FOUND 0
+#define IMGBUILD_TGR_RING_BLOCKS_FOUND 0
+#define IMGBUILD_TGR_RING_NOT_FOUND 1 // Ring is not found in HW image.
+#define IMGBUILD_TGR_INVALID_RING_ID 2 // Ring is invalid or mismatch.
+#define IMGBUILD_TGR_AMBIGUOUS_API_PARMS 3 // Ring search in HW iamge got ambiguous condition.
+#define IMGBUILD_TGR_SECTION_NOT_FOUND 4
+#define IMGBUILD_TGR_DD_LVL_INFO_NOT_FOUND 5
+#define IMGBUILD_TGR_OP_BUFFER_INVALID 6
+#define IMGBUILD_TGR_OP_BUFFER_SIZE_EXCEEDED 7
+#define IMGBUILD_INVALID_INSTANCEID 8
+#define IMGBUILD_TGR_IMAGE_DOES_NOT_SUPPORT_CME 10
+#define IMGBUILD_TGR_IMAGE_DOES_NOT_SUPPORT_SGPE 11
+#define IMGBUILD_TGR_IMAGE_DOES_NOT_SUPPORT_DD_LEVEL 12
+#define IMGBUILD_TGR_IMAGE_DOES_NOT_SUPPORT_PPE_LEVEL 13
#define MY_INF(_fmt_, _args_...) printf(_fmt_, ##_args_)
#define MY_ERR(_fmt_, _args_...) printf(_fmt_, ##_args_)
@@ -228,7 +232,6 @@ int tor_get_ring( void*
RingVariant_t i_RingVariant, // Base, Cache etc
uint8_t& io_instanceId, // chiplet instance ID
RingBlockType_t i_RingBlockType, // 0: single ring, 1: ring block
- //uint8_t i_bBuffer, // 0: No buffer, 1: Yes buffer.
void** io_ringBlockPtr, // Addr of ring buffer
uint32_t& io_ringBlockSize, // size of ring data
char* o_ringName // Ring name
@@ -241,7 +244,7 @@ int tor_get_single_ring ( void*
PpeType_t i_PpeType, // ppe Type
RingVariant_t
i_RingVariant, // Base, cache contained, Risk level, Override and Overlay
- uint8_t& io_instanceId, // Chiplet Instance ID
+ uint8_t i_instanceId, // Chiplet Instance ID
void** io_ringBlockPtr, // Addr of ring buffer
uint32_t& io_ringBlockSize ); // size of ring data
@@ -250,9 +253,9 @@ int tor_get_block_of_rings ( void*
i_ringSectionPt, // Ring address Ptr any of .rings, .overrides and .overlays.
uint16_t i_ddLevel, // DD level
PpeType_t i_PpeType, // ppe Type
- RingType_t& io_RingType, // Common Or Instance
+ RingType_t i_RingType, // Common Or Instance
RingVariant_t i_RingVariant, // base,cache,etc
- uint8_t& io_instanceId, // Chiplet Instance ID
+ uint8_t i_instanceId, // Chiplet Instance ID
void** io_ringBlockPtr, // Addr of ring buffer
uint32_t& io_ringBlockSize // size of ring data
);
OpenPOWER on IntegriCloud