Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 271561
b: refs/heads/master
c: 6c32df4
h: refs/heads/master
i:
  271559: 83243b1
v: v3
  • Loading branch information
Ohad Ben-Cohen authored and Joerg Roedel committed Aug 26, 2011
1 parent 55fda94 commit 433a888
Show file tree
Hide file tree
Showing 14 changed files with 209 additions and 190 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: 384fa675795ae3796dbc263e5d0f35b9a27d6462
refs/heads/master: 6c32df437c7c5b1fc29d3ca29b0ff44f8dfafc56
31 changes: 17 additions & 14 deletions trunk/arch/arm/mach-omap2/iommu2.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
((pgsz) == MMU_CAM_PGSZ_4K) ? 0xfffff000 : 0)


static void __iommu_set_twl(struct iommu *obj, bool on)
static void __iommu_set_twl(struct omap_iommu *obj, bool on)
{
u32 l = iommu_read_reg(obj, MMU_CNTL);

Expand All @@ -85,7 +85,7 @@ static void __iommu_set_twl(struct iommu *obj, bool on)
}


static int omap2_iommu_enable(struct iommu *obj)
static int omap2_iommu_enable(struct omap_iommu *obj)
{
u32 l, pa;
unsigned long timeout;
Expand Down Expand Up @@ -127,7 +127,7 @@ static int omap2_iommu_enable(struct iommu *obj)
return 0;
}

static void omap2_iommu_disable(struct iommu *obj)
static void omap2_iommu_disable(struct omap_iommu *obj)
{
u32 l = iommu_read_reg(obj, MMU_CNTL);

Expand All @@ -138,12 +138,12 @@ static void omap2_iommu_disable(struct iommu *obj)
dev_dbg(obj->dev, "%s is shutting down\n", obj->name);
}

static void omap2_iommu_set_twl(struct iommu *obj, bool on)
static void omap2_iommu_set_twl(struct omap_iommu *obj, bool on)
{
__iommu_set_twl(obj, false);
}

static u32 omap2_iommu_fault_isr(struct iommu *obj, u32 *ra)
static u32 omap2_iommu_fault_isr(struct omap_iommu *obj, u32 *ra)
{
u32 stat, da;
u32 errs = 0;
Expand Down Expand Up @@ -173,13 +173,13 @@ static u32 omap2_iommu_fault_isr(struct iommu *obj, u32 *ra)
return errs;
}

static void omap2_tlb_read_cr(struct iommu *obj, struct cr_regs *cr)
static void omap2_tlb_read_cr(struct omap_iommu *obj, struct cr_regs *cr)
{
cr->cam = iommu_read_reg(obj, MMU_READ_CAM);
cr->ram = iommu_read_reg(obj, MMU_READ_RAM);
}

static void omap2_tlb_load_cr(struct iommu *obj, struct cr_regs *cr)
static void omap2_tlb_load_cr(struct omap_iommu *obj, struct cr_regs *cr)
{
iommu_write_reg(obj, cr->cam | MMU_CAM_V, MMU_CAM);
iommu_write_reg(obj, cr->ram, MMU_RAM);
Expand All @@ -193,7 +193,8 @@ static u32 omap2_cr_to_virt(struct cr_regs *cr)
return cr->cam & mask;
}

static struct cr_regs *omap2_alloc_cr(struct iommu *obj, struct iotlb_entry *e)
static struct cr_regs *omap2_alloc_cr(struct omap_iommu *obj,
struct iotlb_entry *e)
{
struct cr_regs *cr;

Expand Down Expand Up @@ -230,7 +231,8 @@ static u32 omap2_get_pte_attr(struct iotlb_entry *e)
return attr;
}

static ssize_t omap2_dump_cr(struct iommu *obj, struct cr_regs *cr, char *buf)
static ssize_t
omap2_dump_cr(struct omap_iommu *obj, struct cr_regs *cr, char *buf)
{
char *p = buf;

Expand All @@ -254,7 +256,8 @@ static ssize_t omap2_dump_cr(struct iommu *obj, struct cr_regs *cr, char *buf)
goto out; \
} while (0)

static ssize_t omap2_iommu_dump_ctx(struct iommu *obj, char *buf, ssize_t len)
static ssize_t
omap2_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len)
{
char *p = buf;

Expand All @@ -280,7 +283,7 @@ static ssize_t omap2_iommu_dump_ctx(struct iommu *obj, char *buf, ssize_t len)
return p - buf;
}

static void omap2_iommu_save_ctx(struct iommu *obj)
static void omap2_iommu_save_ctx(struct omap_iommu *obj)
{
int i;
u32 *p = obj->ctx;
Expand All @@ -293,7 +296,7 @@ static void omap2_iommu_save_ctx(struct iommu *obj)
BUG_ON(p[0] != IOMMU_ARCH_VERSION);
}

static void omap2_iommu_restore_ctx(struct iommu *obj)
static void omap2_iommu_restore_ctx(struct omap_iommu *obj)
{
int i;
u32 *p = obj->ctx;
Expand Down Expand Up @@ -343,13 +346,13 @@ static const struct iommu_functions omap2_iommu_ops = {

static int __init omap2_iommu_init(void)
{
return install_iommu_arch(&omap2_iommu_ops);
return omap_install_iommu_arch(&omap2_iommu_ops);
}
module_init(omap2_iommu_init);

static void __exit omap2_iommu_exit(void)
{
uninstall_iommu_arch(&omap2_iommu_ops);
omap_uninstall_iommu_arch(&omap2_iommu_ops);
}
module_exit(omap2_iommu_exit);

Expand Down
55 changes: 30 additions & 25 deletions trunk/arch/arm/plat-omap/include/plat/iommu.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct iotlb_entry {
};
};

struct iommu {
struct omap_iommu {
const char *name;
struct module *owner;
struct clk *clk;
Expand All @@ -48,7 +48,7 @@ struct iommu {
struct list_head mmap;
struct mutex mmap_lock; /* protect mmap */

int (*isr)(struct iommu *obj, u32 da, u32 iommu_errs, void *priv);
int (*isr)(struct omap_iommu *obj, u32 da, u32 iommu_errs, void *priv);

void *ctx; /* iommu context: registres saved area */
u32 da_start;
Expand Down Expand Up @@ -81,25 +81,27 @@ struct iotlb_lock {
struct iommu_functions {
unsigned long version;

int (*enable)(struct iommu *obj);
void (*disable)(struct iommu *obj);
void (*set_twl)(struct iommu *obj, bool on);
u32 (*fault_isr)(struct iommu *obj, u32 *ra);
int (*enable)(struct omap_iommu *obj);
void (*disable)(struct omap_iommu *obj);
void (*set_twl)(struct omap_iommu *obj, bool on);
u32 (*fault_isr)(struct omap_iommu *obj, u32 *ra);

void (*tlb_read_cr)(struct iommu *obj, struct cr_regs *cr);
void (*tlb_load_cr)(struct iommu *obj, struct cr_regs *cr);
void (*tlb_read_cr)(struct omap_iommu *obj, struct cr_regs *cr);
void (*tlb_load_cr)(struct omap_iommu *obj, struct cr_regs *cr);

struct cr_regs *(*alloc_cr)(struct iommu *obj, struct iotlb_entry *e);
struct cr_regs *(*alloc_cr)(struct omap_iommu *obj,
struct iotlb_entry *e);
int (*cr_valid)(struct cr_regs *cr);
u32 (*cr_to_virt)(struct cr_regs *cr);
void (*cr_to_e)(struct cr_regs *cr, struct iotlb_entry *e);
ssize_t (*dump_cr)(struct iommu *obj, struct cr_regs *cr, char *buf);
ssize_t (*dump_cr)(struct omap_iommu *obj, struct cr_regs *cr,
char *buf);

u32 (*get_pte_attr)(struct iotlb_entry *e);

void (*save_ctx)(struct iommu *obj);
void (*restore_ctx)(struct iommu *obj);
ssize_t (*dump_ctx)(struct iommu *obj, char *buf, ssize_t len);
void (*save_ctx)(struct omap_iommu *obj);
void (*restore_ctx)(struct omap_iommu *obj);
ssize_t (*dump_ctx)(struct omap_iommu *obj, char *buf, ssize_t len);
};

struct iommu_platform_data {
Expand Down Expand Up @@ -150,28 +152,31 @@ struct iommu_platform_data {
/*
* global functions
*/
extern u32 iommu_arch_version(void);
extern u32 omap_iommu_arch_version(void);

extern void iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e);
extern void omap_iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e);

extern int iopgtable_store_entry(struct iommu *obj, struct iotlb_entry *e);
extern int
omap_iopgtable_store_entry(struct omap_iommu *obj, struct iotlb_entry *e);

extern int iommu_set_isr(const char *name,
int (*isr)(struct iommu *obj, u32 da, u32 iommu_errs,
extern int omap_iommu_set_isr(const char *name,
int (*isr)(struct omap_iommu *obj, u32 da, u32 iommu_errs,
void *priv),
void *isr_priv);

extern void iommu_save_ctx(struct iommu *obj);
extern void iommu_restore_ctx(struct iommu *obj);
extern void omap_iommu_save_ctx(struct omap_iommu *obj);
extern void omap_iommu_restore_ctx(struct omap_iommu *obj);

extern int install_iommu_arch(const struct iommu_functions *ops);
extern void uninstall_iommu_arch(const struct iommu_functions *ops);
extern int omap_install_iommu_arch(const struct iommu_functions *ops);
extern void omap_uninstall_iommu_arch(const struct iommu_functions *ops);

extern int foreach_iommu_device(void *data,
extern int omap_foreach_iommu_device(void *data,
int (*fn)(struct device *, void *));

extern ssize_t iommu_dump_ctx(struct iommu *obj, char *buf, ssize_t len);
extern size_t dump_tlb_entries(struct iommu *obj, char *buf, ssize_t len);
extern ssize_t
omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len);
extern size_t
omap_dump_tlb_entries(struct omap_iommu *obj, char *buf, ssize_t len);
struct device *omap_find_iommu_device(const char *name);

#endif /* __MACH_IOMMU_H */
4 changes: 2 additions & 2 deletions trunk/arch/arm/plat-omap/include/plat/iommu2.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@
/*
* register accessors
*/
static inline u32 iommu_read_reg(struct iommu *obj, size_t offs)
static inline u32 iommu_read_reg(struct omap_iommu *obj, size_t offs)
{
return __raw_readl(obj->regbase + offs);
}

static inline void iommu_write_reg(struct iommu *obj, u32 val, size_t offs)
static inline void iommu_write_reg(struct omap_iommu *obj, u32 val, size_t offs)
{
__raw_writel(val, obj->regbase + offs);
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/arm/plat-omap/include/plat/iopgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,6 @@ static inline u32 iotlb_init_entry(struct iotlb_entry *e, u32 da, u32 pa,
}

#define to_iommu(dev) \
(struct iommu *)platform_get_drvdata(to_platform_device(dev))
(struct omap_iommu *)platform_get_drvdata(to_platform_device(dev))

#endif /* __PLAT_OMAP_IOMMU_H */
19 changes: 11 additions & 8 deletions trunk/arch/arm/plat-omap/include/plat/iovmm.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <linux/iommu.h>

struct iovm_struct {
struct iommu *iommu; /* iommu object which this belongs to */
struct omap_iommu *iommu; /* iommu object which this belongs to */
u32 da_start; /* area definition */
u32 da_end;
u32 flags; /* IOVMF_: see below */
Expand Down Expand Up @@ -72,15 +72,18 @@ struct iovm_struct {
#define IOVMF_DA_FIXED (1 << (4 + IOVMF_SW_SHIFT))


extern struct iovm_struct *find_iovm_area(struct iommu *obj, u32 da);
extern u32 iommu_vmap(struct iommu_domain *domain, struct iommu *obj, u32 da,
extern struct iovm_struct *omap_find_iovm_area(struct omap_iommu *obj, u32 da);
extern u32
omap_iommu_vmap(struct iommu_domain *domain, struct omap_iommu *obj, u32 da,
const struct sg_table *sgt, u32 flags);
extern struct sg_table *iommu_vunmap(struct iommu_domain *domain,
struct iommu *obj, u32 da);
extern u32 iommu_vmalloc(struct iommu_domain *domain, struct iommu *obj,
extern struct sg_table *omap_iommu_vunmap(struct iommu_domain *domain,
struct omap_iommu *obj, u32 da);
extern u32
omap_iommu_vmalloc(struct iommu_domain *domain, struct omap_iommu *obj,
u32 da, size_t bytes, u32 flags);
extern void iommu_vfree(struct iommu_domain *domain, struct iommu *obj,
extern void
omap_iommu_vfree(struct iommu_domain *domain, struct omap_iommu *obj,
const u32 da);
extern void *da_to_va(struct iommu *obj, u32 da);
extern void *omap_da_to_va(struct omap_iommu *obj, u32 da);

#endif /* __IOMMU_MMAP_H */
Loading

0 comments on commit 433a888

Please sign in to comment.