Skip to contentSkip to conversation

reimplement memtest command

PATCH Applied Alexander Aring 2 participants 13 messages Jan 13, 2013 – Jan 14, 2013

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

cover reimplement memtest command

This patch series reimplement the memtest command.

Now it's support enable/disable caching on arm architecture and skip barebox regions.

In part of this patch series are the following changes:
- Fix missing include in meminfo.
- Fix some memory adresses issues.
- Make remap_range globally accessable.
- Add function to get cache/uncache pte flags.
- Add new section data which is between text and bss.
- Add function to check if address is in iomem regions of ram.

Alexander Aring (9):
meminfo: fix missing include
memory: fix size address calculation
meminfo: fix display of allocated addresses
arm-mmu: remove semicolon in arm mmu.c
mmu: make remap_range global accessable
memory: add function address_in_sdram_regions
barebox-data: add barebox-data sections
memtest: remove memtest command
memtest: add rewritten memtest command

 arch/arm/cpu/mmu.c                               |  18 +-
 arch/arm/include/asm/mmu.h                       |  17 +
 arch/arm/lib/barebox.lds.S                       |   6 +-
 arch/blackfin/boards/ipe337/barebox.lds.S        |   6 +-
 arch/blackfin/include/asm/mmu.h                  |  19 +
 arch/mips/include/asm/mmu.h                      |  19 +
 arch/mips/lib/barebox.lds.S                      |   5 +-
 arch/nios2/cpu/barebox.lds.S                     |   5 +-
 arch/nios2/include/asm/mmu.h                     |  19 +
 arch/openrisc/include/asm/mmu.h                  |  19 +
 arch/ppc/boards/freescale-p2020rdb/barebox.lds.S |   6 +-
 arch/ppc/boards/pcm030/barebox.lds.S             |   5 +-
 arch/ppc/include/asm/mmu.h                       |  15 +
 arch/sandbox/include/asm/mmu.h                   |  19 +
 arch/x86/include/asm/mmu.h                       |  19 +
 arch/x86/lib/barebox.lds.S                       |   5 +-
 commands/Kconfig                                 |  16 +-
 commands/Makefile                                |   2 +-
 commands/memtest.c                               | 895 ++++++++++++++++-------
 common/meminfo.c                                 |   7 +-
 common/memory.c                                  |  21 +-
 include/asm-generic/sections.h                   |   1 +
 include/common.h                                 |   2 +
 include/memory.h                                 |   6 +
 24 files changed, 850 insertions(+), 302 deletions(-)
 create mode 100644 arch/blackfin/include/asm/mmu.h
 create mode 100644 arch/mips/include/asm/mmu.h
 create mode 100644 arch/nios2/include/asm/mmu.h
 create mode 100644 arch/openrisc/include/asm/mmu.h
 create mode 100644 arch/sandbox/include/asm/mmu.h
 create mode 100644 arch/x86/include/asm/mmu.h
Signature · 7 lines
1.8.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH 1/9 meminfo: fix missing include

Fix include for linkerscript variables like _etext. Otherwise build with #define DEBUG will fail.

---
 common/meminfo.c | 1 +
 1 file changed, 1 insertion(+)
common/meminfo.c +1 -0
index 06fce5a..a7c515f 100644
@@ -2,6 +2,7 @@
 #include <init.h>
 #include <memory.h>
 #include <asm-generic/memory_layout.h>
+#include <asm-generic/sections.h>
 
 static int display_meminfo(void)
 {
Signature · 7 lines
1.8.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 2/9 memory: fix size address calculation

In reply to Alexander Aring

Fix size address calculation.

Global variables from <asm/sections.h> which are defined in linker script *.lds files for end addresses has already a +1 calculation.

For example:
stext = 0x100 with a size about 0x50 will result a etext = 0x150. In this case a correct size calculation is (etext - stext) = 0x50.

In function 'request_sdram_region' the end address will be calculated with (start + size - 1) which result a correct end address of 0x149 in this example.

---
 common/memory.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/memory.c +2 -2
index 2674002..7dd1384 100644
@@ -74,11 +74,11 @@ static int mem_malloc_resource(void)
 	request_sdram_region("barebox",
 			(unsigned long)&_stext,
 			(unsigned long)&_etext -
-			(unsigned long)&_stext + 1);
+			(unsigned long)&_stext);
 	request_sdram_region("bss",
 			(unsigned long)&__bss_start,
 			(unsigned long)&__bss_stop -
-			(unsigned long)&__bss_start + 1);
+			(unsigned long)&__bss_start);
 #ifdef STACK_BASE
 	request_sdram_region("stack", STACK_BASE, STACK_SIZE);
 #endif
Signature · 7 lines
1.8.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH 3/9 meminfo: fix display of allocated addresses

In reply to Alexander Aring

Fix display to stdout of allocated addresses.

---
 common/meminfo.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
common/meminfo.c +3 -3
index a7c515f..a09b2d2 100644
@@ -10,13 +10,13 @@ static int display_meminfo(void)
 	ulong mend   = mem_malloc_end();
 	ulong msize  = mend - mstart + 1;
 
-	debug("barebox code: 0x%p -> 0x%p\n", _stext, _etext);
-	debug("bss segment:  0x%p -> 0x%p\n", __bss_start, __bss_stop);
+	debug("barebox code: 0x%p -> 0x%p\n", _stext, _etext - 1);
+	debug("bss segment:  0x%p -> 0x%p\n", __bss_start, __bss_stop - 1);
 	printf("malloc space: 0x%08lx -> 0x%08lx (size %s)\n",
 		mstart, mend, size_human_readable(msize));
 #ifdef CONFIG_ARM
 	printf("stack space:  0x%08x -> 0x%08x (size %s)\n",
-		STACK_BASE, STACK_BASE + STACK_SIZE,
+		STACK_BASE, STACK_BASE + STACK_SIZE - 1,
 		size_human_readable(STACK_SIZE));
 #endif
 	return 0;
Signature · 7 lines
1.8.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH 4/9 arm-mmu: remove semicolon in arm mmu.c

In reply to Alexander Aring

Remove semicolon in PAGE_ALIGN macro.

---
 arch/arm/cpu/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/cpu/mmu.c +1 -1
index 068e0ea..40b7ec4 100644
@@ -294,7 +294,7 @@ void mmu_disable(void)
 	__mmu_cache_off();
 }
 
-#define PAGE_ALIGN(s) ((s) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1);
+#define PAGE_ALIGN(s) (((s) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
 
 void *dma_alloc_coherent(size_t size)
 {
Signature · 7 lines
1.8.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

PATCH 5/9 mmu: make remap_range global accessable

In reply to Alexander Aring

There is only one implementation of 'remap_range' in arm architecture. Added dummy function for others architectures.

Added new function 'mmu_get_pte_cached_flags' and 'mmu_get_pte_uncached_flags' to get pte flags for caching and uncaching pages.

These flags are in arm architecture configured at runtime. Others architectures will return 0, which don't have a mmu implementation for this.

Also moved PAGE_ALIGN and add PAGE_ALIGN_DOWN macros to common.h.

---
 arch/arm/cpu/mmu.c              | 18 +++++++++++++++---
 arch/arm/include/asm/mmu.h      | 17 +++++++++++++++++
 arch/blackfin/include/asm/mmu.h | 19 +++++++++++++++++++
 arch/mips/include/asm/mmu.h     | 19 +++++++++++++++++++
 arch/nios2/include/asm/mmu.h    | 19 +++++++++++++++++++
 arch/openrisc/include/asm/mmu.h | 19 +++++++++++++++++++
 arch/ppc/include/asm/mmu.h      | 15 +++++++++++++++
 arch/sandbox/include/asm/mmu.h  | 19 +++++++++++++++++++
 arch/x86/include/asm/mmu.h      | 19 +++++++++++++++++++
 include/common.h                |  2 ++
 10 files changed, 163 insertions(+), 3 deletions(-)
 create mode 100644 arch/blackfin/include/asm/mmu.h
 create mode 100644 arch/mips/include/asm/mmu.h
 create mode 100644 arch/nios2/include/asm/mmu.h
 create mode 100644 arch/openrisc/include/asm/mmu.h
 create mode 100644 arch/sandbox/include/asm/mmu.h
 create mode 100644 arch/x86/include/asm/mmu.h
arch/arm/cpu/mmu.c +15 -3
index 40b7ec4..50112d2 100644
@@ -52,9 +52,23 @@ 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
 
+/*
+ * PTE flags to set cached and uncached areas.
+ * This will be determined at runtime.
+ */
 static uint32_t PTE_FLAGS_CACHED;
 static uint32_t PTE_FLAGS_UNCACHED;
 
+uint32_t mmu_get_pte_cached_flags()
+{
+	return PTE_FLAGS_CACHED;
+}
+
+uint32_t mmu_get_pte_uncached_flags()
+{
+	return PTE_FLAGS_UNCACHED;
+}
+
 #define PTE_MASK ((1 << 12) - 1)
 
 /*
@@ -93,7 +107,7 @@ static u32 *find_pte(unsigned long adr)
 	return &table[(adr >> PAGE_SHIFT) & 0xff];
 }
 
-static void remap_range(void *_start, size_t size, uint32_t flags)
+void remap_range(void *_start, size_t size, uint32_t flags)
 {
 	unsigned long start = (unsigned long)_start;
 	u32 *p;
@@ -294,8 +308,6 @@ void mmu_disable(void)
 	__mmu_cache_off();
 }
 
-#define PAGE_ALIGN(s) (((s) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
-
 void *dma_alloc_coherent(size_t size)
 {
 	void *ret;
arch/arm/include/asm/mmu.h +17 -0
index a66da8c..f32cea6 100644
@@ -41,7 +41,10 @@ void dma_flush_range(unsigned long, unsigned long);
 void dma_inv_range(unsigned long, unsigned long);
 unsigned long virt_to_phys(void *virt);
 void *phys_to_virt(unsigned long phys);
+void remap_range(void *_start, size_t size, uint32_t flags);
 void *map_io_sections(unsigned long physaddr, void *start, size_t size);
+uint32_t mmu_get_pte_cached_flags(void);
+uint32_t mmu_get_pte_uncached_flags(void);
 
 #else
 static inline void *dma_alloc_coherent(size_t size)
@@ -76,11 +79,25 @@ static inline void dma_inv_range(unsigned long s, unsigned long e)
 {
 }
 
+static inline void remap_range(void *_start, size_t size, uint32_t flags)
+{
+}
+
 static inline void *map_io_sections(unsigned long phys, void *start, size_t size)
 {
 	return (void *)phys;
 }
 
+static inline uint32_t mmu_get_pte_cached_flags(void)
+{
+	return 0;
+}
+
+static inline uint32_t mmu_get_pte_uncached_flags(void)
+{
+	return 0;
+}
+
 #endif
 
 #ifdef CONFIG_CACHE_L2X0
arch/blackfin/include/asm/mmu.h new file +19 -0
new file mode 100644
index 0000000..71f671f
@@ -0,0 +1,19 @@
+#ifndef __ASM_MMU_H
+#define __ASM_MMU_H
+
+static inline void remap_range(void *_start, size_t size, uint32_t flags)
+{
+}
+
+static inline uint32_t mmu_get_pte_cached_flags(void)
+{
+	    return 0;
+}
+
+static inline uint32_t mmu_get_pte_uncached_flags(void)
+{
+	    return 0;
+}
+
+#endif /* __ASM_MMU_H */
+
arch/mips/include/asm/mmu.h new file +19 -0
new file mode 100644
index 0000000..71f671f
@@ -0,0 +1,19 @@
+#ifndef __ASM_MMU_H
+#define __ASM_MMU_H
+
+static inline void remap_range(void *_start, size_t size, uint32_t flags)
+{
+}
+
+static inline uint32_t mmu_get_pte_cached_flags(void)
+{
+	    return 0;
+}
+
+static inline uint32_t mmu_get_pte_uncached_flags(void)
+{
+	    return 0;
+}
+
+#endif /* __ASM_MMU_H */
+
arch/nios2/include/asm/mmu.h new file +19 -0
new file mode 100644
index 0000000..71f671f
@@ -0,0 +1,19 @@
+#ifndef __ASM_MMU_H
+#define __ASM_MMU_H
+
+static inline void remap_range(void *_start, size_t size, uint32_t flags)
+{
+}
+
+static inline uint32_t mmu_get_pte_cached_flags(void)
+{
+	    return 0;
+}
+
+static inline uint32_t mmu_get_pte_uncached_flags(void)
+{
+	    return 0;
+}
+
+#endif /* __ASM_MMU_H */
+
arch/openrisc/include/asm/mmu.h new file +19 -0
new file mode 100644
index 0000000..71f671f
@@ -0,0 +1,19 @@
+#ifndef __ASM_MMU_H
+#define __ASM_MMU_H
+
+static inline void remap_range(void *_start, size_t size, uint32_t flags)
+{
+}
+
+static inline uint32_t mmu_get_pte_cached_flags(void)
+{
+	    return 0;
+}
+
+static inline uint32_t mmu_get_pte_uncached_flags(void)
+{
+	    return 0;
+}
+
+#endif /* __ASM_MMU_H */
+
arch/ppc/include/asm/mmu.h +15 -0
index b2dd0b7..799653a 100644
@@ -540,4 +540,19 @@ extern int write_bat(ppc_bat_t bat, unsigned long upper, unsigned long lower);
 					(rt<<21)|(ra<<16)|(ws<<11)|(946<<1)
 
 #endif
+
+static inline void remap_range(void *_start, size_t size, uint32_t flags)
+{
+}
+
+static inline uint32_t mmu_get_pte_cached_flags(void)
+{
+	    return 0;
+}
+
+static inline uint32_t mmu_get_pte_uncached_flags(void)
+{
+	    return 0;
+}
+
 #endif /* _PPC_MMU_H_ */
arch/sandbox/include/asm/mmu.h new file +19 -0
new file mode 100644
index 0000000..71f671f
@@ -0,0 +1,19 @@
+#ifndef __ASM_MMU_H
+#define __ASM_MMU_H
+
+static inline void remap_range(void *_start, size_t size, uint32_t flags)
+{
+}
+
+static inline uint32_t mmu_get_pte_cached_flags(void)
+{
+	    return 0;
+}
+
+static inline uint32_t mmu_get_pte_uncached_flags(void)
+{
+	    return 0;
+}
+
+#endif /* __ASM_MMU_H */
+
arch/x86/include/asm/mmu.h new file +19 -0
new file mode 100644
index 0000000..71f671f
@@ -0,0 +1,19 @@
+#ifndef __ASM_MMU_H
+#define __ASM_MMU_H
+
+static inline void remap_range(void *_start, size_t size, uint32_t flags)
+{
+}
+
+static inline uint32_t mmu_get_pte_cached_flags(void)
+{
+	    return 0;
+}
+
+static inline uint32_t mmu_get_pte_uncached_flags(void)
+{
+	    return 0;
+}
+
+#endif /* __ASM_MMU_H */
+
include/common.h +2 -0
index b1c96de..3e67164 100644
@@ -225,6 +225,8 @@ int run_shell(void);
 
 #define PAGE_SIZE	4096
 #define PAGE_SHIFT	12
+#define PAGE_ALIGN(s) (((s) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
+#define PAGE_ALIGN_DOWN(x) ((x) & ~(PAGE_SIZE - 1))
 
 int memory_display(char *addr, loff_t offs, ulong nbytes, int size, int swab);
 
Signature · 7 lines
1.8.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw

PATCH 6/9 memory: add function address_in_sdram_regions

In reply to Alexander Aring

Add function address_in_sdram_regions to check if a address is in any sdram region.

---
 common/memory.c  | 13 +++++++++++++
 include/memory.h |  6 ++++++
 2 files changed, 19 insertions(+)
common/memory.c +13 -0
index 7dd1384..24dd0dd 100644
@@ -158,6 +158,19 @@ int release_sdram_region(struct resource *res)
 	return release_region(res);
 }
 
+int address_in_sdram_regions(resource_size_t address)
+{
+	struct memory_bank *bank = NULL;
+	struct resource *r = NULL;
+
+	for_each_memory_bank(bank)
+		list_for_each_entry(r, &bank->res->children, sibling)
+			if (ADDRESS_IN_REGIONS(address, r->start, r->end))
+				return 1;
+
+	return 0;
+}
+
 #ifdef CONFIG_OFTREE
 
 /*
include/memory.h +6 -0
index 165d2dc..e12a28d 100644
@@ -27,4 +27,10 @@ struct resource *request_sdram_region(const char *name, resource_size_t start,
 		resource_size_t size);
 int release_sdram_region(struct resource *res);
 
+#define ADDRESS_IN_REGIONS(address, region_start, region_end) \
+	((address >= region_start) && \
+	 (address <= region_end))
+
+int address_in_sdram_regions(resource_size_t address);
+
 #endif
Signature · 7 lines
1.8.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#7 lore raw

PATCH 7/9 barebox-data: add barebox-data sections

In reply to Alexander Aring

Add barebox-data section in arm branch to get complete barebox regions in sdram regions tree.

---
 arch/arm/lib/barebox.lds.S                       | 6 +++++-
 arch/blackfin/boards/ipe337/barebox.lds.S        | 6 +++++-
 arch/mips/lib/barebox.lds.S                      | 5 ++++-
 arch/nios2/cpu/barebox.lds.S                     | 5 +++--
 arch/ppc/boards/freescale-p2020rdb/barebox.lds.S | 6 ++++--
 arch/ppc/boards/pcm030/barebox.lds.S             | 5 +++--
 arch/x86/lib/barebox.lds.S                       | 5 ++++-
 common/memory.c                                  | 4 ++++
 include/asm-generic/sections.h                   | 1 +
 9 files changed, 33 insertions(+), 10 deletions(-)
arch/arm/lib/barebox.lds.S +5 -1
index bac1a04..6cad804 100644
@@ -65,7 +65,9 @@ SECTIONS
 		__stop_unwind_tab = .;
 	}
 #endif
-	_etext = .;			/* End of text and rodata section */
+	_etext = . - 1;			/* End of text and rodata section */
+
+	_sdata = .;
 
 	. = ALIGN(4);
 	.data : { *(.data*) }
@@ -87,6 +89,8 @@ SECTIONS
 	__usymtab : { BAREBOX_SYMS }
 	__usymtab_end = .;
 
+	_edata = . - 1;
+
 	. = ALIGN(4);
 	__bss_start = .;
 	.bss : { *(.bss*) }
arch/blackfin/boards/ipe337/barebox.lds.S +5 -1
index 6a07b43..29f5d9e 100644
@@ -54,7 +54,9 @@ SECTIONS
 	. = ALIGN(4);
 	.rodata : { *(.rodata) }
 
-	__etext = .;			/* End of text and rodata section */
+	__etext = . - 1;	/* End of text and rodata section */
+
+	_sdata = .;
 
 	. = ALIGN(4);
 	.data : { *(.data) }
@@ -79,6 +81,8 @@ SECTIONS
 	__usymtab : { BAREBOX_SYMS }
 	___usymtab_end = .;
 
+	_edata - . -1;
+
 	. = ALIGN(4);
 	___bss_start = .;
 	.bss : { *(.bss) }
arch/mips/lib/barebox.lds.S +4 -1
index 0cbf2d7..6f05513 100644
@@ -43,7 +43,8 @@ SECTIONS
 	. = ALIGN(4);
 	.rodata : { *(.rodata*) }
 
-	_etext = .;			/* End of text and rodata section */
+	_etext = . - 1;			/* End of text and rodata section */
+	_sdata = .;
 
 	. = ALIGN(4);
 	.data : { *(.data*) }
@@ -68,6 +69,8 @@ SECTIONS
 	__usymtab : { BAREBOX_SYMS }
 	__usymtab_end = .;
 
+	_edata = . - 1;
+
 	. = ALIGN(4);
 	__bss_start = .;
 	.bss : { *(.bss*) }
arch/nios2/cpu/barebox.lds.S +3 -2
index af7be4d..ac4cc8a 100644
@@ -67,13 +67,14 @@ SECTIONS
 	__usymtab : { BAREBOX_SYMS }
 	___usymtab_end = .;
 
-	_etext = .; /* End of text and rodata section */
+	_etext = . - 1; /* End of text and rodata section */
 
 	/* INIT DATA sections - "Small" data (see the gcc -G option)
 	 * is always gp-relative. Here we make all init data sections
 	 * adjacent to simplify the startup code -- and provide
 	 * the global pointer for gp-relative access.
 	 */
+	_sdata = .;
 	_data = .;
 	.data :
 	{
@@ -94,7 +95,7 @@ SECTIONS
 	}
 	. = ALIGN(4);
 
-	_edata = .;
+	_edata = . - 1;
 	PROVIDE (edata = .);
 
 	/* UNINIT DATA - Small uninitialized data is first so it's
arch/ppc/boards/freescale-p2020rdb/barebox.lds.S +4 -2
index 95033d4..e9b0679 100644
@@ -39,7 +39,9 @@ SECTIONS
     *(.text*)
   } :text
 
-  _etext = .;
+  _etext = . - 1;
+
+  _sdata = .;
   PROVIDE (etext = .);
 
   .rodata    :
@@ -74,7 +76,7 @@ SECTIONS
     *(.dynamic*)
     CONSTRUCTORS
   }
-  _edata  =  .;
+  _edata  =  . - 1;
   PROVIDE (edata = .);
 
   . = .;
arch/ppc/boards/pcm030/barebox.lds.S +3 -2
index cc86d82..bfc646b 100644
@@ -67,7 +67,8 @@ SECTIONS
 
   /* Read-write section, merged into data segment: */
   . = (. + 0x0FFF) & 0xFFFFF000;
-  _etext = .;
+  _etext = . - 1;
+  _sdata = .;
   PROVIDE (erotext = .);
   .reloc   :
   {
@@ -90,7 +91,7 @@ SECTIONS
     *(.dynamic*)
     CONSTRUCTORS
   }
-  _edata  =  .;
+  _edata  =  . - 1;
   PROVIDE (edata = .);
 
   . = .;
arch/x86/lib/barebox.lds.S +4 -1
index 8bd2a7b..5826fb2 100644
@@ -149,7 +149,8 @@ SECTIONS
 		. = ALIGN(4);
 		*(.rodata*)
 		. = ALIGN(4);
-		_etext = .;			/* End of text and rodata section */
+		_etext = . - 1;	/* End of text and rodata section */
+		_sdata = .;
 	} > barebox
 	BAREBOX_BARE_INIT_SIZE
 
@@ -191,6 +192,8 @@ SECTIONS
 		. = ALIGN(4);
 	} > barebox
 
+	_edata = . - 1;
+
 	.bss : {
 		__bss_start = .;
 		*(.bss*);
common/memory.c +4 -0
index 24dd0dd..1748d78 100644
@@ -75,6 +75,10 @@ static int mem_malloc_resource(void)
 			(unsigned long)&_stext,
 			(unsigned long)&_etext -
 			(unsigned long)&_stext);
+	request_sdram_region("barebox data",
+			(unsigned long)&_sdata,
+			(unsigned long)&_edata -
+			(unsigned long)&_sdata);
 	request_sdram_region("bss",
 			(unsigned long)&__bss_start,
 			(unsigned long)&__bss_stop -
include/asm-generic/sections.h +1 -0
index 17d5fd1..5492aa4 100644
@@ -3,6 +3,7 @@
 
 extern char _text[], _stext[], _etext[];
 extern char __bss_start[], __bss_stop[];
+extern char _sdata[], _edata[];
 extern char __bare_init_start[], __bare_init_end[];
 extern char _end[];
 extern void *_barebox_image_size;
Signature · 7 lines
1.8.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#8 lore raw

Re: [PATCH 7/9] barebox-data: add barebox-data sections

Quoted 21 lines · Alexander Aring

Add barebox-data section in arm branch to get complete barebox regions in sdram regions tree.

---
 arch/arm/lib/barebox.lds.S                       | 6 +++++-
 arch/blackfin/boards/ipe337/barebox.lds.S        | 6 +++++-
 arch/mips/lib/barebox.lds.S                      | 5 ++++-
 arch/nios2/cpu/barebox.lds.S                     | 5 +++--
 arch/ppc/boards/freescale-p2020rdb/barebox.lds.S | 6 ++++--
 arch/ppc/boards/pcm030/barebox.lds.S             | 5 +++--
 arch/x86/lib/barebox.lds.S                       | 5 ++++-
 common/memory.c                                  | 4 ++++
 include/asm-generic/sections.h                   | 1 +
 9 files changed, 33 insertions(+), 10 deletions(-)
arch/arm/lib/barebox.lds.S +0 -0
index bac1a04..6cad804 100644

arch/arm/lib/barebox.lds.S SECTIONS · line 68

Quoted 5 lines
arch/arm/lib/barebox.lds.S +1 -1
@@ -65,7 +65,9 @@ SECTIONS
 		__stop_unwind_tab = .;
 	}
 #endif
-	_etext = .;			/* End of text and rodata section */
+	_etext = . - 1;			/* End of text and rodata section */

Is this correct? In 2/9 you explained that etext points to the next free memory location rather than to the last byte in the text segment. 2/9 fixes the request_sdram_region call accordingly. Now it is changed to be the last byte of the text segment?

arch/arm/lib/barebox.lds.S SECTIONS · line 92

Quoted 10 lines
arch/arm/lib/barebox.lds.S +3 -0
+
+	_sdata = .;
 
 	. = ALIGN(4);
 	.data : { *(.data*) }
@@ -87,6 +89,8 @@ SECTIONS
 	__usymtab : { BAREBOX_SYMS }
 	__usymtab_end = .;
 
+	_edata = . - 1;

Should probably also be _edata = .;

Sascha

Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#9 lore raw

Re: [PATCH 7/9] barebox-data: add barebox-data sections

Hi,

You are right! Sry, about that.
I checked both values for regions overlapping with iomem. Both doesn't overlapped(because align) but etext = .; is right. Otherwise (for example in arm) "barebox" region is placed a little bit in "barebox-data" region.

I draw a little graphics(some time ago) to demonstrate which variable from which managment structure calc with 'inclusive' or 'exclusive' byte for end-address. I attach them to this mail.

2013/1/14 Sascha Hauer <[email protected]>

Quoted 48 lines · Alexander Aring
Quoted 21 lines

Add barebox-data section in arm branch to get complete barebox regions in sdram regions tree.

---
 arch/arm/lib/barebox.lds.S                       | 6 +++++-
 arch/blackfin/boards/ipe337/barebox.lds.S        | 6 +++++-
 arch/mips/lib/barebox.lds.S                      | 5 ++++-
 arch/nios2/cpu/barebox.lds.S                     | 5 +++--
 arch/ppc/boards/freescale-p2020rdb/barebox.lds.S | 6 ++++--
 arch/ppc/boards/pcm030/barebox.lds.S             | 5 +++--
 arch/x86/lib/barebox.lds.S                       | 5 ++++-
 common/memory.c                                  | 4 ++++
 include/asm-generic/sections.h                   | 1 +
 9 files changed, 33 insertions(+), 10 deletions(-)
arch/arm/lib/barebox.lds.S +0 -0
index bac1a04..6cad804 100644

arch/arm/lib/barebox.lds.S SECTIONS · line 68

Quoted 4 lines
arch/arm/lib/barebox.lds.S +0 -1
@@ -65,7 +65,9 @@ SECTIONS
              __stop_unwind_tab = .;
      }
 #endif
-     _etext = .;                     /* End of text and rodata section

*/

arch/arm/lib/barebox.lds.S SECTIONS · line 68

Quoted 1 line
arch/arm/lib/barebox.lds.S +1 -0
+     _etext = . - 1;                 /* End of text and rodata section

*/

Is this correct? In 2/9 you explained that etext points to the next free memory location rather than to the last byte in the text segment. 2/9 fixes the request_sdram_region call accordingly. Now it is changed to be the last byte of the text segment?

arch/arm/lib/barebox.lds.S SECTIONS · line 92

Quoted 10 lines
arch/arm/lib/barebox.lds.S +3 -0
+
+     _sdata = .;
 
      . = ALIGN(4);
      .data : { *(.data*) }
@@ -87,6 +89,8 @@ SECTIONS
      __usymtab : { BAREBOX_SYMS }
      __usymtab_end = .;
 
+     _edata = . - 1;

Should probably also be _edata = .;

Quoted 9 lines

Sascha

--

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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#10 lore raw

PATCH 8/9 memtest: remove memtest command

In reply to Alexander Aring

Remove memtest command.

---
 commands/Kconfig   |   9 --
 commands/Makefile  |   1 -
 commands/memtest.c | 351 -----------------------------------------------------
 3 files changed, 361 deletions(-)
 delete mode 100644 commands/memtest.c
commands/Kconfig +0 -9
index 53cee5c..fc0e448 100644
@@ -496,15 +496,6 @@ config CMD_NANDTEST
 	select PARTITION_NEED_MTD
 	prompt "nandtest"
 
-config CMD_MTEST
-	tristate
-	prompt "mtest"
-
-config CMD_MTEST_ALTERNATIVE
-	bool
-	depends on CMD_MTEST
-	prompt "alternative mtest implementation"
-
 endmenu
 
 menu "video command"
commands/Makefile +0 -1
index 359f566..3145685 100644
@@ -7,7 +7,6 @@ obj-$(CONFIG_CMD_LOADY)		+= loadxy.o
 obj-$(CONFIG_CMD_LOADS)		+= loads.o
 obj-$(CONFIG_CMD_ECHO)		+= echo.o
 obj-$(CONFIG_CMD_MEMORY)	+= mem.o
-obj-$(CONFIG_CMD_MTEST)		+= memtest.o
 obj-$(CONFIG_CMD_EDIT)		+= edit.o
 obj-$(CONFIG_CMD_EXEC)		+= exec.o
 obj-$(CONFIG_CMD_SLEEP)		+= sleep.o
commands/memtest.c deleted +0 -351

351 lines not on this page · raw message

Signature · 7 lines
1.8.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#11 lore raw

PATCH 9/9 memtest: add rewritten memtest command

In reply to Alexander Aring

Rewrite memtest command:
- Skip barebox sdram regions.
- Uncache unused mem regions while testing.
- Add iteration parameter.
- Add parameter to do only bus testing.
- Check start and end addresses.
- Testing all banks if no start and end address are given.

- Add sha changes (thanks):
- fix calculation of regions to test. When we use PAGE_ALIGN on size, size can be to high.
- start address has to be aligned up
- end address has to be aligned down
- then size can be calculated as end - start + 1
- Add ctrlc() to the longer loops
- Add a progress bar to give some visual feedback that something issues
still going on.

- Change to use end element instead of size in region struct.
- Fix some newline issues.

- Add '-c' parameter if CONFIG_MMU enabled to test with enabled cache.
- Fix some size calculation.
- set start address to 0xffffffff

---
 commands/Kconfig   |   9 +
 commands/Makefile  |   1 +
 commands/memtest.c | 696 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 706 insertions(+)
 create mode 100644 commands/memtest.c
commands/Kconfig +9 -0
index fc0e448..f027a7e 100644
@@ -496,6 +496,15 @@ config CMD_NANDTEST
 	select PARTITION_NEED_MTD
 	prompt "nandtest"
 
+config CMD_MEMTEST
+    tristate
+    prompt "memtest"
+	help
+	  This command enables a memtest to test installed memory.
+	  During this test allocated iomem regions will be skipped.
+	  If tested architecture has MMU with PTE flags support,
+	  caching can be set enabled or disabled.
+
 endmenu
 
 menu "video command"
commands/Makefile +1 -0
index 3145685..6b4d9cb 100644
@@ -7,6 +7,7 @@ obj-$(CONFIG_CMD_LOADY)		+= loadxy.o
 obj-$(CONFIG_CMD_LOADS)		+= loads.o
 obj-$(CONFIG_CMD_ECHO)		+= echo.o
 obj-$(CONFIG_CMD_MEMORY)	+= mem.o
+obj-$(CONFIG_CMD_MEMTEST)   += memtest.o
 obj-$(CONFIG_CMD_EDIT)		+= edit.o
 obj-$(CONFIG_CMD_EXEC)		+= exec.o
 obj-$(CONFIG_CMD_SLEEP)		+= sleep.o
commands/memtest.c new file +696 -0

696 lines not on this page · raw message

Signature · 7 lines
1.8.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#12 lore raw
In reply to Alexander Aring

Hi Alexander,

Quoted 14 lines · Alexander Aring

This patch series reimplement the memtest command.

Now it's support enable/disable caching on arm architecture and skip barebox regions.

In part of this patch series are the following changes:
- Fix missing include in meminfo.
- Fix some memory adresses issues.
- Make remap_range globally accessable.
- Add function to get cache/uncache pte flags.
- Add new section data which is between text and bss.
- Add function to check if address is in iomem regions of ram.

Quoted 5 lines

Alexander Aring (9):
meminfo: fix missing include
memory: fix size address calculation
meminfo: fix display of allocated addresses
arm-mmu: remove semicolon in arm mmu.c

I applied up to 4/9 to master for now.

Sascha

Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox