summaryrefslogtreecommitdiffstats
path: root/sbe
diff options
context:
space:
mode:
authorSachin Gupta <sgupta2m@in.ibm.com>2016-02-09 22:42:48 -0600
committerAMIT J. TENDOLKAR <amit.tendolkar@in.ibm.com>2016-05-03 07:35:29 -0400
commit1a83cd915cd2be01158eb7016d7f92e1f7c54d80 (patch)
treee95f297d4ad13f058dbf4e80033bbaa77164c00c /sbe
parentce2b54ae9458775feac2fab757afadc6817605a8 (diff)
downloadtalos-sbe-1a83cd915cd2be01158eb7016d7f92e1f7c54d80.tar.gz
talos-sbe-1a83cd915cd2be01158eb7016d7f92e1f7c54d80.zip
Single SEEPROM image for SBE
Currently we build seprarate images for PIBMEM and SEEPROM. Later using XIP tools we add pibmem image to seeprom. This activity will create only one image for SEEPROM and PIBMEM RTC: 145589 Change-Id: I5f560afaf310ace539a793ea7c2ce710dcb3fcc1 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/20653 Tested-by: Jenkins Server Reviewed-by: Santosh S. Puranik <santosh.puranik@in.ibm.com> Reviewed-by: RAJA DAS <rajadas2@in.ibm.com> Reviewed-by: AMIT J. TENDOLKAR <amit.tendolkar@in.ibm.com>
Diffstat (limited to 'sbe')
-rw-r--r--sbe/image/Makefile29
-rw-r--r--sbe/image/base_ppe_header.S131
-rw-r--r--sbe/image/linksbe.cmd6
-rw-r--r--sbe/image/linkseeprom.cmd160
-rwxr-xr-xsbe/image/parsAndCutElf.py46
-rw-r--r--sbe/image/pm_loader.S4
-rw-r--r--sbe/sbefw/attr.C100
-rw-r--r--sbe/sbefw/sbecmdcntlinst.C6
-rw-r--r--sbe/sbefw/sbefwfiles.mk1
-rw-r--r--sbe/sbefw/sbemain.C28
-rw-r--r--sbe/sbefw/vector2
11 files changed, 280 insertions, 233 deletions
diff --git a/sbe/image/Makefile b/sbe/image/Makefile
index dd1e84ad..738c0c21 100644
--- a/sbe/image/Makefile
+++ b/sbe/image/Makefile
@@ -140,19 +140,16 @@ LINK_SCRIPT_OTPROM = $(addprefix $(OBJDIR)/, linkscriptotprom)
# ---- 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
- $(OBJCOPY) -O binary $< $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin --pad-to 0x`/usr/bin/nm $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out | grep "A _seeprom_end" | cut -d " " -f 1`
+ ./parsAndCutElf.py
$(OBJDUMP) -S $< > $(OBJDIR)/$(IMAGE_SEEPROM_NAME).dis
ifndef FAPI2_TEST
# This is the production build of the SEEPROM
#create a linked ELF executable
-# TODO via RTC 142365
-# Remove pibMemAttrSet from this file once we have support to copy fixed section
-# from SEEPROM to PIBMEM.
-$(OBJDIR)/$(IMAGE_SEEPROM_NAME).out: pibMemAttrSet buildInfo $(LINK_OBJS) $(LINK_SCRIPT_SEEPROM)
+$(OBJDIR)/$(IMAGE_SEEPROM_NAME).out: buildInfo $(LINK_OBJS) $(LINK_SCRIPT_SEEPROM)
@echo ">>>>> Production Build <<<<<<"
- $(LD) -e __system_reset -T$(LINK_SCRIPT_SEEPROM) -Map $(OBJDIR)/$(IMAGE_SEEPROM_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out $(OBJS) $(LIB_DIRS) -leabi -lmath -lc
+ $(LD) -n -T$(LINK_SCRIPT_SEEPROM) -Map $(OBJDIR)/$(IMAGE_SEEPROM_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out $(OBJS) $(LIB_DIRS) --start-group $(LLIBS) --end-group -leabi -lmath -lc
else
# This a special build of the SEEPROM image that includes the PK to allow for test threads to be used.
# create a linked ELF executable
@@ -174,7 +171,7 @@ $(OBJDIR)/$(IMAGE_SBE_NAME).bin $(OBJDIR)/$(IMAGE_SBE_NAME).dis: $(OBJDIR)/$(IMA
$(NM) $< > $(OBJDIR)/$(IMAGE_SBE_NAME).syms
# create a linked ELF executable
-$(OBJDIR)/$(IMAGE_SBE_NAME).out: pibMemAttrSet buildInfo $(OBJDIR)/base_sbe_fixed.o $(LINK_OBJS) $(LINK_SCRIPT_SBE)
+$(OBJDIR)/$(IMAGE_SBE_NAME).out: buildInfo $(OBJDIR)/base_sbe_fixed.o $(LINK_OBJS) $(LINK_SCRIPT_SBE)
$(LD) -e __system_reset -T$(LINK_SCRIPT_SBE) -Map $(OBJDIR)/$(IMAGE_SBE_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_SBE_NAME).out $(LIB_DIRS) $(OBJDIR)/base_sbe_fixed.o --start-group $(LLIBS) --end-group
# pass the link command file through the C preprocessor to evaluate macros and remove comments
@@ -211,7 +208,7 @@ $(LINK_SCRIPT_LOADER): linkloader.cmd
# Remove the "all" rule if FAPI2_TEST as the SBE FW is incompatible with the
# option of PK enabled
ifndef FAPI2_TEST
-all: seeprom $(OBJDIR)/$(IMAGE_SBE_NAME).bin $(OBJDIR)/$(IMAGE_LOADER_NAME).bin $(SBE_TOOLS) appendbase appendloader
+all: seeprom $(OBJDIR)/$(IMAGE_SBE_NAME).bin $(OBJDIR)/$(IMAGE_LOADER_NAME).bin $(SBE_TOOLS) appendloader
install: all
@echo "Installing simics.tar"
@rm -rf $(OBJDIR)/simics-tar-dir
@@ -226,9 +223,10 @@ all:
@echo "Makefile option error: ALL is not compatible with FAPI2_test"
endif
-.PHONY: all normalize defaultset appendbase appendloader add_L1_LoaderAddr add_L2_LoaderAddr add_kernelAddr symbols appendoverrides report
+.PHONY: all normalize defaultset appendloader add_L1_LoaderAddr add_L2_LoaderAddr add_kernelAddr symbols appendoverrides report
+
+all: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin $(OBJDIR)/$(IMAGE_SBE_NAME).bin $(OBJDIR)/$(IMAGE_LOADER_NAME).bin $(OBJDIR)/$(IMAGE_OTPROM_NAME).bin $(SBE_TOOLS) normalize defaultset $(OBJDIR)/fixed.bin appendloader appendoverrides add_L1_LoaderAddr add_L2_LoaderAddr add_kernelAddr symbols tracehash buildinfo report
-all: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin $(OBJDIR)/$(IMAGE_SBE_NAME).bin $(OBJDIR)/$(IMAGE_LOADER_NAME).bin $(OBJDIR)/$(IMAGE_OTPROM_NAME).bin $(SBE_TOOLS) normalize defaultset $(OBJDIR)/fixed.bin appendbase appendloader appendoverrides add_L1_LoaderAddr add_L2_LoaderAddr add_kernelAddr symbols tracehash buildinfo report
buildinfo: $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin
$(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin set build_date `date +%Y%m%d`
@@ -243,12 +241,11 @@ add_L2_LoaderAddr: $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out
$(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin set L2_LoaderAddr 0x`nm $(OBJDIR)/$(IMAGE_LOADER_NAME).out | grep __base_loader_setup | cut -f 1 -d " "`
add_kernelAddr: $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_LOADER_NAME).out
- $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin set kernelAddr 0x`nm $(OBJDIR)/$(IMAGE_SBE_NAME).out | grep __pk_boot | 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 $(OBJDIR)/$(IMAGE_LOADER_NAME).out $(OBJDIR)/$(IMAGE_SBE_NAME).out
$(NM) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out > $(OBJDIR)/$(SBE_SYMBOLS_NAME)
$(NM) $(OBJDIR)/$(IMAGE_LOADER_NAME).out >> $(OBJDIR)/$(SBE_SYMBOLS_NAME)
- $(NM) $(OBJDIR)/$(IMAGE_SBE_NAME).out >> $(OBJDIR)/$(SBE_SYMBOLS_NAME)
# this target is broken, since the image report should be created
# when the xip image has been finalised
@@ -284,7 +281,7 @@ $(OBJDIR):
$(TOOLS_ATTR_DIR)/ppeCreateIfAttrService.pl $(PPE_FAPI2_DIR)/include $(IMPORT_XML_DIR)/attribute_info/p9_sbe_attributes.xml $(ATTRFILES)
mkdir -p $(OBJDIR)
-.PHONY: clean topfixedheaders $(PKLIB) $(P2PLIB) $(PPELIB) $(FAPI2LIB) $(CACHELIB) $(CORELIB) $(PERVLIB) $(NESTLIB) $(PMLIB) $(HWPLIB) buildInfo pibMemAttrSet
+.PHONY: clean topfixedheaders $(PKLIB) $(P2PLIB) $(PPELIB) $(FAPI2LIB) $(CACHELIB) $(CORELIB) $(PERVLIB) $(NESTLIB) $(PMLIB) $(HWPLIB) buildInfo
#errxml: topfixedheaders attrids platattr attrserv
@@ -394,9 +391,6 @@ $(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
-appendbase: $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin $(OBJDIR)/$(IMAGE_SBE_NAME).bin
- $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin append .base $(OBJDIR)/$(IMAGE_SBE_NAME).bin
-
appendloader: $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin $(OBJDIR)/$(IMAGE_LOADER_NAME).bin
$(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin append .baseloader $(OBJDIR)/$(IMAGE_LOADER_NAME).bin
@@ -412,9 +406,6 @@ tracehash:
mkdir -p $(OBJDIR)
$(THASH) -c -d $(OBJDIR) -s $(OBJDIR)/trexStringFile
-pibMemAttrSet:
- $(TOOLS_IMAGE_DIR)/ppeSetFixedPibmem.pl $(IMPORT_XML_DIR)/attribute_info/p9_sbe_attributes.xml $(ATTRFILES)
-
#clean the kernel directory first, then the application level clean
clean:
rm -fr $(OBJDIR)
diff --git a/sbe/image/base_ppe_header.S b/sbe/image/base_ppe_header.S
index 402385fb..5e106504 100644
--- a/sbe/image/base_ppe_header.S
+++ b/sbe/image/base_ppe_header.S
@@ -22,76 +22,76 @@
- .macro ..checku, x:req, bits:req, err="Unsigned value too large"
+ .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
+ .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"
+ .iflt (\x)
+ .error "An unsigned value is required here"
.endif
- .ifgt ((\x) - (0xffffffffffffffff >> (64 - (\bits))))
- .error "\err"
- .endif
+ .ifgt ((\x) - (0xffffffffffffffff >> (64 - (\bits))))
+ .error "\err"
+ .endif
- .endm
+ .endm
.macro ..check_u16, u16
- ..checku (\u16), 16, "Unsigned immediate is larger than 16 bits"
+ ..checku (\u16), 16, "Unsigned immediate is larger than 16 bits"
.endm
.macro ..set_default_space, s
- ..check_u16 (\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 ..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 .quada, offset:req
+ ..check_default_space
+ .long _PGAS_DEFAULT_SPACE
+ .long (\offset)
+ .endm
- .macro P9XipHeader, magic, link_address, entry_point, image_size
+ .macro P9XipHeader, magic, link_address, entry_point, image_size
- .section .header, "a", @progbits
+ .section .header, "a", @progbits
- //////////////////////////////////////////////////////////////////////
- // Identification - 8-byte aligned; 8 Entries; TOC-Indexed
- //////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////
+ // Identification - 8-byte aligned; 8 Entries; TOC-Indexed
+ //////////////////////////////////////////////////////////////////////
__magic:
- .quad (\magic)
+ .quad (\magic)
__L1_LoaderAddr:
- .quad 0
+ .quad 0
__L2_LoaderAddr:
- .quad 0
+ .quad 0
__kernelAddr:
- .quad 0
+ .quad 0
__link_address:
- .quada (\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
-
+ .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 - 8-byte aligned; 16 entries; Not TOC-Indexed
+ // Section Table - Not TOC-Indexed
//////////////////////////////////////////////////////////////////////
.xip_section header
@@ -100,10 +100,10 @@ __header_64_reserved:
.xip_section toc, 4
.xip_section strings
.xip_section loader_text, 4
- .xip_section loader_data, 8
+ .xip_section loader_data, 8, empty=1
.xip_section text, 4
- .xip_section data, 8
- .xip_section base, 4, empty=1
+ .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
@@ -116,17 +116,17 @@ __header_64_reserved:
//////////////////////////////////////////////////////////////////////
__image_size:
- .long (\image_size)
+ .long (\image_size)
__build_date:
- .long 0
+ .long 0
__build_time:
- .long 0
+ .long 0
__header_32_reserved:
- .long 0, 0, 0, 0, 0
+ .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
+ .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
//////////////////////////////////////////////////////////////////////
@@ -134,17 +134,17 @@ __header_32_reserved:
//////////////////////////////////////////////////////////////////////
__header_version:
- .byte P9_XIP_HEADER_VERSION
+ .byte P9_XIP_HEADER_VERSION
__toc_normalized:
- .byte 0
+ .byte 0
__toc_sorted:
- .byte 0
+ .byte 0
__header_8_reserved:
- .byte 0, 0, 0, 0, 0
+ .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
+ .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
//////////////////////////////////////////////////////////////////////
@@ -152,17 +152,17 @@ __header_8_reserved:
//////////////////////////////////////////////////////////////////////
__build_user:
- .asciz "unknown " # 16 Characters allocated
+ .asciz "unknown " # 16 Characters allocated
__build_host:
- .asciz "unknown " # 24 characters allocated
+ .asciz "unknown " # 24 characters allocated
__header_string_reserved:
- .space 24, 0
+ .space 24, 0
- .xip_toc build_user, P9_XIP_STRING, __build_user
- .xip_toc build_host, P9_XIP_STRING, __build_host
+ .xip_toc build_user, P9_XIP_STRING, __build_user
+ .xip_toc build_host, P9_XIP_STRING, __build_host
- .endm
+ .endm
.section .fixed, "a", @progbits
@@ -172,9 +172,10 @@ __header_string_reserved:
.section .toc, "a", @progbits
.section .strings, "aS", @progbits
+ .section .base, "a", @progbits
..set_default_space IMAGE_SPACE_SEEPROM
- P9XipHeader P9_XIP_MAGIC_SEEPROM, 0x80000000, 0x80000C78, _seeprom_size
+ P9XipHeader P9_XIP_MAGIC_SEEPROM, 0x80000000, 0x00000000, _sbe_image_size
// Create the .fixed section
.proc_sbe_fixed_system
diff --git a/sbe/image/linksbe.cmd b/sbe/image/linksbe.cmd
index 6e287d28..1a74de72 100644
--- a/sbe/image/linksbe.cmd
+++ b/sbe/image/linksbe.cmd
@@ -11,7 +11,9 @@ OUTPUT_FORMAT(elf32-powerpc);
MEMORY
{
- sram : ORIGIN = SBE_BASE_ORIGIN, LENGTH = SBE_BASE_LENGTH
+ // increasing ram size as workaround so that pibmem image compilation
+ // doe not fail.
+ sram : ORIGIN = SBE_BASE_ORIGIN, LENGTH = SBE_BASE_LENGTH + 0xF000
}
SECTIONS
@@ -60,7 +62,9 @@ SECTIONS
_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
diff --git a/sbe/image/linkseeprom.cmd b/sbe/image/linkseeprom.cmd
index 79ad5625..43e7c406 100644
--- a/sbe/image/linkseeprom.cmd
+++ b/sbe/image/linkseeprom.cmd
@@ -3,77 +3,173 @@
#include <sbe_link.H>
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
////////////////////////////////
- . = ALIGN(1); _header_origin = .; _header_offset = . - _seeprom_origin; .header . : { *(.header) } _header_size = . - _header_origin;
+ .header : {
+ _header_origin = .; _header_offset = . - _seeprom_origin; *(.header);
+ } > seeprom
+ _header_size = . - _header_origin;
- // @TODO via RTC 136315
- // This value will change as per OTPROM requirement
- . = SBE_SEEPROM_BASE_ORIGIN + 0x1000;
- ////////////////////////////////
- // LOADER_TEXT
- ////////////////////////////////
- . = ALIGN(4); _loader_text_origin = .; _loader_text_offset = . - _seeprom_origin; .loader_text . : { *(.loader_text) } _loader_text_size = . - _loader_text_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_DATA
+ // LOADER_TEXT
////////////////////////////////
- . = ALIGN(8); _loader_data_origin = .; _loader_data_offset = . - _seeprom_origin; .loader_data . : { *(.loader_data) } _loader_data_size = . - _loader_data_origin;
+ .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
////////////////////////////////
- . = ALIGN(512); _fixed_origin = .; _fixed_offset = . - _seeprom_origin; .fixed . : { *(.fixed) } _fixed_size = . - _fixed_origin;
+ .fixed ALIGN(0x200) : {
+ _fixed_origin = .; _fixed_offset = . - _seeprom_origin;
+ *(.fixed)
+ } > seeprom
+ _fixed_size = . - _fixed_origin;
////////////////////////////////
// FIXED_TOC
////////////////////////////////
- . = ALIGN(8); _fixed_toc_origin = .; _fixed_toc_offset = . - _seeprom_origin; .fixed_toc . : { *(.fixed_toc) } _fixed_toc_size = . - _fixed_toc_origin;
-
-
- ////////////////////////////////
- // TEXT
- ////////////////////////////////
- . = ALIGN(4); _text_origin = .; _text_offset = . - _seeprom_origin; .text . : {. = ALIGN(512); *(.vectors) *(.text) *(.eh_frame) } _text_size = . - _text_origin;
-
- ////////////////////////////////
- // DATA
- ////////////////////////////////
- . = ALIGN(8); _data_origin = .; _data_offset = . - _seeprom_origin; .data . : { *(.data) *(.comment) *(.rodata*)} _data_size = . - _data_origin;
+ .fixed_toc ALIGN(8) : {
+ _fixed_toc_origin = .; _fixed_toc_offset = . - _seeprom_origin; *(.fixed_toc);
+ } > seeprom
+ _fixed_toc_size = . - _fixed_toc_origin;
////////////////////////////////
// TOC
////////////////////////////////
- . = ALIGN(4); _toc_origin = .; _toc_offset = . - _seeprom_origin; .toc . : { *(.toc) } _toc_size = . - _toc_origin;
+ .toc ALIGN(4): {
+ _toc_origin = .; _toc_offset = . - _seeprom_origin; *(.toc);
+ } > seeprom
+ _toc_size = . - _toc_origin;
////////////////////////////////
// STRING
////////////////////////////////
- . = ALIGN(1); _strings_origin = .; _strings_offset = . - _seeprom_origin; .strings . : { *(.strings) } _strings_size = . - _strings_origin;
+ .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* ) } > 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;
- // SDA sections .sdata and .sbss must be adjacent to each
- // other. Our SDATA sections are small so we'll use strictly positive
- // offsets.
+ . = ALIGN(8); _DATA_SECTION_BASE = .;
_SDA_BASE_ = .;
+ .data . : {
+ *(.data*) *(.bss*) *(.comment)
+ } > pibmem
+ .sdata . : { *(.sdata*) } > pibmem
+ . = ALIGN(8);
+ _sbss_start = .;
+ .sbss . : {
+ *(.sbss*);
+ . = ALIGN(8);
+ } > pibmem
+ _sbss_end = .;
+
+ // As bss section is not expanded by default, reserve the space
+ . = . + SIZEOF(.sbss);
+ . = ALIGN(8);
+ _sbss_size = SIZEOF(.sbss);
- .sbss . : { *(.sbss) }
- .sdata . : { *(.sdata) }
+ . = ALIGN(8);
+ _PK_INITIAL_STACK_LIMIT = .;
+ . = . + INITIAL_STACK_SIZE;
+ _PK_INITIAL_STACK = . - 1;
+ . = ALIGN(8);
+
+ _base_size = . - _base_origin;
. = ALIGN(8);
- _seeprom_size = . - _seeprom_origin;
- _seeprom_end = . - 0;
+ _pibmem_size = . - _pibmem_origin;
+ _sbe_image_size = _seeprom_size + ( . - _pibmem_origin );
}
diff --git a/sbe/image/parsAndCutElf.py b/sbe/image/parsAndCutElf.py
new file mode 100755
index 00000000..44c4b8a7
--- /dev/null
+++ b/sbe/image/parsAndCutElf.py
@@ -0,0 +1,46 @@
+#!/usr/bin/python
+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/sbe/image/pm_loader.S b/sbe/image/pm_loader.S
index 84c64020..1f926181 100644
--- a/sbe/image/pm_loader.S
+++ b/sbe/image/pm_loader.S
@@ -13,15 +13,13 @@
.section .loader_text, "ax", @progbits
- .global __vectors
-
__vectors:
############################################################
# 0x0040 : System Reset
############################################################
- .global __system_reset
.org __vectors + 0x0040
+
__system_reset:
b __pmLoader
diff --git a/sbe/sbefw/attr.C b/sbe/sbefw/attr.C
deleted file mode 100644
index f893e625..00000000
--- a/sbe/sbefw/attr.C
+++ /dev/null
@@ -1,100 +0,0 @@
-#include <fapi2.H>
-extern fapi2attr::SystemAttributes_t G_system_attributes;
-extern fapi2attr::ProcChipAttributes_t G_proc_chip_attributes;
-extern fapi2attr::PervAttributes_t G_perv_attributes;
-extern fapi2attr::CoreAttributes_t G_core_attributes;
-extern fapi2attr::EQAttributes_t G_eq_attributes;
-extern fapi2attr::EXAttributes_t G_ex_attributes;
-void initAttrWA()
-{
-////// workaround start
-#ifndef SBE_SEEPROM_FIXED_SECTION
-G_system_attributes.fapi2attr::SystemAttributes_t::ATTR_SYSTEM_IPL_PHASE=0x1;
-G_system_attributes.fapi2attr::SystemAttributes_t::ATTR_IS_MPIPL=0x01;
-G_system_attributes.fapi2attr::SystemAttributes_t::ATTR_PROC_FABRIC_ADDR_BAR_MODE=0x01;
-G_system_attributes.fapi2attr::SystemAttributes_t::ATTR_MEM_MIRROR_PLACEMENT_POLICY=0x01;
-G_system_attributes.fapi2attr::SystemAttributes_t::ATTR_SBE_BOOTLOADER_OFFSET=0x01;
-G_system_attributes.fapi2attr::SystemAttributes_t::ATTR_HOSTBOOT_HRMOR_OFFSET=0x01;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_FSI=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_PRV=0xF07D;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_N0=0xF03F;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_N1=0xF03F;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_N2=0xF03F;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_N3=0xF01F;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_XB=0xF01D;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_MC01=0xF0FD;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_MC23=0xF0FD;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_OB0=0xF1FD;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_OB1=0;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_OB2=0;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_OB3=0xF1FD;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_PCI0=0xF1FD;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_PCI1=0xF0FD;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_PCI2=0xF07D;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EQ0=0xF019;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EQ1=0xF019;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EQ2=0xF019;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EQ3=0xF019;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EQ4=0xF019;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EQ5=0xF019;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC00=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC01=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC02=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC03=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC04=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC05=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC06=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC07=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC08=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC09=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC10=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC11=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC12=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC13=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC14=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC15=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC16=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC17=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC18=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC19=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC20=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC21=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC22=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PG_EC23=0xF1FF;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_FABRIC_SYSTEM_ID=0x1;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_MC_SYNC_MODE=0x01;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_EQ_GARD=0x01;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_EC_GARD=0x01;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_I2C_BUS_DIV_REF=0x01;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_BOOT_FLAGS=0x01;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_NODE_POS=0x01;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_CHIP_POS=0x01;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_BOOT_FREQ=0x01;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_NEST_PLL_BUCKET=0x01;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_VCS_BOOT_VOLTAGE=0x01;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_VDD_BOOT_VOLTAGE=0x01;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_FABRIC_CHIP_ID=0x01;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_FABRIC_GROUP_ID=0x01;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_ADU_XSCOM_BAR_BASE_ADDR=0x01;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PROC_SBE_MASTER_CHIP=0x01;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PROC_FABRIC_SYSTEM_ID=0x01;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PROC_FABRIC_GROUP_ID=0x01;
-G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::ATTR_PROC_FABRIC_CHIP_ID=0x01;
-G_perv_attributes.fapi2attr::PervAttributes_t::ATTR_CHIP_UNIT_POS[0]=0x00;
-G_perv_attributes.fapi2attr::PervAttributes_t::ATTR_CHIP_UNIT_POS[1]=0x01;
-G_perv_attributes.fapi2attr::PervAttributes_t::ATTR_CHIP_UNIT_POS[2]=0x02;
-G_perv_attributes.fapi2attr::PervAttributes_t::ATTR_CHIP_UNIT_POS[3]=0x03;
-G_perv_attributes.fapi2attr::PervAttributes_t::ATTR_CHIP_UNIT_POS[4]=0x04;
-G_perv_attributes.fapi2attr::PervAttributes_t::ATTR_CHIP_UNIT_POS[5]=0x05;
-G_perv_attributes.fapi2attr::PervAttributes_t::ATTR_CHIP_UNIT_POS[6]=0x06;
-G_perv_attributes.fapi2attr::PervAttributes_t::ATTR_CHIP_UNIT_POS[7]=0x07;
-G_perv_attributes.fapi2attr::PervAttributes_t::ATTR_CHIP_UNIT_POS[8]=0x08;
-G_perv_attributes.fapi2attr::PervAttributes_t::ATTR_CHIP_UNIT_POS[9]=0x09;
-G_perv_attributes.fapi2attr::PervAttributes_t::ATTR_CHIP_UNIT_POS[10]=0x0A;
-G_perv_attributes.fapi2attr::PervAttributes_t::ATTR_CHIP_UNIT_POS[11]=0x0B;
-G_perv_attributes.fapi2attr::PervAttributes_t::ATTR_CHIP_UNIT_POS[12]=0x0C;
-G_perv_attributes.fapi2attr::PervAttributes_t::ATTR_CHIP_UNIT_POS[13]=0x0D;
-G_perv_attributes.fapi2attr::PervAttributes_t::ATTR_CHIP_UNIT_POS[14]=0x0E;
-G_perv_attributes.fapi2attr::PervAttributes_t::ATTR_CHIP_UNIT_POS[15]=0x0F;
-#endif //SBE_SEEPROM_FIXED_SECTION
-}
diff --git a/sbe/sbefw/sbecmdcntlinst.C b/sbe/sbefw/sbecmdcntlinst.C
index 09eb8232..11fd374a 100644
--- a/sbe/sbefw/sbecmdcntlinst.C
+++ b/sbe/sbefw/sbecmdcntlinst.C
@@ -19,6 +19,10 @@ using namespace fapi2;
// This is used to find out the array index in g_control_reg_map in
// p9_thread_control.C
static const uint8_t SINGLE_THREAD_BIT_MASK = 0x08;
+// TODO via RTC 152424
+// Currently all proecdures in core directory are in seeprom.
+// So we have to use function pointer to force a long call.
+p9_thread_control_FP_t threadCntlhwp = &p9_thread_control;
/* @brief Map User Thread Command to Hwp ThreadCommands Enum */
ThreadCommands getThreadCommand(const sbeCntlInstRegMsgHdr_t & i_req)
@@ -111,7 +115,7 @@ uint32_t sbeCntlInst(uint8_t *i_pArg)
do
{
// Call the Procedure
- l_fapiRc = p9_thread_control(
+ l_fapiRc = threadCntlhwp(
l_coreTgt,
(SINGLE_THREAD_BIT_MASK >> l_thread),
l_cmd, l_warnCheck,
diff --git a/sbe/sbefw/sbefwfiles.mk b/sbe/sbefw/sbefwfiles.mk
index 32826a7d..f666bdb6 100644
--- a/sbe/sbefw/sbefwfiles.mk
+++ b/sbe/sbefw/sbefwfiles.mk
@@ -8,7 +8,6 @@ SBEFW-CPP-SOURCES += sbecmdiplcontrol.C
SBEFW-CPP-SOURCES += pool.C
SBEFW-CPP-SOURCES += sbecmdgeneric.C
SBEFW-CPP-SOURCES += sbeFifoMsgUtils.C
-SBEFW-CPP-SOURCES += attr.C
SBEFW-CPP-SOURCES += sbecmdmemaccess.C
SBEFW-CPP-SOURCES += sbeHostUtils.C
SBEFW-CPP-SOURCES += sbecmdcntrldmt.C
diff --git a/sbe/sbefw/sbemain.C b/sbe/sbefw/sbemain.C
index 2f8f43f7..0502c2bf 100644
--- a/sbe/sbefw/sbemain.C
+++ b/sbe/sbefw/sbemain.C
@@ -19,10 +19,6 @@
#include "sbestates.H"
#include "fapi2.H" // For target init
-// TODO via RTC 142365
-// Remove this workaround once we have support to copy fixed section
-// from SEEPROM to PIBMEM.
-extern void initAttrWA();
////////////////////////////////////////////////////////////////
// @brief Global semaphores
////////////////////////////////////////////////////////////////
@@ -58,14 +54,31 @@ PkThread g_sbeAsyncCommandProcessor_thread;
extern "C"
{
// These variables are declared in linker script to keep track of
-// global constructor pointer functions.
+// global constructor pointer functions and sbss section.
extern void (*ctor_start_address)() __attribute__ ((section (".rodata")));
extern void (*ctor_end_address)() __attribute__ ((section (".rodata")));
+extern uint64_t _sbss_start __attribute__ ((section (".sbss")));
+extern uint64_t _sbss_end __attribute__ ((section (".sbss")));
// This function will be used to do any C++ handling required before doing
// any main job. Call to this function should get generated by
// compiler.
+// TODO via RTC 152070
+// We are also initialising sbss section to zero this function.
+// Though it does not do any harm as of now, it is better if we use loader
+// or linker script to zero init sbss section. This way we will be future
+// garded if pk boot uses some static/global data initialised to
+// false in future.
void __eabi()
{
+ // Initialise sbss section
+ uint64_t *startAddr = &_sbss_start;
+ while ( startAddr != &_sbss_end )
+ {
+ *startAddr = 0;
+ startAddr++;
+ }
+
+ // Call global constructors
void(**ctors)() = &ctor_start_address;
while( ctors != &ctor_end_address)
{
@@ -281,11 +294,6 @@ uint32_t main(int argc, char **argv)
break;
}
- // TODO via RTC 142365
- // Remove this workaround once we have support to copy fixed section
- // from SEEPROM to PIBMEM.
- initAttrWA();
-
// TODO via RTC 126146.
// Check if we should call plat_TargetsInit in some other thread.
// We may want to keep only PK init in main and can move
diff --git a/sbe/sbefw/vector b/sbe/sbefw/vector
index 59cbfdd3..1f14eb20 100644
--- a/sbe/sbefw/vector
+++ b/sbe/sbefw/vector
@@ -40,7 +40,7 @@ namespace std
protected:
- pointer iv_start;
+ pointer iv_start __attribute__ ((aligned (8)));
pointer iv_finish;
SBEVECTORPOOL::vectorMemPool_t *iv_poolPtr;
public:
OpenPOWER on IntegriCloud