diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2008-01-29 09:14:00 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-01-30 20:11:10 -0500 |
commit | 7fc67afc436cf7f74d8cc697012696187332fc35 (patch) | |
tree | 6751c3bc965a11cab95dd140cb70cba6e3988d24 /arch/powerpc | |
parent | 209bfbb4780190754a6383ad052e59ce8b5bedeb (diff) |
[POWERPC] Split cell_iommu_setup_hardware() into two parts
Split cell_iommu_setup_hardware() into two parts. Split the page table
setup into cell_iommu_setup_page_tables() and the bits that kick the
hardware into cell_iommu_enable_hardware().
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/powerpc')
-rw-r--r-- | arch/powerpc/platforms/cell/iommu.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c index 26c1bba848b6..b3655aa88ddb 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c | |||
@@ -306,20 +306,13 @@ static int cell_iommu_find_ioc(int nid, unsigned long *base) | |||
306 | return -ENODEV; | 306 | return -ENODEV; |
307 | } | 307 | } |
308 | 308 | ||
309 | static void cell_iommu_setup_hardware(struct cbe_iommu *iommu, unsigned long size) | 309 | static void cell_iommu_setup_page_tables(struct cbe_iommu *iommu, |
310 | unsigned long base, unsigned long size) | ||
310 | { | 311 | { |
311 | struct page *page; | 312 | struct page *page; |
312 | int ret, i; | 313 | int i; |
313 | unsigned long reg, segments, pages_per_segment, ptab_size, stab_size, | 314 | unsigned long reg, segments, pages_per_segment, ptab_size, stab_size, |
314 | n_pte_pages, xlate_base; | 315 | n_pte_pages; |
315 | unsigned int virq; | ||
316 | |||
317 | if (cell_iommu_find_ioc(iommu->nid, &xlate_base)) | ||
318 | panic("%s: missing IOC register mappings for node %d\n", | ||
319 | __FUNCTION__, iommu->nid); | ||
320 | |||
321 | iommu->xlate_regs = ioremap(xlate_base, IOC_Reg_Size); | ||
322 | iommu->cmd_regs = iommu->xlate_regs + IOC_IOCmd_Offset; | ||
323 | 316 | ||
324 | segments = size >> IO_SEGMENT_SHIFT; | 317 | segments = size >> IO_SEGMENT_SHIFT; |
325 | pages_per_segment = 1ull << IO_PAGENO_BITS; | 318 | pages_per_segment = 1ull << IO_PAGENO_BITS; |
@@ -378,6 +371,20 @@ static void cell_iommu_setup_hardware(struct cbe_iommu *iommu, unsigned long siz | |||
378 | (__pa(iommu->ptab) + n_pte_pages * IOMMU_PAGE_SIZE * i); | 371 | (__pa(iommu->ptab) + n_pte_pages * IOMMU_PAGE_SIZE * i); |
379 | pr_debug("\t[%d] 0x%016lx\n", i, iommu->stab[i]); | 372 | pr_debug("\t[%d] 0x%016lx\n", i, iommu->stab[i]); |
380 | } | 373 | } |
374 | } | ||
375 | |||
376 | static void cell_iommu_enable_hardware(struct cbe_iommu *iommu) | ||
377 | { | ||
378 | int ret; | ||
379 | unsigned long reg, xlate_base; | ||
380 | unsigned int virq; | ||
381 | |||
382 | if (cell_iommu_find_ioc(iommu->nid, &xlate_base)) | ||
383 | panic("%s: missing IOC register mappings for node %d\n", | ||
384 | __FUNCTION__, iommu->nid); | ||
385 | |||
386 | iommu->xlate_regs = ioremap(xlate_base, IOC_Reg_Size); | ||
387 | iommu->cmd_regs = iommu->xlate_regs + IOC_IOCmd_Offset; | ||
381 | 388 | ||
382 | /* ensure that the STEs have updated */ | 389 | /* ensure that the STEs have updated */ |
383 | mb(); | 390 | mb(); |
@@ -407,6 +414,13 @@ static void cell_iommu_setup_hardware(struct cbe_iommu *iommu, unsigned long siz | |||
407 | out_be64(iommu->cmd_regs + IOC_IOCmd_Cfg, reg); | 414 | out_be64(iommu->cmd_regs + IOC_IOCmd_Cfg, reg); |
408 | } | 415 | } |
409 | 416 | ||
417 | static void cell_iommu_setup_hardware(struct cbe_iommu *iommu, | ||
418 | unsigned long base, unsigned long size) | ||
419 | { | ||
420 | cell_iommu_setup_page_tables(iommu, base, size); | ||
421 | cell_iommu_enable_hardware(iommu); | ||
422 | } | ||
423 | |||
410 | #if 0/* Unused for now */ | 424 | #if 0/* Unused for now */ |
411 | static struct iommu_window *find_window(struct cbe_iommu *iommu, | 425 | static struct iommu_window *find_window(struct cbe_iommu *iommu, |
412 | unsigned long offset, unsigned long size) | 426 | unsigned long offset, unsigned long size) |
@@ -622,7 +636,7 @@ static void __init cell_iommu_init_one(struct device_node *np, | |||
622 | base, base + size - 1); | 636 | base, base + size - 1); |
623 | 637 | ||
624 | /* Initialize the hardware */ | 638 | /* Initialize the hardware */ |
625 | cell_iommu_setup_hardware(iommu, size); | 639 | cell_iommu_setup_hardware(iommu, base, size); |
626 | 640 | ||
627 | /* Setup the iommu_table */ | 641 | /* Setup the iommu_table */ |
628 | cell_iommu_setup_window(iommu, np, base, size, | 642 | cell_iommu_setup_window(iommu, np, base, size, |