summaryrefslogtreecommitdiffstats
path: root/src/ppe/sbe
diff options
context:
space:
mode:
Diffstat (limited to 'src/ppe/sbe')
-rw-r--r--src/ppe/sbe/.empty0
-rw-r--r--src/ppe/sbe/image/Makefile336
-rw-r--r--src/ppe/sbe/image/base_loader.c47
-rw-r--r--src/ppe/sbe/image/base_main.C91
-rw-r--r--src/ppe/sbe/image/base_ppe_demo.c46
-rw-r--r--src/ppe/sbe/image/base_ppe_demo.h43
-rw-r--r--src/ppe/sbe/image/base_ppe_header.S217
-rw-r--r--src/ppe/sbe/image/base_sbe_fixed.S69
-rw-r--r--src/ppe/sbe/image/fapi_sbe_common.H71
-rw-r--r--src/ppe/sbe/image/img_defs.mk359
-rw-r--r--src/ppe/sbe/image/link.cmd115
-rw-r--r--src/ppe/sbe/image/linkloader.cmd96
-rw-r--r--src/ppe/sbe/image/linksbe.cmd97
-rw-r--r--src/ppe/sbe/image/linkseeprom.cmd115
-rw-r--r--src/ppe/sbe/image/p9_sbe.H53
-rw-r--r--src/ppe/sbe/image/proc_sbe_fixed.H189
-rw-r--r--src/ppe/sbe/image/sbe_common.H601
-rw-r--r--src/ppe/sbe/image/sbe_link.H77
-rw-r--r--src/ppe/sbe/image/sbe_loader.c46
-rw-r--r--src/ppe/sbe/image/sbe_main.C388
-rw-r--r--src/ppe/sbe/image/sbe_xip_image.c2487
-rw-r--r--src/ppe/sbe/image/sbe_xip_image.h1703
-rw-r--r--src/ppe/sbe/image/topfiles.mk35
-rw-r--r--src/ppe/sbe/plat/include/README9
-rw-r--r--src/ppe/sbe/plat/include/fapi2_hw_access.H464
-rw-r--r--src/ppe/sbe/plat/include/hw_access.H619
-rw-r--r--src/ppe/sbe/plat/include/plat_error_scope.H71
-rw-r--r--src/ppe/sbe/plat/include/plat_hw_access.H94
-rw-r--r--src/ppe/sbe/plat/src/Makefile56
-rw-r--r--src/ppe/sbe/plat/src/fapi2sbefiles.mk49
-rw-r--r--src/ppe/sbe/plat/src/return_code.C47
-rw-r--r--src/ppe/sbe/sample/Makefile100
-rw-r--r--src/ppe/sbe/sample/img_defs.mk265
-rw-r--r--src/ppe/sbe/sample/link.cmd92
-rw-r--r--src/ppe/sbe/sample/pk_scom.c236
-rw-r--r--src/ppe/sbe/sample/pk_scom.h67
-rw-r--r--src/ppe/sbe/sample/pk_trace_wrap.c33
-rw-r--r--src/ppe/sbe/sample/pk_trace_wrap.h31
-rw-r--r--src/ppe/sbe/sample/sample_main.C123
-rw-r--r--src/ppe/sbe/sample/topfiles.mk30
-rw-r--r--src/ppe/sbe/sbefw/Makefile57
-rw-r--r--src/ppe/sbe/sbefw/pk_app_cfg.h128
-rw-r--r--src/ppe/sbe/sbefw/pool.C71
-rw-r--r--src/ppe/sbe/sbefw/pool.H59
-rw-r--r--src/ppe/sbe/sbefw/sbe_sp_intf.H222
-rw-r--r--src/ppe/sbe/sbefw/sbecmdiplcontrol.C328
-rw-r--r--src/ppe/sbe/sbefw/sbecmdiplcontrol.H58
-rw-r--r--src/ppe/sbe/sbefw/sbecmdparser.C186
-rw-r--r--src/ppe/sbe/sbefw/sbecmdparser.H116
-rw-r--r--src/ppe/sbe/sbefw/sbecmdprocessor.C263
-rw-r--r--src/ppe/sbe/sbefw/sbecmdreceiver.C175
-rw-r--r--src/ppe/sbe/sbefw/sbecmdscomaccess.C306
-rw-r--r--src/ppe/sbe/sbefw/sbecmdscomaccess.H59
-rw-r--r--src/ppe/sbe/sbefw/sbeexeintf.H195
-rw-r--r--src/ppe/sbe/sbefw/sbefifo.C274
-rw-r--r--src/ppe/sbe/sbefw/sbefifo.H490
-rw-r--r--src/ppe/sbe/sbefw/sbefwfiles.mk37
-rw-r--r--src/ppe/sbe/sbefw/sbeirq.C128
-rw-r--r--src/ppe/sbe/sbefw/sbeirq.H108
-rw-r--r--src/ppe/sbe/sbefw/sbemain.C289
-rw-r--r--src/ppe/sbe/sbefw/sbetrace.H59
-rw-r--r--src/ppe/sbe/sbefw/vector399
62 files changed, 0 insertions, 13674 deletions
diff --git a/src/ppe/sbe/.empty b/src/ppe/sbe/.empty
deleted file mode 100644
index e69de29..0000000
--- a/src/ppe/sbe/.empty
+++ /dev/null
diff --git a/src/ppe/sbe/image/Makefile b/src/ppe/sbe/image/Makefile
deleted file mode 100644
index 388286e..0000000
--- a/src/ppe/sbe/image/Makefile
+++ /dev/null
@@ -1,336 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/ppe/sbe/image/Makefile $
-#
-# OpenPOWER OnChipController Project
-#
-# Contributors Listed Below - COPYRIGHT 2015
-# [+] 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
-
-#remove this once we have a real compiler
-export P2P_ENABLE = 1
-
-#remove this once we have a real compiler
-export SBEFW_ENABLE = 1
-
-#Pull in the definitions that affect all makefiles for this image
-include img_defs.mk
-
-#Pull in object file names for the top directory
-include topfiles.mk
-
-ifdef P2P_ENABLE
-include $(P2P_SRCDIR)/p2pfiles.mk
-endif
-
-#Pull in PPE complier libraries .
-# Sets up the following variables:
-# $(GCCLIBS) -> Libary objects to be linked
-# $(LIB_DIRS) -> Include directories
-include ../../include/ppe_compiler.mk
-
-
-PK_MAKE_DIR := $(PK_SRCDIR)/$(PPE_TYPE)
-LIB_DIRS += -L$(OBJDIR)/pk
-PKLIB := $(OBJDIR)/pk/libpk.a
-LLIBS += -lpk
-
-SBEFW_MAKE_DIR := ../sbefw
-LIB_DIRS += -L$(OBJDIR)/sbefw
-SBEFWLIB := $(OBJDIR)/sbefw/libsbefw.a
-LLIBS += -lsbefw
-
-SAMPLE_MAKE_DIR := ../sample
-LIB_DIRS += -L$(OBJDIR)/sample
-SAMPLELIB := $(OBJDIR)/sample/libsample.a
-#LLIBS += -lsample
-
-# FAPI2 library
-FAPI2_MAKE_DIR := $(PLAT_FAPI2_DIR)
-LIB_DIRS += -L$(OBJDIR)/fapi2
-FAPI2LIB := $(OBJDIR)/fapi2/libfapi2.a
-LLIBS += -lfapi2
-
-ifdef P2P_ENABLE
-LIB_DIRS += -L$(OBJDIR)/p2p
-P2PLIB := $(OBJDIR)/p2p/libp2p.a
-LINK_OBJS += $(P2PLIB)
-LLIBS += -lp2p
-endif
-
-# HWP LIB library
-HWPLIB_MAKE_DIR := $(HWPLIB_SRCDIR)
-LIB_DIRS += -L$(OBJDIR)/lib
-HWPLIB := $(OBJDIR)/libcommon.a
-LLIBS += -lcommon
-include $(HWPLIB_SRCDIR)/libcommonerrors.mk
-
-# Common Cache HWP Exit library
-CACHE_MAKE_DIR := $(CACHE_SRCDIR)
-LIB_DIRS += -L$(OBJDIR)/cache
-CACHELIB := $(OBJDIR)/cache/libcache.a
-LLIBS += -lcache
-
-
-# Common Core libraries
-CORE_MAKE_DIR := $(CORE_SRCDIR)
-LIB_DIRS += -L$(OBJDIR)/core
-CORELIB := $(OBJDIR)/core/libcore.a
-LLIBS += -lcore
-
-# Common Perv libraries
-PERV_MAKE_DIR := $(PERV_SRCDIR)
-LIB_DIRS += -L$(OBJDIR)/perv
-PERVLIB := $(OBJDIR)/perv/libperv.a
-LLIBS += -lperv
-include $(PERV_SRCDIR)/perverrors.mk
-
-# Common Nest libraries
-NEST_MAKE_DIR := $(NEST_SRCDIR)
-LIB_DIRS += -L$(OBJDIR)/nest
-NESTLIB := $(OBJDIR)/nest/libnest.a
-LLIBS += -lnest
-include $(NEST_SRCDIR)/nesterrors.mk
-
-SBE_TOOLS := $(TOOLS_IMAGE_DIR)/sbe_xip_tool $(TOOLS_IMAGE_DIR)/sbe_default_tool
-
-LINK_OBJS = $(OBJS) $(SBEFWLIB) $(PKLIB) $(FAPI2LIB) $(CACHELIB) $(CORELIB) $(HWPLIB) $(P2PLIB) $(PERVLIB) $(NESTLIB)
-
-# Define the objects
-OBJS := $(addprefix $(OBJDIR)/, $(TOP_OBJECTS))
-LINK_OBJS += $(OBJS) $(GCCLIBS)
-
-LINK_SCRIPT_SEEPROM = $(addprefix $(OBJDIR)/, linkscriptseeprom)
-LINK_SCRIPT_SBE = $(addprefix $(OBJDIR)/, linkscriptsbe)
-LINK_SCRIPT_LOADER = $(addprefix $(OBJDIR)/, linkscriptloader)
-
-
-#default target is to make a binary application image
-#This removes all unecessary headers from the ELF executable
-$(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin $(OBJDIR)/$(IMAGE_SEEPROM_NAME).dis: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out
- $(OBJCOPY) -O binary $< $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin --pad-to 0x`/usr/bin/nm $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out | grep "A _seeprom_end" | cut -d " " -f 1`
- $(OBJDUMP) -S $< > $(OBJDIR)/$(IMAGE_SEEPROM_NAME).dis
-
-#create a linked ELF executable
-$(OBJDIR)/$(IMAGE_SEEPROM_NAME).out: $(LINK_OBJS) $(LINK_SCRIPT_SEEPROM)
- $(LD) -e __system_reset -T$(LINK_SCRIPT_SEEPROM) -Map $(OBJDIR)/$(IMAGE_SEEPROM_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out $(LIB_DIRS) $(OBJS) --start-group $(LLIBS) --end-group
-
-#pass the link command file through the C preprocessor to evaluate macros and remove comments
-$(LINK_SCRIPT_SEEPROM): linkseeprom.cmd
- $(CPP) -E -x c++ -P $(DEFS) linkseeprom.cmd -o $(LINK_SCRIPT_SEEPROM)
-
-#default target is to make a binary pibmem image
-#This removes all unecessary headers from the ELF executable
-$(OBJDIR)/$(IMAGE_SBE_NAME).bin $(OBJDIR)/$(IMAGE_SBE_NAME).dis: $(OBJDIR)/$(IMAGE_SBE_NAME).out
- $(OBJCOPY) -O binary $< $(OBJDIR)/$(IMAGE_SBE_NAME).bin --pad-to 0x`/usr/bin/nm $(OBJDIR)/$(IMAGE_SBE_NAME).out | grep "A _sbe_end" | cut -d " " -f 1`
- $(OBJDUMP) -S $< > $(OBJDIR)/$(IMAGE_SBE_NAME).dis
-
-#create a linked ELF executable
-$(OBJDIR)/$(IMAGE_SBE_NAME).out: $(OBJDIR)/base_sbe_fixed.o $(LINK_OBJS) $(LINK_SCRIPT_SBE)
- $(LD) -e __system_reset -T$(LINK_SCRIPT_SBE) -Map $(OBJDIR)/$(IMAGE_SBE_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_SBE_NAME).out $(LIB_DIRS) $(OBJDIR)/base_sbe_fixed.o --start-group $(LLIBS) --end-group
-
-#pass the link command file through the C preprocessor to evaluate macros and remove comments
-$(LINK_SCRIPT_SBE): linksbe.cmd
- $(CPP) -E -x c++ -P $(DEFS) linksbe.cmd -o $(LINK_SCRIPT_SBE)
-
-
-
-
-$(OBJDIR)/$(IMAGE_LOADER_NAME).bin $(OBJDIR)/$(IMAGE_LOADER_NAME).dis: $(OBJDIR)/$(IMAGE_LOADER_NAME).out
- $(OBJCOPY) -O binary $< $(OBJDIR)/$(IMAGE_LOADER_NAME).bin --pad-to 0x`/usr/bin/nm $(OBJDIR)/$(IMAGE_LOADER_NAME).out | grep "A _loader_end" | cut -d " " -f 1`
- $(OBJDUMP) -S $< > $(OBJDIR)/$(IMAGE_LOADER_NAME).dis
-
-#create a linked ELF executable
-$(OBJDIR)/$(IMAGE_LOADER_NAME).out: $(OBJDIR)/base_loader.o $(LINK_OBJS) $(LINK_SCRIPT_LOADER)
- $(LD) -e base_loader -T$(LINK_SCRIPT_LOADER) -Map $(OBJDIR)/$(IMAGE_LOADER_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_LOADER_NAME).out $(LIB_DIRS) $(OBJDIR)/base_loader.o --start-group $(SBEFWLIB) $(LLIBS) --end-group
-
-#pass the link command file through the C preprocessor to evaluate macros and remove comments
-$(LINK_SCRIPT_LOADER): linkloader.cmd
- $(CPP) -E -x c++ -P $(DEFS) linkloader.cmd -o $(LINK_SCRIPT_LOADER)
-
-
-
-
-all: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin $(OBJDIR)/$(IMAGE_SBE_NAME).bin $(OBJDIR)/$(IMAGE_LOADER_NAME).bin $(SBE_TOOLS) normalize defaultset $(OBJDIR)/fixed.bin appendbase appendloader
-
-generic: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin $(SBE_TOOLS) normalize defaultset $(OBJDIR)/fixed.bin
-
-#Create an obj directory if needed
-$(LINK_OBJS) $(OBJS) $(OBJS:.o=.d) $(OBJDIR)/base_sbe_fixed.o $(OBJDIR)/base_sbe_fixed.d: | $(OBJDIR)
-
-ATTRFILES += $(IMPORT_XML_DIR)/attribute_info/perv_attributes.xml
-ATTRFILES += $(IMPORT_XML_DIR)/attribute_info/proc_attributes.xml
-ATTRFILES += $(IMPORT_XML_DIR)/attribute_info/ex_attributes.xml
-ATTRFILES += $(IMPORT_XML_DIR)/attribute_info/eq_attributes.xml
-ATTRFILES += $(IMPORT_XML_DIR)/attribute_info/core_attributes.xml
-
-$(OBJDIR):
- $(TOOLS_ATTR_DIR)/ppeParseProcSbeFixed.pl . $(IMPORT_XML_DIR)/p9_ppe_attributes.xml $(ATTRFILES)
- $(TOOLS_ATTR_DIR)/ppeParseAttributeInfo.pl $(PPE_FAPI2_DIR)/include $(IMPORT_XML_DIR)/p9_ppe_attributes.xml $(ATTRFILES)
- $(TOOLS_ATTR_DIR)/ppeCreateAttrGetSetMacros.pl -path $(TOOLS_ATTR_DIR)/src -inc $(PPE_FAPI2_DIR)/include -src $(PPE_FAPI2_DIR)/src
- $(TOOLS_ATTR_DIR)/ppeCreateIfAttrService.pl $(PPE_FAPI2_DIR)/include $(IMPORT_XML_DIR)/p9_ppe_attributes.xml $(ATTRFILES)
- mkdir -p $(OBJDIR)
-
-.PHONY: clean topfixedheaders $(PKLIB) $(P2PLIB) $(PPELIB) $(FAPI2LIB) $(CACHELIB) $(CORELIB) $(PERVLIB) $(NESTLIB) $(HWPLIB)
-
-#errxml: topfixedheaders attrids platattr attrserv
-
-topfixedheaders:
- $(TOOLS_ATTR_DIR)/ppeParseProcSbeFixed.pl . $(IMPORT_XML_DIR)/p9_ppe_attributes.xml $(ATTRFILES)
-
-attrids:
- $(TOOLS_ATTR_DIR)/ppeParseAttributeInfo.pl $(PPE_FAPI2_DIR)/include $(IMPORT_XML_DIR)/p9_ppe_attributes.xml $(ATTRFILES)
-
-platattr:
- $(TOOLS_ATTR_DIR)/ppeCreateAttrGetSetMacros.pl --path $(TOOLS_ATTR_DIR)/src --inc $(PPE_FAPI2_DIR)/include --src $(PPE_FAPI2_DIR)/src
-
-attrserv:
- $(TOOLS_ATTR_DIR)/ppeCreateIfAttrService.pl $(PPE_FAPI2_DIR)/include $(IMPORT_XML_DIR)/p9_ppe_attributes.xml $(ATTRFILES)
-
-
-#Build macro-specific kernel code
-$(PKLIB):
- $(MAKE) -I $(IMAGE_SRCDIR) -C $(PK_MAKE_DIR) -f Makefile
-
-#Build macro-specific kernel code
-$(SBEFWLIB):
- $(MAKE) -I $(IMAGE_SRCDIR) -C $(SBEFW_MAKE_DIR) -f Makefile
-
-#Build the code that is common for all processors (PPEs and 405)
-$(PPELIB):
- @echo "Processing ppelibmakefile"
- $(MAKE) -I $(IMAGE_SRCDIR) -C $(LIB_MAKE_DIR) -f Makefile
-
-#Build the cache exit code shared with the SBE
-$(CACHELIB):
- @echo "Processing cache makefile"
- $(MAKE) -I $(IMAGE_SRCDIR) -C $(CACHE_MAKE_DIR) -f Makefile
-
-#Build the core exit code shared with the SBE
-$(CORELIB):
- @echo "Processing core makefile"
- $(MAKE) -I $(IMAGE_SRCDIR) -C $(CORE_MAKE_DIR) -f Makefile
-
-#Build the perv code
-$(PERVLIB):
- @echo "Processing perv makefile"
- $(MAKE) -I $(IMAGE_SRCDIR) -C $(PERV_MAKE_DIR) -f Makefile
-
-#Build the nest code
-$(NESTLIB):
- @echo "Processing nest makefile"
- $(MAKE) -I $(IMAGE_SRCDIR) -C $(NEST_MAKE_DIR) -f Makefile
-
-#Build the comming HWP lib procedures
-
-#Build the HWP lib procedures
-$(HWPLIB):
- @echo "Processing HWP lib makefile"
- $(MAKE) -I $(IMAGE_SRCDIR) -C $(HWPLIB_MAKE_DIR) -f Makefile
-
-#Build the FAPI2 library
-$(FAPI2LIB):
- @echo "Processing fapi2 makefile"
- $(MAKE) -I $(IMAGE_SRCDIR) -C $(FAPI2_MAKE_DIR)/src -f Makefile
-
-ifdef P2P_ENABLE
-$(P2PLIB):
- $(MAKE) -I $(IMAGE_SRCDIR) -C $(P2P_SRCDIR) -f Makefile
-endif
-
-$(SBE_TOOLS):
- $(MAKE) -C $(TOOLS_IMAGE_DIR) -f Makefile
-
-normalize: $(SBE_TOOLS) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin
- $(TOOLS_IMAGE_DIR)/sbe_xip_tool $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin normalize
-
-defaultset: $(SBE_TOOLS) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin normalize
- $(TOOLS_IMAGE_DIR)/ppeSetFixed.pl $(TOOLS_IMAGE_DIR) $(BASE_OBJDIR)/$(IMAGE_SEEPROM_NAME).bin $(IMPORT_XML_DIR)/p9_ppe_attributes.xml $(ATTRFILES)
-
-# Build hwp_error_info.H. If the script fails then print the contents of
-# the header and then delete whatever garbage the script left to force it to
-# be built again.
-#
-# -*- HACK -*- Use local version of parseErrorInfo.pl until FW team
-# updates the standard version to work in assembly. The source for this
-# script is : $(FAPI)/capi/scripts/parseErrorInfo.pl
-
-.PHONY : xml
-
-xml: $(FAPI_RC)
-
-$(FAPI_RC): $(TOOLS_ATTR_DIR)/parseErrorInfo.pl $(ERROR_XML_FILES)
- $(TOOLS_ATTR_DIR)/parseErrorInfo.pl --empty-ffdc-classes --output-dir=. $(ERROR_XML_FILES)
-# if [ $$? -ne 0 ]; then \
-# echo "Build of hwp_error_info.H failed; Current contents :"; \
-# cat hwp_error_info.H; \
-# rm -f hwp_error_info.H; \
-# exit 1; fi
-# The above is commented out as the current version of make produces errors
-# This was taken from the P8 SBE Makefile which worked.
-
-$(OBJDIR)/fixed.bin: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin
- $(TOOLS_IMAGE_DIR)/sbe_xip_tool $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin extract .fixed $(BASE_OBJDIR)/fixed.bin
-
-
-appendbase: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin $(OBJDIR)/$(IMAGE_SBE_NAME).bin
- $(TOOLS_IMAGE_DIR)/sbe_xip_tool $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin append .base $(OBJDIR)/$(IMAGE_SBE_NAME).bin
-
-
-
-appendloader: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin $(OBJDIR)/$(IMAGE_LOADER_NAME).bin
- $(TOOLS_IMAGE_DIR)/sbe_xip_tool $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin append .baseloader $(OBJDIR)/$(IMAGE_LOADER_NAME).bin
-
-#/afs/bb/proj/cte/tools/ppetools/prod/powerpc-eabi/bin/objcopy -O binary --only-section=.fixed $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out $(OBJDIR)/fixed.bin
-
-# collect all of the trace hash files for this image into a single trexStringFile
-.PHONY : tracehash
-tracehash:
- mkdir -p $(OBJDIR)
- $(THASH) -c -d $(OBJDIR) -s $(OBJDIR)/trexStringFile
-
-#clean the kernel directory first, then the application level clean
-clean:
- rm -fr $(OBJDIR)
- rm -f $(TOP-FIXED-HEADERS)
- rm -fr $(TOOLS_IMAGE_DIR)/bin/*
- rm -f *.dump
- rm -f hwp_return_codes.H hwp_error_info.H hwp_ffdc_classes.H collect_reg_ffdc.C set_sbe_error.H
-
-dump:
- objdump -s $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out > $(IMAGE_SEEPROM_NAME).dump
- objdump -s $(OBJDIR)/$(IMAGE_SBE_NAME).out > $(IMAGE_SBE_NAME).dump
-
-.PHONY : run_spgpe run_pmgpe
-# load and run the SBE SeeProm image in a GPE simics environment
-run_spgpe: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out
- $(SIMICS_WS)/simics \
- -e '$$occ_gpe0_binary_to_load=$(OBJDIR)/$(IMAGE_SEEPROM_NAME).out' modelsetup.simics
-
-# load and run the SBE PibMem image in a GPE simics environment
-run_pmgpe: $(OBJDIR)/$(IMAGE_NAME).out
- $(SIMICS_WS)/simics \
- -e '$$occ_gpe0_binary_to_load=$(OBJDIR)/$(IMAGE_SBE_NAME).out' modelsetup.simics
-
-
-
-#Add dependencies to header files
-ifneq ($(MAKECMDGOALS),clean)
-include $(OBJS:.o=.d)
-endif
diff --git a/src/ppe/sbe/image/base_loader.c b/src/ppe/sbe/image/base_loader.c
deleted file mode 100644
index dbba19f..0000000
--- a/src/ppe/sbe/image/base_loader.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/image/base_loader.c $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 "sbe_xip_image.h"
-#include "sbetrace.H"
-
-int32_t base_loader();
-
-
-int32_t base_loader() {
-
- int32_t rc = 0;
-
- SbeXipHeader *hdr = 0;//getXipHdr();
- uint32_t idx;
-
-
- for(idx = 0; idx < SBE_XIP_SECTIONS; idx++) {
-
- SBE_TRACE("Section Idx:%u Size:0x%08X", idx, hdr->iv_section[idx].iv_size);
-
- }
-
- return rc;
-}
-
diff --git a/src/ppe/sbe/image/base_main.C b/src/ppe/sbe/image/base_main.C
deleted file mode 100644
index 92cf13b..0000000
--- a/src/ppe/sbe/image/base_main.C
+++ /dev/null
@@ -1,91 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/image/base_main.C $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 */
-//-----------------------------------------------------------------------------
-// *! (C) Copyright International Business Machines Corp. 2014
-// *! All Rights Reserved -- Property of IBM
-// *! *** IBM Confidential ***
-//-----------------------------------------------------------------------------
-
-/// \file base_main.c
-/// \brief base program that creates and starts a thread
-///
-/// This file is a placeholder code in order to compile. I will be replaced in future by the code placed into the .text section.
-
-extern "C" {
-#include "pk.h"
-#include "pk_trace.h"
-#include "base_ppe_demo.h"
-#include "sbe_xip_image.h"
-}
-#define KERNEL_STACK_SIZE 256
-#define MAIN_THREAD_STACK_SIZE 256
-
-uint8_t G_kernel_stack[KERNEL_STACK_SIZE];
-uint8_t G_main_thread_stack[MAIN_THREAD_STACK_SIZE];
-PkThread G_main_thread;
-
-// A simple thread that just increments a local variable and sleeps
-void main_thread(void* arg)
-{
-
- while(1)
- {
-
- pk_sleep(PK_SECONDS(1));
-
- }
-}
-
-
-// The main function is called by the boot code (after initializing some
-// registers)
-int main(int argc, char **argv)
-{
- // initializes kernel data (stack, threads, timebase, timers, etc.)
- pk_initialize((PkAddress)G_kernel_stack,
- KERNEL_STACK_SIZE,
- 0,
- 500000000);
-
-
- //Initialize the thread control block for G_main_thread
- pk_thread_create(&G_main_thread,
- (PkThreadRoutine)main_thread,
- (void*)NULL,
- (PkAddress)G_main_thread_stack,
- (size_t)MAIN_THREAD_STACK_SIZE,
- (PkThreadPriority)1);
-
-
-
- //Make G_main_thread runnable
- pk_thread_resume(&G_main_thread);
-
- // Start running the highest priority thread.
- // This function never returns
- pk_start_threads();
-
- return 0;
-}
diff --git a/src/ppe/sbe/image/base_ppe_demo.c b/src/ppe/sbe/image/base_ppe_demo.c
deleted file mode 100644
index a2ece74..0000000
--- a/src/ppe/sbe/image/base_ppe_demo.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/image/base_ppe_demo.c $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 */
-//-----------------------------------------------------------------------------
-// *! (C) Copyright International Business Machines Corp. 2014
-// *! All Rights Reserved -- Property of IBM
-// *! *** IBM Confidential ***
-//-----------------------------------------------------------------------------
-
-/// \file base_ppe_demo.c
-/// \brief example code to include into fixed section
-///
-/// demo function to include into fixed section. Can be replaced as soon as
-/// real functions are available
-
-#include "base_ppe_demo.h"
-#include "pk.h"
-#include "pk_trace.h"
-
-
-//void base_ppe_demo_func(const char* str)
-void main()
-{
- PK_TRACE("TESTFUNCTION");
-}
diff --git a/src/ppe/sbe/image/base_ppe_demo.h b/src/ppe/sbe/image/base_ppe_demo.h
deleted file mode 100644
index 5447b0c..0000000
--- a/src/ppe/sbe/image/base_ppe_demo.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/image/base_ppe_demo.h $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 */
-//-----------------------------------------------------------------------------
-// *! (C) Copyright International Business Machines Corp. 2014
-// *! All Rights Reserved -- Property of IBM
-// *! *** IBM Confidential ***
-//-----------------------------------------------------------------------------
-
-/// \file base_ppe_demo.h
-/// \brief routine to be placed into the fixed section.
-///
-/// this routing is a demonstration for functions to be placed into the fixed
-/// fixed section
-#ifndef __BASE_PPE_DEMO_H__
-#define __BASE_PPE_DEMO_H__
-
-/// this is a demo function whose pointer is placed into the fixed section
-/// @param str demo string
-void base_ppe_demo_func(const char*);
-
-#endif // __BASE_PPE_DEMO_H__
diff --git a/src/ppe/sbe/image/base_ppe_header.S b/src/ppe/sbe/image/base_ppe_header.S
deleted file mode 100644
index 8d2fa43..0000000
--- a/src/ppe/sbe/image/base_ppe_header.S
+++ /dev/null
@@ -1,217 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/image/base_ppe_header.S $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 */
-//-----------------------------------------------------------------------------
-// *! (C) Copyright International Business Machines Corp. 2014
-// *! All Rights Reserved -- Property of IBM
-// *! *** IBM Confidential ***
-//-----------------------------------------------------------------------------
-
-/// \file base_ppe_header.S
-/// \brief code to create header, toc, strings, fixed and fixed_toc sections
-///
-/// function SbeXipHeader creates header section, function .proc_sbe_fixed
-/// creates fixed, fixed_toc sections
-#include "sbe_xip_image.h"
-#include "proc_sbe_fixed.H"
-
-
-#define IMAGE_SPACE_UNDEFINED 0xffff
-#define IMAGE_SPACE_OCI 0x8000
-#define IMAGE_SPACE_PNOR 0x800b
-#define IMAGE_SPACE_OTPROM 0x0001
-#define IMAGE_SPACE_SEEPROM 0x800c
-#define IMAGE_SPACE_BASE 0x0008
-
-
-
- .macro ..checku, x:req, bits:req, err="Unsigned value too large"
-
- .if (((\bits) <= 0) || ((\bits) > 63))
- .error "The number of bits must be in the range 0 < bits < 64"
- .endif
-
- .iflt (\x)
- .error "An unsigned value is required here"
- .endif
-
- .ifgt ((\x) - (0xffffffffffffffff >> (64 - (\bits))))
- .error "\err"
- .endif
-
- .endm
-
- .macro ..check_u16, u16
- ..checku (\u16), 16, "Unsigned immediate is larger than 16 bits"
- .endm
-
-
- .macro ..set_default_space, s
- ..check_u16 (\s)
- .set _PGAS_DEFAULT_SPACE, (\s)
- .endm
-
- .macro ..check_default_space
- .if (_PGAS_DEFAULT_SPACE == IMAGE_SPACE_UNDEFINED)
- .error "The PGAS default address space has not been defined"
- .endif
- .endm
-
-
- .macro .quada, offset:req
- ..check_default_space
- .long _PGAS_DEFAULT_SPACE
- .long (\offset)
- .endm
-
-
-// .macro SbeXipHeader, magic, link_address, entry_point, image_size
-
- .macro SbeXipSection, s:req, alignment=1, empty=0
-__\s\()_section:
- .if \empty
- .long 0
- .long 0
- .else
- .long _\s\()_offset
- .long _\s\()_size
- .endif
- .byte (\alignment)
- .byte 0, 0, 0
- .endm
-
-
- .macro SbeXipHeader, magic, link_address, entry_point, image_size
-
- .section .header, "a", @progbits
-
-
- //////////////////////////////////////////////////////////////////////
- // Identification - 8-byte aligned; 8 Entries; TOC-Indexed
- //////////////////////////////////////////////////////////////////////
-
-__magic:
- .quad (\magic)
-__entry_offset:
- .quad ((\entry_point) - (\link_address))
-__link_address:
- .quada (\link_address)
-__header_64_reserved:
- .quad 0, 0, 0, 0, 0
-
- .xip_toc magic, SBE_XIP_UINT64, __magic
- .xip_toc entry_offset, SBE_XIP_UINT64, __entry_offset
- .xip_toc link_address, SBE_XIP_UINT64, __link_address
-
-
- //////////////////////////////////////////////////////////////////////
- // Section Table - 8-byte aligned; 16 entries; Not TOC-Indexed
- //////////////////////////////////////////////////////////////////////
-
- SbeXipSection header
- SbeXipSection fixed, 8
- SbeXipSection fixed_toc, 8
- SbeXipSection loader_text, 4
- SbeXipSection loader_data, 8
- SbeXipSection text, 4
- SbeXipSection data, 8
- SbeXipSection toc, 4
- SbeXipSection strings
- SbeXipSection base, 4, empty=1
- SbeXipSection baseloader, 8, empty=1
- SbeXipSection overlay, 8, empty=1
- SbeXipSection rings, 8, empty=1
-
-
- //////////////////////////////////////////////////////////////////////
- // Other Information - 4-byte aligned; 8 entries; TOC-Indexed
- //////////////////////////////////////////////////////////////////////
-
-__image_size:
- .long (\image_size)
-__build_date:
- .long 0
-__build_time:
- .long 0
-__header_32_reserved:
- .long 0, 0, 0, 0, 0
-
- .xip_toc image_size, SBE_XIP_UINT32, __image_size
- .xip_toc build_date, SBE_XIP_UINT32, __build_date
- .xip_toc build_time, SBE_XIP_UINT32, __build_time
-
-
- //////////////////////////////////////////////////////////////////////
- // Other Information - 1-byte aligned; 8 entries; TOC-Indexed
- //////////////////////////////////////////////////////////////////////
-
-__header_version:
- .byte SBE_XIP_HEADER_VERSION
-__toc_normalized:
- .byte 0
-__toc_sorted:
- .byte 0
-__header_8_reserved:
- .byte 0, 0, 0, 0, 0
-
- .xip_toc header_version, SBE_XIP_UINT8, __header_version
- .xip_toc toc_normalized, SBE_XIP_UINT8, __toc_normalized
- .xip_toc toc_sorted, SBE_XIP_UINT8, __toc_sorted
-
-
- //////////////////////////////////////////////////////////////////////
- // Strings; 64 characters allocated; TOC-Indexed
- //////////////////////////////////////////////////////////////////////
-
-__build_user:
- .asciz "unknown " # 16 Characters allocated
-__build_host:
- .asciz "unknown " # 24 characters allocated
-__header_string_reserved:
- .space 24, 0
-
- .xip_toc build_user, SBE_XIP_STRING, __build_user
- .xip_toc build_host, SBE_XIP_STRING, __build_host
-
-
- .endm
-
-
- .section .fixed, "a", @progbits
- .section .fixed_toc, "a", @progbits
- .section .loader_data, "a", @progbits
- .section .loader_text, "a", @progbits
-
- .section .toc, "a", @progbits
- .section .strings, "aS", @progbits
-
- ..set_default_space IMAGE_SPACE_SEEPROM
- SbeXipHeader SBE_SEEPROM_MAGIC, 0xFFF00000, 0xFFF00C78, _seeprom_size
-
- // Create the .fixed section
- .proc_sbe_fixed_proc_chip
- .proc_sbe_fixed_perv
- .proc_sbe_fixed_core
- .proc_sbe_fixed_ex
- .proc_sbe_fixed_eq
diff --git a/src/ppe/sbe/image/base_sbe_fixed.S b/src/ppe/sbe/image/base_sbe_fixed.S
deleted file mode 100644
index b9e4b04..0000000
--- a/src/ppe/sbe/image/base_sbe_fixed.S
+++ /dev/null
@@ -1,69 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/image/base_sbe_fixed.S $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 sbefixed.S
-/// \brief code to generated fixed section in pibmem image
-///
-#include "sbe_xip_image.h"
-#include "proc_sbe_fixed.H"
-
-
- .macro ..checku, x:req, bits:req, err="Unsigned value too large"
-
- .if (((\bits) <= 0) || ((\bits) > 63))
- .error "The number of bits must be in the range 0 < bits < 64"
- .endif
-
- .iflt (\x)
- .error "An unsigned value is required here"
- .endif
-
- .ifgt ((\x) - (0xffffffffffffffff >> (64 - (\bits))))
- .error "\err"
- .endif
-
- .endm
-
-
- .macro ..check_u16, u16
- ..checku (\u16), 16, "Unsigned immediate is larger than 16 bits"
- .endm
-
-
- .macro ..set_default_space, s
- ..check_u16 (\s)
- .set _PGAS_DEFAULT_SPACE, (\s)
- .endm
-
-
-
- .section .fixed, "a", @progbits
-
-
- // Create the .fixed section
- .proc_sbe_fixed_proc_chip
- .proc_sbe_fixed_perv
- .proc_sbe_fixed_core
- .proc_sbe_fixed_ex
- .proc_sbe_fixed_eq
diff --git a/src/ppe/sbe/image/fapi_sbe_common.H b/src/ppe/sbe/image/fapi_sbe_common.H
deleted file mode 100644
index aebd089..0000000
--- a/src/ppe/sbe/image/fapi_sbe_common.H
+++ /dev/null
@@ -1,71 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/image/fapi_sbe_common.H $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 */
-//-----------------------------------------------------------------------------
-// *! (C) Copyright International Business Machines Corp. 2014
-// *! All Rights Reserved -- Property of IBM
-// *! *** IBM Confidential ***
-//-----------------------------------------------------------------------------
-
-/// \file fapi_sbe_common.H
-/// \brief provides several preprocessor macros used functions in fixed secion.
-///
-/// Several preprocessor macros are required to have different definitions in
-/// C, C++ and SBE assembly procedures. These common forms are collected here.
-
-#ifndef __FAPI_SBE_COMMON_H
-#define __FAPI_SBE_COMMON_H
-
-/// Several preprocessor macros are required to have different definitions in
-/// C, C++ and SBE assembly procedures. These common forms are collected here.
-
-#if defined __ASSEMBLER__
-
-#define CONST_UINT8_T(name, expr) .set name, (expr)
-#define CONST_UINT32_T(name, expr) .set name, (expr)
-#define CONST_UINT64_T(name, expr) .set name, (expr)
-
-#define ULL(x) x
-
-#elif defined __cplusplus
-
-#include <stdint.h>
-
-#define CONST_UINT8_T(name, expr) const uint8_t name = (expr);
-#define CONST_UINT32_T(name, expr) const uint32_t name = (expr);
-#define CONST_UINT64_T(name, expr) const uint64_t name = (expr);
-
-#define ULL(x) x##ull
-
-#else // C code
-
-// CONST_UINT[8,3,64]_T() can't be used in C code/headers; Use
-//
-// #define <symbol> <value> [ or ULL(<value>) for 64-bit constants
-
-#define ULL(x) x##ull
-
-#endif // __ASSEMBLER__
-
-#endif // __FAPI_SBE_COMMON_H
diff --git a/src/ppe/sbe/image/img_defs.mk b/src/ppe/sbe/image/img_defs.mk
deleted file mode 100644
index 8140cb9..0000000
--- a/src/ppe/sbe/image/img_defs.mk
+++ /dev/null
@@ -1,359 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/ppe/sbe/image/img_defs.mk $
-#
-# OpenPOWER OnChipController Project
-#
-# Contributors Listed Below - COPYRIGHT 2015
-# [+] 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
-# Make header for SBE image build
-#
-# Settings to for SBE image file build
-#
-# IMG_INCLUDES : Aplication-specific header search paths
-#
-# DEFS : A string of -D<symbol>[=<value>] to control compilation
-#
-# PK : Default ..; The path to the PK source code.
-# The default is set for building the PK
-# subdirectories.
-#
-# PK_THREAD_SUPPORT : (0/1, default 1); Compile PK thread and
-# semaphore suppprt
-#
-# PK_TIMER_SUPPORT : (0/1, default 1); Compile PK timer suppprt
-#
-# GCC-O-LEVEL : The optimization level passed to GCC (default -Os). May
-# also be defined empty (GCC-O-LEVEL=) to disable
-# optimization. This variable can also be used to pass
-# any other non-default setting to GCC, e.g.
-# make GCC-O-LEVEL="-Os -fno-branch-count-reg"
-#
-# GCC-TOOL-PREFIX : The full path (including executable file prefixes) to
-# the GCC cross-development tools to use. The default is
-# "ppcnf-mcp5-"
-#
-# CTEPATH : This variable defaults to the afs/awd CTE tool
-# installation - The PORE binutils are stored there. If
-# you are not in Austin be sure to define CTEPATH in
-# your .profile.
-#
-# OBJDIR : target directory for all generated files
-
-IMAGE_SEEPROM_NAME := seeprom_main
-IMAGE_SBE_NAME := sbe_main
-IMAGE_LOADER_NAME := loader_main
-
-ifndef PPE_TYPE
-PPE_TYPE := std
-endif
-
-ifndef IMAGE_SRCDIR
-export IMAGE_SRCDIR = $(abspath .)
-endif
-
-ifndef CACHE_SRCDIR
-export CACHE_SRCDIR = $(abspath ../../hwp/cache)
-endif
-
-ifndef CORE_SRCDIR
-export CORE_SRCDIR = $(abspath ../../hwp/core)
-endif
-
-ifndef PERV_SRCDIR
-export PERV_SRCDIR = $(abspath ../../hwp/perv)
-endif
-
-ifndef NEST_SRCDIR
-export NEST_SRCDIR = $(abspath ../../hwp/nest)
-endif
-
-ifndef HWPLIB_SRCDIR
-export HWPLIB_SRCDIR = $(abspath ../../hwp/lib)
-endif
-
-ifndef IMG_INCLUDES
-export IMG_INCLUDES = -I$(IMAGE_SRCDIR) -I$(CACHE_SRCDIR) -I$(CORE_SRCDIR) -I$(PERV_SRCDIR) -I$(NEST_SRCDIR)
-endif
-ifndef BASE_OBJDIR
-export BASE_OBJDIR = $(abspath ../obj)
-endif
-
-export IMG_OBJDIR = $(BASE_OBJDIR)/$(IMAGE_SEEPROM_NAME)
-
-ifndef PK_SRCDIR
-export PK_SRCDIR = $(abspath ../../pk)
-endif
-
-ifndef TOOLS_ATTR_DIR
-export TOOLS_ATTR_DIR = $(abspath ../../tools/scripts)
-endif
-
-ifndef TOOLS_IMAGE_DIR
-export TOOLS_IMAGE_DIR = $(abspath ../../tools/image)
-endif
-
-ifndef IMPORT_XML_DIR
-export IMPORT_XML_DIR = $(abspath ../../importtemp/xml)
-endif
-
-ifndef IMPORT_COMMON_DIR
-export IMPORT_COMMON_DIR = $(abspath ../../importtemp/common)
-endif
-
-ifndef P2P_SRCDIR
-export P2P_SRCDIR = $(abspath ../../tools/PowerPCtoPPE)
-endif
-
-ifndef PPETRACEPP_DIR
-export PPETRACEPP_DIR = $(abspath ../../tools/ppetracepp)
-endif
-
-ifndef PLAT_FAPI2_DIR
-export PLAT_FAPI2_DIR = $(abspath ../plat)
-endif
-
-
-ifndef PPE_FAPI2_DIR
-export PPE_FAPI2_DIR = $(abspath ../../hwpf/plat)
-endif
-
-ifndef BASE_FAPI2_DIR
-export BASE_FAPI2_DIR = $(abspath ../../importtemp/fapi2)
-endif
-
-ifndef CC_ROOT
-export CC_ROOT = ${CTEPATH}/tools/gcc405lin/prod
-endif
-
-ifndef GCC-TOOL-PREFIX
-GCC-TOOL-PREFIX = ${CC_ROOT}/usr/bin/powerpc-linux-
-endif
-
-ifndef BINUTILS-TOOL-PREFIX
-BINUTILS-TOOL-PREFIX = $(CTEPATH)/tools/ppetools/prod/powerpc-eabi/bin/
-endif
-
-ifndef FAPI_RC
-FAPI_RC = hwp_return_codes.H
-#FAPI_RC =
-endif
-
-OBJDIR = $(BASE_OBJDIR)$(SUB_OBJDIR)
-
-CC_ASM = $(GCC-TOOL-PREFIX)gcc
-#TCC = $(PPETRACEPP_DIR)/ppetracepp $(GCC-TOOL-PREFIX)g++
-TCC = $(PPETRACEPP_DIR)/ppetracepp $(GCC-TOOL-PREFIX)gcc
-CC = $(PPETRACEPP_DIR)/ppetracepp $(GCC-TOOL-PREFIX)gcc
-AS = $(BINUTILS-TOOL-PREFIX)as
-AR = $(BINUTILS-TOOL-PREFIX)ar
-LD = $(BINUTILS-TOOL-PREFIX)ld
-OBJDUMP = $(BINUTILS-TOOL-PREFIX)objdump
-OBJCOPY = $(BINUTILS-TOOL-PREFIX)objcopy
-TCPP = $(PPETRACEPP_DIR)/ppetracepp $(GCC-TOOL-PREFIX)gcc
-THASH = $(PPETRACEPP_DIR)/tracehash.pl
-CPP = $(GCC-TOOL-PREFIX)gcc
-
-ifdef P2P_ENABLE
-PCP = $(P2P_SRCDIR)/ppc-ppe-pcp.py
-endif
-
-
-ifndef CTEPATH
-$(warning The CTEPATH variable is not defined; Defaulting to /afs/awd)
-export CTEPATH = /afs/awd/projects/cte
-endif
-
-ifeq "$(PK_TIMER_SUPPORT)" ""
-PK_TIMER_SUPPORT = 1
-endif
-
-ifeq "$(PK_THREAD_SUPPORT)" ""
-PK_THREAD_SUPPORT = 1
-endif
-
-ifeq "$(PK_TRACE_SUPPORT)" ""
-PK_TRACE_SUPPORT = 1
-endif
-
-# Generate a 16bit trace string hash prefix value based on the name of this image. This will form
-# the upper 16 bits of the 32 bit trace hash values.
-ifndef PK_TRACE_HASH_PREFIX
-PK_TRACE_HASH_PREFIX := $(shell echo $(IMAGE_SEEPROM_NAME) | md5sum | cut -c1-4 | xargs -i printf "%d" 0x{})
-endif
-
-
-ifndef GCC-O-LEVEL
-#GCC-O-LEVEL = -Os
-#GCC-O-LEVEL = -O -g
-GCC-O-LEVEL = -O
-endif
-
-GCC-DEFS += -DIMAGE_NAME=$(IMAGE_SEEPROM_NAME)
-GCC-DEFS += -DPK_TIMER_SUPPORT=$(PK_TIMER_SUPPORT)
-GCC-DEFS += -DPK_THREAD_SUPPORT=$(PK_THREAD_SUPPORT)
-GCC-DEFS += -DPK_TRACE_SUPPORT=$(PK_TRACE_SUPPORT)
-GCC-DEFS += -DPK_TRACE_HASH_PREFIX=$(PK_TRACE_HASH_PREFIX)
-GCC-DEFS += -DUSE_PK_APP_CFG_H=1
-GCC-DEFS += -D__PK__=1
-GCC-DEFS += -D__SBE__=1
-GCC-DEFS += -D__PPE__=1
-GCC-DEFS += -DFAPI2_NO_FFDC=1
-GCC-DEFS += -DPK_TRACE_SZ=512
-
-DEFS += $(GCC-DEFS)
-export LD_LIBRARY_PATH = /afs/awd.austin.ibm.com/proj/p3/cte/tools/gcc405lin/vol1/usr/lib
-
-############################################################################
-
-
-INCLUDES += $(IMG_INCLUDES)
-INCLUDES += -I$(IMAGE_SRCDIR)/../../../include
-INCLUDES += -I$(HWPLIB_SRCDIR)
-INCLUDES += -I$(PLAT_FAPI2_DIR)/include
-INCLUDES += -I$(PPE_FAPI2_DIR)/include
-INCLUDES += -I$(BASE_FAPI2_DIR)/include
-INCLUDES += -I$(PK_SRCDIR)/../include
-INCLUDES += -I$(PK_SRCDIR)/$(PPE_TYPE)
-INCLUDES += -I$(PK_SRCDIR)/../include
-INCLUDES += -I$(PK_SRCDIR)/kernel
-INCLUDES += -I$(PK_SRCDIR)/ppe
-INCLUDES += -I$(PK_SRCDIR)/ppe42
-INCLUDES += -I$(PK_SRCDIR)/../sbe/sbefw
-INCLUDES += -I$(PK_SRCDIR)/trace
-INCLUDES += -I$(PK_SRCDIR)/../tools/ppetracepp
-INCLUDES += -I$(IMPORT_COMMON_DIR)/include
-
-PIPE-CFLAGS = -pipe -Wa,-m405
-
-# -Wno-error=unused-label , needs to be in.
-
-GCC-CFLAGS += -Wall -Werror -Wno-unused-label
-GCC-CFLAGS += -msoft-float -mcpu=405 -mmulhw
-GCC-CFLAGS += -meabi -msdata=eabi
-GCC-CFLAGS += -gpubnames -gdwarf-3
-GCC-CFLAGS += -ffreestanding
-GCC-CFLAGS += -fno-common
-GCC-CFLAGS += -fno-exceptions
-GCC-CFLAGS += -fsigned-char
-GCC-CFLAGS += -fno-inline-functions-called-once
-GCC-CFLAGS += -ffixed-r11
-GCC-CFLAGS += -ffixed-r12
-GCC-CFLAGS += -ffixed-r14
-GCC-CFLAGS += -ffixed-r15
-GCC-CFLAGS += -ffixed-r16
-GCC-CFLAGS += -ffixed-r17
-GCC-CFLAGS += -ffixed-r18
-GCC-CFLAGS += -ffixed-r19
-GCC-CFLAGS += -ffixed-r20
-GCC-CFLAGS += -ffixed-r21
-GCC-CFLAGS += -ffixed-r22
-GCC-CFLAGS += -ffixed-r23
-GCC-CFLAGS += -ffixed-r24
-GCC-CFLAGS += -ffixed-r25
-GCC-CFLAGS += -ffixed-r26
-GCC-CFLAGS += -ffixed-r27
-GCC-CFLAGS += -ffixed-cr1
-GCC-CFLAGS += -ffixed-cr2
-GCC-CFLAGS += -ffixed-cr3
-GCC-CFLAGS += -ffixed-cr4
-GCC-CFLAGS += -ffixed-cr5
-GCC-CFLAGS += -ffixed-cr6
-GCC-CFLAGS += -ffixed-cr7
-
-CFLAGS =
-PPE-CFLAGS = $(CFLAGS) -c $(GCC-CFLAGS) $(PIPE-CFLAGS) $(GCC-O-LEVEL) $(INCLUDES)
-
-CPPFLAGS = -E -std=c++11
-#CPPFLAGS = -E
-
-ASFLAGS = -mppe42
-
-ifdef P2P_ENABLE
-#use this to disable optimizations (fused compare/branch etc.)
-PCP-FLAG =
-
-#use this to enable optimizations
-#PCP-FLAG =
-endif
-############################################################################
-
-#override the GNU Make implicit rule for going from a .C to a .o
-%.o: %.C
-
-$(OBJDIR)/%.s: %.C
- $(TCC) $(PPE-CFLAGS) $(DEFS) -S -std=c++11 -o $@ $<
-
-
-#override the GNU Make implicit rule for going from a .c to a .o
-%.o: %.c
-
-$(OBJDIR)/%.s: %.c
- $(CC) $(PPE-CFLAGS) $(DEFS) -S -o $@ $<
-
-#override the GNU Make implicit rule for going from a .S to a .o
-%.o: %.S
-
-$(OBJDIR)/%.s: %.S
- $(TCPP) $(PPE-CFLAGS) $(DEFS) $(CPPFLAGS) -o $@ $<
-.PRECIOUS: $(OBJDIR)/%.s
-
-ifndef P2P_ENABLE
-
-$(OBJDIR)/%.o: $(OBJDIR)/%.s
- $(AS) $(ASFLAGS) -o $@ $<
-
-else
-
-$(OBJDIR)/%.es: $(OBJDIR)/%.s
- $(PCP) $(PCP-FLAG) -f $<
-.PRECIOUS: $(OBJDIR)/%.es
-
-$(OBJDIR)/%.o: $(OBJDIR)/%.es
- $(AS) $(ASFLAGS) -o $@ $<
-
-endif
-
-# From the GNU 'Make' manual - these scripts uses the preprocessor to
-# create dependency files (*.d), then mungs them slightly to make them
-# work as Make targets. The *.d files are include-ed in the
-# subdirectory Makefiles.
-
-$(OBJDIR)/%.d: %.C $(FAPI_RC)
- @set -e; rm -f $@; \
- echo -n "$(OBJDIR)/" > $@.$$$$; \
- $(CC_ASM) -MM $(INCLUDES) $(CPPFLAGS) $(DEFS) $< >> $@.$$$$; \
- sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
- rm -f $@.$$$$
-
-$(OBJDIR)/%.d: %.c $(FAPI_RC)
- @set -e; rm -f $@; \
- echo -n "$(OBJDIR)/" > $@.$$$$; \
- echo "$(INCLUDES)"; \
- $(CC_ASM) -MM $(INCLUDES) $(CPPFLAGS) $(DEFS) $< >> $@.$$$$; \
- sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
- rm -f $@.$$$$
-
-$(OBJDIR)/%.d: %.S $(FAPI_RC)
- @set -e; rm -f $@; \
- echo -n "$(OBJDIR)/" > $@.$$$$; \
- $(CC_ASM) -MM $(INCLUDES) $(CPPFLAGS) $(DEFS) $< >> $@.$$$$; \
- sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
- rm -f $@.$$$$
-
diff --git a/src/ppe/sbe/image/link.cmd b/src/ppe/sbe/image/link.cmd
deleted file mode 100644
index 8c75f1c..0000000
--- a/src/ppe/sbe/image/link.cmd
+++ /dev/null
@@ -1,115 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/image/link.cmd $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 */
-// Need to do this so that elf32-powerpc is not modified!
-#undef powerpc
-
-#ifndef INITIAL_STACK_SIZE
-#define INITIAL_STACK_SIZE 256
-#endif
-
-OUTPUT_FORMAT(elf32-powerpc);
-
-SECTIONS
-{
- . = 0xfff00000;
- _sbe_base_origin = . - 0;
- ////////////////////////////////
- // Header
- ////////////////////////////////
- . = ALIGN(1); _header_origin = .; _header_offset = . - _sbe_base_origin; .header . : { *(.header) } _header_size = . - _header_origin;
-
- ////////////////////////////////
- // FIXED
- ////////////////////////////////
- . = ALIGN(512); _fixed_origin = .; _fixed_offset = . - _sbe_base_origin; .fixed . : { *(.fixed) } _fixed_size = . - _fixed_origin;
-
- ////////////////////////////////
- // FIXED_TOC
- ////////////////////////////////
- . = ALIGN(8); _fixed_toc_origin = .; _fixed_toc_offset = . - _sbe_base_origin; .fixed_toc . : { *(.fixed_toc) } _fixed_toc_size = . - _fixed_toc_origin;
-
- ////////////////////////////////
- // IPL_TEXT
- ////////////////////////////////
- . = ALIGN(4); _ipl_text_origin = .; _ipl_text_offset = . - _sbe_base_origin; .ipl_text . : { *(.ipl_text) } _ipl_text_size = . - _ipl_text_origin;
-
- ////////////////////////////////
- // IPL_DATA
- ////////////////////////////////
- . = ALIGN(8); _ipl_data_origin = .; _ipl_data_offset = . - _sbe_base_origin; .ipl_data . : { *(.ipl_data) } _ipl_data_size = . - _ipl_data_origin;
-
- ////////////////////////////////
- // TEXT
- ////////////////////////////////
- . = ALIGN(4); _text_origin = .; _text_offset = . - _sbe_base_origin; .text . : {. = ALIGN(512); *(.vectors) *(.text) *(.eh_frame) } _text_size = . - _text_origin;
-
- ////////////////////////////////
- // DATA
- ////////////////////////////////
- . = ALIGN(8); _data_origin = .; _data_offset = . - _sbe_base_origin; .data . : { *(.data) *(.comment) *(.rodata*)} _data_size = . - _data_origin;
-
- ////////////////////////////////
- // TOC
- ////////////////////////////////
- . = ALIGN(4); _toc_origin = .; _toc_offset = . - _sbe_base_origin; .toc . : { *(.toc) } _toc_size = . - _toc_origin;
-
- ////////////////////////////////
- // STRING
- ////////////////////////////////
- . = ALIGN(1); _strings_origin = .; _strings_offset = . - _sbe_base_origin; .strings . : { *(.strings) } _strings_size = . - _strings_origin;
-
-// . = ALIGN(8);
-// _sbe_base_size = . - _sbe_base_origin;
-// _sbe_base_end = . - 0;
-
-
- _RODATA_SECTION_BASE = .;
-
-
- _SDA2_BASE_ = .;
-
- _RODATA_SECTION_SIZE = . - _RODATA_SECTION_BASE;
-
- // SDA sections .sdata and .sbss must be adjacent to each
- // other. Our SDATA sections are small so we'll use strictly positive
- // offsets.
-
- _SDA_BASE_ = .;
-
- .sbss . : { *(.sbss) }
- .sdata . : { *(.sdata) }
-
-
- _PK_INITIAL_STACK_LIMIT = .;
- . = . + INITIAL_STACK_SIZE;
- _PK_INITIAL_STACK = . - 1;
-
-
- . = ALIGN(8);
- _sbe_base_size = . - _sbe_base_origin;
- _sbe_base_end = . - 0;
-
-
-}
diff --git a/src/ppe/sbe/image/linkloader.cmd b/src/ppe/sbe/image/linkloader.cmd
deleted file mode 100644
index 33c7092..0000000
--- a/src/ppe/sbe/image/linkloader.cmd
+++ /dev/null
@@ -1,96 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/image/linkloader.cmd $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 */
-
-// Need to do this so that elf32-powerpc is not modified!
-#undef powerpc
-
-#ifndef INITIAL_STACK_SIZE
-#define INITIAL_STACK_SIZE 256
-#endif
-
-OUTPUT_FORMAT(elf32-powerpc);
-
-MEMORY
-{
- sram : ORIGIN = 0xffff2000, LENGTH = 0x10000
-}
-
-SECTIONS
-{
- . = 0xffff2000;
-
- ////////////////////////////////
- // Read-only Data
- ////////////////////////////////
-
- . = ALIGN(8);
- _RODATA_SECTION_BASE = .;
-
- .text . : { *(.text) } > sram
- .data . : { *(.data) } > sram
-
- // SDA2 constant sections .sdata2 and .sbss2 must be adjacent to each
- // other. Our SDATA sections are small so we'll use strictly positive
- // offsets.
-
- _SDA2_BASE_ = .;
- .sdata2 . : { *(.sdata2) } > sram
- .sbss2 . : { *(.sbss2) } > sram
-
- // Other read-only data.
-
- .rodata . : { *(.rodata*) *(.got2) } > sram
-
- _RODATA_SECTION_SIZE = . - _RODATA_SECTION_BASE;
-
- ////////////////////////////////
- // Read-write Data
- ////////////////////////////////
-
- . = ALIGN(8);
- _DATA_SECTION_BASE = .;
-
- // SDA sections .sdata and .sbss must be adjacent to each
- // other. Our SDATA sections are small so we'll use strictly positive
- // offsets.
-
- _SDA_BASE_ = .;
- .sdata . : { *(.sdata) } > sram
- .sbss . : { *(.sbss) } > sram
-
- // Other read-write data
- // It's not clear why boot.S is generating empty .glink,.iplt
-
- .rela . : { *(.rela*) } > sram
- .rwdata . : { *(.data) *(.bss) } > sram
-
- _PK_INITIAL_STACK_LIMIT = .;
- . = . + INITIAL_STACK_SIZE;
- _PK_INITIAL_STACK = . - 1;
-
- . = ALIGN(8);
- _loader_end = . - 0;
-
-}
diff --git a/src/ppe/sbe/image/linksbe.cmd b/src/ppe/sbe/image/linksbe.cmd
deleted file mode 100644
index 735a64b..0000000
--- a/src/ppe/sbe/image/linksbe.cmd
+++ /dev/null
@@ -1,97 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/image/linksbe.cmd $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 */
-
-// Need to do this so that elf32-powerpc is not modified!
-#undef powerpc
-
-#ifndef INITIAL_STACK_SIZE
-#define INITIAL_STACK_SIZE 256
-#endif
-
-OUTPUT_FORMAT(elf32-powerpc);
-
-MEMORY
-{
- sram : ORIGIN = 0xffff0000, LENGTH = 0x10000
-}
-
-SECTIONS
-{
- . = 0xffff0000;
-
- .vectors : {. = ALIGN(512); *(.vectors)} > sram
- .fixed . : {. = ALIGN(512); *(.fixed) } > sram
- .text . : {. = ALIGN(512); *(.text)} > sram
-
- ////////////////////////////////
- // Read-only Data
- ////////////////////////////////
-
- . = ALIGN(8);
- _RODATA_SECTION_BASE = .;
-
- // SDA2 constant sections .sdata2 and .sbss2 must be adjacent to each
- // other. Our SDATA sections are small so we'll use strictly positive
- // offsets.
-
- _SDA2_BASE_ = .;
- .sdata2 . : { *(.sdata2) } > sram
- .sbss2 . : { *(.sbss2) } > sram
-
- // Other read-only data.
-
- .rodata . : { *(.rodata*) *(.got2) } > sram
-
- _RODATA_SECTION_SIZE = . - _RODATA_SECTION_BASE;
-
- ////////////////////////////////
- // Read-write Data
- ////////////////////////////////
-
- . = ALIGN(8);
- _DATA_SECTION_BASE = .;
-
- // SDA sections .sdata and .sbss must be adjacent to each
- // other. Our SDATA sections are small so we'll use strictly positive
- // offsets.
-
- _SDA_BASE_ = .;
- .sdata . : { *(.sdata) } > sram
- .sbss . : { *(.sbss) } > sram
-
- // Other read-write data
- // It's not clear why boot.S is generating empty .glink,.iplt
-
- .rela . : { *(.rela*) } > sram
- .rwdata . : { *(.data) *(.bss) } > sram
-
- _PK_INITIAL_STACK_LIMIT = .;
- . = . + INITIAL_STACK_SIZE;
- _PK_INITIAL_STACK = . - 1;
-
- . = ALIGN(8);
- _sbe_end = . - 0;
-
-}
diff --git a/src/ppe/sbe/image/linkseeprom.cmd b/src/ppe/sbe/image/linkseeprom.cmd
deleted file mode 100644
index 6897c3d..0000000
--- a/src/ppe/sbe/image/linkseeprom.cmd
+++ /dev/null
@@ -1,115 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/image/linkseeprom.cmd $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 */
-// Need to do this so that elf32-powerpc is not modified!
-#undef powerpc
-
-#ifndef INITIAL_STACK_SIZE
-#define INITIAL_STACK_SIZE 256
-#endif
-
-OUTPUT_FORMAT(elf32-powerpc);
-
-SECTIONS
-{
- . = 0xfff00000;
- _seeprom_origin = . - 0;
- ////////////////////////////////
- // Header
- ////////////////////////////////
- . = ALIGN(1); _header_origin = .; _header_offset = . - _seeprom_origin; .header . : { *(.header) } _header_size = . - _header_origin;
-
- ////////////////////////////////
- // FIXED
- ////////////////////////////////
- . = ALIGN(512); _fixed_origin = .; _fixed_offset = . - _seeprom_origin; .fixed . : { *(.fixed) } _fixed_size = . - _fixed_origin;
-
- ////////////////////////////////
- // FIXED_TOC
- ////////////////////////////////
- . = ALIGN(8); _fixed_toc_origin = .; _fixed_toc_offset = . - _seeprom_origin; .fixed_toc . : { *(.fixed_toc) } _fixed_toc_size = . - _fixed_toc_origin;
-
- ////////////////////////////////
- // LOADER_TEXT
- ////////////////////////////////
- . = ALIGN(4); _loader_text_origin = .; _loader_text_offset = . - _seeprom_origin; .loader_text . : { *(.loader_text) } _loader_text_size = . - _loader_text_origin;
-
- ////////////////////////////////
- // LOADER_DATA
- ////////////////////////////////
- . = ALIGN(8); _loader_data_origin = .; _loader_data_offset = . - _seeprom_origin; .loader_data . : { *(.loader_data) } _loader_data_size = . - _loader_data_origin;
-
- ////////////////////////////////
- // TEXT
- ////////////////////////////////
- . = ALIGN(4); _text_origin = .; _text_offset = . - _seeprom_origin; .text . : {. = ALIGN(512); *(.vectors) *(.text) *(.eh_frame) } _text_size = . - _text_origin;
-
- ////////////////////////////////
- // DATA
- ////////////////////////////////
- . = ALIGN(8); _data_origin = .; _data_offset = . - _seeprom_origin; .data . : { *(.data) *(.comment) *(.rodata*)} _data_size = . - _data_origin;
-
- ////////////////////////////////
- // TOC
- ////////////////////////////////
- . = ALIGN(4); _toc_origin = .; _toc_offset = . - _seeprom_origin; .toc . : { *(.toc) } _toc_size = . - _toc_origin;
-
- ////////////////////////////////
- // STRING
- ////////////////////////////////
- . = ALIGN(1); _strings_origin = .; _strings_offset = . - _seeprom_origin; .strings . : { *(.strings) } _strings_size = . - _strings_origin;
-
-// . = ALIGN(8);
-// _seeprom_size = . - _seeprom_origin;
-// _seeprom_end = . - 0;
-
-
- _RODATA_SECTION_BASE = .;
-
-
- _SDA2_BASE_ = .;
-
- _RODATA_SECTION_SIZE = . - _RODATA_SECTION_BASE;
-
- // SDA sections .sdata and .sbss must be adjacent to each
- // other. Our SDATA sections are small so we'll use strictly positive
- // offsets.
-
- _SDA_BASE_ = .;
-
- .sbss . : { *(.sbss) }
- .sdata . : { *(.sdata) }
-
-
- _PK_INITIAL_STACK_LIMIT = .;
- . = . + INITIAL_STACK_SIZE;
- _PK_INITIAL_STACK = . - 1;
-
-
- . = ALIGN(8);
- _seeprom_size = . - _seeprom_origin;
- _seeprom_end = . - 0;
-
-
-}
diff --git a/src/ppe/sbe/image/p9_sbe.H b/src/ppe/sbe/image/p9_sbe.H
deleted file mode 100644
index b5118c1..0000000
--- a/src/ppe/sbe/image/p9_sbe.H
+++ /dev/null
@@ -1,53 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/image/p9_sbe.H $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 */
-#ifndef __P9_SBE_H
-#define __P9_SBE_H
-
-/// \file p9_sbe.H
-/// \brief A header to be included into all SBE assembler files and C++
-/// hardware procedures that interact with SBE images.
-///
-/// This header #include-s all generally useful headers required for SBE code
-/// development as well as defining other needed facilities. Note that any
-/// sub-includes must be done in an assembler-safe way.
-
-#include "sbe_common.H"
-//#include "p9_scom_addresses.H"
-//#include "p9_istep_num.H"
-
-// The #include of fapiHwpReturnCodes.H must be made here (instead of in
-// sbe_common.H) to guarantee that the P9-local copy is used.
-//#include "fapiHwpReturnCodes.H"
-
-#ifdef __ASSEMBLER__
-
- // p9_sbe.H 'recursively' inserts itself into any hook code extracted
- // from an assembly context that includes p9_sbe.H.
-
- ##`#include "p9_sbe.H"
-
-#endif // __ASSEMBLER__
-
-#endif // __P9_SBE_H
diff --git a/src/ppe/sbe/image/proc_sbe_fixed.H b/src/ppe/sbe/image/proc_sbe_fixed.H
deleted file mode 100644
index 304b868..0000000
--- a/src/ppe/sbe/image/proc_sbe_fixed.H
+++ /dev/null
@@ -1,189 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/image/proc_sbe_fixed.H $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 */
-//-----------------------------------------------------------------------------
-// *! (C) Copyright International Business Machines Corp. 2014
-// *! All Rights Reserved -- Property of IBM
-// *! *** IBM Confidential ***
-//-----------------------------------------------------------------------------
-
-/// \file proc_sbe_fixed.H
-/// \brief Define the layout of fixed-position data in the P9 SBE reference
-/// and IPL images
-///
-/// Contains struct ProcSbeFixed which contains functions, rings and
-/// attributes whose pointers are stored in the fixed and fixed_toc section
-///
-/// This file defines the layout of the special .fixed data section of P9 SBE
-/// reference and IPL images. The .fixed section is guaranteed to appear at a
-/// fixed offset from the beginning of the image, containing data required to
-/// be manipulated when images are resident in non-volatile memories, thereby
-/// avoiding having to search the TOC. Data manipulated during in-memory image
-/// processing can always be easily located using the SBE-XIP TOC APIs. All
-/// of the data stored in .fixed can also still be referenced via the SBE-XIP
-/// TOC.
-///
-/// This header file can be #include-ed into either C or SBE assembly language
-/// source code. In C, it creates simple structures 'ProcChipAttributes',
-/// 'PervAttributes', 'CoreAttributes', 'EQAttributes' and 'EXAttributes' that
-/// contain attribute information that are sized per XML definition per entry.
-///
-/// PPE image data is always stored big-endian, so applications on little-endian
-/// hosts will need to perform the appropriate endian converison when reading or
-/// writing images via this header.
-///
-/// In assembler code, this header creates macros '.proc_sbe_fixed_proc_chip',
-/// '.proc_sbe_fixed_perv', '.proc_sbe_fixed_core', '.proc_sbe_fixed_ex',
-/// '.proc_sbe_fixed_eq', that is expanded exactly once in the file
-/// 'sbe_base_header.S', creating the actual data allocation of the data
-/// equivalent to the C structure. Assembler code references the data symbols
-/// as normal.
-///
-/// To simplify programming a 'mini-TOC' is also provided for this data in
-/// the .fixed_toc section. This section is comprised of SbeXipHashedToc
-/// structures. When a symbol is indedxed in .fixed, a blank SbeXipHashedToc
-/// stucture is added to .fixed_toc. During image normalization the array of
-/// SbeXipHashedToc is filled in as each symbol in .fixed is re-indexed into
-/// .fixed_toc.
-
-#ifndef __PROC_SBE_FIXED_H__
-#define __PROC_SBE_FIXED_H__
-
-#include "p9_sbe.H"
-#include "plat_target_parms.H"
-#include "fapi2AttributeIds.H"
-
-
-#ifdef __ASSEMBLER__
- .macro .proc_sbe_fixed_proc_chip
- .section .fixed, "a", @progbits
- .balign 8
- .global G_proc_chip_attributes
-G_proc_chip_attributes:
-#else
-extern "C" {
-namespace fapi2attr {
-typedef struct ProcChipAttributes_t {
-#endif
-
-#include "proc_sbe_fixed_proc_chip.H"
-
-#ifdef __ASSEMBLER__
- .endm
-#else
-} ProcChipAttributes;
-} // fapi2
-} // C
-#endif
-
-///
-/// Pervasive Target Attributes
-#ifdef __ASSEMBLER__
- .macro .proc_sbe_fixed_perv
- .section .fixed, "a", @progbits
- .balign 8
- .global G_perv_attributes
-G_perv_attributes:
-#else
-namespace fapi2attr {
-typedef struct PervAttributes_t {
-#endif
-
-#include "proc_sbe_fixed_perv.H"
-
-#ifdef __ASSEMBLER__
- .endm
-#else
-} PervAttributes;
-} // fapi2
-#endif
-
-///
-/// Core (EC) Target Attributes
-#ifdef __ASSEMBLER__
- .macro .proc_sbe_fixed_core
- .section .fixed, "a", @progbits
- .balign 8
- .global G_core_attributes
-G_core_attributes:
-#else
-namespace fapi2attr {
-typedef struct CoreAttributes_t {
-#endif
-
-#include "proc_sbe_fixed_core.H"
-
-#ifdef __ASSEMBLER__
- .endm
-#else
-} CoreAttributes;
-} // fapi2
-#endif
-
-///
-/// EX Target Attributes
-#ifdef __ASSEMBLER__
- .macro .proc_sbe_fixed_ex
- .section .fixed, "a", @progbits
- .balign 8
- .global G_ex_attributes
-G_ex_attributes:
-#else
-namespace fapi2attr {
-typedef struct EXAttributes_t {
-#endif
-
-#include "proc_sbe_fixed_ex.H"
-
-#ifdef __ASSEMBLER__
- .endm
-#else
-} EXAttributes;
-} // fapi2
-#endif
-
-///
-/// EQ Target Attributes
-#ifdef __ASSEMBLER__
- .macro .proc_sbe_fixed_eq
- .section .fixed, "a", @progbits
- .balign 8
- .global G_eq_attributes
-G_eq_attributes:
-#else
-namespace fapi2attr {
-typedef struct EQAttributes_t {
-#endif
-
-#include "proc_sbe_fixed_eq.H"
-
-#ifdef __ASSEMBLER__
- .endm
-#else
-} EQAttributes;
-} // fapi2
-#endif
-
-
-#endif // __PROC_SBE_FIXED_H__
diff --git a/src/ppe/sbe/image/sbe_common.H b/src/ppe/sbe/image/sbe_common.H
deleted file mode 100644
index a4489df..0000000
--- a/src/ppe/sbe/image/sbe_common.H
+++ /dev/null
@@ -1,601 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/image/sbe_common.H $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 */
-#ifndef __SBE_COMMON_H
-#define __SBE_COMMON_H
-
-// $Id: Exp $
-
-/// \file sbe_common.H
-
-/// \brief This header contains #include-s and macro definitions common to P8
-/// and Centaur SBE code development. It is #include-ed into p8_sbe.H and
-/// cen_sbe.H which have other setup specific to each environment.
-
-
-#include "sbe_link.H"
-#include "sbe_xip_image.h"
-//#include "sbe_xip_header.H"
-
-/// Macros for generating the .fixed section
-///
-/// The CPP macros PROC_SBE_FIXED_UINT64[_VECTOR] generate equivalent code
-/// depending on whether they are being called from assembler (where they
-/// actually create the .fixed section data) or from C (where they specifiy a
-/// C-structure form of the contents of the .fixed section.
-///
-/// In assembler each invocation also creates space in the .fixed_toc section
-/// for a fixed TOC entry. Unlike the normal TOC no data is generated for
-/// .fixed_toc by the data declaration. Instead, the fixed TOC table is
-/// filled in during image normalization by normalizeToc (sbe_xip_image.c)
-/// which requires that there be one and only one fixed TOC entery allocated
-/// per TOC entry referencing the .fixed section. This means that in the
-/// current implementation it is not possible to create .fixed_toc entries
-/// for addresses or for data stored in sections other than .fixed.
-
-#ifdef __ASSEMBLER__
-
- .macro proc_sbe_fixed_uint8, symbol:req, tnumber=1, elements=1
- .global \symbol
-\symbol\():
- .rept ((\tnumber)*(\elements))
- .byte 0
- .endr
-
- .xip_toc \symbol, SBE_XIP_UINT8, \symbol, (\elements)
-
- .pushsection .fixed_toc
- .space 8
- .popsection
-
- .endm
-
- .macro proc_sbe_fixed_int8, symbol:req, tnumber=1, elements=1
- .global \symbol
-\symbol\():
- .rept ((\tnumber)*(\elements))
- .byte 0
- .endr
-
- .xip_toc \symbol, SBE_XIP_INT8, \symbol, (\elements)
-
- .pushsection .fixed_toc
- .space 8
- .popsection
-
- .endm
-
- .macro proc_sbe_fixed_uint16, symbol:req, tnumber=1, elements=1
- .balign 2
- .global \symbol
-\symbol\():
-
- .rept ((\tnumber)*(\elements))
- .long 0
- .endr
-
- .xip_toc \symbol, SBE_XIP_UINT16, \symbol, (\elements)
-
- .pushsection .fixed_toc
- .space 8
- .popsection
-
- .endm
-
- .macro proc_sbe_fixed_int16, symbol:req, tnumber=1, elements=1
- .balign 2
- .global \symbol
-\symbol\():
-
- .rept ((\tnumber)*(\elements))
- .long 0
- .endr
-
- .xip_toc \symbol, SBE_XIP_INT16, \symbol, (\elements)
-
- .pushsection .fixed_toc
- .space 8
- .popsection
-
- .endm
-
- .macro proc_sbe_fixed_uint32, symbol:req, tnumber=1, elements=1
- .balign 4
- .global \symbol
-\symbol\():
-
- .rept ((\tnumber)*(\elements))
- .long 0
- .endr
-
- .xip_toc \symbol, SBE_XIP_UINT32, \symbol, (\elements)
-
- .pushsection .fixed_toc
- .space 8
- .popsection
-
- .endm
-
- .macro proc_sbe_fixed_int32, symbol:req, tnumber=1, elements=1
- .balign 4
- .global \symbol
-\symbol\():
-
- .rept ((\tnumber)*(\elements))
- .long 0
- .endr
-
- .xip_toc \symbol, SBE_XIP_INT32, \symbol, (\elements)
-
- .pushsection .fixed_toc
- .space 8
- .popsection
-
- .endm
-
- .macro proc_sbe_fixed_uint64, symbol:req, tnumber=1, elements=1
- .balign 8
- .global \symbol
-\symbol\():
- .rept ((\tnumber)*(\elements))
- .quad 0
- .endr
-
- .xip_toc \symbol, SBE_XIP_UINT64, \symbol, (\elements)
-
- .pushsection .fixed_toc
- .space 8
- .popsection
-
- .endm
-
- .macro proc_sbe_fixed_int64, symbol:req, tnumber=1, elements=1
- .balign 8
- .global \symbol
-\symbol\():
- .rept ((\tnumber)*(\elements))
- .quad 0
- .endr
-
- .xip_toc \symbol, SBE_XIP_INT64, \symbol, (\elements)
-
- .pushsection .fixed_toc
- .space 8
- .popsection
-
- .endm
-
- .macro proc_sbe_fixed_quadia, symbol:req, space:req, address:req
- .global \symbol
-\symbol\():
- .quadia (\space), (\address)
-
- .xip_toc \symbol, SBE_XIP_UINT64, \symbol
-
- .pushsection .fixed_toc
- .space 8
- .popsection
-
- .endm
-
-
-#define PROC_SBE_FIXED_UINT8(symbol) \
- proc_sbe_fixed_uint8 symbol
-
-#define PROC_SBE_FIXED_INT8(symbol) \
- proc_sbe_fixed_int8 symbol
-
-#define PROC_SBE_FIXED_UINT16(symbol) \
- proc_sbe_fixed_uint16 symbol
-
-#define PROC_SBE_FIXED_INT16(symbol) \
- proc_sbe_fixed_int16 symbol
-
-#define PROC_SBE_FIXED_UINT32(symbol) \
- proc_sbe_fixed_uint32 symbol
-
-#define PROC_SBE_FIXED_INT32(symbol) \
- proc_sbe_fixed_int32 symbol
-
-#define PROC_SBE_FIXED_UINT64(symbol) \
- proc_sbe_fixed_uint64 symbol
-
-#define PROC_SBE_FIXED_INT64(symbol) \
- proc_sbe_fixed_int64 symbol
-
-#define PROC_SBE_FIXED_UINT8_VECTOR(symbol, elements) \
- proc_sbe_fixed_uint8 symbol, elements
-
-#define PROC_SBE_FIXED_INT8_VECTOR(symbol, elements) \
- proc_sbe_fixed_int8 symbol, elements
-
-#define PROC_SBE_FIXED_UINT16_VECTOR(symbol, elements) \
- proc_sbe_fixed_uint16 symbol, elements
-
-#define PROC_SBE_FIXED_INT16_VECTOR(symbol, elements) \
- proc_sbe_fixed_int16 symbol, elements
-
-#define PROC_SBE_FIXED_UINT32_VECTOR(symbol, elements) \
- proc_sbe_fixed_uint32 symbol, elements
-
-#define PROC_SBE_FIXED_INT32_VECTOR(symbol, elements) \
- proc_sbe_fixed_int32 symbol, elements
-
-#define PROC_SBE_FIXED_UINT64_VECTOR(symbol, elements) \
- proc_sbe_fixed_uint64 symbol, elements
-
-#define PROC_SBE_FIXED_INT64_VECTOR(symbol, elements) \
- proc_sbe_fixed_int64 symbol, elements
-
-#define PROC_SBE_FIXED_UINT8_VECTOR_2(symbol, dim1, dim2 ) \
- proc_sbe_fixed_uint8 symbol, dim1 * dim2
-
-#define PROC_SBE_FIXED_INT8_VECTOR_2(symbol, dim1, dim2 ) \
- proc_sbe_fixed_int8 symbol, dim1 * dim2
-
-#define PROC_SBE_FIXED_UINT16_VECTOR_2(symbol, dim1, dim2 ) \
- proc_sbe_fixed_uint16 symbol, dim1 * dim2
-
-#define PROC_SBE_FIXED_INT16_VECTOR_2(symbol, dim1, dim2 ) \
- proc_sbe_fixed_int16 symbol, dim1 * dim2
-
-#define PROC_SBE_FIXED_UINT32_VECTOR_2(symbol, dim1, dim2 ) \
- proc_sbe_fixed_uint32 symbol, dim1 * dim2
-
-#define PROC_SBE_FIXED_INT32_VECTOR_2(symbol, dim1, dim2 ) \
- proc_sbe_fixed_int32 symbol, dim1 * dim2
-
-#define PROC_SBE_FIXED_UINT64_VECTOR_2(symbol, dim1, dim2 ) \
- proc_sbe_fixed_uint64 symbol, dim1 * dim2
-
-#define PROC_SBE_FIXED_INT64_VECTOR_2(symbol, dim1, dim2 ) \
- proc_sbe_fixed_int64 symbol, dim1 * dim2
-
-#define PROC_SBE_FIXED_UINT8_VECTOR_3(symbol, dim1, dim2, dim3 ) \
- proc_sbe_fixed_uint8 symbol, dim1 * dim2 * dim3
-
-#define PROC_SBE_FIXED_INT8_VECTOR_3(symbol, dim1, dim2, dim3 ) \
- proc_sbe_fixed_uint8 symbol, dim1 * dim2 * dim3
-
-#define PROC_SBE_FIXED_UINT16_VECTOR_3(symbol, dim1, dim2, dim3 ) \
- proc_sbe_fixed_uint16 symbol, dim1 * dim2 * dim3
-
-#define PROC_SBE_FIXED_INT16_VECTOR_3(symbol, dim1, dim2, dim3 ) \
- proc_sbe_fixed_uint16 symbol, dim1 * dim2 * dim3
-
-#define PROC_SBE_FIXED_UINT32_VECTOR_3(symbol, dim1, dim2, dim3 ) \
- proc_sbe_fixed_uint32 symbol, dim1 * dim2 * dim3
-
-#define PROC_SBE_FIXED_INT32_VECTOR_3(symbol, dim1, dim2, dim3 ) \
- proc_sbe_fixed_uint32 symbol, dim1 * dim2 * dim3
-
-#define PROC_SBE_FIXED_UINT64_VECTOR_3(symbol, dim1, dim2, dim3 ) \
- proc_sbe_fixed_uint64 symbol, dim1 * dim2 * dim3
-
-#define PROC_SBE_FIXED_INT64_VECTOR_3(symbol, dim1, dim2, dim3 ) \
- proc_sbe_fixed_uint64 symbol, dim1 * dim2 * dim3
-
-// Non-Chip Target Attributes
-
-#define PROC_SBE_FIXED_TARGET_UINT8(symbol, tnumber) \
- proc_sbe_fixed_uint8 symbol, tnumber
-
-#define PROC_SBE_FIXED_TARGET_INT8(symbol, tnumber) \
- proc_sbe_fixed_int8 symbol, tnumber
-
-#define PROC_SBE_FIXED_TARGET_UINT16(symbol, tnumber) \
- proc_sbe_fixed_uint16 symbol, tnumber
-
-#define PROC_SBE_FIXED_TARGET_INT16(symbol, tnumber) \
- proc_sbe_fixed_int16 symbol, tnumber
-
-#define PROC_SBE_FIXED_TARGET_UINT32(symbol, tnumber) \
- proc_sbe_fixed_uint32 symbol, tnumber
-
-#define PROC_SBE_FIXED_TARGET_INT32(symbol, tnumber) \
- proc_sbe_fixed_int32 symbol, tnumber
-
-#define PROC_SBE_FIXED_TARGET_UINT64(symbol, tnumber) \
- proc_sbe_fixed_uint64 symbol, tnumber
-
-#define PROC_SBE_FIXED_TARGET_INT64(symbol, tnumber) \
- proc_sbe_fixed_int64 symbol, tnumber
-
-#define PROC_SBE_FIXED_TARGET_UINT8_VECTOR(symbol, tnumber, elements) \
- proc_sbe_fixed_uint8 symbol, tnumber * elements
-
-#define PROC_SBE_FIXED_TARGET_INT8_VECTOR(symbol, tnumber, elements) \
- proc_sbe_fixed_int8 symbol, tnumber * elements
-
-#define PROC_SBE_FIXED_TARGET_UINT16_VECTOR(symbol, tnumber, elements) \
- proc_sbe_fixed_uint16 symbol, tnumber * elements
-
-#define PROC_SBE_FIXED_TARGET_INT16_VECTOR(symbol, tnumber, elements) \
- proc_sbe_fixed_int16 symbol, tnumber * elements
-
-#define PROC_SBE_FIXED_TARGET_UINT32_VECTOR(symbol, tnumber, elements) \
- proc_sbe_fixed_uint32 symbol, tnumber * elements
-
-#define PROC_SBE_FIXED_TARGET_INT32_VECTOR(symbol, tnumber, elements) \
- proc_sbe_fixed_int32 symbol, tnumber * elements
-
-#define PROC_SBE_FIXED_TARGET_UINT64_VECTOR(symbol, tnumber, elements) \
- proc_sbe_fixed_uint64 symbol, tnumber * elements
-
-#define PROC_SBE_FIXED_TARGET_INT64_VECTOR(symbol, tnumber, elements) \
- proc_sbe_fixed_int64 symbol, tnumber * elements
-
-#define PROC_SBE_FIXED_TARGET_UINT8_VECTOR_2(symbol, tnumber, dim1, dim2 ) \
- proc_sbe_fixed_uint8 symbol, tnumber * dim1 * dim2
-
-#define PROC_SBE_FIXED_TARGET_INT8_VECTOR_2(symbol, tnumber, dim1, dim2 ) \
- proc_sbe_fixed_int8 symbol, tnumber * dim1 * dim2
-
-#define PROC_SBE_FIXED_TARGET_UINT16_VECTOR_2(symbol, tnumber, dim1, dim2 ) \
- proc_sbe_fixed_uint16 symbol, tnumber * dim1 * dim2
-
-#define PROC_SBE_FIXED_TARGET_INT16_VECTOR_2(symbol, tnumber, dim1, dim2 ) \
- proc_sbe_fixed_int16 symbol, tnumber * dim1 * dim2
-
-#define PROC_SBE_FIXED_TARGET_UINT32_VECTOR_2(symbol, tnumber, dim1, dim2 ) \
- proc_sbe_fixed_uint32 symbol, tnumber * dim1 * dim2
-
-#define PROC_SBE_FIXED_TARGET_INT32_VECTOR_2(symbol, tnumber, dim1, dim2 ) \
- proc_sbe_fixed_int32 symbol, tnumber * dim1 * dim2
-
-#define PROC_SBE_FIXED_TARGET_UINT64_VECTOR_2(symbol, tnumber, dim1, dim2 ) \
- proc_sbe_fixed_uint64 symbol, tnumber * dim1 * dim2
-
-#define PROC_SBE_FIXED_TARGET_INT64_VECTOR_2(symbol, tnumber, dim1, dim2 ) \
- proc_sbe_fixed_int64 symbol, tnumber * dim1 * dim2
-
-#define PROC_SBE_FIXED_TARGET_UINT8_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \
- proc_sbe_fixed_uint8 symbol, tnumber * dim1 * dim2 * dim3
-
-#define PROC_SBE_FIXED_TARGET_INT8_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \
- proc_sbe_fixed_uint8 symbol, tnumber * dim1 * dim2 * dim3
-
-#define PROC_SBE_FIXED_TARGET_UINT16_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \
- proc_sbe_fixed_uint16 symbol, tnumber * dim1 * dim2 * dim3
-
-#define PROC_SBE_FIXED_TARGET_INT16_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \
- proc_sbe_fixed_uint16 symbol, tnumber * dim1 * dim2 * dim3
-
-#define PROC_SBE_FIXED_TARGET_UINT32_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \
- proc_sbe_fixed_uint32 symbol, tnumber * dim1 * dim2 * dim3
-
-#define PROC_SBE_FIXED_TARGET_INT32_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \
- proc_sbe_fixed_uint32 symbol, tnumber * dim1 * dim2 * dim3
-
-#define PROC_SBE_FIXED_TARGET_UINT64_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \
- proc_sbe_fixed_uint64 symbol, tnumber * dim1 * dim2 * dim3
-
-#define PROC_SBE_FIXED_TARGET_INT64_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \
- proc_sbe_fixed_uint64 symbol, tnumber * dim1 * dim2 * dim3
-
-#define PROC_SBE_FIXED_QUADIA(symbol, space, address) \
- proc_sbe_fixed_quadia symbol, (space), (address)
-
-
-#else // __ASSEMBLER__ (eg the C portion)
-
-#define PROC_SBE_FIXED_UINT8(symbol) \
- uint8_t symbol
-
-#define PROC_SBE_FIXED_INT8(symbol) \
- int8_t symbol
-
-#define PROC_SBE_FIXED_UINT16(symbol) \
- uint16_t symbol
-
-#define PROC_SBE_FIXED_INT16(symbol) \
- int16_t symbol
-
-#define PROC_SBE_FIXED_UINT32(symbol) \
- uint32_t symbol
-
-#define PROC_SBE_FIXED_INT32(symbol) \
- int32_t symbol
-
-#define PROC_SBE_FIXED_UINT64(symbol) \
- uint64_t symbol
-
-#define PROC_SBE_FIXED_INT64(symbol) \
- int64_t symbol
-
-#define PROC_SBE_FIXED_UINT8_VECTOR(symbol, elements) \
- uint8_t symbol[elements]
-
-#define PROC_SBE_FIXED_INT8_VECTOR(symbol, elements) \
- int8_t symbol[elements]
-
-#define PROC_SBE_FIXED_UINT16_VECTOR(symbol, elements) \
- uint16_t symbol[elements]
-
-#define PROC_SBE_FIXED_INT16_VECTOR(symbol, elements) \
- int16_t symbol[elements]
-
-#define PROC_SBE_FIXED_UINT32_VECTOR(symbol, elements) \
- uint32_t symbol[elements]
-
-#define PROC_SBE_FIXED_INT32_VECTOR(symbol, elements) \
- int32_t symbol[elements]
-
-#define PROC_SBE_FIXED_UINT64_VECTOR(symbol, elements) \
- uint64_t symbol[elements]
-
-#define PROC_SBE_FIXED_INT64_VECTOR(symbol, elements) \
- int64_t symbol[elements]
-
-#define PROC_SBE_FIXED_UINT8_VECTOR_2(symbol, dim1, dim2 ) \
- uint8_t symbol[dim1][dim2]
-
-#define PROC_SBE_FIXED_INT8_VECTOR_2(symbol, dim1, dim2 ) \
- int8_t symbol[dim1][dim2]
-
-#define PROC_SBE_FIXED_UINT16_VECTOR_2(symbol, dim1, dim2 ) \
- uint16_t symbol[dim1][dim2]
-
-#define PROC_SBE_FIXED_INT16_VECTOR_2(symbol, dim1, dim2 ) \
- int16_t symbol[dim1][dim2]
-
-#define PROC_SBE_FIXED_UINT32_VECTOR_2(symbol, dim1, dim2 ) \
- uint32_t symbol[dim1][dim2]
-
-#define PROC_SBE_FIXED_INT32_VECTOR_2(symbol, dim1, dim2 ) \
- int32_t symbol[dim1][dim2]
-
-#define PROC_SBE_FIXED_UINT64_VECTOR_2(symbol, dim1, dim2 ) \
- uint64_t symbol[dim1][dim2]
-
-#define PROC_SBE_FIXED_INT64_VECTOR_2(symbol, dim1, dim2 ) \
- int64_t symbol[dim1][dim2]
-
-#define PROC_SBE_FIXED_UINT8_VECTOR_3(symbol, dim1, dim2, dim3 ) \
- uint8_t symbol[dim1][dim2][dim3]
-
-#define PROC_SBE_FIXED_INT8_VECTOR_3(symbol, dim1, dim2, dim3 ) \
- int8_t symbol[dim1][dim2][dim3]
-
-#define PROC_SBE_FIXED_UINT16_VECTOR_3(symbol, dim1, dim2, dim3 ) \
- uint16_t symbol[dim1][dim2][dim3]
-
-#define PROC_SBE_FIXED_INT16_VECTOR_3(symbol, dim1, dim2, dim3 ) \
- int16_t symbol[dim1][dim2][dim3]
-
-#define PROC_SBE_FIXED_UINT32_VECTOR_3(symbol, dim1, dim2, dim3 ) \
- uint32_t symbol[dim1][dim2][dim3]
-
-#define PROC_SBE_FIXED_INT32_VECTOR_3(symbol, dim1, dim2, dim3 ) \
- int32_t symbol[dim1][dim2][dim3]
-
-#define PROC_SBE_FIXED_UINT64_VECTOR_3(symbol, dim1, dim2, dim3 ) \
- uint64_t symbol[dim1][dim2][dim3]
-
-#define PROC_SBE_FIXED_INT64_VECTOR_3(symbol, dim1, dim2, dim3 ) \
- int64_t symbol[dim1][dim2][dim3]
-
-// Non-Chip Target Attributes
-
-#define PROC_SBE_FIXED_TARGET_UINT8(symbol, tnumber) \
- uint8_t symbol[tnumber]
-
-#define PROC_SBE_FIXED_TARGET_INT8(symbol, tnumber) \
- int8_t symbol[tnumber]
-
-#define PROC_SBE_FIXED_TARGET_UINT16(symbol, tnumber) \
- uint16_t symbol[tnumber]
-
-#define PROC_SBE_FIXED_TARGET_INT16(symbol, tnumber) \
- int16_t symbol[tnumber]
-
-#define PROC_SBE_FIXED_TARGET_UINT32(symbol, tnumber) \
- uint32_t symbol[tnumber]
-
-#define PROC_SBE_FIXED_TARGET_INT32(symbol, tnumber) \
- int32_t symbol[tnumber]
-
-#define PROC_SBE_FIXED_TARGET_UINT64(symbol, tnumber) \
- uint64_t symbol[tnumber]
-
-#define PROC_SBE_FIXED_TARGET_INT64(symbol, tnumber) \
- int64_t symbol[tnumber]
-
-#define PROC_SBE_FIXED_TARGET_UINT8_VECTOR(symbol, tnumber, elements) \
- uint8_t symbol[tnumber][elements]
-
-#define PROC_SBE_FIXED_TARGET_INT8_VECTOR(symbol, tnumber, elements) \
- int8_t symbol[tnumber][elements]
-
-#define PROC_SBE_FIXED_TARGET_UINT16_VECTOR(symbol, tnumber, elements) \
- uint16_t symbol[tnumber][elements]
-
-#define PROC_SBE_FIXED_TARGET_INT16_VECTOR(symbol, tnumber, elements) \
- int16_t symbol[tnumber][elements]
-
-#define PROC_SBE_FIXED_TARGET_UINT32_VECTOR(symbol, tnumber, elements) \
- uint32_t symbol[tnumber][elements]
-
-#define PROC_SBE_FIXED_TARGET_INT32_VECTOR(symbol, tnumber, elements) \
- int32_t symbol[tnumber][elements]
-
-#define PROC_SBE_FIXED_TARGET_UINT64_VECTOR(symbol, tnumber, elements) \
- uint64_t symbol[tnumber][elements]
-
-#define PROC_SBE_FIXED_TARGET_INT64_VECTOR(symbol, tnumber, elements) \
- int64_t symbol[tnumber][elements]
-
-#define PROC_SBE_FIXED_TARGET_UINT8_VECTOR_2(symbol, tnumber, dim1, dim2 ) \
- uint8_t symbol[tnumber][dim1][dim2]
-
-#define PROC_SBE_FIXED_TARGET_INT8_VECTOR_2(symbol, tnumber, dim1, dim2 ) \
- int8_t symbol[tnumber][dim1][dim2]
-
-#define PROC_SBE_FIXED_TARGET_UINT16_VECTOR_2(symbol, tnumber, dim1, dim2 ) \
- uint16_t symbol[tnumber][dim1][dim2]
-
-#define PROC_SBE_FIXED_TARGET_INT16_VECTOR_2(symbol, tnumber, dim1, dim2 ) \
- int16_t symbol[tnumber][dim1][dim2]
-
-#define PROC_SBE_FIXED_TARGET_UINT32_VECTOR_2(symbol, tnumber, dim1, dim2 ) \
- uint32_t symbol[tnumber][dim1][dim2]
-
-#define PROC_SBE_FIXED_TARGET_INT32_VECTOR_2(symbol, tnumber, dim1, dim2 ) \
- int32_t symbol[tnumber][dim1][dim2]
-
-#define PROC_SBE_FIXED_TARGET_UINT64_VECTOR_2(symbol, tnumber, dim1, dim2 ) \
- uint64_t symbol[tnumber][dim1][dim2]
-
-#define PROC_SBE_FIXED_TARGET_INT64_VECTOR_2(symbol, tnumber, dim1, dim2 ) \
- int64_t symbol[tnumber][dim1][dim2]
-
-#define PROC_SBE_FIXED_TARGET_UINT8_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \
- uint8_t symbol[tnumber][dim1][dim2][dim3]
-
-#define PROC_SBE_FIXED_TARGET_INT8_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \
- int8_t symbol[tnumber][dim1][dim2][dim3]
-
-#define PROC_SBE_FIXED_TARGET_UINT16_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \
- uint16_t symbol[tnumber][dim1][dim2][dim3]
-
-#define PROC_SBE_FIXED_TARGET_INT16_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \
- int16_t symbol[tnumber][dim1][dim2][dim3]
-
-#define PROC_SBE_FIXED_TARGET_UINT32_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \
- uint32_t symbol[tnumber][dim1][dim2][dim3]
-
-#define PROC_SBE_FIXED_TARGET_INT32_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \
- int32_t symbol[tnumber][dim1][dim2][dim3]
-
-#define PROC_SBE_FIXED_TARGET_UINT64_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \
- uint64_t symbol[tnumber][dim1][dim2][dim3]
-
-#define PROC_SBE_FIXED_TARGET_INT64_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \
- int64_t symbol[tnumber][dim1][dim2][dim3]
-
-#define PROC_SBE_FIXED_QUADIA(symbol, space, address) uint64_t symbol
-
-#endif // __ASSEMBLER__
-
-#endif // __SBE_COMMON_H
diff --git a/src/ppe/sbe/image/sbe_link.H b/src/ppe/sbe/image/sbe_link.H
deleted file mode 100644
index 5635f39..0000000
--- a/src/ppe/sbe/image/sbe_link.H
+++ /dev/null
@@ -1,77 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/image/sbe_link.H $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 */
-#ifndef __SBE_LINK_H
-#define __SBE_LINK_H
-
-// $Id: Exp $
-
-/// \file sbe_link.H
-/// \brief Constants required for linking SBE code images
-///
-/// This header contains those cpp manifest constants required for processing
-/// the linker scripts used to generate SBE code images. They may also be
-/// useful for PPE assembler programming so they are included in sbe.H as
-/// well.
-///
-/// The link address of OTPROM code as a byte-address
-///
-/// The OTPROM can be addressed both as an I2C slave and as a direct PIB
-/// slave. The I2C slave is at PIB local address 0x0 and the PIB memory
-/// interface is at local address 0x8000. SBE/IPL uses the PIB addressing
-/// mode, so the OTPROM image is linked at 0x40000 (the byte-address
-/// equivalent of 0x8000).
-#define OTPROM_ORIGIN 0x40000
-
-/// The amount of memory contained in each OTPROM macro
-#define OTPROM_BLOCK_SIZE 4096
-
-/// The amount of memory reserved for OTPROM code
-///
-/// This amount is exclusive of physical OTPROM memory reserved for compressed
-/// scan ring images.
-#define OTPROM_CODE_SIZE (1 * OTPROM_BLOCK_SIZE)
-
-/// The link address of the P9 SBE Base image
-#define SBE_BASE_ORIGIN 0xFFFF0000
-
-/// The physical address offset where SBE-SEEPROM code is loaded
-///
-/// This address *must* be a constant known to the OTPROM code.
-#define SBE_SEEPROM_LOAD_ADDRESS 0x2000
-
-/// The offset (in bytes) of the .fixed section in P9 SBE-XIP images
-#define SBE_XIP_FIXED_OFFSET 512
-
-/// The link address of the PIBMEM image
-#define PIBMEM_ORIGIN 0
-
-/// The amount of space available in the PIBMEM, in bytes (3KB)
-#define PIBMEM_SIZE (64 * 1024)
-
-/// The offset (in bytes) of the .fixed section in P9 SBE-XIP images
-#define SBE_XIP_FIXED_OFFSET 512
-
-#endif // __SBE_LINK_H
-
diff --git a/src/ppe/sbe/image/sbe_loader.c b/src/ppe/sbe/image/sbe_loader.c
deleted file mode 100644
index 43041ff..0000000
--- a/src/ppe/sbe/image/sbe_loader.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/image/sbe_loader.c $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 "sbe_xip_image.h"
-#include "sbetrace.H"
-
-int32_t sbe_loader() __attribute__ ((section (".loader_text")));
-
-
-int32_t sbe_loader() {
-
- int32_t rc = 0;
-
- SbeXipHeader *hdr = 0;//getXipHdr();
- uint32_t idx;
-
-
- for(idx = 0; idx < SBE_XIP_SECTIONS; idx++) {
-
- SBE_TRACE("Section Idx:%u Size:0x%08X", idx, hdr->iv_section[idx].iv_size);
-
- }
-
- return rc;
-}
diff --git a/src/ppe/sbe/image/sbe_main.C b/src/ppe/sbe/image/sbe_main.C
deleted file mode 100644
index 025e808..0000000
--- a/src/ppe/sbe/image/sbe_main.C
+++ /dev/null
@@ -1,388 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/image/sbe_main.C $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 */
-//-----------------------------------------------------------------------------
-// *! (C) Copyright International Business Machines Corp. 2014
-// *! All Rights Reserved -- Property of IBM
-// *! *** IBM Confidential ***
-//-----------------------------------------------------------------------------
-
-/// \file sample_main.c
-/// \brief Sample program that creates and starts a thread
-///
-/// This file demonstrates how to create a thread and run it. It also provides
-/// an example of how to add traces to the code.
-#include <fapi2.H>
-//#include <p9_sbe_perv.H>
-
-#include <vector>
-
-
-
-
-extern "C"
-{
-
-#include "pk.h"
-#include "pk_trace.h"
-//#include "pk_trace_wrap.h"
-//#include "common_scom_addresses.H"
-//#include "p9_sbe_perv.H"
-#include "p9_hcd_cache.H"
-#include "p9_hcd_core.H"
-#include "proc_sbe_fixed.H"
-#include "trac_interface.h"
-
-}
-
-namespace fapi2attr
-{
-
-extern ProcChipAttributes_t* G_proc_chip_attributes asm("G_proc_chip_attributes") __attribute__ ((section (".fixed")));
-extern PervAttributes_t* G_perv_attributes asm("G_perv_attributes") __attribute__ ((section (".fixed")));
-extern CoreAttributes_t* G_core_attributes asm("G_core_attributes") __attribute__ ((section (".fixed")));
-extern EQAttributes_t* G_eq_attributes asm("G_eq_attributes") __attribute__ ((section (".fixed")));
-extern EXAttributes_t* G_ex_attributes asm("G_ex_attributes") __attribute__ ((section (".fixed")));
-
-}
-
-extern "C" {
-
-
-#define KERNEL_STACK_SIZE 256
-#define MAIN_THREAD_STACK_SIZE 256
-
-// Necessary Kernel Structures
-uint8_t G_kernel_stack[KERNEL_STACK_SIZE];
-uint8_t G_main_thread_stack[MAIN_THREAD_STACK_SIZE];
-PkThread G_main_thread;
-
-
-fapi2::ReturnCode
-hwp_chip(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> & i_target);
-
-fapi2::ReturnCode
-hwp_chip2(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> & i_target);
-
-
-fapi2::ReturnCode
-hwp_core(const fapi2::Target<fapi2::TARGET_TYPE_CORE> & i_target);
-
-fapi2::ReturnCode
-hwp_eq(const fapi2::Target<fapi2::TARGET_TYPE_EQ> & i_target);
-
-fapi2::ReturnCode
-hwp_perv(const fapi2::Target<fapi2::TARGET_TYPE_PERV> & i_target);
-
-
-//---------------------------------------------------------------------------
-
-
-void main_thread(void* arg)
-{
-
- // This is workaround. Currently we do not have code to initialise
- // global objects. So initializing global objects against using local
- // initialized object
- FAPI_DBG("Workaround temporary allocation of Global Vector");
- std::vector<fapi2::plat_target_handle_t> targets1;
- G_vec_targets = std::move(targets1);
-
- // Intialize the targets
- fapi2::plat_TargetsInit();
-
- // Get a specific target
- fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>chip_target_new =
- fapi2::plat_getChipTarget();
-
- FAPI_DBG("chip_target_new = 0x%08X", (uint32_t)(chip_target_new.get()>>32));
-
- FAPI_TRY(hwp_chip(chip_target_new));
-
- FAPI_TRY(hwp_chip2(chip_target_new));
-
- ///
-#ifndef __noRC__
- // PIB Errors are masked for platforms like SBE where
- // explict error code checking is to occur
- fapi2::setPIBErrorMask(0b11111111);
-#else
- // PIB Errors are unmaskd for platforms that desire to take machine
- // check interrupts
- fapi2::setPIBErrorMask(0b00000000);
-#endif
-
-// FAPI_TRY(hwp_chip(chip_target_new));
-
-// FAPI_TRY(p9_sbe_attr_setup(chip_target));
-// FAPI_TRY(p9_sbe_check_master(chip_target));
-// FAPI_TRY(p9_sbe_setup_evid(chip_target));
-
-
-fapi_try_exit:
- return;
-
-}
-
-// A Chip try
-fapi2::ReturnCode
-hwp_chip(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> & i_target)
-{
-
- FAPI_DBG("i_target = 0x%08X", (uint32_t)(i_target.get()>>32));
-
- auto l_perv_functional_vector =
- i_target.getChildren<fapi2::TARGET_TYPE_PERV>
- (fapi2::TARGET_STATE_PRESENT);
-
- // Get the TPChiplet target
- uint32_t i = 0;
- for (auto it: l_perv_functional_vector)
- {
-
- FAPI_DBG("Perv Functional Target %u value=%08X chiplet %02X",
- i,
- (uint32_t)(it.get()>>32),
- (uint32_t)(it.getChipletNumber()));
-
- ++i;
- }
-
- auto l_core_functional_vector =
- i_target.getChildren<fapi2::TARGET_TYPE_CORE>
- (fapi2::TARGET_STATE_PRESENT);
-
- // Get the Core Chiplet targets
- uint32_t j = 0;
- for (auto it: l_core_functional_vector)
- {
-
- FAPI_DBG("Core Functional Target %u value=%08X chiplet %02X",
- j,
- (uint32_t)(it.get()>>32),
- (uint32_t)(it.getChipletNumber()));
-
- ++j;
- }
-
-
- fapi2::buffer<uint64_t> data = 0;
- const uint32_t address = 0x0006d010;
-
- FAPI_INF("hwp_chip %u", address);
-
- uint64_t databuffer;
- getscom_abs(address, &databuffer);
-
- databuffer = 0xDEAD000000000000ull;
-
- putscom_abs(address, databuffer);
-
- data = 0xBADC0DE800000000ull;
- FAPI_TRY(fapi2::putScom(i_target, address, data));
-
-
- FAPI_TRY(fapi2::getScom(i_target, address, data));
- FAPI_DBG("First getSCOM: data = %016llX", revle64(data));
-
- data.setBit<0, 16>();
- FAPI_TRY(fapi2::putScom(i_target, 0x0006d010, data));
-
- return fapi2::FAPI2_RC_SUCCESS;
-
-fapi_try_exit:
- return fapi2::FAPI2_RC_PLAT_ERR_SEE_DATA;
-}
-
-// A Chip try
-fapi2::ReturnCode
-hwp_chip2(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> & i_target)
-{
-
- FAPI_DBG("i_target = 0x%08X", (uint32_t)(i_target.get()>>32));
-
-
- auto l_eq_functional_vector =
- i_target.getChildren<fapi2::TARGET_TYPE_EQ>
- (fapi2::TARGET_STATE_PRESENT);
-
- // Get the EQ Chiplet target
- uint32_t k = 0;
- for (auto it: l_eq_functional_vector)
- {
-
- FAPI_DBG("EQ Functional Target %u value=%08X chiplet %02X",
- k,
- (uint32_t)(it.get()>>32),
- (uint32_t)(it.getChipletNumber()));
-
- ++k;
- }
-
-
- auto l_mcs_functional_vector =
- i_target.getChildren<fapi2::TARGET_TYPE_MCS>
- (fapi2::TARGET_STATE_PRESENT);
-
- // Get the MCS Chiplet target
- uint32_t m = 0;
- for (auto it: l_mcs_functional_vector)
- {
-
- FAPI_DBG("MCS Functional Target %u value=%08X chiplet %02X",
- m,
- (uint32_t)(it.get()>>32),
- (uint32_t)(it.getChipletNumber()));
-
- ++m;
- }
-
-
- return fapi2::FAPI2_RC_SUCCESS;
-
-fapi_try_exit:
- return fapi2::FAPI2_RC_PLAT_ERR_SEE_DATA;
-}
-
-// A Core try
-fapi2::ReturnCode
-hwp_core(const fapi2::Target<fapi2::TARGET_TYPE_CORE> & i_target)
-{
-
- // Temporary target that pulls out only the chiplet overly. This keeps
- // from having to compute this for each SCOM operation.
-// fapi2::Target<fapi2::TARGET_TYPE_ADDRESS> iv_target (i_target.getAddressOverlay());
-
- fapi2::buffer<uint64_t> data = 0;
- fapi2::buffer<uint64_t> mask;
-
- uint32_t address = 0x200F5678;
- FAPI_TRY(fapi2::getScom(i_target, address, data));
-
- FAPI_TRY(fapi2::putScom(i_target, 0x20006789, data));
-
- data = 0xBADC0DEBADC0DEBAull;
- FAPI_TRY(fapi2::putScom(i_target, 0x0000AAAA, data));
-
- FAPI_TRY(fapi2::getScom(i_target, address, data));
-
- FAPI_TRY(fapi2::modifyScom(i_target, address, data, fapi2::CHIP_OP_MODIFY_MODE_OR));
-
-
- mask = BITS(4,4);
- FAPI_TRY(fapi2::putScomUnderMask(i_target, address, data, mask));
-
- return fapi2::FAPI2_RC_SUCCESS;
-
-fapi_try_exit:
-
- return fapi2::FAPI2_RC_PLAT_ERR_SEE_DATA;
-}
-
-// An EQ try
-fapi2::ReturnCode
-hwp_eq(const fapi2::Target<fapi2::TARGET_TYPE_EQ> & i_target)
-{
- fapi2::buffer<uint64_t> data = 0;
-
- uint64_t address = 0x1000F2222;
- FAPI_TRY(fapi2::getScom(i_target, address, data));
-
-
- FAPI_TRY(fapi2::putScom(i_target, 0x10006789, data));
-
- data = 0xDEADBEEFDEADBEEFull;
- FAPI_TRY(fapi2::putScom(i_target, 0x1000ABCD, data));
-
- return fapi2::FAPI2_RC_SUCCESS;
-
-fapi_try_exit:
-
- return fapi2::FAPI2_RC_PLAT_ERR_SEE_DATA;
-}
-
-// A Perv try
-fapi2::ReturnCode
-hwp_perv(const fapi2::Target<fapi2::TARGET_TYPE_PERV> & i_target)
-{
- fapi2::buffer<uint64_t> data = 0;;
-
- uint64_t address = 0x00005678;
-
- for (uint32_t i = 0; i < 5; i++)
- {
- FAPI_TRY(fapi2::getScom(i_target, address+i, data));
-
- data.setBit<4>();
-
- FAPI_TRY(fapi2::putScom(i_target, address+i, data));
-
- data = 0xDEADBEEFDEADBEEFull;
- FAPI_TRY(fapi2::putScom(i_target, address+(2*i), data));
- }
-
- return fapi2::FAPI2_RC_SUCCESS;
-
-fapi_try_exit:
-
- return fapi2::FAPI2_RC_PLAT_ERR_SEE_DATA;
-}
-
-
-
-// The main function is called by the boot code (after initializing some
-// registers)
-int main(int argc, char **argv)
-{
- // initializes kernel data (stack, threads, timebase, timers, etc.)
- pk_initialize((PkAddress)G_kernel_stack,
- KERNEL_STACK_SIZE,
- 0,
- 500000000);
-
- PK_TRACE("Kernel init completed");
-
- //Initialize the thread control block for G_main_thread
- pk_thread_create(&G_main_thread,
- (PkThreadRoutine)main_thread,
- (void*)NULL,
- (PkAddress)G_main_thread_stack,
- (size_t)MAIN_THREAD_STACK_SIZE,
- (PkThreadPriority)1);
-
- PK_TRACE_BIN("G_main_thread", &G_main_thread, sizeof(G_main_thread));
-
- //Make G_main_thread runnable
- pk_thread_resume(&G_main_thread);
-
- PK_TRACE("Starting thread(s)");
-
- // Start running the highest priority thread.
- // This function never returns
- pk_start_threads();
-
- return 0;
-}
-
-} // extern C
diff --git a/src/ppe/sbe/image/sbe_xip_image.c b/src/ppe/sbe/image/sbe_xip_image.c
deleted file mode 100644
index bf692c3..0000000
--- a/src/ppe/sbe/image/sbe_xip_image.c
+++ /dev/null
@@ -1,2487 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/image/sbe_xip_image.c $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 sbe_xip_image.c
-/// \brief APIs for validating, normalizing, searching and manipulating
-/// SBE-XIP images.
-///
-/// The background, APIs and implementation details are documented in the
-/// document "SBE-XIP Binary format" currently available at this link:
-///
-/// - https://mcdoc.boeblingen.de.ibm.com/out/out.ViewDocument.php?documentid=2678
-///
-/// \bug The sbe_xip_validate() API should be carefully reviewed to ensure
-/// that validating even a corrupt image can not lead to a segfault, i.e., to
-/// ensure that no memory outside of the putative bounds of the image is ever
-/// referenced during validation.
-
-#ifndef PLIC_MODULE
-#include <stddef.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#endif // PLIC_MODULE
-
-#include <stddef.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include "sbe_xip_image.h"
-
-
-////////////////////////////////////////////////////////////////////////////
-// Local Functions
-////////////////////////////////////////////////////////////////////////////
-
-// PHYP has their own way of implementing the <string.h> functions. PHYP also
-// does not allow static functions or data, so all of the XIP_STATIC functions
-// defined here are global to PHYP.
-
-#ifdef PPC_HYP
-
-#ifdef PLIC_MODULE
-
-#define strcpy(dest, src) hvstrcpy(dest, src)
-#define strlen(s) hvstrlen(s)
-#define strcmp(s1, s2) hvstrcmp(s1, s2)
-#endif //PLIC_MODULE
-
-#define XIP_STATIC
-
-#else // PPC_HYP
-
-#define XIP_STATIC static
-
-#endif // PPC_HYP
-
-
-#ifdef DEBUG_SBE_XIP_IMAGE
-
-// Debugging support, normally disabled. All of the formatted I/O you see in
-// the code is effectively under this switch.
-
-#ifdef __FAPI
-
-#include "fapi.H"
-#define fprintf(stream, ...) FAPI_ERR(__VA_ARGS__)
-#define printf(...) FAPI_INF(__VA_ARGS__)
-#define TRACE_NEWLINE ""
-
-#else // __FAPI
-
-#include <stdio.h>
-#define TRACE_NEWLINE "\n"
-
-#endif // __FAPI
-
-// Portable formatting of uint64_t. The ISO C99 standard requires
-// __STDC_FORMAT_MACROS to be defined in order for PRIx64 etc. to be defined.
-
-#define __STDC_FORMAT_MACROS
-#include <inttypes.h>
-
-#define F0x016llx "0x%016" PRIx64
-#define F0x012llx "0x%012" PRIx64
-
-XIP_STATIC SBE_XIP_ERROR_STRINGS(sbe_xip_error_strings);
-
-#define TRACE_ERROR(x) \
- ({ \
- fprintf(stderr, "%s:%d : Returning error code %d : %s" TRACE_NEWLINE, \
- __FILE__, __LINE__, (x), \
- SBE_XIP_ERROR_STRING(sbe_xip_error_strings, (x))); \
- (x); \
- })
-
-#define TRACE_ERRORX(x, ...) \
- ({ \
- TRACE_ERROR(x); \
- fprintf(stderr, ##__VA_ARGS__); \
- (x); \
- })
-
-
-// Uncomment these if required for debugging, otherwise we get warnings from
-// GCC as they are not otherwise used.
-
-#if 0
-
-XIP_STATIC uint32_t xipRevLe32(const uint32_t i_x);
-
-XIP_STATIC SBE_XIP_TYPE_STRINGS(type_strings);
-
-XIP_STATIC void
-dumpToc(int index, SbeXipToc* toc)
-{
- printf("TOC entry %d @ %p\n"
- " iv_id = 0x%08x\n"
- " iv_data = 0x%08x\n"
- " iv_type = %s\n"
- " iv_section = 0x%02x\n"
- " iv_elements = %d\n",
- index, toc,
- xipRevLe32(toc->iv_id),
- xipRevLe32(toc->iv_data),
- SBE_XIP_TYPE_STRING(type_strings, toc->iv_type),
- toc->iv_section,
- toc->iv_elements);
-}
-
-#endif
-
-#if 0
-
-XIP_STATIC void
-dumpItem(SbeXipItem* item)
-{
- printf("SbeXipItem @ %p\n"
- " iv_toc = %p\n"
- " iv_address = " F0x016llx "\n"
- " iv_imageData = %p\n"
- " iv_id = %s\n"
- " iv_type = %s\n"
- " iv_elements = %d\n",
- item,
- item->iv_toc,
- item->iv_address,
- item->iv_imageData,
- item->iv_id,
- SBE_XIP_TYPE_STRING(type_strings, item->iv_type),
- item->iv_elements);
- dumpToc(-1, item->iv_toc);
-}
-
-#endif /* 0 */
-
-XIP_STATIC void
-dumpSectionTable(const void* i_image)
-{
- int i, rc;
- SbeXipSection section;
-
- printf("Section table dump of image @ %p\n"
- " Entry Offset Size\n"
- "-------------------------------\n",
- i_image);
-
- for (i = 0; i < SBE_XIP_SECTIONS; i++) {
- rc = sbe_xip_get_section(i_image, i, &section);
- if (rc) {
- printf(">>> dumpSectionTable got error at entry %d : %s\n",
- i, SBE_XIP_ERROR_STRING(sbe_xip_error_strings, rc));
- break;
- }
- printf("%7d 0x%08x 0x%08x\n",
- i, section.iv_offset, section.iv_size);
- }
-}
-
-#else
-
-#define TRACE_ERROR(x) (x)
-#define TRACE_ERRORX(x, ...) (x)
-#define dumpToc(...)
-#define dumpItem(...)
-#define dumpSectionTable(...)
-
-#endif
-
-
-// Note: For maximum flexibility we provide private versions of
-// endian-conversion routines rather than counting on a system-specific header
-// to provide these.
-
-/// Byte-reverse a 16-bit integer if on a little-endian machine
-
-XIP_STATIC uint16_t
-xipRevLe16(const uint16_t i_x)
-{
- uint16_t rx;
-
-#ifndef _BIG_ENDIAN
- uint8_t *pix = (uint8_t*)(&i_x);
- uint8_t *prx = (uint8_t*)(&rx);
-
- prx[0] = pix[1];
- prx[1] = pix[0];
-#else
- rx = i_x;
-#endif
-
- return rx;
-}
-
-
-/// Byte-reverse a 32-bit integer if on a little-endian machine
-
-XIP_STATIC uint32_t
-xipRevLe32(const uint32_t i_x)
-{
- uint32_t rx;
-
-#ifndef _BIG_ENDIAN
- 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];
-#else
- rx = i_x;
-#endif
-
- return rx;
-}
-
-
-/// Byte-reverse a 64-bit integer if on a little-endian machine
-
-XIP_STATIC uint64_t
-xipRevLe64(const uint64_t i_x)
-{
- uint64_t rx;
-
-#ifndef _BIG_ENDIAN
- 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];
-#else
- rx = i_x;
-#endif
-
- return rx;
-}
-
-
-/// What is the image link address?
-
-XIP_STATIC uint64_t
-xipLinkAddress(const void* i_image)
-{
- return xipRevLe64(((SbeXipHeader*)i_image)->iv_linkAddress);
-}
-
-
-/// What is the image size?
-
-XIP_STATIC uint32_t
-xipImageSize(const void* i_image)
-{
- return xipRevLe32(((SbeXipHeader*)i_image)->iv_imageSize);
-}
-
-
-/// Set the image size
-
-XIP_STATIC void
-xipSetImageSize(void* io_image, const size_t i_size)
-{
- ((SbeXipHeader*)io_image)->iv_imageSize = xipRevLe32(i_size);
-}
-
-
-/// Re-establish the required final alignment
-
-XIP_STATIC void
-xipFinalAlignment(void* io_image)
-{
- uint32_t size;
-
- size = xipImageSize(io_image);
-
- if ((size % SBE_XIP_FINAL_ALIGNMENT) != 0) {
- xipSetImageSize(io_image,
- size + (SBE_XIP_FINAL_ALIGNMENT -
- (size % SBE_XIP_FINAL_ALIGNMENT)));
- }
-}
-
-
-/// Compute a host address from an image address and offset
-
-XIP_STATIC void*
-xipHostAddressFromOffset(const void* i_image, const uint32_t offset)
-{
- return (void*)((unsigned long)i_image + offset);
-}
-
-
-/// Convert a IMAGE address to a host address
-
-XIP_STATIC void*
-xipImage2Host(const void* i_image, const uint64_t i_imageAddress)
-{
- return xipHostAddressFromOffset(i_image,
- i_imageAddress - xipLinkAddress(i_image));
-}
-
-
-XIP_STATIC int
-xipValidateImageAddress(const void* i_image,
- const uint64_t i_imageAddress,
- const uint32_t size)
-{
- int rc;
-
- if ((i_imageAddress < xipLinkAddress(i_image)) ||
- (i_imageAddress > (xipLinkAddress(i_image) +
- xipImageSize(i_image) -
- size))) {
- rc = TRACE_ERRORX(SBE_XIP_INVALID_ARGUMENT,
- "The IMAGE address " F0x012llx
- " is outside the bounds "
- "of the image ("
- F0x012llx ":" F0x012llx
- ") for %u-byte access.\n",
- i_imageAddress,
- xipLinkAddress(i_image),
- xipLinkAddress(i_image) + xipImageSize(i_image) - 1,
- size);
- } else {
- rc = 0;
- }
- return rc;
-}
-
-
-/// Get the magic number from the image
-
-XIP_STATIC uint64_t
-xipMagic(const void* i_image)
-{
- return xipRevLe64(((SbeXipHeader*)i_image)->iv_magic);
-}
-
-
-/// Get the header version from the image
-
-XIP_STATIC uint8_t
-xipHeaderVersion(const void* i_image)
-{
- return ((SbeXipHeader*)i_image)->iv_headerVersion;
-}
-
-
-/// Has the image been normalized?
-
-XIP_STATIC uint8_t
-xipNormalized(const void* i_image)
-{
- return ((SbeXipHeader*)i_image)->iv_normalized;
-}
-
-
-/// Has the image TOC been sorted?
-
-XIP_STATIC uint8_t
-xipSorted(const void* i_image)
-{
- return ((SbeXipHeader*)i_image)->iv_tocSorted;
-}
-
-
-/// A quick check that the image exists, has the correct magic and header
-/// version, and optionally is normalized.
-
-XIP_STATIC int
-xipQuickCheck(const void* i_image, const int i_normalizationRequired)
-{
- int rc;
-
- do {
- rc = 0;
-
- if (i_image == 0) {
- rc = TRACE_ERRORX(SBE_XIP_IMAGE_ERROR,
- "Image pointer is NULL (0)\n");
- break;
- }
- if ((xipMagic(i_image) >> 32) != SBE_XIP_MAGIC) {
- rc = TRACE_ERRORX(SBE_XIP_IMAGE_ERROR,
- "Magic number mismatch; Found "
- "" F0x016llx ", expected 0x%08x........\n",
- xipMagic(i_image), SBE_XIP_MAGIC);
- break;
- }
- if ((xipHeaderVersion(i_image)) != SBE_XIP_HEADER_VERSION) {
- rc = TRACE_ERRORX(SBE_XIP_IMAGE_ERROR,
- "Header version mismatch; Expecting %d, "
- "found %d\n",
- SBE_XIP_HEADER_VERSION,
- xipHeaderVersion(i_image));
- break;
- }
- if (i_normalizationRequired && !xipNormalized(i_image)) {
- rc = TRACE_ERRORX(SBE_XIP_NOT_NORMALIZED,
- "Image not normalized\n");
- break;
- }
- } while(0);
-
- return rc;
-}
-
-
-/// Convert a 32-bit relocatable offset to a full IMAGE 48-bit address
-
-XIP_STATIC uint64_t
-xipFullAddress(const void* i_image, uint32_t offset)
-{
- return (xipLinkAddress(i_image) & 0x0000ffff00000000ull) + offset;
-}
-
-
-/// Translate a section table entry
-
-XIP_STATIC void
-xipTranslateSection(SbeXipSection* o_dest, const SbeXipSection* i_src)
-{
-#ifndef _BIG_ENDIAN
-
-#if SBE_XIP_HEADER_VERSION != 8
-#error This code assumes the SBE-XIP header version 8 layout
-#endif
-
- o_dest->iv_offset = xipRevLe32(i_src->iv_offset);
- o_dest->iv_size = xipRevLe32(i_src->iv_size);
- o_dest->iv_alignment = i_src->iv_alignment;
- o_dest->iv_reserved8[0] = 0;
- o_dest->iv_reserved8[1] = 0;
- o_dest->iv_reserved8[2] = 0;
-#else
- if (o_dest != i_src) {
- *o_dest = *i_src;
- }
-#endif /* _BIG_ENDIAN */
-}
-
-
-/// Translate a TOC entry
-
-XIP_STATIC void
-xipTranslateToc(SbeXipToc* o_dest, SbeXipToc* i_src)
-{
-#ifndef _BIG_ENDIAN
-
-#if SBE_XIP_HEADER_VERSION != 8
-#error This code assumes the SBE-XIP header version 8 layout
-#endif
-
- o_dest->iv_id = xipRevLe32(i_src->iv_id);
- o_dest->iv_data = xipRevLe32(i_src->iv_data);
- o_dest->iv_type = i_src->iv_type;
- o_dest->iv_section = i_src->iv_section;
- o_dest->iv_elements = i_src->iv_elements;
- o_dest->iv_pad = 0;
-#else
- if (o_dest != i_src) {
- *o_dest = *i_src;
- }
-#endif /* _BIG_ENDIAN */
-}
-
-
-/// Find the final (highest-address) section of the image
-
-XIP_STATIC int
-xipFinalSection(const void* i_image, int* o_sectionId)
-{
- int i, rc, found;
- uint32_t offset;
- SbeXipHeader hostHeader;
-
- sbe_xip_translate_header(&hostHeader, (SbeXipHeader*)i_image);
-
- found = 0;
- offset = 0;
- *o_sectionId = 0; /* Make GCC -O3 happy */
- for (i = 0; i < SBE_XIP_SECTIONS; i++) {
- if ((hostHeader.iv_section[i].iv_size != 0) &&
- (hostHeader.iv_section[i].iv_offset >= offset)) {
- *o_sectionId = i;
- offset = hostHeader.iv_section[i].iv_offset;
- found = 1;
- }
- }
- if (!found) {
- rc = TRACE_ERRORX(SBE_XIP_IMAGE_ERROR, "The image is empty\n");
- } else {
- rc = 0;
- }
- return rc;
-}
-
-
-/// Return a pointer to an image-format section table entry
-
-XIP_STATIC int
-xipGetSectionPointer(const void* i_image,
- const int i_sectionId,
- SbeXipSection** o_imageSection)
-{
- int rc;
-
- if ((i_sectionId < 0) || (i_sectionId >= SBE_XIP_SECTIONS)) {
- rc = TRACE_ERROR(SBE_XIP_INVALID_ARGUMENT);
- } else {
- *o_imageSection =
- &(((SbeXipHeader*)i_image)->iv_section[i_sectionId]);
- rc = 0;
- }
- return rc;
-}
-
-
-/// Restore a section table entry from host format to image format.
-
-XIP_STATIC int
-xipPutSection(const void* i_image,
- const int i_sectionId,
- SbeXipSection* i_hostSection)
-{
- int rc;
- SbeXipSection *imageSection;
-
- rc = xipGetSectionPointer(i_image, i_sectionId, &imageSection);
-
- if (!rc) {
- xipTranslateSection(imageSection, i_hostSection);
- }
-
- return rc;
-}
-
-
-/// Set the offset of a section
-
-XIP_STATIC int
-xipSetSectionOffset(void* io_image, const int i_section,
- const uint32_t i_offset)
-{
- SbeXipSection* section;
- int rc;
-
- rc = xipGetSectionPointer(io_image, i_section, &section);
- if (!rc) {
- section->iv_offset = xipRevLe32(i_offset);
- }
- return rc;
-}
-
-
-/// Set the size of a section
-
-XIP_STATIC int
-xipSetSectionSize(void* io_image, const int i_section, const uint32_t i_size)
-{
- SbeXipSection* section;
- int rc;
-
- rc = xipGetSectionPointer(io_image, i_section, &section);
- if (!rc) {
- section->iv_size = xipRevLe32(i_size);
- }
- return rc;
-}
-
-
-/// Translate a IMAGE address in the image to a section and offset
-
-// We first check to be sure that the IMAGE address is contained in the image,
-// using the full 48-bit form. Then we scan the section table to see which
-// section contains the address - if none then the image is corrupted. We can
-// (must) use the 32-bit offset form of the address here.
-
-XIP_STATIC int
-xipImage2Section(const void* i_image,
- const uint64_t i_imageAddress,
- int* o_section,
- uint32_t* o_offset)
-{
- int rc, sectionId;
- SbeXipSection section;
- uint32_t addressOffset;
-
- do {
- rc = 0;
-
- if ((i_imageAddress < xipLinkAddress(i_image)) ||
- (i_imageAddress >
- (xipLinkAddress(i_image) + xipImageSize(i_image)))) {
- rc = TRACE_ERRORX(SBE_XIP_INVALID_ARGUMENT,
- "image2section: The i_imageAddress argument "
- "(" F0x016llx ")\nis outside the bounds of the "
- "image (" F0x016llx ":" F0x016llx ")\n",
- i_imageAddress,
- xipLinkAddress(i_image),
- xipLinkAddress(i_image) + xipImageSize(i_image));
- break;
- }
-
- addressOffset = (i_imageAddress - xipLinkAddress(i_image)) & 0xffffffff;
-
- for (sectionId = 0; sectionId < SBE_XIP_SECTIONS; sectionId++) {
- rc = sbe_xip_get_section(i_image, sectionId, &section);
- if (rc) {
- rc = TRACE_ERROR(SBE_XIP_BUG); /* Can't happen */
- break;
- }
- if ((section.iv_size != 0) &&
- (addressOffset >= section.iv_offset) &&
- (addressOffset < (section.iv_offset + section.iv_size))) {
- break;
- }
- }
- if (rc) break;
-
- if (sectionId == SBE_XIP_SECTIONS) {
- rc = TRACE_ERRORX(SBE_XIP_IMAGE_ERROR,
- "Error processing IMAGE address " F0x016llx ". "
- "The address is not mapped in any section.\n"
- "A section table dump appears below\n",
- i_imageAddress);
- dumpSectionTable(i_image);
- break;
- }
-
- *o_section = sectionId;
- *o_offset = addressOffset - section.iv_offset;
-
- } while(0);
-
- return rc;
-}
-
-
-/// Get the information required to search the TOC.
-///
-/// All return values are optional.
-
-XIP_STATIC int
-xipGetToc(void* i_image,
- SbeXipToc** o_toc,
- size_t* o_entries,
- int* o_sorted,
- char** o_strings)
-{
- int rc;
- SbeXipSection tocSection, stringsSection;
-
- do {
- rc = sbe_xip_get_section(i_image, SBE_XIP_SECTION_TOC, &tocSection);
- if (rc) break;
-
- rc = sbe_xip_get_section(i_image, SBE_XIP_SECTION_STRINGS,
- &stringsSection);
- if (rc) break;
-
- if (o_toc) {
- *o_toc = (SbeXipToc*)((uint8_t*)i_image + tocSection.iv_offset);
- }
- if (o_entries) {
- *o_entries = tocSection.iv_size / sizeof(SbeXipToc);
- }
- if (o_sorted) {
- *o_sorted = xipSorted(i_image);
- }
- if (o_strings) {
- *o_strings = (char*)i_image + stringsSection.iv_offset;
- }
- } while (0);
- return rc;
-}
-
-
-/// Compare two normalized TOC entries for sorting.
-
-XIP_STATIC int
-xipCompareToc(const SbeXipToc* i_a, const SbeXipToc* i_b,
- const char* i_strings)
-{
- return strcmp(i_strings + xipRevLe32(i_a->iv_id),
- i_strings + xipRevLe32(i_b->iv_id));
-}
-
-
-/// Iterative quicksort of the TOC
-
-// Note: The stack requirement is limited to 256 bytes + minor local storage.
-
-XIP_STATIC void
-xipQuickSort(SbeXipToc* io_toc, int i_left, int i_right,
- const char* i_strings)
-{
- int i, j, left, right, sp;
- SbeXipToc pivot, temp;
- uint32_t stack[64];
-
- sp = 0;
- stack[sp++] = i_left;
- stack[sp++] = i_right;
-
- while (sp) {
-
- right = stack[--sp];
- left = stack[--sp];
-
- i = left;
- j = right;
-
- pivot = io_toc[(i + j) / 2];
-
- while (i <= j) {
- while (xipCompareToc(&(io_toc[i]), &pivot, i_strings) < 0) {
- i++;
- }
- while (xipCompareToc(&(io_toc[j]), &pivot, i_strings) > 0) {
- j--;
- }
- if (i <= j) {
- temp = io_toc[i];
- io_toc[i] = io_toc[j];
- io_toc[j] = temp;
- i++;
- j--;
- }
- }
- if (left < j) {
- stack[sp++] = left;
- stack[sp++] = j;
- }
- if (i < right) {
- stack[sp++] = i;
- stack[sp++] = right;
- }
- }
-}
-
-
-/// TOC linear search
-
-XIP_STATIC int
-xipLinearSearch(void* i_image, const char* i_id, SbeXipToc** o_entry)
-{
- int rc;
- SbeXipToc *imageToc, hostToc;
- size_t entries;
- char* strings;
-
- *o_entry = 0;
- rc = xipGetToc(i_image, &imageToc, &entries, 0, &strings);
- if (!rc) {
- for (; entries; entries--, imageToc++) {
- xipTranslateToc(&hostToc, imageToc);
- if (strcmp(i_id, strings + hostToc.iv_id) == 0) {
- break;
- }
- }
- if (entries) {
- *o_entry = imageToc;
- rc = 0;
- } else {
- *o_entry = 0;
- rc = TRACE_ERROR(SBE_XIP_ITEM_NOT_FOUND);
- }
- }
- return rc;
-}
-
-
-/// A classic binary search of a (presumed) sorted array
-
-XIP_STATIC int
-xipBinarySearch(void* i_image, const char* i_id, SbeXipToc** o_entry)
-{
- int rc;
- SbeXipToc *imageToc;
- size_t entries;
- char* strings;
- int sorted, left, right, next, sort;
-
- do {
- *o_entry = 0;
-
- rc = xipGetToc(i_image, &imageToc, &entries, &sorted, &strings);
- if (rc) break;
-
- if (!sorted) {
- rc = TRACE_ERROR(SBE_XIP_BUG);
- break;
- }
-
- left = 0;
- right = entries - 1;
- while (left <= right) {
- next = (left + right) / 2;
- sort = strcmp(i_id, strings + xipRevLe32(imageToc[next].iv_id));
- if (sort == 0) {
- *o_entry = &(imageToc[next]);
- break;
- } else if (sort < 0) {
- right = next - 1;
- } else {
- left = next + 1;
- }
- }
- if (*o_entry == 0) {
- rc = TRACE_ERROR(SBE_XIP_ITEM_NOT_FOUND);
- break;
- }
- } while (0);
- return rc;
-}
-
-
-/// Validate a TOC entry as a mapping function
-///
-/// The TOC is validated by searching for the entry, which will uncover
-/// duplicate entries or problems with sorting/searching.
-
-XIP_STATIC int
-xipValidateTocEntry(void* io_image, const SbeXipItem* i_item, void* io_arg)
-{
- int rc;
- SbeXipItem found;
-
- do {
- rc = sbe_xip_find(io_image, i_item->iv_id, &found);
- if (rc) {
- rc = TRACE_ERRORX(rc, "TOC entry for %s not found\n",
- i_item->iv_id);
- } else if (found.iv_toc != i_item->iv_toc) {
- rc = TRACE_ERRORX(SBE_XIP_TOC_ERROR,
- "Duplicate TOC entry for '%s'\n", i_item->iv_id);
- }
- break;
- } while (0);
- return rc;
-}
-
-
-// This is the FNV-1a hash, used for hashing symbol names in the .fixed
-// section into 32-bit hashes for the mini-TOC.
-
-// According to the authors:
-
-// "FNV hash algorithms and source code have been released into the public
-// domain. The authors of the FNV algorithmm look deliberate steps to disclose
-// the algorhtm (sic) in a public forum soon after it was invented. More than
-// a year passed after this public disclosure and the authors deliberatly took
-// no steps to patent the FNV algorithm. Therefore it is safe to say that the
-// FNV authors have no patent claims on the FNV algorithm as published."
-
-#define FNV_OFFSET_BASIS 2166136261u
-#define FNV_PRIME32 16777619u
-
-uint32_t
-xipHash32(const char* s)
-{
- uint32_t hash;
-
- hash = FNV_OFFSET_BASIS;
- while (*s) {
- hash ^= *s++;
- hash *= FNV_PRIME32;
- }
- return hash;
-}
-
-
-// Normalize a TOC entry
-
-// Normalize the TOC entry by converting relocatable pointers into 32-bit
-// offsets from the beginning of the section containing the data. All
-// addresses in the TOC are actually 32-bit offsets in the address space named
-// in bits 16:31 of the link address of the image.
-
-XIP_STATIC int
-xipNormalizeToc(void* io_image, SbeXipToc *io_imageToc,
- SbeXipHashedToc** io_fixedTocEntry,
- size_t* io_fixedEntriesRemaining)
-{
- SbeXipToc hostToc;
- int idSection, dataSection;
- uint32_t idOffset, dataOffset;
- char* hostString;
- int rc;
-
- do {
-
- // Translate the TOC entry to host format. Then locate the
- // sections/offsets of the Id string (which must be in .strings) and
- // the data.
-
- xipTranslateToc(&hostToc, io_imageToc);
-
- hostString =
- (char*)xipImage2Host(io_image,
- xipFullAddress(io_image, hostToc.iv_id));
-
- rc = xipImage2Section(io_image,
- xipFullAddress(io_image, hostToc.iv_id),
- &idSection,
- &idOffset);
- if (rc) break;
-
- if (idSection != SBE_XIP_SECTION_STRINGS) {
- rc = TRACE_ERROR(SBE_XIP_IMAGE_ERROR);
- break;
- }
-
- rc = xipImage2Section(io_image,
- xipFullAddress(io_image, hostToc.iv_data),
- &dataSection,
- &dataOffset);
- if (rc) break;
-
- // Now replace the Id and data pointers with their offsets, and update
- // the data section in the TOC entry.
-
- hostToc.iv_id = idOffset;
- hostToc.iv_data = dataOffset;
- hostToc.iv_section = dataSection;
-
- // If this TOC entry is from .fixed, create a new record in .fixed_toc
-
- if (hostToc.iv_section == SBE_XIP_SECTION_FIXED) {
-
- if (*io_fixedEntriesRemaining == 0) {
- rc = TRACE_ERRORX(SBE_XIP_TOC_ERROR,
- "Too many TOC entries for .fixed\n");
- break;
- }
- if (hostToc.iv_data != (uint16_t)hostToc.iv_data) {
- rc = TRACE_ERRORX(SBE_XIP_IMAGE_ERROR,
- "The .fixed section is too big to index\n");
- break;
- }
-
- (*io_fixedTocEntry)->iv_hash = xipRevLe32(xipHash32(hostString));
- (*io_fixedTocEntry)->iv_offset = xipRevLe16(hostToc.iv_data);
- (*io_fixedTocEntry)->iv_type = hostToc.iv_type;
- (*io_fixedTocEntry)->iv_elements = hostToc.iv_elements;
-
- (*io_fixedTocEntry)++;
- (*io_fixedEntriesRemaining)--;
- }
-
- // Finally update the TOC entry
-
- xipTranslateToc(io_imageToc, &hostToc);
-
- } while (0);
-
- return rc;
-}
-
-
-// Check for hash collisions in the .fixed mini-TOC. Note that endianness is
-// not an issue here, as we're comparing for equality.
-
-XIP_STATIC int
-xipHashCollision(SbeXipHashedToc* i_fixedToc, size_t i_entries)
-{
- int rc;
- size_t i, j;
-
- rc = 0;
-
- for (i = 0; i < i_entries; i++) {
- for (j = i + 1; j < i_entries; j++) {
- if (i_fixedToc[i].iv_hash == i_fixedToc[j].iv_hash) {
- rc = TRACE_ERRORX(SBE_XIP_HASH_COLLISION,
- "Hash collision at index %d\n",
- i);
- break;
- }
- }
- if (rc) break;
- }
-
- return rc;
-}
-
-
-/// Decode a normalized image-format TOC entry into a host-format SbeXipItem
-/// structure
-
-XIP_STATIC int
-xipDecodeToc(void* i_image,
- SbeXipToc* i_imageToc,
- SbeXipItem* o_item)
-{
- int rc;
- SbeXipToc hostToc;
- SbeXipSection dataSection, stringsSection;
-
- do {
- if (!xipNormalized(i_image)) {
- rc = TRACE_ERROR(SBE_XIP_NOT_NORMALIZED);
- break;
- }
-
-
- // Translate the TOC entry and set the TOC pointer, data type and
- // number of elements in the outgoing structure. The Id string is
- // always located in the TOC_STRINGS section.
-
- xipTranslateToc(&hostToc, i_imageToc);
-
- o_item->iv_toc = i_imageToc;
- o_item->iv_type = hostToc.iv_type;
- o_item->iv_elements = hostToc.iv_elements;
-
- sbe_xip_get_section(i_image, SBE_XIP_SECTION_STRINGS, &stringsSection);
- o_item->iv_id =
- (char*)i_image + stringsSection.iv_offset + hostToc.iv_id;
-
-
- // The data (or text address) are addressed by relative offsets from
- // the beginning of their section. The TOC entry may remain in the TOC
- // even though the section has been removed from the image, so this
- // case needs to be covered.
-
- rc = sbe_xip_get_section(i_image, hostToc.iv_section, &dataSection);
- if (rc) break;
-
- if (dataSection.iv_size == 0) {
- rc = TRACE_ERROR(SBE_XIP_DATA_NOT_PRESENT);
- break;
- }
-
- o_item->iv_imageData =
- (void*)((uint8_t*)i_image +
- dataSection.iv_offset + hostToc.iv_data);
-
- o_item->iv_address =
- xipLinkAddress(i_image) + dataSection.iv_offset + hostToc.iv_data;
-
- o_item->iv_partial = 0;
-
- } while (0);
- return rc;
-}
-
-
-/// Sort the TOC
-
-XIP_STATIC int
-xipSortToc(void* io_image)
-{
- int rc;
- SbeXipToc *hostToc;
- size_t entries;
- char* strings;
-
- do {
- rc = xipQuickCheck(io_image, 1);
- if (rc) break;
-
- if (xipSorted(io_image)) break;
-
- rc = xipGetToc(io_image, &hostToc, &entries, 0, &strings);
- if (rc) break;
-
- xipQuickSort(hostToc, 0, entries - 1, strings);
-
- ((SbeXipHeader*)io_image)->iv_tocSorted = 1;
-
- } while (0);
-
- return rc;
-}
-
-
-// Pad the image with 0 to a given power-of-2 alignment. The image size is
-// modified to reflect the pad, but the caller must modify the section size to
-// reflect the pad.
-
-XIP_STATIC int
-xipPadImage(void* io_image, uint32_t i_allocation,
- uint32_t i_align, uint32_t* pad)
-{
- int rc;
-
- do {
- rc = 0;
-
- if ((i_align == 0) || ((i_align & (i_align - 1)) != 0)) {
- rc = TRACE_ERRORX(SBE_XIP_INVALID_ARGUMENT,
- "Alignment specification (%u) "
- "not a power-of-2\n",
- i_align);
- break;
- }
-
- *pad = xipImageSize(io_image) % i_align;
- if (*pad != 0) {
- *pad = i_align - *pad;
-
- if ((xipImageSize(io_image) + *pad) > i_allocation) {
- rc = TRACE_ERROR(SBE_XIP_WOULD_OVERFLOW);
- break;
- }
-
- memset((void*)((unsigned long)io_image + xipImageSize(io_image)),
- 0, *pad);
- xipSetImageSize(io_image, xipImageSize(io_image) + *pad);
- }
- } while (0);
-
- return rc;
-}
-
-
-// Get the .fixed_toc section
-
-XIP_STATIC int
-xipGetFixedToc(void* io_image,
- SbeXipHashedToc** o_imageToc,
- size_t* o_entries)
-{
- int rc;
- SbeXipSection section;
-
- rc = sbe_xip_get_section(io_image, SBE_XIP_SECTION_FIXED_TOC, &section);
- if (!rc) {
-
- *o_imageToc =
- (SbeXipHashedToc*)((unsigned long)io_image + section.iv_offset);
-
- *o_entries = section.iv_size / sizeof(SbeXipHashedToc);
- }
-
- return rc;
-}
-
-
-// Search for an item in the fixed TOC, and populate a partial TOC entry if
-// requested. This table is small and unsorted so a linear search is
-// adequate. The TOC structures are also small so all byte-reversal is done
-// 'by hand' rather than with a translate-type API.
-
-XIP_STATIC int
-xipFixedFind(void* i_image, const char* i_id, SbeXipItem* o_item)
-{
- int rc;
- SbeXipHashedToc* toc;
- size_t entries;
- uint32_t hash;
- SbeXipSection fixedSection;
- uint32_t offset;
-
- do {
- rc = xipGetFixedToc(i_image, &toc, &entries);
- if (rc) break;
-
- for (hash = xipRevLe32(xipHash32(i_id)); entries != 0; entries--, toc++) {
- if (toc->iv_hash == hash) break;
- }
-
- if (entries == 0) {
- rc = SBE_XIP_ITEM_NOT_FOUND;
- break;
- } else {
- rc = 0;
- }
-
- // The caller may have requested a lookup only (o_item == 0), in which
- // case we're done. Otherwise we create a partial SbeXipItem and
- // populate the non-0 fields analogously to the xipDecodeToc()
- // routine. The data resides in the .fixed section in this case.
-
- if (o_item == 0) break;
-
- o_item->iv_partial = 1;
- o_item->iv_toc = 0;
- o_item->iv_id = 0;
-
- o_item->iv_type = toc->iv_type;
- o_item->iv_elements = toc->iv_elements;
-
- rc = sbe_xip_get_section(i_image, SBE_XIP_SECTION_FIXED, &fixedSection);
- if (rc) break;
-
- if (fixedSection.iv_size == 0) {
- rc = TRACE_ERROR(SBE_XIP_DATA_NOT_PRESENT);
- break;
- }
-
- offset = fixedSection.iv_offset + xipRevLe16(toc->iv_offset);
-
- o_item->iv_imageData = (void*)((uint8_t*)i_image + offset);
- o_item->iv_address = xipLinkAddress(i_image) + offset;
-
- } while (0);
-
- return rc;
-}
-
-
-// Search for an item in the special built-in TOC of header fields, and
-// populate a partial TOC entry if requested.
-//
-// This facility was added to allow header data to be searched by name even
-// when the TOC has been stripped. This API will only be used in the case of a
-// stripped TOC since the header fields are also indexed in the main TOC.
-//
-// The table is allocated on the stack in order to make this code concurrently
-// patchable in PHYP (although PHYP applications will never use this code).
-// The table is small and unsorted so a linear search is adequate, and the
-// stack requirememts are small.
-
-XIP_STATIC int
-xipHeaderFind(void* i_image, const char* i_id, SbeXipItem* o_item)
-{
- int rc;
- unsigned i;
- uint32_t offset;
- SbeXipSection headerSection;
-
-#define HEADER_TOC(id, field, type) \
- {#id, offsetof(SbeXipHeader, field), type}
-
- struct HeaderToc {
-
- const char* iv_id;
- uint16_t iv_offset;
- uint8_t iv_type;
-
- } toc[] = {
-
- HEADER_TOC(magic, iv_magic, SBE_XIP_UINT64),
- HEADER_TOC(entry_offset, iv_entryOffset, SBE_XIP_UINT64),
- HEADER_TOC(link_address, iv_linkAddress, SBE_XIP_UINT64),
-
- HEADER_TOC(image_size, iv_imageSize, SBE_XIP_UINT32),
- HEADER_TOC(build_date, iv_buildDate, SBE_XIP_UINT32),
- HEADER_TOC(build_time, iv_buildTime, SBE_XIP_UINT32),
-
- HEADER_TOC(header_version, iv_headerVersion, SBE_XIP_UINT8),
- HEADER_TOC(toc_normalized, iv_normalized, SBE_XIP_UINT8),
- HEADER_TOC(toc_sorted, iv_tocSorted, SBE_XIP_UINT8),
-
- HEADER_TOC(build_user, iv_buildUser, SBE_XIP_STRING),
- HEADER_TOC(build_host, iv_buildHost, SBE_XIP_STRING),
-
- };
-
- do {
-
- rc = SBE_XIP_ITEM_NOT_FOUND;
- for (i = 0; i < (sizeof(toc) / sizeof(struct HeaderToc)); i++) {
- if (strcmp(i_id, toc[i].iv_id) == 0) {
- rc = 0;
- break;
- }
- }
-
- if (rc) break;
-
- // The caller may have requested a lookup only (o_item == 0), in which
- // case we're done. Otherwise we create a partial SbeXipItem and
- // populate the non-0 fields analogously to the xipDecodeToc()
- // routine. The data resides in the .fixed section in this case.
-
- if (o_item == 0) break;
-
- o_item->iv_partial = 1;
- o_item->iv_toc = 0;
- o_item->iv_id = 0;
-
- o_item->iv_type = toc[i].iv_type;
- o_item->iv_elements = 1; /* True for now... */
-
- rc = sbe_xip_get_section(i_image, SBE_XIP_SECTION_HEADER,
- &headerSection);
- if (rc) break;
-
- if (headerSection.iv_size == 0) {
- rc = TRACE_ERROR(SBE_XIP_DATA_NOT_PRESENT);
- break;
- }
-
- offset = headerSection.iv_offset + toc[i].iv_offset;
-
- o_item->iv_imageData = (void*)((uint8_t*)i_image + offset);
- o_item->iv_address = xipLinkAddress(i_image) + offset;
-
- } while (0);
-
- return rc;
-}
-
-
-////////////////////////////////////////////////////////////////////////////
-// Published API
-////////////////////////////////////////////////////////////////////////////
-
-int
-sbe_xip_validate(void* i_image, const uint32_t i_size)
-{
- SbeXipHeader hostHeader;
- int rc = 0, i;
- uint32_t linkAddress, imageSize, extent, offset, size;
- uint8_t alignment;
-
- sbe_xip_translate_header(&hostHeader, (SbeXipHeader*)i_image);
-
- do {
-
- // Validate C/Assembler constraints.
-
- if (sizeof(SbeXipSection) != SIZE_OF_SBE_XIP_SECTION) {
- rc = TRACE_ERRORX(SBE_XIP_BUG,
- "C/Assembler size mismatch(%d/%d) "
- "for SbeXipSection\n",
- sizeof(SbeXipSection), SIZE_OF_SBE_XIP_SECTION);
- break;
- }
-
- if (sizeof(SbeXipToc) != SIZE_OF_SBE_XIP_TOC) {
- rc = TRACE_ERRORX(SBE_XIP_BUG,
- "C/Assembler size mismatch(%d/%d) "
- "for SbeXipToc\n",
- sizeof(SbeXipToc), SIZE_OF_SBE_XIP_TOC);
- break;
- }
-
- if (sizeof(SbeXipHashedToc) != SIZE_OF_SBE_XIP_HASHED_TOC) {
- rc = TRACE_ERRORX(SBE_XIP_BUG,
- "C/Assembler size mismatch(%d/%d) "
- "for SbeXipHashedToc\n",
- sizeof(SbeXipHashedToc),
- SIZE_OF_SBE_XIP_HASHED_TOC);
- break;
- }
-
- // Validate the image pointer and magic number
-
- rc = xipQuickCheck(i_image, 0);
- if (rc) break;
-
- // Validate the image size
-
- linkAddress = hostHeader.iv_linkAddress;
- imageSize = hostHeader.iv_imageSize;
- extent = linkAddress + imageSize;
-
- if (imageSize < sizeof(SbeXipHeader)) {
- rc = TRACE_ERRORX(SBE_XIP_IMAGE_ERROR,
- "sbe_xip_validate(%p, %u) : "
- "The image size recorded in the image "
- "(%u) is smaller than the header size.\n",
- i_image, i_size, imageSize);
- break;
- }
- if (imageSize != i_size) {
- rc = TRACE_ERRORX(SBE_XIP_IMAGE_ERROR,
- "sbe_xip_validate(%p, %u) : "
- "The image size recorded in the image "
- "(%u) does not match the i_size parameter.\n",
- i_image, i_size, imageSize);
- break;
- }
- if (extent <= linkAddress) {
- rc = TRACE_ERRORX(SBE_XIP_IMAGE_ERROR,
- "sbe_xip_validate(%p, %u) : "
- "Given the link address (%u) and the "
- "image size, the image wraps the address space\n",
- i_image, i_size, linkAddress);
- break;
- }
- if ((imageSize % SBE_XIP_FINAL_ALIGNMENT) != 0) {
- rc = TRACE_ERRORX(SBE_XIP_ALIGNMENT_ERROR,
- "sbe_xip_validate(%p, %u) : "
- "The image size (%u) is not a multiple of %u\n",
- i_image, i_size, imageSize,
- SBE_XIP_FINAL_ALIGNMENT);
- break;
- }
-
- // Validate that all sections appear to be within the image
- // bounds, and are aligned correctly.
-
- for (i = 0; i < SBE_XIP_SECTIONS; i++) {
-
- offset = hostHeader.iv_section[i].iv_offset;
- size = hostHeader.iv_section[i].iv_size;
- alignment = hostHeader.iv_section[i].iv_alignment;
-
- if ((offset > imageSize) ||
- ((offset + size) > imageSize) ||
- ((offset + size) < offset)) {
- rc = TRACE_ERRORX(SBE_XIP_IMAGE_ERROR,
- "Section %d does not appear to be within "
- "the bounds of the image\n"
- "offset = %u, size = %u, image size = %u\n",
- i, offset, size, imageSize);
- break;
- }
- if ((offset % alignment) != 0) {
- rc = TRACE_ERRORX(SBE_XIP_ALIGNMENT_ERROR,
- "Section %d requires %d-byte initial "
- "alignment but the section offset is %u\n",
- i, alignment, offset);
- break;
- }
- }
- if (rc) break;
-
- // If the TOC exists and the image is normalized, validate each TOC
- // entry.
-
- size = hostHeader.iv_section[SBE_XIP_SECTION_TOC].iv_size;
- if (size != 0) {
- if (xipNormalized(i_image)) {
- rc = sbe_xip_map_toc(i_image, xipValidateTocEntry, 0);
- if (rc) break;
- }
- }
- } while (0);
- return rc;
-}
-
-
-int
-sbe_xip_validate2(void* i_image, const uint32_t i_size, const uint32_t i_maskIgnores)
-{
- SbeXipHeader hostHeader;
- int rc = 0, i;
- uint32_t linkAddress, imageSize, extent, offset, size;
- uint8_t alignment;
-
- sbe_xip_translate_header(&hostHeader, (SbeXipHeader*)i_image);
-
- do {
-
- // Validate C/Assembler constraints.
-
- if (sizeof(SbeXipSection) != SIZE_OF_SBE_XIP_SECTION) {
- rc = TRACE_ERRORX(SBE_XIP_BUG,
- "C/Assembler size mismatch(%d/%d) "
- "for SbeXipSection\n",
- sizeof(SbeXipSection), SIZE_OF_SBE_XIP_SECTION);
- break;
- }
-
- if (sizeof(SbeXipToc) != SIZE_OF_SBE_XIP_TOC) {
- rc = TRACE_ERRORX(SBE_XIP_BUG,
- "C/Assembler size mismatch(%d/%d) "
- "for SbeXipToc\n",
- sizeof(SbeXipToc), SIZE_OF_SBE_XIP_TOC);
- break;
- }
-
- if (sizeof(SbeXipHashedToc) != SIZE_OF_SBE_XIP_HASHED_TOC) {
- rc = TRACE_ERRORX(SBE_XIP_BUG,
- "C/Assembler size mismatch(%d/%d) "
- "for SbeXipHashedToc\n",
- sizeof(SbeXipHashedToc),
- SIZE_OF_SBE_XIP_HASHED_TOC);
- break;
- }
-
- // Validate the image pointer and magic number
-
- rc = xipQuickCheck(i_image, 0);
- if (rc) break;
-
- // Validate the image size
-
- linkAddress = hostHeader.iv_linkAddress;
- imageSize = hostHeader.iv_imageSize;
- extent = linkAddress + imageSize;
-
- if (imageSize < sizeof(SbeXipHeader)) {
- rc = TRACE_ERRORX(SBE_XIP_IMAGE_ERROR,
- "sbe_xip_validate2(%p, %u) : "
- "The image size recorded in the image "
- "(%u) is smaller than the header size.\n",
- i_image, i_size, imageSize);
- break;
- }
- if (imageSize != i_size && !(i_maskIgnores & SBE_XIP_IGNORE_FILE_SIZE)) {
- rc = TRACE_ERRORX(SBE_XIP_IMAGE_ERROR,
- "sbe_xip_validate2(%p, %u) : "
- "The image size recorded in the image "
- "(%u) does not match the i_size parameter.\n",
- i_image, i_size, imageSize);
- break;
- }
- if (extent <= linkAddress) {
- rc = TRACE_ERRORX(SBE_XIP_IMAGE_ERROR,
- "sbe_xip_validate2(%p, %u) : "
- "Given the link address (%u) and the "
- "image size, the image wraps the address space\n",
- i_image, i_size, linkAddress);
- break;
- }
- if ((imageSize % SBE_XIP_FINAL_ALIGNMENT) != 0) {
- rc = TRACE_ERRORX(SBE_XIP_ALIGNMENT_ERROR,
- "sbe_xip_validate2(%p, %u) : "
- "The image size (%u) is not a multiple of %u\n",
- i_image, i_size, imageSize,
- SBE_XIP_FINAL_ALIGNMENT);
- break;
- }
-
- // Validate that all sections appear to be within the image
- // bounds, and are aligned correctly.
-
- for (i = 0; i < SBE_XIP_SECTIONS; i++) {
-
- offset = hostHeader.iv_section[i].iv_offset;
- size = hostHeader.iv_section[i].iv_size;
- alignment = hostHeader.iv_section[i].iv_alignment;
-
- if ((offset > imageSize) ||
- ((offset + size) > imageSize) ||
- ((offset + size) < offset)) {
- rc = TRACE_ERRORX(SBE_XIP_IMAGE_ERROR,
- "Section %d does not appear to be within "
- "the bounds of the image\n"
- "offset = %u, size = %u, image size = %u\n",
- i, offset, size, imageSize);
- break;
- }
- if ((offset % alignment) != 0) {
- rc = TRACE_ERRORX(SBE_XIP_ALIGNMENT_ERROR,
- "Section %d requires %d-byte initial "
- "alignment but the section offset is %u\n",
- i, alignment, offset);
- break;
- }
- }
- if (rc) break;
-
- // If the TOC exists and the image is normalized, validate each TOC
- // entry.
-
- size = hostHeader.iv_section[SBE_XIP_SECTION_TOC].iv_size;
- if (size != 0) {
- if (xipNormalized(i_image)) {
- rc = sbe_xip_map_toc(i_image, xipValidateTocEntry, 0);
- if (rc) break;
- }
- }
- } while (0);
- return rc;
-}
-
-
-// Normalization:
-//
-// 1. Normalize the TOC, unless the image is already normalized. The image
-// must be marked as normalized before sorting.
-//
-// 2. Sort the TOC.
-//
-// 3. Clear the section offsets of any empty sections to make the section
-// table reports less confusing.
-//
-// 4. Clear normalization status on any failure.
-
-int
-sbe_xip_normalize(void* io_image)
-{
- int rc, i;
- SbeXipSection section;
- SbeXipToc* imageToc;
- SbeXipHashedToc* fixedImageToc;
- SbeXipHashedToc* fixedTocEntry;
- size_t tocEntries, fixedTocEntries, fixedEntriesRemaining;
-
- do {
- rc = xipQuickCheck(io_image, 0);
- if (rc) break;
-
- if (!xipNormalized(io_image)) {
-
- rc = xipGetToc(io_image, &imageToc, &tocEntries, 0, 0);
- if (rc) break;
-
- rc = xipGetFixedToc(io_image, &fixedImageToc, &fixedTocEntries);
- if (rc) break;
-
- fixedTocEntry = fixedImageToc;
- fixedEntriesRemaining = fixedTocEntries;
-
- for (; tocEntries--; imageToc++) {
- rc = xipNormalizeToc(io_image, imageToc,
- &fixedTocEntry, &fixedEntriesRemaining);
- if (rc) break;
-
- }
- if (rc) break;
-
- if (fixedEntriesRemaining != 0) {
- rc = TRACE_ERRORX(SBE_XIP_TOC_ERROR,
- "Not enough TOC entries for .fixed");
- break;
- }
-
- rc = xipHashCollision(fixedImageToc, fixedTocEntries);
- if (rc) break;
-
- ((SbeXipHeader*)io_image)->iv_normalized = 1;
- }
-
- rc = xipSortToc(io_image);
- if (rc) break;
-
- for (i = 0; i < SBE_XIP_SECTIONS; i++) {
- rc = sbe_xip_get_section(io_image, i, &section);
- if (rc) break;
- if (section.iv_size == 0) {
- xipSetSectionOffset(io_image, i, 0);
- }
- }
- if (rc) break;
-
- } while(0);
-
- ((SbeXipHeader*)io_image)->iv_normalized = (rc == 0);
-
- return rc;
-}
-
-
-int
-sbe_xip_image_size(void* io_image, uint32_t* o_size)
-{
- int rc;
-
- rc = xipQuickCheck(io_image, 0);
- if (!rc) {
- *o_size = xipImageSize(io_image);
- }
- return rc;
-}
-
-
-int
-sbe_xip_get_section(const void* i_image,
- const int i_sectionId,
- SbeXipSection* o_hostSection)
-{
- int rc;
- SbeXipSection *imageSection;
-
- rc = xipGetSectionPointer(i_image, i_sectionId, &imageSection);
-
- if (!rc) {
- xipTranslateSection(o_hostSection, imageSection);
- }
-
- return rc;
-}
-
-
-// If the 'big' TOC is not present, search the mini-TOCs that only index the
-// .fixed and .header sections.
-
-int
-sbe_xip_find(void* i_image,
- const char* i_id,
- SbeXipItem* o_item)
-{
- int rc;
- SbeXipToc* toc;
- SbeXipItem item, *pitem;
- SbeXipSection* tocSection;
-
- do {
- rc = xipQuickCheck(i_image, 1);
- if (rc) break;
-
- rc = xipGetSectionPointer(i_image, SBE_XIP_SECTION_TOC, &tocSection);
- if (rc) break;
-
- if (tocSection->iv_size == 0) {
- rc = xipFixedFind(i_image, i_id, o_item);
- if (rc) {
- rc = xipHeaderFind(i_image, i_id, o_item);
- }
- break;
- }
-
- if (xipSorted(i_image)) {
- rc = xipBinarySearch(i_image, i_id, &toc);
- } else {
- rc = xipLinearSearch(i_image, i_id, &toc);
- }
- if (rc) break;
-
- if (o_item) {
- pitem = o_item;
- } else {
- pitem = &item;
- }
- rc = xipDecodeToc(i_image, toc, pitem);
- if (rc) break;
-
- } while (0);
-
- return rc;
-}
-
-
-
-
-int
-sbe_xip_get_scalar(void *i_image, const char* i_id, uint64_t* o_data)
-{
- int rc;
- SbeXipItem item;
-
- rc = sbe_xip_find(i_image, i_id, &item);
- if (!rc) {
- switch (item.iv_type) {
- case SBE_XIP_UINT8:
- *o_data = *((uint8_t*)(item.iv_imageData));
- break;
- case SBE_XIP_UINT16:
- *o_data = xipRevLe16(*((uint16_t*)(item.iv_imageData)));
- break;
- case SBE_XIP_UINT32:
- *o_data = xipRevLe32(*((uint32_t*)(item.iv_imageData)));
- break;
- case SBE_XIP_UINT64:
- *o_data = xipRevLe64(*((uint64_t*)(item.iv_imageData)));
- break;
- case SBE_XIP_INT8:
- *o_data = *((int8_t*)(item.iv_imageData));
- break;
- case SBE_XIP_INT16:
- *o_data = xipRevLe16(*((int16_t*)(item.iv_imageData)));
- break;
- case SBE_XIP_INT32:
- *o_data = xipRevLe32(*((int32_t*)(item.iv_imageData)));
- break;
- case SBE_XIP_INT64:
- *o_data = xipRevLe64(*((int64_t*)(item.iv_imageData)));
- break;
- case SBE_XIP_ADDRESS:
- *o_data = item.iv_address;
- break;
- default:
- rc = TRACE_ERROR(SBE_XIP_TYPE_ERROR);
- break;
- }
- }
- return rc;
-}
-
-
-int
-sbe_xip_get_element(void *i_image,
- const char* i_id,
- const uint32_t i_index,
- uint64_t* o_data)
-{
- int rc;
- SbeXipItem item;
-
- do {
- rc = sbe_xip_find(i_image, i_id, &item);
- if (rc) break;
-
- if ((item.iv_elements != 0) && (i_index >= item.iv_elements)) {
- rc = TRACE_ERROR(SBE_XIP_BOUNDS_ERROR);
- break;
- }
-
- switch (item.iv_type) {
- case SBE_XIP_UINT8:
- *o_data = ((uint8_t*)(item.iv_imageData))[i_index];
- break;
- case SBE_XIP_UINT16:
- *o_data = xipRevLe16(((uint16_t*)(item.iv_imageData))[i_index]);
- break;
- case SBE_XIP_UINT32:
- *o_data = xipRevLe32(((uint32_t*)(item.iv_imageData))[i_index]);
- break;
- case SBE_XIP_UINT64:
- *o_data = xipRevLe64(((uint64_t*)(item.iv_imageData))[i_index]);
- break;
- case SBE_XIP_INT8:
- *o_data = ((int8_t*)(item.iv_imageData))[i_index];
- break;
- case SBE_XIP_INT16:
- *o_data = xipRevLe16(((int16_t*)(item.iv_imageData))[i_index]);
- break;
- case SBE_XIP_INT32:
- *o_data = xipRevLe32(((int32_t*)(item.iv_imageData))[i_index]);
- break;
- case SBE_XIP_INT64:
- *o_data = xipRevLe64(((int64_t*)(item.iv_imageData))[i_index]);
- break;
- default:
- rc = TRACE_ERROR(SBE_XIP_TYPE_ERROR);
- break;
- }
- if (rc) break;
-
- } while (0);
- return rc;
-}
-
-
-int
-sbe_xip_get_string(void *i_image, const char* i_id, char** o_data)
-{
- int rc;
- SbeXipItem item;
-
- rc = sbe_xip_find(i_image, i_id, &item);
- if (!rc) {
- switch (item.iv_type) {
- case SBE_XIP_STRING:
- *o_data = (char*)(item.iv_imageData);
- break;
- default:
- rc = TRACE_ERROR(SBE_XIP_TYPE_ERROR);
- break;
- }
- }
- return rc;
-}
-
-
-int
-sbe_xip_read_uint64(const void *i_image,
- const uint64_t i_imageAddress,
- uint64_t* o_data)
-{
- int rc;
-
- do {
- rc = xipQuickCheck(i_image, 0);
- if (rc) break;
-
- rc = xipValidateImageAddress(i_image, i_imageAddress, 8);
- if (rc) break;
-
- if (i_imageAddress % 8) {
- rc = TRACE_ERROR(SBE_XIP_ALIGNMENT_ERROR);
- break;
- }
-
- *o_data =
- xipRevLe64(*((uint64_t*)xipImage2Host(i_image, i_imageAddress)));
-
- } while(0);
-
- return rc;
-}
-
-
-int
-sbe_xip_set_scalar(void* io_image, const char* i_id, const uint64_t i_data)
-{
- int rc;
- SbeXipItem item;
-
- rc = sbe_xip_find(io_image, i_id, &item);
- if (!rc) {
- switch(item.iv_type) {
- case SBE_XIP_UINT8:
- *((uint8_t*)(item.iv_imageData)) = (uint8_t)i_data;
- break;
- case SBE_XIP_UINT16:
- *((uint16_t*)(item.iv_imageData)) = xipRevLe16((uint16_t)i_data);
- break;
- case SBE_XIP_UINT32:
- *((uint32_t*)(item.iv_imageData)) = xipRevLe32((uint32_t)i_data);
- break;
- case SBE_XIP_UINT64:
- *((uint64_t*)(item.iv_imageData)) = xipRevLe64((uint64_t)i_data);
- break;
- case SBE_XIP_INT8:
- *((int8_t*)(item.iv_imageData)) = (int8_t)i_data;
- break;
- case SBE_XIP_INT16:
- *((int16_t*)(item.iv_imageData)) = xipRevLe16((int16_t)i_data);
- break;
- case SBE_XIP_INT32:
- *((int32_t*)(item.iv_imageData)) = xipRevLe32((int32_t)i_data);
- break;
- case SBE_XIP_INT64:
- *((int64_t*)(item.iv_imageData)) = xipRevLe64((int64_t)i_data);
- break;
- default:
- rc = TRACE_ERROR(SBE_XIP_TYPE_ERROR);
- break;
- }
- }
- return rc;
-}
-
-
-int
-sbe_xip_set_element(void *i_image,
- const char* i_id,
- const uint32_t i_index,
- const uint64_t i_data)
-{
- int rc;
- SbeXipItem item;
-
- do {
- rc = sbe_xip_find(i_image, i_id, &item);
- if (rc) break;
-
- if ((item.iv_elements != 0) && (i_index >= item.iv_elements)) {
- rc = TRACE_ERROR(SBE_XIP_BOUNDS_ERROR);
- break;
- }
-
- switch (item.iv_type) {
- case SBE_XIP_UINT8:
- ((uint8_t*)(item.iv_imageData))[i_index] = (uint8_t)i_data;
- break;
- case SBE_XIP_UINT32:
- ((uint32_t*)(item.iv_imageData))[i_index] =
- xipRevLe32((uint32_t)i_data);
- break;
- case SBE_XIP_UINT64:
- ((uint64_t*)(item.iv_imageData))[i_index] =
- xipRevLe64((uint64_t)i_data);
- break;
- default:
- rc = TRACE_ERROR(SBE_XIP_TYPE_ERROR);
- break;
- }
- if (rc) break;
-
- } while (0);
-
- return rc;
-}
-
-
-int
-sbe_xip_set_string(void *i_image, const char* i_id, const char* i_data)
-{
- int rc;
- SbeXipItem item;
- char* dest;
-
- rc = sbe_xip_find(i_image, i_id, &item);
- if (!rc) {
- switch (item.iv_type) {
- case SBE_XIP_STRING:
- dest = (char*)(item.iv_imageData);
- if (strlen(dest) < strlen(i_data)) {
- memcpy(dest, i_data, strlen(dest));
- } else {
- strcpy(dest, i_data);
- }
- break;
- default:
- rc = TRACE_ERROR(SBE_XIP_TYPE_ERROR);
- break;
- }
- }
- return rc;
-}
-
-
-int
-sbe_xip_write_uint64(void *io_image,
- const uint64_t i_imageAddress,
- const uint64_t i_data)
-{
- int rc;
-
- do {
- rc = xipQuickCheck(io_image, 0);
- if (rc) break;
-
- rc = xipValidateImageAddress(io_image, i_imageAddress, 8);
- if (rc) break;
-
- if (i_imageAddress % 8) {
- rc = TRACE_ERROR(SBE_XIP_ALIGNMENT_ERROR);
- break;
- }
-
- *((uint64_t*)xipImage2Host(io_image, i_imageAddress)) =
- xipRevLe64(i_data);
-
- } while(0);
-
- return rc;
-}
-
-
-int
-sbe_xip_delete_section(void* io_image, const int i_sectionId)
-{
- int rc, final;
- SbeXipSection section;
-
- do {
- rc = xipQuickCheck(io_image, 1);
- if (rc) break;
-
- rc = sbe_xip_get_section(io_image, i_sectionId, &section);
- if (rc) break;
-
-
- // Deleting an empty section is a NOP. Otherwise the section must be
- // the final section of the image. Update the sizes and re-establish
- // the final image alignment.
-
- if (section.iv_size == 0) break;
-
- rc = xipFinalSection(io_image, &final);
- if (rc) break;
-
- if (final != i_sectionId) {
- rc = TRACE_ERRORX(SBE_XIP_SECTION_ERROR,
- "Attempt to delete non-final section %d\n",
- i_sectionId);
- break;
- }
-
- xipSetSectionOffset(io_image, i_sectionId, 0);
- xipSetSectionSize(io_image, i_sectionId, 0);
-
-
- // For cleanliness we also remove any alignment padding that had been
- // appended between the now-last section and the deleted section, then
- // re-establish the final alignment. The assumption is that all images
- // always have the correct final alignment, so there is no way this
- // could overflow a designated buffer space since the image size is
- // the same or has been reduced.
-
- rc = xipFinalSection(io_image, &final);
- if (rc) break;
-
- rc = sbe_xip_get_section(io_image, final, &section);
- if (rc) break;
-
- xipSetImageSize(io_image, section.iv_offset + section.iv_size);
- xipFinalAlignment(io_image);
-
- } while (0);
-
- return rc;
-}
-
-
-#ifndef PPC_HYP
-
-// This API is not needed by PHYP procedures, and is elided since PHYP does
-// not support malloc().
-
-int
-sbe_xip_duplicate_section(const void* i_image,
- const int i_sectionId,
- void** o_duplicate,
- uint32_t* o_size)
-{
- SbeXipSection section;
- int rc;
-
- *o_duplicate = 0;
-
- do {
- rc = xipQuickCheck(i_image, 0);
- if (rc) break;
-
- rc = sbe_xip_get_section(i_image, i_sectionId, &section);
- if (rc) break;
-
- if (section.iv_size == 0) {
- rc = TRACE_ERRORX(SBE_XIP_SECTION_ERROR,
- "Attempt to duplicate empty section %d\n",
- i_sectionId);
- break;
- }
-
- *o_duplicate = malloc(section.iv_size);
- *o_size = section.iv_size;
-
- if (*o_duplicate == 0) {
- rc = TRACE_ERROR(SBE_XIP_NO_MEMORY);
- break;
- }
-
- memcpy(*o_duplicate,
- xipHostAddressFromOffset(i_image, section.iv_offset),
- section.iv_size);
-
-
- } while (0);
-
- if (rc) {
- free(*o_duplicate);
- *o_duplicate = 0;
- *o_size = 0;
- }
-
- return rc;
-}
-
-#endif // PPC_HYP
-
-
-// The append must be done in such a way that if the append fails, the image
-// is not modified. This behavior is required by applications that
-// speculatively append until the allocation fails, but still require the
-// final image to be valid. To accomplish this the initial image size and
-// section statistics are captured at entry, and restored in the event of an
-// error.
-
-int
-sbe_xip_append(void* io_image,
- const int i_sectionId,
- const void* i_data,
- const uint32_t i_size,
- const uint32_t i_allocation,
- uint32_t* o_sectionOffset)
-{
- SbeXipSection section, initialSection;
- int rc, final, restoreOnError;
- void* hostAddress;
- uint32_t pad, initialSize;
-
- do {
- restoreOnError = 0;
-
- rc = xipQuickCheck(io_image, 1);
- if (rc) break;
-
- rc = sbe_xip_get_section(io_image, i_sectionId, &section);
- if (rc) break;
-
- if (i_size == 0) break;
-
- initialSection = section;
- initialSize = xipImageSize(io_image);
- restoreOnError = 1;
-
- if (section.iv_size == 0) {
-
- // The section is empty, and now becomes the final section. Pad
- // the image to the specified section alignment. Note that the
- // size of the previously final section does not change.
-
- rc = xipPadImage(io_image, i_allocation, section.iv_alignment,
- &pad);
- if (rc) break;
- section.iv_offset = xipImageSize(io_image);
-
- } else {
-
- // Otherwise, the section must be the final section in order to
- // continue. Remove any padding from the image.
-
- rc = xipFinalSection(io_image, &final);
- if (rc) break;
-
- if (final != i_sectionId) {
- rc = TRACE_ERRORX(SBE_XIP_SECTION_ERROR,
- "Attempt to append to non-final section "
- "%d\n", i_sectionId);
- break;
- }
- xipSetImageSize(io_image, section.iv_offset + section.iv_size);
- }
-
-
- // Make sure the allocated space won't overflow. Set the return
- // parameter o_sectionOffset and copy the new data into the image (or
- // simply clear the space).
-
- if ((xipImageSize(io_image) + i_size) > i_allocation) {
- rc = TRACE_ERROR(SBE_XIP_WOULD_OVERFLOW);
- break;
- }
- if (o_sectionOffset != 0) {
- *o_sectionOffset = section.iv_size;
- }
-
- hostAddress =
- xipHostAddressFromOffset(io_image, xipImageSize(io_image));
- if (i_data == 0) {
- memset(hostAddress, 0, i_size);
- } else {
- memcpy(hostAddress, i_data, i_size);
- }
-
-
- // Update the image size and section table. Note that the final
- // alignment may push out of the allocation.
-
- xipSetImageSize(io_image, xipImageSize(io_image) + i_size);
- xipFinalAlignment(io_image);
-
- if (xipImageSize(io_image) > i_allocation) {
- rc = TRACE_ERROR(SBE_XIP_WOULD_OVERFLOW);
- break;
- }
-
- section.iv_size += i_size;
-
- if (xipPutSection(io_image, i_sectionId, &section) != 0) {
- rc = TRACE_ERROR(SBE_XIP_BUG); /* Can't happen */
- break;
- }
-
-
- // Special case
-
- if (i_sectionId == SBE_XIP_SECTION_TOC) {
- ((SbeXipHeader*)io_image)->iv_tocSorted = 0;
- }
-
- } while (0);
-
- if (rc && restoreOnError) {
- if (xipPutSection(io_image, i_sectionId, &initialSection) != 0) {
- rc = TRACE_ERROR(SBE_XIP_BUG); /* Can't happen */
- }
- xipSetImageSize(io_image, initialSize);
- }
-
- return rc;
-}
-
-
-int
-sbe_xip_section2image(const void* i_image,
- const int i_sectionId,
- const uint32_t i_offset,
- uint64_t* o_imageAddress)
-{
- int rc;
- SbeXipSection section;
-
- do {
- rc = xipQuickCheck(i_image, 0);
- if (rc) break;
-
- rc = sbe_xip_get_section(i_image, i_sectionId, &section);
- if (rc) break;
-
- if (section.iv_size == 0) {
- rc = TRACE_ERROR(SBE_XIP_SECTION_ERROR);
- break;
- }
-
- if (i_offset > (section.iv_offset + section.iv_size)) {
- rc = TRACE_ERROR(SBE_XIP_INVALID_ARGUMENT);
- break;
- }
-
- *o_imageAddress = xipLinkAddress(i_image) + section.iv_offset + i_offset;
-
- if (*o_imageAddress % 4) {
- rc = TRACE_ERROR(SBE_XIP_ALIGNMENT_ERROR);
- break;
- }
-
- } while(0);
-
- return rc;
-}
-
-
-int
-sbe_xip_image2section(const void* i_image,
- const uint64_t i_imageAddress,
- int* i_section,
- uint32_t* i_offset)
-{
- int rc;
-
- do {
- rc = xipQuickCheck(i_image, 0);
- if (rc) break;
-
- rc = xipImage2Section(i_image, i_imageAddress, i_section, i_offset);
-
- } while(0);
-
- return rc;
-}
-
-
-int
-sbe_xip_image2host(const void* i_image,
- const uint64_t i_imageAddress,
- void** o_hostAddress)
-{
- int rc;
-
- do {
- rc = xipQuickCheck(i_image, 0);
- if (rc) break;
-
- if ((i_imageAddress < xipLinkAddress(i_image)) ||
- (i_imageAddress >
- (xipLinkAddress(i_image) + xipImageSize(i_image)))) {
- rc = TRACE_ERROR(SBE_XIP_INVALID_ARGUMENT);
- break;
- }
-
- *o_hostAddress =
- xipHostAddressFromOffset(i_image,
- i_imageAddress - xipLinkAddress(i_image));
- } while(0);
-
- return rc;
-}
-
-
-int
-sbe_xip_host2image(const void* i_image,
- void* i_hostAddress,
- uint64_t* o_imageAddress)
-{
- int rc;
-
- do {
- rc = xipQuickCheck(i_image, 0);
- if (rc) break;
-
- if ((i_hostAddress < i_image) ||
- (i_hostAddress >
- xipHostAddressFromOffset(i_image, xipImageSize(i_image)))) {
- rc = TRACE_ERROR(SBE_XIP_INVALID_ARGUMENT);
- break;
- }
-
- *o_imageAddress = xipLinkAddress(i_image) +
- ((unsigned long)i_hostAddress - (unsigned long)i_image);
- if (*o_imageAddress % 4) {
- rc = TRACE_ERROR(SBE_XIP_ALIGNMENT_ERROR);
- break;
- }
- } while(0);
-
- return rc;
-}
-
-
-void
-sbe_xip_translate_header(SbeXipHeader* o_dest, const SbeXipHeader* i_src)
-{
-#ifndef _BIG_ENDIAN
- int i;
- SbeXipSection* destSection;
- const SbeXipSection* srcSection;
-
-#if SBE_XIP_HEADER_VERSION != 8
-#error This code assumes the SBE-XIP header version 8 layout
-#endif
-
- o_dest->iv_magic = xipRevLe64(i_src->iv_magic);
- o_dest->iv_entryOffset = xipRevLe64(i_src->iv_entryOffset);
- o_dest->iv_linkAddress = xipRevLe64(i_src->iv_linkAddress);
-
- for (i = 0; i < 5; i++) {
- o_dest->iv_reserved64[i] = 0;
- }
-
- for (i = 0, destSection = o_dest->iv_section,
- srcSection = i_src->iv_section;
- i < SBE_XIP_SECTIONS;
- i++, destSection++, srcSection++) {
- xipTranslateSection(destSection, srcSection);
- }
-
- o_dest->iv_imageSize = xipRevLe32(i_src->iv_imageSize);
- o_dest->iv_buildDate = xipRevLe32(i_src->iv_buildDate);
- o_dest->iv_buildTime = xipRevLe32(i_src->iv_buildTime);
-
- for (i = 0; i < 5; i++) {
- o_dest->iv_reserved32[i] = 0;
- }
-
- o_dest->iv_headerVersion = i_src->iv_headerVersion;
- o_dest->iv_normalized = i_src->iv_normalized;
- o_dest->iv_tocSorted = i_src->iv_tocSorted;
-
- for (i = 0; i < 3; i++) {
- o_dest->iv_reserved8[i] = 0;
- }
-
- memcpy(o_dest->iv_buildUser, i_src->iv_buildUser,
- sizeof(i_src->iv_buildUser));
- memcpy(o_dest->iv_buildHost, i_src->iv_buildHost,
- sizeof(i_src->iv_buildHost));
- memcpy(o_dest->iv_reservedChar, i_src->iv_reservedChar,
- sizeof(i_src->iv_reservedChar));
-
-#else
- if (o_dest != i_src) {
- *o_dest = *i_src;
- }
-#endif /* _BIG_ENDIAN */
-}
-
-
-int
-sbe_xip_map_toc(void* io_image,
- int (*i_fn)(void* io_image,
- const SbeXipItem* i_item,
- void* io_arg),
- void* io_arg)
-{
- int rc;
- SbeXipToc *imageToc;
- SbeXipItem item;
- size_t entries;
-
- do {
- rc = xipQuickCheck(io_image, 0);
- if (rc) break;
-
- rc = xipGetToc(io_image, &imageToc, &entries, 0, 0);
- if (rc) break;
-
- for (; entries--; imageToc++) {
- rc = xipDecodeToc(io_image, imageToc, &item);
- if (rc) break;
- rc = i_fn(io_image, &item, io_arg);
- if (rc) break;
- }
- } while(0);
-
- return rc;
-}
diff --git a/src/ppe/sbe/image/sbe_xip_image.h b/src/ppe/sbe/image/sbe_xip_image.h
deleted file mode 100644
index 5a47b0a..0000000
--- a/src/ppe/sbe/image/sbe_xip_image.h
+++ /dev/null
@@ -1,1703 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/image/sbe_xip_image.h $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 */
-//-----------------------------------------------------------------------------
-// *! (C) Copyright International Business Machines Corp. 2014
-// *! All Rights Reserved -- Property of IBM
-// *! *** IBM Confidential ***
-//-----------------------------------------------------------------------------
-
-/// \file sbe_xip_image.h
-/// \brief definition of structs in sections
-///
-/// Contains struct ProcSbeFixed which contains functions, rings and
-/// attributes whose pointers are stored in the fixed and fixed_toc section
-/// Everything related to creating and manipulating SBE-XIP binary images
-
-#ifndef __SBE_XIP_IMAGE_H
-#define __SBE_XIP_IMAGE_H
-
-#include "fapi_sbe_common.H"
-
-/// Current version (fields, layout, sections) of the SBE_XIP header
-///
-/// If any changes are made to this file or to sbe_xip_header.H, please update
-/// the header version and follow-up on all of the error messages.
-
-#define SBE_XIP_HEADER_VERSION 8
-
-/// \defgroup sbe_xip_magic_numbers SBE-XIP magic numbers
-///
-/// An SBE-XIP magic number is a 64-bit constant. The 4 high-order bytes
-/// contain the ASCII characters "XIP " and identify the image as an SBE-XIP
-/// image, while the 4 low-order bytes identify the type of the image.
-///
-/// @{
-
-#define SBE_XIP_MAGIC 0x58495020 // "XIP "
-#define SBE_BASE_MAGIC ULL(0x5849502042415345) // "XIP BASE"
-#define SBE_SEEPROM_MAGIC ULL(0x584950205345504d) // "XIP SEPM"
-#define SBE_CENTAUR_MAGIC ULL(0x58495020434e5452) // "XIP CNTR"
-
-/// @}
-
-
-/// \defgroup sbe_xip_sections SBE-XIP Image Section Indexes
-///
-/// These constants define the order that the SbeXipSection structures appear
-/// in the header, which is not necessarily the order the sections appear in
-/// the binary image. Given that SBE-XIP image contents are tightly
-/// controlled, we use this simple indexing scheme for the allowed sections
-/// rather than a more general approach, e.g., allowing arbitrary sections
-/// identified by their names.
-///
-/// @{
-
-// -*- DO NOT REORDER OR EDIT THIS SET OF CONSTANTS WITHOUT ALSO EDITING -*-
-// -*- THE ASSEMBLER LAYOUT IN sbe_xip_header.H. -*-
-
-#define SBE_XIP_SECTION_HEADER 0
-#define SBE_XIP_SECTION_FIXED 1
-#define SBE_XIP_SECTION_FIXED_TOC 2
-#define SBE_XIP_SECTION_LOADER_TEXT 3
-#define SBE_XIP_SECTION_LOADER_DATA 4
-#define SBE_XIP_SECTION_TEXT 5
-#define SBE_XIP_SECTION_DATA 6
-#define SBE_XIP_SECTION_TOC 7
-#define SBE_XIP_SECTION_STRINGS 8
-#define SBE_XIP_SECTION_BASE 9
-#define SBE_XIP_SECTION_BASELOADER 10
-#define SBE_XIP_SECTION_OVERLAYS 11
-#define SBE_XIP_SECTION_RINGS 12
-
-#define SBE_XIP_SECTIONS 13
-
-/// @}
-
-
-/// \defgroup sbe_xip_validate() ignore masks.
-///
-/// These defines, when matched in sbe_xip_validate(), cause the validation
-/// to skip the check of the corresponding property. The purpose is to more
-/// effectively debug images that may be damaged and which have excess info
-/// before or after the image. The latter will be the case when dumping the
-/// image as a memory block without knowing where the image starts and ends.
-///
-/// @{
-
-#define SBE_XIP_IGNORE_FILE_SIZE (uint32_t)0x00000001
-#define SBE_XIP_IGNORE_ALL (uint32_t)0x80000000
-
-/// @}
-
-
-#ifndef __ASSEMBLER__
-
-/// Applications can expand this macro to create an array of section names.
-#define SBE_XIP_SECTION_NAMES(var) \
- const char* var[] = { \
- ".header", \
- ".fixed", \
- ".fixed_toc", \
- ".loader_text", \
- ".loader_data", \
- ".text", \
- ".data", \
- ".toc", \
- ".strings", \
- ".base", \
- ".baseloader", \
- ".overlays", \
- ".rings", \
- }
-
-/// Applications can use this macro to safely index the array of section
-/// names.
-#define SBE_XIP_SECTION_NAME(var, n) \
- ((((n) < 0) || ((n) > (int)(sizeof(var) / sizeof(char*)))) ? \
- "Bug : Invalid SBE-XIP section name" : var[n])
-
-
-#endif /* __ASSEMBLER__ */
-
-
-/// Maximum section alignment for SBE-XIP sections
-#define SBE_XIP_MAX_SECTION_ALIGNMENT 128
-
-/// \defgroup sbe_xip_toc_types SBE-XIP Table of Contents data types
-///
-/// These are the data types stored in the \a iv_type field of the SbeXipToc
-/// objects. These must be defined as manifest constants because they are
-/// required to be recognized as manifest constants in C (as opposed to C++)
-/// code.
-///
-/// NB: The 0x0 code is purposefully left undefined to catch bugs.
-///
-/// @{
-
-/// Data is a single unsigned byte
-#define SBE_XIP_UINT8 0x01
-
-/// Data is a 16-bit unsigned integer
-#define SBE_XIP_UINT16 0x02
-
-/// Data is a 32-bit unsigned integer
-#define SBE_XIP_UINT32 0x03
-
-/// Data is a 64-bit unsigned integer
-#define SBE_XIP_UINT64 0x04
-
-/// Data is a single signed byte
-#define SBE_XIP_INT8 0x05
-
-/// Data is a 16-bit signed integer
-#define SBE_XIP_INT16 0x06
-
-/// Data is a 32-bit signed integer
-#define SBE_XIP_INT32 0x07
-
-/// Data is a 64-bit signed integer
-#define SBE_XIP_INT64 0x08
-
-/// Data is a 0-byte terminated ASCII string
-#define SBE_XIP_STRING 0x09
-
-/// Data is an address
-#define SBE_XIP_ADDRESS 0x0A
-
-/// The maximum type number
-#define SBE_XIP_MAX_TYPE_INDEX 0x0A
-
-/// Applications can expand this macro to get access to string forms of the
-/// SBE-XIP data types if desired.
-#define SBE_XIP_TYPE_STRINGS(var) \
- const char* var[] = { \
- "Illegal 0 Code", \
- "SBE_XIP_UINT8", \
- "SBE_XIP_UINT16", \
- "SBE_XIP_UINT32", \
- "SBE_XIP_UINT64", \
- "SBE_XIP_INT8", \
- "SBE_XIP_INT16", \
- "SBE_XIP_INT32", \
- "SBE_XIP_INT64", \
- "SBE_XIP_STRING", \
- "SBE_XIP_ADDRESS", \
- }
-
-/// Applications can expand this macro to get access to abbreviated string
-/// forms of the SBE-XIP data types if desired.
-#define SBE_XIP_TYPE_ABBREVS(var) \
- const char* var[] = { \
- "Illegal 0 Code", \
- "u8 ", \
- "u16", \
- "u32", \
- "u64", \
- "i8 ", \
- "i16", \
- "i32", \
- "i64", \
- "str", \
- "adr", \
- }
-
-/// Applications can use this macro to safely index either array of SBE-XIP
-/// type strings.
-#define SBE_XIP_TYPE_STRING(var, n) \
- (((n) > (sizeof(var) / sizeof(char*))) ? \
- "Invalid SBE-XIP type specification" : var[n])
-
-/// @}
-
-
-/// Final alignment constraint for SBE-XIP images.
-///
-/// images are required to be multiples of 8 bytes in length, to
-/// gaurantee that the something will be able to complete any 8-byte load/store.
-#define SBE_XIP_FINAL_ALIGNMENT 8
-
-
-////////////////////////////////////////////////////////////////////////////
-// C Definitions
-////////////////////////////////////////////////////////////////////////////
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-#if 0
-} /* So __cplusplus doesn't mess w/auto-indent */
-#endif
-
-/// SBE-XIP Section information
-///
-/// This structure defines the data layout of section table entries in the
-/// SBE-XIP image header.
-
-// -*- DO NOT REORDER OR EDIT THIS STRUCTURE DEFINITION WITHOUT ALSO -*-
-// -*- EDITING THE ASSEMBLER LAYOUT IN sbe_xip_header.H -*-
-
-typedef struct {
-
- /// The offset (in bytes) of the section from the beginning of the image
- ///
- /// In normalized images the section offset will always be 0 if the
- /// section size is also 0.
- uint32_t iv_offset;
-
- /// The size of the section in bytes, exclusive of alignment padding
- ///
- /// This is the size of the program-significant data in the section,
- /// exclusive of any alignment padding or reserved or extra space. The
- /// alignment padding (reserved space) is not represented explicitly, but
- /// is only implied by the offset of any subsequent non-empty section, or
- /// in the case of the final section in the image, the image size.
- ///
- /// Regardless of the \a iv_offset, if the \a iv_size of a section is 0 it
- /// should be considered "not present" in the image. In normalized images
- /// the section offset will always be 0 if the section size is also 0.
- uint32_t iv_size;
-
- /// The required initial alignment for the section offset
- ///
- /// The image and the applications using SBE-XIP images have strict
- /// alignment/padding requirements. The image does not handle any type of
- /// unaligned instruction or data fetches. Some sections and subsections
- /// must also be POWER cache-line aligned. The \a iv_alignment applies to
- /// the first byte of the section. image images are also required to be
- /// multiples of 8 bytes in length, to gaurantee that the something will be
- /// able to complete any 8-byte load/store. These constraints are checked
- /// by sbe_xip_validate() and enforced by sbe_xip_append(). The alignment
- /// constraints may force a section to be padded, which may create "holes"
- /// in the image as explained in the comments for the \a iv_size field.
- ///
- /// Note that alignment constraints are always checked relative to the
- /// first byte of the image for in-memory images, not relative to the host
- /// address. Alignment specifications are required to be a power-of-2.
- uint8_t iv_alignment;
-
- /// Reserved structure alignment padding; Pad to 12 bytes
- uint8_t iv_reserved8[3];
-
-} SbeXipSection;
-
-/// The SbeXipSection structure is created by assembler code and is expected
-/// to have the same size in C code. This constraint is checked in
-/// sbe_xip_validate().
-#define SIZE_OF_SBE_XIP_SECTION 12
-
-
-/// SBE-XIP binary image header
-///
-/// This header occupies the initial bytes of an SBE-XIP binary image.
-/// The header contents are documented here, however the structure is actually
-/// defined in the file sbe_xip_header.S, and these two definitions must be
-/// kept consistent.
-///
-/// The header is a fixed-format representation of the most critical
-/// information about the image. The large majority of information about the
-/// image and its contents are available through the searchable table of
-/// contents. image code itself normally accesses the data directly through
-/// global symbols.
-///
-/// The header only contains information 1) required by OTPROM code (e.g., the
-/// entry point); 2) required by search and updating APIs (e.g., the
-/// locations and sizes of all of the sections.); a few pieces of critical
-/// meta-data (e.g., information about the image build process).
-///
-/// Any entries that are accessed by image code are required to be 64 bits, and
-/// will appear at the beginning of the header.
-///
-/// The header also contains bytewise offsets and sizes of all of the sections
-/// that are assembled to complete the image. The offsets are relative to the
-/// start of the image (where the header is loaded). The sizes include any
-/// padding inserted by the link editor to guarantee section alignment.
-///
-/// Every field of the header is also accesssible through the searchable table
-/// of contents as documented in sbe_xip_header.S.
-
-// -*- DO NOT REORDER OR EDIT THIS STRUCTURE DEFINITION WITHOUT ALSO -*-
-// -*- EDITING THE ASSEMBLER LAYOUT IN sbe_xip_header.S, AND WITHOUT -*-
-// -*- UPDATING THE sbe_xip_translate_header() API IN sbe_xip_image.c. -*-
-
-typedef struct {
-
- //////////////////////////////////////////////////////////////////////
- // Identification - 8-byte aligned; 8 entries
- //////////////////////////////////////////////////////////////////////
-
- /// Contains SBE_XIP_MAGIC to identify an SBE-XIP image
- uint64_t iv_magic;
-
- /// The offset of the SBE-XIP entry point from the start of the image
- uint64_t iv_entryOffset;
-
- /// The base address used to link the image, as a full relocatable image
- /// address
- uint64_t iv_linkAddress;
-
- /// Reserved for future expansion
- uint64_t iv_reserved64[5];
-
- //////////////////////////////////////////////////////////////////////
- // Section Table - 4-byte aligned; 16 entries
- //////////////////////////////////////////////////////////////////////
-
- SbeXipSection iv_section[SBE_XIP_SECTIONS];
-
- //////////////////////////////////////////////////////////////////////
- // Other information - 4-byte aligned; 8 entries
- //////////////////////////////////////////////////////////////////////
-
- /// The size of the image (including padding) in bytes
- uint32_t iv_imageSize;
-
- /// Build date generated by `date +%Y%m%d`, e.g., 20110630
- uint32_t iv_buildDate;
-
- /// Build time generated by `date +%H%M`, e.g., 0756
- uint32_t iv_buildTime;
-
- /// Reserved for future expansion
- uint32_t iv_reserved32[5];
-
- //////////////////////////////////////////////////////////////////////
- // Other Information - 1-byte aligned; 8 entries
- //////////////////////////////////////////////////////////////////////
-
- /// Header format version number
- uint8_t iv_headerVersion;
-
- /// Indicates whether the image has been normalized (0/1)
- uint8_t iv_normalized;
-
- /// Indicates whether the TOC has been sorted to speed searching (0/1)
- uint8_t iv_tocSorted;
-
- /// Reserved for future expansion
- uint8_t iv_reserved8[5];
-
- //////////////////////////////////////////////////////////////////////
- // Strings; 64 characters allocated
- //////////////////////////////////////////////////////////////////////
-
- /// Build user, generated by `id -un`
- char iv_buildUser[16];
-
- /// Build host, generated by `hostname`
- char iv_buildHost[24];
-
- /// Reserved for future expansion
- char iv_reservedChar[24];
-
-} SbeXipHeader;
-
-
-
-/// A C-structure form of the SBE-XIP Table of Contents (TOC) entries
-///
-/// The .toc section consists entirely of an array of these structures.
-/// TOC entries are never accessed by image code.
-///
-/// These structures store indexing information for global data required to be
-/// manipulated by external tools. The actual data is usually allocated in a
-/// data section and manipulated by the SBE code using global or local symbol
-/// names. Each TOC entry contains a pointer to a keyword string naming the
-/// data, the address of the data (or the data itself), the data type,
-/// meta-information about the data, and for vectors the vector size.
-
-// -*- DO NOT REORDER OR EDIT THIS STRUCTURE DEFINITION WITHOUT ALSO -*-
-// -*- EDITING THE ASSEMBLER MACROS (BELOW) THAT CREATE THE TABLE OF -*-
-// -*- CONTENTS ENTRIES. -*-
-
-typedef struct {
-
- /// A pointer to a 0-byte terminated ASCII string identifying the data.
- ///
- /// When allocated by the .xip_toc macro this is a pointer to the string
- /// form of the symbol name for the global or local symbol associated with
- /// the data which is allocated in the .strings section. This pointer is
- /// not aligned.
- ///
- /// When the image is normalized this pointer is replaced by the offset of
- /// the string in the .strings section.
- uint32_t iv_id;
-
- /// A 32-bit pointer locating the data
- ///
- /// This field is initially populated by the link editor. For scalar,
- /// vector and string types this is the final relocated address of the
- /// first byte of the data. For address types, this is the relocated
- /// address. When the image is normalized, these addresses are converted
- /// into the equivalent offsets from the beginning of the section holding
- /// the data.
- uint32_t iv_data;
-
- /// The type of the data; See \ref sbe_xip_toc_types.
- uint8_t iv_type;
-
- /// The section containing the data; See \ref sbe_xip_sections.
- uint8_t iv_section;
-
- /// The number of elements for vector types, otherwise 1 for scalar types
- /// and addresses.
- ///
- /// Vectors are naturally limited in size, e.g. to the number of cores,
- /// chips in a node, DD-levels etc. If \a iv_elements is 0 then no bounds
- /// checking is done on get/set accesses of the data.
- uint8_t iv_elements;
-
- /// Structure alignment padding; Pad to 12 bytes
- uint8_t iv_pad;
-
-} SbeXipToc;
-
-/// The SbeXipToc structure is created by assembler code and is expected
-/// to have the same size in C code. This constraint is checked in
-/// sbe_xip_validate().
-#define SIZE_OF_SBE_XIP_TOC 12
-
-
-/// A C-structure form of hashed SBE-XIP Table of Contents (TOC) entries
-///
-/// This structure was introduced in order to allow a small TOC for the .fixed
-/// section to support minimum-sized SEEPROM images in which the global TOC
-/// and all strings have been stripped out. In this structure the index
-/// string has been replaced by a 32-bit hash, and there is no longer a record
-/// of the original data name other then the hash. The section of the data is
-/// assumed to be .fixed, with a maximum 16-bit offset.
-///
-/// These structures are created when entries are made in the .fixed section.
-/// They are created empty, then filled in during image normalization.
-///
-/// This structure allows the sbe_xip_get*() and sbe_xip_set*() APIs to work
-/// even on highly-stripped SEEPROM images.
-
-typedef struct {
-
- /// A 32-bit hash (FNV-1a) of the Id string.
- uint32_t iv_hash;
-
- /// The offset in bytes from the start of the (implied) section of the data
- uint16_t iv_offset;
-
- /// The type of the data; See \ref sbe_xip_toc_types.
- uint8_t iv_type;
-
- /// The number of elements for vector types, otherwise 1 for scalar types
- /// and addresses.
- ///
- /// Vectors are naturally limited in size, e.g. to the number of cores,
- /// chips in a node, DD-levels etc. If \a iv_elements is 0 then no bounds
- /// checking is done on get/set accesses of the data.
- uint8_t iv_elements;
-
-} SbeXipHashedToc;
-
-/// The SbeXipHashedToc structure is created by assembler code and is expected
-/// to have the same size in C code. This constraint is checked in
-/// sbe_xip_validate().
-#define SIZE_OF_SBE_XIP_HASHED_TOC 8
-
-
-/// A decoded TOC entry for use by applications
-///
-/// This structure is a decoded form of a normalized TOC entry, filled in by
-/// the sbe_xip_decode_toc() and sbe_xip_find() APIs. This structure is
-/// always returned with data elements in host-endian format.
-///
-/// In the event that the TOC has been removed from the image, this structure
-/// will also be returned by sbe_xip_find() with information populated from
-/// the .fixed_toc section if possible. In this case the field \a iv_partial
-/// will be set and only the fields \a iv_address, \a iv_imageData, \a iv_type
-/// and \a iv_elements will be populated (all other fields will be set to 0).
-///
-/// \note Only special-purpose applications will ever need to use this
-/// structure given that the higher-level APIs sbe_xip_get_*() and
-/// sbe_xip_set_*() are provided and should be used if possible, especially
-/// given that the information may be truncated as described above.
-
-typedef struct {
-
- /// A pointer to the associated TOC entry as it exists in the image
- ///
- /// If \a iv_partial is set this field is returned as 0.
- SbeXipToc* iv_toc;
-
- /// The full relocatable image address
- ///
- /// All relocatable addresses are computed from the \a iv_linkAddress
- /// stored in the header. For scalar and string data, this is the
- /// relocatable address of the data. For address-only entries, this is
- /// the indexed address itself.
- uint64_t iv_address;
-
- /// A host pointer to the first byte of text or data within the image
- ///
- /// For scalar or string types this is a host pointer to the first byte of
- /// the data. For code pointers (addresses) this is host pointer to the
- /// first byte of code. Note that any use of this field requires the
- /// caller to handle conversion of the data to host endian-ness if
- /// required. Only 8-bit and string data can be used directly on all
- /// hosts.
- void* iv_imageData;
-
- /// The item name
- ///
- /// This is a pointer in host memory to a string that names the TOC entry
- /// requested. This field is set to a pointer to the ID string of the TOC
- /// entry inside the image. If \a iv_partial is set this field is returned
- /// as 0.
- char* iv_id;
-
- /// The data type, one of the SBE_XIP_* constants
- uint8_t iv_type;
-
- /// The number of elements in a vector
- ///
- /// This field is set from the TOC entry when the TOC entry is
- /// decoded. This value is stored as 1 for scalar declarations, and may be
- /// set to 0 for vectors with large or undeclared sizes. Otherwise it is
- /// used to bounds check indexed accesses.
- uint8_t iv_elements;
-
- /// Is this record only partially populated?
- ///
- /// This field is set to 0 normally, and only set to 1 if a lookup is made
- /// in an image that only has the fixed TOC and the requested Id hashes to
- /// the fixed TOC.
- uint8_t iv_partial;
-
-} SbeXipItem;
-
-
-/// Validate an SBE-XIP image
-///
-/// \param[in] i_image A pointer to an SBE-XIP image in host memory.
-///
-/// \param[in] i_size The putative size of the image
-///
-/// \param[in] i_maskIgnores Array of ignore bits representing which properties
-/// should not be checked for in sbe_xip_validate2().
-///
-/// This API should be called first by all applications that manipulate
-/// SBE-XIP images in host memory. The magic number is validated, and
-/// the image is checked for consistency of the section table and table of
-/// contents. The \a iv_imageSize field of the header must also match the
-/// provided \a i_size parameter. Validation does not modify the image.
-///
-/// \retval 0 Success
-///
-/// \retval non-0 See \ref sbe_xip_image_errors
-int
-sbe_xip_validate(void* i_image, const uint32_t i_size);
-
-int
-sbe_xip_validate2(void* i_image, const uint32_t i_size, const uint32_t i_maskIgnores);
-
-
-/// Normalize the SBE-XIP image
-///
-/// \param[in] io_image A pointer to an SBE-XIP image in host memory. The
-/// image is assumed to be consistent with the information contained in the
-/// header regarding the presence of and sizes of all sections.
-///
-/// SBE-XIP images must be normalized before any other APIs are allowed to
-/// operate on the image. Since normalization modifies the image, an explicit
-/// call to normalize the image is required. Briefly, normalization modifies
-/// the TOC entries created by the final link to simplify search, updates,
-/// modification and relocation of the image. Normalization is explained in
-/// the written documentation of the SBE-XIP binary format. Normalization does
-/// not modify the size of the image.
-///
-/// \retval 0 Success
-///
-/// \retval non-0 See \ref sbe_xip_image_errors
-int
-sbe_xip_normalize(void* io_image);
-
-
-/// Return the size of an SBE-XIP image from the image header
-///
-/// \param[in] i_image A pointer to an SBE-XIP image in host memory. The
-/// image is assumed to be consistent with the information contained in the
-/// header regarding the presence of and sizes of all sections.
-///
-/// \param[out] o_size A pointer to a variable returned as the size of the
-/// image in bytes, as recorded in the image header.
-///
-/// \retval 0 Success
-///
-/// \retval non-0 See \ref sbe_xip_image_errors
-int
-sbe_xip_image_size(void* i_image, uint32_t* o_size);
-
-
-/// Locate a section table entry and translate into host format
-///
-/// \param[in] i_image A pointer to an SBE-XIP image in host memory.
-///
-/// \param[in] i_sectionId Identifies the section to be queried. See \ref
-/// sbe_xip_sections.
-///
-/// \param[out] o_hostSection Updated to contain the section table entry
-/// translated to host byte order.
-///
-/// \retval 0 Success
-///
-/// \retval non-0 See \ref sbe_xip_image_errors
-int
-sbe_xip_get_section(const void* i_image,
- const int i_sectionId,
- SbeXipSection* o_hostSection);
-
-
-/// Endian translation of an SbeXipHeader object
-///
-/// \param[out] o_hostHeader The destination object.
-///
-/// \param[in] i_imageHeader The source object.
-///
-/// Translation of a SbeXipHeader includes translation of all data members
-/// including traslation of the embedded section table. This translation
-/// works even if \a o_src == \a o_dest, i.e., in the destructive case.
-void
-sbe_xip_translate_header(SbeXipHeader* o_hostHeader,
- const SbeXipHeader* i_imageHeader);
-
-
-/// Get scalar data from an SBE-XIP image
-///
-/// \param[in] i_image A pointer to an SBE-XIP image in host memory. The
-/// image is assumed to be consistent with the information contained in the
-/// header regarding the presence of and sizes of all sections. The image is
-/// also required to have been normalized.
-///
-/// \param[in] i_id A pointer to a 0-terminated ASCII string naming the item
-/// requested.
-///
-/// \param[out] o_data A pointer to an 8-byte integer to receive the scalar
-/// data. Assuming the item is located this variable is assigned by the call.
-/// In the event of an error the final state of \a o_data is not specified.
-///
-/// This API searches the SBE-XIP Table of Contents (TOC) for the item named
-/// \a i_id, assigning \a o_data from the image if the item is found and is a
-/// scalar value. Scalar values include 8- 32- and 64-bit integers and image
-/// addresses. Image data smaller than 64 bits are extracted as unsigned
-/// types, and it is the caller's responsibility to cast or convert the
-/// returned data as appropriate.
-///
-/// \retval 0 Success
-///
-/// \retval non-0 See \ref sbe_xip_image_errors
-int
-sbe_xip_get_scalar(void *i_image, const char* i_id, uint64_t* o_data);
-
-
-/// Get an integral element from a vector held in an SBE-XIP image
-///
-/// \param[in] i_image A pointer to an SBE-XIP image in host memory. The
-/// image is assumed to be consistent with the information contained in the
-/// header regarding the presence of and sizes of all sections. The image is
-/// also required to have been normalized.
-///
-/// \param[in] i_id A pointer to a 0-terminated ASCII string naming the item
-/// requested.
-///
-/// \param[in] i_index The index of the vector element to return.
-///
-/// \param[out] o_data A pointer to an 8-byte integer to receive the
-/// data. Assuming the item is located this variable is assigned by the call.
-/// In the event of an error the final state of \a o_data is not specified.
-///
-/// This API searches the SBE-XIP Table of Contents (TOC) for the \a i_index
-/// element of the item named \a i_id, assigning \a o_data from the image if
-/// the item is found, is a vector of an integral type, and the \a i_index is
-/// in bounds. Vector elements smaller than 64 bits are extracted as unsigned
-/// types, and it is the caller's responsibility to cast or convert the
-/// returned data as appropriate.
-///
-/// \retval 0 Success
-///
-/// \retval non-0 See \ref sbe_xip_image_errors
-int
-sbe_xip_get_element(void *i_image,
- const char* i_id,
- const uint32_t i_index,
- uint64_t* o_data);
-
-
-/// Get string data from an SBE-XIP image
-///
-/// \param[in] i_image A pointer to an SBE-XIP image in host memory. The
-/// image is assumed to be consistent with the information contained in the
-/// header regarding the presence of and sizes of all sections. The image is
-/// also required to have been normalized.
-///
-/// \param[in] i_id A pointer to a 0-terminated ASCII string naming the item
-/// requested.
-///
-/// \param[out] o_data A pointer to a character pointer. Assuming the
-/// item is located this variable is assigned by the call to point to the
-/// string as it exists in the \a i_image. In the event of an error the final
-/// state of \a o_data is not specified.
-///
-/// This API searches the SBE-XIP Table of Contents (TOC) for the item named
-/// \a i_id, assigning \a o_data if the item is found and is a string. It is
-/// the caller's responsibility to copy the string from the \a i_image memory
-/// space if necessary.
-///
-/// \retval 0 Success
-///
-/// \retval non-0 See \ref sbe_xip_image_errors
-int
-sbe_xip_get_string(void *i_image, const char* i_id, char** o_data);
-
-
-/// Directly read 64-bit data from the image based on a image address
-///
-/// \param[in] i_image A pointer to an SBE-XIP image in host memory. The
-/// image is assumed to be consistent with the information contained in the
-/// header regarding the presence of and sizes of all sections.
-///
-/// \param[in] i_imageAddress A relocatable IMAGE address contained in the
-/// image, presumably of an 8-byte data area. The \a i_imageAddress is
-/// required to be 8-byte aligned, otherwise the SBE_XIP_ALIGNMENT_ERROR code
-/// is returned.
-///
-/// \param[out] o_data The 64 bit data in host format that was found at \a
-/// i_imageAddress.
-///
-/// This API is provided for applications that need to manipulate SBE-XIP
-/// images in terms of their relocatable IMAGE addresses. The API checks that
-/// the \a i_imageAddress is properly aligned and contained in the image, then
-/// reads the contents of \a i_imageAddress into \a o_data, performing
-/// image-to-host endianess conversion if required.
-///
-/// \retval 0 Success
-///
-/// \retval non-0 See \ref sbe_xip_image_errors
-int
-sbe_xip_read_uint64(const void *i_image,
- const uint64_t i_imageAddress,
- uint64_t* o_data);
-
-
-/// Set scalar data in an SBE-XIP image
-///
-/// \param[in,out] io_image A pointer to an SBE-XIP image in host memory.
-/// The image is assumed to be consistent with the information contained in
-/// the header regarding the presence of and sizes of all sections. The image
-/// is also required to have been normalized.
-///
-/// \param[in] i_id A pointer to a 0-terminated ASCII string naming the item
-/// to be modified.
-///
-/// \param[in] i_data The new scalar data.
-///
-/// This API searches the SBE-XIP Table of Contents (TOC) for the item named
-/// by \a i_id, updating the image from \a i_data if the item is found, has
-/// a scalar type and can be modified. For this API the scalar types include
-/// 8- 32- and 64-bit integers. Although IMAGE addresses are considered a
-/// scalar type for sbe_xip_get_scalar(), IMAGE addresses can not be modified
-/// by this API. The caller is responsible for ensuring that the \a i_data is
-/// of the correct size for the underlying data element in the image.
-///
-/// \retval 0 Success
-///
-/// \retval non-0 See \ref sbe_xip_image_errors
-int
-sbe_xip_set_scalar(void* io_image, const char* i_id, const uint64_t i_data);
-
-
-/// Set an integral element in a vector held in an SBE-XIP image
-///
-/// \param[in] i_image A pointer to an SBE-XIP image in host memory. The
-/// image is assumed to be consistent with the information contained in the
-/// header regarding the presence of and sizes of all sections. The image is
-/// also required to have been normalized.
-///
-/// \param[in] i_id A pointer to a 0-terminated ASCII string naming the item
-/// to be updated.
-///
-/// \param[in] i_index The index of the vector element to update.
-///
-/// \param[out] i_data The new vector element.
-///
-/// This API searches the SBE-XIP Table of Contents (TOC) for the \a i_index
-/// element of the item named \a i_id, update the image from \a i_data if the
-/// item is found, is a vector of an integral type, and the \a i_index is in
-/// bounds. The caller is responsible for ensuring that the \a i_data is of
-/// the correct size for the underlying data element in the image.
-///
-/// \retval 0 Success
-///
-/// \retval non-0 See \ref sbe_xip_image_errors
-int
-sbe_xip_set_element(void *i_image,
- const char* i_id,
- const uint32_t i_index,
- const uint64_t i_data);
-
-
-/// Set string data in an SBE-XIP image
-///
-/// \param[in,out] io_image A pointer to an SBE-XIP image in host memory. The
-/// image is assumed to be consistent with the information contained in the
-/// header regarding the presence of and sizes of all sections. The image is
-/// also required to have been normalized.
-///
-/// \param[in] i_id A pointer to a 0-terminated ASCII string naming the item
-/// to be modified.
-///
-/// \param[in] i_data A pointer to the new string data.
-///
-/// This API searches the SBE-XIP Table of Contents (TOC) for the item named
-/// \a i_id, which must be a string variable. If found, then the string data
-/// in the image is overwritten with \a i_data. Strings are held 0-terminated
-/// in the image, and the SBE-XIP format does not maintain a record of the
-/// amount of memory allocated for an individual string. If a string is
-/// overwritten by a shorter string then the 'excess' storage is effectively
-/// lost. If the length of \a i_data is longer that the current strlen() of
-/// the string data then \a i_data is silently truncated to the first
-/// strlen(old_string) characters.
-///
-/// \retval 0 Success
-///
-/// \retval non-0 See \ref sbe_xip_image_errors
-int
-sbe_xip_set_string(void *io_image, const char* i_id, const char* i_data);
-
-
-/// Directly write 64-bit data into the image based on a IMAGE address
-///
-/// \param[in, out] io_image A pointer to an SBE-XIP image in host memory. The
-/// image is assumed to be consistent with the information contained in the
-/// header regarding the presence of and sizes of all sections.
-///
-/// \param[in] i_imageAddress A relocatable IMAGE address contained in the
-/// image, presumably of an 8-byte data area. The \a i_imageAddress is
-/// required to be 8-byte aligned, otherwise the SBE_XIP_ALIGNMENT_ERROR code
-/// is returned.
-///
-/// \param[in] i_data The 64 bit data in host format to be written to \a
-/// i_imageAddress.
-///
-/// This API is provided for applications that need to manipulate SBE-XIP
-/// images in terms of their relocatable IMAGE addresses. The API checks that
-/// the \a i_imageAddress is properly aligned and contained in the image, then
-/// updates the contents of \a i_imageAddress with \a i_data, performing
-/// host-to-image endianess conversion if required.
-///
-/// \retval 0 Success
-///
-/// \retval non-0 See \ref sbe_xip_image_errors
-int
-sbe_xip_write_uint64(void *io_image,
- const uint64_t i_imageAddress,
- const uint64_t i_data);
-
-
-/// Map over an SBE-XIP image Table of Contents
-///
-/// \param[in,out] io_image A pointer to an SBE-XIP image in host memory. The
-/// image is assumed to be consistent with the information contained in the
-/// header regarding the presence of and sizes of all sections. The image is
-/// also required to have been normalized.
-///
-/// \param[in] i_fn A pointer to a function to call on each TOC entry. The
-/// function has the prototype:
-///
-/// \code
-/// int (*i_fn)(void* io_image,
-/// const SbeXipItem* i_item,
-/// void* io_arg)
-/// \endcode
-///
-/// \param[in,out] io_arg The private argument of \a i_fn.
-///
-/// This API iterates over each entry of the TOC, calling \a i_fn with
-/// pointers to the image, an SbeXipItem* pointer, and a private argument. The
-/// iteration terminates either when all TOC entries have been mapped, or \a
-/// i_fn returns a non-zero code.
-///
-/// \retval 0 Success; All TOC entries were mapped, including the case that
-/// the .toc section is empty.
-///
-/// \retval non-0 May be either one of the SBE-XIP image error codes (see \ref
-/// sbe_xip_image_errors), or a non-zero code from \a i_fn. Since the standard
-/// SBE_XIP return codes are > 0, application-defined codes should be < 0.
-int
-sbe_xip_map_toc(void* io_image,
- int (*i_fn)(void* io_image,
- const SbeXipItem* i_item,
- void* io_arg),
- void* io_arg);
-
-
-/// Find an SBE-XIP TOC entry
-///
-/// \param[in] i_image A pointer to an SBE-XIP image in host memory. The
-/// image is assumed to be consistent with the information contained in the
-/// header regarding the presence of and sizes of all sections. The image is
-/// also required to have been normalized.
-///
-/// \param[in] i_id A 0-byte terminated ASCII string naming the item to be
-/// searched for.
-///
-/// \param[out] o_item If the search is successful, then the object
-/// pointed to by \a o_item is filled in with the decoded form of the
-/// TOC entry for \a i_id. If the API returns a non-0 error code then the
-/// final state of the storage at \a o_item is undefined. This parameter may
-/// be suppied as 0, in which case sbe_xip_find() serves as a simple predicate
-/// on whether an item is indexded in the TOC.
-///
-/// This API searches the TOC of a normalized SBE-XIP image for the item named
-/// \a i_id, and if found, fills in the structure pointed to by \a
-/// o_item with a decoded form of the TOC entry. If the item is not found,
-/// the following two return codes may be considered non-error codes:
-///
-/// - SBE_XIP_ITEM_NOT_FOUND : No TOC record for \a i_id was found.
-///
-/// - SBE_XIP_DATA_NOT_PRESENT : The item appears in the TOC, however the
-/// section containing the data is no longer present in the image.
-///
-/// If the TOC section has been deleted from the image, then the search is
-/// restricted to the abbreviated TOC that indexes data in the .fixed section.
-/// In this case the \a o_item structure is marked with a 1 in the \a
-/// iv_partial field since the abbreviated TOC can not populate the entire
-/// SbeXipItem structure.
-///
-/// \note This API should typically only be used as a predicate, not as a way
-/// to access the image via the returned SbeXipItem structure. To obtain data
-/// from the image or update data in the image use the sbe_xip_get_*() and
-/// sbe_xip_set_*() APIs respectively.
-///
-/// \retval 0 Success
-///
-/// \retval non-0 See \ref sbe_xip_image_errors
-int
-sbe_xip_find(void* i_image,
- const char* i_id,
- SbeXipItem* o_item);
-
-
-
-/// Delete a section from an SBE-XIP image in host memory
-///
-/// \param[in,out] io_image A pointer to an SBE-XIP image in host memory. The
-/// image is assumed to be consistent with the information contained in the
-/// header regarding the presence of and sizes of all sections. The image is
-/// also required to have been normalized.
-///
-/// \param[in] i_sectionId Identifies the section to be deleted. See \ref
-/// sbe_xip_sections.
-///
-/// This API effectively deletes a section from an SBE-XIP image held in host
-/// memory. Unless the requested section \a i_section is already empty, only
-/// the final (highest address offset) section of the image may be deleted.
-/// Deleting the final section of the image means that the section size is set
-/// to 0, and the size of the image recorded in the header is reduced by the
-/// section size. Any alignment padding of the now-last section is also
-/// removed.
-///
-/// \note This API does not check for or warn if other sections in the image
-/// reference the deleted section.
-///
-/// \retval 0 Success
-///
-/// \retval non-0 See \ref sbe_xip_image_errors
-int
-sbe_xip_delete_section(void* io_image, const int i_sectionId);
-
-
-#ifndef PPC_HYP
-
-/// Duplicate a section from an SBE-XIP image in host memory
-///
-/// \param[in,out] i_image A pointer to an SBE-XIP image in host memory. The
-/// image is assumed to be consistent with the information contained in the
-/// header regarding the presence of and sizes of all sections.
-///
-/// \param[in] i_sectionId Identifies the section to be duplicated. See \ref
-/// sbe_xip_sections.
-///
-/// \param[out] o_duplicate At exit, points to the newly allocated and
-/// initialized duplicate of the given section. The caller is responsible for
-/// free()-ing this memory when no longer required.
-///
-/// \param[out] o_size At exit, contains the size (in bytes) of the duplicated
-/// section.
-///
-/// This API creates a bytewise duplicate of a non-empty section into newly
-/// malloc()-ed memory. At exit \a o_duplicate points to the duplicate, and \a
-/// o_size is set the the size of the duplicated section. The caller is
-/// responsible for free()-ing the memory when no longer required. The
-/// pointer at \a o_duplicate is set to NULL (0) and the \a o_size is set to 0
-/// in the event of any failure.
-///
-/// \retval 0 Success
-///
-/// \retval non-0 See \ref sbe_xip_image_errors
-int
-sbe_xip_duplicate_section(const void* i_image,
- const int i_sectionId,
- void** o_duplicate,
- uint32_t* o_size);
-
-#endif // PPC_HYP
-
-
-/// Append binary data to an SBE-XIP image held in host memory
-///
-/// \param[in,out] io_image A pointer to an SBE-XIP image in host memory. The
-/// image is assumed to be consistent with the information contained in the
-/// header regarding the presence of and sizes of all sections. The image is
-/// also required to have been normalized.
-///
-/// \param[in] i_sectionId Identifies the section to contain the new data.
-///
-/// \param[in] i_data A pointer to the data to be appended to the image. If
-/// this pointer is NULL (0), then the effect is as if \a i_data were a
-/// pointer to an \a i_size array of 0 bytes.
-///
-/// \param[in] i_size The size of the data to be appended in bytes. If \a
-/// i_data is 0, then this is the number of bytes to clear.
-///
-/// \param[in] i_allocation The size of the memory region containing the
-/// image, measured from the first byte of the image. The call will fail if
-/// appending the new data plus any alignment padding would overflow the
-/// allocated memory.
-///
-/// \param[out] o_sectionOffset If non-0 at entry, then the API updates the
-/// location pointed to by \a o_sectionOffset with the offset of the first
-/// byte of the appended data within the indicated section. This return value
-/// is invalid in the event of a non-0 return code.
-///
-/// This API copies data from \a i_data to the end of the indicated \a
-/// i_section. The section \a i_section must either be empty, or must be the
-/// final (highest address) section in the image. If the section is initially
-/// empty and \a i_size is non-0 then the section is created at the end of the
-/// image. The size of \a i_section and the size of the image are always
-/// adjusted to reflect the newly added data. This is a simple binary copy
-/// without any interpretation (e.g., endian-translation) of the copied data.
-/// The caller is responsible for insuring that the host memory area
-/// containing the SBE-XIP image is large enough to hold the newly appended
-/// data without causing addressing errors or buffer overrun errors.
-///
-/// The final parameter \a o_sectionOffset is optional, and may be passed as
-/// NULL (0) if the application does not require the information. This return
-/// value is provided to simplify typical use cases of this API:
-///
-/// - A scan program is appended to the image, or a run-time data area is
-/// allocated and cleared at the end of the image.
-///
-/// - Pointer variables in the image are updated with IMAGE addresses obtained
-/// via sbe_xip_section2image(), or
-/// other procedure code initializes a newly allocated and cleared data area
-/// via host addresses obtained from sbe_xip_section2host().
-///
-/// Regarding alignment, note that the SBE-XIP format requires that sections
-/// maintain an initial alignment that varies by section, and the API will
-/// enforce these alignment constraints for all sections created by the API.
-/// All alignment is relative to the first byte of the image (\a io_image) -
-/// \e not to the current in-memory address of the image. By specification
-/// SBE-XIP images must be loaded at a 4K alignment in order for IMAGE hardware
-/// relocation to work, however the APIs don't require this 4K alignment for
-/// in-memory manipulation of images. Images to be executed on ImageVe will
-/// normally require at least 8-byte final aligment in order to guarantee that
-/// the ImageVe can execute an 8-byte fetch or load/store of the final
-/// doubleword.
-///
-/// \note If the TOC section is modified then the image is marked as having an
-/// unsorted TOC.
-///
-/// \note If the call fails for any reason (other than a bug in the API
-/// itself) then the \a io_image data is returned unmodified.
-///
-/// \retval 0 Success
-///
-/// \retval non-0 See \ref sbe_xip_image_errors
-int
-sbe_xip_append(void* io_image,
- const int i_sectionId,
- const void* i_data,
- const uint32_t i_size,
- const uint32_t i_allocation,
- uint32_t* o_sectionOffset);
-
-
-/// Convert an SBE-XIP section offset to a relocatable IMAGE address
-///
-/// \param[in] i_image A pointer to an SBE-XIP image in host memory
-///
-/// \param[in] i_sectionId A valid SBE-XIP section identifier; The section
-/// must be non-empty.
-///
-/// \param[in] i_offset An offset (in bytes) within the section. At least one
-/// byte at \a i_offset must be currently allocated in the section.
-///
-/// \param[in] o_imageAddress The equivalent relocatable IMAGE address is
-/// returned via this pointer. Since valid IMAGE addresses are always either
-/// 4-byte (code) or 8-byte (data) aligned, this API checks the aligment of
-/// the translated address and returns SBE_XIP_ALIGNMENT_ERROR if the IMAGE
-/// address is not at least 4-byte aligned. Note that the translated address
-/// is still returned even if incorrectly aligned.
-///
-/// This API is typically used to translate section offsets returned from
-/// sbe_xip_append() into relocatable IMAGE addresses.
-///
-/// \retval 0 Success
-///
-/// \retval non-0 See \ref sbe_xip_image_errors
-int
-sbe_xip_section2image(const void* i_image,
- const int i_sectionId,
- const uint32_t i_offset,
- uint64_t* o_imageAddress);
-
-
-/// Convert an SBE-XIP relocatable image address to a host memory address
-///
-/// \param[in] i_image A pointer to an SBE-XIP image in host memory.
-///
-/// \param[in] i_imageAddress A relocatable image address putatively addressing
-/// relocatable memory contained in the image.
-///
-/// \param[out] o_hostAddress The API updates the location pointed to by \a
-/// o_hostAddress with the host address of the memory addressed by \a
-/// i_imageAddress. In the event of an error (non-0 return code) the final
-/// content of \a o_hostAddress is undefined.
-///
-/// This API is typically used to translate relocatable image addresses stored
-/// in the SBE-XIP image into the equivalent host address of the in-memory
-/// image, allowing host-code to manipulate arbitrary data structures in the
-/// image. If the \a i_imageAddress does not refer to memory within the image
-/// (as determined by the link address and image size) then the
-/// SBE_XIP_INVALID_ARGUMENT error code is returned.
-///
-/// \retval 0 Success
-///
-/// \retval non-0 See \ref sbe_xip_image_errors
-int
-sbe_xip_image2host(const void* i_image,
- const uint64_t i_imageAddress,
- void** o_hostAddress);
-
-
-/// Convert an SBE-XIP relocatable image address to section Id and offset
-///
-/// \param[in] i_image A pointer to an SBE-XIP image in host memory.
-///
-/// \param[in] i_imageAddress A relocatable image address putatively addressing
-/// relocatable memory contained in the image.
-///
-/// \param[out] o_section The API updates the location pointed to by \a
-/// o_section with the section Id of the memory addressed by \a
-/// i_imageAddress. In the event of an error (non-0 return code) the final
-/// content of \a o_section is undefined.
-///
-/// \param[out] o_offset The API updates the location pointed to by \a
-/// o_offset with the byte offset of the memory addressed by \a i_imageAddress
-/// within \a o_section. In the event of an error (non-0 return code) the
-/// final content of \a o_offset is undefined.
-///
-/// This API is typically used to translate relocatable image addresses stored
-/// in the SBE-XIP image into the equivalent section + offset form, allowing
-/// host-code to manipulate arbitrary data structures in the image. If the \a
-/// i_imageAddress does not refer to memory within the image (as determined by
-/// the link address and image size) then the SBE_XIP_INVALID_ARGUMENT error
-/// code is returned.
-///
-/// \retval 0 Success
-///
-/// \retval non-0 See \ref sbe_xip_image_errors
-int
-sbe_xip_image2section(const void* i_image,
- const uint64_t i_imageAddress,
- int* o_section,
- uint32_t* o_offset);
-
-
-/// Convert an in-memory SBE-XIP host address to a relocatable image address
-///
-/// \param[in] i_image A pointer to an SBE-XIP image in host memory
-///
-/// \param[in] i_hostAddress A host address addressing data within the image.
-///
-/// \param[out] o_imageAddress The API updates the location pointed to by \a
-/// o_imageAddress with the equivelent relocatable image address of the memory
-/// addressed by i_hostAddress. Since valid image addresses are always either
-/// 4-byte (code) or 8-byte (data) aligned, this API checks the aligment of
-/// the translated address and returns SBE_XIP_ALIGNMENT_ERROR if the image
-/// address is not at least 4-byte aligned. Note that the translated address
-/// is still returned evn if incorrectly aligned.
-///
-/// This API is provided as a convenient way to convert host memory addresses
-/// for an in-memory SBE-XIP image into image addresses correctly relocated for
-/// the image, for example to update pointer variables in the image. If the
-/// \a i_hostAddress does not refer to memory within the image (as determined
-/// by the image address and image size) then the SBE_XIP_INVALID_ARGUMENT
-/// error code is returned.
-///
-/// \retval 0 Success
-///
-/// \retval non-0 See \ref sbe_xip_image_errors
-int
-sbe_xip_host2image(const void* i_image,
- void* i_hostAddress,
- uint64_t* o_imageAddress);
-
-
-/// \defgroup sbe_xip_image_errors Error codes from SBE-XIP image APIs
-///
-/// @{
-
-/// A putative SBE-XIP image does not have the correct magic number, or
-/// contains some other major inconsistency.
-#define SBE_XIP_IMAGE_ERROR 1
-
-/// The TOC may be missing, partially present or may have an alignment problem.
-#define SBE_XIP_TOC_ERROR 2
-
-/// A named item was not found in the SBE-XIP TOC, or a putative HALT address
-/// is not associated with a halt code in .halt.
-#define SBE_XIP_ITEM_NOT_FOUND 3
-
-/// A named item appears in the SBE-XIP TOC, but the data is not present in
-/// the image. This error can occur if sections have been deleted from the
-/// image.
-#define SBE_XIP_DATA_NOT_PRESENT 4
-
-/// A named item appears in the SBE-XIP TOC, but the data can not be
-/// modified. This error will occur if an attempt is made to modify an
-/// address-only entry.
-#define SBE_XIP_CANT_MODIFY 5
-
-/// A direct or implied argument is invalid, e.g. an illegal data type or
-/// section identifier, or an address not contained within the image.
-#define SBE_XIP_INVALID_ARGUMENT 6
-
-/// A data type mismatch or an illegal type was specified or implied for an
-/// operation.
-#define SBE_XIP_TYPE_ERROR 7
-
-/// A bug in an SBE-XIP image API
-#define SBE_XIP_BUG 8
-
-/// The image must first be normalized with sbe_xip_normalize().
-#define SBE_XIP_NOT_NORMALIZED 9
-
-/// Attempt to delete a non-empty section that is not the final section of the
-/// image, or an attempt to append data to a non-empty section that is not the
-/// final section of the image, or an attempt to operate on an empty section
-/// for those APIs that prohibit this.
-#define SBE_XIP_SECTION_ERROR 10
-
-/// An address translation API returned a image address that was not at least
-/// 4-byte aligned, or alignment violations were observed by
-/// sbe_xip_validate() or sbe_xip_append().
-#define SBE_XIP_ALIGNMENT_ERROR 11
-
-/// An API that performs dynamic memory allocation was unable to allocate
-/// memory.
-#define SBE_XIP_NO_MEMORY 12
-
-/// Attempt to get or set a vector element with an index that is outside of
-/// the declared bounds of the vector.
-#define SBE_XIP_BOUNDS_ERROR 13
-
-/// Attempt to grow the image past its defined memory allocation
-#define SBE_XIP_WOULD_OVERFLOW 14
-
-/// Error associated with the disassembler occured.
-#define SBE_XIP_DISASSEMBLER_ERROR 15
-
-/// hash collision creating the .fixed_toc section
-#define SBE_XIP_HASH_COLLISION 16
-
-/// Applications can expand this macro to declare an array of string forms of
-/// the error codes if desired.
-#define SBE_XIP_ERROR_STRINGS(var) \
- const char* var[] = { \
- "Success", \
- "SBE_XIP_IMAGE_ERROR", \
- "SBE_XIP_TOC_ERROR", \
- "SBE_XIP_ITEM_NOT_FOUND", \
- "SBE_XIP_DATA_NOT_PRESENT", \
- "SBE_XIP_CANT_MODIFY", \
- "SBE_XIP_INVALID_ARGUMENT", \
- "SBE_XIP_TYPE_ERROR", \
- "SBE_XIP_BUG", \
- "SBE_XIP_NOT_NORMALIZED", \
- "SBE_XIP_SECTION_ERROR", \
- "SBE_XIP_ALIGNMENT_ERROR", \
- "SBE_XIP_NO_MEMORY", \
- "SBE_XIP_BOUNDS_ERROR", \
- "SBE_XIP_WOULD_OVERFLOW", \
- "SBE_XIP_DISASSEMBLER_ERROR", \
- "SBE_XIP_HASH_COLLISION", \
- }
-
-/// Applications can use this macro to safely index the array of error
-/// strings.
-#define SBE_XIP_ERROR_STRING(var, n) \
- ((((n) < 0) || ((n) > (int)(sizeof(var) / sizeof(char*)))) ? \
- "Bug : Invalid SBE-XIP error code" : var[n])
-
-/// @}
-
-/// Disassembler error codes.
-#define DIS_IMAGE_ERROR 1
-#define DIS_MEMORY_ERROR 2
-#define DIS_DISASM_ERROR 3
-#define DIS_RING_NAME_ADDR_MATCH_SUCCESS 4
-#define DIS_RING_NAME_ADDR_MATCH_FAILURE 5
-#define DIS_TOO_MANY_DISASM_WARNINGS 6
-#define DIS_DISASM_TROUBLES 7
-
-#define DIS_ERROR_STRINGS(var) \
- const char* var[] = { \
- "Success", \
- "DIS_IMAGE_ERROR", \
- "DIS_MEMORY_ERROR", \
- "DIS_DISASM_ERROR", \
- "DIS_RING_NAME_ADDR_MATCH_SUCCESS", \
- "DIS_RING_NAME_ADDR_MATCH_FAILURE", \
- "DIS_TOO_MANY_DISASM_WARNINGS", \
- "DIS_DISASM_TROUBLES", \
- }
-
-#define DIS_ERROR_STRING(var, n) \
- ((((n) < 0) || ((n) > (int)(sizeof(var) / sizeof(char*)))) ? \
- "Bug : Invalid DIS error code" : var[n])
-
-#if 0
-{ /* So __cplusplus doesn't mess w/auto-indent */
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-#endif // __ASSEMBLER__
-
-
-////////////////////////////////////////////////////////////////////////////
-// Assembler Definitions
-////////////////////////////////////////////////////////////////////////////
-
-#ifdef __ASSEMBLER__
-
-/// Create an XIP TOC entry
-///
-/// \param[in] index The string form of the \a index symbol is created and
-/// linked from the TOC entry to allow external search procedures to locate
-/// the \a address.
-///
-/// \param[in] type One of the SBE_XIP_* type constants; See \ref
-/// sbe_xip_toc_types.
-///
-/// \param[in] address The address of the idexed code or data; This wlll
-/// typically be a symbol.
-///
-/// \param[in] elements <Optional> For vector types, number of elements in the
-/// vector, which is limited to an 8-bit unsigned integer. This parameter
-/// defaults to 1 which indicates a scalar type. Declaring a vector with 0
-/// elements disables bounds checking on vector accesses, and can be used if
-/// very large or indeterminate sized vectors are required. The TOC format
-/// does not support vectors of strings or addresses.
-///
-/// The \c .xip_toc macro creates a XIP Table of Contents (TOC) structure in
-/// the \c .toc section, as specified by the parameters. This macro is
-/// typically not used directly in assembly code. Instead programmers should
-/// use .xip_quad, .xip_quada, .xip_quadia, .xip_address, .xip_string or
-/// .xip_cvs_revision.
-
- .macro .xip_toc, index:req, type:req, address:req, elements=1
-
- .if (((\type) < 1) || ((\type) > SBE_XIP_MAX_TYPE_INDEX))
- .error ".xip_toc : Illegal type index"
- .endif
-
- // First push into the .strings section to lay down the
- // string form of the index name under a local label.
-
- .pushsection .strings
-7667862:
- .asciz "\index"
- .popsection
-
- // Now the 12-byte TOC entry is created. Push into the .toc section
- // and lay down the first 4 bytes which are always a pointer to the
- // string just declared. The next 4 bytes are the address of the data
- // (or the address itself in the case of address types). The final 4
- // bytes are the type, section (always 0 prior to normalization),
- // number of elements, and a padding byte.
-
- .pushsection .toc
-
- .long 7667862b, (\address)
- .byte (\type), 0, (\elements), 0
-
- .popsection
-
- .endm
-
-
-/// Allocate and initialize 64-bit global scalar or vector data and create the
-/// TOC entry.
-///
-/// \param[in] symbol The name of the scalar or vector; this name is also used
-/// as the TOC index of the data.
-///
-/// \param[in] init The initial value of (each element of) the data.
-/// This is a 64-bit integer; To allocate address pointers use .xip_quada.
-///
-/// \param[in] elements The number of 64-bit elements in the data structure,
-/// defaulting to 1, with a maximum value of 255.
-///
-/// \param[in] section The section where the data will be allocated,
-/// default depends on the memory space
-
- .macro .xip_quad, symbol:req, init:req, elements=1, section
-
- ..xip_quad_helper .quad, \symbol, (\init), (\elements), \section
-
- .endm
-
-
-/// Allocate and initialize 64-bit global scalar or vector data containing a
-/// relocatable address in and create the TOC entry.
-///
-/// \param[in] symbol The name of the scalar or vector; this name is also used
-/// as the TOC index of the data.
-///
-/// \param[in] init The initial value of (each element of) the data. This
-/// will typically be a symbolic address. If the intention is to define an
-/// address that will always be filled in later by image manipulation tools,
-/// then use the .xip_quad macro with a 0 initial value.
-///
-/// \param[in] elements The number of 64-bit elements in the data structure,
-/// defaulting to 1, with a maximum value of 255.
-///
-/// \param[in] section The section where the data will be allocated,
-/// default depends on the memory space
-
- .macro .xip_quada, symbol:req, offset:req, elements=1, section
-
- ..xip_quad_helper .quada, \symbol, (\offset), (\elements), \section
-
- .endm
-
-
-/// Helper for .xip_quad and .xip_quada
-
- .macro ..xip_quad_helper, directive, symbol, init, elements, section
-
- .if (((\elements) < 1) || ((\elements) > 255))
- .error "The number of vector elements must be in the range 1..255"
- .endif
-
- ..xip_pushsection \section
- .balign 8
-
- .global \symbol
-\symbol\():
- .rept (\elements)
- \directive (\init)
- .endr
-
- .popsection
-
- .xip_toc \symbol, SBE_XIP_UINT64, \symbol, (\elements)
-
- .endm
-
-
-/// Allocate and initialize 64-bit global scalar or vector data containing
-/// full 64-bit addresses and create a TOC entry
-///
-/// \param[in] symbol The name of the scalar or vector; this name is also used
-/// as the TOC index of the data.
-///
-/// \param[in] space A valid image memory space descriptor
-///
-/// \param[in] offset A 32-bit relocatable offset
-///
-/// \param[in] elements The number of 64-bit elements in the data structure,
-/// defaulting to 1, with a maximum value of 255.
-///
-/// \param[in] section The section where the data will be allocated,
-/// default depends on the memory space
-
- .macro .xip_quadia, symbol:req, space:req, offset:req, \
- elements=1, section
-
- .if (((\elements) < 1) || ((\elements) > 255))
- .error "The number of vector elements must be in the range 1..255"
- .endif
-
- ..xip_pushsection \section
- .balign 8
-
- .global \symbol
-\symbol\():
- .rept (\elements)
- .quadia (\space), (\offset)
- .endr
-
- .popsection
-
- .xip_toc \symbol, SBE_XIP_UINT64, \symbol, (\elements)
-
- .endm
-
-/// Default push into .ipl_data unless in an OCI space, then .data
-
- .macro ..xip_pushsection, section
-
- .ifnb \section
- .pushsection \section
- .else
- .if (_PGAS_DEFAULT_SPACE == PORE_SPACE_OCI)
- .pushsection .data
- .else
- .pushsection .ipl_data
- .endif
- .endif
-
- .balign 8
-
- .endm
-
-/// Allocate and initialize a string in .strings
-///
-/// \param[in] index The string will be stored in the TOC using this index
-/// symbol.
-///
-/// \param[in] string The string to be allocated in .strings. String space is
-/// fixed once allocated. Strings designed to be overwritten by external tools
-/// should be allocated to be as long as eventually needed (e.g., by a string
-/// of blanks.)
-
- .macro .xip_string, index:req, string:req
-
- .pushsection .strings
-7874647:
- .asciz "\string"
- .popsection
-
- .xip_toc \index, SBE_XIP_STRING, 7874647b
-
- .endm
-
-
-/// Allocate and initialize a CVS Revison string in .strings
-///
-/// \param[in] index The string will be stored in the TOC using this index
-/// symbol.
-///
-/// \param[in] string A CVS revision string to be allocated in .strings. CVS
-/// revision strings are formatted by stripping out and only storing the
-/// actual revision number :
-///
-/// \code
-/// "$Revision <n>.<m> $" -> "<n>.<m>"
-/// \endcode
-
-
- .macro .xip_cvs_revision, index:req, string:req
-
- .pushsection .strings
-7874647:
- ..cvs_revision_string "\string"
- .popsection
-
- .xip_toc \index, SBE_XIP_STRING, 7874647b
-
- .endm
-
-
-/// Shorthand to create a TOC entry for an address
-///
-/// \param[in] index The symbol will be indexed as this name
-///
-/// \param[in] symbol <Optional> The symbol to index; by default the same as
-/// the index.
-
- .macro .xip_address, index:req, symbol
-
- .ifb \symbol
- .xip_toc \index, SBE_XIP_ADDRESS, \index
- .else
- .xip_toc \index, SBE_XIP_ADDRESS, \symbol
- .endif
-
- .endm
-
-
-/// Edit and allocate a CVS revision string
-///
-/// CVS revision strings are formatted by stripping out and only storing the
-/// actual revision number :
-/// \code
-/// "$Revision <n>.<m> $" -> "<n>.<m>"
-/// \endcode
-
- .macro ..cvs_revision_string, rev:req
- .irpc c, \rev
- .ifnc "\c", "$"
- .ifnc "\c", "R"
- .ifnc "\c", "e"
- .ifnc "\c", "v"
- .ifnc "\c", "i"
- .ifnc "\c", "s"
- .ifnc "\c", "i"
- .ifnc "\c", "o"
- .ifnc "\c", "n"
- .ifnc "\c", ":"
- .ifnc "\c", " "
- .ascii "\c"
- .endif
- .endif
- .endif
- .endif
- .endif
- .endif
- .endif
- .endif
- .endif
- .endif
- .endif
- .endr
- .byte 0
- .endm
-
-#endif // __ASSEMBLER__
-
-#endif // __SBE_XIP_TOC_H
diff --git a/src/ppe/sbe/image/topfiles.mk b/src/ppe/sbe/image/topfiles.mk
deleted file mode 100644
index cc31d9c..0000000
--- a/src/ppe/sbe/image/topfiles.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/ppe/sbe/image/topfiles.mk $
-#
-# OpenPOWER OnChipController Project
-#
-# Contributors Listed Below - COPYRIGHT 2015
-# [+] 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
-TOP-C-SOURCES = sbe_loader.c
-TOP-CPP-SOURCES = sbe_main.C
-TOP-S-SOURCES = base_ppe_header.S
-
-TOP-FIXED-HEADERS += $(IMAGE_SRCDIR)/proc_sbe_fixed_perv.H
-TOP-FIXED-HEADERS += $(IMAGE_SRCDIR)/proc_sbe_fixed_proc_chip.H
-TOP-FIXED-HEADERS += $(IMAGE_SRCDIR)/proc_sbe_fixed_core.H
-TOP-FIXED-HEADERS += $(IMAGE_SRCDIR)/proc_sbe_fixed_ex.H
-TOP-FIXED-HEADERS += $(IMAGE_SRCDIR)/proc_sbe_fixed_eq.H
-
-TOP_OBJECTS = $(TOP-C-SOURCES:.c=.o) $(TOP-CPP-SOURCES:.C=.o) $(TOP-S-SOURCES:.S=.o)
diff --git a/src/ppe/sbe/plat/include/README b/src/ppe/sbe/plat/include/README
deleted file mode 100644
index 4637505..0000000
--- a/src/ppe/sbe/plat/include/README
+++ /dev/null
@@ -1,9 +0,0 @@
-fapi2_hw_access.H is placed here to restore the return code get/putScom APIs
-while allowing PPE Plat include directory to be before the Base HWPF in the
-include path.
-
-1. SBE PLAT (return codes)
-2, PPE PLAT (no return codes) used by SGPE/PGPE/CME
-3. Base HWPF (return codes)
-
-This is a dual maintenance issue that should be reconsidered in the future.
diff --git a/src/ppe/sbe/plat/include/fapi2_hw_access.H b/src/ppe/sbe/plat/include/fapi2_hw_access.H
deleted file mode 100644
index bc2d56b..0000000
--- a/src/ppe/sbe/plat/include/fapi2_hw_access.H
+++ /dev/null
@@ -1,464 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/plat/include/fapi2_hw_access.H $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2012,2015 */
-/* [+] 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 fapi2_hw_access.H
-/// @brief Common file that defines the hardware access functions that
-/// platform code must implement.
-///
-
-#ifndef _FAPI2_COMMON_HWACCESS_H_
-#define _FAPI2_COMMON_HWACCESS_H_
-
-#ifdef FAPI_SUPPORT_SPY_AS_ENUM
-#include <spy_ids.H>
-typedef uint64_t spyId_t;
-#endif
-
-#include <stdint.h>
-#include <thread>
-#include <buffer.H>
-
-// variable_buffer isn't supported on PPE
-#ifndef __PPE__
-#include <variable_buffer.H>
-#endif
-
-#include <return_code.H>
-#include <target.H>
-#include <hw_access_def.H>
-#include <plat_hw_access.H>
-
-#ifdef FAPI_SUPPORT_MULTI_SCOM
-#include <multi_scom.H>
-#endif
-
-namespace fapi2
-{
- //--------------------------------------------------------------------------
- // PIB Error Functions
- //--------------------------------------------------------------------------
-
- /// @brief Sets the PIB error mask - platform dependant
- /// @param[in] i_mask The new error mask
- inline void setPIBErrorMask(uint8_t i_mask);
-
- /// @brief Gets the PIB error mask - platform dependant
- /// @return uint8_t The current PIB error mask
- inline uint8_t getPIBErrorMask(void);
-
- //--------------------------------------------------------------------------
- // Operational Mode Error Functions
- //--------------------------------------------------------------------------
-
- /// @brief Sets the operational mode
- /// @param[in] i_mode The new mode
- inline void setOpMode(const OpModes i_mode);
-
- /// @brief Gets the operational mode
- /// @return the operational mode
- inline OpModes getOpMode(void);
-
- //--------------------------------------------------------------------------
- // HW Communication Functions
- //--------------------------------------------------------------------------
-
- /// @brief Reads a SCOM register from a chip.
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target HW target to operate on.
- /// @param[in] i_address SCOM register address to read from.
- /// @param[out] o_data Buffer that holds data read from HW target.
- /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- template< TargetType K >
- inline ReturnCode getScom(const Target<K>& i_target, const uint64_t i_address,
- buffer<uint64_t>& o_data);
-
- /// @brief Writes a SCOM register on a chip.
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target HW target to operate on.
- /// @param[in] i_address SCOM register address to write to.
- /// @param[in] i_data Buffer that holds data to write into address.
- /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- template< TargetType K >
- inline ReturnCode putScom(const Target<K>& i_target, const uint64_t i_address,
- const buffer<uint64_t> i_data);
-
- /// @brief Writes a SCOM register under mask on a chip
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target HW target to operate on.
- /// @param[in] i_address SCOM register address to write to.
- /// @param[in] i_data Buffer that holds data to write into address.
- /// @param[in] i_mask Buffer that holds the mask value.
- /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- template< TargetType K >
- inline ReturnCode putScomUnderMask(const Target<K>& i_target,
- const uint64_t i_address,
- const buffer<uint64_t> i_data,
- const buffer<uint64_t> i_mask);
-
- /// @brief Reads a CFAM register from a chip.
- /// CFAM register is 32-bit wide.
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target HW target to operate on.
- /// @param[in] i_address CFAM register address to read from.
- /// @param[out] o_data Buffer that holds data read from HW target.
- /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- template< TargetType K >
- inline ReturnCode getCfamRegister(const Target<K>& i_target,
- const uint32_t i_address,
- buffer<uint32_t>& o_data);
-
- /// @brief Writes a CFAM register on a chip.
- /// CFAM register is 32-bit wide.
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target HW target to operate on.
- /// @param[in] i_address CFAM register address to write to.
- /// @param[in] i_data Buffer that holds data to write into address.
- /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- template< TargetType K >
- inline ReturnCode putCfamRegister(const Target<K>& i_target,
- const uint32_t i_address,
- const buffer<uint32_t> i_data);
-
- /// @brief Read-modify-write a CFAM register on a chip.
- /// CFAM register is 32-bit wide.
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target HW target to operate on.
- /// @param[in] i_address CFAM register address to modify.
- /// @param[in] i_data Buffer that holds data to be modified.
- /// @param[in] i_modifyMode The modify mode (or/and/xor).
- /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- template< TargetType K >
- inline ReturnCode modifyCfamRegister(const Target<K>& i_target,
- const uint32_t i_address,
- const buffer<uint32_t> i_data,
- const ChipOpModifyMode i_modifyMode);
-
- // variable_buffer isn't supported on PPE
-#ifndef __PPE__
- /// @brief Reads a ring from a chip.
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target Target to operate on.
- /// @param[in] i_address Ring address to read from.
- /// @param[out] o_data Buffer that holds data read from HW target.
- /// @param[in] i_ringMode Ring operation mode.
- /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- template< TargetType K >
- inline ReturnCode getRing(const Target<K>& i_target,
- const scanRingId_t i_address,
- variable_buffer& o_data,
- const RingMode i_ringMode = 0);
-
- /// @brief Writes a ring to a chip.
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target Target to operate on.
- /// @param[in] i_address Ring address to write to.
- /// @param[in] i_data Buffer that contains RS4 compressed ring data
- /// to write into address
- /// @param[in] i_ringMode Ring operation mode.
- /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- template< TargetType K >
- inline ReturnCode putRing(const Target<K>& i_target,
- const scanRingId_t i_address,
- const variable_buffer& i_data,
- const RingMode i_ringMode = 0);
-
-
- /// @brief Read-modify-write a ring on a chip.
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target Target to operate on.
- /// @param[in] i_address Ring address to modify.
- /// @param[in] i_data Buffer that contains RS4 compressed ring data
- /// to be modified.
- /// @param[in] i_modifyMode The modify mode (or/and/xor)
- /// @param[in] i_ringMode Ring operation mode.
- /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- template< TargetType K >
- inline ReturnCode modifyRing(const Target<K>& i_target,
- const scanRingId_t i_address,
- const variable_buffer& i_data,
- const ChipOpModifyMode i_modifyMode,
- const RingMode i_ringMode = 0);
-#endif
-
-#ifdef FAPI_SUPPORT_MULTI_SCOM
- /// @brief Performs a multiple SCOM operation
- /// This interface performs multiple SCOM operations on a chip in the
- /// order specified by the input MultiScom object.
- /// See fapiMultiScom.H for details of how to populate the MultiScom
- /// object with SCOM operations.
- ///
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target Target to operate on.
- /// @param[in,out] io_multiScomObj Reference to a MultiScom object,
- /// pre-populated with SingleScomInfo entries
- /// to perform multiple SCOMs on input target
- /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- ///
- /// @note This is a synchronous interface and would return after all the
- /// SCOM operations are completed or on the first failed operation
- ///
- /// @note SCOMs will be performed in the order they were added to the
- /// input MultiScom object
- ///
- /// @note In case of errors, the platform code is responsible to collect
- /// and add all the required error info and FFDC into the error data
- /// for debugging
- ///
- /// @note If the SCOM operations added are specific to a processor chip,
- /// then the FSI Shift Engine configured in scatter-gather DMA mode
- /// extension would be used to execute the SCOM operations in a
- /// performance optimize mode. In this mode, the special
- /// SCOM_BULK_READ_MODE and SCOM_BULK_WRITE_MODE operations are
- /// supported that allow a large bulk of SCOM access (in multiple of
- /// 64 bits) for targets that support auto-increment. The
- /// SCOM_WRITE_UNDER_MASK operation is not supported in this mode
- ///
- /// @note If the SCOM operations added are specific to a memory buffer
- /// chip, then the regular SCOM engine is used to execute the SCOM
- /// operations. SCOM_WRITE_UNDER_MASK operation is supported in
- /// this mode, but the special SCOM_BULK_READ_MODE and
- /// SCOM_BULK_WRITE_MODE operations are not supported due to
- /// hardware limitations.
- ///
- template< TargetType K >
- fapi2::ReturnCode multiScom (const Target<K>& i_target,
- MultiScom& io_multiScomObj);
-#endif
-
- // --------------------------------------------------------------------------
- // NOTE:
- // Implement platform Spy access functions if platform supports them.
- // --------------------------------------------------------------------------
-
- // variable_buffer isn't supported on PPE
-#ifndef __PPE__
- /// @brief Reads a spy from a chip.
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target Target to operate on.
- /// @param[in] i_spyId Id of the spy whose data to be read.
- /// @param[out] o_data Buffer that holds data read from HW target.
- /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- ///
- /// @note: The string version is only supported for cronus.
- ///
- /// The fapi design to support both FSP and cronus use of get and
- /// put spy functions is dependant on the SPY names being expanded
- /// to resemble a valid C identifier. This design places some
- /// restrictions on the SPY names which can be used.
- ///
- /// 1. if the spy name contains a # procedure writers should replace
- /// it with an __P__ for example -
- ///
- /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS
- /// becomes
- /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS
- ///
- /// 2. if the spy name has a number following a "." it must have an
- /// underscore prepended to the number.
- ///
- /// EH.TPCHIP.2KX100_ARY_CLK_EDGES_DLY
- /// becomes
- /// EH.TPCHIP._2KX100_ARY_CLK_EDGES_DLY
- ///
- /// Example SPY name:
- /// The hardware procedure should call the function like:
- ///
- /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS
- ///
- /// fapi2::ReturnCode rc = fapiGetSpy( targ,
- /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS, data );
- ///
- /// @note The ID is not in quotes the fapi code will handle adding
- /// the quotes for the cronus environment
-#if defined(FAPI_SUPPORT_SPY_AS_ENUM) || defined(DOXYGEN)
-
-#define FAPI_GET_SPY(TARGET, ID, DATA) fapi2::getSpy(TARGET, FAPI_SPY_NAMES::ID.value, DATA)
-
- template< TargetType K >
- inline ReturnCode getSpy(const Target<K>& i_target,
- const spyId_t i_spyId,
- variable_buffer& o_data);
-#endif
-
-#if defined(FAPI_SUPPORT_SPY_AS_STRING) || defined(DOXYGEN)
-
-#define FAPI_GET_SPY(TARGET, ID, DATA) fapi2::getSpy(TARGET, #ID, DATA)
-
- template< TargetType K >
- inline ReturnCode getSpy(const Target<K>& i_target,
- const char * const i_spyId,
- variable_buffer& o_data);
-#endif
-
- /// @brief Writes a spy on a chip.
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target Target to operate on.
- /// @param[in] i_spyId Id of the spy to write data to.
- /// @param[out] i_data Buffer that holds data to write into spy.
- /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- ///
- /// @note: The string version is only supported for cronus.
- ///
- /// The fapi design to support both FSP and cronus use of get and
- /// put spy functions is dependent on the SPY names being expanded
- /// to resemble a valid C identifier. This design places some
- /// restrictions on the SPY names which can be used.
- ///
- /// 1. if the spy name contains a # procedure writers should replace
- /// is with an __P__ for example -
- ///
- /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS
- /// becomes
- /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS
- ///
- /// 2. if the spy name has a number following a "." it must have an
- /// underscore prepended to the number.
- ///
- /// EH.TPCHIP.2KX100_ARY_CLK_EDGES_DLY
- /// becomes
- /// EH.TPCHIP._2KX100_ARY_CLK_EDGES_DLY
- ///
- /// Example SPY name:
- /// The hardware procedure should call the function like:
- ///
- /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS
- ///
- /// fapi2::ReturnCode rc = fapiPutSpy( targ,
- /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS, data );
- ///
- /// @note The ID is not in quotes the fapi code will handle adding
- /// the quotes for the cronus environment
- ///
-#if defined(FAPI_SUPPORT_SPY_AS_ENUM) || defined(DOXYGEN)
-
-#define FAPI_PUT_SPY(TARGET, ID, DATA) fapi2::putSpy(TARGET, FAPI_SPY_NAMES::ID.value, DATA)
-
- template< TargetType K >
- inline ReturnCode putSpy(const Target<K>& i_target,
- const spyId_t i_spyId,
- variable_buffer& i_data);
-#endif
-
-#if defined(FAPI_SUPPORT_SPY_AS_STRING) || defined(DOXYGEN)
-
-#define FAPI_PUT_SPY(TARGET, ID, DATA) fapi2::putSpy(TARGET, #ID, DATA)
-
- template< TargetType K >
- inline ReturnCode putSpy(const Target<K>& i_target,
- const char* const i_spyId,
- variable_buffer& i_data);
-#endif
-
- /// @brief Writes spy data into a buffer holding ring data image
- /// This API is used by L2/L3 repair to put column repair data
- /// into a ring buffer image.
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target Target to operate on.
- /// @param[in] i_spyId Id of the spy.
- /// @param[in] i_data Buffer that holds spy data to write into ring
- /// image.
- /// @param[out] o_data Buffer that holds updated ring image.
- /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- ///
- /// @note: The string version is only supported for cronus.
- ///
- /// The fapi design to support both FSP and cronus use of get and
- /// put spy functions is dependent on the SPY names being expanded
- /// to resemble a valid C identifier. This design places some
- /// restrictions on the SPY names which can be used.
- ///
- /// See fapiPutSpy for details on spy id specifics.
- ///
-#if defined(FAPI_SUPPORT_SPY_AS_ENUM) || defined(DOXYGEN)
-
-#define FAPI_PUT_SPY_IMAGE(TARGET, ID, DATA1, DATA2) \
- fapi2::putSpyImage(TARGET, FAPI_SPY_NAMES::ID.value, \
- DATA1, DATA2)
-
- template< TargetType K >
- inline ReturnCode putSpyImage(const Target<K>& i_target,
- const spyId_t i_spyId,
- const variable_buffer& i_data,
- variable_buffer& o_imageData);
-#endif
-
-#if defined(FAPI_SUPPORT_SPY_AS_STRING) || defined(DOXYGEN)
-
-#define FAPI_PUT_SPY_IMAGE(TARGET, ID, DATA1, DATA2) \
- fapi2::putSpyImage(TARGET, #ID, DATA1,DATA2)
-
- template< TargetType K >
- inline ReturnCode putSpyImage(const Target<K>& i_target,
- const char* const i_spyId,
- const variable_buffer& i_data,
- variable_buffer& o_imageData);
-#endif
-
- /// @brief Reads spy data from a ring image buffer
- /// @param[in] i_target Target to operate on
- /// @param[in] i_spyId The spy's id
- /// @param[out] o_data Buffer that holds data read from ring image.
- /// @param[in] i_imageData Buffer that holds ring image to read data
- /// from.
- /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- ///
- /// @note: The string version is only supported for cronus.
- ///
- /// The fapi design to support both FSP and cronus use of get and
- /// put spy functions is dependent on the SPY names being expanded
- /// to resemble a valid C identifier. This design places some
- /// restrictions on the SPY names which can be used.
- ///
- /// See fapiPutSpy for details on spy id specifics.
- ///
-#if defined(FAPI_SUPPORT_SPY_AS_ENUM) || defined(DOXYGEN)
-
-#define FAPI_GET_SPY_IMAGE(TARGET, ID, DATA1, DATA2) \
- fapi2:getSpyImage(TARGET, FAPI_SPY_NAMES::ID.value, \
- DATA1, DATA2)
-
- template< TargetType K >
- inline ReturnCode getSpyImage(const Target<K>& i_target,
- const spyId_t i_spyId,
- variable_buffer& o_data,
- const variable_buffer& i_imageData);
-#endif
-
-#if defined(FAPI_SUPPORT_SPY_AS_STRING) || defined(DOXYGEN)
-
-#define FAPI_GET_SPY_IMAGE(TARGET, ID, DATA1, DATA2) \
- fapi2::getSpyImage(TARGET, #ID, DATA1,DATA2)
-
- template< TargetType K >
- inline ReturnCode getSpyImage(const Target<K>& i_target,
- const char * const i_spyId,
- variable_buffer& o_data,
- const variable_buffer& i_imageData);
-#endif
-
-#endif // PPE
-};
-
-#endif // _FAPI2_HWACCESS_H_
diff --git a/src/ppe/sbe/plat/include/hw_access.H b/src/ppe/sbe/plat/include/hw_access.H
deleted file mode 100644
index 0f380e0..0000000
--- a/src/ppe/sbe/plat/include/hw_access.H
+++ /dev/null
@@ -1,619 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/plat/include/hw_access.H $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2012,2015 */
-/* [+] 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 hw_access.H
- *
-* @brief Defines the hardware access functions that platform code must
- * implement.
- */
-
-#ifndef FAPI2_HWACCESS_H_
-#define FAPI2_HWACCESS_H_
-
-
-// variable_buffer isn't supported on PPE
-#ifndef __PPE__
-#include <variable_buffer.H>
-#endif
-
-#include <utils.H>
-#include <plat_hw_access.H>
-#include <fapi2_hw_access.H>
-
-namespace fapi2
-{
-
- //--------------------------------------------------------------------------
- // PIB Error Functions
- //--------------------------------------------------------------------------
-
- /// @brief Sets the PIB error mask - platform dependant
- /// @param[in] i_mask The new error mask
- void setPIBErrorMask(uint8_t i_mask)
- {
- PLAT_SET_PIB_ERROR_MASK(i_mask);
- }
-
- /// @brief Gets the PIB error mask - platform dependant
- /// @return uint8_t The current PIB error mask
- uint8_t getPIBErrorMask(void)
- {
- PLAT_GET_PIB_ERROR_MASK(o_pib_mask);
- return o_pib_mask;
- }
-
- //--------------------------------------------------------------------------
- // Operational Mode Error Functions
- //--------------------------------------------------------------------------
-
- /// @brief Sets the operational mode
- /// @param[in] i_mode The new mode
- // note: this can be moved to a C file if desired
- inline void setOpMode(const OpModes i_mode)
- {
- // Keeps the compiler from complaining about the unused i_mode
- static_cast<void>(i_mode);
-
- // No-op for now. Should set thread-local operational mode
- return;
- }
-
- /// @brief Gets the operational mode
- /// @return the operational mode
- // note: this can be moved to a C file if desired
- inline OpModes getOpMode(void)
- {
- // No-op for now. Should read thread-local operational mode
- return NORMAL;
- }
-
- //--------------------------------------------------------------------------
- // HW Communication Functions
- //--------------------------------------------------------------------------
-
- /// @brief Reads a SCOM register from a chip.
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target HW target to operate on.
- /// @param[in] i_address SCOM register address to read from.
- /// @param[out] o_data Buffer that holds data read from HW target.
- /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- template< TargetType K >
- inline ReturnCode getScom(const Target<K>& i_target, const uint64_t i_address,
- buffer<uint64_t>& o_data)
- {
- fapi2::ReturnCode l_rc;
- PLAT_GETSCOM(l_rc,
- i_target,
- i_address,
- &(o_data()));
-
- return l_rc;
- }
-
- /// @brief Writes a SCOM register on a chip.
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target HW target to operate on.
- /// @param[in] i_address SCOM register address to write to.
- /// @param[in] i_data Buffer that holds data to write into address.
- /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- template< TargetType K >
- inline ReturnCode putScom(const Target<K>& i_target, const uint64_t i_address,
- const buffer<uint64_t> i_data)
- {
- fapi2::ReturnCode l_rc;
- PLAT_PUTSCOM(l_rc,
- i_target,
- i_address,
- i_data());
-
- return l_rc;
- }
-
- /// @brief Read-modify-write a SCOM register on a chip
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target HW target to operate on.
- /// @param[in] i_address SCOM register address to write to.
- /// @param[in] i_data Buffer that holds data to be modified.
- /// @param[in] i_modifyMode The modify mode (or/and/xor).
- /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- template< TargetType K >
- inline ReturnCode modifyScom(const Target<K>& i_target,
- const uint64_t i_address,
- const buffer<uint64_t> i_data,
- const ChipOpModifyMode i_modifyMode)
- {
- fapi2::buffer<uint64_t> l_modifyDataBuffer;
-
- fapi2::ReturnCode l_rc;
- PLAT_GETSCOM(l_rc,
- i_target,
- (uint32_t)(i_address & BITS(40,24)),
- &(l_modifyDataBuffer()));
- if (l_rc) goto __fapi2exit__;
-
- if ( i_modifyMode == CHIP_OP_MODIFY_MODE_OR)
- {
- l_modifyDataBuffer |= i_data;
- }
-
- if ( i_modifyMode == CHIP_OP_MODIFY_MODE_AND)
- {
- l_modifyDataBuffer &= i_data;
- }
-
- if ( i_modifyMode == CHIP_OP_MODIFY_MODE_XOR)
- {
- l_modifyDataBuffer ^= i_data;
- }
-
- PLAT_PUTSCOM(l_rc,
- i_target,
- (uint32_t)(i_address & BITS(40,24)),
- l_modifyDataBuffer());
- if (l_rc) goto __fapi2exit__;
-
-
-__fapi2exit__:
- return l_rc;
-
- }
-
- /// @brief Writes a SCOM register under mask on a chip
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target HW target to operate on.
- /// @param[in] i_address SCOM register address to write to.
- /// @param[in] i_data Buffer that holds data to write into address.
- /// @param[in] i_mask Buffer that holds the mask value.
- /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- template< TargetType K >
- inline ReturnCode putScomUnderMask( const Target<K>& i_target,
- const uint64_t i_address,
- buffer<uint64_t> i_data,
- buffer<uint64_t> i_mask)
- {
- fapi2::buffer<uint64_t> l_modifyDataBuffer = i_data;
-
- l_modifyDataBuffer &= i_mask;
-
- fapi2::ReturnCode l_rc;
- PLAT_PUTSCOM(l_rc,
- i_target,
- (uint32_t)(i_address & BITS(40,24)),
- l_modifyDataBuffer());
-
- return l_rc;
-
- }
-
-
- /// @brief Reads a CFAM register from a chip.
- /// CFAM register is 32-bit wide.
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target HW target to operate on.
- /// @param[in] i_address CFAM register address to read from.
- /// @param[out] o_data Buffer that holds data read from HW target.
- /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- template< TargetType K >
- inline ReturnCode getCfamRegister(const Target<K>& i_target,
- const uint32_t i_address,
- buffer<uint32_t>& o_data)
- {
- PLAT_GETCFAM(i_target.get(),
- (uint32_t)(i_address & BITS(40,24)),
- &(o_data()));
-
- return FAPI2_RC_SUCCESS;
- }
-
- /// @brief Writes a CFAM register on a chip.
- /// CFAM register is 32-bit wide.
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target HW target to operate on.
- /// @param[in] i_address CFAM register address to write to.
- /// @param[in] i_data Buffer that holds data to write into address.
- /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- template< TargetType K >
- inline ReturnCode putCfamRegister(const Target<K>& i_target,
- const uint32_t i_address,
- buffer<uint32_t>& i_data)
- {
- PLAT_PUTCFAM(i_target.get(),
- (uint32_t)(i_address & BITS(40,24)),
- &(i_data()));
-
- return FAPI2_RC_SUCCESS;
- }
-
- /// @brief Read-modify-write a CFAM register on a chip.
- /// CFAM register is 32-bit wide.
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target HW target to operate on.
- /// @param[in] i_address CFAM register address to modify.
- /// @param[in] i_data Buffer that holds data to be modified.
- /// @param[in] i_modifyMode The modify mode (or/and/xor).
- /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- template< TargetType K >
- inline ReturnCode modifyCfamRegister(const Target<K>& i_target,
- const uint32_t i_address,
- const buffer<uint32_t>& i_data,
- const ChipOpModifyMode i_modifyMode)
- {
- PLAT_MODCFAM(i_target.get(),
- (uint32_t)(i_address & BITS(40,24)),
- &(i_data()),
- i_modifyMode);
-
- return FAPI2_RC_SUCCESS;
- }
-
- // variable_buffer isn't supported on PPE
-#ifndef __PPE__
- /// @brief Reads a ring from a chip.
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target Target to operate on.
- /// @param[in] i_address Ring address to read from.
- /// @param[out] o_data Buffer that holds data read from HW target.
- /// @param[in] i_ringMode Ring operation mode.
- /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- template< TargetType K >
- inline ReturnCode getRing(const Target<K>& i_target,
- const scanRingId_t i_address,
- variable_buffer& o_data,
- const RingMode i_ringMode = 0)
- {
- o_data.setBit(0);
- o_data.setBit(3);
-#ifndef __PPE__
- std::cout << std::hex << " getRing "
- << "target: {" << i_target.getType() << ","
- << uint64_t(i_target) << "}; "
- << "ring address: " << i_address << "; "
- << "ring mode: " << i_ringMode << "; "
- << "output data:";
- o_data.print();
-#endif
-
- return FAPI2_RC_SUCCESS;
- }
-
- /// @brief Writes a ring to a chip.
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target Target to operate on.
- /// @param[in] i_address Ring address to write to.
- /// @param[in] i_data Buffer that contains RS4 compressed ring data
- /// to write into address
- /// @param[in] i_ringMode Ring operation mode.
- /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- template< TargetType K >
- inline ReturnCode putRing(const Target<K>& i_target,
- const scanRingId_t i_address,
- variable_buffer& i_data,
- const RingMode i_ringMode = 0)
- {
-
- return FAPI2_RC_SUCCESS;
- }
-
-
- /// @brief Writes a ring to a chip.
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target Target to operate on.
- /// @param[in] i_address Ring address to write to.
- /// @param[in] i_data Pointer to location that contains RS4 compressed
- // ring data to write into address
- /// @param[in] i_ringMode Ring operation mode.
- /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- template< TargetType K >
- inline ReturnCode putRing(const Target<K>& i_target,
- const scanRingId_t i_address,
- const void* i_data,
- const RingMode i_ringMode = 0)
- {
- uint64_t* dataPtr = reinterpret_cast<uint64_t*>(const_cast<void*>(i_data));
-
- return FAPI2_RC_SUCCESS;
- }
-
- /// @brief Read-modify-write a ring on a chip.
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target Target to operate on.
- /// @param[in] i_address Ring address to modify.
- /// @param[in] i_data Buffer that contains RS4 compressed ring data
- /// to be modified.
- /// @param[in] i_modifyMode The modify mode (or/and/xor)
- /// @param[in] i_ringMode Ring operation mode.
- /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- template< TargetType K >
- inline ReturnCode modifyRing(const Target<K>& i_target,
- const scanRingId_t i_address,
- variable_buffer& i_data,
- const ChipOpModifyMode i_modifyMode,
- const RingMode i_ringMode = 0)
- {
-
- return FAPI2_RC_SUCCESS;
- }
-#endif
-
-
-#ifdef FAPI_SUPPORT_MULTI_SCOM
- /// @brief Performs a multiple SCOM operation
- /// This interface performs multiple SCOM operations on a chip in the
- /// order specified by the input MultiScom object.
- /// See fapiMultiScom.H for details of how to populate the MultiScom
- /// object with SCOM operations.
- ///
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target Target to operate on.
- /// @param[in,out] io_multiScomObj Reference to a MultiScom object,
- /// pre-populated with SingleScomInfo entries
- /// to perform multiple SCOMs on input target
- /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- ///
- /// @note This is a synchronous interface and would return after all the
- /// SCOM operations are completed or on the first failed operation
- ///
- /// @note SCOMs will be performed in the order they were added to the
- /// input MultiScom object
- ///
- /// @note In case of errors, the platform code is responsible to collect
- /// and add all the required error info and FFDC into the error data
- /// for debugging
- ///
- /// @note If the SCOM operations added are specific to a processor chip,
- /// then the FSI Shift Engine configured in scatter-gather DMA mode
- /// extension would be used to execute the SCOM operations in a
- /// performance optimize mode. In this mode, the special
- /// SCOM_BULK_READ_MODE and SCOM_BULK_WRITE_MODE operations are
- /// supported that allow a large bulk of SCOM access (in multiple of
- /// 64 bits) for targets that support auto-increment. The
- /// SCOM_WRITE_UNDER_MASK operation is not supported in this mode
- ///
- /// @note If the SCOM operations added are specific to a memory buffer
- /// chip, then the regular SCOM engine is used to execute the SCOM
- /// operations. SCOM_WRITE_UNDER_MASK operation is supported in
- /// this mode, but the special SCOM_BULK_READ_MODE and
- /// SCOM_BULK_WRITE_MODE operations are not supported due to
- /// hardware limitations.
- ///
- template< TargetType K >
- fapi2::ReturnCode multiScom (const Target<K>& i_target,
- MultiScom& io_multiScomObj)
- {
- }
-#endif
-
- // --------------------------------------------------------------------------
- // NOTE:
- // Implement platform Spy access functions if platform supports them.
- // --------------------------------------------------------------------------
-
- // variable_buffer isn't supported on PPE
-#ifndef __PPE__
- /// @brief Reads a spy from a chip.
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target Target to operate on.
- /// @param[in] i_spyId Id of the spy whose data to be read.
- /// @param[out] o_data Buffer that holds data read from HW target.
- /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- ///
- /// @note: The string version is only supported for cronus.
- ///
- /// The fapi design to support both FSP and cronus use of get and
- /// put spy functions is dependant on the SPY names being expanded
- /// to resemble a valid C identifier. This design places some
- /// restrictions on the SPY names which can be used.
- ///
- /// 1. if the spy name contains a # procedure writers should replace
- /// it with an __P__ for example -
- ///
- /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS
- /// becomes
- /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS
- ///
- /// 2. if the spy name has a number following a "." it must have an
- /// underscore prepended to the number.
- ///
- /// EH.TPCHIP.2KX100_ARY_CLK_EDGES_DLY
- /// becomes
- /// EH.TPCHIP._2KX100_ARY_CLK_EDGES_DLY
- ///
- /// Example SPY name:
- /// The hardware procedure should call the function like:
- ///
- /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS
- ///
- /// fapi2::ReturnCode rc = fapiGetSpy( targ,
- /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS, data );
- ///
- /// @note The ID is not in quotes the fapi code will handle adding
- /// the quotes for the cronus environment
- ///
-#ifdef FAPI_SUPPORT_SPY_AS_ENUM
- template< TargetType K >
- inline ReturnCode getSpy(const Target<K>& i_target,
- const spyId_t i_spyId,
- variable_buffer& o_data)
- {
- static_assert(K == 0, "implement getSpy (string)");
- return ~FAPI2_RC_SUCCESS;
- }
-#endif
-#ifdef FAPI_SUPPORT_SPY_AS_STRING
- template< TargetType K >
- inline ReturnCode getSpy(const Target<K>& i_target,
- const char * const i_spyId,
- variable_buffer& o_data)
- {
- static_assert(K == 0, "implement getSpy (string)");
- return ~FAPI2_RC_SUCCESS;
- }
-#endif
- /// @brief Writes a spy on a chip.
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target Target to operate on.
- /// @param[in] i_spyId Id of the spy to write data to.
- /// @param[out] i_data Buffer that holds data to write into spy.
- /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- ///
- /// @note: The string version is only supported for cronus.
- ///
- /// The fapi design to support both FSP and cronus use of get and
- /// put spy functions is dependent on the SPY names being expanded
- /// to resemble a valid C identifier. This design places some
- /// restrictions on the SPY names which can be used.
- ///
- /// 1. if the spy name contains a # procedure writers should replace
- /// is with an __P__ for example -
- ///
- /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS
- /// becomes
- /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS
- ///
- /// 2. if the spy name has a number following a "." it must have an
- /// underscore prepended to the number.
- ///
- /// EH.TPCHIP.2KX100_ARY_CLK_EDGES_DLY
- /// becomes
- /// EH.TPCHIP._2KX100_ARY_CLK_EDGES_DLY
- ///
- /// Example SPY name:
- /// The hardware procedure should call the function like:
- ///
- /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS
- ///
- /// fapi2::ReturnCode rc = fapiPutSpy( targ,
- /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS, data );
- ///
- /// @note The ID is not in quotes the fapi code will handle adding
- /// the quotes for the cronus environment
- ///
-#ifdef FAPI_SUPPORT_SPY_AS_ENUM
- template< TargetType K >
- inline ReturnCode putSpy(const Target<K>& i_target,
- const spyId_t i_spyId,
- variable_buffer& i_data)
- {
- static_assert(K == 0, "implement putSpy (enum)");
- return ~FAPI2_RC_SUCCESS;
- }
-#endif
-#ifdef FAPI_SUPPORT_SPY_AS_STRING
- template< TargetType K >
- inline ReturnCode putSpy(const Target<K>& i_target,
- const char* const i_spyId,
- variable_buffer& i_data)
- {
- static_assert(K == 0, "implement putSpy (string)");
- return ~FAPI2_RC_SUCCESS;
- }
-#endif
- /// @brief Writes spy data into a buffer holding ring data image
- /// This API is used by L2/L3 repair to put column repair data
- /// into a ring buffer image.
- /// @tparam K template parameter, passed in target.
- /// @param[in] i_target Target to operate on.
- /// @param[in] i_spyId Id of the spy.
- /// @param[in] i_data Buffer that holds spy data to write into ring
- /// image.
- /// @param[out] o_data Buffer that holds updated ring image.
- /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- ///
- /// @note: The string version is only supported for cronus.
- ///
- /// The fapi design to support both FSP and cronus use of get and
- /// put spy functions is dependent on the SPY names being expanded
- /// to resemble a valid C identifier. This design places some
- /// restrictions on the SPY names which can be used.
- ///
- /// See fapiPutSpy for details on spy id specifics.
- ///
-#ifdef FAPI_SUPPORT_SPY_AS_ENUM
- template< TargetType K >
- inline ReturnCode putSpyImage(const Target<K>& i_target,
- const spyId_t i_spyId,
- const variable_buffer& i_data,
- variable_buffer& o_imageData)
- {
- static_assert(K == 0, "implement putSpyImage (enum)");
- return ~FAPI2_RC_SUCCESS;
- }
-#endif
-#ifdef FAPI_SUPPORT_SPY_AS_STRING
- template< TargetType K >
- inline ReturnCode putSpyImage(const Target<K>& i_target,
- const char* const i_spyId,
- const variable_buffer& i_data,
- variable_buffer& o_imageData)
- {
- static_assert(K == 0, "implement putSpyImage (string)");
- return ~FAPI2_RC_SUCCESS;
- }
-#endif
- /// @brief Reads spy data from a ring image buffer
- /// @param[in] i_target Target to operate on
- /// @param[in] i_spyId The spy's id
- /// @param[out] o_data Buffer that holds data read from ring image.
- /// @param[in] i_imageData Buffer that holds ring image to read data
- /// from.
- /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
- ///
- /// @note: The string version is only supported for cronus.
- ///
- /// The fapi design to support both FSP and cronus use of get and
- /// put spy functions is dependent on the SPY names being expanded
- /// to resemble a valid C identifier. This design places some
- /// restrictions on the SPY names which can be used.
- ///
- /// See fapiPutSpy for details on spy id specifics.
- ///
-#ifdef FAPI_SUPPORT_SPY_AS_ENUM
- template< TargetType K >
- inline ReturnCode getSpyImage(const Target<K>& i_target,
- const spyId_t i_spyId,
- variable_buffer& o_data,
- const variable_buffer& i_imageData)
- {
- static_assert(K == 0, "implement getSpyImage (enum)");
- return ~FAPI2_RC_SUCCESS;
- }
-#endif
-#ifdef FAPI_SUPPORT_SPY_AS_STRING
- template< TargetType K >
- inline ReturnCode getSpyImage(const Target<K>& i_target,
- const char * const i_spyId,
- variable_buffer& o_data,
- const variable_buffer& i_imageData)
- {
- static_assert(K == 0, "implement getSpyImage (string)");
- return ~FAPI2_RC_SUCCESS;
- }
-#endif
-
-#endif // PPE
-
-};
-
-#endif // _FAPI2_HWACCESS_H_
diff --git a/src/ppe/sbe/plat/include/plat_error_scope.H b/src/ppe/sbe/plat/include/plat_error_scope.H
deleted file mode 100644
index a44ba74..0000000
--- a/src/ppe/sbe/plat/include/plat_error_scope.H
+++ /dev/null
@@ -1,71 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/plat/include/plat_error_scope.H $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2012,2015 */
-/* [+] 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_error_scope.H
- * @brief platform definitions which create a scope for automatic error handling
- */
-
-#ifndef __FAPI2_PLAT_ERROR_SCOPE__
-#define __FAPI2_PLAT_ERROR_SCOPE__
-
-/// @cond
-#define PLAT_FAPI_TRY_NO_TRACE( __operation__ ) \
- if ((fapi2::current_err = (__operation__)) != fapi2::FAPI2_RC_SUCCESS) \
- { \
- goto fapi_try_exit; \
- }
-
-#define PLAT_FAPI_TRY_TRACE( __operation__, ... ) \
- if ((fapi2::current_err = (__operation__)) != fapi2::FAPI2_RC_SUCCESS) \
- { \
- FAPI_ERR(__VA_ARGS__); \
- goto fapi_try_exit; \
- }
-
-///
-/// @brief Assert a conditional is true.
-/// If it is not, the FFDC gathering function is called and the
-/// trace is output as a FAPI error trace.
-/// @param[in] __conditional__ the condition to assert
-/// @param[in] __ffdc__ the FFDC gathering function
-/// @param[in] ... varargs, as input to FAPI_ERR
-///
-#define PLAT_FAPI_ASSERT( __conditional__, __ffdc__, ... ) \
- if (! (__conditional__)) \
- { \
- (__ffdc__).execute(); \
- FAPI_ERR(__VA_ARGS__); \
- goto fapi_try_exit; \
- }
-
-
-///
-/// @brief Temporary macro for error label until all are removed.
-/// @todo REMOVE this in time.
-#define FAPI_CLEANUP() \
-fapi_try_exit:
-/// @endcond
-
-#endif
diff --git a/src/ppe/sbe/plat/include/plat_hw_access.H b/src/ppe/sbe/plat/include/plat_hw_access.H
deleted file mode 100644
index f8efc4f..0000000
--- a/src/ppe/sbe/plat/include/plat_hw_access.H
+++ /dev/null
@@ -1,94 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/plat/include/plat_hw_access.H $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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_hw_access.H
- *
- * @brief Define platform specific calls for hardware accesses.
- */
-
-#ifndef PLATHWACCESS_H_
-#define PLATHWACCESS_H_
-
-#include <plat_includes.H>
-
-/// PIB Error Mask
-
-#define PLAT_SET_PIB_ERROR_MASK(_m_mask) \
- { /* Read MSR */ \
- uint32_t msr_data = mfmsr(); \
- /* Set SEM field */ \
- msr_data &= ~(BITS(0,8)); \
- msr_data |= (uint32_t)(i_mask << 24); \
- /* Write MSR */ \
- mtmsr(msr_data); \
- };
-
-#define PLAT_GET_PIB_ERROR_MASK(_m_mask) \
- uint8_t _m_mask; \
- uint32_t _sem = mfmsr(); \
- _m_mask = (uint8_t)((_sem & MSR_SEM) >> (32-(MSR_SEM_START_BIT + MSR_SEM_LEN)));
-
-// Building block PPE instructions
-#define PPE_MFMSR(_m_data) \
-asm volatile \
- ( \
- "mfmsr %[data] \n" \
- : [data]"=&r"(*_m_data) \
- : "[data]"(*_m_data) \
- );
-
-#define PPE_MTMSR(_m_data) \
-asm volatile \
- ( \
- "mtmsr %[data] \n" \
- : [data]"=&r"(*_m_data) \
- : "[data]"(*_m_data) \
- );
-
-/// GetScom
-#define PLAT_GETSCOM(_m_rc, _m_base, _m_offset, _m_data) \
- _m_rc = getscom(_m_base.getAddressOverlay(), (uint32_t)(_m_offset & BITS(40,24)), _m_data);
-
-/// PutScom
-#define PLAT_PUTSCOM(_m_rc, _m_base, _m_offset, _m_data) \
- _m_rc = putscom(_m_base.getAddressOverlay(), (uint32_t)(_m_offset & BITS(40,24)), _m_data);
-
-/// GetCFAM
-#define PLAT_GETCFAM(_m_base, _m_offset, _m_data) \
- static_assert( K == TARGET_TYPE_NONE, \
- "getCfamRegister is not supported by PPE platforms")
-
-/// PutCFAM
-#define PLAT_PUTCFAM(_m_base, _m_offset, _m_data) \
- static_assert( K == TARGET_TYPE_NONE, \
- "putCfamRegister is not supported by PPE platforms")
-
-/// ModifyCFAM
-#define PLAT_MODCFAM(_m_base, _m_offset, _m_data, _m_mode) \
- static_assert( K == TARGET_TYPE_NONE, \
- "modifyCfamRegister is not supported by PPE platforms")
-
-#endif // PLATHWACCESS_H_
-
diff --git a/src/ppe/sbe/plat/src/Makefile b/src/ppe/sbe/plat/src/Makefile
deleted file mode 100644
index fe2b991..0000000
--- a/src/ppe/sbe/plat/src/Makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/ppe/sbe/plat/src/Makefile $
-#
-# OpenPOWER OnChipController Project
-#
-# Contributors Listed Below - COPYRIGHT 2015
-# [+] 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
- $(AR) crs $(OBJDIR)/libfapi2.a $(OBJDIR)/*.o
-
-.PHONY: clean fapi2 hwpf
-fapi2: $(OBJS)
-
-#plat:
-# $(MAKE) -I $(IMAGE_SRCDIR) -C $(PLAT_FAPI2_DIR)
-
-hwpf:
- @echo "Processing fapi2 hwpf makefile"
- $(MAKE) -I $(IMAGE_SRCDIR) -C $(PPE_FAPI2_DIR)/src
-
-$(OBJS) $(OBJS:.o=.d): | $(OBJDIR)
-
-$(OBJDIR):
- mkdir -p $(OBJDIR)
-
-ifneq ($(MAKECMDGOALS),clean)
-include $(OBJS:.o=.d)
-endif
-
diff --git a/src/ppe/sbe/plat/src/fapi2sbefiles.mk b/src/ppe/sbe/plat/src/fapi2sbefiles.mk
deleted file mode 100644
index 0a8fa50..0000000
--- a/src/ppe/sbe/plat/src/fapi2sbefiles.mk
+++ /dev/null
@@ -1,49 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/ppe/sbe/plat/src/fapi2sbefiles.mk $
-#
-# OpenPOWER OnChipController Project
-#
-# Contributors Listed Below - COPYRIGHT 2015
-# [+] 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 +=
-FAPI2-S-SOURCES =
-
-
-FAPI2LIB_OBJECTS += $(FAPI2-C-SOURCES:.C=.o) $(FAPI2-S-SOURCES:.S=.o)
-
diff --git a/src/ppe/sbe/plat/src/return_code.C b/src/ppe/sbe/plat/src/return_code.C
deleted file mode 100644
index 1db9522..0000000
--- a/src/ppe/sbe/plat/src/return_code.C
+++ /dev/null
@@ -1,47 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/plat/src/return_code.C $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2012,2015 */
-/* [+] 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;
- }
-
-}
diff --git a/src/ppe/sbe/sample/Makefile b/src/ppe/sbe/sample/Makefile
deleted file mode 100644
index 8bf74a0..0000000
--- a/src/ppe/sbe/sample/Makefile
+++ /dev/null
@@ -1,100 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/ppe/sbe/sample/Makefile $
-#
-# OpenPOWER OnChipController Project
-#
-# Contributors Listed Below - COPYRIGHT 2015
-# [+] 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
-#remove this once we have a real compiler
-export P2P_ENABLE = 1
-
-#Pull in the definitions that affect all makefiles for this image
-include img_defs.mk
-
-#Pull in object file names for the top directory
-include topfiles.mk
-
-ifdef P2P_ENABLE
-include $(P2P_SRCDIR)/p2pfiles.mk
-endif
-
-PK_MAKE_DIR := $(PK_SRCDIR)/$(PPE_TYPE)
-OBJS := $(addprefix $(OBJDIR)/, $(TOP_OBJECTS))
-PKLIB := $(OBJDIR)/pk/libpk.a
-
-LIB_DIRS = -L$(OBJDIR)/pk #-L$(OBJDIR)/commonlib
-LINK_OBJS = $(OBJS) $(PKLIB) #$(COMMONLIB)
-LINK_SCRIPT = $(addprefix $(OBJDIR)/, linkscript)
-
-ifdef P2P_ENABLE
-P2PLIB := $(OBJDIR)/p2p/libp2p.a
-LIB_DIRS += -L$(OBJDIR)/p2p
-LINK_OBJS += $(P2PLIB)
-endif
-
-#default target is to make a binary application image
-#This removes all unecessary headers from the ELF executable
-$(OBJDIR)/$(IMAGE_NAME).bin $(OBJDIR)/$(IMAGE_NAME).dis: $(OBJDIR)/$(IMAGE_NAME).out
- $(OBJCOPY) -O binary $< $(OBJDIR)/$(IMAGE_NAME).bin
- $(OBJDUMP) -S $< > $(OBJDIR)/$(IMAGE_NAME).dis
-
-#create a linked ELF executable
-$(OBJDIR)/$(IMAGE_NAME).out: $(LINK_OBJS) $(LINK_SCRIPT)
- $(LD) -e __system_reset -T$(LINK_SCRIPT) -Map $(OBJDIR)/$(IMAGE_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_NAME).out $(LIB_DIRS) $(OBJS) -lpk -lp2p #-lcommon
-
-#pass the link command file through the C preprocessor to evaluate macros and remove comments
-$(LINK_SCRIPT): link.cmd
- $(CPP) -E -x c++ -P $(DEFS) link.cmd -o $(LINK_SCRIPT)
-
-#Create an obj directory if needed
-$(LINK_OBJS) $(OBJS) $(OBJS:.o=.d): | $(OBJDIR)
-
-$(OBJDIR):
- mkdir -p $(OBJDIR)
-
-.PHONY: clean $(PKLIB) $(P2PLIB)
-
-#Build macro-specific kernel code
-$(PKLIB):
- $(MAKE) -I $(IMAGE_SRCDIR) -C $(PK_MAKE_DIR)
-
-#Build the code that is common for all processors (PPEs and 405)
-#$(COMMONLIB):
-# $(MAKE) -I $(IMAGE_SRCDIR) -C $(COMMONLIB_SRCDIR)
-
-ifdef P2P_ENABLE
-$(P2PLIB):
- $(MAKE) -I $(IMAGE_SRCDIR) -C $(P2P_SRCDIR)
-endif
-
-# collect all of the trace hash files for this image into a single trexStringFile
-.PHONY : tracehash
-tracehash:
- mkdir -p $(OBJDIR)
- $(THASH) -c -d $(OBJDIR) -s $(OBJDIR)/trexStringFile
-
-#clean the kernel directory first, then the application level clean
-clean:
- rm -fr $(OBJDIR)
-
-#Add dependencies to header files
-ifneq ($(MAKECMDGOALS),clean)
-include $(OBJS:.o=.d)
-endif
diff --git a/src/ppe/sbe/sample/img_defs.mk b/src/ppe/sbe/sample/img_defs.mk
deleted file mode 100644
index 7211acb..0000000
--- a/src/ppe/sbe/sample/img_defs.mk
+++ /dev/null
@@ -1,265 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/ppe/sbe/sample/img_defs.mk $
-#
-# OpenPOWER OnChipController Project
-#
-# Contributors Listed Below - COPYRIGHT 2015
-# [+] 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
-# Make header for GPE PK builds
-#
-# The application may define the following variables to control the
-# build process:
-#
-# IMG_INCLUDES : Aplication-specific header search paths
-#
-# DEFS : A string of -D<symbol>[=<value>] to control compilation
-#
-# PK : Default ..; The path to the PK source code.
-# The default is set for building the PK
-# subdirectories.
-#
-# PK_THREAD_SUPPORT : (0/1, default 1); Compile PK thread and
-# semaphore suppprt
-#
-# PK_TIMER_SUPPORT : (0/1, default 1); Compile PK timer suppprt
-#
-# SIMICS_ENVIRONMENT : (0/1, current default 0); Compile for Simics
-#
-# SIMICS_MAGIC_PANIC : (0/1, current default 0); Use Simics Magic
-# breakpoint for PK_PANIC() instead of PowerPC trap.
-# Note that Simics does not model trap correctly in
-# external debug mode.
-#
-# GCC-O-LEVEL : The optimization level passed to GCC (default -Os). May
-# also be defined empty (GCC-O-LEVEL=) to disable
-# optimization. This variable can also be used to pass
-# any other non-default setting to GCC, e.g.
-# make GCC-O-LEVEL="-Os -fno-branch-count-reg"
-#
-# GCC-TOOL-PREFIX : The full path (including executable file prefixes) to
-# the GCC cross-development tools to use. The default is
-# "ppcnf-mcp5-"
-#
-# CTEPATH : This variable defaults to the afs/awd CTE tool
-# installation - The PORE binutils are stored there. If
-# you are not in Austin be sure to define CTEPATH in
-# your .profile.
-#
-# OBJDIR : target directory for all generated files
-
-IMAGE_NAME := sample_ppe
-
-PPE_TYPE := ppe
-
-ifndef IMAGE_SRCDIR
-export IMAGE_SRCDIR = $(abspath .)
-endif
-
-ifndef IMG_INCLUDES
-export IMG_INCLUDES = -I$(IMAGE_SRCDIR)
-endif
-
-ifndef BASE_OBJDIR
-export BASE_OBJDIR = $(abspath ../../../obj)
-endif
-
-export IMG_OBJDIR = $(BASE_OBJDIR)/$(IMAGE_NAME)
-
-ifndef PK_SRCDIR
-export PK_SRCDIR = $(abspath ../../pk)
-endif
-
-ifndef GCC-TOOL-PREFIX
-#GCC-TOOL-PREFIX = $(CTEPATH)/tools/ppcgcc/prod/bin/powerpc-linux-
-GCC-TOOL-PREFIX = /afs/bb/u/rembold/openpower/op-build/output/host/usr/bin/powerpc64-linux-
-#GCC-TOOL-PREFIX = /afs/bb/u/rembold/openpower/op-build/buildroot/output/host/usr/bin/powerpc-linux-
-#GCC-TOOL-PREFIX = /afs/bb/u/rembold/openpower/op-build/output/host/usr/powerpc64-buildroot-linux-gnu/bin/
-#GCC-TOOL-PREFIX = /afs/bb/u/rembold/openpower/opcustom/op-build/buildroot/output/host/usr/bin/powerpc-linux-
-endif
-
-ifndef BINUTILS-TOOL-PREFIX
-BINUTILS-TOOL-PREFIX = $(CTEPATH)/tools/ppetools/prod/powerpc-eabi/bin/
-endif
-
-ifndef P2P_SRCDIR
-export P2P_SRCDIR = $(abspath ../../tools/PowerPCtoPPE)
-endif
-
-ifndef PPETRACEPP_DIR
-export PPETRACEPP_DIR = $(abspath ../../tools/ppetracepp)
-endif
-
-OBJDIR = $(BASE_OBJDIR)$(SUB_OBJDIR)
-
-
-CC_ASM = $(GCC-TOOL-PREFIX)gcc
-TCC = $(PPETRACEPP_DIR)/ppetracepp $(GCC-TOOL-PREFIX)gcc
-CC = $(GCC-TOOL-PREFIX)gcc
-AS = $(BINUTILS-TOOL-PREFIX)as
-AR = $(BINUTILS-TOOL-PREFIX)ar
-LD = $(BINUTILS-TOOL-PREFIX)ld
-OBJDUMP = $(BINUTILS-TOOL-PREFIX)objdump
-OBJCOPY = $(BINUTILS-TOOL-PREFIX)objcopy
-TCPP = $(PPETRACEPP_DIR)/ppetracepp $(GCC-TOOL-PREFIX)gcc
-THASH = $(PPETRACEPP_DIR)/tracehash.pl
-CPP = $(GCC-TOOL-PREFIX)gcc
-
-ifdef P2P_ENABLE
-PCP = $(P2P_SRCDIR)/ppc-ppe-pcp.py
-endif
-
-
-ifndef CTEPATH
-$(warning The CTEPATH variable is not defined; Defaulting to /afs/awd)
-export CTEPATH = /afs/awd/projects/cte
-endif
-
-ifeq "$(PK_TIMER_SUPPORT)" ""
-PK_TIMER_SUPPORT = 1
-endif
-
-ifeq "$(PK_THREAD_SUPPORT)" ""
-PK_THREAD_SUPPORT = 1
-endif
-
-ifeq "$(PK_TRACE_SUPPORT)" ""
-PK_TRACE_SUPPORT = 1
-endif
-
-# Generate a 16bit trace string hash prefix value based on the name of this image. This will form
-# the upper 16 bits of the 32 bit trace hash values.
-ifndef PK_TRACE_HASH_PREFIX
-PK_TRACE_HASH_PREFIX := $(shell echo $(IMAGE_NAME) | md5sum | cut -c1-4 | xargs -i printf "%d" 0x{})
-endif
-
-
-ifndef GCC-O-LEVEL
-#GCC-O-LEVEL = -Os
-GCC-O-LEVEL = -O -g
-endif
-
-GCC-DEFS += -DIMAGE_NAME=$(IMAGE_NAME)
-GCC-DEFS += -DPK_TIMER_SUPPORT=$(PK_TIMER_SUPPORT)
-GCC-DEFS += -DPK_THREAD_SUPPORT=$(PK_THREAD_SUPPORT)
-GCC-DEFS += -DPK_TRACE_SUPPORT=$(PK_TRACE_SUPPORT)
-GCC-DEFS += -DPK_TRACE_HASH_PREFIX=$(PK_TRACE_HASH_PREFIX)
-GCC-DEFS += -D__PK__=1
-DEFS += $(GCC-DEFS)
-
-############################################################################
-
-INCLUDES += $(IMG_INCLUDES) \
- -I$(PK_SRCDIR)/kernel -I$(PK_SRCDIR)/ppe42 -I$(PK_SRCDIR)/trace \
- -I$(PK_SRCDIR)/$(PPE_TYPE) -I$(PK_SRCDIR)/../include \
- -I$(PK_SRCDIR)/../tools/ppetracepp
-
-PIPE-CFLAGS = -pipe -Wa,-m405
-
-GCC-CFLAGS += -Wall -fsigned-char -msoft-float \
- -mcpu=405 -m32 -mmulhw -mmultiple \
- -meabi -msdata=eabi \
- -ffreestanding -fno-common -Werror \
- -fno-inline-functions-called-once \
- -ffixed-r11 -ffixed-r12 \
- -ffixed-r14 -ffixed-r15 -ffixed-r16 -ffixed-r17 \
- -ffixed-r18 -ffixed-r19 -ffixed-r20 -ffixed-r21 \
- -ffixed-r22 -ffixed-r23 -ffixed-r24 -ffixed-r25 \
- -ffixed-r26 -ffixed-r27 \
- -ffixed-cr1 -ffixed-cr2 -ffixed-cr3 -ffixed-cr4 \
- -ffixed-cr5 -ffixed-cr6 -ffixed-cr7 #-lstdc++
-
-
-CFLAGS = -c $(GCC-CFLAGS) $(PIPE-CFLAGS) $(GCC-O-LEVEL) $(INCLUDES)
-
-CPPFLAGS = -E
-
-ASFLAGS = -mppe42
-
-ifdef P2P_ENABLE
-#use this to disable optimizations (fused compare/branch etc.)
-PCP-FLAG =
-
-#use this to enable optimizations
-#PCP-FLAG =
-endif
-############################################################################
-
-#override the GNU Make implicit rule for going from a .C to a .o
-%.o: %.C
-
-$(OBJDIR)/%.s: %.C
- $(TCC) $(CFLAGS) $(DEFS) -S -o $@ $<
-
-
-#override the GNU Make implicit rule for going from a .c to a .o
-%.o: %.c
-
-$(OBJDIR)/%.s: %.c
- $(TCC) $(CFLAGS) $(DEFS) -S -o $@ $<
-
-#override the GNU Make implicit rule for going from a .S to a .o
-%.o: %.S
-
-$(OBJDIR)/%.s: %.S
- $(TCPP) $(CFLAGS) $(DEFS) $(CPPFLAGS) -o $@ $<
-.PRECIOUS: $(OBJDIR)/%.s
-
-ifndef P2P_ENABLE
-
-$(OBJDIR)/%.o: $(OBJDIR)/%.s
- $(AS) $(ASFLAGS) -o $@ $<
-
-else
-
-$(OBJDIR)/%.es: $(OBJDIR)/%.s
- $(PCP) $(PCP-FLAG) -f $<
-.PRECIOUS: $(OBJDIR)/%.es
-
-$(OBJDIR)/%.o: $(OBJDIR)/%.es
- $(AS) $(ASFLAGS) -o $@ $<
-
-endif
-
-# From the GNU 'Make' manual - these scripts uses the preprocessor to
-# create dependency files (*.d), then mungs them slightly to make them
-# work as Make targets. The *.d files are include-ed in the
-# subdirectory Makefiles.
-
-$(OBJDIR)/%.d: %.C
- @set -e; rm -f $@; \
- echo -n "$(OBJDIR)/" > $@.$$$$; \
- $(CC_ASM) -MM $(INCLUDES) $(CPPFLAGS) $(DEFS) $< >> $@.$$$$; \
- sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
- rm -f $@.$$$$
-
-$(OBJDIR)/%.d: %.c
- @set -e; rm -f $@; \
- echo -n "$(OBJDIR)/" > $@.$$$$; \
- $(CC_ASM) -MM $(INCLUDES) $(CPPFLAGS) $(DEFS) $< >> $@.$$$$; \
- sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
- rm -f $@.$$$$
-
-$(OBJDIR)/%.d: %.S
- @set -e; rm -f $@; \
- echo -n "$(OBJDIR)/" > $@.$$$$; \
- $(CC_ASM) -MM $(INCLUDES) $(CPPFLAGS) $(DEFS) $< >> $@.$$$$; \
- sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
- rm -f $@.$$$$
-
diff --git a/src/ppe/sbe/sample/link.cmd b/src/ppe/sbe/sample/link.cmd
deleted file mode 100644
index c3bff22..0000000
--- a/src/ppe/sbe/sample/link.cmd
+++ /dev/null
@@ -1,92 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sample/link.cmd $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 */
-
-// Need to do this so that elf32-powerpc is not modified!
-#undef powerpc
-
-#ifndef INITIAL_STACK_SIZE
-#define INITIAL_STACK_SIZE 256
-#endif
-
-OUTPUT_FORMAT(elf32-powerpc);
-
-MEMORY
-{
- sram : ORIGIN = 0xFFF40000, LENGTH = 0xc0000
-}
-
-SECTIONS
-{
- . = 0xfff40000;
- .text : {. = ALIGN(512); *(.vectors) *(.text)} > sram
-
- ////////////////////////////////
- // Read-only Data
- ////////////////////////////////
-
- . = ALIGN(8);
- _RODATA_SECTION_BASE = .;
-
- // SDA2 constant sections .sdata2 and .sbss2 must be adjacent to each
- // other. Our SDATA sections are small so we'll use strictly positive
- // offsets.
-
- _SDA2_BASE_ = .;
- .sdata2 . : { *(.sdata2) } > sram
- .sbss2 . : { *(.sbss2) } > sram
-
- // Other read-only data.
-
- .rodata . : { *(.rodata*) *(.got2) } > sram
-
- _RODATA_SECTION_SIZE = . - _RODATA_SECTION_BASE;
-
- ////////////////////////////////
- // Read-write Data
- ////////////////////////////////
-
- . = ALIGN(8);
- _DATA_SECTION_BASE = .;
-
- // SDA sections .sdata and .sbss must be adjacent to each
- // other. Our SDATA sections are small so we'll use strictly positive
- // offsets.
-
- _SDA_BASE_ = .;
- .sdata . : { *(.sdata) } > sram
- .sbss . : { *(.sbss) } > sram
-
- // Other read-write data
- // It's not clear why boot.S is generating empty .glink,.iplt
-
- .rela . : { *(.rela*) } > sram
- .rwdata . : { *(.data) *(.bss) } > sram
-// .iplt . : { *(.iplt) } > sram
-
- _PK_INITIAL_STACK_LIMIT = .;
- . = . + INITIAL_STACK_SIZE;
- _PK_INITIAL_STACK = . - 1;
-
-}
diff --git a/src/ppe/sbe/sample/pk_scom.c b/src/ppe/sbe/sample/pk_scom.c
deleted file mode 100644
index 6b2c0b9..0000000
--- a/src/ppe/sbe/sample/pk_scom.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sample/pk_scom.c $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 */
-//-----------------------------------------------------------------------------
-// *! (C) Copyright International Business Machines Corp. 2014
-// *! All Rights Reserved -- Property of IBM
-// *! *** IBM Confidential ***
-//-----------------------------------------------------------------------------
-
-/// \file pk_scom.c
-/// \brief Lowest level SCOM definitions.
-///
-/// A fapi-level SCOM should call these functions.
-///
-/// Todo:
-/// - Poll PCB master for SCOM completion.
-/// - Return error code of SCOM fails.
-/// - Return error code if SCOM input parms violate rules.
-
-#include "pk.h"
-#include "pk_scom.h"
-
-uint32_t putscom( uint32_t i_chiplet_id, uint32_t i_address, uint64_t i_data)
-{
- uint32_t l_cid=0;
-
- // CMO-Declaring variables tied to specific registers enables us to protect
- // the SCOM data and address variables used in the new stvd and lvd 64-bit
- // data instructions. This protection is needed since the new instructions
- // are not yet properly considered by the compiler.
- // l_dataH is used to represent the "beginning" of the 64-bit data in d8
- // (i.e., r8+r9).
- uint32_t register l_dataH asm("r8")=0;
- uint32_t register l_dataL asm("r9")=0;
- uint32_t register l_addr_eff asm("r10")=0;
- uint32_t register l_scratch asm("r31")=0;
-
- if (i_chiplet_id)
- {
- // Accommodate two different ways of supplying the chiplet ID:
- // 0xNN000000: Only bits in high-order two nibbles : Valid
- // 0x000000NN: Only bits in low-order two nibbles : Valid
- //
- if ((i_chiplet_id & 0xFF000000) == i_chiplet_id)
- {
- // Valid: Chiplet ID in high-order two nibbles.
- l_cid = i_chiplet_id;
- }
- else if ((i_chiplet_id & 0x000000FF) == i_chiplet_id)
- {
- // Valid: Chiplet ID in low-order two nibbles. Convert to high-order.
- l_cid = i_chiplet_id << 24;
- }
- else
- {
- // Invalid: Invalid type of chiplet ID
- PK_TRACE("putscom() : Invalid value of i_chiplet_id (=0x%08X)",i_chiplet_id);
- return 1; //CMO-improve Return sensible rc here.
- }
-
- l_addr_eff = (i_address & 0x00FFFFFF) | l_cid;
- }
- else
- {
- // Chiplet ID is zero. Accept address as is.
- // This is useful for PIB addresses and non-EX chiplets, and even for
- // EX chiplets if the fully qualified EX chiplet addr is already known.
- l_addr_eff = i_address;
-
- }
-
- l_dataH = (uint32_t)(i_data>>32);
- l_dataL = (uint32_t)(i_data);
-
- // CMO-The following sequence forces usage of l_dataH/L and l_addr_eff
- // and thus the population of them as well.
- // Further note that unless l_dataH/L are placed right before the following
- // sequence, more specifically, if they're placed at the top of putscom(),
- // r8, or l_dataH, might be overwritten in the if(chiplet_id) section.
- // Secondly, we test l_addr_eff for non-zero through the CR0 register
- // (which was populated in the "mr." instruction.) This is to convince the
- // compiler that we actually used l_addr_eff for something.
- // At present the test result causes no action except to execute the stvd
- // instruction in either case.
- asm volatile ( \
- "mr. %0, %1 \n" \
- : "=r"(l_scratch) \
- : "r"(l_dataH) );
- asm volatile ( \
- "mr. %0, %1 \n" \
- : "=r"(l_scratch) \
- : "r"(l_dataL) );
- asm volatile ( \
- "mr. %0, %1 \n" \
- : "=r"(l_scratch) \
- : "r"(l_addr_eff) );
- asm volatile ( \
- "beq 0x4 \n" );
-
-
-/* asm volatile ( \
- "stw %[data], 0(%[effective_address]) \n" \
- : [data]"=r"(l_dataH) \
- : [effective_address]"r"(l_addr_eff) );
-*/
- // CMO-This instruction is not fully supported by the compiler (as of
- // 20150108):
- // - Correct: It is correctly translated into the proper OP code
- // format.
- // - Incorrect: The compiler does not seem to recognize the usage
- // of the two l_xyz variables in that it doesn't
- // know prior to this command that the registers that
- // contain the values of l_xyz need to be protected
- // up to this point. Thus, we are forced to use those
- // two l_xyz variables in some dummy instructions just
- // before this point in order to protect them.
- asm volatile ( \
- "stvd %[data], 0(%[effective_address]) \n" \
- : [data]"=r"(l_dataH) \
- : [effective_address]"r"(l_addr_eff) );
-
- // CMO-TBD
- // Check PIB response code in 0x00001007(17:19)
- // Translate PIB rc to PK rc
- // Does this rc get reset to zero on success?
- // Do we need to check this rc prior to issuing the SCOM?
-
- return 0;
-}
-
-
-uint32_t getscom( uint32_t i_chiplet_id, uint32_t i_address, uint64_t *o_data)
-{
- uint32_t l_cid=0;
-
- // CMO-Declaring variables tied to specific registers enables us to protect
- // the SCOM data and address variables used in the new stvd and lvd 64-bit
- // data instructions. This protection is needed since the new instructions
- // are not yet properly considered by the compiler.
- // l_dataH is used to represent the "beginning" of the 64-bit data in d8
- // (i.e., r8+r9).
- uint32_t register l_dataH asm("r8")=0;
- uint32_t register l_dataL asm("r9")=0;
- uint32_t register l_addr_eff asm("r10")=0;
- uint32_t register l_scratch asm("r31")=0;
-
- if (i_chiplet_id)
- {
- // Accommodate two different ways of supplying the chiplet ID:
- // 0xNN000000: Only bits in high-order two nibbles : Valid
- // 0x000000NN: Only bits in low-order two nibbles : Valid
- //
- if ((i_chiplet_id & 0xFF000000) == i_chiplet_id)
- {
- // Valid: Chiplet ID in high-order two nibbles.
- l_cid = i_chiplet_id;
- }
- else if ((i_chiplet_id & 0x000000FF) == i_chiplet_id)
- {
- // Valid: Chiplet ID in low-order two nibbles. Convert to high-order.
- l_cid = i_chiplet_id << 24;
- }
- else
- {
- // Invalid: Invalid type of chiplet ID
- PK_TRACE("getscom() : Invalid value of i_chiplet_id (=0x%08X)",i_chiplet_id);
- return 1; //CMO-improve Return sensible rc here.
- }
-
- l_addr_eff = (i_address & 0x00FFFFFF) | l_cid;
- }
- else
- {
- // Chiplet ID is zero. Accept address as is.
- // This is useful for PIB addresses and non-EX chiplets, and even for
- // EX chiplets if the fully qualified EX chiplet addr is already known.
- l_addr_eff = i_address;
- }
-
- // CMO-The following sequence forces usage of l_addr_eff and thus the
- // population of it as well.
- // Secondly, we test l_addr_eff for non-zero through the CR0 register
- // (which was populated in the "mr." instruction.) This is to convince the
- // compiler that we actually used l_addr_eff for something.
- // At present the test result causes no action except to execute the lvd
- // instruction in either case.
- asm volatile ( \
- "mr. %0, %1 \n" \
- : "=r"(l_scratch) \
- : "r"(l_addr_eff) );
- asm volatile ( \
- "beq 0x4 \n" );
-
- asm volatile ( \
- "lvd %[data], 0(%[effective_address]) \n" \
- : [data]"=r"(l_dataH) \
- : [effective_address]"r"(l_addr_eff) );
-
- // CMO-The following sequence moves the read data, in l_dataH/L, into the
- // 64-bit o_data location.
- asm volatile ( \
- "stw %0, 0(%1) \n" \
- : "=r"(l_dataH) \
- : "r"(o_data) );
- asm volatile ( \
- "stw %0, 4(%1) \n" \
- : "=r"(l_dataL) \
- : "r"(o_data) );
-
- // CMO-TBD
- // Check PIB response code in 0x00001007(17:19)
- // Translate PIB rc to PK rc
-
- return 0;
-}
diff --git a/src/ppe/sbe/sample/pk_scom.h b/src/ppe/sbe/sample/pk_scom.h
deleted file mode 100644
index f558abf..0000000
--- a/src/ppe/sbe/sample/pk_scom.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sample/pk_scom.h $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 */
-//-----------------------------------------------------------------------------
-// *! (C) Copyright International Business Machines Corp. 2014
-// *! All Rights Reserved -- Property of IBM
-// *! *** IBM Confidential ***
-//-----------------------------------------------------------------------------
-
-/// \file sample_main.c
-/// \brief Sample program that creates and starts a thread
-///
-/// This file demonstrates how to create a thread and run it. It also provides
-/// an example of how to add traces to the code.
-
-#ifndef __PK_SCOM_H__
-#define __PK_SCOM_H__
-
-/// SCOM operations return non-zero error codes that may or may not indicate
-/// an actual error, depending on which SCOM is begin accessed. This error
-/// code is returned as the value of get/putscom(). The error code value
-/// increases with teh severity of the error.
-#define CFAM_FSI_STATUS_0x00001007 0x00001007
-typedef union cfam_fsi_status_reg {
- uint64_t value;
- struct {
- uint64_t ignore_fields1 : 17 ;
- uint64_t pib_error_code : 3 ;
- uint64_t igore_fields2 : 44 ;
- } fields;
-} cfam_fsi_status_reg_t;
-
-#define PCB_ERROR_NONE 0
-#define PCB_ERROR_RESOURCE_OCCUPIED 1
-#define PCB_ERROR_CHIPLET_OFFLINE 2
-#define PCB_ERROR_PARTIAL_GOOD 3
-#define PCB_ERROR_ADDRESS_ERROR 4
-#define PCB_ERROR_CLOCK_ERROR 5
-#define PCB_ERROR_PACKET_ERROR 6
-#define PCB_ERROR_TIMEOUT 7
-
-uint32_t putscom( uint32_t i_chiplet, uint32_t i_address, uint64_t i_data);
-
-uint32_t getscom( uint32_t i_chiplet, uint32_t i_address, uint64_t *o_data);
-
-#endif // __PK_SCOM_H__
diff --git a/src/ppe/sbe/sample/pk_trace_wrap.c b/src/ppe/sbe/sample/pk_trace_wrap.c
deleted file mode 100644
index 4237b29..0000000
--- a/src/ppe/sbe/sample/pk_trace_wrap.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sample/pk_trace_wrap.c $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 "pk_trace_wrap.h"
-#include "pk.h"
-#include "pk_trace.h"
-
-
-void pk_trace_wrap(const char* str)
-{
- PK_TRACE("testsetest");
-}
diff --git a/src/ppe/sbe/sample/pk_trace_wrap.h b/src/ppe/sbe/sample/pk_trace_wrap.h
deleted file mode 100644
index f3c8ac6..0000000
--- a/src/ppe/sbe/sample/pk_trace_wrap.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sample/pk_trace_wrap.h $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 */
-#ifndef __PK_WRAP_WRAP_H__
-#define __PK_WRAP_WRAP__H__
-
-
-void pk_trace_wrap(const char*);
-
-#endif // __PK_WRAP_WRAP_H__
diff --git a/src/ppe/sbe/sample/sample_main.C b/src/ppe/sbe/sample/sample_main.C
deleted file mode 100644
index 0d59138..0000000
--- a/src/ppe/sbe/sample/sample_main.C
+++ /dev/null
@@ -1,123 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sample/sample_main.C $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 */
-//-----------------------------------------------------------------------------
-// *! (C) Copyright International Business Machines Corp. 2014
-// *! All Rights Reserved -- Property of IBM
-// *! *** IBM Confidential ***
-//-----------------------------------------------------------------------------
-
-/// \file sample_main.c
-/// \brief Sample program that creates and starts a thread
-///
-/// This file demonstrates how to create a thread and run it. It also provides
-/// an example of how to add traces to the code.
-extern "C" {
-#include "pk.h"
-#include "pk_trace.h"
-#include "pk_scom.h"
-#include "pk_trace_wrap.h"
-}
-#define KERNEL_STACK_SIZE 256
-#define MAIN_THREAD_STACK_SIZE 256
-
-
-
-uint8_t G_kernel_stack[KERNEL_STACK_SIZE];
-uint8_t G_main_thread_stack[MAIN_THREAD_STACK_SIZE];
-PkThread G_main_thread;
-
-class Thetest {
-
- public:
- int i;
-
-};
-
-// A simple thread that just increments a local variable and sleeps
-void main_thread(void* arg)
-{
- //Thetest mytest;
-
- //mytest.i = 0;
-
- //std::cout << "sdfds" << std::endl;
-
- uint16_t a = 0;
-
- pk_trace_wrap("sdfsdf");
- //PK_TRACE("thread started");
-
-
- while(1)
- {
- // PK_TRACE can take up to 4 parameters
- // (not including the format string)
- //PK_TRACE("thread seconds = %d", a);
- pk_sleep(PK_SECONDS(1));
-
- uint64_t i_data = 0x0110;
-
- putscom(0x33333, 0x11111, i_data);
-
- getscom(0x33333, 0x11111, &i_data);
-
- a++;
- }
-}
-
-
-// The main function is called by the boot code (after initializing some
-// registers)
-int main(int argc, char **argv)
-{
- // initializes kernel data (stack, threads, timebase, timers, etc.)
- pk_initialize((PkAddress)G_kernel_stack,
- KERNEL_STACK_SIZE,
- 0,
- 500000000);
-
- //PK_TRACE("Kernel init completed");
-
- //Initialize the thread control block for G_main_thread
- pk_thread_create(&G_main_thread,
- (PkThreadRoutine)main_thread,
- (void*)NULL,
- (PkAddress)G_main_thread_stack,
- (size_t)MAIN_THREAD_STACK_SIZE,
- (PkThreadPriority)1);
-
- //PK_TRACE_BIN("G_main_thread", &G_main_thread, sizeof(G_main_thread));
-
- //Make G_main_thread runnable
- pk_thread_resume(&G_main_thread);
-
- //PK_TRACE("Starting thread(s)");
-
- // Start running the highest priority thread.
- // This function never returns
- pk_start_threads();
-
- return 0;
-}
diff --git a/src/ppe/sbe/sample/topfiles.mk b/src/ppe/sbe/sample/topfiles.mk
deleted file mode 100644
index b3ee1e2..0000000
--- a/src/ppe/sbe/sample/topfiles.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/ppe/sbe/sample/topfiles.mk $
-#
-# OpenPOWER OnChipController Project
-#
-# Contributors Listed Below - COPYRIGHT 2015
-# [+] 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
-TOP-C-SOURCES = pk_trace_wrap.c pk_scom.c
-TOP-CPP-SOURCES = sample_main.C
-TOP-S-SOURCES =
-
-
-TOP_OBJECTS = $(TOP-C-SOURCES:.c=.o) $(TOP-CPP-SOURCES:.C=.o) $(TOP-S-SOURCES:.S=.o)
diff --git a/src/ppe/sbe/sbefw/Makefile b/src/ppe/sbe/sbefw/Makefile
deleted file mode 100644
index 01e92b4..0000000
--- a/src/ppe/sbe/sbefw/Makefile
+++ /dev/null
@@ -1,57 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/ppe/sbe/sbefw/Makefile $
-#
-# OpenPOWER OnChipController Project
-#
-# Contributors Listed Below - COPYRIGHT 2015
-# [+] 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
-export P2P_ENABLE = 1
-
-export SUB_OBJDIR = /sbefw
-
-include img_defs.mk
-include sbefwfiles.mk
-
-OBJS := $(addprefix $(OBJDIR)/, $(SBEFW_OBJECTS))
-
-libsbefw.a: $(OBJS)
- $(AR) crs $(OBJDIR)/libsbefw.a $(OBJDIR)/*.o
-
-.PHONY: clean sbefw
-sbefw: $(OBJS)
-
-$(OBJS) $(OBJS:.o=.d): | $(OBJDIR)
-
-$(OBJDIR):
- mkdir -p $(OBJDIR)
-
-
-#clean the kernel directory first, then the application level clean
-clean:
- rm -fr $(OBJDIR)
-
-ifneq ($(MAKECMDGOALS),clean)
-include $(OBJS:.o=.d)
-endif
-
-
-
-
-
diff --git a/src/ppe/sbe/sbefw/pk_app_cfg.h b/src/ppe/sbe/sbefw/pk_app_cfg.h
deleted file mode 100644
index 3bd29dd..0000000
--- a/src/ppe/sbe/sbefw/pk_app_cfg.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sbefw/pk_app_cfg.h $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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: ppe/sbe/sbefw/pk_app_cfg.h
- *
- * @brief Application specific overrides go here.
- *
- */
-
-#ifndef __PK_APP_CFG_H__
-#define __PK_APP_CFG_H__
-
-#include "sbeirq.H"
-
-/*
- * @brief Static configuration data for external interrupts:
- * IRQ#, TYPE, POLARITY, ENABLE
- *
- */
-#define APPCFG_EXT_IRQS_CONFIG \
- SBE_IRQ_START0 STD_IRQ_TYPE_EDGE STD_IRQ_POLARITY_RISING STD_IRQ_MASKED \
- SBE_IRQ_START1 STD_IRQ_TYPE_EDGE STD_IRQ_POLARITY_RISING STD_IRQ_MASKED \
- SBE_IRQ_INTR0 STD_IRQ_TYPE_LEVEL STD_IRQ_POLARITY_RISING STD_IRQ_MASKED \
- SBE_IRQ_INTR1 STD_IRQ_TYPE_LEVEL STD_IRQ_POLARITY_RISING STD_IRQ_MASKED \
- SBE_IRQ_DRTM_REQ STD_IRQ_TYPE_LEVEL STD_IRQ_POLARITY_RISING STD_IRQ_MASKED \
- SBE_IRQ_SBEFIFO_RESET STD_IRQ_TYPE_LEVEL STD_IRQ_POLARITY_RISING STD_IRQ_MASKED \
- SBE_IRQ_SBEFIFO_DATA STD_IRQ_TYPE_LEVEL STD_IRQ_POLARITY_RISING STD_IRQ_MASKED \
-
-
-/*
- * @brief This 64 bit mask specifies which of the interrupts are not to be used.
- *
- */
-#define APPCFG_IRQ_INVALID_MASK \
-(\
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_7) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_8) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_9) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_10) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_11) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_12) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_13) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_14) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_15) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_16) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_17) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_18) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_19) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_20) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_21) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_22) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_23) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_24) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_25) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_26) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_27) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_28) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_29) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_30) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_31) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_32) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_33) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_34) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_35) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_36) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_37) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_38) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_39) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_40) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_41) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_42) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_43) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_44) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_45) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_46) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_47) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_48) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_49) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_50) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_51) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_52) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_53) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_54) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_55) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_56) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_57) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_58) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_59) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_60) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_61) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_62) | \
- STD_IRQ_MASK64(SBE_IRQ_RESERVED_63))
-
-
-/*
- * @brief Override the default behavior of the PK API error handling.
- * Force PK to send the return code back to the application,
- * instead of a kernel panic.
- *
- */
-#ifndef PK_ERROR_PANIC
-#define PK_ERROR_PANIC 0
-#endif
-
-
-#endif /*__PK_APP_CFG_H__*/
diff --git a/src/ppe/sbe/sbefw/pool.C b/src/ppe/sbe/sbefw/pool.C
deleted file mode 100644
index 8e02dd0..0000000
--- a/src/ppe/sbe/sbefw/pool.C
+++ /dev/null
@@ -1,71 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sbefw/pool.C $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 <stdint.h>
-#include <sbetrace.H>
-#include <stddef.h>
-#include<pool.H>
-
-namespace SBEVECTORPOOL
-{
-
-vectorMemPool_t g_pool[G_POOLSIZE];
-
-vectorMemPool_t * allocMem()
-{
- vectorMemPool_t *pool = NULL;
- for( size_t idx = 0; idx < G_POOLSIZE; idx++ )
- {
- if( 0 == g_pool[idx].refCount )
- {
- pool = g_pool + idx;
- g_pool[idx].refCount++;
- break;
- }
- }
- SBE_TRACE(" Giving pool 0x%08X", pool);
- return pool;
-}
-
-void releaseMem( vectorMemPool_t * i_pool )
-{
- do
- {
- if ( NULL == i_pool ) break;
-
- if( 0 == i_pool->refCount )
- {
- //TODO via RTC 129166
- // Assert here. This pool was not supposed to be in use.
- // Currenty just keeping it as is as we can not do much till the
- // time support for assert is in.
- break;
- }
- SBE_TRACE(" Releasing pool 0x%08X", i_pool);
- i_pool->refCount--;
- SBE_TRACE(" In releaseMem() RefCount:%u", i_pool->refCount);
- }while(0);
-}
-
-} // namesspace SBEVECTORPOOL
diff --git a/src/ppe/sbe/sbefw/pool.H b/src/ppe/sbe/sbefw/pool.H
deleted file mode 100644
index 1d620d1..0000000
--- a/src/ppe/sbe/sbefw/pool.H
+++ /dev/null
@@ -1,59 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sbefw/pool.H $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 */
-
-#ifndef SBE_VECTOR_POOL_H
-#define SBE_VECTOR_POOL_H
-
-namespace SBEVECTORPOOL
-{
-
-// Size of a block for a vector
-static const size_t G_BLOCKSIZE = 512;
-
-//Pool size
-static const size_t G_POOLSIZE = 4;
-
-typedef struct
-{
- size_t refCount;
- uint8_t data[G_BLOCKSIZE];
-}vectorMemPool_t;
-
-/**
- * @brief Returns memory pool block.
- *
- * @return Memory block if available, NULL otherwise.
- */
-vectorMemPool_t * allocMem();
-
-/**
- * @brief Release memory pool block.
- *
- * @param[in] i_pool pool pointer.
- */
-void releaseMem( vectorMemPool_t * i_pool );
-
-} // namespace SBEVECTORPOOL
-#endif //SBE_VECTOR_POOL_H
diff --git a/src/ppe/sbe/sbefw/sbe_sp_intf.H b/src/ppe/sbe/sbefw/sbe_sp_intf.H
deleted file mode 100644
index 0952659..0000000
--- a/src/ppe/sbe/sbefw/sbe_sp_intf.H
+++ /dev/null
@@ -1,222 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sbefw/sbe_sp_intf.H $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 sbe_sp_intf.H
- *
- * @brief This file contains the SP - SBE interface protocol common details
- */
-
-#ifndef __SBEFW_SBE_SP_INTF_H
-#define __SBEFW_SBE_SP_INTF_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * $Version: Conforms to SP-SBE Interface Spec v0.8
- */
-
-/**
- * @brief enums for SBE command classes
- *
-*/
-enum sbeCommandClass
-{
- SBE_CMD_CLASS_UNKNOWN = 0,
- SBE_CMD_CLASS_IPL_CONTROL = 0xA1,
- SBE_CMD_CLASS_SCOM_ACCESS = 0xA2,
- SBE_CMD_CLASS_RING_ACCESS = 0xA3,
- SBE_CMD_CLASS_MEMORY_ACCESS = 0xA4,
- SBE_CMD_CLASS_REGISTER_ACCESS = 0xA5,
- SBE_CMD_CLASS_ARRAY_ACCESS = 0xA6,
- SBE_CMD_CLASS_INSTRUCTION_CONTROL = 0xA7,
- SBE_CMD_CLASS_GENERIC_MESSAGE = 0xA8,
- SBE_CMD_CLASS_MPIPL_COMMANDS = 0xA9,
-};
-
-/**
- * @brief enums for SBE Istep Control command class
- *
-*/
-enum sbeIplControlCommands
-{
- SBE_CMD_EXECUTE_ISTEP = 0x01, /* Execute istep */
- SBE_CMD_IS_SBE_IPL_DONE = 0x02, /* Check if SBE IPL Done */
-};
-
-/**
- * @brief enums for SCOM Access Messages
- *
-*/
-enum sbeScomAccessCommands
-{
- SBE_CMD_GETSCOM = 0x01, /* Get SCOM */
- SBE_CMD_PUTSCOM = 0x02, /* Put SCOM */
- SBE_CMD_MODIFYSCOM = 0x03, /* Modify SCOM */
- SBE_CMD_PUTSCOM_MASK = 0x04, /* Put SCOM under mask */
- SBE_CMD_MULTISCOM = 0x05, /* Execute Multi SCOM */
-};
-
-/**
- * @brief enums for Ring Access Messages
- *
-*/
-enum sbeRingAccessCommands
-{
- SBE_CMD_GETRING = 0x01, /* Get Ring */
- SBE_CMD_PUTRING = 0x02, /* Put Ring */
-};
-
-/**
- * @brief enums for Memory Access Messages
- *
-*/
-enum sbeMemoryAccesCommands
-{
- SBE_CMD_GETMEM = 0x01, /* Get Memory (Proc/PBA) */
- SBE_CMD_PUTMEM = 0x02, /* Put Memory (Proc/PBA) */
- SBE_CMD_GETSRAM = 0x03, /* Get Memory (SRAM) */
- SBE_CMD_PUTSRAM = 0x04, /* Put Memory (SRAM) */
-};
-
-/**
- * @brief enums for GPR/SPR/FPR Access Messages
- *
-*/
-enum sbeRegisterAccessCommands
-{
- SBE_CMD_GETREG = 0x01, /* Get Register (GPR,SPR,FPR) */
- SBE_CMD_PUTREG = 0x02, /* Put Register (GPR,SPR,FPR) */
-};
-
-/**
- * @brief enums for Trace Array Access Messages
- *
-*/
-enum sbeArrayAccessCommands
-{
- SBE_CMD_GET_FAST_ARRAY = 0x01, /* Get Fast Array */
- SBE_CMD_GET_TRACE_ARRAY = 0x02, /* Get Trace Array */
- SBE_CMD_CONTROL_TRACE_ARRAY = 0x03, /* Control Trace Array */
-};
-
-/**
- * @brief enums for Instruction Control Messages
- *
-*/
-enum sbeInstructionControlCommands
-{
- SBE_CMD_CONTROL_INSTRUCTIONS = 0x01, /* Control Instructions */
-};
-
-/**
- * @brief enums for Generic Messages
- *
-*/
-enum sbeGenericMessageCommands
-{
- SBE_CMD_GET_SBE_FFDC = 0x01, /* Get FFDC */
- SBE_CMD_GET_SBE_VER = 0x02, /* GET SBE Version */
- SBE_CMD_GET_SBE_CAPABILITIES = 0x03, /* GET SBE capabilities */
- SBE_CMD_GET_FREQ_SUPPORTED = 0x04, /* Get Supported frequencies */
- SBE_CMD_GET_SBE_STATE = 0x05, /* Get SBE State */
-};
-
-enum sbeMpIplCommands
-{
- SBE_CMD_MPIPL_INVALID = 0x00,
-};
-
-/**
- * @brief enums for primary SBE response
- *
-*/
-enum sbePrimResponse
-{
- SBE_PRI_OPERATION_SUCCESSFUL = 0x00,
- SBE_PRI_INVALID_COMMAND = 0x01,
- SBE_PRI_INVALID_DATA = 0x02,
- SBE_PRI_SEQUENCE_ERROR = 0x03,
- SBE_PRI_INTERNAL_ERROR = 0x04,
- SBE_PRI_GENERIC_EXECUTION_FAILURE = 0xFE,
-};
-
-/**
- * @brief enums for secondary SBE response
- * @TODO via RTC: 129763
- * Discuss on SBE_SEC_INVALID_TARGET_ID_PASSED
- *
-*/
-enum sbeSecondaryResponse
-{
- SBE_SEC_OPERATION_SUCCESSFUL = 0x00,
- SBE_SEC_COMMAND_CLASS_NOT_SUPPORTED = 0x01,
- SBE_SEC_COMMAND_NOT_SUPPORTED = 0x02,
- SBE_SEC_INVALID_ADDRESS_PASSED = 0x03,
- SBE_SEC_INVALID_TARGET_TYPE_PASSED = 0x04,
- SBE_SEC_INVALID_TARGET_ID_PASSED = 0x05,
- SBE_SEC_SPECIFIED_TARGET_NOT_PRESENT = 0x06,
- SBE_SEC_SPECIFIED_TARGET_NOT_FUNCTIONAL = 0x07,
- SBE_SEC_COMMAND_NOT_ALLOWED_IN_THIS_STATE = 0x08,
- SBE_SEC_FUNCTIONALITY_NOT_SUPPORTED = 0x09,
- SBE_SEC_GENERIC_FAILURE_IN_EXECUTION = 0x0A,
- SBE_SEC_SECURITY_VALIDATION_FAILED = 0x0B,
- SBE_SEC_OS_FAILURE = 0x0C,
- SBE_SEC_FIFO_ACCESS_FAILURE = 0x0D,
-};
-
-/**
- * @brief enums for SBE command timeout values
- *
-*/
-enum sbeCmdRespTimeout
-{
- SBE_CMD_TIMEOUT_SHORT_IN_MSEC = 100,
- SBE_CMD_TIMEOUT_LONG_IN_MSEC = 30000,
-};
-
-/**
- * @brief enums for PCB-PIB Generic Error codes
- *
-*/
-enum sbePCBPIBErrorRC
-{
- SBE_PCB_PIB_ERROR_NONE = 0x00,
- SBE_PCB_PIB_ERROR_RESOURCE_OCCUPIED = 0x01,
- SBE_PCB_PIB_ERROR_CHIPLET_OFFLINE = 0x02,
- SBE_PCB_PIB_ERROR_PARTIAL_GOOD = 0x03,
- SBE_PCB_PIB_ERROR_ADDRESS_ERROR = 0x04,
- SBE_PCB_PIB_ERROR_CLOCK_ERROR = 0x05,
- SBE_PCB_PIB_ERROR_PACKET_ERROR = 0x06,
- SBE_PCB_PIB_ERROR_TIMEOUT = 0x07,
-};
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __SBEFW_SBE_SP_INTF_H */
diff --git a/src/ppe/sbe/sbefw/sbecmdiplcontrol.C b/src/ppe/sbe/sbefw/sbecmdiplcontrol.C
deleted file mode 100644
index e9dafd9..0000000
--- a/src/ppe/sbe/sbefw/sbecmdiplcontrol.C
+++ /dev/null
@@ -1,328 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sbefw/sbecmdiplcontrol.C $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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: ppe/sbe/sbefw/sbecmdiplcontrol.C
- *
- * @brief This file contains the SBE FIFO Commands
- *
- */
-
-#include "sbecmdiplcontrol.H"
-#include "sbefifo.H"
-#include "sbetrace.H"
-#include "sbe_sp_intf.H"
-
-// Forward declaration
-
-uint32_t sbeExecuteIstep (const uint8_t i_major, const uint8_t i_minor);
-bool validateIstep (const uint8_t i_major, const uint8_t i_minor);
-
-// @TODO via RTC 129073.
-// Just a dummy code for HWP to test the flow.
-// Remove it once complete flow is ready
-uint32_t istep1SuccessHwp( ) { SBE_DEBUG("istep1SuccessHwp"); return 0; }
-uint32_t istep1FailHwp( ) { SBE_DEBUG("istep1FailHwp"); return 1; }
-
-
-//typedefs
-// @TODO via RTC 129073.
-// This is currently not defined as actual HWP signature as it
-// will break compilation. Once Greg FAPI codeis in master, we will
-// change it
-typedef uint32_t (*sbe_istep_hwp)();
-
-// Wrapper function for HWP IPl functions
-typedef uint32_t (*sbe_istep)( sbe_istep_hwp );
-
-// Wrapper function which will call HWP with Proc target.
-uint32_t istepWithProc( sbe_istep_hwp i_hwp );
-
-//structure for mapping SBE wrapper and HWP functions
-typedef struct
-{
- sbe_istep istepWrapper;
- sbe_istep_hwp istepHwp;
-}istepMap_t;
-
-// Major isteps which are supported
-typedef enum
-{
- SBE_ISTEP2 = 2,
- SBE_ISTEP4 = 4,
- SBE_ISTEP5 = 5,
-}sbe_supported_steps_t;
-
-// constants
-// @TODO via RTC 129073.
-// These are random numbers now. Will fill up
-// once IPL flow document is in better shape.
-const uint32_t ISTEP2_MAX_SUBSTEPS = 15;
-const uint32_t ISTEP4_MAX_SUBSTEPS = 2;
-const uint32_t ISTEP5_MAX_SUBSTEPS = 4;
-
-// File static data
-// @TODO via RTC 129073.
-// Initialise pointer tables.
-
-static istepMap_t g_istep2PtrTbl[ ISTEP2_MAX_SUBSTEPS ] =
- {
- { NULL, NULL },
- { &istepWithProc, &istep1FailHwp },
- { &istepWithProc, &istep1SuccessHwp }
-
- };
-static istepMap_t g_istep4PtrTbl[ ISTEP4_MAX_SUBSTEPS ];
-static istepMap_t g_istep5PtrTbl[ ISTEP5_MAX_SUBSTEPS ];
-
-// Functions
-//----------------------------------------------------------------------------
-uint32_t sbeHandleIstep (uint8_t *i_pArg)
-{
- #define SBE_FUNC "sbeHandleIstep "
- SBE_DEBUG(SBE_FUNC);
- uint32_t rc = SBE_SEC_OPERATION_SUCCESSFUL;
- //@TODO via RTC 129073.
- //Use proper initialisation for fapi RC
- uint32_t fapiRc = SBE_SEC_OPERATION_SUCCESSFUL;
- uint8_t len = 0;
- sbeIstepReqMsg_t req;
- sbeResponseGenericHeader_t respHdr;
- respHdr.init();
- sbeResponseFfdc_t ffdc;
-
- // NOTE: In this function we will have two loops
- // First loop will deque data and prepare the response
- // Second response will enque the data on DS FIFO
- //loop 1
- do
- {
- // @TODO via RTC : 130575
- // Optimize both the RC handling and
- // FIFO operation infrastructure.
- len = sizeof( req )/sizeof(uint32_t);
- rc = sbeUpFifoDeq_mult ( len, (uint32_t *)&req);
- if (rc) //FIFO access issue
- {
- SBE_ERROR(SBE_FUNC"FIFO dequeue failed, rc[0x%X]", rc);
- break;
- }
- len = 1;
- rc = sbeUpFifoDeq_mult ( len, NULL, true );
-
- // If we didn't receive EOT yet
- if ( rc != SBE_FIFO_RC_EOT_ACKED )
- {
- SBE_ERROR(SBE_FUNC"FIFO dequeue failed, rc[0x%X]", rc);
- break;
- }
- // override Rc as we do not want to treat SBE_FIFO_RC_EOT_ACKED as error
- rc = SBE_SEC_OPERATION_SUCCESSFUL;
-
- SBE_DEBUG(SBE_FUNC"Major number:0x%08x minor number:0x%08x",
- req.major, req.minor );
-
- if( false == validateIstep( req.major, req.minor ) )
- {
- SBE_ERROR(SBE_FUNC" Invalid Istep. major:0x%08x"
- " minor:0x%08x", req.major, req.minor);
- // @TODO via RTC 129073.
- // Need to change code asper better error handling.
- respHdr.setStatus( SBE_PRI_INVALID_DATA,
- SBE_SEC_GENERIC_FAILURE_IN_EXECUTION);
- break;
- }
- fapiRc = sbeExecuteIstep( req.major, req.minor );
- if( fapiRc )
- {
- SBE_ERROR(SBE_FUNC" sbeExecuteIstep() Failed. major:0x%08x"
- " minor:0x%08x", req.major, req.minor);
- respHdr.setStatus( SBE_PRI_GENERIC_EXECUTION_FAILURE,
- SBE_SEC_GENERIC_FAILURE_IN_EXECUTION);
- ffdc.setRc(fapiRc);
- }
-
- }while(0);
-
- //loop 2
- do
- {
- // FIFO error
- if ( rc )
- {
- break;
- }
-
- uint32_t distance = 1; //initialise by 1 for entry count itself.
- len = sizeof(respHdr)/sizeof(uint32_t);
- // sbeDownFifoEnq_mult.
- rc = sbeDownFifoEnq_mult ( len, ( uint32_t *) &respHdr);
- if (rc)
- {
- break;
- }
- distance += len;
-
- // If no ffdc , exit;
- if( ffdc.fapiRc )
- {
- len = sizeof(ffdc)/sizeof(uint32_t);
- rc = sbeDownFifoEnq_mult ( len, ( uint32_t *) &ffdc);
- if (rc)
- {
- break;
- }
- distance += len;
- }
- len = sizeof(distance)/sizeof(uint32_t);
- //@TODO via 129076.
- //Need to add FFDC data as well.
- rc = sbeDownFifoEnq_mult ( len, &distance);
- if (rc)
- {
- break;
- }
- }while(0);
-
- if( rc )
- {
- SBE_ERROR( SBE_FUNC"Failed. rc[0x%X]", rc);
- }
- return rc;
- #undef SBE_FUNC
-}
-
-//----------------------------------------------------------------------------
-// @TODO via RTC 129073.
-// Change return code as per design
-// @note This is the responsibilty of caller to verify major/minor
-// number before calling this function
-
-// @TODO via RTC 129077.
-// This function should check for system checkstop as well.
-uint32_t sbeExecuteIstep (const uint8_t i_major, const uint8_t i_minor)
-{
- #define SBE_FUNC "sbeExecuteIstep "
- SBE_DEBUG(SBE_FUNC"Major number:0x%x minor number:0x%x",
- i_major, i_minor );
- uint32_t rc = 0;
-
- switch( i_major )
- {
- case SBE_ISTEP2:
- rc = (g_istep2PtrTbl[i_minor-1].istepWrapper)(
- g_istep2PtrTbl[i_minor-1].istepHwp);
- break;
-
- case SBE_ISTEP4:
- rc = (g_istep4PtrTbl[i_minor-1].istepWrapper)(
- g_istep4PtrTbl[i_minor-1].istepHwp);
- break;
-
- case SBE_ISTEP5:
- rc = (g_istep5PtrTbl[i_minor-1].istepWrapper)(
- g_istep5PtrTbl[i_minor-1].istepHwp);
- break;
-
- // We should never reach here as before calling this validation has
- // been done.
- // @TODO via RTC 129166.
- // assert if we reach in default case.
- default:
- break;
- }
-
- return rc;
- #undef SBE_FUNC
-}
-
-//----------------------------------------------------------------------------
-bool validateIstep (const uint8_t i_major, const uint8_t i_minor)
-{
- bool valid = true;
- do
- {
- if( 0 == i_minor )
- {
- valid = false;
- break;
- }
-
- switch( i_major )
- {
- case SBE_ISTEP2:
- // istep 2.1 loads image to PIBMEM
- // So SBE control loop can not execute istep 2.1.
- if(( i_minor > ISTEP2_MAX_SUBSTEPS ) || ( i_minor == 1) )
- {
- valid = false;
- }
- break;
-
- case SBE_ISTEP4:
- if( i_minor > ISTEP4_MAX_SUBSTEPS )
- {
- valid = false;
- }
- break;
-
- case SBE_ISTEP5:
- if( i_minor > ISTEP5_MAX_SUBSTEPS )
- {
- valid = false;
- }
- break;
-
- default:
- valid= false;
- break;
- }
- } while(0);
-
- return valid;
-}
-
-//----------------------------------------------------------------------------
-
-uint32_t istepWithProc( sbe_istep_hwp i_hwp)
-{
- SBE_DEBUG("istepWithProc");
- uint32_t rc = 0;
- if( i_hwp )
- {
- rc = i_hwp();
- }
- return rc;
-}
-
-//----------------------------------------------------------------------------
-
-uint32_t sbeWaitForSbeIplDone (uint8_t *i_pArg)
-{
- uint32_t rc = 0;
- SBE_TRACE("sbeWaitForSbeIplDone");
-
-
- return rc;
-}
diff --git a/src/ppe/sbe/sbefw/sbecmdiplcontrol.H b/src/ppe/sbe/sbefw/sbecmdiplcontrol.H
deleted file mode 100644
index 06332bb..0000000
--- a/src/ppe/sbe/sbefw/sbecmdiplcontrol.H
+++ /dev/null
@@ -1,58 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sbefw/sbecmdiplcontrol.H $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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: ppe/sbe/sbefw/sbecmdiplcontrol.H
- *
- * @brief This file contains the SBE command details
- *
- */
-
-#ifndef __SBEFW_SBECMDIPLCONTROL_H
-#define __SBEFW_SBECMDIPLCONTROL_H
-
-#include <stdint.h>
-
-
-/**
- * @brief execute istep chipop (0xA101)
- *
- * @param[in] i_pArg Buffer to be passed to the function (not used as of now)
- *
- * @return Rc from the FIFO access utility
- */
-uint32_t sbeHandleIstep(uint8_t *i_pArg);
-
-
-/**
- * @brief Handles wait for IPL done chipop (0xA102)
- *
- * @param[in] i_pArg Buffer to be passed to the function (not used as of now)
- *
- * @return Rc from the FIFO access utility
- */
-uint32_t sbeWaitForSbeIplDone (uint8_t *i_pArg);
-
-
-#endif // __SBEFW_SBECMDIPLCONTROL_H
diff --git a/src/ppe/sbe/sbefw/sbecmdparser.C b/src/ppe/sbe/sbefw/sbecmdparser.C
deleted file mode 100644
index 65bf271..0000000
--- a/src/ppe/sbe/sbefw/sbecmdparser.C
+++ /dev/null
@@ -1,186 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sbefw/sbecmdparser.C $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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: ppe/sbe/sbefw/sbecmdparser.C
- *
- * @brief This file contains the SBE FIFO Commands
- *
- */
-
-#include "sbecmdparser.H"
-#include "sbecmdscomaccess.H"
-#include "sbecmdiplcontrol.H"
-#include "sbetrace.H"
-#include "sbe_sp_intf.H"
-
-
-////////////////////////////////////////////////////////////////
-// @brief g_sbeScomCmdArray
-////////////////////////////////////////////////////////////////
-static sbeCmdStruct_t g_sbeScomCmdArray [] =
-{
- {sbeGetScom,
- SBE_CMD_GETSCOM,
- SBE_FENCE_AT_CONTINUOUS_IPL,
- },
-
- {sbePutScom,
- SBE_CMD_PUTSCOM,
- SBE_FENCE_AT_CONTINUOUS_IPL,
- },
-};
-
-////////////////////////////////////////////////////////////////
-// @brief g_sbeScomCmdArray
-//
-////////////////////////////////////////////////////////////////
-static sbeCmdStruct_t g_sbeIplControlCmdArray [] =
-{
- {sbeHandleIstep,
- SBE_CMD_EXECUTE_ISTEP,
- SBE_FENCE_AT_CONTINUOUS_IPL|SBE_FENCE_AT_RUNTIME|SBE_FENCE_AT_MPIPL,
- },
-
- {sbeWaitForSbeIplDone,
- SBE_CMD_IS_SBE_IPL_DONE,
- SBE_FENCE_AT_ISTEP|SBE_FENCE_AT_RUNTIME|SBE_FENCE_AT_MPIPL,
- },
-};
-
-
-
-////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////
-uint8_t sbeGetCmdStructAttr (const uint8_t i_cmdClass,
- sbeCmdStruct_t **o_ppCmd)
-{
- #define SBE_FUNC " sbeGetCmdStructAttr "
- SBE_DEBUG(SBE_FUNC);
- uint8_t l_numCmds = 0;
- *o_ppCmd = NULL;
-
- switch(i_cmdClass)
- {
- case SBE_CMD_CLASS_IPL_CONTROL:
- // @TODO via RTC : 128655
- // Use C++ style typecase
- l_numCmds = sizeof(g_sbeIplControlCmdArray) /
- sizeof(sbeCmdStruct_t);
- *o_ppCmd = (sbeCmdStruct_t*)g_sbeIplControlCmdArray;
- break;
- case SBE_CMD_CLASS_SCOM_ACCESS:
- l_numCmds = sizeof(g_sbeScomCmdArray) /
- sizeof(sbeCmdStruct_t);
- *o_ppCmd = (sbeCmdStruct_t*)g_sbeScomCmdArray;
- break;
-
- // This will grow with each class of chipOp in future
- default:
- break;
- }
- return l_numCmds;
- #undef SBE_FUNC
-}
-
-
-////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////
-uint8_t sbeValidateCmdClass (const uint8_t i_cmdClass,
- const uint8_t i_cmdOpcode)
-{
- #define SBE_FUNC " sbeValidateCmdClass "
- uint8_t l_rc = SBE_SEC_COMMAND_NOT_SUPPORTED;
-
- SBE_DEBUG(SBE_FUNC"i_cmdClass[0x%02X], "
- "i_cmdOpcode[0x%02X]", i_cmdClass, i_cmdOpcode);
-
- do
- {
- uint8_t l_numCmds = 0;
- sbeCmdStruct_t *l_pCmd = NULL;
-
- l_numCmds = sbeGetCmdStructAttr (i_cmdClass, &l_pCmd);
- if (!l_numCmds)
- {
- // Command class not supported
- l_rc = SBE_SEC_COMMAND_CLASS_NOT_SUPPORTED;
- break;
- }
-
- // @TODO via RTC : 128654
- // Analyze on merging the validation functions into one
- // and also on using loop vs switch case performance
- for (uint8_t l_cnt = 0; l_cnt < l_numCmds; ++l_cnt, ++l_pCmd)
- {
- if (i_cmdOpcode == l_pCmd->cmd_opcode)
- {
- // Command found
- l_rc = SBE_SEC_OPERATION_SUCCESSFUL;
- break;
- }
- }
- } while (false);
-
- return l_rc;
- #undef SBE_FUNC
-}
-
-////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////
-bool sbeIsCmdAllowedAtState (const uint8_t i_cmdClass,
- const uint8_t i_cmdOpcode)
-{
- // @TODO via RTC : 126146
- // SBE state management
- return 0;
-}
-
-////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////
-sbeCmdFunc_t sbeFindCmdFunc (const uint8_t i_cmdClass,
- const uint8_t i_cmdOpcode)
-
-{
- #define SBE_FUNC " sbeFindCmdFunc "
- uint8_t l_numCmds = 0;
- sbeCmdStruct_t *l_pCmd = NULL;
-
- l_numCmds = sbeGetCmdStructAttr (i_cmdClass, &l_pCmd);
-
- SBE_DEBUG(SBE_FUNC"i_cmdClass[0x%02X], "
- "i_cmdOpcode[0x%02X], l_numCmds[0x%02X]",
- i_cmdClass, i_cmdOpcode, l_numCmds);
-
- for (uint8_t l_cnt = 0; l_cnt < l_numCmds; ++l_cnt, ++l_pCmd)
- {
- if (i_cmdOpcode == l_pCmd->cmd_opcode)
- {
- break;
- }
- }
-
- return l_pCmd ? (l_pCmd->cmd_func) : NULL;
- #undef SBE_FUNC
-}
diff --git a/src/ppe/sbe/sbefw/sbecmdparser.H b/src/ppe/sbe/sbefw/sbecmdparser.H
deleted file mode 100644
index 921637a..0000000
--- a/src/ppe/sbe/sbefw/sbecmdparser.H
+++ /dev/null
@@ -1,116 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sbefw/sbecmdparser.H $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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: ppe/sbe/sbefw/sbecmdparser.H
- *
- * @brief This file contains the SBE command details
- *
- */
-
-#ifndef __SBEFW_SBECMDPARSER_H
-#define __SBEFW_SBECMDPARSER_H
-
-#include <stdint.h>
-
-
-/**
- * @brief SBE Command structure associating an opcode of a command
- * to the processing function as well as the allowed states
- *
- */
-typedef uint32_t (*sbeChipOpFunc_t) (uint8_t *i_pArg);
-
-typedef struct {
- sbeChipOpFunc_t cmd_func; /* Command function pointer */
- uint8_t cmd_opcode; /* Command opcode */
- uint8_t cmd_state_fence; /* Command fencing based on SBE state */
-} sbeCmdStruct_t;
-
-
-/**
- * @brief SBE Command Fence attributes
- *
- */
-enum sbe_command_fence_attrs
-{
- SBE_FENCE_AT_ISTEP = 0x80, ///< Fence off the cmd at istep state
- SBE_FENCE_AT_CONTINUOUS_IPL = 0x40, ///< Fence off the cmd at cont IPL
- SBE_FENCE_AT_RUNTIME = 0x20, ///< Fence off the cmd at Runtime state
- SBE_FENCE_AT_MPIPL = 0x10, ///< Fence off the cmd at MPIPL state
-};
-
-
-/**
- * @brief sbeValidateCmdClass Validates the command class and opcode
- *
- * @param[in] i_cmdClass Command class code
- * @param[in] i_cmdOpcode Command opcode
- *
- * @return uint8_t return code
- * SBE_SEC_OPERATION_SUCCESSFUL - Command found
- * SBE_SEC_COMMAND_CLASS_NOT_SUPPORTED
- * SBE_SEC_COMMAND_NOT_SUPPORTED
- */
-uint8_t sbeValidateCmdClass (const uint8_t i_cmdClass,
- const uint8_t i_cmdOpcode);
-
-/**
- * @brief sbeIsCmdAllowedAtState Validates if the command is allowed
- * at the current SBE state
- *
- * @param[in] i_cmdClass Command class code
- * @param[in] i_cmdOpcode Command opcode
- *
- * @return true command is allowed at the current state
- * false command is not allowed at the current state
- */
-bool sbeIsCmdAllowedAtState (const uint8_t i_cmdClass,
- const uint8_t i_cmdOpcode);
-
-
-/**
- * @brief sbeCmdFunc_t Typical signature for any SBE ChipOp back-end function
- *
- * @param[in] uint8_t *i_pArg Pointer to the argument to be passed to
- * the chipOp function
- *
- * @return uint32_t Return code from the chipOp function
- */
-typedef uint32_t ( *sbeCmdFunc_t ) (uint8_t *i_pArg);
-
-
-/**
- * @brief sbeFindCmdFunc Finds the function corresponding to the command
- *
- * @param[in] i_cmdClass Command class code
- * @param[in] i_cmdOpcode Command opcode
- *
- * @return sbeCmdFunc_t A pointer to the corresponding ChipOps function
- */
-sbeCmdFunc_t sbeFindCmdFunc (const uint8_t i_cmdClass,
- const uint8_t i_cmdOpcode);
-
-
-#endif // __SBEFW_SBECMDPARSER_H
diff --git a/src/ppe/sbe/sbefw/sbecmdprocessor.C b/src/ppe/sbe/sbefw/sbecmdprocessor.C
deleted file mode 100644
index 31391d0..0000000
--- a/src/ppe/sbe/sbefw/sbecmdprocessor.C
+++ /dev/null
@@ -1,263 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sbefw/sbecmdprocessor.C $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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: ppe/sbe/sbefw/sbecmdprocessor.C
- *
- * @brief This file contains the SBE Command processing Thread Routines
- *
- */
-
-
-#include "sbeexeintf.H"
-#include "sbefifo.H"
-#include "sbecmdparser.H"
-#include "sbeirq.H"
-#include "sbetrace.H"
-#include "sbe_sp_intf.H"
-
-//////////////////////////////////////////////////////
-//////////////////////////////////////////////////////
-void sbeSyncCommandProcessor_routine(void *i_pArg)
-{
- #define SBE_FUNC " sbeSyncCommandProcessor_routine "
- SBE_ENTER(SBE_FUNC);
-
- do
- {
- uint32_t l_rc = SBE_SEC_OPERATION_SUCCESSFUL;
- uint8_t l_dist2StatusHdr = 0;
- uint32_t l_sbeDownFifoRespBuf[4] = {0};
-
- // Wait for new command processing
- int l_rcPk = pk_semaphore_pend (
- &g_sbeSemCmdProcess, PK_WAIT_FOREVER);
-
- do
- {
- uint16_t l_primStatus = g_sbeCmdRespHdr.prim_status;
- uint16_t l_secStatus = g_sbeCmdRespHdr.sec_status ;
- SBE_DEBUG (SBE_FUNC"l_primStatus=[0x%04X], l_secStatus=[0x%04X]",
- l_primStatus, l_secStatus);
-
- // PK API failure
- if (l_rcPk != PK_OK)
- {
- SBE_ERROR(SBE_FUNC"pk_semaphore_pend failed, "
- "l_rcPk=%d, g_sbeSemCmdRecv.count=%d",
- l_rcPk, g_sbeSemCmdRecv.count);
-
- // if the command receiver thread already updated
- // the response status codes, don't override them.
- if (l_primStatus != SBE_PRI_OPERATION_SUCCESSFUL)
- {
- l_primStatus = SBE_PRI_INTERNAL_ERROR;
- l_secStatus = SBE_SEC_OS_FAILURE;
- }
- }
-
- SBE_DEBUG(SBE_FUNC"unblocked");
-
- // if there was a PK API failure or the
- // command receiver thread indicated of
- // a failure due to
- // Command Validation or
- // FIFO Reset request
- if (l_primStatus)
- {
- uint8_t l_len2dequeue = 0;
- switch (l_primStatus)
- {
- case SBE_FIFO_RESET_RECEIVED:
- SBE_ERROR(SBE_FUNC"FIFO reset received");
- l_rc = SBE_FIFO_RC_RESET;
- break;
-
- case SBE_PRI_INVALID_COMMAND:
- // Command or SBE state validation failed
- // just follow through
-
- case SBE_PRI_INTERNAL_ERROR:
- // Flush out the upstream FIFO till EOT arrives
- l_len2dequeue = 1;
- l_rc = sbeUpFifoDeq_mult (l_len2dequeue, NULL, true);
- if (l_rc == SBE_FIFO_RC_RESET)
- {
- break;
- }
-
- // Not handling any other RC from sbeUpFifoDeq_mult
- // while flushing out to keep this code simple.
-
- // Don't break here to force the flow through
- // the next case to enqueue the response into
- // the downstream FIFO
-
- case SBE_PRI_INVALID_DATA:
- // SBE caller already wrongly sent EOT
- // before sending two mandatory header entries
- //
- // enqueue the response payload now into
- // the downstream FIFO
-
- // @TODO via RTC : 130575
- // Optimize RC handling infrastructure code
-
- // Build the response packet first
- sbeBuildMinRespHdr(&l_sbeDownFifoRespBuf[0],
- l_dist2StatusHdr,
- l_primStatus,
- l_secStatus,
- 0);
-
- // Now enqueue into the downstream FIFO
- l_rc = sbeDownFifoEnq_mult (++l_dist2StatusHdr,
- &l_sbeDownFifoRespBuf[0]);
- if (l_rc)
- {
- SBE_ERROR(SBE_FUNC"sbeDownFifoEnq_mult failure,"
- " l_rc[0x%X]", l_rc);
- }
- break;
-
- // Signal EOT in Downstream FIFO
- l_rc = sbeDownFifoSignalEot();
- if (l_rc)
- {
- SBE_ERROR(SBE_FUNC"sbeDownFifoSignalEot failure,"
- " l_rc[0x0%08X]", l_rc);
- break;
- }
-
- default:
- break;
- } // End switch
-
- break;
- }
-
- SBE_DEBUG(SBE_FUNC"New cmd arrived, g_sbeSemCmdProcess.count=%d",
- g_sbeSemCmdProcess.count);
-
- uint8_t l_cmdClass = 0;
- uint8_t l_cmdOpCode = 0;
- uint32_t (*l_pFuncP) (uint8_t *) ;
-
- // @TODO via RTC: 128658
- // Review if Mutex protection is required
- // for all the globals used between threads
- l_cmdClass = g_sbeCmdHdr.cmdClass;
- l_cmdOpCode = g_sbeCmdHdr.command;
-
- // Get the command function
- l_pFuncP = sbeFindCmdFunc (l_cmdClass, l_cmdOpCode) ;
-
- if (!l_pFuncP)
- {
- // No Supported function found
- SBE_ERROR(SBE_FUNC"No supported function");
- l_rc = SBE_FUNC_NOT_SUPPORTED;
-
- // @TODO via RTC : 129166
- // force assert
- break;
- }
-
- // Call the ChipOp function
- l_rc = l_pFuncP ((uint8_t *)i_pArg);
-
- } while(false); // Inner do..while loop ends here
-
- SBE_DEBUG(SBE_FUNC"l_rc=[0x%08X]", l_rc);
-
- // Handle FIFO reset case
- if (l_rc == SBE_FIFO_RC_RESET)
- {
- // @TODO via RTC : 126147
- // Handle FIFO reset flow
- pk_irq_enable(SBE_IRQ_SBEFIFO_DATA);
- continue;
- }
-
- switch (l_rc)
- {
- // EOT arrived prematurely in upstream FIFO
- // or there were unexpected data in upstream
- // FIFO
- case SBE_FIFO_RC_EOT_ACKED:
- case SBE_FIFO_RC_EOT_ACK_FAILED:
- SBE_ERROR(SBE_FUNC"Received unexpected EOT, l_rc[0x%08X]",
- l_rc);
- sbeBuildMinRespHdr(&l_sbeDownFifoRespBuf[0],
- l_dist2StatusHdr,
- SBE_PRI_INVALID_DATA,
- SBE_SEC_GENERIC_FAILURE_IN_EXECUTION,
- 0);
- l_rc = sbeDownFifoEnq_mult (++l_dist2StatusHdr,
- &l_sbeDownFifoRespBuf[0]);
- if (l_rc)
- {
- SBE_ERROR(SBE_FUNC"sbeDownFifoEnq_mult failure,"
- " l_rc[0x0%08X]", l_rc);
- // not attempting to signal EOT
- break;
- }
- // Follow through to signal EOT in downstream
-
- case SBE_SEC_OPERATION_SUCCESSFUL: // Successful execution
- // Signal EOT in Downstream FIFO
- l_rc = sbeDownFifoSignalEot();
- if (l_rc)
- {
- SBE_ERROR(SBE_FUNC"sbeDownFifoSignalEot failure,"
- " l_rc[0x0%08X]", l_rc);
- }
- SBE_INFO(SBE_FUNC"ChipOp Done");
- break;
-
- default:
- break;
- }
-
- // @TODO via RTC : 126147
- // Review all the scenarios
- // Enable the new data available interrupt
- pk_irq_enable(SBE_IRQ_SBEFIFO_DATA);
-
- } while(true); // Thread always exists
-}
-
-//////////////////////////////////////////////////////
-//////////////////////////////////////////////////////
-void sbeAsyncCommandProcessor_routine(void *arg)
-{
- SBE_TRACE("sbeAsyncCommandProcessor Thread started");
-
- do
- {
- // @TODO RTC via : 130392
- // Add infrastructure for host interface
-
- } while(0);
-}
diff --git a/src/ppe/sbe/sbefw/sbecmdreceiver.C b/src/ppe/sbe/sbefw/sbecmdreceiver.C
deleted file mode 100644
index a58636b..0000000
--- a/src/ppe/sbe/sbefw/sbecmdreceiver.C
+++ /dev/null
@@ -1,175 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sbefw/sbecmdreceiver.C $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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: ppe/sbe/sbefw/sbecmdreceiver.C
- *
- * @brief This file contains the SBE Command Receiver Thread Routine
- *
- */
-
-
-#include "sbeexeintf.H"
-#include "sbefifo.H"
-#include "sbecmdparser.H"
-#include "sbeirq.H"
-#include "sbetrace.H"
-#include "sbe_sp_intf.H"
-
-sbeCmdReqBuf_t g_sbeCmdHdr;
-sbeCmdRespHdr_t g_sbeCmdRespHdr;
-
-//////////////////////////////////////////////////////
-//////////////////////////////////////////////////////
-void sbeCommandReceiver_routine(void *i_pArg)
-{
- #define SBE_FUNC " sbeCommandReceiver_routine "
- SBE_ENTER(SBE_FUNC);
-
- do
- {
- uint32_t l_rc = SBE_SEC_OPERATION_SUCCESSFUL;
-
- // @TODO via RTC: 128944
- // Read Scratchpad
-
- // Wait for new data in FIFO or FIFO reset interrupt
- int l_rcPk = pk_semaphore_pend (&g_sbeSemCmdRecv, PK_WAIT_FOREVER);
-
- // @TODO via RTC: 128658
- // Review if Mutex protection is required
- // for all the globals used between threads
- g_sbeCmdRespHdr.prim_status = SBE_PRI_OPERATION_SUCCESSFUL;
- g_sbeCmdRespHdr.sec_status = SBE_SEC_OPERATION_SUCCESSFUL;
- g_sbeCmdHdr.cmdClass = SBE_CMD_CLASS_UNKNOWN;
-
- // inner loop for command handling
- do
- {
- // pk API failure
- if (l_rcPk != PK_OK)
- {
- break;
- }
-
- SBE_DEBUG(SBE_FUNC"unblocked");
-
- // @TODO via RTC: 128943
- // Host services / OPAL handling
-
- // @TODO via RTC: 128945
- // Handle protocol violation if needed (a long term goal)
-
- // The responsibility of this thread is limited to dequeueing
- // only the first two word entries from the protocol header.
- uint8_t len = sizeof( g_sbeCmdHdr)/ sizeof(uint32_t);
- l_rc = sbeUpFifoDeq_mult ( len, (uint32_t *)&g_sbeCmdHdr );
-
- // If FIFO reset is requested,
- if (l_rc == SBE_FIFO_RC_RESET)
- {
- SBE_ERROR(SBE_FUNC"FIFO reset received");
- g_sbeCmdRespHdr.prim_status =
- (uint16_t)SBE_FIFO_RESET_RECEIVED;
- g_sbeCmdRespHdr.sec_status =
- (uint16_t)SBE_SEC_GENERIC_FAILURE_IN_EXECUTION;
- break;
- }
-
- // If we received EOT pre-maturely or
- // got an error while Ack'ing EOT
- if ( (l_rc == SBE_FIFO_RC_EOT_ACKED) ||
- (l_rc == SBE_FIFO_RC_EOT_ACK_FAILED) )
- {
- SBE_ERROR(SBE_FUNC"sbeUpFifoDeq_mult failure, "
- " l_rc=[0x%08X]", l_rc);
- g_sbeCmdRespHdr.prim_status =
- SBE_PRI_INVALID_DATA;
- g_sbeCmdRespHdr.sec_status =
- SBE_SEC_GENERIC_FAILURE_IN_EXECUTION;
- l_rc = SBE_SEC_OPERATION_SUCCESSFUL;
- break;
- }
-
- // Any other FIFO access issue
- if ( l_rc != SBE_SEC_OPERATION_SUCCESSFUL)
- {
- SBE_ERROR(SBE_FUNC"sbeUpFifoDeq_mult failue, "
- "l_rc=[0x%08X]", l_rc);
- break;
- }
-
- // validate the command class and sub-class opcodes
- l_rc = sbeValidateCmdClass (
- g_sbeCmdHdr.cmdClass,
- g_sbeCmdHdr.command ) ;
-
- if (l_rc)
- {
- // Command Validation failed;
- SBE_ERROR(SBE_FUNC"Command validation failed");
- g_sbeCmdRespHdr.prim_status = SBE_PRI_INVALID_COMMAND;
- g_sbeCmdRespHdr.sec_status = l_rc;
- l_rc = SBE_SEC_OPERATION_SUCCESSFUL;
- break;
- }
-
- // @TODO via RTC: 126146
- // validate state machine constraints
-
- } while (false); // Inner do..while ends
-
- // Unblock the command processor thread
- // if we could dequeue the header successfully
- if ((l_rcPk == PK_OK) && (l_rc == SBE_SEC_OPERATION_SUCCESSFUL))
- {
- l_rcPk = pk_semaphore_post(&g_sbeSemCmdProcess);
- }
-
- if ((l_rcPk != PK_OK) || (l_rc != SBE_SEC_OPERATION_SUCCESSFUL))
- {
- // It's likely a code bug or PK failure, or
- // FIFO reset request arrived or any other
- // FIFO access failure.
-
- // @TODO via RTC : 129166
- // Review if we need to add ASSERT here
-
- // Add Error trace, collect FFDC and
- // continue wait for the next interrupt
- SBE_ERROR(SBE_FUNC"Unexpected failure, "
- "l_rcPk=[%d], g_sbeSemCmdProcess.count=[%d], l_rc=[%d]",
- l_rcPk, g_sbeSemCmdProcess.count, l_rc);
-
- pk_irq_enable(SBE_IRQ_SBEFIFO_DATA);
-
- continue;
- }
-
- SBE_DEBUG(SBE_FUNC"Posted g_sbeSemCmdProcess, "
- "g_sbeSemCmdProcess.count=[%d]", g_sbeSemCmdProcess.count);
-
- } while (true); // thread always exists
- #undef SBE_FUNC
-}
diff --git a/src/ppe/sbe/sbefw/sbecmdscomaccess.C b/src/ppe/sbe/sbefw/sbecmdscomaccess.C
deleted file mode 100644
index b485937..0000000
--- a/src/ppe/sbe/sbefw/sbecmdscomaccess.C
+++ /dev/null
@@ -1,306 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sbefw/sbecmdscomaccess.C $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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: ppe/sbe/sbefw/sbecmdscomaccess.C
- *
- * @brief This file contains the SBE SCOM Access chipOps
- *
- */
-
-#include "sbecmdscomaccess.H"
-#include "sbefifo.H"
-#include "sbe_sp_intf.H"
-#include "sbetrace.H"
-
-//////////////////////////////////////////////////////
-//////////////////////////////////////////////////////
-uint32_t sbeGetScom (uint8_t *i_pArg)
-{
- #define SBE_FUNC " sbeGetScom "
- SBE_ENTER(SBE_FUNC);
-
- uint32_t l_rc = SBE_SEC_OPERATION_SUCCESSFUL;
-
- do
- {
- uint16_t l_primStatus = g_sbeCmdRespHdr.prim_status;
- uint16_t l_secStatus = g_sbeCmdRespHdr.sec_status ;
-
- // Will attempt to dequeue two entries for
- // the scom addresses plus the expected
- // EOT entry at the end
-
- // @TODO via RTC : 130575
- // Optimize both the RC handling and
- // FIFO operation infrastructure.
- uint8_t l_len2dequeue = 3;
- uint32_t l_scomAddr[3] = {0};
- l_rc = sbeUpFifoDeq_mult (l_len2dequeue, &l_scomAddr[0]);
-
- // If FIFO access failure
- if (l_rc == SBE_SEC_FIFO_ACCESS_FAILURE)
- {
- // Let command processor routine to handle the RC.
- break;
- }
-
- // If we didn't receive EOT yet
- if ( (l_rc != SBE_FIFO_RC_EOT_ACKED) &&
- (l_rc != SBE_FIFO_RC_EOT_ACK_FAILED) )
- {
- // We must have received unexpected data
- // on the upstream FIFO.
-
- // Flush upstream FIFO until EOT;
- l_len2dequeue = 1;
- l_rc = sbeUpFifoDeq_mult ( l_len2dequeue, NULL, true );
-
- // We will break out here to force
- // command processor routine to handle the RC.
- // If the RC indicates the receipt of EOT,
- // It would send the appropriate response
- // back into the down stream FIFO.
- // For all other failures, it would force
- // timeout the chipOp operation
- break;
- }
-
- // If EOT arrived prematurely
- if ( ((l_rc == SBE_FIFO_RC_EOT_ACKED) ||
- (l_rc == SBE_FIFO_RC_EOT_ACK_FAILED))
- && (l_len2dequeue < 2) )
- {
- // We will break out here to force
- // command processor routine to respond
- // into the downstream FIFO with
- // primary response code as SBE_PRI_INVALID_DATA
- break;
- }
-
- uint32_t l_sbeDownFifoRespBuf[6] = {0};
- uint32_t l_pcbpibStatus = SBE_PCB_PIB_ERROR_NONE;
- uint8_t l_len2enqueue = 0;
- uint8_t l_index = 0;
- // successfully dequeued two entries for
- // scom address followed by the EOT entry
- if ( ((l_rc == SBE_FIFO_RC_EOT_ACKED) ||
- (l_rc == SBE_FIFO_RC_EOT_ACK_FAILED))
- && (l_len2dequeue == 2) )
- {
- // @TODO via RTC : 126140
- // Support Indirect SCOM
- // Data entry 1 : Scom Register Address (0..31)
- // Data entry 2 : Register Address (32..63)
- // For Direct SCOM, will ignore entry 1
-
- uint64_t l_scomData = 0;
- SBE_TRACE(SBE_FUNC"scomAddr1[0x%08X]", l_scomAddr[1]);
- l_rc = getscom (0, l_scomAddr[1], &l_scomData);
-
- if (l_rc) // scom failed
- {
- SBE_ERROR(SBE_FUNC"getscom failed, l_rc[0x%08X]", l_rc);
- l_primStatus = SBE_PRI_GENERIC_EXECUTION_FAILURE;
- l_secStatus = SBE_SEC_GENERIC_FAILURE_IN_EXECUTION;
- l_pcbpibStatus = l_rc;
- }
-
- if (!l_rc) // successful scom
- {
- SBE_TRACE(SBE_FUNC"getscom succeeds, l_scomData[0x%X]",
- l_scomData);
-
- l_sbeDownFifoRespBuf[0] = (uint32_t)(l_scomData>>32);
- l_sbeDownFifoRespBuf[1] = (uint32_t)(l_scomData);
-
- // Push the data into downstream FIFO
- l_len2enqueue = 2;
- l_rc = sbeDownFifoEnq_mult (l_len2enqueue,
- &l_sbeDownFifoRespBuf[0]);
- if (l_rc)
- {
- // will let command processor routine
- // handle the failure
- break;
- }
- l_index = 2;
- } // end successful scom
- } // end successful dequeue
-
- // Build the response header packet
-
- uint8_t l_curIndex = l_index ;
- sbeBuildMinRespHdr(&l_sbeDownFifoRespBuf[0],
- l_curIndex,
- l_primStatus,
- l_secStatus,
- l_pcbpibStatus,
- l_index);
-
- // Now enqueue into the downstream FIFO
- l_len2enqueue = ++l_curIndex - l_index;
- l_rc = sbeDownFifoEnq_mult (l_len2enqueue,
- &l_sbeDownFifoRespBuf[l_index]);
- if (l_rc)
- {
- // will let command processor routine
- // handle the failure
- break;
- }
-
- } while(false);
-
- return l_rc;
- #undef SBE_FUNC
-}
-
-/////////////////////////////////////////////////////
-//////////////////////////////////////////////////////
-uint32_t sbePutScom (uint8_t *i_pArg)
-{
- #define SBE_FUNC " sbePutScom "
- SBE_ENTER(SBE_FUNC);
-
- uint32_t l_rc = SBE_SEC_OPERATION_SUCCESSFUL;
-
- do
- {
- uint16_t l_primStatus = g_sbeCmdRespHdr.prim_status;
- uint16_t l_secStatus = g_sbeCmdRespHdr.sec_status ;
-
- // Will attempt to dequeue four entries for
- // the scom address (two entries) and the
- // corresponding data (two entries) plus
- // the expected EOT entry at the end
-
- // @TODO via RTC : 130575
- // Optimize both the RC handling and
- // FIFO operation infrastructure.
- uint8_t l_len2dequeue = 5;
- uint32_t l_scomAddr_Data[5] = {0};
- l_rc = sbeUpFifoDeq_mult (l_len2dequeue, &l_scomAddr_Data[0]);
-
- // If FIFO access failure
- if (l_rc == SBE_SEC_FIFO_ACCESS_FAILURE)
- {
- // Let command processor routine to handle the RC.
- break;
- }
-
- // If we didn't receive EOT yet
- if ( (l_rc != SBE_FIFO_RC_EOT_ACKED) &&
- (l_rc != SBE_FIFO_RC_EOT_ACK_FAILED) )
- {
- // We must have received unexpected data
- // on the upstream FIFO.
-
- // Flush upstream FIFO until EOT;
- l_len2dequeue = 1;
- l_rc = sbeUpFifoDeq_mult ( l_len2dequeue, NULL, true );
-
- // We will break out here to force
- // command processor routine to handle the RC.
- // If the RC indicates the receipt of EOT,
- // It would send the appropriate response
- // back into the down stream FIFO.
- // For all other failures, it would force
- // timeout the chipOp operation
- break;
- }
-
- // If EOT arrived prematurely
- if ( ((l_rc == SBE_FIFO_RC_EOT_ACKED) ||
- (l_rc == SBE_FIFO_RC_EOT_ACK_FAILED))
- && (l_len2dequeue < 4) )
- {
- // We will break out here to force
- // command processor routine to respond
- // into the downstream FIFO with
- // primary response code as SBE_PRI_INVALID_DATA
- break;
- }
-
- uint64_t l_scomData = 0;
- uint32_t l_sbeDownFifoRespBuf[4] = {0};
- uint32_t l_pcbpibStatus = SBE_PCB_PIB_ERROR_NONE;
- uint8_t l_len2enqueue = 0;
- // successfully dequeued two entries for
- // scom address followed by the EOT entry
- if ( ((l_rc == SBE_FIFO_RC_EOT_ACKED) ||
- (l_rc == SBE_FIFO_RC_EOT_ACK_FAILED))
- && (l_len2dequeue == 4) )
- {
- // @TODO via RTC : 126140
- // Support Indirect SCOM
- // Data entry 1 : Scom Register Address (0..31)
- // Data entry 2 : Scom Register Address (32..63)
- // Data entry 3 : Scom Register Data (0..31)
- // Data entry 4 : Scom Register Data (32..63)
- // For Direct SCOM, will ignore entry 1
- l_scomData = ((uint64_t)(l_scomAddr_Data[2])<<32)
- | (l_scomAddr_Data[3]);
-
- SBE_DEBUG(SBE_FUNC"scomAddr0[0x%X]"
- "scomAddr1[0x%X]"
- "scomData0[0x%X]"
- "scomData1[0x%X]",
- l_scomAddr_Data[0], l_scomAddr_Data[1],
- l_scomAddr_Data[2], l_scomAddr_Data[3]);
-
- l_rc = putscom (0, l_scomAddr_Data[1], l_scomData);
-
- if (l_rc) // scom failed
- {
- SBE_ERROR(SBE_FUNC"putscom failed, l_rc[0x%08X]", l_rc);
- l_primStatus = SBE_PRI_GENERIC_EXECUTION_FAILURE;
- l_secStatus = SBE_SEC_GENERIC_FAILURE_IN_EXECUTION;
- l_pcbpibStatus = l_rc;
- }
- } // end successful dequeue
-
- // Build the response header packet
-
- uint8_t l_curIndex = 0;
- sbeBuildMinRespHdr(&l_sbeDownFifoRespBuf[0],
- l_curIndex,
- l_primStatus,
- l_secStatus,
- l_pcbpibStatus);
-
- // Now enqueue into the downstream FIFO
- l_len2enqueue = ++l_curIndex;
- l_rc = sbeDownFifoEnq_mult (l_len2enqueue, &l_sbeDownFifoRespBuf[0]);
- if (l_rc)
- {
- // will let command processor routine
- // handle the failure
- break;
- }
-
- } while(false);
-
- return l_rc;
- #undef SBE_FUNC
-}
diff --git a/src/ppe/sbe/sbefw/sbecmdscomaccess.H b/src/ppe/sbe/sbefw/sbecmdscomaccess.H
deleted file mode 100644
index 6377512..0000000
--- a/src/ppe/sbe/sbefw/sbecmdscomaccess.H
+++ /dev/null
@@ -1,59 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sbefw/sbecmdscomaccess.H $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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: ppe/sbe/sbefw/sbecmdscomaccess.H
- *
- * @brief This file contains the Interfaces for the SCOM Access chip-ops
- *
- */
-
-#ifndef __SBEFW_SBECMDSCOMACCESS_H
-#define __SBEFW_SBECMDSCOMACCESS_H
-
-#include <stdint.h>
-
-/**
- * @brief sbeDownFifoGetStatus : Write data into Downstream FIFO
- *
- * @param[in] i_pArg Buffer to be passed to the function (not used as of now)
- *
- * @return Rc from the FIFO access utility
- */
-uint32_t sbeGetScom (uint8_t *i_pArg);
-
-
-/**
- * @brief sbeDownFifoGetStatus : Write data into Downstream FIFO
- *
- * @param[in] i_pArg Buffer to be passed to the function (not used as of now)
- *
- * @return Rc from the FIFO access utility
- */
-uint32_t sbePutScom (uint8_t *i_pArg);
-
-
-
-
-#endif /* __SBEFW_SBECMDSCOMACCESS_H */
diff --git a/src/ppe/sbe/sbefw/sbeexeintf.H b/src/ppe/sbe/sbefw/sbeexeintf.H
deleted file mode 100644
index ba558b0..0000000
--- a/src/ppe/sbe/sbefw/sbeexeintf.H
+++ /dev/null
@@ -1,195 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sbefw/sbeexeintf.H $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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: ppe/sbe/sbefw/sbeexeintf.H
- *
- * @brief This file contains the SBE control loop firmware details like
- * - Thread priority enums
- * - Thread stack size and space enums
- * - Thread sub-rountine declarations
- * - IRQ setup and ISR declarations
- * - Other Common declaration among all the threads
- */
-
-#ifndef __SBEFW_SBE_H
-#define __SBEFW_SBE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "pk.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-/**
- * @brief enums for priorities for thread creation
- *
- */
-typedef enum
-{
- THREAD_PRIORITY_MAX_0,
- THREAD_PRIORITY_1,
- THREAD_PRIORITY_2,
- THREAD_PRIORITY_3,
- THREAD_PRIORITY_4,
- THREAD_PRIORITY_5,
- THREAD_PRIORITY_6,
- THREAD_PRIORITY_7,
- THREAD_PRIORITY_8,
- THREAD_PRIORITY_MIN_30 = 30,
-} sbeThreadPriorities ;
-
-/**
- * @brief enums for thread stack sizes
- * - Non-Critical Stack used by non-critical interrupt handlers
- * - Critical Stack used for critical interrupts
- * - Stacks for each thread
- *
- * @TODO via RTC : 128657
- * - Measure the actual thread stack utilization
- * - This will be a continuous activity
- */
-enum sbeThreadStackSize
-{
- SBE_NONCRITICAL_STACK_SIZE = 256,
- SBE_THREAD_ASYNC_CMD_PROC_STACK_SIZE = 256,
- SBE_THREAD_CMD_RECV_STACK_SIZE = 512,
- SBE_THREAD_SYNC_CMD_PROC_STACK_SIZE = 2048,
-};
-
-/**
- * @brief enums SBE internal error codes
- *
-*/
-enum sbeInternalResponseCodes
-{
- SBE_FIFO_RESET_RECEIVED = 0xFA,
- SBE_FIFO_RESET_HANDLING_FAILED = 0xFB,
- SBE_FUNC_NOT_SUPPORTED = 0xFC,
-};
-
-/**
- * @brief Global semaphore : g_sbeSemCmdRecv
- *
- * This is used to synchronize between the ISR and
- * the command receiver thread.
- *
- */
-extern PkSemaphore g_sbeSemCmdRecv;
-
-/**
- * @brief Global semaphore : g_sbeSemCmdProcess
- *
- * This is used to synchronize between command receiver thread
- * and synchronous command processor thread.
- *
- */
-extern PkSemaphore g_sbeSemCmdProcess;
-
-/**
- * @brief Global semaphore : g_sbeSemFifoReset
- *
- * This is used to synchronize the graceful handling of FIFO reset
- * between command receiver and synchronous command processor threads.
- *
- */
-extern PkSemaphore g_sbeSemFifoReset;
-
-/**
- * @TODO via RTC : 128658
- * Mutex protect the critical data
- * e.g., add Mutex g_sbeMutCmdReqBuf etc.
- */
-
-/**
- * @brief sbeCommandReceiver_routine
- * The major responsibilities of this thread are :
- * - Determine the reason for the interrupt
- * - FIFO New data
- * - FIFO reset
- * - Host services
- * - Dequeue the mandatory 2 entry header from upstream FIFO
- * - Command input data validation
- * - SBE State and pre-requirements validation
- * - FFDC collection and FIFO flush upon validation failure
- * - Unblock SBE command processor thread
- * - Perform FIFO reset upon request from SP
- *
- * @param[in] i_pArg - Any buffer needed to be passed to the thread routine
- */
-void sbeCommandReceiver_routine(void *i_pArg);
-
-/**
- * @brief sbeSyncCommandProcessor_routine
- * The major responsibilities of this thread are :
- * - Dequeue data payload from upstream FIFO
- * - Un-marshalling of the command request data
- * - Blacklist validation
- * - FFDC collection upon validation failure
- * - Invoke the corresponding Hardware access utility
- * or the HWP corresponding to the chipOp request
- * - FFDC collection and FIFO flush upon hardware access / HWP failure
- * - Build the response buffer with the data and the header
- * - Enqueue the response into the Downstream FIFO
- * - Un-mask the new data available interrupt
- *
- * @param[in] i_pArg - Any buffer needed to be passed to the thread routine
- */
-void sbeSyncCommandProcessor_routine(void *i_pArg);
-
-/**
- * @brief sbeAsyncCommandProcessor_routine
- * @TODO RTC via : 130392
- * Add infrastructure for host interface
- *
- * @param[in] i_pArg - Any buffer needed to be passed to the thread routine
- */
-void sbeAsyncCommandProcessor_routine(void *i_pArg);
-
-
-/* @brief ISR for all application FIFO Interrupts
- * - FIFO : New data available
- * - FIFO : Reset Request
- *
- * @param[in/out] i_pArg - Any buffer needed to be passed to the handler
- * @param[in] i_irq - IRQ number as defined in the SBE PPE spec
- */
-void sbe_fifo_interrupt_handler(void* i_pArg, PkIrqId i_irq);
-
-
-/* brief : Register SBE interrupt handlers and enable the IRQs
- *
- * @return int PK_OK - Success (IRQ Setup was successful)
- * PK_INVALID_ARGUMENT_IRQ_HANDLER - Invalid argument passed
- * (Code bug)
- *
- */
-int sbeIRQSetup (void);
-
-
-#endif /* __SBEFW_SBE_H */
diff --git a/src/ppe/sbe/sbefw/sbefifo.C b/src/ppe/sbe/sbefw/sbefifo.C
deleted file mode 100644
index 1489ad1..0000000
--- a/src/ppe/sbe/sbefw/sbefifo.C
+++ /dev/null
@@ -1,274 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sbefw/sbefifo.C $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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: ppe/sbe/sbefw/sbefifo.C
- *
- * @brief This file contains the SBE FIFO Commands
- *
- */
-
-#include "sbeexeintf.H"
-#include "sbefifo.H"
-#include "sbetrace.H"
-#include "sbe_sp_intf.H"
-
-//////////////////////////////////////////////////////
-//////////////////////////////////////////////////////
-uint32_t sbeUpFifoDeq_mult (uint8_t &io_len,
- uint32_t *o_pData,
- const bool i_flush)
-{
- #define SBE_FUNC " sbeUpFifoDeq_mult "
- uint32_t l_rc = SBE_FIFO_RC_UNKNOWN;
- uint8_t l_len = 0;
-
- // @TODO via RTC : 130575
- // Refactor this utility to
- // optimize RC handling, stack usage
- // and FIFO operation infrastructure.
- //
-
- do
- {
- sbe_upfifo_entry_t l_data = {0};
- uint64_t l_upfifo_data = 0;
-
- // Read Double word from the Upstream FIFO;
- // The DW data represents the first 32 bits of data word entry
- // followed by the status bits.
-
- // Bit 0-31 : Data
- // Bit 32 : Data valid flag
- // Bit 33 : EOT flag
- // Bit 34-63 : Status (2-31)
- // Valid : EOT
- // 1 : 0 -> data=message
- // 0 : 1 -> data=dummy_data of EOT operation
- // 0 : 0 -> data=dummy_data
- // 1 : 1 -> Not used
-
- l_rc = sbeUpFifoDeq ( &l_upfifo_data );
-
- if (l_rc)
- {
- // Error while dequeueing from upstream FIFO
- SBE_ERROR(SBE_FUNC"sbeUpFifoDeq failed,"
- "l_rc=[0x%08X]", l_rc);
- l_rc = SBE_SEC_FIFO_ACCESS_FAILURE;
- break;
- }
-
- l_data.upfifo_data = (uint32_t)(l_upfifo_data>>32);
- l_data.upfifo_status.upfifo_status_uint32 = (uint32_t)
- (l_upfifo_data);
-
- SBE_DEBUG(SBE_FUNC"sbeUpFifoDeq, "
- "l_data.upfifo_data=[0x%08X],"
- "l_data.upfifo_status=[0x%08X]",
- l_data.upfifo_data,
- l_data.upfifo_status.upfifo_status_uint32);
-
- // If FIFO reset is requested
- if(l_data.upfifo_status.upfifo_status_bitset.req_upfifo_reset)
- {
- // @TODO via RTC : 126147
- // Review reset loop flow in here.
- // Received a FIFO reset request
- l_rc = SBE_FIFO_RC_RESET;
- break;
- }
-
- // if EOT flag is set
- // clear EOT
- if (l_data.upfifo_status.upfifo_status_bitset.eot_flag)
- {
- l_rc = sbeUpFifoAckEot();
- if (l_rc)
- {
- // Error while ack'ing EOT in upstream FIFO
- SBE_ERROR(SBE_FUNC"sbeUpFifoAckEot failed,"
- "l_rc=[0x%08X]", l_rc);
- // Collect FFDC
- l_rc = SBE_FIFO_RC_EOT_ACK_FAILED;
- }
- else
- {
- l_rc = SBE_FIFO_RC_EOT_ACKED;
- }
- break;
- }
-
- // if Upstream FIFO is empty,
- if (l_data.upfifo_status.upfifo_status_bitset.fifo_empty)
- {
- l_rc = SBE_FIFO_RC_EMPTY;
- continue;
- }
-
- if (i_flush)
- {
- l_len = 0; // to force the upFIFO flush until EOT arrives
- continue;
- }
-
- o_pData[l_len] = l_data.upfifo_data;
- ++l_len;
- l_rc = SBE_SEC_OPERATION_SUCCESSFUL;
-
- } while(l_len<io_len);
-
- // Return the length of entries dequeued.
- // When user sets i_flush as true, this
- // would return io_len as 0;
- io_len = l_len;
- return l_rc;
-
- #undef SBE_FUNC
-}
-
-//////////////////////////////////////////////////////
-//////////////////////////////////////////////////////
-uint32_t sbeDownFifoEnq_mult (uint8_t &io_len,
- const uint32_t *i_pData)
-{
- #define SBE_FUNC " sbeDownFifoEnq_mult "
- uint8_t l_rc = SBE_FIFO_RC_UNKNOWN;
- uint8_t l_len = 0;
-
- // @TODO via RTC : 130575
- // Refactor this utility to
- // optimize RC handling, stack usage
- // and FIFO operation infrastructure.
-
- do
- {
- sbe_downfifo_status_t l_downFifoStatus ;
- typedef union
- {
- uint64_t status;
- uint64_t data;
- } sbeDownFiFoEntry_t;
- sbeDownFiFoEntry_t l_sbeDownFiFoEntry ;
-
- // Read the down stream FIFO status
- l_rc = sbeDownFifoGetStatus (&l_sbeDownFiFoEntry.status);
- if (l_rc)
- {
- // Error while reading downstream FIFO status
- SBE_ERROR(SBE_FUNC"sbeDownFifoGetStatus failed, "
- "l_rc=[0x%08X]", l_rc);
- l_rc = SBE_SEC_FIFO_ACCESS_FAILURE;
- break;
- }
-
- l_downFifoStatus.downfifo_status_uint32 = (uint32_t)
- (l_sbeDownFiFoEntry.status>>32);
-
- SBE_DEBUG(SBE_FUNC"downstream fifo status[0x%08X]",
- l_downFifoStatus.downfifo_status_uint32);
-
- // Check if there was a FIFO reset request from SP
- if (l_downFifoStatus.downfifo_status_bitset.req_upfifo_reset)
- {
- // @TODO via RTC : 126147
- // Review reset loop flow in here.
- // Received an upstream FIFO reset request
- SBE_ERROR(SBE_FUNC"Received reset request");
- l_rc = SBE_FIFO_RC_RESET;
- break;
- }
-
- // Check if downstream FIFO is full
- if (l_downFifoStatus.downfifo_status_bitset.fifo_full)
- {
- // Downstream FIFO is full
- SBE_INFO(SBE_FUNC"Downstream FIFO is full");
- l_rc = SBE_FIFO_RC_FULL; // in case we ever add timeout
- continue;
- }
-
- // PIB write data format:
- // Bit 0 - 31 : Data
- // Bit 32 - 63 : Unused
-
- l_sbeDownFiFoEntry.data = (uint64_t)(*(i_pData+l_len));
- l_sbeDownFiFoEntry.data = l_sbeDownFiFoEntry.data<<32;
-
- SBE_DEBUG(SBE_FUNC"Downstream fifo data entry[0x%08X]",
- (l_sbeDownFiFoEntry.data>>32));
-
- // Write the data into the downstream FIFO
- l_rc = sbeDownFifoEnq (l_sbeDownFiFoEntry.data);
- if (l_rc)
- {
- SBE_ERROR(SBE_FUNC"sbeDownFifoEnq failed, "
- "l_rc[0x%08X]", l_rc);
- l_rc = SBE_SEC_FIFO_ACCESS_FAILURE;
- break;
- }
-
- l_rc = SBE_SEC_OPERATION_SUCCESSFUL;
- ++l_len;
-
- } while(l_len<io_len);
-
- io_len = l_len;
- return l_rc;
- #undef SBE_FUNC
-}
-
-////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////
-void sbeBuildMinRespHdr ( uint32_t *io_pBuf,
- uint8_t &io_curIndex,
- const uint16_t i_primStatus,
- const uint16_t i_secStatus,
- const uint32_t i_pcbpibStatus,
- const uint8_t i_startIndex )
-{
- do
- {
- if (!io_pBuf)
- {
- break;
- }
-
- io_pBuf[io_curIndex] = sbeBuildRespHeaderMagicCodeCmdClass();
- io_pBuf[++io_curIndex] = sbeBuildRespHeaderStatusWordLocal(
- i_primStatus, i_secStatus);
-
- // @TODO via RTC: 128916
- // pcb-pib error is optional,
- // not needed for success case
- io_pBuf[++io_curIndex] = i_pcbpibStatus;
-
- // Somehow this compiler isn't allowing the
- // index pre-increment for the last array entry
- // directly embedded into the assignment
- ++io_curIndex;
- io_pBuf[io_curIndex] = io_curIndex - i_startIndex + 1;
-
- } while(false);
-}
diff --git a/src/ppe/sbe/sbefw/sbefifo.H b/src/ppe/sbe/sbefw/sbefifo.H
deleted file mode 100644
index 6838f3d..0000000
--- a/src/ppe/sbe/sbefw/sbefifo.H
+++ /dev/null
@@ -1,490 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sbefw/sbefifo.H $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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: ppe/sbe/sbefw/sbefifo.H
- *
- * @brief This file contains the SBE FIFO Commands
- *
- */
-
-#ifndef __SBEFW_SBEFIFO_H
-#define __SBEFW_SBEFIFO_H
-
-#include "sbeexeintf.H"
-#include "sbetrace.H"
-#include "ppe42_scom.h"
-#include "sbe_sp_intf.H"
-
-/**
- * @brief SBE FIFO Access addresses
- *
- */
-const uint32_t SBE_FIFO_BASE = 0x000B0000;
-
-const uint32_t SBE_UPSTREAM_FIFO_DEQ_ADD = SBE_FIFO_BASE + 0x0000;
-const uint32_t SBE_UPSTREAM_FIFO_STATUS = SBE_FIFO_BASE + 0x0001;
-const uint32_t SBE_UPSTREAM_FIFO_SIGNAL_EOT = SBE_FIFO_BASE + 0x0002;
-const uint32_t SBE_UPSTREAM_FIFO_REQ_RESET = SBE_FIFO_BASE + 0x0003;
-const uint32_t SBE_UPSTREAM_FIFO_PERFORM_RESET = SBE_FIFO_BASE + 0x0004;
-const uint32_t SBE_UPSTREAM_FIFO_ACK_EOT = SBE_FIFO_BASE + 0x0005;
-
-const uint32_t SBE_DOWNSTREAM_FIFO_ENQ_ADD = SBE_FIFO_BASE + 0x0010;
-const uint32_t SBE_DOWNSTREAM_FIFO_STATUS = SBE_FIFO_BASE + 0x0011;
-const uint32_t SBE_DOWNSTREAM_FIFO_SIGNAL_EOT = SBE_FIFO_BASE + 0x0012;
-const uint32_t SBE_DOWNSTREAM_FIFO_REQ_RESET = SBE_FIFO_BASE + 0x0013;
-const uint32_t SBE_DOWNSTREAM_FIFO_PERFORM_RESET = SBE_FIFO_BASE + 0x0014;
-const uint32_t SBE_DOWNSTREAM_FIFO_ACK_EOT = SBE_FIFO_BASE + 0x0015;
-
-/**
- * @brief SBE Upstream FIFO Status bits
- *
- */
-
-typedef struct
-{
- uint32_t valid_flag:1; // Bit 0
- uint32_t eot_flag:1; // Bit 1
- uint32_t parity_err:1; // Bit 2
- uint32_t reserved3_5:3; // Bit 3:5
- uint32_t req_upfifo_reset:1; // Bit 6
- uint32_t req_downfifo_reset:1; // Bit 7
- uint32_t signaling_eot:1; // Bit 8
- uint32_t reserved9:1; // Bit 9
- uint32_t fifo_full:1; // Bit 10
- uint32_t fifo_empty:1; // Bit 11
- uint32_t fifo_entry_count:4; // Bit 12:15
- uint32_t fifo_valid_flags:8; // Bit 16:23
- uint32_t fifo_eot_flags:8; // Bit 24:31
-
-} sbe_upfifo_status_bitset_t ;
-
-typedef union
-{
- sbe_upfifo_status_bitset_t upfifo_status_bitset;
- uint32_t upfifo_status_uint32;
-} sbe_upfifo_status_t;
-
-/**
- * @brief FIFO access return codes for internal purpose
- *
- */
-typedef enum
-{
- SBE_FIFO_RC_ACCESS_SUCCESS = 0,
- SBE_FIFO_RC_RESET = 0xE0,
- SBE_FIFO_RC_FULL,
- SBE_FIFO_RC_EMPTY,
- SBE_FIFO_RC_DUMMY_DATA,
- SBE_FIFO_RC_EOT_ACKED,
- SBE_FIFO_RC_EOT_ACK_FAILED,
- SBE_FIFO_RC_UNKNOWN,
-} sbe_fifo_access_rc_t;
-
-
-/**
- * @brief 64-bit DW structure for Upstream FIFO Read
- *
- */
-typedef struct
-{
- uint32_t upfifo_data;
- sbe_upfifo_status_t upfifo_status;
-} sbe_upfifo_entry_t ;
-
-
-/**
- * @brief SBE Downstream FIFO Status bits
- *
- */
-typedef struct
-{
- uint32_t reserved0_1:2; // Bit 0:1
- uint32_t parity_err:1; // Bit 2
- uint32_t reserved3_5:3; // Bit 3:5
- uint32_t req_downfifo_reset:1; // Bit 6
- uint32_t req_upfifo_reset:1; // Bit 7
- uint32_t signaling_eot:1; // Bit 8
- uint32_t reserved9:1; // Bit 9
- uint32_t fifo_full:1; // Bit 10
- uint32_t fifo_empty:1; // Bit 11
- uint32_t fifo_entry_count:4; // Bit 12:15
- uint32_t fifo_valid_flags:8; // Bit 16:23
- uint32_t fifo_eot_flags:8; // Bit 24:31
-
-} sbe_downfifo_status_bitset_t ;
-
-typedef union
-{
- sbe_downfifo_status_bitset_t downfifo_status_bitset;
- uint32_t downfifo_status_uint32;
-} sbe_downfifo_status_t;
-
-
-// @TODO via RTC 129073.
-// Put these structures in separate file as these are not FIFO specific.
-// Also make sure all FIFO structures are 32 bit alligned ( the largest
-// member should be atleast 4 byte). It is required as in sbe fifo
-// operation we are casting these structures to uint32_t pointer. It can
-// cause allignment issue if largest member of structure is not atleast
-// 32 bit. We can use bit fields to optimize memory requirements.
-/**
- * @brief Command Request Header
- */
-typedef struct
-{
- uint32_t len;
- uint16_t reserved;
- uint8_t cmdClass;
- uint8_t command;
-}sbeCmdReqBuf_t;
-
-extern sbeCmdReqBuf_t g_sbeCmdHdr;
-
-/**
- * @brief structure for generic header for fifo response.
- *
- */
-typedef struct
-{
- uint16_t magicCode;
- uint8_t cmdClass;
- uint8_t command;
- uint16_t primaryStatus;
- uint16_t secondaryStatus;
-
- /**
- * @brief set the primary and secondary status
- *
- * @param[in] i_prim Primary status
- * @param[in] i_sec Secondary status
- *
- * @return
- */
- void setStatus( const uint16_t i_prim, const uint16_t i_sec)
- {
- primaryStatus = i_prim;
- secondaryStatus = i_sec;
- }
-
- /**
- * @brief set initial values for response header
- *
- * @note We did not set this in constructor as based on use case
- * it is possible that g_sbeCmdHdr does not have proper
- * values at time of object creation.
- *
- */
- void init()
- {
- magicCode = 0xC0DE;
- cmdClass = g_sbeCmdHdr.cmdClass;
- command = g_sbeCmdHdr.command;
- primaryStatus = SBE_PRI_OPERATION_SUCCESSFUL;
- secondaryStatus = SBE_SEC_OPERATION_SUCCESSFUL;
- }
-
-}sbeResponseGenericHeader_t;
-
-/**
- * @brief structure for ffdc header for fifo response.
- *
- */
-typedef struct sbeResponseFfdc
-{
- uint16_t magicBytes;
- uint16_t lenInWords; // length in word( 4 byte )
- //@TODO via RTC 129073.
- //make fapiRc 64 bit
- uint32_t fapiRc;
-
- /**
- * @brief set rc
- *
- * @param[in] i_rc FAPI RC
- *
- * @return
- */
- void setRc(const uint32_t i_rc)
- {
- fapiRc = i_rc;
- }
-
- /**
- * @brief constructor
- *
- * @param[in] i_rc FAPI RC
- *
- * @return
- */
- sbeResponseFfdc()
- {
- magicBytes = 0xFFDC;
- //TODO via 129076.
- //Need to change value for length once FFDC design is final.
- lenInWords = ( sizeof(magicBytes) + sizeof(lenInWords)
- + sizeof(fapiRc) )/ sizeof(uint32_t);
- fapiRc = 0;
- }
-}sbeResponseFfdc_t;
-
-/**
- * @brief structure for execute istep chipop (0xA101) contents.
- *
- */
-typedef struct
-{
- uint8_t reserved1;
- uint8_t major;
- uint8_t reserved2;
- uint8_t minor;
-}sbeIstepReqMsg_t;
-
-
-/**
- * @brief Command response structure to hold the primary and secondary
- * status values. This will be utilized when a command class
- * validation or state machine check fails.
- *
- */
-typedef struct
-{
- uint16_t prim_status ; // Primary Response Status
- uint16_t sec_status ; // Secondary Response Status
-} sbeCmdRespHdr_t;
-
-extern sbeCmdRespHdr_t g_sbeCmdRespHdr;
-
-typedef struct
-{
- uint16_t magic_bytes;
- uint16_t len;
-} sbeCmdResp_FFDC_t;
-
-
-/*****************************************************************/
-/** Upstream FIFO access utilities **/
-/*****************************************************************/
-
-/**
- * @brief sbeUpFifoDeq : Read entry and status from Upstream FIFO
- *
- * @param[out] 64-Bit Data read from Upstream FIFO
- *
- * @return Rc from the underlying scom utility
- *
- */
-extern inline uint32_t sbeUpFifoDeq (uint64_t *o_data)
-{
- /* For SBE FIFO (PIB) access, chiplet ID should be passed as 0 */
- return getscom(0, SBE_UPSTREAM_FIFO_DEQ_ADD, o_data);
-}
-
-
-/**
- * @brief sbeUpFifoPerformReset : Perform Upstream FIFO reset request
- *
- * @return Rc from the underlying scom utility
- *
- */
-extern inline uint32_t sbeUpFifoPerformReset (void)
-{
- SBE_TRACE(">sbeUpFifoPerformReset");
- return putscom(0, SBE_UPSTREAM_FIFO_PERFORM_RESET, ((uint64_t)0x1)<<32);
-}
-
-
-/**
- * @brief sbeUpFifoAckEot : Acknowledge EOT in Upstream FIFO
- *
- * @return Rc from the underlying scom utility
- *
- */
-extern inline uint32_t sbeUpFifoAckEot (void)
-{
- SBE_DEBUG("sbeUpFifoAckEot");
-
- return putscom(0, SBE_UPSTREAM_FIFO_ACK_EOT, ((uint64_t)0x1)<<32);
-}
-
-
-/*****************************************************************/
-/** Downstream FIFO access utilities **/
-/*****************************************************************/
-
-/**
- * @brief sbeDownFifoEnq : Write data into Downstream FIFO
- *
- * @param[in] 64-Bit Data write into Downstream FIFO
- * Bit 0-31 : Data
- * Bit 32-63 : Unused
- *
- * @return Rc from the underlying scom utility
- */
-extern inline uint32_t sbeDownFifoEnq (const uint64_t i_data)
-{
- SBE_DEBUG(">sbeDownFifoEnq");
- return putscom(0, SBE_DOWNSTREAM_FIFO_ENQ_ADD, i_data);
-}
-
-
-/**
- * @brief sbeDownFifoGetStatus : Read status from downstream FIFO
- *
- * @param[out] 64-Bit Read status from downstream FIFO
- * Bit 0-31 : Data
- * Bit 32-63 : Unused
- *
- * @return Rc from the underlying scom utility
- */
-extern inline uint32_t sbeDownFifoGetStatus (uint64_t *o_data)
-{
- SBE_DEBUG(">sbeDownFifoStatus");
- return getscom(0, SBE_DOWNSTREAM_FIFO_STATUS, o_data);
-}
-
-/**
- * @brief sbeDownFifoSignalEot : Signal EOT in Downstream FIFO
- *
- * @return Rc from the underlying scom utility
- *
- */
-extern inline uint32_t sbeDownFifoSignalEot (void)
-{
- SBE_DEBUG(">sbeDownFifoSignalEot");
- return putscom(0, SBE_DOWNSTREAM_FIFO_SIGNAL_EOT, ((uint64_t)0x1)<<32);
-}
-
-
-/**********************************************************************/
-// Utilities
-/**********************************************************************/
-
-/**
- * @brief sbeUpFifoDeq_mult : Dequeue multiple entries from upstream FIFO
- *
- * @param[in/out] io_len
- * number of entries to dequeue as input,
- * number of entries dequeued as output without
- * taking EOT dummy entry into consideration
- * @param[out] o_pData entries dequeued into the buffer
- * @param[in] i_flush true / false
- * true - caller requested FIFO flush,
- * io_len would be returned as 0
- * false - default case,
- * io_len would be number of entries dequeued
- *
- * @return Rc from the underlying scom utility
- *
- */
-extern uint32_t sbeUpFifoDeq_mult (uint8_t &io_len,
- uint32_t *o_pData,
- const bool i_flush = false);
-
-
-/**
- * @brief sbeDownFifoEnq_mult : Enqueue into downstream FIFO
- *
- * @param[in/out] io_len number of entries to enqueue as input,
- * number of entries enqueued as output
- * @param[in] i_pData buffer containting data to be enqueued
- *
- * @return Rc from the underlying scom utility
- *
- */
-extern uint32_t sbeDownFifoEnq_mult (uint8_t &io_len,
- const uint32_t *i_pData) ;
-
-
-/**
- * @brief sbeBuildRespHeaderMagicCodeCmdClass
- * Builds the header word containing the magic code,
- * the command class and the opcode
- *
- * @return Returns the header word in the response header
- * containing the magic code, command class and opcode
- *
- */
-extern inline uint32_t sbeBuildRespHeaderMagicCodeCmdClass (void)
-{
- return ( (0xC0DE0000 ) |
- (uint32_t)(g_sbeCmdHdr.cmdClass << 8) |
- (uint32_t)(g_sbeCmdHdr.command ));
-}
-
-/**
- * @brief sbeBuildRespHeaderStatusWordGlobal
- * Builds the status header word from global variables
- *
- * @return Returns the status word in the response header
- *
- */
-extern inline uint32_t sbeBuildRespHeaderStatusWordGlobal (void)
-{
- return ( (((uint32_t)g_sbeCmdRespHdr.prim_status)<<16) |
- (g_sbeCmdRespHdr.sec_status) );
-}
-
-/**
- * @brief sbeBuildRespHeaderStatusWordLocal
- * Builds the status header word from passed in parameters
- *
- * @param[in] const uint16_t i_primStatus Primary Response Status Code
- * @param[in] const uint16_t i_secStatus Secondary Response Status Code
- *
- * @return Returns the status word in the response header
- *
- */
-extern inline uint32_t sbeBuildRespHeaderStatusWordLocal (
- const uint16_t i_primStatus,
- const uint16_t i_secStatus)
-{
- return ( (((uint32_t)i_primStatus)<<16) | (i_secStatus) );
-}
-
-/**
- * @brief sbeBuildMinRespHdr : Builds minimum response header
- *
- * @desc This builds the buffer with the following status words
- * - Magic Bytes, Command Class, Command opcode
- * - Primary Status Code, Secondary Status Code
- * - PCB / PIB Status Code [optional]
- * - Distance to Status Header
- * @param[in/out] uint32_t *io_pBuf Buffer to be filled in
- * @param[in/out] uint8_t &io_curIndex Current Index into the buffer
- * @param[in] const uint16_t i_primStatus Primary Response Status Code
- * @param[in] const uint16_t i_secStatus Secondary Response Status Code
- * @param[in] const uint32_t i_pcbpibStatus PCB-PIB Response Status Code
- * @param[in] const uint8_t i_startIndex Starting Index into the buffer
- */
-
-void sbeBuildMinRespHdr ( uint32_t *io_pBuf,
- uint8_t &io_curIndex,
- const uint16_t i_primStatus,
- const uint16_t i_secStatus,
- const uint32_t i_pcbpibStatus,
- const uint8_t i_startIndex = 0 );
-
-
-#endif // __SBEFW_SBEFIFO_H
diff --git a/src/ppe/sbe/sbefw/sbefwfiles.mk b/src/ppe/sbe/sbefw/sbefwfiles.mk
deleted file mode 100644
index d7454c3..0000000
--- a/src/ppe/sbe/sbefw/sbefwfiles.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/ppe/sbe/sbefw/sbefwfiles.mk $
-#
-# OpenPOWER OnChipController Project
-#
-# Contributors Listed Below - COPYRIGHT 2015
-# [+] 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
-SBEFW-CPP-SOURCES = sbemain.C
-SBEFW-CPP-SOURCES += sbeirq.C
-SBEFW-CPP-SOURCES += sbecmdreceiver.C
-SBEFW-CPP-SOURCES += sbecmdprocessor.C
-SBEFW-CPP-SOURCES += sbecmdparser.C
-SBEFW-CPP-SOURCES += sbecmdscomaccess.C
-SBEFW-CPP-SOURCES += sbecmdiplcontrol.C
-SBEFW-CPP-SOURCES += sbefifo.C
-SBEFW-CPP-SOURCES += pool.C
-SBEFW-C-SOURCES =
-SBEFW-S-SOURCES =
-
-SBEFW_OBJECTS = $(SBEFW-C-SOURCES:.c=.o) $(SBEFW-CPP-SOURCES:.C=.o) $(SBEFW-S-SOURCES:.S=.o)
diff --git a/src/ppe/sbe/sbefw/sbeirq.C b/src/ppe/sbe/sbefw/sbeirq.C
deleted file mode 100644
index c421d13..0000000
--- a/src/ppe/sbe/sbefw/sbeirq.C
+++ /dev/null
@@ -1,128 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sbefw/sbeirq.C $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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: ppe/sbe/sbefw/sbeirq.C
- *
- * @brief This sets up and registers SBE ISRs
- *
- */
-
-#include "sbeexeintf.H"
-#include "sbeirq.H"
-#include "sbetrace.H"
-
-
-////////////////////////////////////////////////////////////////
-// @brief: SBE control loop ISR:
-// - FIFO new data available
-// - FIFO reset request
-//
-// @param[in] i_pArg - Unused
-// @param[in] i_irq - IRQ number as defined in sbeirq.h
-//
-////////////////////////////////////////////////////////////////
-void sbe_fifo_interrupt_handler (void *i_pArg, PkIrqId i_irq)
-{
- #define SBE_FUNC " sbe_fifo_interrupt_handler "
- SBE_ENTER(SBE_FUNC"i_irq=[0x%02X]",i_irq);
-
- int l_rc = 0;
- switch (i_irq)
- {
- case SBE_IRQ_SBEFIFO_DATA:
- case SBE_IRQ_SBEFIFO_RESET:
- // Mask the interrupt
- pk_irq_disable(i_irq);
-
- // Unblock the command receiver thread
- l_rc = pk_semaphore_post(&g_sbeSemCmdRecv);
- if (l_rc)
- {
- // If we received an error while posting the semaphore,
- // unmask the interrupt back and assert
- // @TODO via RTC : 129166
- // Add support for ASSERT here
- SBE_ERROR(SBE_FUNC"pk_semaphore_post failed, rc=[%d]", l_rc);
- pk_irq_enable(i_irq);
- }
- break;
-
- default:
- SBE_ERROR(SBE_FUNC"Unknown IRQ, assert");
- // @TODO via RTC : 129166
- // Add support for ASSERT here
- break;
- }
- #undef SBE_FUNC
-}
-
-////////////////////////////////////////////////////////////////
-// See sbeexeintf.h for more details
-////////////////////////////////////////////////////////////////
-int sbeIRQSetup (void)
-{
- #define SBE_FUNC " sbeIRQSetup "
- int l_rc = 0;
-
- // Disable the relevant IRQs while we set them up
- pk_irq_disable(SBE_IRQ_SBEFIFO_DATA);
- pk_irq_disable(SBE_IRQ_SBEFIFO_RESET);
-
- do
- {
- // Register the IRQ handler with PK
-
- // FIFO New data available interrupt
- l_rc = pk_irq_handler_set(SBE_IRQ_SBEFIFO_DATA,
- sbe_fifo_interrupt_handler,
- NULL);
-
- if(l_rc)
- {
- SBE_ERROR (SBE_FUNC"pk_irq_handler_set failed, IRQ=[0x%02X], "
- "rc=[%d]", SBE_IRQ_SBEFIFO_DATA, l_rc);
- break;
- }
-
- // FIFO Reset request
- l_rc = pk_irq_handler_set(SBE_IRQ_SBEFIFO_RESET,
- sbe_fifo_interrupt_handler,
- NULL);
-
- if(l_rc)
- {
- SBE_ERROR (SBE_FUNC"pk_irq_handler_set failed, IRQ=[0x%02X], "
- "rc=[%d]", SBE_IRQ_SBEFIFO_RESET, l_rc);
- break;
- }
-
- // Enable the IRQ
- pk_irq_enable(SBE_IRQ_SBEFIFO_RESET);
- pk_irq_enable(SBE_IRQ_SBEFIFO_DATA);
- } while(false);
-
- return l_rc;
- #undef SBE_FUNC
-}
diff --git a/src/ppe/sbe/sbefw/sbeirq.H b/src/ppe/sbe/sbefw/sbeirq.H
deleted file mode 100644
index 61477f4..0000000
--- a/src/ppe/sbe/sbefw/sbeirq.H
+++ /dev/null
@@ -1,108 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sbefw/sbeirq.H $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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: ppe/sbe/sbefw/sbeirq.H
- *
- * @brief This file contains the SBE PPE Interrupt Request numbers
- */
-
-#ifndef _SBE_IRQ_H
-#define _SBE_IRQ_H
-
-/**
- * @brief SBE PPE IRQ numbers
- *
- */
-
-#define SBE_IRQ_START0 0 /* SBE Start Vector 0 */
-#define SBE_IRQ_START1 1 /* SBE Start Vector 1 */
-#define SBE_IRQ_INTR0 2 /* SBE Interrupt S0 */
-#define SBE_IRQ_INTR1 3 /* SBE Interrupt S1 */
-#define SBE_IRQ_DRTM_REQ 4 /* DRTM late launch request */
-#define SBE_IRQ_SBEFIFO_RESET 5 /* FIFO - Reset request from SE */
-#define SBE_IRQ_SBEFIFO_DATA 6 /* FIFO - Incoming Data Available */
-
-#define SBE_IRQ_RESERVED_7 7
-#define SBE_IRQ_RESERVED_8 8
-#define SBE_IRQ_RESERVED_9 9
-
-#define SBE_IRQ_RESERVED_10 10
-#define SBE_IRQ_RESERVED_11 11
-#define SBE_IRQ_RESERVED_12 12
-#define SBE_IRQ_RESERVED_13 13
-#define SBE_IRQ_RESERVED_14 14
-#define SBE_IRQ_RESERVED_15 15
-#define SBE_IRQ_RESERVED_16 16
-#define SBE_IRQ_RESERVED_17 17
-#define SBE_IRQ_RESERVED_18 18
-#define SBE_IRQ_RESERVED_19 19
-#define SBE_IRQ_RESERVED_20 20
-#define SBE_IRQ_RESERVED_21 21
-#define SBE_IRQ_RESERVED_22 22
-#define SBE_IRQ_RESERVED_23 23
-#define SBE_IRQ_RESERVED_24 24
-#define SBE_IRQ_RESERVED_25 25
-#define SBE_IRQ_RESERVED_26 26
-#define SBE_IRQ_RESERVED_27 27
-#define SBE_IRQ_RESERVED_28 28
-#define SBE_IRQ_RESERVED_29 29
-#define SBE_IRQ_RESERVED_30 30
-#define SBE_IRQ_RESERVED_31 31
-#define SBE_IRQ_RESERVED_32 32
-#define SBE_IRQ_RESERVED_33 33
-#define SBE_IRQ_RESERVED_34 34
-#define SBE_IRQ_RESERVED_35 35
-#define SBE_IRQ_RESERVED_36 36
-#define SBE_IRQ_RESERVED_37 37
-#define SBE_IRQ_RESERVED_38 38
-#define SBE_IRQ_RESERVED_39 39
-#define SBE_IRQ_RESERVED_40 40
-#define SBE_IRQ_RESERVED_41 41
-#define SBE_IRQ_RESERVED_42 42
-#define SBE_IRQ_RESERVED_43 43
-#define SBE_IRQ_RESERVED_44 44
-#define SBE_IRQ_RESERVED_45 45
-#define SBE_IRQ_RESERVED_46 46
-#define SBE_IRQ_RESERVED_47 47
-#define SBE_IRQ_RESERVED_48 48
-#define SBE_IRQ_RESERVED_49 49
-#define SBE_IRQ_RESERVED_50 50
-#define SBE_IRQ_RESERVED_51 51
-#define SBE_IRQ_RESERVED_52 52
-#define SBE_IRQ_RESERVED_53 53
-#define SBE_IRQ_RESERVED_54 54
-#define SBE_IRQ_RESERVED_55 55
-#define SBE_IRQ_RESERVED_56 56
-#define SBE_IRQ_RESERVED_57 57
-#define SBE_IRQ_RESERVED_58 58
-#define SBE_IRQ_RESERVED_59 59
-#define SBE_IRQ_RESERVED_60 60
-#define SBE_IRQ_RESERVED_61 61
-#define SBE_IRQ_RESERVED_62 62
-#define SBE_IRQ_RESERVED_63 63
-
-
-
-#endif //_SBE_IRQ_H
diff --git a/src/ppe/sbe/sbefw/sbemain.C b/src/ppe/sbe/sbefw/sbemain.C
deleted file mode 100644
index 04e1f9b..0000000
--- a/src/ppe/sbe/sbefw/sbemain.C
+++ /dev/null
@@ -1,289 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sbefw/sbemain.C $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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: ppe/sbe/sbefw/sbemain.C
- *
- * @brief This file does the following
- * - SBE Application Main entry point
- * - PK initialization
- * - Thread initialization
- * - Semaphore initialization
- * - IRQ setup
- * - Scheduling of the threads and
- * - Starting of the control loop code flow
- *
- */
-
-
-#include "sbeexeintf.H"
-#include "sbetrace.H"
-
-
-////////////////////////////////////////////////////////////////
-// @brief Global semaphores
-////////////////////////////////////////////////////////////////
-PkSemaphore g_sbeSemCmdRecv;
-PkSemaphore g_sbeSemCmdProcess;
-PkSemaphore g_sbeSemFifoReset;
-
-////////////////////////////////////////////////////////////////
-// @brief Stacks for Non-critical Interrupts and Threads
-////////////////////////////////////////////////////////////////
-uint8_t g_sbe_Kernel_NCInt_stack[SBE_NONCRITICAL_STACK_SIZE];
-uint8_t g_sbeCommandReceiver_stack[SBE_THREAD_CMD_RECV_STACK_SIZE];
-uint8_t g_sbeSyncCommandProcessor_stack[SBE_THREAD_SYNC_CMD_PROC_STACK_SIZE];
-uint8_t g_sbeAsyncCommandProcessor_stack[SBE_THREAD_ASYNC_CMD_PROC_STACK_SIZE];
-
-////////////////////////////////////////////////////////////////
-// @brief PkThread structure for SBE Command Receiver thread
-////////////////////////////////////////////////////////////////
-PkThread g_sbeCommandReceiver_thread;
-
-////////////////////////////////////////////////////////////////
-// @brief PkThread structure for SBE Synchronous ChipOps
-// processing thread
-////////////////////////////////////////////////////////////////
-PkThread g_sbeSyncCommandProcessor_thread;
-
-////////////////////////////////////////////////////////////////
-//// @brief PkThread structure for SBE Asynchronous ChipOps
-//// processing thread
-////////////////////////////////////////////////////////////////
-PkThread g_sbeAsyncCommandProcessor_thread;
-
-
-////////////////////////////////////////////////////////////////
-// @brief sbeInitSems - Create the necessary semaphores
-//
-// @return PK_OK - Success
-// PK_INVALID_SEMAPHORE_AT_CREATE - Invalid PkSemaphore
-// PK_INVALID_ARGUMENT_SEMAPHORE - max_count is non-zero
-// and less than the initial_count
-////////////////////////////////////////////////////////////////
-uint32_t sbeInitSems(void)
-{
- SBE_ENTER("sbeInitSems");
- int l_rc = PK_OK;
-
- do
- {
- l_rc = pk_semaphore_create(&g_sbeSemCmdRecv, 0, 1);
- if (l_rc)
- {
- break;
- }
- l_rc = pk_semaphore_create(&g_sbeSemCmdProcess, 0, 1);
- if (l_rc)
- {
- break;
- }
- l_rc = pk_semaphore_create(&g_sbeSemFifoReset, 0, 1);
- if (l_rc)
- {
- break;
- }
- } while (false);
-
- if (l_rc)
- {
- SBE_ERROR ("pk_semaphore_create, rc=[%d]", l_rc);
- }
- return l_rc;
-}
-
-////////////////////////////////////////////////////////////////
-// @brief createAndResumeThreadHelper
-// - Create and resume the given thread
-//
-// @param[in/out] io_thread A pointer to an PkThread structure to initialize
-// @param[in] i_thread_routine The subroutine that implements the thread
-// @param[in/out] io_arg Private data to be passed as the argument to the
-// thread routine when it begins execution
-// @param[in] i_stack The stack space of the thread
-// @param[in] i_stack_size The size of the stack in bytes
-// @param[in] i_priority The initial priority of the thread
-//
-// @return PK_OK Successfully created and resumed the thread
-//
-// @return PK_INVALID_THREAD_AT_CREATE io_thread is null
-// @return PK_INVALID_ARGUMENT_THREAD1 i_thread_routine is null
-// @return PK_INVALID_ARGUMENT_THREAD2 i_priority is invalid
-// @return PK_INVALID_ARGUMENT_THREAD3 the stack area wraps around
-// the end of memory.
-// @return PK_STACK_OVERFLOW The stack area at thread creation
-// is smaller than the min safe size
-// @return PK_INVALID_THREAD_AT_RESUME1 io_thread is null (unlikely)
-// @return PK_INVALID_THREAD_AT_RESUME2 The thread is not active,
-// i.e. has completed or been deleted,
-// @return PK_PRIORITY_IN_USE_AT_RESUME Another thread is already
-// mapped at the priority of the thread
-////////////////////////////////////////////////////////////////
-uint32_t createAndResumeThreadHelper(PkThread *io_pThread,
- PkThreadRoutine i_thread_routine,
- void *io_pArg,
- PkAddress i_stack,
- size_t i_stack_size,
- sbeThreadPriorities i_priority)
-{
- int l_rc = PK_OK;
-
- // Thread creation
- l_rc = pk_thread_create(io_pThread,
- i_thread_routine,
- io_pArg,
- i_stack,
- i_stack_size,
- (PkThreadPriority)i_priority);
- if(l_rc == PK_OK)
- {
- // resume the thread once created
- l_rc = pk_thread_resume(io_pThread);
- }
-
- // Check for errors creating or resuming the thread
- if(l_rc != PK_OK)
- {
- SBE_ERROR ("Failure creating/resuming thread, rc=[%d]", l_rc);
- }
-
- return l_rc;
-}
-
-////////////////////////////////////////////////////////////////
-// @brief sbeInitThreads
-// Create the resume all the firmware threads
-//
-// @return See createAndResumeThreadHelper for more details
-////////////////////////////////////////////////////////////////
-int sbeInitThreads(void)
-{
- // Locals
- uint32_t l_rc = PK_OK;
-
- do
- {
- // Initialize Command receiver thread
- l_rc = createAndResumeThreadHelper(&g_sbeCommandReceiver_thread,
- sbeCommandReceiver_routine,
- (void *)0,
- (PkAddress)g_sbeCommandReceiver_stack,
- SBE_THREAD_CMD_RECV_STACK_SIZE,
- THREAD_PRIORITY_5);
- if (l_rc)
- {
- break;
- }
-
- // Initialize Synchronous Command Processor thread
- l_rc = createAndResumeThreadHelper(&g_sbeSyncCommandProcessor_thread,
- sbeSyncCommandProcessor_routine,
- (void *)0,
- (PkAddress)g_sbeSyncCommandProcessor_stack,
- SBE_THREAD_SYNC_CMD_PROC_STACK_SIZE,
- THREAD_PRIORITY_7);
- if (l_rc)
- {
- break;
- }
-
- // Initialize Asynchronous Command Processor thread
- l_rc = createAndResumeThreadHelper(&g_sbeAsyncCommandProcessor_thread,
- sbeAsyncCommandProcessor_routine,
- (void *)0,
- (PkAddress)g_sbeAsyncCommandProcessor_stack,
- SBE_THREAD_ASYNC_CMD_PROC_STACK_SIZE,
- THREAD_PRIORITY_6);
- if (l_rc)
- {
- break;
- }
- } while (false);
-
- // If there are any errors initializing the threads
- if( l_rc )
- {
- SBE_ERROR ("Error Initializing a thread, rc=[%d]", l_rc);
- }
-
- return l_rc;
-}
-
-////////////////////////////////////////////////////////////////
-// @brief - main : SBE Application main
-////////////////////////////////////////////////////////////////
-uint32_t main(int argc, char **argv)
-{
- SBE_TRACE("Enter SBE main");
- int l_rc = 0;
-
- // @TODO via RTC : 128818
- // Explore on reclaiming the stack
- // used by this Initialization code
-
- do
- {
- // initializes kernel data -
- // stack, threads, timebase, timers, etc.
- l_rc = pk_initialize((PkAddress)g_sbe_Kernel_NCInt_stack,
- SBE_NONCRITICAL_STACK_SIZE,
- 0,
- 500000000); // @TODO via RTC : 128819
- // Need to obtain at Runtime, a new attribute?
- if (l_rc)
- {
- break;
- }
-
- SBE_DEBUG("Completed PK init");
-
- // Initialize the semaphores
- l_rc = sbeInitSems();
- if (l_rc)
- {
- break;
- }
-
- // Initialize SBE control loop threads
- l_rc = sbeInitThreads();
- if (l_rc)
- {
- break;
- }
-
- // Setup SBE PPE IRQs
- l_rc = sbeIRQSetup();
- if (l_rc)
- {
- break;
- }
-
- // Start running the highest priority thread.
- // This function never returns
- pk_start_threads();
-
- } while (false);
-
- return l_rc;
-}
diff --git a/src/ppe/sbe/sbefw/sbetrace.H b/src/ppe/sbe/sbefw/sbetrace.H
deleted file mode 100644
index b5b9c6c..0000000
--- a/src/ppe/sbe/sbefw/sbetrace.H
+++ /dev/null
@@ -1,59 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sbefw/sbetrace.H $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 */
-#ifndef __SBEFW_SBE_TRACE_H
-#define __SBEFW_SBE_TRACE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "pk_api.h"
-#include "trac_interface.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#define SBE_ENTER_MRK ">>"
-#define SBE_EXIT_MRK "<<"
-#define SBE_ERR_MRK "E>"
-#define SBE_INF_MRK "I>"
-
-#define SBE_TRACE(args...) PK_TRACE(args)
-#define SBE_ENTER(args...) PK_TRACE(SBE_ENTER_MRK"" args)
-#define SBE_EXIT(args...) PK_TRACE(SBE_EXIT_MRK"" args)
-#define SBE_ERROR(args...) PK_TRACE(SBE_ERR_MRK"" args)
-#define SBE_INFO(args...) PK_TRACE(SBE_INF_MRK"" args)
-
-//Debug traces
-#define SBE_FW_DEBUG
-#ifdef SBE_FW_DEBUG
-#define SBE_DEBUG_MRK "D>"
-#define SBE_DEBUG(args...) PK_TRACE(SBE_DEBUG_MRK"" args)
-#else
-#define SBE_DEBUG(args...)
-#endif //SBE_FW_DEBUG
-
-#endif // __SBEFW_SBE_TRACE_H
diff --git a/src/ppe/sbe/sbefw/vector b/src/ppe/sbe/sbefw/vector
deleted file mode 100644
index bcd13a5..0000000
--- a/src/ppe/sbe/sbefw/vector
+++ /dev/null
@@ -1,399 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/ppe/sbe/sbefw/vector $ */
-/* */
-/* OpenPOWER OnChipController Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
-/* [+] 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 */
-
-#ifndef stl_vector
-#define stl_vector
-
-/**
- * @file vector
- * @brief simple stl vector template class declaration.
- */
-
-#include <stddef.h>
-
-#if !defined( __STDC_LIMIT_MACROS)
-#define __STDC_LIMIT_MACROS
-#endif
-#include <stdint.h>
-#include <pool.H>
-//TODO via RTC 129166
-// Add implementation for assert
-#define assert(X)
-namespace std
-{
-
- /**
- * @class vector
- * subset of stl vector
- * @note Does not support allocators, reverse iterators.
- */
- template <class T>
- class vector
- {
- public:
-
- typedef T * iterator;
- typedef const T * const_iterator;
- typedef T & reference;
- typedef const T & const_reference;
- typedef size_t size_type;
- typedef T value_type;
- typedef T * pointer;
- typedef const T * const_pointer;
-
- protected:
-
- pointer iv_start;
- pointer iv_finish;
- SBEVECTORPOOL::vectorMemPool_t *iv_poolPtr;
- public:
-
- /**
- * Constructor default
- * @post The vector is created with storage of
- * G_BLOCKSIZE bytes.
- */
- explicit vector(void)
- {
- iv_poolPtr = SBEVECTORPOOL::allocMem();
- assert ( NULL != iv_poolPtr)
- iv_start = ( T* )iv_poolPtr->data;
- iv_finish = iv_start;
- }
-
-
- /**
- * MOVE COPY CTOR create a vector from another vector
- * @param[in] x source vector
- * @post Vector of x.size() is created from x with same
- * memory.
- * size() == capacity() == x.size()
- * @note move Copy construtor willuse shallow copy. So input
- * as well as output vector will point to same data
- */
- vector(const vector<T>&& x)
- {
- iv_start = x.iv_start;
- iv_finish = x.iv_finish;
- iv_poolPtr = x.iv_poolPtr;
- iv_poolPtr->refCount++;
- }
-
- /**
- * Reserve space for atleast n elements
- * @param[in] n Number of elements
- * @note We are having fixed size vectors in ppe. Defining
- * this function to avoid compile issues in standard
- * library. This function is noop for less than 512
- * bytes requirement. For more than 512 bytes, it will
- * assert.
- */
- void reserve(size_type n)
- {
- assert(n < max_size());
- return;
- }
- /**
- * DTOR
- * @post Storage released
- */
- __attribute__ ((always_inline))
- ~vector()
- {
- clear(); // call dtors
- SBEVECTORPOOL::releaseMem(iv_poolPtr);
- }
-
- /**
- * Move Assignment operator.
- * @param[in] x A vector.
- * @return A vector (for the purpose of multiple assigns).
- * @pre None.
- * @post *this == x, this->capacity() == x.size().
- * All previously obtained iterators are invalid.
- */
- vector<T>& operator=(const vector<T>&& x)
- {
- // Just check here for pool to make sure
- // input vector and current vector are not same;
- if( iv_poolPtr != x.iv_poolPtr)
- {
- clear();
- SBEVECTORPOOL::releaseMem(iv_poolPtr);
- iv_start = x.iv_start;
- iv_finish = x.iv_finish;
- iv_poolPtr = x.iv_poolPtr;
- iv_poolPtr->refCount++;
- }
- return(*this);
- }
-
- // Iterators --------------------
-
- /**
- * Get iterator to the first vector element
- * @return iterator of rist vector element
- * @pre None.
- * @post None.
- */
- __attribute__ ((always_inline))
- iterator begin()
- {
- return (iv_start);
- }
-
- /**
- * Get const_iterator to the first vector element
- * @return const_iterator of rist vector element
- * @pre None.
- * @post None.
- */
- __attribute__ ((always_inline))
- const_iterator begin() const
- {
- return (iv_start);
- }
-
- /**
- * Get iterator to the last vector element + 1
- * @return iterator
- * @pre None.
- * @post None.
- */
- __attribute__ ((always_inline))
- iterator end()
- {
- return (iv_finish);
- }
-
- /**
- * Get const_iterator to the last vector element + 1
- * @return const_iterator
- * @pre None.
- * @post None.
- */
- __attribute__ ((always_inline))
- const_iterator end() const
- {
- return (iv_finish);
- }
-
- // Capacity -----------------------------------------------
-
- /**
- * Get the number of elements in the container
- * @return number of elements in the container
- */
- __attribute__ ((always_inline))
- size_type size() const
- {
- return(iv_finish - iv_start);
- }
-
- /**
- * Return the maximum potential size the container could reach.
- * @return number of the maximum element count this container
- * could reach
- */
- __attribute__ ((always_inline))
- size_type max_size() const
- {
- return SBEVECTORPOOL::G_BLOCKSIZE/(sizeof(T));
- }
-
- /**
- * Query for empty container
- * @return bool, true if size()==0 else false.
- * @pre none
- * @post none
- */
- __attribute__ ((always_inline))
- bool empty() const
- {
- return(size() == 0);
- }
-
- // - Element Access -----------------------------------
-
- /**
- * Access a mutable reference to an element in the container
- * @param An index into the vector
- * @return A reference to an element
- * @pre 0 <= n < size()
- * @post None.
- */
- __attribute__ ((always_inline))
- reference operator[](size_type n)
- {
- assert(n < size());
- return(*(iv_start + n));
- }
-
- /**
- * Access a mutable reference to an element in the container
- * @param[in] index An index into the vector
- * @return A reference to an element
- * @pre 0 <= n < size()
- * @post None.
- * @note no exception handling
- */
- __attribute__ ((always_inline))
- reference at(size_type index)
- {
- assert(index < size());
- return(*(iv_start + index));
- }
-
- /**
- * Get an immutable reference to an element in the container
- * @param[in] index An index into the vector
- * @return A const_reference to an object or type T
- * @pre 0 <= n < size()
- * @post None.
- */
- __attribute__ ((always_inline))
- const_reference operator[](size_type index) const
- {
- assert(index < size());
- return(*(iv_start + index));
- }
-
- /**
- * Get an immutable reference to an element in the container
- * @param[in] index An index into the vector
- * @return A const_reference to an object or type T
- * @pre 0 <= n < size()
- * @post None.
- * @note no exception handling
- */
- __attribute__ ((always_inline))
- const_reference at(size_type index) const
- {
- assert(index < size());
- return(*(iv_start + index));
- }
-
- /**
- * Get a mutable reference to the first element in the container
- * @return reference to first element
- * @pre none
- * @post None
- */
- __attribute__ ((always_inline))
- reference front()
- {
- return *iv_start;
- }
-
- /**
- * Get an Immutable reference to the first element in the
- * container
- * @return const_reference to first element
- * @pre none
- * @post None
- */
- __attribute__ ((always_inline))
- const_reference front() const
- {
- return *iv_start;
- }
-
- /**
- * Get a mutable reference to the last element in the container
- * @return reference to last element
- * @pre none
- * @post None
- */
- __attribute__ ((always_inline))
- reference back()
- {
- return *(iv_finish-1);
- }
-
- /**
- * Get an Immutable reference to the last element in the
- * container
- * @return reference to last element
- * @pre none
- * @post None
- */
- __attribute__ ((always_inline))
- const_reference back() const
- {
- return *(iv_finish-1);
- }
-
- /**
- * Add element to the back of the container
- * @param[in] x reference to object used to create new element
- * @pre none
- * @post All previously obtained iterators are invalid.
- */
- __attribute__ ((always_inline))
- void push_back(const T& x)
- {
- assert(max_size() > size())
- new (iv_finish++) T(x);
- }
-
- /**
- * Clear the vector
- * @pre none.
- * @post size() = 0, All previously obtained iterators are
- * invalid
- * @note capacity unchanged
- */
- void clear ()
- {
- while(iv_finish != iv_start)
- {
- --iv_finish;
- (iv_finish)->~T();
- }
- }
-
- /*
- * Assign new content to the vector object
- * @param[in] n number of elements to assign
- * @param[in] x reference to element to copy in
- */
- void assign ( size_type n, const T& x)
- {
- assert(n < max_size());
- clear();
- for ( ; n> 0; n--)
- push_back( x);
- }
-
- private:
- vector(const vector<T>& x);
- vector<T>& operator=(const vector<T>& x);
-};
-
-}; // end namespace std
-
-
-#endif
-/* vim: set filetype=cpp : */
OpenPOWER on IntegriCloud