arch/powerpc/kernel/pci_64.c
Source file repositories/reference/linux-study-clean/arch/powerpc/kernel/pci_64.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/kernel/pci_64.c- Extension
.c- Size
- 8130 bytes
- Lines
- 299
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: syscall or user/kernel boundary
- Status
- core 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 participates in a user/kernel boundary; inspect argument validation, copy_from_user/copy_to_user, credentials, and dispatch target.
- 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/kernel.hlinux/pci.hlinux/string.hlinux/init.hlinux/export.hlinux/mm.hlinux/list.hlinux/syscalls.hlinux/irq.hlinux/vmalloc.hlinux/of.hasm/processor.hasm/io.hasm/pci-bridge.hasm/byteorder.hasm/machdep.hasm/ppc-pci.h
Detected Declarations
syscall pciconfig_iobasefunction pcibios_initfunction pcibios_unmap_io_spacefunction pgprot_noncachedfunction pcibios_map_phb_io_spacefunction pcibios_map_io_spacefunction pcibios_setup_phb_io_spacefunction list_for_each_entryfunction pcibus_to_nodefunction pci_device_from_OF_nodeexport pci_io_baseexport pcibios_unmap_io_spaceexport ioremap_phbexport pcibios_map_io_spaceexport pcibus_to_node
Annotated Snippet
SYSCALL_DEFINE3(pciconfig_iobase, long, which, unsigned long, in_bus,
unsigned long, in_devfn)
{
struct pci_controller* hose;
struct pci_bus *tmp_bus, *bus = NULL;
struct device_node *hose_node;
/* Argh ! Please forgive me for that hack, but that's the
* simplest way to get existing XFree to not lockup on some
* G5 machines... So when something asks for bus 0 io base
* (bus 0 is HT root), we return the AGP one instead.
*/
if (in_bus == 0 && of_machine_is_compatible("MacRISC4")) {
struct device_node *agp;
agp = of_find_compatible_node(NULL, NULL, "u3-agp");
if (agp)
in_bus = 0xf0;
of_node_put(agp);
}
/* That syscall isn't quite compatible with PCI domains, but it's
* used on pre-domains setup. We return the first match
*/
list_for_each_entry(tmp_bus, &pci_root_buses, node) {
if (in_bus >= tmp_bus->number &&
in_bus <= tmp_bus->busn_res.end) {
bus = tmp_bus;
break;
}
}
if (bus == NULL || bus->dev.of_node == NULL)
return -ENODEV;
hose_node = bus->dev.of_node;
hose = PCI_DN(hose_node)->phb;
switch (which) {
case IOBASE_BRIDGE_NUMBER:
return (long)hose->first_busno;
case IOBASE_MEMORY:
return (long)hose->mem_offset[0];
case IOBASE_IO:
return (long)hose->io_base_phys;
case IOBASE_ISA_IO:
return (long)isa_io_base;
case IOBASE_ISA_MEM:
return -EINVAL;
}
return -EOPNOTSUPP;
}
#ifdef CONFIG_NUMA
int pcibus_to_node(struct pci_bus *bus)
{
struct pci_controller *phb = pci_bus_to_host(bus);
return phb->node;
}
EXPORT_SYMBOL(pcibus_to_node);
#endif
#ifdef CONFIG_PPC_PMAC
int pci_device_from_OF_node(struct device_node *np, u8 *bus, u8 *devfn)
{
if (!PCI_DN(np))
return -ENODEV;
*bus = PCI_DN(np)->busno;
*devfn = PCI_DN(np)->devfn;
return 0;
}
#endif
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/pci.h`, `linux/string.h`, `linux/init.h`, `linux/export.h`, `linux/mm.h`, `linux/list.h`, `linux/syscalls.h`.
- Detected declarations: `syscall pciconfig_iobase`, `function pcibios_init`, `function pcibios_unmap_io_space`, `function pgprot_noncached`, `function pcibios_map_phb_io_space`, `function pcibios_map_io_space`, `function pcibios_setup_phb_io_space`, `function list_for_each_entry`, `function pcibus_to_node`, `function pci_device_from_OF_node`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: core 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.