Merge pull request #1173 from stewart-ibm/redbud

Redbud platform: temporary variant of Witherspoon
diff --git a/openpower/configs/redbud_defconfig b/openpower/configs/redbud_defconfig
new file mode 100644
index 0000000..9ec0aaa
--- /dev/null
+++ b/openpower/configs/redbud_defconfig
@@ -0,0 +1,67 @@
+BR2_powerpc64le=y
+BR2_powerpc_power8=y
+BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_OP_BUILD_PATH)/patches/redbud-patches"
+BR2_GLIBC_VERSION_2_24=y
+BR2_BINUTILS_VERSION_2_27_X=y
+BR2_BINUTILS_EXTRA_CONFIG_OPTIONS="--enable-targets=powerpc64-linux"
+BR2_GCC_VERSION_4_9_X=y
+BR2_EXTRA_GCC_CONFIG_OPTIONS="--enable-targets=powerpc64-linux"
+BR2_TOOLCHAIN_BUILDROOT_CXX=y
+BR2_TARGET_GENERIC_HOSTNAME="skiroot"
+BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
+BR2_ROOTFS_DEVICE_TABLE="../openpower/device_table.txt"
+BR2_TARGET_GENERIC_GETTY_PORT="hvc0"
+BR2_ENABLE_LOCALE_WHITELIST="C de en es fr it ja ko pt_BR ru zh_CN zh_TW"
+BR2_GENERATE_LOCALE="en_US.UTF-8 de_DE.UTF-8 es_ES.UTF-8 fr_FR.UTF-8 it_IT.UTF-8 ja_JP.UTF-8 ko_KR.UTF-8 pt_BR.UTF-8 ru_RU.UTF-8 zh_CN.UTF-8 zh_TW.UTF-8"
+BR2_ROOTFS_OVERLAY="../openpower/overlay"
+BR2_ROOTFS_POST_BUILD_SCRIPT="../openpower/scripts/fixup-target-var ../openpower/scripts/firmware-whitelist"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.11.2"
+BR2_LINUX_KERNEL_PATCH="$(BR2_EXTERNAL_OP_BUILD_PATH)/linux"
+BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_OP_BUILD_PATH)/configs/linux/skiroot_p9_defconfig"
+BR2_LINUX_KERNEL_ZIMAGE_EPAPR=y
+BR2_LINUX_KERNEL_XZ=y
+BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_OP_BUILD_PATH)/configs/busybox.fragment"
+BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
+BR2_PACKAGE_LINUX_FIRMWARE=y
+BR2_PACKAGE_LINUX_FIRMWARE_BNX2X=y
+BR2_PACKAGE_LINUX_FIRMWARE_CXGB4_T4=y
+BR2_PACKAGE_I2C_TOOLS=y
+BR2_PACKAGE_IPMITOOL=y
+BR2_PACKAGE_MDADM=y
+BR2_PACKAGE_NCURSES_WCHAR=y
+BR2_PACKAGE_DROPBEAR=y
+# BR2_PACKAGE_DROPBEAR_SERVER is not set
+BR2_PACKAGE_ETHTOOL=y
+BR2_PACKAGE_NETCAT=y
+BR2_PACKAGE_RSYNC=y
+BR2_TARGET_ROOTFS_CPIO_XZ=y
+BR2_TARGET_ROOTFS_INITRAMFS=y
+BR2_OPENPOWER_PLATFORM=y
+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_FILENAME="witherspoon.xml"
+BR2_OPENPOWER_SYSTEM_XML_FILENAME="WITHERSPOON_hb.system.xml"
+BR2_OPENPOWER_MRW_XML_FILENAME="WITHERSPOON_hb.mrw.xml"
+BR2_OPENPOWER_BIOS_XML_FILENAME="WITHERSPOON_bios.xml"
+BR2_OPENPOWER_PNOR_XML_LAYOUT_FILENAME="defaultPnorLayout_64.xml"
+BR2_OPENPOWER_CONFIG_NAME="witherspoon"
+BR2_OPENPOWER_PNOR_FILENAME="redbud.pnor"
+BR2_HOSTBOOT_BINARY_SBE_FILENAME="nimbus_sbe.img.ecc"
+BR2_HOSTBOOT_BINARY_SBEC_FILENAME="centaur_sbec_pad.img.ecc"
+BR2_HOSTBOOT_BINARY_WINK_FILENAME="p9n.ref_image.hdr.bin.ecc"
+BR2_WOFDATA_FILENAME="wof_output"
+BR2_WOFDATA_BINARY_FILENAME="wofdata.bin.ecc"
+BR2_IMA_CATALOG_FILENAME="ima_catalog.bin"
+BR2_OPENPOWER_TARGETING_BIN_FILENAME="WITHERSPOON_HB.targeting.bin"
+BR2_OPENPOWER_TARGETING_ECC_FILENAME="WITHERSPOON_HB.targeting.bin.ecc"
+BR2_PACKAGE_PETITBOOT=y
+BR2_PACKAGE_PETITBOOT_MTD=y
+BR2_OCC_BIN_FILENAME="occ.bin"
+BR2_CAPP_UCODE_BIN_FILENAME="cappucode.bin"
+BR2_PACKAGE_LOADKEYS=y
+BR2_IMA_CATALOG_DTS="POWER9"
diff --git a/openpower/patches/redbud-patches/skiboot/0001-NOT-FOR-UPSTREAM-Add-support-for-Redbud.patch b/openpower/patches/redbud-patches/skiboot/0001-NOT-FOR-UPSTREAM-Add-support-for-Redbud.patch
new file mode 100644
index 0000000..25897fb
--- /dev/null
+++ b/openpower/patches/redbud-patches/skiboot/0001-NOT-FOR-UPSTREAM-Add-support-for-Redbud.patch
@@ -0,0 +1,172 @@
+From 399620b8282f89728ab94fd0c273882063bf32b1 Mon Sep 17 00:00:00 2001
+From: Alistair Popple <alistair@popple.id.au>
+Date: Thu, 22 Jun 2017 13:26:01 +1000
+Subject: [PATCH] NOT FOR UPSTREAM: Add support for Redbud
+
+Add support for Redbud. This is mutually exclusive with support for Sequoia so
+anything built with this patch will not work on Sequoia.
+
+Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
+---
+ platforms/astbmc/Makefile.inc                |  2 +-
+ platforms/astbmc/{witherspoon.c => redbud.c} | 68 +++++++---------------------
+ 2 files changed, 18 insertions(+), 52 deletions(-)
+ rename platforms/astbmc/{witherspoon.c => redbud.c} (91%)
+
+diff --git a/platforms/astbmc/Makefile.inc b/platforms/astbmc/Makefile.inc
+index 49292c10601c..797a03c323ad 100644
+--- a/platforms/astbmc/Makefile.inc
++++ b/platforms/astbmc/Makefile.inc
+@@ -4,7 +4,7 @@ ASTBMC_OBJS = pnor.o common.o slots.o \
+ 	      palmetto.o habanero.o firestone.o \
+ 	      p8dtu.o p8dnu.o \
+ 	      garrison.o barreleye.o \
+-	      witherspoon.o zaius.o romulus.o p9dsu.o
++	      redbud.o zaius.o romulus.o p9dsu.o
+ 
+ ASTBMC = $(PLATDIR)/astbmc/built-in.o
+ $(ASTBMC): $(ASTBMC_OBJS:%=$(PLATDIR)/astbmc/%)
+diff --git a/platforms/astbmc/witherspoon.c b/platforms/astbmc/redbud.c
+similarity index 91%
+rename from platforms/astbmc/witherspoon.c
+rename to platforms/astbmc/redbud.c
+index 6a773061db74..90373f66961f 100644
+--- a/platforms/astbmc/witherspoon.c
++++ b/platforms/astbmc/redbud.c
+@@ -51,7 +51,7 @@ static const struct slot_table_entry witherspoon_gpu1[] = {
+ static const struct slot_table_entry witherspoon_gpu2[] = {
+ 	{
+ 		.etype = st_pluggable_slot,
+-		.location = ST_LOC_DEVFN(0xc0,0),
++		.location = ST_LOC_DEVFN(0x60,0),
+ 		.name = "GPU2",
+ 	},
+ 	{ .etype = st_end },
+@@ -60,26 +60,8 @@ static const struct slot_table_entry witherspoon_gpu2[] = {
+ static const struct slot_table_entry witherspoon_gpu3[] = {
+ 	{
+ 		.etype = st_pluggable_slot,
+-		.location = ST_LOC_DEVFN(0x60,0),
+-		.name = "GPU3",
+-	},
+-	{ .etype = st_end },
+-};
+-
+-static const struct slot_table_entry witherspoon_gpu4[] = {
+-	{
+-		.etype = st_pluggable_slot,
+ 		.location = ST_LOC_DEVFN(0x80,0),
+-		.name = "GPU4",
+-	},
+-	{ .etype = st_end },
+-};
+-
+-static const struct slot_table_entry witherspoon_gpu5[] = {
+-	{
+-		.etype = st_pluggable_slot,
+-		.location = ST_LOC_DEVFN(0xa0,0),
+-		.name = "GPU5",
++		.name = "GPU3",
+ 	},
+ 	{ .etype = st_end },
+ };
+@@ -97,12 +79,6 @@ static const struct slot_table_entry witherspoon_plx0_down[] = {
+ 		.children = witherspoon_gpu1,
+ 		.name = "GPU1 down",
+ 	},
+-	{
+-		.etype = st_builtin_dev,
+-		.location = ST_LOC_DEVFN(0x4c,0),
+-		.children = witherspoon_gpu2,
+-		.name = "GPU2 down",
+-	},
+ 	{ .etype = st_end },
+ };
+ 
+@@ -110,20 +86,14 @@ static const struct slot_table_entry witherspoon_plx1_down[] = {
+ 	{
+ 		.etype = st_builtin_dev,
+ 		.location = ST_LOC_DEVFN(0x44,0),
+-		.children = witherspoon_gpu3,
+-		.name = "GPU3 down",
++		.children = witherspoon_gpu2,
++		.name = "GPU2 down",
+ 	},
+ 	{
+ 		.etype = st_builtin_dev,
+ 		.location = ST_LOC_DEVFN(0x45,0),
+-		.children = witherspoon_gpu4,
+-		.name = "GPU4 down",
+-	},
+-	{
+-		.etype = st_builtin_dev,
+-		.location = ST_LOC_DEVFN(0x4d,0),
+-		.children = witherspoon_gpu5,
+-		.name = "GPU5 down",
++		.children = witherspoon_gpu3,
++		.name = "GPU3 down",
+ 	},
+ 	{ .etype = st_end },
+ };
+@@ -175,11 +145,6 @@ static const struct slot_table_entry witherspoon_npu0_slots[] = {
+ 		.location = ST_LOC_NPU_GROUP(1),
+ 		.name = "GPU1",
+ 	},
+-	{
+-		.etype = st_npu_slot,
+-		.location = ST_LOC_NPU_GROUP(2),
+-		.name = "GPU2",
+-	},
+ 	{ .etype = st_end },
+ };
+ 
+@@ -187,17 +152,12 @@ static const struct slot_table_entry witherspoon_npu8_slots[] = {
+ 	{
+ 		.etype = st_npu_slot,
+ 		.location = ST_LOC_NPU_GROUP(0),
+-		.name = "GPU3",
++		.name = "GPU2",
+ 	},
+ 	{
+ 		.etype = st_npu_slot,
+ 		.location = ST_LOC_NPU_GROUP(1),
+-		.name = "GPU4",
+-	},
+-	{
+-		.etype = st_npu_slot,
+-		.location = ST_LOC_NPU_GROUP(2),
+-		.name = "GPU5",
++		.name = "GPU3",
+ 	},
+ 	{ .etype = st_end },
+ };
+@@ -290,10 +250,10 @@ static void dt_create_npu2(void)
+ 
+ 		create_link(npu, 0, 0);
+ 		create_link(npu, 0, 1);
+-		create_link(npu, 1, 2);
++		create_link(npu, 0, 2);
+ 		create_link(npu, 1, 3);
+-		create_link(npu, 2, 4);
+-		create_link(npu, 2, 5);
++		create_link(npu, 1, 4);
++		create_link(npu, 1, 5);
+ 	}
+ }
+ 
+@@ -304,6 +264,12 @@ static bool witherspoon_probe(void)
+ 	if (!dt_node_is_compatible(dt_root, "ibm,witherspoon"))
+ 		return false;
+ 
++	prerror("********************************************************************************\n");
++	prerror("*     README: THIS BUILD IS ONLY FOR SYSTEMS SUPPORTING A MAXIMUM OF 4 GPUS    *\n");
++	prerror("*                                                                              *\n");
++	prerror("*       !!! THIS BUILD WILL NOT WORK ON SYSTEMS WHICH SUPPORT 6 GPUS !!!       *\n");
++	prerror("********************************************************************************\n");
++
+ 	/* Lot of common early inits here */
+ 	astbmc_early_init();
+ 
+-- 
+2.9.4
+