diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2009-01-13 14:58:10 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-01-16 00:15:11 -0500 |
commit | 494fd07a88ea561e1bea73516d7e92c4c2d1f223 (patch) | |
tree | d597647b6037ab2c2a31a80c97bd8cc5877c9019 /arch/powerpc | |
parent | c52fe6b620e9c7a52b296ec478bd24b91b4e7634 (diff) |
powerpc/ps3: Use dma_addr_t down through the stack
Push the dma_addr_t type usage all the way down to where the actual
values are manipulated.
Now that u64 is "unsigned long long", this removes warnings like:
arch/powerpc/platforms/ps3/system-bus.c:532: warning: passing argument 4 of 'ps3_dma_map' from incompatible pointer type
arch/powerpc/platforms/ps3/system-bus.c:649: warning: passing argument 4 of 'ps3_dma_map' from incompatible pointer type
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/include/asm/ps3.h | 8 | ||||
-rw-r--r-- | arch/powerpc/platforms/ps3/mm.c | 32 | ||||
-rw-r--r-- | arch/powerpc/platforms/ps3/system-bus.c | 4 |
3 files changed, 23 insertions, 21 deletions
diff --git a/arch/powerpc/include/asm/ps3.h b/arch/powerpc/include/asm/ps3.h index eead5c67197a..67f1812698d2 100644 --- a/arch/powerpc/include/asm/ps3.h +++ b/arch/powerpc/include/asm/ps3.h | |||
@@ -103,10 +103,10 @@ struct ps3_dma_region_ops { | |||
103 | int (*map)(struct ps3_dma_region *, | 103 | int (*map)(struct ps3_dma_region *, |
104 | unsigned long virt_addr, | 104 | unsigned long virt_addr, |
105 | unsigned long len, | 105 | unsigned long len, |
106 | unsigned long *bus_addr, | 106 | dma_addr_t *bus_addr, |
107 | u64 iopte_pp); | 107 | u64 iopte_pp); |
108 | int (*unmap)(struct ps3_dma_region *, | 108 | int (*unmap)(struct ps3_dma_region *, |
109 | unsigned long bus_addr, | 109 | dma_addr_t bus_addr, |
110 | unsigned long len); | 110 | unsigned long len); |
111 | }; | 111 | }; |
112 | /** | 112 | /** |
@@ -124,9 +124,9 @@ int ps3_dma_region_init(struct ps3_system_bus_device *dev, | |||
124 | int ps3_dma_region_create(struct ps3_dma_region *r); | 124 | int ps3_dma_region_create(struct ps3_dma_region *r); |
125 | int ps3_dma_region_free(struct ps3_dma_region *r); | 125 | int ps3_dma_region_free(struct ps3_dma_region *r); |
126 | int ps3_dma_map(struct ps3_dma_region *r, unsigned long virt_addr, | 126 | int ps3_dma_map(struct ps3_dma_region *r, unsigned long virt_addr, |
127 | unsigned long len, unsigned long *bus_addr, | 127 | unsigned long len, dma_addr_t *bus_addr, |
128 | u64 iopte_pp); | 128 | u64 iopte_pp); |
129 | int ps3_dma_unmap(struct ps3_dma_region *r, unsigned long bus_addr, | 129 | int ps3_dma_unmap(struct ps3_dma_region *r, dma_addr_t bus_addr, |
130 | unsigned long len); | 130 | unsigned long len); |
131 | 131 | ||
132 | /* mmio routines */ | 132 | /* mmio routines */ |
diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c index a4d49dd9e8a9..4761e2dcf3e0 100644 --- a/arch/powerpc/platforms/ps3/mm.c +++ b/arch/powerpc/platforms/ps3/mm.c | |||
@@ -777,7 +777,7 @@ static int dma_ioc0_region_free(struct ps3_dma_region *r) | |||
777 | */ | 777 | */ |
778 | 778 | ||
779 | static int dma_sb_map_area(struct ps3_dma_region *r, unsigned long virt_addr, | 779 | static int dma_sb_map_area(struct ps3_dma_region *r, unsigned long virt_addr, |
780 | unsigned long len, unsigned long *bus_addr, | 780 | unsigned long len, dma_addr_t *bus_addr, |
781 | u64 iopte_flag) | 781 | u64 iopte_flag) |
782 | { | 782 | { |
783 | int result; | 783 | int result; |
@@ -800,7 +800,7 @@ static int dma_sb_map_area(struct ps3_dma_region *r, unsigned long virt_addr, | |||
800 | DBG("%s:%d lpar_addr %lxh\n", __func__, __LINE__, | 800 | DBG("%s:%d lpar_addr %lxh\n", __func__, __LINE__, |
801 | lpar_addr); | 801 | lpar_addr); |
802 | DBG("%s:%d len %lxh\n", __func__, __LINE__, len); | 802 | DBG("%s:%d len %lxh\n", __func__, __LINE__, len); |
803 | DBG("%s:%d bus_addr %lxh (%lxh)\n", __func__, __LINE__, | 803 | DBG("%s:%d bus_addr %llxh (%lxh)\n", __func__, __LINE__, |
804 | *bus_addr, len); | 804 | *bus_addr, len); |
805 | } | 805 | } |
806 | 806 | ||
@@ -832,7 +832,7 @@ static int dma_sb_map_area(struct ps3_dma_region *r, unsigned long virt_addr, | |||
832 | } | 832 | } |
833 | 833 | ||
834 | static int dma_ioc0_map_area(struct ps3_dma_region *r, unsigned long virt_addr, | 834 | static int dma_ioc0_map_area(struct ps3_dma_region *r, unsigned long virt_addr, |
835 | unsigned long len, unsigned long *bus_addr, | 835 | unsigned long len, dma_addr_t *bus_addr, |
836 | u64 iopte_flag) | 836 | u64 iopte_flag) |
837 | { | 837 | { |
838 | int result; | 838 | int result; |
@@ -872,7 +872,7 @@ static int dma_ioc0_map_area(struct ps3_dma_region *r, unsigned long virt_addr, | |||
872 | return result; | 872 | return result; |
873 | } | 873 | } |
874 | *bus_addr = c->bus_addr + phys_addr - aligned_phys; | 874 | *bus_addr = c->bus_addr + phys_addr - aligned_phys; |
875 | DBG("%s: va=%#lx pa=%#lx a_pa=%#lx bus=%#lx\n", __func__, | 875 | DBG("%s: va=%#lx pa=%#lx a_pa=%#lx bus=%#llx\n", __func__, |
876 | virt_addr, phys_addr, aligned_phys, *bus_addr); | 876 | virt_addr, phys_addr, aligned_phys, *bus_addr); |
877 | c->usage_count = 1; | 877 | c->usage_count = 1; |
878 | 878 | ||
@@ -889,7 +889,7 @@ static int dma_ioc0_map_area(struct ps3_dma_region *r, unsigned long virt_addr, | |||
889 | * This is the common dma unmap routine. | 889 | * This is the common dma unmap routine. |
890 | */ | 890 | */ |
891 | 891 | ||
892 | static int dma_sb_unmap_area(struct ps3_dma_region *r, unsigned long bus_addr, | 892 | static int dma_sb_unmap_area(struct ps3_dma_region *r, dma_addr_t bus_addr, |
893 | unsigned long len) | 893 | unsigned long len) |
894 | { | 894 | { |
895 | unsigned long flags; | 895 | unsigned long flags; |
@@ -903,7 +903,7 @@ static int dma_sb_unmap_area(struct ps3_dma_region *r, unsigned long bus_addr, | |||
903 | 1 << r->page_size); | 903 | 1 << r->page_size); |
904 | unsigned long aligned_len = _ALIGN_UP(len + bus_addr | 904 | unsigned long aligned_len = _ALIGN_UP(len + bus_addr |
905 | - aligned_bus, 1 << r->page_size); | 905 | - aligned_bus, 1 << r->page_size); |
906 | DBG("%s:%d: not found: bus_addr %lxh\n", | 906 | DBG("%s:%d: not found: bus_addr %llxh\n", |
907 | __func__, __LINE__, bus_addr); | 907 | __func__, __LINE__, bus_addr); |
908 | DBG("%s:%d: not found: len %lxh\n", | 908 | DBG("%s:%d: not found: len %lxh\n", |
909 | __func__, __LINE__, len); | 909 | __func__, __LINE__, len); |
@@ -926,12 +926,12 @@ static int dma_sb_unmap_area(struct ps3_dma_region *r, unsigned long bus_addr, | |||
926 | } | 926 | } |
927 | 927 | ||
928 | static int dma_ioc0_unmap_area(struct ps3_dma_region *r, | 928 | static int dma_ioc0_unmap_area(struct ps3_dma_region *r, |
929 | unsigned long bus_addr, unsigned long len) | 929 | dma_addr_t bus_addr, unsigned long len) |
930 | { | 930 | { |
931 | unsigned long flags; | 931 | unsigned long flags; |
932 | struct dma_chunk *c; | 932 | struct dma_chunk *c; |
933 | 933 | ||
934 | DBG("%s: start a=%#lx l=%#lx\n", __func__, bus_addr, len); | 934 | DBG("%s: start a=%#llx l=%#lx\n", __func__, bus_addr, len); |
935 | spin_lock_irqsave(&r->chunk_list.lock, flags); | 935 | spin_lock_irqsave(&r->chunk_list.lock, flags); |
936 | c = dma_find_chunk(r, bus_addr, len); | 936 | c = dma_find_chunk(r, bus_addr, len); |
937 | 937 | ||
@@ -941,7 +941,7 @@ static int dma_ioc0_unmap_area(struct ps3_dma_region *r, | |||
941 | unsigned long aligned_len = _ALIGN_UP(len + bus_addr | 941 | unsigned long aligned_len = _ALIGN_UP(len + bus_addr |
942 | - aligned_bus, | 942 | - aligned_bus, |
943 | 1 << r->page_size); | 943 | 1 << r->page_size); |
944 | DBG("%s:%d: not found: bus_addr %lxh\n", | 944 | DBG("%s:%d: not found: bus_addr %llxh\n", |
945 | __func__, __LINE__, bus_addr); | 945 | __func__, __LINE__, bus_addr); |
946 | DBG("%s:%d: not found: len %lxh\n", | 946 | DBG("%s:%d: not found: len %lxh\n", |
947 | __func__, __LINE__, len); | 947 | __func__, __LINE__, len); |
@@ -975,7 +975,8 @@ static int dma_ioc0_unmap_area(struct ps3_dma_region *r, | |||
975 | static int dma_sb_region_create_linear(struct ps3_dma_region *r) | 975 | static int dma_sb_region_create_linear(struct ps3_dma_region *r) |
976 | { | 976 | { |
977 | int result; | 977 | int result; |
978 | unsigned long virt_addr, len, tmp; | 978 | unsigned long virt_addr, len; |
979 | dma_addr_t tmp; | ||
979 | 980 | ||
980 | if (r->len > 16*1024*1024) { /* FIXME: need proper fix */ | 981 | if (r->len > 16*1024*1024) { /* FIXME: need proper fix */ |
981 | /* force 16M dma pages for linear mapping */ | 982 | /* force 16M dma pages for linear mapping */ |
@@ -1027,7 +1028,8 @@ static int dma_sb_region_create_linear(struct ps3_dma_region *r) | |||
1027 | static int dma_sb_region_free_linear(struct ps3_dma_region *r) | 1028 | static int dma_sb_region_free_linear(struct ps3_dma_region *r) |
1028 | { | 1029 | { |
1029 | int result; | 1030 | int result; |
1030 | unsigned long bus_addr, len, lpar_addr; | 1031 | dma_addr_t bus_addr; |
1032 | unsigned long len, lpar_addr; | ||
1031 | 1033 | ||
1032 | if (r->offset < map.rm.size) { | 1034 | if (r->offset < map.rm.size) { |
1033 | /* Unmap (part of) 1st RAM chunk */ | 1035 | /* Unmap (part of) 1st RAM chunk */ |
@@ -1072,7 +1074,7 @@ static int dma_sb_region_free_linear(struct ps3_dma_region *r) | |||
1072 | */ | 1074 | */ |
1073 | 1075 | ||
1074 | static int dma_sb_map_area_linear(struct ps3_dma_region *r, | 1076 | static int dma_sb_map_area_linear(struct ps3_dma_region *r, |
1075 | unsigned long virt_addr, unsigned long len, unsigned long *bus_addr, | 1077 | unsigned long virt_addr, unsigned long len, dma_addr_t *bus_addr, |
1076 | u64 iopte_flag) | 1078 | u64 iopte_flag) |
1077 | { | 1079 | { |
1078 | unsigned long phys_addr = is_kernel_addr(virt_addr) ? __pa(virt_addr) | 1080 | unsigned long phys_addr = is_kernel_addr(virt_addr) ? __pa(virt_addr) |
@@ -1091,7 +1093,7 @@ static int dma_sb_map_area_linear(struct ps3_dma_region *r, | |||
1091 | */ | 1093 | */ |
1092 | 1094 | ||
1093 | static int dma_sb_unmap_area_linear(struct ps3_dma_region *r, | 1095 | static int dma_sb_unmap_area_linear(struct ps3_dma_region *r, |
1094 | unsigned long bus_addr, unsigned long len) | 1096 | dma_addr_t bus_addr, unsigned long len) |
1095 | { | 1097 | { |
1096 | return 0; | 1098 | return 0; |
1097 | }; | 1099 | }; |
@@ -1169,13 +1171,13 @@ int ps3_dma_region_free(struct ps3_dma_region *r) | |||
1169 | EXPORT_SYMBOL(ps3_dma_region_free); | 1171 | EXPORT_SYMBOL(ps3_dma_region_free); |
1170 | 1172 | ||
1171 | int ps3_dma_map(struct ps3_dma_region *r, unsigned long virt_addr, | 1173 | int ps3_dma_map(struct ps3_dma_region *r, unsigned long virt_addr, |
1172 | unsigned long len, unsigned long *bus_addr, | 1174 | unsigned long len, dma_addr_t *bus_addr, |
1173 | u64 iopte_flag) | 1175 | u64 iopte_flag) |
1174 | { | 1176 | { |
1175 | return r->region_ops->map(r, virt_addr, len, bus_addr, iopte_flag); | 1177 | return r->region_ops->map(r, virt_addr, len, bus_addr, iopte_flag); |
1176 | } | 1178 | } |
1177 | 1179 | ||
1178 | int ps3_dma_unmap(struct ps3_dma_region *r, unsigned long bus_addr, | 1180 | int ps3_dma_unmap(struct ps3_dma_region *r, dma_addr_t bus_addr, |
1179 | unsigned long len) | 1181 | unsigned long len) |
1180 | { | 1182 | { |
1181 | return r->region_ops->unmap(r, bus_addr, len); | 1183 | return r->region_ops->unmap(r, bus_addr, len); |
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c index ee0d22911621..70ef793e5565 100644 --- a/arch/powerpc/platforms/ps3/system-bus.c +++ b/arch/powerpc/platforms/ps3/system-bus.c | |||
@@ -568,7 +568,7 @@ static dma_addr_t ps3_sb_map_page(struct device *_dev, struct page *page, | |||
568 | { | 568 | { |
569 | struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); | 569 | struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); |
570 | int result; | 570 | int result; |
571 | unsigned long bus_addr; | 571 | dma_addr_t bus_addr; |
572 | void *ptr = page_address(page) + offset; | 572 | void *ptr = page_address(page) + offset; |
573 | 573 | ||
574 | result = ps3_dma_map(dev->d_region, (unsigned long)ptr, size, | 574 | result = ps3_dma_map(dev->d_region, (unsigned long)ptr, size, |
@@ -590,7 +590,7 @@ static dma_addr_t ps3_ioc0_map_page(struct device *_dev, struct page *page, | |||
590 | { | 590 | { |
591 | struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); | 591 | struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); |
592 | int result; | 592 | int result; |
593 | unsigned long bus_addr; | 593 | dma_addr_t bus_addr; |
594 | u64 iopte_flag; | 594 | u64 iopte_flag; |
595 | void *ptr = page_address(page) + offset; | 595 | void *ptr = page_address(page) + offset; |
596 | 596 | ||