mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* Add 64bit support to mem commands
@ 2015-05-28 10:34 Sascha Hauer
  2015-05-28 10:34 ` [PATCH 01/10] memory_display: Use consistent types Sascha Hauer
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Sascha Hauer @ 2015-05-28 10:34 UTC (permalink / raw)
  To: Barebox List

This series adds 64bit support to the memory commands which can
be quite useful on 64bit architectures. The commands use the
'-q' (for quad) option to switch to 64bit mode.

Sascha

----------------------------------------------------------------
Sascha Hauer (10):
      memory_display: Use consistent types
      memory_display: Add 64bit support
      fs: Add O_RWSIZE_8
      mem commands: suppport parsing 'q' option
      md command: Add 64bit support
      memcmp command: Add 64bit support
      memcpy command: Add 64bit support
      memset command: Add 64bit support
      mm command: Add 64bit support
      mw command: Add 64bit support

 commands/md.c           |  3 ++-
 commands/mem.c          |  3 +++
 commands/memcmp.c       |  3 ++-
 commands/memcpy.c       |  3 ++-
 commands/memset.c       |  3 ++-
 commands/mm.c           | 20 ++++++++++++++++----
 commands/mw.c           | 10 +++++++++-
 common/memory_display.c | 42 ++++++++++++++++++++++++++++--------------
 fs/fs.c                 |  3 +++
 include/fcntl.h         |  3 ++-
 10 files changed, 69 insertions(+), 24 deletions(-)

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

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

* [PATCH 01/10] memory_display: Use consistent types
  2015-05-28 10:34 Add 64bit support to mem commands Sascha Hauer
@ 2015-05-28 10:34 ` Sascha Hauer
  2015-05-28 10:34 ` [PATCH 02/10] memory_display: Add 64bit support Sascha Hauer
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2015-05-28 10:34 UTC (permalink / raw)
  To: Barebox List

memory_display uses three different types for 32bit variables, three
types for 16bit variables and three types for 8bit variables. Clean up
this mess and use one type per variable width.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/memory_display.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/common/memory_display.c b/common/memory_display.c
index 7b1d35e..1ad0f05 100644
--- a/common/memory_display.c
+++ b/common/memory_display.c
@@ -6,8 +6,8 @@
 
 int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int swab)
 {
-	ulong linebytes, i;
-	u_char	*cp;
+	unsigned long linebytes, i;
+	unsigned char *cp;
 
 	/* Print the lines.
 	 *
@@ -15,10 +15,10 @@ int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int
 	 * once, and all accesses are with the specified bus width.
 	 */
 	do {
-		char linebuf[DISP_LINE_LEN];
-		uint32_t *uip = (uint   *)linebuf;
-		uint16_t *usp = (ushort *)linebuf;
-		uint8_t *ucp = (u_char *)linebuf;
+		unsigned char linebuf[DISP_LINE_LEN];
+		uint32_t *uip = (uint32_t *)linebuf;
+		uint16_t *usp = (uint16_t *)linebuf;
+		uint8_t *ucp = (uint8_t *)linebuf;
 		unsigned count = 52;
 
 		printf("%08llx:", offs);
@@ -26,9 +26,9 @@ int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int
 
 		for (i = 0; i < linebytes; i += size) {
 			if (size == 4) {
-				u32 res;
+				uint32_t res;
 				data_abort_mask();
-				res = *((uint *)addr);
+				res = *((uint32_t *)addr);
 				if (swab)
 					res = __swab32(res);
 				if (data_abort_unmask()) {
@@ -39,9 +39,9 @@ int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int
 				}
 				*uip++ = res;
 			} else if (size == 2) {
-				u16 res;
+				uint16_t res;
 				data_abort_mask();
-				res = *((ushort *)addr);
+				res = *((uint16_t *)addr);
 				if (swab)
 					res = __swab16(res);
 				if (data_abort_unmask()) {
@@ -52,9 +52,9 @@ int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int
 				}
 				*usp++ = res;
 			} else {
-				u8 res;
+				uint8_t res;
 				data_abort_mask();
-				res = *((u_char *)addr);
+				res = *((uint8_t *)addr);
 				if (data_abort_unmask()) {
 					res = 0xff;
 					count -= printf(" xx");
@@ -70,7 +70,7 @@ int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int
 		while (count--)
 			putchar(' ');
 
-		cp = (uint8_t *)linebuf;
+		cp = linebuf;
 		for (i = 0; i < linebytes; i++) {
 			if ((*cp < 0x20) || (*cp > 0x7e))
 				putchar('.');
-- 
2.1.4


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

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

* [PATCH 02/10] memory_display: Add 64bit support
  2015-05-28 10:34 Add 64bit support to mem commands Sascha Hauer
  2015-05-28 10:34 ` [PATCH 01/10] memory_display: Use consistent types Sascha Hauer
@ 2015-05-28 10:34 ` Sascha Hauer
  2015-05-28 10:34 ` [PATCH 03/10] fs: Add O_RWSIZE_8 Sascha Hauer
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2015-05-28 10:34 UTC (permalink / raw)
  To: Barebox List

Add support for showing hexdumps in 64bit width.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/memory_display.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/common/memory_display.c b/common/memory_display.c
index 1ad0f05..ea91985 100644
--- a/common/memory_display.c
+++ b/common/memory_display.c
@@ -16,6 +16,7 @@ int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int
 	 */
 	do {
 		unsigned char linebuf[DISP_LINE_LEN];
+		uint64_t *ullp = (uint64_t *)linebuf;
 		uint32_t *uip = (uint32_t *)linebuf;
 		uint16_t *usp = (uint16_t *)linebuf;
 		uint8_t *ucp = (uint8_t *)linebuf;
@@ -25,7 +26,20 @@ int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int
 		linebytes = (nbytes > DISP_LINE_LEN) ? DISP_LINE_LEN : nbytes;
 
 		for (i = 0; i < linebytes; i += size) {
-			if (size == 4) {
+			if (size == 8) {
+				uint64_t res;
+				data_abort_mask();
+				res = *((uint64_t *)addr);
+				if (swab)
+					res = __swab64(res);
+				if (data_abort_unmask()) {
+					res = 0xffffffffffffffffULL;
+					count -= printf(" xxxxxxxxxxxxxxxx");
+				} else {
+					count -= printf(" %016llx", res);
+				}
+				*ullp++ = res;
+			} else if (size == 4) {
 				uint32_t res;
 				data_abort_mask();
 				res = *((uint32_t *)addr);
-- 
2.1.4


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

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

* [PATCH 03/10] fs: Add O_RWSIZE_8
  2015-05-28 10:34 Add 64bit support to mem commands Sascha Hauer
  2015-05-28 10:34 ` [PATCH 01/10] memory_display: Use consistent types Sascha Hauer
  2015-05-28 10:34 ` [PATCH 02/10] memory_display: Add 64bit support Sascha Hauer
@ 2015-05-28 10:34 ` Sascha Hauer
  2015-05-28 10:34 ` [PATCH 04/10] mem commands: suppport parsing 'q' option Sascha Hauer
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2015-05-28 10:34 UTC (permalink / raw)
  To: Barebox List

To support native 64bit accesses in memcpy_sz.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 fs/fs.c         | 3 +++
 include/fcntl.h | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/fs.c b/fs/fs.c
index 779f264..9a79a03 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1590,6 +1590,9 @@ static void memcpy_sz(void *_dst, const void *_src, ulong count, ulong rwsize)
 		case 4:
 			*((ulong  *)dst) = *((ulong  *)src);
 			break;
+		case 8:
+			*((u64  *)dst) = *((u64  *)src);
+			break;
 		}
 		dst += rwsize;
 		src += rwsize;
diff --git a/include/fcntl.h b/include/fcntl.h
index aed741e..501b415 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -17,11 +17,12 @@
 #define O_NOFOLLOW	00400000	/* don't follow links */
 
 /* barebox additional flags */
-#define O_RWSIZE_MASK	00000070
+#define O_RWSIZE_MASK	00000170
 #define O_RWSIZE_SHIFT	3
 #define O_RWSIZE_1      00000010
 #define O_RWSIZE_2      00000020
 #define O_RWSIZE_4      00000040
+#define O_RWSIZE_8      00000100
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
-- 
2.1.4


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

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

* [PATCH 04/10] mem commands: suppport parsing 'q' option
  2015-05-28 10:34 Add 64bit support to mem commands Sascha Hauer
                   ` (2 preceding siblings ...)
  2015-05-28 10:34 ` [PATCH 03/10] fs: Add O_RWSIZE_8 Sascha Hauer
@ 2015-05-28 10:34 ` Sascha Hauer
  2015-05-28 10:34 ` [PATCH 05/10] md command: Add 64bit support Sascha Hauer
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2015-05-28 10:34 UTC (permalink / raw)
  To: Barebox List

Add 64bit ('q', for quad) support to mem_parse_options

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/mem.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/commands/mem.c b/commands/mem.c
index 568050d..23c703f 100644
--- a/commands/mem.c
+++ b/commands/mem.c
@@ -84,6 +84,9 @@ int mem_parse_options(int argc, char *argv[], char *optstr, int *mode,
 		case 'l':
 			*mode = O_RWSIZE_4;
 			break;
+		case 'q':
+			*mode = O_RWSIZE_8;
+			break;
 		case 's':
 			*sourcefile = optarg;
 			break;
-- 
2.1.4


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

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

* [PATCH 05/10] md command: Add 64bit support
  2015-05-28 10:34 Add 64bit support to mem commands Sascha Hauer
                   ` (3 preceding siblings ...)
  2015-05-28 10:34 ` [PATCH 04/10] mem commands: suppport parsing 'q' option Sascha Hauer
@ 2015-05-28 10:34 ` Sascha Hauer
  2015-05-28 10:34 ` [PATCH 06/10] memcmp " Sascha Hauer
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2015-05-28 10:34 UTC (permalink / raw)
  To: Barebox List

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/md.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/commands/md.c b/commands/md.c
index 07a03d5..c88259a 100644
--- a/commands/md.c
+++ b/commands/md.c
@@ -49,7 +49,7 @@ static int do_mem_md(int argc, char *argv[])
 	if (argc < 2)
 		return COMMAND_ERROR_USAGE;
 
-	if (mem_parse_options(argc, argv, "bwls:x", &mode, &filename, NULL,
+	if (mem_parse_options(argc, argv, "bwlqs:x", &mode, &filename, NULL,
 			&swab) < 0)
 		return 1;
 
@@ -105,6 +105,7 @@ BAREBOX_CMD_HELP_TEXT("Options:")
 BAREBOX_CMD_HELP_OPT ("-b",  "byte access")
 BAREBOX_CMD_HELP_OPT ("-w",  "word access (16 bit)")
 BAREBOX_CMD_HELP_OPT ("-l",  "long access (32 bit)")
+BAREBOX_CMD_HELP_OPT ("-q",  "quad access (64 bit)")
 BAREBOX_CMD_HELP_OPT ("-s FILE",  "display file (default /dev/mem)")
 BAREBOX_CMD_HELP_OPT ("-x",       "swap bytes at output")
 BAREBOX_CMD_HELP_TEXT("")
-- 
2.1.4


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

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

* [PATCH 06/10] memcmp command: Add 64bit support
  2015-05-28 10:34 Add 64bit support to mem commands Sascha Hauer
                   ` (4 preceding siblings ...)
  2015-05-28 10:34 ` [PATCH 05/10] md command: Add 64bit support Sascha Hauer
@ 2015-05-28 10:34 ` Sascha Hauer
  2015-05-28 10:34 ` [PATCH 07/10] memcpy " Sascha Hauer
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2015-05-28 10:34 UTC (permalink / raw)
  To: Barebox List

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/memcmp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/commands/memcmp.c b/commands/memcmp.c
index d048150..e079d5f 100644
--- a/commands/memcmp.c
+++ b/commands/memcmp.c
@@ -49,7 +49,7 @@ static int do_memcmp(int argc, char *argv[])
 	int     offset = 0;
 	struct  stat statbuf;
 
-	if (mem_parse_options(argc, argv, "bwls:d:", &mode, &sourcefile,
+	if (mem_parse_options(argc, argv, "bwlqs:d:", &mode, &sourcefile,
 			&destfile, NULL) < 0)
 		return 1;
 
@@ -138,6 +138,7 @@ BAREBOX_CMD_HELP_TEXT("Options:")
 BAREBOX_CMD_HELP_OPT ("-b",  "byte access")
 BAREBOX_CMD_HELP_OPT ("-w",  "word access (16 bit)")
 BAREBOX_CMD_HELP_OPT ("-l",  "long access (32 bit)")
+BAREBOX_CMD_HELP_OPT ("-q",  "quad access (64 bit)")
 BAREBOX_CMD_HELP_OPT ("-s FILE", "source file (default /dev/mem)")
 BAREBOX_CMD_HELP_OPT ("-d FILE", "destination file (default /dev/mem)")
 BAREBOX_CMD_HELP_END
-- 
2.1.4


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

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

* [PATCH 07/10] memcpy command: Add 64bit support
  2015-05-28 10:34 Add 64bit support to mem commands Sascha Hauer
                   ` (5 preceding siblings ...)
  2015-05-28 10:34 ` [PATCH 06/10] memcmp " Sascha Hauer
@ 2015-05-28 10:34 ` Sascha Hauer
  2015-05-28 10:34 ` [PATCH 08/10] memset " Sascha Hauer
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2015-05-28 10:34 UTC (permalink / raw)
  To: Barebox List

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/memcpy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/commands/memcpy.c b/commands/memcpy.c
index 78716b1..9c8b645 100644
--- a/commands/memcpy.c
+++ b/commands/memcpy.c
@@ -47,7 +47,7 @@ static int do_memcpy(int argc, char *argv[])
 	struct stat statbuf;
 	int ret = 0;
 
-	if (mem_parse_options(argc, argv, "bwls:d:", &mode, &sourcefile,
+	if (mem_parse_options(argc, argv, "bwlqs:d:", &mode, &sourcefile,
 			&destfile, NULL) < 0)
 		return 1;
 
@@ -135,6 +135,7 @@ BAREBOX_CMD_HELP_TEXT("Options:")
 BAREBOX_CMD_HELP_OPT ("-b", "byte access")
 BAREBOX_CMD_HELP_OPT ("-w", "word access (16 bit)")
 BAREBOX_CMD_HELP_OPT ("-l", "long access (32 bit)")
+BAREBOX_CMD_HELP_OPT ("-q", "quad access (64 bit)")
 BAREBOX_CMD_HELP_OPT ("-s FILE", "source file (default /dev/mem)")
 BAREBOX_CMD_HELP_OPT ("-d FILE", "write file (default /dev/mem)")
 BAREBOX_CMD_HELP_END
-- 
2.1.4


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

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

* [PATCH 08/10] memset command: Add 64bit support
  2015-05-28 10:34 Add 64bit support to mem commands Sascha Hauer
                   ` (6 preceding siblings ...)
  2015-05-28 10:34 ` [PATCH 07/10] memcpy " Sascha Hauer
@ 2015-05-28 10:34 ` Sascha Hauer
  2015-05-28 10:34 ` [PATCH 09/10] mm " Sascha Hauer
  2015-05-28 10:34 ` [PATCH 10/10] mw " Sascha Hauer
  9 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2015-05-28 10:34 UTC (permalink / raw)
  To: Barebox List

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/memset.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/commands/memset.c b/commands/memset.c
index bb5f46d..fc5b659 100644
--- a/commands/memset.c
+++ b/commands/memset.c
@@ -44,7 +44,7 @@ static int do_memset(int argc, char *argv[])
 	int     ret = 1;
 	char	*file = "/dev/mem";
 
-	if (mem_parse_options(argc, argv, "bwld:", &mode, NULL, &file,
+	if (mem_parse_options(argc, argv, "bwlqd:", &mode, NULL, &file,
 			NULL) < 0)
 		return 1;
 
@@ -92,6 +92,7 @@ BAREBOX_CMD_HELP_TEXT("Options:")
 BAREBOX_CMD_HELP_OPT ("-b",  "byte access")
 BAREBOX_CMD_HELP_OPT ("-w",  "word access (16 bit)")
 BAREBOX_CMD_HELP_OPT ("-l",  "long access (32 bit)")
+BAREBOX_CMD_HELP_OPT ("-q",  "quad access (64 bit)")
 BAREBOX_CMD_HELP_OPT ("-d FILE",  "write file (default /dev/mem)")
 BAREBOX_CMD_HELP_END
 
-- 
2.1.4


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

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

* [PATCH 09/10] mm command: Add 64bit support
  2015-05-28 10:34 Add 64bit support to mem commands Sascha Hauer
                   ` (7 preceding siblings ...)
  2015-05-28 10:34 ` [PATCH 08/10] memset " Sascha Hauer
@ 2015-05-28 10:34 ` Sascha Hauer
  2015-05-28 10:34 ` [PATCH 10/10] mw " Sascha Hauer
  9 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2015-05-28 10:34 UTC (permalink / raw)
  To: Barebox List

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/mm.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/commands/mm.c b/commands/mm.c
index ff2e746..7c890a6 100644
--- a/commands/mm.c
+++ b/commands/mm.c
@@ -38,9 +38,10 @@ static int do_mem_mm(int argc, char *argv[])
 	u8 val8;
 	u16 val16;
 	u32 val32;
-	u32 value, mask;
+	u64 val64;
+	u64 value, mask;
 
-	if (mem_parse_options(argc, argv, "bwld:", &mode, NULL, &filename,
+	if (mem_parse_options(argc, argv, "bwlqd:", &mode, NULL, &filename,
 			&swab) < 0)
 		return 1;
 
@@ -48,8 +49,8 @@ static int do_mem_mm(int argc, char *argv[])
 		return COMMAND_ERROR_USAGE;
 
 	adr = strtoull_suffix(argv[optind++], NULL, 0);
-	value = simple_strtoul(argv[optind++], NULL, 0);
-	mask = simple_strtoul(argv[optind++], NULL, 0);
+	value = simple_strtoull(argv[optind++], NULL, 0);
+	mask = simple_strtoull(argv[optind++], NULL, 0);
 
 	fd = open_and_lseek(filename, mode | O_RDWR, adr);
 	if (fd < 0)
@@ -86,6 +87,16 @@ static int do_mem_mm(int argc, char *argv[])
 		if (ret < 0)
 			goto out_write;
 		break;
+	case O_RWSIZE_8:
+		if (ret < 0)
+			goto out_read;
+		ret = pread(fd, &val64, 8, adr);
+		val64 &= ~mask;
+		val64 |= (value & mask);
+		ret = pwrite(fd, &val64, 8, adr);
+		if (ret < 0)
+			goto out_write;
+		break;
 	}
 
 	close(fd);
@@ -110,6 +121,7 @@ BAREBOX_CMD_HELP_TEXT("Options:")
 BAREBOX_CMD_HELP_OPT ("-b",  "byte access")
 BAREBOX_CMD_HELP_OPT ("-w",  "word access (16 bit)")
 BAREBOX_CMD_HELP_OPT ("-l",  "long access (32 bit)")
+BAREBOX_CMD_HELP_OPT ("-q",  "quad access (64 bit)")
 BAREBOX_CMD_HELP_OPT ("-d FILE",  "write file (default /dev/mem)")
 BAREBOX_CMD_HELP_END
 
-- 
2.1.4


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

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

* [PATCH 10/10] mw command: Add 64bit support
  2015-05-28 10:34 Add 64bit support to mem commands Sascha Hauer
                   ` (8 preceding siblings ...)
  2015-05-28 10:34 ` [PATCH 09/10] mm " Sascha Hauer
@ 2015-05-28 10:34 ` Sascha Hauer
  9 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2015-05-28 10:34 UTC (permalink / raw)
  To: Barebox List

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/mw.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/commands/mw.c b/commands/mw.c
index f0384f6..8ca3c61 100644
--- a/commands/mw.c
+++ b/commands/mw.c
@@ -42,7 +42,7 @@ static int do_mem_mw(int argc, char *argv[])
 	loff_t adr;
 	int swab = 0;
 
-	if (mem_parse_options(argc, argv, "bwld:x", &mode, NULL, &filename,
+	if (mem_parse_options(argc, argv, "bwlqd:x", &mode, NULL, &filename,
 			&swab) < 0)
 		return 1;
 
@@ -59,6 +59,7 @@ static int do_mem_mw(int argc, char *argv[])
 		u8 val8;
 		u16 val16;
 		u32 val32;
+		u64 val64;
 		switch (mode) {
 		case O_RWSIZE_1:
 			val8 = simple_strtoul(argv[optind], NULL, 0);
@@ -76,6 +77,12 @@ static int do_mem_mw(int argc, char *argv[])
 				val32 = __swab32(val32);
 			ret = write(fd, &val32, 4);
 			break;
+		case O_RWSIZE_8:
+			val64 = simple_strtoull(argv[optind], NULL, 0);
+			if (swab)
+				val64 = __swab64(val64);
+			ret = write(fd, &val64, 8);
+			break;
 		}
 		if (ret < 0) {
 			perror("write");
@@ -97,6 +104,7 @@ BAREBOX_CMD_HELP_TEXT("Options:")
 BAREBOX_CMD_HELP_OPT ("-b",  "byte access")
 BAREBOX_CMD_HELP_OPT ("-w",  "word access (16 bit)")
 BAREBOX_CMD_HELP_OPT ("-l",  "long access (32 bit)")
+BAREBOX_CMD_HELP_OPT ("-q",  "quad access (64 bit)")
 BAREBOX_CMD_HELP_OPT ("-d FILE",  "write file (default /dev/mem)")
 BAREBOX_CMD_HELP_END
 
-- 
2.1.4


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

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

end of thread, other threads:[~2015-05-28 10:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-28 10:34 Add 64bit support to mem commands Sascha Hauer
2015-05-28 10:34 ` [PATCH 01/10] memory_display: Use consistent types Sascha Hauer
2015-05-28 10:34 ` [PATCH 02/10] memory_display: Add 64bit support Sascha Hauer
2015-05-28 10:34 ` [PATCH 03/10] fs: Add O_RWSIZE_8 Sascha Hauer
2015-05-28 10:34 ` [PATCH 04/10] mem commands: suppport parsing 'q' option Sascha Hauer
2015-05-28 10:34 ` [PATCH 05/10] md command: Add 64bit support Sascha Hauer
2015-05-28 10:34 ` [PATCH 06/10] memcmp " Sascha Hauer
2015-05-28 10:34 ` [PATCH 07/10] memcpy " Sascha Hauer
2015-05-28 10:34 ` [PATCH 08/10] memset " Sascha Hauer
2015-05-28 10:34 ` [PATCH 09/10] mm " Sascha Hauer
2015-05-28 10:34 ` [PATCH 10/10] mw " Sascha Hauer

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