diff options
author | Girisankar Paulraj <gpaulraj@in.ibm.com> | 2016-08-29 00:45:23 -0500 |
---|---|---|
committer | Sachin Gupta <sgupta2m@in.ibm.com> | 2016-09-26 03:14:06 -0400 |
commit | 4b56547bd2ed3d823d7f8db980ab96041c829d1c (patch) | |
tree | 498bbceea839002010492e1cde2abcec3436126b /src/import | |
parent | 58f1531271d74a489928785293f6ffe2b1dfb18b (diff) | |
download | talos-sbe-4b56547bd2ed3d823d7f8db980ab96041c829d1c.tar.gz talos-sbe-4b56547bd2ed3d823d7f8db980ab96041c829d1c.zip |
Improved printing statement
Moving MY_INF under cotrol of i_dbgl params
Improved io_ringBlockSize size checking condition
Change-Id: Ieecbd27fe7ea5c4d7422a16764981e612025e042
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/28891
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Kahn C. Evans <kahnevan@us.ibm.com>
Reviewed-by: Claus M. Olsen <cmolsen@us.ibm.com>
Reviewed-by: GIRISANKAR PAULRAJ <gpaulraj@in.ibm.com>
Reviewed-by: Prachi Gupta <pragupta@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/30264
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')
-rw-r--r-- | src/import/chips/p9/utils/imageProcs/p9_tor.C | 241 | ||||
-rw-r--r-- | src/import/chips/p9/utils/imageProcs/p9_tor.H | 3 |
2 files changed, 203 insertions, 41 deletions
diff --git a/src/import/chips/p9/utils/imageProcs/p9_tor.C b/src/import/chips/p9/utils/imageProcs/p9_tor.C index f03093e9..d502e5fa 100644 --- a/src/import/chips/p9/utils/imageProcs/p9_tor.C +++ b/src/import/chips/p9/utils/imageProcs/p9_tor.C @@ -299,13 +299,23 @@ int get_ring_from_sbe_image ( void* i_ringSection, // Image pointer if (chiplet_offset) { - if (io_ringBlockSize < ringSize) + if (io_ringBlockSize == 0) { - MY_INF("\tio_ringBlockSize is less than required size ...\n"); + 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 IMGBUILD_TGR_BUFFER_TOO_SMALL; + } + if(i_dbgl > 1) { MY_INF(" ring container of %s is found in the SBE image container \n", @@ -418,13 +428,23 @@ int get_ring_from_sbe_image ( void* i_ringSection, // Image pointer if (chiplet_offset) { - if (io_ringBlockSize < ringSize) + if (io_ringBlockSize == 0) { - MY_INF("\tio_ringBlockSize is less than required size ...\n"); + 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 IMGBUILD_TGR_BUFFER_TOO_SMALL; + } + if(i_dbgl > 0) { MY_INF(" ring container of %s is found in the SBE image container \n", @@ -506,7 +526,7 @@ int get_ring_from_sbe_image ( void* i_ringSection, // Image pointer } - return IMGBUILD_TGR_RING_NOT_FOUND; + return IMGBUILD_TGR_INVALID_RING_ID; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -587,13 +607,23 @@ int get_ring_from_sgpe_image ( void* i_ringSection, // Image pointer if (chiplet_offset) { - if (io_ringBlockSize < ringSize) + if (io_ringBlockSize == 0) { - MY_INF("\tio_ringBlockSize is less than required size ...\n"); + 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 IMGBUILD_TGR_BUFFER_TOO_SMALL; + } + if(i_dbgl > 0) { MY_INF(" ring container of %s is found in the SGPE image container && ring offset %d \n", @@ -708,13 +738,23 @@ int get_ring_from_sgpe_image ( void* i_ringSection, // Image pointer if (chiplet_offset) { - if (io_ringBlockSize < ringSize) + if (io_ringBlockSize == 0) { - MY_INF("\tio_ringBlockSize is less than required size ...\n"); + 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 IMGBUILD_TGR_BUFFER_TOO_SMALL; + } + if(i_dbgl > 0) { MY_INF(" ring container of %s is found in the SGPE image container \n", @@ -790,7 +830,7 @@ int get_ring_from_sgpe_image ( void* i_ringSection, // Image pointer } } - return IMGBUILD_TGR_RING_NOT_FOUND; + return IMGBUILD_TGR_INVALID_RING_ID; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -876,13 +916,23 @@ int get_ring_from_cme_image ( void* if (chiplet_offset) { - if (io_ringBlockSize < ringSize) + if (io_ringBlockSize == 0) { - MY_INF("\tio_ringBlockSize is less than required size ...\n"); + 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 IMGBUILD_TGR_BUFFER_TOO_SMALL; + } + if(i_dbgl > 0) { MY_INF(" ring container of %s is found in the CME image container \n", @@ -999,13 +1049,23 @@ int get_ring_from_cme_image ( void* if (chiplet_offset) { - if (io_ringBlockSize < ringSize) + if (io_ringBlockSize == 0) { - MY_INF("\tio_ringBlockSize is less than required size ...\n"); + 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 IMGBUILD_TGR_BUFFER_TOO_SMALL; + } + if(i_dbgl > 0) { MY_INF(" ring container of %s is found in the CME image container %d %d \n", @@ -1084,7 +1144,7 @@ int get_ring_from_cme_image ( void* } } - return IMGBUILD_TGR_RING_NOT_FOUND; + return IMGBUILD_TGR_INVALID_RING_ID; } ////////////////////////////////////////////////////////////////////////////////////////// @@ -1221,14 +1281,23 @@ int tor_access_ring( void* if(i_RingBlockType == GET_DD_LEVEL_RINGS) // DD_LEVEL_COPY { - - if (io_ringBlockSize < temp1) + if (io_ringBlockSize == 0) { - MY_INF("\tio_ringBlockSize is less than required size ...\n"); + if(i_dbgl > 0) + { + MY_INF("\tio_ringBlockSize is zero. Returning required size.\n"); + } + io_ringBlockSize = temp1; return 0; } + if (io_ringBlockSize < temp1) + { + MY_ERR("\tio_ringBlockSize is less than required size.\n"); + return IMGBUILD_TGR_BUFFER_TOO_SMALL; + } + memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + ddLevelOffset, (size_t)temp1); @@ -1291,13 +1360,23 @@ int tor_access_ring( void* l_ppe_size = htobe32(l_ppe_size); } - if (io_ringBlockSize < l_ppe_size) + if (io_ringBlockSize == 0) { - MY_INF("\tio_ringBlockSize is less than required size ....\n"); + if(i_dbgl > 0) + { + MY_INF("\tio_ringBlockSize is zero. Returning 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 IMGBUILD_TGR_BUFFER_TOO_SMALL; + } + memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + l_ppe_offset + ddLevelOffset, (size_t)l_ppe_size); @@ -1738,13 +1817,22 @@ int tor_access_ring( void* } } - if (io_ringBlockSize < l_cplt_size) + if (io_ringBlockSize == 0) { - MY_INF("\tio_ringBlockSize is less than required size ...\n"); + if(i_dbgl > 0) + { + MY_INF("\tio_ringBlockSize is zero. Returning required size.\n"); + } + io_ringBlockSize = l_cplt_size; return 0; } + if (io_ringBlockSize < l_cplt_size) + { + MY_ERR("\tio_ringBlockSize is less than required size.\n"); + return IMGBUILD_TGR_BUFFER_TOO_SMALL; + } memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + l_cplt_offset + temp1, @@ -1754,7 +1842,9 @@ int tor_access_ring( void* } else { - if(i_PpeType == SBE) + if(i_PpeType == SBE && + ( i_magic == P9_XIP_MAGIC_HW || + i_magic == P9_XIP_MAGIC_SEEPROM)) { rc = get_ring_from_sbe_image ( i_ringSection, i_magic, @@ -1771,21 +1861,44 @@ int tor_access_ring( void* if (rc == IMGBUILD_TGR_RING_NOT_FOUND) { - MY_INF("\t After SBE single ring call, %s ring container is not found \n", - RING_PROPERTIES[i_ringId].iv_name); + 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 == IMGBUILD_INVALID_INSTANCEID) { - MY_INF("\t After SBE single ring call, Instance %d is invalid \n", - io_instanceId ); + if(i_dbgl > 0) + { + MY_INF("\t After SBE single ring call, Instance %d is invalid \n", + io_instanceId ); + } + return rc; } else if ( rc == IMGBUILD_TGR_RING_AVAILABLE_IN_RINGSECTION) { - MY_INF("\t After SBE single ring call, Ring container is available in the image \n"); + 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 == IMGBUILD_TGR_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; + } + if(i_dbgl > 1) { @@ -1793,7 +1906,9 @@ int tor_access_ring( void* io_ringBlockSize ); } } - else if (i_PpeType == CME) + else if (i_PpeType == CME && + ( i_magic == P9_XIP_MAGIC_HW || + i_magic == P9_XIP_MAGIC_CME)) { rc = get_ring_from_cme_image ( i_ringSection, i_magic, @@ -1810,19 +1925,41 @@ int tor_access_ring( void* if (rc == IMGBUILD_TGR_RING_NOT_FOUND) { - MY_INF("\t After CME single ring call, %s ring container is not found \n", - RING_PROPERTIES[i_ringId].iv_name); + if(i_dbgl > 0) + { + MY_INF("\t After CME single ring call, %s ring container is not found \n", + RING_PROPERTIES[i_ringId].iv_name); + } + return rc; } else if ( rc == IMGBUILD_INVALID_INSTANCEID) { - MY_INF("\t After CME single ring call, Instance %d is invalid \n", - io_instanceId ); + if(i_dbgl > 0) + { + MY_INF("\t After CME single ring call, Instance %d is invalid \n", + io_instanceId ); + } + return rc; } else if ( rc == IMGBUILD_TGR_RING_AVAILABLE_IN_RINGSECTION) { - MY_INF("\t After CME single ring call, Ring container is available in the image \n"); + if(i_dbgl > 0) + { + MY_INF("\t After CME single ring call, Ring container is available in the image \n"); + } + + return rc; + } + else if ( rc == IMGBUILD_TGR_INVALID_RING_ID) + { + if(i_dbgl > 0) + { + MY_INF("\t After CME single ring call, There is no TOR slot for %s %d\n", + RING_PROPERTIES[i_ringId].iv_name, i_ringId); + } + return rc; } @@ -1832,7 +1969,9 @@ int tor_access_ring( void* io_ringBlockSize ); } } - else if (i_PpeType == SGPE) + else if (i_PpeType == SGPE && + ( i_magic == P9_XIP_MAGIC_HW || + i_magic == P9_XIP_MAGIC_SGPE)) { rc = get_ring_from_sgpe_image ( i_ringSection, i_magic, @@ -1849,19 +1988,41 @@ int tor_access_ring( void* if (rc == IMGBUILD_TGR_RING_NOT_FOUND) { - MY_INF("\t After SGPE single ring call, %s ring container is not found \n", - RING_PROPERTIES[i_ringId].iv_name); + if(i_dbgl > 0) + { + MY_INF("\t After SGPE single ring call, %s ring container is not found \n", + RING_PROPERTIES[i_ringId].iv_name); + } + return rc; } else if ( rc == IMGBUILD_INVALID_INSTANCEID) { - MY_INF("\t After SGPE single ring call, Instance %d is invalid \n", - io_instanceId ); + if(i_dbgl > 0) + { + MY_INF("\t After SGPE single ring call, Instance %d is invalid \n", + io_instanceId ); + } + return rc; } else if ( rc == IMGBUILD_TGR_RING_AVAILABLE_IN_RINGSECTION) { - MY_INF("\t After SGPE single ring call, Ring container is available in the image \n"); + if(i_dbgl > 0) + { + MY_INF("\t After SGPE single ring call, Ring container is available in the image \n"); + } + + return rc; + } + else if ( rc == IMGBUILD_TGR_INVALID_RING_ID) + { + if(i_dbgl > 0) + { + MY_INF("\t After SGPE single ring call, There is no TOR slot for %s %d\n", + RING_PROPERTIES[i_ringId].iv_name, i_ringId); + } + return rc; } diff --git a/src/import/chips/p9/utils/imageProcs/p9_tor.H b/src/import/chips/p9/utils/imageProcs/p9_tor.H index d51061df..a6a2a2fd 100644 --- a/src/import/chips/p9/utils/imageProcs/p9_tor.H +++ b/src/import/chips/p9/utils/imageProcs/p9_tor.H @@ -75,6 +75,7 @@ typedef struct #define IMGBUILD_TGR_IMAGE_DOES_NOT_SUPPORT_DD_LEVEL 12 #define IMGBUILD_TGR_IMAGE_DOES_NOT_SUPPORT_PPE_LEVEL 13 #define IMGBUILD_TGR_RING_AVAILABLE_IN_RINGSECTION 14 // Ring container is already available in ring section +#define IMGBUILD_TGR_BUFFER_TOO_SMALL 15 extern const char* ringVariantName[]; @@ -331,7 +332,7 @@ int tor_access_ring( void* i_ringSection, // Ring address Ptr any of . /// /// \retval non-0 See \ref TOR API RETURN errors int tor_get_single_ring ( void* i_ringSection, - uint64_t i_magic, // Image Magic Number + uint64_t i_magic, // Image Magic Number uint16_t i_ddLevel, RingID i_ringId, PpeType_t i_PpeType, |