diff options
author | Claus Michael Olsen <cmolsen@us.ibm.com> | 2016-08-10 15:13:32 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2016-08-25 14:32:53 -0400 |
commit | 415947b1acb37d65b4c9ffe0730fa8080fba3095 (patch) | |
tree | 311bbb350fba9a81075d6c4c273cfd89213316cd /src/import/chips/p9/xip/p9_xip_image.h | |
parent | 1ab9096d45f5ec40748d38c6608bb0323122eaf5 (diff) | |
download | talos-hostboot-415947b1acb37d65b4c9ffe0730fa8080fba3095.tar.gz talos-hostboot-415947b1acb37d65b4c9ffe0730fa8080fba3095.zip |
p9_xip_delete_section: Modified API
This API has been updated to remove any random section, not just the
last section.
Also, an update has been made to p9_xip_tool, which uses this API.
Change-Id: I0acdcd24d860093322cf13abf98511032e5b3eb1
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/28125
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: Prachi Gupta <pragupta@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/28131
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/import/chips/p9/xip/p9_xip_image.h')
-rw-r--r-- | src/import/chips/p9/xip/p9_xip_image.h | 47 |
1 files changed, 37 insertions, 10 deletions
diff --git a/src/import/chips/p9/xip/p9_xip_image.h b/src/import/chips/p9/xip/p9_xip_image.h index e8e0b7fb3..d0ac71dfd 100644 --- a/src/import/chips/p9/xip/p9_xip_image.h +++ b/src/import/chips/p9/xip/p9_xip_image.h @@ -1035,23 +1035,38 @@ p9_xip_find(void* i_image, -/// Delete a section from a P9-XIP image in host memory +/// Delete any section, except .header, from a P9-XIP image in host memory, +/// even in-between sections, i.e. non-final sections. /// /// \param[in,out] io_image A pointer to a P9-XIP image in host memory. The /// image is assumed to be consistent with the information contained in the /// header regarding the presence of and sizes of all sections. The image is -/// also required to have been normalized. +/// also required to have been normalized. In case of failure in this +/// funtion, the io_image will get restored to its input value. +/// +/// \param[out] o_imageBuf A pointer to a pre-allocated buffer that MUST +/// BE greater than or equal to the size of the \a io_image. The size of +/// this buffer must be supplied in \a i_imageBufSize. If \a o_imageBuf +/// is NULL, the supplied \a i_sectionId must be the final section in the +/// image or this function will fail at deleting the section. On return +/// from this function, o_imageBuf contains a copy of the initial input +/// image \a io_image, but only if it's a valid buffer. +/// +/// \param[in] i_imageBufSize The size of \a o_imageBuf buffer. It MUST +/// BE greater than or equal to the size of \a io_image. However, if \a +/// o_imageBuf is NULL, then this arg is ignored. /// /// \param[in] i_sectionId Identifies the section to be deleted. See \ref /// p9_xip_sections. /// /// This API effectively deletes a section from a P9-XIP image held in host -/// memory. Unless the requested section \a i_section is already empty, only -/// the final (highest address offset) section of the image may be deleted. -/// Deleting the final section of the image means that the section size is set -/// to 0, and the size of the image recorded in the header is reduced by the -/// section size. Any alignment padding of the now-last section is also -/// removed. +/// memory. Deleting a section of the image means that the section size is +/// set to 0, and the size of the image recorded in the header is reduced by +/// the section size. Any alignment padding of the in-between section is +/// also handled, i.e. removed if final section and re-applied upon +/// re-appending sections. In the special case where \a o_imageBuf is +/// NULL, unless the requested \a i_sectionId is already empty, only the final +/// section (highest address offset) of the image may be deleted. /// /// \note This API does not check for or warn if other sections in the image /// reference the deleted section. @@ -1060,7 +1075,11 @@ p9_xip_find(void* i_image, /// /// \retval non-0 See \ref p9_xip_image_errors int -p9_xip_delete_section(void* io_image, const int i_sectionId); +p9_xip_delete_section(void* io_image, + void* o_imageBuf, + const uint32_t i_imageBufSize, + const int i_sectionId); + #ifndef PPC_HYP @@ -1422,9 +1441,15 @@ p9_xip_decode_toc_dump(void* i_image, void* i_dump, /// Error associated with the disassembler occured. #define P9_XIP_DISASSEMBLER_ERROR 15 -/// hash collision creating the .fixed_toc section +/// Hash collision creating the .fixed_toc section #define P9_XIP_HASH_COLLISION 16 +/// Invalid buffer. It had a NULL ptr. +#define P9_XIP_NULL_BUFFER 17 + +/// Image has been broken and unable to restore original image. +#define P9_XIP_CANT_RESTORE_IMAGE 18 + /// Applications can expand this macro to declare an array of string forms of /// the error codes if desired. #define P9_XIP_ERROR_STRINGS(var) \ @@ -1446,6 +1471,8 @@ p9_xip_decode_toc_dump(void* i_image, void* i_dump, "P9_XIP_WOULD_OVERFLOW", \ "P9_XIP_DISASSEMBLER_ERROR", \ "P9_XIP_HASH_COLLISION", \ + "P9_XIP_NULL_BUFFER", \ + "P9_XIP_CANT_RESTORE_IMAGE", \ } /// Applications can use this macro to safely index the array of error |