diff options
author | Amit Kumar <akumar3@us.ibm.com> | 2016-06-20 01:24:53 -0500 |
---|---|---|
committer | Joshua Hunsberger <jahunsbe@us.ibm.com> | 2017-10-23 16:26:28 -0500 |
commit | 27e2ccbb1002b32c4440c22cf2541f56b6160618 (patch) | |
tree | 2d1898fbd6f5fa6518cc46d52de20a5e0a555f0b /import/chips/p9/procedures/ppe_closed/cme | |
parent | 4f36f6d623f7cb443da04c9b4e1875ce0dfa161b (diff) | |
download | talos-hcode-27e2ccbb1002b32c4440c22cf2541f56b6160618.tar.gz talos-hcode-27e2ccbb1002b32c4440c22cf2541f56b6160618.zip |
istep 15 changes
- changes in CME/SGPE hcode for istep15 changes.
- merged 23684 changes
- sgpe Makefile changes
- sgpe_img_edit changes to accept multiple images
- changes to get ekb build to do cme and sgpe img edit
- Replaced EPM_P9_TUNING with ISTEP15_HACK at few places
- More changes to get working on 9067
- Removed trailing whitespace in multiple files which were giving
build warnings
- Checked in image build wrapper files with new hw_image name
plus commented out lines which are being worked out in a
separate gerrit id
- Added FUSED mode attribute to all base attribute files
- Added a first draft of the istep15 perl script in pm tools dir
Change-Id: I4f559e041406e09ea1d9376c585c97b8445e8ff8
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/26027
Dev-Ready: Gregory S. Still <stillgs@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Gregory S. Still <stillgs@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Diffstat (limited to 'import/chips/p9/procedures/ppe_closed/cme')
12 files changed, 439 insertions, 217 deletions
diff --git a/import/chips/p9/procedures/ppe_closed/cme/link.cmd b/import/chips/p9/procedures/ppe_closed/cme/link.cmd index 04a4386d..da800065 100644 --- a/import/chips/p9/procedures/ppe_closed/cme/link.cmd +++ b/import/chips/p9/procedures/ppe_closed/cme/link.cmd @@ -54,7 +54,12 @@ SECTIONS .vectors _VECTOR_START : { *(.vectors) } > sram - _CME_IMG_HEADER = _VECTOR_START + CME_IMAGE_OFFSET; + _CME_IMG_HEADER = _VECTOR_START + CME_HEADER_OFFSET; + /////////////////////////////////////////////////////////////////////////// + // + // CME Image Header + // + /////////////////////////////////////////////////////////////////////////// .cme_image_header _CME_IMG_HEADER : { *(.cme_image_header) } > sram /////////////////////////////////////////////////////////////////////////// @@ -82,13 +87,13 @@ SECTIONS // SDA2 constant sections .sdata2 and .sbss2 must be adjacent to each // other. Our SDATA sections are small so we'll use strictly positive - // offsets. + // offsets. _SDA2_BASE_ = .; .sdata2 . : { *(.sdata2*) } > sram .sbss2 . : { *(.sbss2*) } > sram - // Other read-only data. + // Other read-only data. .rodata . : { *(.rodata*) *(.got2) } > sram @@ -103,7 +108,7 @@ SECTIONS // SDA sections .sdata and .sbss must be adjacent to each // other. Our SDATA sections are small so we'll use strictly positive - // offsets. + // offsets. _SDA_BASE_ = .; .sdata . : { *(.sdata*) } > sram @@ -120,4 +125,6 @@ SECTIONS . = . + INITIAL_STACK_SIZE; _PK_INITIAL_STACK = . - 1; + _CME_END = .; + _CME_SIZE = . - SRAM_START; } diff --git a/import/chips/p9/procedures/ppe_closed/cme/p9_cpmr_header.S b/import/chips/p9/procedures/ppe_closed/cme/p9_cpmr_header.S new file mode 100644 index 00000000..39039239 --- /dev/null +++ b/import/chips/p9/procedures/ppe_closed/cme/p9_cpmr_header.S @@ -0,0 +1,27 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: import/chips/p9/procedures/ppe_closed/cme/p9_cpmr_header.S $ */ +/* */ +/* OpenPOWER HCODE Project */ +/* */ +/* COPYRIGHT 2016,2017 */ +/* [+] 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 <p9_hcode_image_defines.H> +.cpmr_header diff --git a/import/chips/p9/procedures/ppe_closed/cme/p9_cpmr_img_edit.C b/import/chips/p9/procedures/ppe_closed/cme/p9_cpmr_img_edit.C new file mode 100644 index 00000000..7aa765ea --- /dev/null +++ b/import/chips/p9/procedures/ppe_closed/cme/p9_cpmr_img_edit.C @@ -0,0 +1,180 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: import/chips/p9/procedures/ppe_closed/cme/p9_cpmr_img_edit.C $ */ +/* */ +/* OpenPOWER HCODE Project */ +/* */ +/* COPYRIGHT 2015,2017 */ +/* [+] 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 <stdio.h> +#include <stdint.h> +#include <netinet/in.h> +#include <time.h> +#include <stddef.h> /* offsetof */ + + +//#include <p9_cpmr_header.H> +#include <p9_cme_img_layout.h> +//#include <p9_cme_header.H> +#include <pk_debug_ptrs.h> +#include <p9_hcode_image_defines.H> + +using namespace p9_hcodeImageBuild; + +enum +{ + HCODE_OFFSET_POS = 0x190, + HCODE_LEN_POS = 0x194, + CME_HCODE_OFFSET = 0x200, + CME_BUILD_DATE_POS = 0x188, + CME_BUILD_VER_POS = 0x18C, + CME_BUILD_VER = 0x001, + CPMR_ATTN_WORD0 = 0x00, + CPMR_ATTN_WORD1 = 0x03, + CPMR_BUILD_DATE_POS = 0x10, + CPMR_BUILD_VER_POS = 0x14, + CPMR_HCODE_OFFSET_POS = 0x20, + CPMR_HCODE_LEN_POS = 0x24, + CPMR_SELFREST_OFF_POS = 0x48, + CPMR_SELFREST_OFF_VAL = 0x100, + CPMR_SELFREST_LEN_POS = 0x4C, +}; + +int main(int narg, char* argv[]) +{ + if (narg < 4) + { + printf("Usage: %s <full path to image>\n", + argv[0]); + return -1; + } + + FILE* pImage = fopen( argv[1], "r+" ); + FILE* pCpmr = fopen( argv[2], "r+" ); + FILE* pSelfRest = fopen( argv[3], "r+"); + + //FILE* pImage = fopen( "./obj/cme/cme.bin", "r+" ); + //FILE* pCpmr = fopen( "./obj/cme/cpmr_header.bin", "r+" ); + //FILE* pSelfRest = fopen( "../../utils/stopreg/selfRest.bin", "r+"); + + + time_t buildTime = time(NULL); + struct tm* headerTime = localtime(&buildTime); + + cmeHeader_t cmeHeader; + cpmrHeader_t cpmrHeader; + + do + { + if( !pImage ) + { + break; + } + + if( !pCpmr ) + { + break; + } + + printf("Debug Pointers Offset : %d (0x%X)\n", PPE_DEBUG_PTRS_OFFSET, PPE_DEBUG_PTRS_OFFSET); + printf("Debug Pointers size : %d (0x%X)\n", sizeof(pk_debug_ptrs_t), sizeof(pk_debug_ptrs_t)); + + printf("CME Image Offset : %d (0x%X)\n", PPE_DEBUG_PTRS_OFFSET + sizeof(pk_debug_ptrs_t), + PPE_DEBUG_PTRS_OFFSET + sizeof(pk_debug_ptrs_t)); + + fseek (pCpmr, 0, SEEK_END); + uint32_t Cpmrsize = ftell (pCpmr); + rewind(pCpmr); + printf("CPMR size : %d (0x%X)\n", Cpmrsize, Cpmrsize); + + fseek (pImage, 0, SEEK_END); + uint32_t Imagesize = ftell (pImage); + rewind(pImage); + printf("Hcode Image size : %d (0x%X)\n", Imagesize, Imagesize); + + fseek (pSelfRest, 0, SEEK_END); + uint32_t selfRestSize = ftell (pSelfRest); + rewind(pSelfRest); + printf("Self Restore size : %d (0x%X)\n", selfRestSize, selfRestSize); + + // cme build date yyyymmdd + fseek ( pImage, CME_HEADER_OFFSET + offsetof(cmeHeader_t, g_cme_build_date) , SEEK_SET ); + fseek ( pCpmr, offsetof(cpmrHeader_t, cpmrbuildDate) , SEEK_SET ); + uint32_t temp = (((headerTime->tm_year + 1900) << 16) | + ((headerTime->tm_mon + 1) << 8) | + (headerTime->tm_mday)); + printf("Build date : %X -> %04d/%02d/%02d (YYYY/MM/DD)\n", + temp, headerTime->tm_year + 1900, headerTime->tm_mon + 1, headerTime->tm_mday); + + temp = htonl(temp); + fwrite(&temp, sizeof(cmeHeader.g_cme_build_date), 1, pImage ); + fwrite(&temp, sizeof(cpmrHeader.cpmrbuildDate), 1, pCpmr ); + + // cme build version + fseek ( pImage, CME_HEADER_OFFSET + offsetof(cmeHeader_t, g_cme_build_ver) , SEEK_SET ); + fseek ( pCpmr, offsetof(cpmrHeader_t, cpmrVersion) , SEEK_SET ); + temp = htonl(CME_BUILD_VER); + fwrite(&temp, sizeof(cmeHeader.g_cme_build_ver), 1, pImage ); + fwrite(&temp, sizeof(cpmrHeader.cpmrVersion), 1, pCpmr ); + + printf("CME_HEADER_OFFSET : %X\n", CME_HEADER_OFFSET); + + // cme hcode offset + fseek ( pImage, HCODE_OFFSET_POS , SEEK_SET ); + temp = CME_HCODE_OFFSET; + temp = htonl(temp); + fwrite(&(temp), sizeof(uint32_t), 1, pImage ); + + // cme hcode length + fseek ( pImage , HCODE_LEN_POS , SEEK_SET ); + temp = htonl( Imagesize ); + fwrite(&temp, sizeof(uint32_t), 1, pImage ); + fwrite(&temp, sizeof(uint32_t), 1, pCpmr ); + + // self restore offset+ length + fseek ( pCpmr , CPMR_SELFREST_OFF_POS , SEEK_SET ); + temp = htonl( CPMR_SELFREST_OFF_VAL ); + fwrite(&temp, sizeof(uint32_t), 1, pCpmr ); + + fseek ( pCpmr , CPMR_SELFREST_LEN_POS , SEEK_SET ); + temp = htonl( selfRestSize ); + fwrite(&temp, sizeof(uint32_t), 1, pCpmr ); + + printf("CME Hcode Offset Address: %X\n", CME_HEADER_OFFSET + offsetof(cmeHeader_t, g_cme_hcode_offset)); + fseek ( pImage, CME_HEADER_OFFSET + offsetof(cmeHeader_t, g_cme_hcode_offset) , SEEK_SET ); + temp = CME_HCODE_OFFSET; + temp = htonl(temp); + fwrite(&temp, sizeof(cmeHeader.g_cme_hcode_offset), 1, pImage ); + fwrite(&temp, sizeof(cpmrHeader.cmeImgOffset), 1, pCpmr ); + + // cme hcode length + printf("CME HCode Length Address: %X\n", CME_HEADER_OFFSET + offsetof(cmeHeader_t, g_cme_hcode_length)); + fseek ( pImage, CME_HEADER_OFFSET + offsetof(cmeHeader_t, g_cme_hcode_length) , SEEK_SET ); + fseek ( pCpmr, offsetof(cpmrHeader_t, cmeImgLength) , SEEK_SET ); + temp = htonl( Imagesize ); + fwrite(&temp, sizeof(cmeHeader.g_cme_hcode_length), 1, pImage ); + fwrite(&temp, sizeof(cpmrHeader.cmeImgLength), 1, pCpmr ); + + fclose(pImage); + fclose(pCpmr); + } + while(0); + + return 0; +} diff --git a/import/chips/p9/procedures/ppe_closed/cme/pk_app_cfg.h b/import/chips/p9/procedures/ppe_closed/cme/pk_app_cfg.h index cacf1a34..382c312b 100644 --- a/import/chips/p9/procedures/ppe_closed/cme/pk_app_cfg.h +++ b/import/chips/p9/procedures/ppe_closed/cme/pk_app_cfg.h @@ -40,19 +40,34 @@ #define SKIP_ABORT 0 #define SKIP_L2_PURGE_ABORT 0 #define SKIP_ENTRY_CATCHUP 0 -#define SKIP_EXIT_CATCHUP 0 -#define SKIP_ARRAYINIT 1 -#define SKIP_SCAN0 1 -#define SKIP_INITF 0 -#define SKIP_SELF_RESTORE 0 -#define SKIP_RAM_HRMOR 0 -#define SKIP_BCE_SCAN_RING 1 -#define SKIP_BCE_SCOM_RESTORE 1 -#define SPWU_AUTO 1 +#define ISTEP15_HACK 1 + +#if !ISTEP15_HACK + #define SKIP_EXIT_CATCHUP 0 + #define EPM_P9_TUNING 1 + #define SKIP_SCAN0 1 + #define SKIP_INITF 0 + #define SKIP_SELF_RESTORE 0 + #define SKIP_RAM_HRMOR 0 + #define SKIP_BCE_SCAN_RING 1 + #define SKIP_BCE_SCOM_RESTORE 1 + #define SPWU_AUTO 1 + #define SKIP_ARRAYINIT 1 +#else + #define SKIP_EXIT_CATCHUP 1 + #define EPM_P9_TUNING 0 + #define SKIP_SCAN0 0 + #define SKIP_INITF 0 + #define SKIP_SELF_RESTORE 0 + #define SKIP_RAM_HRMOR 0 + #define SKIP_BCE_SCAN_RING 0 + #define SKIP_BCE_SCOM_RESTORE 1 + #define SPWU_AUTO 0 + #define SKIP_ARRAYINIT 0 +#endif // -------------------- -#define EPM_P9_TUNING 1 #define SIMICS_TUNING 0 #define USE_SIMICS_IO 0 #define DEV_DEBUG 1 diff --git a/import/chips/p9/procedures/ppe_closed/cme/stop_cme/link_cpmr.cmd b/import/chips/p9/procedures/ppe_closed/cme/stop_cme/link_cpmr.cmd new file mode 100644 index 00000000..37649f4c --- /dev/null +++ b/import/chips/p9/procedures/ppe_closed/cme/stop_cme/link_cpmr.cmd @@ -0,0 +1,37 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: import/chips/p9/procedures/ppe_closed/cme/stop_cme/link_cpmr.cmd $ */ +/* */ +/* OpenPOWER HCODE Project */ +/* */ +/* COPYRIGHT 2015,2017 */ +/* [+] 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 */ + +OUTPUT_FORMAT(binary) +MEMORY +{ + cpmrHeader(rw) : ORIGIN = 0, LENGTH = 512 +} + + SECTIONS +{ + . = 0; + .cpmr : + { *(.cpmr) } > cpmrHeader +} diff --git a/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_copy_scan_ring.c b/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_copy_scan_ring.c index 0a6ea2b5..70faf5cd 100644 --- a/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_copy_scan_ring.c +++ b/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_copy_scan_ring.c @@ -37,7 +37,7 @@ enum CME_INST_ID_MASK = 0x0000001F, COPY_DEF_CME_ADDR = 0x00000000, CME_PAGE_RD_SIZE = 0x20, - CME_IMG_HDR_ADDR = CME_IMAGE_OFFSET, + CME_IMG_HDR_ADDR = CME_IMAGE_BASE_ADDR + CME_HEADER_OFFSET, }; void instance_scan_init( ) @@ -66,6 +66,7 @@ void instance_scan_init( ) startCmeBlockCopy( cmeSbase, l_bcLength, l_cmePir, PLAT_CME, BAR_INDEX_1, l_bceMbase ); + PK_TRACE(" Done startCmeBlockCopy(instance_scan_init)."); } diff --git a/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_cpmr.S b/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_cpmr.S index c215be29..268452fb 100644 --- a/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_cpmr.S +++ b/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_cpmr.S @@ -23,92 +23,5 @@ # # IBM_PROLOG_END_TAG -.section ".cpmr" , "aw", @progbits - -.global g_cpmr_attn_quad -.global g_cpmr_magic_word -.global g_build_date -.global g_build_ver -.global g_reserve_flags -.global g_cme_hcode_offset -.global g_cme_hcode_length -.global g_cme_common_ring_offset -.global g_cme_common_ring_length -.global g_cme_pstate_region_offset -.global g_cme_pstate_region_length -.global g_cme_core_spec_ring_offset -.global g_cme_core_spec_ring_length -.global g_cme_core_scom_offset -.global g_cme_core_scom_length - -#----------------------------------------------------- -# CPMR HEADER -#----------------------------------------------------- -# Word 0 | Word 1 -#----------------------------------------------------- -# ATTN Opcode | ATTN Opcode -#----------------------------------------------------- -# Magic Number -#----------------------------------------------------- -# Build Date | Version -#----------------------------------------------------- -# Reserved Flags -#----------------------------------------------------- -# CME Hcode Offset | CME Length -#----------------------------------------------------- -# CME Cmn Ring Offset | CME common ring length -#----------------------------------------------------- -# CME Pstate offset | CME Pstate length -#----------------------------------------------------- -# Core spec ring offset | Core spec ring length -#----------------------------------------------------- -# Core SCOM restore | Core SCOM restore length -# offset -#----------------------------------------------------- -# ATTN Opcodes -#----------------------------------------------------- -_start: - -g_cpmr_attn_quad: -.quad 0x0000020000000200 #ATTN OPCODE ATTN OPCODE - -g_cpmr_magic_word: -.quad 0x484F4D4552312E30 #"HOMER1.0" - - g_build_date: -.long 0 - - g_build_ver: -.long 0 - - g_reserve_flags: -.quad 0 - - g_cme_hcode_offset: -.long 0 - - g_cme_hcode_length: -.long 0 - - g_cme_common_ring_offset: -.long 0 - - g_cme_common_ring_length: -.long 0 - - g_cme_pstate_region_offset: -.long 0 - g_cme_pstate_region_length: -.long 0 - -g_cme_core_spec_ring_offset: -.long 0 - -g_cme_core_spec_ring_length: -.long 0 - -g_cme_core_scom_offset: -.long 0 - -g_cme_core_scom_length: -.long 0 +#include <p9_hcode_image_defines.H> +.cpmr_header diff --git a/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_edit.mk b/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_edit.mk index 73934190..77698949 100644 --- a/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_edit.mk +++ b/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_edit.mk @@ -23,11 +23,60 @@ # # IBM_PROLOG_END_TAG EXE=cmeImgEdit + +CME_LIB=$(ROOTPATH)/chips/p9/procedures/ppe_closed/cme/ +HCODE_UTIL=$(ROOTPATH)/chips/p9/procedures/utils/stopreg/ +HCODE_UTIL+=$(ROOTPATH)/chips/p9/xip/ +HCODE_UTIL+=$(ROOTPATH)/chips/p9/procedures/hwp/lib/ +HCODE_UTIL+=$(ROOTPATH)/chips/p9/procedures/ppe_closed/lib/ +HCODE_UTIL+=$(ROOTPATH)/chips/p9/procedures/utils/stopreg/ +HCODE_UTIL+=$(ROOTPATH)/chips/p9/utils/imageProcs/ +HCODE_UTIL+=$(ROOTPATH)/tools/imageProcs/ +HCODE_UTIL+=$(ROOTPATH)/chips/p9/procedures/ppe/pk/kernel +$(EXE)_DEPLIBS+=p9_xip_image +$(EXE)_DEPLIBS+=p9_ringId + +$(IMAGE)_COMMONFLAGS+= -DPK_TIMER_SUPPORT=1 +$(IMAGE)_COMMONFLAGS+= -DPK_THREAD_SUPPORT=1 +$(IMAGE)_COMMONFLAGS+= -DPK_TRACE_SUPPORT=1 +$(IMAGE)_COMMONFLAGS+= -DUSE_PK_APP_CFG_H=1 +$(IMAGE)_COMMONFLAGS+= -D__PK__=1 +$(EXE)_COMMONFLAGS+= -D__PPE_PLAT + +$(call ADD_EXE_INCDIR,$(EXE), $(HCODE_UTIL)) +$(call ADD_EXE_INCDIR,$(EXE), $(CME_LIB)) + + IMAGE_DEPS+=cmeImgEdit OBJS=p9_cme_img_edit.o $(call BUILD_EXE) EXE=cpmr_headerImgEdit + +CME_LIB=$(ROOTPATH)/chips/p9/procedures/ppe_closed/cme/ +HCODE_UTIL=$(ROOTPATH)/chips/p9/procedures/utils/stopreg/ +HCODE_UTIL+=$(ROOTPATH)/chips/p9/xip/ +HCODE_UTIL+=$(ROOTPATH)/chips/p9/procedures/hwp/lib/ +HCODE_UTIL+=$(ROOTPATH)/chips/p9/procedures/ppe_closed/lib/ +HCODE_UTIL+=$(ROOTPATH)/chips/p9/procedures/utils/stopreg/ +HCODE_UTIL+=$(ROOTPATH)/chips/p9/utils/imageProcs/ +HCODE_UTIL+=$(ROOTPATH)/tools/imageProcs/ +HCODE_UTIL+=$(ROOTPATH)/chips/p9/procedures/ppe/pk/kernel +$(EXE)_DEPLIBS+=p9_xip_image +$(EXE)_DEPLIBS+=p9_ringId + +$(IMAGE)_COMMONFLAGS+= -DPK_TIMER_SUPPORT=1 +$(IMAGE)_COMMONFLAGS+= -DPK_THREAD_SUPPORT=1 +$(IMAGE)_COMMONFLAGS+= -DPK_TRACE_SUPPORT=1 +$(IMAGE)_COMMONFLAGS+= -DUSE_PK_APP_CFG_H=1 +$(IMAGE)_COMMONFLAGS+= -D__PK__=1 +$(EXE)_COMMONFLAGS+= -D__PPE_PLAT + +$(call ADD_EXE_INCDIR,$(EXE), $(HCODE_UTIL)) +$(call ADD_EXE_INCDIR,$(EXE), $(CME_LIB)) + + + IMAGE_DEPS+=cpmr_headerImgEdit OBJS=p9_cme_img_edit.o $(call BUILD_EXE) diff --git a/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_header.S b/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_header.S index c7e82da8..59521e88 100755 --- a/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_header.S +++ b/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_header.S @@ -23,85 +23,6 @@ # # IBM_PROLOG_END_TAG +#include <p9_hcode_image_defines.H> -#Definition of a CME Image header to be used by CME Hcode when loaded in -#SRAM. Linker script maps this 56 bit image header to an SRAM address range -#after interrupt vector area. Some fields will be populated during Hcode -#image build activity. Build date, version, Hcode offset and position are -#populated during CME Image build process. - -.set BUILD_VER, 0x01 # version * 10 -.section ".cme_image_header" , "aw" - -.global g_cme_magic_word -.global g_cme_build -.global g_cme_build_ver -.global g_cme_hcode_offset -.global g_cme_hcode_length -.global g_cme_cmn_ring_ofset -.global g_cme_cmn_ring_len -.global g_cme_pstate_offset -.global g_cme_pstate_length -.global g_cme_Inst_ring_offset -.global g_cme_Inst_ring_length -.global g_cme_attr_mode -#----------------------------------------------------- -# CME HEADER -#----------------------------------------------------- -# Word 0 | Word 1 -#----------------------------------------------------- -# Magic Number -#----------------------------------------------------- -# Build Date | Version -#----------------------------------------------------- -# CME Hcode Offset | CME Hcode Length -#----------------------------------------------------- -# CME Common Rings | CME Common Rings Sections -# Sections Offset | Length -#----------------------------------------------------- -# CME Quad PState | CME Quad PState Region -# Region Offset | Length -#----------------------------------------------------- -# Core Instance Spec. | Max instance Spec Scan -# Scan Ring Offset | Ring Length -#----------------------------------------------------- -# ATTR_CME_MODE | Reserved -#----------------------------------------------------- -# Reserved -#----------------------------------------------------- - -g_cme_magic_word: -.quad 0x58495020434D454D #XIP CMEM - -g_cme_build: -.long 0 - -g_cme_build_ver: -.long BUILD_VER - -g_cme_hcode_offset: -.long 0 - -g_cme_hcode_length: -.long 0 - -g_cme_cmn_ring_offset: -.long 0 - -g_cme_cmn_ring_len: -.long 0 - -g_cme_pstate_offset: -.long 0 - -g_cme_pstate_length: -.long 0 - -g_cme_Inst_ring_offset: -.long 0 - -g_cme_Inst_ring_length: -.long 0 - -g_cme_attr_mode: -.long 0 +.cme_header diff --git a/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_img_edit.c b/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_img_edit.c index 088e937b..fd9e9b2a 100644 --- a/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_img_edit.c +++ b/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_img_edit.c @@ -26,6 +26,13 @@ #include <stdint.h> #include <netinet/in.h> #include <time.h> +#include <stddef.h> /* offsetof */ + +#include <p9_cme_img_layout.h> +#include <pk_debug_ptrs.h> +#include <p9_hcode_image_defines.H> + +//namespace p9_hcodeImageBuild; enum { @@ -39,23 +46,32 @@ enum CPMR_ATTN_WORD1 = 0x03, CPMR_BUILD_DATE_POS = 0x10, CPMR_BUILD_VER_POS = 0x14, + CPMR_HCODE_OFFSET_POS = 0x20, + CPMR_HCODE_LEN_POS = 0x24, + CPMR_SELFREST_OFF_POS = 0x48, + CPMR_SELFREST_OFF_VAL = 0x100, + CPMR_SELFREST_LEN_POS = 0x4C, CME_IMAGE = 1, CPMR_IMAGE = 2, }; int main(int narg, char* argv[]) { - - if(narg < 2) + if (narg < 2) { printf("Usage: %s <full path to image>\n", argv[0]); return -1; } + cmeHeader_t cmeHeader; + //cpmrHeader_t cpmrHeader; + int imageType = CME_IMAGE; - long int buildDatePos = CME_BUILD_DATE_POS; - long int buildVerPos = CME_BUILD_VER_POS; + long int buildDatePos = CME_HEADER_OFFSET + offsetof(cmeHeader_t, g_cme_build_date); + long int buildVerPos = CME_HEADER_OFFSET + offsetof(cmeHeader_t, g_cme_build_ver); + long int hcodeLenPos = CME_HEADER_OFFSET + offsetof(cmeHeader_t, g_cme_hcode_length); + long int hcodeOffsetPos = CME_HEADER_OFFSET + offsetof(cmeHeader_t, g_cme_hcode_offset); FILE* pImage = fopen( argv[1], "r+" ); @@ -75,47 +91,79 @@ int main(int narg, char* argv[]) break; } + printf("Debug Pointers Offset : %d (0x%X)\n", PPE_DEBUG_PTRS_OFFSET, PPE_DEBUG_PTRS_OFFSET); + printf("Debug Pointers size : %ld (0x%lX)\n", sizeof(pk_debug_ptrs_t), sizeof(pk_debug_ptrs_t)); + printf("CME Image Offset : %ld (0x%lX)\n", PPE_DEBUG_PTRS_OFFSET + sizeof(pk_debug_ptrs_t), + PPE_DEBUG_PTRS_OFFSET + sizeof(pk_debug_ptrs_t)); + + fseek (pImage, 0, SEEK_END); uint32_t size = ftell (pImage); - rewind(pImage); + rewind (pImage); + printf("Hcode Image size : %d (0x%X)\n", size, size); // For ekb build it's desired to detect the image type w/o special // make rules. Better way? if(size < CME_HCODE_OFFSET) { imageType = CPMR_IMAGE; - buildDatePos = CPMR_BUILD_DATE_POS; - buildVerPos = CPMR_BUILD_VER_POS; + buildDatePos = offsetof(cpmrHeader_t, cpmrbuildDate); + buildVerPos = offsetof(cpmrHeader_t, cpmrVersion); + hcodeLenPos = offsetof(cpmrHeader_t, cmeImgLength); + hcodeOffsetPos = offsetof(cpmrHeader_t, cmeImgOffset); + printf("CPMR size : %d (0x%X)\n", size, size); + FILE* pHcodeImage = fopen( argv[2], "r+" ); + fseek (pHcodeImage, 0, SEEK_END); + size = ftell (pHcodeImage); + rewind (pHcodeImage); + printf("CME Hcode size : %d (0x%X)\n", size, size); } // cme build date yyyymmdd fseek ( pImage, buildDatePos , SEEK_SET ); - uint32_t temp = ( (headerTime->tm_year + 1900) << 16) | - ((headerTime->tm_mon + 1) << 8) | - (headerTime->tm_mday + 1); + uint32_t temp = (((headerTime->tm_year + 1900) << 16) | + ((headerTime->tm_mon + 1) << 8) | + (headerTime->tm_mday)); + printf("Build date : %X -> %04d/%02d/%02d (YYYY/MM/DD)\n", + temp, headerTime->tm_year + 1900, headerTime->tm_mon + 1, headerTime->tm_mday); temp = htonl(temp); - fwrite(&temp, sizeof(uint32_t), 1, pImage ); - // build version + // cme build version fseek ( pImage , buildVerPos, SEEK_SET ); temp = htonl(CME_BUILD_VER); fwrite(&temp, sizeof(uint32_t), 1, pImage ); + printf("CME_HEADER_OFFSET : %X\n", CME_HEADER_OFFSET); + + printf("CME Hcode Offset Address: %ld (0x%lX)\n", hcodeOffsetPos , hcodeOffsetPos); + fseek ( pImage, hcodeOffsetPos , SEEK_SET ); + temp = CME_HCODE_OFFSET; + temp = htonl(temp); + fwrite(&temp, sizeof(cmeHeader.g_cme_hcode_offset), 1, pImage ); + // cme hcode length + printf("CME HCode Length Address: %ld (0x%lX)\n", hcodeLenPos, hcodeLenPos); + fseek ( pImage, hcodeLenPos, SEEK_SET ); + temp = htonl( size ); + fwrite(&temp, sizeof(cmeHeader.g_cme_hcode_length), 1, pImage ); - if(imageType == CME_IMAGE) + // self restore offset + length + if (imageType == CPMR_IMAGE ) { - // cme hcode offset - fseek ( pImage, HCODE_OFFSET_POS , SEEK_SET ); - temp = CME_HCODE_OFFSET; - temp = htonl(temp); - fwrite(&(temp), sizeof(uint32_t), 1, pImage ); - - // cme hcode length - fseek ( pImage , HCODE_LEN_POS , SEEK_SET ); - temp = htonl( size ); + FILE* pSelfRest = fopen( argv[3], "r+"); + fseek (pSelfRest, 0, SEEK_END); + uint32_t selfRestSize = ftell (pSelfRest); + rewind(pSelfRest); + printf("Self Restore size %s : %d (0x%X)\n", argv[3], selfRestSize, selfRestSize); + + fseek ( pImage , CPMR_SELFREST_OFF_POS , SEEK_SET ); + temp = htonl( CPMR_SELFREST_OFF_VAL ); + fwrite(&temp, sizeof(uint32_t), 1, pImage ); + + fseek ( pImage , CPMR_SELFREST_LEN_POS , SEEK_SET ); + temp = htonl( selfRestSize ); fwrite(&temp, sizeof(uint32_t), 1, pImage ); } diff --git a/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_stop_exit.c b/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_stop_exit.c index 74880d92..94f5c0f5 100644 --- a/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_stop_exit.c +++ b/import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_stop_exit.c @@ -101,6 +101,9 @@ p9_cme_stop_exit() #endif + PK_TRACE("X0: Actual Stop Levels[%d %d]", + G_cme_stop_record.act_level_c0, G_cme_stop_record.act_level_c1); + // Code Error: function should never be entered without wakeup source active if (!core) { @@ -402,6 +405,11 @@ p9_cme_stop_exit() //===================== #if !SKIP_INITF PK_TRACE("X8: Core Func Scan"); +#if !ISTEP15_HACK + asm volatile ("nop"); +#else + asm volatile ("tw 31, 0, 0"); +#endif p9_hcd_core_initf(core); #endif #endif @@ -536,7 +544,8 @@ p9_cme_stop_exit() #if EPM_P9_TUNING CME_PUTSCOM(SCRACTH0, CME_MASK_C0, 0x200000); #else - CME_PUTSCOM(SCRACTH0, CME_MASK_C0, in64(SELF_RESTORE_ADDR_FETCH)); + CME_PUTSCOM(SCRACTH0, CME_MASK_C0, 0xA200000); + //CME_PUTSCOM(SCRACTH0, CME_MASK_C0, in64(SELF_RESTORE_ADDR_FETCH)); #endif } @@ -549,7 +558,8 @@ p9_cme_stop_exit() #if EPM_P9_TUNING CME_PUTSCOM(SCRACTH1, CME_MASK_C1, 0x200000); #else - CME_PUTSCOM(SCRACTH1, CME_MASK_C1, in64(SELF_RESTORE_ADDR_FETCH)); + CME_PUTSCOM(SCRACTH1, CME_MASK_C1, 0xA200000); + //CME_PUTSCOM(SCRACTH1, CME_MASK_C1, in64(SELF_RESTORE_ADDR_FETCH)); #endif } @@ -566,6 +576,13 @@ p9_cme_stop_exit() CME_PUTSCOM(RAM_MODEREG, core, 0); #endif + +#if !ISTEP15_HACK + asm volatile ("nop"); +#else + asm volatile ("tw 31, 0, 0"); +#endif + PK_TRACE("S-Reset all threads"); CME_PUTSCOM(DIRECT_CONTROLS, core, BIT64(4) | BIT64(12) | BIT64(20) | BIT64(28)); @@ -574,7 +591,7 @@ p9_cme_stop_exit() MARK_TRAP(SX_SRESET_THREADS) //========================== - PK_TRACE("Allow threads to run(pm_exit=0)"); + PK_TRACE("Allow threads to run(pm_exit=0) core: %d data:0x%08x ", core, (core << SHIFT32(5))); out32(CME_LCL_SICR_CLR, core << SHIFT32(5)); PK_TRACE("Poll for Core stop again(pm_active=1)"); @@ -726,11 +743,13 @@ p9_cme_stop_exit() if (spwu_stop) { + PK_TRACE("XF: setting spwu done"); out32(CME_LCL_SICR_OR, spwu_stop << SHIFT32(17)); } if ((core = (core & (~spwu_stop)))) { + PK_TRACE("XF: spwu is not done"); out32(CME_LCL_SICR_CLR, core << SHIFT32(5)); } diff --git a/import/chips/p9/procedures/ppe_closed/cme/topfiles.mk b/import/chips/p9/procedures/ppe_closed/cme/topfiles.mk index 94e2096b..8afc61df 100644 --- a/import/chips/p9/procedures/ppe_closed/cme/topfiles.mk +++ b/import/chips/p9/procedures/ppe_closed/cme/topfiles.mk @@ -1,3 +1,4 @@ + # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # @@ -25,8 +26,8 @@ TOP-C-SOURCES = p9_cme_main.c \ - p9_cme_irq.c -PSTATE-C-SOURCES = pstate_cme/p9_cme_pstate.c + p9_cme_irq.c +PSTATE-C-SOURCES = pstate_cme/p9_cme_pstate.c STOP-C-SOURCES = stop_cme/p9_cme_stop_irq_handlers.c \ stop_cme/p9_cme_stop_enter_thread.c \ stop_cme/p9_cme_stop_exit_thread.c \ @@ -45,9 +46,13 @@ STOP-C-SOURCES = stop_cme/p9_cme_stop_irq_handlers.c \ stop_cme/p9_hcd_core_scomcust.c \ stop_cme/p9_hcd_core_ras_runtime_scom.c \ stop_cme/p9_hcd_core_occ_runtime_scom.c \ - stop_cme/p9_cme_copy_scan_ring.c -TOP-S-SOURCES = stop_cme/p9_cme_header.S + stop_cme/p9_cme_copy_scan_ring.c + +TOP-S-SOURCES = stop_cme/p9_cme_header.S + +IMG-S-SOURCES = p9_cpmr_header.S -TOP_OBJECTS = $(TOP-C-SOURCES:.c=.o) $(TOP-S-SOURCES:.S=.o) -PSTATE_OBJECTS = $(PSTATE-C-SOURCES:.c=.o) -STOP_OBJECTS = $(STOP-C-SOURCES:.c=.o) +TOP_OBJECTS = $(TOP-C-SOURCES:.c=.o) $(TOP-S-SOURCES:.S=.o) +PSTATE_OBJECTS = $(PSTATE-C-SOURCES:.c=.o) +STOP_OBJECTS = $(STOP-C-SOURCES:.c=.o) +IMG_OBJECTS = $(IMG-C-SOURCES:.c=.o) $(IMG-S-SOURCES:.S=.o) |