diff options
author | Chris Cain <cjcain@us.ibm.com> | 2015-09-23 10:11:04 -0500 |
---|---|---|
committer | William A. Bryan <wilbryan@us.ibm.com> | 2015-09-24 10:34:28 -0500 |
commit | 774c825185dbca3c11c3ca946f4b07b72ee0c4d5 (patch) | |
tree | 27c67dcc4324fcff9aa02cb57dbdb6fa866c7324 | |
parent | 447b47d1dfbfafa54363beabb381122d780b783b (diff) | |
download | talos-occ-774c825185dbca3c11c3ca946f4b07b72ee0c4d5.tar.gz talos-occ-774c825185dbca3c11c3ca946f4b07b72ee0c4d5.zip |
OCC: Init and start GPE1
Change-Id: I2f1ef0a01497d46884eed25f1f63f9ebfcaf1da4
RTC: 133841
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/20729
Reviewed-by: William A. Bryan <wilbryan@us.ibm.com>
Tested-by: William A. Bryan <wilbryan@us.ibm.com>
-rwxr-xr-x | src/Makefile | 18 | ||||
-rwxr-xr-x | src/occ_405/main.c | 5 | ||||
-rw-r--r-- | src/occ_gpe1/Makefile | 81 | ||||
-rw-r--r-- | src/occ_gpe1/gpe1_main.c | 71 | ||||
-rwxr-xr-x | src/occ_gpe1/gpe_export.h | 41 | ||||
-rw-r--r-- | src/occ_gpe1/img_defs.mk | 234 | ||||
-rw-r--r-- | src/occ_gpe1/ipc_func_tables.c | 33 | ||||
-rw-r--r-- | src/occ_gpe1/link.cmd | 98 | ||||
-rw-r--r-- | src/occ_gpe1/pk_app_cfg.h | 38 | ||||
-rw-r--r-- | src/occ_gpe1/pk_app_irq_table.c | 93 | ||||
-rw-r--r-- | src/occ_gpe1/topfiles.mk | 4 |
11 files changed, 698 insertions, 18 deletions
diff --git a/src/Makefile b/src/Makefile index ebe3649..6afecee 100755 --- a/src/Makefile +++ b/src/Makefile @@ -46,16 +46,12 @@ THASH = $(PPETRACEPP_DIR)/tracehash.pl OCC_405_IMAGE_NAME = occ_405 OCC_GPE0_IMAGE_NAME = occ_gpe0 OCC_GPE1_IMAGE_NAME = occ_gpe1 -OCC_GPE2_IMAGE_NAME = occ_gpe2 -OCC_GPE3_IMAGE_NAME = occ_gpe3 NEEDED_IMAGES = \ $(TRACEPP_DIR)/tracepp \ $(OBJDIR)/$(OCC_405_IMAGE_NAME)/$(OCC_405_IMAGE_NAME).out \ $(OBJDIR)/$(OCC_GPE0_IMAGE_NAME)/$(OCC_GPE0_IMAGE_NAME).out \ -# $(OBJDIR)/$(OCC_GPE1_IMAGE_NAME)/$(OCC_GPE1_IMAGE_NAME).out \ -# $(OBJDIR)/$(OCC_GPE2_IMAGE_NAME)/$(OCC_GPE2_IMAGE_NAME).out \ -# $(OBJDIR)/$(OCC_GPE3_IMAGE_NAME)/$(OCC_GPE3_IMAGE_NAME).out + $(OBJDIR)/$(OCC_GPE1_IMAGE_NAME)/$(OCC_GPE1_IMAGE_NAME).out #SIMICS_WS = /gsa/ausgsa/home/d/a/davidy/work/simics-ppeWork @@ -66,9 +62,7 @@ run: $(NEEDED_IMAGES) $(SIMICS_WS)/simics \ -e '$$occ_405_binary_to_load=$(OBJDIR)/$(OCC_405_IMAGE_NAME)/$(OCC_405_IMAGE_NAME).out' \ -e '$$occ_gpe0_binary_to_load=$(OBJDIR)/$(OCC_GPE0_IMAGE_NAME)/$(OCC_GPE0_IMAGE_NAME).out' \ -# -e '$$occ_gpe1_binary_to_load=$(OBJDIR)/$(OCC_GPE1_IMAGE_NAME)/$(OCC_GPE1_IMAGE_NAME).out' \ -# -e '$$occ_gpe2_binary_to_load=$(OBJDIR)/$(OCC_GPE2_IMAGE_NAME)/$(OCC_GPE2_IMAGE_NAME).out' \ -# -e '$$occ_gpe3_binary_to_load=$(OBJDIR)/$(OCC_GPE3_IMAGE_NAME)/$(OCC_GPE3_IMAGE_NAME).out' \ + -e '$$occ_gpe1_binary_to_load=$(OBJDIR)/$(OCC_GPE1_IMAGE_NAME)/$(OCC_GPE1_IMAGE_NAME).out' \ modelsetup.simics @@ -86,13 +80,7 @@ $(OBJDIR)/$(OCC_GPE0_IMAGE_NAME)/$(OCC_GPE0_IMAGE_NAME).out: (cd $(SRCDIR)/$(OCC_GPE0_IMAGE_NAME) && make) $(OBJDIR)/$(OCC_GPE1_IMAGE_NAME)/$(OCC_GPE1_IMAGE_NAME).out: -# (cd $(SRCDIR)/$(OCC_GPE1_IMAGE_NAME) && make) - -$(OBJDIR)/$(OCC_GPE2_IMAGE_NAME)/$(OCC_GPE2_IMAGE_NAME).out: -# (cd $(SRCDIR)/$(OCC_GPE2_IMAGE_NAME) && make) - -$(OBJDIR)/$(OCC_GPE3_IMAGE_NAME)/$(OCC_GPE3_IMAGE_NAME).out: -# (cd $(SRCDIR)/$(OCC_GPE3_IMAGE_NAME) && make) + (cd $(SRCDIR)/$(OCC_GPE1_IMAGE_NAME) && make) $(TRACEPP_DIR)/tracepp: (cd $(TRACEPP_DIR) && make) diff --git a/src/occ_405/main.c b/src/occ_405/main.c index 920b2d6..7401b77 100755 --- a/src/occ_405/main.c +++ b/src/occ_405/main.c @@ -404,9 +404,8 @@ void occ_ipc_setup() TRAC_INFO("Starting GPE0"); gpe_reset(OCCHW_INST_ID_GPE0); -// $TEMP start GPE1 at later phase for DIMM collection -// TRAC_INFO("Starting GPE1"); -// gpe_reset(OCCHW_INST_ID_GPE1); + TRAC_INFO("Starting GPE1"); + gpe_reset(OCCHW_INST_ID_GPE1); TRAC_INFO("GPE's taken out of reset"); diff --git a/src/occ_gpe1/Makefile b/src/occ_gpe1/Makefile new file mode 100644 index 0000000..a69bc27 --- /dev/null +++ b/src/occ_gpe1/Makefile @@ -0,0 +1,81 @@ +#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 +COMMONLIB := $(OBJDIR)/commonlib/libcommon.a +OCCLIB := $(OBJDIR)/occlib/libocc.a +LIB_DIRS = -L$(OBJDIR)/pk -L$(OBJDIR)/commonlib -L$(OBJDIR)/occlib +LINK_OBJS = $(OBJS) $(PKLIB) $(COMMONLIB) $(OCCLIB) +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 -N -T$(LINK_SCRIPT) -Map $(OBJDIR)/$(IMAGE_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_NAME).out $(LIB_DIRS) $(OBJS) -locc -lcommon -lpk -lp2p + +#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) + +#Build the code that is common for all OCC processors (GPEs and 405) +$(OCCLIB): + $(MAKE) -I $(IMAGE_SRCDIR) -C $(OCCLIB_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/occ_gpe1/gpe1_main.c b/src/occ_gpe1/gpe1_main.c new file mode 100644 index 0000000..e81869e --- /dev/null +++ b/src/occ_gpe1/gpe1_main.c @@ -0,0 +1,71 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/occ_gpe0/gpe0_main.c $ */ +/* */ +/* OpenPOWER OnChipController Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ + +/// \file gpe1_main.c +/// \brief Sample program that creates and starts a thread +/// +/// This file demonstrates how to create a thread and run it. It also provides +/// an example of how to add traces to the code. + +#include "pk.h" +#include "ipc_api.h" +#include "ipc_ping.h" + +#define KERNEL_STACK_SIZE 256 + +uint8_t G_kernel_stack[KERNEL_STACK_SIZE]; + +// The main function is called by the boot code (after initializing some +// registers) +int main(int argc, char **argv) +{ + int rc; + + // initializes kernel data (stack, threads, timebase, timers, etc.) + pk_initialize((PkAddress)G_kernel_stack, + KERNEL_STACK_SIZE, + PK_TIMEBASE_CONTINUES, + PPE_TIMEBASE_HZ); + + PK_TRACE("Kernel init completed"); + + // Disable IPC's and register the IPC interrupt handler + rc = ipc_init(); + if(rc) + { + PK_TRACE("ipc_init failed with rc = 0x%08x", rc); + pk_halt(); + } + + // enable IPC's + rc = ipc_enable(); + if(rc) + { + PK_TRACE("ipc_enable failed with rc = 0x%08x", rc); + pk_halt(); + } + + return 0; +} diff --git a/src/occ_gpe1/gpe_export.h b/src/occ_gpe1/gpe_export.h new file mode 100755 index 0000000..84184e7 --- /dev/null +++ b/src/occ_gpe1/gpe_export.h @@ -0,0 +1,41 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/occ_405/gpe/gpe_export.h $ */ +/* */ +/* OpenPOWER OnChipController Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef _GPE_EXPORT_H +#define _GPE_EXPORT_H + +typedef struct { + union + { + struct { + uint32_t rc; + uint32_t addr; + }; + uint64_t error; + }; + uint64_t ffdc; +} GpeErrorStruct; // Same for every GPE program + +#endif //_GPE_EXPORT_H diff --git a/src/occ_gpe1/img_defs.mk b/src/occ_gpe1/img_defs.mk new file mode 100644 index 0000000..041279f --- /dev/null +++ b/src/occ_gpe1/img_defs.mk @@ -0,0 +1,234 @@ +# 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 := occ_gpe1 + +PPE_TYPE := gpe + +ifndef IMAGE_SRCDIR +export IMAGE_SRCDIR = $(abspath .) +endif + +ifndef IMG_INCLUDES +export IMG_INCLUDES = -I$(IMAGE_SRCDIR) +endif + +ifndef GLOBAL_INCLUDES +export GLOBAL_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 ../ppe/pk) +endif + +ifndef COMMONLIB_SRCDIR +export COMMONLIB_SRCDIR = $(abspath ../lib/common) +endif + +ifndef OCCLIB_SRCDIR +export OCCLIB_SRCDIR = $(abspath ../lib/occlib) +endif + +ifndef GCC-TOOL-PREFIX +GCC-TOOL-PREFIX = $(CTEPATH)/tools/ppcgcc/prod/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 ../ppe/tools/PowerPCtoPPE) +endif + +ifndef PPETRACEPP_DIR +export PPETRACEPP_DIR = $(abspath ../ppe/tools/ppetracepp) +endif + +OBJDIR = $(IMG_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 += -DUSE_PK_APP_CFG_H=1 +GCC-DEFS += -D__PK__=1 +DEFS += $(GCC-DEFS) + +############################################################################ + +INCLUDES += $(IMG_INCLUDES) $(GLOBAL_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)/../../include/registers -I$(OCCLIB_SRCDIR) -I$(COMMONLIB_SRCDIR) + +PIPE-CFLAGS = -pipe -Wa,-m405 + +GCC-CFLAGS += -Wall -fsigned-char -msoft-float \ + -mcpu=405 -mmulhw -mmultiple \ + -meabi -msdata=eabi -ffreestanding -fno-common \ + -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 + +CFLAGS = -c $(GCC-CFLAGS) $(PIPE-CFLAGS) $(GCC-O-LEVEL) $(INCLUDES) + +CPPFLAGS = -E + +ASFLAGS = -mppe42 + +ifdef P2P_ENABLE +#use this to disable sda optimizations +#PCP-FLAG = + +#use this to enable sda optimizations +PCP-FLAG = -e +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 .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: %.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/occ_gpe1/ipc_func_tables.c b/src/occ_gpe1/ipc_func_tables.c new file mode 100644 index 0000000..1dfa02e --- /dev/null +++ b/src/occ_gpe1/ipc_func_tables.c @@ -0,0 +1,33 @@ +#include "ipc_api.h" + +// Function table for multi target (common) functions +IPC_MT_FUNC_TABLE_START +IPC_HANDLER_DEFAULT // 0 +IPC_HANDLER_DEFAULT // 1 +IPC_HANDLER_DEFAULT // 2 +IPC_HANDLER_DEFAULT // 3 +IPC_HANDLER_DEFAULT // 4 +IPC_HANDLER_DEFAULT // 5 +IPC_HANDLER_DEFAULT // 6 +IPC_HANDLER_DEFAULT // 7 +IPC_MT_FUNC_TABLE_END + +// Function table for single target (processor-specific) functions +IPC_ST_FUNC_TABLE_START +IPC_HANDLER_DEFAULT // 0 +IPC_HANDLER_DEFAULT // 1 +IPC_HANDLER_DEFAULT // 2 +IPC_HANDLER_DEFAULT // 3 +IPC_HANDLER_DEFAULT // 4 +IPC_HANDLER_DEFAULT // 5 +IPC_HANDLER_DEFAULT // 6 +IPC_HANDLER_DEFAULT // 7 +IPC_HANDLER_DEFAULT // 8 +IPC_HANDLER_DEFAULT // 9 +IPC_HANDLER_DEFAULT // 10 +IPC_HANDLER_DEFAULT // 11 +IPC_HANDLER_DEFAULT // 12 +IPC_HANDLER_DEFAULT // 13 +IPC_HANDLER_DEFAULT // 14 +IPC_HANDLER_DEFAULT // 15 +IPC_ST_FUNC_TABLE_END diff --git a/src/occ_gpe1/link.cmd b/src/occ_gpe1/link.cmd new file mode 100644 index 0000000..ec9245e --- /dev/null +++ b/src/occ_gpe1/link.cmd @@ -0,0 +1,98 @@ + +// 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); + +// GPE1 starts after GPE0 +#define SRAM_START 0xfff10000 +#define SRAM_LENGTH 0x10000 +#define PPE_DEBUG_PTRS_OFFSET 0x180 + +MEMORY +{ + sram : ORIGIN = SRAM_START, LENGTH = SRAM_LENGTH +} + +// This symbol is only needed by external debug tools, so add this command +// to ensure that table is pulled in by the linker even though PPE code +// never references it. +EXTERN(pk_debug_ptrs); + +SECTIONS +{ + . = SRAM_START; + + . = ALIGN(512); + + _VECTOR_START = .; + + .vectors _VECTOR_START : { *(.vectors) } > sram + + /////////////////////////////////////////////////////////////////////////// + // Debug Pointers Table + // + // We want the debug pointers table to always appear at + // PPE_DEBUG_PTRS_OFFSET from the IVPR address. + /////////////////////////////////////////////////////////////////////////// + + _DEBUG_PTRS_START = _VECTOR_START + PPE_DEBUG_PTRS_OFFSET; + .debug_ptrs _DEBUG_PTRS_START : { *(.debug_ptrs) } > sram + + //////////////////////////////// + // All non-vector code goes here + //////////////////////////////// + .text : { *(.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/occ_gpe1/pk_app_cfg.h b/src/occ_gpe1/pk_app_cfg.h new file mode 100644 index 0000000..c5e72eb --- /dev/null +++ b/src/occ_gpe1/pk_app_cfg.h @@ -0,0 +1,38 @@ +#ifndef __PK_APP_CFG_H__ +#define __PK_APP_CFG_H__ +//----------------------------------------------------------------------------- +// *! (C) Copyright International Business Machines Corp. 2014 +// *! All Rights Reserved -- Property of IBM +// *! *** IBM Confidential *** +//----------------------------------------------------------------------------- + +/// \file pk_app_cfg.h +/// \brief Application specific overrides go here. +/// + +#include "global_app_cfg.h" + +#ifndef SIMICS_ENVIRONMENT +#define SIMICS_ENVIRONMENT 1 +#warning Building for Simics! +#endif + +/// Static configuration data for external interrupts: +/// +/// IRQ#, TYPE, POLARITY, ENABLE +/// +#define APPCFG_EXT_IRQS_CONFIG \ + OCCHW_IRQ_CHECK_STOP_GPE1 OCCHW_IRQ_TYPE_EDGE OCCHW_IRQ_POLARITY_RISING OCCHW_IRQ_MASKED \ + OCCHW_IRQ_IPI1_HI_PRIORITY OCCHW_IRQ_TYPE_EDGE OCCHW_IRQ_POLARITY_RISING OCCHW_IRQ_MASKED \ + OCCHW_IRQ_IPI1_LO_PRIORITY OCCHW_IRQ_TYPE_EDGE OCCHW_IRQ_POLARITY_RISING OCCHW_IRQ_MASKED \ + +/// The Instance ID of the occ processor that this application is intended to run on +/// 0-3 -> GPE, 4 -> 405 +#define APPCFG_OCC_INSTANCE_ID 1 + +// This application will statically initialize it's external interrupt table +#define STATIC_IRQ_TABLE + +#define STATIC_IPC_TABLES + +#endif /*__PK_APP_CFG_H__*/ diff --git a/src/occ_gpe1/pk_app_irq_table.c b/src/occ_gpe1/pk_app_irq_table.c new file mode 100644 index 0000000..5c560e6 --- /dev/null +++ b/src/occ_gpe1/pk_app_irq_table.c @@ -0,0 +1,93 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/occ_gpe1/pk_app_irq_table.c $ */ +/* */ +/* OpenPOWER OnChipController Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +#include "pk.h" + +EXTERNAL_IRQ_TABLE_START +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_DEBUGGER +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_TRACE_TRIGGER +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_OCC_ERROR +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_PBA_ERROR +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_SRT_ERROR +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_GPE0_HALT +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_GPE1_HALT +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_GPE2_HALT +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_GPE3_HALT +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_PPC405_HALT +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_OCB_ERROR +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_SPIPSS_ERROR +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_CHECK_STOP_PPC405 +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_CHECK_STOP_GPE0 +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_CHECK_STOP_GPE1 +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_CHECK_STOP_GPE2 +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_CHECK_STOP_GPE3 +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_OCC_MALF_ALERT +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_ADU_MALF_ALERT +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_EXTERNAL_TRAP +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_IVRM_PVREF_ERROR +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_OCC_TIMER0 +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_OCC_TIMER1 +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_AVS_SLAVE0 +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_AVS_SLAVE1 +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_IPI0_HI_PRIORITY +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_IPI1_HI_PRIORITY +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_IPI2_HI_PRIORITY +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_IPI3_HI_PRIORITY +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_IPI4_HI_PRIORITY +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_ADCFSM_ONGOING +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_RESERVED_31 +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_PBAX_OCC_SEND +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_PBAX_OCC_PUSH0 +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_PBAX_OCC_PUSH1 +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_PBA_BCDE_ATTN +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_PBA_BCUE_ATTN +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_STRM0_PULL +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_STRM0_PUSH +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_STRM1_PULL +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_STRM1_PUSH +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_STRM2_PULL +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_STRM2_PUSH +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_STRM3_PULL +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_STRM3_PUSH +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_PMC_PCB_INTR_TYPE0_PENDING +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_PMC_PCB_INTR_TYPE1_PENDING +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_PMC_PCB_INTR_TYPE2_PENDING +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_PMC_PCB_INTR_TYPE3_PENDING +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_PMC_PCB_INTR_TYPE4_PENDING +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_PMC_PCB_INTR_TYPE5_PENDING +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_PMC_PCB_INTR_TYPE6_PENDING +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_PMC_PCB_INTR_TYPE7_PENDING +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_PMC_O2S_0A_ONGOING +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_PMC_O2S_0B_ONGOING +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_PMC_O2S_1A_ONGOING +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_PMC_O2S_1B_ONGOING +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_PSSBRIDGE_ONGOING +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_IPI0_LO_PRIORITY +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_IPI1_LO_PRIORITY +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_IPI2_LO_PRIORITY +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_IPI3_LO_PRIORITY +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_IPI4_LO_PRIORITY +IRQ_HANDLER_DEFAULT //OCCHW_IRQ_RESERVED_63 +EXTERNAL_IRQ_TABLE_END + diff --git a/src/occ_gpe1/topfiles.mk b/src/occ_gpe1/topfiles.mk new file mode 100644 index 0000000..698d29f --- /dev/null +++ b/src/occ_gpe1/topfiles.mk @@ -0,0 +1,4 @@ +TOP-C-SOURCES = gpe1_main.c pk_app_irq_table.c ipc_func_tables.c +TOP-S-SOURCES = + +TOP_OBJECTS = $(TOP-C-SOURCES:.c=.o) $(TOP-S-SOURCES:.S=.o) |