diff options
author | Thi Tran <thi@us.ibm.com> | 2018-01-08 09:54:47 -0600 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-01-08 17:25:37 -0500 |
commit | 245f7224088ecc9da7885fa839bd85bc1745aadf (patch) | |
tree | 0d7f6ba191568e65cbcfd2e2852d870307a8b67e /src/import | |
parent | 03e13ded87246627cfb480c17918b539f2c90d89 (diff) | |
download | talos-hostboot-245f7224088ecc9da7885fa839bd85bc1745aadf.tar.gz talos-hostboot-245f7224088ecc9da7885fa839bd85bc1745aadf.zip |
Mirror (new) p9_putmemproc HWP files
Change-Id: I9699bac2d394684bcfc9fefd6fd436e4bed96ff6
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/51618
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Joseph J. McGill <jmcgill@us.ibm.com>
Reviewed-by: Thi N. Tran <thi@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/51625
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>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/import')
4 files changed, 459 insertions, 0 deletions
diff --git a/src/import/chips/p9/procedures/hwp/nest/p9_putmemproc.C b/src/import/chips/p9/procedures/hwp/nest/p9_putmemproc.C new file mode 100644 index 000000000..3b790d60b --- /dev/null +++ b/src/import/chips/p9/procedures/hwp/nest/p9_putmemproc.C @@ -0,0 +1,227 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/import/chips/p9/procedures/hwp/nest/p9_putmemproc.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2017,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 */ +/// +/// @file p9_putmemproc.C +/// @brief Invoke ADU putmem chipop +/// +/// *HWP HWP Owner: Joe McGill <jmcgill@us.ibm.com> +/// *HWP FW Owner: Thi Tran <thi@us.ibm.com> +/// *HWP Team: Nest +/// *HWP Level: 3 +/// *HWP Consumed by: HB +/// + +//------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------ +#include <p9_putmemproc.H> +#include <p9_adu_setup.H> +#include <p9_adu_access.H> +#include <p9_adu_coherent_utils.H> + +//------------------------------------------------------------------------------ +// Function definitions +//------------------------------------------------------------------------------ + +/// NOTE: doxygen in header +fapi2::ReturnCode p9_putmemproc( + const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target, + const uint64_t i_address, + const uint32_t i_bytes, + uint8_t* i_data, + const uint32_t i_mem_flags) +{ + p9_ADU_oper_flag l_flags; + uint64_t l_target_address = i_address; + uint64_t l_end_address = i_address + i_bytes; + uint32_t l_granules_before_setup = 0; + uint32_t l_granule = 0; + uint8_t l_data[1]; + bool l_first_access = true; + + FAPI_DBG("Start"); + + FAPI_ASSERT(((i_mem_flags & SBE_MEM_ACCESS_FLAGS_TARGET_PROC) == SBE_MEM_ACCESS_FLAGS_TARGET_PROC) && + ((i_mem_flags & SBE_MEM_ACCESS_FLAGS_TARGET_PBA) == 0) && + ((i_mem_flags & SBE_MEM_ACCESS_FLAGS_LCO_MODE) == 0) && + ((i_mem_flags & SBE_MEM_ACCESS_FLAGS_CACHE_INJECT_MODE) == 0), + fapi2::P9_PUTMEMPROC_INVALID_FLAGS(). + set_TARGET(i_target). + set_ADDRESS(i_address). + set_BYTES(i_bytes). + set_FLAGS(i_mem_flags). + set_FLAG_CHECK_OP_TYPE(((i_mem_flags & SBE_MEM_ACCESS_FLAGS_TARGET_PROC) == SBE_MEM_ACCESS_FLAGS_TARGET_PROC) && + ((i_mem_flags & SBE_MEM_ACCESS_FLAGS_TARGET_PBA) == 0)). + set_FLAG_CHECK_LCO_MODE((i_mem_flags & SBE_MEM_ACCESS_FLAGS_LCO_MODE) == 0). + set_FLAG_CHECK_CACHE_INJECT_MODE((i_mem_flags & SBE_MEM_ACCESS_FLAGS_CACHE_INJECT_MODE) == 0), + "Invalid flag specified for ADU access"); + + FAPI_ASSERT(((i_mem_flags & SBE_MEM_ACCESS_FLAGS_ECC_OVERRIDE) == 0) && + ((i_mem_flags & SBE_MEM_ACCESS_FLAGS_TAG) == 0) && + ((i_mem_flags & SBE_MEM_ACCESS_FLAGS_HOST_PASS_THROUGH) == 0), + fapi2::P9_PUTMEMPROC_UNSUPPORTED_FLAGS(). + set_TARGET(i_target). + set_ADDRESS(i_address). + set_BYTES(i_bytes). + set_FLAGS(i_mem_flags). + set_FLAG_CHECK_ECC_OVERRIDE((i_mem_flags & SBE_MEM_ACCESS_FLAGS_ECC_OVERRIDE) == 0). + set_FLAG_CHECK_TAG((i_mem_flags & SBE_MEM_ACCESS_FLAGS_TAG) == 0). + set_FLAG_CHECK_HOST_PASS_THROUGH((i_mem_flags & SBE_MEM_ACCESS_FLAGS_HOST_PASS_THROUGH) == 0), + "Unsupported flag specified for ADU access"); + + // set auto-increment + l_flags.setAutoIncrement((i_mem_flags & SBE_MEM_ACCESS_FLAGS_AUTO_INCR_ON) == SBE_MEM_ACCESS_FLAGS_AUTO_INCR_ON); + + // set fast mode + l_flags.setFastMode((i_mem_flags & SBE_MEM_ACCESS_FLAGS_FAST_MODE_ON) == SBE_MEM_ACCESS_FLAGS_FAST_MODE_ON); + + // set operation type and transaction size + if ((i_mem_flags & SBE_MEM_ACCESS_FLAGS_CACHE_INHIBITED_MODE) == SBE_MEM_ACCESS_FLAGS_CACHE_INHIBITED_MODE) + { + l_flags.setOperationType(p9_ADU_oper_flag::CACHE_INHIBIT); + + if (i_bytes == 4) + { + l_flags.setTransactionSize(p9_ADU_oper_flag::TSIZE_4); + } + else if (i_bytes == 2) + { + l_flags.setTransactionSize(p9_ADU_oper_flag::TSIZE_2); + } + else if (i_bytes == 1) + { + l_flags.setTransactionSize(p9_ADU_oper_flag::TSIZE_1); + } + else if (i_bytes == 8) + { + l_flags.setTransactionSize(p9_ADU_oper_flag::TSIZE_8); + } + else + { + FAPI_ASSERT(false, + fapi2::P9_PUTMEMPROC_INVALID_SIZE_CI(). + set_TARGET(i_target). + set_ADDRESS(i_address). + set_BYTES(i_bytes). + set_FLAGS(i_mem_flags), + "Invalid byte count specified for cache-inhibited access"); + } + } + else if ((i_mem_flags & SBE_MEM_ACCESS_FLAGS_PB_DIS_MODE) == SBE_MEM_ACCESS_FLAGS_PB_DIS_MODE) + { + l_flags.setOperationType(p9_ADU_oper_flag::PB_DIS_OPER); + } + else if ((i_mem_flags & SBE_MEM_ACCESS_FLAGS_SWITCH_MODE) == SBE_MEM_ACCESS_FLAGS_SWITCH_MODE) + { + l_flags.setOperationType(p9_ADU_oper_flag::PMISC_OPER); + } + else if ((i_mem_flags & SBE_MEM_ACCESS_FLAGS_PB_INIT_MODE) == SBE_MEM_ACCESS_FLAGS_PB_INIT_MODE) + { + l_flags.setOperationType(p9_ADU_oper_flag::PB_INIT_OPER); + } + else if ((i_mem_flags & SBE_MEM_ACCESS_FLAGS_PRE_SWITCH_CD_MODE) == SBE_MEM_ACCESS_FLAGS_PRE_SWITCH_CD_MODE) + { + l_flags.setOperationType(p9_ADU_oper_flag::PRE_SWITCH_CD); + } + else if ((i_mem_flags & SBE_MEM_ACCESS_FLAGS_PRE_SWITCH_AB_MODE) == SBE_MEM_ACCESS_FLAGS_PRE_SWITCH_AB_MODE) + { + l_flags.setOperationType(p9_ADU_oper_flag::PRE_SWITCH_AB); + } + else if ((i_mem_flags & SBE_MEM_ACCESS_FLAGS_POST_SWITCH_MODE) == SBE_MEM_ACCESS_FLAGS_POST_SWITCH_MODE) + { + l_flags.setOperationType(p9_ADU_oper_flag::POST_SWITCH); + } + else + { + l_flags.setOperationType(p9_ADU_oper_flag::DMA_PARTIAL); + + if (i_bytes == 4) + { + l_flags.setTransactionSize(p9_ADU_oper_flag::TSIZE_4); + } + else if (i_bytes == 2) + { + l_flags.setTransactionSize(p9_ADU_oper_flag::TSIZE_2); + } + else if (i_bytes == 1) + { + l_flags.setTransactionSize(p9_ADU_oper_flag::TSIZE_1); + } + else if ((i_bytes % 8) == 0) + { + l_flags.setTransactionSize(p9_ADU_oper_flag::TSIZE_8); + } + else + { + FAPI_ASSERT(false, + fapi2::P9_PUTMEMPROC_INVALID_SIZE_DMA(). + set_TARGET(i_target). + set_ADDRESS(i_address). + set_BYTES(i_bytes). + set_FLAGS(i_mem_flags), + "Invalid byte count specified for DMA partial write access"); + } + } + + while (l_target_address < l_end_address) + { + // invoke ADU setup HWP to prepare current stream of contiguous granules + FAPI_TRY(p9_adu_setup(i_target, + l_target_address, + false, + l_flags.setFlag(), + l_granules_before_setup), + "Error from p9_adu_setup"); + + FAPI_DBG("Granules before setup: %d", + l_granules_before_setup); + l_first_access = true; + + while (l_granules_before_setup && (l_target_address < l_end_address)) + { + // invoke ADU access HWP to move one granule (8B) + l_data[0] = i_data[l_granule]; + FAPI_TRY(p9_adu_access(i_target, + l_target_address, + false, + l_flags.setFlag(), + l_first_access, + (l_granules_before_setup == 1) || + ((l_target_address + 8) >= + l_end_address), + l_data), + "Error from p9_adu_access"); + + l_first_access = false; + l_granules_before_setup--; + l_target_address += 8; + l_granule++; + } + } + +fapi_try_exit: + FAPI_DBG("End"); + return fapi2::current_err; +} diff --git a/src/import/chips/p9/procedures/hwp/nest/p9_putmemproc.H b/src/import/chips/p9/procedures/hwp/nest/p9_putmemproc.H new file mode 100644 index 000000000..8e461c46b --- /dev/null +++ b/src/import/chips/p9/procedures/hwp/nest/p9_putmemproc.H @@ -0,0 +1,105 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/import/chips/p9/procedures/hwp/nest/p9_putmemproc.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2017,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 */ +/// +/// @file p9_putmemproc.H +/// @brief Invoke ADU putmem chipop +/// +/// *HWP HWP Owner: Joseph McGill jmcgill@us.ibm.com +/// *HWP FW Owner: Thi Tran thi@us.ibm.com +/// *HWP Team: Nest +/// *HWP Level: 3 +/// *HWP Consumed by: HB +/// + +#ifndef _P9_PUTMEMPROC_H_ +#define _P9_PUTMEMPROC_H_ + +//------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------ +#include <fapi2.H> + +//------------------------------------------------------------------------------ +// Constant Definitions +//------------------------------------------------------------------------------ +enum sbeMemoryAccessFlags +{ + SBE_MEM_ACCESS_FLAGS_TARGET_PROC = 0x00000001, + SBE_MEM_ACCESS_FLAGS_TARGET_PBA = 0x00000002, + SBE_MEM_ACCESS_FLAGS_AUTO_INCR_ON = 0x00000004, + SBE_MEM_ACCESS_FLAGS_ECC_OVERRIDE = 0x00000008, + SBE_MEM_ACCESS_FLAGS_TAG = 0x00000010, + SBE_MEM_ACCESS_FLAGS_FAST_MODE_ON = 0x00000020, + SBE_MEM_ACCESS_FLAGS_LCO_MODE = 0x00000040, + SBE_MEM_ACCESS_FLAGS_CACHE_INHIBITED_MODE = 0x00000080, + SBE_MEM_ACCESS_FLAGS_HOST_PASS_THROUGH = 0x00000100, + SBE_MEM_ACCESS_FLAGS_CACHE_INJECT_MODE = 0x00000200, + SBE_MEM_ACCESS_FLAGS_PB_DIS_MODE = 0x00001000, + SBE_MEM_ACCESS_FLAGS_SWITCH_MODE = 0x00002000, + SBE_MEM_ACCESS_FLAGS_PB_INIT_MODE = 0x00004000, + SBE_MEM_ACCESS_FLAGS_PRE_SWITCH_CD_MODE = 0x00008000, + SBE_MEM_ACCESS_FLAGS_PRE_SWITCH_AB_MODE = 0x00010000, + SBE_MEM_ACCESS_FLAGS_POST_SWITCH_MODE = 0x00020000, +}; + +//------------------------------------------------------------------------------ +// Structure definitions +//------------------------------------------------------------------------------ +// function pointer typedef definition for HWP call support +typedef fapi2::ReturnCode(*p9_putmemproc_FP_t) ( + const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>&, + const uint64_t, + const uint32_t, + uint8_t*, + const uint32_t); + +//------------------------------------------------------------------------------ +// Function prototype +//------------------------------------------------------------------------------ +// + +extern "C" { + +/// +/// @brief Invoke ADU putmem chipop +/// +/// @param[in] i_target Reference to processor chip target +/// @param[in] i_address Base address for write operation +/// @param[in] i_bytes Size of write data, in B +/// @param[in] i_data Pointer to write data +/// @param[in] i_mem_flags Flags to pass to chipop +/// +/// @return FAPI_RC_SUCCESS if success, else error code +/// + fapi2::ReturnCode p9_putmemproc( + const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target, + const uint64_t i_address, + const uint32_t i_bytes, + uint8_t* i_data, + const uint32_t i_mem_flags); + +} //extern "C" + +#endif //_P9_PUTMEMPROC_H_ diff --git a/src/import/chips/p9/procedures/hwp/nest/p9_putmemproc.mk b/src/import/chips/p9/procedures/hwp/nest/p9_putmemproc.mk new file mode 100644 index 000000000..08f937a7d --- /dev/null +++ b/src/import/chips/p9/procedures/hwp/nest/p9_putmemproc.mk @@ -0,0 +1,30 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/import/chips/p9/procedures/hwp/nest/p9_putmemproc.mk $ +# +# OpenPOWER HostBoot Project +# +# Contributors Listed Below - COPYRIGHT 2017,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 +PROCEDURE=p9_putmemproc +OBJS+=p9_adu_setup.o +OBJS+=p9_adu_access.o +OBJS+=p9_adu_coherent_utils.o +OBJS+=p9_fbc_utils.o +$(call BUILD_PROCEDURE) diff --git a/src/import/chips/p9/procedures/xml/error_info/p9_putmemproc_errors.xml b/src/import/chips/p9/procedures/xml/error_info/p9_putmemproc_errors.xml new file mode 100644 index 000000000..965cae00a --- /dev/null +++ b/src/import/chips/p9/procedures/xml/error_info/p9_putmemproc_errors.xml @@ -0,0 +1,97 @@ +<!-- IBM_PROLOG_BEGIN_TAG --> +<!-- This is an automatically generated prolog. --> +<!-- --> +<!-- $Source: src/import/chips/p9/procedures/xml/error_info/p9_putmemproc_errors.xml $ --> +<!-- --> +<!-- OpenPOWER HostBoot Project --> +<!-- --> +<!-- Contributors Listed Below - COPYRIGHT 2017,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 --> +<hwpErrors> + <!-- ******************************************************************** --> + <hwpError> + <rc>RC_P9_PUTMEMPROC_INVALID_FLAGS</rc> + <description> + Procedure: p9_putmemproc + Invalid flag specified for ADU access + </description> + <ffdc>TARGET</ffdc> + <ffdc>ADDRESS</ffdc> + <ffdc>BYTES</ffdc> + <ffdc>FLAGS</ffdc> + <ffdc>FLAG_CHECK_OP_TYPE</ffdc> + <ffdc>FLAG_CHECK_LCO_MODE</ffdc> + <ffdc>FLAG_CHECK_CACHE_INJECT_MODE</ffdc> + <callout> + <procedure>CODE</procedure> + <priority>HIGH</priority> + </callout> + </hwpError> + <!-- ******************************************************************** --> + <hwpError> + <rc>RC_P9_PUTMEMPROC_UNSUPPORTED_FLAGS</rc> + <description> + Procedure: p9_putmemproc + Unsupported flag specified for ADU access + </description> + <ffdc>TARGET</ffdc> + <ffdc>ADDRESS</ffdc> + <ffdc>BYTES</ffdc> + <ffdc>FLAGS</ffdc> + <ffdc>FLAG_CHECK_ECC_OVERRIDE</ffdc> + <ffdc>FLAG_CHECK_TAG</ffdc> + <ffdc>FLAG_CHECK_HOST_PASS_THROUGH</ffdc> + <callout> + <procedure>CODE</procedure> + <priority>HIGH</priority> + </callout> + </hwpError> + <!-- ******************************************************************** --> + <hwpError> + <rc>RC_P9_PUTMEMPROC_INVALID_SIZE_CI</rc> + <description> + Procedure: p9_putmemproc + Invalid byte count specified for cache inhibited ADU access + </description> + <ffdc>TARGET</ffdc> + <ffdc>ADDRESS</ffdc> + <ffdc>BYTES</ffdc> + <ffdc>FLAGS</ffdc> + <callout> + <procedure>CODE</procedure> + <priority>HIGH</priority> + </callout> + </hwpError> + <!-- ******************************************************************** --> + <hwpError> + <rc>RC_P9_PUTMEMPROC_INVALID_SIZE_DMA</rc> + <description> + Procedure: p9_putmemproc + Invalid byte count specified for DMA partial write ADU access + </description> + <ffdc>TARGET</ffdc> + <ffdc>ADDRESS</ffdc> + <ffdc>BYTES</ffdc> + <ffdc>FLAGS</ffdc> + <callout> + <procedure>CODE</procedure> + <priority>HIGH</priority> + </callout> + </hwpError> + <!-- ******************************************************************** --> +</hwpErrors> |