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