arch/powerpc/sysdev/tsi108_pci.c
Source file repositories/reference/linux-study-clean/arch/powerpc/sysdev/tsi108_pci.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/sysdev/tsi108_pci.c- Extension
.c- Size
- 10707 bytes
- Lines
- 427
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/init.hlinux/pci.hlinux/irq.hlinux/irqdomain.hlinux/interrupt.hlinux/of_address.hasm/byteorder.hasm/io.hasm/irq.hlinux/uaccess.hasm/machdep.hasm/pci-bridge.hasm/tsi108.hasm/tsi108_pci.hasm/tsi108_irq.h
Detected Declarations
function tsi108_direct_write_configfunction tsi108_clear_pci_errorfunction __volatile__function tsi108_clear_pci_cfg_errorfunction tsi108_setup_pcifunction tsi108_pci_int_maskfunction tsi108_pci_int_unmaskfunction init_pci_sourcefunction get_pci_sourcefunction tsi108_pci_irq_unmaskfunction tsi108_pci_irq_maskfunction tsi108_pci_irq_ackfunction pci_irq_host_xlatefunction pci_irq_host_mapfunction sourcefunction tsi108_irq_cascade
Annotated Snippet
if ((err_addr & 0xFF000000) == pci_cfg_base) {
pci_stat =
tsi108_read_reg(TSI108_PCI_OFFSET + TSI108_PCI_CSR);
tsi108_write_reg(TSI108_PCI_OFFSET + TSI108_PCI_CSR,
pci_stat);
}
}
return;
}
#define __tsi108_read_pci_config(x, addr, op) \
__asm__ __volatile__( \
" "op" %0,0,%1\n" \
"1: eieio\n" \
"2:\n" \
".section .fixup,\"ax\"\n" \
"3: li %0,-1\n" \
" b 2b\n" \
".previous\n" \
EX_TABLE(1b, 3b) \
: "=r"(x) : "r"(addr))
int
tsi108_direct_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
int len, u32 * val)
{
volatile unsigned char *cfg_addr;
struct pci_controller *hose = pci_bus_to_host(bus);
u32 temp;
if (ppc_md.pci_exclude_device)
if (ppc_md.pci_exclude_device(hose, bus->number, devfn))
return PCIBIOS_DEVICE_NOT_FOUND;
cfg_addr = (unsigned char *)(tsi_mk_config_addr(bus->number,
devfn,
offset) | (offset &
0x03));
switch (len) {
case 1:
__tsi108_read_pci_config(temp, cfg_addr, "lbzx");
break;
case 2:
__tsi108_read_pci_config(temp, cfg_addr, "lhbrx");
break;
default:
__tsi108_read_pci_config(temp, cfg_addr, "lwbrx");
break;
}
*val = temp;
#ifdef DEBUG
if ((0xFFFFFFFF != temp) && (0xFFFF != temp) && (0xFF != temp)) {
printk("PCI CFG read : ");
printk("%d:0x%x:0x%x ", bus->number, devfn, offset);
printk("%d ADDR=0x%08x ", len, (uint) cfg_addr);
printk("data = 0x%x\n", *val);
}
#endif
return PCIBIOS_SUCCESSFUL;
}
void tsi108_clear_pci_cfg_error(void)
{
tsi108_clear_pci_error(tsi108_pci_cfg_phys);
}
static struct pci_ops tsi108_direct_pci_ops = {
.read = tsi108_direct_read_config,
.write = tsi108_direct_write_config,
};
int __init tsi108_setup_pci(struct device_node *dev, u32 cfg_phys, int primary)
{
int len;
struct pci_controller *hose;
struct resource rsrc;
const int *bus_range;
int has_address = 0;
/* PCI Config mapping */
tsi108_pci_cfg_base = (u32)ioremap(cfg_phys, TSI108_PCI_CFG_SIZE);
tsi108_pci_cfg_phys = cfg_phys;
DBG("TSI_PCI: %s tsi108_pci_cfg_base=0x%x\n", __func__,
tsi108_pci_cfg_base);
/* Fetch host bridge registers address */
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/init.h`, `linux/pci.h`, `linux/irq.h`, `linux/irqdomain.h`, `linux/interrupt.h`, `linux/of_address.h`, `asm/byteorder.h`.
- Detected declarations: `function tsi108_direct_write_config`, `function tsi108_clear_pci_error`, `function __volatile__`, `function tsi108_clear_pci_cfg_error`, `function tsi108_setup_pci`, `function tsi108_pci_int_mask`, `function tsi108_pci_int_unmask`, `function init_pci_source`, `function get_pci_source`, `function tsi108_pci_irq_unmask`.
- Atlas domain: Architecture Layer / arch/powerpc.
- 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.