^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * This program is free software; you can redistribute it and/or modify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * it under the terms of the GNU General Public License as published by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * the Free Software Foundation; either version 2 of the License, or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * (at your option) any later version.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * This program is distributed in the hope that it will be useful,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * but WITHOUT ANY WARRANTY; without even the implied warranty of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * GNU General Public License for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * You should have received a copy of the GNU General Public License
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * along with this program; if not, write to the Free Software
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #ifndef __MTD_NFTL_USER_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define __MTD_NFTL_USER_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) /* Block Control Information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) struct nftl_bci {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) unsigned char ECCSig[6];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) __u8 Status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) __u8 Status1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) }__attribute__((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) /* Unit Control Information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) struct nftl_uci0 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) __u16 VirtUnitNum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) __u16 ReplUnitNum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) __u16 SpareVirtUnitNum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) __u16 SpareReplUnitNum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) } __attribute__((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) struct nftl_uci1 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) __u32 WearInfo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) __u16 EraseMark;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) __u16 EraseMark1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) } __attribute__((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) struct nftl_uci2 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) __u16 FoldMark;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) __u16 FoldMark1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) __u32 unused;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) } __attribute__((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) union nftl_uci {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) struct nftl_uci0 a;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) struct nftl_uci1 b;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) struct nftl_uci2 c;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) struct nftl_oob {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) struct nftl_bci b;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) union nftl_uci u;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) /* NFTL Media Header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) struct NFTLMediaHeader {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) char DataOrgID[6];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) __u16 NumEraseUnits;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) __u16 FirstPhysicalEUN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) __u32 FormattedSize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) unsigned char UnitSizeFactor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) } __attribute__((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) #define MAX_ERASE_ZONES (8192 - 512)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) #define ERASE_MARK 0x3c69
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) #define SECTOR_FREE 0xff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) #define SECTOR_USED 0x55
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) #define SECTOR_IGNORE 0x11
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) #define SECTOR_DELETED 0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) #define FOLD_MARK_IN_PROGRESS 0x5555
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) #define ZONE_GOOD 0xff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) #define ZONE_BAD_ORIGINAL 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) #define ZONE_BAD_MARKED 7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) #endif /* __MTD_NFTL_USER_H__ */