diff options
| author | Matt Derksen <mderkse1@us.ibm.com> | 2017-05-30 15:25:20 -0500 |
|---|---|---|
| committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2017-06-12 11:42:37 -0400 |
| commit | 94010840e9551be4711ac135c9855b7f0cecb3a3 (patch) | |
| tree | 2398d28f8123c7f262160e6b87f993756be98eb7 /src/usr/util/runtime | |
| parent | 1c2fcebe0a3fde901e9a621a6f7362fb2cf1d200 (diff) | |
| download | talos-hostboot-94010840e9551be4711ac135c9855b7f0cecb3a3.tar.gz talos-hostboot-94010840e9551be4711ac135c9855b7f0cecb3a3.zip | |
Consolidating HBRT reserved memory (ATTR,ATTR_OVERRIDE,VPD) into a single entry
Change-Id: I9fc5846d9901ac79c59bb149b8f55b5c7ca2fa73
RTC: 171863
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/41141
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Martin Gloff <mgloff@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>
Diffstat (limited to 'src/usr/util/runtime')
| -rw-r--r-- | src/usr/util/runtime/makefile | 3 | ||||
| -rw-r--r-- | src/usr/util/runtime/util_rt.C | 107 |
2 files changed, 109 insertions, 1 deletions
diff --git a/src/usr/util/runtime/makefile b/src/usr/util/runtime/makefile index e61091cc5..6512606d2 100644 --- a/src/usr/util/runtime/makefile +++ b/src/usr/util/runtime/makefile @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2013,2016 +# Contributors Listed Below - COPYRIGHT 2013,2017 # [+] International Business Machines Corp. # # @@ -33,6 +33,7 @@ OBJS += utillidmgr_rt.o OBJS += utilfile.o OBJS += utillidpnor.o OBJS += rt_cmds.o +OBJS += util_rt.o SUBDIRS += test.d diff --git a/src/usr/util/runtime/util_rt.C b/src/usr/util/runtime/util_rt.C new file mode 100644 index 000000000..633456248 --- /dev/null +++ b/src/usr/util/runtime/util_rt.C @@ -0,0 +1,107 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/util/runtime/util_rt.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2017 */ +/* [+] 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 <targeting/common/trace.H> +#include <trace/interface.H> +#include <runtime/interface.h> +#include <util/runtime/util_rt.H> + +/** + * @brief Get the address of a reserved hostboot memory region by its label + * @param[in] i_label HBRT_MEM_LABEL_ constant + * @param[in] i_instance instance number + * @param[out] o_size size of returned region in bytes + * @return virtual address of region or 0 + * @platform FSP, OpenPOWER + **/ +uint64_t hb_get_rt_rsvd_mem(hbrt_mem_label_t i_label, + uint32_t i_instance, + uint64_t & o_size) +{ + uint64_t l_label_data_addr = 0; + o_size = 0; + + TRACFCOMP(TARGETING::g_trac_targeting, ENTER_MRK"hb_get_rt_rsvd_mem(0x%llX, %d, %ld) -> 0x%X", + i_label,i_instance, o_size,l_label_data_addr); + + switch(i_label) + { + case HBRT_MEM_LABEL_VPD: + case HBRT_MEM_LABEL_ATTR: + case HBRT_MEM_LABEL_ATTROVER: + case HBRT_MEM_LABEL_PADDING: + if( (g_hostInterfaces != NULL) && + (g_hostInterfaces->get_reserved_mem) ) + { + uint64_t hb_data_addr = + g_hostInterfaces->get_reserved_mem(HBRT_RSVD_MEM__DATA, + i_instance); + if (0 != hb_data_addr) + { + hbrtTableOfContents_t * toc_ptr = + reinterpret_cast<hbrtTableOfContents_t *>(hb_data_addr); + + // Find offset of label section + for (uint16_t i = 0; i < toc_ptr->total_entries; i++) + { + if (toc_ptr->entry[i].label == i_label) + { + l_label_data_addr = hb_data_addr + + toc_ptr->entry[i].offset; + o_size = toc_ptr->entry[i].size; + TRACFCOMP(TARGETING::g_trac_targeting, "hb_get_rt_rsvd_mem: Entry found at 0x%.16llX, size %ld", + l_label_data_addr, o_size); + break; + } + } + + if (0 == o_size) + { + TRACFCOMP(TARGETING::g_trac_targeting, "hb_get_rt_rsvd_mem: Entry %.16llX not found", i_label); + } + } + else + { + // unable to find HBRT_RSVD_MEM__DATA section + TRACFCOMP(TARGETING::g_trac_targeting, "hb_get_rt_rsvd_mem: Unable to find HBRT_RSVD_MEM__DATA section"); + } + } + else + { + // g_hostInterfaces is either NULL or + // get_reserved_mem function isn't defined + TRACFCOMP(TARGETING::g_trac_targeting, "hb_get_rt_rsvd_mem: g_hostInterfaces->get_reserved_mem is invalid"); + } + break; + default: + // unknown label? + TRACFCOMP(TARGETING::g_trac_targeting, "hb_get_rt_rsvd_mem: unknown label 0x%.16llX", i_label); + break; + } + + TRACFCOMP(TARGETING::g_trac_targeting, EXIT_MRK"hb_get_rt_rsvd_mem(0x%X, %d, %ld) -> 0x%X", + i_label,i_instance, o_size,l_label_data_addr); + + return l_label_data_addr; +} |

