arch/sparc/kernel/pci_common.c
Source file repositories/reference/linux-study-clean/arch/sparc/kernel/pci_common.c
File Facts
- System
- Linux kernel
- Corpus path
arch/sparc/kernel/pci_common.c- Extension
.c- Size
- 13276 bytes
- Lines
- 548
- Domain
- Architecture Layer
- Bucket
- arch/sparc
- 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.
- 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/slab.hlinux/pci.hlinux/device.hlinux/of.hlinux/platform_device.hasm/prom.hasm/oplib.hpci_impl.hpci_sun4v.h
Detected Declarations
function Copyrightfunction sun4u_read_pci_cfg_hostfunction sun4u_read_pci_cfgfunction sun4u_write_pci_cfg_hostfunction sun4u_write_pci_cfgfunction sun4v_read_pci_cfgfunction sun4v_write_pci_cfgfunction pci_get_pbm_propsfunction pci_register_iommu_regionfunction pci_determine_mem_io_spacefunction pci_scan_for_target_abortfunction list_for_each_entryfunction pci_scan_for_master_abortfunction list_for_each_entryfunction pci_scan_for_parity_errorfunction list_for_each_entry
Annotated Snippet
if (where < 8) {
unsigned long align = (unsigned long) addr;
align &= ~1;
pci_config_read16((u16 *)align, &tmp16);
if (where & 1)
*value = tmp16 >> 8;
else
*value = tmp16 & 0xff;
} else {
pci_config_read8((u8 *)addr, &tmp8);
*value = (u32) tmp8;
}
break;
case 2:
if (where < 8) {
pci_config_read16((u16 *)addr, &tmp16);
*value = (u32) tmp16;
} else {
pci_config_read8((u8 *)addr, &tmp8);
*value = (u32) tmp8;
pci_config_read8(((u8 *)addr) + 1, &tmp8);
*value |= ((u32) tmp8) << 8;
}
break;
case 4:
tmp32 = 0xffffffff;
sun4u_read_pci_cfg_host(pbm, bus, devfn,
where, 2, &tmp32);
*value = tmp32;
tmp32 = 0xffffffff;
sun4u_read_pci_cfg_host(pbm, bus, devfn,
where + 2, 2, &tmp32);
*value |= tmp32 << 16;
break;
}
return PCIBIOS_SUCCESSFUL;
}
static int sun4u_read_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn,
int where, int size, u32 *value)
{
struct pci_pbm_info *pbm = bus_dev->sysdata;
unsigned char bus = bus_dev->number;
u32 *addr;
u16 tmp16;
u8 tmp8;
switch (size) {
case 1:
*value = 0xff;
break;
case 2:
*value = 0xffff;
break;
case 4:
*value = 0xffffffff;
break;
}
if (!bus_dev->number && !PCI_SLOT(devfn))
return sun4u_read_pci_cfg_host(pbm, bus, devfn, where,
size, value);
addr = sun4u_config_mkaddr(pbm, bus, devfn, where);
if (!addr)
return PCIBIOS_SUCCESSFUL;
switch (size) {
case 1:
pci_config_read8((u8 *)addr, &tmp8);
*value = (u32) tmp8;
break;
case 2:
if (where & 0x01) {
printk("pci_read_config_word: misaligned reg [%x]\n",
where);
return PCIBIOS_SUCCESSFUL;
}
pci_config_read16((u16 *)addr, &tmp16);
*value = (u32) tmp16;
break;
case 4:
if (where & 0x03) {
printk("pci_read_config_dword: misaligned reg [%x]\n",
Annotation
- Immediate include surface: `linux/string.h`, `linux/slab.h`, `linux/pci.h`, `linux/device.h`, `linux/of.h`, `linux/platform_device.h`, `asm/prom.h`, `asm/oplib.h`.
- Detected declarations: `function Copyright`, `function sun4u_read_pci_cfg_host`, `function sun4u_read_pci_cfg`, `function sun4u_write_pci_cfg_host`, `function sun4u_write_pci_cfg`, `function sun4v_read_pci_cfg`, `function sun4v_write_pci_cfg`, `function pci_get_pbm_props`, `function pci_register_iommu_region`, `function pci_determine_mem_io_space`.
- Atlas domain: Architecture Layer / arch/sparc.
- Implementation status: source 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.