arch/mips/pci/pci-rt2880.c
Source file repositories/reference/linux-study-clean/arch/mips/pci/pci-rt2880.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/pci/pci-rt2880.c- Extension
.c- Size
- 6979 bytes
- Lines
- 278
- Domain
- Architecture Layer
- Bucket
- arch/mips
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/types.hlinux/pci.hlinux/io.hlinux/init.hlinux/mod_devicetable.hlinux/platform_device.hasm/mach-ralink/rt288x.h
Detected Declarations
function rt2880_pci_reg_readfunction rt2880_pci_reg_writefunction rt2880_pci_get_cfgaddrfunction rt2880_pci_config_readfunction rt2880_pci_config_writefunction rt2880_pci_read_u32function rt2880_pci_write_u32function pcibios_map_irqfunction rt288x_pci_probefunction pcibios_plat_dev_initfunction pcibios_init
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Ralink RT288x SoC PCI register definitions
*
* Copyright (C) 2009 John Crispin <john@phrozen.org>
* Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
*
* Parts of this file are based on Ralink's 2.6.21 BSP
*/
#include <linux/delay.h>
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/io.h>
#include <linux/init.h>
#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>
#include <asm/mach-ralink/rt288x.h>
#define RT2880_PCI_BASE 0x00440000
#define RT288X_CPU_IRQ_PCI 4
#define RT2880_PCI_MEM_BASE 0x20000000
#define RT2880_PCI_MEM_SIZE 0x10000000
#define RT2880_PCI_IO_BASE 0x00460000
#define RT2880_PCI_IO_SIZE 0x00010000
#define RT2880_PCI_REG_PCICFG_ADDR 0x00
#define RT2880_PCI_REG_PCIMSK_ADDR 0x0c
#define RT2880_PCI_REG_BAR0SETUP_ADDR 0x10
#define RT2880_PCI_REG_IMBASEBAR0_ADDR 0x18
#define RT2880_PCI_REG_CONFIG_ADDR 0x20
#define RT2880_PCI_REG_CONFIG_DATA 0x24
#define RT2880_PCI_REG_MEMBASE 0x28
#define RT2880_PCI_REG_IOBASE 0x2c
#define RT2880_PCI_REG_ID 0x30
#define RT2880_PCI_REG_CLASS 0x34
#define RT2880_PCI_REG_SUBID 0x38
#define RT2880_PCI_REG_ARBCTL 0x80
static void __iomem *rt2880_pci_base;
static u32 rt2880_pci_reg_read(u32 reg)
{
return readl(rt2880_pci_base + reg);
}
static void rt2880_pci_reg_write(u32 val, u32 reg)
{
writel(val, rt2880_pci_base + reg);
}
static inline u32 rt2880_pci_get_cfgaddr(unsigned int bus, unsigned int slot,
unsigned int func, unsigned int where)
{
return ((bus << 16) | (slot << 11) | (func << 8) | (where & 0xfc) |
0x80000000);
}
static int rt2880_pci_config_read(struct pci_bus *bus, unsigned int devfn,
int where, int size, u32 *val)
{
u32 address;
u32 data;
address = rt2880_pci_get_cfgaddr(bus->number, PCI_SLOT(devfn),
PCI_FUNC(devfn), where);
rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR);
data = rt2880_pci_reg_read(RT2880_PCI_REG_CONFIG_DATA);
switch (size) {
case 1:
*val = (data >> ((where & 3) << 3)) & 0xff;
break;
case 2:
*val = (data >> ((where & 3) << 3)) & 0xffff;
break;
case 4:
*val = data;
break;
}
return PCIBIOS_SUCCESSFUL;
}
static int rt2880_pci_config_write(struct pci_bus *bus, unsigned int devfn,
int where, int size, u32 val)
{
Annotation
- Immediate include surface: `linux/delay.h`, `linux/types.h`, `linux/pci.h`, `linux/io.h`, `linux/init.h`, `linux/mod_devicetable.h`, `linux/platform_device.h`, `asm/mach-ralink/rt288x.h`.
- Detected declarations: `function rt2880_pci_reg_read`, `function rt2880_pci_reg_write`, `function rt2880_pci_get_cfgaddr`, `function rt2880_pci_config_read`, `function rt2880_pci_config_write`, `function rt2880_pci_read_u32`, `function rt2880_pci_write_u32`, `function pcibios_map_irq`, `function rt288x_pci_probe`, `function pcibios_plat_dev_init`.
- Atlas domain: Architecture Layer / arch/mips.
- 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.