diff options
| author | Michael Ellerman <michael@ellerman.id.au> | 2008-01-29 09:14:02 -0500 |
|---|---|---|
| committer | Paul Mackerras <paulus@samba.org> | 2008-01-30 20:11:11 -0500 |
| commit | c96b51265ad4658eb82fd4379c98b9beb98f99d0 (patch) | |
| tree | 93a65c18abec1f6f2be43a7803c91052d9779849 | |
| parent | 41347917280bcd96619441dae20507711608b4b8 (diff) | |
[POWERPC] Split out the ioid fetching/checking logic
Split out the ioid fetching and checking logic so we can use it elsewhere
in a subsequent patch.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
| -rw-r--r-- | arch/powerpc/platforms/cell/iommu.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c index 950d4327b41e..7316226a5f17 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c | |||
| @@ -443,25 +443,36 @@ static struct iommu_window *find_window(struct cbe_iommu *iommu, | |||
| 443 | } | 443 | } |
| 444 | #endif | 444 | #endif |
| 445 | 445 | ||
| 446 | static inline u32 cell_iommu_get_ioid(struct device_node *np) | ||
| 447 | { | ||
| 448 | const u32 *ioid; | ||
| 449 | |||
| 450 | ioid = of_get_property(np, "ioid", NULL); | ||
| 451 | if (ioid == NULL) { | ||
| 452 | printk(KERN_WARNING "iommu: missing ioid for %s using 0\n", | ||
| 453 | np->full_name); | ||
| 454 | return 0; | ||
| 455 | } | ||
| 456 | |||
| 457 | return *ioid; | ||
| 458 | } | ||
| 459 | |||
| 446 | static struct iommu_window * __init | 460 | static struct iommu_window * __init |
| 447 | cell_iommu_setup_window(struct cbe_iommu *iommu, struct device_node *np, | 461 | cell_iommu_setup_window(struct cbe_iommu *iommu, struct device_node *np, |
| 448 | unsigned long offset, unsigned long size, | 462 | unsigned long offset, unsigned long size, |
| 449 | unsigned long pte_offset) | 463 | unsigned long pte_offset) |
| 450 | { | 464 | { |
| 451 | struct iommu_window *window; | 465 | struct iommu_window *window; |
| 452 | const unsigned int *ioid; | 466 | u32 ioid; |
| 453 | 467 | ||
| 454 | ioid = of_get_property(np, "ioid", NULL); | 468 | ioid = cell_iommu_get_ioid(np); |
| 455 | if (ioid == NULL) | ||
| 456 | printk(KERN_WARNING "iommu: missing ioid for %s using 0\n", | ||
| 457 | np->full_name); | ||
| 458 | 469 | ||
| 459 | window = kmalloc_node(sizeof(*window), GFP_KERNEL, iommu->nid); | 470 | window = kmalloc_node(sizeof(*window), GFP_KERNEL, iommu->nid); |
| 460 | BUG_ON(window == NULL); | 471 | BUG_ON(window == NULL); |
| 461 | 472 | ||
| 462 | window->offset = offset; | 473 | window->offset = offset; |
| 463 | window->size = size; | 474 | window->size = size; |
| 464 | window->ioid = ioid ? *ioid : 0; | 475 | window->ioid = ioid; |
| 465 | window->iommu = iommu; | 476 | window->iommu = iommu; |
| 466 | window->pte_offset = pte_offset; | 477 | window->pte_offset = pte_offset; |
| 467 | 478 | ||
