arch/x86/pci/fixup.c
Source file repositories/reference/linux-study-clean/arch/x86/pci/fixup.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/pci/fixup.c- Extension
.c- Size
- 36489 bytes
- Lines
- 1084
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: implementation source
- Status
- source 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.
- 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/bitfield.hlinux/delay.hlinux/dmi.hlinux/pci.hlinux/suspend.hlinux/vgaarb.hasm/amd/node.hasm/hpet.hasm/pci_x86.h
Detected Declarations
function pci_fixup_i450nxfunction pci_fixup_i450gxfunction pci_fixup_umc_idefunction pci_fixup_latencyfunction pci_fixup_piix4_acpifunction pci_fixup_via_northbridge_bugfunction pci_fixup_transparent_bridgefunction pci_fixup_nforce2function quirk_pcie_aspm_readfunction quirk_pcie_aspm_writefunction ASPMfunction limit_mrrs_to_128function pci_xeon_x2_bifurc_quirkfunction pci_fixup_videofunction pci_fixup_msi_k8t_onboard_soundfunction pci_pre_fixup_toshiba_ohci1394function pci_post_fixup_toshiba_ohci1394function pci_early_fixup_cyrix_5530function pci_siemens_interrupt_controllerfunction sb600_disable_hpet_barfunction sb600_hpet_quirkfunction twinhead_reserve_killing_zonefunction pci_invalid_barfunction pci_fixup_amd_ehci_pmefunction pci_fixup_amd_fch_xhci_pmefunction quirk_apple_mbp_powerofffunction quirk_no_aersidfunction quirk_intel_th_dnvfunction RTIT_BARfunction pci_amd_enable_64bit_barfunction rs690_fix_64bit_dmafunction quirk_clear_strap_no_soft_reset_dev2_f0function chromeos_save_apl_pci_l1ss_capabilityfunction chromeos_fixup_apl_pci_l1ss_capabilityfunction asus_disable_nvme_d3coldfunction amd_rp_pme_suspendfunction amd_rp_pme_resumefunction quirk_tuxeo_rp_d3
Annotated Snippet
if (bridge && (pci_is_bridge(bridge))) {
pci_read_config_word(bridge, PCI_BRIDGE_CONTROL,
&config);
if (!(config & PCI_BRIDGE_CTL_VGA))
return;
}
bus = bus->parent;
}
if (!vga_default_device() || pdev == vga_default_device()) {
pci_read_config_word(pdev, PCI_COMMAND, &config);
if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
res = &pdev->resource[PCI_ROM_RESOURCE];
pci_disable_rom(pdev);
if (res->parent)
release_resource(res);
res->start = 0xC0000;
res->end = res->start + 0x20000 - 1;
res->flags = IORESOURCE_MEM | IORESOURCE_ROM_SHADOW |
IORESOURCE_PCI_FIXED;
dev_info(&pdev->dev, "Video device with shadowed ROM at %pR\n",
res);
}
}
}
DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_ANY_ID, PCI_ANY_ID,
PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video);
static const struct dmi_system_id msi_k8t_dmi_table[] = {
{
.ident = "MSI-K8T-Neo2Fir",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "MSI"),
DMI_MATCH(DMI_PRODUCT_NAME, "MS-6702E"),
},
},
{}
};
/*
* The AMD-Athlon64 board MSI "K8T Neo2-FIR" disables the onboard sound
* card if a PCI-soundcard is added.
*
* The BIOS only gives options "DISABLED" and "AUTO". This code sets
* the corresponding register-value to enable the soundcard.
*
* The soundcard is only enabled, if the mainboard is identified
* via DMI-tables and the soundcard is detected to be off.
*/
static void pci_fixup_msi_k8t_onboard_sound(struct pci_dev *dev)
{
unsigned char val;
if (!dmi_check_system(msi_k8t_dmi_table))
return; /* only applies to MSI K8T Neo2-FIR */
pci_read_config_byte(dev, 0x50, &val);
if (val & 0x40) {
pci_write_config_byte(dev, 0x50, val & (~0x40));
/* verify the change for status output */
pci_read_config_byte(dev, 0x50, &val);
if (val & 0x40)
dev_info(&dev->dev, "Detected MSI K8T Neo2-FIR; "
"can't enable onboard soundcard!\n");
else
dev_info(&dev->dev, "Detected MSI K8T Neo2-FIR; "
"enabled onboard soundcard\n");
}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237,
pci_fixup_msi_k8t_onboard_sound);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237,
pci_fixup_msi_k8t_onboard_sound);
/*
* Some Toshiba laptops need extra code to enable their TI TSB43AB22/A.
*
* We pretend to bring them out of full D3 state, and restore the proper
* IRQ, PCI cache line size, and BARs, otherwise the device won't function
* properly. In some cases, the device will generate an interrupt on
* the wrong IRQ line, causing any devices sharing the line it's
* *supposed* to use to be disabled by the kernel's IRQ debug code.
*/
static u16 toshiba_line_size;
static const struct dmi_system_id toshiba_ohci1394_dmi_table[] = {
{
.ident = "Toshiba PS5 based laptop",
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/delay.h`, `linux/dmi.h`, `linux/pci.h`, `linux/suspend.h`, `linux/vgaarb.h`, `asm/amd/node.h`, `asm/hpet.h`.
- Detected declarations: `function pci_fixup_i450nx`, `function pci_fixup_i450gx`, `function pci_fixup_umc_ide`, `function pci_fixup_latency`, `function pci_fixup_piix4_acpi`, `function pci_fixup_via_northbridge_bug`, `function pci_fixup_transparent_bridge`, `function pci_fixup_nforce2`, `function quirk_pcie_aspm_read`, `function quirk_pcie_aspm_write`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: source 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.