summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorAndres Lugo-Reyes <aalugore@us.ibm.com>2016-10-24 18:02:08 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2016-12-20 00:22:27 -0500
commitbdf8d5b8b6ab68f1882d18b1fad721f465b8aa74 (patch)
treeb8b5eb683ec2c66ae89443516cc57a2d5a5fb8d5 /src/usr
parentc4692b79f73b6867c76d22e608c4a831d69bdb03 (diff)
downloadtalos-hostboot-bdf8d5b8b6ab68f1882d18b1fad721f465b8aa74.tar.gz
talos-hostboot-bdf8d5b8b6ab68f1882d18b1fad721f465b8aa74.zip
P9 Updates for occ communication code
This commit contains updates for p9 OCC communication code to no longer use the deprecated ecmdDataBufferBase class. Change-Id: I96b6be564a6edee1f66099583f030d3b519acb60 Depends-on: I6182163e569ac97f06e3ddfbb69deab90e849de3 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/31876 Reviewed-by: Martin Gloff <mgloff@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Reviewed-by: Christopher J. Cain <cjcain@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/htmgt/htmgt_occ.C11
-rw-r--r--src/usr/htmgt/htmgt_occcmd.C40
-rw-r--r--src/usr/htmgt/occError.C20
-rw-r--r--src/usr/isteps/pm/occAccess.C (renamed from src/usr/occ/occAccess.C)115
-rw-r--r--src/usr/isteps/pm/pm.mk1
5 files changed, 116 insertions, 71 deletions
diff --git a/src/usr/htmgt/htmgt_occ.C b/src/usr/htmgt/htmgt_occ.C
index 173090aab..f15968cad 100644
--- a/src/usr/htmgt/htmgt_occ.C
+++ b/src/usr/htmgt/htmgt_occ.C
@@ -37,11 +37,11 @@
#include <targeting/common/targetservice.H>
#include <console/consoleif.H>
#include <sys/time.h>
-#include <ecmdDataBufferBase.H>
#include <occ/occAccess.H>
#include <occ/occ.H>
#include <occ/occ_common.H>
#include <errl/errludlogregister.H>
+#include <buffer.H>
namespace HTMGT
{
@@ -932,14 +932,17 @@ namespace HTMGT
// Read SRAM response buffer to check for OCC checkpoint
errlHndl_t l_err = NULL;
const uint16_t l_length = 8;
- ecmdDataBufferBase l_buffer(l_length*8); // convert to bits
+
+ fapi2::buffer<uint64_t> l_buffer;
l_err = HBOCC::readSRAM(occ->getTarget(),
OCC_RSP_SRAM_ADDR,
- l_buffer);
+ l_buffer.pointer(),
+ l_length);
if (NULL == l_err)
{
// Check response status for checkpoint (byte 6-7)
- const uint16_t checkpoint = l_buffer.getHalfWord(3);
+ uint16_t checkpoint = 0;
+ l_buffer.extractToRight<48,16>(checkpoint);
if (checkpoint != lastCheckpoint)
{
TMGT_INF("_waitForOccCheckpoint: OCC%d Checkpoint "
diff --git a/src/usr/htmgt/htmgt_occcmd.C b/src/usr/htmgt/htmgt_occcmd.C
index 5d190f7ce..3ba3efcff 100644
--- a/src/usr/htmgt/htmgt_occcmd.C
+++ b/src/usr/htmgt/htmgt_occcmd.C
@@ -43,7 +43,8 @@
#include <errl/errlmanager.H>
#include <stdio.h>
#include <console/consoleif.H>
-
+#include <variable_buffer.H>
+#include <fapi2.H>
namespace HTMGT
{
@@ -794,24 +795,24 @@ namespace HTMGT
#ifdef CONFIG_HTMGT
// Read SRAM to check for exception
// (Exception data not copied into HOMER)
- const uint16_t l_length = 4*KILOBYTE;
- uint8_t l_sram_data[l_length];
- ecmdDataBufferBase l_buffer(l_length*8); // convert to bits
+ const size_t l_length = 4*KILOBYTE;
+
+ fapi2::variable_buffer l_buffer(l_length*8); // convert to bits
+
errlHndl_t l_err = HBOCC::readSRAM(iv_Occ->getTarget(),
- OCC_RSP_SRAM_ADDR,
- l_buffer);
+ OCC_RSP_SRAM_ADDR,
+ reinterpret_cast<uint64_t*>(l_buffer.pointer()),
+ l_length );
if (NULL == l_err)
{
- const uint32_t l_flatSize = l_buffer.flattenSize();
- l_buffer.flatten(l_sram_data, l_flatSize);
- // Skip 8 byte ecmd header
- const uint8_t *sramRspPtr = &l_sram_data[8];
+ auto sramRspPtr = reinterpret_cast<uint8_t*>(l_buffer.pointer());
+ uint32_t l_sramDataLen = l_buffer.getLength<uint8_t>();
// Check buffer status for exception
- if ((l_flatSize >= 3) && (0xE0 == (sramRspPtr[2] & 0xE0)))
+ if ((l_sramDataLen >= 3) && (0xE0 == (sramRspPtr[2] & 0xE0)))
{
const uint8_t exceptionType = sramRspPtr[2];
uint16_t exceptionDataLength = 0;
- if (l_flatSize >= 5)
+ if (l_sramDataLen >= 5)
{
exceptionDataLength = UINT16_GET(&sramRspPtr[3]);
}
@@ -819,9 +820,9 @@ namespace HTMGT
// the data length
uint32_t exceptionLength = OCC_RSP_HDR_LENGTH - 2 +
exceptionDataLength;
- if (exceptionLength > l_flatSize)
+ if (exceptionLength > l_sramDataLen)
{
- exceptionLength = l_flatSize;
+ exceptionLength = l_sramDataLen;
}
TMGT_ERR("handleOccException: OCC%d SRAM has exception"
@@ -896,21 +897,24 @@ namespace HTMGT
// Notify OCC that command is available (via circular buffer)
const uint32_t l_bitsToSend = sizeof(occCircBufferCmd_t) * 8;
- ecmdDataBufferBase l_circ_buffer(l_bitsToSend);
+
const occCircBufferCmd_t tmgtDataWriteAttention =
{
0x10, // sender: HTMGT
0x01, // command: Command Write Attention
{0, 0, 0, 0, 0, 0} // reserved
};
- l_circ_buffer.insert((uint8_t*)&tmgtDataWriteAttention, 0,
- l_bitsToSend);
+
+ fapi2::buffer<uint64_t> l_circ_buffer;
+ l_circ_buffer.insert((*(uint64_t*)&tmgtDataWriteAttention),0, l_bitsToSend);
+
+
if (G_debug_trace & DEBUG_TRACE_VERBOSE)
{
TMGT_INF("writeOccCmd: Calling writeCircularBuffer()");
}
#ifdef CONFIG_HTMGT
- l_err = HBOCC::writeCircularBuffer(iv_Occ->iv_target, l_circ_buffer);
+ l_err = HBOCC::writeCircularBuffer(iv_Occ->iv_target, l_circ_buffer.pointer());
if (NULL != l_err)
{
TMGT_ERR("writeOccCmd: Error writing to OCC Circular Buffer,"
diff --git a/src/usr/htmgt/occError.C b/src/usr/htmgt/occError.C
index 5dc733d99..a83d9b7f7 100644
--- a/src/usr/htmgt/occError.C
+++ b/src/usr/htmgt/occError.C
@@ -29,11 +29,10 @@
#include "occError.H"
#include "htmgt_occcmd.H"
-#include <ecmdDataBufferBase.H>
#include <occ/occAccess.H>
#include <console/consoleif.H>
#include <targeting/targplatutil.H>
-
+#include <variable_buffer.H>
namespace HTMGT
{
@@ -93,19 +92,20 @@ namespace HTMGT
errlHndl_t l_errlHndl = NULL;
// Read data from SRAM (length must be multiple of 8 bytes)
- const uint16_t l_length = (i_length + 8) & 0xFFF8;
- uint8_t l_sram_data[8 + l_length];
- ecmdDataBufferBase l_buffer(l_length*8); // convert to bits
+ const uint16_t l_length = (i_length) & 0xFFF8;
+ fapi2::variable_buffer l_buffer(l_length*8); //convert to bits
// HBOCC is only defined for HTMGT
#ifdef CONFIG_HTMGT
- l_errlHndl = HBOCC::readSRAM(iv_target, i_address, l_buffer);
+ l_errlHndl = HBOCC::readSRAM( iv_target,
+ i_address,
+ reinterpret_cast<uint64_t*>(l_buffer.pointer()),
+ l_length );
#endif
if (NULL == l_errlHndl)
{
- const uint32_t l_flatSize = l_buffer.flattenSize();
- l_buffer.flatten(l_sram_data, l_flatSize);
- // Skip 8 byte ecmd header
- const occErrlEntry_t *l_occElog=(occErrlEntry_t *)&l_sram_data[8];
+
+ const occErrlEntry_t * l_occElog= reinterpret_cast<occErrlEntry_t*>
+ (l_buffer.pointer());
TMGT_BIN("OCC ELOG", l_occElog, 256);
diff --git a/src/usr/occ/occAccess.C b/src/usr/isteps/pm/occAccess.C
index d06a47680..d6cda63ae 100644
--- a/src/usr/occ/occAccess.C
+++ b/src/usr/isteps/pm/occAccess.C
@@ -1,7 +1,7 @@
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
-/* $Source: src/usr/occ/occAccess.C $ */
+/* $Source: src/usr/isteps/pm/occAccess.C $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
@@ -30,19 +30,23 @@
#include <targeting/common/utilFilter.H>
// Fapi
-#include <fapi.H>
-#include <fapiPlatHwpInvoker.H>
+#include <fapi2.H>
+#include <fapi2/plat_hwp_invoker.H>
#include <isteps/hwpf_reasoncodes.H>
// Procedures
-#include <p8_ocb_init.H>
-#include <p8_ocb_indir_setup_linear.H>
-#include <p8_ocb_indir_access.H>
+#include <p9_pm_ocb_init.H>
+#include <p9_pm_ocb_indir_setup_linear.H>
+#include <p9_pm_ocb_indir_access.H>
// Easy macro replace for unit testing
//#define TRACUCOMP(args...) TRACFCOMP(args)
#define TRACUCOMP(args...)
+#define CIRCULAR_OCB_DATA_SIZE 8
+
+
+
namespace HBOCC
{
@@ -52,14 +56,14 @@ namespace HBOCC
errlHndl_t getChipTarget(const TARGETING::Target* i_target,
TARGETING::Target* & o_pChipTarget)
{
- errlHndl_t l_errl = NULL;
+ errlHndl_t l_errl = nullptr;
TARGETING::TYPE l_type = TARGETING::TYPE_NA;
bool l_found = false; //error if no chip target found
uint32_t l_huid = 0xFFFFFFFF; //read for error FFDC
do
{
- if(NULL == i_target) //unexpected error
+ if(nullptr == i_target) //unexpected error
{
TRACFCOMP( g_fapiTd, ERR_MRK"getChipTarget: null target passed");
break; // log and return error
@@ -71,7 +75,7 @@ errlHndl_t getChipTarget(const TARGETING::Target* i_target,
const TARGETING::Target * l_pChipTarget = getParentChip(
const_cast<TARGETING::Target *>(i_target));
o_pChipTarget = const_cast<TARGETING::Target *>(l_pChipTarget);
- if (NULL == o_pChipTarget)
+ if (nullptr == o_pChipTarget)
{
l_huid = i_target->getAttr<TARGETING::ATTR_HUID>();
TRACFCOMP( g_fapiTd, ERR_MRK"getChipTarget:"
@@ -133,17 +137,29 @@ enum accessOCBIndirectCmd
ACCESS_OCB_WRITE_CIRCULAR,
};
+/*
+ * @brief Interface for communicating with the OCC via OCB channels
+ *
+ * @param[in] i_cmd - OCB Command type
+ * @param[in] i_pTarget - The OCC Target
+ * @param[in] i_addr - The address to read from/write to
+ * @param[in/out] io_dataBuf - The input/output buffer
+ * @param[in] i_dataLen - The length of the buffer in bytes
+ *
+ * @return - nullptr on success, error log handle on failure
+ */
errlHndl_t accessOCBIndirectChannel(accessOCBIndirectCmd i_cmd,
- const TARGETING::Target * i_pTarget,
- const uint32_t i_addr,
- ecmdDataBufferBase & io_dataBuf)
+ const TARGETING::Target * i_pTarget,
+ const uint32_t i_addr,
+ uint64_t * io_dataBuf,
+ size_t i_dataLen )
{
- errlHndl_t l_errl = NULL;
+ errlHndl_t l_errl = nullptr;
uint32_t l_len = 0;
- TARGETING::Target* l_pChipTarget = NULL;
+ TARGETING::Target* l_pChipTarget = nullptr;
- uint32_t l_channel = OCB_CHAN0; // OCB channel (0,1,2,3)
- uint32_t l_operation = OCB_GET; // Operation(Get, Put)
+ p9ocb::PM_OCB_CHAN_NUM l_channel = p9ocb::OCB_CHAN0; // OCB channel (0,1,2,3)
+ p9ocb::PM_OCB_ACCESS_OP l_operation = p9ocb::OCB_GET; // Operation(Get, Put)
bool l_ociAddrValid = true; // use oci_address
bool l_setup=true; // set up linear
@@ -154,11 +170,11 @@ errlHndl_t accessOCBIndirectChannel(accessOCBIndirectCmd i_cmd,
case (ACCESS_OCB_READ_LINEAR):
break; // use defaults
case (ACCESS_OCB_WRITE_LINEAR):
- l_operation = OCB_PUT;
+ l_operation = p9ocb::OCB_PUT;
break;
case (ACCESS_OCB_WRITE_CIRCULAR):
- l_channel = OCB_CHAN1;
- l_operation = OCB_PUT;
+ l_channel = p9ocb::OCB_CHAN1;
+ l_operation = p9ocb::OCB_PUT;
l_ociAddrValid = false;
l_setup = false;
break;
@@ -179,16 +195,17 @@ errlHndl_t accessOCBIndirectChannel(accessOCBIndirectCmd i_cmd,
get_huid(l_pChipTarget),
l_pChipTarget->getAttr<TARGETING::ATTR_TYPE>());
- fapi::Target l_fapiTarget(fapi::TARGET_TYPE_PROC_CHIP,
- reinterpret_cast<void *> (l_pChipTarget) );
+ fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> l_fapiTarget( l_pChipTarget );
- // buffer must be multiple of bytes
- if(io_dataBuf.getByteLength()%8 != 0)
+ // buffer must be multiple of 8 bytes
+ if( i_dataLen%8 != 0)
{
+
TRACFCOMP( g_fapiImpTd, ERR_MRK"accessOCBIndirectChannel:"
" Error Improper data size:%d(in bytes),size of data"
" requested to be read is not aligned in size of 8 Bytes",
- io_dataBuf.getByteLength());
+ i_dataLen );
+
/*@
* @errortype
* @moduleid fapi::MOD_ACCESS_OCB_INDIRECT_CHANNEL
@@ -205,7 +222,7 @@ errlHndl_t accessOCBIndirectChannel(accessOCBIndirectCmd i_cmd,
ERRORLOG::ERRL_SEV_UNRECOVERABLE,
fapi::MOD_ACCESS_OCB_INDIRECT_CHANNEL,
fapi::RC_INVALID_DATA_BUFFER_LENGTH,
- io_dataBuf.getByteLength(),
+ i_dataLen,
i_addr,
hbSwError);
break; // return with error
@@ -218,8 +235,15 @@ errlHndl_t accessOCBIndirectChannel(accessOCBIndirectCmd i_cmd,
// b) circular write may need to be set up once
if (l_setup)
{
- FAPI_INVOKE_HWP(l_errl, p8_ocb_indir_setup_linear, l_fapiTarget,
- OCB_CHAN0, OCB_TYPE_LINSTR, i_addr);
+
+ FAPI_INVOKE_HWP( l_errl,
+ p9_pm_ocb_indir_setup_linear,
+ l_fapiTarget,
+ p9ocb::OCB_CHAN0,
+ p9ocb::OCB_TYPE_LINSTR,
+ i_addr );
+
+
if(l_errl)
{
TRACFCOMP( g_fapiImpTd, ERR_MRK"accessOCBIndirectChannel:"
@@ -231,9 +255,17 @@ errlHndl_t accessOCBIndirectChannel(accessOCBIndirectCmd i_cmd,
}
// perform operation
- FAPI_INVOKE_HWP(l_errl, p8_ocb_indir_access, l_fapiTarget,
- l_channel,l_operation,io_dataBuf.getByteLength()/8,
- io_dataBuf,l_len,l_ociAddrValid,i_addr);
+ FAPI_INVOKE_HWP( l_errl,
+ p9_pm_ocb_indir_access,
+ l_fapiTarget,
+ l_channel,
+ l_operation,
+ i_dataLen/8, // Number of 8-byte blocks
+ l_ociAddrValid,
+ i_addr,
+ l_len,
+ io_dataBuf );
+
if(l_errl)
{
TRACFCOMP( g_fapiImpTd, ERR_MRK"accessOCBIndirectChannel:"
@@ -254,38 +286,43 @@ errlHndl_t accessOCBIndirectChannel(accessOCBIndirectCmd i_cmd,
// Read OCC SRAM
errlHndl_t readSRAM(const TARGETING::Target * i_pTarget,
const uint32_t i_addr,
- ecmdDataBufferBase & io_dataBuf)
+ uint64_t * io_dataBuf,
+ size_t i_dataLen )
{
- errlHndl_t l_errl = NULL;
+ errlHndl_t l_errl = nullptr;
l_errl = accessOCBIndirectChannel(ACCESS_OCB_READ_LINEAR,
i_pTarget,
i_addr,
- io_dataBuf);
+ io_dataBuf,
+ i_dataLen );
return l_errl;
}
// Write OCC SRAM
errlHndl_t writeSRAM(const TARGETING::Target * i_pTarget,
const uint32_t i_addr,
- ecmdDataBufferBase & i_dataBuf)
+ uint64_t * i_dataBuf,
+ size_t i_dataLen)
{
- errlHndl_t l_errl = NULL;
+ errlHndl_t l_errl = nullptr;
l_errl = accessOCBIndirectChannel(ACCESS_OCB_WRITE_LINEAR,
i_pTarget,
i_addr,
- i_dataBuf);
+ i_dataBuf,
+ i_dataLen );
return l_errl;
}
// Write OCC Circular Buffer
errlHndl_t writeCircularBuffer(const TARGETING::Target * i_pTarget,
- ecmdDataBufferBase & i_dataBuf)
+ uint64_t * i_dataBuf)
{
- errlHndl_t l_errl = NULL;
+ errlHndl_t l_errl = nullptr;
l_errl = accessOCBIndirectChannel(ACCESS_OCB_WRITE_CIRCULAR,
i_pTarget,
0,
- i_dataBuf);
+ i_dataBuf,
+ CIRCULAR_OCB_DATA_SIZE);
return l_errl;
}
diff --git a/src/usr/isteps/pm/pm.mk b/src/usr/isteps/pm/pm.mk
index 782725a8c..86bb5cca0 100644
--- a/src/usr/isteps/pm/pm.mk
+++ b/src/usr/isteps/pm/pm.mk
@@ -53,6 +53,7 @@ EXTRAINCDIR += ${ROOTPATH}/src/usr/isteps/
#common PM Complex functions between ipl and runtime
OBJS += pm_common.o
+OBJS += occAccess.o
## NOTE: add a new directory onto the vpaths when you add a new HWP
VPATH += ${HWP_PM_PATH} ${HWP_CUST_PATH} ${HWP_ACC_PATH}
OpenPOWER on IntegriCloud