From 4b56547bd2ed3d823d7f8db980ab96041c829d1c Mon Sep 17 00:00:00 2001 From: Girisankar Paulraj Date: Mon, 29 Aug 2016 00:45:23 -0500 Subject: 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 Tested-by: Hostboot CI Reviewed-by: Kahn C. Evans Reviewed-by: Claus M. Olsen Reviewed-by: GIRISANKAR PAULRAJ Reviewed-by: Prachi Gupta Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/30264 Tested-by: FSP CI Jenkins Reviewed-by: Sachin Gupta --- src/import/chips/p9/utils/imageProcs/p9_tor.C | 241 +++++++++++++++++++++----- 1 file changed, 201 insertions(+), 40 deletions(-) (limited to 'src/import/chips/p9/utils/imageProcs/p9_tor.C') 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; } -- cgit v1.2.1