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