18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Parts of INFTL headers shared with userspace
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef __MTD_INFTL_USER_H__
88c2ecf20Sopenharmony_ci#define __MTD_INFTL_USER_H__
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <linux/types.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#define	OSAK_VERSION	0x5120
138c2ecf20Sopenharmony_ci#define	PERCENTUSED	98
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#define	SECTORSIZE	512
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci/* Block Control Information */
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_cistruct inftl_bci {
208c2ecf20Sopenharmony_ci	__u8 ECCsig[6];
218c2ecf20Sopenharmony_ci	__u8 Status;
228c2ecf20Sopenharmony_ci	__u8 Status1;
238c2ecf20Sopenharmony_ci} __attribute__((packed));
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_cistruct inftl_unithead1 {
268c2ecf20Sopenharmony_ci	__u16 virtualUnitNo;
278c2ecf20Sopenharmony_ci	__u16 prevUnitNo;
288c2ecf20Sopenharmony_ci	__u8 ANAC;
298c2ecf20Sopenharmony_ci	__u8 NACs;
308c2ecf20Sopenharmony_ci	__u8 parityPerField;
318c2ecf20Sopenharmony_ci	__u8 discarded;
328c2ecf20Sopenharmony_ci} __attribute__((packed));
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_cistruct inftl_unithead2 {
358c2ecf20Sopenharmony_ci	__u8 parityPerField;
368c2ecf20Sopenharmony_ci	__u8 ANAC;
378c2ecf20Sopenharmony_ci	__u16 prevUnitNo;
388c2ecf20Sopenharmony_ci	__u16 virtualUnitNo;
398c2ecf20Sopenharmony_ci	__u8 NACs;
408c2ecf20Sopenharmony_ci	__u8 discarded;
418c2ecf20Sopenharmony_ci} __attribute__((packed));
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_cistruct inftl_unittail {
448c2ecf20Sopenharmony_ci	__u8 Reserved[4];
458c2ecf20Sopenharmony_ci	__u16 EraseMark;
468c2ecf20Sopenharmony_ci	__u16 EraseMark1;
478c2ecf20Sopenharmony_ci} __attribute__((packed));
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ciunion inftl_uci {
508c2ecf20Sopenharmony_ci	struct inftl_unithead1 a;
518c2ecf20Sopenharmony_ci	struct inftl_unithead2 b;
528c2ecf20Sopenharmony_ci	struct inftl_unittail c;
538c2ecf20Sopenharmony_ci};
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_cistruct inftl_oob {
568c2ecf20Sopenharmony_ci	struct inftl_bci b;
578c2ecf20Sopenharmony_ci	union inftl_uci u;
588c2ecf20Sopenharmony_ci};
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci/* INFTL Media Header */
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_cistruct INFTLPartition {
648c2ecf20Sopenharmony_ci	__u32 virtualUnits;
658c2ecf20Sopenharmony_ci	__u32 firstUnit;
668c2ecf20Sopenharmony_ci	__u32 lastUnit;
678c2ecf20Sopenharmony_ci	__u32 flags;
688c2ecf20Sopenharmony_ci	__u32 spareUnits;
698c2ecf20Sopenharmony_ci	__u32 Reserved0;
708c2ecf20Sopenharmony_ci	__u32 Reserved1;
718c2ecf20Sopenharmony_ci} __attribute__((packed));
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_cistruct INFTLMediaHeader {
748c2ecf20Sopenharmony_ci	char bootRecordID[8];
758c2ecf20Sopenharmony_ci	__u32 NoOfBootImageBlocks;
768c2ecf20Sopenharmony_ci	__u32 NoOfBinaryPartitions;
778c2ecf20Sopenharmony_ci	__u32 NoOfBDTLPartitions;
788c2ecf20Sopenharmony_ci	__u32 BlockMultiplierBits;
798c2ecf20Sopenharmony_ci	__u32 FormatFlags;
808c2ecf20Sopenharmony_ci	__u32 OsakVersion;
818c2ecf20Sopenharmony_ci	__u32 PercentUsed;
828c2ecf20Sopenharmony_ci	struct INFTLPartition Partitions[4];
838c2ecf20Sopenharmony_ci} __attribute__((packed));
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci/* Partition flag types */
868c2ecf20Sopenharmony_ci#define	INFTL_BINARY	0x20000000
878c2ecf20Sopenharmony_ci#define	INFTL_BDTL	0x40000000
888c2ecf20Sopenharmony_ci#define	INFTL_LAST	0x80000000
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci#endif /* __MTD_INFTL_USER_H__ */
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci
93