arch/powerpc/platforms/pseries/ibmebus.c
Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/pseries/ibmebus.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/platforms/pseries/ibmebus.c- Extension
.c- Size
- 11513 bytes
- Lines
- 482
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/init.hlinux/export.hlinux/console.hlinux/kobject.hlinux/dma-map-ops.hlinux/interrupt.hlinux/irqdomain.hlinux/of.hlinux/slab.hlinux/stat.hlinux/sysfs.hlinux/of_platform.hlinux/platform_device.hasm/ibmebus.hasm/machdep.h
Detected Declarations
function ibmebus_free_coherentfunction ibmebus_map_physfunction ibmebus_unmap_physfunction ibmebus_map_sgfunction for_each_sgfunction ibmebus_unmap_sgfunction ibmebus_dma_supportedfunction ibmebus_dma_get_required_maskfunction ibmebus_match_pathfunction ibmebus_match_nodefunction ibmebus_create_devicefunction ibmebus_create_devicesfunction for_each_child_of_nodefunction ibmebus_register_driverfunction ibmebus_unregister_driverfunction ibmebus_request_irqfunction ibmebus_free_irqfunction probe_storefunction remove_storefunction ibmebus_bus_bus_matchfunction ibmebus_bus_device_probefunction ibmebus_bus_device_removefunction ibmebus_bus_device_shutdownfunction devspec_showfunction name_showfunction modalias_showfunction ibmebus_bus_modaliasfunction ibmebus_bus_initexport ibmebus_register_driverexport ibmebus_unregister_driverexport ibmebus_request_irqexport ibmebus_free_irqexport ibmebus_bus_type
Annotated Snippet
const struct bus_type ibmebus_bus_type;
/* These devices will automatically be added to the bus during init */
static const struct of_device_id ibmebus_matches[] __initconst = {
{ .compatible = "IBM,lhca" },
{ .compatible = "IBM,lhea" },
{},
};
static void *ibmebus_alloc_coherent(struct device *dev,
size_t size,
dma_addr_t *dma_handle,
gfp_t flag,
unsigned long attrs)
{
void *mem;
mem = kmalloc(size, flag);
*dma_handle = (dma_addr_t)mem;
return mem;
}
static void ibmebus_free_coherent(struct device *dev,
size_t size, void *vaddr,
dma_addr_t dma_handle,
unsigned long attrs)
{
kfree(vaddr);
}
static dma_addr_t ibmebus_map_phys(struct device *dev, phys_addr_t phys,
size_t size,
enum dma_data_direction direction,
unsigned long attrs)
{
if (attrs & DMA_ATTR_MMIO)
return DMA_MAPPING_ERROR;
return (dma_addr_t)(phys_to_virt(phys));
}
static void ibmebus_unmap_phys(struct device *dev,
dma_addr_t dma_addr,
size_t size,
enum dma_data_direction direction,
unsigned long attrs)
{
return;
}
static int ibmebus_map_sg(struct device *dev,
struct scatterlist *sgl,
int nents, enum dma_data_direction direction,
unsigned long attrs)
{
struct scatterlist *sg;
int i;
for_each_sg(sgl, sg, nents, i) {
sg->dma_address = (dma_addr_t) sg_virt(sg);
sg->dma_length = sg->length;
}
return nents;
}
static void ibmebus_unmap_sg(struct device *dev,
struct scatterlist *sg,
int nents, enum dma_data_direction direction,
unsigned long attrs)
{
return;
}
static int ibmebus_dma_supported(struct device *dev, u64 mask)
{
return mask == DMA_BIT_MASK(64);
}
static u64 ibmebus_dma_get_required_mask(struct device *dev)
{
return DMA_BIT_MASK(64);
}
static const struct dma_map_ops ibmebus_dma_ops = {
.alloc = ibmebus_alloc_coherent,
.free = ibmebus_free_coherent,
.map_sg = ibmebus_map_sg,
.unmap_sg = ibmebus_unmap_sg,
Annotation
- Immediate include surface: `linux/init.h`, `linux/export.h`, `linux/console.h`, `linux/kobject.h`, `linux/dma-map-ops.h`, `linux/interrupt.h`, `linux/irqdomain.h`, `linux/of.h`.
- Detected declarations: `function ibmebus_free_coherent`, `function ibmebus_map_phys`, `function ibmebus_unmap_phys`, `function ibmebus_map_sg`, `function for_each_sg`, `function ibmebus_unmap_sg`, `function ibmebus_dma_supported`, `function ibmebus_dma_get_required_mask`, `function ibmebus_match_path`, `function ibmebus_match_node`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: pattern 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.