[Cbe-oss-dev] [PATCH 04/23]MARS/base: mpu dma reduce code size

Yuji Mano yuji.mano at am.sony.com
Sat Mar 14 12:18:14 EST 2009


From: Kazunori Asayama <asayama at sm.sony.co.jp>

Reduce code size of MPU DMA routine

This patch reduces code size of DMA routine on MPU side by sharing
code.

Signed-off-by: Kazunori Asayama <asayama at sm.sony.co.jp>
---
 base/src/mpu/kernel/dma.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Index: b/base/src/mpu/kernel/dma.c
===================================================================
--- a/base/src/mpu/kernel/dma.c	2009-02-12 22:30:42.000000000 +0900
+++ b/base/src/mpu/kernel/dma.c	2009-02-20 14:27:43.000000000 +0900
@@ -47,8 +47,10 @@
 #define MARS_DMA_ALIGN_MASK	0xf
 
 static int dma_large(void *ls, uint64_t ea, uint32_t size, uint32_t tag,
-		     int put)
+		     unsigned int dma_cmd)
 {
+	unsigned int cmd = MFC_CMD_WORD(0, 0, dma_cmd);
+
 	if (tag > MARS_DMA_TAG_MAX)
 		return MARS_ERROR_PARAMS;
 	if (((uintptr_t)ls & MARS_DMA_ALIGN_MASK) ||
@@ -61,10 +63,8 @@ static int dma_large(void *ls, uint64_t 
 		block_size = (size < MARS_DMA_SIZE_MAX) ?
 			      size : MARS_DMA_SIZE_MAX;
 
-		if (put)
-			mfc_put((volatile void *)ls, ea, block_size, tag, 0, 0);
-		else
-			mfc_get((volatile void *)ls, ea, block_size, tag, 0, 0);
+		spu_mfcdma64((volatile void *)ls, mfc_ea2h(ea), mfc_ea2l(ea),
+			     block_size, tag, cmd);
 
 		ls += block_size;
 		ea += block_size;
@@ -76,12 +76,12 @@ static int dma_large(void *ls, uint64_t 
 
 int dma_get(void *ls, uint64_t ea, uint32_t size, uint32_t tag)
 {
-	return dma_large(ls, ea, size, tag, 0);
+	return dma_large(ls, ea, size, tag, MFC_GET_CMD);
 }
 
 int dma_put(const void *ls, uint64_t ea, uint32_t size, uint32_t tag)
 {
-	return dma_large((void *)ls, ea, size, tag, 1);
+	return dma_large((void *)ls, ea, size, tag, MFC_PUT_CMD);
 }
 
 int dma_wait(uint32_t tag)






More information about the cbe-oss-dev mailing list