William Juul | 52c0796 | 2007-10-31 13:53:06 +0100 | [diff] [blame] | 1 | /* |
| 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 | */ |
wdenk | a1e329b | 2002-01-26 00:07:42 +0000 | [diff] [blame] | 6 | |
| 7 | #ifndef __MTD_NFTL_H__ |
| 8 | #define __MTD_NFTL_H__ |
| 9 | |
William Juul | 52c0796 | 2007-10-31 13:53:06 +0100 | [diff] [blame] | 10 | #include <linux/mtd/mtd.h> |
| 11 | #include <linux/mtd/blktrans.h> |
wdenk | a1e329b | 2002-01-26 00:07:42 +0000 | [diff] [blame] | 12 | |
William Juul | 52c0796 | 2007-10-31 13:53:06 +0100 | [diff] [blame] | 13 | #include <linux/mtd/nftl-user.h> |
wdenk | a1e329b | 2002-01-26 00:07:42 +0000 | [diff] [blame] | 14 | |
| 15 | /* these info are used in ReplUnitTable */ |
Wolfgang Denk | 74e0dde | 2008-08-14 14:41:06 +0200 | [diff] [blame] | 16 | #define BLOCK_NIL 0xffff /* last block of a chain */ |
| 17 | #define BLOCK_FREE 0xfffe /* free block */ |
wdenk | a1e329b | 2002-01-26 00:07:42 +0000 | [diff] [blame] | 18 | #define BLOCK_NOTEXPLORED 0xfffd /* non explored block, only used during mounting */ |
Wolfgang Denk | 74e0dde | 2008-08-14 14:41:06 +0200 | [diff] [blame] | 19 | #define BLOCK_RESERVED 0xfffc /* bios block or bad block */ |
wdenk | a1e329b | 2002-01-26 00:07:42 +0000 | [diff] [blame] | 20 | |
| 21 | struct NFTLrecord { |
William Juul | 52c0796 | 2007-10-31 13:53:06 +0100 | [diff] [blame] | 22 | struct mtd_blktrans_dev mbd; |
wdenk | a1e329b | 2002-01-26 00:07:42 +0000 | [diff] [blame] | 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; |
Wolfgang Denk | 74e0dde | 2008-08-14 14:41:06 +0200 | [diff] [blame] | 31 | __u16 lastEUN; /* should be suppressed */ |
wdenk | a1e329b | 2002-01-26 00:07:42 +0000 | [diff] [blame] | 32 | __u16 numfreeEUNs; |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 33 | __u16 LastFreeEUN; /* To speed up finding a free EUN */ |
wdenk | a1e329b | 2002-01-26 00:07:42 +0000 | [diff] [blame] | 34 | int head,sect,cyl; |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 35 | __u16 *EUNtable; /* [numvunits]: First EUN for each virtual unit */ |
| 36 | __u16 *ReplUnitTable; /* [numEUNs]: ReplUnitNumber for each */ |
Wolfgang Denk | 74e0dde | 2008-08-14 14:41:06 +0200 | [diff] [blame] | 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; |
William Juul | 52c0796 | 2007-10-31 13:53:06 +0100 | [diff] [blame] | 40 | struct nand_ecclayout oobinfo; |
wdenk | a1e329b | 2002-01-26 00:07:42 +0000 | [diff] [blame] | 41 | }; |
| 42 | |
William Juul | 52c0796 | 2007-10-31 13:53:06 +0100 | [diff] [blame] | 43 | int NFTL_mount(struct NFTLrecord *s); |
| 44 | int NFTL_formatblock(struct NFTLrecord *s, int block); |
| 45 | |
| 46 | #ifndef NFTL_MAJOR |
| 47 | #define NFTL_MAJOR 93 |
| 48 | #endif |
| 49 | |
wdenk | a1e329b | 2002-01-26 00:07:42 +0000 | [diff] [blame] | 50 | #define MAX_NFTLS 16 |
William Juul | 52c0796 | 2007-10-31 13:53:06 +0100 | [diff] [blame] | 51 | #define MAX_SECTORS_PER_UNIT 64 |
wdenk | a1e329b | 2002-01-26 00:07:42 +0000 | [diff] [blame] | 52 | #define NFTL_PARTN_BITS 4 |
| 53 | |
| 54 | #endif /* __MTD_NFTL_H__ */ |