arch/mips/pci/pci-ar724x.c
Source file repositories/reference/linux-study-clean/arch/mips/pci/pci-ar724x.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/pci/pci-ar724x.c- Extension
.c- Size
- 10318 bytes
- Lines
- 448
- Domain
- Architecture Layer
- Bucket
- arch/mips
- 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/irq.hlinux/pci.hlinux/init.hlinux/delay.hlinux/platform_device.hasm/mach-ath79/ath79.hasm/mach-ath79/ar71xx_regs.h
Detected Declarations
struct ar724x_pci_controllerfunction ar724x_pci_check_linkfunction pci_bus_to_ar724x_controllerfunction ar724x_pci_local_writefunction ar724x_pci_readfunction ar724x_pci_writefunction ar724x_pci_irq_handlerfunction ar724x_pci_irq_unmaskfunction ar724x_pci_irq_maskfunction ar724x_pci_irq_initfunction ar724x_pci_hw_initfunction ar724x_pci_probefunction ar724x_pci_init
Annotated Snippet
struct ar724x_pci_controller {
void __iomem *devcfg_base;
void __iomem *ctrl_base;
void __iomem *crp_base;
int irq;
int irq_base;
bool link_up;
bool bar0_is_cached;
u32 bar0_value;
struct pci_controller pci_controller;
struct resource io_res;
struct resource mem_res;
};
static inline bool ar724x_pci_check_link(struct ar724x_pci_controller *apc)
{
u32 reset;
reset = __raw_readl(apc->ctrl_base + AR724X_PCI_REG_RESET);
return reset & AR724X_PCI_RESET_LINK_UP;
}
static inline struct ar724x_pci_controller *
pci_bus_to_ar724x_controller(struct pci_bus *bus)
{
struct pci_controller *hose;
hose = (struct pci_controller *) bus->sysdata;
return container_of(hose, struct ar724x_pci_controller, pci_controller);
}
static int ar724x_pci_local_write(struct ar724x_pci_controller *apc,
int where, int size, u32 value)
{
void __iomem *base;
u32 data;
int s;
WARN_ON(where & (size - 1));
if (!apc->link_up)
return PCIBIOS_DEVICE_NOT_FOUND;
base = apc->crp_base;
data = __raw_readl(base + (where & ~3));
switch (size) {
case 1:
s = ((where & 3) * 8);
data &= ~(0xff << s);
data |= ((value & 0xff) << s);
break;
case 2:
s = ((where & 2) * 8);
data &= ~(0xffff << s);
data |= ((value & 0xffff) << s);
break;
case 4:
data = value;
break;
default:
return PCIBIOS_BAD_REGISTER_NUMBER;
}
__raw_writel(data, base + (where & ~3));
/* flush write */
__raw_readl(base + (where & ~3));
return PCIBIOS_SUCCESSFUL;
}
static int ar724x_pci_read(struct pci_bus *bus, unsigned int devfn, int where,
int size, uint32_t *value)
{
struct ar724x_pci_controller *apc;
void __iomem *base;
u32 data;
apc = pci_bus_to_ar724x_controller(bus);
if (!apc->link_up)
return PCIBIOS_DEVICE_NOT_FOUND;
if (devfn)
return PCIBIOS_DEVICE_NOT_FOUND;
base = apc->devcfg_base;
data = __raw_readl(base + (where & ~3));
Annotation
- Immediate include surface: `linux/irq.h`, `linux/pci.h`, `linux/init.h`, `linux/delay.h`, `linux/platform_device.h`, `asm/mach-ath79/ath79.h`, `asm/mach-ath79/ar71xx_regs.h`.
- Detected declarations: `struct ar724x_pci_controller`, `function ar724x_pci_check_link`, `function pci_bus_to_ar724x_controller`, `function ar724x_pci_local_write`, `function ar724x_pci_read`, `function ar724x_pci_write`, `function ar724x_pci_irq_handler`, `function ar724x_pci_irq_unmask`, `function ar724x_pci_irq_mask`, `function ar724x_pci_irq_init`.
- Atlas domain: Architecture Layer / arch/mips.
- 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.