diff options
| author | Matt Derksen <mderkse1@us.ibm.com> | 2019-06-20 16:33:05 -0500 |
|---|---|---|
| committer | Daniel M Crowell <dcrowell@us.ibm.com> | 2019-08-15 17:06:46 -0500 |
| commit | fc5fa5842e3e03e1419501de236c36b1641281d0 (patch) | |
| tree | 55838f029f7fdb4404be79bc562ea4bce29aac02 /src/usr/mmio | |
| parent | 3048b4b1689faf1842499f6402f6175909b2b410 (diff) | |
| download | blackbird-hostboot-fc5fa5842e3e03e1419501de236c36b1641281d0.tar.gz blackbird-hostboot-fc5fa5842e3e03e1419501de236c36b1641281d0.zip | |
Runtime scom support for OCMBs
fapi2::getScom on OCMB targets eventually resolves
to a mmio call at runtime.
This commit registers a runtime version of mmioScomPerformOp
to the IBSCOM device ops for OCMB targets.
During runtime, hostboot will rely on the hypervisor (opal/phyp)
to issue the inband commands to perform the operation on the
desired OCMB.
Change-Id: I5ec25d0401267125419cd579a3a2d752f14234a4
RTC:210321
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/80235
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Christian R Geddes <crgeddes@us.ibm.com>
Reviewed-by: Roland Veloz <rveloz@us.ibm.com>
Reviewed-by: Daniel M Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/mmio')
| -rw-r--r-- | src/usr/mmio/makefile | 1 | ||||
| -rw-r--r-- | src/usr/mmio/mmio.H | 6 | ||||
| -rw-r--r-- | src/usr/mmio/runtime/makefile | 33 | ||||
| -rw-r--r-- | src/usr/mmio/runtime/rt_mmio.C | 108 |
4 files changed, 147 insertions, 1 deletions
diff --git a/src/usr/mmio/makefile b/src/usr/mmio/makefile index 0787dbe50..2cc5fd76a 100644 --- a/src/usr/mmio/makefile +++ b/src/usr/mmio/makefile @@ -26,6 +26,7 @@ ROOTPATH = ../../.. MODULE = mmio SUBDIRS += test.d +SUBDIRS += runtime.d EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/common/include/ EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/ffdc/ diff --git a/src/usr/mmio/mmio.H b/src/usr/mmio/mmio.H index d69ade6f7..96ea25e8d 100644 --- a/src/usr/mmio/mmio.H +++ b/src/usr/mmio/mmio.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2018 */ +/* Contributors Listed Below - COPYRIGHT 2018,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -25,6 +25,10 @@ #ifndef __MMIO_H #define __MMIO_H +#include <errl/errlentry.H> +#include <devicefw/driverif.H> +#include <targeting/common/target.H> + /** @file mmio.H * @brief Provides interface to perform MMIO operations to Explorer chips * */ diff --git a/src/usr/mmio/runtime/makefile b/src/usr/mmio/runtime/makefile new file mode 100644 index 000000000..c61c68c39 --- /dev/null +++ b/src/usr/mmio/runtime/makefile @@ -0,0 +1,33 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/mmio/runtime/makefile $ +# +# OpenPOWER HostBoot Project +# +# Contributors Listed Below - COPYRIGHT 2019 +# [+] 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 +HOSTBOOT_RUNTIME = 1 +ROOTPATH = ../../../.. +MODULE = mmio_rt + +#include unique object modules +OBJS += rt_mmio.o + +VPATH += .. +include $(ROOTPATH)/config.mk diff --git a/src/usr/mmio/runtime/rt_mmio.C b/src/usr/mmio/runtime/rt_mmio.C new file mode 100644 index 000000000..620dff855 --- /dev/null +++ b/src/usr/mmio/runtime/rt_mmio.C @@ -0,0 +1,108 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/mmio/runtime/rt_mmio.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2019 */ +/* [+] 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 */ +// @file src/usr/mmio/runtime/rt_mmio.C +// @brief Runtime mmio operations -- particularly for scom operations + +#include "../mmio.H" +#include <scom/runtime/rt_scomif.H> +#include <devicefw/driverif.H> +#include <errl/errlentry.H> +#include <limits.h> +#include <usr/mmio/mmio_reasoncodes.H> + +// Trace definition +trace_desc_t* g_trac_mmio = NULL; +TRAC_INIT(&g_trac_mmio, MMIO_COMP_NAME, 2*KILOBYTE, TRACE::BUFFER_SLOW); + +//#define TRACUCOMP(args...) TRACFCOMP(args) +#define TRACUCOMP(args...) + +namespace MMIO +{ +// Direct OCMB reads and writes to the device's memory mapped memory. +DEVICE_REGISTER_ROUTE(DeviceFW::WILDCARD, + DeviceFW::MMIO, + TARGETING::TYPE_OCMB_CHIP, + ocmbMmioPerformOp); + +/******************************************************************************* + * + * See comments in header file + * + */ +errlHndl_t ocmbMmioPerformOp(DeviceFW::OperationType i_opType, + TARGETING::TargetHandle_t i_ocmbTarget, + void* io_buffer, + size_t& io_buflen, + int64_t i_accessType, + va_list i_args) +{ + errlHndl_t l_err = nullptr; + uint64_t l_offset = va_arg(i_args, uint64_t); + + TRACUCOMP(g_trac_mmio, ENTER_MRK"runtime ocmbMmioPerformOp"); + TRACUCOMP(g_trac_mmio, INFO_MRK"op=%d, target=0x%.8X", + i_opType, TARGETING::get_huid(i_ocmbTarget)); + TRACUCOMP(g_trac_mmio, INFO_MRK"buffer=%p, length=%d, accessType=%ld", + io_buffer, io_buflen, i_accessType); + TRACUCOMP(g_trac_mmio, INFO_MRK"offset=0x%lX", l_offset); + + // Verify offset is within scom mmio range + if ( (l_offset >= (4 * GIGABYTE)) && (l_offset < (6 * GIGABYTE)) ) + { + // send message to hypervisor level to do the mmio operation + l_err = SCOM::sendScomToHyp(i_opType, i_ocmbTarget, + l_offset, io_buffer); + } + else + { + // Only Scom range is supported for MMIO runtime context + /*@ + * @errortype + * @moduleid MMIO::RT_OCMB_MMIO_PERFORM_OP + * @reasoncode MMIO::RC_INVALID_OFFSET + * @userdata1[0:31] Target huid + * @userdata1[32:63] Data Offset + * @userdata2[0:31] Operation Type + * @userdata2[32:63] Buffer Length + * @devdesc Invalid offset, requested + * address was out of range for a MMIO operation. + * @custdesc Unexpected memory subsystem firmware error. + */ + l_err = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_UNRECOVERABLE, + MMIO::RT_OCMB_MMIO_PERFORM_OP, + MMIO::RC_INVALID_OFFSET, + TWO_UINT32_TO_UINT64( + TARGETING::get_huid(i_ocmbTarget), + l_offset), + TWO_UINT32_TO_UINT64(i_opType, io_buflen), + ERRORLOG::ErrlEntry::ADD_SW_CALLOUT); + } + + return l_err; +} + +}; // end namespace MMIO |

