drivers/pci/controller/pcie-aspeed.c
Source file repositories/reference/linux-study-clean/drivers/pci/controller/pcie-aspeed.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/controller/pcie-aspeed.c- Extension
.c- Size
- 31828 bytes
- Lines
- 1112
- 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.
- 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/interrupt.hlinux/irq.hlinux/irqdomain.hlinux/irqchip/chained_irq.hlinux/irqchip/irq-msi-lib.hlinux/kernel.hlinux/mfd/syscon.hlinux/module.hlinux/msi.hlinux/mutex.hlinux/of.hlinux/of_address.hlinux/of_pci.hlinux/pci.hlinux/platform_device.hlinux/phy/pcie.hlinux/phy/phy.hlinux/regmap.hlinux/reset.h../pci.h
Detected Declarations
struct aspeed_pcie_portstruct aspeed_pciestruct aspeed_pcie_rc_platformfunction aspeed_pcie_intx_irq_ackfunction aspeed_pcie_intx_irq_maskfunction aspeed_pcie_intx_irq_unmaskfunction aspeed_pcie_intx_mapfunction aspeed_pcie_intr_handlerfunction for_each_set_bitfunction aspeed_pcie_get_bdf_offsetfunction aspeed_ast2600_conffunction aspeed_ast2600_rd_conffunction aspeed_ast2600_child_rd_conffunction aspeed_ast2600_wr_conffunction aspeed_ast2600_child_wr_conffunction aspeed_ast2700_configfunction aspeed_ast2700_child_configfunction aspeed_ast2700_rd_conffunction aspeed_ast2700_child_rd_conffunction aspeed_ast2700_wr_conffunction aspeed_ast2700_child_wr_conffunction aspeed_irq_compose_msi_msgfunction aspeed_irq_msi_domain_allocfunction aspeed_irq_msi_domain_freefunction aspeed_pcie_msi_initfunction aspeed_pcie_msi_freefunction aspeed_pcie_irq_domain_freefunction aspeed_pcie_init_irq_domainfunction aspeed_pcie_port_initfunction aspeed_host_resetfunction aspeed_pcie_map_rangesfunction resource_list_for_each_entryfunction aspeed_ast2600_pcie_map_rangesfunction aspeed_ast2600_setupfunction aspeed_ast2700_pcie_map_rangesfunction aspeed_ast2700_setupfunction aspeed_pcie_reset_releasefunction aspeed_pcie_parse_portfunction aspeed_pcie_parse_dtfunction for_each_available_child_of_node_scopedfunction aspeed_pcie_probe
Annotated Snippet
struct aspeed_pcie_port {
struct list_head list;
struct aspeed_pcie *pcie;
struct clk *clk;
struct phy *phy;
struct reset_control *perst;
u32 slot;
};
/**
* struct aspeed_pcie - PCIe RC information
* @host: pointer to PCIe host bridge
* @dev: pointer to device structure
* @reg: PCIe host register base address
* @ahbc: pointer to AHHC register map
* @cfg: pointer to Aspeed PCIe configuration register map
* @platform: platform specific information
* @ports: list of PCIe ports
* @tx_tag: current TX tag for the port
* @root_bus_nr: bus number of the host bridge
* @h2xrst: pointer to H2X reset control
* @intx_domain: IRQ domain for INTx interrupts
* @msi_domain: IRQ domain for MSI interrupts
* @lock: mutex to protect MSI bitmap variable
* @msi_irq_in_use: bitmap to track used MSI host IRQs
* @clear_msi_twice: AST2700 workaround to clear MSI status twice
*/
struct aspeed_pcie {
struct pci_host_bridge *host;
struct device *dev;
void __iomem *reg;
struct regmap *ahbc;
struct regmap *cfg;
const struct aspeed_pcie_rc_platform *platform;
struct list_head ports;
u8 tx_tag;
u8 root_bus_nr;
struct reset_control *h2xrst;
struct irq_domain *intx_domain;
struct irq_domain *msi_domain;
struct mutex lock;
DECLARE_BITMAP(msi_irq_in_use, MAX_MSI_HOST_IRQS);
bool clear_msi_twice; /* AST2700 workaround */
};
/**
* struct aspeed_pcie_rc_platform - Platform information
* @setup: initialization function
* @pcie_map_ranges: function to map PCIe address ranges
* @reg_intx_en: INTx enable register offset
* @reg_intx_sts: INTx status register offset
* @reg_msi_en: MSI enable register offset
* @reg_msi_sts: MSI enable register offset
* @msi_address: HW fixed MSI address
*/
struct aspeed_pcie_rc_platform {
int (*setup)(struct platform_device *pdev);
void (*pcie_map_ranges)(struct aspeed_pcie *pcie, u64 pci_addr);
int reg_intx_en;
int reg_intx_sts;
int reg_msi_en;
int reg_msi_sts;
u32 msi_address;
};
static void aspeed_pcie_intx_irq_ack(struct irq_data *d)
{
struct aspeed_pcie *pcie = irq_data_get_irq_chip_data(d);
int intx_en = pcie->platform->reg_intx_en;
u32 en;
en = readl(pcie->reg + intx_en);
en |= BIT(d->hwirq);
writel(en, pcie->reg + intx_en);
}
static void aspeed_pcie_intx_irq_mask(struct irq_data *d)
{
struct aspeed_pcie *pcie = irq_data_get_irq_chip_data(d);
int intx_en = pcie->platform->reg_intx_en;
u32 en;
en = readl(pcie->reg + intx_en);
en &= ~BIT(d->hwirq);
writel(en, pcie->reg + intx_en);
}
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/interrupt.h`, `linux/irq.h`, `linux/irqdomain.h`, `linux/irqchip/chained_irq.h`, `linux/irqchip/irq-msi-lib.h`, `linux/kernel.h`.
- Detected declarations: `struct aspeed_pcie_port`, `struct aspeed_pcie`, `struct aspeed_pcie_rc_platform`, `function aspeed_pcie_intx_irq_ack`, `function aspeed_pcie_intx_irq_mask`, `function aspeed_pcie_intx_irq_unmask`, `function aspeed_pcie_intx_map`, `function aspeed_pcie_intr_handler`, `function for_each_set_bit`, `function aspeed_pcie_get_bdf_offset`.
- 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.