xref: /openbmc/linux/include/uapi/mtd/inftl-user.h (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*6f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
24a8e43feSDavid Howells /*
34a8e43feSDavid Howells  * Parts of INFTL headers shared with userspace
44a8e43feSDavid Howells  *
54a8e43feSDavid Howells  */
64a8e43feSDavid Howells 
74a8e43feSDavid Howells #ifndef __MTD_INFTL_USER_H__
84a8e43feSDavid Howells #define __MTD_INFTL_USER_H__
94a8e43feSDavid Howells 
104a8e43feSDavid Howells #include <linux/types.h>
114a8e43feSDavid Howells 
124a8e43feSDavid Howells #define	OSAK_VERSION	0x5120
134a8e43feSDavid Howells #define	PERCENTUSED	98
144a8e43feSDavid Howells 
154a8e43feSDavid Howells #define	SECTORSIZE	512
164a8e43feSDavid Howells 
174a8e43feSDavid Howells /* Block Control Information */
184a8e43feSDavid Howells 
194a8e43feSDavid Howells struct inftl_bci {
204a8e43feSDavid Howells 	__u8 ECCsig[6];
214a8e43feSDavid Howells 	__u8 Status;
224a8e43feSDavid Howells 	__u8 Status1;
234a8e43feSDavid Howells } __attribute__((packed));
244a8e43feSDavid Howells 
254a8e43feSDavid Howells struct inftl_unithead1 {
264a8e43feSDavid Howells 	__u16 virtualUnitNo;
274a8e43feSDavid Howells 	__u16 prevUnitNo;
284a8e43feSDavid Howells 	__u8 ANAC;
294a8e43feSDavid Howells 	__u8 NACs;
304a8e43feSDavid Howells 	__u8 parityPerField;
314a8e43feSDavid Howells 	__u8 discarded;
324a8e43feSDavid Howells } __attribute__((packed));
334a8e43feSDavid Howells 
344a8e43feSDavid Howells struct inftl_unithead2 {
354a8e43feSDavid Howells 	__u8 parityPerField;
364a8e43feSDavid Howells 	__u8 ANAC;
374a8e43feSDavid Howells 	__u16 prevUnitNo;
384a8e43feSDavid Howells 	__u16 virtualUnitNo;
394a8e43feSDavid Howells 	__u8 NACs;
404a8e43feSDavid Howells 	__u8 discarded;
414a8e43feSDavid Howells } __attribute__((packed));
424a8e43feSDavid Howells 
434a8e43feSDavid Howells struct inftl_unittail {
444a8e43feSDavid Howells 	__u8 Reserved[4];
454a8e43feSDavid Howells 	__u16 EraseMark;
464a8e43feSDavid Howells 	__u16 EraseMark1;
474a8e43feSDavid Howells } __attribute__((packed));
484a8e43feSDavid Howells 
494a8e43feSDavid Howells union inftl_uci {
504a8e43feSDavid Howells 	struct inftl_unithead1 a;
514a8e43feSDavid Howells 	struct inftl_unithead2 b;
524a8e43feSDavid Howells 	struct inftl_unittail c;
534a8e43feSDavid Howells };
544a8e43feSDavid Howells 
554a8e43feSDavid Howells struct inftl_oob {
564a8e43feSDavid Howells 	struct inftl_bci b;
574a8e43feSDavid Howells 	union inftl_uci u;
584a8e43feSDavid Howells };
594a8e43feSDavid Howells 
604a8e43feSDavid Howells 
614a8e43feSDavid Howells /* INFTL Media Header */
624a8e43feSDavid Howells 
634a8e43feSDavid Howells struct INFTLPartition {
644a8e43feSDavid Howells 	__u32 virtualUnits;
654a8e43feSDavid Howells 	__u32 firstUnit;
664a8e43feSDavid Howells 	__u32 lastUnit;
674a8e43feSDavid Howells 	__u32 flags;
684a8e43feSDavid Howells 	__u32 spareUnits;
694a8e43feSDavid Howells 	__u32 Reserved0;
704a8e43feSDavid Howells 	__u32 Reserved1;
714a8e43feSDavid Howells } __attribute__((packed));
724a8e43feSDavid Howells 
734a8e43feSDavid Howells struct INFTLMediaHeader {
744a8e43feSDavid Howells 	char bootRecordID[8];
754a8e43feSDavid Howells 	__u32 NoOfBootImageBlocks;
764a8e43feSDavid Howells 	__u32 NoOfBinaryPartitions;
774a8e43feSDavid Howells 	__u32 NoOfBDTLPartitions;
784a8e43feSDavid Howells 	__u32 BlockMultiplierBits;
794a8e43feSDavid Howells 	__u32 FormatFlags;
804a8e43feSDavid Howells 	__u32 OsakVersion;
814a8e43feSDavid Howells 	__u32 PercentUsed;
824a8e43feSDavid Howells 	struct INFTLPartition Partitions[4];
834a8e43feSDavid Howells } __attribute__((packed));
844a8e43feSDavid Howells 
854a8e43feSDavid Howells /* Partition flag types */
864a8e43feSDavid Howells #define	INFTL_BINARY	0x20000000
874a8e43feSDavid Howells #define	INFTL_BDTL	0x40000000
884a8e43feSDavid Howells #define	INFTL_LAST	0x80000000
894a8e43feSDavid Howells 
904a8e43feSDavid Howells #endif /* __MTD_INFTL_USER_H__ */
914a8e43feSDavid Howells 
924a8e43feSDavid Howells 
93