Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 113036
b: refs/heads/master
c: 046e26a
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller committed Aug 29, 2008
1 parent ef1436b commit 95143ec
Show file tree
Hide file tree
Showing 10 changed files with 109 additions and 287 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5059625ed8862e897760b86effff0f8a35989c0d
refs/heads/master: 046e26a8ba10b8ceff822f8d91451ab6c1e08c4e
2 changes: 0 additions & 2 deletions trunk/arch/sparc/include/asm/io-unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,4 @@ extern __u32 iounit_map_dma_init(struct sbus_bus *, int);
#define iounit_map_dma_finish(sbus, addr, len) mmu_release_scsi_one(addr, len, sbus)
extern __u32 iounit_map_dma_page(__u32, void *, struct sbus_bus *);

extern void iounit_init(struct sbus_bus *sbus);

#endif /* !(_SPARC_IO_UNIT_H) */
2 changes: 0 additions & 2 deletions trunk/arch/sparc/include/asm/iommu_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,4 @@ static inline void iommu_invalidate_page(struct iommu_regs *regs, unsigned long
regs->pageflush = (ba & PAGE_MASK);
}

extern void iommu_init(struct device_node *dp, struct sbus_bus *sbus);

#endif /* !(_SPARC_IOMMU_H) */
1 change: 0 additions & 1 deletion trunk/arch/sparc/include/asm/irq_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ extern unsigned int sun4u_build_msi(u32 portid, unsigned int *virt_irq_p,
unsigned long imap_base,
unsigned long iclr_base);
extern void sun4u_destroy_msi(unsigned int virt_irq);
extern unsigned int sbus_build_irq(void *sbus, unsigned int ino);

extern unsigned char virt_irq_alloc(unsigned int dev_handle,
unsigned int dev_ino);
Expand Down
23 changes: 0 additions & 23 deletions trunk/arch/sparc/kernel/ioport.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,22 +377,6 @@ void sbus_dma_sync_single_for_device(struct device *dev, dma_addr_t ba, size_t s
{
}

/* Support code for sbus_init(). */
void __init sbus_setup_iommu(struct sbus_bus *sbus, struct device_node *dp)
{
#ifndef CONFIG_SUN4
struct device_node *parent = dp->parent;

if (sparc_cpu_model != sun4d &&
parent != NULL &&
!strcmp(parent->name, "iommu"))
iommu_init(parent, sbus);

if (sparc_cpu_model == sun4d)
iounit_init(sbus);
#endif
}

static int __init sparc_register_ioport(void)
{
register_proc_sparc_ioport();
Expand All @@ -402,13 +386,6 @@ static int __init sparc_register_ioport(void)

arch_initcall(sparc_register_ioport);

void __init sbus_arch_postinit(void)
{
if (sparc_cpu_model == sun4d) {
extern void sun4d_init_sbi_irq(void);
sun4d_init_sbi_irq();
}
}
#endif /* CONFIG_SBUS */

#ifdef CONFIG_PCI
Expand Down
30 changes: 20 additions & 10 deletions trunk/arch/sparc/mm/io-unit.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,10 @@
#define IOPERM (IOUPTE_CACHE | IOUPTE_WRITE | IOUPTE_VALID)
#define MKIOPTE(phys) __iopte((((phys)>>4) & IOUPTE_PAGE) | IOPERM)

void __init iounit_init(struct sbus_bus *sbus)
static void __init iounit_iommu_init(struct of_device *op)
{
struct device_node *dp = sbus->ofdev.node;
struct iounit_struct *iounit;
iopte_t *xpt, *xptend;
struct of_device *op;

op = of_find_device_by_node(dp);
if (!op) {
prom_printf("SUN4D: Cannot find SBI of_device.\n");
prom_halt();
}

iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC);
if (!iounit) {
Expand All @@ -66,7 +58,6 @@ void __init iounit_init(struct sbus_bus *sbus)
prom_halt();
}

sbus->ofdev.dev.archdata.iommu = iounit;
op->dev.archdata.iommu = iounit;
iounit->page_table = xpt;
spin_lock_init(&iounit->lock);
Expand All @@ -76,6 +67,25 @@ void __init iounit_init(struct sbus_bus *sbus)
iopte_val(*xpt++) = 0;
}

static int __init iounit_init(void)
{
extern void sun4d_init_sbi_irq(void);
struct device_node *dp;

for_each_node_by_name(dp, "sbi") {
struct of_device *op = of_find_device_by_node(dp);

iounit_iommu_init(op);
of_propagate_archdata(op);
}

sun4d_init_sbi_irq();

return 0;
}

subsys_initcall(iounit_init);

/* One has to hold iounit->lock to call this */
static unsigned long iounit_get_area(struct iounit_struct *iounit, unsigned long vaddr, int size)
{
Expand Down
40 changes: 21 additions & 19 deletions trunk/arch/sparc/mm/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,33 +55,20 @@ static pgprot_t dvma_prot; /* Consistent mapping pte flags */
#define IOPERM (IOPTE_CACHE | IOPTE_WRITE | IOPTE_VALID)
#define MKIOPTE(pfn, perm) (((((pfn)<<8) & IOPTE_PAGE) | (perm)) & ~IOPTE_WAZ)

void __init iommu_init(struct device_node *parent, struct sbus_bus *sbus)
static void __init sbus_iommu_init(struct of_device *op)
{
struct of_device *parent_op, *op;
struct iommu_struct *iommu;
unsigned int impl, vers;
unsigned long *bitmap;
unsigned long tmp;

parent_op = of_find_device_by_node(parent);
if (!parent_op) {
prom_printf("Unable to find IOMMU of_device\n");
prom_halt();
}

op = of_find_device_by_node(sbus->ofdev.node);
if (!op) {
prom_printf("Unable to find SBUS of_device\n");
prom_halt();
}

iommu = kmalloc(sizeof(struct iommu_struct), GFP_ATOMIC);
if (!iommu) {
prom_printf("Unable to allocate iommu structure\n");
prom_halt();
}

iommu->regs = of_ioremap(&parent_op->resource[0], 0, PAGE_SIZE * 3,
iommu->regs = of_ioremap(&op->resource[0], 0, PAGE_SIZE * 3,
"iommu_regs");
if (!iommu->regs) {
prom_printf("Cannot map IOMMU registers\n");
Expand Down Expand Up @@ -132,14 +119,29 @@ void __init iommu_init(struct device_node *parent, struct sbus_bus *sbus)
else
iommu->usemap.num_colors = 1;

printk("IOMMU: impl %d vers %d table 0x%p[%d B] map [%d b]\n",
impl, vers, iommu->page_table,
(int)(IOMMU_NPTES*sizeof(iopte_t)), (int)IOMMU_NPTES);
printk(KERN_INFO "IOMMU: impl %d vers %d table 0x%p[%d B] map [%d b]\n",
impl, vers, iommu->page_table,
(int)(IOMMU_NPTES*sizeof(iopte_t)), (int)IOMMU_NPTES);

sbus->ofdev.dev.archdata.iommu = iommu;
op->dev.archdata.iommu = iommu;
}

static int __init iommu_init(void)
{
struct device_node *dp;

for_each_node_by_name(dp, "iommu") {
struct of_device *op = of_find_device_by_node(dp);

sbus_iommu_init(op);
of_propagate_archdata(op);
}

return 0;
}

subsys_initcall(iommu_init);

/* This begs to be btfixup-ed by srmmu. */
/* Flush the iotlb entries to ram. */
/* This could be better if we didn't have to flush whole pages. */
Expand Down
Loading

0 comments on commit 95143ec

Please sign in to comment.