All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] Add the "mfill" and "mcheck" memory commands.
@ 2009-03-06 16:17 Benoit Monin
  2009-03-08 22:20 ` Wolfgang Denk
  0 siblings, 1 reply; 4+ messages in thread
From: Benoit Monin @ 2009-03-06 16:17 UTC (permalink / raw)
  To: u-boot

> De : "Wolfgang Denk"
> 
> Dear Benoit Monin,
> 
> In message <28907262.11403.1236090567026.JavaMail.www@wwinf8303> you wrote:
> > 
> > The mfill command writes the value of a counter to a memory area.
> > The mcheck command verifies the memory area against the counter value.
> > Those commands are useful for debugging memory/framebuffer controller.
> > 
> > The configuration option is CONFIG_MFILL and this only takes effect if
> > the memory commands are activated globally (CONFIG_CMD_MEM).
> 
> What exactly is the purpose of this patch? Looks like an extremely
> simple memory test to me. Don't we have already a rich selection of
> better ones available yet?
> 
I should have detailed more the intent of those commands. We have here
a video controller embedded in an fpga with its own video ram. We use
mfill to fill the video ram as fast as possible with variable data for
each vram address. And we use mcheck to verify (as fast as possible)
the content of the vram.

So this is not intended to test the main memory but it is a development
and debug tool for peripheral containing memory.

I've sent a patch because they are useful to us and generic enough,
and might be handy for debugging accesses to memory mapped behind
programmable logic.

But maybe this debug tool is beyond the scope of U-Boot ?

> Best regards,
> 
> Wolfgang Denk
> 
Sincerely,
Beno?t.

--


 Cr?ez votre adresse ?lectronique prenom.nom at laposte.net 
 1 Go d'espace de stockage, anti-spam et anti-virus int?gr?s.

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

* [U-Boot] [PATCH] Add the "mfill" and "mcheck" memory commands.
  2009-03-06 16:17 [U-Boot] [PATCH] Add the "mfill" and "mcheck" memory commands Benoit Monin
@ 2009-03-08 22:20 ` Wolfgang Denk
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2009-03-08 22:20 UTC (permalink / raw)
  To: u-boot

Dear Benoit Monin,

In message <6148322.23690.1236356233840.JavaMail.www@wwinf8204> you wrote:
> 
> > > The configuration option is CONFIG_MFILL and this only takes effect if
> > > the memory commands are activated globally (CONFIG_CMD_MEM).
> > 
> > What exactly is the purpose of this patch? Looks like an extremely
> > simple memory test to me. Don't we have already a rich selection of
> > better ones available yet?
> > 
> I should have detailed more the intent of those commands. We have here

Indeed.

> a video controller embedded in an fpga with its own video ram. We use
> mfill to fill the video ram as fast as possible with variable data for
> each vram address. And we use mcheck to verify (as fast as possible)
> the content of the vram.
> 
> So this is not intended to test the main memory but it is a development
> and debug tool for peripheral containing memory.

You could use the existing memory tests to do the same.

> I've sent a patch because they are useful to us and generic enough,
> and might be handy for debugging accesses to memory mapped behind
> programmable logic.
> 
> But maybe this debug tool is beyond the scope of U-Boot ?

I think it duplicates existing functionality.

Best regards,

Wolfgang Denk

-- 
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
Men don't talk peace unless they're ready to back it up with war.
	-- Col. Green, "The Savage Curtain", stardate 5906.4

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

* [U-Boot] [PATCH] Add the "mfill" and "mcheck" memory commands.
  2009-03-03 14:29 Benoit Monin
@ 2009-03-05 23:55 ` Wolfgang Denk
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2009-03-05 23:55 UTC (permalink / raw)
  To: u-boot

Dear Benoit Monin,

In message <28907262.11403.1236090567026.JavaMail.www@wwinf8303> you wrote:
> 
> The mfill command writes the value of a counter to a memory area.
> The mcheck command verifies the memory area against the counter value.
> Those commands are useful for debugging memory/framebuffer controller.
> 
> The configuration option is CONFIG_MFILL and this only takes effect if
> the memory commands are activated globally (CONFIG_CMD_MEM).

What exactly is the purpose of this patch? Looks like an extremely
simple memory test to me. Don't we have already a rich selection of
better ones available yet?

Best regards,

Wolfgang Denk

-- 
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 can call spirits from the vasty deep."
"Why so can I, or so can any man; but will they come when you do call
for them?"          - Shakespeare, 1 King Henry IV, Act III, Scene I.

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

* [U-Boot] [PATCH] Add the "mfill" and "mcheck" memory commands.
@ 2009-03-03 14:29 Benoit Monin
  2009-03-05 23:55 ` Wolfgang Denk
  0 siblings, 1 reply; 4+ messages in thread
From: Benoit Monin @ 2009-03-03 14:29 UTC (permalink / raw)
  To: u-boot

The mfill command writes the value of a counter to a memory area.
The mcheck command verifies the memory area against the counter value.
Those commands are useful for debugging memory/framebuffer controller.

The configuration option is CONFIG_MFILL and this only takes effect if
the memory commands are activated globally (CONFIG_CMD_MEM).

Signed-off-by: Beno?t Monin <bmonin <at> adeneo.eu>
---
 README           |   17 +++++++-
 common/cmd_mem.c |  127 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 143 insertions(+), 1 deletions(-)

diff --git a/README b/README
index 43fb1c0..d0a636e 100644
--- a/README
+++ b/README
@@ -627,7 +627,7 @@ The following options need to be configured:
 		CONFIG_CMD_LOADB	  loadb
 		CONFIG_CMD_LOADS	  loads
 		CONFIG_CMD_MEMORY	  md, mm, nm, mw, cp, cmp, crc, base,
-					  loop, loopw, mtest
+					  loop, loopw, mtest, mfill, mcheck
 		CONFIG_CMD_MISC		  Misc functions like sleep etc
 		CONFIG_CMD_MMC		* MMC memory mapped support
 		CONFIG_CMD_MII		* MII utility commands
@@ -2678,6 +2678,21 @@ Low Level (hardware related) configuration options:
 		This only takes effect if the memory commands are activated
 		globally (CONFIG_CMD_MEM).
 
+- CONFIG_MFILL
+		Add the "mfill" and "mcheck" memory commands. "mfill" writes
+		a memory area with the value of a counter. "mcheck" checks
+		a memory area against the value of a counter and can be run
+		after mfill.
+
+		(mfill/mcheck)[.b, .w, .l] address count [init]
+		  [.b, .w, .l] : Access size (default to l).
+		  address : Address in hexadecimal.
+		  count : Number of elements to write in hex.
+		  [init] : Initial value of the counter (default to 0).
+
+		This only takes effect if the memory commands are activated
+		globally (CONFIG_CMD_MEM).
+
 - CONFIG_SKIP_LOWLEVEL_INIT
 - CONFIG_SKIP_RELOCATE_UBOOT
 
diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index 2d4fc2a..0191687 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -943,6 +943,117 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	return rcode;
 }
 
+#ifdef CONFIG_MFILL
+/* Memory fill
+ * 
+ * Write a memory area with the value of a counter
+ * 
+ * mfill{.b, .w, .l} {address} {count} {init}
+ */
+static int do_mem_mfill(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+	volatile void* addr;
+	ulong count;
+	ulong val;
+	int size;
+	
+	if (argc < 3) {
+		printf ("Usage:\n%s\n", cmdtp->usage);
+		return 1;
+	}
+	/* Scan for data size */
+	if ((size = cmd_get_data_size(argv[0], 4)) < 0)
+		return 1;
+	addr = (void*)simple_strtoul(argv[1], NULL, 16);
+	addr += base_address;
+	count = simple_strtoul(argv[2], NULL, 16);
+	if (argc == 4) {
+		val = simple_strtoul(argv[3], NULL, 16);
+	} else {
+		val = 0;
+	}
+	if (size == 4) {
+		while (count-- > 0) {
+			*((ulong*)addr) = (ulong)val++;
+			addr += size;
+		}
+	} else if (size == 2) {
+		while (count-- > 0) {
+			*((ushort*)addr) = (ushort)val++;
+			addr += size;
+		}
+	} else {
+		while (count-- > 0) {
+			*((uchar*)addr) = (uchar)val++;
+			addr += size;
+		}
+	}
+	return 0;
+}
+
+/* Memory check
+ * 
+ * Check a memory area against the value of a counter
+ * Run this after mfill.
+ * 
+ * mcheck{.b, .w, .l} {address} {count} {init}
+ */
+static int do_mem_mcheck(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+	volatile void* addr;
+	ulong count;
+	ulong val;
+	int size;
+	
+	if (argc < 3) {
+		printf ("Usage:\n%s\n", cmdtp->usage);
+		return 1;
+	}
+	/* Scan for data size */
+	if ((size = cmd_get_data_size(argv[0], 4)) < 0)
+		return 1;
+	addr = (void*)simple_strtoul(argv[1], NULL, 16);
+	addr += base_address;
+	count = simple_strtoul(argv[2], NULL, 16);
+	if (argc == 4) {
+		val = simple_strtoul(argv[3], NULL, 16);
+	} else {
+		val = 0;
+	}
+	if (size == 4) {
+		while (count-- > 0) {
+			if (*((ulong*)addr) != (ulong)val) {
+				printf ("Mem error @ 0x%p: found 0x%08lx, expected 0x%08lx\n",
+					addr, *((ulong*)addr), (ulong)val);
+				if (ctrlc()) return 1;
+			}
+			addr += size;
+			val++;
+		}
+	} else if (size == 2) {
+		while (count-- > 0) {
+			if (*((ushort*)addr) != (ushort)val) {
+				printf ("Mem error @ 0x%p: found 0x%04x, expected 0x%04x\n",
+					addr, *((ushort*)addr), (ushort)val);
+				if (ctrlc()) return 1;
+			}
+			addr += size;
+			val++;
+		}
+	} else {
+		while (count-- > 0) {
+			if (*((uchar*)addr) != (uchar)val) {
+				printf ("Mem error @ 0x%p: found 0x%02x, expected 0x%02x\n",
+					addr, *((uchar*)addr), (uchar)val);
+				if (ctrlc()) return 1;
+			}
+			addr += size;
+			val++;
+		}
+	}
+	return 0;
+}
+#endif /* CONFIG_MFILL */
 
 /* Modify memory.
  *
@@ -1256,6 +1367,22 @@ U_BOOT_CMD(
 	"    - simple RAM read/write test\n"
 );
 
+#ifdef CONFIG_MFILL
+U_BOOT_CMD(
+	mfill,	4,	1,	do_mem_mfill,
+	"mfill   - Fill memory with the value of a counter\n",
+	"[.b, .w, .l] address count [init]\n"
+	"    - Fill memory range with the value of a counter\n"
+);
+
+U_BOOT_CMD(
+	mcheck,	4,	1,	do_mem_mcheck,
+	"mcheck  - Check memory after mfill\n",
+	"[.b, .w, .l] address count [init]\n"
+	"    - Check memory range after mfill\n"
+);
+#endif /* CONFIG_MFILL */
+
 #ifdef CONFIG_MX_CYCLIC
 U_BOOT_CMD(
 	mdc,	4,	1,	do_mem_mdc,
-- 


 Cr?ez votre adresse ?lectronique prenom.nom at laposte.net 
 1 Go d'espace de stockage, anti-spam et anti-virus int?gr?s.

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

end of thread, other threads:[~2009-03-08 22:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-06 16:17 [U-Boot] [PATCH] Add the "mfill" and "mcheck" memory commands Benoit Monin
2009-03-08 22:20 ` Wolfgang Denk
  -- strict thread matches above, loose matches on Subject: below --
2009-03-03 14:29 Benoit Monin
2009-03-05 23:55 ` Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.