arch/powerpc/platforms/powernv/pci.c
Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/powernv/pci.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/platforms/powernv/pci.c- Extension
.c- Size
- 22708 bytes
- Lines
- 802
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/delay.hlinux/string.hlinux/init.hlinux/irq.hlinux/io.hlinux/msi.hlinux/iommu.hasm/sections.hasm/io.hasm/pci-bridge.hasm/machdep.hasm/msi_bitmap.hasm/ppc-pci.hasm/pnv-pci.hasm/opal.hasm/iommu.hasm/tce.hasm/firmware.hasm/eeh_event.hasm/eeh.hpowernv.hpci.h
Detected Declarations
function pnv_pci_get_slot_idfunction pnv_pci_get_device_treefunction pnv_pci_get_presence_statefunction pnv_pci_get_power_statefunction pnv_pci_set_power_statefunction pnv_pci_dump_pestfunction pnv_pci_dump_p7ioc_diag_datafunction pnv_pci_dump_phb3_diag_datafunction pnv_pci_dump_phb4_diag_datafunction pnv_pci_dump_phb_diag_datafunction pnv_pci_handle_eeh_configfunction pnv_pci_config_check_eehfunction pnv_pci_cfg_readfunction pnv_pci_cfg_writefunction pnv_pci_cfg_checkfunction pnv_pci_cfg_checkfunction pnv_pci_read_configfunction pnv_pci_write_configfunction pnv_pci_shutdownfunction pnv_p7ioc_rc_quirkfunction pnv_pci_initexport pnv_pci_get_slot_idexport pnv_pci_get_device_treeexport pnv_pci_get_presence_stateexport pnv_pci_get_power_stateexport pnv_pci_set_power_state
Annotated Snippet
if (!PCI_DN(node)) {
of_node_put(node);
break;
}
if (!of_device_is_compatible(node, "ibm,ioda2-phb") &&
!of_device_is_compatible(node, "ibm,ioda3-phb") &&
!of_device_is_compatible(node, "ibm,ioda2-npu2-opencapi-phb")) {
of_node_put(node);
continue;
}
ret = of_property_read_u64(node, "ibm,opal-phbid", &phbid);
if (ret) {
of_node_put(node);
return -ENXIO;
}
if (of_device_is_compatible(node, "ibm,ioda2-npu2-opencapi-phb"))
*id = PCI_PHB_SLOT_ID(phbid);
else
*id = PCI_SLOT_ID(phbid, bdfn);
return 0;
}
return -ENODEV;
}
EXPORT_SYMBOL_GPL(pnv_pci_get_slot_id);
int pnv_pci_get_device_tree(uint32_t phandle, void *buf, uint64_t len)
{
int64_t rc;
if (!opal_check_token(OPAL_GET_DEVICE_TREE))
return -ENXIO;
rc = opal_get_device_tree(phandle, (uint64_t)buf, len);
if (rc < OPAL_SUCCESS)
return -EIO;
return rc;
}
EXPORT_SYMBOL_GPL(pnv_pci_get_device_tree);
int pnv_pci_get_presence_state(uint64_t id, uint8_t *state)
{
int64_t rc;
if (!opal_check_token(OPAL_PCI_GET_PRESENCE_STATE))
return -ENXIO;
rc = opal_pci_get_presence_state(id, (uint64_t)state);
if (rc != OPAL_SUCCESS)
return -EIO;
return 0;
}
EXPORT_SYMBOL_GPL(pnv_pci_get_presence_state);
int pnv_pci_get_power_state(uint64_t id, uint8_t *state)
{
int64_t rc;
if (!opal_check_token(OPAL_PCI_GET_POWER_STATE))
return -ENXIO;
rc = opal_pci_get_power_state(id, (uint64_t)state);
if (rc != OPAL_SUCCESS)
return -EIO;
return 0;
}
EXPORT_SYMBOL_GPL(pnv_pci_get_power_state);
int pnv_pci_set_power_state(uint64_t id, uint8_t state, struct opal_msg *msg)
{
struct opal_msg m;
int token, ret;
int64_t rc;
if (!opal_check_token(OPAL_PCI_SET_POWER_STATE))
return -ENXIO;
token = opal_async_get_token_interruptible();
if (unlikely(token < 0))
return token;
rc = opal_pci_set_power_state(token, id, (uint64_t)&state);
if (rc == OPAL_SUCCESS) {
ret = 0;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/pci.h`, `linux/delay.h`, `linux/string.h`, `linux/init.h`, `linux/irq.h`, `linux/io.h`, `linux/msi.h`.
- Detected declarations: `function pnv_pci_get_slot_id`, `function pnv_pci_get_device_tree`, `function pnv_pci_get_presence_state`, `function pnv_pci_get_power_state`, `function pnv_pci_set_power_state`, `function pnv_pci_dump_pest`, `function pnv_pci_dump_p7ioc_diag_data`, `function pnv_pci_dump_phb3_diag_data`, `function pnv_pci_dump_phb4_diag_data`, `function pnv_pci_dump_phb_diag_data`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.