drivers/pci/controller/pci-ftpci100.c
Source file repositories/reference/linux-study-clean/drivers/pci/controller/pci-ftpci100.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/controller/pci-ftpci100.c- Extension
.c- Size
- 14689 bytes
- Lines
- 551
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/interrupt.hlinux/io.hlinux/kernel.hlinux/of.hlinux/of_irq.hlinux/of_pci.hlinux/pci.hlinux/platform_device.hlinux/slab.hlinux/irqdomain.hlinux/irqchip/chained_irq.hlinux/bitops.hlinux/irq.hlinux/clk.h../pci.h
Detected Declarations
struct faraday_pci_variantstruct faraday_pcifunction faraday_res_to_memcfgfunction faraday_raw_pci_read_configfunction faraday_pci_read_configfunction faraday_raw_pci_write_configfunction faraday_pci_write_configfunction faraday_pci_ack_irqfunction faraday_pci_mask_irqfunction faraday_pci_unmask_irqfunction faraday_pci_irq_handlerfunction faraday_pci_irq_mapfunction faraday_pci_setup_cascaded_irqfunction faraday_pci_parse_map_dma_rangesfunction resource_list_for_each_entryfunction faraday_pci_probe
Annotated Snippet
struct faraday_pci_variant {
bool cascaded_irq;
};
struct faraday_pci {
struct device *dev;
void __iomem *base;
struct irq_domain *irqdomain;
struct pci_bus *bus;
struct clk *bus_clk;
};
static int faraday_res_to_memcfg(resource_size_t mem_base,
resource_size_t mem_size, u32 *val)
{
u32 outval;
switch (mem_size) {
case SZ_1M:
outval = FARADAY_PCI_MEMSIZE_1MB;
break;
case SZ_2M:
outval = FARADAY_PCI_MEMSIZE_2MB;
break;
case SZ_4M:
outval = FARADAY_PCI_MEMSIZE_4MB;
break;
case SZ_8M:
outval = FARADAY_PCI_MEMSIZE_8MB;
break;
case SZ_16M:
outval = FARADAY_PCI_MEMSIZE_16MB;
break;
case SZ_32M:
outval = FARADAY_PCI_MEMSIZE_32MB;
break;
case SZ_64M:
outval = FARADAY_PCI_MEMSIZE_64MB;
break;
case SZ_128M:
outval = FARADAY_PCI_MEMSIZE_128MB;
break;
case SZ_256M:
outval = FARADAY_PCI_MEMSIZE_256MB;
break;
case SZ_512M:
outval = FARADAY_PCI_MEMSIZE_512MB;
break;
case SZ_1G:
outval = FARADAY_PCI_MEMSIZE_1GB;
break;
case SZ_2G:
outval = FARADAY_PCI_MEMSIZE_2GB;
break;
default:
return -EINVAL;
}
outval <<= FARADAY_PCI_MEMSIZE_SHIFT;
/* This is probably not good */
if (mem_base & ~(FARADAY_PCI_MEMBASE_MASK))
pr_warn("truncated PCI memory base\n");
/* Translate to bridge side address space */
outval |= (mem_base & FARADAY_PCI_MEMBASE_MASK);
pr_debug("Translated pci base @%pap, size %pap to config %08x\n",
&mem_base, &mem_size, outval);
*val = outval;
return 0;
}
static int faraday_raw_pci_read_config(struct faraday_pci *p, int bus_number,
unsigned int fn, int config, int size,
u32 *value)
{
writel(PCI_CONF1_ADDRESS(bus_number, PCI_SLOT(fn),
PCI_FUNC(fn), config),
p->base + FTPCI_CONFIG);
*value = readl(p->base + FTPCI_DATA);
if (size == 1)
*value = (*value >> (8 * (config & 3))) & 0xFF;
else if (size == 2)
*value = (*value >> (8 * (config & 3))) & 0xFFFF;
return PCIBIOS_SUCCESSFUL;
}
static int faraday_pci_read_config(struct pci_bus *bus, unsigned int fn,
Annotation
- Immediate include surface: `linux/init.h`, `linux/interrupt.h`, `linux/io.h`, `linux/kernel.h`, `linux/of.h`, `linux/of_irq.h`, `linux/of_pci.h`, `linux/pci.h`.
- Detected declarations: `struct faraday_pci_variant`, `struct faraday_pci`, `function faraday_res_to_memcfg`, `function faraday_raw_pci_read_config`, `function faraday_pci_read_config`, `function faraday_raw_pci_write_config`, `function faraday_pci_write_config`, `function faraday_pci_ack_irq`, `function faraday_pci_mask_irq`, `function faraday_pci_unmask_irq`.
- 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.