diff options
author | Martin Peschke <mpeschke@de.ibm.com> | 2017-05-11 08:10:35 +0200 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2017-05-24 22:41:52 -0400 |
commit | acda24ef7c76c0d457a37e02179cf1b0f40cd6ab (patch) | |
tree | c55c47af847d50f99b7625fe52383f561d93eb43 | |
parent | e734170c132ccb53b65d24c5f89955b1250cf150 (diff) | |
download | talos-hostboot-acda24ef7c76c0d457a37e02179cf1b0f40cd6ab.tar.gz talos-hostboot-acda24ef7c76c0d457a37e02179cf1b0f40cd6ab.zip |
H-code ddLevel support: Bridging front-end to back-end.
Further add a small update to xip_image.C to clear the ddSupport
field in XipSection upon deleting a section.
Change-Id: I5a0aa28ac209d8d31a1e30a75389910da366c5f6
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/40046
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Richard J. Knight <rjknight@us.ibm.com>
Reviewed-by: Prem Shanker Jha <premjha2@in.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/40477
Reviewed-by: Hostboot Team <hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
6 files changed, 89 insertions, 14 deletions
diff --git a/src/import/chips/p9/procedures/hwp/customize/p9_xip_customize.mk b/src/import/chips/p9/procedures/hwp/customize/p9_xip_customize.mk index 07bbfc429..fd41524c1 100644 --- a/src/import/chips/p9/procedures/hwp/customize/p9_xip_customize.mk +++ b/src/import/chips/p9/procedures/hwp/customize/p9_xip_customize.mk @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2016 +# Contributors Listed Below - COPYRIGHT 2016,2017 # [+] International Business Machines Corp. # # @@ -30,6 +30,7 @@ lib$(PROCEDURE)_DEPLIBS+=p9_get_mvpd_ring lib$(PROCEDURE)_DEPLIBS+=p9_mvpd_ring_funcs lib$(PROCEDURE)_DEPLIBS+=p9_tor lib$(PROCEDURE)_DEPLIBS+=p9_ringId +lib$(PROCEDURE)_DEPLIBS+=p9_dd_container $(call ADD_MODULE_INCDIR,$(PROCEDURE),$(ROOTPATH)/chips/p9/xip) $(call ADD_MODULE_INCDIR,$(PROCEDURE),$(ROOTPATH)/chips/p9/utils/imageProcs) $(call ADD_MODULE_INCDIR,$(PROCEDURE),$(ROOTPATH)/chips/p9/procedures/hwp/accessors/) diff --git a/src/import/chips/p9/procedures/hwp/customize/p9_xip_section_append.mk b/src/import/chips/p9/procedures/hwp/customize/p9_xip_section_append.mk index 6746d2ff6..9d0655cc9 100644 --- a/src/import/chips/p9/procedures/hwp/customize/p9_xip_section_append.mk +++ b/src/import/chips/p9/procedures/hwp/customize/p9_xip_section_append.mk @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2016 +# Contributors Listed Below - COPYRIGHT 2016,2017 # [+] International Business Machines Corp. # # @@ -24,5 +24,6 @@ # IBM_PROLOG_END_TAG PROCEDURE=p9_xip_section_append lib$(PROCEDURE)_DEPLIBS+=p9_xip_image +lib$(PROCEDURE)_DEPLIBS+=p9_dd_container $(call ADD_MODULE_INCDIR,$(PROCEDURE),$(ROOTPATH)/chips/p9/xip) $(call BUILD_PROCEDURE) diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_hcode_image_build.mk b/src/import/chips/p9/procedures/hwp/pm/p9_hcode_image_build.mk index 3f0957066..33e46efab 100644 --- a/src/import/chips/p9/procedures/hwp/pm/p9_hcode_image_build.mk +++ b/src/import/chips/p9/procedures/hwp/pm/p9_hcode_image_build.mk @@ -41,6 +41,7 @@ lib$(PROCEDURE)_DEPLIBS += p9_ringId lib$(PROCEDURE)_DEPLIBS += p9_stop_util lib$(PROCEDURE)_DEPLIBS += p9_stop_api lib$(PROCEDURE)_DEPLIBS += p9_fbc_utils +lib$(PROCEDURE)_DEPLIBS += p9_dd_container $(call ADD_MODULE_INCDIR,$(PROCEDURE),$(HCODE_UTIL)) $(call BUILD_PROCEDURE) diff --git a/src/import/chips/p9/xip/p9_xip_image.C b/src/import/chips/p9/xip/p9_xip_image.C index 4e961a986..ef57004d8 100644 --- a/src/import/chips/p9/xip/p9_xip_image.C +++ b/src/import/chips/p9/xip/p9_xip_image.C @@ -44,6 +44,9 @@ #else #include <stdint.h> #include <endian.h> + #ifndef __PPE__ + #include "p9_dd_container.h" + #endif #endif #include <stdlib.h> #include <string.h> @@ -555,6 +558,25 @@ xipSetSectionSize(void* io_image, const int i_section, const uint32_t i_size) } +/// Set the properties of a section +// +XIP_STATIC int +xipSetSectionProps(void* io_image, const int i_section, const uint8_t i_props) +{ + P9XipSection* section; + int rc; + + rc = xipGetSectionPointer(io_image, i_section, §ion); + + if (!rc) + { + section->iv_ddSupport = i_props; + } + + return rc; +} + + /// Translate a IMAGE address in the image to a section and offset // We first check to be sure that the IMAGE address is contained in the image, @@ -650,7 +672,7 @@ xipDeleteLastSection(void* io_image, xipSetSectionOffset(io_image, i_sectionId, 0); xipSetSectionSize(io_image, i_sectionId, 0); - + xipSetSectionProps(io_image, i_sectionId, 0); // For cleanliness we also remove any alignment padding that had been // appended between the now-last section and the deleted section, then @@ -2004,7 +2026,7 @@ p9_xip_image_size(void* io_image, uint32_t* o_size) } -#ifdef __PPE__ +#if defined(__PPE__) || defined(WIN32) int p9_xip_get_section(const void* i_image, const int i_sectionId, @@ -2031,14 +2053,9 @@ p9_xip_get_section(const void* i_image, P9XipSection* o_hostSection, const uint8_t i_ddLevel) { - int rc; + int rc = 0; P9XipSection* imageSection; - if (i_ddLevel != P9_XIP_UNDEFINED_DDLEVEL) - { - return P9_XIP_NO_DDLEVEL_SUPPORT; - } - rc = xipGetSectionPointer(i_image, i_sectionId, &imageSection); if (!rc) @@ -2046,6 +2063,55 @@ p9_xip_get_section(const void* i_image, xipTranslateSection(o_hostSection, imageSection); } + if (i_ddLevel == P9_XIP_UNDEFINED_DDLEVEL) + { + //Here we always return the entire XIP section. Nothing more to do. + } + else if (o_hostSection->iv_ddSupport == 1) + { + uint8_t* buf; + uint32_t size; + rc = p9_dd_get( (uint8_t*)i_image + o_hostSection->iv_offset, + i_ddLevel, + &buf, + &size ); + + if (!rc) + { + o_hostSection->iv_offset = (uint32_t)(buf - (uint8_t*)i_image); + o_hostSection->iv_size = size; + o_hostSection->iv_alignment = 0; + o_hostSection->iv_ddSupport = 0; + //@FIXME: In order to inform caller more clearly, we could do this instead + // where the idea is to clear the DD support flag which no longer + // applies and to clear the flag that indicates this section is no + // longer the full/original XIP section. + //o_hostSection->iv_support = o_hostSection->iv_support & ~SECTION_ATTRIBS_DD_SUPP + //o_hostSection->iv_support = o_hostSection->iv_support & ~SECTION_ATTRIBS_XIP_SECTION + } + else + { + switch (rc) + { + case P9_DD_FAILURE_NOT_FOUND: + rc = P9_XIP_DDLEVEL_NOT_FOUND; + break; + + case P9_DD_FAILURE_DOES_NOT_EXIST: + rc = P9_XIP_NULL_BUFFER; + break; + + case P9_DD_FAILURE_BROKEN: + rc = P9_XIP_NO_DDLEVEL_SUPPORT; + break; + + default: + rc = P9_XIP_DDLEVEL_CODE_BUG; + break; + } + } + } + return rc; } #endif @@ -3188,7 +3254,7 @@ p9_xip_map_toc(void* io_image, } -#ifndef __PPE__ +#if !defined(__PPE__) && !defined(WIN32) // // Inform caller if specified sectionId has DD support // diff --git a/src/import/chips/p9/xip/p9_xip_image.h b/src/import/chips/p9/xip/p9_xip_image.h index 38233c9c3..62ef0b859 100644 --- a/src/import/chips/p9/xip/p9_xip_image.h +++ b/src/import/chips/p9/xip/p9_xip_image.h @@ -699,7 +699,7 @@ p9_xip_image_size(void* i_image, uint32_t* o_size); int p9_xip_get_section(const void* i_image, const int i_sectionId, -#ifdef __PPE__ +#if defined(__PPE__) || defined(WIN32) P9XipSection* o_hostSection); #else P9XipSection* o_hostSection, @@ -1380,7 +1380,7 @@ p9_xip_get_toc(void* i_image, /// \retval 0 Success /// /// \retval non-0 See \ref p9_xip_image_errors -#ifndef __PPE__ +#if !defined(__PPE__) && !defined(WIN32) int p9_xip_dd_section_support(const void* i_image, const int i_sectionId, @@ -1504,6 +1504,9 @@ p9_xip_decode_toc_dump(void* i_image, void* i_dump, /// Specified ddLevel was not found in section #define P9_XIP_DDLEVEL_NOT_FOUND 21 +/// Code bug in the ddLevel handling codes +#define P9_XIP_DDLEVEL_CODE_BUG 22 + /// Applications can expand this macro to declare an array of string forms of /// the error codes if desired. #define P9_XIP_ERROR_STRINGS(var) \ @@ -1530,6 +1533,7 @@ p9_xip_decode_toc_dump(void* i_image, void* i_dump, "P9_XIP_SBE_DD_SIZE_ERR", \ "P9_XIP_NO_DDLEVEL_SUPPORT", \ "P9_XIP_DDLEVEL_NOT_FOUND", \ + "P9_XIP_DDLEVEL_CODE_BUG", \ } /// Applications can use this macro to safely index the array of error diff --git a/src/import/chips/p9/xip/p9_xip_image.mk b/src/import/chips/p9/xip/p9_xip_image.mk index d258d6e2b..db02340d3 100644 --- a/src/import/chips/p9/xip/p9_xip_image.mk +++ b/src/import/chips/p9/xip/p9_xip_image.mk @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2016 +# Contributors Listed Below - COPYRIGHT 2016,2017 # [+] International Business Machines Corp. # # @@ -24,5 +24,7 @@ # IBM_PROLOG_END_TAG PROCEDURE = p9_xip_image lib$(PROCEDURE)_COMMONFLAGS += -DDEBUG_P9_XIP_IMAGE=1 +lib$(PROCEDURE)_DEPLIBS += p9_dd_container +$(call ADD_MODULE_INCDIR,$(PROCEDURE),$(ROOTPATH)/chips/p9/utils/imageProcs) $(call BUILD_PROCEDURE) |