drivers/pci/quirks.c
Source file repositories/reference/linux-study-clean/drivers/pci/quirks.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/quirks.c- Extension
.c- Size
- 236620 bytes
- Lines
- 6426
- 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.
- 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/aer.hlinux/align.hlinux/bitfield.hlinux/types.hlinux/kernel.hlinux/export.hlinux/pci.hlinux/isa-dma.hlinux/init.hlinux/iommu.hlinux/delay.hlinux/acpi.hlinux/dmi.hlinux/ioport.hlinux/sched.hlinux/ktime.hlinux/mm.hlinux/nvme.hlinux/platform_data/x86/apple.hlinux/pm_runtime.hlinux/sizes.hlinux/suspend.hlinux/switchtec.hpci.hasm/io_apic.h
Detected Declarations
function architecturesfunction pcie_failed_link_retrainfunction fixup_debug_startfunction fixup_debug_reportfunction pci_do_fixupsfunction pci_fixup_devicefunction pci_apply_final_quirksfunction quirk_mmio_always_onfunction quirk_passive_releasefunction quirk_isa_dma_hangsfunction quirk_tigerpoint_bm_stsfunction quirk_nopcipcifunction quirk_nopciamdfunction quirk_tritonfunction quirk_vialatencyfunction quirk_viaetbffunction quirk_vsfxfunction quirk_alimagikfunction quirk_natomafunction quirk_citrinefunction quirk_nfp6000function quirk_extend_bar_to_pagefunction quirk_s3_64Mfunction quirk_iofunction quirk_cs5536_vsafunction quirk_io_regionfunction quirk_ati_exploding_mcefunction PCI_CLASS_SERIAL_USB_XHCIfunction quirk_synopsys_hapsfunction quirk_ali7101_acpifunction piix4_io_quirkfunction piix4_mem_quirkfunction quirk_piix4_acpifunction quirk_ich4_lpc_acpifunction ich6_lpc_acpi_gpiofunction ich6_lpc_generic_decodefunction quirk_ich6_lpcfunction ich7_lpc_generic_decodefunction quirk_ich7_lpcfunction quirk_vt82c586_acpifunction quirk_vt82c686_acpifunction quirk_vt8235_acpifunction quirk_xio2000afunction quirk_via_ioapicfunction quirk_via_vt8237_bypass_apic_deassertfunction quirk_amd_ioapicfunction quirk_cavium_sriov_rnm_linkfunction quirk_amd_8131_mmrbc
Annotated Snippet
if (ret) {
pci_info(dev, "retraining failed\n");
pcie_set_target_speed(dev, PCIE_LNKCTL2_TLS2SPEED(oldlnkctl2),
true);
return ret;
}
pcie_capability_read_word(dev, PCI_EXP_LNKSTA, &lnksta);
}
pcie_capability_read_word(dev, PCI_EXP_LNKCTL2, &lnkctl2);
if ((lnksta & PCI_EXP_LNKSTA_DLLLA) &&
(lnkctl2 & PCI_EXP_LNKCTL2_TLS) == PCI_EXP_LNKCTL2_TLS_2_5GT &&
pci_match_id(ids, dev)) {
u32 lnkcap;
pci_info(dev, "removing 2.5GT/s downstream link speed restriction\n");
pcie_capability_read_dword(dev, PCI_EXP_LNKCAP, &lnkcap);
ret = pcie_set_target_speed(dev, PCIE_LNKCAP_SLS2SPEED(lnkcap), false);
if (ret) {
pci_info(dev, "retraining failed\n");
return ret;
}
}
return ret;
}
static ktime_t fixup_debug_start(struct pci_dev *dev,
void (*fn)(struct pci_dev *dev))
{
if (initcall_debug)
pci_info(dev, "calling %pS @ %i\n", fn, task_pid_nr(current));
return ktime_get();
}
static void fixup_debug_report(struct pci_dev *dev, ktime_t calltime,
void (*fn)(struct pci_dev *dev))
{
ktime_t delta, rettime;
unsigned long long duration;
rettime = ktime_get();
delta = ktime_sub(rettime, calltime);
duration = (unsigned long long) ktime_to_ns(delta) >> 10;
if (initcall_debug || duration > 10000)
pci_info(dev, "%pS took %lld usecs\n", fn, duration);
}
static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
struct pci_fixup *end)
{
ktime_t calltime;
for (; f < end; f++)
if ((f->class == (u32) (dev->class >> f->class_shift) ||
f->class == (u32) PCI_ANY_ID) &&
(f->vendor == dev->vendor ||
f->vendor == (u16) PCI_ANY_ID) &&
(f->device == dev->device ||
f->device == (u16) PCI_ANY_ID)) {
void (*hook)(struct pci_dev *dev);
#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
hook = offset_to_ptr(&f->hook_offset);
#else
hook = f->hook;
#endif
calltime = fixup_debug_start(dev, hook);
hook(dev);
fixup_debug_report(dev, calltime, hook);
}
}
extern struct pci_fixup __start_pci_fixups_early[];
extern struct pci_fixup __end_pci_fixups_early[];
extern struct pci_fixup __start_pci_fixups_header[];
extern struct pci_fixup __end_pci_fixups_header[];
extern struct pci_fixup __start_pci_fixups_final[];
extern struct pci_fixup __end_pci_fixups_final[];
extern struct pci_fixup __start_pci_fixups_enable[];
extern struct pci_fixup __end_pci_fixups_enable[];
extern struct pci_fixup __start_pci_fixups_resume[];
extern struct pci_fixup __end_pci_fixups_resume[];
extern struct pci_fixup __start_pci_fixups_resume_early[];
extern struct pci_fixup __end_pci_fixups_resume_early[];
extern struct pci_fixup __start_pci_fixups_suspend[];
extern struct pci_fixup __end_pci_fixups_suspend[];
extern struct pci_fixup __start_pci_fixups_suspend_late[];
Annotation
- Immediate include surface: `linux/aer.h`, `linux/align.h`, `linux/bitfield.h`, `linux/types.h`, `linux/kernel.h`, `linux/export.h`, `linux/pci.h`, `linux/isa-dma.h`.
- Detected declarations: `function architectures`, `function pcie_failed_link_retrain`, `function fixup_debug_start`, `function fixup_debug_report`, `function pci_do_fixups`, `function pci_fixup_device`, `function pci_apply_final_quirks`, `function quirk_mmio_always_on`, `function quirk_passive_release`, `function quirk_isa_dma_hangs`.
- Atlas domain: Representative Device Path / PCIe NVMe Storage Path.
- Implementation status: integration implementation candidate.
- 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.