summaryrefslogtreecommitdiffstats
path: root/src/usr/scom
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/scom')
-rw-r--r--src/usr/scom/makefile8
-rw-r--r--src/usr/scom/scom.C46
-rw-r--r--src/usr/scom/scom.H41
-rw-r--r--src/usr/scom/test/makefile6
-rw-r--r--src/usr/scom/test/scomtest.H30
5 files changed, 131 insertions, 0 deletions
diff --git a/src/usr/scom/makefile b/src/usr/scom/makefile
new file mode 100644
index 000000000..777b4a2fd
--- /dev/null
+++ b/src/usr/scom/makefile
@@ -0,0 +1,8 @@
+ROOTPATH = ../../..
+MODULE = scom
+
+OBJS = scom.o
+
+SUBDIRS = test.d
+
+include ${ROOTPATH}/config.mk
diff --git a/src/usr/scom/scom.C b/src/usr/scom/scom.C
new file mode 100644
index 000000000..43357a85f
--- /dev/null
+++ b/src/usr/scom/scom.C
@@ -0,0 +1,46 @@
+/**
+ * @file scom.C
+ *
+ * @brief Implementation of SCOM operations
+ */
+
+/*****************************************************************************/
+// I n c l u d e s
+/*****************************************************************************/
+#include <devicefw/driverif.H>
+#include <trace/interface.H>
+#include <errl/errlentry.H>
+#include <errl/errlmanager.H>
+#include "scom.H"
+
+namespace SCOM
+{
+
+// Register SCom access functions to DD framework
+DEVICE_REGISTER_ROUTE(DeviceFW::WILDCARD,
+ DeviceFW::SCOM,
+ DeviceFW::PROCESSOR,
+ scomPerformOp);
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+errlHndl_t scomPerformOp(DeviceFW::OperationType i_opType,
+ DeviceFW::TargetHandle_t i_target,
+ void* io_buffer,
+ size_t& io_buflen,
+ int64_t i_accessType,
+ va_list i_args)
+{
+ errlHndl_t l_err = NULL;
+
+ //@todo - For now, just call XSCOM
+ l_err = deviceOp(i_opType,
+ i_target,
+ io_buffer,
+ io_buflen,
+ DEVICE_XSCOM_ADDRESS(va_arg(i_args,uint64_t)));
+
+ return l_err;
+}
+
+} // end namespace
diff --git a/src/usr/scom/scom.H b/src/usr/scom/scom.H
new file mode 100644
index 000000000..332883d00
--- /dev/null
+++ b/src/usr/scom/scom.H
@@ -0,0 +1,41 @@
+#ifndef __SCOM_H
+#define __SCOM_H
+
+/** @file scom.H
+ * @brief Provides the interfaces to perform a SCom
+ */
+
+namespace SCOM
+{
+
+/**
+ * @brief Performs an SCom operation
+ * This function performs an SCom Read/Write operation. It follows a
+ * pre-defined prototype functions in order to be registered with the
+ * device-driver framework.
+ *
+ * @param[in] i_opType Operation type, see DeviceFW::OperationType
+ * in driverif.H
+ * @param[in] i_target SCom target
+ * @param[in/out] io_buffer Read: pointer to output data storage
+ * Write: pointer to data to be written
+ * @param[in/out] io_buflen Input: size of io_buffer (in bytes)
+ * Output: Read: size of output data
+ * Write: size of data written
+ * @param[in] i_accessType Select from DeviceFW::AccessType enum
+ * (usrif.H)
+ * @param[in] i_args This is an argument list for DD framework.
+ * In this function, there's only one argument,
+ * which is the SCom address value.
+ *
+ * @return errlHndl_t
+ */
+errlHndl_t scomPerformOp(DeviceFW::OperationType i_opType,
+ DeviceFW::TargetHandle_t i_target,
+ void* io_buffer,
+ size_t& io_buflen,
+ int64_t i_accessType,
+ va_list i_args);
+}; // End namespace
+
+#endif
diff --git a/src/usr/scom/test/makefile b/src/usr/scom/test/makefile
new file mode 100644
index 000000000..298f91b6e
--- /dev/null
+++ b/src/usr/scom/test/makefile
@@ -0,0 +1,6 @@
+ROOTPATH = ../../../..
+
+MODULE = testscom
+TESTS = *.H
+
+include ${ROOTPATH}/config.mk
diff --git a/src/usr/scom/test/scomtest.H b/src/usr/scom/test/scomtest.H
new file mode 100644
index 000000000..6082db403
--- /dev/null
+++ b/src/usr/scom/test/scomtest.H
@@ -0,0 +1,30 @@
+#ifndef __SCOMTEST_H
+#define __SCOMTEST_H
+
+/**
+ * @file scomtest.H
+ *
+ * @brief Test case for SCOM code
+*/
+
+#include <cxxtest/TestSuite.H>
+#include <errl/errlmanager.H>
+#include <errl/errlentry.H>
+#include <errl/errltypes.H>
+#include <devicefw/userif.H>
+
+class ScomTest: public CxxTest::TestSuite
+{
+public:
+
+ /**
+ * @brief SCOM test #1
+ * TBD
+ */
+ void testScom1(void)
+ {
+ return;
+ }
+};
+
+#endif
OpenPOWER on IntegriCloud