Skip to content

Commit

Permalink
Runtime scom support for OCMBs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mderkse1 authored and dcrowell77 committed Aug 15, 2019
1 parent 3048b4b commit fc5fa58
Show file tree
Hide file tree
Showing 11 changed files with 337 additions and 65 deletions.
1 change: 1 addition & 0 deletions src/include/usr/mmio/mmio_reasoncodes.H
Expand Up @@ -41,6 +41,7 @@ namespace MMIO
MOD_CHECK_OCMB_ERROR = 0x07,
MOD_DETERMINE_CALLOUTS = 0x08,
MOD_DETERMINE_EXP_CALLOUTS = 0x09,
RT_OCMB_MMIO_PERFORM_OP = 0x0A,
};

enum MMIOReasonCode
Expand Down
3 changes: 2 additions & 1 deletion src/include/usr/runtime/runtime_reasoncodes.H
Expand Up @@ -145,7 +145,8 @@ namespace RUNTIME
RC_NULL_FIRMWARE_MSG_PTR = RUNTIME_COMP_ID | 0x45,
RC_SERIALIZE_ATTRIBUTE_FAILED = RUNTIME_COMP_ID | 0x46,
RC_NO_SPACE_FOR_ATTRIBUTE_SERIALIZATION = RUNTIME_COMP_ID | 0x47,
RC_CANNOT_MAKE_ATTRIBUTE = RUNTIME_COMP_ID | 0x47,
RC_CANNOT_MAKE_ATTRIBUTE = RUNTIME_COMP_ID | 0x48,
RT_NO_OMI_TARGET_FOUND = RUNTIME_COMP_ID | 0x49,
};

enum UserDetailsTypes
Expand Down
1 change: 1 addition & 0 deletions src/makefile
Expand Up @@ -323,6 +323,7 @@ RUNTIME_MODULES += imageprocs_rt
RUNTIME_MODULES += $(if $(CONFIG_NVDIMM),nvdimm_rt)
RUNTIME_MODULES += mss_rt
RUNTIME_MODULES += expaccess_rt
RUNTIME_MODULES += mmio_rt

# This is exported so that gcov knows the list of runtime modules to
# exclude from instrumentation. We can't simply export RUNTIME_MODULES or
Expand Down
5 changes: 4 additions & 1 deletion src/usr/expaccess/runtime/makefile
Expand Up @@ -22,6 +22,7 @@
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
HOSTBOOT_RUNTIME = 1

ROOTPATH = ../../../..
MODULE = expaccess_rt
Expand All @@ -30,7 +31,9 @@ SUBDIRS += test.d

include ../expaccess.mk

EXTRAINCDIR += ../

VPATH += ${ROOTPATH}/src/import/chips/ocmb/explorer/procedures/hwp/memory/
VPATH += ${ROOTPATH}/src/usr/expaccess/

include ${ROOTPATH}/config.mk
include ${ROOTPATH}/config.mk
1 change: 1 addition & 0 deletions src/usr/mmio/makefile
Expand Up @@ -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/
Expand Down
6 changes: 5 additions & 1 deletion src/usr/mmio/mmio.H
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2018 */
/* Contributors Listed Below - COPYRIGHT 2018,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand All @@ -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
* */
Expand Down
33 changes: 33 additions & 0 deletions 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
108 changes: 108 additions & 0 deletions 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

0 comments on commit fc5fa58

Please sign in to comment.