summaryrefslogtreecommitdiffstats
path: root/src/import/chips/p9/procedures/hwp/accessors
diff options
context:
space:
mode:
authorCorey Swenson <cswenson@us.ibm.com>2019-01-25 13:11:27 -0600
committerChristian R. Geddes <crgeddes@us.ibm.com>2019-02-10 22:56:15 -0600
commit99bfd4be9d12b2bb841d89bcab3cbfebb3c6dff0 (patch)
tree80cdf48011a9b2ccf6a694750054d71ff1b6c447 /src/import/chips/p9/procedures/hwp/accessors
parent7315298af82e5975e78e4a9b831bad8986444ccb (diff)
downloadtalos-hostboot-99bfd4be9d12b2bb841d89bcab3cbfebb3c6dff0.tar.gz
talos-hostboot-99bfd4be9d12b2bb841d89bcab3cbfebb3c6dff0.zip
Use virtual address buffer to read mvpd rings
Fragmented memory may prevent mallocing multiple pages when getting mvpd rings in xip_customize. Pass in and use a previously allocated virtual memory buffer instead. Change-Id: I43f70aab7787d2849dca5add6d4a777b5f49b62e CQ:SW451916 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/70937 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> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: Sumit Kumar <sumit_kumar@in.ibm.com> Reviewed-by: Claus M. Olsen <cmolsen@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/70944 Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Diffstat (limited to 'src/import/chips/p9/procedures/hwp/accessors')
-rw-r--r--src/import/chips/p9/procedures/hwp/accessors/p9_get_mvpd_ring.C10
-rw-r--r--src/import/chips/p9/procedures/hwp/accessors/p9_get_mvpd_ring.H15
-rw-r--r--src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.C42
-rw-r--r--src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.H13
4 files changed, 65 insertions, 15 deletions
diff --git a/src/import/chips/p9/procedures/hwp/accessors/p9_get_mvpd_ring.C b/src/import/chips/p9/procedures/hwp/accessors/p9_get_mvpd_ring.C
index 6cb36c88b..22330564c 100644
--- a/src/import/chips/p9/procedures/hwp/accessors/p9_get_mvpd_ring.C
+++ b/src/import/chips/p9/procedures/hwp/accessors/p9_get_mvpd_ring.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2016,2017 */
+/* Contributors Listed Below - COPYRIGHT 2016,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -57,7 +57,9 @@ extern "C"
const uint8_t i_evenOdd,
const RingId_t i_ringId,
uint8_t* o_pRingBuf,
- uint32_t& io_rRingBufsize )
+ uint32_t& io_rRingBufsize,
+ uint8_t* i_pTempBuf,
+ uint32_t i_tempBufsize )
{
fapi2::ReturnCode l_fapirc;
@@ -76,7 +78,9 @@ extern "C"
i_evenOdd,
i_ringId,
o_pRingBuf,
- io_rRingBufsize );
+ io_rRingBufsize,
+ i_pTempBuf,
+ i_tempBufsize );
FAPI_DBG("getMvpdRing: exit rc=0x%x",
diff --git a/src/import/chips/p9/procedures/hwp/accessors/p9_get_mvpd_ring.H b/src/import/chips/p9/procedures/hwp/accessors/p9_get_mvpd_ring.H
index 385cdbe8d..d959eee0e 100644
--- a/src/import/chips/p9/procedures/hwp/accessors/p9_get_mvpd_ring.H
+++ b/src/import/chips/p9/procedures/hwp/accessors/p9_get_mvpd_ring.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2016,2017 */
+/* Contributors Listed Below - COPYRIGHT 2016,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -47,7 +47,9 @@ typedef ReturnCode (*getMvpdRing_FP_t) (
const uint64_t,
const RingId_t,
uint8_t*,
- uint32_t& );
+ uint32_t&,
+ uint8_t*,
+ uint32_t );
extern "C"
{
@@ -88,6 +90,11 @@ extern "C"
* byte x0 CompressedScanData structure (rs4 header)
* byte x0C compressed data (sizeof CompressedScanData is 0x0C)
* byte xNN last byte of compressed data
+ * Optional Parameters
+ * @param i_pTempBuf - pointer to a temp buffer allocated by the caller
+ * and must be large enough to fit the largest
+ * vpd record that contains ring data
+ * @param i_tempBufsize - size of temp buffer that caller has allocated
*
* @return fapi2::ReturnCode - FAPI_RC_SUCCESS if success,
* relevant error code for failure.
@@ -100,7 +107,9 @@ extern "C"
const uint8_t i_evenOdd,
const RingId_t i_ringId,
uint8_t* o_pRingBuf,
- uint32_t& io_rRingBufsize );
+ uint32_t& io_rRingBufsize,
+ uint8_t* i_pTempBuf = nullptr,
+ uint32_t i_tempBufsize = 0 );
}
}
diff --git a/src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.C b/src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.C
index 851e66dd1..2627d5805 100644
--- a/src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.C
+++ b/src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2016,2018 */
+/* Contributors Listed Below - COPYRIGHT 2016,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -193,6 +193,13 @@ extern "C"
* @param[in/out] io_rRingBufsize
* Size of ring buffer
*
+ * @param[in] i_pTempBuf
+ * Pointer to temp buffer
+ *
+ * @param[in] i_TempBufsize
+ * Size of temp buffer, must be large enough to fit the
+ * largest vpd record that contains ring data
+ *
* @note: io_rRingBufsize is only an 'output' for get function.
*
* @return fapi2::ReturnCode
@@ -206,7 +213,9 @@ extern "C"
const uint8_t i_evenOdd,
const RingId_t i_ringId,
uint8_t* o_pRingBuf,
- uint32_t& io_rRingBufsize )
+ uint32_t& io_rRingBufsize,
+ uint8_t* i_pTempBuf,
+ uint32_t i_tempBufsize )
{
fapi2::ReturnCode l_fapirc = fapi2::FAPI2_RC_SUCCESS;
uint32_t l_recordLen = 0;
@@ -274,8 +283,29 @@ extern "C"
FAPI_DBG( "mvpdRingFunc: getMvpdField returned record len=0x%x",
l_recordLen );
- // allocate buffer for the record. Always works
- l_recordBuf = static_cast<uint8_t*>(malloc((size_t)l_recordLen));
+ // use already allocated buffer if available
+ if (i_pTempBuf != nullptr)
+ {
+ // Make sure the record fits into the temp buffer
+ FAPI_ASSERT(l_recordLen <= i_tempBufsize,
+ fapi2::MVPD_INSUFFICIENT_RING_BUFFER_SPACE().
+ set_CHIP_TARGET(i_fapiTarget).
+ set_RING_ID(i_ringId).
+ set_CHIPLET_ID(i_chipletId).
+ set_BUFFER_SIZE(i_tempBufsize).
+ set_RING_SIZE(l_recordLen).
+ set_OCCURRENCE(1),
+ "mvpdRingFuncFindHdr: Not enough temp buffer space to contain record: "
+ "ringId=0x%x, chipletId=0x%x, bufferSize=0x%x, recordLen=0x%x",
+ i_ringId, i_chipletId, i_tempBufsize, l_recordLen );
+
+ l_recordBuf = i_pTempBuf;
+ }
+ // else allocate space for the record buffer
+ else
+ {
+ l_recordBuf = static_cast<uint8_t*>(malloc((size_t)l_recordLen));
+ }
// load ring from MVPD for this target
FAPI_TRY(getMvpdField(i_record,
@@ -368,8 +398,8 @@ extern "C"
// get current error
l_fapirc = fapi2::current_err;
- // unload the repair ring if allocated
- if(l_recordBuf)
+ // free the temp buffer if allocated
+ if((i_pTempBuf == nullptr) && l_recordBuf)
{
free(static_cast<void*>(l_recordBuf));
l_recordBuf = NULL;
diff --git a/src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.H b/src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.H
index 449a684cc..d40f69170 100644
--- a/src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.H
+++ b/src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2016,2017 */
+/* Contributors Listed Below - COPYRIGHT 2016,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -57,7 +57,9 @@ typedef ReturnCode (*mvpdRingFuncs_FP_t) (
const uint64_t,
const RingId_t,
uint8_t*,
- uint32_t& );
+ uint32_t&,
+ uint8_t*,
+ uint32_t );
extern "C"
{
@@ -78,6 +80,9 @@ extern "C"
* @param i_ringId - Ring ID
* @param o_pRingBuf - The buffer to receive or send the ring
* @param io_rRingBufsize - Size of ring / ring buffer
+ * @param i_pTempBuf - Temp buffer, must be large enough to fit the
+ * largest vpd record that contains ring data
+ * @param i_tempBufsize - Size of temp buffer
*
* @return fapi2::ReturnCode - FAPI_RC_SUCCESS if success,
* relevant error code for failure.
@@ -91,7 +96,9 @@ extern "C"
const uint8_t i_evenOdd,
const RingId_t i_ringId,
uint8_t* o_pRingBuf,
- uint32_t& io_rRingBufsize );
+ uint32_t& io_rRingBufsize,
+ uint8_t* i_pTempBuf = nullptr,
+ uint32_t i_tempBufsize = 0 );
} // extern "C"
} // namespace fapi
OpenPOWER on IntegriCloud