]> git.ipfire.org Git - people/ms/u-boot.git/blob - include/linux/mtd/nftl.h
* Code cleanup:
[people/ms/u-boot.git] / include / linux / mtd / nftl.h
1
2 /* Defines for NAND Flash Translation Layer */
3 /* (c) 1999 Machine Vision Holdings, Inc. */
4 /* Author: David Woodhouse <dwmw2@mvhi.com> */
5 /* $Id: nftl.h,v 1.10 2000/12/29 00:25:38 dwmw2 Exp $ */
6
7 #ifndef __MTD_NFTL_H__
8 #define __MTD_NFTL_H__
9
10 /* Block Control Information */
11
12 struct nftl_bci {
13 unsigned char ECCSig[6];
14 __u8 Status;
15 __u8 Status1;
16 }__attribute__((packed));
17
18 /* Unit Control Information */
19
20 struct nftl_uci0 {
21 __u16 VirtUnitNum;
22 __u16 ReplUnitNum;
23 __u16 SpareVirtUnitNum;
24 __u16 SpareReplUnitNum;
25 } __attribute__((packed));
26
27 struct nftl_uci1 {
28 __u32 WearInfo;
29 __u16 EraseMark;
30 __u16 EraseMark1;
31 } __attribute__((packed));
32
33 struct nftl_uci2 {
34 __u16 FoldMark;
35 __u16 FoldMark1;
36 __u32 unused;
37 } __attribute__((packed));
38
39 union nftl_uci {
40 struct nftl_uci0 a;
41 struct nftl_uci1 b;
42 struct nftl_uci2 c;
43 };
44
45 struct nftl_oob {
46 struct nftl_bci b;
47 union nftl_uci u;
48 };
49
50 /* NFTL Media Header */
51
52 struct NFTLMediaHeader {
53 char DataOrgID[6];
54 __u16 NumEraseUnits;
55 __u16 FirstPhysicalEUN;
56 __u32 FormattedSize;
57 unsigned char UnitSizeFactor;
58 } __attribute__((packed));
59
60 #define MAX_ERASE_ZONES (8192 - 512)
61
62 #define ERASE_MARK 0x3c69
63 #define SECTOR_FREE 0xff
64 #define SECTOR_USED 0x55
65 #define SECTOR_IGNORE 0x11
66 #define SECTOR_DELETED 0x00
67
68 #define FOLD_MARK_IN_PROGRESS 0x5555
69
70 #define ZONE_GOOD 0xff
71 #define ZONE_BAD_ORIGINAL 0
72 #define ZONE_BAD_MARKED 7
73
74 /* these info are used in ReplUnitTable */
75 #define BLOCK_NIL 0xffff /* last block of a chain */
76 #define BLOCK_FREE 0xfffe /* free block */
77 #define BLOCK_NOTEXPLORED 0xfffd /* non explored block, only used during mounting */
78 #define BLOCK_RESERVED 0xfffc /* bios block or bad block */
79
80 struct NFTLrecord {
81 struct DiskOnChip *mtd;
82 __u16 MediaUnit, SpareMediaUnit;
83 __u32 EraseSize;
84 struct NFTLMediaHeader MediaHdr;
85 int usecount;
86 unsigned char heads;
87 unsigned char sectors;
88 unsigned short cylinders;
89 __u16 numvunits;
90 __u16 lastEUN; /* should be suppressed */
91 __u16 numfreeEUNs;
92 __u16 LastFreeEUN; /* To speed up finding a free EUN */
93 __u32 nr_sects;
94 int head,sect,cyl;
95 __u16 *EUNtable; /* [numvunits]: First EUN for each virtual unit */
96 __u16 *ReplUnitTable; /* [numEUNs]: ReplUnitNumber for each */
97 unsigned int nb_blocks; /* number of physical blocks */
98 unsigned int nb_boot_blocks; /* number of blocks used by the bios */
99 };
100
101 #define MAX_NFTLS 16
102 #define MAX_SECTORS_PER_UNIT 32
103 #define NFTL_PARTN_BITS 4
104
105 #endif /* __MTD_NFTL_H__ */