diff options
author | Shakeeb <shakeebbk@in.ibm.com> | 2016-08-28 22:23:54 -0500 |
---|---|---|
committer | Sachin Gupta <sgupta2m@in.ibm.com> | 2016-08-30 06:01:42 -0400 |
commit | 593629e88423f3c652c65706d4f4648db26b0fb2 (patch) | |
tree | ae2f47deee0fddf7cc016021900a6d35701b1a38 | |
parent | b6e511f8fe906c566537e79d7fb5f3af1563d3b1 (diff) | |
download | talos-sbe-593629e88423f3c652c65706d4f4648db26b0fb2.tar.gz talos-sbe-593629e88423f3c652c65706d4f4648db26b0fb2.zip |
SBE code restructure: Build directory setup
Change-Id: I5727522fe885260dde54a94b9ae37fd1382a76ff
RTC:159709
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/28888
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: RAJA DAS <rajadas2@in.ibm.com>
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | import/chips/p9/procedures/ppe/pk/std/Makefile | 6 | ||||
-rw-r--r-- | src/boot/Makefile | 11 | ||||
-rw-r--r-- | src/build/Makefile (renamed from src/image/Makefile) | 19 | ||||
-rw-r--r-- | src/build/Mirror_WA_attributes.xml (renamed from src/image/Mirror_WA_attributes.xml) | 2 | ||||
-rw-r--r-- | src/build/base_ppe_header.S (renamed from src/image/base_ppe_header.S) | 2 | ||||
-rw-r--r-- | src/build/base_sbe_fixed.S (renamed from src/image/base_sbe_fixed.S) | 2 | ||||
-rwxr-xr-x | src/build/buildInfo.py (renamed from src/image/buildInfo.py) | 2 | ||||
-rw-r--r-- | src/build/img_defs.mk (renamed from src/image/img_defs.mk) | 14 | ||||
-rwxr-xr-x | src/build/linkerscripts/linkloader.cmd (renamed from src/image/linkloader.cmd) | 4 | ||||
-rw-r--r-- | src/build/linkerscripts/linkotprom.cmd (renamed from src/image/linkotprom.cmd) | 2 | ||||
-rw-r--r-- | src/build/linkerscripts/linksbe.cmd (renamed from src/image/linksbe.cmd) | 2 | ||||
-rw-r--r-- | src/build/linkerscripts/linkseeprom.cmd (renamed from src/image/linkseeprom.cmd) | 2 | ||||
-rw-r--r-- | src/build/p9_sbe.H (renamed from src/image/p9_sbe.H) | 2 | ||||
-rwxr-xr-x | src/build/parsAndCutElf.py (renamed from src/image/parsAndCutElf.py) | 2 | ||||
-rw-r--r-- | src/build/proc_sbe_fixed.H (renamed from src/image/proc_sbe_fixed.H) | 2 | ||||
-rw-r--r-- | src/build/sbe_common.H (renamed from src/image/sbe_common.H) | 2 | ||||
-rw-r--r-- | src/build/sbe_link.H (renamed from src/image/sbe_link.H) | 2 | ||||
-rw-r--r-- | src/build/topfiles.mk (renamed from src/image/topfiles.mk) | 14 | ||||
-rw-r--r-- | src/hwpf/src/Makefile | 3 | ||||
-rw-r--r-- | src/sample/Makefile | 99 | ||||
-rw-r--r-- | src/sample/img_defs.mk | 264 | ||||
-rw-r--r-- | src/sample/link.cmd | 91 | ||||
-rw-r--r-- | src/sample/pk_scom.c | 235 | ||||
-rw-r--r-- | src/sample/pk_scom.h | 66 | ||||
-rw-r--r-- | src/sample/pk_trace_wrap.c | 32 | ||||
-rw-r--r-- | src/sample/pk_trace_wrap.h | 30 | ||||
-rw-r--r-- | src/sample/sample_main.C | 122 | ||||
-rw-r--r-- | src/sample/topfiles.mk | 29 |
29 files changed, 51 insertions, 1014 deletions
@@ -22,7 +22,7 @@ # permissions and limitations under the License. # # IBM_PROLOG_END_TAG -BUILD_DIR = src/image +BUILD_DIR = src/build .PHONY: install all clean install: diff --git a/import/chips/p9/procedures/ppe/pk/std/Makefile b/import/chips/p9/procedures/ppe/pk/std/Makefile index 3f484e61..7d4613ed 100644 --- a/import/chips/p9/procedures/ppe/pk/std/Makefile +++ b/import/chips/p9/procedures/ppe/pk/std/Makefile @@ -52,13 +52,13 @@ libpk.a: kernel ppe42 trace std std: $(OBJS) trace: - $(MAKE) -I $(IMAGE_SRCDIR) -C ../trace + $(MAKE) -I $(BUILD_DIR) -C ../trace kernel: - $(MAKE) -I $(IMAGE_SRCDIR) -C ../kernel + $(MAKE) -I $(BUILD_DIR) -C ../kernel ppe42: - $(MAKE) -I $(IMAGE_SRCDIR) -C ../ppe42 + $(MAKE) -I $(BUILD_DIR) -C ../ppe42 $(OBJS) $(OBJS:.o=.d): | $(OBJDIR) diff --git a/src/boot/Makefile b/src/boot/Makefile index 95e29143..11b33a94 100644 --- a/src/boot/Makefile +++ b/src/boot/Makefile @@ -6,6 +6,7 @@ # OpenPOWER sbe Project # # Contributors Listed Below - COPYRIGHT 2016 +# [+] International Business Machines Corp. # # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,7 +27,7 @@ export SUB_OBJDIR = /boot include img_defs.mk include bootfiles.mk -INCLUDES += -I$(IMAGE_SRCDIR) +INCLUDES += -I$(BUILD_DIR) OBJS := $(addprefix $(OBJDIR)/, $(BOOT_OBJECTS)) BOOTOBJS += $(OBJS) @@ -53,8 +54,8 @@ $(OBJDIR)/$(IMAGE_OTPROM_NAME).out: $(OTPROM_LOADER_OBJS) $(LINK_SCRIPT_OTPROM) # pass the link command file through the C preprocessor to evaluate macros # and remove comments -$(LINK_SCRIPT_OTPROM): $(IMAGE_SRCDIR)/linkotprom.cmd - $(CPP) -I. -E -x c++ -P $(DEFS) $(IMAGE_SRCDIR)/linkotprom.cmd -o $(LINK_SCRIPT_OTPROM) +$(LINK_SCRIPT_OTPROM): $(LINKER_DIR)/linkotprom.cmd + $(CPP) -I$(INCLUDES) -E -x c++ -P $(DEFS) $(LINKER_DIR)/linkotprom.cmd -o $(LINK_SCRIPT_OTPROM) # ---- Loader Image ------ $(OBJDIR)/$(IMAGE_LOADER_NAME).bin $(OBJDIR)/$(IMAGE_LOADER_NAME).dis: $(OBJDIR)/$(IMAGE_LOADER_NAME).out @@ -67,8 +68,8 @@ $(OBJDIR)/$(IMAGE_LOADER_NAME).out: $(LOADER_OBJS) $(LINK_SCRIPT_LOADER) # pass the link command file through the C preprocessor to evaluate macros # and remove comments -$(LINK_SCRIPT_LOADER): $(IMAGE_SRCDIR)/linkloader.cmd - $(CPP) -I. -E -x c++ -P $(DEFS) $(IMAGE_SRCDIR)/linkloader.cmd -o $(LINK_SCRIPT_LOADER) +$(LINK_SCRIPT_LOADER): $(LINKER_DIR)/linkloader.cmd + $(CPP) -I$(INCLUDES) -E -x c++ -P $(DEFS) $(LINKER_DIR)/linkloader.cmd -o $(LINK_SCRIPT_LOADER) $(OBJDIR): mkdir -p $(OBJDIR) diff --git a/src/image/Makefile b/src/build/Makefile index 7de0cfbc..ff2bb580 100644 --- a/src/image/Makefile +++ b/src/build/Makefile @@ -1,7 +1,7 @@ # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # -# $Source: src/image/Makefile $ +# $Source: src/build/Makefile $ # # OpenPOWER sbe Project # @@ -153,8 +153,8 @@ $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out: ppe_trace_bin buildInfo $(SUBDIRS) $(LINK_O # pass the link command file through the C preprocessor to evaluate macros # and remove comments -$(LINK_SCRIPT_SEEPROM): linkseeprom.cmd - $(CPP) -I. -E -x c++ -P $(DEFS) linkseeprom.cmd -o $(LINK_SCRIPT_SEEPROM) +$(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 @@ -170,8 +170,8 @@ $(OBJDIR)/$(IMAGE_SBE_NAME).out: ppe_trace_bin buildInfo $(OBJDIR)/base_sbe_fix $(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++ -I. -P $(DEFS) linksbe.cmd -o $(LINK_SCRIPT_SBE) +$(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 \ @@ -224,7 +224,7 @@ 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 += $(IMAGE_SRCDIR)/Mirror_WA_attributes.xml +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 @@ -256,13 +256,12 @@ attrserv: # Build the subdirectories $(SUBDIRS): - $(MAKE) -I $(IMAGE_SRCDIR) -C $@ -f Makefile + $(MAKE) -I $(BUILD_DIR) -C $@ -f Makefile #Build the SBE XIP Tools $(SBE_TOOLS): $(P9_XIP_TOOL) - $(info #######$(P9_XIP_TOOL)###########) - $(MAKE) -I $(IMAGE_SRCDIR) -C $(TOOLS_IMAGE_DIR) -f Makefile + $(MAKE) -I $(BUILD_DIR) -C $(TOOLS_IMAGE_DIR) -f Makefile # Build the P9-XIP Tool $(P9_XIP_TOOL): @@ -276,7 +275,7 @@ defaultset: $(SBE_TOOLS) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin normalize # Build the trace utilities ppe_trace_bin: - $(MAKE) -I $(IMAGE_SRCDIR) -C $(PPETRACEPP_DIR) -f Makefile #$(PK trace util) + $(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 diff --git a/src/image/Mirror_WA_attributes.xml b/src/build/Mirror_WA_attributes.xml index 6552eb27..6b307550 100644 --- a/src/image/Mirror_WA_attributes.xml +++ b/src/build/Mirror_WA_attributes.xml @@ -1,7 +1,7 @@ <!-- IBM_PROLOG_BEGIN_TAG --> <!-- This is an automatically generated prolog. --> <!-- --> -<!-- $Source: src/image/Mirror_WA_attributes.xml $ --> +<!-- $Source: src/build/Mirror_WA_attributes.xml $ --> <!-- --> <!-- OpenPOWER sbe Project --> <!-- --> diff --git a/src/image/base_ppe_header.S b/src/build/base_ppe_header.S index cf8e7c58..b68b9214 100644 --- a/src/image/base_ppe_header.S +++ b/src/build/base_ppe_header.S @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/image/base_ppe_header.S $ */ +/* $Source: src/build/base_ppe_header.S $ */ /* */ /* OpenPOWER sbe Project */ /* */ diff --git a/src/image/base_sbe_fixed.S b/src/build/base_sbe_fixed.S index bcfc0e1e..e1a53f84 100644 --- a/src/image/base_sbe_fixed.S +++ b/src/build/base_sbe_fixed.S @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/image/base_sbe_fixed.S $ */ +/* $Source: src/build/base_sbe_fixed.S $ */ /* */ /* OpenPOWER sbe Project */ /* */ diff --git a/src/image/buildInfo.py b/src/build/buildInfo.py index a881cb88..f7b109e4 100755 --- a/src/image/buildInfo.py +++ b/src/build/buildInfo.py @@ -2,7 +2,7 @@ # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # -# $Source: src/image/buildInfo.py $ +# $Source: src/build/buildInfo.py $ # # OpenPOWER sbe Project # diff --git a/src/image/img_defs.mk b/src/build/img_defs.mk index ea12c1bf..621be484 100644 --- a/src/image/img_defs.mk +++ b/src/build/img_defs.mk @@ -1,7 +1,7 @@ # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # -# $Source: src/image/img_defs.mk $ +# $Source: src/build/img_defs.mk $ # # OpenPOWER sbe Project # @@ -78,8 +78,12 @@ ifndef SBE_FW_DIR export SBE_FW_DIR = $(SBE_SRC_DIR)/sbefw endif -ifndef IMAGE_SRCDIR -export IMAGE_SRCDIR = $(SBE_SRC_DIR)/image +ifndef BUILD_DIR +export BUILD_DIR = $(SBE_SRC_DIR)/build +endif + +ifndef LINKER_DIR +export LINKER_DIR = $(BUILD_DIR)/linkerscripts endif ifndef BOOT_SRCDIR @@ -159,7 +163,7 @@ export P9_XIP_BINDIR = $(BASE_OBJDIR)/xip endif ifndef IMG_INCLUDES -export IMG_INCLUDES = -I$(IMAGEPROCS_SRCDIR) -I$(P9_XIP_SRCDIR) -I$(IMAGE_SRCDIR) -I$(CACHE_SRCDIR) -I$(UTILS_SRCDIR) -I$(CORE_SRCDIR) -I$(PERV_SRCDIR) -I$(NEST_SRCDIR) -I$(PM_SRCDIR) -I$(INITFILES_SRCDIR) +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 @@ -337,7 +341,7 @@ export LD_LIBRARY_PATH+=:$(GCC-TOOL-PATH)/lib INCLUDES += $(IMG_INCLUDES) -INCLUDES += -I$(IMAGE_SRCDIR)/../../include +INCLUDES += -I$(BUILD_DIR)/../../include INCLUDES += -I$(HWPLIB_SRCDIR) INCLUDES += -I$(PLAT_FAPI2_DIR)/include/plat INCLUDES += -I$(PLAT_FAPI2_DIR)/include diff --git a/src/image/linkloader.cmd b/src/build/linkerscripts/linkloader.cmd index 5e08a692..75c460d4 100755 --- a/src/image/linkloader.cmd +++ b/src/build/linkerscripts/linkloader.cmd @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/image/linkloader.cmd $ */ +/* $Source: src/build/linkerscripts/linkloader.cmd $ */ /* */ /* OpenPOWER sbe Project */ /* */ @@ -28,7 +28,7 @@ #ifndef BASE_LOADER_STACK_SIZE #define BASE_LOADER_STACK_SIZE 128 #endif -#include "sbe_link.H" +#include "../sbe_link.H" OUTPUT_FORMAT(elf32-powerpc); diff --git a/src/image/linkotprom.cmd b/src/build/linkerscripts/linkotprom.cmd index 8da70f49..19d636b0 100644 --- a/src/image/linkotprom.cmd +++ b/src/build/linkerscripts/linkotprom.cmd @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/image/linkotprom.cmd $ */ +/* $Source: src/build/linkerscripts/linkotprom.cmd $ */ /* */ /* OpenPOWER sbe Project */ /* */ diff --git a/src/image/linksbe.cmd b/src/build/linkerscripts/linksbe.cmd index 67303295..4e1832f6 100644 --- a/src/image/linksbe.cmd +++ b/src/build/linkerscripts/linksbe.cmd @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/image/linksbe.cmd $ */ +/* $Source: src/build/linkerscripts/linksbe.cmd $ */ /* */ /* OpenPOWER sbe Project */ /* */ diff --git a/src/image/linkseeprom.cmd b/src/build/linkerscripts/linkseeprom.cmd index 64cb6f77..7cbbcda4 100644 --- a/src/image/linkseeprom.cmd +++ b/src/build/linkerscripts/linkseeprom.cmd @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/image/linkseeprom.cmd $ */ +/* $Source: src/build/linkerscripts/linkseeprom.cmd $ */ /* */ /* OpenPOWER sbe Project */ /* */ diff --git a/src/image/p9_sbe.H b/src/build/p9_sbe.H index 0f5a402b..3e624d01 100644 --- a/src/image/p9_sbe.H +++ b/src/build/p9_sbe.H @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/image/p9_sbe.H $ */ +/* $Source: src/build/p9_sbe.H $ */ /* */ /* OpenPOWER sbe Project */ /* */ diff --git a/src/image/parsAndCutElf.py b/src/build/parsAndCutElf.py index d550b517..1a91d969 100755 --- a/src/image/parsAndCutElf.py +++ b/src/build/parsAndCutElf.py @@ -2,7 +2,7 @@ # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # -# $Source: src/image/parsAndCutElf.py $ +# $Source: src/build/parsAndCutElf.py $ # # OpenPOWER sbe Project # diff --git a/src/image/proc_sbe_fixed.H b/src/build/proc_sbe_fixed.H index 500e9b3b..6c3d134e 100644 --- a/src/image/proc_sbe_fixed.H +++ b/src/build/proc_sbe_fixed.H @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/image/proc_sbe_fixed.H $ */ +/* $Source: src/build/proc_sbe_fixed.H $ */ /* */ /* OpenPOWER sbe Project */ /* */ diff --git a/src/image/sbe_common.H b/src/build/sbe_common.H index c9061354..4fb78079 100644 --- a/src/image/sbe_common.H +++ b/src/build/sbe_common.H @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/image/sbe_common.H $ */ +/* $Source: src/build/sbe_common.H $ */ /* */ /* OpenPOWER sbe Project */ /* */ diff --git a/src/image/sbe_link.H b/src/build/sbe_link.H index 6efcc753..ad703e1a 100644 --- a/src/image/sbe_link.H +++ b/src/build/sbe_link.H @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/image/sbe_link.H $ */ +/* $Source: src/build/sbe_link.H $ */ /* */ /* OpenPOWER sbe Project */ /* */ diff --git a/src/image/topfiles.mk b/src/build/topfiles.mk index 1f04d000..6c76eaaf 100644 --- a/src/image/topfiles.mk +++ b/src/build/topfiles.mk @@ -1,7 +1,7 @@ # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # -# $Source: src/image/topfiles.mk $ +# $Source: src/build/topfiles.mk $ # # OpenPOWER sbe Project # @@ -26,12 +26,12 @@ TOP-CPP-SOURCES = TOP-S-SOURCES = base_ppe_header.S # generated by ppeParseProcSbeFixed.pl -TOP-FIXED-HEADERS += $(IMAGE_SRCDIR)/proc_sbe_fixed_system.H -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-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 diff --git a/src/hwpf/src/Makefile b/src/hwpf/src/Makefile index 950c0ccc..4377a865 100644 --- a/src/hwpf/src/Makefile +++ b/src/hwpf/src/Makefile @@ -6,6 +6,7 @@ # OpenPOWER sbe Project # # Contributors Listed Below - COPYRIGHT 2015,2016 +# [+] International Business Machines Corp. # # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -38,7 +39,7 @@ libfapi2.a: fapi2 hwpf plat fapi2: $(OBJS) plat: - $(MAKE) -I $(IMAGE_SRCDIR) -C $(PLAT_FAPI2_DIR)/src/plat + $(MAKE) -I $(BUILD_DIR) -C $(PLAT_FAPI2_DIR)/src/plat $(OBJS) $(OBJS:.o=.d): | $(OBJDIR) diff --git a/src/sample/Makefile b/src/sample/Makefile deleted file mode 100644 index 4d02b37e..00000000 --- a/src/sample/Makefile +++ /dev/null @@ -1,99 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/sample/Makefile $ -# -# 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 -#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/sample/img_defs.mk b/src/sample/img_defs.mk deleted file mode 100644 index 8b4685cc..00000000 --- a/src/sample/img_defs.mk +++ /dev/null @@ -1,264 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/sample/img_defs.mk $ -# -# 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 -# 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/sample/link.cmd b/src/sample/link.cmd deleted file mode 100644 index 1037564b..00000000 --- a/src/sample/link.cmd +++ /dev/null @@ -1,91 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/sample/link.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 - -#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/sample/pk_scom.c b/src/sample/pk_scom.c deleted file mode 100644 index 5b200566..00000000 --- a/src/sample/pk_scom.c +++ /dev/null @@ -1,235 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/sample/pk_scom.c $ */ -/* */ -/* 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 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/sample/pk_scom.h b/src/sample/pk_scom.h deleted file mode 100644 index 3d02e15e..00000000 --- a/src/sample/pk_scom.h +++ /dev/null @@ -1,66 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/sample/pk_scom.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 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/sample/pk_trace_wrap.c b/src/sample/pk_trace_wrap.c deleted file mode 100644 index e9118e2d..00000000 --- a/src/sample/pk_trace_wrap.c +++ /dev/null @@ -1,32 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/sample/pk_trace_wrap.c $ */ -/* */ -/* 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 */ -#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/sample/pk_trace_wrap.h b/src/sample/pk_trace_wrap.h deleted file mode 100644 index 072d91c8..00000000 --- a/src/sample/pk_trace_wrap.h +++ /dev/null @@ -1,30 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/sample/pk_trace_wrap.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 __PK_WRAP_WRAP_H__ -#define __PK_WRAP_WRAP__H__ - - -void pk_trace_wrap(const char*); - -#endif // __PK_WRAP_WRAP_H__ diff --git a/src/sample/sample_main.C b/src/sample/sample_main.C deleted file mode 100644 index a2d460f4..00000000 --- a/src/sample/sample_main.C +++ /dev/null @@ -1,122 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/sample/sample_main.C $ */ -/* */ -/* 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 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/sample/topfiles.mk b/src/sample/topfiles.mk deleted file mode 100644 index 8918a95c..00000000 --- a/src/sample/topfiles.mk +++ /dev/null @@ -1,29 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/sample/topfiles.mk $ -# -# 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 -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) |