Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Thomas Gleixner | e4f0648 | 2005-11-07 11:15:37 +0000 | [diff] [blame] | 2 | * Parts of NFTL headers shared with userspace |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * |
| 4 | */ |
| 5 | |
| 6 | #ifndef __MTD_NFTL_USER_H__ |
| 7 | #define __MTD_NFTL_USER_H__ |
| 8 | |
| 9 | /* Block Control Information */ |
| 10 | |
| 11 | struct nftl_bci { |
| 12 | unsigned char ECCSig[6]; |
| 13 | uint8_t Status; |
| 14 | uint8_t Status1; |
| 15 | }__attribute__((packed)); |
| 16 | |
| 17 | /* Unit Control Information */ |
| 18 | |
| 19 | struct nftl_uci0 { |
| 20 | uint16_t VirtUnitNum; |
| 21 | uint16_t ReplUnitNum; |
| 22 | uint16_t SpareVirtUnitNum; |
| 23 | uint16_t SpareReplUnitNum; |
| 24 | } __attribute__((packed)); |
| 25 | |
| 26 | struct nftl_uci1 { |
| 27 | uint32_t WearInfo; |
| 28 | uint16_t EraseMark; |
| 29 | uint16_t EraseMark1; |
| 30 | } __attribute__((packed)); |
| 31 | |
| 32 | struct nftl_uci2 { |
| 33 | uint16_t FoldMark; |
| 34 | uint16_t FoldMark1; |
| 35 | uint32_t unused; |
| 36 | } __attribute__((packed)); |
| 37 | |
| 38 | union nftl_uci { |
| 39 | struct nftl_uci0 a; |
| 40 | struct nftl_uci1 b; |
| 41 | struct nftl_uci2 c; |
| 42 | }; |
| 43 | |
| 44 | struct nftl_oob { |
| 45 | struct nftl_bci b; |
| 46 | union nftl_uci u; |
| 47 | }; |
| 48 | |
| 49 | /* NFTL Media Header */ |
| 50 | |
| 51 | struct NFTLMediaHeader { |
| 52 | char DataOrgID[6]; |
| 53 | uint16_t NumEraseUnits; |
| 54 | uint16_t FirstPhysicalEUN; |
| 55 | uint32_t FormattedSize; |
| 56 | unsigned char UnitSizeFactor; |
| 57 | } __attribute__((packed)); |
| 58 | |
| 59 | #define MAX_ERASE_ZONES (8192 - 512) |
| 60 | |
| 61 | #define ERASE_MARK 0x3c69 |
| 62 | #define SECTOR_FREE 0xff |
| 63 | #define SECTOR_USED 0x55 |
| 64 | #define SECTOR_IGNORE 0x11 |
| 65 | #define SECTOR_DELETED 0x00 |
| 66 | |
| 67 | #define FOLD_MARK_IN_PROGRESS 0x5555 |
| 68 | |
| 69 | #define ZONE_GOOD 0xff |
| 70 | #define ZONE_BAD_ORIGINAL 0 |
| 71 | #define ZONE_BAD_MARKED 7 |
| 72 | |
| 73 | |
| 74 | #endif /* __MTD_NFTL_USER_H__ */ |