arch/sparc/kernel/of_device_64.c
Source file repositories/reference/linux-study-clean/arch/sparc/kernel/of_device_64.c
File Facts
- System
- Linux kernel
- Corpus path
arch/sparc/kernel/of_device_64.c- Extension
.c- Size
- 16228 bytes
- Lines
- 727
- 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.
- 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/string.hlinux/kernel.hlinux/dma-mapping.hlinux/init.hlinux/export.hlinux/mod_devicetable.hlinux/slab.hlinux/errno.hlinux/irq.hlinux/of.hlinux/of_platform.hlinux/platform_device.hasm/spitfire.hof_device_common.h
Detected Declarations
function of_iounmapfunction of_bus_pci_matchfunction of_bus_simba_matchfunction of_bus_simba_mapfunction of_bus_pci_count_cellsfunction of_bus_pci_mapfunction of_bus_pci_get_flagsfunction of_bus_fhc_matchfunction build_one_resourcefunction use_1to1_mappingfunction build_device_resourcesfunction apply_interrupt_mapfunction pci_irq_swizzlefunction build_one_device_irqfunction scan_one_devicefunction scan_treefunction scan_of_devicesfunction of_debugexport of_ioremapexport of_iounmap
Annotated Snippet
if (use_1to1_mapping(pp)) {
result = of_read_addr(addr, na);
goto build_res;
}
dna = na;
dns = ns;
dbus = bus;
while (1) {
dp = pp;
pp = dp->parent;
if (!pp) {
result = of_read_addr(addr, dna);
break;
}
pbus = of_match_bus(pp);
pbus->count_cells(dp, &pna, &pns);
if (build_one_resource(dp, dbus, pbus, addr,
dna, dns, pna))
break;
flags = pbus->get_flags(addr, flags);
dna = pna;
dns = pns;
dbus = pbus;
}
build_res:
memset(r, 0, sizeof(*r));
if (of_resource_verbose)
printk("%pOF reg[%d] -> %llx\n",
op->dev.of_node, index,
result);
if (result != OF_BAD_ADDR) {
if (tlb_type == hypervisor)
result &= 0x0fffffffffffffffUL;
r->start = result;
r->end = result + size - 1;
r->flags = flags;
}
r->name = op->dev.of_node->full_name;
}
}
static struct device_node * __init
apply_interrupt_map(struct device_node *dp, struct device_node *pp,
const u32 *imap, int imlen, const u32 *imask,
unsigned int *irq_p)
{
struct device_node *cp;
unsigned int irq = *irq_p;
struct of_bus *bus;
phandle handle;
const u32 *reg;
int na, num_reg, i;
bus = of_match_bus(pp);
bus->count_cells(dp, &na, NULL);
reg = of_get_property(dp, "reg", &num_reg);
if (!reg || !num_reg)
return NULL;
imlen /= ((na + 3) * 4);
handle = 0;
for (i = 0; i < imlen; i++) {
int j;
for (j = 0; j < na; j++) {
if ((reg[j] & imask[j]) != imap[j])
goto next;
}
if (imap[na] == irq) {
handle = imap[na + 1];
irq = imap[na + 2];
break;
}
next:
imap += (na + 3);
}
if (i == imlen) {
/* Psycho and Sabre PCI controllers can have 'interrupt-map'
Annotation
- Immediate include surface: `linux/string.h`, `linux/kernel.h`, `linux/dma-mapping.h`, `linux/init.h`, `linux/export.h`, `linux/mod_devicetable.h`, `linux/slab.h`, `linux/errno.h`.
- Detected declarations: `function of_iounmap`, `function of_bus_pci_match`, `function of_bus_simba_match`, `function of_bus_simba_map`, `function of_bus_pci_count_cells`, `function of_bus_pci_map`, `function of_bus_pci_get_flags`, `function of_bus_fhc_match`, `function build_one_resource`, `function use_1to1_mapping`.
- Atlas domain: Architecture Layer / arch/sparc.
- Implementation status: integration implementation candidate.
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.