Lines Matching refs:hpdev

963 static void get_pcichild(struct hv_pci_dev *hpdev)  in get_pcichild()  argument
965 refcount_inc(&hpdev->refs); in get_pcichild()
968 static void put_pcichild(struct hv_pci_dev *hpdev) in put_pcichild() argument
970 if (refcount_dec_and_test(&hpdev->refs)) in put_pcichild()
971 kfree(hpdev); in put_pcichild()
1108 static void _hv_pcifront_read_config(struct hv_pci_dev *hpdev, int where, in _hv_pcifront_read_config() argument
1111 struct hv_pcibus_device *hbus = hpdev->hbus; in _hv_pcifront_read_config()
1120 memcpy(val, ((u8 *)&hpdev->desc.v_id) + where, size); in _hv_pcifront_read_config()
1123 memcpy(val, ((u8 *)&hpdev->desc.rev) + where - in _hv_pcifront_read_config()
1127 memcpy(val, (u8 *)&hpdev->desc.subsystem_id + where - in _hv_pcifront_read_config()
1148 hpdev->desc.win_slot.slot); in _hv_pcifront_read_config()
1154 writel(hpdev->desc.win_slot.slot, hbus->cfg_addr); in _hv_pcifront_read_config()
1181 static u16 hv_pcifront_get_vendor_id(struct hv_pci_dev *hpdev) in hv_pcifront_get_vendor_id() argument
1183 struct hv_pcibus_device *hbus = hpdev->hbus; in hv_pcifront_get_vendor_id()
1196 hpdev->desc.win_slot.slot); in hv_pcifront_get_vendor_id()
1203 writel(hpdev->desc.win_slot.slot, hbus->cfg_addr); in hv_pcifront_get_vendor_id()
1226 static void _hv_pcifront_write_config(struct hv_pci_dev *hpdev, int where, in _hv_pcifront_write_config() argument
1229 struct hv_pcibus_device *hbus = hpdev->hbus; in _hv_pcifront_write_config()
1244 hpdev->desc.win_slot.slot); in _hv_pcifront_write_config()
1250 writel(hpdev->desc.win_slot.slot, hbus->cfg_addr); in _hv_pcifront_write_config()
1293 struct hv_pci_dev *hpdev; in hv_pcifront_read_config() local
1295 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(devfn)); in hv_pcifront_read_config()
1296 if (!hpdev) in hv_pcifront_read_config()
1299 _hv_pcifront_read_config(hpdev, where, size, val); in hv_pcifront_read_config()
1301 put_pcichild(hpdev); in hv_pcifront_read_config()
1321 struct hv_pci_dev *hpdev; in hv_pcifront_write_config() local
1323 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(devfn)); in hv_pcifront_write_config()
1324 if (!hpdev) in hv_pcifront_write_config()
1327 _hv_pcifront_write_config(hpdev, where, size, val); in hv_pcifront_write_config()
1329 put_pcichild(hpdev); in hv_pcifront_write_config()
1573 struct hv_pci_dev *hpdev; in hv_register_block_invalidate() local
1575 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn)); in hv_register_block_invalidate()
1576 if (!hpdev) in hv_register_block_invalidate()
1579 hpdev->block_invalidate = block_invalidate; in hv_register_block_invalidate()
1580 hpdev->invalidate_context = context; in hv_register_block_invalidate()
1582 put_pcichild(hpdev); in hv_register_block_invalidate()
1588 static void hv_int_desc_free(struct hv_pci_dev *hpdev, in hv_int_desc_free() argument
1605 int_pkt->wslot.slot = hpdev->desc.win_slot.slot; in hv_int_desc_free()
1607 vmbus_sendpacket(hpdev->hbus->hdev->channel, int_pkt, sizeof(*int_pkt), in hv_int_desc_free()
1627 struct hv_pci_dev *hpdev; in hv_msi_free() local
1640 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn)); in hv_msi_free()
1641 if (!hpdev) { in hv_msi_free()
1646 hv_int_desc_free(hpdev, int_desc); in hv_msi_free()
1647 put_pcichild(hpdev); in hv_msi_free()
1817 struct hv_pci_dev *hpdev; in hv_compose_msi_msg() local
1862 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn)); in hv_compose_msi_msg()
1863 if (!hpdev) in hv_compose_msi_msg()
1870 hv_int_desc_free(hpdev, int_desc); in hv_compose_msi_msg()
1891 put_pcichild(hpdev); in hv_compose_msi_msg()
1922 hpdev->desc.win_slot.slot, in hv_compose_msi_msg()
1931 hpdev->desc.win_slot.slot, in hv_compose_msi_msg()
1939 hpdev->desc.win_slot.slot, in hv_compose_msi_msg()
1954 ret = vmbus_sendpacket_getid(hpdev->hbus->hdev->channel, &ctxt.int_pkts, in hv_compose_msi_msg()
1979 if (hv_pcifront_get_vendor_id(hpdev) == 0xFFFF) { in hv_compose_msi_msg()
2025 put_pcichild(hpdev); in hv_compose_msi_msg()
2042 put_pcichild(hpdev); in hv_compose_msi_msg()
2131 struct hv_pci_dev *hpdev; in survey_child_resources() local
2156 list_for_each_entry(hpdev, &hbus->children, list_entry) { in survey_child_resources()
2158 if (hpdev->probed_bar[i] & PCI_BASE_ADDRESS_SPACE_IO) in survey_child_resources()
2162 if (hpdev->probed_bar[i] != 0) { in survey_child_resources()
2168 bar_val = hpdev->probed_bar[i]; in survey_child_resources()
2171 ((u64)hpdev->probed_bar[++i] << 32); in survey_child_resources()
2208 struct hv_pci_dev *hpdev; in prepopulate_bars() local
2239 list_for_each_entry(hpdev, &hbus->children, list_entry) { in prepopulate_bars()
2240 _hv_pcifront_read_config(hpdev, PCI_COMMAND, 2, &command); in prepopulate_bars()
2242 _hv_pcifront_write_config(hpdev, PCI_COMMAND, 2, command); in prepopulate_bars()
2247 list_for_each_entry(hpdev, &hbus->children, list_entry) { in prepopulate_bars()
2249 bar_val = hpdev->probed_bar[i]; in prepopulate_bars()
2255 ((u64)hpdev->probed_bar[i + 1] in prepopulate_bars()
2266 _hv_pcifront_write_config(hpdev, in prepopulate_bars()
2271 _hv_pcifront_write_config(hpdev, in prepopulate_bars()
2278 _hv_pcifront_write_config(hpdev, in prepopulate_bars()
2319 struct hv_pci_dev *hpdev; in hv_pci_assign_slots() local
2323 list_for_each_entry(hpdev, &hbus->children, list_entry) { in hv_pci_assign_slots()
2324 if (hpdev->pci_slot) in hv_pci_assign_slots()
2327 slot_nr = PCI_SLOT(wslot_to_devfn(hpdev->desc.win_slot.slot)); in hv_pci_assign_slots()
2328 snprintf(name, SLOT_NAME_SIZE, "%u", hpdev->desc.ser); in hv_pci_assign_slots()
2329 hpdev->pci_slot = pci_create_slot(hbus->bridge->bus, slot_nr, in hv_pci_assign_slots()
2331 if (IS_ERR(hpdev->pci_slot)) { in hv_pci_assign_slots()
2333 hpdev->pci_slot = NULL; in hv_pci_assign_slots()
2343 struct hv_pci_dev *hpdev; in hv_pci_remove_slots() local
2345 list_for_each_entry(hpdev, &hbus->children, list_entry) { in hv_pci_remove_slots()
2346 if (!hpdev->pci_slot) in hv_pci_remove_slots()
2348 pci_destroy_slot(hpdev->pci_slot); in hv_pci_remove_slots()
2349 hpdev->pci_slot = NULL; in hv_pci_remove_slots()
2414 struct hv_pci_dev *hpdev; member
2437 dev_err(&completion->hpdev->hbus->hdev->device, in q_resource_requirements()
2442 completion->hpdev->probed_bar[i] = in q_resource_requirements()
2464 struct hv_pci_dev *hpdev; in new_pcichild_device() local
2474 hpdev = kzalloc(sizeof(*hpdev), GFP_KERNEL); in new_pcichild_device()
2475 if (!hpdev) in new_pcichild_device()
2478 hpdev->hbus = hbus; in new_pcichild_device()
2482 comp_pkt.hpdev = hpdev; in new_pcichild_device()
2500 hpdev->desc = *desc; in new_pcichild_device()
2501 refcount_set(&hpdev->refs, 1); in new_pcichild_device()
2502 get_pcichild(hpdev); in new_pcichild_device()
2505 list_add_tail(&hpdev->list_entry, &hbus->children); in new_pcichild_device()
2507 return hpdev; in new_pcichild_device()
2510 kfree(hpdev); in new_pcichild_device()
2531 struct hv_pci_dev *iter, *hpdev = NULL; in get_pcichild_wslot() local
2536 hpdev = iter; in get_pcichild_wslot()
2537 get_pcichild(hpdev); in get_pcichild_wslot()
2543 return hpdev; in get_pcichild_wslot()
2574 struct hv_pci_dev *hpdev; in pci_devices_present_work() local
2609 list_for_each_entry(hpdev, &hbus->children, list_entry) { in pci_devices_present_work()
2610 hpdev->reported_missing = true; in pci_devices_present_work()
2620 list_for_each_entry(hpdev, &hbus->children, list_entry) { in pci_devices_present_work()
2621 if ((hpdev->desc.win_slot.slot == new_desc->win_slot.slot) && in pci_devices_present_work()
2622 (hpdev->desc.v_id == new_desc->v_id) && in pci_devices_present_work()
2623 (hpdev->desc.d_id == new_desc->d_id) && in pci_devices_present_work()
2624 (hpdev->desc.ser == new_desc->ser)) { in pci_devices_present_work()
2625 hpdev->reported_missing = false; in pci_devices_present_work()
2632 hpdev = new_pcichild_device(hbus, new_desc); in pci_devices_present_work()
2633 if (!hpdev) in pci_devices_present_work()
2643 list_for_each_entry(hpdev, &hbus->children, list_entry) { in pci_devices_present_work()
2644 if (hpdev->reported_missing) { in pci_devices_present_work()
2646 put_pcichild(hpdev); in pci_devices_present_work()
2647 list_move_tail(&hpdev->list_entry, &removed); in pci_devices_present_work()
2656 hpdev = list_first_entry(&removed, struct hv_pci_dev, in pci_devices_present_work()
2658 list_del(&hpdev->list_entry); in pci_devices_present_work()
2660 if (hpdev->pci_slot) in pci_devices_present_work()
2661 pci_destroy_slot(hpdev->pci_slot); in pci_devices_present_work()
2663 put_pcichild(hpdev); in pci_devices_present_work()
2826 struct hv_pci_dev *hpdev; in hv_eject_device_work() local
2835 hpdev = container_of(work, struct hv_pci_dev, wrk); in hv_eject_device_work()
2836 hbus = hpdev->hbus; in hv_eject_device_work()
2846 wslot = wslot_to_devfn(hpdev->desc.win_slot.slot); in hv_eject_device_work()
2856 list_del(&hpdev->list_entry); in hv_eject_device_work()
2859 if (hpdev->pci_slot) in hv_eject_device_work()
2860 pci_destroy_slot(hpdev->pci_slot); in hv_eject_device_work()
2865 ejct_pkt->wslot.slot = hpdev->desc.win_slot.slot; in hv_eject_device_work()
2871 put_pcichild(hpdev); in hv_eject_device_work()
2873 put_pcichild(hpdev); in hv_eject_device_work()
2874 put_pcichild(hpdev); in hv_eject_device_work()
2888 static void hv_pci_eject_device(struct hv_pci_dev *hpdev) in hv_pci_eject_device() argument
2890 struct hv_pcibus_device *hbus = hpdev->hbus; in hv_pci_eject_device()
2898 get_pcichild(hpdev); in hv_pci_eject_device()
2899 INIT_WORK(&hpdev->wrk, hv_eject_device_work); in hv_pci_eject_device()
2900 queue_work(hbus->wq, &hpdev->wrk); in hv_pci_eject_device()
2928 struct hv_pci_dev *hpdev; in hv_pci_onchannelcallback() local
3031 hpdev = get_pcichild_wslot(hbus, in hv_pci_onchannelcallback()
3033 if (hpdev) { in hv_pci_onchannelcallback()
3034 hv_pci_eject_device(hpdev); in hv_pci_onchannelcallback()
3035 put_pcichild(hpdev); in hv_pci_onchannelcallback()
3047 hpdev = get_pcichild_wslot(hbus, in hv_pci_onchannelcallback()
3049 if (hpdev) { in hv_pci_onchannelcallback()
3050 if (hpdev->block_invalidate) { in hv_pci_onchannelcallback()
3051 hpdev->block_invalidate( in hv_pci_onchannelcallback()
3052 hpdev->invalidate_context, in hv_pci_onchannelcallback()
3055 put_pcichild(hpdev); in hv_pci_onchannelcallback()
3474 struct hv_pci_dev *hpdev; in hv_send_resources_allocated() local
3490 hpdev = get_pcichild_wslot(hbus, wslot); in hv_send_resources_allocated()
3491 if (!hpdev) in hv_send_resources_allocated()
3504 res_assigned->wslot.slot = hpdev->desc.win_slot.slot; in hv_send_resources_allocated()
3510 res_assigned2->wslot.slot = hpdev->desc.win_slot.slot; in hv_send_resources_allocated()
3512 put_pcichild(hpdev); in hv_send_resources_allocated()
3549 struct hv_pci_dev *hpdev; in hv_send_resources_released() local
3554 hpdev = get_pcichild_wslot(hbus, wslot); in hv_send_resources_released()
3555 if (!hpdev) in hv_send_resources_released()
3560 pkt.wslot.slot = hpdev->desc.win_slot.slot; in hv_send_resources_released()
3562 put_pcichild(hpdev); in hv_send_resources_released()
3813 struct hv_pci_dev *hpdev, *tmp; in hv_pci_bus_exit() local
3831 list_for_each_entry_safe(hpdev, tmp, &hbus->children, list_entry) in hv_pci_bus_exit()
3832 list_move_tail(&hpdev->list_entry, &removed); in hv_pci_bus_exit()
3836 list_for_each_entry_safe(hpdev, tmp, &removed, list_entry) { in hv_pci_bus_exit()
3837 list_del(&hpdev->list_entry); in hv_pci_bus_exit()
3838 if (hpdev->pci_slot) in hv_pci_bus_exit()
3839 pci_destroy_slot(hpdev->pci_slot); in hv_pci_bus_exit()
3841 put_pcichild(hpdev); in hv_pci_bus_exit()
3842 put_pcichild(hpdev); in hv_pci_bus_exit()