sparc32: fix sparse warning in iommu.c
Fix following warning: iommu.c:69:21: warning: incorrect type in assignment (different address spaces) iommu_struct.regs is __iomem - fix up all users. Introduce sbus operations for all read/write operations. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
178f0ffa63
commit
f977ea49ae
@@ -99,7 +99,7 @@ struct iommu_regs {
|
|||||||
#define IOPTE_WAZ 0x00000001 /* Write as zeros */
|
#define IOPTE_WAZ 0x00000001 /* Write as zeros */
|
||||||
|
|
||||||
struct iommu_struct {
|
struct iommu_struct {
|
||||||
struct iommu_regs *regs;
|
struct iommu_regs __iomem *regs;
|
||||||
iopte_t *page_table;
|
iopte_t *page_table;
|
||||||
/* For convenience */
|
/* For convenience */
|
||||||
unsigned long start; /* First managed virtual address */
|
unsigned long start; /* First managed virtual address */
|
||||||
@@ -108,14 +108,14 @@ struct iommu_struct {
|
|||||||
struct bit_map usemap;
|
struct bit_map usemap;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void iommu_invalidate(struct iommu_regs *regs)
|
static inline void iommu_invalidate(struct iommu_regs __iomem *regs)
|
||||||
{
|
{
|
||||||
regs->tlbflush = 0;
|
sbus_writel(0, ®s->tlbflush);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void iommu_invalidate_page(struct iommu_regs *regs, unsigned long ba)
|
static inline void iommu_invalidate_page(struct iommu_regs __iomem *regs, unsigned long ba)
|
||||||
{
|
{
|
||||||
regs->pageflush = (ba & PAGE_MASK);
|
sbus_writel(ba & PAGE_MASK, ®s->pageflush);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !(_SPARC_IOMMU_H) */
|
#endif /* !(_SPARC_IOMMU_H) */
|
||||||
|
|||||||
@@ -58,6 +58,8 @@ static void __init sbus_iommu_init(struct platform_device *op)
|
|||||||
struct iommu_struct *iommu;
|
struct iommu_struct *iommu;
|
||||||
unsigned int impl, vers;
|
unsigned int impl, vers;
|
||||||
unsigned long *bitmap;
|
unsigned long *bitmap;
|
||||||
|
unsigned long control;
|
||||||
|
unsigned long base;
|
||||||
unsigned long tmp;
|
unsigned long tmp;
|
||||||
|
|
||||||
iommu = kmalloc(sizeof(struct iommu_struct), GFP_KERNEL);
|
iommu = kmalloc(sizeof(struct iommu_struct), GFP_KERNEL);
|
||||||
@@ -72,12 +74,14 @@ static void __init sbus_iommu_init(struct platform_device *op)
|
|||||||
prom_printf("Cannot map IOMMU registers\n");
|
prom_printf("Cannot map IOMMU registers\n");
|
||||||
prom_halt();
|
prom_halt();
|
||||||
}
|
}
|
||||||
impl = (iommu->regs->control & IOMMU_CTRL_IMPL) >> 28;
|
|
||||||
vers = (iommu->regs->control & IOMMU_CTRL_VERS) >> 24;
|
control = sbus_readl(&iommu->regs->control);
|
||||||
tmp = iommu->regs->control;
|
impl = (control & IOMMU_CTRL_IMPL) >> 28;
|
||||||
tmp &= ~(IOMMU_CTRL_RNGE);
|
vers = (control & IOMMU_CTRL_VERS) >> 24;
|
||||||
tmp |= (IOMMU_RNGE_256MB | IOMMU_CTRL_ENAB);
|
control &= ~(IOMMU_CTRL_RNGE);
|
||||||
iommu->regs->control = tmp;
|
control |= (IOMMU_RNGE_256MB | IOMMU_CTRL_ENAB);
|
||||||
|
sbus_writel(control, &iommu->regs->control);
|
||||||
|
|
||||||
iommu_invalidate(iommu->regs);
|
iommu_invalidate(iommu->regs);
|
||||||
iommu->start = IOMMU_START;
|
iommu->start = IOMMU_START;
|
||||||
iommu->end = 0xffffffff;
|
iommu->end = 0xffffffff;
|
||||||
@@ -99,7 +103,9 @@ static void __init sbus_iommu_init(struct platform_device *op)
|
|||||||
memset(iommu->page_table, 0, IOMMU_NPTES*sizeof(iopte_t));
|
memset(iommu->page_table, 0, IOMMU_NPTES*sizeof(iopte_t));
|
||||||
flush_cache_all();
|
flush_cache_all();
|
||||||
flush_tlb_all();
|
flush_tlb_all();
|
||||||
iommu->regs->base = __pa((unsigned long) iommu->page_table) >> 4;
|
|
||||||
|
base = __pa((unsigned long)iommu->page_table) >> 4;
|
||||||
|
sbus_writel(base, &iommu->regs->base);
|
||||||
iommu_invalidate(iommu->regs);
|
iommu_invalidate(iommu->regs);
|
||||||
|
|
||||||
bitmap = kmalloc(IOMMU_NPTES>>3, GFP_KERNEL);
|
bitmap = kmalloc(IOMMU_NPTES>>3, GFP_KERNEL);
|
||||||
|
|||||||
Reference in New Issue
Block a user