aboutsummaryrefslogtreecommitdiff
path: root/platforms
diff options
context:
space:
mode:
authorOliver O'Halloran <oohall@gmail.com>2017-09-15 15:40:49 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-09-15 02:49:27 -0500
commitdcd53cfaeaf633e9ec08f4c8c68bf6c12ad0f998 (patch)
treeac6f1f71ddf2639f933452865c521295df5f3038 /platforms
parent6d67361b59b70d930144b47f6fbbef956ca2fb40 (diff)
downloadskiboot-dcd53cfaeaf633e9ec08f4c8c68bf6c12ad0f998.zip
skiboot-dcd53cfaeaf633e9ec08f4c8c68bf6c12ad0f998.tar.gz
skiboot-dcd53cfaeaf633e9ec08f4c8c68bf6c12ad0f998.tar.bz2
astbmc: Add methods for handing DT based slots
Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'platforms')
-rw-r--r--platforms/astbmc/astbmc.h1
-rw-r--r--platforms/astbmc/slots.c48
2 files changed, 49 insertions, 0 deletions
diff --git a/platforms/astbmc/astbmc.h b/platforms/astbmc/astbmc.h
index d538f97..88eb43f 100644
--- a/platforms/astbmc/astbmc.h
+++ b/platforms/astbmc/astbmc.h
@@ -54,5 +54,6 @@ extern void check_all_slot_table(void);
extern void slot_table_init(const struct slot_table_entry *top_table);
extern void slot_table_get_slot_info(struct phb *phb, struct pci_device * pd);
+void dt_slot_get_slot_info(struct phb *phb, struct pci_device *pd);
#endif /* __ASTBMC_H */
diff --git a/platforms/astbmc/slots.c b/platforms/astbmc/slots.c
index 5de5120..a5bd50e 100644
--- a/platforms/astbmc/slots.c
+++ b/platforms/astbmc/slots.c
@@ -124,6 +124,54 @@ void slot_table_get_slot_info(struct phb *phb, struct pci_device *pd)
slot->data = (void *)ent;
}
+static void dt_slot_add_properties(struct pci_slot *slot,
+ struct dt_node *np)
+{
+ struct dt_node *slot_np = slot->data;
+ const char *label = NULL;
+
+ if (slot_np)
+ label = dt_prop_get_def(slot_np, "ibm,slot-label", NULL);
+
+ pci_slot_add_loc(slot, np, label);
+}
+
+void dt_slot_get_slot_info(struct phb *phb, struct pci_device *pd)
+{
+ struct dt_node *slot_np;
+ struct pci_slot *slot;
+ const char *name = NULL;
+ bool pluggable = false;
+
+ if (!pd || pd->slot)
+ return;
+
+ slot_np = map_pci_dev_to_slot(phb, pd);
+ if (slot_np) {
+ pluggable = dt_has_node_property(slot_np,
+ "ibm,pluggable", NULL);
+ name = dt_prop_get_def(slot_np, "ibm,slot-label", NULL);
+ }
+
+ if (!slot_np || !name) {
+ slot = pcie_slot_create_dynamic(phb, pd);
+ if (slot) {
+ slot->ops.add_properties = dt_slot_add_properties;
+ slot->pluggable = true;
+ slot->data = (void *)slot_np;
+ }
+
+ return;
+ }
+
+ slot = pcie_slot_create(phb, pd);
+ assert(slot);
+
+ slot->ops.add_properties = dt_slot_add_properties;
+ slot->pluggable = pluggable;
+ slot->data = (void *)slot_np;
+}
+
static int __pci_find_dev_by_location(struct phb *phb,
struct pci_device *pd, void *userdata)
{