aboutsummaryrefslogtreecommitdiff
path: root/libflash/ecc.h
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2015-03-12 17:42:06 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-03-17 17:58:03 +1100
commit672f26aeae18352e1fe8e4c7030cf1e338188487 (patch)
treea6f4cd3262216e7f2744e164bfa685cc48a87eb6 /libflash/ecc.h
parent5e10de0c32edc997407ef1911946f700e30ffd5e (diff)
downloadskiboot-672f26aeae18352e1fe8e4c7030cf1e338188487.zip
skiboot-672f26aeae18352e1fe8e4c7030cf1e338188487.tar.gz
skiboot-672f26aeae18352e1fe8e4c7030cf1e338188487.tar.bz2
libflash: Improved ECC interface
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>
Diffstat (limited to 'libflash/ecc.h')
-rw-r--r--libflash/ecc.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/libflash/ecc.h b/libflash/ecc.h
index 581886f..d58ec3e 100644
--- a/libflash/ecc.h
+++ b/libflash/ecc.h
@@ -20,6 +20,7 @@
#define __ECC_H
#include <stdint.h>
+#include <ccan/endian/endian.h>
/* Bit field identifiers for syndrome calculations. */
enum eccbitfields
@@ -36,7 +37,14 @@ enum eccbitfields
E7 = 64 //< Error in ECC bit 7
};
-extern uint8_t eccmemcpy(uint64_t *dst, uint64_t *src, uint32_t len);
+struct ecc64 {
+ beint64_t data;
+ uint8_t ecc;
+} __attribute__((__packed__));
+
+extern uint8_t memcpy_from_ecc(uint64_t *dst, struct ecc64 *src, uint32_t len);
+
+extern uint8_t memcpy_to_ecc(struct ecc64 *dst, const uint64_t *src, uint32_t len);
/*
* Calculate the size of a buffer if ECC is added