summaryrefslogtreecommitdiffstats
path: root/common/memtest.c
Commit message (Collapse)AuthorAgeFilesLines
* memtest: Make use of resource_size()Andrey Smirnov2018-09-191-2/+2
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memtest: Adjust code for 64-bit architecturesAndrey Smirnov2018-09-191-15/+20
| | | | | | | | | Make use of %pa specifier to avoid warnings when building against 64-bit CPU (specifically AArch64) as well as adjust a number of patterns to be 64-bits wide. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memtest: fix list iteration in region setupSteffen Trumtrar2017-09-201-1/+1
| | | | | | | | | | | | | | | | | | | | When memory regions start at 0, the current mem_test_request_regions function wrongly assumes that struct resource *r points at the correct region. It points to the first region however (which starts at 0). The comment states, that the code starts from the second entry. In include/linux/list.h the macro documentation however says: list_for_each_entry_from - iterate over list of given type from the current point The correct list iteration macro to use here is list_for_each_entry_continue, where the documentation says: Continue to iterate over list of given type, continuing after the current position. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Revert "memtest: move error handling to end of function"Sascha Hauer2015-12-041-17/+20
| | | | | | | | While this simplifies the code as is I got the request to continue on errors in memtest, which can be better implemented when the messages are printed inline and not at the end of the function. This reverts commit 4ff9e28abc2e31dabde6d71503219b3e50d9f4e3.
* memtest: By default only test biggest regionSascha Hauer2015-11-041-0/+16
| | | | | | | | | Often enough the biggest free region spans most free RAM, so it doesn't add much value to test the remaining free regions. This patch changes the default behaviour to only test the biggest free region and adds the -t option to test all regions. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memtest: move error handling to end of functionSascha Hauer2015-11-041-20/+17
| | | | | | | Move error handling out of the test code to make the actual test better visible. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memtest: move ctrlc check / progress showing into separate functionSascha Hauer2015-11-041-16/+24
| | | | | | To make the actual test a bit better visible in the code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memtest: Make comments single line when appropriateSascha Hauer2015-11-031-16/+5
| | | | | | | Make the comments single line when they fit into a single line to make the code a bit shorter. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memtest: Make output more compactSascha Hauer2015-11-031-13/+7
| | | | | | | | Especially when called multiple times the output of the memory test is quite verbose. Make it more compact by only describing once what is being done and only use one progress bare instead of three. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memtest: split tests in separate functionsSascha Hauer2015-11-031-35/+1
| | | | | | | | The memtest does a bus integrity check and a moving inversions test. Split the tests into two separate functions so that the can be called separately. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rework remap_rangeSascha Hauer2015-11-031-3/+2
| | | | | | | | | | | | | | | | | | remap_range is for remapping regions with different cache attributes. It is implemented for ARM and PowerPC only, the other architectures only provide stubs. Currently the new cache attributes are passed in an architecture specific way and the attributes have to be retrieved by calls to mmu_get_pte_cached_flags() and mmu_get_pte_uncached_flags(). Make this simpler by providing architecture independent flags which can be directly passed to remap_range() Also provide a MAP_ARCH_DEFAULT flag and a arch_can_remap() function. The MAP_ARCH_DEFAULT defaults to whatever caching type the architecture has as default. the arch_can_remap() function returns true if the architecture can change the cache attributes, false otherwise. This allows the memtest code to better find out what it has to do. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memtest: move request/release regions to common/Sascha Hauer2015-10-271-0/+112
| | | | | | | | Normally code providing a feature should be implemented in common/ which is then called from the command code. Follow this rule and move some more of the memtest code to common/. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common/memtest.c: Distil common error reporting codeAndrey Smirnov2015-05-151-25/+28
| | | | | | | | | Move all of the common code for error message output into a new function mem_test_report_failure() and convert the rest of the code to use it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common/memtest.c: Refactor mem_test() into three surbroutinesAndrey Smirnov2015-05-151-37/+68
| | | | | | | | | | Original mem_test() was rather long an contained code to perform two distinct operations. This patch moves that code into two separate subroutines and converts mem_test into a high level interface that calls the subroutines. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common/memtest.c: Do not omit offset of 0 from testsAndrey Smirnov2015-05-151-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | Ommiting offset 0 from address line tests allows certain corner cases of faults to be undetected. For the "stuck high" case, consider scenario in which all of the tested address lines are stuck high. In original code first data filling loop would execute writing data to a single cell multiple times and second loop would just read data from that cell over and over again. Adding a write to start[0] should prevent this since it would cause the second loop to read incorrect data on its first iteration. For the "stuck low" case, having any of the tested bits of the address shorted would effectively "remap" that memory cell to start[0] in this case excluding start[0] during the verification phase would result in a false positive result. Note that both of the changes are present in Michael Barr's code here: http://www.esacademy.com/en/library/technical-articles-and-documents/miscellaneous/software-based-memory-testing.html and the code in barebox is based on that code. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common/memtest.c: Fix incorrect array boundary checkAndrey Smirnov2015-05-151-2/+1
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* sizes.h: move include/sizes.h to include/linux/sizes.hMasahiro Yamada2015-01-081-1/+1
| | | | | | | | | | | | | | This file originates in Linux. Linux has it under include/linux/ directory since commit dccd2304cc90. Let's move it to the same place as well in barebox. This commit was generated by the following commands: find -name '*.[chS]' | xargs sed -i -e 's:<sizes.h>:<linux/sizes.h>:' git mv include/sizes.h include/linux/ Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memtest: copyright to UPPER case and fix typoAlexander Aring2014-04-231-2/+2
| | | | | Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: Add missing includesSascha Hauer2013-11-081-0/+1
| | | | | | | | A lot of files rely on include/driver.h including include/of.h (and this including include/errno.h. include the files explicitly so we can eventually get rid of including of.h from driver.h Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: add memtest.c with mem_test routineAlexander Aring2013-06-051-0/+313
Add mem_test routine. Useful to detect timing problems if someone porting a new device to barebox. This test includes a data bus test, address bus test and integrity check of memory. This mem_test routine has as parameter start and end address of testing space. The last parameter can skip the integrity check. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>