drivers/pci/endpoint/pci-epc-core.c
Source file repositories/reference/linux-study-clean/drivers/pci/endpoint/pci-epc-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/endpoint/pci-epc-core.c- Extension
.c- Size
- 30589 bytes
- Lines
- 1079
- Domain
- Representative Device Path
- Bucket
- PCIe NVMe Storage Path
- Inferred role
- Representative Device Path: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/device.hlinux/slab.hlinux/module.hlinux/pci-epc.hlinux/pci-epf.hlinux/pci-ep-cfs.h
Detected Declarations
function devm_pci_epc_releasefunction pci_epc_putfunction pci_epc_getfunction pci_epc_get_first_free_barfunction pci_epc_get_next_free_barfunction pci_epc_function_is_validfunction pci_epc_get_featuresfunction pci_epc_stopfunction pci_epc_startfunction pci_epc_raise_irqfunction pci_epc_map_msi_irqfunction pci_epc_get_msifunction pci_epc_set_msifunction pci_epc_get_msixfunction pci_epc_set_msixfunction pci_epc_unmap_addrfunction pci_epc_map_addrfunction pci_epc_mem_mapfunction pci_epc_mem_unmapfunction pci_epc_clear_barfunction pci_epc_set_barfunction pci_epc_bar_size_to_rebar_capfunction pci_epc_write_headerfunction pci_epc_add_epffunction pci_epc_remove_epffunction pci_epc_linkupfunction pci_epc_linkdownfunction pci_epc_init_notifyfunction pci_epc_notify_pending_initfunction pci_epc_deinit_notifyfunction pci_epc_bus_master_enable_notifyfunction pci_epc_destroyfunction pci_epc_releasefunction __pci_epc_createfunction __devm_pci_epc_createfunction pci_epc_initfunction pci_epc_exitmodule init pci_epc_initexport pci_epc_putexport pci_epc_getexport pci_epc_get_first_free_barexport pci_epc_get_next_free_barexport pci_epc_get_featuresexport pci_epc_stopexport pci_epc_startexport pci_epc_raise_irqexport pci_epc_map_msi_irqexport pci_epc_get_msi
Annotated Snippet
ret = device_add(&epc->dev);
if (ret)
goto put_dev;
epc->group = pci_ep_cfs_add_epc_group(dev_name(dev));
return epc;
put_dev:
put_device(&epc->dev);
err_ret:
return ERR_PTR(ret);
}
EXPORT_SYMBOL_GPL(__pci_epc_create);
/**
* __devm_pci_epc_create() - create a new endpoint controller (EPC) device
* @dev: device that is creating the new EPC
* @ops: function pointers for performing EPC operations
* @owner: the owner of the module that creates the EPC device
*
* Invoke to create a new EPC device and add it to pci_epc class.
* While at that, it also associates the device with the pci_epc using devres.
* On driver detach, release function is invoked on the devres data,
* then, devres data is freed.
*/
struct pci_epc *
__devm_pci_epc_create(struct device *dev, const struct pci_epc_ops *ops,
struct module *owner)
{
struct pci_epc **ptr, *epc;
ptr = devres_alloc(devm_pci_epc_release, sizeof(*ptr), GFP_KERNEL);
if (!ptr)
return ERR_PTR(-ENOMEM);
epc = __pci_epc_create(dev, ops, owner);
if (!IS_ERR(epc)) {
*ptr = epc;
devres_add(dev, ptr);
} else {
devres_free(ptr);
}
return epc;
}
EXPORT_SYMBOL_GPL(__devm_pci_epc_create);
static int __init pci_epc_init(void)
{
return class_register(&pci_epc_class);
}
module_init(pci_epc_init);
static void __exit pci_epc_exit(void)
{
class_unregister(&pci_epc_class);
}
module_exit(pci_epc_exit);
MODULE_DESCRIPTION("PCI EPC Library");
MODULE_AUTHOR("Kishon Vijay Abraham I <kishon@ti.com>");
Annotation
- Immediate include surface: `linux/device.h`, `linux/slab.h`, `linux/module.h`, `linux/pci-epc.h`, `linux/pci-epf.h`, `linux/pci-ep-cfs.h`.
- Detected declarations: `function devm_pci_epc_release`, `function pci_epc_put`, `function pci_epc_get`, `function pci_epc_get_first_free_bar`, `function pci_epc_get_next_free_bar`, `function pci_epc_function_is_valid`, `function pci_epc_get_features`, `function pci_epc_stop`, `function pci_epc_start`, `function pci_epc_raise_irq`.
- Atlas domain: Representative Device Path / PCIe NVMe Storage Path.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.