arch/x86/pci/mmconfig-shared.c
Source file repositories/reference/linux-study-clean/arch/x86/pci/mmconfig-shared.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/pci/mmconfig-shared.c- Extension
.c- Size
- 21472 bytes
- Lines
- 879
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/acpi.hlinux/efi.hlinux/pci.hlinux/init.hlinux/bitmap.hlinux/dmi.hlinux/slab.hlinux/mutex.hlinux/rculist.hasm/acpi.hasm/e820/api.hasm/msr.hasm/pci_x86.h
Detected Declarations
struct pci_mmcfg_hostbridge_probefunction pci_mmconfig_removefunction free_all_mmcfgfunction list_add_sortedfunction pci_mmconfig_addfunction pci_mmcfg_e7520function pci_mmcfg_intel_945function pci_mmcfg_amd_fam10hfunction pci_mmcfg_nvidia_mcp55function pci_mmcfg_check_end_bus_numberfunction pci_mmcfg_check_hostbridgefunction check_mcfg_resourcefunction find_mboard_resourcefunction is_acpi_reservedfunction is_efi_mmiofunction for_each_efi_memory_descfunction is_mmconf_reservedfunction pci_mmcfg_reservedfunction pci_mmcfg_reject_brokenfunction list_for_each_entryfunction acpi_mcfg_valid_entryfunction pci_parse_mcfgfunction pci_mmcfg_for_each_regionfunction list_for_each_entryfunction __pci_mmcfg_initfunction list_for_each_entryfunction pci_mmcfg_early_initfunction pci_mmcfg_late_initfunction pci_mmcfg_late_insert_resourcesfunction pci_mmconfig_insertfunction pci_mmconfig_lookupfunction pci_mmconfig_delete
Annotated Snippet
struct pci_mmcfg_hostbridge_probe {
u32 bus;
u32 devfn;
u32 vendor;
u32 device;
const char *(*probe)(void);
};
static const struct pci_mmcfg_hostbridge_probe pci_mmcfg_probes[] __initconst = {
{ 0, PCI_DEVFN(0, 0), PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_INTEL_E7520_MCH, pci_mmcfg_e7520 },
{ 0, PCI_DEVFN(0, 0), PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_INTEL_82945G_HB, pci_mmcfg_intel_945 },
{ 0, PCI_DEVFN(0x18, 0), PCI_VENDOR_ID_AMD,
0x1200, pci_mmcfg_amd_fam10h },
{ 0xff, PCI_DEVFN(0, 0), PCI_VENDOR_ID_AMD,
0x1200, pci_mmcfg_amd_fam10h },
{ 0, PCI_DEVFN(0, 0), PCI_VENDOR_ID_NVIDIA,
0x0369, pci_mmcfg_nvidia_mcp55 },
};
static void __init pci_mmcfg_check_end_bus_number(void)
{
struct pci_mmcfg_region *cfg, *cfgx;
/* Fixup overlaps */
list_for_each_entry(cfg, &pci_mmcfg_list, list) {
if (cfg->end_bus < cfg->start_bus)
cfg->end_bus = 255;
/* Don't access the list head ! */
if (cfg->list.next == &pci_mmcfg_list)
break;
cfgx = list_entry(cfg->list.next, typeof(*cfg), list);
if (cfg->end_bus >= cfgx->start_bus)
cfg->end_bus = cfgx->start_bus - 1;
}
}
static int __init pci_mmcfg_check_hostbridge(void)
{
u32 l;
u32 bus, devfn;
u16 vendor, device;
int i;
const char *name;
if (!raw_pci_ops)
return 0;
free_all_mmcfg();
for (i = 0; i < ARRAY_SIZE(pci_mmcfg_probes); i++) {
bus = pci_mmcfg_probes[i].bus;
devfn = pci_mmcfg_probes[i].devfn;
raw_pci_ops->read(0, bus, devfn, 0, 4, &l);
vendor = l & 0xffff;
device = (l >> 16) & 0xffff;
name = NULL;
if (pci_mmcfg_probes[i].vendor == vendor &&
pci_mmcfg_probes[i].device == device)
name = pci_mmcfg_probes[i].probe();
if (name)
pr_info("%s with ECAM support\n", name);
}
/* some end_bus_number is crazy, fix it */
pci_mmcfg_check_end_bus_number();
return !list_empty(&pci_mmcfg_list);
}
static acpi_status check_mcfg_resource(struct acpi_resource *res, void *data)
{
struct resource *mcfg_res = data;
struct acpi_resource_address64 address;
acpi_status status;
if (res->type == ACPI_RESOURCE_TYPE_FIXED_MEMORY32) {
struct acpi_resource_fixed_memory32 *fixmem32 =
&res->data.fixed_memory32;
if (!fixmem32)
return AE_OK;
if ((mcfg_res->start >= fixmem32->address) &&
(mcfg_res->end < (fixmem32->address +
fixmem32->address_length))) {
mcfg_res->flags = 1;
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/efi.h`, `linux/pci.h`, `linux/init.h`, `linux/bitmap.h`, `linux/dmi.h`, `linux/slab.h`, `linux/mutex.h`.
- Detected declarations: `struct pci_mmcfg_hostbridge_probe`, `function pci_mmconfig_remove`, `function free_all_mmcfg`, `function list_add_sorted`, `function pci_mmconfig_add`, `function pci_mmcfg_e7520`, `function pci_mmcfg_intel_945`, `function pci_mmcfg_amd_fam10h`, `function pci_mmcfg_nvidia_mcp55`, `function pci_mmcfg_check_end_bus_number`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.