diff options
author | Guzman Lugo, Fernando <x0095840@ti.com> | 2010-12-14 19:54:03 -0500 |
---|---|---|
committer | Hari Kanigeri <h-kanigeri2@ti.com> | 2010-12-15 12:29:10 -0500 |
commit | c7f4ab26e3bcdaeb3e19ec658e3ad9092f1a6ceb (patch) | |
tree | b80f93995d8e9daa1f53a18c105e8d532102cd21 /arch/arm/plat-omap/iovmm.c | |
parent | 9205a109fbeee180254bb5a4020eb71d50735944 (diff) |
OMAP: iommu: create new api to set valid da range
Some IOMMUs cannot use the whole 0x0 - 0xFFFFFFFF range.
With this new API the valid range can be set.
Signed-off-by: Fernando Guzman Lugo <x0095840@ti.com>
Acked-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Diffstat (limited to 'arch/arm/plat-omap/iovmm.c')
-rw-r--r-- | arch/arm/plat-omap/iovmm.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/arch/arm/plat-omap/iovmm.c b/arch/arm/plat-omap/iovmm.c index fa6e64332a9e..6dc1296c8c77 100644 --- a/arch/arm/plat-omap/iovmm.c +++ b/arch/arm/plat-omap/iovmm.c | |||
@@ -280,13 +280,14 @@ static struct iovm_struct *alloc_iovm_area(struct iommu *obj, u32 da, | |||
280 | alignement = PAGE_SIZE; | 280 | alignement = PAGE_SIZE; |
281 | 281 | ||
282 | if (flags & IOVMF_DA_ANON) { | 282 | if (flags & IOVMF_DA_ANON) { |
283 | /* | 283 | start = obj->da_start; |
284 | * Reserve the first page for NULL | 284 | |
285 | */ | ||
286 | start = PAGE_SIZE; | ||
287 | if (flags & IOVMF_LINEAR) | 285 | if (flags & IOVMF_LINEAR) |
288 | alignement = iopgsz_max(bytes); | 286 | alignement = iopgsz_max(bytes); |
289 | start = roundup(start, alignement); | 287 | start = roundup(start, alignement); |
288 | } else if (start < obj->da_start || start > obj->da_end || | ||
289 | obj->da_end - start < bytes) { | ||
290 | return ERR_PTR(-EINVAL); | ||
290 | } | 291 | } |
291 | 292 | ||
292 | tmp = NULL; | 293 | tmp = NULL; |
@@ -299,16 +300,16 @@ static struct iovm_struct *alloc_iovm_area(struct iommu *obj, u32 da, | |||
299 | if (prev_end > start) | 300 | if (prev_end > start) |
300 | break; | 301 | break; |
301 | 302 | ||
302 | if (start + bytes <= tmp->da_start) | 303 | if (tmp->da_start > start && (tmp->da_start - start) >= bytes) |
303 | goto found; | 304 | goto found; |
304 | 305 | ||
305 | if (flags & IOVMF_DA_ANON) | 306 | if (tmp->da_end >= start && flags & IOVMF_DA_ANON) |
306 | start = roundup(tmp->da_end + 1, alignement); | 307 | start = roundup(tmp->da_end + 1, alignement); |
307 | 308 | ||
308 | prev_end = tmp->da_end; | 309 | prev_end = tmp->da_end; |
309 | } | 310 | } |
310 | 311 | ||
311 | if ((start >= prev_end) && (ULONG_MAX - start + 1 >= bytes)) | 312 | if ((start >= prev_end) && (obj->da_end - start >= bytes)) |
312 | goto found; | 313 | goto found; |
313 | 314 | ||
314 | dev_dbg(obj->dev, "%s: no space to fit %08x(%x) flags: %08x\n", | 315 | dev_dbg(obj->dev, "%s: no space to fit %08x(%x) flags: %08x\n", |