drivers/parisc/sba_iommu.c
Source file repositories/reference/linux-study-clean/drivers/parisc/sba_iommu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/parisc/sba_iommu.c- Extension
.c- Size
- 58980 bytes
- Lines
- 2092
- Domain
- Driver Families
- Bucket
- drivers/parisc
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/types.hlinux/kernel.hlinux/spinlock.hlinux/slab.hlinux/init.hlinux/mm.hlinux/string.hlinux/pci.hlinux/dma-map-ops.hlinux/scatterlist.hlinux/iommu-helper.hlinux/io-64-nonatomic-lo-hi.hasm/byteorder.hasm/io.hasm/dma.hasm/hardware.hlinux/proc_fs.hlinux/seq_file.hlinux/module.hasm/ropes.hasm/page.hasm/pdc.hasm/pdcpat.hasm/parisc-device.hiommu.hiommu-helpers.h
Detected Declarations
struct ibase_data_structfunction Superdomefunction sba_dump_tlbfunction sba_dump_pdir_entryfunction sba_check_pdirfunction sba_dump_sgfunction addressesfunction sba_search_bitmapfunction sba_alloc_rangefunction sba_free_rangefunction addressfunction entryfunction sba_dma_supportedfunction sba_map_singlefunction sba_map_physfunction sba_unmap_physfunction sba_freefunction sba_map_sgfunction sba_unmap_sgfunction pdc_pat_cell_modulefunction sba_alloc_pdirfunction PA8700function setup_ibase_imask_callbackfunction setup_ibase_imaskfunction sba_ioc_find_quicksilverfunction sba_ioc_init_plutofunction sba_ioc_initfunction codefunction sba_hw_initfunction ROPEfunction sba_common_initfunction sba_proc_infofunction sba_proc_bitmap_infofunction chipfunction pci_initfunction sba_get_iommufunction sba_directed_lmmiofunction sba_distributed_lmmioexport sba_list
Annotated Snippet
struct ibase_data_struct {
struct ioc *ioc;
int ioc_num;
};
static int setup_ibase_imask_callback(struct device *dev, void *data)
{
struct parisc_device *lba = to_parisc_device(dev);
struct ibase_data_struct *ibd = data;
int rope_num = (lba->hpa.start >> 13) & 0xf;
if (rope_num >> 3 == ibd->ioc_num)
lba_set_iregs(lba, ibd->ioc->ibase, ibd->ioc->imask);
return 0;
}
/* setup Mercury or Elroy IBASE/IMASK registers. */
static void
setup_ibase_imask(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
{
struct ibase_data_struct ibase_data = {
.ioc = ioc,
.ioc_num = ioc_num,
};
device_for_each_child(&sba->dev, &ibase_data,
setup_ibase_imask_callback);
}
#ifdef SBA_AGP_SUPPORT
static int
sba_ioc_find_quicksilver(struct device *dev, void *data)
{
int *agp_found = data;
struct parisc_device *lba = to_parisc_device(dev);
if (IS_QUICKSILVER(lba))
*agp_found = 1;
return 0;
}
#endif
static void
sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
{
u32 iova_space_mask;
u32 iova_space_size;
int iov_order, tcnfg;
#ifdef SBA_AGP_SUPPORT
int agp_found = 0;
#endif
/*
** Firmware programs the base and size of a "safe IOVA space"
** (one that doesn't overlap memory or LMMIO space) in the
** IBASE and IMASK registers.
*/
ioc->ibase = READ_REG(ioc->ioc_hpa + IOC_IBASE) & ~0x1fffffULL;
iova_space_size = ~(READ_REG(ioc->ioc_hpa + IOC_IMASK) & 0xFFFFFFFFUL) + 1;
if ((ioc->ibase < 0xfed00000UL) && ((ioc->ibase + iova_space_size) > 0xfee00000UL)) {
printk("WARNING: IOV space overlaps local config and interrupt message, truncating\n");
iova_space_size /= 2;
}
/*
** iov_order is always based on a 1GB IOVA space since we want to
** turn on the other half for AGP GART.
*/
iov_order = get_order(iova_space_size >> (IOVP_SHIFT - PAGE_SHIFT));
ioc->pdir_size = (iova_space_size / IOVP_SIZE) * sizeof(u64);
DBG_INIT("%s() hpa 0x%p IOV %dMB (%d bits)\n",
__func__, ioc->ioc_hpa, iova_space_size >> 20,
iov_order + PAGE_SHIFT);
ioc->pdir_base = (void *) __get_free_pages(GFP_KERNEL,
get_order(ioc->pdir_size));
if (!ioc->pdir_base)
panic("Couldn't allocate I/O Page Table\n");
memset(ioc->pdir_base, 0, ioc->pdir_size);
DBG_INIT("%s() pdir %p size %x\n",
__func__, ioc->pdir_base, ioc->pdir_size);
#ifdef SBA_HINT_SUPPORT
ioc->hint_shift_pdir = iov_order + PAGE_SHIFT;
ioc->hint_mask_pdir = ~(0x3 << (iov_order + PAGE_SHIFT));
DBG_INIT(" hint_shift_pdir %x hint_mask_pdir %lx\n",
ioc->hint_shift_pdir, ioc->hint_mask_pdir);
Annotation
- Immediate include surface: `linux/types.h`, `linux/kernel.h`, `linux/spinlock.h`, `linux/slab.h`, `linux/init.h`, `linux/mm.h`, `linux/string.h`, `linux/pci.h`.
- Detected declarations: `struct ibase_data_struct`, `function Superdome`, `function sba_dump_tlb`, `function sba_dump_pdir_entry`, `function sba_check_pdir`, `function sba_dump_sg`, `function addresses`, `function sba_search_bitmap`, `function sba_alloc_range`, `function sba_free_range`.
- Atlas domain: Driver Families / drivers/parisc.
- Implementation status: integration 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.