drivers/pci/controller/dwc/pcie-histb.c
Source file repositories/reference/linux-study-clean/drivers/pci/controller/dwc/pcie-histb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/controller/dwc/pcie-histb.c- Extension
.c- Size
- 11141 bytes
- Lines
- 452
- 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/clk.hlinux/delay.hlinux/gpio/consumer.hlinux/interrupt.hlinux/kernel.hlinux/module.hlinux/of.hlinux/pci.hlinux/phy/phy.hlinux/platform_device.hlinux/resource.hlinux/reset.hpcie-designware.h
Detected Declarations
struct histb_pciefunction histb_pcie_readlfunction histb_pcie_writelfunction histb_pcie_dbi_w_modefunction histb_pcie_dbi_r_modefunction histb_pcie_read_dbifunction histb_pcie_write_dbifunction histb_pcie_rd_own_conffunction histb_pcie_wr_own_conffunction histb_pcie_link_upfunction histb_pcie_start_linkfunction histb_pcie_host_initfunction histb_pcie_host_disablefunction histb_pcie_host_enablefunction histb_pcie_probefunction histb_pcie_remove
Annotated Snippet
struct histb_pcie {
struct dw_pcie *pci;
struct clk *aux_clk;
struct clk *pipe_clk;
struct clk *sys_clk;
struct clk *bus_clk;
struct phy *phy;
struct reset_control *soft_reset;
struct reset_control *sys_reset;
struct reset_control *bus_reset;
void __iomem *ctrl;
struct gpio_desc *reset_gpio;
struct regulator *vpcie;
};
static u32 histb_pcie_readl(struct histb_pcie *histb_pcie, u32 reg)
{
return readl(histb_pcie->ctrl + reg);
}
static void histb_pcie_writel(struct histb_pcie *histb_pcie, u32 reg, u32 val)
{
writel(val, histb_pcie->ctrl + reg);
}
static void histb_pcie_dbi_w_mode(struct dw_pcie_rp *pp, bool enable)
{
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
struct histb_pcie *hipcie = to_histb_pcie(pci);
u32 val;
val = histb_pcie_readl(hipcie, PCIE_SYS_CTRL0);
if (enable)
val |= PCIE_ELBI_SLV_DBI_ENABLE;
else
val &= ~PCIE_ELBI_SLV_DBI_ENABLE;
histb_pcie_writel(hipcie, PCIE_SYS_CTRL0, val);
}
static void histb_pcie_dbi_r_mode(struct dw_pcie_rp *pp, bool enable)
{
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
struct histb_pcie *hipcie = to_histb_pcie(pci);
u32 val;
val = histb_pcie_readl(hipcie, PCIE_SYS_CTRL1);
if (enable)
val |= PCIE_ELBI_SLV_DBI_ENABLE;
else
val &= ~PCIE_ELBI_SLV_DBI_ENABLE;
histb_pcie_writel(hipcie, PCIE_SYS_CTRL1, val);
}
static u32 histb_pcie_read_dbi(struct dw_pcie *pci, void __iomem *base,
u32 reg, size_t size)
{
u32 val;
histb_pcie_dbi_r_mode(&pci->pp, true);
dw_pcie_read(base + reg, size, &val);
histb_pcie_dbi_r_mode(&pci->pp, false);
return val;
}
static void histb_pcie_write_dbi(struct dw_pcie *pci, void __iomem *base,
u32 reg, size_t size, u32 val)
{
histb_pcie_dbi_w_mode(&pci->pp, true);
dw_pcie_write(base + reg, size, val);
histb_pcie_dbi_w_mode(&pci->pp, false);
}
static int histb_pcie_rd_own_conf(struct pci_bus *bus, unsigned int devfn,
int where, int size, u32 *val)
{
struct dw_pcie *pci = to_dw_pcie_from_pp(bus->sysdata);
if (PCI_SLOT(devfn))
return PCIBIOS_DEVICE_NOT_FOUND;
*val = dw_pcie_read_dbi(pci, where, size);
return PCIBIOS_SUCCESSFUL;
}
static int histb_pcie_wr_own_conf(struct pci_bus *bus, unsigned int devfn,
int where, int size, u32 val)
{
struct dw_pcie *pci = to_dw_pcie_from_pp(bus->sysdata);
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/interrupt.h`, `linux/kernel.h`, `linux/module.h`, `linux/of.h`, `linux/pci.h`.
- Detected declarations: `struct histb_pcie`, `function histb_pcie_readl`, `function histb_pcie_writel`, `function histb_pcie_dbi_w_mode`, `function histb_pcie_dbi_r_mode`, `function histb_pcie_read_dbi`, `function histb_pcie_write_dbi`, `function histb_pcie_rd_own_conf`, `function histb_pcie_wr_own_conf`, `function histb_pcie_link_up`.
- 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.