18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify
68c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License as published by
78c2ecf20Sopenharmony_ci * the Free Software Foundation; either version 2 of the License, or
88c2ecf20Sopenharmony_ci * (at your option) any later version.
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful,
118c2ecf20Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
128c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
138c2ecf20Sopenharmony_ci * GNU General Public License for more details.
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License
168c2ecf20Sopenharmony_ci * along with this program; if not, write to the Free Software
178c2ecf20Sopenharmony_ci * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
188c2ecf20Sopenharmony_ci *
198c2ecf20Sopenharmony_ci */
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#ifndef __MTD_NFTL_USER_H__
228c2ecf20Sopenharmony_ci#define __MTD_NFTL_USER_H__
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#include <linux/types.h>
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/* Block Control Information */
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_cistruct nftl_bci {
298c2ecf20Sopenharmony_ci	unsigned char ECCSig[6];
308c2ecf20Sopenharmony_ci	__u8 Status;
318c2ecf20Sopenharmony_ci	__u8 Status1;
328c2ecf20Sopenharmony_ci}__attribute__((packed));
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci/* Unit Control Information */
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_cistruct nftl_uci0 {
378c2ecf20Sopenharmony_ci	__u16 VirtUnitNum;
388c2ecf20Sopenharmony_ci	__u16 ReplUnitNum;
398c2ecf20Sopenharmony_ci	__u16 SpareVirtUnitNum;
408c2ecf20Sopenharmony_ci	__u16 SpareReplUnitNum;
418c2ecf20Sopenharmony_ci} __attribute__((packed));
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_cistruct nftl_uci1 {
448c2ecf20Sopenharmony_ci	__u32 WearInfo;
458c2ecf20Sopenharmony_ci	__u16 EraseMark;
468c2ecf20Sopenharmony_ci	__u16 EraseMark1;
478c2ecf20Sopenharmony_ci} __attribute__((packed));
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_cistruct nftl_uci2 {
508c2ecf20Sopenharmony_ci        __u16 FoldMark;
518c2ecf20Sopenharmony_ci        __u16 FoldMark1;
528c2ecf20Sopenharmony_ci	__u32 unused;
538c2ecf20Sopenharmony_ci} __attribute__((packed));
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ciunion nftl_uci {
568c2ecf20Sopenharmony_ci	struct nftl_uci0 a;
578c2ecf20Sopenharmony_ci	struct nftl_uci1 b;
588c2ecf20Sopenharmony_ci	struct nftl_uci2 c;
598c2ecf20Sopenharmony_ci};
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_cistruct nftl_oob {
628c2ecf20Sopenharmony_ci	struct nftl_bci b;
638c2ecf20Sopenharmony_ci	union nftl_uci u;
648c2ecf20Sopenharmony_ci};
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci/* NFTL Media Header */
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_cistruct NFTLMediaHeader {
698c2ecf20Sopenharmony_ci	char DataOrgID[6];
708c2ecf20Sopenharmony_ci	__u16 NumEraseUnits;
718c2ecf20Sopenharmony_ci	__u16 FirstPhysicalEUN;
728c2ecf20Sopenharmony_ci	__u32 FormattedSize;
738c2ecf20Sopenharmony_ci	unsigned char UnitSizeFactor;
748c2ecf20Sopenharmony_ci} __attribute__((packed));
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci#define MAX_ERASE_ZONES (8192 - 512)
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci#define ERASE_MARK 0x3c69
798c2ecf20Sopenharmony_ci#define SECTOR_FREE 0xff
808c2ecf20Sopenharmony_ci#define SECTOR_USED 0x55
818c2ecf20Sopenharmony_ci#define SECTOR_IGNORE 0x11
828c2ecf20Sopenharmony_ci#define SECTOR_DELETED 0x00
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci#define FOLD_MARK_IN_PROGRESS 0x5555
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci#define ZONE_GOOD 0xff
878c2ecf20Sopenharmony_ci#define ZONE_BAD_ORIGINAL 0
888c2ecf20Sopenharmony_ci#define ZONE_BAD_MARKED 7
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci#endif /* __MTD_NFTL_USER_H__ */
92