Lines Matching refs:hpdev

1030 static void get_pcichild(struct hv_pci_dev *hpdev)  in get_pcichild()  argument
1032 refcount_inc(&hpdev->refs); in get_pcichild()
1035 static void put_pcichild(struct hv_pci_dev *hpdev) in put_pcichild() argument
1037 if (refcount_dec_and_test(&hpdev->refs)) in put_pcichild()
1038 kfree(hpdev); in put_pcichild()
1175 static void _hv_pcifront_read_config(struct hv_pci_dev *hpdev, int where, in _hv_pcifront_read_config() argument
1178 struct hv_pcibus_device *hbus = hpdev->hbus; in _hv_pcifront_read_config()
1187 memcpy(val, ((u8 *)&hpdev->desc.v_id) + where, size); in _hv_pcifront_read_config()
1190 memcpy(val, ((u8 *)&hpdev->desc.rev) + where - in _hv_pcifront_read_config()
1194 memcpy(val, (u8 *)&hpdev->desc.subsystem_id + where - in _hv_pcifront_read_config()
1215 hpdev->desc.win_slot.slot); in _hv_pcifront_read_config()
1221 writel(hpdev->desc.win_slot.slot, hbus->cfg_addr); in _hv_pcifront_read_config()
1248 static u16 hv_pcifront_get_vendor_id(struct hv_pci_dev *hpdev) in hv_pcifront_get_vendor_id() argument
1250 struct hv_pcibus_device *hbus = hpdev->hbus; in hv_pcifront_get_vendor_id()
1263 hpdev->desc.win_slot.slot); in hv_pcifront_get_vendor_id()
1270 writel(hpdev->desc.win_slot.slot, hbus->cfg_addr); in hv_pcifront_get_vendor_id()
1293 static void _hv_pcifront_write_config(struct hv_pci_dev *hpdev, int where, in _hv_pcifront_write_config() argument
1296 struct hv_pcibus_device *hbus = hpdev->hbus; in _hv_pcifront_write_config()
1311 hpdev->desc.win_slot.slot); in _hv_pcifront_write_config()
1317 writel(hpdev->desc.win_slot.slot, hbus->cfg_addr); in _hv_pcifront_write_config()
1360 struct hv_pci_dev *hpdev; in hv_pcifront_read_config() local
1362 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(devfn)); in hv_pcifront_read_config()
1363 if (!hpdev) in hv_pcifront_read_config()
1366 _hv_pcifront_read_config(hpdev, where, size, val); in hv_pcifront_read_config()
1368 put_pcichild(hpdev); in hv_pcifront_read_config()
1388 struct hv_pci_dev *hpdev; in hv_pcifront_write_config() local
1390 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(devfn)); in hv_pcifront_write_config()
1391 if (!hpdev) in hv_pcifront_write_config()
1394 _hv_pcifront_write_config(hpdev, where, size, val); in hv_pcifront_write_config()
1396 put_pcichild(hpdev); in hv_pcifront_write_config()
1640 struct hv_pci_dev *hpdev; in hv_register_block_invalidate() local
1642 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn)); in hv_register_block_invalidate()
1643 if (!hpdev) in hv_register_block_invalidate()
1646 hpdev->block_invalidate = block_invalidate; in hv_register_block_invalidate()
1647 hpdev->invalidate_context = context; in hv_register_block_invalidate()
1649 put_pcichild(hpdev); in hv_register_block_invalidate()
1655 static void hv_int_desc_free(struct hv_pci_dev *hpdev, in hv_int_desc_free() argument
1672 int_pkt->wslot.slot = hpdev->desc.win_slot.slot; in hv_int_desc_free()
1674 vmbus_sendpacket(hpdev->hbus->hdev->channel, int_pkt, sizeof(*int_pkt), in hv_int_desc_free()
1692 struct hv_pci_dev *hpdev; in hv_msi_free() local
1705 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn)); in hv_msi_free()
1706 if (!hpdev) { in hv_msi_free()
1711 hv_int_desc_free(hpdev, int_desc); in hv_msi_free()
1712 put_pcichild(hpdev); in hv_msi_free()
1879 struct hv_pci_dev *hpdev; in hv_compose_msi_msg() local
1924 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn)); in hv_compose_msi_msg()
1925 if (!hpdev) in hv_compose_msi_msg()
1932 hv_int_desc_free(hpdev, int_desc); in hv_compose_msi_msg()
1953 put_pcichild(hpdev); in hv_compose_msi_msg()
1984 hpdev->desc.win_slot.slot, in hv_compose_msi_msg()
1993 hpdev->desc.win_slot.slot, in hv_compose_msi_msg()
2001 hpdev->desc.win_slot.slot, in hv_compose_msi_msg()
2016 ret = vmbus_sendpacket_getid(hpdev->hbus->hdev->channel, &ctxt.int_pkts, in hv_compose_msi_msg()
2041 if (hv_pcifront_get_vendor_id(hpdev) == 0xFFFF) { in hv_compose_msi_msg()
2087 put_pcichild(hpdev); in hv_compose_msi_msg()
2104 put_pcichild(hpdev); in hv_compose_msi_msg()
2252 struct hv_pci_dev *hpdev; in survey_child_resources() local
2277 list_for_each_entry(hpdev, &hbus->children, list_entry) { in survey_child_resources()
2279 if (hpdev->probed_bar[i] & PCI_BASE_ADDRESS_SPACE_IO) in survey_child_resources()
2283 if (hpdev->probed_bar[i] != 0) { in survey_child_resources()
2289 bar_val = hpdev->probed_bar[i]; in survey_child_resources()
2292 ((u64)hpdev->probed_bar[++i] << 32); in survey_child_resources()
2329 struct hv_pci_dev *hpdev; in prepopulate_bars() local
2360 list_for_each_entry(hpdev, &hbus->children, list_entry) { in prepopulate_bars()
2361 _hv_pcifront_read_config(hpdev, PCI_COMMAND, 2, &command); in prepopulate_bars()
2363 _hv_pcifront_write_config(hpdev, PCI_COMMAND, 2, command); in prepopulate_bars()
2368 list_for_each_entry(hpdev, &hbus->children, list_entry) { in prepopulate_bars()
2370 bar_val = hpdev->probed_bar[i]; in prepopulate_bars()
2376 ((u64)hpdev->probed_bar[i + 1] in prepopulate_bars()
2387 _hv_pcifront_write_config(hpdev, in prepopulate_bars()
2392 _hv_pcifront_write_config(hpdev, in prepopulate_bars()
2399 _hv_pcifront_write_config(hpdev, in prepopulate_bars()
2440 struct hv_pci_dev *hpdev; in hv_pci_assign_slots() local
2444 list_for_each_entry(hpdev, &hbus->children, list_entry) { in hv_pci_assign_slots()
2445 if (hpdev->pci_slot) in hv_pci_assign_slots()
2448 slot_nr = PCI_SLOT(wslot_to_devfn(hpdev->desc.win_slot.slot)); in hv_pci_assign_slots()
2449 snprintf(name, SLOT_NAME_SIZE, "%u", hpdev->desc.ser); in hv_pci_assign_slots()
2450 hpdev->pci_slot = pci_create_slot(hbus->bridge->bus, slot_nr, in hv_pci_assign_slots()
2452 if (IS_ERR(hpdev->pci_slot)) { in hv_pci_assign_slots()
2454 hpdev->pci_slot = NULL; in hv_pci_assign_slots()
2464 struct hv_pci_dev *hpdev; in hv_pci_remove_slots() local
2466 list_for_each_entry(hpdev, &hbus->children, list_entry) { in hv_pci_remove_slots()
2467 if (!hpdev->pci_slot) in hv_pci_remove_slots()
2469 pci_destroy_slot(hpdev->pci_slot); in hv_pci_remove_slots()
2470 hpdev->pci_slot = NULL; in hv_pci_remove_slots()
2543 struct hv_pci_dev *hpdev; member
2566 dev_err(&completion->hpdev->hbus->hdev->device, in q_resource_requirements()
2571 completion->hpdev->probed_bar[i] = in q_resource_requirements()
2593 struct hv_pci_dev *hpdev; in new_pcichild_device() local
2603 hpdev = kzalloc_obj(*hpdev); in new_pcichild_device()
2604 if (!hpdev) in new_pcichild_device()
2607 hpdev->hbus = hbus; in new_pcichild_device()
2611 comp_pkt.hpdev = hpdev; in new_pcichild_device()
2629 hpdev->desc = *desc; in new_pcichild_device()
2630 refcount_set(&hpdev->refs, 1); in new_pcichild_device()
2631 get_pcichild(hpdev); in new_pcichild_device()
2634 list_add_tail(&hpdev->list_entry, &hbus->children); in new_pcichild_device()
2636 return hpdev; in new_pcichild_device()
2639 kfree(hpdev); in new_pcichild_device()
2660 struct hv_pci_dev *iter, *hpdev = NULL; in get_pcichild_wslot() local
2665 hpdev = iter; in get_pcichild_wslot()
2666 get_pcichild(hpdev); in get_pcichild_wslot()
2672 return hpdev; in get_pcichild_wslot()
2703 struct hv_pci_dev *hpdev; in pci_devices_present_work() local
2738 list_for_each_entry(hpdev, &hbus->children, list_entry) { in pci_devices_present_work()
2739 hpdev->reported_missing = true; in pci_devices_present_work()
2749 list_for_each_entry(hpdev, &hbus->children, list_entry) { in pci_devices_present_work()
2750 if ((hpdev->desc.win_slot.slot == new_desc->win_slot.slot) && in pci_devices_present_work()
2751 (hpdev->desc.v_id == new_desc->v_id) && in pci_devices_present_work()
2752 (hpdev->desc.d_id == new_desc->d_id) && in pci_devices_present_work()
2753 (hpdev->desc.ser == new_desc->ser)) { in pci_devices_present_work()
2754 hpdev->reported_missing = false; in pci_devices_present_work()
2761 hpdev = new_pcichild_device(hbus, new_desc); in pci_devices_present_work()
2762 if (!hpdev) in pci_devices_present_work()
2772 list_for_each_entry(hpdev, &hbus->children, list_entry) { in pci_devices_present_work()
2773 if (hpdev->reported_missing) { in pci_devices_present_work()
2775 put_pcichild(hpdev); in pci_devices_present_work()
2776 list_move_tail(&hpdev->list_entry, &removed); in pci_devices_present_work()
2785 hpdev = list_first_entry(&removed, struct hv_pci_dev, in pci_devices_present_work()
2787 list_del(&hpdev->list_entry); in pci_devices_present_work()
2789 if (hpdev->pci_slot) in pci_devices_present_work()
2790 pci_destroy_slot(hpdev->pci_slot); in pci_devices_present_work()
2792 put_pcichild(hpdev); in pci_devices_present_work()
2953 struct hv_pci_dev *hpdev; in hv_eject_device_work() local
2962 hpdev = container_of(work, struct hv_pci_dev, wrk); in hv_eject_device_work()
2963 hbus = hpdev->hbus; in hv_eject_device_work()
2973 wslot = wslot_to_devfn(hpdev->desc.win_slot.slot); in hv_eject_device_work()
2983 list_del(&hpdev->list_entry); in hv_eject_device_work()
2986 if (hpdev->pci_slot) in hv_eject_device_work()
2987 pci_destroy_slot(hpdev->pci_slot); in hv_eject_device_work()
2992 ejct_pkt->wslot.slot = hpdev->desc.win_slot.slot; in hv_eject_device_work()
2998 put_pcichild(hpdev); in hv_eject_device_work()
3000 put_pcichild(hpdev); in hv_eject_device_work()
3001 put_pcichild(hpdev); in hv_eject_device_work()
3015 static void hv_pci_eject_device(struct hv_pci_dev *hpdev) in hv_pci_eject_device() argument
3017 struct hv_pcibus_device *hbus = hpdev->hbus; in hv_pci_eject_device()
3025 get_pcichild(hpdev); in hv_pci_eject_device()
3026 INIT_WORK(&hpdev->wrk, hv_eject_device_work); in hv_pci_eject_device()
3027 queue_work(hbus->wq, &hpdev->wrk); in hv_pci_eject_device()
3055 struct hv_pci_dev *hpdev; in hv_pci_onchannelcallback() local
3158 hpdev = get_pcichild_wslot(hbus, in hv_pci_onchannelcallback()
3160 if (hpdev) { in hv_pci_onchannelcallback()
3161 hv_pci_eject_device(hpdev); in hv_pci_onchannelcallback()
3162 put_pcichild(hpdev); in hv_pci_onchannelcallback()
3174 hpdev = get_pcichild_wslot(hbus, in hv_pci_onchannelcallback()
3176 if (hpdev) { in hv_pci_onchannelcallback()
3177 if (hpdev->block_invalidate) { in hv_pci_onchannelcallback()
3178 hpdev->block_invalidate( in hv_pci_onchannelcallback()
3179 hpdev->invalidate_context, in hv_pci_onchannelcallback()
3182 put_pcichild(hpdev); in hv_pci_onchannelcallback()
3601 struct hv_pci_dev *hpdev; in hv_send_resources_allocated() local
3617 hpdev = get_pcichild_wslot(hbus, wslot); in hv_send_resources_allocated()
3618 if (!hpdev) in hv_send_resources_allocated()
3631 res_assigned->wslot.slot = hpdev->desc.win_slot.slot; in hv_send_resources_allocated()
3637 res_assigned2->wslot.slot = hpdev->desc.win_slot.slot; in hv_send_resources_allocated()
3639 put_pcichild(hpdev); in hv_send_resources_allocated()
3676 struct hv_pci_dev *hpdev; in hv_send_resources_released() local
3681 hpdev = get_pcichild_wslot(hbus, wslot); in hv_send_resources_released()
3682 if (!hpdev) in hv_send_resources_released()
3687 pkt.wslot.slot = hpdev->desc.win_slot.slot; in hv_send_resources_released()
3689 put_pcichild(hpdev); in hv_send_resources_released()
3900 struct hv_pci_dev *hpdev, *tmp; in hv_pci_bus_exit() local
3918 list_for_each_entry_safe(hpdev, tmp, &hbus->children, list_entry) in hv_pci_bus_exit()
3919 list_move_tail(&hpdev->list_entry, &removed); in hv_pci_bus_exit()
3923 list_for_each_entry_safe(hpdev, tmp, &removed, list_entry) { in hv_pci_bus_exit()
3924 list_del(&hpdev->list_entry); in hv_pci_bus_exit()
3925 if (hpdev->pci_slot) in hv_pci_bus_exit()
3926 pci_destroy_slot(hpdev->pci_slot); in hv_pci_bus_exit()
3928 put_pcichild(hpdev); in hv_pci_bus_exit()
3929 put_pcichild(hpdev); in hv_pci_bus_exit()