drivers/pci/controller/dwc/pci-layerscape.c
Source file repositories/reference/linux-study-clean/drivers/pci/controller/dwc/pci-layerscape.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/controller/dwc/pci-layerscape.c- Extension
.c- Size
- 11310 bytes
- Lines
- 430
- 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/delay.hlinux/kernel.hlinux/interrupt.hlinux/init.hlinux/iopoll.hlinux/module.hlinux/of_pci.hlinux/of_platform.hlinux/of_address.hlinux/pci.hlinux/platform_device.hlinux/resource.hlinux/mfd/syscon.hlinux/regmap.h../../pci.hpcie-designware.h
Detected Declarations
struct ls_pcie_drvdatastruct ls_pciefunction ls_pcie_is_bridgefunction ls_pcie_clear_multifunctionfunction ls_pcie_drop_msg_tlpfunction ls_pcie_fix_error_responsefunction ls_pcie_pf_lut_readlfunction ls_pcie_pf_lut_writelfunction ls_pcie_send_turnoff_msgfunction ls_pcie_exit_from_l2function ls_pcie_host_initfunction scfg_pcie_send_turnoff_msgfunction ls1021a_pcie_send_turnoff_msgfunction scfg_pcie_exit_from_l2function ls1021a_pcie_exit_from_l2function ls1043a_pcie_send_turnoff_msgfunction ls1043a_pcie_exit_from_l2function ls_pcie_probefunction ls_pcie_suspend_noirqfunction ls_pcie_resume_noirqfunction ls_pcie_remove
Annotated Snippet
struct ls_pcie_drvdata {
const u32 pf_lut_off;
const struct dw_pcie_host_ops *ops;
int (*exit_from_l2)(struct dw_pcie_rp *pp);
bool scfg_support;
bool pm_support;
};
struct ls_pcie {
struct dw_pcie *pci;
const struct ls_pcie_drvdata *drvdata;
void __iomem *pf_lut_base;
struct regmap *scfg;
int index;
bool big_endian;
};
#define ls_pcie_pf_lut_readl_addr(addr) ls_pcie_pf_lut_readl(pcie, addr)
#define to_ls_pcie(x) dev_get_drvdata((x)->dev)
static bool ls_pcie_is_bridge(struct ls_pcie *pcie)
{
struct dw_pcie *pci = pcie->pci;
u32 header_type;
header_type = ioread8(pci->dbi_base + PCI_HEADER_TYPE);
header_type &= PCI_HEADER_TYPE_MASK;
return header_type == PCI_HEADER_TYPE_BRIDGE;
}
/* Clear multi-function bit */
static void ls_pcie_clear_multifunction(struct ls_pcie *pcie)
{
struct dw_pcie *pci = pcie->pci;
iowrite8(PCI_HEADER_TYPE_BRIDGE, pci->dbi_base + PCI_HEADER_TYPE);
}
/* Drop MSG TLP except for Vendor MSG */
static void ls_pcie_drop_msg_tlp(struct ls_pcie *pcie)
{
u32 val;
struct dw_pcie *pci = pcie->pci;
val = ioread32(pci->dbi_base + PCIE_STRFMR1);
val &= 0xDFFFFFFF;
iowrite32(val, pci->dbi_base + PCIE_STRFMR1);
}
/* Forward error response of outbound non-posted requests */
static void ls_pcie_fix_error_response(struct ls_pcie *pcie)
{
struct dw_pcie *pci = pcie->pci;
iowrite32(PCIE_ABSERR_SETTING, pci->dbi_base + PCIE_ABSERR);
}
static u32 ls_pcie_pf_lut_readl(struct ls_pcie *pcie, u32 off)
{
if (pcie->big_endian)
return ioread32be(pcie->pf_lut_base + off);
return ioread32(pcie->pf_lut_base + off);
}
static void ls_pcie_pf_lut_writel(struct ls_pcie *pcie, u32 off, u32 val)
{
if (pcie->big_endian)
iowrite32be(val, pcie->pf_lut_base + off);
else
iowrite32(val, pcie->pf_lut_base + off);
}
static void ls_pcie_send_turnoff_msg(struct dw_pcie_rp *pp)
{
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
struct ls_pcie *pcie = to_ls_pcie(pci);
u32 val;
int ret;
val = ls_pcie_pf_lut_readl(pcie, LS_PCIE_PF_MCR);
val |= PF_MCR_PTOMR;
ls_pcie_pf_lut_writel(pcie, LS_PCIE_PF_MCR, val);
ret = readx_poll_timeout(ls_pcie_pf_lut_readl_addr, LS_PCIE_PF_MCR,
val, !(val & PF_MCR_PTOMR),
PCIE_PME_TO_L2_TIMEOUT_US/10,
PCIE_PME_TO_L2_TIMEOUT_US);
if (ret)
Annotation
- Immediate include surface: `linux/delay.h`, `linux/kernel.h`, `linux/interrupt.h`, `linux/init.h`, `linux/iopoll.h`, `linux/module.h`, `linux/of_pci.h`, `linux/of_platform.h`.
- Detected declarations: `struct ls_pcie_drvdata`, `struct ls_pcie`, `function ls_pcie_is_bridge`, `function ls_pcie_clear_multifunction`, `function ls_pcie_drop_msg_tlp`, `function ls_pcie_fix_error_response`, `function ls_pcie_pf_lut_readl`, `function ls_pcie_pf_lut_writel`, `function ls_pcie_send_turnoff_msg`, `function ls_pcie_exit_from_l2`.
- 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.