blob: 001eec50cac6d12c12e3362ef1ca9687400357b8 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * $Id: nftl.h,v 1.16 2004/06/30 14:49:00 dbrown 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#include <mtd/nftl-user.h>
14
15/* these info are used in ReplUnitTable */
16#define BLOCK_NIL 0xffff /* last block of a chain */
17#define BLOCK_FREE 0xfffe /* free block */
18#define BLOCK_NOTEXPLORED 0xfffd /* non explored block, only used during mounting */
19#define BLOCK_RESERVED 0xfffc /* bios block or bad block */
20
21struct NFTLrecord {
22 struct mtd_blktrans_dev mbd;
23 __u16 MediaUnit, SpareMediaUnit;
24 __u32 EraseSize;
25 struct NFTLMediaHeader MediaHdr;
26 int usecount;
27 unsigned char heads;
28 unsigned char sectors;
29 unsigned short cylinders;
30 __u16 numvunits;
31 __u16 lastEUN; /* should be suppressed */
32 __u16 numfreeEUNs;
33 __u16 LastFreeEUN; /* To speed up finding a free EUN */
34 int head,sect,cyl;
35 __u16 *EUNtable; /* [numvunits]: First EUN for each virtual unit */
36 __u16 *ReplUnitTable; /* [numEUNs]: ReplUnitNumber for each */
37 unsigned int nb_blocks; /* number of physical blocks */
38 unsigned int nb_boot_blocks; /* number of blocks used by the bios */
39 struct erase_info instr;
Thomas Gleixner5bd34c02006-05-27 22:16:10 +020040 struct nand_ecclayout oobinfo;
Linus Torvalds1da177e2005-04-16 15:20:36 -070041};
42
43int NFTL_mount(struct NFTLrecord *s);
44int NFTL_formatblock(struct NFTLrecord *s, int block);
45
Adrian Bunk51ee83d2008-04-14 17:20:00 +030046int nftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len,
47 size_t *retlen, uint8_t *buf);
48int nftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len,
49 size_t *retlen, uint8_t *buf);
50
Linus Torvalds1da177e2005-04-16 15:20:36 -070051#ifndef NFTL_MAJOR
52#define NFTL_MAJOR 93
53#endif
54
55#define MAX_NFTLS 16
56#define MAX_SECTORS_PER_UNIT 64
57#define NFTL_PARTN_BITS 4
58
59#endif /* __MTD_NFTL_H__ */