blob: b0337c34011cac5b708a533b65fd8ca30e146b40 [file] [log] [blame]
wdenka1e329b2002-01-26 00:07:42 +00001
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
12struct nftl_bci {
13 unsigned char ECCSig[6];
14 __u8 Status;
15 __u8 Status1;
16}__attribute__((packed));
17
18/* Unit Control Information */
19
20struct nftl_uci0 {
21 __u16 VirtUnitNum;
22 __u16 ReplUnitNum;
23 __u16 SpareVirtUnitNum;
24 __u16 SpareReplUnitNum;
25} __attribute__((packed));
26
27struct nftl_uci1 {
28 __u32 WearInfo;
29 __u16 EraseMark;
30 __u16 EraseMark1;
31} __attribute__((packed));
32
33struct nftl_uci2 {
wdenk57b2d802003-06-27 21:31:46 +000034 __u16 FoldMark;
35 __u16 FoldMark1;
wdenka1e329b2002-01-26 00:07:42 +000036 __u32 unused;
37} __attribute__((packed));
38
39union nftl_uci {
40 struct nftl_uci0 a;
41 struct nftl_uci1 b;
42 struct nftl_uci2 c;
43};
44
45struct nftl_oob {
46 struct nftl_bci b;
47 union nftl_uci u;
48};
49
50/* NFTL Media Header */
51
52struct 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
80struct 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;
Wolfgang Denka1be4762008-05-20 16:00:29 +020092 __u16 LastFreeEUN; /* To speed up finding a free EUN */
wdenkdbae5042003-06-21 00:17:24 +000093 __u32 nr_sects;
wdenka1e329b2002-01-26 00:07:42 +000094 int head,sect,cyl;
Wolfgang Denka1be4762008-05-20 16:00:29 +020095 __u16 *EUNtable; /* [numvunits]: First EUN for each virtual unit */
96 __u16 *ReplUnitTable; /* [numEUNs]: ReplUnitNumber for each */
wdenk57b2d802003-06-27 21:31:46 +000097 unsigned int nb_blocks; /* number of physical blocks */
98 unsigned int nb_boot_blocks; /* number of blocks used by the bios */
wdenka1e329b2002-01-26 00:07:42 +000099};
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__ */