Lines Matching full:slot
145 struct acpiphp_slot *slot, *next; in free_bridge() local
152 list_for_each_entry_safe(slot, next, &bridge->slots, node) { in free_bridge()
153 list_for_each_entry_safe(func, tmp, &slot->funcs, sibling) in free_bridge()
156 kfree(slot); in free_bridge()
190 bus = context->func.slot->bus; in acpiphp_post_dock_fixup()
195 * secondary bridge on slot in acpiphp_post_dock_fixup()
224 struct acpiphp_slot *slot; in acpiphp_add_context() local
268 /* search for objects that share the same slot */ in acpiphp_add_context()
269 list_for_each_entry(slot, &bridge->slots, node) in acpiphp_add_context()
270 if (slot->device == device) in acpiphp_add_context()
273 slot = kzalloc(sizeof(struct acpiphp_slot), GFP_KERNEL); in acpiphp_add_context()
274 if (!slot) { in acpiphp_add_context()
281 slot->bus = bridge->pci_bus; in acpiphp_add_context()
282 slot->device = device; in acpiphp_add_context()
283 INIT_LIST_HEAD(&slot->funcs); in acpiphp_add_context()
285 list_add_tail(&slot->node, &bridge->slots); in acpiphp_add_context()
304 pr_debug("found ACPI PCI Hotplug slot %llu at PCI %04x:%02x:%02x\n", in acpiphp_add_context()
307 retval = acpiphp_register_hotplug_slot(slot, sun); in acpiphp_add_context()
309 slot->slot = NULL; in acpiphp_add_context()
312 pr_warn("Slot %llu already registered by another hotplug driver\n", sun); in acpiphp_add_context()
316 /* Even if the slot registration fails, we can still use it. */ in acpiphp_add_context()
320 newfunc->slot = slot; in acpiphp_add_context()
321 list_add_tail(&newfunc->sibling, &slot->funcs); in acpiphp_add_context()
325 slot->flags |= SLOT_ENABLED; in acpiphp_add_context()
332 struct acpiphp_slot *slot; in cleanup_bridge() local
335 list_for_each_entry(slot, &bridge->slots, node) { in cleanup_bridge()
336 list_for_each_entry(func, &slot->funcs, sibling) { in cleanup_bridge()
344 slot->flags |= SLOT_IS_GOING_AWAY; in cleanup_bridge()
345 if (slot->slot) in cleanup_bridge()
346 acpiphp_unregister_hotplug_slot(slot); in cleanup_bridge()
385 static void acpiphp_set_acpi_region(struct acpiphp_slot *slot) in acpiphp_set_acpi_region() argument
391 list_for_each_entry(func, &slot->funcs, sibling) { in acpiphp_set_acpi_region()
404 static void check_hotplug_bridge(struct acpiphp_slot *slot, struct pci_dev *dev) in check_hotplug_bridge() argument
412 list_for_each_entry(func, &slot->funcs, sibling) { in check_hotplug_bridge()
420 static int acpiphp_rescan_slot(struct acpiphp_slot *slot) in acpiphp_rescan_slot() argument
424 list_for_each_entry(func, &slot->funcs, sibling) { in acpiphp_rescan_slot()
431 return pci_scan_slot(slot->bus, PCI_DEVFN(slot->device, 0)); in acpiphp_rescan_slot()
458 * enable_slot - enable, configure a slot
459 * @slot: slot to be enabled
460 * @bridge: true if enable is for the whole bridge (not a single slot)
462 * This function should be called per *physical slot*,
463 * not per each slot object in ACPI namespace.
465 static void enable_slot(struct acpiphp_slot *slot, bool bridge) in enable_slot() argument
468 struct pci_bus *bus = slot->bus; in enable_slot()
474 * slot management and resource allocation for hotplug in enable_slot()
480 if (PCI_SLOT(dev->devfn) == slot->device) in enable_slot()
488 acpiphp_rescan_slot(slot); in enable_slot()
492 if (PCI_SLOT(dev->devfn) != slot->device) in enable_slot()
497 check_hotplug_bridge(slot, dev); in enable_slot()
509 acpiphp_set_acpi_region(slot); in enable_slot()
519 slot->flags |= SLOT_ENABLED; in enable_slot()
520 list_for_each_entry(func, &slot->funcs, sibling) { in enable_slot()
521 dev = pci_get_slot(bus, PCI_DEVFN(slot->device, in enable_slot()
526 slot->flags &= ~SLOT_ENABLED; in enable_slot()
533 * disable_slot - disable a slot
534 * @slot: ACPI PHP slot
536 static void disable_slot(struct acpiphp_slot *slot) in disable_slot() argument
538 struct pci_bus *bus = slot->bus; in disable_slot()
549 if (PCI_SLOT(dev->devfn) == slot->device) in disable_slot()
552 list_for_each_entry(func, &slot->funcs, sibling) in disable_slot()
555 slot->flags &= ~SLOT_ENABLED; in disable_slot()
558 static bool slot_no_hotplug(struct acpiphp_slot *slot) in slot_no_hotplug() argument
560 struct pci_bus *bus = slot->bus; in slot_no_hotplug()
564 if (PCI_SLOT(dev->devfn) == slot->device && dev->ignore_hotplug) in slot_no_hotplug()
571 * get_slot_status - get ACPI slot status
572 * @slot: ACPI PHP slot
574 * If a slot has _STA for each function and if any one of them
577 * If a slot doesn't have _STA and if any one of its functions'
582 static unsigned int get_slot_status(struct acpiphp_slot *slot) in get_slot_status() argument
588 list_for_each_entry(func, &slot->funcs, sibling) { in get_slot_status()
597 if (pci_bus_read_dev_vendor_id(slot->bus, in get_slot_status()
598 PCI_DEVFN(slot->device, func->function), in get_slot_status()
608 * Check for the slot itself since it may be that the in get_slot_status()
609 * ACPI slot is a device below PCIe upstream port so in in get_slot_status()
612 if (pci_bus_read_dev_vendor_id(slot->bus, in get_slot_status()
613 PCI_DEVFN(slot->device, 0), &dvid, 0)) { in get_slot_status()
682 struct acpiphp_slot *slot; in acpiphp_check_bridge() local
691 list_for_each_entry(slot, &bridge->slots, node) { in acpiphp_check_bridge()
692 struct pci_bus *bus = slot->bus; in acpiphp_check_bridge()
695 if (slot_no_hotplug(slot)) { in acpiphp_check_bridge()
697 } else if (device_status_valid(get_slot_status(slot))) { in acpiphp_check_bridge()
701 if (PCI_SLOT(dev->devfn) == slot->device) in acpiphp_check_bridge()
705 enable_slot(slot, true); in acpiphp_check_bridge()
707 disable_slot(slot); in acpiphp_check_bridge()
764 static int acpiphp_disable_and_eject_slot(struct acpiphp_slot *slot);
770 struct acpiphp_slot *slot = func->slot; in hotplug_event() local
788 else if (!(slot->flags & SLOT_IS_GOING_AWAY)) in hotplug_event()
789 enable_slot(slot, false); in hotplug_event()
798 } else if (!(slot->flags & SLOT_IS_GOING_AWAY)) { in hotplug_event()
800 * Check if anything has changed in the slot and rescan in hotplug_event()
803 if (acpiphp_rescan_slot(slot)) in hotplug_event()
811 acpiphp_disable_and_eject_slot(slot); in hotplug_event()
837 * A "slot" is an object associated with a PCI device number. All functions
838 * (PCI devices) with the same bus and device number belong to the same slot.
906 /* register all slot objects under this bridge */ in acpiphp_enumerate_slots()
941 * acpiphp_remove_slots - Remove slot objects associated with a given bus.
942 * @bus: PCI bus to remove the slot objects for.
963 * acpiphp_enable_slot - power on slot
964 * @slot: ACPI PHP slot
966 int acpiphp_enable_slot(struct acpiphp_slot *slot) in acpiphp_enable_slot() argument
970 if (slot->flags & SLOT_IS_GOING_AWAY) { in acpiphp_enable_slot()
976 if (!(slot->flags & SLOT_ENABLED)) in acpiphp_enable_slot()
977 enable_slot(slot, false); in acpiphp_enable_slot()
984 * acpiphp_disable_and_eject_slot - power off and eject slot
985 * @slot: ACPI PHP slot
987 static int acpiphp_disable_and_eject_slot(struct acpiphp_slot *slot) in acpiphp_disable_and_eject_slot() argument
991 if (slot->flags & SLOT_IS_GOING_AWAY) in acpiphp_disable_and_eject_slot()
995 disable_slot(slot); in acpiphp_disable_and_eject_slot()
997 list_for_each_entry(func, &slot->funcs, sibling) in acpiphp_disable_and_eject_slot()
1010 int acpiphp_disable_slot(struct acpiphp_slot *slot) in acpiphp_disable_slot() argument
1020 ret = acpiphp_disable_and_eject_slot(slot); in acpiphp_disable_slot()
1027 * slot enabled: 1
1028 * slot disabled: 0
1030 u8 acpiphp_get_power_status(struct acpiphp_slot *slot) in acpiphp_get_power_status() argument
1032 return (slot->flags & SLOT_ENABLED); in acpiphp_get_power_status()
1039 u8 acpiphp_get_latch_status(struct acpiphp_slot *slot) in acpiphp_get_latch_status() argument
1041 return !(get_slot_status(slot) & ACPI_STA_DEVICE_UI); in acpiphp_get_latch_status()
1048 u8 acpiphp_get_adapter_status(struct acpiphp_slot *slot) in acpiphp_get_adapter_status() argument
1050 return !!get_slot_status(slot); in acpiphp_get_adapter_status()