drivers/pci/pci-acpi.c
Source file repositories/reference/linux-study-clean/drivers/pci/pci-acpi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/pci-acpi.c- Extension
.c- Size
- 45061 bytes
- Lines
- 1718
- 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/delay.hlinux/init.hlinux/iommu.hlinux/irqdomain.hlinux/pci.hlinux/msi.hlinux/pci_hotplug.hlinux/module.hlinux/pci-acpi.hlinux/pci-ecam.hlinux/pm_runtime.hlinux/pm_qos.hlinux/rwsem.hpci.h
Detected Declarations
struct hpx_type0struct hpx_type1struct hpx_type2struct hpx_type3struct acpi_pci_generic_root_infoenum hpx_type3_dev_typeenum hpx_type3_fn_typeenum hpx_type3_cfg_locfunction acpi_get_rc_addrfunction acpi_match_rcfunction acpi_get_rc_resourcesfunction acpi_pci_root_get_mcfg_addrfunction pci_acpi_preserve_configfunction program_hpx_type0function decode_type0_hpx_recordfunction program_hpx_type1function decode_type1_hpx_recordfunction program_hpx_type2function decode_type2_hpx_recordfunction hpx3_device_typefunction hpx3_function_typefunction hpx3_cap_ver_matchesfunction program_hpx_type3_registerfunction program_hpx_type3function parse_hpx3_registerfunction program_type3_hpx_recordfunction acpi_run_hpxfunction acpi_run_hppfunction pci_acpi_program_hp_paramsfunction pciehp_is_nativefunction shpchp_is_nativefunction pci_acpi_wake_busfunction pci_acpi_wake_devfunction pci_acpi_add_root_pm_notifierfunction pci_acpi_add_pm_notifierfunction powerfunction pci_set_acpi_fwnodefunction pci_dev_acpi_resetfunction acpi_pci_power_manageablefunction acpi_pci_bridge_d3function acpi_pci_config_space_accessfunction acpi_pci_set_power_statefunction acpi_pci_get_power_statefunction acpi_pci_refresh_power_statefunction acpi_pci_propagate_wakeupfunction acpi_pci_wakeupfunction acpi_pci_need_resumefunction acpi_pci_add_bus
Annotated Snippet
struct hpx_type0 {
u32 revision; /* Not present in _HPP */
u8 cache_line_size; /* Not applicable to PCIe */
u8 latency_timer; /* Not applicable to PCIe */
u8 enable_serr;
u8 enable_perr;
};
static struct hpx_type0 pci_default_type0 = {
.revision = 1,
.cache_line_size = 8,
.latency_timer = 0x40,
.enable_serr = 0,
.enable_perr = 0,
};
static void program_hpx_type0(struct pci_dev *dev, struct hpx_type0 *hpx)
{
u16 pci_cmd, pci_bctl;
if (!hpx)
hpx = &pci_default_type0;
if (hpx->revision > 1) {
pci_warn(dev, "PCI settings rev %d not supported; using defaults\n",
hpx->revision);
hpx = &pci_default_type0;
}
pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, hpx->cache_line_size);
pci_write_config_byte(dev, PCI_LATENCY_TIMER, hpx->latency_timer);
pci_read_config_word(dev, PCI_COMMAND, &pci_cmd);
if (hpx->enable_serr)
pci_cmd |= PCI_COMMAND_SERR;
if (hpx->enable_perr)
pci_cmd |= PCI_COMMAND_PARITY;
pci_write_config_word(dev, PCI_COMMAND, pci_cmd);
/* Program bridge control value */
if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
pci_write_config_byte(dev, PCI_SEC_LATENCY_TIMER,
hpx->latency_timer);
pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &pci_bctl);
if (hpx->enable_perr)
pci_bctl |= PCI_BRIDGE_CTL_PARITY;
pci_write_config_word(dev, PCI_BRIDGE_CONTROL, pci_bctl);
}
}
static acpi_status decode_type0_hpx_record(union acpi_object *record,
struct hpx_type0 *hpx0)
{
int i;
union acpi_object *fields = record->package.elements;
u32 revision = fields[1].integer.value;
switch (revision) {
case 1:
if (record->package.count != 6)
return AE_ERROR;
for (i = 2; i < 6; i++)
if (fields[i].type != ACPI_TYPE_INTEGER)
return AE_ERROR;
hpx0->revision = revision;
hpx0->cache_line_size = fields[2].integer.value;
hpx0->latency_timer = fields[3].integer.value;
hpx0->enable_serr = fields[4].integer.value;
hpx0->enable_perr = fields[5].integer.value;
break;
default:
pr_warn("%s: Type 0 Revision %d record not supported\n",
__func__, revision);
return AE_ERROR;
}
return AE_OK;
}
/* _HPX PCI-X Setting Record (Type 1) */
struct hpx_type1 {
u32 revision;
u8 max_mem_read;
u8 avg_max_split;
u16 tot_max_split;
};
static void program_hpx_type1(struct pci_dev *dev, struct hpx_type1 *hpx)
{
int pos;
if (!hpx)
Annotation
- Immediate include surface: `linux/delay.h`, `linux/init.h`, `linux/iommu.h`, `linux/irqdomain.h`, `linux/pci.h`, `linux/msi.h`, `linux/pci_hotplug.h`, `linux/module.h`.
- Detected declarations: `struct hpx_type0`, `struct hpx_type1`, `struct hpx_type2`, `struct hpx_type3`, `struct acpi_pci_generic_root_info`, `enum hpx_type3_dev_type`, `enum hpx_type3_fn_type`, `enum hpx_type3_cfg_loc`, `function acpi_get_rc_addr`, `function acpi_match_rc`.
- 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.