summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRick Ward <rward15@us.ibm.com>2018-11-06 16:51:42 -0600
committerDaniel M. Crowell <dcrowell@us.ibm.com>2018-11-09 13:27:04 -0600
commit8351efdb3b65ed4fc5472e78efd5db315663e42f (patch)
treec12686656b0e9c54d017232b8681b3ee5e9ecac5
parent7d4f360d16e2c8f734d361486e7334f2d31f9a20 (diff)
downloadtalos-hostboot-8351efdb3b65ed4fc5472e78efd5db315663e42f.tar.gz
talos-hostboot-8351efdb3b65ed4fc5472e78efd5db315663e42f.zip
Inband MMIO access to OCMB (skeleton)
This is a skeleton version of the new MMIO device driver that will give access to the OCMB. It is being pushed to allow related development to progress. Change-Id: Iefec0677e63db6af29d81389c630584ba9dff16c RTC: 189447 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/68489 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Matt Derksen <mderkse1@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@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: Daniel M. Crowell <dcrowell@us.ibm.com>
-rw-r--r--src/include/usr/devicefw/userif.H12
-rw-r--r--src/include/usr/mmio/mmio.H71
-rw-r--r--src/makefile1
-rw-r--r--src/usr/initservice/extinitsvc/extinitsvctasks.H14
-rw-r--r--src/usr/makefile1
-rw-r--r--src/usr/mmio/makefile32
-rw-r--r--src/usr/mmio/mmio.C61
7 files changed, 191 insertions, 1 deletions
diff --git a/src/include/usr/devicefw/userif.H b/src/include/usr/devicefw/userif.H
index 25d355ccf..a6c7f26b0 100644
--- a/src/include/usr/devicefw/userif.H
+++ b/src/include/usr/devicefw/userif.H
@@ -71,6 +71,7 @@ namespace DeviceFW
NODECOMM,
NVDIMM,
FAPI_I2C,
+ MMIO,
LAST_ACCESS_TYPE,
};
@@ -394,6 +395,17 @@ namespace DeviceFW
DEVICE_FAPI_I2C_ADDRESS_WCONFIG( 0, NULL )
/**
+ * @brief Additional device addressing parameters for MMIO ops.
+ * @param[in] i_offset - offset (bytes) into the device
+ * @param[in] i_accessLimit - number of bytes to read/write at a
+ * time (device limitation)
+ */
+ #define DEVICE_MMIO_ADDRESS(i_offset, i_accessLimit) \
+ DeviceFW::MMIO, \
+ static_cast<uint64_t>((i_offset)), \
+ static_cast<uint64_t>((i_accessLimit))
+
+ /**
* @brief Perform a hardware read operation.
*
* @param[in] i_target Device target to operate on.
diff --git a/src/include/usr/mmio/mmio.H b/src/include/usr/mmio/mmio.H
new file mode 100644
index 000000000..e340e29e4
--- /dev/null
+++ b/src/include/usr/mmio/mmio.H
@@ -0,0 +1,71 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/usr/mmio/mmio.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2018 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+#ifndef __MMIO_H
+#define __MMIO_H
+
+/** @file mmio.H
+ * @brief Provides the interfaces to perform a MMIO operation
+ * */
+
+namespace MMIO
+{
+/**
+ * @brief Memory map OCMBs.
+ * This function maps OCMB memory and registers into Hostboot virtual memory..
+ *
+ */
+void mmioSetup();
+
+/**
+ * @brief Complete the MMIO operation.
+ * This function performs read or write operations on OCMBs by accessing
+ * virtual memory that was previously memory mapped to the OCMBs.
+ * It follows a pre-defined function prototype in order to be registered
+ * with the device driver framework.
+ *
+ * @param[in] i_opType Operation type, see driverif.H
+ * @param[in] i_target MMIO target
+ * @param[in/out] io_buffer Read: Pointer to output data storage
+ * Write: Pointer to input data storage
+ * @param[in/out] io_buflen Input: Read: size of data to read (in bytes)
+ * Write: Size of data to write
+ * Output: Read: Size of output data
+ * Write: Size of data written
+ * @param[in] i_accessType Access type
+ * @param[in] i_args This is an argument list for DD framework.
+ * In this function, there are two arguments,
+ * the offset (bytes) into the device, and the number
+ * of bytes to read at a time (device limitation).
+ * @return errlHndl_t
+ */
+errlHndl_t mmioPerformOp(DeviceFW::OperationType i_opType,
+ TARGETING::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/makefile b/src/makefile
index 60a62feb7..c2e48e6d6 100644
--- a/src/makefile
+++ b/src/makefile
@@ -212,6 +212,7 @@ EXTENDED_MODULES += isteps_io
EXTENDED_MODULES += node_comm
EXTENDED_MODULES += $(if $(CONFIG_NVDIMM),nvdimm)
EXTENDED_MODULES += $(if $(CONFIG_FSP_BUILD),,nvram)
+EXTENDED_MODULES += mmio
#***************************************
# Working test modules
diff --git a/src/usr/initservice/extinitsvc/extinitsvctasks.H b/src/usr/initservice/extinitsvc/extinitsvctasks.H
index ea04481ff..b6961b622 100644
--- a/src/usr/initservice/extinitsvc/extinitsvctasks.H
+++ b/src/usr/initservice/extinitsvc/extinitsvctasks.H
@@ -388,7 +388,19 @@ const TaskInfo g_exttaskinfolist[] = {
"libisteps.so" , // taskname
NULL, // no pointer to fn
{
- INIT_TASK, // task type
+ INIT_TASK, // task type
+ EXT_IMAGE, // Extended Module
+ }
+ },
+
+ /**
+ * @brief MMIO module
+ */
+ {
+ "libmmio.so" , // taskname
+ NULL, // no pointer to fn
+ {
+ INIT_TASK, // task type
EXT_IMAGE, // Extended Module
}
},
diff --git a/src/usr/makefile b/src/usr/makefile
index 6d9ccd9c6..a5961b89d 100644
--- a/src/usr/makefile
+++ b/src/usr/makefile
@@ -69,6 +69,7 @@ SUBDIRS += $(if $(CONFIG_HTMGT),htmgt.d)
SUBDIRS += diag.d
SUBDIRS += xz.d
SUBDIRS += hwplibs.d
+SUBDIRS += mmio.d
SUBDIRS += $(if $(CONFIG_ENABLE_HDAT_IN_HOSTBOOT),hdat.d,)
SUBDIRS += $(if $(CONFIG_FSP_BUILD),,nvram.d)
diff --git a/src/usr/mmio/makefile b/src/usr/mmio/makefile
new file mode 100644
index 000000000..9b8d03ded
--- /dev/null
+++ b/src/usr/mmio/makefile
@@ -0,0 +1,32 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/mmio/makefile $
+#
+# OpenPOWER HostBoot Project
+#
+# Contributors Listed Below - COPYRIGHT 2013,2018
+# [+] International Business Machines Corp.
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# permissions and limitations under the License.
+#
+# IBM_PROLOG_END_TAG
+ROOTPATH = ../../..
+MODULE = mmio
+
+#include unique object modules
+OBJS += mmio.o
+
+VPATH += ..
+include $(ROOTPATH)/config.mk
diff --git a/src/usr/mmio/mmio.C b/src/usr/mmio/mmio.C
new file mode 100644
index 000000000..2b0849aa5
--- /dev/null
+++ b/src/usr/mmio/mmio.C
@@ -0,0 +1,61 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/mmio/mmio.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2018 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+#include <sys/mmio.h>
+#include <devicefw/driverif.H>
+#include <errl/errlentry.H>
+#include <errl/errlmanager.H>
+#include <targeting/common/predicates/predicates.H>
+#include <targeting/common/utilFilter.H>
+#include <targeting/common/targetservice.H>
+#include <arch/ppc.H>
+
+#include <mmio/mmio.H>
+
+namespace MMIO
+{
+
+void mmioSetup()
+{
+}
+
+// Direct OCMB reads and writes to the device's memory mapped memory.
+DEVICE_REGISTER_ROUTE(DeviceFW::WILDCARD,
+ DeviceFW::MMIO,
+ TARGETING::TYPE_OCMB_CHIP,
+ mmioPerformOp);
+
+errlHndl_t mmioPerformOp(DeviceFW::OperationType i_opType,
+ TARGETING::TargetHandle_t i_target,
+ void* io_buffer,
+ size_t& io_buflen,
+ int64_t i_accessType,
+ va_list i_args)
+{
+ errlHndl_t l_err = nullptr;
+
+ return l_err;
+}
+
+}; // end namespace MMIO
OpenPOWER on IntegriCloud