drivers/pci/controller/dwc/pcie-intel-gw.c
Source file repositories/reference/linux-study-clean/drivers/pci/controller/dwc/pcie-intel-gw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/controller/dwc/pcie-intel-gw.c- Extension
.c- Size
- 10472 bytes
- Lines
- 448
- 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.
- 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/bitfield.hlinux/clk.hlinux/gpio/consumer.hlinux/iopoll.hlinux/mod_devicetable.hlinux/pci_regs.hlinux/phy/phy.hlinux/platform_device.hlinux/property.hlinux/reset.h../../pci.hpcie-designware.h
Detected Declarations
struct intel_pciefunction pcie_update_bitsfunction pcie_app_wrfunction pcie_app_wr_maskfunction pcie_rc_cfg_rdfunction pcie_rc_cfg_wrfunction pcie_rc_cfg_wr_maskfunction intel_pcie_ltssm_enablefunction intel_pcie_ltssm_disablefunction intel_pcie_link_setupfunction intel_pcie_init_n_ftsfunction intel_pcie_ep_rst_initfunction intel_pcie_core_rst_assertfunction intel_pcie_core_rst_deassertfunction intel_pcie_device_rst_assertfunction intel_pcie_device_rst_deassertfunction intel_pcie_core_irq_disablefunction intel_pcie_get_resourcesfunction intel_pcie_wait_l2function intel_pcie_turn_offfunction intel_pcie_host_setupfunction __intel_pcie_removefunction intel_pcie_removefunction intel_pcie_suspend_noirqfunction intel_pcie_resume_noirqfunction intel_pcie_rc_initfunction intel_pcie_probe
Annotated Snippet
struct intel_pcie {
struct dw_pcie pci;
void __iomem *app_base;
struct gpio_desc *reset_gpio;
u32 rst_intrvl;
struct clk *core_clk;
struct reset_control *core_rst;
struct phy *phy;
};
static void pcie_update_bits(void __iomem *base, u32 ofs, u32 mask, u32 val)
{
u32 old;
old = readl(base + ofs);
val = (old & ~mask) | (val & mask);
if (val != old)
writel(val, base + ofs);
}
static inline void pcie_app_wr(struct intel_pcie *pcie, u32 ofs, u32 val)
{
writel(val, pcie->app_base + ofs);
}
static void pcie_app_wr_mask(struct intel_pcie *pcie, u32 ofs,
u32 mask, u32 val)
{
pcie_update_bits(pcie->app_base, ofs, mask, val);
}
static inline u32 pcie_rc_cfg_rd(struct intel_pcie *pcie, u32 ofs)
{
return dw_pcie_readl_dbi(&pcie->pci, ofs);
}
static inline void pcie_rc_cfg_wr(struct intel_pcie *pcie, u32 ofs, u32 val)
{
dw_pcie_writel_dbi(&pcie->pci, ofs, val);
}
static void pcie_rc_cfg_wr_mask(struct intel_pcie *pcie, u32 ofs,
u32 mask, u32 val)
{
pcie_update_bits(pcie->pci.dbi_base, ofs, mask, val);
}
static void intel_pcie_ltssm_enable(struct intel_pcie *pcie)
{
pcie_app_wr_mask(pcie, PCIE_APP_CCR, PCIE_APP_CCR_LTSSM_ENABLE,
PCIE_APP_CCR_LTSSM_ENABLE);
}
static void intel_pcie_ltssm_disable(struct intel_pcie *pcie)
{
pcie_app_wr_mask(pcie, PCIE_APP_CCR, PCIE_APP_CCR_LTSSM_ENABLE, 0);
}
static void intel_pcie_link_setup(struct intel_pcie *pcie)
{
u32 val;
u8 offset = dw_pcie_find_capability(&pcie->pci, PCI_CAP_ID_EXP);
val = pcie_rc_cfg_rd(pcie, offset + PCI_EXP_LNKCTL);
val &= ~(PCI_EXP_LNKCTL_LD | PCI_EXP_LNKCTL_ASPMC);
pcie_rc_cfg_wr(pcie, offset + PCI_EXP_LNKCTL, val);
}
static void intel_pcie_init_n_fts(struct dw_pcie *pci)
{
switch (pci->max_link_speed) {
case 3:
pci->n_fts[1] = PORT_AFR_N_FTS_GEN3;
break;
case 4:
pci->n_fts[1] = PORT_AFR_N_FTS_GEN4;
break;
default:
pci->n_fts[1] = PORT_AFR_N_FTS_GEN12_DFT;
break;
}
pci->n_fts[0] = PORT_AFR_N_FTS_GEN12_DFT;
}
static int intel_pcie_ep_rst_init(struct intel_pcie *pcie)
{
struct device *dev = pcie->pci.dev;
int ret;
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/gpio/consumer.h`, `linux/iopoll.h`, `linux/mod_devicetable.h`, `linux/pci_regs.h`, `linux/phy/phy.h`, `linux/platform_device.h`.
- Detected declarations: `struct intel_pcie`, `function pcie_update_bits`, `function pcie_app_wr`, `function pcie_app_wr_mask`, `function pcie_rc_cfg_rd`, `function pcie_rc_cfg_wr`, `function pcie_rc_cfg_wr_mask`, `function intel_pcie_ltssm_enable`, `function intel_pcie_ltssm_disable`, `function intel_pcie_link_setup`.
- Atlas domain: Representative Device Path / PCIe NVMe Storage Path.
- 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.