Lines Matching refs:hpdev

970 static void get_pcichild(struct hv_pci_dev *hpdev)
972 refcount_inc(&hpdev->refs);
975 static void put_pcichild(struct hv_pci_dev *hpdev)
977 if (refcount_dec_and_test(&hpdev->refs))
978 kfree(hpdev);
1110 * @hpdev: The PCI driver's representation of the device
1115 static void _hv_pcifront_read_config(struct hv_pci_dev *hpdev, int where,
1118 struct hv_pcibus_device *hbus = hpdev->hbus;
1127 memcpy(val, ((u8 *)&hpdev->desc.v_id) + where, size);
1130 memcpy(val, ((u8 *)&hpdev->desc.rev) + where -
1134 memcpy(val, (u8 *)&hpdev->desc.subsystem_id + where -
1155 hpdev->desc.win_slot.slot);
1161 writel(hpdev->desc.win_slot.slot, hbus->cfg_addr);
1188 static u16 hv_pcifront_get_vendor_id(struct hv_pci_dev *hpdev)
1190 struct hv_pcibus_device *hbus = hpdev->hbus;
1203 hpdev->desc.win_slot.slot);
1210 writel(hpdev->desc.win_slot.slot, hbus->cfg_addr);
1228 * @hpdev: The PCI driver's representation of the device
1233 static void _hv_pcifront_write_config(struct hv_pci_dev *hpdev, int where,
1236 struct hv_pcibus_device *hbus = hpdev->hbus;
1251 hpdev->desc.win_slot.slot);
1257 writel(hpdev->desc.win_slot.slot, hbus->cfg_addr);
1300 struct hv_pci_dev *hpdev;
1302 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(devfn));
1303 if (!hpdev)
1306 _hv_pcifront_read_config(hpdev, where, size, val);
1308 put_pcichild(hpdev);
1328 struct hv_pci_dev *hpdev;
1330 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(devfn));
1331 if (!hpdev)
1334 _hv_pcifront_write_config(hpdev, where, size, val);
1336 put_pcichild(hpdev);
1580 struct hv_pci_dev *hpdev;
1582 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn));
1583 if (!hpdev)
1586 hpdev->block_invalidate = block_invalidate;
1587 hpdev->invalidate_context = context;
1589 put_pcichild(hpdev);
1595 static void hv_int_desc_free(struct hv_pci_dev *hpdev,
1612 int_pkt->wslot.slot = hpdev->desc.win_slot.slot;
1614 vmbus_sendpacket(hpdev->hbus->hdev->channel, int_pkt, sizeof(*int_pkt),
1634 struct hv_pci_dev *hpdev;
1647 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn));
1648 if (!hpdev) {
1653 hv_int_desc_free(hpdev, int_desc);
1654 put_pcichild(hpdev);
1824 struct hv_pci_dev *hpdev;
1869 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn));
1870 if (!hpdev)
1877 hv_int_desc_free(hpdev, int_desc);
1898 put_pcichild(hpdev);
1929 hpdev->desc.win_slot.slot,
1938 hpdev->desc.win_slot.slot,
1946 hpdev->desc.win_slot.slot,
1961 ret = vmbus_sendpacket_getid(hpdev->hbus->hdev->channel, &ctxt.int_pkts,
1986 if (hv_pcifront_get_vendor_id(hpdev) == 0xFFFF) {
2032 put_pcichild(hpdev);
2049 put_pcichild(hpdev);
2138 struct hv_pci_dev *hpdev;
2163 list_for_each_entry(hpdev, &hbus->children, list_entry) {
2165 if (hpdev->probed_bar[i] & PCI_BASE_ADDRESS_SPACE_IO)
2169 if (hpdev->probed_bar[i] != 0) {
2175 bar_val = hpdev->probed_bar[i];
2178 ((u64)hpdev->probed_bar[++i] << 32);
2215 struct hv_pci_dev *hpdev;
2246 list_for_each_entry(hpdev, &hbus->children, list_entry) {
2247 _hv_pcifront_read_config(hpdev, PCI_COMMAND, 2, &command);
2249 _hv_pcifront_write_config(hpdev, PCI_COMMAND, 2, command);
2254 list_for_each_entry(hpdev, &hbus->children, list_entry) {
2256 bar_val = hpdev->probed_bar[i];
2262 ((u64)hpdev->probed_bar[i + 1]
2273 _hv_pcifront_write_config(hpdev,
2278 _hv_pcifront_write_config(hpdev,
2285 _hv_pcifront_write_config(hpdev,
2326 struct hv_pci_dev *hpdev;
2330 list_for_each_entry(hpdev, &hbus->children, list_entry) {
2331 if (hpdev->pci_slot)
2334 slot_nr = PCI_SLOT(wslot_to_devfn(hpdev->desc.win_slot.slot));
2335 snprintf(name, SLOT_NAME_SIZE, "%u", hpdev->desc.ser);
2336 hpdev->pci_slot = pci_create_slot(hbus->bridge->bus, slot_nr,
2338 if (IS_ERR(hpdev->pci_slot)) {
2340 hpdev->pci_slot = NULL;
2350 struct hv_pci_dev *hpdev;
2352 list_for_each_entry(hpdev, &hbus->children, list_entry) {
2353 if (!hpdev->pci_slot)
2355 pci_destroy_slot(hpdev->pci_slot);
2356 hpdev->pci_slot = NULL;
2421 struct hv_pci_dev *hpdev;
2444 dev_err(&completion->hpdev->hbus->hdev->device,
2449 completion->hpdev->probed_bar[i] =
2471 struct hv_pci_dev *hpdev;
2481 hpdev = kzalloc(sizeof(*hpdev), GFP_KERNEL);
2482 if (!hpdev)
2485 hpdev->hbus = hbus;
2489 comp_pkt.hpdev = hpdev;
2507 hpdev->desc = *desc;
2508 refcount_set(&hpdev->refs, 1);
2509 get_pcichild(hpdev);
2512 list_add_tail(&hpdev->list_entry, &hbus->children);
2514 return hpdev;
2517 kfree(hpdev);
2538 struct hv_pci_dev *iter, *hpdev = NULL;
2543 hpdev = iter;
2544 get_pcichild(hpdev);
2550 return hpdev;
2581 struct hv_pci_dev *hpdev;
2616 list_for_each_entry(hpdev, &hbus->children, list_entry) {
2617 hpdev->reported_missing = true;
2627 list_for_each_entry(hpdev, &hbus->children, list_entry) {
2628 if ((hpdev->desc.win_slot.slot == new_desc->win_slot.slot) &&
2629 (hpdev->desc.v_id == new_desc->v_id) &&
2630 (hpdev->desc.d_id == new_desc->d_id) &&
2631 (hpdev->desc.ser == new_desc->ser)) {
2632 hpdev->reported_missing = false;
2639 hpdev = new_pcichild_device(hbus, new_desc);
2640 if (!hpdev)
2650 list_for_each_entry(hpdev, &hbus->children, list_entry) {
2651 if (hpdev->reported_missing) {
2653 put_pcichild(hpdev);
2654 list_move_tail(&hpdev->list_entry, &removed);
2663 hpdev = list_first_entry(&removed, struct hv_pci_dev,
2665 list_del(&hpdev->list_entry);
2667 if (hpdev->pci_slot)
2668 pci_destroy_slot(hpdev->pci_slot);
2670 put_pcichild(hpdev);
2833 struct hv_pci_dev *hpdev;
2842 hpdev = container_of(work, struct hv_pci_dev, wrk);
2843 hbus = hpdev->hbus;
2853 wslot = wslot_to_devfn(hpdev->desc.win_slot.slot);
2863 list_del(&hpdev->list_entry);
2866 if (hpdev->pci_slot)
2867 pci_destroy_slot(hpdev->pci_slot);
2872 ejct_pkt->wslot.slot = hpdev->desc.win_slot.slot;
2878 put_pcichild(hpdev);
2880 put_pcichild(hpdev);
2881 put_pcichild(hpdev);
2882 /* hpdev has been freed. Do not use it any more. */
2889 * @hpdev: Internal device tracking struct
2895 static void hv_pci_eject_device(struct hv_pci_dev *hpdev)
2897 struct hv_pcibus_device *hbus = hpdev->hbus;
2905 get_pcichild(hpdev);
2906 INIT_WORK(&hpdev->wrk, hv_eject_device_work);
2907 queue_work(hbus->wq, &hpdev->wrk);
2935 struct hv_pci_dev *hpdev;
3038 hpdev = get_pcichild_wslot(hbus,
3040 if (hpdev) {
3041 hv_pci_eject_device(hpdev);
3042 put_pcichild(hpdev);
3054 hpdev = get_pcichild_wslot(hbus,
3056 if (hpdev) {
3057 if (hpdev->block_invalidate) {
3058 hpdev->block_invalidate(
3059 hpdev->invalidate_context,
3062 put_pcichild(hpdev);
3481 struct hv_pci_dev *hpdev;
3497 hpdev = get_pcichild_wslot(hbus, wslot);
3498 if (!hpdev)
3511 res_assigned->wslot.slot = hpdev->desc.win_slot.slot;
3517 res_assigned2->wslot.slot = hpdev->desc.win_slot.slot;
3519 put_pcichild(hpdev);
3556 struct hv_pci_dev *hpdev;
3561 hpdev = get_pcichild_wslot(hbus, wslot);
3562 if (!hpdev)
3567 pkt.wslot.slot = hpdev->desc.win_slot.slot;
3569 put_pcichild(hpdev);
3820 struct hv_pci_dev *hpdev, *tmp;
3838 list_for_each_entry_safe(hpdev, tmp, &hbus->children, list_entry)
3839 list_move_tail(&hpdev->list_entry, &removed);
3843 list_for_each_entry_safe(hpdev, tmp, &removed, list_entry) {
3844 list_del(&hpdev->list_entry);
3845 if (hpdev->pci_slot)
3846 pci_destroy_slot(hpdev->pci_slot);
3848 put_pcichild(hpdev);
3849 put_pcichild(hpdev);