drivers/pci/controller/pcie-brcmstb.c
Source file repositories/reference/linux-study-clean/drivers/pci/controller/pcie-brcmstb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/controller/pcie-brcmstb.c- Extension
.c- Size
- 65391 bytes
- Lines
- 2215
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/bitops.hlinux/clk.hlinux/compiler.hlinux/delay.hlinux/init.hlinux/interrupt.hlinux/io.hlinux/iopoll.hlinux/ioport.hlinux/irqchip/chained_irq.hlinux/irqchip/irq-msi-lib.hlinux/irqdomain.hlinux/kdebug.hlinux/kernel.hlinux/list.hlinux/log2.hlinux/module.hlinux/msi.hlinux/notifier.hlinux/of_address.hlinux/of_irq.hlinux/of_pci.hlinux/of_platform.hlinux/panic_notifier.hlinux/pci.hlinux/pci-ecam.hlinux/printk.hlinux/regulator/consumer.hlinux/reset.hlinux/sizes.hlinux/slab.h
Detected Declarations
struct brcm_pciestruct inbound_winstruct pcie_cfg_datastruct subdev_regulatorsstruct brcm_msistruct brcm_pcieenum pcie_soc_basefunction is_bmipsfunction brcm_pcie_bridge_sw_init_setfunction brcm_pcie_encode_ibar_sizefunction brcm_pcie_mdio_form_pktfunction brcm_pcie_mdio_readfunction brcm_pcie_mdio_writefunction brcm_pcie_set_sscfunction brcm_pcie_set_genfunction brcm_pcie_set_outbound_winfunction brcm_pcie_msi_isrfunction for_each_set_bitfunction brcm_msi_compose_msi_msgfunction brcm_msi_ack_irqfunction brcm_msi_allocfunction brcm_msi_freefunction brcm_irq_domain_allocfunction brcm_irq_domain_freefunction brcm_allocate_domainsfunction brcm_free_domainsfunction brcm_msi_removefunction brcm_msi_set_regsfunction brcm_pcie_enable_msifunction brcm_pcie_rc_modefunction brcm_pcie_link_upfunction brcm_pcie_bridge_sw_init_set_genericfunction brcm_pcie_bridge_sw_init_set_7278function brcm_pcie_perst_set_4908function brcm_pcie_perst_set_7278function brcm_pcie_perst_set_genericfunction brcm_pcie_post_setup_bcm2712function add_inbound_winfunction brcm_pcie_get_inbound_winsfunction resource_list_for_each_entryfunction brcm_bar_reg_offsetfunction brcm_ubus_reg_offsetfunction set_inbound_win_registersfunction brcm_pcie_setupfunction brcm_extend_rbus_timeoutfunction brcm_config_clkreqfunction brcm_pcie_start_linkfunction brcm_pcie_add_bus
Annotated Snippet
struct inbound_win {
u64 size;
u64 pci_offset;
u64 cpu_addr;
};
/*
* The RESCAL block is tied to PCIe controller #1, regardless of the number of
* controllers, and turning off PCIe controller #1 prevents access to the RESCAL
* register blocks, therefore no other controller can access this register
* space, and depending upon the bus fabric we may get a timeout (UBUS/GISB),
* or a hang (AXI).
*/
#define CFG_QUIRK_AVOID_BRIDGE_SHUTDOWN BIT(0)
struct pcie_cfg_data {
const int *offsets;
const enum pcie_soc_base soc_base;
const bool has_phy;
const u32 quirks;
u8 num_inbound_wins;
int (*perst_set)(struct brcm_pcie *pcie, u32 val);
int (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val);
int (*post_setup)(struct brcm_pcie *pcie);
bool has_err_report;
};
struct subdev_regulators {
unsigned int num_supplies;
struct regulator_bulk_data supplies[];
};
struct brcm_msi {
struct device *dev;
void __iomem *base;
struct device_node *np;
struct irq_domain *inner_domain;
struct mutex lock; /* guards the alloc/free operations */
u64 target_addr;
int irq;
DECLARE_BITMAP(used, BRCM_INT_PCI_MSI_NR);
bool legacy;
/* Some chips have MSIs in bits [31..24] of a shared register. */
int legacy_shift;
int nr; /* No. of MSI available, depends on chip */
/* This is the base pointer for interrupt status/set/clr regs */
void __iomem *intr_base;
};
/* Internal PCIe Host Controller Information.*/
struct brcm_pcie {
struct device *dev;
void __iomem *base;
struct clk *clk;
struct device_node *np;
bool ssc;
int gen;
u64 msi_target_addr;
struct brcm_msi *msi;
struct reset_control *rescal;
struct reset_control *perst_reset;
struct reset_control *bridge_reset;
struct reset_control *swinit_reset;
int num_memc;
u64 memc_size[PCIE_BRCM_MAX_MEMC];
u32 hw_rev;
struct subdev_regulators *sr;
bool ep_wakeup_capable;
const struct pcie_cfg_data *cfg;
bool bridge_in_reset;
struct notifier_block die_notifier;
struct notifier_block panic_notifier;
spinlock_t bridge_lock;
};
static inline bool is_bmips(const struct brcm_pcie *pcie)
{
return pcie->cfg->soc_base == BCM7435 || pcie->cfg->soc_base == BCM7425;
}
static int brcm_pcie_bridge_sw_init_set(struct brcm_pcie *pcie, u32 val)
{
unsigned long flags;
int ret;
if (pcie->cfg->has_err_report)
spin_lock_irqsave(&pcie->bridge_lock, flags);
ret = pcie->cfg->bridge_sw_init_set(pcie, val);
/* If we fail, assume the bridge is in reset (off) */
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bitops.h`, `linux/clk.h`, `linux/compiler.h`, `linux/delay.h`, `linux/init.h`, `linux/interrupt.h`, `linux/io.h`.
- Detected declarations: `struct brcm_pcie`, `struct inbound_win`, `struct pcie_cfg_data`, `struct subdev_regulators`, `struct brcm_msi`, `struct brcm_pcie`, `enum pcie_soc_base`, `function is_bmips`, `function brcm_pcie_bridge_sw_init_set`, `function brcm_pcie_encode_ibar_size`.
- Atlas domain: Representative Device Path / PCIe NVMe Storage Path.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.