aboutsummaryrefslogtreecommitdiff
path: root/hdata
diff options
context:
space:
mode:
authorOliver O'Halloran <oohall@gmail.com>2017-09-15 15:40:59 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-09-15 02:49:27 -0500
commit1f242d5a503931146917fd7aeeb62a9525155fe0 (patch)
tree70b0b25912260fae02c18f1b6cd4203a60722a89 /hdata
parent9b886a44d993ade2f05f3a554a098c674bb7cd7f (diff)
downloadskiboot-1f242d5a503931146917fd7aeeb62a9525155fe0.zip
skiboot-1f242d5a503931146917fd7aeeb62a9525155fe0.tar.gz
skiboot-1f242d5a503931146917fd7aeeb62a9525155fe0.tar.bz2
hdata: Parse extra NVLink info
Add parsing for the link speed information and the OCC GPU presence flags. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hdata')
-rw-r--r--hdata/spira.c30
-rw-r--r--hdata/spira.h3
2 files changed, 32 insertions, 1 deletions
diff --git a/hdata/spira.c b/hdata/spira.c
index 73a678f..5e3d6cc 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -1288,9 +1288,10 @@ static void add_npu(struct dt_node *xscom, const struct HDIF_array_hdr *links,
int group_target[6]; /* Tracks the PCI slot targeted each link group */
int group_count = 0;
int link_count = 0;
- uint32_t chip_id;
+ uint32_t size, chip_id;
int i;
+ size = be32_to_cpu(links->esize);
chip_id = dt_get_chip_id(xscom);
memset(group_target, 0, sizeof(group_target));
@@ -1307,6 +1308,7 @@ static void add_npu(struct dt_node *xscom, const struct HDIF_array_hdr *links,
HDIF_iarray_for_each(links, i, link) {
uint16_t slot_id = be16_to_cpu(link->pci_slot_idx);
uint32_t link_id = be32_to_cpu(link->link_id);
+ uint64_t speed = 0, nvlink_speed = 0;
struct dt_node *node;
/* only add a link node if this link is targeted at at device */
@@ -1403,6 +1405,32 @@ static void add_npu(struct dt_node *xscom, const struct HDIF_array_hdr *links,
dt_add_property_cells(node, "ibm,pcie-slot",
slot->phandle);
}
+
+ /* Newer fields which might not be populated */
+ if (size <= 0x24)
+ continue;
+
+ switch (be32_to_cpu(link->link_speed)) {
+ case 0: /* 20Gbps */
+ speed = 20000000000ul;
+ nvlink_speed = 0x3;
+ break;
+ case 1: /* 25Gbps */
+ speed = 25000000000ul;
+ nvlink_speed = 0x9;
+ break;
+ case 2: /* 25.78125 Gbps */
+ nvlink_speed = 0x8;
+ speed = 25781250000ul;
+ break;
+ }
+
+ /* ibm,link-speed is in bps and nvidia,link-speed is ~magic~ */
+ dt_add_property_u64s(node, "ibm,link-speed", speed);
+ dt_add_property_cells(node, "nvidia,link-speed", nvlink_speed);
+
+ dt_add_property_cells(node, DT_PRIVATE "occ-flag-pos",
+ PPC_BIT(link->occ_flag_bit));
}
dt_add_property_cells(npu, "ibm,npu-links", link_count);
diff --git a/hdata/spira.h b/hdata/spira.h
index 9b427cb..f850c79 100644
--- a/hdata/spira.h
+++ b/hdata/spira.h
@@ -1178,6 +1178,9 @@ struct sppcrd_smp_link {
__be32 i2c_link_cable;
__be32 i2c_presence;
__be32 i2c_micro;
+ uint8_t link_speed;
+ uint8_t occ_flag_bit;
+ __be16 gpu_slca;
} __packed;
/*