summaryrefslogtreecommitdiffstats
path: root/src/import/tools
diff options
context:
space:
mode:
authorSumit Kumar <sumit_kumar@in.ibm.com>2017-07-05 05:37:12 -0500
committerSachin Gupta <sgupta2m@in.ibm.com>2018-01-23 19:48:04 -0500
commit9b03db45c424d6edc5698fa74830dc1d432fdfe8 (patch)
treeff608bac2d069988faadcaf2266870dc623825a0 /src/import/tools
parent60bbd1a8b644665590dcbe5b79c0ac7e0ece9f9a (diff)
downloadtalos-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/tools')
-rw-r--r--src/import/tools/imageProcs/p9_ipl_build.C144
-rw-r--r--src/import/tools/imageProcs/p9_ipl_build.H9
2 files changed, 88 insertions, 65 deletions
diff --git a/src/import/tools/imageProcs/p9_ipl_build.C b/src/import/tools/imageProcs/p9_ipl_build.C
index 48d277a1..7e742ddc 100644
--- a/src/import/tools/imageProcs/p9_ipl_build.C
+++ b/src/import/tools/imageProcs/p9_ipl_build.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER sbe Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2016,2017 */
+/* Contributors Listed Below - COPYRIGHT 2016,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -74,83 +74,105 @@ int get_dd_level_rings_from_hw_image( char* i_hwImage,
P9XipSection l_ringsSection;
*o_ringBlock = NULL;
o_blockSize = 0;
+ myBoolean_t l_bDdSupport = UNDEFINED_BOOLEAN;
- // Get the block of rings from the HW image
- rc = p9_xip_get_section(i_hwImage, P9_XIP_SECTION_HW_RINGS, &l_ringsSection);
+ // Determine if there's rings dd support
+ rc = p9_xip_dd_section_support(i_hwImage, P9_XIP_SECTION_HW_RINGS, &l_bDdSupport);
if (rc)
{
- MY_ERR("Call to p9_xip_get_section ID(%d) failed rc=%d\n", P9_XIP_SECTION_HW_RINGS, rc);
- rc = IMGBUILD_ERR_GET_SECTION;
+ MY_ERR("p9_xip_dd_section_support() failed w/rc=0x%08x.\n", (uint32_t)rc );
+ rc = IMGBUILD_ERR_XIP_DD_SUPPORT;
+ return rc;
}
- else
+
+ if (l_bDdSupport)
{
- // Check if any content in .rings
- if (l_ringsSection.iv_size == 0)
+ rc = p9_xip_get_section(i_hwImage, P9_XIP_SECTION_HW_RINGS, &l_ringsSection, i_ddLevel);
+
+ if (rc)
{
- MY_ERR("Ring section size in HW image is zero. No TOR. We need rings here.\n");
- rc = IMGBUILD_EMPTY_RING_SECTION;
+ MY_ERR("ERROR: error getting dd (=%x) specific ring section w/rc=0x%08x.\n",
+ i_ddLevel, (uint32_t)rc);
+ rc = IMGBUILD_ERR_XIP_GET_SECTION;
return rc;
}
+ }
+ else
+ {
+ // Get the block of rings from the HW image
+ rc = p9_xip_get_section(i_hwImage, P9_XIP_SECTION_HW_RINGS, &l_ringsSection);
- // Make a pointer to the start of the rings section
- void* ringsSection = i_hwImage + l_ringsSection.iv_offset;
-
- do
+ if (rc)
{
+ MY_ERR("Call to p9_xip_get_section ID(%d) failed rc=%d\n", P9_XIP_SECTION_HW_RINGS, rc);
+ rc = IMGBUILD_ERR_XIP_GET_SECTION;
+ return rc;
+ }
+ }
- // Call the first time to get a size of the pending section
- rc = tor_get_block_of_rings( ringsSection,
- i_ddLevel,
- PT_SBE,
- NOT_VALID,
- o_ringBlock,
- o_blockSize );
+ // Check if any content in .rings
+ if (l_ringsSection.iv_size == 0)
+ {
+ MY_ERR("Ring section size in HW image is zero. No TOR. We need rings here.\n");
+ rc = IMGBUILD_EMPTY_RING_SECTION;
+ return rc;
+ }
- if(rc)
- {
- MY_ERR("error calling tor API rc = %d\n", rc);
- rc = IMGBUILD_ERR_SECTION_SIZING;
- break;
- }
+ // Make a pointer to the start of the rings section
+ void* ringsSection = i_hwImage + l_ringsSection.iv_offset;
- if( o_blockSize == 0 )
- {
- rc = IMGBUILD_NO_RINGS_FOUND;
- MY_INF("No rings for dd_level %#02x found\n", i_ddLevel);
- break;
- }
+ // Call the first time to get a size of the pending section
+ rc = tor_get_block_of_rings( ringsSection,
+ i_ddLevel,
+ PT_SBE,
+ NOT_VALID,
+ o_ringBlock,
+ o_blockSize );
- // *o_ringBlock is freed by caller
- *o_ringBlock = malloc(o_blockSize);
+ if(rc)
+ {
+ MY_ERR("error calling tor API rc = %d\n", rc);
+ rc = IMGBUILD_ERR_SECTION_SIZING;
+ return rc;
+ }
- if (o_ringBlock != NULL)
- {
- rc = tor_get_block_of_rings( ringsSection,
- i_ddLevel,
- PT_SBE,
- NOT_VALID,
- o_ringBlock,
- o_blockSize );
-
- if(rc)
- {
- MY_ERR("error calling tor API rc = %d\n", rc);
- rc = IMGBUILD_ERR_RING_SEARCH;
- }
- }
- else
- {
- MY_ERR("failed to allocate memory for ring block\n");
- rc = IMGBUILD_ERR_MEMORY;
- }
+ if( o_blockSize == 0 )
+ {
+ rc = IMGBUILD_NO_RINGS_FOUND;
+ MY_INF("No rings for dd_level %#02x found\n", i_ddLevel);
+ return rc;
+ }
- MY_DBG("o_blockSize = %d\n", o_blockSize);
- MY_DBG("o_ringBlock = %p\n", o_ringBlock);
+ // *o_ringBlock is freed by caller of this function
+ *o_ringBlock = malloc(o_blockSize);
+ if (*o_ringBlock != NULL)
+ {
+ rc = tor_get_block_of_rings( ringsSection,
+ i_ddLevel,
+ PT_SBE,
+ NOT_VALID,
+ o_ringBlock,
+ o_blockSize );
+
+ if(rc)
+ {
+ MY_ERR("error calling tor API rc = %d\n", rc);
+ free(*o_ringBlock);
+ rc = IMGBUILD_ERR_RING_SEARCH;
+ return rc;
}
- while(0);
}
+ else
+ {
+ MY_ERR("failed to allocate memory for ring block\n");
+ rc = IMGBUILD_ERR_MEMORY;
+ return rc;
+ }
+
+ MY_DBG("o_blockSize = %d\n", o_blockSize);
+ MY_DBG("*o_ringBlock = %p\n", *o_ringBlock);
return rc;
};
@@ -192,7 +214,7 @@ int append_ring_block_to_image( char* io_sbeImage,
if(rc)
{
MY_ERR("error appending ring section = %d\n", rc);
- rc = IMGBUILD_ERR_APPEND;
+ rc = IMGBUILD_ERR_XIP_APPEND;
}
MY_DBG("i_ringBlock = %p\n", i_ringBlock);
@@ -261,7 +283,7 @@ int ipl_build( char* i_fnSbeImage,
if(rc)
{
MY_ERR("The SBE image failed validation w/rc = %d", rc);
- rc = IMGBUILD_INVALID_IMAGE;
+ rc = IMGBUILD_XIP_INVALID_IMAGE;
break;
}
@@ -394,7 +416,7 @@ int main( int argc, char* argv[])
if (rc)
{
MY_ERR("p9_xip_validate() of HW image failed: rc=%d\n", rc);
- rc = IMGBUILD_INVALID_IMAGE;
+ rc = IMGBUILD_XIP_INVALID_IMAGE;
break;
}
diff --git a/src/import/tools/imageProcs/p9_ipl_build.H b/src/import/tools/imageProcs/p9_ipl_build.H
index 3d67c4b7..3f251673 100644
--- a/src/import/tools/imageProcs/p9_ipl_build.H
+++ b/src/import/tools/imageProcs/p9_ipl_build.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER sbe Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2016 */
+/* Contributors Listed Below - COPYRIGHT 2016,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -34,10 +34,11 @@
#define IMGBUILD_NO_RINGS_FOUND 5 // Successful img build but no rings found.
#define IMGBUILD_EMPTY_RING_SECTION 6 // Successful img build but empty ring section.
#define IMGBUILD_ERR_MEMORY 7 // Memory allocation error.
-#define IMGBUILD_INVALID_IMAGE 10 // Invalid image.
+#define IMGBUILD_XIP_INVALID_IMAGE 10 // Invalid image.
#define IMGBUILD_ERR_RING_SEARCH 33 // Err assoc w/ring retrieval.
-#define IMGBUILD_ERR_GET_SECTION 49 // Err assoc w/getting section ID.
+#define IMGBUILD_ERR_XIP_GET_SECTION 49 // Err assoc w/getting section ID.
#define IMGBUILD_ERR_SECTION_SIZING 48 // Err assoc w/section sizing.
-#define IMGBUILD_ERR_APPEND 51 // Err assoc w/appending to ELF section.
+#define IMGBUILD_ERR_XIP_APPEND 51 // Err assoc w/appending to XIP section.
+#define IMGBUILD_ERR_XIP_DD_SUPPORT 52 // Err assoc w/getting dd section ID.
#endif
OpenPOWER on IntegriCloud