diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2008-01-29 09:14:01 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-01-30 20:11:11 -0500 |
commit | 41347917280bcd96619441dae20507711608b4b8 (patch) | |
tree | 61d9f6fbfef4453ec72f7ff04cec4e5c3f0cf40a /arch | |
parent | 86865771ea213d756b03e1f2ff44d3f811672762 (diff) |
[POWERPC] Add support to cell_iommu_setup_page_tables() for multiple windows
Add support to cell_iommu_setup_page_tables() for handling two windows,
the dynamic window and the fixed window. A fixed window size of 0
indicates that there is no fixed window at all.
Currently there are no callers who pass a non-zero fixed window, but the
upcoming fixed IOMMU mapping patch will change that.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/platforms/cell/iommu.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c index a6e6bc1b020f..950d4327b41e 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c | |||
@@ -307,14 +307,19 @@ static int cell_iommu_find_ioc(int nid, unsigned long *base) | |||
307 | } | 307 | } |
308 | 308 | ||
309 | static void cell_iommu_setup_page_tables(struct cbe_iommu *iommu, | 309 | static void cell_iommu_setup_page_tables(struct cbe_iommu *iommu, |
310 | unsigned long base, unsigned long size) | 310 | unsigned long dbase, unsigned long dsize, |
311 | unsigned long fbase, unsigned long fsize) | ||
311 | { | 312 | { |
312 | struct page *page; | 313 | struct page *page; |
313 | int i; | 314 | int i; |
314 | unsigned long reg, segments, pages_per_segment, ptab_size, stab_size, | 315 | unsigned long reg, segments, pages_per_segment, ptab_size, stab_size, |
315 | n_pte_pages; | 316 | n_pte_pages, base; |
316 | 317 | ||
317 | segments = size >> IO_SEGMENT_SHIFT; | 318 | base = dbase; |
319 | if (fsize != 0) | ||
320 | base = min(fbase, dbase); | ||
321 | |||
322 | segments = max(dbase + dsize, fbase + fsize) >> IO_SEGMENT_SHIFT; | ||
318 | pages_per_segment = 1ull << IO_PAGENO_BITS; | 323 | pages_per_segment = 1ull << IO_PAGENO_BITS; |
319 | 324 | ||
320 | pr_debug("%s: iommu[%d]: segments: %lu, pages per segment: %lu\n", | 325 | pr_debug("%s: iommu[%d]: segments: %lu, pages per segment: %lu\n", |
@@ -366,7 +371,7 @@ static void cell_iommu_setup_page_tables(struct cbe_iommu *iommu, | |||
366 | } | 371 | } |
367 | 372 | ||
368 | pr_debug("Setting up IOMMU stab:\n"); | 373 | pr_debug("Setting up IOMMU stab:\n"); |
369 | for (i = 0; i * (1ul << IO_SEGMENT_SHIFT) < size; i++) { | 374 | for (i = base >> IO_SEGMENT_SHIFT; i < segments; i++) { |
370 | iommu->stab[i] = reg | | 375 | iommu->stab[i] = reg | |
371 | (__pa(iommu->ptab) + n_pte_pages * IOMMU_PAGE_SIZE * i); | 376 | (__pa(iommu->ptab) + n_pte_pages * IOMMU_PAGE_SIZE * i); |
372 | pr_debug("\t[%d] 0x%016lx\n", i, iommu->stab[i]); | 377 | pr_debug("\t[%d] 0x%016lx\n", i, iommu->stab[i]); |
@@ -417,7 +422,7 @@ static void cell_iommu_enable_hardware(struct cbe_iommu *iommu) | |||
417 | static void cell_iommu_setup_hardware(struct cbe_iommu *iommu, | 422 | static void cell_iommu_setup_hardware(struct cbe_iommu *iommu, |
418 | unsigned long base, unsigned long size) | 423 | unsigned long base, unsigned long size) |
419 | { | 424 | { |
420 | cell_iommu_setup_page_tables(iommu, base, size); | 425 | cell_iommu_setup_page_tables(iommu, base, size, 0, 0); |
421 | cell_iommu_enable_hardware(iommu); | 426 | cell_iommu_enable_hardware(iommu); |
422 | } | 427 | } |
423 | 428 | ||