/** * set_attention_status - set attention LED * @hotplug_slot: target &hotplug_slot * @value: LED control value * * echo 0 > attention -- set LED OFF * echo 1 > attention -- set LED ON * echo 2 > attention -- set LED ID(identify, light is blinking)
*/ staticint set_attention_status(struct hotplug_slot *hotplug_slot, u8 value)
{ int rc; struct slot *slot = to_slot(hotplug_slot);
switch (value) { case 0: case 1: case 2: break; default:
value = 1; break;
}
rc = rtas_set_indicator(DR_INDICATOR, slot->index, value); if (!rc)
slot->attention_status = value;
return rc;
}
/** * get_power_status - get power status of a slot * @hotplug_slot: slot to get status * @value: pointer to store status
*/ staticint get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
{ int retval, level; struct slot *slot = to_slot(hotplug_slot);
/** * get_attention_status - get attention LED status * @hotplug_slot: slot to get status * @value: pointer to store status
*/ staticint get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
{ struct slot *slot = to_slot(hotplug_slot);
*value = slot->attention_status; return 0;
}
staticenum pci_bus_speed get_max_bus_speed(struct slot *slot)
{ enum pci_bus_speed speed; switch (slot->type) { case 1: case 2: case 3: case 4: case 5: case 6:
speed = PCI_SPEED_33MHz; /* speed for case 1-6 */ break; case 7: case 8:
speed = PCI_SPEED_66MHz; break; case 11: case 14:
speed = PCI_SPEED_66MHz_PCIX; break; case 12: case 15:
speed = PCI_SPEED_100MHz_PCIX; break; case 13: case 16:
speed = PCI_SPEED_133MHz_PCIX; break; default:
speed = PCI_SPEED_UNKNOWN; break;
}
if (!indexes || !names || !types || !domains) { /* Slot does not have dynamically-removable children */ return -EINVAL;
} if (drc_indexes)
*drc_indexes = indexes; if (drc_names) /* &drc_names[1] contains NULL terminated slot names */
*drc_names = names; if (drc_types) /* &drc_types[1] contains NULL terminated slot types */
*drc_types = types; if (drc_power_domains)
*drc_power_domains = domains;
return 0;
}
/* Verify the existence of 'drc_name' and/or 'drc_type' within the * current node. First obtain its my-drc-index property. Next, * obtain the DRC info from its parent. Use the my-drc-index for * correlation, and obtain/validate the requested properties.
*/
/* Iterate through parent properties, looking for my-drc-index */ for (i = 0; i < be32_to_cpu(indexes[0]); i++) { if (be32_to_cpu(indexes[i + 1]) == my_index) break;
/* PCI Hotplug nodes have an integer for drc_type */
simple_strtoul(drc_type, &endptr, 10); if (endptr == drc_type) return 0;
return 1;
}
/** * is_php_dn() - return 1 if this is a hotpluggable pci slot, else 0 * @dn: target &device_node * @indexes: passed to get_children_props() * @names: passed to get_children_props() * @types: returned from get_children_props() * @power_domains: * * This routine will return true only if the device node is * a hotpluggable slot. This routine will return false * for built-in pci slots (even when the built-in slots are * dlparable.)
*/ staticint is_php_dn(struct device_node *dn, const __be32 **indexes, const __be32 **names, const __be32 **types, const __be32 **power_domains)
{ const __be32 *drc_types; int rc;
retval = rpaphp_enable_slot(slot); if (!retval)
retval = rpaphp_register_slot(slot);
if (retval)
dealloc_slot_struct(slot);
name += strlen(name) + 1;
type += strlen(type) + 1;
}
dbg("%s - Exit: rc[%d]\n", __func__, retval);
/* XXX FIXME: reports a failure only if last entry in loop failed */ return retval;
}
/** * rpaphp_add_slot -- declare a hotplug slot to the hotplug subsystem. * @dn: device node of slot * * This subroutine will register a hotpluggable slot with the * PCI hotplug infrastructure. This routine is typically called * during boot time, if the hotplug slots are present at boot time, * or is called later, by the dlpar add code, if the slot is * being dynamically added during runtime. * * If the device node points at an embedded (built-in) slot, this * routine will just return without doing anything, since embedded * slots cannot be hotplugged. * * To remove a slot, it suffices to call rpaphp_deregister_slot().
*/ int rpaphp_add_slot(struct device_node *dn)
{ if (!of_node_name_eq(dn, "pci")) return 0;
if (of_property_present(dn, "ibm,drc-info")) return rpaphp_drc_info_add_slot(dn); else return rpaphp_drc_add_slot(dn);
}
EXPORT_SYMBOL_GPL(rpaphp_add_slot);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.