summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2011-11-29 23:13:02 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2011-12-06 10:18:26 -0600
commitf478f52831aff692d4a5fd31c2991e76e7188284 (patch)
tree9a0d1b0fcf0a0f34fac4f0a2fb960e231fe8cced /src
parentde2d409bf23f3f6bf91d11bcb7e4fa0766af8275 (diff)
downloadtalos-hostboot-f478f52831aff692d4a5fd31c2991e76e7188284.tar.gz
talos-hostboot-f478f52831aff692d4a5fd31c2991e76e7188284.zip
FSI Presence Detect for Proc and MemBuf
Change-Id: I282a764fbfb81cf13cc9d41ee275bafff478d20e Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/519 Tested-by: Jenkins Server Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: ADAM R. MUHLE <armuhle@us.ibm.com> Reviewed-by: Terry J. Opie <opiet@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/include/usr/fsi/fsi_reasoncodes.H5
-rw-r--r--src/usr/fsi/fsipres.C113
-rw-r--r--src/usr/fsi/makefile2
-rw-r--r--src/usr/fsi/test/fsiprestest.H146
4 files changed, 263 insertions, 3 deletions
diff --git a/src/include/usr/fsi/fsi_reasoncodes.H b/src/include/usr/fsi/fsi_reasoncodes.H
index 80539c691..5a079f3f6 100644
--- a/src/include/usr/fsi/fsi_reasoncodes.H
+++ b/src/include/usr/fsi/fsi_reasoncodes.H
@@ -37,18 +37,19 @@ namespace FSI
MOD_FSIDD_DDOP = 0x05, /**< fsidd.C : ddOp */
MOD_FSIDD_POLLFORCOMPLETE = 0x06, /**< fsidd.C : FsiDD::pollForComplete */
MOD_FSIDD_INITPORT = 0x07, /**< fsidd.C : FsiDD::initPort */
+ MOD_FSIPRES_PRESENCEDETECT = 0x08, /**< fsipres.C : presenceDetect */
};
enum FSIReasonCode
{
- RC_INVALID_LENGTH = FSI_COMP_ID | 0x01,
+ RC_INVALID_LENGTH = FSI_COMP_ID | 0x01,
RC_INVALID_ADDRESS = FSI_COMP_ID | 0x02,
RC_OPB_TIMEOUT = FSI_COMP_ID | 0x03,
RC_OPB_ERROR = FSI_COMP_ID | 0x04,
RC_INVALID_TARGET = FSI_COMP_ID | 0x05,
RC_OPB_NO_READ_VALID = FSI_COMP_ID | 0x06,
RC_ERROR_ENABLING_SLAVE = FSI_COMP_ID | 0x07,
- RC_INVALID_OPERATION = FSI_COMP_ID | 0x08,
+ RC_INVALID_OPERATION = FSI_COMP_ID | 0x08,
RC_NULL_TARGET = FSI_COMP_ID | 0x09,
RC_MASTER_TARGET = FSI_COMP_ID | 0x0A,
};
diff --git a/src/usr/fsi/fsipres.C b/src/usr/fsi/fsipres.C
new file mode 100644
index 000000000..c5440cc4e
--- /dev/null
+++ b/src/usr/fsi/fsipres.C
@@ -0,0 +1,113 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/usr/fsi/fsipres.C $
+//
+// IBM CONFIDENTIAL
+//
+// COPYRIGHT International Business Machines Corp. 2011
+//
+// p1
+//
+// Object Code Only (OCO) source materials
+// Licensed Internal Code Source Materials
+// IBM HostBoot Licensed Internal Code
+//
+// The source code for this program is not published or other-
+// wise divested of its trade secrets, irrespective of what has
+// been deposited with the U.S. Copyright Office.
+//
+// Origin: 30
+//
+// IBM_PROLOG_END
+#include <devicefw/driverif.H>
+#include <targeting/targetservice.H>
+#include <fsi/fsi_reasoncodes.H>
+#include "fsidd.H"
+
+extern trace_desc_t* g_trac_fsi;
+
+namespace FSI
+{
+
+// Forward declaration from fsidd.C.
+bool isSlavePresent( const TARGETING::Target* i_target );
+
+/**
+ * @brief Performs a presence detect operation.
+ *
+ * This function does FSI presence detect, following the pre-defined prototype
+ * for a device-driver framework function.
+ *
+ * @param[in] i_opType Operation type, see DeviceFW::OperationType
+ * in driverif.H
+ * @param[in] i_target Presence detect target
+ * @param[in/out] io_buffer Read: Pointer to output data storage
+ * Write: Pointer to input data storage
+ * @param[in/out] io_buflen Input: size of io_buffer (in bytes, always 1)
+ * Output: Success = 1, Failure = 0
+ * @param[in] i_accessType DeviceFW::AccessType enum (userif.H)
+ * @param[in] i_args This is an argument list for DD framework.
+ * In this function, there are no arguments.
+ * @return errlHndl_t
+ */
+errlHndl_t presenceDetect(DeviceFW::OperationType i_opType,
+ TARGETING::Target* i_target,
+ void* io_buffer,
+ size_t& io_buflen,
+ int64_t i_accessType,
+ va_list i_args)
+{
+ if (io_buflen != sizeof(bool))
+ {
+ TRACFCOMP(g_trac_fsi,
+ ERR_MRK "FSI::presenceDetect> Invalid data length: %d",
+ io_buflen);
+ /*@
+ * @errortype
+ * @moduleid FSI::MOD_FSIPRES_PRESENCEDETECT
+ * @reasoncode FSI::RC_INVALID_LENGTH
+ * @userdata1 Data Length
+ * @devdesc presenceDetect> Invalid data length (!= 1 bytes)
+ */
+ errlHndl_t l_errl =
+ new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ FSI::MOD_FSIPRES_PRESENCEDETECT,
+ FSI::RC_INVALID_LENGTH,
+ TO_UINT64(io_buflen));
+ io_buflen = 0;
+ return l_errl;
+ }
+
+ bool present = false;
+
+ TARGETING::Target* l_masterChip = NULL;
+ TARGETING::targetService().masterProcChipTargetHandle(l_masterChip);
+
+ if ((i_target == TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL) ||
+ (i_target == l_masterChip))
+ {
+ present = true;
+ }
+ else
+ {
+ present = isSlavePresent(i_target);
+ }
+
+ memcpy(io_buffer, &present, sizeof(present));
+ io_buflen = sizeof(present);
+
+ return NULL;
+}
+
+// Register as the presence detect for processor and memory buffers.
+DEVICE_REGISTER_ROUTE(DeviceFW::READ,
+ DeviceFW::PRESENT,
+ TARGETING::TYPE_PROC,
+ presenceDetect);
+DEVICE_REGISTER_ROUTE(DeviceFW::READ,
+ DeviceFW::PRESENT,
+ TARGETING::TYPE_MEMBUF,
+ presenceDetect);
+
+};
diff --git a/src/usr/fsi/makefile b/src/usr/fsi/makefile
index 94c02b826..3be90f9bd 100644
--- a/src/usr/fsi/makefile
+++ b/src/usr/fsi/makefile
@@ -23,7 +23,7 @@
ROOTPATH = ../../..
MODULE = fsi
-OBJS = fsidd.o
+OBJS = fsidd.o fsipres.o
SUBDIRS = test.d
diff --git a/src/usr/fsi/test/fsiprestest.H b/src/usr/fsi/test/fsiprestest.H
new file mode 100644
index 000000000..66fd6dc3b
--- /dev/null
+++ b/src/usr/fsi/test/fsiprestest.H
@@ -0,0 +1,146 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/usr/fsi/test/fsiprestest.H $
+//
+// IBM CONFIDENTIAL
+//
+// COPYRIGHT International Business Machines Corp. 2011
+//
+// p1
+//
+// Object Code Only (OCO) source materials
+// Licensed Internal Code Source Materials
+// IBM HostBoot Licensed Internal Code
+//
+// The source code for this program is not published or other-
+// wise divested of its trade secrets, irrespective of what has
+// been deposited with the U.S. Copyright Office.
+//
+// Origin: 30
+//
+// IBM_PROLOG_END
+#ifndef __FSIPRESTEST_H
+#define __FSIPRESTEST_H
+
+/**
+ * @file fsiprestest.H
+ * @brief Test cases for the FSI presence detect.
+ */
+
+#include <trace/interface.H>
+#include <cxxtest/TestSuite.H>
+#include <targeting/targetservice.H>
+#include <devicefw/userif.H>
+#include <targeting/predicates/predicatectm.H>
+#include <targeting/predicates/predicatepostfixexpr.H>
+#include <targeting/iterators/rangefilter.H>
+
+using namespace TARGETING;
+using namespace DeviceFW;
+
+extern trace_desc_t* g_trac_fsi;
+uint64_t target_to_uint64(const TARGETING::Target* i_target);
+
+class FSIPresTest : public CxxTest::TestSuite
+{
+ public:
+
+ /** @brief Verify presence state matches the apparent FSI bus states.
+ *
+ * Performs a presence detect on every processor and memory, followed
+ * by an FSI access to the device. Ensures we get an error on every
+ * non-present device and we do not get an error for any present
+ * device.
+ */
+ void testPresence()
+ {
+ Target* l_masterChip = NULL;
+ targetService().masterProcChipTargetHandle(l_masterChip);
+
+ // Filter for just processor and mem-buffers.
+ PredicateCTM l_proc(CLASS_NA,TYPE_PROC);
+ PredicateCTM l_membuf(CLASS_NA,TYPE_MEMBUF);
+ PredicatePostfixExpr l_expr;
+ l_expr.push(&l_proc).push(&l_membuf).Or();
+
+ TargetRangeFilter target(targetService().begin(),
+ targetService().end(),
+ &l_expr);
+
+ // Iterate through all processors and mem-buffers.
+ while(target)
+ {
+ TS_TRACE("FSI-PRES: Testing target %x",
+ target_to_uint64(*target));
+
+ // Read presence detect.
+ errlHndl_t l_errl = NULL;
+ bool present = false;
+ size_t l_size = 1;
+
+ l_errl = deviceRead(*target, &present, l_size,
+ DEVICE_PRESENT_ADDRESS());
+
+ if (l_errl)
+ {
+ TS_FAIL("FSI-PRES: Cannot perform presence detect. %x",
+ target_to_uint64(*target));
+ TRACFCOMP(g_trac_fsi,
+ "Failed presence detect. %x",
+ target_to_uint64(*target));
+ }
+ else if ((*target == l_masterChip) && (!present))
+ {
+ TS_FAIL("FSI-PRES: Claiming master chip is not present!");
+ }
+ else // Attempt FSI read.
+ {
+
+ // Determine a valid FSI address to read.
+ uint64_t fsi_address = 0x1028; // CHIPID address
+ if (*target == l_masterChip)
+ {
+ fsi_address = 0x3474; //MFSI MVER address
+ }
+
+ // Perform FSI read.
+ uint32_t fsi_data = 0;
+ size_t op_size = sizeof(fsi_data);
+ l_errl = deviceRead(*target, &fsi_data, op_size,
+ DEVICE_FSI_ADDRESS(fsi_address));
+
+ // Verify we get an FSI error if device is not present or
+ // we do not get an FSI error if device is present.
+ if (present && l_errl)
+ {
+ TS_FAIL("FSI-PRES: "
+ "Error performing read to present device. %x",
+ target_to_uint64(*target));
+ TRACFCOMP(g_trac_fsi,
+ "FSI-PRES: FSI-read failed with %d on %x",
+ l_errl->reasonCode(),
+ target_to_uint64(*target));
+ }
+ else if (!present && !l_errl)
+ {
+ TS_FAIL("FSI-PRES: No error performing "
+ "read to non-present device. %x",
+ target_to_uint64(*target));
+ TRACFCOMP(g_trac_fsi,
+ "FSI-PRES: FSI-read did not fail. %x",
+ target_to_uint64(*target));
+ }
+ else
+ {
+ TS_TRACE("FSI-PRES: Read chip-id %x on %x",
+ fsi_data, target_to_uint64(*target));
+ }
+ }
+
+ ++target;
+ }
+ }
+};
+
+#endif
OpenPOWER on IntegriCloud