diff options
author | Claus Michael Olsen <cmolsen@us.ibm.com> | 2017-04-11 16:26:12 -0500 |
---|---|---|
committer | Sachin Gupta <sgupta2m@in.ibm.com> | 2017-04-28 12:18:19 -0400 |
commit | d8c61193eac940a3ac79bbd6d6d1deb1c1b10d38 (patch) | |
tree | d3b8c2a8ec7ed1749ad2c40119b515b97b7bedc2 /src/import/chips/p9/utils/imageProcs/p9_tor.C | |
parent | 70994cede7aa1654e8d9ea959b63a29ba3315d56 (diff) | |
download | talos-sbe-d8c61193eac940a3ac79bbd6d6d1deb1c1b10d38.tar.gz talos-sbe-d8c61193eac940a3ac79bbd6d6d1deb1c1b10d38.zip |
Fixing CME TOR allocation bug in ring_apply and TOR API
RTC172494 - ring_apply currently allocates for 13 CME chiplets
when the CME(s) only handle one chipletType, namely the EC core.
** This will NOT break the lab **
Change-Id: I3ead5727d0306438cd69f0919d7f9ad0cc39a245
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/39130
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com>
Reviewed-by: Sumit Kumar <sumit_kumar@in.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/39133
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.C | 194 |
1 files changed, 96 insertions, 98 deletions
diff --git a/src/import/chips/p9/utils/imageProcs/p9_tor.C b/src/import/chips/p9/utils/imageProcs/p9_tor.C index 7c82fb9e..24d23d97 100644 --- a/src/import/chips/p9/utils/imageProcs/p9_tor.C +++ b/src/import/chips/p9/utils/imageProcs/p9_tor.C @@ -882,142 +882,140 @@ int get_ring_from_cme_image ( void* i_ringSection, // Ring section // Instance specific single ring extract loop local = 0; - for (uint8_t z = 0; z < 12; z++) + for ( uint8_t i = (ring_id_list_instance + 0)->instanceIdMin; + i <= (ring_id_list_instance + 0)->instanceIdMax; + i++ ) { - 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++) + for (uint8_t j = 0; j < EC::g_ecData.iv_num_instance_rings; j++) { - for (uint8_t j = 0; j < EC::g_ecData.iv_num_instance_rings; j++) + for (uint8_t k = 0; k < l_num_variant ; k++) { - for (uint8_t k = 0; k < l_num_variant ; k++) + if (i_dbgl > 2) { - 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); - } + 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, - 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 ) { - if ( io_instanceId >= (ring_id_list_instance + 0)->instanceIdMin - && io_instanceId <= (ring_id_list_instance + 0)->instanceIdMax ) + if ( i == io_instanceId && k == i_RingVariant ) { - 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; + int temp1 = var / CPLT_OFFSET_SIZE; + ring_offset = *((uint32_t*)i_ringSection + temp1); + ring_offset = be32toh(ring_offset); + var = ring_offset + i_ddLevelOffset + temp; + temp1 = var / sizeof(uint16_t) + local; + chiplet_offset = *((uint16_t*)i_ringSection + temp1); + chiplet_offset = be16toh(chiplet_offset); + + if (i_RingBlockType == GET_SINGLE_RING) { - strcpy(o_ringName, RING_PROPERTIES[i_ringId].iv_name); - uint32_t var = z * CPLT_OFFSET_SIZE + i_ddLevelOffset + temp + 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 + temp; - temp1 = var / sizeof(uint16_t) + local; - chiplet_offset = *((uint16_t*)i_ringSection + temp1); - chiplet_offset = be16toh(chiplet_offset); + var = ring_offset + chiplet_offset + i_ddLevelOffset + temp; + ringSize = be16toh( ((CompressedScanData*) + ((uint8_t*)i_ringSection + + var))->iv_size ); + io_RingType = INSTANCE; - if (i_RingBlockType == GET_SINGLE_RING) + if (chiplet_offset) { - var = ring_offset + chiplet_offset + i_ddLevelOffset + temp; - ringSize = be16toh( ((CompressedScanData*) - ((uint8_t*)i_ringSection + - var))->iv_size ); - io_RingType = INSTANCE; - - if (chiplet_offset) + if (io_ringBlockSize == 0) { - 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(" 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("\tio_ringBlockSize is zero. Returning required size.\n"); } - memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + var, - (size_t)ringSize); + io_ringBlockSize = ringSize; - io_ringBlockSize = ringSize; + return TOR_SUCCESS; + } - if (i_dbgl > 0) - { - MY_INF(" After get_ring_from_cme_image Size %d \n", io_ringBlockSize); - } + if (io_ringBlockSize < ringSize) + { + MY_ERR("\tio_ringBlockSize is less than required size.\n"); - 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); - } + return TOR_BUFFER_TOO_SMALL; + } - return TOR_RING_FOUND; + 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); } - else + + memcpy( (uint8_t*)(*io_ringBlockPtr), (uint8_t*)i_ringSection + var, + (size_t)ringSize); + + io_ringBlockSize = ringSize; + + if (i_dbgl > 0) { - if (i_dbgl > 0) - { - MY_INF(" ring container of %s is not found in the CME image container \n", - o_ringName); - } + MY_INF(" After get_ring_from_cme_image Size %d \n", io_ringBlockSize); + } - return TOR_RING_NOT_FOUND; + 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); } + + return TOR_RING_FOUND; } - else if (i_RingBlockType == PUT_SINGLE_RING) + else { - if (chiplet_offset) + if (i_dbgl > 0) { - MY_ERR("Ring container is already present in the CME section \n"); - return TOR_RING_AVAILABLE_IN_RINGSECTION; + MY_INF(" ring container of %s is not found in the CME image container \n", + o_ringName); } - 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; + return TOR_RING_NOT_FOUND; } - else + } + else if (i_RingBlockType == PUT_SINGLE_RING) + { + if (chiplet_offset) { - MY_ERR("Ring block type (i_RingBlockType=%d) is not supported for CME \n", i_RingBlockType); - return TOR_INVALID_RING_BLOCK_TYPE; + 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 - { - if (i_dbgl > 0) + else { - 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); + MY_ERR("Ring block type (i_RingBlockType=%d) is not supported for CME \n", i_RingBlockType); + return TOR_INVALID_RING_BLOCK_TYPE; } - - return TOR_INVALID_INSTANCE_ID; } } + 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); + } - local++; + return TOR_INVALID_INSTANCE_ID; + } } + + local++; } } } |