From 593629e88423f3c652c65706d4f4648db26b0fb2 Mon Sep 17 00:00:00 2001 From: Shakeeb Date: Sun, 28 Aug 2016 22:23:54 -0500 Subject: SBE code restructure: Build directory setup Change-Id: I5727522fe885260dde54a94b9ae37fd1382a76ff RTC:159709 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/28888 Tested-by: Jenkins Server Tested-by: FSP CI Jenkins Reviewed-by: RAJA DAS Reviewed-by: Sachin Gupta --- src/build/Makefile | 315 +++++++++++++++++ src/build/Mirror_WA_attributes.xml | 34 ++ src/build/base_ppe_header.S | 209 +++++++++++ src/build/base_sbe_fixed.S | 67 ++++ src/build/buildInfo.py | 48 +++ src/build/img_defs.mk | 490 ++++++++++++++++++++++++++ src/build/linkerscripts/linkloader.cmd | 96 +++++ src/build/linkerscripts/linkotprom.cmd | 43 +++ src/build/linkerscripts/linksbe.cmd | 108 ++++++ src/build/linkerscripts/linkseeprom.cmd | 200 +++++++++++ src/build/p9_sbe.H | 52 +++ src/build/parsAndCutElf.py | 69 ++++ src/build/proc_sbe_fixed.H | 211 +++++++++++ src/build/sbe_common.H | 600 ++++++++++++++++++++++++++++++++ src/build/sbe_link.H | 102 ++++++ src/build/topfiles.mk | 53 +++ 16 files changed, 2697 insertions(+) create mode 100644 src/build/Makefile create mode 100644 src/build/Mirror_WA_attributes.xml create mode 100644 src/build/base_ppe_header.S create mode 100644 src/build/base_sbe_fixed.S create mode 100755 src/build/buildInfo.py create mode 100644 src/build/img_defs.mk create mode 100755 src/build/linkerscripts/linkloader.cmd create mode 100644 src/build/linkerscripts/linkotprom.cmd create mode 100644 src/build/linkerscripts/linksbe.cmd create mode 100644 src/build/linkerscripts/linkseeprom.cmd create mode 100644 src/build/p9_sbe.H create mode 100755 src/build/parsAndCutElf.py create mode 100644 src/build/proc_sbe_fixed.H create mode 100644 src/build/sbe_common.H create mode 100644 src/build/sbe_link.H create mode 100644 src/build/topfiles.mk (limited to 'src/build') diff --git a/src/build/Makefile b/src/build/Makefile new file mode 100644 index 00000000..ff2bb580 --- /dev/null +++ b/src/build/Makefile @@ -0,0 +1,315 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/build/Makefile $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2015,2016 +# +# +# 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 + + +#Pull in the definitions that affect all makefiles for this image +include img_defs.mk + +include ../boot/bootfiles.mk + +#Pull in object file names for the top directory +include topfiles.mk + +SUBDIRS := $(PK_SRCDIR)/$(PPE_TYPE) +LIB_DIRS += -L$(OBJDIR)/pk +PKLIB := $(OBJDIR)/pk/libpk.a +LLIBS += -lpk + +SUBDIRS += $(BOOT_SRCDIR) + +SUBDIRS += ../sbefw +LIB_DIRS += -L$(OBJDIR)/sbefw +SBEFWLIB := $(OBJDIR)/sbefw/libsbefw.a +LLIBS += -lsbefw + +# FAPI2 library +SUBDIRS += $(PLAT_FAPI2_DIR)/src +LIB_DIRS += -L$(OBJDIR)/fapi2 +FAPI2LIB := $(OBJDIR)/fapi2/libfapi2.a +LLIBS += -lfapi2 + +LIB_DIRS += -L$(GCC-TOOL-PATH)/libgcc +LLIBS += -lmath -leabi -lc + +# HWP LIB library +SUBDIRS += $(HWPLIB_SRCDIR) +LIB_DIRS += -L$(OBJDIR)/lib +HWPLIB := $(OBJDIR)/libcommon.a +LLIBS += -lcommon +include $(HWPERR_SRCDIR)/hwpErrors.mk + +# Common Utils library +SUBDIRS += $(UTILS_SRCDIR) +LIB_DIRS += -L$(OBJDIR)/utils +UTILSLIB := $(OBJDIR)/utils/libutils.a +LLIBS += -lutils + +# Common Cache HWP Exit library +SUBDIRS += $(CACHE_SRCDIR) +LIB_DIRS += -L$(OBJDIR)/cache +CACHELIB := $(OBJDIR)/cache/libcache.a +LLIBS += -lcache + +# Common Core libraries +SUBDIRS += $(CORE_SRCDIR) +LIB_DIRS += -L$(OBJDIR)/core +CORELIB := $(OBJDIR)/core/libcore.a +LLIBS += -lcore + +# Common Perv libraries +SUBDIRS += $(PERV_SRCDIR) +LIB_DIRS += -L$(OBJDIR)/perv +PERVLIB := $(OBJDIR)/perv/libperv.a +LLIBS += -lperv + +# Common Nest libraries +SUBDIRS += $(NEST_SRCDIR) +LIB_DIRS += -L$(OBJDIR)/nest +NESTLIB := $(OBJDIR)/nest/libnest.a +LLIBS += -lnest + +# Initfiles library +SUBDIRS += $(INITFILES_SRCDIR) +LIB_DIRS += -L$(OBJDIR)/initfiles +INITFILESLIB := $(OBJDIR)/initfiles/libinitfiles.a +LLIBS += -linitfiles + +# Common Pm libraries +SUBDIRS += $(PM_SRCDIR) +LIB_DIRS += -L$(OBJDIR)/pm +PMLIB := $(OBJDIR)/pm/libpm.a +LLIBS += -lpm + +SIMICS_PPE_TAR_FILES += $(OBJDIR)/$(IMAGE_SBE_NAME).out +SIMICS_PPE_TAR_FILES += $(OBJDIR)/$(IMAGE_SBE_NAME).map +SIMICS_PPE_TAR_FILES += $(OBJDIR)/$(IMAGE_SBE_NAME).dis +SIMICS_PPE_TAR_FILES += $(BOOT_OBJDIR)/$(IMAGE_LOADER_NAME).out +SIMICS_PPE_TAR_FILES += $(BOOT_OBJDIR)/$(IMAGE_LOADER_NAME).map +SIMICS_PPE_TAR_FILES += $(BOOT_OBJDIR)/$(IMAGE_LOADER_NAME).dis +SIMICS_PPE_TAR_FILES += $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out +SIMICS_PPE_TAR_FILES += $(OBJDIR)/$(IMAGE_SEEPROM_NAME).map +SIMICS_PPE_TAR_FILES += $(OBJDIR)/$(IMAGE_SEEPROM_NAME).dis +SIMICS_PPE_TAR_FILES += $(OBJDIR)/sbe.syms +SIMICS_PPE_TAR_FILES += $(TEST_SRCDIR)/*.xml +SIMICS_PPE_TAR_FILES += $(TEST_SRCDIR)/*.py +SIMICS_PPE_TAR_FILES += $(PPETRACEPP_DIR)/fsp-trace +SIMICS_PPE_TAR_FILES += $(OBJDIR)/sbeStringFile +SIMICS_PPE_TAR_FILES += $(OBJDIR)/ppe2fsp +SIMICS_BB_TAR_FILES += $(SIMICSTOOLS_SRCDIR)/* +SIMICS_PPETRACEPP_TAR_FILES += $(PPETRACEPP_DIR)/cmvc/makefile +SIMICS_PPETRACEPP_TAR_FILES += $(PPETRACEPP_DIR)/ppe2fsp.h +SIMICS_PPETRACEPP_TAR_FILES += $(PPETRACEPP_DIR)/ppe2fsp.c +SIMICS_PPETRACEPP_TAR_FILES += $(PPETRACEPP_DIR)/ppe2fsp_cmd.c +SIMICS_PPETRACEPP_TAR_FILES += $(PPETRACEPP_DIR)/trac_interface.h +SIMICS_PPETRACEPP_TAR_FILES += $(PK_SRCDIR)/trace/pk_trace.h +SIMICS_PARSERPLUGINS_TAR_FILES += $(SBE_FW_DIR)/plugins/sbeUserDataParser.C +SIMICS_PARSERPLUGINS_TAR_FILES += $(SBE_FW_DIR)/sbeFFDCType.H + +SBE_TOOLS := $(BASE_OBJDIR)/sbe_default_tool + +P9_XIP_TOOL := $(P9_XIP_BINDIR)/p9_xip_tool + +LINK_OBJS = $(OBJS) + +# Define the objects +OBJS := $(addprefix $(OBJDIR)/, $(TOP_OBJECTS)) +LINK_OBJS += $(OBJS) $(GCCLIBS) + +LINK_SCRIPT_SEEPROM = $(addprefix $(OBJDIR)/, linkscriptseeprom) +LINK_SCRIPT_SBE = $(addprefix $(OBJDIR)/, linkscriptsbe) + +# ---- SEEPROM 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 + ./parsAndCutElf.py + $(OBJDUMP) -S $< > $(OBJDIR)/$(IMAGE_SEEPROM_NAME).dis + +#create a linked ELF executable +$(OBJDIR)/$(IMAGE_SEEPROM_NAME).out: ppe_trace_bin buildInfo $(SUBDIRS) $(LINK_OBJS) $(LINK_SCRIPT_SEEPROM) + $(LD) -n -T$(LINK_SCRIPT_SEEPROM) -Map $(OBJDIR)/$(IMAGE_SEEPROM_NAME).map \ + -Bstatic -o $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out $(BOOT_OBJDIR)/$(BOOT_OBJECTS) $(OBJS) $(LIB_DIRS) \ + --start-group $(LLIBS) --end-group -leabi -lmath -lc + +# pass the link command file through the C preprocessor to evaluate macros +# and remove comments +$(LINK_SCRIPT_SEEPROM): $(LINKER_DIR)/linkseeprom.cmd + $(CPP) -I. -E -x c++ -P $(DEFS) $(LINKER_DIR)/linkseeprom.cmd -o $(LINK_SCRIPT_SEEPROM) + +# ---- 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 + $(NM) $< > $(OBJDIR)/$(IMAGE_SBE_NAME).syms + +# create a linked ELF executable +$(OBJDIR)/$(IMAGE_SBE_NAME).out: ppe_trace_bin buildInfo $(OBJDIR)/base_sbe_fixed.o $(SUBDIRS) $(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): $(LINKER_DIR)/linksbe.cmd + $(CPP) -E -x c++ -I. -P $(DEFS) $(LINKER_DIR)/linksbe.cmd -o $(LINK_SCRIPT_SBE) + +all: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin $(OBJDIR)/$(IMAGE_SBE_NAME).bin \ + $(SBE_TOOLS) normalize defaultset $(OBJDIR)/fixed.bin appendloader \ + appendoverrides add_LoaderAddr symbols tracehash buildinfo report + +install: all + @echo "Installing simics.tar" + @rm -rf $(OBJDIR)/simics-tar-dir + @mkdir $(OBJDIR)/simics-tar-dir + @mkdir $(OBJDIR)/simics-tar-dir/ppetracepp + @mkdir $(OBJDIR)/simics-tar-dir/parserplugins + @cp $(SIMICS_PPE_TAR_FILES) $(OBJDIR)/simics-tar-dir + @cp $(SIMICS_BB_TAR_FILES) $(OBJDIR)/simics-tar-dir + @cp $(SIMICS_PPETRACEPP_TAR_FILES) $(OBJDIR)/simics-tar-dir/ppetracepp + @cp $(SIMICS_PARSERPLUGINS_TAR_FILES) $(OBJDIR)/simics-tar-dir/parserplugins + @cd $(OBJDIR)/simics-tar-dir && tar -cvf simics.tar * && mv simics.tar $(OBJDIR) && cd .. + @rm -rf $(OBJDIR)/simics-tar-dir + @echo "Generated simics.tar in Sbe Obj Directory" + +.PHONY: all normalize defaultset appendloader add_LoaderAddr symbols report \ + appendoverrides xml tracehash topfixedheaders $(SUBDIRS) + +buildinfo: $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin + $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin set build_date `date +%Y%m%d` + $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin set build_time `date +%H%M` + $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin set build_user `id -un` + $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin set build_host `hostname` + +add_LoaderAddr: $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out + $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin set L1_LoaderAddr 0x`nm $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out | grep __pmLoader | cut -f 1 -d " "` + $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin set L2_LoaderAddr 0x`nm $(BOOT_OBJDIR)/$(IMAGE_LOADER_NAME).out | grep __base_loader_setup | cut -f 1 -d " "` + $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin set kernelAddr 0x`nm $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out | grep __pk_boot | cut -f 1 -d " "` + +symbols: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out $(BOOT_OBJDIR)/$(IMAGE_LOADER_NAME).out $(OBJDIR)/$(IMAGE_SBE_NAME).out + $(NM) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out > $(OBJDIR)/$(SBE_SYMBOLS_NAME) + $(NM) $(BOOT_OBJDIR)/$(IMAGE_LOADER_NAME).out >> $(OBJDIR)/$(SBE_SYMBOLS_NAME) + +report: $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin + $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin report > $(OBJDIR)/$(IMAGE_SEEPROM_NAME).rpt + +# Create build Info file +buildInfo: + python buildInfo.py + + +#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/pervasive_attributes.xml +# TODO via RTC 142708 +# Workaound for ATTR_CHIP_UNIT_POS. Remove Mirror_WA_attributes.xml once fapi +# support is in. +ATTRFILES += $(BUILD_DIR)/Mirror_WA_attributes.xml +ATTRFILES += $(IMPORT_XML_DIR)/attribute_info/p9_sbe_load_bootloader_attributes.xml +ATTRFILES += $(IMPORT_XML_DIR)/attribute_info/core_attributes.xml +ATTRFILES += $(IMPORT_XML_DIR)/attribute_info/nest_attributes.xml +ATTRFILES += $(IMPORT_XML_DIR)/attribute_info/pm_plat_attributes.xml +ATTRFILES += $(IMPORT_XML_DIR)/attribute_info/p9_cache_contained_attributes.xml +ATTRFILES += $(BASE_FAPI2_DIR)/xml/attribute_info/chip_attributes.xml +ATTRFILES += $(IMPORT_XML_DIR)/attribute_info/chip_ec_attributes.xml + +$(OBJDIR): + $(TOOLS_ATTR_DIR)/ppeParseProcSbeFixed.pl . $(IMPORT_XML_DIR)/attribute_info/p9_sbe_attributes.xml $(ATTRFILES) + $(TOOLS_ATTR_DIR)/ppeParseAttributeInfo.pl $(PLAT_FAPI2_DIR)/include $(IMPORT_XML_DIR)/attribute_info/p9_sbe_attributes.xml $(ATTRFILES) + $(TOOLS_ATTR_DIR)/ppeCreateAttrGetSetMacros.pl --path $(TOOLS_ATTR_DIR)/src --inc $(PLAT_FAPI2_DIR)/include --src $(PLAT_FAPI2_DIR)/src + $(TOOLS_ATTR_DIR)/ppeCreateIfAttrService.pl $(PLAT_FAPI2_DIR)/include $(IMPORT_XML_DIR)/attribute_info/p9_sbe_attributes.xml $(ATTRFILES) + mkdir -p $(OBJDIR) + +topfixedheaders: + $(TOOLS_ATTR_DIR)/ppeParseProcSbeFixed.pl . $(IMPORT_XML_DIR)/attribute_info/p9_sbe_attributes.xml $(ATTRFILES) + +attrids: + $(TOOLS_ATTR_DIR)/ppeParseAttributeInfo.pl $(PLAT_FAPI2_DIR)/include $(IMPORT_XML_DIR)/attribute_info/p9_sbe_attributes.xml $(ATTRFILES) + +platattr: + $(TOOLS_ATTR_DIR)/ppeCreateAttrGetSetMacros.pl --path $(TOOLS_ATTR_DIR)/src --inc $(PLAT_FAPI2_DIR)/include --src $(PLAT_FAPI2_DIR)/src + +attrserv: + $(TOOLS_ATTR_DIR)/ppeCreateIfAttrService.pl $(PLAT_FAPI2_DIR)/include $(IMPORT_XML_DIR)/attribute_info/p9_sbe_attributes.xml $(ATTRFILES) + + + +# Build the subdirectories +$(SUBDIRS): + $(MAKE) -I $(BUILD_DIR) -C $@ -f Makefile + + +#Build the SBE XIP Tools +$(SBE_TOOLS): $(P9_XIP_TOOL) + $(MAKE) -I $(BUILD_DIR) -C $(TOOLS_IMAGE_DIR) -f Makefile + +# Build the P9-XIP Tool +$(P9_XIP_TOOL): + $(MAKE) -I $(P9_XIP_SRCDIR) -C $(P9_XIP_SRCDIR) -f Makefile BINDIR=$(P9_XIP_BINDIR) + +normalize: $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin + $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin normalize + +defaultset: $(SBE_TOOLS) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin normalize + $(TOOLS_ATTR_DIR)/ppeSetFixed.pl $(BASE_OBJDIR) $(BASE_OBJDIR)/$(IMAGE_SEEPROM_NAME).bin $(IMPORT_XML_DIR)/attribute_info/p9_sbe_attributes.xml $(ATTRFILES) + +# Build the trace utilities +ppe_trace_bin: + $(MAKE) -I $(BUILD_DIR) -C $(PPETRACEPP_DIR) -f Makefile #$(PK trace util) + + +# 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. +# + +xml: $(FAPI_RC) + +$(FAPI_RC): $(TOOLS_ATTR_DIR)/parseErrorInfo.pl $(ERROR_XML_FILES) + $(TOOLS_ATTR_DIR)/parseErrorInfo.pl --local-ffdc --output-dir=. $(ERROR_XML_FILES) + +$(OBJDIR)/fixed.bin: $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin + $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin extract .fixed $(BASE_OBJDIR)/fixed.bin + + +appendloader: $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin $(BOOT_OBJDIR)/$(IMAGE_LOADER_NAME).bin + $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin append .baseloader $(BOOT_OBJDIR)/$(IMAGE_LOADER_NAME).bin + +# collect all of the trace hash files for this image into a single sbeStringFile +tracehash: + mkdir -p $(OBJDIR) + $(THASH) -c -d $(OBJDIR) -s $(OBJDIR)/sbeStringFile + +#clean the kernel directory first, then the application level clean +clean: + rm -fr $(OBJDIR) + rm -f $(TOP-FIXED-HEADERS) + rm -f collect_reg_ffdc.H hwp_return_codes.H hwp_error_info.H hwp_ffdc_classes.H collect_reg_ffdc.C set_sbe_error.H sbe_build_info.H + rm -f $(GEN-CREATEATTRGETSETMACROS) + rm -f $(GEN-PARSEATTRIBUTEINFO) + rm -f $(GEN-CREATEIFATTRSERVICE) + +#Add dependencies to header files +ifneq ($(MAKECMDGOALS),clean) +include $(OBJS:.o=.d) +endif diff --git a/src/build/Mirror_WA_attributes.xml b/src/build/Mirror_WA_attributes.xml new file mode 100644 index 00000000..6b307550 --- /dev/null +++ b/src/build/Mirror_WA_attributes.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + ATTR_CHIP_UNIT_POS + TARGET_TYPE_PERV + + uint8 + + + diff --git a/src/build/base_ppe_header.S b/src/build/base_ppe_header.S new file mode 100644 index 00000000..b68b9214 --- /dev/null +++ b/src/build/base_ppe_header.S @@ -0,0 +1,209 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/build/base_ppe_header.S $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* */ +/* */ +/* 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 P9XipHeader creates header section, function .proc_sbe_fixed +/// creates fixed, fixed_toc sections +#include "p9_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 P9XipHeader, magic, link_address, entry_point, image_size + + .section .header, "a", @progbits + + + ////////////////////////////////////////////////////////////////////// + // Identification - 8-byte aligned; 8 Entries; TOC-Indexed + ////////////////////////////////////////////////////////////////////// + +__magic: + .quad (\magic) +__L1_LoaderAddr: + .quad 0 +__L2_LoaderAddr: + .quad 0 +__kernelAddr: + .quad 0 +__link_address: + .quada (\link_address) +__header_64_reserved: + .quad 0, 0, 0 + + .xip_toc magic, P9_XIP_UINT64, __magic + .xip_toc L1_LoaderAddr, P9_XIP_UINT64, __L1_LoaderAddr + .xip_toc L2_LoaderAddr, P9_XIP_UINT64, __L2_LoaderAddr + .xip_toc kernelAddr, P9_XIP_UINT64, __kernelAddr + .xip_toc link_address, P9_XIP_UINT64, __link_address + + ////////////////////////////////////////////////////////////////////// + // Section Table - Not TOC-Indexed + ////////////////////////////////////////////////////////////////////// + + .xip_section header + .xip_section fixed, 8 + .xip_section fixed_toc, 8 + .xip_section toc, 4 + .xip_section strings + .xip_section loader_text, 4 + .xip_section loader_data, 8, empty=1 + .xip_section text, 4 + .xip_section data, 8, empty=1 + .xip_section base, 4 + .xip_section baseloader, 8, empty=1 + .xip_section overrides, 8, empty=1 + .xip_section rings, 8, empty=1 + .xip_section overlay, 8, empty=1 + .xip_section hbbl, 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, P9_XIP_UINT32, __image_size + .xip_toc build_date, P9_XIP_UINT32, __build_date + .xip_toc build_time, P9_XIP_UINT32, __build_time + + + ////////////////////////////////////////////////////////////////////// + // Other Information - 1-byte aligned; 8 entries; TOC-Indexed + ////////////////////////////////////////////////////////////////////// + +__header_version: + .byte P9_XIP_HEADER_VERSION +__toc_normalized: + .byte 0 +__toc_sorted: + .byte 0 +__header_8_reserved: + .byte 0, 0, 0, 0, 0 + + .xip_toc header_version, P9_XIP_UINT8, __header_version + .xip_toc toc_normalized, P9_XIP_UINT8, __toc_normalized + .xip_toc toc_sorted, P9_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, P9_XIP_STRING, __build_user + .xip_toc build_host, P9_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 + .section .base, "a", @progbits + + ..set_default_space IMAGE_SPACE_SEEPROM + P9XipHeader P9_XIP_MAGIC_SEEPROM, 0x80000000, 0x00000000, _sbe_image_size + + // Create the .fixed section + .proc_sbe_fixed_system + .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/build/base_sbe_fixed.S b/src/build/base_sbe_fixed.S new file mode 100644 index 00000000..e1a53f84 --- /dev/null +++ b/src/build/base_sbe_fixed.S @@ -0,0 +1,67 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/build/base_sbe_fixed.S $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* */ +/* */ +/* 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 "p9_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_system + .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/build/buildInfo.py b/src/build/buildInfo.py new file mode 100755 index 00000000..f7b109e4 --- /dev/null +++ b/src/build/buildInfo.py @@ -0,0 +1,48 @@ +#! /usr/bin/python +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/build/buildInfo.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 script will create header file sbe_build_info.H which will have +# buld information required by SBE code. +import os +buildInfoFileName = "sbe_build_info.H" + +def buildInfo(): + header = \ +"#ifndef SBE_BUILD_INFO_H \n\ +#define SBE_BUILD_INFO_H \n\n" + + footer = "\n#endif // SBE_BUILD_INFO_H" + commitId = "0x" + os.popen("git rev-parse --short=8 HEAD").read().rstrip() + + f = open( buildInfoFileName, 'w') + + f.write(header) + f.write("//Define SBE Commit ID \n") + f.write("#define SBE_COMMIT_ID " + commitId + "\n") + f.write(footer) + f.close() + +# Call buildInfo +buildInfo() diff --git a/src/build/img_defs.mk b/src/build/img_defs.mk new file mode 100644 index 00000000..621be484 --- /dev/null +++ b/src/build/img_defs.mk @@ -0,0 +1,490 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/build/img_defs.mk $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2015,2016 +# +# +# 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[=] 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 := sbe_seeprom +IMAGE_SBE_NAME := sbe_pibmem +IMAGE_LOADER_NAME := sbe_loader +IMAGE_OTPROM_NAME := sbe_otprom + +SBE_SYMBOLS_NAME := sbe.syms + +ifndef PPE_TYPE +PPE_TYPE := std +endif + +ifndef SBE_ROOT_DIR +export SBE_ROOT_DIR = $(abspath ../..) +endif + +ifndef SBE_SRC_DIR +export SBE_SRC_DIR = $(SBE_ROOT_DIR)/src +endif + +ifndef SBE_FW_DIR +export SBE_FW_DIR = $(SBE_SRC_DIR)/sbefw +endif + +ifndef BUILD_DIR +export BUILD_DIR = $(SBE_SRC_DIR)/build +endif + +ifndef LINKER_DIR +export LINKER_DIR = $(BUILD_DIR)/linkerscripts +endif + +ifndef BOOT_SRCDIR +export BOOT_SRCDIR = $(SBE_SRC_DIR)/boot +endif + +ifndef IMPORT_SRCDIR +export IMPORT_SRCDIR = $(SBE_ROOT_DIR)/import +endif + +ifndef TOOLS_SRCDIR +export TOOLS_SRCDIR = $(SBE_SRC_DIR)/tools +endif + +ifndef TEST_SRCDIR +export TEST_SRCDIR = $(SBE_SRC_DIR)/test +endif + +ifndef DEBUGTOOLS_SRCDIR +export DEBUGTOOLS_SRCDIR = $(TOOLS_SRCDIR)/debug +endif + +ifndef SIMICSTOOLS_SRCDIR +export SIMICSTOOLS_SRCDIR = $(DEBUGTOOLS_SRCDIR)/simics +endif + +ifndef UTILS_SRCDIR +export UTILS_SRCDIR = $(IMPORT_SRCDIR)/chips/p9/utils +endif + +ifndef CACHE_SRCDIR +export CACHE_SRCDIR = $(IMPORT_SRCDIR)/chips/p9/procedures/hwp/cache +endif + +ifndef CORE_SRCDIR +export CORE_SRCDIR = $(IMPORT_SRCDIR)/chips/p9/procedures/hwp/core +endif + +ifndef PERV_SRCDIR +export PERV_SRCDIR = $(IMPORT_SRCDIR)/chips/p9/procedures/hwp/perv +endif + +ifndef HWPERR_SRCDIR +export HWPERR_SRCDIR = $(IMPORT_SRCDIR)/chips/p9/procedures/xml/error_info +endif + +ifndef NEST_SRCDIR +export NEST_SRCDIR = $(IMPORT_SRCDIR)/chips/p9/procedures/hwp/nest +endif + +ifndef PM_SRCDIR +export PM_SRCDIR = $(IMPORT_SRCDIR)/chips/p9/procedures/hwp/pm +endif + +ifndef INITFILES_SRCDIR +export INITFILES_SRCDIR = $(IMPORT_SRCDIR)/chips/p9/procedures/hwp/initfiles +endif + +ifndef HWPLIB_SRCDIR +export HWPLIB_SRCDIR = $(IMPORT_SRCDIR)/chips/p9/procedures/hwp/lib +endif + +ifndef IMAGEPROCS_SRCDIR +export IMAGEPROCS_SRCDIR = $(IMPORT_SRCDIR)/tools/imageProcs +endif + +ifndef BASE_OBJDIR +export BASE_OBJDIR = $(SBE_ROOT_DIR)/obj +endif + +ifndef P9_XIP_SRCDIR +export P9_XIP_SRCDIR = $(IMPORT_SRCDIR)/chips/p9/xip +endif + +ifndef P9_XIP_BINDIR +export P9_XIP_BINDIR = $(BASE_OBJDIR)/xip +endif + +ifndef IMG_INCLUDES +export IMG_INCLUDES = -I$(IMAGEPROCS_SRCDIR) -I$(P9_XIP_SRCDIR) -I$(BUILD_DIR) -I$(CACHE_SRCDIR) -I$(UTILS_SRCDIR) -I$(CORE_SRCDIR) -I$(PERV_SRCDIR) -I$(NEST_SRCDIR) -I$(PM_SRCDIR) -I$(INITFILES_SRCDIR) +endif + +ifndef BOOT_OBJDIR +export BOOT_OBJDIR = $(BASE_OBJDIR)/boot +endif + +export IMG_OBJDIR = $(BASE_OBJDIR)/$(IMAGE_SEEPROM_NAME) + +ifndef PK_SRCDIR +export PK_SRCDIR = $(IMPORT_SRCDIR)/chips/p9/procedures/ppe/pk +endif + + +ifndef TOOLS_ATTR_DIR +export TOOLS_ATTR_DIR = $(TOOLS_SRCDIR)/scripts +endif + +ifndef TOOLS_IMAGE_DIR +export TOOLS_IMAGE_DIR = $(TOOLS_SRCDIR)/image +endif + +ifndef IMPORT_XML_DIR +export IMPORT_XML_DIR = $(IMPORT_SRCDIR)/chips/p9/procedures/xml +endif + +ifndef IMPORT_UTILS_DIR +export IMPORT_UTILS_DIR = $(IMPORT_SRCDIR)/chips/p9/utils +endif + +ifndef IMPORT_COMMON_DIR +export IMPORT_COMMON_DIR = $(IMPORT_SRCDIR)/chips/p9/common +endif + +ifndef PPETRACEPP_DIR +export PPETRACEPP_DIR = $(TOOLS_SRCDIR)/ppetracepp +endif + +ifndef PPETRACEPP_BIN_DIR +export PPETRACEPP_BIN_DIR = $(BASE_OBJDIR) +endif + +ifndef PLAT_FAPI2_DIR +export PLAT_FAPI2_DIR = $(SBE_SRC_DIR)/hwpf +endif + +ifndef BASE_FAPI2_DIR +export BASE_FAPI2_DIR = $(IMPORT_SRCDIR)/hwpf/fapi2 +endif + +ifndef FAPI2_TOOLS_DIR +export FAPI2_TOOLS_DIR = $(IMPORT_SRCDIR)/hwpf/fapi2/tools/ +endif + +ifdef P2P_ENABLE +ifndef CC_ROOT +export CC_ROOT = ${CTEPATH}/tools/gcc405lin/prod +endif +endif + +GCC-TOOL-PATH = $(CTEPATH)/tools/ppetools/prod + + +ifndef GCC-TOOL-PREFIX +GCC-TOOL-PREFIX = $(GCC-TOOL-PATH)/bin/powerpc-eabi- +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_BIN_DIR)/ppetracepp $(GCC-TOOL-PREFIX)gcc +CC = $(PPETRACEPP_BIN_DIR)/ppetracepp $(GCC-TOOL-PREFIX)gcc +AS = $(BINUTILS-TOOL-PREFIX)as +AR = $(BINUTILS-TOOL-PREFIX)ar +LD = $(BINUTILS-TOOL-PREFIX)ld +NM = $(BINUTILS-TOOL-PREFIX)nm -S +OBJDUMP = $(BINUTILS-TOOL-PREFIX)objdump +OBJCOPY = $(BINUTILS-TOOL-PREFIX)objcopy +TCPP = $(PPETRACEPP_BIN_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 + +ifdef SBE_ISTEP_STUBBED +GCC-DEFS += -DSBE_ISTEP_STUBBED=1 +endif + +ifdef SIM_ONLY_OSC_SWC_CHK +GCC-DEFS += -DSIM_ONLY_OSC_SWC_CHK=1 +endif + +ifdef __FAPI_DELAY_SIM__ +GCC-DEFS += -D__FAPI_DELAY_SIM__=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 +ifdef P2P_ENABLE +GCC-O-LEVEL = -O +#GCC-O-LEVEL = -O -g +else +GCC-O-LEVEL = -Os +#GCC-O-LEVEL = -Os -g +endif +endif + +FAPI_TRACE_LEVEL_DEF = 4 +ifdef FAPI_TRACE_LEVEL_ENV +FAPI_TRACE_LEVEL_DEF = $(FAPI_TRACE_LEVEL_ENV) +endif + +# Levels of SBE logging +# 0 - No tracing +# 1 - Error +# 2 - Error, info +# 3 - Error, info, entry/exit +# 4 - Error, info, entry/exit, debug +SBE_TRACE_LEVEL_DEF = 3 + +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 += -DMINIMUM_FFDC=1 +GCC-DEFS += -DFAPI_TRACE_LEVEL=$(FAPI_TRACE_LEVEL_DEF) +GCC-DEFS += -DSBE_TRACE_LEVEL=$(SBE_TRACE_LEVEL_DEF) +# use the default settings in the code unless a size is defined +ifdef PK_TRACE_SZ +GCC-DEFS += -DPK_TRACE_SZ=$(PK_TRACE_SZ) +endif + +DEFS += $(GCC-DEFS) +export LD_LIBRARY_PATH+=:$(GCC-TOOL-PATH)/lib +############################################################################ + + +INCLUDES += $(IMG_INCLUDES) +INCLUDES += -I$(BUILD_DIR)/../../include +INCLUDES += -I$(HWPLIB_SRCDIR) +INCLUDES += -I$(PLAT_FAPI2_DIR)/include/plat +INCLUDES += -I$(PLAT_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)/../include/std +INCLUDES += -I$(PK_SRCDIR)/kernel +INCLUDES += -I$(PK_SRCDIR)/ppe +INCLUDES += -I$(PK_SRCDIR)/ppe42 +INCLUDES += -I$(SBE_FW_DIR) +INCLUDES += -I$(BOOT_SRCDIR) +INCLUDES += -I$(PK_SRCDIR)/trace +INCLUDES += -I$(PPETRACEPP_DIR) +INCLUDES += -I$(IMPORT_COMMON_DIR)/include +INCLUDES += -I$(IMPORT_UTILS_DIR)/imageProcs +INCLUDES += -I$(IMPORT_UTILS_DIR)/ + +GCC-CFLAGS += -Wall -Werror -Wno-unused-label +GCC-CFLAGS += -msoft-float +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 + +ifdef P2P_ENABLE +## Flags specific to 405 compiler with PowerPc to PPE backend +PIPE-CFLAGS = -pipe -Wa,-m405 + +GCC-CFLAGS += -mcpu=405 -mmulhw +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 +else +## Flags specific to ppe42 compiler +PIPE-CFLAGS = -pipe + +GCC-CFLAGS += -mcpu=ppe42 +GCC-CFLAGS += -ffunction-sections +GCC-CFLAGS += -fdata-sections +endif + +CFLAGS = +PPE-CFLAGS = $(CFLAGS) -c $(GCC-CFLAGS) $(PIPE-CFLAGS) $(GCC-O-LEVEL) $(INCLUDES) + +CXXFLAGS = -std=c++11 -nostdinc++ -fno-rtti -fno-threadsafe-statics -fno-strict-aliasing +CPPFLAGS = -E + +ASFLAGS = -mppe42 + +ifdef P2P_ENABLE +#use this to disable optimizations (fused compare/branch etc.) +PCP-FLAG = -b +endif + +############################################################################ + +#override the GNU Make implicit rule for going from a .C to a .o +%.o: %.C + +# -Wno-conversion-null is necesary to allow mapping of NULL to TARGET_TYPE_SYSTEM +# for attribute accesses +$(OBJDIR)/%.s: %.C + $(TCC) $(PPE-CFLAGS) $(DEFS) -Wno-conversion-null -S $(CXXFLAGS) -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/build/linkerscripts/linkloader.cmd b/src/build/linkerscripts/linkloader.cmd new file mode 100755 index 00000000..75c460d4 --- /dev/null +++ b/src/build/linkerscripts/linkloader.cmd @@ -0,0 +1,96 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/build/linkerscripts/linkloader.cmd $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* */ +/* */ +/* 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 BASE_LOADER_STACK_SIZE +#define BASE_LOADER_STACK_SIZE 128 +#endif +#include "../sbe_link.H" + +OUTPUT_FORMAT(elf32-powerpc); + +MEMORY +{ + sram : ORIGIN = SBE_LOADER_BASE_ORIGIN, LENGTH = SBE_LOADER_BASE_LENGTH +} + +SECTIONS +{ + . = SBE_LOADER_BASE_ORIGIN; + + //////////////////////////////// + // 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 + + _BASE_LOADER_STACK_LIMIT = .; + . = . + BASE_LOADER_STACK_SIZE; + _BASE_LOADER_STACK_LIMIT = . - 1; + + . = ALIGN(8); + _loader_end = . - 0; + +} diff --git a/src/build/linkerscripts/linkotprom.cmd b/src/build/linkerscripts/linkotprom.cmd new file mode 100644 index 00000000..19d636b0 --- /dev/null +++ b/src/build/linkerscripts/linkotprom.cmd @@ -0,0 +1,43 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/build/linkerscripts/linkotprom.cmd $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* */ +/* */ +/* 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 + +#include "sbe_link.H" + +OUTPUT_FORMAT(elf32-powerpc); + +MEMORY +{ + sram : ORIGIN = OTPROM_ORIGIN, LENGTH = OTPROM_BLOCK_SIZE +} + +SECTIONS +{ + . = OTPROM_ORIGIN; + .text . : { *(.text)} + . = OTPROM_FIXED_SIZE; + .fixed . : { *(.fixed)} +} diff --git a/src/build/linkerscripts/linksbe.cmd b/src/build/linkerscripts/linksbe.cmd new file mode 100644 index 00000000..4e1832f6 --- /dev/null +++ b/src/build/linkerscripts/linksbe.cmd @@ -0,0 +1,108 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/build/linkerscripts/linksbe.cmd $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* */ +/* */ +/* 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 +#include + +OUTPUT_FORMAT(elf32-powerpc); + +MEMORY +{ + // increasing ram size as workaround so that pibmem image compilation + // doe not fail. + // TODO: Reducing the SBE_BASE_ORIGIN by 0x1F000 to reduce the size of + // generated sbe_pibmem.bin. Just a workaround to use pibmem for poweron + sram : ORIGIN = SBE_BASE_ORIGIN - 0x1F000, LENGTH = SBE_BASE_LENGTH + 0x1F000 +} + +SECTIONS +{ + . = SBE_BASE_ORIGIN - 0x1F000; + + .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. + + . = ALIGN(8); + .rodata . : { ctor_start_address = .; + *(.ctors) *(.ctors.*) + ctor_end_address = .; + *(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_start = .; + .sbss . : { *(.sbss*) } > sram + _sbss_end = .; + + // Other read-write data + // It's not clear why boot.S is generating empty .glink,.iplt + + .rela . : { *(.rela*) } > sram + .rwdata . : { *(.data*) *(.bss*) } > sram + + . = ALIGN(8); + _PK_INITIAL_STACK_LIMIT = .; + . = . + INITIAL_STACK_SIZE; + _PK_INITIAL_STACK = . - 1; + + . = ALIGN(8); + _sbe_end = . - 0; + +} diff --git a/src/build/linkerscripts/linkseeprom.cmd b/src/build/linkerscripts/linkseeprom.cmd new file mode 100644 index 00000000..7cbbcda4 --- /dev/null +++ b/src/build/linkerscripts/linkseeprom.cmd @@ -0,0 +1,200 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/build/linkerscripts/linkseeprom.cmd $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* */ +/* */ +/* 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 +#include +OUTPUT_FORMAT(elf32-powerpc); + +#ifndef INITIAL_STACK_SIZE +#define INITIAL_STACK_SIZE 256 +#endif + +MEMORY +{ + pibmem : ORIGIN = SBE_BASE_ORIGIN, LENGTH = SBE_BASE_LENGTH + seeprom : ORIGIN = SBE_SEEPROM_BASE_ORIGIN, LENGTH = 0x40000 +} + +SECTIONS +{ + . = SBE_SEEPROM_BASE_ORIGIN; + _sbe_image_start_addr = . + SIZEOF_HEADERS; + + // TODO via RTC 149153 + // It seems first section in elf image is 8 byte aligned. + // We need to verify this assumption. + + // Get 8 byte alligned address + _sbe_image_start_addr = ( ( _sbe_image_start_addr % 8) == 0 ) ? _sbe_image_start_addr : ( _sbe_image_start_addr + ( 8 - ( _sbe_image_start_addr % 8))); + + // Get the image offset after elf header + _sbe_image_start_offset = _sbe_image_start_addr - .; + _seeprom_origin = . - 0; + _pibmem_origin = SBE_BASE_ORIGIN; + + //////////////////////////////// + // Header + //////////////////////////////// + .header : { + _header_origin = .; _header_offset = . - _seeprom_origin; *(.header); + } > seeprom + _header_size = . - _header_origin; + + // @TODO via RTC 136215 + // We have used allignment 0x1000 so that it can be found + // at fixed location. once otprom loader support is enabled. + // alligment will not be required. + + //////////////////////////////// + // LOADER_TEXT + //////////////////////////////// + .loader_text ALIGN(0x1000): { + _loader_text_origin = .; _loader_text_offset = . - _seeprom_origin; + *(.loader_text); + } > seeprom + _loader_text_size = . - _loader_text_origin; + + // @TODO via RTC 136215 + // loader_text section should come after fixed and related + // sections as we want fixed section at knowon offset. Currently we + // have shared SEEPROM start address ( IVPR register value ) with + // multiple teams. So keeping loader_text as first section. Once + // WE have otprom loader support, we will put loader_text at right + // position + + //////////////////////////////// + // FIXED + //////////////////////////////// + .fixed ALIGN(0x200) : { + _fixed_origin = .; _fixed_offset = . - _seeprom_origin; + *(.fixed) + } > seeprom + _fixed_size = . - _fixed_origin; + + //////////////////////////////// + // FIXED_TOC + //////////////////////////////// + .fixed_toc ALIGN(8) : { + _fixed_toc_origin = .; _fixed_toc_offset = . - _seeprom_origin; *(.fixed_toc); + } > seeprom + _fixed_toc_size = . - _fixed_toc_origin; + + //////////////////////////////// + // TOC + //////////////////////////////// + .toc ALIGN(4): { + _toc_origin = .; _toc_offset = . - _seeprom_origin; *(.toc); + } > seeprom + _toc_size = . - _toc_origin; + + //////////////////////////////// + // STRING + //////////////////////////////// + .strings : { + _strings_origin = .; _strings_offset = . - _seeprom_origin; *(.strings); + } > seeprom + _strings_size = . - _strings_origin; + + .text ALIGN(8): { + _text_origin = .; _text_offset = . - _seeprom_origin; + *\libcore.a:(.text* ) *\libcache.a:(.text* ) *\libperv.a:(.text* )} > seeprom + _text_size = . - _text_origin; + + _seeprom_size = . - _seeprom_origin; + + // TODO via RTC 149153 + // It seems when we jump across memory region, elf creates 32 byte offset. + // We need to verify this assumption. + + _seeprom_size_with_elf_hdr = _seeprom_size + _sbe_image_start_offset; + _seeprom_size = ( ( _seeprom_size_with_elf_hdr % 32) == 0 ) ? _seeprom_size : ( _seeprom_size + ( 32 - (_seeprom_size_with_elf_hdr % 32))); + + + . = _pibmem_origin; + _base_origin = .; + _base_offset = . - _base_origin + _seeprom_size; + + .pkVectors ALIGN(32) : { + *(.vectors) + } > pibmem + + .base . : { + *(.text*) *(.eh_frame) *(.dtors*); + } > pibmem + + . = 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*) } > pibmem + .sbss2 . : { *(.sbss2*) } > pibmem + + . = ALIGN(8); + .rodata . : { + ctor_start_address = .; + *(.ctors) *(.ctors.*) + ctor_end_address = .; + *(.rodata*) *(.got2); + } > pibmem + _RODATA_SECTION_SIZE = . - _RODATA_SECTION_BASE; + + + . = ALIGN(8); _DATA_SECTION_BASE = .; + _SDA_BASE_ = .; + .data . : { + *(.data*) *(.comment) + } > pibmem + .sdata . : { *(.sdata*) } > pibmem + . = ALIGN(8); + + // We do not want to store bss section in sbe image as laoder will take + // care of it while loading image on PIBMEM. It will save us space in + // SEEPROM. So define XIP image related variables here so that SBE image + // finishes here. + + _base_size = . - _base_origin; + _pibmem_size = . - _pibmem_origin; + _sbe_image_size = _seeprom_size + ( . - _pibmem_origin ); + + _sbss_start = .; + .sbss . : { + *(.bss*) *(.sbss*); + . = ALIGN(8); + } > pibmem + _sbss_end = .; + + . = ALIGN(8); + _sbss_size = SIZEOF(.sbss); + + . = ALIGN(8); + _PK_INITIAL_STACK_LIMIT = .; + . = . + INITIAL_STACK_SIZE; + _PK_INITIAL_STACK = . - 1; + . = ALIGN(8); + +} diff --git a/src/build/p9_sbe.H b/src/build/p9_sbe.H new file mode 100644 index 00000000..3e624d01 --- /dev/null +++ b/src/build/p9_sbe.H @@ -0,0 +1,52 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/build/p9_sbe.H $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* */ +/* */ +/* 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/build/parsAndCutElf.py b/src/build/parsAndCutElf.py new file mode 100755 index 00000000..1a91d969 --- /dev/null +++ b/src/build/parsAndCutElf.py @@ -0,0 +1,69 @@ +#!/usr/bin/python +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/build/parsAndCutElf.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 +import os +import subprocess +import re +import random +import sys + +# Workaround to cut SBE image from elf image. +def parserElf(): + cmd = "readelf -S ../../obj/sbe_seeprom.out" + firstSection = ".header" + cmd1 = "nm ../../obj/sbe_seeprom.out | grep _sbe_image_size" + output = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) + i = 0; + for line in output.stdout: + line = line.strip() + + if not line: continue + + if( (line.find(firstSection) != -1) ): + tokens = line.split(); + startSize = int( tokens[5], 16 ) + print startSize + break; + + # Get the location of sbe end + output = subprocess.Popen(cmd1, shell=True, stdout=subprocess.PIPE) + for line in output.stdout: + line = line.strip() + tokens = line.split(); + endSize = int( tokens[0], 16 ); + break; + + print endSize; + if( (startSize == 0) or (endSize == 0)): + exit(-1) + + # cut the image + cmd1 = "dd skip=" + str(startSize) + " count=" + str(endSize) + " if=../../obj/sbe_seeprom.out of=../../obj/sbe_seeprom.bin bs=1" + rc = os.system(cmd1) + if ( rc ): + print "ERROR running %s: %d "%( cmd1, rc ) + exit(-1) + +parserElf() + diff --git a/src/build/proc_sbe_fixed.H b/src/build/proc_sbe_fixed.H new file mode 100644 index 00000000..6c3d134e --- /dev/null +++ b/src/build/proc_sbe_fixed.H @@ -0,0 +1,211 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/build/proc_sbe_fixed.H $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* */ +/* */ +/* 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_system + .section .fixed, "a", @progbits + .balign 8 + .global G_system_attributes +G_system_attributes: +#else + +extern "C" { +namespace fapi2attr { +typedef struct SystemAttributes_t { +#endif + +#include "proc_sbe_fixed_system.H" + +#ifdef __ASSEMBLER__ + .endm +#else +} SystemAttributes; +} // fapi2 +} // C +#endif + +#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/build/sbe_common.H b/src/build/sbe_common.H new file mode 100644 index 00000000..4fb78079 --- /dev/null +++ b/src/build/sbe_common.H @@ -0,0 +1,600 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/build/sbe_common.H $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* */ +/* */ +/* 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 "p9_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 (p9_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, P9_XIP_UINT8, \symbol, ((\tnumber)*(\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, P9_XIP_INT8, \symbol, ((\tnumber)*(\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)) + .byte 0,0 + .endr + + .xip_toc \symbol, P9_XIP_UINT16, \symbol, ((\tnumber)*(\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)) + .byte 0,0 + .endr + + .xip_toc \symbol, P9_XIP_INT16, \symbol, ((\tnumber)*(\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, P9_XIP_UINT32, \symbol, ((\tnumber)*(\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, P9_XIP_INT32, \symbol, ((\tnumber)*(\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, P9_XIP_UINT64, \symbol, ((\tnumber)*(\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, P9_XIP_INT64, \symbol, ((\tnumber)*(\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, P9_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, 1, elements + +#define PROC_SBE_FIXED_INT8_VECTOR(symbol, elements) \ + proc_sbe_fixed_int8 symbol, 1, elements + +#define PROC_SBE_FIXED_UINT16_VECTOR(symbol, elements) \ + proc_sbe_fixed_uint16 symbol, 1, elements + +#define PROC_SBE_FIXED_INT16_VECTOR(symbol, elements) \ + proc_sbe_fixed_int16 symbol, 1, elements + +#define PROC_SBE_FIXED_UINT32_VECTOR(symbol, elements) \ + proc_sbe_fixed_uint32 symbol, 1, elements + +#define PROC_SBE_FIXED_INT32_VECTOR(symbol, elements) \ + proc_sbe_fixed_int32 symbol, 1, elements + +#define PROC_SBE_FIXED_UINT64_VECTOR(symbol, elements) \ + proc_sbe_fixed_uint64 symbol, 1, elements + +#define PROC_SBE_FIXED_INT64_VECTOR(symbol, elements) \ + proc_sbe_fixed_int64 symbol, 1, elements + +#define PROC_SBE_FIXED_UINT8_VECTOR_2(symbol, dim1, dim2 ) \ + proc_sbe_fixed_uint8 symbol, 1, dim1 * dim2 + +#define PROC_SBE_FIXED_INT8_VECTOR_2(symbol, dim1, dim2 ) \ + proc_sbe_fixed_int8 symbol, 1, dim1 * dim2 + +#define PROC_SBE_FIXED_UINT16_VECTOR_2(symbol, dim1, dim2 ) \ + proc_sbe_fixed_uint16 symbol, 1, dim1 * dim2 + +#define PROC_SBE_FIXED_INT16_VECTOR_2(symbol, dim1, dim2 ) \ + proc_sbe_fixed_int16 symbol, 1, dim1 * dim2 + +#define PROC_SBE_FIXED_UINT32_VECTOR_2(symbol, dim1, dim2 ) \ + proc_sbe_fixed_uint32 symbol, 1, dim1 * dim2 + +#define PROC_SBE_FIXED_INT32_VECTOR_2(symbol, dim1, dim2 ) \ + proc_sbe_fixed_int32 symbol, 1, dim1 * dim2 + +#define PROC_SBE_FIXED_UINT64_VECTOR_2(symbol, dim1, dim2 ) \ + proc_sbe_fixed_uint64 symbol, 1, dim1 * dim2 + +#define PROC_SBE_FIXED_INT64_VECTOR_2(symbol, dim1, dim2 ) \ + proc_sbe_fixed_int64 symbol, 1, dim1 * dim2 + +#define PROC_SBE_FIXED_UINT8_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint8 symbol, 1, dim1 * dim2 * dim3 + +#define PROC_SBE_FIXED_INT8_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint8 symbol, 1, dim1 * dim2 * dim3 + +#define PROC_SBE_FIXED_UINT16_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint16 symbol, 1, dim1 * dim2 * dim3 + +#define PROC_SBE_FIXED_INT16_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint16 symbol, 1, dim1 * dim2 * dim3 + +#define PROC_SBE_FIXED_UINT32_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint32 symbol, 1, dim1 * dim2 * dim3 + +#define PROC_SBE_FIXED_INT32_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint32 symbol, 1, dim1 * dim2 * dim3 + +#define PROC_SBE_FIXED_UINT64_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint64 symbol, 1, dim1 * dim2 * dim3 + +#define PROC_SBE_FIXED_INT64_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint64 symbol, 1, 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/build/sbe_link.H b/src/build/sbe_link.H new file mode 100644 index 00000000..ad703e1a --- /dev/null +++ b/src/build/sbe_link.H @@ -0,0 +1,102 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/build/sbe_link.H $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* */ +/* */ +/* 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 0xC0000 + +/// The amount of memory contained in each OTPROM macro +#define OTPROM_BLOCK_SIZE 1024 + +/// 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 0xFFFE8000 +/// SBE base image length ( 96 KB - 512 bytes for loader) +#define SBE_BASE_LENGTH 0x17DFF + +///This Index depends upon XIP HEADER File +// Start offset of sectionTable in XIP header. There are 8 entries +// of 8 byte each. +#define SBE_XIP_TOC_OFFSET 8*8 + +/// The link address of the P9 SBE Base image +#define SBE_SEEPROM_BASE_ORIGIN 0x80000000 + +/// This Index depends upon XIP HEADER File +/// Each section table entry is 12 bytes(SIZE_OF_SBE_XIP_SECTION) size, +// Base Loader is 10 th (P9_XIP_SECTION_BASELOADER) section +#define SBE_LOADER_BASE_SECTION SBE_SEEPROM_BASE_ORIGIN + SBE_XIP_TOC_OFFSET \ + + 120 +// Base Loader start address +#define SBE_LOADER_BASE_ORIGIN 0xFFFFFE00 +// Base Loader length +#define SBE_LOADER_BASE_LENGTH 0x200 + +// Base Loader entry function offset in header +#define SBE_LOADER_ENTRY_HEADER_OFFSET 20 + +/// 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 (96KB) +#define PIBMEM_SIZE (96 * 1024) + +/// The fixed section of Otprom +#define OTPROM_FIXED_SIZE (OTPROM_ORIGIN + 0x340) + +/// Sbe fixed sction for the pibmem repair +#define SBE_FIXED_SECTION (SBE_SEEPROM_BASE_ORIGIN + SBE_XIP_TOC_OFFSET + 12) + +#endif // __SBE_LINK_H + diff --git a/src/build/topfiles.mk b/src/build/topfiles.mk new file mode 100644 index 00000000..6c76eaaf --- /dev/null +++ b/src/build/topfiles.mk @@ -0,0 +1,53 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/build/topfiles.mk $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2015,2016 +# +# +# 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 = +TOP-CPP-SOURCES = +TOP-S-SOURCES = base_ppe_header.S + +# generated by ppeParseProcSbeFixed.pl +TOP-FIXED-HEADERS += $(BUILD_DIR)/proc_sbe_fixed_system.H +TOP-FIXED-HEADERS += $(BUILD_DIR)/proc_sbe_fixed_perv.H +TOP-FIXED-HEADERS += $(BUILD_DIR)/proc_sbe_fixed_proc_chip.H +TOP-FIXED-HEADERS += $(BUILD_DIR)/proc_sbe_fixed_core.H +TOP-FIXED-HEADERS += $(BUILD_DIR)/proc_sbe_fixed_ex.H +TOP-FIXED-HEADERS += $(BUILD_DIR)/proc_sbe_fixed_eq.H + +TOP_OBJECTS = $(TOP-C-SOURCES:.c=.o) $(TOP-CPP-SOURCES:.C=.o) $(TOP-S-SOURCES:.S=.o) +PLAT_FAPI2_DIR_INCL = $(PLAT_FAPI2_DIR)/include +# generated by ppeParseAttributeInfo.pl +GEN-PARSEATTRIBUTEINFO += $(PLAT_FAPI2_DIR_INCL)/fapi2AttributeIds.H +GEN-PARSEATTRIBUTEINFO += $(PLAT_FAPI2_DIR_INCL)/fapi2ChipEcFeature.C +GEN-PARSEATTRIBUTEINFO += $(PLAT_FAPI2_DIR_INCL)/fapi2AttributePlatCheck.H +GEN-PARSEATTRIBUTEINFO += $(PLAT_FAPI2_DIR_INCL)/fapi2AttributesSupported.html +GEN-PARSEATTRIBUTEINFO += $(PLAT_FAPI2_DIR_INCL)/fapi2AttrInfo.csv +GEN-PARSEATTRIBUTEINFO += $(PLAT_FAPI2_DIR_INCL)/fapi2AttrEnumInfo.csv + +PPE_FAPI2_DIR_SRC = $(PLAT_FAPI2_DIR)/src +# generated by ppeCreateAttrGetSetMacros.pl +GEN-CREATEATTRGETSETMACROS += fapi2PlatAttributeService.H.temp +GEN-CREATEATTRGETSETMACROS += $(PPE_FAPI2_DIR_SRC)/fapi2PlatAttributeService.C +GEN-CREATEATTRGETSETMACROS += $(PLAT_FAPI2_DIR_INCL)/fapi2PlatAttributeService.H + +# generated by ppeCreateIfAttrService.pl +GEN-CREATEIFATTRSERVICE += $(PLAT_FAPI2_DIR_INCL)/fapi2AttributeService.C -- cgit v1.2.1