drivers/pci/controller/pcie-altera.c
Source file repositories/reference/linux-study-clean/drivers/pci/controller/pcie-altera.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/controller/pcie-altera.c- Extension
.c- Size
- 27283 bytes
- Lines
- 1066
- Domain
- Representative Device Path
- Bucket
- PCIe NVMe Storage Path
- Inferred role
- Representative Device Path: implementation source
- Status
- source implementation candidate
Why This File Exists
Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/delay.hlinux/interrupt.hlinux/irqchip/chained_irq.hlinux/irqdomain.hlinux/init.hlinux/module.hlinux/of.hlinux/of_pci.hlinux/pci.hlinux/platform_device.hlinux/slab.h../pci.h
Detected Declarations
struct altera_pciestruct altera_pcie_opsstruct altera_pcie_datastruct tlp_rp_regpair_tenum altera_pcie_versionfunction cra_writelfunction cra_readlfunction cra_writewfunction cra_readwfunction cra_writebfunction cra_readbfunction altera_pcie_link_upfunction s10_altera_pcie_link_upfunction aglx_altera_pcie_link_upfunction altera_pcie_hide_rc_barfunction tlp_write_txfunction s10_tlp_write_txfunction altera_pcie_valid_devicefunction tlp_read_packetfunction s10_tlp_read_packetfunction tlp_write_packetfunction s10_tlp_write_packetfunction get_tlp_headerfunction tlp_cfg_dword_readfunction tlp_cfg_dword_writefunction s10_rp_read_cfgfunction s10_rp_write_cfgfunction aglx_rp_read_cfgfunction aglx_rp_write_cfgfunction aglx_ep_write_cfgfunction aglx_ep_read_cfgfunction _altera_pcie_cfg_readfunction _altera_pcie_cfg_writefunction altera_pcie_cfg_readfunction altera_pcie_cfg_writefunction altera_read_cap_wordfunction altera_write_cap_wordfunction altera_wait_link_retrainfunction altera_pcie_retrainfunction altera_pcie_intx_mapfunction altera_pcie_isrfunction aglx_isrfunction altera_pcie_init_irq_domainfunction altera_pcie_irq_teardownfunction altera_pcie_parse_dtfunction altera_pcie_host_initfunction altera_pcie_probefunction altera_pcie_remove
Annotated Snippet
struct altera_pcie {
struct platform_device *pdev;
void __iomem *cra_base;
void __iomem *hip_base;
int irq;
u8 root_bus_nr;
struct irq_domain *irq_domain;
struct resource bus_range;
const struct altera_pcie_data *pcie_data;
};
struct altera_pcie_ops {
int (*tlp_read_pkt)(struct altera_pcie *pcie, u32 *value);
void (*tlp_write_pkt)(struct altera_pcie *pcie, u32 *headers,
u32 data, bool align);
bool (*get_link_status)(struct altera_pcie *pcie);
int (*rp_read_cfg)(struct altera_pcie *pcie, int where,
int size, u32 *value);
int (*rp_write_cfg)(struct altera_pcie *pcie, u8 busno,
int where, int size, u32 value);
int (*ep_read_cfg)(struct altera_pcie *pcie, u8 busno,
unsigned int devfn, int where, int size, u32 *value);
int (*ep_write_cfg)(struct altera_pcie *pcie, u8 busno,
unsigned int devfn, int where, int size, u32 value);
void (*rp_isr)(struct irq_desc *desc);
};
struct altera_pcie_data {
const struct altera_pcie_ops *ops;
enum altera_pcie_version version;
u32 cap_offset; /* PCIe capability structure register offset */
u32 cfgrd0;
u32 cfgrd1;
u32 cfgwr0;
u32 cfgwr1;
u32 port_conf_offset;
u32 port_irq_status_offset;
u32 port_irq_enable_offset;
};
struct tlp_rp_regpair_t {
u32 ctrl;
u32 reg0;
u32 reg1;
};
static inline void cra_writel(struct altera_pcie *pcie, const u32 value,
const u32 reg)
{
writel_relaxed(value, pcie->cra_base + reg);
}
static inline u32 cra_readl(struct altera_pcie *pcie, const u32 reg)
{
return readl_relaxed(pcie->cra_base + reg);
}
static inline void cra_writew(struct altera_pcie *pcie, const u32 value,
const u32 reg)
{
writew_relaxed(value, pcie->cra_base + reg);
}
static inline u32 cra_readw(struct altera_pcie *pcie, const u32 reg)
{
return readw_relaxed(pcie->cra_base + reg);
}
static inline void cra_writeb(struct altera_pcie *pcie, const u32 value,
const u32 reg)
{
writeb_relaxed(value, pcie->cra_base + reg);
}
static inline u32 cra_readb(struct altera_pcie *pcie, const u32 reg)
{
return readb_relaxed(pcie->cra_base + reg);
}
static bool altera_pcie_link_up(struct altera_pcie *pcie)
{
return !!((cra_readl(pcie, RP_LTSSM) & RP_LTSSM_MASK) == LTSSM_L0);
}
static bool s10_altera_pcie_link_up(struct altera_pcie *pcie)
{
void __iomem *addr = S10_RP_CFG_ADDR(pcie,
pcie->pcie_data->cap_offset +
PCI_EXP_LNKSTA);
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/delay.h`, `linux/interrupt.h`, `linux/irqchip/chained_irq.h`, `linux/irqdomain.h`, `linux/init.h`, `linux/module.h`, `linux/of.h`.
- Detected declarations: `struct altera_pcie`, `struct altera_pcie_ops`, `struct altera_pcie_data`, `struct tlp_rp_regpair_t`, `enum altera_pcie_version`, `function cra_writel`, `function cra_readl`, `function cra_writew`, `function cra_readw`, `function cra_writeb`.
- Atlas domain: Representative Device Path / PCIe NVMe Storage Path.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.