summaryrefslogtreecommitdiffstats
path: root/import/chips/p9
diff options
context:
space:
mode:
authorAmit Kumar <akumar3@us.ibm.com>2016-06-20 01:24:53 -0500
committerJoshua Hunsberger <jahunsbe@us.ibm.com>2017-10-23 16:26:28 -0500
commit27e2ccbb1002b32c4440c22cf2541f56b6160618 (patch)
tree2d1898fbd6f5fa6518cc46d52de20a5e0a555f0b /import/chips/p9
parent4f36f6d623f7cb443da04c9b4e1875ce0dfa161b (diff)
downloadtalos-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')
-rw-r--r--import/chips/p9/procedures/hwp/lib/p9_hcd_common.H6
-rw-r--r--import/chips/p9/procedures/ppe_closed/cme/link.cmd15
-rw-r--r--import/chips/p9/procedures/ppe_closed/cme/p9_cpmr_header.S27
-rw-r--r--import/chips/p9/procedures/ppe_closed/cme/p9_cpmr_img_edit.C180
-rw-r--r--import/chips/p9/procedures/ppe_closed/cme/pk_app_cfg.h35
-rw-r--r--import/chips/p9/procedures/ppe_closed/cme/stop_cme/link_cpmr.cmd37
-rw-r--r--import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_copy_scan_ring.c3
-rw-r--r--import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_cpmr.S91
-rw-r--r--import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_edit.mk49
-rwxr-xr-ximport/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_header.S83
-rw-r--r--import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_img_edit.c92
-rw-r--r--import/chips/p9/procedures/ppe_closed/cme/stop_cme/p9_cme_stop_exit.c25
-rw-r--r--import/chips/p9/procedures/ppe_closed/cme/topfiles.mk19
-rw-r--r--import/chips/p9/procedures/ppe_closed/lib/p9_hcd_block_copy.c12
-rw-r--r--import/chips/p9/procedures/ppe_closed/lib/p9_hcd_block_copy.h6
-rw-r--r--import/chips/p9/procedures/ppe_closed/pgpe/boot/modelsetup.simics6
-rw-r--r--import/chips/p9/procedures/ppe_closed/sgpe/Makefile59
-rw-r--r--import/chips/p9/procedures/ppe_closed/sgpe/boot/Makefile26
-rw-r--r--import/chips/p9/procedures/ppe_closed/sgpe/boot/sgpe_boot_copier.S47
-rw-r--r--import/chips/p9/procedures/ppe_closed/sgpe/boot/sgpe_boot_loader.S7
-rw-r--r--import/chips/p9/procedures/ppe_closed/sgpe/p9_sgpe_img_edit.c149
-rw-r--r--import/chips/p9/procedures/ppe_closed/sgpe/p9_sgpe_qpmr.S27
-rw-r--r--import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/p9_hcd_sgpe_boot_cme.c118
-rw-r--r--import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/p9_sgpe_edit.mk1
-rw-r--r--import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/p9_sgpe_img_edit.c65
-rw-r--r--import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/p9_sgpe_stop_exit.c27
-rw-r--r--import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/pk_app_cfg.h17
-rw-r--r--import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/stop_gpe.mk53
-rw-r--r--import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/topfiles.mk4
-rw-r--r--import/chips/p9/procedures/ppe_closed/sgpe/topfiles.mk29
30 files changed, 972 insertions, 343 deletions
diff --git a/import/chips/p9/procedures/hwp/lib/p9_hcd_common.H b/import/chips/p9/procedures/hwp/lib/p9_hcd_common.H
index 60a7951c..a30e71d6 100644
--- a/import/chips/p9/procedures/hwp/lib/p9_hcd_common.H
+++ b/import/chips/p9/procedures/hwp/lib/p9_hcd_common.H
@@ -232,7 +232,11 @@ enum XCR_DEFS
HARD_RESET = 6,
FORCE_HALT = 7
};
-
+enum SLAVE_CONFIG_DEFS
+{
+ CFG_PM_DISABLE = 6,
+ CFG_PM_MUX_DISABLE = 7
+};
} // END OF NAMESPACE p9hcd
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)
diff --git a/import/chips/p9/procedures/ppe_closed/lib/p9_hcd_block_copy.c b/import/chips/p9/procedures/ppe_closed/lib/p9_hcd_block_copy.c
index 6e41d3e8..c0488d63 100644
--- a/import/chips/p9/procedures/ppe_closed/lib/p9_hcd_block_copy.c
+++ b/import/chips/p9/procedures/ppe_closed/lib/p9_hcd_block_copy.c
@@ -57,9 +57,9 @@ void initCmeBceBarAddr( uint8_t i_barIndex, uint64_t i_barRegData, uint8_t i_cme
uint8_t l_quadId = i_cmePos >> 1;
- l_bceBarAddr = SGPE_SCOM_ADDR( l_bceBarAddr, l_quadId, i_cmePos );
+ l_bceBarAddr = SGPE_SCOM_ADDR( l_bceBarAddr, l_quadId, (i_cmePos % 2) );
- l_bceBarData = (( i_barRegData & 0x0000000FFFFFFFFF ) << BASE_SHIFT_POS);
+ l_bceBarData = ( i_barRegData & 0x00FFFFFFFFF00000); //To extract bitss 8:43 from the i_barRegData
l_bceBarData |= (ENABLE_WR_SCOPE | ENABLE_RD_SCOPE | BLOCK_COPY_SIZE_1MB );
PPE_PUTSCOM(l_bceBarAddr, l_bceBarData); // set the source address for block copy
@@ -93,7 +93,9 @@ void startCmeBlockCopy( uint64_t i_cmeStartBlk, uint32_t i_blockLength, uint32_t
//getting quad id by dividing cme pos with 2
uint8_t l_quadId = i_cmePos >> 1;
- uint32_t l_sgpeBceAddr = SGPE_SCOM_ADDR( SCOM_ADDR_BCEBCSR, l_quadId, i_cmePos );
+ uint32_t l_sgpeBceAddr = SGPE_SCOM_ADDR( SCOM_ADDR_BCEBCSR, l_quadId,
+ (i_cmePos % 2) );
+
PPE_PUTSCOM(l_sgpeBceAddr, l_bceStatusData );
}
}
@@ -116,15 +118,13 @@ BceReturnCode_t checkCmeBlockCopyStatus( uint32_t i_cmePos, InitiatorPlat_t i_pl
// for entities external to CME.
uint32_t l_cmeBcelAddr = CME_LCL_BCECSR;
l_bceStatusData = in64(l_cmeBcelAddr);
- // CME reading block copy engine status
- out64(l_cmeBcelAddr, l_bceStatusData );
}
else if( PLAT_SGPE == i_plat )
{
// getting quad id by dividing cme pos with 2
uint8_t l_quadId = i_cmePos >> 1;
- uint32_t l_sgpeBceAddr = SGPE_SCOM_ADDR( SCOM_ADDR_BCEBCSR, l_quadId, i_cmePos );
+ uint32_t l_sgpeBceAddr = SGPE_SCOM_ADDR( SCOM_ADDR_BCEBCSR, l_quadId, (i_cmePos % 2) );
// SGPE reading block copy engine status of CME
PPE_GETSCOM(l_sgpeBceAddr, l_bceStatusData);
}
diff --git a/import/chips/p9/procedures/ppe_closed/lib/p9_hcd_block_copy.h b/import/chips/p9/procedures/ppe_closed/lib/p9_hcd_block_copy.h
index 51fb2239..c61caa8c 100644
--- a/import/chips/p9/procedures/ppe_closed/lib/p9_hcd_block_copy.h
+++ b/import/chips/p9/procedures/ppe_closed/lib/p9_hcd_block_copy.h
@@ -66,8 +66,8 @@ typedef enum
// SCOM addresses associated with a CME BCE.
typedef enum
{
- SCOM_ADDR_BCEBAR0 = 0x10012010,
- SCOM_ADDR_BCEBAR1 = 0x10012011,
+ SCOM_ADDR_BCEBAR0 = 0x10012030,
+ SCOM_ADDR_BCEBAR1 = 0x10012031,
SCOM_ADDR_BCEBCSR = 0x1001200F,
SCOM_ADDR_PBABAR0 = 0x05012B00,
} ScomAddrList_t;
@@ -81,7 +81,7 @@ enum
CME_BASE_ADDRESS = 0x10012000,
};
-#define SGPE_SCOM_ADDR(addr, quad, ex) (addr | CME_BASE_ADDRESS | (quad << 24) | (ex << 10) )
+#define SGPE_SCOM_ADDR(addr, quad, ex) ( addr | CME_BASE_ADDRESS | (quad << 24) | (ex << 10) )
#define PPE_GETSCOM(addr, data) \
rc = getscom(0, addr, &data); \
diff --git a/import/chips/p9/procedures/ppe_closed/pgpe/boot/modelsetup.simics b/import/chips/p9/procedures/ppe_closed/pgpe/boot/modelsetup.simics
index 244619c2..38d6f3ac 100644
--- a/import/chips/p9/procedures/ppe_closed/pgpe/boot/modelsetup.simics
+++ b/import/chips/p9/procedures/ppe_closed/pgpe/boot/modelsetup.simics
@@ -114,9 +114,9 @@ p9chip0.cell.cpu-switch-time cycles = 1000
## p9chip0.gpe0.write-reg iar 0x10100240
-p9chip0.pob_space.load-file ../../../obj/bootLoader/bootCopier.bin 0x200
-p9chip0.pob_space.load-file ../../../obj/bootLoader/bootLoader.bin 0x600
-p9chip0.pob_space.load-file ../../../ppe_closed/sgpe/stop_gpe/obj/stop_gpe/stop_gpe.bin 0x1400
+p9chip0.pob_space.load-file ../obj/bootLoader/bootCopier.bin 0x200
+p9chip0.pob_space.load-file ../obj/bootLoader/bootLoader.bin 0x600
+p9chip0.pob_space.load-file ../obj/stop_gpe/stop_gpe.bin 0x1400
p9chip0.pba->pba_bar0 = 0x0
diff --git a/import/chips/p9/procedures/ppe_closed/sgpe/Makefile b/import/chips/p9/procedures/ppe_closed/sgpe/Makefile
new file mode 100644
index 00000000..d1fd40e7
--- /dev/null
+++ b/import/chips/p9/procedures/ppe_closed/sgpe/Makefile
@@ -0,0 +1,59 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: import/chips/p9/procedures/ppe_closed/sgpe/Makefile $
+#
+# 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
+
+#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
+
+OBJS := $(addprefix $(OBJDIR)/, $(TOP_OBJECTS))
+LINK_OBJS = $(OBJS)
+LINK_SCRIPT = stop_gpe/linkqpmr.cmd
+
+lib_stop_gpe := stop_gpe
+lib_boot_loader := boot
+libraries := $(lib_boot_loader) $(lib_stop_gpe)
+
+.PHONY: all $(libraries) qpmr_header
+all: $(libraries) qpmr_header
+ make qpmr_header
+
+$(libraries) :
+ $(MAKE) --directory=$@ $(TARGET)
+ @echo 'Directory $(TARGET)'
+ $(if $(TARGET), $(MAKE) $(TARGET))
+
+qpmr_header: p9_sgpe_img_edit.c $(LINK_OBJS) stop_gpe/linkqpmr.cmd
+ g++ p9_sgpe_img_edit.c -o $(OBJDIR)/sgpeImgEdit $(INCLUDES)
+ $(LD) -T$(LINK_SCRIPT) -o $(OBJDIR)/qpmr_header.bin -Map $(OBJDIR)/qpmr.map -s $(OBJDIR)/p9_sgpe_qpmr.o
+ #$(OBJDIR)/sgpeImgEdit $(OBJDIR)/stop_gpe/$(IMAGE_NAME).bin
+ $(OBJDIR)/sgpeImgEdit $(OBJDIR)/stop_gpe/stop_gpe.bin $(OBJDIR)/stop_gpe/stop_gpe.bin
+ @echo "Done editing sgpe image....."
+ $(OBJDIR)/sgpeImgEdit $(OBJDIR)/qpmr_header.bin $(OBJDIR)/stop_gpe/stop_gpe.bin
+ @echo "Done editing qpmr images....."
+
+clean:
+ rm -fr $(OBJDIR)
diff --git a/import/chips/p9/procedures/ppe_closed/sgpe/boot/Makefile b/import/chips/p9/procedures/ppe_closed/sgpe/boot/Makefile
index 270a4897..246dc573 100644
--- a/import/chips/p9/procedures/ppe_closed/sgpe/boot/Makefile
+++ b/import/chips/p9/procedures/ppe_closed/sgpe/boot/Makefile
@@ -41,8 +41,8 @@ BOOT_LOADER_OBJS := $(addprefix $(OBJDIR)/, $(BOOT_LOADER_OBJECTS))
# Boot Loader Objects:
BOOT_COPIER_OBJS := $(addprefix $(OBJDIR)/, $(BOOT_COPIER_OBJECTS))
-LIB_DIRS =
-LINK_OBJS = $(OBJS)
+LIB_DIRS =
+LINK_OBJS = $(OBJS)
LINK_SCRIPT_BOOTCOPIER = $(addprefix $(OBJDIR)/, linkscriptbootcopier)
LINK_SCRIPT_BOOTLOADER = $(addprefix $(OBJDIR)/, linkscriptbootloader)
@@ -52,16 +52,21 @@ LIB_DIRS += -L$(OBJDIR)/p2p
LINK_OBJS += $(P2PLIB)
endif
+
+all: bootCopier bootLoader
+bootCopier: $(OBJDIR)/$(IMAGE_BOOTCOPIER_NAME).bin $(OBJDIR)/$(IMAGE_BOOTCOPIER_NAME).dis $(OBJDIR)/$(IMAGE_BOOTCOPIER_NAME).out $(LINK_SCRIPT_BOOTCOPIER)
+bootLoader: $(OBJDIR)/$(IMAGE_BOOTLOADER_NAME).bin $(OBJDIR)/$(IMAGE_BOOTLOADER_NAME).dis $(OBJDIR)/$(IMAGE_BOOTLOADER_NAME).out $(LINK_SCRIPT_BOOTLOADER)
+
####################################
#### Bootcopier Image creation:
####################################
$(OBJDIR)/$(IMAGE_BOOTCOPIER_NAME).bin $(OBJDIR)/$(IMAGE_BOOTCOPIER_NAME).dis: $(OBJDIR)/$(IMAGE_BOOTCOPIER_NAME).out
- $(OBJCOPY) -O binary $< $(OBJDIR)/$(IMAGE_BOOTCOPIER_NAME).bin
+ $(OBJCOPY) -O binary $< $(OBJDIR)/$(IMAGE_BOOTCOPIER_NAME).bin
$(OBJDUMP) -S $< > $(OBJDIR)/$(IMAGE_BOOTCOPIER_NAME).dis
#create a linked ELF executable
$(OBJDIR)/$(IMAGE_BOOTCOPIER_NAME).out: $(LINK_OBJS) $(LINK_SCRIPT_BOOTCOPIER)
- $(LD) -e __system_reset -N -T$(LINK_SCRIPT_BOOTCOPIER) -Map $(OBJDIR)/$(IMAGE_BOOTCOPIER_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_BOOTCOPIER_NAME).out $(LIB_DIRS) $(BOOT_COPIER_OBJS) -lp2p
+ $(LD) -e __system_reset -N -T$(LINK_SCRIPT_BOOTCOPIER) -Map $(OBJDIR)/$(IMAGE_BOOTCOPIER_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_BOOTCOPIER_NAME).out $(LIB_DIRS) $(BOOT_COPIER_OBJS) -lp2p
#pass the link command file through the C preprocessor to evaluate macros and remove comments
$(LINK_SCRIPT_BOOTCOPIER): linkcopier.cmd
@@ -76,7 +81,7 @@ $(OBJDIR)/$(IMAGE_BOOTLOADER_NAME).bin $(OBJDIR)/$(IMAGE_BOOTLOADER_NAME).dis: $
#create a linked ELF executable
$(OBJDIR)/$(IMAGE_BOOTLOADER_NAME).out: $(LINK_OBJS) $(LINK_SCRIPT_BOOTLOADER)
- $(LD) -e __system_reset -N -T$(LINK_SCRIPT_BOOTLOADER) -Map $(OBJDIR)/$(IMAGE_BOOTLOADER_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_BOOTLOADER_NAME).out $(LIB_DIRS) $(BOOT_LOADER_OBJS) -lp2p
+ $(LD) -e __system_reset -N -T$(LINK_SCRIPT_BOOTLOADER) -Map $(OBJDIR)/$(IMAGE_BOOTLOADER_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_BOOTLOADER_NAME).out $(LIB_DIRS) $(BOOT_LOADER_OBJS) -lp2p
#pass the link command file through the C preprocessor to evaluate macros and remove comments
$(LINK_SCRIPT_BOOTLOADER): linkloader.cmd
@@ -94,8 +99,9 @@ $(OBJDIR):
ifdef P2P_ENABLE
$(P2PLIB):
+ @echo 'Before BL Objdir = $(OBJDIR) $(IMAGE_SRCDIR)'
$(MAKE) -I $(IMAGE_SRCDIR) -C $(P2P_SRCDIR)
-endif
+endif
# collect all of the trace hash files for this image into a single trexStringFile
.PHONY : tracehash
@@ -104,12 +110,6 @@ tracehash:
$(THASH) -c -d $(OBJDIR) -s $(OBJDIR)/trexStringFile
-bootCopier: $(OBJDIR)/$(IMAGE_BOOTCOPIER_NAME).bin $(OBJDIR)/$(IMAGE_BOOTCOPIER_NAME).dis $(OBJDIR)/$(IMAGE_BOOTCOPIER_NAME).out $(LINK_SCRIPT_BOOTCOPIER)
-
-bootLoader: $(OBJDIR)/$(IMAGE_BOOTLOADER_NAME).bin $(OBJDIR)/$(IMAGE_BOOTLOADER_NAME).dis $(OBJDIR)/$(IMAGE_BOOTLOADER_NAME).out $(LINK_SCRIPT_BOOTLOADER)
-
-all: bootCopier bootLoader
-
# load and run the gpe image in simics
run: $(OBJDIR)/$(IMAGE_BOOTCOPIER_NAME).out
$(SIMICS_WS)/simics \
@@ -121,5 +121,5 @@ clean:
#Add dependencies to header files
ifneq ($(MAKECMDGOALS),clean)
-include $(OBJS:.o=.d)
+include $(OBJS:.o=.d)
endif
diff --git a/import/chips/p9/procedures/ppe_closed/sgpe/boot/sgpe_boot_copier.S b/import/chips/p9/procedures/ppe_closed/sgpe/boot/sgpe_boot_copier.S
index cc84f900..03ec735b 100644
--- a/import/chips/p9/procedures/ppe_closed/sgpe/boot/sgpe_boot_copier.S
+++ b/import/chips/p9/procedures/ppe_closed/sgpe/boot/sgpe_boot_copier.S
@@ -29,57 +29,57 @@
.list
.section .loader_text, "ax", @progbits
-
+
.global __vectors
__vectors:
- .org __vectors + 0x0000
+ .org __vectors + 0x0000
__machine_check:
- b .
+ b .
- .org __vectors + 0x0040
+ .org __vectors + 0x0040
.global __system_reset
__system_reset:
b __bootCopier
- .org __vectors + 0x0060
+ .org __vectors + 0x0060
__data_storage:
- b .
-
- .org __vectors + 0x0080
+ b .
+
+ .org __vectors + 0x0080
__instruction_storage:
- b .
+ b .
- .org __vectors + 0x00A0
+ .org __vectors + 0x00A0
__external_interrupt_vector:
b .
- .org __vectors + 0x00C0
+ .org __vectors + 0x00C0
__alignment_exception:
b .
- .org __vectors + 0x00E0
+ .org __vectors + 0x00E0
__program_exception:
b .
- .org __vectors + 0x0100
+ .org __vectors + 0x0100
__dec_interrupt:
b .
- .org __vectors + 0x0120
+ .org __vectors + 0x0120
__fit_interrupt:
b .
- .org __vectors + 0x0140
+ .org __vectors + 0x0140
__watchdog_interrupt:
b .
-
+
__bootCopier:
- //load r3 with BASE_
- _liw %r3, HOMER_BOOT_LOADER_LENGTH_ADDR
+ //load r3 with BASE_
+ _liw %r3, HOMER_BOOT_LOADER_LENGTH_ADDR
_liw %r7, HOMER_BOOT_LOADER_OFFSET_ADDR
-
+
//load r4 with address where bootLoader will be loaded in SRAM e.g 0xFFFE8000 (Destination address)
_liw %r4, SRAM_SGPE_BOOT_LOADER_ADDR # dest
@@ -88,11 +88,12 @@ __bootCopier:
//size of image in bytes
lwz r5, 0(r3)
- li r6, 3
+ li r6, 3
srw r5, r5, r6 # r5 contains number of bytes, divide by 8 will give number of double words
+ addi r5, r5, 1
mtctr r5 # set the counter for loop
-
- // calculating bootLoader image loaded address
+
+ // calculating bootLoader image loaded address
lwz r8, 0(r7) # offset of bootLoader section in Homer
adde r8, r8, r9 # add base address to offset to get absolute bootLoader address in Homer
@@ -101,7 +102,7 @@ copy_loop:
stvd d28, 0(r4) # Destination address
addi r8, r8, 8 # Increasing source address
addi r4, r4, 8 # Increasing Dest address
- bdnz copy_loop # Keep repeating the address.
+ bdnz copy_loop # Keep repeating the address.
## Using blr command:
_liw %r6, SRAM_SGPE_BOOT_LOADER_RESET_ADDR
diff --git a/import/chips/p9/procedures/ppe_closed/sgpe/boot/sgpe_boot_loader.S b/import/chips/p9/procedures/ppe_closed/sgpe/boot/sgpe_boot_loader.S
index 98c2df48..be7e3ffd 100644
--- a/import/chips/p9/procedures/ppe_closed/sgpe/boot/sgpe_boot_loader.S
+++ b/import/chips/p9/procedures/ppe_closed/sgpe/boot/sgpe_boot_loader.S
@@ -77,6 +77,13 @@ __bootLoader:
## QPMR Header Copy
######################
## cal source Address
+ _liw %r9, SRAM_SGPE_BASE_ADDR
+ nop
+ _liw %r8, SGPE_IVPR_OCI_ADDR
+ nop
+ nop
+ stw r9, 0(r8)
+
_liw %r10, SRAM_SGPE_HCODE_LENGTH_ADDR
_liw %r3, QPMR_HEADER_ADDR
diff --git a/import/chips/p9/procedures/ppe_closed/sgpe/p9_sgpe_img_edit.c b/import/chips/p9/procedures/ppe_closed/sgpe/p9_sgpe_img_edit.c
new file mode 100644
index 00000000..d6e84878
--- /dev/null
+++ b/import/chips/p9/procedures/ppe_closed/sgpe/p9_sgpe_img_edit.c
@@ -0,0 +1,149 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: import/chips/p9/procedures/ppe_closed/sgpe/p9_sgpe_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>
+
+enum
+{
+ SGPE_RESET_ADDR_POS = 0x0188,
+ SGPE_RESET_ADDRESS = 0x40,
+ SGPE_BUILD_DATE_POS = 0x0198,
+ SGPE_BUILD_VER_POS = 0x019C,
+ SGPE_BUILD_VER = 0x01,
+ QPMR_BUILD_DATE_POS = 0x18,
+ QPMR_BUILD_VER_POS = 0x1C,
+ SGPE_IMAGE = 1,
+ QPMR_IMAGE = 2,
+ QPMR_SGPE_HCODE_OFF_POS = 0x28,
+ QPMR_SGPE_HCODE_OFF_VAL = 0xA00, //512B + 1KB + 1kB
+ QPMR_SGPE_HCODE_LEN_POS = 0x28,
+};
+
+int main(int narg, char* argv[])
+{
+
+ if(narg < 2)
+ {
+ printf("Usage: %s <full path to image>\n",
+ argv[0]);
+ return -1;
+ }
+
+ int imageType = SGPE_IMAGE;
+ long int buildDatePos = SGPE_BUILD_DATE_POS;
+ long int buildVerPos = SGPE_BUILD_VER_POS;
+
+ FILE* pMainImage = fopen( argv[1], "r+");
+ FILE* pDependImage = fopen(argv[2], "r+");
+
+ time_t buildTime = time(NULL);
+ struct tm* headerTime = localtime(&buildTime);
+
+ do
+ {
+ if( !pMainImage )
+ {
+ printf("\n image file to edit was not found\n");
+ break;
+ }
+
+ fseek (pMainImage, 0, SEEK_END);
+ uint32_t size = ftell (pMainImage);
+ rewind(pMainImage);
+ uint32_t QPMR_SGPE_HCODE_LEN_VAL = 0;
+
+
+ // For ekb build it's desired to detect the image type w/o special
+ // make rules. Better way?
+ if(size < 1024)
+ {
+ imageType = QPMR_IMAGE;
+ buildDatePos = QPMR_BUILD_DATE_POS;
+ buildVerPos = QPMR_BUILD_VER_POS;
+
+ if( !pDependImage )
+ {
+ printf("\n image file to find the size was not found\n");
+ break;
+ }
+
+ fseek (pDependImage, 0, SEEK_END);
+ QPMR_SGPE_HCODE_LEN_VAL = ftell (pDependImage);
+ rewind(pDependImage);
+ }
+
+ uint32_t temp = 0;
+
+ if(imageType == SGPE_IMAGE)
+ {
+
+ // populating SGPE Image Header
+ // populating RESET address
+ fseek (pMainImage, SGPE_RESET_ADDR_POS, SEEK_SET);
+ temp = SGPE_RESET_ADDRESS;
+ temp = htonl(temp);
+ fwrite(&(temp), sizeof(uint32_t), 1, pMainImage );
+ }
+
+
+ //build date
+ fseek( pMainImage, buildDatePos, SEEK_SET );
+ // date format same as in XIP Header YYYYMMDD
+ temp = ((headerTime->tm_mday ) |
+ ((headerTime->tm_mon + 1) << 8) |
+ (headerTime->tm_year + 1900) << 16);
+
+ temp = htonl(temp);
+ fwrite(&temp, sizeof(uint32_t), 1, pMainImage );
+
+ // build ver
+ fseek( pMainImage, buildVerPos, SEEK_SET );
+ temp = htonl(SGPE_BUILD_VER);
+ fwrite(&temp, sizeof(uint32_t), 1, pMainImage );
+
+ if (imageType == QPMR_IMAGE)
+ {
+ //SGPE HCODE offset in QPMR header
+ fseek ( pMainImage , QPMR_SGPE_HCODE_OFF_POS, SEEK_SET );
+ temp = QPMR_SGPE_HCODE_OFF_VAL;
+ temp = htonl(temp);
+ fwrite(&temp, sizeof(uint32_t), 1, pMainImage );
+
+ //SGPE Hcode length in QPMR header
+ fseek ( pMainImage , QPMR_SGPE_HCODE_LEN_POS, SEEK_SET );
+ temp = QPMR_SGPE_HCODE_LEN_VAL;
+ temp = htonl(temp);
+ fwrite(&temp, sizeof(uint32_t), 1, pMainImage );
+ }
+
+ fclose(pMainImage);
+ fclose(pDependImage);
+ }
+ while(0);
+
+ return 0;
+}
diff --git a/import/chips/p9/procedures/ppe_closed/sgpe/p9_sgpe_qpmr.S b/import/chips/p9/procedures/ppe_closed/sgpe/p9_sgpe_qpmr.S
new file mode 100644
index 00000000..4bd6e406
--- /dev/null
+++ b/import/chips/p9/procedures/ppe_closed/sgpe/p9_sgpe_qpmr.S
@@ -0,0 +1,27 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: import/chips/p9/procedures/ppe_closed/sgpe/p9_sgpe_qpmr.S $ */
+/* */
+/* 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 <p9_hcode_image_defines.H>
+.qpmr_header
diff --git a/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/p9_hcd_sgpe_boot_cme.c b/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/p9_hcd_sgpe_boot_cme.c
index 2b681377..8bcccf07 100644
--- a/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/p9_hcd_sgpe_boot_cme.c
+++ b/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/p9_hcd_sgpe_boot_cme.c
@@ -39,11 +39,13 @@ enum
MAX_CME_PER_CHIP = MAX_EXES,
CHECK_BIT = 0x8000, // input vector is big endian
SCOM_ADDR_CME_FLAGS = 0x10012020,
+ SCOM_ADDR_CME_FLAGS_CLR = SCOM_ADDR_CME_FLAGS + 1,
+ SCOM_ADDR_CME_FLAGS_SET = SCOM_ADDR_CME_FLAGS + 2,
CPMR_POSITION = 0x00200000,
CME_IMG_HDR_OFFSET_POS = 0x20,
CME_HCODE_LEN_POS = 0x24,
- CME_FLAG_SHIFT_POS = 0x1E,
- SCOM_ADDR_CME_XCR = 0x10012030,
+ CME_FLAG_SHIFT_POS = (63 - 31), // @bug: was 0x1E
+ SCOM_ADDR_CME_XCR = 0x10012010,
RESUME_PPE_OPERATION = 0x2000000000000000ll, // Resume PPE
HARD_RESET_PPE = 0x6000000000000000ll, // Hard Reset PPE
SBASE_FIRST_BLOCK_COPY = 0, // corresponds to address 0xFFFF8000
@@ -56,15 +58,17 @@ enum
SCOM_ADDR_CCSR = 0x0006C090,
CHECK_BIT_DWORD = 0x8000000000000000ll,
SET_ADDR_MSB = 0x80000000,
- CME_STOP_READY = 0x80000000,
- SCOM_ADDR_CORE_CPMMR_CLR = 0x2E0F0107,
- WKUP_NOTIFY_SELECT = 0x00040000,
+ CME_STOP_READY = 0x8000000000000000ll,
+ SCOM_ADDR_CORE_CPMMR = 0x200F0106,
+ SCOM_ADDR_CORE_CPMMR_CLR = SCOM_ADDR_CORE_CPMMR + 1,
+ SCOM_ADDR_CORE_CPMMR_OR = SCOM_ADDR_CORE_CPMMR + 2,
+ WKUP_NOTIFY_SELECT = 0x0004000000000000,
CME_BOOT_TIMEOUT = 0x32,
- CME_BCE_TIMEOUT = 0x32,
+ CME_BCE_TIMEOUT = 0xB0,
WRITE_CLR_ALL = 0xFFFFFFFFF,
- SCOM_ADDR_CME_FWMODE_CLR = 0x1001201B,
- SCOM_ADDR_CME_FWMODE_OR = 0x1001201C,
- BCESCR_OVERRIDE_ENABLE = 0x10000000,
+ SCOM_ADDR_CME_FWMODE_CLR = 0x1001203B,
+ SCOM_ADDR_CME_FWMODE_OR = 0x1001203C,
+ BCESCR_OVERRIDE_ENABLE = 0x1000000000000000,
CME_BLOCK_READ_SIZE = 0x20,
};
@@ -95,6 +99,10 @@ BootErrorCode_t boot_cme( uint16_t i_bootCme )
{
BootErrorCode_t l_retCode = CME_BOOT_SUCCESS;
+ //uint32_t cme_boot_loop;
+ uint32_t cme_bce_loop;
+ uint32_t cme_rdy_loop;
+
do
{
int rc = 0;
@@ -141,6 +149,7 @@ BootErrorCode_t boot_cme( uint16_t i_bootCme )
l_corePos = l_cmeIndex << 1;
coreCnt = ( l_dataCCSR & (CHECK_BIT_DWORD >> l_corePos) ) ? EVEN_CORE_ACTIVE : INACTIVE_CORE;
coreCnt += ( l_dataCCSR & (CHECK_BIT_DWORD >> (l_corePos + 1)) ) ? ODD_CORE_ACTIVE : INACTIVE_CORE;
+ PK_TRACE("l_cmeIndex: %d CorePos: %d l_dataCCSR: %x coreCnt: %d", l_cmeIndex, l_corePos, l_dataCCSR, coreCnt);
if( ZERO == coreCnt )
{
@@ -152,22 +161,29 @@ BootErrorCode_t boot_cme( uint16_t i_bootCme )
// Update CME state to Flag register
quadId = l_cmeIndex >> 1;
activeCmeList[l_cmeIndex] = coreCnt;
- l_scomAddr = SGPE_SCOM_ADDR( SCOM_ADDR_CME_FLAGS,
+ l_scomAddr = SGPE_SCOM_ADDR( SCOM_ADDR_CME_FLAGS_CLR, // @bug: was SCOM_ADDR_CME_FLAGS
quadId,
- l_cmeIndex );
-
+ (l_cmeIndex % 2) ); // @bug: was l_cmeIndex which goes from 0 to 11 (0xE)
+ // and this should be giving a 0 or 1 value within
+ // a quad.
PPE_PUTSCOM( l_scomAddr, WRITE_CLR_ALL ); // clear all bits first.
+
//Writing core status as found in CCSR
l_dataReg = activeCmeList[l_cmeIndex];
+ l_scomAddr = SGPE_SCOM_ADDR( SCOM_ADDR_CME_FLAGS,
+ quadId,
+ (l_cmeIndex % 2) );
PPE_PUTSCOM( l_scomAddr, (l_dataReg << CME_FLAG_SHIFT_POS) )
// core is available and CME can attempt to boot it.
// From SGPE platform, let us first get control of Block copy engine.
- l_scomAddr = SGPE_SCOM_ADDR( SCOM_ADDR_CME_FWMODE_OR,
+ l_scomAddr = SGPE_SCOM_ADDR( SCOM_ADDR_CME_FWMODE_OR, //FWMODE -> LMCR
quadId,
- l_cmeIndex );
+ (l_cmeIndex % 2));
+
PPE_PUTSCOM( l_scomAddr, BCESCR_OVERRIDE_ENABLE ); //Disables BCE access via CME's Local register.
+
// -----------------------------------------------------------------
// -----------------------------------------------------------------
// Step 2. Configure Block Copy Engine for copy of CME Image and common scan rings.
@@ -181,16 +197,25 @@ BootErrorCode_t boot_cme( uint16_t i_bootCme )
//of chip' HOMER. This offset is updated in a specific field of
//CPMR Header area of chip's HOMER. Let us read that field and
//find out the offset.
-
+ PK_TRACE("SCOM addr Pbabar0: 0x%x", SCOM_ADDR_PBABAR0);
uint64_t l_cpmrAddr = 0;
PPE_GETSCOM(SCOM_ADDR_PBABAR0, l_cpmrAddr); // get start of HOMER for the chip.
- PK_TRACE("PBABAR0 Data 0x%016llx ", l_cpmrAddr );
l_cpmrAddr += CPMR_POSITION; // offset to CPMR
//Reading CPMR header to determine :
//1. start of CME Image
//2. Length of first block copy
HomerImgDesc_t* pCpmrHdrAddr = (HomerImgDesc_t*)(CPMR_POSITION | SET_ADDR_MSB); // Set MSB to point OCI to PBA
+ PK_TRACE("Magic Number [ 0:31]: 0x%08x", ((pCpmrHdrAddr->homerMagicNumber & 0xffffffff00000000) >> 32));
+ PK_TRACE("Magic Number [32:63]: 0x%08x", ((pCpmrHdrAddr->homerMagicNumber & 0x00000000ffffffff)));
+
+ PK_TRACE("Build Date: 0x%08x", (pCpmrHdrAddr->buildDate));
+ PK_TRACE("Version : 0x%08x", (pCpmrHdrAddr->version));
+ PK_TRACE("Fused Flag: 0x%08x", (pCpmrHdrAddr->fuseModeStatus));
+
+ PK_TRACE("Cme Hcode Offset: 0x%08x", (pCpmrHdrAddr->cmeImgOffset));
+ PK_TRACE("Cme Hcode Length: 0x%08x", (pCpmrHdrAddr->cmeImgLength));
+
uint32_t l_blockCopyLength = 0;
// This offset must be multiple of 32B. This is to facilitate quick calculation of MBASE for BCE.
@@ -200,8 +225,6 @@ BootErrorCode_t boot_cme( uint16_t i_bootCme )
l_blockCopyLength = pCpmrHdrAddr->cmeImgLength; // CME Image length
l_blockCopyLength += pCpmrHdrAddr->cmeCommonRingLength; // adding common ring length
l_blockCopyLength += pCpmrHdrAddr->cmePstateLength; // adding Pstate region length
- PK_TRACE("Block Copy Length in bytes0x%08x Main Mem Hcode Addr 0x%016llx",
- l_blockCopyLength, l_cpmrAddr );
//rounding off length to CME's read block size i.e. 32 bytes
l_blockCopyLength = ((l_blockCopyLength + (CME_BLOCK_READ_SIZE - 1 )) / CME_BLOCK_READ_SIZE);
@@ -216,6 +239,7 @@ BootErrorCode_t boot_cme( uint16_t i_bootCme )
// Step 3. Configure BCE for second block copy
// -----------------------------------------------------------------
// -----------------------------------------------------------------
+
initCmeBceBarAddr( BCEBAR1, l_cpmrAddr , l_cmeIndex );
// -----------------------------------------------------------------
@@ -223,10 +247,14 @@ BootErrorCode_t boot_cme( uint16_t i_bootCme )
// Step 4. Start Block Copy
// -----------------------------------------------------------------
// -----------------------------------------------------------------
+ PK_TRACE("Before startCmeBlockCopy l_blockCopyLength in bytes 0x%08x l_cmeIndex: %d l_hdrToSectionOffset 0x%x",
+ l_blockCopyLength, l_cmeIndex, l_hdrToSectionOffset);
+
startCmeBlockCopy( SBASE_FIRST_BLOCK_COPY, l_blockCopyLength, l_cmeIndex,
PLAT_SGPE, 0, l_hdrToSectionOffset );
activeCmeCnt++;
+ PK_TRACE("activeCmeCnt: %d", activeCmeCnt);
}
l_retCode = BLOCK_COPY_SCOM_FAIL;
@@ -238,9 +266,8 @@ BootErrorCode_t boot_cme( uint16_t i_bootCme )
}
uint32_t l_copyStatus = 0;
- uint8_t l_cmeWaitTime = 0;
- while( l_cmeWaitTime < CME_BCE_TIMEOUT )
+ while(cmeInitSuccessCnt != activeCmeCnt)
{
// we have started first block copy for every functional CME. Let us check if block copy is done or not.
for( l_cmeIndex = 0; l_cmeIndex < MAX_CME_PER_CHIP; l_cmeIndex++ )
@@ -254,9 +281,8 @@ BootErrorCode_t boot_cme( uint16_t i_bootCme )
l_copyStatus = checkCmeBlockCopyStatus( l_cmeIndex, PLAT_SGPE );
- if( BLOCK_COPY_IN_PROGRESS == l_copyStatus )
+ if(BLOCK_COPY_IN_PROGRESS == l_copyStatus )
{
- // block copy on CME was started but it is still in progress
continue;
}
@@ -264,6 +290,7 @@ BootErrorCode_t boot_cme( uint16_t i_bootCme )
{
PK_TRACE(" block copy failed for CME 0x%08x", l_cmeIndex );
l_retCode = BLOCK_COPY_SCOM_FAIL;
+
// for now abandon booting if a block copy fails on some CME.
cmeInitSuccessCnt = activeCmeCnt;
break;
@@ -288,30 +315,30 @@ BootErrorCode_t boot_cme( uint16_t i_bootCme )
// Once it kicks off CME, during its initialization, CME will try to block
// copy its instance specific scan rings. For that to succeed, SGPE must clear
// BCECSR_OVERRIDE_EN bit in CME_FWMODE register.
+
l_scomAddr = SGPE_SCOM_ADDR( SCOM_ADDR_CME_FWMODE_CLR,
quadId,
- l_cmeIndex );
+ (l_cmeIndex % 2));
PPE_PUTSCOM( l_scomAddr, BCESCR_OVERRIDE_ENABLE ); // release control back to local CME BCECSR
//Writing to CME's XCR to Hard Reset it
l_scomAddr = SGPE_SCOM_ADDR(SCOM_ADDR_CME_XCR,
quadId,
- l_cmeIndex );
+ (l_cmeIndex % 2));
- l_dataReg = HARD_RESET_PPE;
- PPE_PUTSCOM( l_scomAddr, l_dataReg );
+ PPE_PUTSCOM( l_scomAddr, HARD_RESET_PPE );
// Kick off CME by giving resume command through PPE External Control Register
// Writing to XCR to resume PPE operation
- l_dataReg = RESUME_PPE_OPERATION;
- PPE_PUTSCOM( l_scomAddr, l_dataReg );
+ PPE_PUTSCOM( l_scomAddr, RESUME_PPE_OPERATION );
cmeInitSuccessCnt++;
- }
- pk_sleep( PK_MILLISECONDS(2));
- l_cmeWaitTime++;
- }
+ } //for ( l_cmeIndex = 0 ....)
+
+ PPE_WAIT_CORE_CYCLES(cme_bce_loop, 256);
+ } //while(l_bceCnt != activeCmeCnt)
+ PK_TRACE("BCE done and resume scom_addr: 0x%08x", l_scomAddr);
// -----------------------------------------------------------------
// -----------------------------------------------------------------
@@ -328,13 +355,11 @@ BootErrorCode_t boot_cme( uint16_t i_bootCme )
if( BLOCK_COPY_SUCCESS == l_copyStatus )
{
uint32_t cmeReadyList = 0;
- l_cmeWaitTime = 0;
- while( l_cmeWaitTime < CME_BOOT_TIMEOUT )
- {
- // Need to check if all CME were able to complete booting
- quadId = 0;
+ uint8_t l_cmeRdyCnt = 0;
+ while(l_cmeRdyCnt != activeCmeCnt)
+ {
for( l_cmeIndex = 0; l_cmeIndex < MAX_CME_PER_CHIP; l_cmeIndex++ )
{
if( INACTIVE_CORE == activeCmeList[l_cmeIndex] )
@@ -350,20 +375,26 @@ BootErrorCode_t boot_cme( uint16_t i_bootCme )
continue;
}
+ //Read CME Flag register to check STOP RDY
quadId = (l_cmeIndex >> 1);
l_scomAddr = SGPE_SCOM_ADDR( SCOM_ADDR_CME_FLAGS,
quadId,
- l_cmeIndex );
+ (l_cmeIndex % 2) );
PPE_GETSCOM( l_scomAddr, l_dataReg );
+ if (!(l_dataReg & CME_STOP_READY))
+ {
+ continue;
+ }
+
+ l_cmeRdyCnt++;
+
if( l_dataReg & CME_STOP_READY )
{
if( EVEN_CORE_ACTIVE == activeCmeList[l_cmeIndex] ||
BOTH_CORE_ACTIVE == activeCmeList[l_cmeIndex] )
{
- //FIXME get scom address
- //clear CPMMR[WKUP_NOTIFY_SELECT]
l_scomAddr = GPE_SCOM_ADDR_CORE( SCOM_ADDR_CORE_CPMMR_CLR, (l_cmeIndex << 1 ));
l_dataReg = WKUP_NOTIFY_SELECT;
PPE_PUTSCOM( l_scomAddr, l_dataReg );
@@ -372,8 +403,6 @@ BootErrorCode_t boot_cme( uint16_t i_bootCme )
if( ODD_CORE_ACTIVE == activeCmeList[l_cmeIndex] ||
BOTH_CORE_ACTIVE == activeCmeList[l_cmeIndex] )
{
- //FIXME get scom address
- //clear CPMMR[WKUP_NOTIFY_SELECT]
l_scomAddr = GPE_SCOM_ADDR_CORE( SCOM_ADDR_CORE_CPMMR_CLR, ((l_cmeIndex << 1) + 1 ));
l_dataReg = WKUP_NOTIFY_SELECT;
PPE_PUTSCOM( l_scomAddr, l_dataReg );
@@ -383,9 +412,8 @@ BootErrorCode_t boot_cme( uint16_t i_bootCme )
}
}//end for
- pk_sleep( PK_MILLISECONDS(2));
- l_cmeWaitTime++;
- } // boot timeout
+ PPE_WAIT_CORE_CYCLES(cme_rdy_loop, 256);
+ } // while l_cmeRdyCnt != activeCmeCnt
} //if all CME kicked off
}
while(0);
diff --git a/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/p9_sgpe_edit.mk b/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/p9_sgpe_edit.mk
index d0e430da..bb69025c 100644
--- a/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/p9_sgpe_edit.mk
+++ b/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/p9_sgpe_edit.mk
@@ -27,6 +27,7 @@ IMAGE_DEPS+=stop_gpeImgEdit
OBJS=p9_sgpe_img_edit.o
$(call BUILD_EXE)
+
EXE=qpmr_headerImgEdit
IMAGE_DEPS+=qpmr_headerImgEdit
OBJS=p9_sgpe_img_edit.o
diff --git a/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/p9_sgpe_img_edit.c b/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/p9_sgpe_img_edit.c
index 40d9b0c0..c4279a2e 100644
--- a/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/p9_sgpe_img_edit.c
+++ b/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/p9_sgpe_img_edit.c
@@ -38,6 +38,9 @@ enum
QPMR_BUILD_VER_POS = 0x1C,
SGPE_IMAGE = 1,
QPMR_IMAGE = 2,
+ QPMR_SGPE_HCODE_OFF_POS = 0x28,
+ QPMR_SGPE_HCODE_OFF_VAL = 0xA00, //512B + 1KB + 1kB
+ QPMR_SGPE_HCODE_LEN_POS = 0x28,
};
int main(int narg, char* argv[])
@@ -54,60 +57,96 @@ int main(int narg, char* argv[])
long int buildDatePos = SGPE_BUILD_DATE_POS;
long int buildVerPos = SGPE_BUILD_VER_POS;
- FILE* pImage = fopen( argv[1], "r+");
+ FILE* pMainImage = fopen( argv[1], "r+");
+ FILE* pDependImage = fopen(argv[2], "r+");
time_t buildTime = time(NULL);
struct tm* headerTime = localtime(&buildTime);
do
{
- if( !pImage )
+ if( !pMainImage )
{
- printf("\n image file not found");
+ printf("\n image file to edit was not found\n");
break;
}
- fseek (pImage, 0, SEEK_END);
- uint32_t size = ftell (pImage);
- rewind(pImage);
+ fseek (pMainImage, 0, SEEK_END);
+ uint32_t size = ftell (pMainImage);
+ rewind(pMainImage);
+ uint32_t QPMR_SGPE_HCODE_LEN_VAL = 0;
+
// For ekb build it's desired to detect the image type w/o special
// make rules. Better way?
+ printf("Size is: %d\n", size);
+
if(size < 1024)
{
imageType = QPMR_IMAGE;
buildDatePos = QPMR_BUILD_DATE_POS;
buildVerPos = QPMR_BUILD_VER_POS;
+
+ if( !pDependImage )
+ {
+ printf("\n image file to find the size was not found\n");
+ break;
+ }
+
+ fseek (pDependImage, 0, SEEK_END);
+ QPMR_SGPE_HCODE_LEN_VAL = ftell (pDependImage);
+ rewind(pDependImage);
}
uint32_t temp = 0;
if(imageType == SGPE_IMAGE)
{
+
// populating SGPE Image Header
// populating RESET address
- fseek (pImage, SGPE_RESET_ADDR_POS, SEEK_SET);
+ fseek (pMainImage, SGPE_RESET_ADDR_POS, SEEK_SET);
temp = SGPE_RESET_ADDRESS;
temp = htonl(temp);
- fwrite(&(temp), sizeof(uint32_t), 1, pImage );
+ fwrite(&(temp), sizeof(uint32_t), 1, pMainImage );
+ printf("Done 1\n");
}
+
//build date
- fseek( pImage, buildDatePos, SEEK_SET );
+ fseek( pMainImage, buildDatePos, SEEK_SET );
// date format same as in XIP Header YYYYMMDD
temp = ((headerTime->tm_mday ) |
((headerTime->tm_mon + 1) << 8) |
(headerTime->tm_year + 1900) << 16);
temp = htonl(temp);
- fwrite(&temp, sizeof(uint32_t), 1, pImage );
+ fwrite(&temp, sizeof(uint32_t), 1, pMainImage );
// build ver
- fseek( pImage, buildVerPos, SEEK_SET );
+ fseek( pMainImage, buildVerPos, SEEK_SET );
temp = htonl(SGPE_BUILD_VER);
- fwrite(&temp, sizeof(uint32_t), 1, pImage );
+ fwrite(&temp, sizeof(uint32_t), 1, pMainImage );
+ printf("Done 2");
+
+ if (imageType == QPMR_IMAGE)
+ {
+ //SGPE HCODE offset in QPMR header
+ fseek ( pMainImage , QPMR_SGPE_HCODE_OFF_POS, SEEK_SET );
+ temp = QPMR_SGPE_HCODE_OFF_VAL;
+ temp = htonl(temp);
+ fwrite(&temp, sizeof(uint32_t), 1, pMainImage );
+
+ //SGPE Hcode length in QPMR header
+ fseek ( pMainImage , QPMR_SGPE_HCODE_LEN_POS, SEEK_SET );
+ temp = QPMR_SGPE_HCODE_LEN_VAL;
+ temp = htonl(temp);
+ fwrite(&temp, sizeof(uint32_t), 1, pMainImage );
+ }
- fclose(pImage);
+ printf("Done 3");
+ fclose(pMainImage);
+ //fclose(pDependImage);
}
while(0);
diff --git a/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/p9_sgpe_stop_exit.c b/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/p9_sgpe_stop_exit.c
index 39932f43..44046670 100644
--- a/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/p9_sgpe_stop_exit.c
+++ b/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/p9_sgpe_stop_exit.c
@@ -61,6 +61,7 @@ p9_sgpe_stop_exit()
cexit > 0 || qspwu > 0;
cexit = cexit << 4, qspwu = qspwu << 1, qloop++, m_l2 = 0, m_pg = 0)
{
+
if (!((cexit & BITS32(0, 4)) || (qspwu & BIT32(0))))
{
continue;
@@ -100,6 +101,18 @@ p9_sgpe_stop_exit()
PK_TRACE("quad[%d]m_l2[%d]m_pg[%d]", qloop, m_l2, m_pg);
+ if (G_sgpe_stop_record.group.ex_l[VECTOR_CONFIG] & BIT32(qloop))
+ {
+ m_pg |= FST_EX_IN_QUAD;
+ }
+
+ if (G_sgpe_stop_record.group.ex_r[VECTOR_CONFIG] & BIT32(qloop))
+ {
+ m_pg |= SND_EX_IN_QUAD;
+ }
+
+ PK_TRACE("quad[%d]m_l2[%d]m_pg[%d]", qloop, m_l2, m_pg);
+
// Update QSSR: stop_exit_ongoing
out32(OCB_QSSR_OR, BIT32(qloop + 26));
@@ -175,6 +188,7 @@ p9_sgpe_stop_exit()
//====================================
#if !SKIP_ARRAYINIT
PK_TRACE("Cache Arrayinit");
+
p9_hcd_cache_arrayinit(qloop, m_pg);
#endif
//=====================
@@ -183,6 +197,12 @@ p9_sgpe_stop_exit()
PK_TRACE("Cache Initf");
p9_hcd_cache_initf(qloop);
+#if !ISTEP15_HACK
+ asm volatile ("nop");
+#else
+ asm volatile ("tw 31, 0, 0");
+#endif
+
#endif
//===========================================
@@ -206,6 +226,11 @@ p9_sgpe_stop_exit()
PK_TRACE("Cache L2 Startclocks");
p9_hcd_cache_l2_startclocks(qloop, m_l2, m_pg);
+#if !ISTEP15_HACK
+ asm volatile ("nop");
+#else
+ asm volatile ("tw 31, 0, 0");
+#endif
// reset ex actual state if ex is exited.
if (m_l2 & FST_EX_IN_QUAD)
@@ -218,6 +243,8 @@ p9_sgpe_stop_exit()
G_sgpe_stop_record.state[qloop].act_state_x1 = 0;
}
+
+
// Update QSSR: drop l2_stopped,
out32(OCB_QSSR_CLR, (m_l2 << SHIFT32((qloop << 1) + 1)));
}
diff --git a/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/pk_app_cfg.h b/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/pk_app_cfg.h
index aa68586c..beaacbf5 100644
--- a/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/pk_app_cfg.h
+++ b/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/pk_app_cfg.h
@@ -37,10 +37,19 @@
#define STOP_PRIME 0
#define SKIP_L3_PURGE 0
#define SKIP_L3_PURGE_ABORT 0
-#define SKIP_CME_BOOT_STOP11 1
-#define SKIP_CME_BOOT_IPL_HB 1
-#define SKIP_ARRAYINIT 1
-#define SKIP_SCAN0 1
+#define ISTEP15_HACK 1
+
+#if !ISTEP15_HACK
+ #define SKIP_CME_BOOT_STOP11 1
+ #define SKIP_CME_BOOT_IPL_HB 1
+ #define SKIP_ARRAYINIT 1
+ #define SKIP_SCAN0 1
+#else
+ #define SKIP_CME_BOOT_STOP11 0
+ #define SKIP_CME_BOOT_IPL_HB 1
+ #define SKIP_ARRAYINIT 0
+ #define SKIP_SCAN0 0
+#endif
#define SKIP_INITF 0
// --------------------
diff --git a/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/stop_gpe.mk b/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/stop_gpe.mk
index 20f5e2d7..71c63c9f 100644
--- a/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/stop_gpe.mk
+++ b/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/stop_gpe.mk
@@ -23,19 +23,16 @@
#
# IBM_PROLOG_END_TAG
#
-
-IMAGE=qpmr_header
-
-# Target tool chain
-$(IMAGE)_TARGET=PPE
-
-#linkscript to use
-$(IMAGE)_LINK_SCRIPT=linkqpmr.cmd
-
-OBJS = p9_sgpe_qpmr.o
-$(call BUILD_BINHEADER)
-
-
+## IMAGE=qpmr_header
+##
+## # Target tool chain
+## $(IMAGE)_TARGET=PPE
+##
+## #linkscript to use
+## $(IMAGE)_LINK_SCRIPT=linkqpmr.cmd
+##
+## OBJS = p9_sgpe_qpmr.o
+## $(call BUILD_BINHEADER)
IMAGE=stop_gpe
@@ -112,8 +109,38 @@ $(call ADD_PPEIMAGE_INCDIR,$(IMAGE),\
$(HCODE_LIBDIR) \
$(HCODE_COMMON_LIBDIR) \
$(HCODE_UTILS_INCDIR) \
+ $(ROOTPATH)/chips/p9/procedures/hwp/lib/ \
)
$(IMAGE)_LDFLAGS=-e __system_reset -N -gc-sections -Bstatic
$(call BUILD_PPEIMAGE)
+
+# QPMR header edit:
+IMAGE=qpmr_header
+
+# Target tool chain
+$(IMAGE)_TARGET=PPE
+
+#linkscript to use
+$(IMAGE)_LINK_SCRIPT=linkqpmr.cmd
+
+OBJS = p9_sgpe_qpmr.o
+
+
+$(call ADD_BINHEADER_INCDIR,$(IMAGE),\
+ $(PK_SRCDIR)/kernel \
+ $(PK_SRCDIR)/ppe42 \
+ $(PK_SRCDIR)/trace \
+ $(PK_SRCDIR)/$(_PPE_TYPE) \
+ $(PM_LIBDIR)/include \
+ $(PM_LIBDIR)/include/registers \
+ $(PM_LIBDIR)/common \
+ $(PM_LIBDIR)/occlib \
+ $(HCODE_LIBDIR) \
+ $(HCODE_COMMON_LIBDIR) \
+ $(HCODE_UTILS_INCDIR) \
+ $(ROOTPATH)/chips/p9/procedures/hwp/lib/ \
+ )
+
+$(call BUILD_BINHEADER,$(IMAGEPATH)/stop_gpe/stop_gpe.bin)
diff --git a/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/topfiles.mk b/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/topfiles.mk
index 14735849..0fa2fe13 100644
--- a/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/topfiles.mk
+++ b/import/chips/p9/procedures/ppe_closed/sgpe/stop_gpe/topfiles.mk
@@ -44,7 +44,7 @@ TOP-C-SOURCES = p9_sgpe_main.c \
p9_hcd_cache_occ_runtime_scom.c \
p9_hcd_cache_ras_runtime_scom.c \
p9_hcd_sgpe_boot_cme.c
-
-TOP-S-SOURCES = p9_sgpe_image_header.S
+
+TOP-S-SOURCES = p9_sgpe_image_header.S
TOP_OBJECTS = $(TOP-C-SOURCES:.c=.o) $(TOP-S-SOURCES:.S=.o) $(TOP-SRC:.C=.o)
diff --git a/import/chips/p9/procedures/ppe_closed/sgpe/topfiles.mk b/import/chips/p9/procedures/ppe_closed/sgpe/topfiles.mk
new file mode 100644
index 00000000..38985d69
--- /dev/null
+++ b/import/chips/p9/procedures/ppe_closed/sgpe/topfiles.mk
@@ -0,0 +1,29 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: import/chips/p9/procedures/ppe_closed/sgpe/topfiles.mk $
+#
+# 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
+TOP-C-SOURCES =
+
+TOP-S-SOURCES += p9_sgpe_qpmr.S
+
+TOP_OBJECTS = $(TOP-C-SOURCES:.c=.o) $(TOP-S-SOURCES:.S=.o)
OpenPOWER on IntegriCloud