1
/* Copyright 2013-2014 IBM Corp.
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
* you may not use this file except in compliance with the License.
5
* You may obtain a copy of the License at
7
* http://www.apache.org/licenses/LICENSE-2.0
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
* Copyright (c) International Business Machines Corp., 2012
21
* This header defines the layout for the FSP Flash Structure.
27
/* Pull in the correct header depending on what is being built */
28
#if defined(__KERNEL__)
29
#include <linux/types.h>
34
/* The version of this partition implementation */
35
#define FFS_VERSION_1 1
37
/* Magic number for the partition header (ASCII 'PART') */
38
#define FFS_MAGIC 0x50415254
40
/* The maximum length of the partition name */
41
#define PART_NAME_MAX 15
44
* Sizes of the data structures
46
#define FFS_HDR_SIZE sizeof(struct ffs_hdr)
47
#define FFS_ENTRY_SIZE sizeof(struct ffs_entry)
50
* Sizes of the data structures w/o checksum
52
#define FFS_HDR_SIZE_CSUM (FFS_HDR_SIZE - sizeof(uint32_t))
53
#define FFS_ENTRY_SIZE_CSUM (FFS_ENTRY_SIZE - sizeof(uint32_t))
55
/* pid of logical partitions/containers */
56
#define FFS_PID_TOPLEVEL 0xFFFFFFFF
59
* Type of image contained w/in partition
64
FFS_TYPE_PARTITION = 3,
68
* Flag bit definitions
70
#define FFS_FLAGS_PROTECTED 0x0001
71
#define FFS_FLAGS_U_BOOT_ENV 0x0002
73
/* Data integrity flags */
74
#define FFS_ENRY_INTEG_ECC 0x8000
77
* struct ffs_entry_user - User data enties
79
* @chip: Chip Select (0,1)
80
* @compressType: Compression Indication/alg (0=not compressed)
81
* @dataInteg: Indicates Data Integrity mechanism
82
* @verCheck: Indicates Version check type
83
* @miscFlags: Misc Partition related Flags
84
* @freeMisc[2]: Unused Miscellaneious Info
85
* @freeUser[14]: Unused User Data
87
struct ffs_entry_user {
94
uint32_t reserved[14];
98
* struct ffs_entry - Partition entry
100
* @name: Opaque null terminated string
101
* @base: Starting offset of partition in flash (in hdr.block_size)
102
* @size: Partition size (in hdr.block_size)
103
* @pid: Parent partition entry (FFS_PID_TOPLEVEL for toplevel)
104
* @id: Partition entry ID [1..65536]
105
* @type: Describe type of partition
106
* @flags: Partition attributes (optional)
107
* @actual: Actual partition size (in bytes)
108
* @resvd: Reserved words for future use
109
* @user: User data (optional)
110
* @checksum: Partition entry checksum (includes all above)
113
char name[PART_NAME_MAX + 1];
122
struct ffs_entry_user user;
124
} __attribute__ ((packed));
127
* struct ffs_hdr - FSP Flash Structure header
129
* @magic: Eye catcher/corruption detector
130
* @version: Version of the structure
131
* @size: Size of partition table (in block_size)
132
* @entry_size: Size of struct ffs_entry element (in bytes)
133
* @entry_count: Number of struct ffs_entry elements in @entries array
134
* @block_size: Size of block on device (in bytes)
135
* @block_count: Number of blocks on device
136
* @resvd: Reserved words for future use
137
* @checksum: Header checksum
138
* @entries: Pointer to array of partition entries
145
uint32_t entry_count;
147
uint32_t block_count;
150
struct ffs_entry entries[];
151
} __attribute__ ((packed));
154
#endif /* __FFS_H__ */