aboutsummaryrefslogtreecommitdiff
path: root/platforms
diff options
context:
space:
mode:
authorGavin Shan <gwshan@linux.vnet.ibm.com>2016-08-11 14:55:17 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-10-11 15:11:03 +1100
commitde7ffb4e49f831fc30aea9e82fcd1f68d61059d6 (patch)
treeaf03ec5fdcd1f874cd2aaa410652873761a07947 /platforms
parent60ce59ccd0e978b0a2bc05e9048d03378c79a85c (diff)
downloadskiboot-de7ffb4e49f831fc30aea9e82fcd1f68d61059d6.zip
skiboot-de7ffb4e49f831fc30aea9e82fcd1f68d61059d6.tar.gz
skiboot-de7ffb4e49f831fc30aea9e82fcd1f68d61059d6.tar.bz2
platforms/astbmc: Introduce slot_init_info() helper function
This moves the logic initializing PCI slot to helper function slot_info_info() so that it can be reused by subsequent patch supporting dynamic PCI slot creation. No functional changes introduced. Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'platforms')
-rw-r--r--platforms/astbmc/slots.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/platforms/astbmc/slots.c b/platforms/astbmc/slots.c
index e71eb38..ff69e99 100644
--- a/platforms/astbmc/slots.c
+++ b/platforms/astbmc/slots.c
@@ -115,10 +115,26 @@ static void add_slot_properties(struct pci_slot *slot,
loc_code, strlen(loc_code) + 1);
}
+static void init_slot_info(struct pci_slot *slot, bool pluggable, void *data)
+{
+ slot->data = data;
+ slot->ops.add_properties = add_slot_properties;
+
+ slot->pluggable = pluggable;
+ slot->power_ctl = false;
+ slot->wired_lanes = PCI_SLOT_WIRED_LANES_UNKNOWN;
+ slot->connector_type = PCI_SLOT_CONNECTOR_PCIE_NS;
+ slot->card_desc = PCI_SLOT_DESC_NON_STANDARD;
+ slot->card_mech = PCI_SLOT_MECH_NONE;
+ slot->power_led_ctl = PCI_SLOT_PWR_LED_CTL_NONE;
+ slot->attn_led_ctl = PCI_SLOT_ATTN_LED_CTL_NONE;
+}
+
void slot_table_get_slot_info(struct phb *phb, struct pci_device *pd)
{
const struct slot_table_entry *ent;
struct pci_slot *slot;
+ bool pluggable;
if (!pd || pd->slot)
return;
@@ -128,15 +144,7 @@ void slot_table_get_slot_info(struct phb *phb, struct pci_device *pd)
slot = pcie_slot_create(phb, pd);
assert(slot);
- slot->ops.add_properties = add_slot_properties;
- slot->data = (void *)ent;
- slot->pluggable = ent->etype == st_pluggable_slot;
- slot->power_ctl = false;
- slot->wired_lanes = PCI_SLOT_WIRED_LANES_UNKNOWN;
- slot->connector_type = PCI_SLOT_CONNECTOR_PCIE_NS;
- slot->card_desc = PCI_SLOT_DESC_NON_STANDARD;
- slot->card_mech = PCI_SLOT_MECH_NONE;
- slot->power_led_ctl = PCI_SLOT_PWR_LED_CTL_NONE;
- slot->attn_led_ctl = PCI_SLOT_ATTN_LED_CTL_NONE;
+ pluggable = !!(ent->etype == st_pluggable_slot);
+ init_slot_info(slot, pluggable, (void *)ent);
}