Merge pull request #211 from stewart-ibm/update-skiboot-5.1.0-beta1

Bump skiboot to skiboot-5.1.0-beta1 for op-build v1.6
diff --git a/openpower/configs/firestone_defconfig b/openpower/configs/firestone_defconfig
index cd32a2c..45e6787 100644
--- a/openpower/configs/firestone_defconfig
+++ b/openpower/configs/firestone_defconfig
@@ -1,7 +1,12 @@
-BR2_powerpc64=y
+BR2_powerpc64le=y
 BR2_powerpc_power8=y
 BR2_OPENPOWER_PLATFORM=y
 
+BR2_BINUTILS_EXTRA_CONFIG_OPTIONS="--enable-targets=powerpc64-linux"
+BR2_EXTRA_GCC_CONFIG_OPTIONS="--enable-targets=powerpc64-linux"
+BR2_TOOLCHAIN_BUILDROOT_CXX=y
+# BR2_TOOLCHAIN_BUILDROOT_LIBSTDCPP is not set
+
 BR2_OPENPOWER_CONFIG_NAME="firestone"
 BR2_OPENPOWER_XML_PACKAGE="firestone-xml"
 BR2_HOSTBOOT_CONFIG_FILE="firestone.config"
diff --git a/openpower/configs/garrison_defconfig b/openpower/configs/garrison_defconfig
index c5bde78..3069ac7 100644
--- a/openpower/configs/garrison_defconfig
+++ b/openpower/configs/garrison_defconfig
@@ -1,7 +1,10 @@
-BR2_powerpc64=y
+BR2_powerpc64le=y
 BR2_powerpc_power8=y
 BR2_OPENPOWER_PLATFORM=y
 
+BR2_BINUTILS_EXTRA_CONFIG_OPTIONS="--enable-targets=powerpc64-linux"
+BR2_EXTRA_GCC_CONFIG_OPTIONS="--enable-targets=powerpc64-linux"
+
 BR2_OPENPOWER_CONFIG_NAME="garrison"
 BR2_OPENPOWER_XML_PACKAGE="garrison-xml"
 BR2_HOSTBOOT_CONFIG_FILE="garrison.config"
diff --git a/openpower/configs/habanero_defconfig b/openpower/configs/habanero_defconfig
index edcad58..14c10ae 100644
--- a/openpower/configs/habanero_defconfig
+++ b/openpower/configs/habanero_defconfig
@@ -1,7 +1,12 @@
-BR2_powerpc64=y
+BR2_powerpc64le=y
 BR2_powerpc_power8=y
 BR2_OPENPOWER_PLATFORM=y
 
+BR2_BINUTILS_EXTRA_CONFIG_OPTIONS="--enable-targets=powerpc64-linux"
+BR2_EXTRA_GCC_CONFIG_OPTIONS="--enable-targets=powerpc64-linux"
+BR2_TOOLCHAIN_BUILDROOT_CXX=y
+# BR2_TOOLCHAIN_BUILDROOT_LIBSTDCPP is not set
+
 BR2_OPENPOWER_CONFIG_NAME="habanero"
 BR2_OPENPOWER_XML_PACKAGE="habanero-xml"
 BR2_HOSTBOOT_CONFIG_FILE="habanero.config"
diff --git a/openpower/configs/linux/skiroot_defconfig b/openpower/configs/linux/skiroot_defconfig
index 78a02c0..648de48 100644
--- a/openpower/configs/linux/skiroot_defconfig
+++ b/openpower/configs/linux/skiroot_defconfig
@@ -3,6 +3,7 @@
 CONFIG_VSX=y
 CONFIG_SMP=y
 CONFIG_NR_CPUS=2048
+CONFIG_CPU_LITTLE_ENDIAN=y
 # CONFIG_SWAP is not set
 CONFIG_SYSVIPC=y
 CONFIG_POSIX_MQUEUE=y
diff --git a/openpower/configs/openpower_mambo_defconfig b/openpower/configs/openpower_mambo_defconfig
index 6c61fa5..12c8308 100644
--- a/openpower/configs/openpower_mambo_defconfig
+++ b/openpower/configs/openpower_mambo_defconfig
@@ -1,7 +1,10 @@
-BR2_powerpc64=y
+BR2_powerpc64le=y
 BR2_powerpc_power8=y
 BR2_OPENPOWER_PLATFORM=y
 
+BR2_BINUTILS_EXTRA_CONFIG_OPTIONS="--enable-targets=powerpc64-linux"
+BR2_EXTRA_GCC_CONFIG_OPTIONS="--enable-targets=powerpc64-linux"
+
 # No HostBoot for Mambo
 BR2_PACKAGE_HOSTBOOT=n
 BR2_PACKAGE_HOSTBOOT_BINARIES=n
@@ -28,7 +31,7 @@
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_GIT=y
 BR2_LINUX_KERNEL_CUSTOM_REPO_URL="git://github.com/open-power/linux.git"
-BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="dc97a6e626eaf22c9bd4baec3954fa5501ce1c63"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="d0ff068a9962ba96d4e6ddfba2a4e9fd8bc9a763"
 BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
 BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL)/configs/linux/skiroot_defconfig"
 BR2_LINUX_KERNEL_ZIMAGE_EPAPR=y
diff --git a/openpower/configs/palmetto_defconfig b/openpower/configs/palmetto_defconfig
index b589463..1468fe8 100644
--- a/openpower/configs/palmetto_defconfig
+++ b/openpower/configs/palmetto_defconfig
@@ -1,7 +1,12 @@
-BR2_powerpc64=y
+BR2_powerpc64le=y
 BR2_powerpc_power8=y
 BR2_OPENPOWER_PLATFORM=y
 
+BR2_BINUTILS_EXTRA_CONFIG_OPTIONS="--enable-targets=powerpc64-linux"
+BR2_EXTRA_GCC_CONFIG_OPTIONS="--enable-targets=powerpc64-linux"
+BR2_TOOLCHAIN_BUILDROOT_CXX=y
+# BR2_TOOLCHAIN_BUILDROOT_LIBSTDCPP is not set
+
 BR2_OPENPOWER_CONFIG_NAME="palmetto"
 BR2_OPENPOWER_XML_PACKAGE="palmetto-xml"
 BR2_HOSTBOOT_CONFIG_FILE="palmetto.config"
diff --git a/openpower/package/firestone-xml/firestone.mk b/openpower/package/firestone-xml/firestone.mk
index 66622f7..68e6347 100644
--- a/openpower/package/firestone-xml/firestone.mk
+++ b/openpower/package/firestone-xml/firestone.mk
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-FIRESTONE_XML_VERSION ?= 44d46e5f009b51fd65594c0efe6bb4f2380d11b1
+FIRESTONE_XML_VERSION ?= 7ac1ae80d0f965d39bdee944f89ed5a118d2adc2
 FIRESTONE_XML_SITE ?= $(call github,open-power,firestone-xml,$(FIRESTONE_XML_VERSION))
 
 FIRESTONE_XML_LICENSE = Apache-2.0
diff --git a/openpower/package/garrison-xml/garrison.mk b/openpower/package/garrison-xml/garrison.mk
index 6781be9..688bc6f 100644
--- a/openpower/package/garrison-xml/garrison.mk
+++ b/openpower/package/garrison-xml/garrison.mk
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-GARRISON_XML_VERSION ?= 26d3a993c0aeadcb68afe52b5f3a04a95c0d252b
+GARRISON_XML_VERSION ?= 835c3467a37773205960d7b0150a3c360972e178
 GARRISON_XML_SITE ?= $(call github,open-power,garrison-xml,$(GARRISON_XML_VERSION))
 
 GARRISON_XML_LICENSE = Apache-2.0
diff --git a/openpower/package/hostboot/hostboot-0006-Change-the-way-we-handle-response-to-chassis-power-c.patch b/openpower/package/hostboot/hostboot-0006-Change-the-way-we-handle-response-to-chassis-power-c.patch
new file mode 100644
index 0000000..92b80d1
--- /dev/null
+++ b/openpower/package/hostboot/hostboot-0006-Change-the-way-we-handle-response-to-chassis-power-c.patch
@@ -0,0 +1,82 @@
+From 547e3794064bc372e8d10a371bb9e305c89b8f8f Mon Sep 17 00:00:00 2001
+From: Matt Ploetz <maploetz@us.ibm.com>
+Date: Fri, 17 Jul 2015 11:55:19 -0500
+Subject: [PATCH] Change the way we handle response to chassis power cycle
+
+Change-Id: I7cb62670fe4b1ce900d0bd2a03061248d5123cc0
+RTC:131615
+Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/19148
+Tested-by: Jenkins Server
+Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
+---
+ src/include/usr/ipmi/ipmiif.H |  1 +
+ src/usr/ipmi/ipmibt.C         | 11 ++++++++++-
+ src/usr/ipmi/ipmirp.C         |  8 ++++----
+ 3 files changed, 15 insertions(+), 5 deletions(-)
+
+diff --git a/src/include/usr/ipmi/ipmiif.H b/src/include/usr/ipmi/ipmiif.H
+index 26ffba3..fa13c32 100644
+--- a/src/include/usr/ipmi/ipmiif.H
++++ b/src/include/usr/ipmi/ipmiif.H
+@@ -62,6 +62,7 @@ namespace IPMI
+         CHASSIS_POWER_OFF = 0x00,
+         CHASSIS_POWER_SOFT_RESET = 0x01,
+         CHASSIS_POWER_CYCLE = 0x02,
++        CHASSIS_POWER_RESET = 0x03,
+     };
+ 
+     // Used in the factory for creating the proper subclass.
+diff --git a/src/usr/ipmi/ipmibt.C b/src/usr/ipmi/ipmibt.C
+index 7c68cdc..42a26e0 100644
+--- a/src/usr/ipmi/ipmibt.C
++++ b/src/usr/ipmi/ipmibt.C
+@@ -317,6 +317,15 @@ namespace IPMI
+                           "completion code %x",
+                           iv_netfun, iv_cmd, iv_seq, iv_cc);
+ 
++                if (iv_cc == IPMI::CC_CMDSPC1)
++                {
++                    // We got a completion code with 0x80, which is no data
++                    // Let's trace the event, but not log an error.
++                    IPMI_TRAC(ERR_MRK "SEL returned with no data, not logging "
++                              "an error");
++                    break;
++                }
++
+                 /* @errorlog tag
+                  * @errortype       ERRL_SEV_INFORMATIONAL
+                  * @moduleid        IPMI::MOD_IPMISRV_REPLY
+@@ -338,7 +347,7 @@ namespace IPMI
+                 errlCommit(err, IPMI_COMP_ID);
+                 break;
+             }
+-
++ 
+             // Before we self destruct, we need to turn the data collected in to
+             // a record we can pass to the waiting event handler.
+             Singleton<IpmiRP>::instance().postEvent(new IPMI::oemSEL(iv_data));
+diff --git a/src/usr/ipmi/ipmirp.C b/src/usr/ipmi/ipmirp.C
+index 9b69991..9a9b506 100644
+--- a/src/usr/ipmi/ipmirp.C
++++ b/src/usr/ipmi/ipmirp.C
+@@ -438,13 +438,13 @@ void IpmiRP::handlePowerMessage( IPMI::oemSEL* i_event )
+ #endif
+ 
+         }
+-        // If the event type is a power soft reset aka power cycle
++        // If the event type is a power soft reset, send a chasis reset
+         // update the modifier to send to the BMC
+         else if( i_event->iv_cmd[1] == IPMI::CHASSIS_POWER_SOFT_RESET )
+         {
+-            // handle the message as a power cycle request
+-            IPMI_TRAC("IPMI power cycle request received");
+-            iv_chassis_power_mod = IPMI::CHASSIS_POWER_CYCLE;
++            // handle the message as a power reset request
++            IPMI_TRAC("IPMI power reset request received");
++            iv_chassis_power_mod = IPMI::CHASSIS_POWER_RESET;
+ #ifdef CONFIG_CONSOLE
+             CONSOLE::displayf(NULL, "IPMI: power cycle requested");
+             CONSOLE::flush();
+-- 
+2.4.4
+
diff --git a/openpower/package/hostboot/hostboot-0007-console-ast2400-Fix-SIO-address-for-SUART-configurat.patch b/openpower/package/hostboot/hostboot-0007-console-ast2400-Fix-SIO-address-for-SUART-configurat.patch
new file mode 100644
index 0000000..3e647b6
--- /dev/null
+++ b/openpower/package/hostboot/hostboot-0007-console-ast2400-Fix-SIO-address-for-SUART-configurat.patch
@@ -0,0 +1,38 @@
+From 5d1ff7656b2b1b8e50d9f30b180ff3e10b3adf3e Mon Sep 17 00:00:00 2001
+From: Jeremy Kerr <jk@ozlabs.org>
+Date: Mon, 6 Jul 2015 17:58:24 +0800
+Subject: [PATCH 1/3] console/ast2400: Fix SIO address for SUART configuration
+
+The SUART1 base address is at 60 hex, not 60 decimal.
+
+Luckily, we've been setting it (from g_uartBase) to the default value
+of 0xf8.
+
+Change-Id: If6e6a095871bee5b55355590a28087ccc2a6bf62
+Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
+Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/18941
+Tested-by: Jenkins Server
+Tested-by: Jenkins OP Build CI
+Tested-by: Jenkins OP HW
+Reviewed-by: Richard J. Knight <rjknight@us.ibm.com>
+Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
+---
+ src/usr/console/ast2400.C | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/usr/console/ast2400.C b/src/usr/console/ast2400.C
+index b2b63c3..c463dcd 100644
+--- a/src/usr/console/ast2400.C
++++ b/src/usr/console/ast2400.C
+@@ -242,7 +242,7 @@ namespace CONSOLE
+                 l_errl = writeSIOReg( 0x60, (g_uartBase >> 8) & 0xFF );
+                 if (l_errl) { break; }
+ 
+-                l_errl = writeSIOReg( 61, (g_uartBase & 0xFF) );
++                l_errl = writeSIOReg( 0x61, (g_uartBase & 0xFF) );
+                 if (l_errl) { break; }
+ 
+                 // Set the SerIRQ
+-- 
+2.4.4
+
diff --git a/openpower/package/hostboot/hostboot-0008-console-ast2400-Fix-swapped-address-value-writes-in-.patch b/openpower/package/hostboot/hostboot-0008-console-ast2400-Fix-swapped-address-value-writes-in-.patch
new file mode 100644
index 0000000..180f326
--- /dev/null
+++ b/openpower/package/hostboot/hostboot-0008-console-ast2400-Fix-swapped-address-value-writes-in-.patch
@@ -0,0 +1,38 @@
+From 8de824a15fe9d97fc169b262c884e09f6e59912a Mon Sep 17 00:00:00 2001
+From: Jeremy Kerr <jk@ozlabs.org>
+Date: Wed, 8 Jul 2015 15:59:40 +0800
+Subject: [PATCH 3/3] console/ast2400: Fix swapped address/value writes in
+ writeSIOReg
+
+We need to write the address to 0x2e, and the data to 0x2f.
+
+Change-Id: I1271a134c19d921fa1ee54b5f0d1c0e092df9e2b
+Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
+Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/19146
+Tested-by: Jenkins Server
+Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
+---
+ src/usr/console/ast2400.C | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/usr/console/ast2400.C b/src/usr/console/ast2400.C
+index c463dcd..243c9be 100644
+--- a/src/usr/console/ast2400.C
++++ b/src/usr/console/ast2400.C
+@@ -83,11 +83,11 @@ namespace CONSOLE
+ 
+             do{
+ 
+-                l_err = _writeReg( SIO_ADDR_REG_2E, i_data );
++                l_err = _writeReg( SIO_ADDR_REG_2E, i_reg );
+ 
+                 if(l_err) { break; }
+ 
+-                l_err = _writeReg( SIO_DATA_REG_2F, i_reg );
++                l_err = _writeReg( SIO_DATA_REG_2F, i_data );
+ 
+             }while(0);
+ 
+-- 
+2.4.4
+
diff --git a/openpower/package/skiboot/skiboot-0002-libflash-Provide-an-internal-parity-implementation-t.patch b/openpower/package/skiboot/skiboot-0002-libflash-Provide-an-internal-parity-implementation-t.patch
new file mode 100644
index 0000000..e377567
--- /dev/null
+++ b/openpower/package/skiboot/skiboot-0002-libflash-Provide-an-internal-parity-implementation-t.patch
@@ -0,0 +1,87 @@
+From de70ad43ccee4dd51e9d38325c7713f590323a47 Mon Sep 17 00:00:00 2001
+From: Jeremy Kerr <jk@ozlabs.org>
+Date: Mon, 23 Feb 2015 16:43:53 +0800
+Subject: [PATCH] libflash: Provide an internal parity implementation, to
+ remove libgcc dependency
+
+In commit 8f5b8616, we introduced a dependency on libgcc, for the
+__builtin_parityl() function in commit 6cfaa3ba.
+
+However, if we're building with a biarch compiler, we may not have a
+libgcc available.
+
+This commit removes the __builtin_parityl() call, and replaces with the
+equivalent instructions, and removes the dependency on libgcc.
+
+Although this is untested, I have confirmed that the __builtin_parityl()
+functions emits the same instructions (on power7 and power8, with
+gcc-4.9) as we're using in the parity() function.
+
+Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
+---
+ Makefile.main  |  5 ++---
+ libflash/ecc.c | 14 +++++++++++++-
+ 2 files changed, 15 insertions(+), 4 deletions(-)
+
+diff --git a/Makefile.main b/Makefile.main
+index 665baf4..b5376fc 100644
+--- a/Makefile.main
++++ b/Makefile.main
+@@ -120,7 +120,6 @@ OBJS += $(LIBPORE)
+ endif
+ OBJS += $(LIBC) $(CCAN) $(DEVSRC_OBJ)
+ OBJS_NO_VER = $(OBJS)
+-EXTRA_LIBS = -Wl,-lgcc
+ ALL_OBJS = $(OBJS) version.o
+ 
+ ALL_OBJS_1 = $(ALL_OBJS) asm/dummy_map.o
+@@ -130,12 +129,12 @@ $(TARGET).lid: $(TARGET).elf
+ 	$(call Q,OBJCOPY, $(OBJCOPY) -O binary -S $^ $@, $@)
+ 
+ $(TARGET).tmp.elf: $(ALL_OBJS_1) $(TARGET).lds $(KERNEL)
+-	$(call Q,LD, $(CC) $(LDFLAGS) -T $(TARGET).lds $(ALL_OBJS_1) $(EXTRA_LIBS) -o $@, $@)
++	$(call Q,LD, $(CC) $(LDFLAGS) -T $(TARGET).lds $(ALL_OBJS_1) -o $@, $@)
+ 
+ asm/real_map.o : $(TARGET).tmp.map
+ 
+ $(TARGET).elf: $(ALL_OBJS_2) $(TARGET).lds $(KERNEL)
+-	$(call Q,LD, $(CC) $(LDFLAGS) -T $(TARGET).lds $(ALL_OBJS_2) $(EXTRA_LIBS) -o $@, $@)
++	$(call Q,LD, $(CC) $(LDFLAGS) -T $(TARGET).lds $(ALL_OBJS_2) -o $@, $@)
+ 
+ $(SUBDIRS):
+ 	$(call Q,MKDIR,mkdir $@, $@)
+diff --git a/libflash/ecc.c b/libflash/ecc.c
+index 9293743..3d94594 100644
+--- a/libflash/ecc.c
++++ b/libflash/ecc.c
+@@ -88,6 +88,18 @@ static uint8_t syndromematrix[] = {
+         UE, UE, UE, UE,  4, UE, UE, UE, UE, UE, UE, UE, UE, UE, UE, UE,
+ };
+ 
++static uint8_t parity(uint64_t data)
++{
++	uint8_t p;
++
++	asm volatile(
++		"popcntb %1,%0\n"
++		"prtyd   %1,%1\n"
++		: "=r"(p) : "r"(data));
++
++	return p;
++}
++
+ /**
+  * Create the ECC field corresponding to a 8-byte data field
+  *
+@@ -100,7 +112,7 @@ static uint8_t eccgenerate(uint64_t data)
+ 	uint8_t result = 0;
+ 
+ 	for (i = 0; i < 8; i++)
+-		result |= __builtin_parityl(eccmatrix[i] & data) << i;
++		result |= parity(eccmatrix[i] & data) << i;
+ 
+ 	return result;
+ }
+-- 
+1.9.1
+
diff --git a/openpower/package/skiboot/skiboot-0003-Makefile-specify-abiv1.patch b/openpower/package/skiboot/skiboot-0003-Makefile-specify-abiv1.patch
new file mode 100644
index 0000000..e689436
--- /dev/null
+++ b/openpower/package/skiboot/skiboot-0003-Makefile-specify-abiv1.patch
@@ -0,0 +1,27 @@
+From 11bff93ad1ca613b1db9d96e9ea9c46b7d7bf48d Mon Sep 17 00:00:00 2001
+From: Jeremy Kerr <jk@ozlabs.org>
+Date: Thu, 5 Mar 2015 22:44:40 +1100
+Subject: [PATCH] Makefile: specify abiv1
+
+Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
+---
+ Makefile.main | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile.main b/Makefile.main
+index 3c67037..76f0bd3 100644
+--- a/Makefile.main
++++ b/Makefile.main
+@@ -50,7 +50,8 @@ CPPFLAGS += -DBITS_PER_LONG=64 -DHAVE_BIG_ENDIAN
+ # causing all our printf's to warn
+ CPPFLAGS += -ffreestanding
+ 
+-CFLAGS := -fno-strict-aliasing -fstack-protector-all -pie -mbig-endian -m64
++CFLAGS := -fno-strict-aliasing -fstack-protector-all -pie \
++	  -mbig-endian -m64 -mabi=elfv1
+ 
+ ifeq ($(STACK_CHECK),1)
+ CFLAGS += -fstack-protector-all -pg
+-- 
+1.9.1
+
diff --git a/openpower/package/skiboot/skiboot.mk b/openpower/package/skiboot/skiboot.mk
index c002740..3eee05e 100644
--- a/openpower/package/skiboot/skiboot.mk
+++ b/openpower/package/skiboot/skiboot.mk
@@ -26,7 +26,7 @@
 endif
 
 define SKIBOOT_BUILD_CMDS
-	$(TARGET_CONFIGURE_OPTS) SKIBOOT_VERSION=$(SKIBOOT_VERSION) \
+	$(TARGET_CONFIGURE_OPTS) SKIBOOT_VERSION=`cat $(SKIBOOT_VERSION_FILE)` \
 		$(MAKE) $(SKIBOOT_MAKE_OPTS) -C $(@D) all
 endef
 
diff --git a/openpower/platform/Config.in b/openpower/platform/Config.in
index badcc22..206b343 100644
--- a/openpower/platform/Config.in
+++ b/openpower/platform/Config.in
@@ -1,4 +1,4 @@
 config BR2_OPENPOWER_PLATFORM
     bool "Enable the OpenPower Platform"
     default n
-    depends on BR2_powerpc64
+    depends on BR2_powerpc64 || BR2_powerpc64le