Skip to content

Commit

Permalink
slots: Add power limit support
Browse files Browse the repository at this point in the history
Add support for sourcing power limit information from either the DT slot
heirachy or the slot table.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
oohal authored and stewartsmith committed Apr 11, 2018
1 parent f10feca commit d15e2e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions platforms/astbmc/astbmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ struct slot_table_entry {
uint32_t location;
const char *name;
const struct slot_table_entry *children;
uint8_t power_limit;
};

/*
Expand Down
5 changes: 5 additions & 0 deletions platforms/astbmc/slots.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ void slot_table_get_slot_info(struct phb *phb, struct pci_device *pd)

slot->pluggable = !!(ent->etype == st_pluggable_slot);
slot->ops.add_properties = slot_table_add_properties;
slot->power_limit = ent->power_limit;
slot->data = (void *)ent;
}

Expand All @@ -141,6 +142,7 @@ 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;
uint32_t power_limit = 0;
bool pluggable = false;

if (!pd || pd->slot)
Expand All @@ -150,6 +152,8 @@ void dt_slot_get_slot_info(struct phb *phb, struct pci_device *pd)
if (slot_np) {
pluggable = dt_has_node_property(slot_np,
"ibm,pluggable", NULL);
power_limit = dt_prop_get_u32_def(slot_np,
"ibm,power-limit", 0);
name = dt_prop_get_def(slot_np, "ibm,slot-label", NULL);
}

Expand All @@ -169,6 +173,7 @@ void dt_slot_get_slot_info(struct phb *phb, struct pci_device *pd)

slot->ops.add_properties = dt_slot_add_properties;
slot->pluggable = pluggable;
slot->power_limit = power_limit;
slot->data = (void *)slot_np;
}

Expand Down

0 comments on commit d15e2e5

Please sign in to comment.