blob: bdeabd86ad99efb10590853a357d1088a31a38ac [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
David Woodhousea1452a32010-08-08 20:58:20 +01002 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Linus Torvalds1da177e2005-04-16 15:20:36 -070017 *
18 */
19
20#ifndef __MTD_NFTL_USER_H__
21#define __MTD_NFTL_USER_H__
22
Arnd Bergmannccef7ab2009-02-26 00:51:41 +010023#include <linux/types.h>
24
Linus Torvalds1da177e2005-04-16 15:20:36 -070025/* Block Control Information */
26
27struct nftl_bci {
28 unsigned char ECCSig[6];
Arnd Bergmannccef7ab2009-02-26 00:51:41 +010029 __u8 Status;
30 __u8 Status1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070031}__attribute__((packed));
32
33/* Unit Control Information */
34
35struct nftl_uci0 {
Arnd Bergmannccef7ab2009-02-26 00:51:41 +010036 __u16 VirtUnitNum;
37 __u16 ReplUnitNum;
38 __u16 SpareVirtUnitNum;
39 __u16 SpareReplUnitNum;
Linus Torvalds1da177e2005-04-16 15:20:36 -070040} __attribute__((packed));
41
42struct nftl_uci1 {
Arnd Bergmannccef7ab2009-02-26 00:51:41 +010043 __u32 WearInfo;
44 __u16 EraseMark;
45 __u16 EraseMark1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070046} __attribute__((packed));
47
48struct nftl_uci2 {
Arnd Bergmannccef7ab2009-02-26 00:51:41 +010049 __u16 FoldMark;
50 __u16 FoldMark1;
51 __u32 unused;
Linus Torvalds1da177e2005-04-16 15:20:36 -070052} __attribute__((packed));
53
54union nftl_uci {
55 struct nftl_uci0 a;
56 struct nftl_uci1 b;
57 struct nftl_uci2 c;
58};
59
60struct nftl_oob {
61 struct nftl_bci b;
62 union nftl_uci u;
63};
64
65/* NFTL Media Header */
66
67struct NFTLMediaHeader {
68 char DataOrgID[6];
Arnd Bergmannccef7ab2009-02-26 00:51:41 +010069 __u16 NumEraseUnits;
70 __u16 FirstPhysicalEUN;
71 __u32 FormattedSize;
Linus Torvalds1da177e2005-04-16 15:20:36 -070072 unsigned char UnitSizeFactor;
73} __attribute__((packed));
74
75#define MAX_ERASE_ZONES (8192 - 512)
76
77#define ERASE_MARK 0x3c69
78#define SECTOR_FREE 0xff
79#define SECTOR_USED 0x55
80#define SECTOR_IGNORE 0x11
81#define SECTOR_DELETED 0x00
82
83#define FOLD_MARK_IN_PROGRESS 0x5555
84
85#define ZONE_GOOD 0xff
86#define ZONE_BAD_ORIGINAL 0
87#define ZONE_BAD_MARKED 7
88
89
90#endif /* __MTD_NFTL_USER_H__ */