Skip to contentSkip to conversation

The bootcount_{store|load} moved to arch specific generic locations.

PATCH New Michael Zaidman 2 participants 3 messages Apr 23, 2010 – Apr 28, 2010 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 The bootcount_{store|load} moved to arch specific generic locations.

---
 arch/powerpc/cpu/mpc8260/commproc.c |   24 ------------------------
 arch/powerpc/cpu/mpc8260/cpu.c      |   24 ++++++++++++++++++++++++
 arch/powerpc/cpu/mpc8xx/commproc.c  |   26 --------------------------
 arch/powerpc/cpu/mpc8xx/cpu.c       |   26 ++++++++++++++++++++++++++
 arch/powerpc/cpu/ppc4xx/commproc.c  |   24 ------------------------
 arch/powerpc/cpu/ppc4xx/cpu.c       |   24 ++++++++++++++++++++++++
 6 files changed, 74 insertions(+), 74 deletions(-)
arch/powerpc/cpu/mpc8260/commproc.c +0 -24
index 111a67c..c522bc5 100644
@@ -195,27 +195,3 @@ ulong post_word_load (void)
 }
 
 #endif	/* CONFIG_POST || CONFIG_LOGBUFFER*/
-
-#ifdef CONFIG_BOOTCOUNT_LIMIT
-
-void bootcount_store (ulong a)
-{
-	volatile ulong *save_addr =
-		(volatile ulong *)(CONFIG_SYS_IMMR + CPM_BOOTCOUNT_ADDR);
-
-	save_addr[0] = a;
-	save_addr[1] = BOOTCOUNT_MAGIC;
-}
-
-ulong bootcount_load (void)
-{
-	volatile ulong *save_addr =
-		(volatile ulong *)(CONFIG_SYS_IMMR + CPM_BOOTCOUNT_ADDR);
-
-	if (save_addr[1] != BOOTCOUNT_MAGIC)
-		return 0;
-	else
-		return save_addr[0];
-}
-
-#endif /* CONFIG_BOOTCOUNT_LIMIT */
arch/powerpc/cpu/mpc8260/cpu.c +24 -0
index aedbf29..0beebb0 100644
@@ -336,3 +336,27 @@ int cpu_eth_init(bd_t *bis)
 #endif
 	return 0;
 }
+
+#ifdef CONFIG_BOOTCOUNT_LIMIT
+
+void bootcount_store (ulong a)
+{
+	volatile ulong *save_addr =
+		(volatile ulong *)(CONFIG_SYS_IMMR + CPM_BOOTCOUNT_ADDR);
+
+	save_addr[0] = a;
+	save_addr[1] = BOOTCOUNT_MAGIC;
+}
+
+ulong bootcount_load (void)
+{
+	volatile ulong *save_addr =
+		(volatile ulong *)(CONFIG_SYS_IMMR + CPM_BOOTCOUNT_ADDR);
+
+	if (save_addr[1] != BOOTCOUNT_MAGIC)
+		return 0;
+	else
+		return save_addr[0];
+}
+
+#endif /* CONFIG_BOOTCOUNT_LIMIT */
arch/powerpc/cpu/mpc8xx/commproc.c +0 -26
index a87a0dc..2c85377 100644
@@ -103,29 +103,3 @@ ulong post_word_load (void)
 }
 
 #endif	/* CONFIG_POST || CONFIG_LOGBUFFER*/
-
-#ifdef CONFIG_BOOTCOUNT_LIMIT
-
-void bootcount_store (ulong a)
-{
-	volatile ulong *save_addr =
-		(volatile ulong *)( ((immap_t *) CONFIG_SYS_IMMR)->im_cpm.cp_dpmem +
-		                    CPM_BOOTCOUNT_ADDR );
-
-	save_addr[0] = a;
-	save_addr[1] = BOOTCOUNT_MAGIC;
-}
-
-ulong bootcount_load (void)
-{
-	volatile ulong *save_addr =
-		(volatile ulong *)( ((immap_t *) CONFIG_SYS_IMMR)->im_cpm.cp_dpmem +
-		                    CPM_BOOTCOUNT_ADDR );
-
-	if (save_addr[1] != BOOTCOUNT_MAGIC)
-		return 0;
-	else
-		return save_addr[0];
-}
-
-#endif /* CONFIG_BOOTCOUNT_LIMIT */
arch/powerpc/cpu/mpc8xx/cpu.c +26 -0
index 2eb848b..70d2e86 100644
@@ -652,3 +652,29 @@ int cpu_eth_init(bd_t *bis)
 #endif
 	return 0;
 }
+
+#ifdef CONFIG_BOOTCOUNT_LIMIT
+
+void bootcount_store (ulong a)
+{
+	volatile ulong *save_addr =
+		(volatile ulong *)( ((immap_t *) CONFIG_SYS_IMMR)->im_cpm.cp_dpmem +
+		                    CPM_BOOTCOUNT_ADDR );
+
+	save_addr[0] = a;
+	save_addr[1] = BOOTCOUNT_MAGIC;
+}
+
+ulong bootcount_load (void)
+{
+	volatile ulong *save_addr =
+		(volatile ulong *)( ((immap_t *) CONFIG_SYS_IMMR)->im_cpm.cp_dpmem +
+		                    CPM_BOOTCOUNT_ADDR );
+
+	if (save_addr[1] != BOOTCOUNT_MAGIC)
+		return 0;
+	else
+		return save_addr[0];
+}
+
+#endif /* CONFIG_BOOTCOUNT_LIMIT */
arch/powerpc/cpu/ppc4xx/commproc.c +0 -24
index a1696d3..6bf95e6 100644
@@ -51,27 +51,3 @@ ulong post_word_load (void)
 }
 
 #endif	/* CONFIG_POST || CONFIG_LOGBUFFER*/
-
-#ifdef CONFIG_BOOTCOUNT_LIMIT
-
-void bootcount_store (ulong a)
-{
-	volatile ulong *save_addr =
-		(volatile ulong *)(CONFIG_SYS_OCM_DATA_ADDR + CONFIG_SYS_BOOTCOUNT_ADDR);
-
-	save_addr[0] = a;
-	save_addr[1] = BOOTCOUNT_MAGIC;
-}
-
-ulong bootcount_load (void)
-{
-	volatile ulong *save_addr =
-		(volatile ulong *)(CONFIG_SYS_OCM_DATA_ADDR + CONFIG_SYS_BOOTCOUNT_ADDR);
-
-	if (save_addr[1] != BOOTCOUNT_MAGIC)
-		return 0;
-	else
-		return save_addr[0];
-}
-
-#endif /* CONFIG_BOOTCOUNT_LIMIT */
arch/powerpc/cpu/ppc4xx/cpu.c +24 -0
index e1a023b..d84e619 100644
@@ -752,3 +752,27 @@ int cpu_eth_init(bd_t *bis)
 #endif
 	return 0;
 }
+
+#ifdef CONFIG_BOOTCOUNT_LIMIT
+
+void bootcount_store (ulong a)
+{
+	volatile ulong *save_addr =
+		(volatile ulong *)(CONFIG_SYS_OCM_DATA_ADDR + CONFIG_SYS_BOOTCOUNT_ADDR);
+
+	save_addr[0] = a;
+	save_addr[1] = BOOTCOUNT_MAGIC;
+}
+
+ulong bootcount_load (void)
+{
+	volatile ulong *save_addr =
+		(volatile ulong *)(CONFIG_SYS_OCM_DATA_ADDR + CONFIG_SYS_BOOTCOUNT_ADDR);
+
+	if (save_addr[1] != BOOTCOUNT_MAGIC)
+		return 0;
+	else
+		return save_addr[0];
+}
+
+#endif /* CONFIG_BOOTCOUNT_LIMIT */
Signature · 1 line
1.6.3.3
#1 lore raw

PATCH 1/2 The bootcount_{store|load} moved to arch specific generic locations.

Hi Michael,

Quoted 2 lines · On Friday 23 April 2010 21:07:12 Michael Zaidman wrote:

Thanks. Even though this patch is an improvement to the current state, we still duplicate some code in the multiple implementations. And the code still doesn't use IO-accessors to load/store the values. I'm currently working on a patch do clean this up a bit more. I think I have it ready this afternoon/evening and will send it then for review. Stay tuned...

Cheers,
Stefan

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de