Lines Matching full:pdn

46 static void pseries_eeh_init_edev(struct pci_dn *pdn);
50 struct pci_dn *pdn = pci_get_pdn(pdev); in pseries_pcibios_bus_add_device() local
58 pdn->device_id = pdev->device; in pseries_pcibios_bus_add_device()
59 pdn->vendor_id = pdev->vendor; in pseries_pcibios_bus_add_device()
60 pdn->class_code = pdev->class; in pseries_pcibios_bus_add_device()
66 pdn->last_allow_rc = 0; in pseries_pcibios_bus_add_device()
69 pseries_eeh_init_edev(pdn); in pseries_pcibios_bus_add_device()
77 struct eeh_dev *edev = pdn_to_eeh_dev(pdn); in pseries_pcibios_bus_add_device()
79 edev->pe_config_addr = (pdn->busno << 16) | (pdn->devfn << 8); in pseries_pcibios_bus_add_device()
90 * @pdn: pci_dn of the input device
101 static int pseries_eeh_get_pe_config_addr(struct pci_dn *pdn) in pseries_eeh_get_pe_config_addr() argument
103 int config_addr = rtas_config_addr(pdn->busno, pdn->devfn, 0); in pseries_eeh_get_pe_config_addr()
104 struct pci_controller *phb = pdn->phb; in pseries_eeh_get_pe_config_addr()
248 static int pseries_eeh_cap_start(struct pci_dn *pdn) in pseries_eeh_cap_start() argument
252 if (!pdn) in pseries_eeh_cap_start()
255 rtas_pci_dn_read_config(pdn, PCI_STATUS, 2, &status); in pseries_eeh_cap_start()
263 static int pseries_eeh_find_cap(struct pci_dn *pdn, int cap) in pseries_eeh_find_cap() argument
265 int pos = pseries_eeh_cap_start(pdn); in pseries_eeh_find_cap()
273 rtas_pci_dn_read_config(pdn, pos, 1, &pos); in pseries_eeh_find_cap()
277 rtas_pci_dn_read_config(pdn, pos + PCI_CAP_LIST_ID, 1, &id); in pseries_eeh_find_cap()
288 static int pseries_eeh_find_ecap(struct pci_dn *pdn, int cap) in pseries_eeh_find_ecap() argument
290 struct eeh_dev *edev = pdn_to_eeh_dev(pdn); in pseries_eeh_find_ecap()
297 if (rtas_pci_dn_read_config(pdn, pos, 4, &header) != PCIBIOS_SUCCESSFUL) in pseries_eeh_find_ecap()
310 if (rtas_pci_dn_read_config(pdn, pos, 4, &header) != PCIBIOS_SUCCESSFUL) in pseries_eeh_find_ecap()
328 struct pci_dn *pdn = eeh_dev_to_pdn(edev); in pseries_eeh_pe_get_parent() local
336 pdn = pci_get_pdn(edev->physfn); in pseries_eeh_pe_get_parent()
338 pdn = pdn ? pdn->parent : NULL; in pseries_eeh_pe_get_parent()
339 while (pdn) { in pseries_eeh_pe_get_parent()
341 parent = pdn_to_eeh_dev(pdn); in pseries_eeh_pe_get_parent()
348 pdn = pdn->parent; in pseries_eeh_pe_get_parent()
357 * @pdn: PCI device node
364 static void pseries_eeh_init_edev(struct pci_dn *pdn) in pseries_eeh_init_edev() argument
375 * Find the eeh_dev for this pdn. The storage for the eeh_dev was in pseries_eeh_init_edev()
380 edev = pdn_to_eeh_dev(pdn); in pseries_eeh_init_edev()
394 if (!pdn->vendor_id || !pdn->device_id || !pdn->class_code) in pseries_eeh_init_edev()
398 if ((pdn->class_code >> 8) == PCI_CLASS_BRIDGE_ISA) in pseries_eeh_init_edev()
408 edev->pcix_cap = pseries_eeh_find_cap(pdn, PCI_CAP_ID_PCIX); in pseries_eeh_init_edev()
409 edev->pcie_cap = pseries_eeh_find_cap(pdn, PCI_CAP_ID_EXP); in pseries_eeh_init_edev()
410 edev->aer_cap = pseries_eeh_find_ecap(pdn, PCI_EXT_CAP_ID_ERR); in pseries_eeh_init_edev()
412 if ((pdn->class_code >> 8) == PCI_CLASS_BRIDGE_PCI) { in pseries_eeh_init_edev()
415 rtas_pci_dn_read_config(pdn, edev->pcie_cap + PCI_EXP_FLAGS, in pseries_eeh_init_edev()
426 ret = pseries_eeh_get_pe_config_addr(pdn); in pseries_eeh_init_edev()
434 pe.phb = pdn->phb; in pseries_eeh_init_edev()
462 struct pci_dn *pdn; in pseries_eeh_probe() local
464 pdn = pci_get_pdn_by_devfn(pdev->bus, pdev->devfn); in pseries_eeh_probe()
465 if (!pdn) in pseries_eeh_probe()
472 edev = pdn_to_eeh_dev(pdn); in pseries_eeh_probe()
481 * @pdn: PCI device node
487 void pseries_eeh_init_edev_recursive(struct pci_dn *pdn) in pseries_eeh_init_edev_recursive() argument
491 if (!pdn) in pseries_eeh_init_edev_recursive()
494 list_for_each_entry(n, &pdn->child_list, list) in pseries_eeh_init_edev_recursive()
497 pseries_eeh_init_edev(pdn); in pseries_eeh_init_edev_recursive()
677 struct pci_dn *pdn = eeh_dev_to_pdn(edev); in pseries_eeh_read_config() local
679 return rtas_pci_dn_read_config(pdn, where, size, val); in pseries_eeh_read_config()
693 struct pci_dn *pdn = eeh_dev_to_pdn(edev); in pseries_eeh_write_config() local
695 return rtas_pci_dn_write_config(pdn, where, size, val); in pseries_eeh_write_config()
699 static int pseries_send_allow_unfreeze(struct pci_dn *pdn, u16 *vf_pe_array, int cur_vfs) in pseries_send_allow_unfreeze() argument
705 addr = rtas_config_addr(pdn->busno, pdn->devfn, 0); in pseries_send_allow_unfreeze()
706 buid = pdn->phb->buid; in pseries_send_allow_unfreeze()
718 pdn->phb->global_number, addr, rc); in pseries_send_allow_unfreeze()
725 struct pci_dn *pdn, *tmp, *parent, *physfn_pdn; in pseries_call_allow_unfreeze() local
734 pdn = eeh_dev_to_pdn(edev); in pseries_call_allow_unfreeze()
735 parent = pdn->parent; in pseries_call_allow_unfreeze()
738 cpu_to_be16(pdn->pe_num_map[vf_index]); in pseries_call_allow_unfreeze()
739 rc = pseries_send_allow_unfreeze(pdn, vf_pe_array, in pseries_call_allow_unfreeze()
741 pdn->last_allow_rc = rc; in pseries_call_allow_unfreeze()
743 list_for_each_entry_safe(pdn, tmp, in pseries_call_allow_unfreeze()
750 if (pdn->busno != bus || in pseries_call_allow_unfreeze()
751 pdn->devfn != devfn) in pseries_call_allow_unfreeze()
753 pdn->last_allow_rc = rc; in pseries_call_allow_unfreeze()
757 pdn = pci_get_pdn(edev->pdev); in pseries_call_allow_unfreeze()
764 pdn->last_allow_rc = rc; in pseries_call_allow_unfreeze()
851 struct pci_dn *pdn; in eeh_pseries_init() local
903 pdn = list_first_entry(&PCI_DN(phb->dn)->child_list, struct pci_dn, list); in eeh_pseries_init()
904 config_addr = pseries_eeh_get_pe_config_addr(pdn); in eeh_pseries_init()