[Skiboot] [PATCH 1/4] libflash: move ecc.h into libflash/
Jeremy Kerr
jk at ozlabs.org
Tue Feb 24 11:58:50 AEDT 2015
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 at ozlabs.org>
---
include/ecc.h | 53 ----------------------------------------------
libflash/ecc.c | 2 -
libflash/ecc.h | 53 ++++++++++++++++++++++++++++++++++++++++++++++
libflash/libffs.c | 2 -
4 files changed, 55 insertions(+), 55 deletions(-)
diff --git a/include/ecc.h b/include/ecc.h
deleted file mode 100644
index d5c30cb..0000000
--- a/include/ecc.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright 2013-2014 IBM Corp.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* This is based on the hostboot ecc code */
-
-#ifndef __ECC_H
-#define __ECC_H
-
-#include <stdint.h>
-#include <skiboot.h>
-
-/* Bit field identifiers for syndrome calculations. */
-enum eccbitfields
-{
- GD = 0xff, //< Good, ECC matches.
- UE = 0xfe, //< Uncorrectable.
- E0 = 71, //< Error in ECC bit 0
- E1 = 70, //< Error in ECC bit 1
- E2 = 69, //< Error in ECC bit 2
- E3 = 68, //< Error in ECC bit 3
- E4 = 67, //< Error in ECC bit 4
- E5 = 66, //< Error in ECC bit 5
- E6 = 65, //< Error in ECC bit 6
- E7 = 64 //< Error in ECC bit 7
-};
-
-extern uint8_t eccmemcpy(uint64_t *dst, uint64_t *src, uint32_t len);
-
-/*
- * Calculate the size of a buffer if ECC is added
- *
- * We add 1 byte of ecc for every 8 bytes of data. So we need to round up to 8
- * bytes length and then add 1/8
- */
-#define ECC_SIZE(len) (ALIGN_UP((len), 8) >> 3)
-#define ECC_BUFFER_SIZE(len) (ALIGN_UP((len), 8) + ECC_SIZE(len))
-#define ECC_BUFFER_SIZE_CHECK(len) ((len) % 9)
-#define BUFFER_SIZE_MINUS_ECC(len) ((len) * 8 / 9)
-
-#endif
diff --git a/libflash/ecc.c b/libflash/ecc.c
index b794e6a..cf0393c 100644
--- a/libflash/ecc.c
+++ b/libflash/ecc.c
@@ -17,9 +17,9 @@
/* This is based on the hostboot ecc code */
#include <stdint.h>
-#include <ecc.h>
#include "libflash.h"
+#include "ecc.h"
/*
* Matrix used for ECC calculation.
diff --git a/libflash/ecc.h b/libflash/ecc.h
new file mode 100644
index 0000000..d5c30cb
--- /dev/null
+++ b/libflash/ecc.h
@@ -0,0 +1,53 @@
+/* Copyright 2013-2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* This is based on the hostboot ecc code */
+
+#ifndef __ECC_H
+#define __ECC_H
+
+#include <stdint.h>
+#include <skiboot.h>
+
+/* Bit field identifiers for syndrome calculations. */
+enum eccbitfields
+{
+ GD = 0xff, //< Good, ECC matches.
+ UE = 0xfe, //< Uncorrectable.
+ E0 = 71, //< Error in ECC bit 0
+ E1 = 70, //< Error in ECC bit 1
+ E2 = 69, //< Error in ECC bit 2
+ E3 = 68, //< Error in ECC bit 3
+ E4 = 67, //< Error in ECC bit 4
+ E5 = 66, //< Error in ECC bit 5
+ E6 = 65, //< Error in ECC bit 6
+ E7 = 64 //< Error in ECC bit 7
+};
+
+extern uint8_t eccmemcpy(uint64_t *dst, uint64_t *src, uint32_t len);
+
+/*
+ * Calculate the size of a buffer if ECC is added
+ *
+ * We add 1 byte of ecc for every 8 bytes of data. So we need to round up to 8
+ * bytes length and then add 1/8
+ */
+#define ECC_SIZE(len) (ALIGN_UP((len), 8) >> 3)
+#define ECC_BUFFER_SIZE(len) (ALIGN_UP((len), 8) + ECC_SIZE(len))
+#define ECC_BUFFER_SIZE_CHECK(len) ((len) % 9)
+#define BUFFER_SIZE_MINUS_ECC(len) ((len) * 8 / 9)
+
+#endif
diff --git a/libflash/libffs.c b/libflash/libffs.c
index c28fd66..c6cf9dd 100644
--- a/libflash/libffs.c
+++ b/libflash/libffs.c
@@ -18,11 +18,11 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <ecc.h>
#include <ccan/endian/endian.h>
#include "libffs.h"
+#include "ecc.h"
enum ffs_type {
ffs_type_flash,
More information about the Skiboot
mailing list