summaryrefslogtreecommitdiffstats
path: root/libflash/blocklevel.h
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2015-06-23 13:22:09 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-06-23 13:38:42 +1000
commit199be6b84faeff7ef03032c857766d4a023fbbb4 (patch)
tree8d03612cfd543eb37bdb8419812314525e1c7c1d /libflash/blocklevel.h
parent69b152cab30aae6188b590b2df9a6f55932c4408 (diff)
downloadtalos-skiboot-199be6b84faeff7ef03032c857766d4a023fbbb4.tar.gz
talos-skiboot-199be6b84faeff7ef03032c857766d4a023fbbb4.zip
libflash/blocklevel: Extend the block level to be able to do ecc
At the moment ECC reads and writes are still being handled by the low level core of libflash. ECC should be none of libflashes concern, it is primarily a hardware access backend. It makes sense for blocklevel to take care of ECC but currently it has no way of knowing. With some simple modifications (which are rudimentary at the moment and will need a performance improvement) blocklevel can handle ECC, and with a little more effort this can be extended to provide read and write protection in blocklevel. Reviewed-By: Alistair Popple <alistair@popple.id.au> Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'libflash/blocklevel.h')
-rw-r--r--libflash/blocklevel.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/libflash/blocklevel.h b/libflash/blocklevel.h
index a22ecb4a..837e67ec 100644
--- a/libflash/blocklevel.h
+++ b/libflash/blocklevel.h
@@ -18,6 +18,17 @@
#include <stdint.h>
+struct bl_prot_range {
+ uint32_t start;
+ uint32_t len;
+};
+
+struct blocklevel_range {
+ struct bl_prot_range *prot;
+ int n_prot;
+ int total_prot;
+};
+
/*
* libffs may be used with different backends, all should provide these for
* libflash to get the information it needs
@@ -34,6 +45,8 @@ struct blocklevel_device {
* Keep the erase mask so that blocklevel_erase() can do sanity checking
*/
uint32_t erase_mask;
+
+ struct blocklevel_range ecc_prot;
};
int blocklevel_read(struct blocklevel_device *bl, uint32_t pos, void *buf, uint32_t len);
@@ -42,4 +55,7 @@ int blocklevel_erase(struct blocklevel_device *bl, uint32_t pos, uint32_t len);
int blocklevel_get_info(struct blocklevel_device *bl, const char **name, uint32_t *total_size,
uint32_t *erase_granule);
+/* Implemented in software at this level */
+int blocklevel_ecc_protect(struct blocklevel_device *bl, uint32_t start, uint32_t len);
+
#endif /* __LIBFLASH_BLOCKLEVEL_H */
OpenPOWER on IntegriCloud