Skip to contentSkip to conversation

74xx: use r4 instead of r2 in lock_ram_in_cache and unlock_ram_in_cache

PATCH New Dave Liu 3 participants 5 messages Oct 23, 2008 – Oct 30, 2008

lore
Share & tools
lore

Dave Liu

author
#0 lore raw

PATCH 1/1 74xx: use r4 instead of r2 in lock_ram_in_cache and unlock_ram_in_cache

The patch is following the commit 392438406041415fe64ab8748ec5ab5ad01d1cf7

mpc86xx: use r4 instead of r2 in lock_ram_in_cache and unlock_ram_in_cache

This is needed in unlock_ram_in_cache() because it is called from C and will corrupt the small data area anchor that is kept in R2.

lock_ram_in_cache() is modified similarly as good coding practice, but is not called from C.

also, the r2 is used as global data pointer.

---
 cpu/74xx_7xx/start.S |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
cpu/74xx_7xx/start.S +4 -4
index 07bbe01..b5484e3 100644
@@ -857,9 +857,9 @@ lock_ram_in_cache:
 	 */
 	lis	r3, (CONFIG_SYS_INIT_RAM_ADDR & ~31)@h
 	ori	r3, r3, (CONFIG_SYS_INIT_RAM_ADDR & ~31)@l
-	li	r2, ((CONFIG_SYS_INIT_RAM_END & ~31) + \
+	li	r4, ((CONFIG_SYS_INIT_RAM_END & ~31) + \
 		     (CONFIG_SYS_INIT_RAM_ADDR & 31) + 31) / 32
-	mtctr	r2
+	mtctr	r4
 1:
 	dcbz	r0, r3
 	addi	r3, r3, 32
@@ -878,9 +878,9 @@ unlock_ram_in_cache:
 	/* invalidate the INIT_RAM section */
 	lis	r3, (CONFIG_SYS_INIT_RAM_ADDR & ~31)@h
 	ori	r3, r3, (CONFIG_SYS_INIT_RAM_ADDR & ~31)@l
-	li	r2, ((CONFIG_SYS_INIT_RAM_END & ~31) + \
+	li	r4, ((CONFIG_SYS_INIT_RAM_END & ~31) + \
 		     (CONFIG_SYS_INIT_RAM_ADDR & 31) + 31) / 32
-	mtctr	r2
+	mtctr	r4
 1:	icbi	r0, r3
 	addi	r3, r3, 32
 	bdnz	1b
Signature · 1 line
1.5.4
#1 lore raw

PATCH 1/1 74xx: use r4 instead of r2 in lock_ram_in_cache and unlock_ram_in_cache

Quoted 48 lines · Dave Liu

The patch is following the commit
392438406041415fe64ab8748ec5ab5ad01d1cf7

mpc86xx: use r4 instead of r2 in lock_ram_in_cache and unlock_ram_in_cache

This is needed in unlock_ram_in_cache() because it is called from C and
will corrupt the small data area anchor that is kept in R2.

lock_ram_in_cache() is modified similarly as good coding practice, but is not called from C.

also, the r2 is used as global data pointer.

---
cpu/74xx_7xx/start.S | 8 ++++----

1 files changed, 4 insertions(+), 4 deletions(-)
cpu/74xx_7xx/start.S +2 -2
index 07bbe01..b5484e3 100644
@@ -857,9 +857,9 @@ lock_ram_in_cache:
 	 */
 	lis	r3, (CONFIG_SYS_INIT_RAM_ADDR & ~31)@h
 	ori	r3, r3, (CONFIG_SYS_INIT_RAM_ADDR & ~31)@l
-	li	r2, ((CONFIG_SYS_INIT_RAM_END & ~31) + \
+	li	r4, ((CONFIG_SYS_INIT_RAM_END & ~31) + \
 		     (CONFIG_SYS_INIT_RAM_ADDR & 31) + 31) / 32
-	mtctr	r2
+	mtctr	r4

1:

	dcbz	r0, r3
	addi	r3, r3, 32
cpu/74xx_7xx/start.S +2 -2
@@ -878,9 +878,9 @@ unlock_ram_in_cache:
 	/* invalidate the INIT_RAM section */
 	lis	r3, (CONFIG_SYS_INIT_RAM_ADDR & ~31)@h
 	ori	r3, r3, (CONFIG_SYS_INIT_RAM_ADDR & ~31)@l
-	li	r2, ((CONFIG_SYS_INIT_RAM_END & ~31) + \
+	li	r4, ((CONFIG_SYS_INIT_RAM_END & ~31) + \
 		     (CONFIG_SYS_INIT_RAM_ADDR & 31) + 31) / 32
-	mtctr	r2
+	mtctr	r4

1: icbi r0, r3

Quoted 2 lines
	addi	r3, r3, 32
	bdnz	1b

Can we change the 31 to CONFIG_SYS_CACHELINE_SIZE-1

It doesn't matter much for 7xx/74xx/e600 as the cache line size has always been 32-bytes, but good to make the code a bit more readable

- k

#2 lore raw

PATCH 1/1 74xx: use r4 instead of r2 in lock_ram_in_cache and unlock_ram_in_cache

Quoted 58 lines

From: Kumar Gala [mailto:galak at kernel.crashing.org]

Quoted 7 lines · Dave Liu

The patch is following the commit
392438406041415fe64ab8748ec5ab5ad01d1cf7

mpc86xx: use r4 instead of r2 in lock_ram_in_cache and unlock_ram_in_cache

This is needed in unlock_ram_in_cache() because it is

called from C

Quoted 4 lines

and
will corrupt the small data area anchor that is kept in R2.

lock_ram_in_cache() is modified similarly as good coding

practice, but

Quoted 37 lines

is not called from C.

also, the r2 is used as global data pointer.

---
cpu/74xx_7xx/start.S | 8 ++++----

1 files changed, 4 insertions(+), 4 deletions(-)
cpu/74xx_7xx/start.S +2 -2
index 07bbe01..b5484e3 100644
@@ -857,9 +857,9 @@ lock_ram_in_cache:
 	 */
 	lis	r3, (CONFIG_SYS_INIT_RAM_ADDR & ~31)@h
 	ori	r3, r3, (CONFIG_SYS_INIT_RAM_ADDR & ~31)@l
-	li	r2, ((CONFIG_SYS_INIT_RAM_END & ~31) + \
+	li	r4, ((CONFIG_SYS_INIT_RAM_END & ~31) + \
 		     (CONFIG_SYS_INIT_RAM_ADDR & 31) + 31) / 32
-	mtctr	r2
+	mtctr	r4

1:

	dcbz	r0, r3
	addi	r3, r3, 32
cpu/74xx_7xx/start.S +2 -2
@@ -878,9 +878,9 @@ unlock_ram_in_cache:
 	/* invalidate the INIT_RAM section */
 	lis	r3, (CONFIG_SYS_INIT_RAM_ADDR & ~31)@h
 	ori	r3, r3, (CONFIG_SYS_INIT_RAM_ADDR & ~31)@l
-	li	r2, ((CONFIG_SYS_INIT_RAM_END & ~31) + \
+	li	r4, ((CONFIG_SYS_INIT_RAM_END & ~31) + \
 		     (CONFIG_SYS_INIT_RAM_ADDR & 31) + 31) / 32
-	mtctr	r2
+	mtctr	r4

1: icbi r0, r3

Quoted 2 lines
	addi	r3, r3, 32
	bdnz	1b

Can we change the 31 to CONFIG_SYS_CACHELINE_SIZE-1

Quoted 2 lines

It doesn't matter much for 7xx/74xx/e600 as the cache line size has always been 32-bytes, but good to make the code a bit more readable

Patch welcomed!

Thanks,
Dave

#3 lore raw

PATCH 1/1 74xx: use r4 instead of r2 in lock_ram_in_cache and unlock_ram_in_cache

Quoted 58 lines · On Oct 23, 2008, at 9:20 AM, Liu Dave-R63238 wrote:
Quoted 58 lines

From: Kumar Gala [mailto:galak at kernel.crashing.org]

Quoted 7 lines · Dave Liu

The patch is following the commit
392438406041415fe64ab8748ec5ab5ad01d1cf7

mpc86xx: use r4 instead of r2 in lock_ram_in_cache and unlock_ram_in_cache

This is needed in unlock_ram_in_cache() because it is

called from C

Quoted 4 lines

and
will corrupt the small data area anchor that is kept in R2.

lock_ram_in_cache() is modified similarly as good coding

practice, but

Quoted 37 lines

is not called from C.

also, the r2 is used as global data pointer.

---
cpu/74xx_7xx/start.S | 8 ++++----

1 files changed, 4 insertions(+), 4 deletions(-)
cpu/74xx_7xx/start.S +2 -2
index 07bbe01..b5484e3 100644
@@ -857,9 +857,9 @@ lock_ram_in_cache:
 	 */
 	lis	r3, (CONFIG_SYS_INIT_RAM_ADDR & ~31)@h
 	ori	r3, r3, (CONFIG_SYS_INIT_RAM_ADDR & ~31)@l
-	li	r2, ((CONFIG_SYS_INIT_RAM_END & ~31) + \
+	li	r4, ((CONFIG_SYS_INIT_RAM_END & ~31) + \
 		     (CONFIG_SYS_INIT_RAM_ADDR & 31) + 31) / 32
-	mtctr	r2
+	mtctr	r4

1:

	dcbz	r0, r3
	addi	r3, r3, 32
cpu/74xx_7xx/start.S +2 -2
@@ -878,9 +878,9 @@ unlock_ram_in_cache:
 	/* invalidate the INIT_RAM section */
 	lis	r3, (CONFIG_SYS_INIT_RAM_ADDR & ~31)@h
 	ori	r3, r3, (CONFIG_SYS_INIT_RAM_ADDR & ~31)@l
-	li	r2, ((CONFIG_SYS_INIT_RAM_END & ~31) + \
+	li	r4, ((CONFIG_SYS_INIT_RAM_END & ~31) + \
 		     (CONFIG_SYS_INIT_RAM_ADDR & 31) + 31) / 32
-	mtctr	r2
+	mtctr	r4

1: icbi r0, r3

Quoted 2 lines
	addi	r3, r3, 32
	bdnz	1b

Can we change the 31 to CONFIG_SYS_CACHELINE_SIZE-1

Quoted 4 lines
Quoted 2 lines

It doesn't matter much for 7xx/74xx/e600 as the cache line size has always been 32-bytes, but good to make the code a bit more readable

Patch welcomed!

I'm willing to deal with it that way.

Ack on this patch.

- k

#4 lore raw

PATCH 1/1 74xx: use r4 instead of r2 in lock_ram_in_cache and unlock_ram_in_cache

In reply to Dave Liu

Dear Dave Liu,

Quoted 10 lines · In message <[email protected]> you wrote:

The patch is following the commit 392438406041415fe64ab8748ec5ab5ad01d1cf7

mpc86xx: use r4 instead of r2 in lock_ram_in_cache and unlock_ram_in_cache

This is needed in unlock_ram_in_cache() because it is called from C and will corrupt the small data area anchor that is kept in R2.

lock_ram_in_cache() is modified similarly as good coding practice, but is not called from C.

Quoted 8 lines

also, the r2 is used as global data pointer.

---
 cpu/74xx_7xx/start.S |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I've already got a female to worry about. Her name is the Enterprise.
	-- Kirk, "The Corbomite Maneuver", stardate 1514.0