arch/sparc/kernel/pci.c
Source file repositories/reference/linux-study-clean/arch/sparc/kernel/pci.c
File Facts
- System
- Linux kernel
- Corpus path
arch/sparc/kernel/pci.c- Extension
.c- Size
- 25003 bytes
- Lines
- 1014
- Domain
- Architecture Layer
- Bucket
- arch/sparc
- 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.
- 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/export.hlinux/kernel.hlinux/string.hlinux/sched.hlinux/capability.hlinux/errno.hlinux/pci.hlinux/msi.hlinux/irq.hlinux/init.hlinux/of.hlinux/of_platform.hlinux/pgtable.hlinux/platform_device.hlinux/uaccess.hasm/irq.hasm/prom.hasm/apb.hpci_impl.hkernel.h
Detected Declarations
function pci_config_read8function pci_config_read16function pci_config_read32function pci_config_write8function pci_config_write16function pci_config_write32function ofpci_debugfunction of_fixup_pci_preffunction pci_parse_of_flagsfunction pci_parse_of_addrsfunction pci_init_dev_archdatafunction apb_calc_first_lastfunction apb_fake_rangesfunction of_scan_pci_bridgefunction pci_of_scan_busfunction show_pciobppath_attrfunction pci_bus_register_of_sysfsfunction list_for_each_entryfunction pci_claim_legacy_resourcesfunction pci_claim_bus_resourcesfunction list_for_each_entryfunction pci_dev_for_each_resourcefunction pci_iobar_pfnfunction pcibus_to_nodefunction pci_domain_nrfunction arch_setup_msi_irqfunction arch_teardown_msi_irqfunction ali_sound_dma_hackfunction pci_resource_to_userfunction pcibios_set_masterfunction pcibios_initfunction pcie_bus_slot_namesfunction list_for_each_entryfunction pci_bus_slot_namesfunction of_pci_slot_initmodule init pcibios_initmodule init of_pci_slot_initexport pcibus_to_nodeexport pci_domain_nr
Annotated Snippet
subsys_initcall(pcibios_init);
#ifdef CONFIG_SYSFS
#define SLOT_NAME_SIZE 11 /* Max decimal digits + null in u32 */
static void pcie_bus_slot_names(struct pci_bus *pbus)
{
struct pci_dev *pdev;
struct pci_bus *bus;
list_for_each_entry(pdev, &pbus->devices, bus_list) {
char name[SLOT_NAME_SIZE];
struct pci_slot *pci_slot;
const u32 *slot_num;
int len;
slot_num = of_get_property(pdev->dev.of_node,
"physical-slot#", &len);
if (slot_num == NULL || len != 4)
continue;
snprintf(name, sizeof(name), "%u", slot_num[0]);
pci_slot = pci_create_slot(pbus, slot_num[0], name, NULL);
if (IS_ERR(pci_slot))
pr_err("PCI: pci_create_slot returned %ld.\n",
PTR_ERR(pci_slot));
}
list_for_each_entry(bus, &pbus->children, node)
pcie_bus_slot_names(bus);
}
static void pci_bus_slot_names(struct device_node *node, struct pci_bus *bus)
{
const struct pci_slot_names {
u32 slot_mask;
char names[];
} *prop;
const char *sp;
int len, i;
u32 mask;
prop = of_get_property(node, "slot-names", &len);
if (!prop)
return;
mask = prop->slot_mask;
sp = prop->names;
if (ofpci_verbose)
pci_info(bus, "Making slots for [%pOF] mask[0x%02x]\n",
node, mask);
i = 0;
while (mask) {
struct pci_slot *pci_slot;
u32 this_bit = 1 << i;
if (!(mask & this_bit)) {
i++;
continue;
}
if (ofpci_verbose)
pci_info(bus, "Making slot [%s]\n", sp);
pci_slot = pci_create_slot(bus, i, sp, NULL);
if (IS_ERR(pci_slot))
pci_err(bus, "pci_create_slot returned %ld\n",
PTR_ERR(pci_slot));
sp += strlen(sp) + 1;
mask &= ~this_bit;
i++;
}
}
static int __init of_pci_slot_init(void)
{
struct pci_bus *pbus = NULL;
while ((pbus = pci_find_next_bus(pbus)) != NULL) {
struct device_node *node;
struct pci_dev *pdev;
pdev = list_first_entry(&pbus->devices, struct pci_dev,
bus_list);
Annotation
- Immediate include surface: `linux/export.h`, `linux/kernel.h`, `linux/string.h`, `linux/sched.h`, `linux/capability.h`, `linux/errno.h`, `linux/pci.h`, `linux/msi.h`.
- Detected declarations: `function pci_config_read8`, `function pci_config_read16`, `function pci_config_read32`, `function pci_config_write8`, `function pci_config_write16`, `function pci_config_write32`, `function ofpci_debug`, `function of_fixup_pci_pref`, `function pci_parse_of_flags`, `function pci_parse_of_addrs`.
- Atlas domain: Architecture Layer / arch/sparc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.