blob: 6731a16e7dc1cbe93f8b589b010109bed2ee787e [file] [log] [blame]
William Juul52c07962007-10-31 13:53:06 +01001/*
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 */
wdenka1e329b2002-01-26 00:07:42 +00006
7#ifndef __MTD_NFTL_H__
8#define __MTD_NFTL_H__
9
William Juul52c07962007-10-31 13:53:06 +010010#include <linux/mtd/mtd.h>
11#include <linux/mtd/blktrans.h>
wdenka1e329b2002-01-26 00:07:42 +000012
William Juul52c07962007-10-31 13:53:06 +010013#include <linux/mtd/nftl-user.h>
wdenka1e329b2002-01-26 00:07:42 +000014
15/* these info are used in ReplUnitTable */
Wolfgang Denk74e0dde2008-08-14 14:41:06 +020016#define BLOCK_NIL 0xffff /* last block of a chain */
17#define BLOCK_FREE 0xfffe /* free block */
wdenka1e329b2002-01-26 00:07:42 +000018#define BLOCK_NOTEXPLORED 0xfffd /* non explored block, only used during mounting */
Wolfgang Denk74e0dde2008-08-14 14:41:06 +020019#define BLOCK_RESERVED 0xfffc /* bios block or bad block */
wdenka1e329b2002-01-26 00:07:42 +000020
21struct NFTLrecord {
William Juul52c07962007-10-31 13:53:06 +010022 struct mtd_blktrans_dev mbd;
wdenka1e329b2002-01-26 00:07:42 +000023 __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;
Wolfgang Denk74e0dde2008-08-14 14:41:06 +020031 __u16 lastEUN; /* should be suppressed */
wdenka1e329b2002-01-26 00:07:42 +000032 __u16 numfreeEUNs;
Wolfgang Denka1be4762008-05-20 16:00:29 +020033 __u16 LastFreeEUN; /* To speed up finding a free EUN */
wdenka1e329b2002-01-26 00:07:42 +000034 int head,sect,cyl;
Wolfgang Denka1be4762008-05-20 16:00:29 +020035 __u16 *EUNtable; /* [numvunits]: First EUN for each virtual unit */
36 __u16 *ReplUnitTable; /* [numEUNs]: ReplUnitNumber for each */
Wolfgang Denk74e0dde2008-08-14 14:41:06 +020037 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;
William Juul52c07962007-10-31 13:53:06 +010040 struct nand_ecclayout oobinfo;
wdenka1e329b2002-01-26 00:07:42 +000041};
42
William Juul52c07962007-10-31 13:53:06 +010043int NFTL_mount(struct NFTLrecord *s);
44int NFTL_formatblock(struct NFTLrecord *s, int block);
45
46#ifndef NFTL_MAJOR
47#define NFTL_MAJOR 93
48#endif
49
wdenka1e329b2002-01-26 00:07:42 +000050#define MAX_NFTLS 16
William Juul52c07962007-10-31 13:53:06 +010051#define MAX_SECTORS_PER_UNIT 64
wdenka1e329b2002-01-26 00:07:42 +000052#define NFTL_PARTN_BITS 4
53
54#endif /* __MTD_NFTL_H__ */