summaryrefslogtreecommitdiffstats
path: root/src/hwpf/src
diff options
context:
space:
mode:
authorSantosh Puranik <santosh.puranik@in.ibm.com>2017-05-29 06:15:17 -0500
committerSantosh S. Puranik <santosh.puranik@in.ibm.com>2017-05-31 23:59:53 -0400
commite97705e412957844cc516486a6686de1a8d69ecb (patch)
tree366cabe4a468c5f85917c48ad4423c8d2ed61711 /src/hwpf/src
parent5110484932840cd55a361b6bbe8bef5aa24b27e3 (diff)
downloadtalos-sbe-e97705e412957844cc516486a6686de1a8d69ecb.tar.gz
talos-sbe-e97705e412957844cc516486a6686de1a8d69ecb.zip
FAPI Plat Cleanup
-- Remove src and include subdirs Change-Id: I47d2b7d0b3667e7765692fb014932ae23a6325f7 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/41085 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com> Reviewed-by: Shakeeb A. Pasha B K <shakeebbk@in.ibm.com> Reviewed-by: Santosh S. Puranik <santosh.puranik@in.ibm.com>
Diffstat (limited to 'src/hwpf/src')
-rw-r--r--src/hwpf/src/Makefile52
-rw-r--r--src/hwpf/src/fapi2sbefiles.mk50
-rw-r--r--src/hwpf/src/ffdc.C42
-rw-r--r--src/hwpf/src/plat/Makefile42
-rw-r--r--src/hwpf/src/plat/fapi2sbeplatfiles.mk53
-rw-r--r--src/hwpf/src/plat/plat_attribute_service.H1442
-rw-r--r--src/hwpf/src/plat/plat_hw_access.C358
-rw-r--r--src/hwpf/src/plat/plat_utils.C197
-rw-r--r--src/hwpf/src/plat/target.C755
-rw-r--r--src/hwpf/src/plat_ring_traverse.C499
-rw-r--r--src/hwpf/src/return_code.C47
11 files changed, 0 insertions, 3537 deletions
diff --git a/src/hwpf/src/Makefile b/src/hwpf/src/Makefile
deleted file mode 100644
index 4377a865..00000000
--- a/src/hwpf/src/Makefile
+++ /dev/null
@@ -1,52 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/hwpf/src/Makefile $
-#
-# OpenPOWER sbe Project
-#
-# Contributors Listed Below - COPYRIGHT 2015,2016
-# [+] 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
-# This Makefile is designed to be invoked with the -I argument
-
-export SUB_OBJDIR = /fapi2
-
-include img_defs.mk
-include fapi2sbefiles.mk
-
-
-OBJS := $(addprefix $(OBJDIR)/, $(FAPI2LIB_OBJECTS))
-
-libfapi2.a: fapi2 hwpf plat
- $(AR) crs $(OBJDIR)/libfapi2.a $(OBJDIR)/*.o
-
-.PHONY: clean fapi2 hwpf plat
-fapi2: $(OBJS)
-
-plat:
- $(MAKE) -I $(BUILD_DIR) -C $(PLAT_FAPI2_DIR)/src/plat
-
-$(OBJS) $(OBJS:.o=.d): | $(OBJDIR)
-
-$(OBJDIR):
- mkdir -p $(OBJDIR)
-
-ifneq ($(MAKECMDGOALS),clean)
-include $(OBJS:.o=.d)
-endif
-
diff --git a/src/hwpf/src/fapi2sbefiles.mk b/src/hwpf/src/fapi2sbefiles.mk
deleted file mode 100644
index e1bdf683..00000000
--- a/src/hwpf/src/fapi2sbefiles.mk
+++ /dev/null
@@ -1,50 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/hwpf/src/fapi2sbefiles.mk $
-#
-# OpenPOWER sbe Project
-#
-# Contributors Listed Below - COPYRIGHT 2015,2016
-# [+] 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 fapi2ppefiles.mk
-#
-# @brief mk for including fapi2 object files
-#
-# @page ChangeLogs Change Logs
-# @section fapi2ppefiles.mk
-# @verbatim
-#
-#
-# Change Log ******************************************************************
-# Flag Defect/Feature User Date Description
-# ------ -------------- ---------- ------------ -----------
-#
-# @endverbatim
-#
-##########################################################################
-# Object Files
-##########################################################################
-
-FAPI2-C-SOURCES += ffdc.C
-FAPI2-C-SOURCES += plat_ring_traverse.C
-FAPI2-S-SOURCES =
-
-
-FAPI2LIB_OBJECTS += $(FAPI2-C-SOURCES:.C=.o) $(FAPI2-S-SOURCES:.S=.o)
-
diff --git a/src/hwpf/src/ffdc.C b/src/hwpf/src/ffdc.C
deleted file mode 100644
index e8242f2a..00000000
--- a/src/hwpf/src/ffdc.C
+++ /dev/null
@@ -1,42 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/hwpf/src/ffdc.C $ */
-/* */
-/* OpenPOWER sbe Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2016 */
-/* [+] 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 ffdc.C
- * @brief Implements the ffdc for sbe
- */
-
-#include <ffdc.H>
-#include <error_info.H>
-
-
-namespace fapi2
-{
-
-#ifdef MINIMUM_FFDC
- // buffer used to hold ffdc data
- SbeFfdcData_t g_FfdcData;
-#endif
-
-};
diff --git a/src/hwpf/src/plat/Makefile b/src/hwpf/src/plat/Makefile
deleted file mode 100644
index c121f162..00000000
--- a/src/hwpf/src/plat/Makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/hwpf/src/plat/Makefile $
-#
-# OpenPOWER sbe Project
-#
-# Contributors Listed Below - COPYRIGHT 2016
-# [+] 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
-# This Makefile is designed to be invoked with the -I argument
-include img_defs.mk
-include fapi2sbeplatfiles.mk
-
-OBJS := $(addprefix $(OBJDIR)/, $(FAPI2PLATLIB_OBJECTS))
-
-all: $(OBJS)
-
-
-$(OBJS) $(OBJS:.o=.d): | $(OBJDIR)
-
-$(OBJDIR):
- mkdir -p $(OBJDIR)
-
-ifneq ($(MAKECMDGOALS),clean)
-include $(OBJS:.o=.d)
-endif
-
diff --git a/src/hwpf/src/plat/fapi2sbeplatfiles.mk b/src/hwpf/src/plat/fapi2sbeplatfiles.mk
deleted file mode 100644
index b931f847..00000000
--- a/src/hwpf/src/plat/fapi2sbeplatfiles.mk
+++ /dev/null
@@ -1,53 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/hwpf/src/plat/fapi2sbeplatfiles.mk $
-#
-# OpenPOWER sbe Project
-#
-# Contributors Listed Below - COPYRIGHT 2015,2016
-# [+] 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 fapi2ppefiles.mk
-#
-# @brief mk for including fapi2 object files
-#
-# @page ChangeLogs Change Logs
-# @section fapi2ppefiles.mk
-# @verbatim
-#
-#
-# Change Log ******************************************************************
-# Flag Defect/Feature User Date Description
-# ------ -------------- ---------- ------------ -----------
-#
-# @endverbatim
-#
-##########################################################################
-# Object Files
-##########################################################################
-
-FAPI2PLAT-CPP-SOURCES += plat_hw_access.C
-FAPI2PLAT-CPP-SOURCES += plat_utils.C
-FAPI2PLAT-CPP-SOURCES += target.C
-
-FAPI2PLAT-C-SOURCES =
-FAPI2PLAT-S-SOURCES =
-
-
-FAPI2PLATLIB_OBJECTS += $(FAPI2PLAT-CPP-SOURCES:.C=.o) $(FAPI2PLAT-C-SOURCES:.c=.o) $(FAPI2PLAT-S-SOURCES:.S=.o)
-
diff --git a/src/hwpf/src/plat/plat_attribute_service.H b/src/hwpf/src/plat/plat_attribute_service.H
deleted file mode 100644
index 008132c3..00000000
--- a/src/hwpf/src/plat/plat_attribute_service.H
+++ /dev/null
@@ -1,1442 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/hwpf/src/plat/plat_attribute_service.H $ */
-/* */
-/* OpenPOWER sbe Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015,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 */
-/**
- * @file fapiPlatAttributeService.H
- *
- * @brief Defines the PLAT attribute access macros and defines which macro
- * handles each attribute.
- *
- */
-
-
-#ifndef FAPI2PLATATTRIBUTESERVICE_H_
-#define FAPI2PLATATTRIBUTESERVICE_H_
-
-#include <stdint.h>
-#include <stddef.h>
-#include <type_traits>
-#include <attribute_ids.H>
-#include <fapi2_chip_ec_feature.H>
-#include <plat_includes.H>
-#include "proc_sbe_fixed.H"
-#include "plat_target_parms.H"
-
-#define PLAT_GET_CHIP_EC_FEATURE_OVERRIDE(ID, PTARGET, VAL) \
- _getEcFeatureOverride<ID##_Type>(ID, PTARGET, VAL)
-
-#define PLAT_ATTR_INIT(ID, TARGET, VAL) \
- (fapi2::checkIdType<ID##_Type>(ID, VAL), \
- ID##_PLAT_INIT(ID, TARGET, VAL))
-
-/* INSERT NEW ATTRIBUTES HERE */
-
-
-/******************************************************************************/
-/* * Global macros * */
-/* These macros are called by the macros above to invoke the appropriate API. */
-/* These macros do not need to change when a new attribute is introduced. */
-/******************************************************************************/
-
-/* global get uint8_t 1D array macro */
-#define PLAT_ATTR_GET_UINT8_1D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeArrayShort<ID##_Type, static_cast<fapi2::TargetType>(ID##TargetType), ID> \
- (ID, PTARGET, VAL)
-
-/* global set uint8_t 1D array macro */
-#define PLAT_ATTR_SET_UINT8_1D_ARRAY(ID, PTARGET, VAL) \
- _setAttributeArrayShort<ID##_Type, static_cast<fapi2::TargetType>(ID##TargetType), ID> \
- (ID, PTARGET, VAL)
-
-/* global get uint8_t 2D array macro */
-#define PLAT_ATTR_GET_UINT8_2D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeArrayShort(ID, PTARGET, VAL[0])
-/* global set uint8_t 2D array macro */
-#define PLAT_ATTR_SET_UINT8_2D_ARRAY(ID, PTARGET, VAL) \
- _setAttributeArrayShort(ID, PTARGET, VAL[0])
-
-/* global get uint8_t 3D array macro */
-#define PLAT_ATTR_GET_UINT8_3D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeArrayShort(ID, PTARGET, VAL[0][0])
-/* global set uint8_t 3D array macro */
-#define PLAT_ATTR_SET_UINT8_3D_ARRAY(ID, PTARGET, VAL) \
- _setAttributeArrayShort(ID, PTARGET, VAL[0][0])
-
-/* global get uint8_t 4D array macro */
-#define PLAT_ATTR_GET_UINT8_4D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeArrayShort(ID, PTARGET, VAL[0][0][0])
-/* global set uint8_t 4D array macro */
-#define PLAT_ATTR_SET_UINT8_4D_ARRAY(ID, PTARGET, VAL) \
- _setAttributeArrayShort(ID, PTARGET, VAL[0][0][0])
-
-/* global get uint32_t 1D array macro */
-#define PLAT_ATTR_GET_UINT32_1D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeArrayWord(ID, PTARGET, VAL)
-/* global set uint32_t 1D array macro */
-#define PLAT_ATTR_SET_UINT32_1D_ARRAY(ID, PTARGET, VAL) \
- _setAttributeArrayWord(ID, PTARGET, VAL)
-
-/* global get uint32_t 2D array macro */
-#define PLAT_ATTR_GET_UINT32_2D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeArrayWord(ID, PTARGET, VAL[0])
-/* global set uint32_t 2D array macro */
-#define PLAT_ATTR_SET_UINT32_2D_ARRAY(ID, PTARGET, VAL) \
- _setAttributeArrayWord(ID, PTARGET, VAL[0])
-
-/* global get uint32_t 3D array macro */
-#define PLAT_ATTR_GET_UINT32_3D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeArrayWord(ID, PTARGET, VAL[0][0])
-/* global set uint32_t 3D array macro */
-#define PLAT_ATTR_SET_UINT32_3D_ARRAY(ID, PTARGET, VAL) \
- _setAttributeArrayWord(ID, PTARGET, VAL[0][0])
-
-/* global get uint32_t 4D array macro */
-#define PLAT_ATTR_GET_UINT32_4D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeArrayWord(ID, PTARGET, VAL[0][0][0])
-/* global set uint32_t 4D array macro */
-#define PLAT_ATTR_SET_UINT32_4D_ARRAY(ID, PTARGET, VAL) \
- _setAttributeArrayWord(ID, PTARGET, VAL[0][0][0])
-
-
-/* global get uint64_t 1D array macro */
-#define PLAT_ATTR_GET_UINT64_1D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeArrayDoubleWord(ID, PTARGET, VAL)
-/* global set uint64_t 1D array macro */
-#define PLAT_ATTR_SET_UINT64_1D_ARRAY(ID, PTARGET, VAL) \
- _setAttributeArrayDoubleWord(ID, PTARGET, VAL)
-
-/* global get uint64_t 2D array macro */
-#define PLAT_ATTR_GET_UINT64_2D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeArrayDoubleWord(ID, PTARGET, VAL[0])
-/* global set uint64_t 2D array macro */
-#define PLAT_ATTR_SET_UINT64_2D_ARRAY(ID, PTARGET, VAL) \
- _setAttributeArrayDoubleWord(ID, PTARGET, VAL[0])
-
-/* global get uint64_t 3D array macro */
-#define PLAT_ATTR_GET_UINT64_3D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeArrayDoubleWord(ID, PTARGET, VAL[0][0])
-/* global set uint64_t 3D array macro */
-#define PLAT_ATTR_SET_UINT64_3D_ARRAY(ID, PTARGET, VAL) \
- _setAttributeArrayDoubleWord(ID, PTARGET, VAL[0][0])
-
-/* global get uint64_t 4D array macro */
-#define PLAT_ATTR_GET_UINT64_4D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeArrayDoubleWord(ID, PTARGET, VAL[0][0][0])
-/* global set uint64_t 4D array macro */
-#define PLAT_ATTR_SET_UINT64_4D_ARRAY(ID, PTARGET, VAL) \
- _setAttributeArrayDoubleWord(ID, PTARGET, VAL[0][0][0])
-
-/* global get int macro (uint8_t, 16, 32 and 64) */
-#define PLAT_ATTR_GET_GLOBAL_INT(ID, PTARGET, VAL) \
- _get<ID##_Type, static_cast<fapi2::TargetType>(ID##_TargetType), ID> \
- (ID, PTARGET, VAL)
-
-/* global set int macro (uint8_t, 16, 32 and 64) */
-#define PLAT_ATTR_SET_GLOBAL_INT(ID, PTARGET, VAL) \
- _set<ID##_Type, static_cast<fapi2::TargetType>(ID##_TargetType), ID> \
- (ID, PTARGET, VAL)
-
-
-//here
-
-/******************************************************************************/
-// Get Override Macros
-/******************************************************************************/
-/* global get override uint8_t 1D array macro */
-#define PLAT_ATTR_GET_OVERRIDE_UINT8_1D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeOverrideArrayShort(ID, PTARGET, VAL)
-/* global get override uint8_t 2D array macro */
-#define PLAT_ATTR_GET_OVERRIDE_UINT8_2D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeOverrideArrayShort(ID, PTARGET, VAL[0])
-/* global get override uint8_t 3D array macro */
-#define PLAT_ATTR_GET_OVERRIDE_UINT8_3D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeOverrideArrayShort(ID, PTARGET, VAL[0][0])
-/* global get override uint8_t 4D array macro */
-#define PLAT_ATTR_GET_OVERRIDE_UINT8_4D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeOverrideArrayShort(ID, PTARGET, VAL[0][0][0])
-
-
-/* global get override uint32_t 1D array macro */
-#define PLAT_ATTR_GET_OVERRIDE_UINT32_1D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeOverrideArrayWord(ID, PTARGET, VAL)
-/* global get override uint32_t 2D array macro */
-#define PLAT_ATTR_GET_OVERRIDE_UINT32_2D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeOverrideArrayWord(ID, PTARGET, VAL[0])
-/* global get override uint32_t 3D array macro */
-#define PLAT_ATTR_GET_OVERRIDE_UINT32_3D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeOverrideArrayWord(ID, PTARGET, VAL[0][0])
-/* global get override uint32_t 4D array macro */
-#define PLAT_ATTR_GET_OVERRIDE_UINT32_4D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeOverrideArrayWord(ID, PTARGET, VAL[0][0][0])
-
-
-/* global get override uint64_t 1D array macro */
-#define PLAT_ATTR_GET_OVERRIDE_UINT64_1D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeOverrideArrayDoubleWord(ID, PTARGET, VAL)
-/* global get override uint64_t 2D array macro */
-#define PLAT_ATTR_GET_OVERRIDE_UINT64_2D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeOverrideArrayDoubleWord(ID, PTARGET, VAL[0])
-/* global get override uint64_t 3D array macro */
-#define PLAT_ATTR_GET_OVERRIDE_UINT64_3D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeOverrideArrayDoubleWord(ID, PTARGET, VAL[0][0])
-/* global get override uint64_t 4D array macro */
-#define PLAT_ATTR_GET_OVERRIDE_UINT64_4D_ARRAY(ID, PTARGET, VAL) \
- _getAttributeOverrideArrayDoubleWord(ID, PTARGET, VAL[0][0][0])
-
-/* global get override int macro (uint8_t, 32 and 64) */
-#define PLAT_ATTR_GET_OVERRIDE_GLOBAL_INT(ID, PTARGET, VAL) \
- _getOverride<ID##_Type>(ID, PTARGET, VAL)
-
-/******************************************************************************/
-// Get string
-/******************************************************************************/
-
-extern "C"
-{
- extern fapi2attr::SystemAttributes_t G_system_attributes asm("G_system_attributes") __attribute__ ((section (".fixed")));
- extern fapi2attr::ProcChipAttributes_t G_proc_chip_attributes asm("G_proc_chip_attributes") __attribute__ ((section (".fixed")));
- extern fapi2attr::PervAttributes_t G_perv_attributes asm("G_perv_attributes") __attribute__ ((section (".fixed")));
- extern fapi2attr::CoreAttributes_t G_core_attributes asm("G_core_attributes") __attribute__ ((section (".fixed")));
- extern fapi2attr::EQAttributes_t G_eq_attributes asm("G_eq_attributes") __attribute__ ((section (".fixed")));
- extern fapi2attr::EXAttributes_t G_ex_attributes asm("G_ex_attributes") __attribute__ ((section (".fixed")));
-
- extern fapi2attr::SystemAttributes_t* G_system_attributes_ptr;
- extern fapi2attr::ProcChipAttributes_t* G_proc_chip_attributes_ptr;
- extern fapi2attr::PervAttributes_t* G_perv_attributes_ptr;
- extern fapi2attr::CoreAttributes_t* G_core_attributes_ptr;
- extern fapi2attr::EQAttributes_t* G_eq_attributes_ptr;
- extern fapi2attr::EXAttributes_t* G_ex_attributes_ptr;
-
-}
-
-namespace fapi2
-{
-
-// Parameters are done as pointers (vs references) to allow the attribute
-// storage to be relocated
-template<TargetType K, typename TAttrStruct, typename TValue, AttributeId AId>
-void __set( const Target<K>& i_ptarget, TAttrStruct* object, const AttributeId attrid, const TValue& value );
-
-template<TargetType K, typename TAttrStruct, typename TValue, AttributeId AId>
-void __get( const Target<K>& i_ptarget, const TAttrStruct* object, const AttributeId attrid, TValue* value );
-
-#define ATTR_CHIP_UNIT_POS_GETMACRO PLAT_ATTR_GET_CHIP_UNIT_POS
-
-#define PLAT_ATTR_GET_CHIP_UNIT_POS(ID, PTARGET, VAL) \
- _getAttrChipUnitPos(PTARGET, VAL)
-
-template<TargetType K>
-inline
-AttributeRC _getAttrChipUnitPos(const Target<K>& i_target,
- ATTR_CHIP_UNIT_POS_Type& o_val)
-{
- o_val = i_target.get().getTargetInstance();
- return FAPI2_RC_SUCCESS;
-}
-
-template<>
-inline
-AttributeRC _getAttrChipUnitPos(const Target<TARGET_TYPE_PERV>& i_target,
- ATTR_CHIP_UNIT_POS_Type& o_val)
-{
- o_val = i_target.getChipletNumber();
- return FAPI2_RC_SUCCESS;
-}
-
-/* INSERT NEW GETTER AND SETTER FUNCTIONS HERE */
-
-
-
-//******************************************************************************
-// Get base template
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _get(const AttributeId i_id,
- const Target<K> & i_pTarget,
- T& o_value)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Get uint8_t
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _get(const AttributeId i_id,
- const Target<K> & i_pTarget,
- uint8_t& o_value)
-{
- static_assert(std::is_same<T, uint8_t>::value, "Attribute type mismatch");
-
- if(K & TARGET_TYPE_SYSTEM)
- {
- __get<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_PROC_CHIP)
- {
- __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_PERV)
- {
- __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_CORE)
- {
- __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_EQ)
- {
- __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_EX)
- {
- __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value );
- }
-
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Get uint16_t
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _get(const AttributeId i_id,
- const Target<K> & i_pTarget,
- uint16_t& o_value)
-{
- static_assert(std::is_same<T, uint16_t>::value, "Attribute type mismatch");
-
- if(K & TARGET_TYPE_SYSTEM)
- {
- __get<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_PROC_CHIP)
- {
- __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_PERV)
- {
- __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_CORE)
- {
- __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_EQ)
- {
- __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_EX)
- {
- __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value );
- }
-
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Get uint32_t
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _get(const AttributeId i_id,
- const Target<K> & i_pTarget,
- uint32_t& o_value)
-{
- static_assert(std::is_same<T, uint32_t>::value, "Attribute type mismatch");
-
- if(K & TARGET_TYPE_SYSTEM)
- {
- __get<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_PROC_CHIP)
- {
- __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_PERV)
- {
- __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_CORE)
- {
- __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_EQ)
- {
- __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_EX)
- {
- __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value );
- }
-
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Get uint64_t
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _get(const AttributeId i_id,
- const Target<K> & i_pTarget,
- uint64_t& o_value)
-{
- static_assert(std::is_same<T, uint64_t>::value, "Attribute type mismatch");
-
- if(K & TARGET_TYPE_SYSTEM)
- {
- __get<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_PROC_CHIP)
- {
- __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_PERV)
- {
- __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_CORE)
- {
- __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_EQ)
- {
- __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_EX)
- {
- __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value );
- }
-
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Get Override uint8_t
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _getOverride(const AttributeId i_id,
- const Target<K> & i_pTarget,
- uint8_t& o_value)
-{
- static_assert(std::is_same<T, uint8_t>::value, "Attribute type mismatch");
-
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Get Override uint16_t
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _getOverride(const AttributeId i_id,
- const Target<K> & i_pTarget,
- uint16_t& o_value)
-{
- static_assert(std::is_same<T, uint16_t>::value, "Attribute type mismatch");
-
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Get Override uint32_t
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _getOverride(const AttributeId i_id,
- const Target<K> & i_pTarget,
- uint32_t& o_value)
-{
- static_assert(std::is_same<T, uint32_t>::value, "Attribute type mismatch");
-
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Get Override uint64_t
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _getOverride(const AttributeId i_id,
- const Target<K> & i_pTarget,
- uint64_t& o_value)
-{
- static_assert(std::is_same<T, uint64_t>::value, "Attribute type mismatch");
-
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Get override EC Feature (uint8_t)
-//******************************************************************************
-template<typename T, TargetType K>
-AttributeRC _getEcFeatureOverride(const AttributeId i_id,
- const Target<K> & i_pTarget,
- uint8_t& o_value)
-{
- static_assert(std::is_same<T, uint8_t>::value, "Attribute type mismatch");
-
- // The way this is implemented, we want to return a non-zero return code if we found an override.
- // Return 0 if there was an error.
- // This is how it's implemented:
- // PLAT_GET_CHIP_EC_FEATURE_OVERRIDE(ID, PTARGET, VAL) ? fapi::FAPI_RC_SUCCESS : fapi::fapiQueryChipEcFeature(fapi::ID, PTARGET, VAL)
-
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Get uint8_t array
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _getAttributeArrayShort(const AttributeId i_id,
- const Target<K> & i_pTarget,
- uint8_t * o_pValues)
-{
-// fapi2::Attributeta o_data;
-// fapi2::ReturnCode l_fapi_rc(FAPI2_RC_SUCCESS);
-// uint32_t l_ecmd_rc = ECMD_SUCCESS;
-//
-// ecmdChipTarget l_ecmd_target;
-// fapiTargetPointerToEcmdTarget(i_pTarget, l_ecmd_target);
-//
-// o_data.faValidMask = FAPI_ATTRIBUTE_TYPE_UINT8ARY;
-// o_data.faUint8ary = o_pValues;
-//
-// l_ecmd_rc = fapi2GetAttribute(l_ecmd_target, i_id, o_data);
-// if (l_ecmd_rc)
-// {
-// l_fapi_rc = (ReturnCodes) l_ecmd_rc;
-// }
-// return l_fapi_rc;
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Set uint8_t array
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _setAttributeArrayShort(const AttributeId i_id,
- const Target<K> & i_pTarget,
- uint8_t * i_pValues)
-{
- if(K & TARGET_TYPE_SYSTEM)
- {
- __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, *i_pValues );
- }
-
- if(K & TARGET_TYPE_PROC_CHIP)
- {
- __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, *i_pValues );
- }
-
- if(K & TARGET_TYPE_PERV)
- {
- __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, *i_pValues );
- }
-
- if(K & TARGET_TYPE_CORE)
- {
- __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, *i_pValues );
- }
-
- if(K & TARGET_TYPE_EQ)
- {
- __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, *i_pValues );
- }
-
- if(K & TARGET_TYPE_EX)
- {
- __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, *i_pValues );
- }
-
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Get uint16_t array
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _getAttributeArrayWord(const AttributeId i_id,
- const Target<K> & i_pTarget,
- uint16_t * o_pValues)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Set uint16_t array
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _setAttributeArrayWord(const AttributeId i_id,
- const Target<K> & i_pTarget,
- uint16_t * i_pValues)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Get uint32_t array
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _getAttributeArrayWord(const AttributeId i_id,
- const Target<K> & i_pTarget,
- uint32_t * o_pValues)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Set uint32_t array
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _setAttributeArrayWord(const AttributeId i_id,
- const Target<K> & i_pTarget,
- uint32_t * i_pValues)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Get uint64_t array
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _getAttributeArrayDoubleWord(const AttributeId i_id,
- const Target<K> & i_pTarget,
- uint64_t * o_pValues)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Set uint64_t array
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _setAttributeArrayDoubleWord(const AttributeId i_id,
- const Target<K> & i_pTarget,
- uint64_t * i_pValues)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Get Override uint8_t array
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _getAttributeOverrideArrayShort(const AttributeId i_id,
- const Target<K> & i_pTarget,
- uint8_t * o_pValues)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Get Override uint16_t array
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _getAttributeOverrideArrayWord(const AttributeId i_id,
- const Target<K> & i_pTarget,
- uint16_t * o_pValues)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Get Override uint32_t array
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _getAttributeOverrideArrayWord(const AttributeId i_id,
- const Target<K> & i_pTarget,
- uint32_t * o_pValues)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Get Override uint64_t array
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _getAttributeOverrideArrayDoubleWord(const AttributeId i_id,
- const Target<K> & i_pTarget,
- uint64_t * o_pValues)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Set base template
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _set(const AttributeId i_id,
- const Target<K> & i_pTarget,
- const T& i_value)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-
-
-//******************************************************************************
-// Set uint8_t
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _set(const AttributeId i_id,
- const Target<K> & i_pTarget,
- const uint8_t& i_value)
-{
- static_assert(std::is_same<T, uint8_t>::value, "Attribute type mismatch"); // May need to remove
-
- if(K & TARGET_TYPE_SYSTEM)
- {
- __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_PROC_CHIP)
- {
- __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_PERV)
- {
- __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_CORE)
- {
- __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_EQ)
- {
- __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_EX)
- {
- __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, i_value );
- }
-
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Set uint16_t
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _set(const AttributeId i_id,
- const Target<K> & i_pTarget,
- const uint16_t& i_value)
-{
- static_assert(std::is_same<T, uint16_t>::value, "Attribute type mismatch"); // May need to remove
-
- if(K & TARGET_TYPE_SYSTEM)
- {
- __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_PROC_CHIP)
- {
- __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_PERV)
- {
- __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_CORE)
- {
- __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_EQ)
- {
- __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_EX)
- {
- __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, i_value );
- }
-
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Set uint32_t
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _set(const AttributeId i_id,
- const Target<K> & i_pTarget,
- const uint32_t& i_value)
-{
- static_assert(std::is_same<T, uint32_t>::value, "Attribute type mismatch"); // May need to remove
-
- if(K & TARGET_TYPE_SYSTEM)
- {
- __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_PROC_CHIP)
- {
- __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_PERV)
- {
- __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_CORE)
- {
- __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_EQ)
- {
- __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id,i_value );
- }
-
- if(K & TARGET_TYPE_EX)
- {
- __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, i_value );
- }
-
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Set uint64_t
-//******************************************************************************
-
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _set(const AttributeId i_id,
- const Target<K> & i_pTarget,
- const uint64_t & i_value)
-{
- static_assert(std::is_same<T, uint64_t>::value, "Attribute type mismatch"); // May need to remove
-
- if(K & TARGET_TYPE_SYSTEM)
- {
- __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_PROC_CHIP)
- {
- __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_PERV)
- {
- __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_CORE)
- {
- __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_EQ)
- {
- __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_EX)
- {
- __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, i_value );
- }
-
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Get int8_t
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _get(const AttributeId i_id,
- const Target<K> & i_pTarget,
- int8_t& o_value)
-{
- static_assert(std::is_same<T, int8_t>::value, "Attribute type mismatch");
-
- if(K & TARGET_TYPE_SYSTEM)
- {
- __get<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_PROC_CHIP)
- {
- __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_PERV)
- {
- __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_CORE)
- {
- __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_EQ)
- {
- __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_EX)
- {
- __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value );
- }
-
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Get int16_t
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _get(const AttributeId i_id,
- const Target<K> & i_pTarget,
- int16_t& o_value)
-{
- static_assert(std::is_same<T, int16_t>::value, "Attribute type mismatch");
-
- if(K & TARGET_TYPE_SYSTEM)
- {
- __get<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_PROC_CHIP)
- {
- __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_PERV)
- {
- __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_CORE)
- {
- __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_EQ)
- {
- __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_EX)
- {
- __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value );
- }
-
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Get int32_t
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _get(const AttributeId i_id,
- const Target<K> & i_pTarget,
- int32_t& o_value)
-{
- static_assert(std::is_same<T, int32_t>::value, "Attribute type mismatch");
-
- if(K & TARGET_TYPE_SYSTEM)
- {
- __get<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_PROC_CHIP)
- {
- __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_PERV)
- {
- __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_CORE)
- {
- __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_EQ)
- {
- __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_EX)
- {
- __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value );
- }
-
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Get int64_t
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _get(const AttributeId i_id,
- const Target<K> & i_pTarget,
- int64_t& o_value)
-{
- static_assert(std::is_same<T, int64_t>::value, "Attribute type mismatch");
-
- if(K & TARGET_TYPE_SYSTEM)
- {
- __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_PROC_CHIP)
- {
- __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_PERV)
- {
- __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_CORE)
- {
- __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_EQ)
- {
- __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value );
- }
-
- if(K & TARGET_TYPE_EX)
- {
- __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value );
- }
-
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Get Override int8_t
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _getOverride(const AttributeId i_id,
- const Target<K> & i_pTarget,
- int8_t& o_value)
-{
- static_assert(std::is_same<T, int8_t>::value, "Attribute type mismatch");
-
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Get Override int16_t
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _getOverride(const AttributeId i_id,
- const Target<K> & i_pTarget,
- int16_t& o_value)
-{
- static_assert(std::is_same<T, int16_t>::value, "Attribute type mismatch");
-
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Get Override int32_t
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _getOverride(const AttributeId i_id,
- const Target<K> & i_pTarget,
- int32_t& o_value)
-{
- static_assert(std::is_same<T, int32_t>::value, "Attribute type mismatch");
-
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Get Override int64_t
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _getOverride(const AttributeId i_id,
- const Target<K> & i_pTarget,
- int64_t& o_value)
-{
- static_assert(std::is_same<T, int64_t>::value, "Attribute type mismatch");
-
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Get int8_t array
-//******************************************************************************
-template<TargetType K>
-AttributeRC _getAttributeArraySignedShort(const AttributeId i_id,
- const Target<K> & i_pTarget,
- int8_t * o_pValues)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Set int8_t array
-//******************************************************************************
-template<TargetType K>
-AttributeRC _setAttributeArraySignedShort(const AttributeId i_id,
- const Target<K> & i_pTarget,
- int8_t * i_pValues)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Get int16_t array
-//******************************************************************************
-template<TargetType K>
-AttributeRC _getAttributeArraySignedWord(const AttributeId i_id,
- const Target<K> & i_pTarget,
- int16_t * o_pValues)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Set int16_t array
-//******************************************************************************
-template<TargetType K>
-AttributeRC _setAttributeArraySignedWord(const AttributeId i_id,
- const Target<K> & i_pTarget,
- int16_t * i_pValues)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Get int32_t array
-//******************************************************************************
-template<TargetType K>
-AttributeRC _getAttributeArraySignedWord(const AttributeId i_id,
- const Target<K> & i_pTarget,
- int32_t * o_pValues)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Set int32_t array
-//******************************************************************************
-template<TargetType K>
-AttributeRC _setAttributeArraySignedWord(const AttributeId i_id,
- const Target<K> & i_pTarget,
- int32_t * i_pValues)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Get int64_t array
-//******************************************************************************
-template<TargetType K>
-AttributeRC _getAttributeArraySignedDoubleWord(const AttributeId i_id,
- const Target<K> & i_pTarget,
- int64_t * o_pValues)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Set int64_t array
-//******************************************************************************
-template<TargetType K>
-AttributeRC _setAttributeArraySignedDoubleWord(const AttributeId i_id,
- const Target<K> & i_pTarget,
- int64_t * i_pValues)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Get Override int8_t array
-//******************************************************************************
-template<TargetType K>
-AttributeRC _getAttributeOverrideArraySignedShort(const AttributeId i_id,
- const Target<K> & i_pTarget,
- int8_t * o_pValues)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Get Override int16_t array
-//******************************************************************************
-template<TargetType K>
-AttributeRC _getAttributeOverrideArraySignedWord(const AttributeId i_id,
- const Target<K> & i_pTarget,
- int16_t * o_pValues)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Get Override int32_t array
-//******************************************************************************
-template<TargetType K>
-AttributeRC _getAttributeOverrideArraySignedWord(const AttributeId i_id,
- const Target<K> & i_pTarget,
- int32_t * o_pValues)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Get Override int64_t array
-//******************************************************************************
-template<TargetType K>
-AttributeRC _getAttributeOverrideArraySignedDoubleWord(const AttributeId i_id,
- const Target<K> & i_pTarget,
- int64_t * o_pValues)
-{
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Set int8_t
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _set(const AttributeId i_id,
- const Target<K> & i_pTarget,
- const int8_t& i_value)
-{
- static_assert(std::is_same<T, int8_t>::value, "Attribute type mismatch"); // May need to remove
-
- if(K & TARGET_TYPE_SYSTEM)
- {
- __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_PROC_CHIP)
- {
- __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_PERV)
- {
- __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_CORE)
- {
- __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_EQ)
- {
- __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_EX)
- {
- __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, i_value );
- }
-
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Set int16_t
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _set(const AttributeId i_id,
- const Target<K> & i_pTarget,
- const int16_t& i_value)
-{
- static_assert(std::is_same<T, int16_t>::value, "Attribute type mismatch"); // May need to remove
-
- if(K & TARGET_TYPE_SYSTEM)
- {
- __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_PROC_CHIP)
- {
- __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_PERV)
- {
- __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_CORE)
- {
- __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_EQ)
- {
- __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_EX)
- {
- __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, i_value );
- }
-
- return FAPI2_RC_SUCCESS;
-}
-
-//******************************************************************************
-// Set int32_t
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _set(const AttributeId i_id,
- const Target<K> & i_pTarget,
- const int32_t& i_value)
-{
- static_assert(std::is_same<T, int32_t>::value, "Attribute type mismatch"); // May need to remove
-
- if(K & TARGET_TYPE_SYSTEM)
- {
- __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_PROC_CHIP)
- {
- __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_PERV)
- {
- __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_CORE)
- {
- __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_EQ)
- {
- __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_EX)
- {
- __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, i_value );
- }
-
- return FAPI2_RC_SUCCESS;
-}
-
-
-//******************************************************************************
-// Set int64_t
-//******************************************************************************
-template<typename T, TargetType K, AttributeId A>
-AttributeRC _set(const AttributeId i_id,
- const Target<K> & i_pTarget,
- const int64_t & i_value)
-{
- static_assert(std::is_same<T, int64_t>::value, "Attribute type mismatch"); // May need to remove
-
- if(K & TARGET_TYPE_SYSTEM)
- {
- __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_PROC_CHIP)
- {
- __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_PERV)
- {
- __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_CORE)
- {
- __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_EQ)
- {
- __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, i_value );
- }
-
- if(K & TARGET_TYPE_EX)
- {
- __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, i_value );
- }
-
- return FAPI2_RC_SUCCESS;
-}
-
-
-} // namespace fapi2
-#endif // FAPIPLATATTRIBUTESERVICE_H_
diff --git a/src/hwpf/src/plat/plat_hw_access.C b/src/hwpf/src/plat/plat_hw_access.C
deleted file mode 100644
index 8508eda1..00000000
--- a/src/hwpf/src/plat/plat_hw_access.C
+++ /dev/null
@@ -1,358 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/hwpf/src/plat/plat_hw_access.C $ */
-/* */
-/* OpenPOWER sbe Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2016,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 <fapi2.H>
-#include "hw_access.H"
-#include "plat_hw_access.H"
-#include "p9_perv_scom_addresses.H"
-#include <p9_putRingUtils.H>
-
-namespace fapi2
-{
-
-struct restoreOpcgRegisters g_opcgData;
-
-uint64_t decodeScanRegionData(const uint32_t i_ringAddress)
-{
- uint32_t l_scan_region = (i_ringAddress & 0x0000FFF0) << 13;
-
- uint32_t l_scan_type = 0x00008000 >> (i_ringAddress & 0x0000000F);
-
- // This is special case if encoded type is 0xF
-
- if ( (i_ringAddress & 0x0000000F) == 0xF)
- {
- l_scan_type = 0x00008000 | (l_scan_type << 12);
- }
- uint64_t l_value = l_scan_region;
- l_value = (l_value << 32) | l_scan_type;
-
- return l_value;
-}
-
-ReturnCode getRing_setup(const uint32_t i_ringAddress,
- const RingMode i_ringMode)
-{
- fapi2::ReturnCode l_rc = FAPI2_RC_SUCCESS;
- uint64_t l_scanRegion = 0;
- uint32_t l_chipletId = i_ringAddress >> 24;
-
- Target<fapi2::TARGET_TYPE_PROC_CHIP> l_proc = plat_getChipTarget();
-
- do
- {
- l_scanRegion = decodeScanRegionData(i_ringAddress);
-
- if (i_ringMode & fapi2::RING_MODE_SET_PULSE_SL)
- {
- l_rc = storeOPCGRegData (l_proc, g_opcgData, l_chipletId);
- if(l_rc != fapi2::FAPI2_RC_SUCCESS)
- {
- break;
- }
-
- l_rc = setupScanRegionForSetPulse(l_proc, l_scanRegion,
- i_ringMode,l_chipletId);
- if(l_rc != fapi2::FAPI2_RC_SUCCESS)
- {
- break;
- }
- }
- else
- {
- // Set up the scan region for the ring.
- l_rc = setupScanRegion(l_proc, l_scanRegion, l_chipletId);
- if(l_rc != fapi2::FAPI2_RC_SUCCESS)
- {
- break;
- }
- }
- // Write a 64 bit value for header.
- const uint64_t l_header = 0xa5a5a5a5a5a5a5a5;
- uint32_t l_scomAddress = 0x0003E000 | (i_ringAddress & 0xFF000000);
- l_rc = fapi2::putScom(l_proc, l_scomAddress, l_header);
- if(l_rc != fapi2::FAPI2_RC_SUCCESS)
- {
- break;
- }
-
- }while(0);
-
- return l_rc;
-}
-
-ReturnCode getRing_verifyAndcleanup(const uint32_t i_ringAddress,
- const RingMode i_ringMode)
-{
- fapi2::ReturnCode l_rc = FAPI2_RC_SUCCESS;
- uint32_t l_chipletId = i_ringAddress >> 24;
-
- fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> l_proc;
-
- do
- {
- // Verify header
- uint64_t l_header = 0xa5a5a5a5a5a5a5a5;
- l_rc = verifyHeader(l_proc, l_header, l_chipletId,i_ringMode);
- if(l_rc != fapi2::FAPI2_RC_SUCCESS)
- {
- break;
- }
-
- l_rc = cleanScanRegionandTypeData(l_proc, l_chipletId);
- if(l_rc != fapi2::FAPI2_RC_SUCCESS)
- {
- break;
- }
-
- if (i_ringMode & fapi2::RING_MODE_SET_PULSE_SL)
- {
- l_rc = restoreOPCGRegData(l_proc, g_opcgData, l_chipletId);
- if(l_rc != fapi2::FAPI2_RC_SUCCESS)
- {
- break;
- }
- }
-
- }while(0);
-
- return l_rc;
-}
-
-static uint32_t getEffectiveAddress(const plat_target_handle_t &i_target, const uint32_t i_addr)
-{
- ScomAddr l_addr(i_addr);
- switch(i_target.getTargetType())
- {
- case PPE_TARGET_TYPE_EX:
- if((EQ_CHIPLET_OFFSET <= l_addr.iv_chiplet) &&
- ((EQ_CHIPLET_OFFSET + EQ_TARGET_COUNT) > l_addr.iv_chiplet))
- {
- l_addr.iv_chiplet = i_target.fields.chiplet_num;
- l_addr.iv_ring = (l_addr.iv_ring - (l_addr.iv_ring % 2)) +
- (i_target.getTargetInstance() % 2);
- }
- else if ((CORE_CHIPLET_OFFSET <= l_addr.iv_chiplet) &&
- ((CORE_CHIPLET_OFFSET + CORE_TARGET_COUNT) > l_addr.iv_chiplet))
- {
- l_addr.iv_chiplet = CORE_CHIPLET_OFFSET + (l_addr.iv_chiplet % 2) +
- (i_target.getTargetInstance() * 2);
- }
- else
- {
- assert(false);
- }
- break;
- case PPE_TARGET_TYPE_MCS:
- l_addr.iv_chiplet = i_target.fields.chiplet_num;
- l_addr.iv_satId = (2 * (i_target.getTargetInstance() % 2));
- break;
- case PPE_TARGET_TYPE_PHB:
- if(l_addr.iv_chiplet == N2_CHIPLET)
- {
- if (i_target.getTargetInstance() == 0)
- {
- l_addr.iv_ring = 0x3;
- l_addr.iv_satId = ((l_addr.iv_satId < 4) ? (1) : (4));
- }
- else
- {
- l_addr.iv_ring = (0x3 + (i_target.getTargetInstance() / 3) + 1) & 0xF;
- l_addr.iv_satId = ((l_addr.iv_satId < 4) ? (1) : (4)) +
- ((i_target.getTargetInstance() % 2) ? (0) : (1)) +
- (2 * (i_target.getTargetInstance() / 5));
- }
- }
- else
- {
- l_addr.iv_chiplet = i_target.fields.chiplet_num;
- if (i_target.getTargetInstance() == 0)
- {
- l_addr.iv_satId = ((l_addr.iv_satId < 4) ? (1) : (4));
- }
- else
- {
- l_addr.iv_satId = (((l_addr.iv_satId < 4) ? (1) : (4)) +
- ((i_target.getTargetInstance() % 2) ? (0) : (1)) +
- (2 * (i_target.getTargetInstance() / 5)));
- }
- }
- break;
- default:
- if(0 != i_target.getAddressOverlay())
- {
- l_addr.iv_chiplet = i_target.fields.chiplet_num;
- }
- break;
- }
- return l_addr;
-}
-
-static fapi2::ReturnCode pibRcToFapiRc(const uint32_t i_pibRc)
-{
- fapi2::ReturnCode l_fapiRc = FAPI2_RC_SUCCESS;
- switch(i_pibRc)
- {
- case PIB_XSCOM_ERROR:
- l_fapiRc = RC_SBE_PIB_XSCOM_ERROR;
- break;
- case PIB_OFFLINE_ERROR:
- l_fapiRc = RC_SBE_PIB_OFFLINE_ERROR;
- break;
- case PIB_PARTIAL_ERROR:
- l_fapiRc = RC_SBE_PIB_PARTIAL_ERROR;
- break;
- case PIB_ADDRESS_ERROR:
- l_fapiRc = RC_SBE_PIB_ADDRESS_ERROR;
- break;
- case PIB_CLOCK_ERROR:
- l_fapiRc = RC_SBE_PIB_CLOCK_ERROR;
- break;
- case PIB_PARITY_ERROR:
- l_fapiRc = RC_SBE_PIB_PARITY_ERROR;
- break;
- case PIB_TIMEOUT_ERROR:
- l_fapiRc = RC_SBE_PIB_TIMEOUT_ERROR;
- break;
- case PIB_NO_ERROR:
- default:
- break;
- }
- return l_fapiRc;
-}
-
-fapi2::ReturnCode getscom_abs_wrap(const void *i_target,
- const uint32_t i_addr, uint64_t *o_data)
-{
- uint32_t l_pibRc = 0;
- uint32_t l_addr = getEffectiveAddress(*(plat_target_handle_t*)i_target, i_addr);
- FAPI_INF("getScom: address: 0x%08X", l_addr);
- l_pibRc = getscom_abs(l_addr, o_data);
- if( PIB_NO_ERROR != l_pibRc )
- {
- l_pibRc = p9_pibErrRetry( l_addr, o_data, l_pibRc, true);
- }
- FAPI_INF("getScom: returned pibRc: 0x%08X, data HI: 0x%08X, "
- "data LO: 0x%08X", l_pibRc, (*o_data >> 32),
- static_cast<uint32_t>(*o_data & 0xFFFFFFFF));
- fapi2::current_err = fapi2::FAPI2_RC_SUCCESS;
- // Setting 64bit address in ffdc package as the parsers are
- // hard coded to read 64bit address
- const uint64_t ffdcAddr = l_addr;
- PLAT_FAPI_ASSERT( PIB_NO_ERROR == l_pibRc,
- SBE_SCOM_FAILURE().
- set_address(ffdcAddr).
- set_pcb_pib_rc(l_pibRc),
- "getScom:pcb pib error, pibRc[0x%08X] Scom_Addr[0x%08X]",
- l_pibRc,l_addr);
-fapi_try_exit:
- if(PIB_NO_ERROR != l_pibRc)
- {
- // Override FAPI RC based on PIB RC
- fapi2::current_err = pibRcToFapiRc(l_pibRc);
- fapi2::g_FfdcData.fapiRc = fapi2::current_err;
- }
- return fapi2::current_err;
-}
-
-fapi2::ReturnCode putscom_abs_wrap(const void *i_target,
- const uint32_t i_addr, uint64_t i_data)
-{
- uint32_t l_pibRc = 0;
- uint32_t l_addr = getEffectiveAddress(*(plat_target_handle_t*)i_target,
- i_addr);
- FAPI_INF("putScom: address: 0x%08X, data HI: 0x%08X, data LO: 0x%08X",
- l_addr, (i_data >> 32),
- static_cast<uint32_t>(i_data & 0xFFFFFFFF));
- l_pibRc = putscom_abs(l_addr, i_data);
- if( PIB_NO_ERROR != l_pibRc )
- {
- l_pibRc = p9_pibErrRetry( l_addr, &i_data, l_pibRc, false);
- }
- FAPI_INF("putScom: returned pibRc: 0x%08X", l_pibRc);
- fapi2::current_err = fapi2::FAPI2_RC_SUCCESS;
- // Setting 64bit address in ffdc package as the parsers are
- // hard coded to read 64bit address
- const uint64_t ffdcAddr = l_addr;
- PLAT_FAPI_ASSERT( PIB_NO_ERROR == l_pibRc,
- SBE_SCOM_FAILURE().
- set_address(ffdcAddr).
- set_pcb_pib_rc(l_pibRc),
- "putScom:pcb pib error, pibRc[0x%08X] Scom_Addr[0x%08X] "
- "Scom_Data[0x%08X%08X]",
- l_pibRc,l_addr,(i_data >> 32),
- static_cast<uint32_t>(i_data & 0xFFFFFFFF));
-fapi_try_exit:
- if(PIB_NO_ERROR != l_pibRc)
- {
- // Override FAPI RC based on PIB RC
- fapi2::current_err = pibRcToFapiRc(l_pibRc);
- fapi2::g_FfdcData.fapiRc = fapi2::current_err;
- }
- return fapi2::current_err;
-}
-
-uint32_t p9_pibErrRetry( const uint32_t i_addr, uint64_t *io_data,
- const uint8_t i_pibErr, const bool i_isRead)
-{
- FAPI_INF("Entering p9_pibErrRetry");
- static const uint8_t MAX_RETRIES = 2;
- uint8_t l_retryCount = 0;
- uint32_t pibErr = i_pibErr;
-
- do
- {
- // Only retry for parity and timeout errors
- if (( i_pibErr != PIB_PARITY_ERROR )
- && ( i_pibErr != PIB_TIMEOUT_ERROR ))
- {
- break;
- }
- for(l_retryCount = 0; l_retryCount < MAX_RETRIES; l_retryCount++)
- {
- FAPI_DBG( "*** Retry %i ***", l_retryCount );
-
- if ( i_isRead )
- {
- pibErr = getscom_abs(i_addr, io_data);
- }
- else
- {
- pibErr = putscom_abs(i_addr, *io_data);
- }
-
- if( PIB_NO_ERROR == pibErr )
- {
- FAPI_INF("Read/Write Retry Successful");
- break;
- }
- if ( pibErr != i_pibErr ) break;
- }
- }while(0);
- FAPI_INF("Exiting p9_pibErrRetry");
- return pibErr;
-}
-
-};
diff --git a/src/hwpf/src/plat/plat_utils.C b/src/hwpf/src/plat/plat_utils.C
deleted file mode 100644
index fe810f4f..00000000
--- a/src/hwpf/src/plat/plat_utils.C
+++ /dev/null
@@ -1,197 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/hwpf/src/plat/plat_utils.C $ */
-/* */
-/* OpenPOWER sbe Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015,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 */
-
-/**
- * @file plat_utils.C
- * @brief Implements fapi2 common utilities
- */
-
-#include <stdint.h>
-#include <fapi2_attribute_service.H>
-#include <attribute_ids.H>
-#include <return_code.H>
-#include <plat_trace.H>
-#include <target.H>
-#include <sbeutil.H>
-#include <sbeglobals.H>
-
-namespace fapi2
-{
-
- // Define own function rather than using PK function
- // This is required as PK function does not scale well for low
- // frequency till istep 2.7
- inline uint64_t delayCycles(uint64_t i_nanoSeconds )
- {
- return ( i_nanoSeconds/1000) * ( SBE_GLOBAL->sbefreq /(1000*1000));
- }
- /// @brief Delay this thread.
- ///
- ReturnCode delay(uint64_t i_nanoSeconds, uint64_t i_simCycles, bool i_fixed /* = false*/)
- {
- // void statements to keep the compiler from complaining
- // about unused variables.
- static_cast<void>(i_nanoSeconds);
- static_cast<void>(i_simCycles);
-
-
-#ifndef __FAPI_DELAY_SIM__
-
- PkTimebase target_time;
- PkTimebase current_time;
- PkMachineContext ctx;
-
-
- // Only execute if nanoSeconds is non-zero (eg a real wait)
- if (i_nanoSeconds)
- {
- // The critical section enter/exit set is done to ensure the timebase
- // operations are non-interrupible.
-
- pk_critical_section_enter(&ctx);
-
- target_time = pk_timebase_get() + delayCycles( i_nanoSeconds);
-
- do
- {
- current_time = pk_timebase_get();
- } while (target_time > current_time);
-
- pk_critical_section_exit(&ctx);
- }
-#else
-
- // Execute a tight loop that simply counts down the i_simCycles
- // value.
-
- // @todo This can might be optimized with a fused compare branch loop
- // Note, though, that subwibnz instruction is optimized for word
- // operations. i_simCycles are uint64_t values so the upper
- // word values needs to be accounted for.
- //
- // Need to determine if this optimization is worth the effort.
-
-#ifndef __FAPI_DELAY_PPE_SIM_CYCLES__
-#define __FAPI_DELAY_PPE_SIM_CYCLES__ 8
-#endif
-
- static const uint8_t NUM_OVERHEAD_INSTRS = 15;
- static const uint8_t NUM_LOOP_INSTRS = 4;
- static const uint64_t MIN_DELAY_CYCLES =
- ((NUM_OVERHEAD_INSTRS + NUM_LOOP_INSTRS) * __FAPI_DELAY_PPE_SIM_CYCLES__);
-
- uint64_t l_adjusted_simcycles;
-
- if (i_simCycles < MIN_DELAY_CYCLES)
- l_adjusted_simcycles = MIN_DELAY_CYCLES;
- else
- l_adjusted_simcycles = i_simCycles;
-
- uint64_t delay_loop_count =
- ((l_adjusted_simcycles - (NUM_OVERHEAD_INSTRS * __FAPI_DELAY_PPE_SIM_CYCLES__)) /
- (NUM_LOOP_INSTRS * __FAPI_DELAY_PPE_SIM_CYCLES__));
-
- for (auto i = delay_loop_count; i > 0; --i) {
- // Force compiler not to optimize for loop
- asm("");
- }
-
-#endif
-
- // replace with platform specific implementation
- return FAPI2_RC_SUCCESS;
- }
-
- ///
- /// @brief Queries the ATTR_NAME and ATTR_EC attributes
- ///
- void queryChipEcAndName(
- const Target < fapi2::TARGET_TYPE_PROC_CHIP > & i_target,
- fapi2::ATTR_NAME_Type& o_chipName, fapi2::ATTR_EC_Type& o_chipEc )
- {
-
- FAPI_ATTR_GET_PRIVILEGED(fapi2::ATTR_NAME, i_target, o_chipName);
-
- FAPI_ATTR_GET_PRIVILEGED(fapi2::ATTR_EC, i_target, o_chipEc);
- }
-};
-
-#ifndef _BIG_ENDIAN
-
-/// Byte-reverse a 16-bit integer if on a little-endian machine
-
-uint16_t
-revle16(uint16_t i_x)
-{
- uint16_t rx;
- uint8_t *pix = (uint8_t*)(&i_x);
- uint8_t *prx = (uint8_t*)(&rx);
-
- prx[0] = pix[1];
- prx[1] = pix[0];
-
- return rx;
-}
-
-/// Byte-reverse a 32-bit integer if on a little-endian machine
-
-uint32_t
-revle32(uint32_t i_x)
-{
- uint32_t rx;
- uint8_t *pix = (uint8_t*)(&i_x);
- uint8_t *prx = (uint8_t*)(&rx);
-
- prx[0] = pix[3];
- prx[1] = pix[2];
- prx[2] = pix[1];
- prx[3] = pix[0];
-
- return rx;
-}
-
-
-/// Byte-reverse a 64-bit integer if on a little-endian machine
-
-uint64_t
-revle64(const uint64_t i_x)
-{
- uint64_t rx;
- uint8_t *pix = (uint8_t*)(&i_x);
- uint8_t *prx = (uint8_t*)(&rx);
-
- prx[0] = pix[7];
- prx[1] = pix[6];
- prx[2] = pix[5];
- prx[3] = pix[4];
- prx[4] = pix[3];
- prx[5] = pix[2];
- prx[6] = pix[1];
- prx[7] = pix[0];
-
- return rx;
-}
-#endif
-
diff --git a/src/hwpf/src/plat/target.C b/src/hwpf/src/plat/target.C
deleted file mode 100644
index 8ab8f0f4..00000000
--- a/src/hwpf/src/plat/target.C
+++ /dev/null
@@ -1,755 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/hwpf/src/plat/target.C $ */
-/* */
-/* OpenPOWER sbe Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2012,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 <fapi2.H>
-#include <assert.h>
-#include <fapi2_target.H>
-#include <plat_target_utils.H>
-#include <p9_perv_scom_addresses.H>
-
-// Global Vector containing ALL targets. This structure is referenced by
-// fapi2::getChildren to produce the resultant returned vector from that
-// call.
-std::vector<fapi2::plat_target_handle_t> G_vec_targets;
-
-// Global variable for fixed section in pibmem
-G_sbe_attrs_t G_sbe_attrs;
-
-fapi2attr::SystemAttributes_t* G_system_attributes_ptr;
-fapi2attr::ProcChipAttributes_t* G_proc_chip_attributes_ptr;
-fapi2attr::PervAttributes_t* G_perv_attributes_ptr;
-fapi2attr::CoreAttributes_t* G_core_attributes_ptr;
-fapi2attr::EQAttributes_t* G_eq_attributes_ptr;
-fapi2attr::EXAttributes_t* G_ex_attributes_ptr;
-
-namespace fapi2
-{
- static ReturnCode plat_AttrInit()
- {
- union
- {
- struct
- {
- uint64_t iv_majorEC : 4;
- uint64_t iv_deviceIdDontCare : 4;
- uint64_t iv_minorEC : 4;
- uint64_t iv_chipId : 8;
- uint64_t iv_deviceIdDontCare2 : 20;
- uint64_t iv_c4Pin : 1;
- uint64_t iv_deviceIdDontCare3 : 23;
- };
- uint64_t iv_deviceIdReg;
- } l_deviceId;
-
- uint8_t l_chipName = fapi2::ENUM_ATTR_NAME_NONE;
- uint8_t l_ec = 0;
- fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> l_chipTarget =
- plat_getChipTarget();
-
- FAPI_TRY(getscom_abs(PERV_DEVICE_ID_REG, &l_deviceId.iv_deviceIdReg));
- l_ec = (l_deviceId.iv_majorEC << 4) | (l_deviceId.iv_minorEC);
- switch(l_deviceId.iv_chipId)
- {
- case 0xD1:
- l_chipName = fapi2::ENUM_ATTR_NAME_NIMBUS;
- break;
- case 0xD4:
- l_chipName = fapi2::ENUM_ATTR_NAME_CUMULUS;
- break;
- default:
- FAPI_ERR("Unsupported chip ID: 0x%02X",
- static_cast<uint8_t>(l_deviceId.iv_chipId));
- assert(false);
- }
-
- FAPI_TRY(PLAT_ATTR_INIT(fapi2::ATTR_NAME, l_chipTarget, l_chipName));
-
- FAPI_TRY(PLAT_ATTR_INIT(fapi2::ATTR_EC, l_chipTarget, l_ec));
-fapi_try_exit:
- return fapi2::current_err;
- }
-
- // Get the plat target handle by chiplet number - For PERV targets
- template<>
- plat_target_handle_t plat_getTargetHandleByChipletNumber<TARGET_TYPE_PERV>(
- const uint8_t i_chipletNumber)
- {
- uint32_t l_idx = 0;
-
- if((i_chipletNumber > 0) &&
- (i_chipletNumber < (EQ_CHIPLET_OFFSET + EQ_TARGET_COUNT)))
- {
- l_idx = (i_chipletNumber - NEST_GROUP1_CHIPLET_OFFSET) +
- NEST_GROUP1_TARGET_OFFSET;
- }
- else if((i_chipletNumber >= CORE_CHIPLET_OFFSET) &&
- (i_chipletNumber < (CORE_CHIPLET_OFFSET + CORE_TARGET_COUNT)))
- {
- l_idx = (i_chipletNumber - CORE_CHIPLET_OFFSET) +
- CORE_TARGET_OFFSET;
- }
- else
- {
- assert(false);
- }
- return G_vec_targets[l_idx];
- }
-
- // Get the plat target handle by chiplet number - For EQ targets
- template<>
- plat_target_handle_t plat_getTargetHandleByChipletNumber<TARGET_TYPE_EQ>(
- const uint8_t i_chipletNumber)
- {
- assert(((i_chipletNumber >= EQ_CHIPLET_OFFSET) &&
- (i_chipletNumber < (EQ_CHIPLET_OFFSET + EQ_TARGET_COUNT))))
-
- uint32_t l_idx = (i_chipletNumber - EQ_CHIPLET_OFFSET) +
- EQ_TARGET_OFFSET;
- return G_vec_targets[l_idx];
- }
-
- // Get the plat target handle by chiplet number - For CORE targets
- template<>
- plat_target_handle_t plat_getTargetHandleByChipletNumber<TARGET_TYPE_CORE>(
- const uint8_t i_chipletNumber)
- {
- assert(((i_chipletNumber >= CORE_CHIPLET_OFFSET) &&
- (i_chipletNumber < (CORE_CHIPLET_OFFSET + CORE_TARGET_COUNT))));
-
- uint32_t l_idx = (i_chipletNumber - CORE_CHIPLET_OFFSET) +
- CORE_TARGET_OFFSET;
-
- return G_vec_targets[l_idx];
- }
-
- // Get the plat target handle by chiplet number - For EX targets
- template<>
- plat_target_handle_t plat_getTargetHandleByChipletNumber<TARGET_TYPE_EX>(
- const uint8_t i_chipletNumber)
- {
- assert(((i_chipletNumber >= CORE_CHIPLET_OFFSET) &&
- (i_chipletNumber < (CORE_CHIPLET_OFFSET + CORE_TARGET_COUNT))));
-
- uint32_t l_idx = ((i_chipletNumber - CORE_CHIPLET_OFFSET) / 2) +
- EX_TARGET_OFFSET;
-
- return G_vec_targets[l_idx];
- }
-
- // Get plat target handle by instance number - For EX targets
- template <>
- plat_target_handle_t plat_getTargetHandleByInstance<TARGET_TYPE_EX>(
- const uint8_t i_targetNum)
- {
- assert(i_targetNum < EX_TARGET_COUNT);
-
- return G_vec_targets[i_targetNum + EX_TARGET_OFFSET];
- }
-
-
- TargetType plat_target_handle_t::getFapiTargetType() const
- {
- TargetType l_targetType = TARGET_TYPE_NONE;
- switch(fields.type)
- {
- case PPE_TARGET_TYPE_PROC_CHIP:
- l_targetType = TARGET_TYPE_PROC_CHIP;
- break;
- case PPE_TARGET_TYPE_MCS:
- l_targetType = TARGET_TYPE_MCS;
- break;
- case PPE_TARGET_TYPE_PHB:
- l_targetType = TARGET_TYPE_PHB;
- break;
- case PPE_TARGET_TYPE_CORE | PPE_TARGET_TYPE_PERV:
- l_targetType = TARGET_TYPE_CORE;
- break;
- case PPE_TARGET_TYPE_EQ | PPE_TARGET_TYPE_PERV:
- l_targetType = TARGET_TYPE_EQ;
- break;
- case PPE_TARGET_TYPE_EX:
- l_targetType = TARGET_TYPE_EX;
- break;
- case PPE_TARGET_TYPE_PERV:
- l_targetType = TARGET_TYPE_PERV;
- break;
- case PPE_TARGET_TYPE_SYSTEM:
- l_targetType = TARGET_TYPE_SYSTEM;
- break;
- case PPE_TARGET_TYPE_MCBIST | PPE_TARGET_TYPE_PERV:
- l_targetType = TARGET_TYPE_MCBIST;
- break;
- case PPE_TARGET_TYPE_NONE:
- case PPE_TARGET_TYPE_ALL:
- default:
- assert(false);
- break;
- }
- return l_targetType;
- }
-
- plat_target_handle_t plat_target_handle_t::getParent(
- const TargetType i_parentType) const
- {
- plat_target_handle_t l_handle;
- switch(i_parentType)
- {
- case TARGET_TYPE_PROC_CHIP:
- l_handle = G_vec_targets[CHIP_TARGET_OFFSET];
- break;
- case TARGET_TYPE_PERV:
- assert(fields.type & PPE_TARGET_TYPE_PERV);
- l_handle = *this;
- break;
- case TARGET_TYPE_EX:
- assert(fields.type & PPE_TARGET_TYPE_CORE);
- l_handle = G_vec_targets
- [(fields.type_target_num / EX_PER_QUAD) + EX_TARGET_OFFSET];
- break;
- case TARGET_TYPE_EQ:
- assert(fields.type &
- (PPE_TARGET_TYPE_EX | PPE_TARGET_TYPE_CORE));
- {
- uint32_t l_perQuad = (fields.type & PPE_TARGET_TYPE_EX) ?
- EX_PER_QUAD : CORES_PER_QUAD;
- l_handle = G_vec_targets
- [(fields.type_target_num / l_perQuad) +
- EQ_TARGET_OFFSET];
- }
- break;
- default:
- assert(false);
- }
- return l_handle;
- }
-
- void plat_target_handle_t::getChildren(const TargetType i_parentType,
- const TargetType i_childType,
- const plat_target_type_t i_platType,
- const TargetState i_state,
- std::vector<plat_target_handle>
- &o_children) const
- {
- uint32_t l_childPerChiplet = 0;
- uint32_t l_childTargetOffset = 0;
- uint32_t l_loopCount = G_vec_targets.size();
- TargetType l_targetType = i_parentType;
-
- if((i_parentType & ~(TARGET_TYPE_PROC_CHIP)) != 0)
- {
- // For composite targets, if multicast, treat as PROC_CHIP, else
- // treat as other target
- if(this->fields.is_multicast)
- {
- l_targetType = TARGET_TYPE_PROC_CHIP;
- }
- else
- {
- l_targetType =
- static_cast<TargetType>(l_targetType & ~(TARGET_TYPE_PROC_CHIP));
- }
- }
-
- // EQ ==> EX
- if((l_targetType == TARGET_TYPE_EQ) && (i_childType == TARGET_TYPE_EX))
- {
- l_childPerChiplet = EX_PER_QUAD;
- l_childTargetOffset = EX_TARGET_OFFSET;
- l_loopCount = l_childPerChiplet;
- }
-
- // EQ ==> EC
- if((l_targetType == TARGET_TYPE_EQ) && (i_childType == TARGET_TYPE_CORE))
- {
- l_childPerChiplet = CORES_PER_QUAD;
- l_childTargetOffset = CORE_TARGET_OFFSET;
- l_loopCount = l_childPerChiplet;
- }
-
- // EX ==> EC
- if((l_targetType == TARGET_TYPE_EX) && (i_childType == TARGET_TYPE_CORE))
- {
- l_childPerChiplet = CORES_PER_EX;
- l_childTargetOffset = CORE_TARGET_OFFSET;
- l_loopCount = l_childPerChiplet;
- }
- // else it is TARGET_TYPE_PROC_CHIP ==> anything, and we iterate over
- // all the targets
-
- for(uint32_t i = 0; i < l_loopCount; ++i)
- {
- plat_target_handle_t l_temp =
- G_vec_targets.at((this->fields.type_target_num *
- l_childPerChiplet) + l_childTargetOffset + i);
- if ((l_temp.fields.type & i_platType) == i_platType)
- {
- switch (i_state)
- {
- case TARGET_STATE_PRESENT:
- if (l_temp.fields.present)
- {
- o_children.push_back(l_temp);
- }
- break;
- case TARGET_STATE_FUNCTIONAL:
- if (l_temp.fields.functional)
- {
- o_children.push_back(l_temp);
- }
- break;
- default:
- assert(false);
- }
- }
- }
- }
-
- void plat_target_handle_t::getChildren(const TargetFilter i_filter,
- const TargetState i_state,
- std::vector<plat_target_handle_t>
- &o_children) const
- {
- static const uint64_t mask = 1;
-
- // Walk the bits in the input target filter. For every bit, at
- // position x, that is set, x can be used as an index into our global
- // target vector (indexed by chiplet number)
- for (uint32_t l_idx = 0;
- l_idx < sizeof(TargetFilter) * 8;
- ++l_idx)
- {
- if (i_filter & (mask << (((sizeof(TargetFilter)*8)-1) - l_idx)))
- {
- plat_target_handle_t l_targetHandle = G_vec_targets.at(l_idx + NEST_GROUP1_CHIPLET_OFFSET);
-
- if(l_targetHandle.fields.type & PPE_TARGET_TYPE_PERV) // Can be an assertion?
- {
- switch (i_state)
- {
- case TARGET_STATE_PRESENT:
- if(l_targetHandle.fields.present)
- {
- o_children.push_back(l_targetHandle);
- }
- break;
- case TARGET_STATE_FUNCTIONAL:
- if(l_targetHandle.fields.functional)
- {
- o_children.push_back(l_targetHandle);
- }
- break;
- default:
- break;
- }
- }
- }
- }
- }
-
- #ifndef __noRC__
- ReturnCode current_err;
- #endif
-
- fapi2::ReturnCode plat_PervPGTargets(const fapi2::Target<fapi2::TARGET_TYPE_PERV> & i_target,
- bool & o_present)
- {
- o_present = false;
- uint16_t attr_value = 0;
- FAPI_ATTR_GET(fapi2::ATTR_PG,
- i_target,
- attr_value);
- FAPI_DBG("Target: 0x%08X, ATTR_PG value = %x", static_cast<uint32_t>(i_target.get().value), attr_value);
- if (0 == (attr_value & 0x1000))
- {
- o_present = true;
- }
- return fapi2::FAPI2_RC_SUCCESS;
- }
-
- /// @brief Function to determine if pervsaive target within a chip is
- /// present and, thus, considered functional per PG attributes
- fapi2::ReturnCode
- plat_TargetPresent( fapi2::Target<fapi2::TARGET_TYPE_PERV> & i_chiplet_target,
- bool & b_present)
- {
-
- uint8_t l_chipName = fapi2::ENUM_ATTR_NAME_NONE;
-
- FAPI_TRY(FAPI_ATTR_GET_PRIVILEGED(fapi2::ATTR_NAME, plat_getChipTarget(), l_chipName));
-
- // TODO via RTC 164026
- // In nimbus all pervasive chiplets (non quad, non core), are present
- // other than OBUS1 and OBUS2. In cumulus all chiplets are present.
- // Though on field parts, all chiplets which are present should be
- // functional. But in lab when we can get partial good parts, its
- // possible that few chiplets are not functional. So we need to
- // differentiate between present versus functional chiplets.
- // We need to see if we need to use same strategy for cores/caches as
- // well.
- // Also in current code we are hard coding the chiplets. We need to use
- // attribute to differentiate between nimbus versus cumulus config.
- static const size_t OBUS1 = 10;
- static const size_t OBUS2 = 11;
- if((OBUS1 == i_chiplet_target.getChipletNumber()) ||
- (OBUS2 == i_chiplet_target.getChipletNumber()))
- {
- if(fapi2::ENUM_ATTR_NAME_CUMULUS == l_chipName)
- {
- static_cast<plat_target_handle_t&>((i_chiplet_target.operator()())).setPresent();
- }
- }
- else if( i_chiplet_target.getChipletNumber() < EQ_CHIPLET_OFFSET )
- {
- static_cast<plat_target_handle_t&>((i_chiplet_target.operator()())).setPresent();
- }
- // Find the PERV target number in the partial good initialization
- // array
-
- FAPI_TRY(plat_PervPGTargets(i_chiplet_target, b_present));
-
- if (b_present)
- {
- if( i_chiplet_target.getChipletNumber() >= EQ_CHIPLET_OFFSET )
- {
- static_cast<plat_target_handle_t&>((i_chiplet_target.operator()())).setPresent();
- }
- static_cast<plat_target_handle_t&>((i_chiplet_target.operator()())).setFunctional(true);
- }
- else
- {
- FAPI_DBG("Perv target NOT present (nor functional): chiplet_number = %d", i_chiplet_target.getChipletNumber());
- }
-
- FAPI_DBG("Target present = %u, Target functional = %u",
- static_cast<plat_target_handle_t>(i_chiplet_target.get()).getPresent(),
- static_cast<plat_target_handle_t>(i_chiplet_target.get()).getFunctional());
-
-fapi_try_exit:
- return fapi2::current_err;
- }
-
-
- /// @brief Function to initialize the G_targets vector based on partial good
- /// attributes /// this will move to plat_target.H formally
- fapi2::ReturnCode plat_TargetsInit()
- {
- bool b_present = false;
-
- // Copy fixed section from SEEPROM to PIBMEM
- G_sbe_attrs.G_system_attrs = G_system_attributes;
- G_sbe_attrs.G_proc_chip_attrs = G_proc_chip_attributes;
- G_sbe_attrs.G_perv_attrs = G_perv_attributes;
- G_sbe_attrs.G_core_attrs = G_core_attributes;
- G_sbe_attrs.G_eq_attrs = G_eq_attributes;
- G_sbe_attrs.G_ex_attrs = G_ex_attributes;
-
- // Initialise global attribute pointers
- G_system_attributes_ptr = &(G_sbe_attrs.G_system_attrs);
- G_proc_chip_attributes_ptr = &(G_sbe_attrs.G_proc_chip_attrs);
- G_perv_attributes_ptr = &(G_sbe_attrs.G_perv_attrs);
- G_core_attributes_ptr = &(G_sbe_attrs.G_core_attrs);
- G_eq_attributes_ptr = &(G_sbe_attrs.G_eq_attrs);
- G_ex_attributes_ptr = &(G_sbe_attrs.G_ex_attrs);
-
-
- std::vector<fapi2::plat_target_handle_t>::iterator tgt_iter;
- uint32_t l_beginning_offset;
-
- FAPI_DBG("Platform target initialization. Target Count = %u", TARGET_COUNT);
- /*
- * Initialize all entries to NULL
- */
- for (uint32_t i = 0; i < TARGET_COUNT; ++i)
- {
- G_vec_targets.push_back((fapi2::plat_target_handle_t)0x0);
- }
-
- /*
- * Chip Target is the first one
- */
- l_beginning_offset = CHIP_TARGET_OFFSET;
-
- fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> chip_target((createPlatTargetHandle<fapi2::TARGET_TYPE_PROC_CHIP>(0)));
- G_vec_targets.at(l_beginning_offset) = revle32((fapi2::plat_target_handle_t)(chip_target.get()));
-
- // Initialize platform attributes. Needs to be after the chip target is
- // created.
- FAPI_TRY(plat_AttrInit());
-
- /*
- * Nest Targets - group 1
- */
- l_beginning_offset = NEST_GROUP1_TARGET_OFFSET;
- for (uint32_t i = 0; i < NEST_GROUP1_TARGET_COUNT; ++i)
- {
- fapi2::Target<fapi2::TARGET_TYPE_PERV> target_name((createPlatTargetHandle<fapi2::TARGET_TYPE_PERV>(i)));
-
- // Determine if the chiplet is present and, thus, functional
- // via partial good attributes
- FAPI_TRY(plat_TargetPresent(target_name, b_present));
-
- G_vec_targets.at(l_beginning_offset+i) = revle32((fapi2::plat_target_handle_t)(target_name.get()));
- }
-
- /*
- * Memory Controller Synchronous (MCBIST) Targets
- */
-
- l_beginning_offset = MCBIST_TARGET_OFFSET;
- for (uint32_t i = 0; i < MCBIST_TARGET_COUNT; ++i)
- {
- fapi2::Target<fapi2::TARGET_TYPE_MCBIST> target_name((createPlatTargetHandle<fapi2::TARGET_TYPE_MCBIST>(i)));
- fapi2::Target<fapi2::TARGET_TYPE_PERV> l_perv = target_name.getParent<fapi2::TARGET_TYPE_PERV>();
-
- // Determine if the chiplet is present and, thus, functional
- // via partial good attributes
- FAPI_TRY(plat_TargetPresent(l_perv, b_present));
-
- G_vec_targets.at(l_beginning_offset+i) = revle32((fapi2::plat_target_handle_t)(l_perv.get()));
-
- }
-
- /*
- * Nest Targets - group 2
- */
- l_beginning_offset = NEST_GROUP2_TARGET_OFFSET;
- for (uint32_t i = NEST_GROUP2_TARGET_OFFSET;
- i < (NEST_GROUP2_TARGET_OFFSET + NEST_GROUP2_TARGET_COUNT); ++i)
- {
- fapi2::Target<fapi2::TARGET_TYPE_PERV> target_name((createPlatTargetHandle<fapi2::TARGET_TYPE_PERV>(i - 1)));
-
- // Determine if the chiplet is present and, thus, functional
- // via partial good attributes
- FAPI_TRY(plat_TargetPresent(target_name, b_present));
-
- G_vec_targets.at(i) = revle32((fapi2::plat_target_handle_t)(target_name.get()));
- }
-
- /*
- * Cache (EQ) Targets
- */
- l_beginning_offset = EQ_TARGET_OFFSET;
- for (uint32_t i = 0; i < EQ_TARGET_COUNT; ++i)
- {
- fapi2::Target<fapi2::TARGET_TYPE_EQ> target_name((createPlatTargetHandle<fapi2::TARGET_TYPE_EQ>(i)));
- fapi2::Target<fapi2::TARGET_TYPE_PERV> l_perv = target_name.getParent<fapi2::TARGET_TYPE_PERV>();
-
- // Determine if the chiplet is present and, thus, functional
- // via partial good attributes
- FAPI_TRY(plat_TargetPresent(l_perv, b_present));
-
- G_vec_targets.at(l_beginning_offset+i) = revle32((fapi2::plat_target_handle_t)(l_perv.get()));
- }
-
- /*
- * Core (EC) Targets
- */
-
- l_beginning_offset = CORE_TARGET_OFFSET;
- for (uint32_t i = 0; i < CORE_TARGET_COUNT; ++i)
- {
- fapi2::Target<fapi2::TARGET_TYPE_CORE> target_name((createPlatTargetHandle<fapi2::TARGET_TYPE_CORE>(i)));
- fapi2::Target<fapi2::TARGET_TYPE_PERV> l_perv = target_name.getParent<fapi2::TARGET_TYPE_PERV>();
-
- // Determine if the chiplet is present and, thus, functional
- // via partial good attributes
- FAPI_TRY(plat_TargetPresent(l_perv, b_present));
-
- G_vec_targets.at(l_beginning_offset+i) = revle32((fapi2::plat_target_handle_t)(l_perv.get()));
- }
-
- /*
- * EX Targets
- */
-
- l_beginning_offset = EX_TARGET_OFFSET;
- for (uint32_t i = 0; i < EX_TARGET_COUNT; ++i)
- {
- fapi2::Target<fapi2::TARGET_TYPE_EX> target_name((createPlatTargetHandle<fapi2::TARGET_TYPE_EX>(i)));
-
- fapi2::Target<fapi2::TARGET_TYPE_EQ> l_parent = target_name.getParent<fapi2::TARGET_TYPE_EQ>();
-
- // Get the parent EQ's ATTR_PG
- uint16_t l_eqAttrPg = 0;
- FAPI_ATTR_GET(fapi2::ATTR_PG, l_parent.getParent<TARGET_TYPE_PERV>(), l_eqAttrPg);
-
- // Check if this EX's L2 and L3 regions are marked "good"
- if(0 == (i % EX_PER_QUAD))
- {
- // Bits 6 and 8 need to be 0
- l_eqAttrPg &= 0x0280;
- }
- else
- {
- // Bits 7 and 9 need to be 0
- l_eqAttrPg &= 0x0140;
- }
-
- if(0 == l_eqAttrPg)
- {
- static_cast<plat_target_handle_t&>(target_name.operator ()()).setPresent();
- static_cast<plat_target_handle_t&>(target_name.operator ()()).setFunctional(true);
- }
- G_vec_targets.at(l_beginning_offset+i) = revle32((fapi2::plat_target_handle_t)(target_name.get()));
- }
-
- /*
- * MCS Targets
- */
-
- l_beginning_offset = MCS_TARGET_OFFSET;
- for (uint32_t i = 0; i < MCS_TARGET_COUNT; ++i)
- {
- fapi2::Target<fapi2::TARGET_TYPE_MCS> target_name(createPlatTargetHandle<fapi2::TARGET_TYPE_MCS>(i));
-
- fapi2::Target<fapi2::TARGET_TYPE_PERV>
- l_nestTarget((plat_getTargetHandleByChipletNumber<TARGET_TYPE_PERV>(N3_CHIPLET - (MCS_PER_MCBIST * (i / MCS_PER_MCBIST)))));
-
- uint16_t l_attrPg = 0;
-
- FAPI_ATTR_GET(fapi2::ATTR_PG, l_nestTarget, l_attrPg);
-
- if(0 == (i / MCS_PER_MCBIST))
- {
- // Bit 10 needs to be 0 for MCS 0, 1
- l_attrPg &= 0x0020;
- }
- else
- {
- // Bit 9 needs to be 0 for MCS 2, 3
- l_attrPg &= 0x0040;
- }
-
- if(0 == l_attrPg)
- {
- static_cast<plat_target_handle_t&>(target_name.operator ()()).setPresent();
- static_cast<plat_target_handle_t&>(target_name.operator ()()).setFunctional(true);
- }
-
- G_vec_targets.at(l_beginning_offset+i) = revle32((fapi2::plat_target_handle_t)(target_name.get()));
- }
-
- /*
- * PHB Targets
- */
- l_beginning_offset = PHB_TARGET_OFFSET;
- for (uint32_t i = 0; i < PHB_TARGET_COUNT; ++i)
- {
- fapi2::Target<fapi2::TARGET_TYPE_PHB> target_name(createPlatTargetHandle<fapi2::TARGET_TYPE_PHB>(i));
-
- fapi2::Target<fapi2::TARGET_TYPE_PERV>
- l_pciTarget((plat_getTargetHandleByChipletNumber<TARGET_TYPE_PERV>(target_name.getChipletNumber())));
-
- constexpr uint16_t l_pciPgArray[] = {0xE1FD, 0xE0FD, 0xE07D};
- uint16_t l_attrPg = 0;
-
- FAPI_ATTR_GET(fapi2::ATTR_PG, l_pciTarget, l_attrPg);
-
- if(l_pciPgArray[target_name.getChipletNumber() - PCI0_CHIPLET] == l_attrPg)
- {
- static_cast<plat_target_handle_t&>(target_name.operator ()()).setPresent();
- static_cast<plat_target_handle_t&>(target_name.operator ()()).setFunctional(true);
- }
-
- G_vec_targets.at(l_beginning_offset+i) = revle32((fapi2::plat_target_handle_t)(target_name.get()));
- }
-
-
-fapi_try_exit:
- return fapi2::current_err;
- }
-
- /// @brief Function to initialize the G_targets vector based on partial good
- /// attributes
- fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> plat_getChipTarget()
- {
-
- // Get the chip specific target
- return ((fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>)G_vec_targets.at(0));
- }
-
- /// @brief Function to apply any gard records set (via
- // ATTR_EQ_GARD/ATTR_EC_GARD) to mark corresponding targets non functional
- ReturnCode plat_ApplyGards()
- {
- uint8_t l_eqGards = 0;
- uint32_t l_ecGards = 0;
- static const uint32_t l_mask = 0x80000000;
- bool l_coreGroupNonFunctional = true;
- fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> l_chip = plat_getChipTarget();
-
- // Read the EQ and EC gard attributes from the chip target
- FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_EQ_GARD, l_chip, l_eqGards));
- FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_EC_GARD, l_chip, l_ecGards));
-
- FAPI_DBG("ATTR_EQ_GARD:: 0x%08x", l_eqGards);
- FAPI_DBG("ATTR_EC_GARD:: 0x%08x", l_ecGards);
-
- // Iterate over the bits in EQ and EC gards, if set, mark the
- // corresponding target non-functional
- for(uint32_t l_idx = 0; l_idx < EQ_TARGET_COUNT; ++l_idx)
- {
- if((l_mask >> l_idx) & (((uint32_t)(l_eqGards)) << 24))
- {
- FAPI_DBG("Making %d'th EQ non-functional", l_idx);
- // EQ chiplet l_idx is to be marked non-functional
- fapi2::Target<fapi2::TARGET_TYPE_EQ> l_target = G_vec_targets.at(l_idx + EQ_TARGET_OFFSET);
- static_cast<plat_target_handle_t&>(l_target.operator ()()).setFunctional(false);
- G_vec_targets.at(l_idx + EQ_TARGET_OFFSET) = l_target.get();
- }
- }
-
- for(uint32_t l_idx = 0; l_idx < CORE_TARGET_COUNT; ++l_idx)
- {
- if((l_mask >> l_idx) & (l_ecGards))
- {
- FAPI_DBG("Making %d'th EC non-functional", l_idx);
- // EC chiplet l_idx is to be marked non-functional
- fapi2::Target<fapi2::TARGET_TYPE_CORE> l_target = G_vec_targets.at(l_idx + CORE_TARGET_OFFSET);
- static_cast<plat_target_handle_t&>(l_target.operator ()()).setFunctional(false);
- G_vec_targets.at(l_idx + CORE_TARGET_OFFSET) = l_target.get();
- }
- else
- {
- l_coreGroupNonFunctional = false;
- }
- if(0 == ((l_idx + 1) % CORES_PER_EX))
- {
- if(true == l_coreGroupNonFunctional)
- {
- // All cores of this group are non-functional. Mark the EX
- // non-functional too.
- G_vec_targets.at((l_idx / CORES_PER_EX) + EX_TARGET_OFFSET).fields.functional = false;
- }
- // Reset ex non-functional flag for the next group
- l_coreGroupNonFunctional = true;
- }
- }
-fapi_try_exit:
- return fapi2::current_err;
- }
-
-} // fapi2
diff --git a/src/hwpf/src/plat_ring_traverse.C b/src/hwpf/src/plat_ring_traverse.C
deleted file mode 100644
index 9b4466a7..00000000
--- a/src/hwpf/src/plat_ring_traverse.C
+++ /dev/null
@@ -1,499 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/hwpf/src/plat_ring_traverse.C $ */
-/* */
-/* OpenPOWER sbe Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2016,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 <plat_ring_traverse.H>
-
-#include <p9_putRingUtils.H> // for RS4 decompression utilities
-#include <sbeXipUtils.H>
-#include <fapi2_attribute_service.H> // for FAPI_ATTR_GET
-#include <plat_target_utils.H> // for plat_getChipTarget
-
-// SEEPROM start address
-const uint32_t g_seepromAddr = SBE_SEEPROM_BASE_ORIGIN;
-using namespace RING_TYPES;
-const uint32_t CACHE_CONTAINED_MODE = 4;
-const uint32_t RISK_LEVEL_MODE = 1;
-#define CACHE_CONTAINED_MODE_OFFSET_IN_TOR 1
-#define RISK_LEVEL_MODE_OFFSET_IN_TOR 2
-#define OVERRIDE_VARIANT_SIZE 1
-
-
-///
-/// @brief This is a plat pecific (SBE Plat) function that locates the
-/// Ring Container in the image and calls the functin to decompress the
-/// RS4 string and apply it to the hardware.
-/// @param i_target The target of Ring apply.
-/// @param i_ringID The Ring ID that identifies the ring to be applied.
-/// @return FAPI2_RC_SUCCESS on success, else error code.
-///
-fapi2::ReturnCode findRS4InImageAndApply(
- const fapi2::Target<fapi2::TARGET_TYPE_ALL>& i_target,
- const RingID i_ringID,
- const fapi2::RingMode i_ringMode)
-{
- SBE_TRACE(">> findRS4InImageAndApply");
-
- fapi2::ReturnCode l_rc = fapi2::FAPI2_RC_SUCCESS;
- bool l_applyOverride = false;
-
- do
- {
- //Apply scanring from .ring section
-
- // Get the address of the Section-TOR
- P9XipHeader *l_hdr = getXipHdr();
- P9XipSection *l_section =
- &(l_hdr->iv_section[P9_XIP_SECTION_SBE_RINGS]);
-
- if (!(l_section->iv_offset))
- {
- SBE_TRACE("No ring data in .RING section");
- break;
- }
-
- SectionTOR *l_sectionTOR = (SectionTOR *)(g_seepromAddr +
- l_section->iv_offset);
-
- l_rc = getRS4ImageFromTor(i_target,i_ringID,l_sectionTOR,
- l_applyOverride,
- l_section->iv_offset,
- i_ringMode);
-
- if(l_rc != fapi2::FAPI2_RC_SUCCESS)
- {
- break;
- }
-
- //Apply scanring from .ring section
- l_applyOverride = true;
- l_section = NULL;
- l_section =
- &(l_hdr->iv_section[P9_XIP_SECTION_SBE_OVERRIDES]);
-
- if (!(l_section->iv_offset))
- {
- SBE_TRACE("No ring data in .OVERRIDE section");
- break;
- }
-
- l_sectionTOR = NULL;
- l_sectionTOR = (SectionTOR *)(g_seepromAddr +
- l_section->iv_offset);
-
-
- l_rc = getRS4ImageFromTor(i_target,i_ringID,l_sectionTOR,
- l_applyOverride,
- l_section->iv_offset,
- i_ringMode);
- }while(0);
-
- return l_rc;
-}
-
-fapi2::ReturnCode getRS4ImageFromTor(
- const fapi2::Target<fapi2::TARGET_TYPE_ALL>& i_target,
- const RingID i_ringID,
- SectionTOR *i_sectionTOR,
- bool i_applyOverride,
- const uint32_t i_sectionOffset,
- const fapi2::RingMode i_ringMode)
-{
-
- // Determine the Offset ID and Ring Type for the given Ring ID.
- uint32_t l_torOffset = 0;
- RINGTYPE l_ringType = COMMON_RING;
- CHIPLET_TYPE l_chipLetType;
- fapi2::ReturnCode l_rc = fapi2::FAPI2_RC_SUCCESS;
- do
- {
-
- getRingProperties(i_ringID, l_torOffset, l_ringType,l_chipLetType);
- if(INVALID_RING == l_torOffset)
- {
- SBE_TRACE("Invalid Ring ID - %d", i_ringID);
- l_rc = fapi2::FAPI2_RC_INVALID_PARAMETER;
- break;
- }
-
- CHIPLET_DATA l_chipletData;
- l_chipletData.iv_base_chiplet_number = 0;
- l_chipletData.iv_num_common_rings = 0;
- l_chipletData.iv_num_instance_rings = 0;
-
- uint8_t l_chipletID = i_target.getChipletNumber();
- uint16_t l_cpltRingVariantSz = 0;
- uint32_t l_sectionOffset = 0;
- uint8_t l_CC_offset = 0;
- uint8_t l_RL_offset = 1;
- switch(l_chipLetType)
- {
- case PERV_TYPE: // PERV
- l_chipletData = PERV::g_pervData;
- l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
- (sizeof(PERV::RingVariants) /
- sizeof(l_cpltRingVariantSz));
-
- l_sectionOffset = i_sectionTOR->TOC_PERV_COMMON_RING;
- if(INSTANCE_RING == l_ringType)
- {
- l_sectionOffset = i_sectionTOR->TOC_PERV_INSTANCE_RING;
- }
-
- break;
-
- case N0_TYPE: // Nest - N0
- l_chipletData = N0::g_n0Data;
- l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
- (sizeof(N0::RingVariants) /
- sizeof(l_cpltRingVariantSz));
-
- l_sectionOffset = i_sectionTOR->TOC_N0_COMMON_RING;
- if(INSTANCE_RING == l_ringType)
- {
- l_sectionOffset = i_sectionTOR->TOC_N0_INSTANCE_RING;
- }
-
- break;
-
- case N1_TYPE: // Nest - N1
- l_chipletData = N1::g_n1Data;
- l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
- (sizeof(N1::RingVariants) /
- sizeof(l_cpltRingVariantSz));
-
- l_sectionOffset = i_sectionTOR->TOC_N1_COMMON_RING;
- if(INSTANCE_RING == l_ringType)
- {
- l_sectionOffset = i_sectionTOR->TOC_N1_INSTANCE_RING;
- }
-
- break;
-
- case N2_TYPE: // Nest - N2
- l_chipletData = N2::g_n2Data;
- l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
- (sizeof(N2::RingVariants) /
- sizeof(l_cpltRingVariantSz));
-
- l_sectionOffset = i_sectionTOR->TOC_N2_COMMON_RING;
- if(INSTANCE_RING == l_ringType)
- {
- l_sectionOffset = i_sectionTOR->TOC_N2_INSTANCE_RING;
- }
-
- break;
-
- case N3_TYPE: // Nest - N3
- l_chipletData = N3::g_n3Data;
- l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
- (sizeof(N3::RingVariants) /
- sizeof(l_cpltRingVariantSz));
-
- l_sectionOffset = i_sectionTOR->TOC_N3_COMMON_RING;
- if(INSTANCE_RING == l_ringType)
- {
- l_sectionOffset = i_sectionTOR->TOC_N3_INSTANCE_RING;
- }
-
- break;
-
- case XB_TYPE: // XB - XBus2
- l_chipletData = XB::g_xbData;
- l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
- (sizeof(XB::RingVariants) /
- sizeof(l_cpltRingVariantSz));
-
- l_sectionOffset = i_sectionTOR->TOC_XB_COMMON_RING;
- if(INSTANCE_RING == l_ringType)
- {
- l_sectionOffset = i_sectionTOR->TOC_XB_INSTANCE_RING;
- }
-
- break;
-
- case MC_TYPE: // MC - MC23
- l_chipletData = MC::g_mcData;
- l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
- (sizeof(MC::RingVariants)/
- sizeof(l_cpltRingVariantSz));
-
- l_sectionOffset = i_sectionTOR->TOC_MC_COMMON_RING;
- if(INSTANCE_RING == l_ringType)
- {
- l_sectionOffset = i_sectionTOR->TOC_MC_INSTANCE_RING;
- }
-
- break;
-
- case OB0_TYPE: // OB0
- l_chipletData = OB0::g_ob0Data;
- l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
- (sizeof(OB0::RingVariants) /
- sizeof(l_cpltRingVariantSz));
-
- l_sectionOffset = i_sectionTOR->TOC_OB0_COMMON_RING;
- if(INSTANCE_RING == l_ringType)
- {
- l_sectionOffset = i_sectionTOR->TOC_OB0_INSTANCE_RING;
- }
-
- break;
- case OB1_TYPE: // OB1
- l_chipletData = OB1::g_ob1Data;
- l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
- (sizeof(OB1::RingVariants) /
- sizeof(l_cpltRingVariantSz));
-
- l_sectionOffset = i_sectionTOR->TOC_OB1_COMMON_RING;
- if(INSTANCE_RING == l_ringType)
- {
- l_sectionOffset = i_sectionTOR->TOC_OB1_INSTANCE_RING;
- }
-
- break;
- case OB2_TYPE: // OB2
- l_chipletData = OB2::g_ob2Data;
- l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
- (sizeof(OB2::RingVariants) /
- sizeof(l_cpltRingVariantSz));
-
- l_sectionOffset = i_sectionTOR->TOC_OB2_COMMON_RING;
- if(INSTANCE_RING == l_ringType)
- {
- l_sectionOffset = i_sectionTOR->TOC_OB2_INSTANCE_RING;
- }
-
- break;
- case OB3_TYPE: // OB3
- l_chipletData = OB3::g_ob3Data;
- l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
- (sizeof(OB3::RingVariants) /
- sizeof(l_cpltRingVariantSz));
-
- l_sectionOffset = i_sectionTOR->TOC_OB3_COMMON_RING;
- if(INSTANCE_RING == l_ringType)
- {
- l_sectionOffset = i_sectionTOR->TOC_OB3_INSTANCE_RING;
- }
-
- break;
-
-
- case PCI0_TYPE: // PCI - PCI0
- l_chipletData = PCI0::g_pci0Data;
- l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
- (sizeof(PCI0::RingVariants) /
- sizeof(l_cpltRingVariantSz));
-
- l_sectionOffset = i_sectionTOR->TOC_PCI0_COMMON_RING;
- if(INSTANCE_RING == l_ringType)
- {
- l_sectionOffset = i_sectionTOR->TOC_PCI0_INSTANCE_RING;
- }
-
- break;
-
- case PCI1_TYPE: // PCI - PCI1
- l_chipletData = PCI1::g_pci1Data;
- l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
- (sizeof(PCI1::RingVariants) /
- sizeof(l_cpltRingVariantSz));
-
- l_sectionOffset = i_sectionTOR->TOC_PCI1_COMMON_RING;
- if(INSTANCE_RING == l_ringType)
- {
- l_sectionOffset = i_sectionTOR->TOC_PCI1_INSTANCE_RING;
- }
-
- break;
-
- case PCI2_TYPE: // PCI - PCI2
- l_chipletData = PCI2::g_pci2Data;
- l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
- (sizeof(PCI2::RingVariants) /
- sizeof(l_cpltRingVariantSz));
-
- l_sectionOffset = i_sectionTOR->TOC_PCI2_COMMON_RING;
- if(INSTANCE_RING == l_ringType)
- {
- l_sectionOffset = i_sectionTOR->TOC_PCI2_INSTANCE_RING;
- }
-
- break;
-
- case EQ_TYPE: // EQ - Quad 0 - Quad 5
- l_chipletData = EQ::g_eqData;
- l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
- ( sizeof(EQ::RingVariants) /
- sizeof(l_cpltRingVariantSz));
-
-
- l_sectionOffset = i_sectionTOR->TOC_EQ_COMMON_RING;
- l_CC_offset = 1;
- l_RL_offset = 2;
- if(INSTANCE_RING == l_ringType)
- {
- l_sectionOffset = i_sectionTOR->TOC_EQ_INSTANCE_RING;
- }
-
- break;
-
- case EC_TYPE: // EC - Core 0 - 23
- l_chipletData = EC::g_ecData;
- l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE :
- (sizeof(EC::RingVariants) /
- sizeof(l_cpltRingVariantSz));
-
- l_sectionOffset = i_sectionTOR->TOC_EC_COMMON_RING;
- l_CC_offset = 1;
- l_RL_offset = 2;
- if(INSTANCE_RING == l_ringType)
- {
- l_sectionOffset = i_sectionTOR->TOC_EC_INSTANCE_RING;
- }
-
- break;
-
- default:
- SBE_TRACE("Invalid Target/ChipletID - %d", l_chipletID);
- l_rc = fapi2::FAPI2_RC_INVALID_PARAMETER;
- break;
-
- } // end of switch(l_chipletID)
-
- if (l_rc)
- {
- break;
- }
-
- FAPI_INF("l_sectionOffset %08x",l_sectionOffset);
- // Determine the section TOR address for the ring
- uint32_t *l_sectionAddr = reinterpret_cast<uint32_t *>(g_seepromAddr +
- i_sectionOffset + l_sectionOffset);
-
- SBE_TRACE ("l_sectionAddr %08X",(uint32_t)l_sectionAddr);
-
- uint16_t *l_ringTorAddr = NULL;
-
-
- if(INSTANCE_RING == l_ringType)
- {
- if ( l_chipletID >= l_chipletData.iv_base_chiplet_number)
- {
- uint8_t l_chipletOffset =
- (l_chipletID - l_chipletData.iv_base_chiplet_number);
- if (l_chipLetType == EQ_TYPE)
- {
- if (fapi2::TARGET_TYPE_EX & (i_target.get().getFapiTargetType()))
- {
- uint32_t l_ex_number = i_target.get().getTargetInstance();
- l_chipletOffset = l_ex_number;
- SBE_TRACE ("l_chipletID %d l_ex_number %d",l_chipletID,l_ex_number);
- }
- }
- SBE_TRACE ("l_chipletID %u l_chipletOffset %u",l_chipletID, l_chipletOffset);
- l_ringTorAddr = reinterpret_cast<uint16_t *>(l_sectionAddr )+ ((l_chipletOffset *
- (l_chipletData.iv_num_instance_rings *l_cpltRingVariantSz)) + (l_torOffset * l_cpltRingVariantSz));
-
- }
- else
- {
- l_ringTorAddr = reinterpret_cast<uint16_t *>(l_sectionAddr) +
- (l_torOffset * l_cpltRingVariantSz);
- }
- }
- else
- {
- // TOR records of Ring TOR are 2 bytes in size.
- l_ringTorAddr = reinterpret_cast<uint16_t *>(l_sectionAddr) +
- (l_torOffset * l_cpltRingVariantSz);
- }
-
- // The ring variants in section TOR are expected to be in the sequence -
- // 1. Base
- // 2. Cache-Contained
- // 3. Risk Level
-
-
- SBE_TRACE ("ring tor address %08X",(uint32_t)l_ringTorAddr);
-
- // If there are non-base variants of the ring, we'll have to check
- // attributes to determine the sequence of ring apply.
- if( l_cpltRingVariantSz > 1)
- {
- // Check if this is cache-contained IPL
- uint8_t l_iplPhase;
- FAPI_ATTR_GET(fapi2::ATTR_SYSTEM_IPL_PHASE,
- fapi2::Target<fapi2::TARGET_TYPE_SYSTEM> (),
- l_iplPhase);
-
- // 4 : Use Cache Contained mode _if_ present, else fall back
- // to normal ring
- if((CACHE_CONTAINED_MODE == l_iplPhase)
- && *(l_ringTorAddr + l_CC_offset))
- {
- l_ringTorAddr += l_CC_offset;
- }
- else
- {
- // Check if this is risk-level IPL
- // _if_ present, else fall back to normal ring
- uint8_t l_riskLevel;
- FAPI_ATTR_GET(fapi2::ATTR_RISK_LEVEL,
- fapi2::Target<fapi2::TARGET_TYPE_SYSTEM> (),
- l_riskLevel);
- if((RISK_LEVEL_MODE == l_riskLevel) &&
- *(l_ringTorAddr + l_RL_offset))
- {
- l_ringTorAddr += l_RL_offset;
- }
- }
- }
-
- SBE_TRACE("l_ringTorAddr %u",*l_ringTorAddr);
- if(*l_ringTorAddr != 0)
- {
- uint8_t *l_addr = reinterpret_cast<uint8_t *>(l_sectionAddr);
- uint8_t *l_rs4Address = reinterpret_cast<uint8_t *>
- (l_addr + *l_ringTorAddr);
- SBE_TRACE("l_rs4Address %08x",(uint32_t)l_rs4Address);
- l_rc = rs4DecompressionSvc(i_target,l_rs4Address,
- i_applyOverride,i_ringMode,l_ringType);
- if(l_rc != fapi2::FAPI2_RC_SUCCESS)
- {
- SBE_TRACE("Error from applyRS4_SS");
- break;
- }
- }
- else
- {
- SBE_TRACE("Ring image is not found for this is ringId %u",i_ringID);
- }
- }while(0);
-
- SBE_TRACE("<< findRS4InImageAndApply Exit for ringId %d",i_ringID);
- return l_rc;
-}
-
diff --git a/src/hwpf/src/return_code.C b/src/hwpf/src/return_code.C
deleted file mode 100644
index b9d0f5fd..00000000
--- a/src/hwpf/src/return_code.C
+++ /dev/null
@@ -1,47 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/hwpf/src/return_code.C $ */
-/* */
-/* OpenPOWER sbe Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2012,2016 */
-/* [+] 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 return_code.C
- *
- * @brief Fuctions that process PPE return codes
- */
-
-#include <return_code.H>
-
-namespace fapi2
-{
-
- /// @brief Takes a non-zero PIB return code and inssert the value into
- /// a fapi2::ReturnCode
- /// @param[in] i_msr Value read from the PPE MSR
- /// @return fapi::ReturnCode. Built ReturnCode
- ReturnCode& ReturnCode::insertPIBcode(uint32_t& rhs)
- {
- iv_rc = FAPI2_RC_PLAT_MASK | rhs;
- return iv_rc;
- }
-
-}
OpenPOWER on IntegriCloud