diff mbox series

[05/14] platform/witherspoon: Add slot names to table

Message ID 20170915054059.32109-5-oohall@gmail.com
State Accepted
Headers show
Series [01/14] core/pci-dt-slot: Represent PCIe slots in the devicetree | expand

Commit Message

Oliver O'Halloran Sept. 15, 2017, 5:40 a.m. UTC
Add the other PCIe devices to the witherspoon slot tables. This provides
a fall back for systems without IOSLOT information in the HDAT. This is
mainly to allow DD1 systems to continue being useful.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 platforms/astbmc/astbmc.h      | 10 ++++++
 platforms/astbmc/witherspoon.c | 80 ++++++++++++++++++++++++++++++------------
 2 files changed, 68 insertions(+), 22 deletions(-)
diff mbox series

Patch

diff --git a/platforms/astbmc/astbmc.h b/platforms/astbmc/astbmc.h
index 88eb43f1f111..feaca1d011d4 100644
--- a/platforms/astbmc/astbmc.h
+++ b/platforms/astbmc/astbmc.h
@@ -41,6 +41,16 @@  struct slot_table_entry {
 	const struct slot_table_entry *children;
 };
 
+/*
+ * Helper to reduce the noise in the PHB table
+ */
+#define ST_PHB_ENTRY(chip_id, phb_id, child_table) \
+{ \
+	.etype = st_phb, \
+	.location = ST_LOC_PHB(chip_id, phb_id), \
+	.children = child_table \
+}
+
 extern const struct bmc_platform astbmc_ami;
 extern const struct bmc_platform astbmc_openbmc;
 
diff --git a/platforms/astbmc/witherspoon.c b/platforms/astbmc/witherspoon.c
index a987e905642c..e9cc98b55983 100644
--- a/platforms/astbmc/witherspoon.c
+++ b/platforms/astbmc/witherspoon.c
@@ -30,6 +30,42 @@ 
 
 #include "astbmc.h"
 
+static const struct slot_table_entry witherspoon_slot1[] = {
+	{
+		.etype = st_pluggable_slot,
+		.location = ST_LOC_DEVFN(0,0),
+		.name = "SLOT0"
+	},
+	{ .etype = st_end },
+};
+
+static const struct slot_table_entry witherspoon_slot2_shared[] = {
+	{
+		.etype = st_pluggable_slot,
+		.location = ST_LOC_DEVFN(0,0),
+		.name = "SLOT1"
+	},
+	{ .etype = st_end },
+};
+
+static const struct slot_table_entry witherspoon_slot3[] = {
+	{
+		.etype = st_pluggable_slot,
+		.location = ST_LOC_DEVFN(0,0),
+		.name = "SLOT2"
+	},
+	{ .etype = st_end },
+};
+
+static const struct slot_table_entry witherspoon_slot4[] = {
+	{
+		.etype = st_pluggable_slot,
+		.location = ST_LOC_DEVFN(0,0),
+		.name = "SLOT3"
+	},
+	{ .etype = st_end },
+};
+
 static const struct slot_table_entry witherspoon_gpu0[] = {
 	{
 		.etype = st_pluggable_slot,
@@ -146,7 +182,7 @@  static const struct slot_table_entry witherspoon_plx1_up[] = {
 	{ .etype = st_end },
 };
 
-static const struct slot_table_entry witherspoon_phb0_4_slot[] = {
+static const struct slot_table_entry witherspoon_plx0_phb[] = {
 	{
 		.etype = st_builtin_dev,
 		.location = ST_LOC_DEVFN(0,0),
@@ -155,7 +191,7 @@  static const struct slot_table_entry witherspoon_phb0_4_slot[] = {
 	{ .etype = st_end },
 };
 
-static const struct slot_table_entry witherspoon_phb8_5_slot[] = {
+static const struct slot_table_entry witherspoon_plx1_phb[] = {
 	{
 		.etype = st_builtin_dev,
 		.location = ST_LOC_DEVFN(0,0),
@@ -202,27 +238,27 @@  static const struct slot_table_entry witherspoon_npu8_slots[] = {
 	{ .etype = st_end },
 };
 
+/*
+ * Slot numbering:
+ *
+ * slot 1 - x4 slot
+ * slot 2 - shared slot, 8x to each chip's PHB3
+ * slot 3 - 16x \w CAPI, second chip
+ * slot 4 - 16x \w CAPI, first chip
+ */
+
 static const struct slot_table_entry witherspoon_phb_table[] = {
-	{
-		.etype = st_phb,
-		.location = ST_LOC_PHB(0,4),
-		.children = witherspoon_phb0_4_slot,
-	},
-	{
-		.etype = st_phb,
-		.location = ST_LOC_PHB(0,7),
-		.children = witherspoon_npu0_slots,
-	},
-	{
-		.etype = st_phb,
-		.location = ST_LOC_PHB(8,5),
-		.children = witherspoon_phb8_5_slot,
-	},
-	{
-		.etype = st_phb,
-		.location = ST_LOC_PHB(8,8),
-		.children = witherspoon_npu8_slots,
-	},
+	ST_PHB_ENTRY(0, 0, witherspoon_slot4),
+	ST_PHB_ENTRY(0, 3, witherspoon_slot2_shared),
+	ST_PHB_ENTRY(0, 4, witherspoon_plx0_phb),
+	ST_PHB_ENTRY(0, 7, witherspoon_npu0_slots),
+
+	ST_PHB_ENTRY(8, 0, witherspoon_slot3),
+	ST_PHB_ENTRY(8, 3, witherspoon_slot2_shared),
+	ST_PHB_ENTRY(8, 4, witherspoon_slot1),
+	ST_PHB_ENTRY(8, 5, witherspoon_plx1_phb),
+	ST_PHB_ENTRY(8, 8, witherspoon_npu8_slots),
+
 	{ .etype = st_end },
 };