arch/x86/pci/i386.c
Source file repositories/reference/linux-study-clean/arch/x86/pci/i386.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/pci/i386.c- Extension
.c- Size
- 11170 bytes
- Lines
- 413
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/types.hlinux/kernel.hlinux/export.hlinux/pci.hlinux/init.hlinux/ioport.hlinux/errno.hlinux/memblock.hasm/memtype.hasm/e820/api.hasm/pci_x86.hasm/io_apic.h
Detected Declarations
struct pcibios_fwaddrmapstruct pci_check_idx_rangefunction pcibios_save_fw_addrfunction pcibios_retrieve_fw_addrfunction pcibios_fw_addr_list_delfunction skip_isa_ioresource_alignfunction pcibios_align_resourcefunction pcibios_allocate_bridge_resourcesfunction pcibios_allocate_bus_resourcesfunction pcibios_allocate_dev_resourcesfunction pcibios_allocate_resourcesfunction list_for_each_entryfunction pcibios_allocate_dev_rom_resourcefunction pcibios_allocate_rom_resourcesfunction list_for_each_entryfunction pcibios_assign_resourcesfunction pcibios_resource_survey_busfunction pcibios_resource_surveymodule init pcibios_assign_resourcesexport pcibios_align_resource
Annotated Snippet
struct pcibios_fwaddrmap {
struct list_head list;
struct pci_dev *dev;
resource_size_t fw_addr[DEVICE_COUNT_RESOURCE];
};
static LIST_HEAD(pcibios_fwaddrmappings);
static DEFINE_SPINLOCK(pcibios_fwaddrmap_lock);
static bool pcibios_fw_addr_done;
/* Must be called with 'pcibios_fwaddrmap_lock' lock held. */
static struct pcibios_fwaddrmap *pcibios_fwaddrmap_lookup(struct pci_dev *dev)
{
struct pcibios_fwaddrmap *map;
lockdep_assert_held(&pcibios_fwaddrmap_lock);
list_for_each_entry(map, &pcibios_fwaddrmappings, list)
if (map->dev == dev)
return map;
return NULL;
}
static void
pcibios_save_fw_addr(struct pci_dev *dev, int idx, resource_size_t fw_addr)
{
unsigned long flags;
struct pcibios_fwaddrmap *map;
if (pcibios_fw_addr_done)
return;
spin_lock_irqsave(&pcibios_fwaddrmap_lock, flags);
map = pcibios_fwaddrmap_lookup(dev);
if (!map) {
spin_unlock_irqrestore(&pcibios_fwaddrmap_lock, flags);
map = kzalloc_obj(*map);
if (!map)
return;
map->dev = pci_dev_get(dev);
map->fw_addr[idx] = fw_addr;
INIT_LIST_HEAD(&map->list);
spin_lock_irqsave(&pcibios_fwaddrmap_lock, flags);
list_add_tail(&map->list, &pcibios_fwaddrmappings);
} else
map->fw_addr[idx] = fw_addr;
spin_unlock_irqrestore(&pcibios_fwaddrmap_lock, flags);
}
resource_size_t pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx)
{
unsigned long flags;
struct pcibios_fwaddrmap *map;
resource_size_t fw_addr = 0;
if (pcibios_fw_addr_done)
return 0;
spin_lock_irqsave(&pcibios_fwaddrmap_lock, flags);
map = pcibios_fwaddrmap_lookup(dev);
if (map)
fw_addr = map->fw_addr[idx];
spin_unlock_irqrestore(&pcibios_fwaddrmap_lock, flags);
return fw_addr;
}
static void __init pcibios_fw_addr_list_del(void)
{
unsigned long flags;
struct pcibios_fwaddrmap *entry, *next;
spin_lock_irqsave(&pcibios_fwaddrmap_lock, flags);
list_for_each_entry_safe(entry, next, &pcibios_fwaddrmappings, list) {
list_del(&entry->list);
pci_dev_put(entry->dev);
kfree(entry);
}
spin_unlock_irqrestore(&pcibios_fwaddrmap_lock, flags);
pcibios_fw_addr_done = true;
}
static int
skip_isa_ioresource_align(struct pci_dev *dev) {
if ((pci_probe & PCI_CAN_SKIP_ISA_ALIGN) &&
!(dev->bus->bridge_ctl & PCI_BRIDGE_CTL_ISA))
Annotation
- Immediate include surface: `linux/types.h`, `linux/kernel.h`, `linux/export.h`, `linux/pci.h`, `linux/init.h`, `linux/ioport.h`, `linux/errno.h`, `linux/memblock.h`.
- Detected declarations: `struct pcibios_fwaddrmap`, `struct pci_check_idx_range`, `function pcibios_save_fw_addr`, `function pcibios_retrieve_fw_addr`, `function pcibios_fw_addr_list_del`, `function skip_isa_ioresource_align`, `function pcibios_align_resource`, `function pcibios_allocate_bridge_resources`, `function pcibios_allocate_bus_resources`, `function pcibios_allocate_dev_resources`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: integration 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.