Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
1 parent
3048b4b
commit fc5fa58
Showing
11 changed files
with
337 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.