[Cbe-oss-dev] [PATCH 06/13]MARS/core: Dma asserts

Yuji Mano yuji.mano at am.sony.com
Fri Dec 12 15:33:35 EST 2008


This fixes the asserts inside dma.h

Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>

---
Index: mars-src/core/include/mpu/mars/dma.h
===================================================================
--- mars-src.orig/core/include/mpu/mars/dma.h
+++ mars-src/core/include/mpu/mars/dma.h
@@ -117,18 +117,18 @@ static inline void mars_dma_sync(uint32_
 static inline void mars_dma_get(void *ls, uint64_t ea,
 				uint32_t size, uint32_t tag)
 {
-	assert(((uintptr_t)ls & MARS_DMA_ALIGN_MASK) == 0);
-	assert(((uintptr_t)ea & MARS_DMA_ALIGN_MASK) == 0);
-	assert(size == 1 || size == 2 || size == 4 || size == 8 ||
-		(size & MARS_DMA_SIZE_MASK) == 0);
-	assert(size && size <= MARS_DMA_LARGE_SIZE_MAX);
+	assert((size == 1 || size == 2 || size == 4 || size == 8 ||
+	       (size & MARS_DMA_SIZE_MASK) == 0) &&
+	       ((uintptr_t)ls & MARS_DMA_ALIGN_MASK) ==
+	       ((uintptr_t)ea & MARS_DMA_ALIGN_MASK) &&
+	       ((uintptr_t)ea & (size - 1) & MARS_DMA_ALIGN_MASK) == 0);
 	assert(tag <= MARS_DMA_TAG_MAX);
 
 	while (size) {
 		unsigned int block_size;
 
 		block_size = (size < MARS_DMA_SIZE_MAX) ?
-				size : MARS_DMA_SIZE_MAX;
+			      size : MARS_DMA_SIZE_MAX;
 
 		mfc_get((volatile void *)ls, ea, block_size, tag, 0, 0);
 
@@ -173,17 +173,18 @@ static inline void mars_dma_get_and_wait
 static inline void mars_dma_put(const void *ls, uint64_t ea,
 				uint32_t size, uint32_t tag)
 {
-	assert(((uintptr_t)ls & MARS_DMA_ALIGN_MASK) == 0);
-	assert(((uintptr_t)ea & MARS_DMA_ALIGN_MASK) == 0);
-	assert(size == 1 || size == 2 || size == 4 || size == 8 ||
-		(size & MARS_DMA_SIZE_MASK) == 0);
+	assert((size == 1 || size == 2 || size == 4 || size == 8 ||
+	       (size & MARS_DMA_SIZE_MASK) == 0) &&
+	       ((uintptr_t)ls & MARS_DMA_ALIGN_MASK) ==
+	       ((uintptr_t)ea & MARS_DMA_ALIGN_MASK) &&
+	       ((uintptr_t)ea & (size - 1) & MARS_DMA_ALIGN_MASK) == 0);
 	assert(tag <= MARS_DMA_TAG_MAX);
 
 	while (size) {
 		unsigned int block_size;
 
 		block_size = (size < MARS_DMA_SIZE_MAX) ?
-				size : MARS_DMA_SIZE_MAX;
+			      size : MARS_DMA_SIZE_MAX;
 
 		mfc_put((volatile void *)ls, ea, block_size, tag, 0, 0);
 






More information about the cbe-oss-dev mailing list