diff options
author | Martin Peschke <mpeschke@de.ibm.com> | 2016-05-31 12:18:29 +0200 |
---|---|---|
committer | Sachin Gupta <sgupta2m@in.ibm.com> | 2016-09-26 02:34:06 -0400 |
commit | ef6305bd585d3115d9e51e138cbd3e0e18d844c3 (patch) | |
tree | 07a2ba5516e19b706a02c1074b40ed4d8b682db7 /src/import/chips/p9/utils/imageProcs/p9_tor.C | |
parent | 24b6a5ce571e5ff5070b9d55c9b03a80ee2db5c4 (diff) | |
download | talos-sbe-ef6305bd585d3115d9e51e138cbd3e0e18d844c3.tar.gz talos-sbe-ef6305bd585d3115d9e51e138cbd3e0e18d844c3.zip |
p9_tor: cleaning up endianess conversion
Use system header endian.h routines to do endianess conversion
instead of own routines.
Change-Id: Ic9ffaf1bca6cf0d7a50715853b4ee72d68272cb7
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/24899
Tested-by: Jenkins Server
Reviewed-by: Claus M. Olsen <cmolsen@us.ibm.com>
Reviewed-by: Richard J. Knight <rjknight@us.ibm.com>
Reviewed-by: Martin Peschke <mpeschke@de.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/30239
Tested-by: Jenkins Server <pfd-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 | 105 |
1 files changed, 54 insertions, 51 deletions
diff --git a/src/import/chips/p9/utils/imageProcs/p9_tor.C b/src/import/chips/p9/utils/imageProcs/p9_tor.C index 4b0182fc..fc2002a3 100644 --- a/src/import/chips/p9/utils/imageProcs/p9_tor.C +++ b/src/import/chips/p9/utils/imageProcs/p9_tor.C @@ -22,6 +22,9 @@ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ + +#include <endian.h> + // IMPORTANT notice on usage of io_RingType and io_instanceId arguments // // io_RingTyp @@ -92,13 +95,13 @@ int get_ring_from_sbe_image ( void* i_ringSectionPtr, // Image pointer if (i_magic == P9_XIP_MAGIC_HW) { sbe_offset = *((uint32_t*)i_ringSectionPtr + temp); - temp = myRev32(sbe_offset); + temp = htobe32(sbe_offset); } else if (i_magic == P9_XIP_MAGIC_SEEPROM) { sbe_offset = 0; i_ddLevel = 0; - temp = myRev32(sbe_offset); + temp = htobe32(sbe_offset); } // Looper for each SBE chiplet @@ -233,18 +236,18 @@ int get_ring_from_sbe_image ( void* i_ringSectionPtr, // Image pointer int var = l * 8 + i_ddLevel + temp; int temp1 = var / 4; ring_offset = *((uint32_t*)i_ringSectionPtr + temp1); - ring_offset = myRev32(ring_offset); + ring_offset = htobe32(ring_offset); var = ring_offset + i_ddLevel + temp; temp1 = var / 2 + local; chiplet_offset = *((uint16_t*)i_ringSectionPtr + temp1); - chiplet_offset = myRev16(chiplet_offset); + chiplet_offset = htobe16(chiplet_offset); if(i_RingBlockType == SINGLE_RING) { var = ring_offset + (chiplet_offset - 8) + i_ddLevel + temp; temp1 = var / 4; next_ring_offset = *((uint32_t*)i_ringSectionPtr + temp1); - next_ring_offset = myRev32(next_ring_offset); + next_ring_offset = htobe32(next_ring_offset); ringSize = next_ring_offset; io_RingType = COMMON; @@ -291,7 +294,7 @@ int get_ring_from_sbe_image ( void* i_ringSectionPtr, // Image pointer for (uint32_t m = 0; m < ringSize / 4; m++) { - printf("compressed data %d --- %08x \t", m, myRev32(deltaRingRS4_4B[m])); + printf("compressed data %d --- %08x \t", m, htobe32(deltaRingRS4_4B[m])); } printf("\n"); @@ -339,18 +342,18 @@ int get_ring_from_sbe_image ( void* i_ringSectionPtr, // Image pointer uint32_t var = l * 8 + i_ddLevel + temp + 4; int temp1 = var / 4; ring_offset = *((uint32_t*)i_ringSectionPtr + temp1); - ring_offset = myRev32(ring_offset); + ring_offset = htobe32(ring_offset); var = ring_offset + i_ddLevel + temp; temp1 = var / 2 + local; chiplet_offset = *((uint16_t*)i_ringSectionPtr + temp1); - chiplet_offset = myRev16(chiplet_offset); + chiplet_offset = htobe16(chiplet_offset); if(i_RingBlockType == SINGLE_RING) { var = ring_offset + (chiplet_offset - 8) + i_ddLevel + temp; temp1 = var / 4; next_ring_offset = *((uint32_t*)i_ringSectionPtr + temp1); - next_ring_offset = myRev32(next_ring_offset); + next_ring_offset = htobe32(next_ring_offset); ringSize = next_ring_offset; io_RingType = INSTANCE; @@ -394,7 +397,7 @@ int get_ring_from_sbe_image ( void* i_ringSectionPtr, // Image pointer for (uint32_t m = 0; m < ringSize / 4; m++) { printf("compressed data %d --- %08x \t", - m, myRev32(deltaRingRS4_4B[m])); + m, htobe32(deltaRingRS4_4B[m])); } printf("\n"); @@ -459,7 +462,7 @@ int get_ring_from_sgpe_image ( void* int temp = (i_ddLevel >> 2) + 4; uint32_t* deltaRingRS4_4B; uint32_t spge_offset = *((uint32_t*)i_ringSectionPtr + temp); - temp = myRev32(spge_offset); + temp = htobe32(spge_offset); GenRingIdList* ring_id_list_common = NULL; GenRingIdList* ring_id_list_instance = NULL; uint8_t iv_num_variant = (uint8_t)sizeof(EQ::RingVariants) / sizeof(uint16_t); @@ -485,18 +488,18 @@ int get_ring_from_sgpe_image ( void* int var = 0 + i_ddLevel + temp; int temp1 = var / 4; ring_offset = *((uint32_t*)i_ringSectionPtr + temp1); - ring_offset = myRev32(ring_offset); + ring_offset = htobe32(ring_offset); var = ring_offset + i_ddLevel + temp; temp1 = var / 2 + local; chiplet_offset = *((uint16_t*)i_ringSectionPtr + temp1); - chiplet_offset = myRev16(chiplet_offset); + chiplet_offset = htobe16(chiplet_offset); if (i_RingBlockType == SINGLE_RING) { var = ring_offset + (chiplet_offset - 8) + i_ddLevel + temp; temp1 = var / 4; next_ring_offset = *((uint32_t*)i_ringSectionPtr + temp1); - next_ring_offset = myRev32(next_ring_offset); + next_ring_offset = htobe32(next_ring_offset); ringSize = next_ring_offset; io_RingType = COMMON; @@ -542,7 +545,7 @@ int get_ring_from_sgpe_image ( void* for (uint32_t m = 0; m < ringSize / 4; m++) { - printf("compressed data %d --- %08x \t", m, myRev32(deltaRingRS4_4B[m])); + printf("compressed data %d --- %08x \t", m, htobe32(deltaRingRS4_4B[m])); } printf("\n"); @@ -593,18 +596,18 @@ int get_ring_from_sgpe_image ( void* uint32_t var = 4 + i_ddLevel + temp; int temp1 = var / 4; ring_offset = *((uint32_t*)i_ringSectionPtr + temp1); - ring_offset = myRev32(ring_offset); + ring_offset = htobe32(ring_offset); var = ring_offset + i_ddLevel + temp; temp1 = var / 2 + local; chiplet_offset = *((uint16_t*)i_ringSectionPtr + temp1); - chiplet_offset = myRev16(chiplet_offset); + chiplet_offset = htobe16(chiplet_offset); if (i_RingBlockType == SINGLE_RING) { var = ring_offset + (chiplet_offset - 8) + i_ddLevel + temp; temp1 = var / 4; next_ring_offset = *((uint32_t*)i_ringSectionPtr + temp1); - next_ring_offset = myRev32(next_ring_offset); + next_ring_offset = htobe32(next_ring_offset); ringSize = next_ring_offset; io_RingType = INSTANCE; @@ -648,7 +651,7 @@ int get_ring_from_sgpe_image ( void* for (uint32_t m = 0; m < ringSize / 4; m++) { - printf("compressed data %d --- %08x \t", m, myRev32(deltaRingRS4_4B[m])); + printf("compressed data %d --- %08x \t", m, htobe32(deltaRingRS4_4B[m])); } printf("\n"); @@ -710,7 +713,7 @@ int get_ring_from_cme_image ( void* int temp = (i_ddLevel >> 2) + 2; uint32_t* deltaRingRS4_4B; uint32_t spge_offset = *((uint32_t*)i_ringSectionPtr + temp); - temp = myRev32(spge_offset); + temp = htobe32(spge_offset); GenRingIdList* ring_id_list_common = NULL; GenRingIdList* ring_id_list_instance = NULL; uint8_t iv_num_variant = (uint8_t)sizeof(EC::RingVariants) / sizeof(uint16_t); @@ -736,18 +739,18 @@ int get_ring_from_cme_image ( void* int var = 0 + i_ddLevel + temp; int temp1 = var / 4; ring_offset = *((uint32_t*)i_ringSectionPtr + temp1); - ring_offset = myRev32(ring_offset); + ring_offset = htobe32(ring_offset); var = ring_offset + i_ddLevel + temp; temp1 = var / 2 + local; chiplet_offset = *((uint16_t*)i_ringSectionPtr + temp1); - chiplet_offset = myRev16(chiplet_offset); + chiplet_offset = htobe16(chiplet_offset); if (i_RingBlockType == SINGLE_RING) { var = ring_offset + (chiplet_offset - 8) + i_ddLevel + temp; temp1 = var / 4; next_ring_offset = *((uint32_t*)i_ringSectionPtr + temp1); - next_ring_offset = myRev32(next_ring_offset); + next_ring_offset = htobe32(next_ring_offset); ringSize = next_ring_offset; io_RingType = COMMON; @@ -793,7 +796,7 @@ int get_ring_from_cme_image ( void* for (uint32_t m = 0; m < ringSize / 4; m++) { - printf("compressed data %d --- %08x \t", m, myRev32(deltaRingRS4_4B[m])); + printf("compressed data %d --- %08x \t", m, htobe32(deltaRingRS4_4B[m])); } printf("\n"); @@ -846,18 +849,18 @@ int get_ring_from_cme_image ( void* uint32_t var = z * 4 + i_ddLevel + temp + 4; int temp1 = var / 4; ring_offset = *((uint32_t*)i_ringSectionPtr + temp1); - ring_offset = myRev32(ring_offset); + ring_offset = htobe32(ring_offset); var = ring_offset + i_ddLevel + temp; temp1 = var / 2 + local; chiplet_offset = *((uint16_t*)i_ringSectionPtr + temp1); - chiplet_offset = myRev16(chiplet_offset); + chiplet_offset = htobe16(chiplet_offset); if (i_RingBlockType == SINGLE_RING) { var = ring_offset + (chiplet_offset - 8) + i_ddLevel + temp; temp1 = var / 4; next_ring_offset = *((uint32_t*)i_ringSectionPtr + temp1); - next_ring_offset = myRev32(next_ring_offset); + next_ring_offset = htobe32(next_ring_offset); ringSize = next_ring_offset; io_RingType = INSTANCE; @@ -903,7 +906,7 @@ int get_ring_from_cme_image ( void* for (uint32_t m = 0; m < ringSize / 4; m++) { - printf("compressed data %d --- %08x \t", m, myRev32(deltaRingRS4_4B[m])); + printf("compressed data %d --- %08x \t", m, htobe32(deltaRingRS4_4B[m])); } printf("\n"); @@ -978,7 +981,7 @@ int tor_get_ring( void* if (i_magic == P9_XIP_MAGIC_HW) { ddLevelCount = *((uint32_t*)i_ringSectionPtr + 0); - ddLevelCount = myRev32(ddLevelCount); + ddLevelCount = htobe32(ddLevelCount); if(dbgl > 1) { @@ -989,8 +992,8 @@ int tor_get_ring( void* { local = 2; ddLevelOffset = *((uint32_t*)i_ringSectionPtr + local); - temp = myRev32(ddLevelOffset) >> 24 & 0x000000FF; - ddLevelOffset = myRev32(ddLevelOffset) & 0x00FFFFFF; + temp = htobe32(ddLevelOffset) >> 24 & 0x000000FF; + ddLevelOffset = htobe32(ddLevelOffset) & 0x00FFFFFF; if(dbgl > 1) { @@ -1002,11 +1005,11 @@ int tor_get_ring( void* { ddLevelOffset = *((uint32_t*)i_ringSectionPtr + local); ddLevelOffset = ddLevelOffset & 0xFFFFFF00; - ddLevelOffset = myRev32(ddLevelOffset); + ddLevelOffset = htobe32(ddLevelOffset); ddLevelOffset = ddLevelOffset + 8; local = local + 1; temp1 = *((uint32_t*)i_ringSectionPtr + local); - temp1 = myRev32(temp1); + temp1 = htobe32(temp1); break; } } @@ -1082,9 +1085,9 @@ int tor_get_ring( void* } l_ppe_offset = *((uint32_t*)i_ringSectionPtr + temp); - l_ppe_offset = myRev32(l_ppe_offset); + l_ppe_offset = htobe32(l_ppe_offset); l_ppe_size = *((uint32_t*)i_ringSectionPtr + temp + 1 ); - l_ppe_size = myRev32(l_ppe_size); + l_ppe_size = htobe32(l_ppe_size); } else if (i_PpeType == CME) { @@ -1096,9 +1099,9 @@ int tor_get_ring( void* } l_ppe_offset = *((uint32_t*)i_ringSectionPtr + temp); - l_ppe_offset = myRev32(l_ppe_offset); + l_ppe_offset = htobe32(l_ppe_offset); l_ppe_size = *((uint32_t*)i_ringSectionPtr + temp + 1 ); - l_ppe_size = myRev32(l_ppe_size); + l_ppe_size = htobe32(l_ppe_size); } else if (i_PpeType == SGPE) { @@ -1111,9 +1114,9 @@ int tor_get_ring( void* } l_ppe_offset = *((uint32_t*)i_ringSectionPtr + temp); - l_ppe_offset = myRev32(l_ppe_offset); + l_ppe_offset = htobe32(l_ppe_offset); l_ppe_size = *((uint32_t*)i_ringSectionPtr + temp + 1 ); - l_ppe_size = myRev32(l_ppe_size); + l_ppe_size = htobe32(l_ppe_size); } if (io_ringBlockSize < l_ppe_size) @@ -1254,11 +1257,11 @@ int tor_get_ring( void* printf("SBE(1):Offset 0x%08x \n", l_cplt_offset); } - l_cplt_offset = myRev32(l_cplt_offset); + l_cplt_offset = htobe32(l_cplt_offset); uint32_t l_ppe_cplt_offset = l_cplt_offset; temp = temp + 2; l_ppe_offset = *((uint32_t*)i_ringSectionPtr + temp); - l_ppe_offset = myRev32(l_ppe_offset); + l_ppe_offset = htobe32(l_ppe_offset); temp1 = l_cplt_offset; if(dbgl > 1) @@ -1293,7 +1296,7 @@ int tor_get_ring( void* } l_cplt_offset = *((uint32_t*)i_ringSectionPtr + l_word); - l_cplt_offset = myRev32(l_cplt_offset); + l_cplt_offset = htobe32(l_cplt_offset); l_word++; if(dbgl > 1) @@ -1302,7 +1305,7 @@ int tor_get_ring( void* } l_cplt_size = *((uint32_t*)i_ringSectionPtr + l_word ); - l_cplt_size = myRev32(l_cplt_size); + l_cplt_size = htobe32(l_cplt_size); if(l_sbeTorId == EC_CPLT && io_RingType == INSTANCE) { @@ -1407,11 +1410,11 @@ int tor_get_ring( void* printf("CME(1):ppe type Offset 0x%08x \n", l_cplt_offset); } - l_cplt_offset = myRev32(l_cplt_offset); + l_cplt_offset = htobe32(l_cplt_offset); uint32_t l_ppe_cplt_offset = l_cplt_offset; temp = temp + 2; l_ppe_offset = *((uint32_t*)i_ringSectionPtr + temp); - l_ppe_offset = myRev32(l_ppe_offset); + l_ppe_offset = htobe32(l_ppe_offset); temp1 = l_cplt_offset; if(dbgl > 1) @@ -1446,7 +1449,7 @@ int tor_get_ring( void* } l_cplt_offset = *((uint32_t*)i_ringSectionPtr + l_word); - l_cplt_offset = myRev32(l_cplt_offset); + l_cplt_offset = htobe32(l_cplt_offset); l_word++; if(dbgl > 1) @@ -1455,7 +1458,7 @@ int tor_get_ring( void* } l_cplt_size = *((uint32_t*)i_ringSectionPtr + l_word ); - l_cplt_size = myRev32(l_cplt_size); + l_cplt_size = htobe32(l_cplt_size); if(l_cmeTorId == CME11_CPLT && io_RingType == INSTANCE) { @@ -1486,11 +1489,11 @@ int tor_get_ring( void* printf("SGPE(1):Offset 0x%08x \n", l_cplt_offset); } - l_cplt_offset = myRev32(l_cplt_offset); + l_cplt_offset = htobe32(l_cplt_offset); temp = temp + 1; l_ppe_offset = *((uint32_t*)i_ringSectionPtr + temp); - l_ppe_offset = myRev32(l_ppe_offset); + l_ppe_offset = htobe32(l_ppe_offset); temp1 = l_cplt_offset; if(dbgl > 1) @@ -1525,10 +1528,10 @@ int tor_get_ring( void* } l_cplt_offset = *((uint32_t*)i_ringSectionPtr + l_word); - l_cplt_offset = myRev32(l_cplt_offset); + l_cplt_offset = htobe32(l_cplt_offset); l_word++; l_cplt_size = *((uint32_t*)i_ringSectionPtr + l_word ); - l_cplt_size = myRev32(l_cplt_size); + l_cplt_size = htobe32(l_cplt_size); if( io_RingType == INSTANCE) { |