Norman James | 6a58a27 | 2015-10-07 14:34:16 -0500 | [diff] [blame] | 1 | /* IBM_PROLOG_BEGIN_TAG */
|
| 2 | /* This is an automatically generated prolog. */
|
| 3 | /* */
|
| 4 | /* $Source: src/usr/pnor/ffs.h $ */
|
| 5 | /* */
|
| 6 | /* IBM CONFIDENTIAL */
|
| 7 | /* */
|
| 8 | /* COPYRIGHT International Business Machines Corp. 2012,2013 */
|
| 9 | /* */
|
| 10 | /* p1 */
|
| 11 | /* */
|
| 12 | /* Object Code Only (OCO) source materials */
|
| 13 | /* Licensed Internal Code Source Materials */
|
| 14 | /* IBM HostBoot Licensed Internal Code */
|
| 15 | /* */
|
| 16 | /* The source code for this program is not published or otherwise */
|
| 17 | /* divested of its trade secrets, irrespective of what has been */
|
| 18 | /* deposited with the U.S. Copyright Office. */
|
| 19 | /* */
|
| 20 | /* Origin: 30 */
|
| 21 | /* */
|
| 22 | /* IBM_PROLOG_END_TAG */
|
| 23 | /*
|
| 24 | * Copyright (c) International Business Machines Corp., 2012
|
| 25 | *
|
| 26 | * FSP Flash Structure
|
| 27 | *
|
| 28 | * This header defines the layout for the FSP Flash Structure.
|
| 29 | */
|
| 30 |
|
| 31 | #ifndef __FFS_H__
|
| 32 | #define __FFS_H__
|
| 33 |
|
| 34 | /* Pull in the correct header depending on what is being built */
|
| 35 | #if defined(__KERNEL__)
|
| 36 | #include <linux/types.h>
|
| 37 | #else
|
| 38 | #include <stdint.h>
|
| 39 | #endif
|
| 40 |
|
| 41 | /* The version of this partition implementation */
|
| 42 | #define FFS_VERSION_1 1
|
| 43 |
|
| 44 | /* Magic number for the partition header (ASCII 'PART') */
|
| 45 | #define FFS_MAGIC 0x50415254
|
| 46 |
|
| 47 | /* The maximum length of the partition name */
|
| 48 | #define PART_NAME_MAX 15
|
| 49 |
|
| 50 | /*
|
| 51 | * Sizes of the data structures
|
| 52 | */
|
| 53 | #define FFS_HDR_SIZE sizeof(struct ffs_hdr)
|
| 54 | #define FFS_ENTRY_SIZE sizeof(struct ffs_entry)
|
| 55 |
|
| 56 | /*
|
| 57 | * Sizes of the data structures w/o checksum
|
| 58 | */
|
| 59 | #define FFS_HDR_SIZE_CSUM (FFS_HDR_SIZE - sizeof(uint32_t))
|
| 60 | #define FFS_ENTRY_SIZE_CSUM (FFS_ENTRY_SIZE - sizeof(uint32_t))
|
| 61 |
|
| 62 | /* pid of logical partitions/containers */
|
| 63 | #define FFS_PID_TOPLEVEL 0xFFFFFFFF
|
| 64 |
|
| 65 | /*
|
| 66 | * Type of image contained w/in partition
|
| 67 | */
|
| 68 | enum type {
|
| 69 | FFS_TYPE_DATA = 1,
|
| 70 | FFS_TYPE_LOGICAL = 2,
|
| 71 | FFS_TYPE_PARTITION = 3,
|
| 72 | };
|
| 73 |
|
| 74 | /*
|
| 75 | * Flag bit definitions
|
| 76 | */
|
| 77 | #define FFS_FLAGS_PROTECTED 0x0001
|
| 78 | #define FFS_FLAGS_U_BOOT_ENV 0x0002
|
| 79 |
|
| 80 | /*
|
| 81 | * Number of user data words
|
| 82 | */
|
| 83 | #define FFS_USER_WORDS 16
|
| 84 |
|
| 85 | /**
|
| 86 | * struct ffs_entry - Partition entry
|
| 87 | *
|
| 88 | * @name: Opaque null terminated string
|
| 89 | * @base: Starting offset of partition in flash (in hdr.block_size)
|
| 90 | * @size: Partition size (in hdr.block_size)
|
| 91 | * @pid: Parent partition entry (FFS_PID_TOPLEVEL for toplevel)
|
| 92 | * @id: Partition entry ID [1..65536]
|
| 93 | * @type: Describe type of partition
|
| 94 | * @flags: Partition attributes (optional)
|
| 95 | * @actual: Actual partition size (in bytes)
|
| 96 | * @resvd: Reserved words for future use
|
| 97 | * @user: User data (optional)
|
| 98 | * @checksum: Partition entry checksum (includes all above)
|
| 99 | */
|
| 100 | struct ffs_entry {
|
| 101 | char name[PART_NAME_MAX + 1];
|
| 102 | uint32_t base;
|
| 103 | uint32_t size;
|
| 104 | uint32_t pid;
|
| 105 | uint32_t id;
|
| 106 | uint32_t type;
|
| 107 | uint32_t flags;
|
| 108 | uint32_t actual;
|
| 109 | uint32_t resvd[4];
|
| 110 | struct {
|
| 111 | uint32_t data[FFS_USER_WORDS];
|
| 112 | } user;
|
| 113 | uint32_t checksum;
|
| 114 | } __attribute__ ((packed));
|
| 115 |
|
| 116 | /**
|
| 117 | * struct ffs_hdr - FSP Flash Structure header
|
| 118 | *
|
| 119 | * @magic: Eye catcher/corruption detector
|
| 120 | * @version: Version of the structure
|
| 121 | * @size: Size of partition table (in block_size)
|
| 122 | * @entry_size: Size of struct ffs_entry element (in bytes)
|
| 123 | * @entry_count: Number of struct ffs_entry elements in @entries array
|
| 124 | * @block_size: Size of block on device (in bytes)
|
| 125 | * @block_count: Number of blocks on device
|
| 126 | * @resvd: Reserved words for future use
|
| 127 | * @checksum: Header checksum
|
| 128 | * @entries: Pointer to array of partition entries
|
| 129 | */
|
| 130 | struct ffs_hdr {
|
| 131 | uint32_t magic;
|
| 132 | uint32_t version;
|
| 133 | uint32_t size;
|
| 134 | uint32_t entry_size;
|
| 135 | uint32_t entry_count;
|
| 136 | uint32_t block_size;
|
| 137 | uint32_t block_count;
|
| 138 | uint32_t resvd[4];
|
| 139 | uint32_t checksum;
|
| 140 | struct ffs_entry entries[];
|
| 141 | } __attribute__ ((packed));
|
| 142 |
|
| 143 |
|
| 144 | #endif /* __FFS_H__ */
|