Lines Matching full:pdn

34 	struct pci_dn *pdn;  in pci_bus_to_pdn()  local
53 pdn = dn ? PCI_DN(dn) : NULL; in pci_bus_to_pdn()
55 return pdn; in pci_bus_to_pdn()
62 struct pci_dn *parent, *pdn; in pci_get_pdn_by_devfn() local
77 pdn = dn ? PCI_DN(dn) : NULL; in pci_get_pdn_by_devfn()
78 if (pdn) in pci_get_pdn_by_devfn()
79 return pdn; in pci_get_pdn_by_devfn()
86 list_for_each_entry(pdn, &parent->child_list, list) { in pci_get_pdn_by_devfn()
87 if (pdn->busno == bus->number && in pci_get_pdn_by_devfn()
88 pdn->devfn == devfn) in pci_get_pdn_by_devfn()
89 return pdn; in pci_get_pdn_by_devfn()
98 struct pci_dn *parent, *pdn; in pci_get_pdn() local
106 pdn = dn ? PCI_DN(dn) : NULL; in pci_get_pdn()
107 if (pdn) in pci_get_pdn()
108 return pdn; in pci_get_pdn()
118 list_for_each_entry(pdn, &parent->child_list, list) { in pci_get_pdn()
119 if (pdn->busno == pdev->bus->number && in pci_get_pdn()
120 pdn->devfn == pdev->devfn) in pci_get_pdn()
121 return pdn; in pci_get_pdn()
128 static struct eeh_dev *eeh_dev_init(struct pci_dn *pdn) in eeh_dev_init() argument
138 pdn->edev = edev; in eeh_dev_init()
139 edev->pdn = pdn; in eeh_dev_init()
140 edev->bdfn = (pdn->busno << 8) | pdn->devfn; in eeh_dev_init()
141 edev->controller = pdn->phb; in eeh_dev_init()
151 struct pci_dn *pdn; in add_one_sriov_vf_pdn() local
157 pdn = kzalloc(sizeof(*pdn), GFP_KERNEL); in add_one_sriov_vf_pdn()
158 if (!pdn) in add_one_sriov_vf_pdn()
161 pdn->phb = parent->phb; in add_one_sriov_vf_pdn()
162 pdn->parent = parent; in add_one_sriov_vf_pdn()
163 pdn->busno = busno; in add_one_sriov_vf_pdn()
164 pdn->devfn = devfn; in add_one_sriov_vf_pdn()
165 pdn->pe_number = IODA_INVALID_PE; in add_one_sriov_vf_pdn()
166 INIT_LIST_HEAD(&pdn->child_list); in add_one_sriov_vf_pdn()
167 INIT_LIST_HEAD(&pdn->list); in add_one_sriov_vf_pdn()
168 list_add_tail(&pdn->list, &parent->child_list); in add_one_sriov_vf_pdn()
170 return pdn; in add_one_sriov_vf_pdn()
175 struct pci_dn *parent, *pdn; in add_sriov_vf_pdns() local
183 pdn = pci_get_pdn(pdev); in add_sriov_vf_pdns()
184 if (!pdn || (pdn->flags & PCI_DN_FLAG_IOV_VF)) in add_sriov_vf_pdns()
187 pdn->flags |= PCI_DN_FLAG_IOV_VF; in add_sriov_vf_pdns()
195 pdn = add_one_sriov_vf_pdn(parent, in add_sriov_vf_pdns()
198 if (!pdn) { in add_sriov_vf_pdns()
206 edev = eeh_dev_init(pdn); in add_sriov_vf_pdns()
220 struct pci_dn *pdn, *tmp; in remove_sriov_vf_pdns() local
228 pdn = pci_get_pdn(pdev); in remove_sriov_vf_pdns()
229 if (!pdn || !(pdn->flags & PCI_DN_FLAG_IOV_VF)) in remove_sriov_vf_pdns()
232 pdn->flags &= ~PCI_DN_FLAG_IOV_VF; in remove_sriov_vf_pdns()
245 list_for_each_entry_safe(pdn, tmp, in remove_sriov_vf_pdns()
247 if (pdn->busno != pci_iov_virtfn_bus(pdev, i) || in remove_sriov_vf_pdns()
248 pdn->devfn != pci_iov_virtfn_devfn(pdev, i)) in remove_sriov_vf_pdns()
258 edev = pdn_to_eeh_dev(pdn); in remove_sriov_vf_pdns()
268 pdn->edev = NULL; in remove_sriov_vf_pdns()
273 if (!list_empty(&pdn->list)) in remove_sriov_vf_pdns()
274 list_del(&pdn->list); in remove_sriov_vf_pdns()
276 kfree(pdn); in remove_sriov_vf_pdns()
288 struct pci_dn *pdn; in pci_add_device_node_info() local
293 pdn = kzalloc(sizeof(*pdn), GFP_KERNEL); in pci_add_device_node_info()
294 if (pdn == NULL) in pci_add_device_node_info()
296 dn->data = pdn; in pci_add_device_node_info()
297 pdn->phb = hose; in pci_add_device_node_info()
298 pdn->pe_number = IODA_INVALID_PE; in pci_add_device_node_info()
304 pdn->busno = (addr >> 16) & 0xff; in pci_add_device_node_info()
305 pdn->devfn = (addr >> 8) & 0xff; in pci_add_device_node_info()
310 pdn->vendor_id = regs ? of_read_number(regs, 1) : 0; in pci_add_device_node_info()
312 pdn->device_id = regs ? of_read_number(regs, 1) : 0; in pci_add_device_node_info()
314 pdn->class_code = regs ? of_read_number(regs, 1) : 0; in pci_add_device_node_info()
317 pdn->pci_ext_config_space = (type && of_read_number(type, 1) == 1); in pci_add_device_node_info()
321 edev = eeh_dev_init(pdn); in pci_add_device_node_info()
323 kfree(pdn); in pci_add_device_node_info()
329 INIT_LIST_HEAD(&pdn->child_list); in pci_add_device_node_info()
330 INIT_LIST_HEAD(&pdn->list); in pci_add_device_node_info()
332 pdn->parent = parent ? PCI_DN(parent) : NULL; in pci_add_device_node_info()
334 if (pdn->parent) in pci_add_device_node_info()
335 list_add_tail(&pdn->list, &pdn->parent->child_list); in pci_add_device_node_info()
337 return pdn; in pci_add_device_node_info()
343 struct pci_dn *pdn = dn ? PCI_DN(dn) : NULL; in pci_remove_device_node_info() local
347 struct eeh_dev *edev = pdn_to_eeh_dev(pdn); in pci_remove_device_node_info()
350 edev->pdn = NULL; in pci_remove_device_node_info()
353 if (!pdn) in pci_remove_device_node_info()
356 WARN_ON(!list_empty(&pdn->child_list)); in pci_remove_device_node_info()
357 list_del(&pdn->list); in pci_remove_device_node_info()
369 pdev = pci_get_domain_bus_and_slot(pdn->phb->global_number, in pci_remove_device_node_info()
370 pdn->busno, pdn->devfn); in pci_remove_device_node_info()
373 pci_dbg(pdev, "marked pdn (from %pOF) as dead\n", dn); in pci_remove_device_node_info()
374 pdn->flags |= PCI_DN_FLAG_DEAD; in pci_remove_device_node_info()
377 kfree(pdn); in pci_remove_device_node_info()
450 struct pci_dn *pdn; in add_pdn() local
452 pdn = pci_add_device_node_info(hose, dn); in add_pdn()
453 if (!pdn) in add_pdn()
470 struct pci_dn *pdn; in pci_devs_phb_init_dynamic() local
473 pdn = pci_add_device_node_info(phb, dn); in pci_devs_phb_init_dynamic()
474 if (pdn) { in pci_devs_phb_init_dynamic()
475 pdn->devfn = pdn->busno = -1; in pci_devs_phb_init_dynamic()
476 pdn->vendor_id = pdn->device_id = pdn->class_code = 0; in pci_devs_phb_init_dynamic()
477 pdn->phb = phb; in pci_devs_phb_init_dynamic()
478 phb->pci_data = pdn; in pci_devs_phb_init_dynamic()
487 struct pci_dn *pdn; in pci_dev_pdn_setup() local
493 pdn = pci_get_pdn(pdev); in pci_dev_pdn_setup()
494 pdev->dev.archdata.pci_data = pdn; in pci_dev_pdn_setup()