drivers/thunderbolt/nhi.c
Source file repositories/reference/linux-study-clean/drivers/thunderbolt/nhi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/thunderbolt/nhi.c- Extension
.c- Size
- 41595 bytes
- Lines
- 1586
- Domain
- Driver Families
- Bucket
- drivers/thunderbolt
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/pm_runtime.hlinux/slab.hlinux/errno.hlinux/pci.hlinux/dma-mapping.hlinux/interrupt.hlinux/iommu.hlinux/module.hlinux/delay.hlinux/property.hlinux/string_choices.hlinux/string_helpers.hnhi.hnhi_regs.htb.h
Detected Declarations
function ring_interrupt_indexfunction nhi_mask_interruptfunction nhi_clear_interruptfunction ring_interrupt_activefunction nhi_disable_interruptsfunction ring_iowrite_consfunction ring_iowrite_prodfunction ring_iowrite32descfunction ring_iowrite64descfunction ring_iowrite32optionsfunction ring_fullfunction ring_emptyfunction ring_write_descriptorsfunction ring_workfunction __tb_ring_enqueuefunction tb_ring_pollfunction __ring_interrupt_maskfunction __ring_interruptfunction tb_ring_poll_completefunction ring_clear_msixfunction ring_msixfunction ring_request_msixfunction ring_release_msixfunction nhi_alloc_hopfunction voidfunction tb_ring_alloc_txfunction tb_ring_alloc_rxfunction tb_ring_startfunction tb_ring_stopfunction tb_ring_freefunction nhi_mailbox_cmdfunction nhi_mailbox_modefunction nhi_interrupt_workfunction nhi_msifunction __nhi_suspend_noirqfunction nhi_suspend_noirqfunction nhi_freeze_noirqfunction nhi_thaw_noirqfunction nhi_wake_supportedfunction nhi_poweroff_noirqfunction nhi_enable_int_throttlingfunction nhi_resume_noirqfunction nhi_suspendfunction nhi_completefunction nhi_runtime_suspendfunction nhi_runtime_resumefunction nhi_shutdownfunction nhi_check_quirks
Annotated Snippet
static struct pci_driver nhi_driver = {
.name = "thunderbolt",
.id_table = nhi_ids,
.probe = nhi_probe,
.remove = nhi_remove,
.shutdown = nhi_remove,
.driver.pm = &nhi_pm_ops,
};
static int __init nhi_init(void)
{
int ret;
ret = tb_domain_init();
if (ret)
return ret;
ret = pci_register_driver(&nhi_driver);
if (ret)
tb_domain_exit();
return ret;
}
static void __exit nhi_unload(void)
{
pci_unregister_driver(&nhi_driver);
tb_domain_exit();
}
rootfs_initcall(nhi_init);
module_exit(nhi_unload);
Annotation
- Immediate include surface: `linux/pm_runtime.h`, `linux/slab.h`, `linux/errno.h`, `linux/pci.h`, `linux/dma-mapping.h`, `linux/interrupt.h`, `linux/iommu.h`, `linux/module.h`.
- Detected declarations: `function ring_interrupt_index`, `function nhi_mask_interrupt`, `function nhi_clear_interrupt`, `function ring_interrupt_active`, `function nhi_disable_interrupts`, `function ring_iowrite_cons`, `function ring_iowrite_prod`, `function ring_iowrite32desc`, `function ring_iowrite64desc`, `function ring_iowrite32options`.
- Atlas domain: Driver Families / drivers/thunderbolt.
- Implementation status: pattern 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.