summaryrefslogtreecommitdiffstats
path: root/src/import/chips/p9/xip
diff options
context:
space:
mode:
authorClaus Michael Olsen <cmolsen@us.ibm.com>2017-03-30 20:20:23 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-05-11 23:47:35 -0400
commit34ebeedcc0629ca9f15d12fe897fa637a9437856 (patch)
treeed6d51130865e5492ee44527bae79c973553f68e /src/import/chips/p9/xip
parent1d9e28faead307516cee33126d0fb9e49b1cf985 (diff)
downloadtalos-hostboot-34ebeedcc0629ca9f15d12fe897fa637a9437856.tar.gz
talos-hostboot-34ebeedcc0629ca9f15d12fe897fa637a9437856.zip
H-code ddLevel support - Front-end hooks for user and back-end codes.
xip_image.c has been renamed to xip_image.C to take advantage of C++ ability to overload function call arg list to avoid having to introduce additional skinny "xip_dd_get_section" and "xip_dd_append" functions. p9_xip_get_section() and p9_xip_append() APIs have been updated with an additional DD support arg as their last parm. P9XipSection.iv_reserved8[0] converted to iv_ddSupport to enable XIP level knowledge about ddSupport capability of XIP sections. Introduced p9_xip_dd_section_support() that queries a section's iv_ddSupport flag to tell caller true/false about a sections ddLevel support status. Added support in xip_tool.C as follows: - Updated "append" command to accept an optional arg, ddSupport, if section has ddLevel support or not. - Updated "extract" command to accept an optional arg, ddLevel, specifying which ddLevel to extract. - Updated "report" command's listing to show ddLevel support status of sections. Change-Id: I17e1e09d63e894d4f26cb7b324cf10ab784d78a4 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/38666 Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/38668 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>
Diffstat (limited to 'src/import/chips/p9/xip')
-rw-r--r--src/import/chips/p9/xip/p9_xip_image.C (renamed from src/import/chips/p9/xip/p9_xip_image.c)65
-rw-r--r--src/import/chips/p9/xip/p9_xip_image.h52
2 files changed, 109 insertions, 8 deletions
diff --git a/src/import/chips/p9/xip/p9_xip_image.c b/src/import/chips/p9/xip/p9_xip_image.C
index 038e142cd..4e961a986 100644
--- a/src/import/chips/p9/xip/p9_xip_image.c
+++ b/src/import/chips/p9/xip/p9_xip_image.C
@@ -1,7 +1,7 @@
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
-/* $Source: src/import/chips/p9/xip/p9_xip_image.c $ */
+/* $Source: src/import/chips/p9/xip/p9_xip_image.C $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
@@ -49,7 +49,6 @@
#include <string.h>
#include "p9_xip_image.h"
-
////////////////////////////////////////////////////////////////////////////
// Local Functions
////////////////////////////////////////////////////////////////////////////
@@ -391,9 +390,9 @@ xipTranslateSection(P9XipSection* o_dest, const P9XipSection* i_src)
o_dest->iv_offset = htobe32(i_src->iv_offset);
o_dest->iv_size = htobe32(i_src->iv_size);
o_dest->iv_alignment = i_src->iv_alignment;
+ o_dest->iv_ddSupport = i_src->iv_ddSupport;
o_dest->iv_reserved8[0] = 0;
o_dest->iv_reserved8[1] = 0;
- o_dest->iv_reserved8[2] = 0;
#else
if (o_dest != i_src)
@@ -2005,6 +2004,7 @@ p9_xip_image_size(void* io_image, uint32_t* o_size)
}
+#ifdef __PPE__
int
p9_xip_get_section(const void* i_image,
const int i_sectionId,
@@ -2023,6 +2023,33 @@ p9_xip_get_section(const void* i_image,
return rc;
}
+#else
+
+int
+p9_xip_get_section(const void* i_image,
+ const int i_sectionId,
+ P9XipSection* o_hostSection,
+ const uint8_t i_ddLevel)
+{
+ int rc;
+ P9XipSection* imageSection;
+
+ if (i_ddLevel != P9_XIP_UNDEFINED_DDLEVEL)
+ {
+ return P9_XIP_NO_DDLEVEL_SUPPORT;
+ }
+
+ rc = xipGetSectionPointer(i_image, i_sectionId, &imageSection);
+
+ if (!rc)
+ {
+ xipTranslateSection(o_hostSection, imageSection);
+ }
+
+ return rc;
+}
+#endif
+
// If the 'big' TOC is not present, search the mini-TOCs that only index the
// .fixed and .header sections.
@@ -2638,7 +2665,8 @@ p9_xip_delete_section(void* io_image,
(void*)(((uint8_t*)o_imageBuf) + section.iv_offset),
(const uint32_t)section.iv_size,
(const uint32_t)imageSize,
- NULL );
+ NULL,
+ section.iv_ddSupport );
if (rc)
{
@@ -2749,7 +2777,8 @@ p9_xip_append(void* io_image,
const void* i_data,
const uint32_t i_size,
const uint32_t i_allocation,
- uint32_t* o_sectionOffset)
+ uint32_t* o_sectionOffset,
+ uint8_t i_ddSupport)
{
P9XipSection section, initialSection;
int rc, final, restoreOnError;
@@ -2799,7 +2828,6 @@ p9_xip_append(void* io_image,
}
section.iv_offset = xipImageSize(io_image);
-
}
else
{
@@ -2868,6 +2896,8 @@ p9_xip_append(void* io_image,
section.iv_size += i_size;
+ section.iv_ddSupport = i_ddSupport;
+
if (xipPutSection(io_image, i_sectionId, &section) != 0)
{
rc = TRACE_ERROR(P9_XIP_BUG); /* Can't happen */
@@ -3156,3 +3186,26 @@ p9_xip_map_toc(void* io_image,
return rc;
}
+
+
+#ifndef __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)
+{
+ int rc;
+ P9XipSection section;
+
+ rc = p9_xip_get_section(i_image, i_sectionId, &section);
+
+ if (!rc)
+ {
+ o_bDdSupport = (bool)section.iv_ddSupport;
+ }
+
+ 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 9c5c5f5ab..38233c9c3 100644
--- a/src/import/chips/p9/xip/p9_xip_image.h
+++ b/src/import/chips/p9/xip/p9_xip_image.h
@@ -238,6 +238,9 @@ typedef enum {
/// gaurantee that the something will be able to complete any 8-byte load/store.
#define P9_XIP_FINAL_ALIGNMENT 8
+/// Local undefined DD level value.
+#define P9_XIP_UNDEFINED_DDLEVEL (uint8_t)0xff
+
////////////////////////////////////////////////////////////////////////////
// C Definitions
@@ -306,8 +309,12 @@ typedef struct
/// address. Alignment specifications are required to be a power-of-2.
uint8_t iv_alignment;
+ /// Indicate if section has DD-level support. This value must be set
+ /// to either 1 for true or 0 for false (default).
+ uint8_t iv_ddSupport;
+
/// Reserved structure alignment padding; Pad to 12 bytes
- uint8_t iv_reserved8[3];
+ uint8_t iv_reserved8[2];
} P9XipSection;
@@ -683,13 +690,21 @@ p9_xip_image_size(void* i_image, uint32_t* o_size);
/// \param[out] o_hostSection Updated to contain the section table entry
/// translated to host byte order.
///
+/// \param[in] i_ddLevel Specified the DD level of the sub-section within
+/// the XIP section to be extracted.
+///
/// \retval 0 Success
///
/// \retval non-0 See \ref p9_xip_image_errors
int
p9_xip_get_section(const void* i_image,
const int i_sectionId,
+#ifdef __PPE__
P9XipSection* o_hostSection);
+#else
+ P9XipSection* o_hostSection,
+ uint8_t i_ddLevel=P9_XIP_UNDEFINED_DDLEVEL);
+#endif
/// Endian translation of a P9XipHeader object
@@ -1150,6 +1165,9 @@ p9_xip_duplicate_section(const void* i_image,
/// byte of the appended data within the indicated section. This return value
/// is invalid in the event of a non-0 return code.
///
+/// \param[in] i_ddSupport Specifies if the section contains ddLevel sub-
+/// sections (=1) or if it does not have ddLevel support (=0).
+///
/// This API copies data from \a i_data to the end of the indicated \a
/// i_section. The section \a i_section must either be empty, or must be the
/// final (highest address) section in the image. If the section is initially
@@ -1200,7 +1218,8 @@ p9_xip_append(void* io_image,
const void* i_data,
const uint32_t i_size,
const uint32_t i_allocation,
- uint32_t* o_sectionOffset);
+ uint32_t* o_sectionOffset,
+ uint8_t i_ddSupport);
/// Convert a P9-XIP section offset to a relocatable IMAGE address
@@ -1348,6 +1367,27 @@ p9_xip_get_toc(void* i_image,
char** o_strings);
+/// Inform caller if specified sectionId has DD support
+///
+/// \param[in] i_image A pointer to a P9-XIP image in host memory.
+///
+/// \param[in] i_sectionId Identifies the section to be queried. See \ref
+/// p9_xip_sections.
+///
+/// \param[out] o_bDdSupport Updated to contain true or false whether
+/// sectionId has DD support or not.
+///
+/// \retval 0 Success
+///
+/// \retval non-0 See \ref p9_xip_image_errors
+#ifndef __PPE__
+int
+p9_xip_dd_section_support(const void* i_image,
+ const int i_sectionId,
+ bool& o_bDdSupport);
+#endif
+
+
/// \brief Decode a TOC entry from dump file
///
///\param[in] - i_image - seeprom image
@@ -1458,6 +1498,12 @@ p9_xip_decode_toc_dump(void* i_image, void* i_dump,
/// .rings seciton for specific dd level is larger than the allowable size
#define P9_XIP_SBE_DD_SIZE_ERR 19
+/// Specified section has no ddLevel support
+#define P9_XIP_NO_DDLEVEL_SUPPORT 20
+
+/// Specified ddLevel was not found in section
+#define P9_XIP_DDLEVEL_NOT_FOUND 21
+
/// Applications can expand this macro to declare an array of string forms of
/// the error codes if desired.
#define P9_XIP_ERROR_STRINGS(var) \
@@ -1482,6 +1528,8 @@ p9_xip_decode_toc_dump(void* i_image, void* i_dump,
"P9_XIP_NULL_BUFFER", \
"P9_XIP_CANT_RESTORE_IMAGE", \
"P9_XIP_SBE_DD_SIZE_ERR", \
+ "P9_XIP_NO_DDLEVEL_SUPPORT", \
+ "P9_XIP_DDLEVEL_NOT_FOUND", \
}
/// Applications can use this macro to safely index the array of error
OpenPOWER on IntegriCloud