Merge pull request #1196 from pragupta/master

xmltohb.pl: pass mrw scratch dir as src-output-dir
diff --git a/openpower/configs/witherspoon_defconfig b/openpower/configs/witherspoon_defconfig
index be031b6..1397a91 100644
--- a/openpower/configs/witherspoon_defconfig
+++ b/openpower/configs/witherspoon_defconfig
@@ -42,7 +42,7 @@
 BR2_OPENPOWER_POWER9=y
 BR2_HOSTBOOT_CONFIG_FILE="witherspoon.config"
 BR2_OPENPOWER_MACHINE_XML_GITHUB_PROJECT_VALUE="witherspoon-xml"
-BR2_OPENPOWER_MACHINE_XML_VERSION="d0f86cf46a99800c6f15a4e650701da141216940"
+BR2_OPENPOWER_MACHINE_XML_VERSION="5b59a1dc4cf70c395ac984a800aef9822d8881ea"
 BR2_OPENPOWER_MACHINE_XML_FILENAME="witherspoon.xml"
 BR2_OPENPOWER_SYSTEM_XML_FILENAME="WITHERSPOON_hb.system.xml"
 BR2_OPENPOWER_MRW_XML_FILENAME="WITHERSPOON_hb.mrw.xml"
diff --git a/openpower/configs/zaius_defconfig b/openpower/configs/zaius_defconfig
index d95bdc5..86fe8c0 100644
--- a/openpower/configs/zaius_defconfig
+++ b/openpower/configs/zaius_defconfig
@@ -42,7 +42,7 @@
 BR2_OPENPOWER_POWER9=y
 BR2_HOSTBOOT_CONFIG_FILE="zaius.config"
 BR2_OPENPOWER_MACHINE_XML_GITHUB_PROJECT_VALUE="zaius-xml"
-BR2_OPENPOWER_MACHINE_XML_VERSION="500647235aab6e2bb5a24dd00baab59083461833"
+BR2_OPENPOWER_MACHINE_XML_VERSION="46a2b3cc06fa7f76265e6576dfc7dacf716fbe6d"
 BR2_OPENPOWER_MACHINE_XML_FILENAME="zaius.xml"
 BR2_OPENPOWER_SYSTEM_XML_FILENAME="ZAIUS_hb.system.xml"
 BR2_OPENPOWER_MRW_XML_FILENAME="ZAIUS_hb.mrw.xml"
diff --git a/openpower/package/hostboot-binaries/hostboot_binaries.mk b/openpower/package/hostboot-binaries/hostboot_binaries.mk
index ebf63a6..8c0623b 100644
--- a/openpower/package/hostboot-binaries/hostboot_binaries.mk
+++ b/openpower/package/hostboot-binaries/hostboot_binaries.mk
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-HOSTBOOT_BINARIES_VERSION ?= 711147ef9f2316ff363b01a787a2bcdf069de590
+HOSTBOOT_BINARIES_VERSION ?= 0e2ad153c4586ffe371920ebc1a2b40e56891980
 HOSTBOOT_BINARIES_SITE ?= $(call github,open-power,hostboot-binaries,$(HOSTBOOT_BINARIES_VERSION))
 
 HOSTBOOT_BINARIES_LICENSE = Apache-2.0
diff --git a/openpower/package/hostboot/hostboot.mk b/openpower/package/hostboot/hostboot.mk
index 0902fc4..85644bd 100644
--- a/openpower/package/hostboot/hostboot.mk
+++ b/openpower/package/hostboot/hostboot.mk
@@ -4,7 +4,7 @@
 #
 ################################################################################
 HOSTBOOT_VERSION_BRANCH_MASTER_P8 ?= 695bd891343faf1f0ef85fe53148590e58239efd
-HOSTBOOT_VERSION_BRANCH_MASTER ?= 31d097409bd233008676e4779c9e6a7582e8156f
+HOSTBOOT_VERSION_BRANCH_MASTER ?= f5764021911276721062635a57cdd1c206084390
 
 HOSTBOOT_VERSION ?= $(if $(BR2_OPENPOWER_POWER9),$(HOSTBOOT_VERSION_BRANCH_MASTER),$(HOSTBOOT_VERSION_BRANCH_MASTER_P8))
 HOSTBOOT_SITE ?= $(call github,open-power,hostboot,$(HOSTBOOT_VERSION))
diff --git a/openpower/package/hostboot/p9Patches/hostboot-0001-Increase-uart-delay.patch b/openpower/package/hostboot/p9Patches/hostboot-0001-Increase-uart-delay.patch
deleted file mode 120000
index 10137ed..0000000
--- a/openpower/package/hostboot/p9Patches/hostboot-0001-Increase-uart-delay.patch
+++ /dev/null
@@ -1 +0,0 @@
-../p8Patches/hostboot-0001-Increase-uart-delay.patch
\ No newline at end of file
diff --git a/openpower/package/hostboot/p9Patches/hostboot-0002-kernel-Update-assembly-for-modern-binutils.patch b/openpower/package/hostboot/p9Patches/hostboot-0002-kernel-Update-assembly-for-modern-binutils.patch
deleted file mode 100644
index 28b9dc5..0000000
--- a/openpower/package/hostboot/p9Patches/hostboot-0002-kernel-Update-assembly-for-modern-binutils.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-From a74562d710c07c1dd2e510fd2c9c259f1f72e4ce Mon Sep 17 00:00:00 2001
-From: Joel Stanley <joel.stanley@au1.ibm.com>
-Date: Tue, 27 Jun 2017 18:00:09 +0930
-Subject: [PATCH] kernel: Update assembly for modern binutils
-
-From Linux 80f23935cadb ("powerpc: Convert cmp to cmpd in idle enter sequence"):
-
-  PowerPC's "cmp" instruction has four operands. Normally people write
-  "cmpw" or "cmpd" for the second cmp operand 0 or 1. But, frequently
-  people forget, and write "cmp" with just three operands.
-
-  With older binutils this is silently accepted as if this was "cmpw",
-  while often "cmpd" is wanted. With newer binutils GAS will complain
-  about this for 64-bit code. For 32-bit code it still silently assumes
-  "cmpw" is what is meant.
-
-The first two instances are dealing with SPRs, which are 32-bit, so cmpw is correct.
-
-It is not clear what to do in the third use of cmp, but given old toolchains
-have generated cmpw lets assume that we should maintain the behaviour.
-
-Change-Id: Iee5dd5903dcd7ac4028bab0176e08ce3db23b2d5
-Signed-off-by: Joel Stanley <joel.stanley@au1.ibm.com>
----
- src/kernel/shutdown.S | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/src/kernel/shutdown.S b/src/kernel/shutdown.S
-index b3c47725ae79..0c42a19cfbfe 100644
---- a/src/kernel/shutdown.S
-+++ b/src/kernel/shutdown.S
-@@ -5,7 +5,7 @@
- #
- # OpenPOWER HostBoot Project
- #
--# Contributors Listed Below - COPYRIGHT 2012,2016
-+# Contributors Listed Below - COPYRIGHT 2012,2017
- # [+] International Business Machines Corp.
- #
- #
-@@ -94,7 +94,7 @@ kernel_shutdown_ea0_1_mode:
-         ;// as it was the one that updated the cpu_count & lowest_pir
-         ;// barrier - 1 wait for all nodes to report
-     mfspr  r10, PIR
--    cmp    cr0, r10, r7
-+    cmpw    cr0, r10, r7
-     bne+ 2f       ;// inside KERNEL_BARRIER below
- 
-         ;// Perform barrier - 1
-@@ -132,7 +132,7 @@ kernel_shutdown_ea0_1_mode:
-     addi r8, r8, 8
-             ;// Check for PIR == r7.
-     mfspr r10, PIR
--    cmp cr0, r10, r7
-+    cmpw cr0, r10, r7
-     beq 3f
-         ;// Increment thread count.
- 1:
-@@ -165,7 +165,7 @@ kernel_shutdown_ea0_1_mode:
- 1:
-     or 1,1,1
-     ld r11, 0(r8)
--    cmp cr0, r3, r11
-+    cmpw cr0, r3, r11
-     bne+ 1b
-     isync
-         ;// All other threads have left, so wait a little bit...
--- 
-2.13.1
-
diff --git a/openpower/package/hostboot/p9Patches/hostboot-1001-PM-HOMER-Header-Magic-word-change.patch b/openpower/package/hostboot/p9Patches/hostboot-1001-PM-HOMER-Header-Magic-word-change.patch
new file mode 100644
index 0000000..49e1de3
--- /dev/null
+++ b/openpower/package/hostboot/p9Patches/hostboot-1001-PM-HOMER-Header-Magic-word-change.patch
@@ -0,0 +1,83 @@
+From 6707528059ba2b13b6ab78c1ed12d99ecd3fa69c Mon Sep 17 00:00:00 2001
+From: Prem Shanker Jha <premjha2@in.ibm.com>
+Date: Fri, 23 Jun 2017 10:42:53 -0500
+Subject: [PATCH v1 1001/1002] PM: HOMER Header Magic word change.
+
+Commit restores the magic words of CPMR, QPMR and PPMR region to
+CPMR_1.0, QPMR_1.0 and PPMR_1.0 respectively. It dissociates it
+with EC level.
+
+Change-Id: I4a5a40f0d766eb80eaba09fb216b93ae54d0219e
+Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/42366
+Reviewed-by: Gregory S. Still <stillgs@us.ibm.com>
+Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
+Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
+Reviewed-by: RAHUL BATRA <rbatra@us.ibm.com>
+Reviewed-by: Jennifer A Stofer <stofer@us.ibm.com>
+---
+ .../p9/procedures/hwp/pm/p9_hcode_image_build.C    | 32 ++++++++++------------
+ 1 file changed, 14 insertions(+), 18 deletions(-)
+
+diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_hcode_image_build.C b/src/import/chips/p9/procedures/hwp/pm/p9_hcode_image_build.C
+index 8957295..4ddb140 100644
+--- a/src/import/chips/p9/procedures/hwp/pm/p9_hcode_image_build.C
++++ b/src/import/chips/p9/procedures/hwp/pm/p9_hcode_image_build.C
+@@ -134,6 +134,7 @@ enum
+     L3_EPS_DIVIDER              =   1,
+     L2_EPS_DIVIDER              =   1,
+     MAX_HOMER_HEADER            =   6,
++    MAX_PM_REGION_HEADER        =   3,
+ };
+ 
+ /**
+@@ -3789,34 +3790,29 @@ void customizeMagicWord( Homerlayout_t*     i_pHomer, uint8_t i_ecLevel )
+     uint64_t magicWordCustom[MAX_HOMER_HEADER];
+     uint64_t * pMagicWord[MAX_HOMER_HEADER];
+     pMagicWord[0]   =   &pQpmrHdr->magic_number;
+-    pMagicWord[1]   =   &pSgpeImgHdr->g_sgpe_magic_number;
+-    pMagicWord[2]   =   &pCpmrHdr->magic_number;
+-    pMagicWord[3]   =   &pCmeHdr->g_cme_magic_number;
+-    pMagicWord[4]   =   &pPpmrHdr->g_ppmr_magic_number;
++    pMagicWord[1]   =   &pCpmrHdr->magic_number;
++    pMagicWord[2]   =   &pPpmrHdr->g_ppmr_magic_number;
++    pMagicWord[3]   =   &pSgpeImgHdr->g_sgpe_magic_number;
++    pMagicWord[4]   =   &pCmeHdr->g_cme_magic_number;
+     pMagicWord[5]   =   &pPgpeHdr->g_pgpe_magic_number;
+ 
+-    magicWordCustom[0]  =  QPMR_MAGIC_NUMBER_BASE;
+-    magicWordCustom[1]  =  SGPE_MAGIC_NUMBER_BASE;
+-    magicWordCustom[2]  =  CPMR_MAGIC_NUMBER_BASE;
+-    magicWordCustom[3]  =  CME_MAGIC_NUMBER_BASE;
+-    magicWordCustom[4]  =  PPMR_MAGIC_NUMBER_BASE;
+-    magicWordCustom[5]  =  PGPE_MAGIC_NUMBER_BASE;
++    magicWordCustom[0]  =  QPMR_MAGIC_NUMBER;
++    magicWordCustom[1]  =  CPMR_MAGIC_NUMBER;
++    magicWordCustom[2]  =  PPMR_MAGIC_NUMBER;
++    magicWordCustom[3]  =  SGPE_MAGIC_NUMBER;
++    magicWordCustom[4]  =  CME_MAGIC_NUMBER;
++    magicWordCustom[5]  =  PGPE_MAGIC_NUMBER;
+ 
+-    uint32_t ecMajor = (i_ecLevel & 0xf0 );
+-    ecMajor = ecMajor << 12;
+-    uint8_t ecMinor = (i_ecLevel & 0x0f);
+ 
+     FAPI_INF("=========== Header Magic Words Info ===========");
+ 
+     for( uint32_t i = 0; i < MAX_HOMER_HEADER; i++ )
+     {
+-        char magicWord[MAX_HOMER_HEADER][20] = { "QPMR Magic Word ", "SGPE Magic Word ", "CPMR Magic Word ",
+-                                        "CME Magic Word ", "PPMR Magic Word ", "PGPE Magic Word " };
++        char magicWord[MAX_HOMER_HEADER][20] = { "QPMR Magic Word ", "CPMR Magic Word ", "PPMR Magic Word ",
++                                                 "SGPE Magic Word ", "CME Magic Word ", "PGPE Magic Word " };
+         char tempBuf[10] ;
+         memset( tempBuf, 0x00, 10 );
+-        magicWordCustom[i] += ecMinor;
+-        magicWordCustom[i] += ecMajor;
+-        *pMagicWord[i]     = SWIZZLE_8_BYTE( magicWordCustom[i]);
++        *pMagicWord[i]     =    SWIZZLE_8_BYTE( magicWordCustom[i] );
+         memcpy( tempBuf, pMagicWord[i], sizeof(uint64_t) );
+         FAPI_INF("%s\t\t:\t\t %s ( 0x%016lx ) ", &magicWord[i], tempBuf, SWIZZLE_8_BYTE(*pMagicWord[i]) );
+     }
+-- 
+1.8.2.2
+
diff --git a/openpower/package/hostboot/p9Patches/hostboot-1002-PM-set-PGPE-and-SGPE-Timer-Select.patch b/openpower/package/hostboot/p9Patches/hostboot-1002-PM-set-PGPE-and-SGPE-Timer-Select.patch
new file mode 100644
index 0000000..8cedc71
--- /dev/null
+++ b/openpower/package/hostboot/p9Patches/hostboot-1002-PM-set-PGPE-and-SGPE-Timer-Select.patch
@@ -0,0 +1,67 @@
+From 72976d2d7f3a303830a41cf282260be09260bcfc Mon Sep 17 00:00:00 2001
+From: Greg Still <stillgs@us.ibm.com>
+Date: Tue, 27 Jun 2017 09:26:41 -0500
+Subject: [PATCH v1 1002/1002] PM: set PGPE and SGPE Timer Select
+
+- Writes fixed values for FIT and watchdog timers on both engines
+- Needed for DD2 as DD1 was done with initfile settings
+- Will work for either DD level
+
+Change-Id: I8fa0a5a20091016e4210b7c81b0297bded7ade62
+Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/42496
+Reviewed-by: RAHUL BATRA <rbatra@us.ibm.com>
+Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
+Reviewed-by: Michael S. Floyd <mfloyd@us.ibm.com>
+Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
+Reviewed-by: Jennifer A Stofer <stofer@us.ibm.com>
+
+Conflicts:
+	src/import/chips/p9/procedures/hwp/pm/p9_pm_pstate_gpe_init.C
+---
+ src/import/chips/p9/procedures/hwp/pm/p9_pm_pstate_gpe_init.C | 10 ++++++++++
+ src/import/chips/p9/procedures/hwp/pm/p9_pm_stop_gpe_init.C   |  8 ++++++++
+ 2 files changed, 18 insertions(+)
+
+diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_pm_pstate_gpe_init.C b/src/import/chips/p9/procedures/hwp/pm/p9_pm_pstate_gpe_init.C
+index bdf8f74..1ca2772 100644
+--- a/src/import/chips/p9/procedures/hwp/pm/p9_pm_pstate_gpe_init.C
++++ b/src/import/chips/p9/procedures/hwp/pm/p9_pm_pstate_gpe_init.C
+@@ -113,6 +113,16 @@ fapi2::ReturnCode pstate_gpe_init(
+ 
+     FAPI_TRY(putScom(i_target, PU_OCB_OCI_OCCS2_SCOM, l_occ_scratch2));
+ 
++    // Setup the PGPE Timer Selects
++    // These hardcoded values are assumed by the PGPE Hcode for setting up
++    // the FIT and Watchdog values a based on the nest frequency that is
++    // passed to it via the PGPE header.
++    l_data64.flush<0>()
++      .insertFromRight<0, 4>(0x1)    // Watchdog
++    .insertFromRight<4, 4>(0xA);   // FIT
++    FAPI_TRY(fapi2::putScom(i_target, PU_GPE2_GPETSEL_SCOM, l_data64));
++
++
+     // Program XCR to ACTIVATE PGPE
+     // @todo RTC 146665 Operations to PPEs should use a p9ppe namespace
+     FAPI_INF("   Starting the PGPE...");
+diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_pm_stop_gpe_init.C b/src/import/chips/p9/procedures/hwp/pm/p9_pm_stop_gpe_init.C
+index 5e05fcb..0829556 100644
+--- a/src/import/chips/p9/procedures/hwp/pm/p9_pm_stop_gpe_init.C
++++ b/src/import/chips/p9/procedures/hwp/pm/p9_pm_stop_gpe_init.C
+@@ -282,6 +282,14 @@ fapi2::ReturnCode p9_pm_stop_gpe_init(
+             }
+         }
+ 
++        // Setup the SGPE Timer Selects
++        // These hardcoded values are assumed by the SGPE Hcode for setting up
++        // the FIT and Watchdog values.
++        l_data64.flush<0>()
++        .insertFromRight<0, 4>(0x1)     // Watchdog
++        .insertFromRight<4, 4>(0xA);    // FIT
++        FAPI_TRY(fapi2::putScom(i_target, PU_GPE3_GPETSEL_SCOM, l_data64));
++
+         // Boot the STOP GPE
+         FAPI_TRY(stop_gpe_init(i_target), "ERROR: failed to initialize Stop GPE");
+ 
+-- 
+1.8.2.2
+
diff --git a/openpower/package/occ/occ.mk b/openpower/package/occ/occ.mk
index fb62b71..f076aad 100644
--- a/openpower/package/occ/occ.mk
+++ b/openpower/package/occ/occ.mk
@@ -5,7 +5,7 @@
 ################################################################################
 
 OCC_VERSION_BRANCH_MASTER_P8 ?= 28f2cec690b7f19548ce860a8820f519e6c39a6a
-OCC_VERSION_BRANCH_MASTER ?= 1dc97a688e32e63420533bfde8c6d7d2996619ea
+OCC_VERSION_BRANCH_MASTER ?= 7adb49aeec6971ff0f3656a73829a793907f5567
 
 OCC_VERSION ?= $(if $(BR2_OPENPOWER_POWER9),$(OCC_VERSION_BRANCH_MASTER),$(OCC_VERSION_BRANCH_MASTER_P8))
 OCC_SITE ?= $(call github,open-power,occ,$(OCC_VERSION))
diff --git a/openpower/package/openpower-pnor/openpower-pnor.mk b/openpower/package/openpower-pnor/openpower-pnor.mk
index 7164ea5..6a76165 100644
--- a/openpower/package/openpower-pnor/openpower-pnor.mk
+++ b/openpower/package/openpower-pnor/openpower-pnor.mk
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-OPENPOWER_PNOR_VERSION ?= 2da7a68536f4552aff23e55d7bcfc81f04c07028
+OPENPOWER_PNOR_VERSION ?= 660174c2c376cec27ab08893a488febb5b058a61
 OPENPOWER_PNOR_SITE ?= $(call github,open-power,pnor,$(OPENPOWER_PNOR_VERSION))
 
 OPENPOWER_PNOR_LICENSE = Apache-2.0
diff --git a/openpower/package/sbe/sbe.mk b/openpower/package/sbe/sbe.mk
index d4063d3..5d82c66 100644
--- a/openpower/package/sbe/sbe.mk
+++ b/openpower/package/sbe/sbe.mk
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-SBE_VERSION ?= 0df81aac2c132f2663b2721842dc73235f90071a
+SBE_VERSION ?= 02021c69d7d55b09718050265a1813d7806c0f01
 SBE_SITE ?= $(call github,open-power,sbe,$(SBE_VERSION))
 
 SBE_LICENSE = Apache-2.0