aboutsummaryrefslogtreecommitdiff
path: root/libflash
AgeCommit message (Collapse)AuthorFilesLines
2015-04-07address reviews for: libflash:don't use the low level interface if it ↵skiboot-5.0-rc3Cyril Bur1-10/+4
doesn't exist commit 237f9d1a51eaed260119346dfddc044395267154 Author: Cyril Bur <cyril.bur@au1.ibm.com> libflash: don't use the low level interface if it doesn't exist In the review process a less invasive version was reworked. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-04-01libflash/file: add file abstraction for libflashCyril Bur4-0/+238
The functionality provided by libflash and libffs are useful and it would be good to use them on dumps of flash or even access flash from userland through MTD devices which are presented as files. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-04-01libflash: don't use the low level interface if it doesn't existCyril Bur1-1/+9
During init libflash calls low level functions without checking. libflash states to backends that if they implement all the higher level functions the lower level functions are optional (from libflash-priv.h): If all functions of the high level interface are implemented then the low level one is optional. A controller can implement some of the high level one in which case the missing ones will be handled by libflash using the low level interface. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-03-26memboot: Add a memboot flash backendAlistair Popple1-0/+1
memboot uses bmc system memory instead of a real flash chip. This patch adds a flash backend for bmc system memory to allow use of the memboot tool (in external/memboot) to boot the system. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-03-17libflash: Improved ECC interfaceCyril Bur7-15/+703
This patch is twofold. 1. Improves the low level ecc memcpy code to better specify that we're reading/writing buffers with ecc bytes. 2. Improves/creates the libflash interfaces for ecc. This patch also includes some tests Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-03-05libflash: endian fixups for ecc.cCyril Bur1-5/+8
The flash is in big endian and the ecc code must be aware of this when performing ecc checks on a little endian cpu. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-03-04libflash: Ensure temporary buffer is freedJoel Stanley1-1/+1
Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-03-04libflash: whitespace fixups for ecc.cCyril Bur1-6/+6
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-03-04libflash: Implement ffs_open_imageJoel Stanley3-7/+88
ffs_open_image is like ffs_open_flash, but it can operate on a file descriptor to a pnor image instead of a flash device. It is currently disabled in skiboot as it does not provide the read and lseek used by libffs. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-03-03sparse: libflash_debug is unusedCédric Le Goater1-0/+2
Let's wrap it with __SKIBOOT__ to avoid the warning. libflash_debug is still being used by libflash in userspace, eg. pflash and opal-prd. Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> Suggested-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-26libflash: move ffs_flash_read into libflashJeremy Kerr6-60/+59
We have ffs_flash_read to do optionally-ecc-ed reads of flash data. However, this isn't really related to the ffs partitioning. This change moves ffs_flash_read into libflash.c, named flash_read_corrected. The function itself isn't changed. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-26libflash: external FL_* macros require stdioJeremy Kerr1-0/+1
Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Reviewed-By: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-26libflash: Remove dependencies on skiboot.h headerJeremy Kerr2-1/+8
libflash should be compilable without the skiboot definitions. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Reviewed-By: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-26libflash: move ecc.h into libflash/Jeremy Kerr3-2/+55
The ecc.h header is used by libflash, so should sit in libflash, to allow non-skiboot tools to access it. This change is a simple move of the header file - no changes are made to the header itself. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Reviewed-By: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-26libflash: Use FL_* logging functionsJeremy Kerr1-3/+5
We don't have prerror / prlog functions when compiling outside of skiboot. Use the FL_* macros instead. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-23libffs: Add ffs_flash_read()Michael Neuling3-0/+57
Add ffs_flash_read() which mimics flash_read() but handles ECC checking, correction and uncorrectable errors. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-23libffs: Add ecc parameter on ffs_part_info()Michael Neuling2-2/+5
Add ecc parmenter to ffs_part_info() to indicate if the partition is ECC protected or not. Fix all call sites. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-23libffs: Add ffs_entry_user fieldMichael Neuling2-6/+24
This adds the correct user structure to ffs_entry as defined from hostboot. No functional changes. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-23libffs: Add ECC checking codeMichael Neuling2-1/+176
Add ECC checking code. This code is based on the hostboot code. Unused currently, but will be soon. This uses __builtin_parityl() hence adding libgcc linking previously. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-23libffs: Add comment for to clarify endian requirmentsMichael Neuling1-0/+4
In some parts of libffs we access struct ffs_entry with endian access and in other parts we don't. This adds a comment to clarify why we do this. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-19Exclude all test cases from coverage-reportStewart Smith1-0/+2
This way we get a true representation from the lcov coverage-report about what firmware code we're testing (besides, test cases are always going to only have 50% of branches hit - we're asserting the tests pass!) Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-19Pretty print make check and coverage outputStewart Smith1-5/+5
Can still get the details with V=1, just like normal make. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-15Fix makefile dependency generation, especially for HOSTCCStewart Smith1-1/+1
Instead of having individual rules to generate .d, add -MMD to HOSTCC parameters, and just include the generated .d files. This fixes a few weird dependency issues. Also, make the mambo hello_kernel test depend on skiboot.lid Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-11-14Import pflash 0.8.6Benjamin Herrenschmidt1-9/+8
We share code, it's easier to maintain it this way Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-30libflash: Update from pflash-0.8.6Benjamin Herrenschmidt2-29/+69
Improve calibration and use safer timings for commands. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-22Preliminary code coverage reporting infrastructureStewart Smith1-1/+12
Add support in core/test/Makefile.check to build -gcov binaries (with -lgcov and -fprofile-blah-blah) as well as some targets for producing lcov HTML code coverage reports. As part of this, I had to fix up an oddity in run-mem_region_init where that due to running under Valgrind, we'd be malloc()ed a heap with a small address, well inside the mem_regions we added but when not running under valgrind (e.g. for code coverage reporting) we would get a much larger address, outside this range and hit an assert. So, after fiddling with the memory stuff for this test, I think I have it right - it passes both under valgrind and not and does produce code coverage data. Currently, we're at this level of code coverage by unit tests: Hit Total Coverage Lines: 1936 2574 75.2 % Functions: 177 225 78.7 % Branches: 1243 2360 52.7 % The totals should largely be ignored due to the only code being counted is that linked into the unit tests (total LOC is ~50kLOC according to sloccount... so unit tests currently cover < 5%) Try the "make coverage-report" target, you'll get coverage-report directory with a LCOV HTML report Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-10-15libflash: Sync with pflash 0.8.3Benjamin Herrenschmidt2-45/+86
Fixes 64MB chip support, improve Macronix settings, add Micron chip support, etc... Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-07-30libflash: Fix licence header in ffs.hBenjamin Herrenschmidt1-22/+0
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-07-02Initial commit of Open Source releaseBenjamin Herrenschmidt10-0/+1888
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>