@@ -37,6 +37,16 @@
#define ST_LOC_NPU_TARGET(chip_id, group_id) \
(ST_LOC_NVLINK_VALID | ((chip_id) << 16) | (group_id))
+/*
+ * 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 \
+}
+
struct slot_table_entry {
enum slot_table_etype {
st_end, /* End of list */
@@ -112,36 +112,14 @@ static const struct slot_table_entry barreleye_phb8_2_slot[] = {
};
static const struct slot_table_entry barreleye_phb_table[] = {
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,0),
- .children = barreleye_phb0_0_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,1),
- .children = barreleye_phb0_1_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,2),
- .children = barreleye_phb0_2_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(8,0),
- .children = barreleye_phb8_0_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(8,1),
- .children = barreleye_phb8_1_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(8,2),
- .children = barreleye_phb8_2_slot,
- },
+ ST_PHB_ENTRY(0, 0, barreleye_phb0_0_slot),
+ ST_PHB_ENTRY(0, 1, barreleye_phb0_1_slot),
+ ST_PHB_ENTRY(0, 2, barreleye_phb0_2_slot),
+
+ ST_PHB_ENTRY(8, 0, barreleye_phb8_0_slot),
+ ST_PHB_ENTRY(8, 1, barreleye_phb8_1_slot),
+ ST_PHB_ENTRY(8, 2, barreleye_phb8_2_slot),
+
{ .etype = st_end },
};
@@ -103,31 +103,13 @@ static const struct slot_table_entry firestone_phb8_2_slot[] = {
};
static const struct slot_table_entry firestone_phb_table[] = {
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,0),
- .children = firestone_phb0_0_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,1),
- .children = firestone_phb0_1_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(8,0),
- .children = firestone_phb8_0_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(8,1),
- .children = firestone_phb8_1_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(8,2),
- .children = firestone_phb8_2_slot,
- },
+ ST_PHB_ENTRY(0, 0, firestone_phb0_0_slot),
+ ST_PHB_ENTRY(0, 1, firestone_phb0_1_slot),
+
+ ST_PHB_ENTRY(8, 0, firestone_phb8_0_slot),
+ ST_PHB_ENTRY(8, 1, firestone_phb8_1_slot),
+ ST_PHB_ENTRY(8, 2, firestone_phb8_2_slot),
+
{ .etype = st_end },
};
@@ -131,46 +131,16 @@ static const struct slot_table_entry garrison_phb1_3_slot[] = {
};
static const struct slot_table_entry garrison_phb_table[] = {
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,0),
- .children = garrison_phb0_0_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,1),
- .children = garrison_phb0_1_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,2),
- .children = garrison_phb0_2_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,3),
- .children = garrison_phb0_3_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(1,0),
- .children = garrison_phb1_0_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(1,1),
- .children = garrison_phb1_1_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(1,2),
- .children = garrison_phb1_2_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(1,3),
- .children = garrison_phb1_3_slot,
- },
+ ST_PHB_ENTRY(0, 0, garrison_phb0_0_slot),
+ ST_PHB_ENTRY(0, 1, garrison_phb0_1_slot),
+ ST_PHB_ENTRY(0, 2, garrison_phb0_2_slot),
+ ST_PHB_ENTRY(0, 3, garrison_phb0_3_slot),
+
+ ST_PHB_ENTRY(1, 0, garrison_phb1_0_slot),
+ ST_PHB_ENTRY(1, 1, garrison_phb1_1_slot),
+ ST_PHB_ENTRY(1, 2, garrison_phb1_2_slot),
+ ST_PHB_ENTRY(1, 3, garrison_phb1_3_slot),
+
{ .etype = st_end },
};
@@ -95,21 +95,10 @@ static const struct slot_table_entry habanero_phb2_slot[] = {
};
static const struct slot_table_entry habanero_phb_table[] = {
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,0),
- .children = habanero_phb0_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,1),
- .children = habanero_phb1_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,2),
- .children = habanero_phb2_slot,
- },
+ ST_PHB_ENTRY(0, 0, habanero_phb0_slot),
+ ST_PHB_ENTRY(0, 1, habanero_phb1_slot),
+ ST_PHB_ENTRY(0, 2, habanero_phb2_slot),
+
{ .etype = st_end },
};
@@ -173,46 +173,16 @@ static const struct slot_table_entry p8dnu_phb1_3_slot[] = {
};
static const struct slot_table_entry p8dnu_phb_table[] = {
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,0),
- .children = p8dnu_phb0_0_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,1),
- .children = p8dnu_phb0_1_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,2),
- .children = p8dnu_phb0_2_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,3),
- .children = p8dnu_phb0_3_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(1,0),
- .children = p8dnu_phb1_0_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(1,1),
- .children = p8dnu_phb1_1_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(1,2),
- .children = p8dnu_phb1_2_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(1,3),
- .children = p8dnu_phb1_3_slot,
- },
+ ST_PHB_ENTRY(0, 0, p8dnu_phb0_0_slot),
+ ST_PHB_ENTRY(0, 1, p8dnu_phb0_1_slot),
+ ST_PHB_ENTRY(0, 2, p8dnu_phb0_2_slot),
+ ST_PHB_ENTRY(0, 3, p8dnu_phb0_3_slot),
+
+ ST_PHB_ENTRY(1, 0, p8dnu_phb1_0_slot),
+ ST_PHB_ENTRY(1, 1, p8dnu_phb1_1_slot),
+ ST_PHB_ENTRY(1, 2, p8dnu_phb1_2_slot),
+ ST_PHB_ENTRY(1, 3, p8dnu_phb1_3_slot),
+
{ .etype = st_end },
};
@@ -136,70 +136,26 @@ static const struct slot_table_entry p8dtu1u_phb8_2_slot[] = {
};
static const struct slot_table_entry p8dtu2u_phb_table[] = {
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,0),
- .children = p8dtu_phb0_0_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,1),
- .children = p8dtu_phb0_1_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,2),
- .children = p8dtu_phb0_2_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(8,0),
- .children = p8dtu_phb8_0_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(8,1),
- .children = p8dtu2u_phb8_1_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(8,2),
- .children = p8dtu2u_phb8_2_slot,
- },
+ ST_PHB_ENTRY(0, 0, p8dtu_phb0_0_slot),
+ ST_PHB_ENTRY(0, 1, p8dtu_phb0_1_slot),
+ ST_PHB_ENTRY(0, 2, p8dtu_phb0_2_slot),
+
+ ST_PHB_ENTRY(8, 0, p8dtu_phb8_0_slot),
+ ST_PHB_ENTRY(8, 1, p8dtu2u_phb8_1_slot),
+ ST_PHB_ENTRY(8, 2, p8dtu2u_phb8_2_slot),
+
{ .etype = st_end },
};
static const struct slot_table_entry p8dtu1u_phb_table[] = {
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,0),
- .children = p8dtu_phb0_0_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,1),
- .children = p8dtu_phb0_1_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,2),
- .children = p8dtu_phb0_2_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(8,0),
- .children = p8dtu_phb8_0_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(8,1),
- .children = p8dtu1u_phb8_1_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(8,2),
- .children = p8dtu1u_phb8_2_slot,
- },
+ ST_PHB_ENTRY(0, 0, p8dtu_phb0_0_slot),
+ ST_PHB_ENTRY(0, 1, p8dtu_phb0_1_slot),
+ ST_PHB_ENTRY(0, 2, p8dtu_phb0_2_slot),
+
+ ST_PHB_ENTRY(8, 0, p8dtu_phb8_0_slot),
+ ST_PHB_ENTRY(8, 1, p8dtu1u_phb8_1_slot),
+ ST_PHB_ENTRY(8, 2, p8dtu1u_phb8_2_slot),
+
{ .etype = st_end },
};
@@ -85,21 +85,10 @@ static const struct slot_table_entry palmetto_phb0_2_slot[] = {
};
static const struct slot_table_entry palmetto_phb_table[] = {
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,0),
- .children = palmetto_phb0_0_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,1),
- .children = palmetto_phb0_1_slot,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,2),
- .children = palmetto_phb0_2_slot,
- },
+ ST_PHB_ENTRY(0, 0, palmetto_phb0_0_slot),
+ ST_PHB_ENTRY(0, 1, palmetto_phb0_1_slot),
+ ST_PHB_ENTRY(0, 2, palmetto_phb0_2_slot),
+
{ .etype = st_end },
};
@@ -201,51 +201,17 @@ static const struct slot_table_entry witherspoon_net_phb[] = {
*/
static const struct slot_table_entry witherspoon_phb_table[] = {
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,0),
- .children = witherspoon_slot4, /* XXX: Might be slot 3 */
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,2),
- .children = witherspoon_bmc_phb, /* BMC */
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,3),
- .children = witherspoon_slot2_shared, /* shared */
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,4),
- .children = witherspoon_plx0_phb, /* chip 1 PLX connection */
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(0,5),
- .children = witherspoon_net_phb, /* builtin ethernet */
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(8,0),
- .children = witherspoon_slot3, /* XXX: might be slot 4 */
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(8,3),
- .children = witherspoon_slot2_shared, /* shared slot */
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(8,4),
- .children = witherspoon_slot1,
- },
- {
- .etype = st_phb,
- .location = ST_LOC_PHB(8,5),
- .children = witherspoon_plx1_phb, /* Chip 2 PLX up */
- },
+ ST_PHB_ENTRY(0, 0, witherspoon_slot4), /* XXX: might be slot3 */
+ ST_PHB_ENTRY(0, 2, witherspoon_bmc_phb), /* BMC */
+ ST_PHB_ENTRY(0, 3, witherspoon_slot2_shared), /* shared */
+ ST_PHB_ENTRY(0, 4, witherspoon_plx0_phb),
+ ST_PHB_ENTRY(0, 5, witherspoon_net_phb),
+
+ ST_PHB_ENTRY(8, 0, witherspoon_slot3), /* XXX: might be swapped with 4 */
+ ST_PHB_ENTRY(8, 3, witherspoon_slot2_shared),
+ ST_PHB_ENTRY(8, 4, witherspoon_slot1),
+ ST_PHB_ENTRY(8, 5, witherspoon_plx1_phb),
+
{ .etype = st_end },
};