aboutsummaryrefslogtreecommitdiff
path: root/libflash/libffs.h
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2017-03-17 16:13:05 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-03-24 12:41:03 +1100
commit602dee4505cd0ceb5b69f056ec403f982b585791 (patch)
tree3c4e9c22d12513c2420171a70989e61e40d224c6 /libflash/libffs.h
parent9ffbfe269ec6ef9b6e2ef914be79dcf902fc2898 (diff)
downloadskiboot-602dee4505cd0ceb5b69f056ec403f982b585791.zip
skiboot-602dee4505cd0ceb5b69f056ec403f982b585791.tar.gz
skiboot-602dee4505cd0ceb5b69f056ec403f982b585791.tar.bz2
libflash/libffs: Rework libffs
This patch attempts a rework of libffs to prepare it for future changes. Firstly the types are split in two: 1. Packed, big endian structures used to map exactly how the data is on flash. 2. CPU endian, sane valued, not packed structures used to manipulate FFS data. Secondly: The packed struct can use BE types so that in future tools like sparse can be run over the code to check for endian conversion bugs. Thirdly: defines of sizeof(struct ...) were removed for clarity. Finally: For ease of manipulation, the in memory FFS structures contain a linked list of entries as this will make addition and removal operations much easier. This patch should be invisible to consumers of libffs. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'libflash/libffs.h')
-rw-r--r--libflash/libffs.h57
1 files changed, 56 insertions, 1 deletions
diff --git a/libflash/libffs.h b/libflash/libffs.h
index a9ff574..0976961 100644
--- a/libflash/libffs.h
+++ b/libflash/libffs.h
@@ -17,11 +17,30 @@
#define __LIBFFS_H
#include <libflash/libflash.h>
-#include <libflash/ffs.h>
#include <libflash/blocklevel.h>
/* FFS handle, opaque */
struct ffs_handle;
+struct ffs_entry;
+
+/**
+ * struct ffs_entry_user - User data entries
+ *
+ * Usable in memory representation of a struct __ffs_entry_user
+ *
+ * @chip: Chip Select (0,1)
+ * @compressType: Compression Indication/alg (0=not compressed)
+ * @dataInteg: Indicates Data Integrity mechanism
+ * @verCheck: Indicates Version check type
+ * @miscFlags: Misc Partition related Flags
+ */
+struct ffs_entry_user {
+ uint8_t chip;
+ uint8_t compresstype;
+ uint16_t datainteg;
+ uint8_t vercheck;
+ uint8_t miscflags;
+};
/* Error codes:
*
@@ -34,6 +53,42 @@ struct ffs_handle;
#define FFS_ERR_BAD_CKSUM 102
#define FFS_ERR_PART_NOT_FOUND 103
#define FFS_ERR_BAD_ECC 104
+#define FFS_ERR_BAD_SIZE 105
+#define FFS_ERR_BAD_PART_NAME 106
+#define FFS_ERR_BAD_PART_BASE 107
+#define FFS_ERR_BAD_PART_SIZE 108
+#define FFS_ERR_BAD_PART_PID 109
+
+/* The maximum length of the partition name */
+#define FFS_PART_NAME_MAX 15
+/* Old version of the name DEPRECATED */
+#define PART_NAME_MAX 15
+
+/*
+ * Flag bit definitions
+ */
+#define FFS_FLAGS_PROTECTED 0x0001
+#define FFS_FLAGS_U_BOOT_ENV 0x0002
+
+/* Data integrity flags */
+#define FFS_ENRY_INTEG_ECC 0x8000
+
+/*
+ * User verCheck definitions
+ */
+#define FFS_VERCHECK_SHA512V 0x80
+#define FFS_VERCHECK_SHA512EC 0x40
+
+/*
+ * User miscFlags
+ */
+#define FFS_MISCFLAGS_PRESERVED 0x80
+#define FFS_MISCFLAGS_READONLY 0x40
+#define FFS_MISCFLAGS_BACKUP 0x20
+#define FFS_MISCFLAGS_REPROVISION 0x10
+
+
+bool has_ecc(struct ffs_entry *ent);
/* Init */