[Skiboot] [PATCH V3 0/7] Improvements to flash reading code

Cyril Bur cyril.bur at au1.ibm.com
Tue Jun 23 13:22:07 AEST 2015

>From V1 Coverletter:
These patches keep improving the blocklevel interface.
I've added the ability for ecc to be done at blocklevel, I've purposefully
left libflash _corrected() functions and their use within skiboot, as that
kind of change could wreck havoc. I'd like for skiboot to be the last that
migrates and I haven't done pflash yet.
I've also implemented smart_write() at blocklevel, in writing this I've
realised that smart can often be quite subjective, feedback requested here.

Rather than use a dodgy file accessing backend to libflash, use a file
backend at the blocklevel. This will make pflash and the gard tool much
nicer, and also make it easy for pflash to migrate to using /dev/mtd on
hosts to flash as well as being able to manipulate images on x86 machines.
I have a working gard tool with this code. Note: keen observers will
notice that the new file backend contains a fix to the MEMERASE MTD ioctl
when compared to what was in file_flash.c.

Patch 2/7 received a pretty substantial rewrite as adding test cases
highlighted some badly defined corner case behaviour in the region
protection logic.
Addressed Alistair's comments

Addressed Alistairs comments for patch 2/7:
 - Fixed an issue in the protection region merging code
 - Added more test cases
 - Stylistic and otherwise minor fixes
Added _GNU_SOURCE #define to patch 4/7
The rest of the series remains unchanged.

Cyril Bur (7):
  libflash/ecc: Simplify and cleanup ecc code.
  libflash/blocklevel: Extend the block level to be able to do ecc
  libflash/blocklevel: add blocklevel flags.
  libflash/file: Add a file access backend to for the blocklevel
  libflash: Delete file_file.[ch] files
  libflash/blocklevel: add a smart write function which wraps up
    eraseing and     writing
  libffs: init with ecc protection at blocklevel level

 core/flash.c                    |  14 +-
 external/gard/gard.c            |   2 +-
 external/pflash/pflash.c        |   4 +-
 libc/include/errno.h            |   2 +
 libflash/blocklevel.c           | 249 ++++++++++++++++++++++++++++++++--
 libflash/blocklevel.h           |  24 ++++
 libflash/ecc.c                  |  51 ++++---
 libflash/ecc.h                  |  44 +++---
 libflash/errors.h               |  35 +++++
 libflash/file.c                 | 294 ++++++++++++++++++++++++++++++++++++++++
 libflash/file.h                 |  45 ++++++
 libflash/file_flash.c           | 224 ------------------------------
 libflash/file_flash.h           |  11 --
 libflash/libffs.c               |  14 +-
 libflash/libffs.h               |   2 +-
 libflash/libflash.c             |  28 ++--
 libflash/libflash.h             |  31 ++---
 libflash/test/Makefile.check    |   4 +-
 libflash/test/test-blocklevel.c | 183 +++++++++++++++++++++++++
 libflash/test/test-ecc.c        |  16 +--
 20 files changed, 933 insertions(+), 344 deletions(-)
 create mode 100644 libflash/errors.h
 create mode 100644 libflash/file.c
 create mode 100644 libflash/file.h
 delete mode 100644 libflash/file_flash.c
 delete mode 100644 libflash/file_flash.h
 create mode 100644 libflash/test/test-blocklevel.c


More information about the Skiboot mailing list