summaryrefslogtreecommitdiffstats
path: root/src/import
diff options
context:
space:
mode:
Diffstat (limited to 'src/import')
-rw-r--r--src/import/chips/p9/procedures/hwp/customize/p9_xip_customize.C13
-rw-r--r--src/import/chips/p9/utils/imageProcs/p9_dd_container.c42
-rw-r--r--src/import/chips/p9/utils/imageProcs/p9_dd_container.h23
-rw-r--r--src/import/chips/p9/xip/p9_xip_image.C27
-rw-r--r--src/import/chips/p9/xip/p9_xip_image.h4
5 files changed, 62 insertions, 47 deletions
diff --git a/src/import/chips/p9/procedures/hwp/customize/p9_xip_customize.C b/src/import/chips/p9/procedures/hwp/customize/p9_xip_customize.C
index c30f31ef5..213d83c73 100644
--- a/src/import/chips/p9/procedures/hwp/customize/p9_xip_customize.C
+++ b/src/import/chips/p9/procedures/hwp/customize/p9_xip_customize.C
@@ -1070,17 +1070,18 @@ fapi2::ReturnCode resolve_gptr_overlays(
// Stage 1 & 2 (shared section)
//------------------------------
// Determine if there is GPTR support through MVPD which there will NOT be if
- // - Nimbus DD1, and
- // - XIP DD section does not support overlays
+ // - Nimbus DD1, or
+ // - Overlays XIP ring section does not have DD support (This is a little confusing
+ // but it tells us, indirectly, that there's no Gptr support through Mvpd.)
// First determine if we're on Nimbus < DD20. If we are, continue, else err out.
FAPI_TRY( FAPI_ATTR_GET(ATTR_CHIP_EC_FEATURE_NO_GPTR_SUPPORT_VIA_MVPD,
i_procTarget,
l_nimbusDd1),
- "FAPI_ATTR_GET(ATTR_CHIP_EC_FEATURE_HAS_GPTR_SUPPORT_VIA_MVPD) failed w/rc=0x%08x",
+ "FAPI_ATTR_GET(ATTR_CHIP_EC_FEATURE_NO_GPTR_SUPPORT_VIA_MVPD) failed w/rc=0x%08x",
(uint64_t)current_err );
- // Second determine if there's no overlays support. If no, continue, else err out.
+ // Second determine if there's overlays support in HW image. If no, continue, else err out.
l_rc = p9_xip_dd_section_support(i_hwImage, P9_XIP_SECTION_HW_OVERLAYS, l_bDdSupport);
FAPI_ASSERT( l_rc == INFRASTRUCT_RC_SUCCESS,
@@ -1091,12 +1092,12 @@ fapi2::ReturnCode resolve_gptr_overlays(
"xip_dd_section_support() failed w/rc=0x%08x.\n",
(uint32_t)l_rc );
- // Now do the checks of the above return vars, l_nimbusDd1, l_bDdSupport and l_rc.
+ // Now do the checks of the above return vars, l_nimbusDd1 and l_bDdSupport.
if ( l_nimbusDd1 )
{
*o_overlaysSection = NULL;
o_bGptrMvpdSupport = false;
- FAPI_DBG("There's no Mvpd-GPTR support in Nimbus DD1.");
+ FAPI_DBG("There's no Mvpd-GPTR support on this system. (Probably a Nimbus DD1 system)");
}
else if ( !l_bDdSupport )
{
diff --git a/src/import/chips/p9/utils/imageProcs/p9_dd_container.c b/src/import/chips/p9/utils/imageProcs/p9_dd_container.c
index ebfbc39b5..03530715b 100644
--- a/src/import/chips/p9/utils/imageProcs/p9_dd_container.c
+++ b/src/import/chips/p9/utils/imageProcs/p9_dd_container.c
@@ -23,10 +23,14 @@
/* */
/* IBM_PROLOG_END_TAG */
-#include <stdint.h>
+#ifdef WIN32
+ #include "endian.h"
+#else
+ #include <endian.h>
+#endif
+
#include <stddef.h>
#include <stdlib.h>
-#include <endian.h>
#include <string.h>
#include <stdio.h>
@@ -36,17 +40,17 @@ int p9_dd_validate(struct p9_dd_cont* i_cont)
{
if (!i_cont)
{
- return P9_DD_FAILURE_DOES_NOT_EXIST;
+ return DDCO_DDCO_DOES_NOT_EXIST;
}
- if (be32toh(i_cont->iv_magic) != P9_DD_CONTAINER_MAGIC)
+ if (be32toh(i_cont->iv_magic) != DD_CONTAINER_MAGIC)
{
- return P9_DD_FAILURE_BROKEN;
+ return DDCO_FAILURE_MAGIC_NOT_FOUND;
}
// may want to check here for holes or overlap as to stored blocks
- return P9_DD_SUCCESS;
+ return DDCO_SUCCESS;
}
// iterates through all dd level blocks
@@ -84,14 +88,14 @@ void p9_dd_betoh(struct p9_dd_block* i_block_be,
int p9_dd_get(uint8_t* i_cont, uint8_t i_dd, uint8_t** o_buf, uint32_t* o_size)
{
struct p9_dd_cont* cont = (struct p9_dd_cont*)i_cont;
- struct p9_dd_iter iter = P9_DD_ITER_INIT(cont);
+ struct p9_dd_iter iter = {cont, 0};
struct p9_dd_block* block;
struct p9_dd_block block_he;
int rc;
rc = p9_dd_validate(cont);
- if (rc != P9_DD_SUCCESS)
+ if (rc != DDCO_SUCCESS)
{
return rc;
}
@@ -103,11 +107,11 @@ int p9_dd_get(uint8_t* i_cont, uint8_t i_dd, uint8_t** o_buf, uint32_t* o_size)
p9_dd_betoh(block, &block_he);
*o_buf = p9_dd_addr(cont, block_he.iv_offset);
*o_size = block_he.iv_size;
- return P9_DD_SUCCESS;
+ return DDCO_SUCCESS;
}
}
- return P9_DD_FAILURE_NOT_FOUND;
+ return DDCO_DDLEVEL_NOT_FOUND;
}
uint32_t p9_dd_size_meta(struct p9_dd_cont* i_cont)
@@ -150,7 +154,7 @@ struct p9_dd_cont* p9_dd_create(void)
return cont;
}
- cont->iv_magic = htobe32(P9_DD_CONTAINER_MAGIC);
+ cont->iv_magic = htobe32(DD_CONTAINER_MAGIC);
cont->iv_num = 0;
return cont;
@@ -179,28 +183,28 @@ int p9_dd_add(
uint32_t this_offs;
struct p9_dd_block* this_block;
- struct p9_dd_iter iter = P9_DD_ITER_INIT(NULL);
+ struct p9_dd_iter iter = {NULL, 0};
// handle duplicates and initial setup of empty container
rc = p9_dd_get(*io_cont, i_dd, &dupl_buf, &dupl_size);
switch (rc)
{
- case P9_DD_FAILURE_NOT_FOUND :
+ case DDCO_DDLEVEL_NOT_FOUND :
break;
- case P9_DD_FAILURE_DOES_NOT_EXIST :
+ case DDCO_DDCO_DOES_NOT_EXIST :
cont = p9_dd_create();
if (!cont)
{
- return P9_DD_FAILURE_NOMEM;
+ return DDCO_FAILURE_NOMEM;
}
break;
- case P9_DD_SUCCESS :
- return P9_DD_FAILURE_DUPLICATE;
+ case DDCO_SUCCESS :
+ return DDCO_DUPLICATE_DDLEVEL;
default :
return rc;
@@ -214,7 +218,7 @@ int p9_dd_add(
if (!cont)
{
- return P9_DD_FAILURE_NOMEM;
+ return DDCO_FAILURE_NOMEM;
}
// offsets and size of existing bufs
@@ -258,5 +262,5 @@ int p9_dd_add(
*io_cont = (uint8_t*)cont;
*o_cont_size = enlarged;
- return P9_DD_SUCCESS;
+ return DDCO_SUCCESS;
}
diff --git a/src/import/chips/p9/utils/imageProcs/p9_dd_container.h b/src/import/chips/p9/utils/imageProcs/p9_dd_container.h
index 1eb9ae3be..7116f3c4a 100644
--- a/src/import/chips/p9/utils/imageProcs/p9_dd_container.h
+++ b/src/import/chips/p9/utils/imageProcs/p9_dd_container.h
@@ -26,16 +26,20 @@
#ifndef _P9_DD_CONTAINER_H_
#define _P9_DD_CONTAINER_H_
-#include <stdint.h>
+#ifdef WIN32
+ #include "win32_stdint.h"
+#else
+ #include <stdint.h>
+#endif
-#define P9_DD_CONTAINER_MAGIC 0x4444434F // "DDCO"
+#define DD_CONTAINER_MAGIC 0x4444434F // "DDCO"
-#define P9_DD_SUCCESS 0
-#define P9_DD_FAILURE_BROKEN 1
-#define P9_DD_FAILURE_NOMEM 2
-#define P9_DD_FAILURE_NOT_FOUND 3
-#define P9_DD_FAILURE_DOES_NOT_EXIST 4
-#define P9_DD_FAILURE_DUPLICATE 5
+#define DDCO_SUCCESS 0
+#define DDCO_FAILURE_MAGIC_NOT_FOUND 1
+#define DDCO_FAILURE_NOMEM 2
+#define DDCO_DDLEVEL_NOT_FOUND 3
+#define DDCO_DDCO_DOES_NOT_EXIST 4
+#define DDCO_DUPLICATE_DDLEVEL 5
// header for each dd level block inside container
struct p9_dd_block
@@ -62,9 +66,6 @@ struct p9_dd_iter
uint8_t iv_idx;
};
-// initialisation of iterator
-#define P9_DD_ITER_INIT(dd_cont) { .iv_cont = (dd_cont), .iv_idx = 0 }
-
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/src/import/chips/p9/xip/p9_xip_image.C b/src/import/chips/p9/xip/p9_xip_image.C
index 95905d068..7c109ba4d 100644
--- a/src/import/chips/p9/xip/p9_xip_image.C
+++ b/src/import/chips/p9/xip/p9_xip_image.C
@@ -44,9 +44,9 @@
#else
#include <stdint.h>
#include <endian.h>
- #ifndef __PPE__
- #include "p9_dd_container.h"
- #endif
+#endif
+#ifndef __PPE__
+ #include "p9_dd_container.h"
#endif
#include <stdlib.h>
#include <string.h>
@@ -2025,7 +2025,7 @@ p9_xip_image_size(void* io_image, uint32_t* o_size)
}
-#if defined(__PPE__) || defined(WIN32)
+#if defined(__PPE__)
int
p9_xip_get_section(const void* i_image,
const int i_sectionId,
@@ -2091,15 +2091,15 @@ p9_xip_get_section(const void* i_image,
{
switch (rc)
{
- case P9_DD_FAILURE_NOT_FOUND:
+ case DDCO_DDLEVEL_NOT_FOUND:
rc = P9_XIP_DDLEVEL_NOT_FOUND;
break;
- case P9_DD_FAILURE_DOES_NOT_EXIST:
+ case DDCO_DDCO_DOES_NOT_EXIST:
rc = P9_XIP_NULL_BUFFER;
break;
- case P9_DD_FAILURE_BROKEN:
+ case DDCO_FAILURE_MAGIC_NOT_FOUND:
rc = P9_XIP_NO_DDLEVEL_SUPPORT;
break;
@@ -3257,7 +3257,7 @@ p9_xip_map_toc(void* io_image,
}
-#if !defined(__PPE__) && !defined(WIN32)
+#if !defined(__PPE__)
//
// Inform caller if specified sectionId has DD support
//
@@ -3272,7 +3272,16 @@ int p9_xip_dd_section_support(const void* i_image,
if (!rc)
{
- o_bDdSupport = (bool)section.iv_ddSupport;
+ if (section.iv_ddSupport == 0 || section.iv_ddSupport == 1)
+ {
+ o_bDdSupport = (bool)section.iv_ddSupport;
+ }
+ else
+ {
+ // iv_ddSupport is uninitialized or corrupted
+ o_bDdSupport = false;
+ rc = P9_XIP_IMAGE_ERROR;
+ }
}
return rc;
diff --git a/src/import/chips/p9/xip/p9_xip_image.h b/src/import/chips/p9/xip/p9_xip_image.h
index 838f0276c..dfa20d454 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,
-#if defined(__PPE__) || defined(WIN32)
+#if defined(__PPE__)
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
-#if !defined(__PPE__) && !defined(WIN32)
+#if !defined(__PPE__)
int
p9_xip_dd_section_support(const void* i_image,
const int i_sectionId,
OpenPOWER on IntegriCloud