mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] arm-mmu: switch pte flags vars to lower case
@ 2013-01-25  0:59 Alexander Aring
  2013-01-25 18:51 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Aring @ 2013-01-25  0:59 UTC (permalink / raw)
  To: barebox

Old cache/uncache pte flags were declared as defines.
Since these flags are determine at runtime they are static
variables.

This patch switch the naming style of these variables to
lower case which is typically used for variables.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 arch/arm/cpu/mmu.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c
index 40b7ec4..c08676f 100644
--- a/arch/arm/cpu/mmu.c
+++ b/arch/arm/cpu/mmu.c
@@ -52,8 +52,8 @@ extern int arm_architecture;
 #define PTE_FLAGS_CACHED_V4 (PTE_SMALL_AP_UNO_SRW | PTE_BUFFERABLE | PTE_CACHEABLE)
 #define PTE_FLAGS_UNCACHED_V4 PTE_SMALL_AP_UNO_SRW
 
-static uint32_t PTE_FLAGS_CACHED;
-static uint32_t PTE_FLAGS_UNCACHED;
+static uint32_t pte_flags_cached;
+static uint32_t pte_flags_uncached;
 
 #define PTE_MASK ((1 << 12) - 1)
 
@@ -72,7 +72,7 @@ static u32 *arm_create_pte(unsigned long virt)
 	ttb[virt >> 20] = (unsigned long)table | PMD_TYPE_TABLE;
 
 	for (i = 0; i < 256; i++) {
-		table[i] = virt | PTE_TYPE_SMALL | PTE_FLAGS_UNCACHED;
+		table[i] = virt | PTE_TYPE_SMALL | pte_flags_uncached;
 		virt += PAGE_SIZE;
 	}
 
@@ -155,7 +155,7 @@ static int arm_mmu_remap_sdram(struct memory_bank *bank)
 
 	for (i = 0; i < num_ptes; i++) {
 		ptes[i] = (phys + i * 4096) | PTE_TYPE_SMALL |
-			PTE_FLAGS_CACHED;
+			pte_flags_cached;
 	}
 
 	pte = 0;
@@ -217,9 +217,10 @@ static void vectors_init(void)
 	memcpy(vectors, __exceptions_start, __exceptions_stop - __exceptions_start);
 
 	if (cr & CR_V)
-		exc[256 - 16] = (u32)vectors | PTE_TYPE_SMALL | PTE_FLAGS_CACHED;
+		exc[256 - 16] = (u32)vectors | PTE_TYPE_SMALL |
+			pte_flags_cached;
 	else
-		exc[0] = (u32)vectors | PTE_TYPE_SMALL | PTE_FLAGS_CACHED;
+		exc[0] = (u32)vectors | PTE_TYPE_SMALL | pte_flags_cached;
 }
 
 /*
@@ -233,11 +234,11 @@ static int mmu_init(void)
 	arm_set_cache_functions();
 
 	if (cpu_architecture() >= CPU_ARCH_ARMv7) {
-		PTE_FLAGS_CACHED = PTE_FLAGS_CACHED_V7;
-		PTE_FLAGS_UNCACHED = PTE_FLAGS_UNCACHED_V7;
+		pte_flags_cached = PTE_FLAGS_CACHED_V7;
+		pte_flags_uncached = PTE_FLAGS_UNCACHED_V7;
 	} else {
-		PTE_FLAGS_CACHED = PTE_FLAGS_CACHED_V4;
-		PTE_FLAGS_UNCACHED = PTE_FLAGS_UNCACHED_V4;
+		pte_flags_cached = PTE_FLAGS_CACHED_V4;
+		pte_flags_uncached = PTE_FLAGS_UNCACHED_V4;
 	}
 
 	ttb = memalign(0x10000, 0x4000);
@@ -305,7 +306,7 @@ void *dma_alloc_coherent(size_t size)
 
 	dma_inv_range((unsigned long)ret, (unsigned long)ret + size);
 
-	remap_range(ret, size, PTE_FLAGS_UNCACHED);
+	remap_range(ret, size, pte_flags_uncached);
 
 	return ret;
 }
@@ -322,7 +323,7 @@ void *phys_to_virt(unsigned long phys)
 
 void dma_free_coherent(void *mem, size_t size)
 {
-	remap_range(mem, size, PTE_FLAGS_CACHED);
+	remap_range(mem, size, pte_flags_cached);
 
 	free(mem);
 }
-- 
1.8.1.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] arm-mmu: switch pte flags vars to lower case
  2013-01-25  0:59 [PATCH] arm-mmu: switch pte flags vars to lower case Alexander Aring
@ 2013-01-25 18:51 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2013-01-25 18:51 UTC (permalink / raw)
  To: Alexander Aring; +Cc: barebox

On Fri, Jan 25, 2013 at 01:59:43AM +0100, Alexander Aring wrote:
> Old cache/uncache pte flags were declared as defines.
> Since these flags are determine at runtime they are static
> variables.
> 
> This patch switch the naming style of these variables to
> lower case which is typically used for variables.
> 
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>

Applied, thanks

Sascha

> ---
>  arch/arm/cpu/mmu.c | 25 +++++++++++++------------
>  1 file changed, 13 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c
> index 40b7ec4..c08676f 100644
> --- a/arch/arm/cpu/mmu.c
> +++ b/arch/arm/cpu/mmu.c
> @@ -52,8 +52,8 @@ extern int arm_architecture;
>  #define PTE_FLAGS_CACHED_V4 (PTE_SMALL_AP_UNO_SRW | PTE_BUFFERABLE | PTE_CACHEABLE)
>  #define PTE_FLAGS_UNCACHED_V4 PTE_SMALL_AP_UNO_SRW
>  
> -static uint32_t PTE_FLAGS_CACHED;
> -static uint32_t PTE_FLAGS_UNCACHED;
> +static uint32_t pte_flags_cached;
> +static uint32_t pte_flags_uncached;
>  
>  #define PTE_MASK ((1 << 12) - 1)
>  
> @@ -72,7 +72,7 @@ static u32 *arm_create_pte(unsigned long virt)
>  	ttb[virt >> 20] = (unsigned long)table | PMD_TYPE_TABLE;
>  
>  	for (i = 0; i < 256; i++) {
> -		table[i] = virt | PTE_TYPE_SMALL | PTE_FLAGS_UNCACHED;
> +		table[i] = virt | PTE_TYPE_SMALL | pte_flags_uncached;
>  		virt += PAGE_SIZE;
>  	}
>  
> @@ -155,7 +155,7 @@ static int arm_mmu_remap_sdram(struct memory_bank *bank)
>  
>  	for (i = 0; i < num_ptes; i++) {
>  		ptes[i] = (phys + i * 4096) | PTE_TYPE_SMALL |
> -			PTE_FLAGS_CACHED;
> +			pte_flags_cached;
>  	}
>  
>  	pte = 0;
> @@ -217,9 +217,10 @@ static void vectors_init(void)
>  	memcpy(vectors, __exceptions_start, __exceptions_stop - __exceptions_start);
>  
>  	if (cr & CR_V)
> -		exc[256 - 16] = (u32)vectors | PTE_TYPE_SMALL | PTE_FLAGS_CACHED;
> +		exc[256 - 16] = (u32)vectors | PTE_TYPE_SMALL |
> +			pte_flags_cached;
>  	else
> -		exc[0] = (u32)vectors | PTE_TYPE_SMALL | PTE_FLAGS_CACHED;
> +		exc[0] = (u32)vectors | PTE_TYPE_SMALL | pte_flags_cached;
>  }
>  
>  /*
> @@ -233,11 +234,11 @@ static int mmu_init(void)
>  	arm_set_cache_functions();
>  
>  	if (cpu_architecture() >= CPU_ARCH_ARMv7) {
> -		PTE_FLAGS_CACHED = PTE_FLAGS_CACHED_V7;
> -		PTE_FLAGS_UNCACHED = PTE_FLAGS_UNCACHED_V7;
> +		pte_flags_cached = PTE_FLAGS_CACHED_V7;
> +		pte_flags_uncached = PTE_FLAGS_UNCACHED_V7;
>  	} else {
> -		PTE_FLAGS_CACHED = PTE_FLAGS_CACHED_V4;
> -		PTE_FLAGS_UNCACHED = PTE_FLAGS_UNCACHED_V4;
> +		pte_flags_cached = PTE_FLAGS_CACHED_V4;
> +		pte_flags_uncached = PTE_FLAGS_UNCACHED_V4;
>  	}
>  
>  	ttb = memalign(0x10000, 0x4000);
> @@ -305,7 +306,7 @@ void *dma_alloc_coherent(size_t size)
>  
>  	dma_inv_range((unsigned long)ret, (unsigned long)ret + size);
>  
> -	remap_range(ret, size, PTE_FLAGS_UNCACHED);
> +	remap_range(ret, size, pte_flags_uncached);
>  
>  	return ret;
>  }
> @@ -322,7 +323,7 @@ void *phys_to_virt(unsigned long phys)
>  
>  void dma_free_coherent(void *mem, size_t size)
>  {
> -	remap_range(mem, size, PTE_FLAGS_CACHED);
> +	remap_range(mem, size, pte_flags_cached);
>  
>  	free(mem);
>  }
> -- 
> 1.8.1.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-25 18:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-25  0:59 [PATCH] arm-mmu: switch pte flags vars to lower case Alexander Aring
2013-01-25 18:51 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox