arch/arm/mach-mv78xx0/pcie.c
Source file repositories/reference/linux-study-clean/arch/arm/mach-mv78xx0/pcie.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm/mach-mv78xx0/pcie.c- Extension
.c- Size
- 7016 bytes
- Lines
- 281
- Domain
- Architecture Layer
- Bucket
- arch/arm
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/pci.hlinux/mbus.hvideo/vga.hasm/irq.hasm/mach/pci.hplat/pcie.hmv78xx0.hcommon.h
Detected Declarations
struct pcie_portfunction mv78xx0_pcie_idfunction mv78xx0_pcie_preinitfunction mv78xx0_pcie_setupfunction pcie_valid_configfunction pcie_rd_conffunction pcie_wr_conffunction rc_pci_fixupfunction pci_dev_for_each_resourcefunction mv78xx0_pcie_scan_busfunction mv78xx0_pcie_map_irqfunction add_pcie_portfunction mv78xx0_pcie_init
Annotated Snippet
struct pcie_port {
u8 maj;
u8 min;
u8 root_bus_nr;
void __iomem *base;
spinlock_t conf_lock;
char mem_space_name[20];
struct resource res;
};
static struct pcie_port pcie_port[8];
static int num_pcie_ports;
static struct resource pcie_io_space;
void __init mv78xx0_pcie_id(u32 *dev, u32 *rev)
{
*dev = orion_pcie_dev_id(PCIE00_VIRT_BASE);
*rev = orion_pcie_rev(PCIE00_VIRT_BASE);
}
u32 pcie_port_size[8] = {
0,
0x20000000,
0x10000000,
0x10000000,
0x08000000,
0x08000000,
0x08000000,
0x04000000,
};
static void __init mv78xx0_pcie_preinit(void)
{
int i;
u32 size_each;
u32 start;
pcie_io_space.name = "PCIe I/O Space";
pcie_io_space.start = MV78XX0_PCIE_IO_PHYS_BASE(0);
pcie_io_space.end =
MV78XX0_PCIE_IO_PHYS_BASE(0) + MV78XX0_PCIE_IO_SIZE * 8 - 1;
pcie_io_space.flags = IORESOURCE_MEM;
if (request_resource(&iomem_resource, &pcie_io_space))
panic("can't allocate PCIe I/O space");
if (num_pcie_ports > 7)
panic("invalid number of PCIe ports");
size_each = pcie_port_size[num_pcie_ports];
start = MV78XX0_PCIE_MEM_PHYS_BASE;
for (i = 0; i < num_pcie_ports; i++) {
struct pcie_port *pp = pcie_port + i;
snprintf(pp->mem_space_name, sizeof(pp->mem_space_name),
"PCIe %d.%d MEM", pp->maj, pp->min);
pp->mem_space_name[sizeof(pp->mem_space_name) - 1] = 0;
pp->res.name = pp->mem_space_name;
pp->res.flags = IORESOURCE_MEM;
pp->res.start = start;
pp->res.end = start + size_each - 1;
start += size_each;
if (request_resource(&iomem_resource, &pp->res))
panic("can't allocate PCIe MEM sub-space");
mvebu_mbus_add_window_by_id(MV78XX0_MBUS_PCIE_MEM_TARGET(pp->maj, pp->min),
MV78XX0_MBUS_PCIE_MEM_ATTR(pp->maj, pp->min),
pp->res.start, resource_size(&pp->res));
mvebu_mbus_add_window_remap_by_id(MV78XX0_MBUS_PCIE_IO_TARGET(pp->maj, pp->min),
MV78XX0_MBUS_PCIE_IO_ATTR(pp->maj, pp->min),
i * SZ_64K, SZ_64K, 0);
}
}
static int __init mv78xx0_pcie_setup(int nr, struct pci_sys_data *sys)
{
struct pcie_port *pp;
struct resource realio;
if (nr >= num_pcie_ports)
return 0;
pp = &pcie_port[nr];
sys->private_data = pp;
pp->root_bus_nr = sys->busnr;
/*
* Generic PCIe unit setup.
*/
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/pci.h`, `linux/mbus.h`, `video/vga.h`, `asm/irq.h`, `asm/mach/pci.h`, `plat/pcie.h`, `mv78xx0.h`.
- Detected declarations: `struct pcie_port`, `function mv78xx0_pcie_id`, `function mv78xx0_pcie_preinit`, `function mv78xx0_pcie_setup`, `function pcie_valid_config`, `function pcie_rd_conf`, `function pcie_wr_conf`, `function rc_pci_fixup`, `function pci_dev_for_each_resource`, `function mv78xx0_pcie_scan_bus`.
- Atlas domain: Architecture Layer / arch/arm.
- 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.