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()
2535 struct hv_pci_dev *hpdev; member
2558 dev_err(&completion->hpdev->hbus->hdev->device, in q_resource_requirements()
2563 completion->hpdev->probed_bar[i] = in q_resource_requirements()
2585 struct hv_pci_dev *hpdev; in new_pcichild_device() local
2595 hpdev = kzalloc_obj(*hpdev); in new_pcichild_device()
2596 if (!hpdev) in new_pcichild_device()
2599 hpdev->hbus = hbus; in new_pcichild_device()
2603 comp_pkt.hpdev = hpdev; in new_pcichild_device()
2621 hpdev->desc = *desc; in new_pcichild_device()
2622 refcount_set(&hpdev->refs, 1); in new_pcichild_device()
2623 get_pcichild(hpdev); in new_pcichild_device()
2626 list_add_tail(&hpdev->list_entry, &hbus->children); in new_pcichild_device()
2628 return hpdev; in new_pcichild_device()
2631 kfree(hpdev); in new_pcichild_device()
2652 struct hv_pci_dev *iter, *hpdev = NULL; in get_pcichild_wslot() local
2657 hpdev = iter; in get_pcichild_wslot()
2658 get_pcichild(hpdev); in get_pcichild_wslot()
2664 return hpdev; in get_pcichild_wslot()
2695 struct hv_pci_dev *hpdev; in pci_devices_present_work() local
2730 list_for_each_entry(hpdev, &hbus->children, list_entry) { in pci_devices_present_work()
2731 hpdev->reported_missing = true; in pci_devices_present_work()
2741 list_for_each_entry(hpdev, &hbus->children, list_entry) { in pci_devices_present_work()
2742 if ((hpdev->desc.win_slot.slot == new_desc->win_slot.slot) && in pci_devices_present_work()
2743 (hpdev->desc.v_id == new_desc->v_id) && in pci_devices_present_work()
2744 (hpdev->desc.d_id == new_desc->d_id) && in pci_devices_present_work()
2745 (hpdev->desc.ser == new_desc->ser)) { in pci_devices_present_work()
2746 hpdev->reported_missing = false; in pci_devices_present_work()
2753 hpdev = new_pcichild_device(hbus, new_desc); in pci_devices_present_work()
2754 if (!hpdev) in pci_devices_present_work()
2764 list_for_each_entry(hpdev, &hbus->children, list_entry) { in pci_devices_present_work()
2765 if (hpdev->reported_missing) { in pci_devices_present_work()
2767 put_pcichild(hpdev); in pci_devices_present_work()
2768 list_move_tail(&hpdev->list_entry, &removed); in pci_devices_present_work()
2777 hpdev = list_first_entry(&removed, struct hv_pci_dev, in pci_devices_present_work()
2779 list_del(&hpdev->list_entry); in pci_devices_present_work()
2781 if (hpdev->pci_slot) in pci_devices_present_work()
2782 pci_destroy_slot(hpdev->pci_slot); in pci_devices_present_work()
2784 put_pcichild(hpdev); in pci_devices_present_work()
2945 struct hv_pci_dev *hpdev; in hv_eject_device_work() local
2954 hpdev = container_of(work, struct hv_pci_dev, wrk); in hv_eject_device_work()
2955 hbus = hpdev->hbus; in hv_eject_device_work()
2965 wslot = wslot_to_devfn(hpdev->desc.win_slot.slot); in hv_eject_device_work()
2975 list_del(&hpdev->list_entry); in hv_eject_device_work()
2978 if (hpdev->pci_slot) in hv_eject_device_work()
2979 pci_destroy_slot(hpdev->pci_slot); in hv_eject_device_work()
2984 ejct_pkt->wslot.slot = hpdev->desc.win_slot.slot; in hv_eject_device_work()
2990 put_pcichild(hpdev); in hv_eject_device_work()
2992 put_pcichild(hpdev); in hv_eject_device_work()
2993 put_pcichild(hpdev); in hv_eject_device_work()
3007 static void hv_pci_eject_device(struct hv_pci_dev *hpdev) in hv_pci_eject_device() argument
3009 struct hv_pcibus_device *hbus = hpdev->hbus; in hv_pci_eject_device()
3017 get_pcichild(hpdev); in hv_pci_eject_device()
3018 INIT_WORK(&hpdev->wrk, hv_eject_device_work); in hv_pci_eject_device()
3019 queue_work(hbus->wq, &hpdev->wrk); in hv_pci_eject_device()
3047 struct hv_pci_dev *hpdev; in hv_pci_onchannelcallback() local
3150 hpdev = get_pcichild_wslot(hbus, in hv_pci_onchannelcallback()
3152 if (hpdev) { in hv_pci_onchannelcallback()
3153 hv_pci_eject_device(hpdev); in hv_pci_onchannelcallback()
3154 put_pcichild(hpdev); in hv_pci_onchannelcallback()
3166 hpdev = get_pcichild_wslot(hbus, in hv_pci_onchannelcallback()
3168 if (hpdev) { in hv_pci_onchannelcallback()
3169 if (hpdev->block_invalidate) { in hv_pci_onchannelcallback()
3170 hpdev->block_invalidate( in hv_pci_onchannelcallback()
3171 hpdev->invalidate_context, in hv_pci_onchannelcallback()
3174 put_pcichild(hpdev); in hv_pci_onchannelcallback()
3593 struct hv_pci_dev *hpdev; in hv_send_resources_allocated() local
3609 hpdev = get_pcichild_wslot(hbus, wslot); in hv_send_resources_allocated()
3610 if (!hpdev) in hv_send_resources_allocated()
3623 res_assigned->wslot.slot = hpdev->desc.win_slot.slot; in hv_send_resources_allocated()
3629 res_assigned2->wslot.slot = hpdev->desc.win_slot.slot; in hv_send_resources_allocated()
3631 put_pcichild(hpdev); in hv_send_resources_allocated()
3668 struct hv_pci_dev *hpdev; in hv_send_resources_released() local
3673 hpdev = get_pcichild_wslot(hbus, wslot); in hv_send_resources_released()
3674 if (!hpdev) in hv_send_resources_released()
3679 pkt.wslot.slot = hpdev->desc.win_slot.slot; in hv_send_resources_released()
3681 put_pcichild(hpdev); in hv_send_resources_released()
3894 struct hv_pci_dev *hpdev, *tmp; in hv_pci_bus_exit() local
3912 list_for_each_entry_safe(hpdev, tmp, &hbus->children, list_entry) in hv_pci_bus_exit()
3913 list_move_tail(&hpdev->list_entry, &removed); in hv_pci_bus_exit()
3917 list_for_each_entry_safe(hpdev, tmp, &removed, list_entry) { in hv_pci_bus_exit()
3918 list_del(&hpdev->list_entry); in hv_pci_bus_exit()
3919 if (hpdev->pci_slot) in hv_pci_bus_exit()
3920 pci_destroy_slot(hpdev->pci_slot); in hv_pci_bus_exit()
3922 put_pcichild(hpdev); in hv_pci_bus_exit()
3923 put_pcichild(hpdev); in hv_pci_bus_exit()