Commit 31595ae5 authored by Oliver O'Halloran's avatar Oliver O'Halloran Committed by Michael Ellerman

powerpc/eeh: Drop pdn use in eeh_pe_tree_insert()

This is mostly just to make the subsequent diffs less noisy. No functional
changes.

One thing that needs calling out is the removal of the "config_addr"
variable and replacing it with edev->bdfn. The contents of edev->bdfn are
the same, however it's worth pointing out that what RTAS calls a
"config_addr" isn't the same as the bdfn. The config_addr is supposed to
be: <bus><devfn><reg> with each field being an 8 bit number. Various parts
of the EEH code use BDFN and "config_addr" as interchangeable quantities
even though they aren't really.
Signed-off-by: default avatarOliver O'Halloran <oohall@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200725081231.39076-13-oohall@gmail.com
parent d923ab7a
...@@ -366,9 +366,8 @@ static struct eeh_pe *eeh_pe_get_parent(struct eeh_dev *edev) ...@@ -366,9 +366,8 @@ static struct eeh_pe *eeh_pe_get_parent(struct eeh_dev *edev)
*/ */
int eeh_pe_tree_insert(struct eeh_dev *edev) int eeh_pe_tree_insert(struct eeh_dev *edev)
{ {
struct pci_controller *hose = edev->controller;
struct eeh_pe *pe, *parent; struct eeh_pe *pe, *parent;
struct pci_dn *pdn = eeh_dev_to_pdn(edev);
int config_addr = (pdn->busno << 8) | (pdn->devfn);
/* Check if the PE number is valid */ /* Check if the PE number is valid */
if (!eeh_has_flag(EEH_VALID_PE_ZERO) && !edev->pe_config_addr) { if (!eeh_has_flag(EEH_VALID_PE_ZERO) && !edev->pe_config_addr) {
...@@ -382,7 +381,7 @@ int eeh_pe_tree_insert(struct eeh_dev *edev) ...@@ -382,7 +381,7 @@ int eeh_pe_tree_insert(struct eeh_dev *edev)
* PE should be composed of PCI bus and its subordinate * PE should be composed of PCI bus and its subordinate
* components. * components.
*/ */
pe = eeh_pe_get(pdn->phb, edev->pe_config_addr, config_addr); pe = eeh_pe_get(hose, edev->pe_config_addr, edev->bdfn);
if (pe) { if (pe) {
if (pe->type & EEH_PE_INVALID) { if (pe->type & EEH_PE_INVALID) {
list_add_tail(&edev->entry, &pe->edevs); list_add_tail(&edev->entry, &pe->edevs);
...@@ -416,15 +415,15 @@ int eeh_pe_tree_insert(struct eeh_dev *edev) ...@@ -416,15 +415,15 @@ int eeh_pe_tree_insert(struct eeh_dev *edev)
/* Create a new EEH PE */ /* Create a new EEH PE */
if (edev->physfn) if (edev->physfn)
pe = eeh_pe_alloc(pdn->phb, EEH_PE_VF); pe = eeh_pe_alloc(hose, EEH_PE_VF);
else else
pe = eeh_pe_alloc(pdn->phb, EEH_PE_DEVICE); pe = eeh_pe_alloc(hose, EEH_PE_DEVICE);
if (!pe) { if (!pe) {
pr_err("%s: out of memory!\n", __func__); pr_err("%s: out of memory!\n", __func__);
return -ENOMEM; return -ENOMEM;
} }
pe->addr = edev->pe_config_addr; pe->addr = edev->pe_config_addr;
pe->config_addr = config_addr; pe->config_addr = edev->bdfn;
/* /*
* Put the new EEH PE into hierarchy tree. If the parent * Put the new EEH PE into hierarchy tree. If the parent
...@@ -434,10 +433,10 @@ int eeh_pe_tree_insert(struct eeh_dev *edev) ...@@ -434,10 +433,10 @@ int eeh_pe_tree_insert(struct eeh_dev *edev)
*/ */
parent = eeh_pe_get_parent(edev); parent = eeh_pe_get_parent(edev);
if (!parent) { if (!parent) {
parent = eeh_phb_pe_get(pdn->phb); parent = eeh_phb_pe_get(hose);
if (!parent) { if (!parent) {
pr_err("%s: No PHB PE is found (PHB Domain=%d)\n", pr_err("%s: No PHB PE is found (PHB Domain=%d)\n",
__func__, pdn->phb->global_number); __func__, hose->global_number);
edev->pe = NULL; edev->pe = NULL;
kfree(pe); kfree(pe);
return -EEXIST; return -EEXIST;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment