Lines Matching refs:hpdev
969 static void get_pcichild(struct hv_pci_dev *hpdev) in get_pcichild() argument
971 refcount_inc(&hpdev->refs); in get_pcichild()
974 static void put_pcichild(struct hv_pci_dev *hpdev) in put_pcichild() argument
976 if (refcount_dec_and_test(&hpdev->refs)) in put_pcichild()
977 kfree(hpdev); in put_pcichild()
1114 static void _hv_pcifront_read_config(struct hv_pci_dev *hpdev, int where, in _hv_pcifront_read_config() argument
1117 struct hv_pcibus_device *hbus = hpdev->hbus; in _hv_pcifront_read_config()
1126 memcpy(val, ((u8 *)&hpdev->desc.v_id) + where, size); in _hv_pcifront_read_config()
1129 memcpy(val, ((u8 *)&hpdev->desc.rev) + where - in _hv_pcifront_read_config()
1133 memcpy(val, (u8 *)&hpdev->desc.subsystem_id + where - in _hv_pcifront_read_config()
1154 hpdev->desc.win_slot.slot); in _hv_pcifront_read_config()
1160 writel(hpdev->desc.win_slot.slot, hbus->cfg_addr); in _hv_pcifront_read_config()
1187 static u16 hv_pcifront_get_vendor_id(struct hv_pci_dev *hpdev) in hv_pcifront_get_vendor_id() argument
1189 struct hv_pcibus_device *hbus = hpdev->hbus; in hv_pcifront_get_vendor_id()
1202 hpdev->desc.win_slot.slot); in hv_pcifront_get_vendor_id()
1209 writel(hpdev->desc.win_slot.slot, hbus->cfg_addr); in hv_pcifront_get_vendor_id()
1232 static void _hv_pcifront_write_config(struct hv_pci_dev *hpdev, int where, in _hv_pcifront_write_config() argument
1235 struct hv_pcibus_device *hbus = hpdev->hbus; in _hv_pcifront_write_config()
1250 hpdev->desc.win_slot.slot); in _hv_pcifront_write_config()
1256 writel(hpdev->desc.win_slot.slot, hbus->cfg_addr); in _hv_pcifront_write_config()
1299 struct hv_pci_dev *hpdev; in hv_pcifront_read_config() local
1301 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(devfn)); in hv_pcifront_read_config()
1302 if (!hpdev) in hv_pcifront_read_config()
1305 _hv_pcifront_read_config(hpdev, where, size, val); in hv_pcifront_read_config()
1307 put_pcichild(hpdev); in hv_pcifront_read_config()
1327 struct hv_pci_dev *hpdev; in hv_pcifront_write_config() local
1329 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(devfn)); in hv_pcifront_write_config()
1330 if (!hpdev) in hv_pcifront_write_config()
1333 _hv_pcifront_write_config(hpdev, where, size, val); in hv_pcifront_write_config()
1335 put_pcichild(hpdev); in hv_pcifront_write_config()
1579 struct hv_pci_dev *hpdev; in hv_register_block_invalidate() local
1581 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn)); in hv_register_block_invalidate()
1582 if (!hpdev) in hv_register_block_invalidate()
1585 hpdev->block_invalidate = block_invalidate; in hv_register_block_invalidate()
1586 hpdev->invalidate_context = context; in hv_register_block_invalidate()
1588 put_pcichild(hpdev); in hv_register_block_invalidate()
1594 static void hv_int_desc_free(struct hv_pci_dev *hpdev, in hv_int_desc_free() argument
1611 int_pkt->wslot.slot = hpdev->desc.win_slot.slot; in hv_int_desc_free()
1613 vmbus_sendpacket(hpdev->hbus->hdev->channel, int_pkt, sizeof(*int_pkt), in hv_int_desc_free()
1633 struct hv_pci_dev *hpdev; in hv_msi_free() local
1646 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn)); in hv_msi_free()
1647 if (!hpdev) { in hv_msi_free()
1652 hv_int_desc_free(hpdev, int_desc); in hv_msi_free()
1653 put_pcichild(hpdev); in hv_msi_free()
1823 struct hv_pci_dev *hpdev; in hv_compose_msi_msg() local
1868 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn)); in hv_compose_msi_msg()
1869 if (!hpdev) in hv_compose_msi_msg()
1876 hv_int_desc_free(hpdev, int_desc); in hv_compose_msi_msg()
1897 put_pcichild(hpdev); in hv_compose_msi_msg()
1928 hpdev->desc.win_slot.slot, in hv_compose_msi_msg()
1937 hpdev->desc.win_slot.slot, in hv_compose_msi_msg()
1945 hpdev->desc.win_slot.slot, in hv_compose_msi_msg()
1960 ret = vmbus_sendpacket_getid(hpdev->hbus->hdev->channel, &ctxt.int_pkts, in hv_compose_msi_msg()
1985 if (hv_pcifront_get_vendor_id(hpdev) == 0xFFFF) { in hv_compose_msi_msg()
2031 put_pcichild(hpdev); in hv_compose_msi_msg()
2048 put_pcichild(hpdev); in hv_compose_msi_msg()
2137 struct hv_pci_dev *hpdev; in survey_child_resources() local
2162 list_for_each_entry(hpdev, &hbus->children, list_entry) { in survey_child_resources()
2164 if (hpdev->probed_bar[i] & PCI_BASE_ADDRESS_SPACE_IO) in survey_child_resources()
2168 if (hpdev->probed_bar[i] != 0) { in survey_child_resources()
2174 bar_val = hpdev->probed_bar[i]; in survey_child_resources()
2177 ((u64)hpdev->probed_bar[++i] << 32); in survey_child_resources()
2214 struct hv_pci_dev *hpdev; in prepopulate_bars() local
2245 list_for_each_entry(hpdev, &hbus->children, list_entry) { in prepopulate_bars()
2246 _hv_pcifront_read_config(hpdev, PCI_COMMAND, 2, &command); in prepopulate_bars()
2248 _hv_pcifront_write_config(hpdev, PCI_COMMAND, 2, command); in prepopulate_bars()
2253 list_for_each_entry(hpdev, &hbus->children, list_entry) { in prepopulate_bars()
2255 bar_val = hpdev->probed_bar[i]; in prepopulate_bars()
2261 ((u64)hpdev->probed_bar[i + 1] in prepopulate_bars()
2272 _hv_pcifront_write_config(hpdev, in prepopulate_bars()
2277 _hv_pcifront_write_config(hpdev, in prepopulate_bars()
2284 _hv_pcifront_write_config(hpdev, in prepopulate_bars()
2325 struct hv_pci_dev *hpdev; in hv_pci_assign_slots() local
2329 list_for_each_entry(hpdev, &hbus->children, list_entry) { in hv_pci_assign_slots()
2330 if (hpdev->pci_slot) in hv_pci_assign_slots()
2333 slot_nr = PCI_SLOT(wslot_to_devfn(hpdev->desc.win_slot.slot)); in hv_pci_assign_slots()
2334 snprintf(name, SLOT_NAME_SIZE, "%u", hpdev->desc.ser); in hv_pci_assign_slots()
2335 hpdev->pci_slot = pci_create_slot(hbus->bridge->bus, slot_nr, in hv_pci_assign_slots()
2337 if (IS_ERR(hpdev->pci_slot)) { in hv_pci_assign_slots()
2339 hpdev->pci_slot = NULL; in hv_pci_assign_slots()
2349 struct hv_pci_dev *hpdev; in hv_pci_remove_slots() local
2351 list_for_each_entry(hpdev, &hbus->children, list_entry) { in hv_pci_remove_slots()
2352 if (!hpdev->pci_slot) in hv_pci_remove_slots()
2354 pci_destroy_slot(hpdev->pci_slot); in hv_pci_remove_slots()
2355 hpdev->pci_slot = NULL; in hv_pci_remove_slots()
2420 struct hv_pci_dev *hpdev; member
2443 dev_err(&completion->hpdev->hbus->hdev->device, in q_resource_requirements()
2448 completion->hpdev->probed_bar[i] = in q_resource_requirements()
2470 struct hv_pci_dev *hpdev; in new_pcichild_device() local
2480 hpdev = kzalloc(sizeof(*hpdev), GFP_KERNEL); in new_pcichild_device()
2481 if (!hpdev) in new_pcichild_device()
2484 hpdev->hbus = hbus; in new_pcichild_device()
2488 comp_pkt.hpdev = hpdev; in new_pcichild_device()
2506 hpdev->desc = *desc; in new_pcichild_device()
2507 refcount_set(&hpdev->refs, 1); in new_pcichild_device()
2508 get_pcichild(hpdev); in new_pcichild_device()
2511 list_add_tail(&hpdev->list_entry, &hbus->children); in new_pcichild_device()
2513 return hpdev; in new_pcichild_device()
2516 kfree(hpdev); in new_pcichild_device()
2537 struct hv_pci_dev *iter, *hpdev = NULL; in get_pcichild_wslot() local
2542 hpdev = iter; in get_pcichild_wslot()
2543 get_pcichild(hpdev); in get_pcichild_wslot()
2549 return hpdev; in get_pcichild_wslot()
2580 struct hv_pci_dev *hpdev; in pci_devices_present_work() local
2615 list_for_each_entry(hpdev, &hbus->children, list_entry) { in pci_devices_present_work()
2616 hpdev->reported_missing = true; in pci_devices_present_work()
2626 list_for_each_entry(hpdev, &hbus->children, list_entry) { in pci_devices_present_work()
2627 if ((hpdev->desc.win_slot.slot == new_desc->win_slot.slot) && in pci_devices_present_work()
2628 (hpdev->desc.v_id == new_desc->v_id) && in pci_devices_present_work()
2629 (hpdev->desc.d_id == new_desc->d_id) && in pci_devices_present_work()
2630 (hpdev->desc.ser == new_desc->ser)) { in pci_devices_present_work()
2631 hpdev->reported_missing = false; in pci_devices_present_work()
2638 hpdev = new_pcichild_device(hbus, new_desc); in pci_devices_present_work()
2639 if (!hpdev) in pci_devices_present_work()
2649 list_for_each_entry(hpdev, &hbus->children, list_entry) { in pci_devices_present_work()
2650 if (hpdev->reported_missing) { in pci_devices_present_work()
2652 put_pcichild(hpdev); in pci_devices_present_work()
2653 list_move_tail(&hpdev->list_entry, &removed); in pci_devices_present_work()
2662 hpdev = list_first_entry(&removed, struct hv_pci_dev, in pci_devices_present_work()
2664 list_del(&hpdev->list_entry); in pci_devices_present_work()
2666 if (hpdev->pci_slot) in pci_devices_present_work()
2667 pci_destroy_slot(hpdev->pci_slot); in pci_devices_present_work()
2669 put_pcichild(hpdev); in pci_devices_present_work()
2832 struct hv_pci_dev *hpdev; in hv_eject_device_work() local
2841 hpdev = container_of(work, struct hv_pci_dev, wrk); in hv_eject_device_work()
2842 hbus = hpdev->hbus; in hv_eject_device_work()
2852 wslot = wslot_to_devfn(hpdev->desc.win_slot.slot); in hv_eject_device_work()
2862 list_del(&hpdev->list_entry); in hv_eject_device_work()
2865 if (hpdev->pci_slot) in hv_eject_device_work()
2866 pci_destroy_slot(hpdev->pci_slot); in hv_eject_device_work()
2871 ejct_pkt->wslot.slot = hpdev->desc.win_slot.slot; in hv_eject_device_work()
2877 put_pcichild(hpdev); in hv_eject_device_work()
2879 put_pcichild(hpdev); in hv_eject_device_work()
2880 put_pcichild(hpdev); in hv_eject_device_work()
2894 static void hv_pci_eject_device(struct hv_pci_dev *hpdev) in hv_pci_eject_device() argument
2896 struct hv_pcibus_device *hbus = hpdev->hbus; in hv_pci_eject_device()
2904 get_pcichild(hpdev); in hv_pci_eject_device()
2905 INIT_WORK(&hpdev->wrk, hv_eject_device_work); in hv_pci_eject_device()
2906 queue_work(hbus->wq, &hpdev->wrk); in hv_pci_eject_device()
2934 struct hv_pci_dev *hpdev; in hv_pci_onchannelcallback() local
3037 hpdev = get_pcichild_wslot(hbus, in hv_pci_onchannelcallback()
3039 if (hpdev) { in hv_pci_onchannelcallback()
3040 hv_pci_eject_device(hpdev); in hv_pci_onchannelcallback()
3041 put_pcichild(hpdev); in hv_pci_onchannelcallback()
3053 hpdev = get_pcichild_wslot(hbus, in hv_pci_onchannelcallback()
3055 if (hpdev) { in hv_pci_onchannelcallback()
3056 if (hpdev->block_invalidate) { in hv_pci_onchannelcallback()
3057 hpdev->block_invalidate( in hv_pci_onchannelcallback()
3058 hpdev->invalidate_context, in hv_pci_onchannelcallback()
3061 put_pcichild(hpdev); in hv_pci_onchannelcallback()
3480 struct hv_pci_dev *hpdev; in hv_send_resources_allocated() local
3496 hpdev = get_pcichild_wslot(hbus, wslot); in hv_send_resources_allocated()
3497 if (!hpdev) in hv_send_resources_allocated()
3510 res_assigned->wslot.slot = hpdev->desc.win_slot.slot; in hv_send_resources_allocated()
3516 res_assigned2->wslot.slot = hpdev->desc.win_slot.slot; in hv_send_resources_allocated()
3518 put_pcichild(hpdev); in hv_send_resources_allocated()
3555 struct hv_pci_dev *hpdev; in hv_send_resources_released() local
3560 hpdev = get_pcichild_wslot(hbus, wslot); in hv_send_resources_released()
3561 if (!hpdev) in hv_send_resources_released()
3566 pkt.wslot.slot = hpdev->desc.win_slot.slot; in hv_send_resources_released()
3568 put_pcichild(hpdev); in hv_send_resources_released()
3819 struct hv_pci_dev *hpdev, *tmp; in hv_pci_bus_exit() local
3837 list_for_each_entry_safe(hpdev, tmp, &hbus->children, list_entry) in hv_pci_bus_exit()
3838 list_move_tail(&hpdev->list_entry, &removed); in hv_pci_bus_exit()
3842 list_for_each_entry_safe(hpdev, tmp, &removed, list_entry) { in hv_pci_bus_exit()
3843 list_del(&hpdev->list_entry); in hv_pci_bus_exit()
3844 if (hpdev->pci_slot) in hv_pci_bus_exit()
3845 pci_destroy_slot(hpdev->pci_slot); in hv_pci_bus_exit()
3847 put_pcichild(hpdev); in hv_pci_bus_exit()
3848 put_pcichild(hpdev); in hv_pci_bus_exit()