arch/powerpc/kernel/pci_dn.c
Source file repositories/reference/linux-study-clean/arch/powerpc/kernel/pci_dn.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/kernel/pci_dn.c- Extension
.c- Size
- 11751 bytes
- Lines
- 497
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/pci.hlinux/string.hlinux/export.hlinux/init.hlinux/gfp.hlinux/of.hasm/io.hasm/pci-bridge.hasm/ppc-pci.hasm/firmware.hasm/eeh.h
Detected Declarations
function Copyrightfunction list_for_each_entryfunction list_for_each_entryfunction remove_sriov_vf_pdnsfunction list_for_each_entry_safefunction pci_remove_device_node_infofunction assumefunction pci_devs_phb_init_dynamicfunction pci_dev_pdn_setupexport pci_add_device_node_infoexport pci_remove_device_node_infoexport pci_traverse_device_nodes
Annotated Snippet
if (pdev->devfn == devfn) {
if (pdev->dev.archdata.pci_data)
return pdev->dev.archdata.pci_data;
dn = pci_device_to_OF_node(pdev);
break;
}
}
/* Fast path: fetch from device node */
pdn = dn ? PCI_DN(dn) : NULL;
if (pdn)
return pdn;
/* Slow path: fetch from firmware data hierarchy */
parent = pci_bus_to_pdn(bus);
if (!parent)
return NULL;
list_for_each_entry(pdn, &parent->child_list, list) {
if (pdn->busno == bus->number &&
pdn->devfn == devfn)
return pdn;
}
return NULL;
}
struct pci_dn *pci_get_pdn(struct pci_dev *pdev)
{
struct device_node *dn;
struct pci_dn *parent, *pdn;
/* Search device directly */
if (pdev->dev.archdata.pci_data)
return pdev->dev.archdata.pci_data;
/* Check device node */
dn = pci_device_to_OF_node(pdev);
pdn = dn ? PCI_DN(dn) : NULL;
if (pdn)
return pdn;
/*
* VFs don't have device nodes. We hook their
* firmware data to PF's bridge.
*/
parent = pci_bus_to_pdn(pdev->bus);
if (!parent)
return NULL;
list_for_each_entry(pdn, &parent->child_list, list) {
if (pdn->busno == pdev->bus->number &&
pdn->devfn == pdev->devfn)
return pdn;
}
return NULL;
}
#ifdef CONFIG_EEH
static struct eeh_dev *eeh_dev_init(struct pci_dn *pdn)
{
struct eeh_dev *edev;
/* Allocate EEH device */
edev = kzalloc_obj(*edev);
if (!edev)
return NULL;
/* Associate EEH device with OF node */
pdn->edev = edev;
edev->pdn = pdn;
edev->bdfn = (pdn->busno << 8) | pdn->devfn;
edev->controller = pdn->phb;
return edev;
}
#endif /* CONFIG_EEH */
#ifdef CONFIG_PCI_IOV
static struct pci_dn *add_one_sriov_vf_pdn(struct pci_dn *parent,
int busno, int devfn)
{
struct pci_dn *pdn;
/* Except PHB, we always have the parent */
if (!parent)
return NULL;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/pci.h`, `linux/string.h`, `linux/export.h`, `linux/init.h`, `linux/gfp.h`, `linux/of.h`, `asm/io.h`.
- Detected declarations: `function Copyright`, `function list_for_each_entry`, `function list_for_each_entry`, `function remove_sriov_vf_pdns`, `function list_for_each_entry_safe`, `function pci_remove_device_node_info`, `function assume`, `function pci_devs_phb_init_dynamic`, `function pci_dev_pdn_setup`, `export pci_add_device_node_info`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.