aboutsummaryrefslogtreecommitdiff
path: root/platforms/astbmc
diff options
context:
space:
mode:
authorOliver O'Halloran <oohall@gmail.com>2018-08-21 14:37:51 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2018-09-13 15:19:36 +1000
commit7a9eb51051f1a165f1480ef5c1e9e0ab78baf69a (patch)
tree875cb153c75d631c9eddfa3b54feb399211dafb9 /platforms/astbmc
parentc07958783dbcf0b5f923fddb9f696be8e5ea3dae (diff)
downloadskiboot-7a9eb51051f1a165f1480ef5c1e9e0ab78baf69a.zip
skiboot-7a9eb51051f1a165f1480ef5c1e9e0ab78baf69a.tar.gz
skiboot-7a9eb51051f1a165f1480ef5c1e9e0ab78baf69a.tar.bz2
astbmc/slot: Add _add_slot_info()
Currently slot_table_get_slot_info() scans the platform defined slot table looking for a slot table entry that matches the device and adds the relevant information to the struct pci_device. This patch splits the searching and adding of the slot information into separate functions so that we can allow the platform code to use a different searching critera. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'platforms/astbmc')
-rw-r--r--platforms/astbmc/astbmc.h3
-rw-r--r--platforms/astbmc/slots.c24
2 files changed, 18 insertions, 9 deletions
diff --git a/platforms/astbmc/astbmc.h b/platforms/astbmc/astbmc.h
index f8548c5..16ffd7d 100644
--- a/platforms/astbmc/astbmc.h
+++ b/platforms/astbmc/astbmc.h
@@ -101,6 +101,9 @@ extern void astbmc_exit(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 slot_table_add_slot_info(struct pci_device *pd,
+ const struct slot_table_entry *ent);
+
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 5c0effd..0bd8403 100644
--- a/platforms/astbmc/slots.c
+++ b/platforms/astbmc/slots.c
@@ -96,18 +96,13 @@ static void slot_table_add_properties(struct pci_slot *slot,
pci_slot_add_loc(slot, np, NULL);
}
-void slot_table_get_slot_info(struct phb *phb, struct pci_device *pd)
+void slot_table_add_slot_info(struct pci_device *pd,
+ const struct slot_table_entry *ent)
{
- const struct slot_table_entry *ent;
struct pci_slot *slot;
- if (!pd || pd->slot)
- return;
-
- ent = match_slot_dev_entry(phb, pd);
-
if (!ent || !ent->name) {
- slot = pcie_slot_create_dynamic(phb, pd);
+ slot = pcie_slot_create_dynamic(pd->phb, pd);
if (slot) {
slot->ops.add_properties = slot_table_add_properties;
slot->pluggable = true;
@@ -116,7 +111,7 @@ void slot_table_get_slot_info(struct phb *phb, struct pci_device *pd)
return;
}
- slot = pcie_slot_create(phb, pd);
+ slot = pcie_slot_create(pd->phb, pd);
assert(slot);
slot->pluggable = !!(ent->etype == st_pluggable_slot);
@@ -125,6 +120,17 @@ void slot_table_get_slot_info(struct phb *phb, struct pci_device *pd)
slot->data = (void *)ent;
}
+void slot_table_get_slot_info(struct phb *phb, struct pci_device *pd)
+{
+ const struct slot_table_entry *ent;
+
+ if (!pd || pd->slot)
+ return;
+
+ ent = match_slot_dev_entry(phb, pd);
+ slot_table_add_slot_info(pd, ent);
+}
+
static void dt_slot_add_properties(struct pci_slot *slot,
struct dt_node *np)
{