On Fri, May 7, 2010 at 9:56 AM, Hiroshi DOYU <Hiroshi.DOYU@xxxxxxxxx> wrote: > From: Hiroshi DOYU <Hiroshi.DOYU@xxxxxxxxx> > > Superpage addresses should be aligned on mapping size of 4KB, 64KB, > 1MB and 16MB respectively both for physical and device virtual > addresses. > > Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@xxxxxxxxx> > --- > arch/arm/plat-omap/iovmm.c | 122 +++++++++++++++++++++++++------------------ > 1 files changed, 71 insertions(+), 51 deletions(-) > @@ -127,13 +100,8 @@ static struct sg_table *sgtable_alloc(const size_t bytes, u32 flags) > if (!IS_ALIGNED(bytes, PAGE_SIZE)) > return ERR_PTR(-EINVAL); > > - /* FIXME: IOVMF_DA_FIXED should support 'superpages' */ > - if ((flags & IOVMF_LINEAR) && (flags & IOVMF_DA_ANON)) { > - nr_entries = sgtable_nents(bytes); > - if (!nr_entries) > - return ERR_PTR(-EINVAL); > - } else > - nr_entries = bytes / PAGE_SIZE; > + /* FIXME: Maximam number of entries are always prepared. */ Typo: maximum. > +static void alloc_area_by_size(u32 start, u32 end, u32 unit, > + struct scatterlist **_sg) > +{ > + u32 addr; > + > + if (unit == 0) > + return; > + > + if (start == end) > + return; > + > + addr = ALIGN(start, unit); > + if (addr > end) { > + /* retry with smaller granularity */ > + alloc_area_by_size(start, end, iopgsz_max(unit - 1), _sg); > + return; > + } > + /* lower chuck with smaller granularity */ Typo: chunk (I guess). > + alloc_area_by_size(start, addr, iopgsz_max(unit - 1), _sg); > + > + addr = __alloc_area_by_size(addr, end, unit, _sg); > + if (addr < end) > + /* higher chuck with smaller granularity */ Another typo? -- Felipe Contreras -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html