nftl.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * (C) 1999-2003 David Woodhouse <dwmw2@infradead.org>
  3. */
  4. #ifndef __MTD_NFTL_H__
  5. #define __MTD_NFTL_H__
  6. #include <linux/mtd/mtd.h>
  7. #include <linux/mtd/blktrans.h>
  8. #include <linux/mtd/nftl-user.h>
  9. /* these info are used in ReplUnitTable */
  10. #define BLOCK_NIL 0xffff /* last block of a chain */
  11. #define BLOCK_FREE 0xfffe /* free block */
  12. #define BLOCK_NOTEXPLORED 0xfffd /* non explored block, only used during mounting */
  13. #define BLOCK_RESERVED 0xfffc /* bios block or bad block */
  14. struct NFTLrecord {
  15. struct mtd_blktrans_dev mbd;
  16. __u16 MediaUnit, SpareMediaUnit;
  17. __u32 EraseSize;
  18. struct NFTLMediaHeader MediaHdr;
  19. int usecount;
  20. unsigned char heads;
  21. unsigned char sectors;
  22. unsigned short cylinders;
  23. __u16 numvunits;
  24. __u16 lastEUN; /* should be suppressed */
  25. __u16 numfreeEUNs;
  26. __u16 LastFreeEUN; /* To speed up finding a free EUN */
  27. int head,sect,cyl;
  28. __u16 *EUNtable; /* [numvunits]: First EUN for each virtual unit */
  29. __u16 *ReplUnitTable; /* [numEUNs]: ReplUnitNumber for each */
  30. unsigned int nb_blocks; /* number of physical blocks */
  31. unsigned int nb_boot_blocks; /* number of blocks used by the bios */
  32. struct erase_info instr;
  33. struct nand_ecclayout oobinfo;
  34. };
  35. int NFTL_mount(struct NFTLrecord *s);
  36. int NFTL_formatblock(struct NFTLrecord *s, int block);
  37. int nftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len,
  38. size_t *retlen, uint8_t *buf);
  39. int nftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len,
  40. size_t *retlen, uint8_t *buf);
  41. #ifndef NFTL_MAJOR
  42. #define NFTL_MAJOR 93
  43. #endif
  44. #define MAX_NFTLS 16
  45. #define MAX_SECTORS_PER_UNIT 64
  46. #define NFTL_PARTN_BITS 4
  47. #endif /* __MTD_NFTL_H__ */