inftl-user.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /*
  3. * Parts of INFTL headers shared with userspace
  4. *
  5. */
  6. #ifndef __MTD_INFTL_USER_H__
  7. #define __MTD_INFTL_USER_H__
  8. #include <linux/types.h>
  9. #define OSAK_VERSION 0x5120
  10. #define PERCENTUSED 98
  11. #define SECTORSIZE 512
  12. /* Block Control Information */
  13. struct inftl_bci {
  14. __u8 ECCsig[6];
  15. __u8 Status;
  16. __u8 Status1;
  17. } __attribute__((packed));
  18. struct inftl_unithead1 {
  19. __u16 virtualUnitNo;
  20. __u16 prevUnitNo;
  21. __u8 ANAC;
  22. __u8 NACs;
  23. __u8 parityPerField;
  24. __u8 discarded;
  25. } __attribute__((packed));
  26. struct inftl_unithead2 {
  27. __u8 parityPerField;
  28. __u8 ANAC;
  29. __u16 prevUnitNo;
  30. __u16 virtualUnitNo;
  31. __u8 NACs;
  32. __u8 discarded;
  33. } __attribute__((packed));
  34. struct inftl_unittail {
  35. __u8 Reserved[4];
  36. __u16 EraseMark;
  37. __u16 EraseMark1;
  38. } __attribute__((packed));
  39. union inftl_uci {
  40. struct inftl_unithead1 a;
  41. struct inftl_unithead2 b;
  42. struct inftl_unittail c;
  43. };
  44. struct inftl_oob {
  45. struct inftl_bci b;
  46. union inftl_uci u;
  47. };
  48. /* INFTL Media Header */
  49. struct INFTLPartition {
  50. __u32 virtualUnits;
  51. __u32 firstUnit;
  52. __u32 lastUnit;
  53. __u32 flags;
  54. __u32 spareUnits;
  55. __u32 Reserved0;
  56. __u32 Reserved1;
  57. } __attribute__((packed));
  58. struct INFTLMediaHeader {
  59. char bootRecordID[8];
  60. __u32 NoOfBootImageBlocks;
  61. __u32 NoOfBinaryPartitions;
  62. __u32 NoOfBDTLPartitions;
  63. __u32 BlockMultiplierBits;
  64. __u32 FormatFlags;
  65. __u32 OsakVersion;
  66. __u32 PercentUsed;
  67. struct INFTLPartition Partitions[4];
  68. } __attribute__((packed));
  69. /* Partition flag types */
  70. #define INFTL_BINARY 0x20000000
  71. #define INFTL_BDTL 0x40000000
  72. #define INFTL_LAST 0x80000000
  73. #endif /* __MTD_INFTL_USER_H__ */