1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
9 #include <linux/mtd/mtd.h>
10 #include <linux/mtd/blktrans.h>
12 #include <mtd/nftl-user.h>
14 /* these info are used in ReplUnitTable */
15 #define BLOCK_NIL 0xffff /* last block of a chain */
16 #define BLOCK_FREE 0xfffe /* free block */
17 #define BLOCK_NOTEXPLORED 0xfffd /* non explored block, only used during mounting */
18 #define BLOCK_RESERVED 0xfffc /* bios block or bad block */
21 struct mtd_blktrans_dev mbd;
22 __u16 MediaUnit, SpareMediaUnit;
24 struct NFTLMediaHeader MediaHdr;
27 unsigned char sectors;
28 unsigned short cylinders;
30 __u16 lastEUN; /* should be suppressed */
32 __u16 LastFreeEUN; /* To speed up finding a free EUN */
34 __u16 *EUNtable; /* [numvunits]: First EUN for each virtual unit */
35 __u16 *ReplUnitTable; /* [numEUNs]: ReplUnitNumber for each */
36 unsigned int nb_blocks; /* number of physical blocks */
37 unsigned int nb_boot_blocks; /* number of blocks used by the bios */
38 struct erase_info instr;
41 int NFTL_mount(struct NFTLrecord *s);
42 int NFTL_formatblock(struct NFTLrecord *s, int block);
44 int nftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len,
45 size_t *retlen, uint8_t *buf);
46 int nftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len,
47 size_t *retlen, uint8_t *buf);
54 #define MAX_SECTORS_PER_UNIT 64
55 #define NFTL_PARTN_BITS 4
57 #endif /* __MTD_NFTL_H__ */