aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2008-06-30 20:22:50 -0400
committerJeremy Kerr <jk@ozlabs.org>2008-07-08 20:13:40 -0400
commit87ff6090bfe416c71730654ab53cd4ecffdd675e (patch)
tree18cc3755ae0b2552bf13c2ada7fc9e04c98a7a4c /arch/powerpc/platforms
parent2442a8ba5abe2c27c572bc522da1c33df98c6ec7 (diff)
powerpc/spufs: avoid magic numbers for mapping sizes
Use a set of #defines for the size of context mappings, instead of magic numbers. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/cell/spufs/context.c12
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c24
-rw-r--r--arch/powerpc/platforms/cell/spufs/spufs.h7
3 files changed, 25 insertions, 18 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/context.c b/arch/powerpc/platforms/cell/spufs/context.c
index 177735f7931..6653ddbed04 100644
--- a/arch/powerpc/platforms/cell/spufs/context.c
+++ b/arch/powerpc/platforms/cell/spufs/context.c
@@ -130,17 +130,17 @@ void spu_unmap_mappings(struct spu_context *ctx)
130 if (ctx->local_store) 130 if (ctx->local_store)
131 unmap_mapping_range(ctx->local_store, 0, LS_SIZE, 1); 131 unmap_mapping_range(ctx->local_store, 0, LS_SIZE, 1);
132 if (ctx->mfc) 132 if (ctx->mfc)
133 unmap_mapping_range(ctx->mfc, 0, 0x1000, 1); 133 unmap_mapping_range(ctx->mfc, 0, SPUFS_MFC_MAP_SIZE, 1);
134 if (ctx->cntl) 134 if (ctx->cntl)
135 unmap_mapping_range(ctx->cntl, 0, 0x1000, 1); 135 unmap_mapping_range(ctx->cntl, 0, SPUFS_CNTL_MAP_SIZE, 1);
136 if (ctx->signal1) 136 if (ctx->signal1)
137 unmap_mapping_range(ctx->signal1, 0, PAGE_SIZE, 1); 137 unmap_mapping_range(ctx->signal1, 0, SPUFS_SIGNAL_MAP_SIZE, 1);
138 if (ctx->signal2) 138 if (ctx->signal2)
139 unmap_mapping_range(ctx->signal2, 0, PAGE_SIZE, 1); 139 unmap_mapping_range(ctx->signal2, 0, SPUFS_SIGNAL_MAP_SIZE, 1);
140 if (ctx->mss) 140 if (ctx->mss)
141 unmap_mapping_range(ctx->mss, 0, 0x1000, 1); 141 unmap_mapping_range(ctx->mss, 0, SPUFS_MSS_MAP_SIZE, 1);
142 if (ctx->psmap) 142 if (ctx->psmap)
143 unmap_mapping_range(ctx->psmap, 0, 0x20000, 1); 143 unmap_mapping_range(ctx->psmap, 0, SPUFS_PS_MAP_SIZE, 1);
144 mutex_unlock(&ctx->mapping_lock); 144 mutex_unlock(&ctx->mapping_lock);
145} 145}
146 146
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index fc595d0db21..d0a497d9140 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -410,7 +410,7 @@ refault:
410static int spufs_cntl_mmap_fault(struct vm_area_struct *vma, 410static int spufs_cntl_mmap_fault(struct vm_area_struct *vma,
411 struct vm_fault *vmf) 411 struct vm_fault *vmf)
412{ 412{
413 return spufs_ps_fault(vma, vmf, 0x4000, 0x1000); 413 return spufs_ps_fault(vma, vmf, 0x4000, SPUFS_CNTL_MAP_SIZE);
414} 414}
415 415
416static struct vm_operations_struct spufs_cntl_mmap_vmops = { 416static struct vm_operations_struct spufs_cntl_mmap_vmops = {
@@ -1102,13 +1102,13 @@ static ssize_t spufs_signal1_write(struct file *file, const char __user *buf,
1102static int 1102static int
1103spufs_signal1_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf) 1103spufs_signal1_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
1104{ 1104{
1105#if PAGE_SIZE == 0x1000 1105#if SPUFS_SIGNAL_MAP_SIZE == 0x1000
1106 return spufs_ps_fault(vma, vmf, 0x14000, 0x1000); 1106 return spufs_ps_fault(vma, vmf, 0x14000, SPUFS_SIGNAL_MAP_SIZE);
1107#elif PAGE_SIZE == 0x10000 1107#elif SPUFS_SIGNAL_MAP_SIZE == 0x10000
1108 /* For 64k pages, both signal1 and signal2 can be used to mmap the whole 1108 /* For 64k pages, both signal1 and signal2 can be used to mmap the whole
1109 * signal 1 and 2 area 1109 * signal 1 and 2 area
1110 */ 1110 */
1111 return spufs_ps_fault(vma, vmf, 0x10000, 0x10000); 1111 return spufs_ps_fault(vma, vmf, 0x10000, SPUFS_SIGNAL_MAP_SIZE);
1112#else 1112#else
1113#error unsupported page size 1113#error unsupported page size
1114#endif 1114#endif
@@ -1239,13 +1239,13 @@ static ssize_t spufs_signal2_write(struct file *file, const char __user *buf,
1239static int 1239static int
1240spufs_signal2_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf) 1240spufs_signal2_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
1241{ 1241{
1242#if PAGE_SIZE == 0x1000 1242#if SPUFS_SIGNAL_MAP_SIZE == 0x1000
1243 return spufs_ps_fault(vma, vmf, 0x1c000, 0x1000); 1243 return spufs_ps_fault(vma, vmf, 0x1c000, SPUFS_SIGNAL_MAP_SIZE);
1244#elif PAGE_SIZE == 0x10000 1244#elif SPUFS_SIGNAL_MAP_SIZE == 0x10000
1245 /* For 64k pages, both signal1 and signal2 can be used to mmap the whole 1245 /* For 64k pages, both signal1 and signal2 can be used to mmap the whole
1246 * signal 1 and 2 area 1246 * signal 1 and 2 area
1247 */ 1247 */
1248 return spufs_ps_fault(vma, vmf, 0x10000, 0x10000); 1248 return spufs_ps_fault(vma, vmf, 0x10000, SPUFS_SIGNAL_MAP_SIZE);
1249#else 1249#else
1250#error unsupported page size 1250#error unsupported page size
1251#endif 1251#endif
@@ -1367,7 +1367,7 @@ DEFINE_SPUFS_ATTRIBUTE(spufs_signal2_type, spufs_signal2_type_get,
1367static int 1367static int
1368spufs_mss_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf) 1368spufs_mss_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
1369{ 1369{
1370 return spufs_ps_fault(vma, vmf, 0x0000, 0x1000); 1370 return spufs_ps_fault(vma, vmf, 0x0000, SPUFS_MSS_MAP_SIZE);
1371} 1371}
1372 1372
1373static struct vm_operations_struct spufs_mss_mmap_vmops = { 1373static struct vm_operations_struct spufs_mss_mmap_vmops = {
@@ -1429,7 +1429,7 @@ static const struct file_operations spufs_mss_fops = {
1429static int 1429static int
1430spufs_psmap_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf) 1430spufs_psmap_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
1431{ 1431{
1432 return spufs_ps_fault(vma, vmf, 0x0000, 0x20000); 1432 return spufs_ps_fault(vma, vmf, 0x0000, SPUFS_PS_MAP_SIZE);
1433} 1433}
1434 1434
1435static struct vm_operations_struct spufs_psmap_mmap_vmops = { 1435static struct vm_operations_struct spufs_psmap_mmap_vmops = {
@@ -1489,7 +1489,7 @@ static const struct file_operations spufs_psmap_fops = {
1489static int 1489static int
1490spufs_mfc_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf) 1490spufs_mfc_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
1491{ 1491{
1492 return spufs_ps_fault(vma, vmf, 0x3000, 0x1000); 1492 return spufs_ps_fault(vma, vmf, 0x3000, SPUFS_MFC_MAP_SIZE);
1493} 1493}
1494 1494
1495static struct vm_operations_struct spufs_mfc_mmap_vmops = { 1495static struct vm_operations_struct spufs_mfc_mmap_vmops = {
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h
index 454c277c145..433dece5c82 100644
--- a/arch/powerpc/platforms/cell/spufs/spufs.h
+++ b/arch/powerpc/platforms/cell/spufs/spufs.h
@@ -32,6 +32,13 @@
32#include <asm/spu_csa.h> 32#include <asm/spu_csa.h>
33#include <asm/spu_info.h> 33#include <asm/spu_info.h>
34 34
35#define SPUFS_PS_MAP_SIZE 0x20000
36#define SPUFS_MFC_MAP_SIZE 0x1000
37#define SPUFS_CNTL_MAP_SIZE 0x1000
38#define SPUFS_CNTL_MAP_SIZE 0x1000
39#define SPUFS_SIGNAL_MAP_SIZE PAGE_SIZE
40#define SPUFS_MSS_MAP_SIZE 0x1000
41
35/* The magic number for our file system */ 42/* The magic number for our file system */
36enum { 43enum {
37 SPUFS_MAGIC = 0x23c9b64e, 44 SPUFS_MAGIC = 0x23c9b64e,