diff options
author | Sumit Kumar <sumit_kumar@in.ibm.com> | 2017-07-05 05:37:12 -0500 |
---|---|---|
committer | Sachin Gupta <sgupta2m@in.ibm.com> | 2018-01-23 19:48:04 -0500 |
commit | 9b03db45c424d6edc5698fa74830dc1d432fdfe8 (patch) | |
tree | ff608bac2d069988faadcaf2266870dc623825a0 /src/import/chips/p9/xip | |
parent | 60bbd1a8b644665590dcbe5b79c0ac7e0ece9f9a (diff) | |
download | talos-sbe-9b03db45c424d6edc5698fa74830dc1d432fdfe8.tar.gz talos-sbe-9b03db45c424d6edc5698fa74830dc1d432fdfe8.zip |
Moving DD specific ring coord from TOR to XIP (step 1)
Step 1 - Ensuring backwards compatibility in TOR and XIP APIs to
avoid co-req issue.
- Updated TOR and XIP APIs, xip_tool and ipl_build to handle both
types of DD coordination.
Key_Cronus_Test=XIP_REGRESS
HW-Image-Prereq=51511
- 51511 changes the .rings section DD level packaging. This commit
(42751) prepares the TOR API and associated codes to handle the
new .rings layout while also making the TOR API backwards
compatible to the existing .rings section.
Change-Id: I7d254340808ca9270fc1c96414102794fcffeabe
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/42751
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com>
Tested-by: Cronus HW CI <cronushw-ci+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/43258
Reviewed-by: Hostboot Team <hostboot@us.ibm.com>
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Diffstat (limited to 'src/import/chips/p9/xip')
-rw-r--r-- | src/import/chips/p9/xip/Makefile | 8 | ||||
-rw-r--r-- | src/import/chips/p9/xip/p9_xip_image.C | 75 | ||||
-rw-r--r-- | src/import/chips/p9/xip/p9_xip_image.h | 8 | ||||
-rw-r--r-- | src/import/chips/p9/xip/p9_xip_tool.C | 102 |
4 files changed, 116 insertions, 77 deletions
diff --git a/src/import/chips/p9/xip/Makefile b/src/import/chips/p9/xip/Makefile index 6a5204db..b663367f 100644 --- a/src/import/chips/p9/xip/Makefile +++ b/src/import/chips/p9/xip/Makefile @@ -5,7 +5,7 @@ # # OpenPOWER sbe Project # -# Contributors Listed Below - COPYRIGHT 2015,2017 +# Contributors Listed Below - COPYRIGHT 2015,2018 # [+] International Business Machines Corp. # # @@ -36,6 +36,7 @@ INCLUDES += -I. INCLUDES += -I../../../hwpf/fapi2/include/plat INCLUDES += -I../utils/imageProcs INCLUDES += -I../../common/utils/imageProcs +INCLUDES += -I../../p9/utils/imageProcs ifeq ($(PROJECT_NAME),sbe) XIP_FLAGS+=-D__PPE__ @@ -69,13 +70,16 @@ all: $(OBJ_DIR) $(XIP_EXECUTABLES) $(OBJ_DIR): mkdir -p $(OBJ_DIR) +$(OBJ_DIR)/%.o: $(IMAGEPROCS_P9_SRCDIR)/%.c + $(CXX) $(CXX_FLAGS) $(INCLUDES) $(XIP_FLAGS) -c -o $@ $< + $(OBJ_DIR)/%.o: %.c $(CXX) $(CXX_FLAGS) $(INCLUDES) $(XIP_FLAGS) -c -o $@ $< $(OBJ_DIR)/%.o: %.C $(CXX) $(CXX_FLAGS) $(INCLUDES) $(XIP_FLAGS) -c -o $@ $< -$(OBJ_DIR)/p9_xip_tool: $(OBJ_DIR)/p9_xip_image.o $(OBJ_DIR)/p9_xip_tool.o +$(OBJ_DIR)/p9_xip_tool: $(OBJ_DIR)/p9_xip_image.o $(OBJ_DIR)/p9_xip_tool.o $(OBJ_DIR)/p9_dd_container.o $(CXX) -o $@ $^ clean: diff --git a/src/import/chips/p9/xip/p9_xip_image.C b/src/import/chips/p9/xip/p9_xip_image.C index 874c0417..c7e493c8 100644 --- a/src/import/chips/p9/xip/p9_xip_image.C +++ b/src/import/chips/p9/xip/p9_xip_image.C @@ -45,12 +45,10 @@ #include <stdint.h> #include <endian.h> #endif -#ifndef __PPE__ - #include "p9_dd_container.h" -#endif #include <stdlib.h> #include <string.h> #include "p9_xip_image.h" +#include "p9_dd_container.h" //////////////////////////////////////////////////////////////////////////// // Local Functions @@ -164,7 +162,7 @@ dumpSectionTable(const void* i_image) for (i = 0; i < P9_XIP_SECTIONS; i++) { - rc = p9_xip_get_section(i_image, i, §ion); + rc = p9_xip_get_section(i_image, i, §ion, UNDEFINED_DD_LEVEL); if (rc) { @@ -615,7 +613,7 @@ xipImage2Section(const void* i_image, for (sectionId = 0; sectionId < P9_XIP_SECTIONS; sectionId++) { - rc = p9_xip_get_section(i_image, sectionId, §ion); + rc = p9_xip_get_section(i_image, sectionId, §ion, UNDEFINED_DD_LEVEL); if (rc) { @@ -687,7 +685,7 @@ xipDeleteLastSection(void* io_image, break; } - rc = p9_xip_get_section(io_image, final, §ion); + rc = p9_xip_get_section(io_image, final, §ion, UNDEFINED_DD_LEVEL); if (rc) { @@ -720,7 +718,7 @@ p9_xip_get_toc(void* i_image, do { - rc = p9_xip_get_section(i_image, P9_XIP_SECTION_TOC, &tocSection); + rc = p9_xip_get_section(i_image, P9_XIP_SECTION_TOC, &tocSection, UNDEFINED_DD_LEVEL); if (rc) { @@ -728,7 +726,7 @@ p9_xip_get_toc(void* i_image, } rc = p9_xip_get_section(i_image, P9_XIP_SECTION_STRINGS, - &stringsSection); + &stringsSection, UNDEFINED_DD_LEVEL); if (rc) { @@ -1174,7 +1172,7 @@ xipDecodeToc(void* i_image, o_item->iv_type = hostToc.iv_type; o_item->iv_elements = hostToc.iv_elements; - p9_xip_get_section(i_image, P9_XIP_SECTION_STRINGS, &stringsSection); + p9_xip_get_section(i_image, P9_XIP_SECTION_STRINGS, &stringsSection, UNDEFINED_DD_LEVEL); o_item->iv_id = (char*)i_image + stringsSection.iv_offset + hostToc.iv_id; @@ -1184,7 +1182,7 @@ xipDecodeToc(void* i_image, // even though the section has been removed from the image, so this // case needs to be covered. - rc = p9_xip_get_section(i_image, hostToc.iv_section, &dataSection); + rc = p9_xip_get_section(i_image, hostToc.iv_section, &dataSection, UNDEFINED_DD_LEVEL); if (rc) { @@ -1237,7 +1235,7 @@ p9_xip_decode_toc_dump(void* i_image, void* i_dump, o_item->iv_type = hostToc.iv_type; o_item->iv_elements = hostToc.iv_elements; - p9_xip_get_section(i_image, P9_XIP_SECTION_STRINGS, &stringsSection); + p9_xip_get_section(i_image, P9_XIP_SECTION_STRINGS, &stringsSection, UNDEFINED_DD_LEVEL); o_item->iv_id = (char*)i_image + stringsSection.iv_offset + hostToc.iv_id; @@ -1355,7 +1353,7 @@ xipGetFixedToc(void* io_image, int rc; P9XipSection section; - rc = p9_xip_get_section(io_image, P9_XIP_SECTION_FIXED_TOC, §ion); + rc = p9_xip_get_section(io_image, P9_XIP_SECTION_FIXED_TOC, §ion, UNDEFINED_DD_LEVEL); if (!rc) { @@ -1429,7 +1427,7 @@ xipFixedFind(void* i_image, const char* i_id, P9XipItem* o_item) o_item->iv_type = toc->iv_type; o_item->iv_elements = toc->iv_elements; - rc = p9_xip_get_section(i_image, P9_XIP_SECTION_FIXED, &fixedSection); + rc = p9_xip_get_section(i_image, P9_XIP_SECTION_FIXED, &fixedSection, UNDEFINED_DD_LEVEL); if (rc) { @@ -1541,7 +1539,7 @@ xipHeaderFind(void* i_image, const char* i_id, P9XipItem* o_item) o_item->iv_elements = 1; /* True for now... */ rc = p9_xip_get_section(i_image, P9_XIP_SECTION_HEADER, - &headerSection); + &headerSection, UNDEFINED_DD_LEVEL); if (rc) { @@ -1982,7 +1980,7 @@ p9_xip_normalize(void* io_image) for (i = 0; i < P9_XIP_SECTIONS; i++) { - rc = p9_xip_get_section(io_image, i, §ion); + rc = p9_xip_get_section(io_image, i, §ion, UNDEFINED_DD_LEVEL); if (rc) { @@ -2025,27 +2023,6 @@ p9_xip_image_size(void* io_image, uint32_t* o_size) } -#if defined(__PPE__) -int -p9_xip_get_section(const void* i_image, - const int i_sectionId, - P9XipSection* o_hostSection) -{ - int rc; - P9XipSection* imageSection; - - rc = xipGetSectionPointer(i_image, i_sectionId, &imageSection); - - if (!rc) - { - xipTranslateSection(o_hostSection, imageSection); - } - - return rc; -} - -#else - int p9_xip_get_section(const void* i_image, const int i_sectionId, @@ -2117,7 +2094,6 @@ p9_xip_get_section(const void* i_image, return rc; } -#endif // If the 'big' TOC is not present, search the mini-TOCs that only index the @@ -2623,7 +2599,7 @@ p9_xip_delete_section(void* io_image, // the final section of the image. Update the sizes and re-establish // the final image alignment. - rc = p9_xip_get_section(io_image, i_sectionId, §ion); + rc = p9_xip_get_section(io_image, i_sectionId, §ion, UNDEFINED_DD_LEVEL); if (rc) { @@ -2722,7 +2698,7 @@ p9_xip_delete_section(void* io_image, { orderIdx--; - rc = p9_xip_get_section(o_imageBuf, sectionOrder[orderIdx], §ion); + rc = p9_xip_get_section(o_imageBuf, sectionOrder[orderIdx], §ion, UNDEFINED_DD_LEVEL); if (rc) { @@ -2788,7 +2764,7 @@ p9_xip_duplicate_section(const void* i_image, break; } - rc = p9_xip_get_section(i_image, i_sectionId, §ion); + rc = p9_xip_get_section(i_image, i_sectionId, §ion, UNDEFINED_DD_LEVEL); if (rc) { @@ -2865,7 +2841,7 @@ p9_xip_append(void* io_image, break; } - rc = p9_xip_get_section(io_image, i_sectionId, §ion); + rc = p9_xip_get_section(io_image, i_sectionId, §ion, UNDEFINED_DD_LEVEL); if (rc) { @@ -3016,7 +2992,7 @@ p9_xip_section2image(const void* i_image, break; } - rc = p9_xip_get_section(i_image, i_sectionId, §ion); + rc = p9_xip_get_section(i_image, i_sectionId, §ion, UNDEFINED_DD_LEVEL); if (rc) { @@ -3257,33 +3233,28 @@ p9_xip_map_toc(void* io_image, } -#if !defined(__PPE__) // // Inform caller if specified sectionId has DD support // int p9_xip_dd_section_support(const void* i_image, const int i_sectionId, - bool& o_bDdSupport) + myBoolean_t* o_bDdSupport) { int rc; P9XipSection section; - rc = p9_xip_get_section(i_image, i_sectionId, §ion); + rc = p9_xip_get_section(i_image, i_sectionId, §ion, UNDEFINED_DD_LEVEL); if (!rc) { - if (section.iv_ddSupport == 0 || section.iv_ddSupport == 1) - { - o_bDdSupport = (bool)section.iv_ddSupport; - } - else + *o_bDdSupport = (myBoolean_t)section.iv_ddSupport; + + if (section.iv_ddSupport != true && section.iv_ddSupport != false) { // iv_ddSupport is uninitialized or corrupted - o_bDdSupport = false; rc = P9_XIP_IMAGE_ERROR; } } return rc; } -#endif diff --git a/src/import/chips/p9/xip/p9_xip_image.h b/src/import/chips/p9/xip/p9_xip_image.h index a78befa1..9b139b98 100644 --- a/src/import/chips/p9/xip/p9_xip_image.h +++ b/src/import/chips/p9/xip/p9_xip_image.h @@ -707,10 +707,10 @@ p9_xip_image_size(void* i_image, uint32_t* o_size); int p9_xip_get_section(const void* i_image, const int i_sectionId, + P9XipSection* o_hostSection, #if defined(__PPE__) - P9XipSection* o_hostSection); + uint8_t i_ddLevel); #else - P9XipSection* o_hostSection, uint8_t i_ddLevel=UNDEFINED_DD_LEVEL); #endif @@ -1388,12 +1388,10 @@ p9_xip_get_toc(void* i_image, /// \retval 0 Success /// /// \retval non-0 See \ref p9_xip_image_errors -#if !defined(__PPE__) int p9_xip_dd_section_support(const void* i_image, const int i_sectionId, - bool& o_bDdSupport); -#endif + myBoolean_t* o_bDdSupport); /// \brief Decode a TOC entry from dump file diff --git a/src/import/chips/p9/xip/p9_xip_tool.C b/src/import/chips/p9/xip/p9_xip_tool.C index 48749db3..935867fe 100644 --- a/src/import/chips/p9/xip/p9_xip_tool.C +++ b/src/import/chips/p9/xip/p9_xip_tool.C @@ -576,7 +576,14 @@ dumpHeader(void* i_image, image_section_type_t i_imageSectionType) printf("Chip type : 0x%02x \"%s\"\n", torHeader->chipType, CHIP_TYPE_LIST[torHeader->chipType].name); printf("DD level : 0x%02x\n", torHeader->ddLevel); - printf("Number DD levels : %d\n", torHeader->numDdLevels); +#ifdef TORV3_SUPPORT + + if (torHeader->version < 5) + { + fprintf(stdout, "Number DD levels : %d\n", torHeader->numDdLevels); + } + +#endif printf("Image size : 0x%08x (%d)\n", be32toh(torHeader->size), be32toh(torHeader->size)); @@ -1408,11 +1415,7 @@ extract(const char* i_imageFile, const int i_imageFd, void* io_image, // return a list of supported DD levels. } -#ifdef __PPE__ - rc = p9_xip_get_section( io_image, sectionId, &xDdSection); -#else rc = p9_xip_get_section( io_image, sectionId, &xDdSection, ddLevel); -#endif switch (rc) { @@ -1776,7 +1779,7 @@ TEST(void* io_image, const int i_argc, const char** i_argv) // Try p9_xip_get_section against the translated header p9_xip_translate_header(&header, (P9XipHeader*)io_image); - rc = p9_xip_get_section(io_image, P9_XIP_SECTION_TOC, §ion); + rc = p9_xip_get_section(io_image, P9_XIP_SECTION_TOC, §ion, UNDEFINED_DD_LEVEL); BOMB_IF_RC; BOMB_IF((section.iv_size != header.iv_section[P9_XIP_SECTION_TOC].iv_size)); @@ -1885,15 +1888,18 @@ int dissectRingSectionTor( uint8_t* i_ringSection, RingId_t numRingIds = 0; uint32_t torMagic = 0xffffffff; // Undefined value ChipType_t chipType = UNDEFINED_CHIP_TYPE; +#ifdef TORV3_SUPPORT uint32_t numDdLevels = 0; // Undefined value - uint8_t iDdLevel, ddLevel = UNDEFINED_DD_LEVEL; +#endif + uint8_t iDdLevel; + uint8_t ddLevel = UNDEFINED_DD_LEVEL; PpeType_t ppeType; RingId_t ringId; RingVariant_t ringVariant; uint8_t instanceId; void* ringBlockPtr; uint32_t ringBlockSize; - char ringName[50]; + char ringName[MAX_RING_NAME_LENGTH]; uint32_t ringSeqNo = 0; // Ring sequence number CompressedScanData* rs4 = NULL; CompressedScanData* rs4ForDisplay = NULL; @@ -1912,15 +1918,37 @@ int dissectRingSectionTor( uint8_t* i_ringSection, uint8_t cmskRingIteration = 0; char ringSuffix = ' '; - TorHeader_t* torHeader = reinterpret_cast<TorHeader_t*>(i_ringSection); // // Get TOR header fields // + TorHeader_t* torHeader = reinterpret_cast<TorHeader_t*>(i_ringSection); torMagic = be32toh(torHeader->magic); chipType = torHeader->chipType; ddLevel = torHeader->ddLevel; - numDdLevels = torHeader->numDdLevels; + +#ifdef TORV3_SUPPORT + TorDdBlock_t* torDdBlock = NULL; + + if (torMagic == TOR_MAGIC_HW) + { + if (torHeader->version < 5) + { + numDdLevels = torHeader->numDdLevels; + // move past the tor header to the tor blocks + torDdBlock = reinterpret_cast<TorDdBlock_t*>(i_ringSection + sizeof(TorHeader_t)); + } + else + { + numDdLevels = 1; + } + } + else + { + numDdLevels = 1; + } + +#endif // // Make some ChipType specific data translations @@ -1997,21 +2025,24 @@ int dissectRingSectionTor( uint8_t* i_ringSection, bool bRingsFound = true; bool bPrintHeader = true; - // Needed if TOR_MAGIC_HW - TorDdBlock_t* torDdBlock = reinterpret_cast<TorDdBlock_t*>(i_ringSection + sizeof(TorHeader_t)); - +#ifdef TORV3_SUPPORT //---------------- // DD level loop. for (iDdLevel = 0; iDdLevel < numDdLevels; iDdLevel++) { - if (torMagic == TOR_MAGIC_HW) + if ( torMagic == TOR_MAGIC_HW && torHeader->version < 5 ) { ddLevel = torDdBlock->ddLevel; //point to the next DD block torDdBlock++; } + else + { + ddLevel = torHeader->ddLevel; + } +#endif // assume no rings will be found so on the next loop so we can print // the info bRingsFound = false; @@ -2347,8 +2378,12 @@ int dissectRingSectionTor( uint8_t* i_ringSection, fprintf(stdout, "No rings for DD level: 0x%x\n", ddLevel); } +#ifdef TORV3_SUPPORT + } // End of for(iDdLevel) +#endif + if (i_listingModeId == LMID_TABLE) { fprintf(stdout, "------------------------------------------------------------------------------\n"); @@ -2397,7 +2432,7 @@ dissectRingSection(void* i_image, P9XipHeader hostHeader; P9XipSection hostSection; image_section_type_t l_imageSectionType = IST_UNDEFINED; - bool bEcLvlSupported = false; + myBoolean_t bEcLvlSupported = UNDEFINED_BOOLEAN; void* ringSection = NULL; std::vector<void*>ringSectionPtrs; @@ -2494,7 +2529,13 @@ dissectRingSection(void* i_image, // Determine if XIP section has DD support // - rc = p9_xip_dd_section_support( i_image, sectionId, bEcLvlSupported ); + rc = p9_xip_dd_section_support( i_image, sectionId, &bEcLvlSupported ); + + if (rc) + { + fprintf(stderr, "p9_xip_dd_section_support() failed w/rc=0x%08x (1)\n", (uint32_t)rc ); + exit(EXIT_FAILURE); + } if( bEcLvlSupported ) { @@ -2814,9 +2855,34 @@ int check_sbe_ring_section_size( void* i_hwImage, void** l_blockPtr = NULL; uint32_t l_blockSize = 0; + myBoolean_t l_bDdSupport = UNDEFINED_BOOLEAN; + + // Determine if there's rings dd support + rc = p9_xip_dd_section_support(i_hwImage, P9_XIP_SECTION_HW_RINGS, &l_bDdSupport); + + if (rc) + { + fprintf(stderr, "p9_xip_dd_section_support() failed w/rc=0x%08x (2)\n", (uint32_t)rc ); + return rc; + } - // Get the full .rings section from the HW image - rc = p9_xip_get_section(i_hwImage, P9_XIP_SECTION_HW_RINGS, &l_ringsSection); + if (l_bDdSupport) + { + rc = p9_xip_get_section(i_hwImage, P9_XIP_SECTION_HW_RINGS, &l_ringsSection, i_ddLevel); + + if (rc) + { + fprintf(stderr, "ERROR: p9_xip_get_section() failed w/rc=0x%x while getting " + "DD (=0x%x) specific ring section.\n", + (uint32_t)rc, i_ddLevel); + exit (EXIT_FAILURE); + } + } + else + { + // Get the full .rings section from the HW image + rc = p9_xip_get_section(i_hwImage, P9_XIP_SECTION_HW_RINGS, &l_ringsSection); + } if (!rc) { |