summaryrefslogtreecommitdiffstats
path: root/qemu/roms/u-boot/include/mtd
diff options
context:
space:
mode:
authorRajithaY <rajithax.yerrumsetty@intel.com>2017-04-25 03:31:15 -0700
committerRajitha Yerrumchetty <rajithax.yerrumsetty@intel.com>2017-05-22 06:48:08 +0000
commitbb756eebdac6fd24e8919e2c43f7d2c8c4091f59 (patch)
treeca11e03542edf2d8f631efeca5e1626d211107e3 /qemu/roms/u-boot/include/mtd
parenta14b48d18a9ed03ec191cf16b162206998a895ce (diff)
Adding qemu as a submodule of KVMFORNFV
This Patch includes the changes to add qemu as a submodule to kvmfornfv repo and make use of the updated latest qemu for the execution of all testcase Change-Id: I1280af507a857675c7f81d30c95255635667bdd7 Signed-off-by:RajithaY<rajithax.yerrumsetty@intel.com>
Diffstat (limited to 'qemu/roms/u-boot/include/mtd')
-rw-r--r--qemu/roms/u-boot/include/mtd/cfi_flash.h185
-rw-r--r--qemu/roms/u-boot/include/mtd/mtd-abi.h197
-rw-r--r--qemu/roms/u-boot/include/mtd/ubi-user.h256
3 files changed, 0 insertions, 638 deletions
diff --git a/qemu/roms/u-boot/include/mtd/cfi_flash.h b/qemu/roms/u-boot/include/mtd/cfi_flash.h
deleted file mode 100644
index 048b4773f..000000000
--- a/qemu/roms/u-boot/include/mtd/cfi_flash.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * (C) Copyright 2009
- * Stefan Roese, DENX Software Engineering, sr@denx.de.
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#ifndef __CFI_FLASH_H__
-#define __CFI_FLASH_H__
-
-#define FLASH_CMD_CFI 0x98
-#define FLASH_CMD_READ_ID 0x90
-#define FLASH_CMD_RESET 0xff
-#define FLASH_CMD_BLOCK_ERASE 0x20
-#define FLASH_CMD_ERASE_CONFIRM 0xD0
-#define FLASH_CMD_WRITE 0x40
-#define FLASH_CMD_PROTECT 0x60
-#define FLASH_CMD_SETUP 0x60
-#define FLASH_CMD_SET_CR_CONFIRM 0x03
-#define FLASH_CMD_PROTECT_SET 0x01
-#define FLASH_CMD_PROTECT_CLEAR 0xD0
-#define FLASH_CMD_CLEAR_STATUS 0x50
-#define FLASH_CMD_READ_STATUS 0x70
-#define FLASH_CMD_WRITE_TO_BUFFER 0xE8
-#define FLASH_CMD_WRITE_BUFFER_PROG 0xE9
-#define FLASH_CMD_WRITE_BUFFER_CONFIRM 0xD0
-
-#define FLASH_STATUS_DONE 0x80
-#define FLASH_STATUS_ESS 0x40
-#define FLASH_STATUS_ECLBS 0x20
-#define FLASH_STATUS_PSLBS 0x10
-#define FLASH_STATUS_VPENS 0x08
-#define FLASH_STATUS_PSS 0x04
-#define FLASH_STATUS_DPS 0x02
-#define FLASH_STATUS_R 0x01
-#define FLASH_STATUS_PROTECT 0x01
-
-#define AMD_CMD_RESET 0xF0
-#define AMD_CMD_WRITE 0xA0
-#define AMD_CMD_ERASE_START 0x80
-#define AMD_CMD_ERASE_SECTOR 0x30
-#define AMD_CMD_UNLOCK_START 0xAA
-#define AMD_CMD_UNLOCK_ACK 0x55
-#define AMD_CMD_WRITE_TO_BUFFER 0x25
-#define AMD_CMD_WRITE_BUFFER_CONFIRM 0x29
-#define AMD_CMD_SET_PPB_ENTRY 0xC0
-#define AMD_CMD_SET_PPB_EXIT_BC1 0x90
-#define AMD_CMD_SET_PPB_EXIT_BC2 0x00
-#define AMD_CMD_PPB_UNLOCK_BC1 0x80
-#define AMD_CMD_PPB_UNLOCK_BC2 0x30
-#define AMD_CMD_PPB_LOCK_BC1 0xA0
-#define AMD_CMD_PPB_LOCK_BC2 0x00
-
-#define AMD_STATUS_TOGGLE 0x40
-#define AMD_STATUS_ERROR 0x20
-
-#define ATM_CMD_UNLOCK_SECT 0x70
-#define ATM_CMD_SOFTLOCK_START 0x80
-#define ATM_CMD_LOCK_SECT 0x40
-
-#define FLASH_CONTINUATION_CODE 0x7F
-
-#define FLASH_OFFSET_MANUFACTURER_ID 0x00
-#define FLASH_OFFSET_DEVICE_ID 0x01
-#define FLASH_OFFSET_DEVICE_ID2 0x0E
-#define FLASH_OFFSET_DEVICE_ID3 0x0F
-#define FLASH_OFFSET_CFI 0x55
-#define FLASH_OFFSET_CFI_ALT 0x555
-#define FLASH_OFFSET_CFI_RESP 0x10
-#define FLASH_OFFSET_PRIMARY_VENDOR 0x13
-/* extended query table primary address */
-#define FLASH_OFFSET_EXT_QUERY_T_P_ADDR 0x15
-#define FLASH_OFFSET_WTOUT 0x1F
-#define FLASH_OFFSET_WBTOUT 0x20
-#define FLASH_OFFSET_ETOUT 0x21
-#define FLASH_OFFSET_CETOUT 0x22
-#define FLASH_OFFSET_WMAX_TOUT 0x23
-#define FLASH_OFFSET_WBMAX_TOUT 0x24
-#define FLASH_OFFSET_EMAX_TOUT 0x25
-#define FLASH_OFFSET_CEMAX_TOUT 0x26
-#define FLASH_OFFSET_SIZE 0x27
-#define FLASH_OFFSET_INTERFACE 0x28
-#define FLASH_OFFSET_BUFFER_SIZE 0x2A
-#define FLASH_OFFSET_NUM_ERASE_REGIONS 0x2C
-#define FLASH_OFFSET_ERASE_REGIONS 0x2D
-#define FLASH_OFFSET_PROTECT 0x02
-#define FLASH_OFFSET_USER_PROTECTION 0x85
-#define FLASH_OFFSET_INTEL_PROTECTION 0x81
-
-#define CFI_CMDSET_NONE 0
-#define CFI_CMDSET_INTEL_EXTENDED 1
-#define CFI_CMDSET_AMD_STANDARD 2
-#define CFI_CMDSET_INTEL_STANDARD 3
-#define CFI_CMDSET_AMD_EXTENDED 4
-#define CFI_CMDSET_MITSU_STANDARD 256
-#define CFI_CMDSET_MITSU_EXTENDED 257
-#define CFI_CMDSET_SST 258
-#define CFI_CMDSET_INTEL_PROG_REGIONS 512
-
-#ifdef CONFIG_SYS_FLASH_CFI_AMD_RESET /* needed for STM_ID_29W320DB on UC100 */
-# undef FLASH_CMD_RESET
-# define FLASH_CMD_RESET AMD_CMD_RESET /* use AMD-Reset instead */
-#endif
-
-#define NUM_ERASE_REGIONS 4 /* max. number of erase regions */
-
-typedef union {
- unsigned char c;
- unsigned short w;
- unsigned long l;
- unsigned long long ll;
-} cfiword_t;
-
-/* CFI standard query structure */
-/* The offsets and sizes of this packed structure members correspond
- * to the actual layout in CFI Flash chips. Some 16- and 32-bit members
- * are unaligned and must be accessed with explicit unaligned access macros.
- */
-struct cfi_qry {
- u8 qry[3];
- u16 p_id; /* unaligned */
- u16 p_adr; /* unaligned */
- u16 a_id; /* unaligned */
- u16 a_adr; /* unaligned */
- u8 vcc_min;
- u8 vcc_max;
- u8 vpp_min;
- u8 vpp_max;
- u8 word_write_timeout_typ;
- u8 buf_write_timeout_typ;
- u8 block_erase_timeout_typ;
- u8 chip_erase_timeout_typ;
- u8 word_write_timeout_max;
- u8 buf_write_timeout_max;
- u8 block_erase_timeout_max;
- u8 chip_erase_timeout_max;
- u8 dev_size;
- u16 interface_desc; /* aligned */
- u16 max_buf_write_size; /* aligned */
- u8 num_erase_regions;
- u32 erase_region_info[NUM_ERASE_REGIONS]; /* unaligned */
-} __attribute__((packed));
-
-struct cfi_pri_hdr {
- u8 pri[3];
- u8 major_version;
- u8 minor_version;
-} __attribute__((packed));
-
-#ifndef CONFIG_SYS_FLASH_BANKS_LIST
-#define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE }
-#endif
-
-/*
- * CFI_MAX_FLASH_BANKS only used for flash_info struct declaration.
- *
- * Use CONFIG_SYS_MAX_FLASH_BANKS_DETECT if defined
- */
-#if defined(CONFIG_SYS_MAX_FLASH_BANKS_DETECT)
-#define CONFIG_SYS_MAX_FLASH_BANKS (cfi_flash_num_flash_banks)
-#define CFI_MAX_FLASH_BANKS CONFIG_SYS_MAX_FLASH_BANKS_DETECT
-/* board code can update this variable before CFI detection */
-extern int cfi_flash_num_flash_banks;
-#else
-#define CFI_MAX_FLASH_BANKS CONFIG_SYS_MAX_FLASH_BANKS
-#endif
-
-void flash_write_cmd(flash_info_t * info, flash_sect_t sect,
- uint offset, u32 cmd);
-phys_addr_t cfi_flash_bank_addr(int i);
-unsigned long cfi_flash_bank_size(int i);
-void flash_cmd_reset(flash_info_t *info);
-
-#ifdef CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS
-void flash_write8(u8 value, void *addr);
-void flash_write16(u16 value, void *addr);
-void flash_write32(u32 value, void *addr);
-void flash_write64(u64 value, void *addr);
-u8 flash_read8(void *addr);
-u16 flash_read16(void *addr);
-u32 flash_read32(void *addr);
-u64 flash_read64(void *addr);
-#endif
-
-#endif /* __CFI_FLASH_H__ */
diff --git a/qemu/roms/u-boot/include/mtd/mtd-abi.h b/qemu/roms/u-boot/include/mtd/mtd-abi.h
deleted file mode 100644
index ac3c29876..000000000
--- a/qemu/roms/u-boot/include/mtd/mtd-abi.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * $Id: mtd-abi.h,v 1.13 2005/11/07 11:14:56 gleixner Exp $
- *
- * Portions of MTD ABI definition which are shared by kernel and user space
- */
-
-#ifndef __MTD_ABI_H__
-#define __MTD_ABI_H__
-
-#if 1
-#include <linux/compat.h>
-#endif
-
-#include <linux/compiler.h>
-
-struct erase_info_user {
- uint32_t start;
- uint32_t length;
-};
-
-struct mtd_oob_buf {
- uint32_t start;
- uint32_t length;
- unsigned char __user *ptr;
-};
-
-/*
- * MTD operation modes
- *
- * @MTD_OPS_PLACE_OOB: OOB data are placed at the given offset (default)
- * @MTD_OPS_AUTO_OOB: OOB data are automatically placed at the free areas
- * which are defined by the internal ecclayout
- * @MTD_OPS_RAW: data are transferred as-is, with no error correction;
- * this mode implies %MTD_OPS_PLACE_OOB
- *
- * These modes can be passed to ioctl(MEMWRITE) and are also used internally.
- * See notes on "MTD file modes" for discussion on %MTD_OPS_RAW vs.
- * %MTD_FILE_MODE_RAW.
- */
-enum {
- MTD_OPS_PLACE_OOB = 0,
- MTD_OPS_AUTO_OOB = 1,
- MTD_OPS_RAW = 2,
-};
-
-#define MTD_ABSENT 0
-#define MTD_RAM 1
-#define MTD_ROM 2
-#define MTD_NORFLASH 3
-#define MTD_NANDFLASH 4
-#define MTD_DATAFLASH 6
-#define MTD_UBIVOLUME 7
-
-#define MTD_WRITEABLE 0x400 /* Device is writeable */
-#define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */
-#define MTD_NO_ERASE 0x1000 /* No erase necessary */
-#define MTD_STUPID_LOCK 0x2000 /* Always locked after reset */
-
-/* Some common devices / combinations of capabilities */
-#define MTD_CAP_ROM 0
-#define MTD_CAP_RAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE)
-#define MTD_CAP_NORFLASH (MTD_WRITEABLE | MTD_BIT_WRITEABLE)
-#define MTD_CAP_NANDFLASH (MTD_WRITEABLE)
-
-/* ECC byte placement */
-#define MTD_NANDECC_OFF 0 /* Switch off ECC (Not recommended) */
-#define MTD_NANDECC_PLACE 1 /* Use the given placement in the structure (YAFFS1 legacy mode) */
-#define MTD_NANDECC_AUTOPLACE 2 /* Use the default placement scheme */
-#define MTD_NANDECC_PLACEONLY 3 /* Use the given placement in the structure (Do not store ecc result on read) */
-#define MTD_NANDECC_AUTOPL_USR 4 /* Use the given autoplacement scheme rather than using the default */
-
-/* OTP mode selection */
-#define MTD_OTP_OFF 0
-#define MTD_OTP_FACTORY 1
-#define MTD_OTP_USER 2
-
-struct mtd_info_user {
- uint8_t type;
- uint32_t flags;
- uint32_t size; /* Total size of the MTD */
- uint32_t erasesize;
- uint32_t writesize;
- uint32_t oobsize; /* Amount of OOB data per block (e.g. 16) */
- /* The below two fields are obsolete and broken, do not use them
- * (TODO: remove at some point) */
- uint32_t ecctype;
- uint32_t eccsize;
-};
-
-struct region_info_user {
- uint32_t offset; /* At which this region starts,
- * from the beginning of the MTD */
- uint32_t erasesize; /* For this region */
- uint32_t numblocks; /* Number of blocks in this region */
- uint32_t regionindex;
-};
-
-struct otp_info {
- uint32_t start;
- uint32_t length;
- uint32_t locked;
-};
-
-/* Get basic MTD characteristics info (better to use sysfs) */
-#define MEMGETINFO _IOR('M', 1, struct mtd_info_user)
-/* Erase segment of MTD */
-#define MEMERASE _IOW('M', 2, struct erase_info_user)
-/* Write out-of-band data from MTD */
-#define MEMWRITEOOB _IOWR('M', 3, struct mtd_oob_buf)
-/* Read out-of-band data from MTD */
-#define MEMREADOOB _IOWR('M', 4, struct mtd_oob_buf)
-/* Lock a chip (for MTD that supports it) */
-#define MEMLOCK _IOW('M', 5, struct erase_info_user)
-/* Unlock a chip (for MTD that supports it) */
-#define MEMUNLOCK _IOW('M', 6, struct erase_info_user)
-/* Get the number of different erase regions */
-#define MEMGETREGIONCOUNT _IOR('M', 7, int)
-/* Get information about the erase region for a specific index */
-#define MEMGETREGIONINFO _IOWR('M', 8, struct region_info_user)
-/* Get info about OOB modes (e.g., RAW, PLACE, AUTO) - legacy interface */
-#define MEMSETOOBSEL _IOW('M', 9, struct nand_oobinfo)
-#define MEMGETOOBSEL _IOR('M', 10, struct nand_oobinfo)
-/* Check if an eraseblock is bad */
-#define MEMGETBADBLOCK _IOW('M', 11, loff_t)
-/* Mark an eraseblock as bad */
-#define MEMSETBADBLOCK _IOW('M', 12, loff_t)
-/* Set OTP (One-Time Programmable) mode (factory vs. user) */
-#define OTPSELECT _IOR('M', 13, int)
-/* Get number of OTP (One-Time Programmable) regions */
-#define OTPGETREGIONCOUNT _IOW('M', 14, int)
-/* Get all OTP (One-Time Programmable) info about MTD */
-#define OTPGETREGIONINFO _IOW('M', 15, struct otp_info)
-/* Lock a given range of user data (must be in mode %MTD_FILE_MODE_OTP_USER) */
-#define OTPLOCK _IOR('M', 16, struct otp_info)
-/* Get ECC layout (deprecated) */
-#define ECCGETLAYOUT _IOR('M', 17, struct nand_ecclayout)
-/* Get statistics about corrected/uncorrected errors */
-#define ECCGETSTATS _IOR('M', 18, struct mtd_ecc_stats)
-/* Set MTD mode on a per-file-descriptor basis (see "MTD file modes") */
-#define MTDFILEMODE _IO('M', 19)
-
-/*
- * Obsolete legacy interface. Keep it in order not to break userspace
- * interfaces
- */
-struct nand_oobinfo {
- uint32_t useecc;
- uint32_t eccbytes;
- uint32_t oobfree[8][2];
- uint32_t eccpos[48];
-};
-
-struct nand_oobfree {
- uint32_t offset;
- uint32_t length;
-};
-
-/**
- * struct mtd_ecc_stats - error correction stats
- *
- * @corrected: number of corrected bits
- * @failed: number of uncorrectable errors
- * @badblocks: number of bad blocks in this partition
- * @bbtblocks: number of blocks reserved for bad block tables
- */
-struct mtd_ecc_stats {
- uint32_t corrected;
- uint32_t failed;
- uint32_t badblocks;
- uint32_t bbtblocks;
-};
-
-/*
- * MTD file modes - for read/write access to MTD
- *
- * @MTD_FILE_MODE_NORMAL: OTP disabled, ECC enabled
- * @MTD_FILE_MODE_OTP_FACTORY: OTP enabled in factory mode
- * @MTD_FILE_MODE_OTP_USER: OTP enabled in user mode
- * @MTD_FILE_MODE_RAW: OTP disabled, ECC disabled
- *
- * These modes can be set via ioctl(MTDFILEMODE). The mode mode will be retained
- * separately for each open file descriptor.
- *
- * Note: %MTD_FILE_MODE_RAW provides the same functionality as %MTD_OPS_RAW -
- * raw access to the flash, without error correction or autoplacement schemes.
- * Wherever possible, the MTD_OPS_* mode will override the MTD_FILE_MODE_* mode
- * (e.g., when using ioctl(MEMWRITE)), but in some cases, the MTD_FILE_MODE is
- * used out of necessity (e.g., `write()', ioctl(MEMWRITEOOB64)).
- */
-enum mtd_file_modes {
- MTD_MODE_NORMAL = MTD_OTP_OFF,
- MTD_MODE_OTP_FACTORY = MTD_OTP_FACTORY,
- MTD_MODE_OTP_USER = MTD_OTP_USER,
- MTD_MODE_RAW,
-};
-
-#endif /* __MTD_ABI_H__ */
diff --git a/qemu/roms/u-boot/include/mtd/ubi-user.h b/qemu/roms/u-boot/include/mtd/ubi-user.h
deleted file mode 100644
index 1ccc06ea6..000000000
--- a/qemu/roms/u-boot/include/mtd/ubi-user.h
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Copyright (c) International Business Machines Corp., 2006
- *
- * SPDX-License-Identifier: GPL-2.0+
- *
- * Author: Artem Bityutskiy (Битюцкий Артём)
- */
-
-#ifndef __UBI_USER_H__
-#define __UBI_USER_H__
-
-/*
- * UBI device creation (the same as MTD device attachment)
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * MTD devices may be attached using %UBI_IOCATT ioctl command of the UBI
- * control device. The caller has to properly fill and pass
- * &struct ubi_attach_req object - UBI will attach the MTD device specified in
- * the request and return the newly created UBI device number as the ioctl
- * return value.
- *
- * UBI device deletion (the same as MTD device detachment)
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * An UBI device maybe deleted with %UBI_IOCDET ioctl command of the UBI
- * control device.
- *
- * UBI volume creation
- * ~~~~~~~~~~~~~~~~~~~
- *
- * UBI volumes are created via the %UBI_IOCMKVOL IOCTL command of UBI character
- * device. A &struct ubi_mkvol_req object has to be properly filled and a
- * pointer to it has to be passed to the IOCTL.
- *
- * UBI volume deletion
- * ~~~~~~~~~~~~~~~~~~~
- *
- * To delete a volume, the %UBI_IOCRMVOL IOCTL command of the UBI character
- * device should be used. A pointer to the 32-bit volume ID hast to be passed
- * to the IOCTL.
- *
- * UBI volume re-size
- * ~~~~~~~~~~~~~~~~~~
- *
- * To re-size a volume, the %UBI_IOCRSVOL IOCTL command of the UBI character
- * device should be used. A &struct ubi_rsvol_req object has to be properly
- * filled and a pointer to it has to be passed to the IOCTL.
- *
- * UBI volume update
- * ~~~~~~~~~~~~~~~~~
- *
- * Volume update should be done via the %UBI_IOCVOLUP IOCTL command of the
- * corresponding UBI volume character device. A pointer to a 64-bit update
- * size should be passed to the IOCTL. After this, UBI expects user to write
- * this number of bytes to the volume character device. The update is finished
- * when the claimed number of bytes is passed. So, the volume update sequence
- * is something like:
- *
- * fd = open("/dev/my_volume");
- * ioctl(fd, UBI_IOCVOLUP, &image_size);
- * write(fd, buf, image_size);
- * close(fd);
- *
- * Atomic eraseblock change
- * ~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * Atomic eraseblock change operation is done via the %UBI_IOCEBCH IOCTL
- * command of the corresponding UBI volume character device. A pointer to
- * &struct ubi_leb_change_req has to be passed to the IOCTL. Then the user is
- * expected to write the requested amount of bytes. This is similar to the
- * "volume update" IOCTL.
- */
-
-/*
- * When a new UBI volume or UBI device is created, users may either specify the
- * volume/device number they want to create or to let UBI automatically assign
- * the number using these constants.
- */
-#define UBI_VOL_NUM_AUTO (-1)
-#define UBI_DEV_NUM_AUTO (-1)
-
-/* Maximum volume name length */
-#define UBI_MAX_VOLUME_NAME 127
-
-/* IOCTL commands of UBI character devices */
-
-#define UBI_IOC_MAGIC 'o'
-
-/* Create an UBI volume */
-#define UBI_IOCMKVOL _IOW(UBI_IOC_MAGIC, 0, struct ubi_mkvol_req)
-/* Remove an UBI volume */
-#define UBI_IOCRMVOL _IOW(UBI_IOC_MAGIC, 1, int32_t)
-/* Re-size an UBI volume */
-#define UBI_IOCRSVOL _IOW(UBI_IOC_MAGIC, 2, struct ubi_rsvol_req)
-
-/* IOCTL commands of the UBI control character device */
-
-#define UBI_CTRL_IOC_MAGIC 'o'
-
-/* Attach an MTD device */
-#define UBI_IOCATT _IOW(UBI_CTRL_IOC_MAGIC, 64, struct ubi_attach_req)
-/* Detach an MTD device */
-#define UBI_IOCDET _IOW(UBI_CTRL_IOC_MAGIC, 65, int32_t)
-
-/* IOCTL commands of UBI volume character devices */
-
-#define UBI_VOL_IOC_MAGIC 'O'
-
-/* Start UBI volume update */
-#define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, int64_t)
-/* An eraseblock erasure command, used for debugging, disabled by default */
-#define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, int32_t)
-/* An atomic eraseblock change command */
-#define UBI_IOCEBCH _IOW(UBI_VOL_IOC_MAGIC, 2, int32_t)
-
-/* Maximum MTD device name length supported by UBI */
-#define MAX_UBI_MTD_NAME_LEN 127
-
-/*
- * UBI data type hint constants.
- *
- * UBI_LONGTERM: long-term data
- * UBI_SHORTTERM: short-term data
- * UBI_UNKNOWN: data persistence is unknown
- *
- * These constants are used when data is written to UBI volumes in order to
- * help the UBI wear-leveling unit to find more appropriate physical
- * eraseblocks.
- */
-enum {
- UBI_LONGTERM = 1,
- UBI_SHORTTERM = 2,
- UBI_UNKNOWN = 3,
-};
-
-/*
- * UBI volume type constants.
- *
- * @UBI_DYNAMIC_VOLUME: dynamic volume
- * @UBI_STATIC_VOLUME: static volume
- */
-enum {
- UBI_DYNAMIC_VOLUME = 3,
- UBI_STATIC_VOLUME = 4,
-};
-
-/**
- * struct ubi_attach_req - attach MTD device request.
- * @ubi_num: UBI device number to create
- * @mtd_num: MTD device number to attach
- * @vid_hdr_offset: VID header offset (use defaults if %0)
- * @padding: reserved for future, not used, has to be zeroed
- *
- * This data structure is used to specify MTD device UBI has to attach and the
- * parameters it has to use. The number which should be assigned to the new UBI
- * device is passed in @ubi_num. UBI may automatically assign the number if
- * @UBI_DEV_NUM_AUTO is passed. In this case, the device number is returned in
- * @ubi_num.
- *
- * Most applications should pass %0 in @vid_hdr_offset to make UBI use default
- * offset of the VID header within physical eraseblocks. The default offset is
- * the next min. I/O unit after the EC header. For example, it will be offset
- * 512 in case of a 512 bytes page NAND flash with no sub-page support. Or
- * it will be 512 in case of a 2KiB page NAND flash with 4 512-byte sub-pages.
- *
- * But in rare cases, if this optimizes things, the VID header may be placed to
- * a different offset. For example, the boot-loader might do things faster if the
- * VID header sits at the end of the first 2KiB NAND page with 4 sub-pages. As
- * the boot-loader would not normally need to read EC headers (unless it needs
- * UBI in RW mode), it might be faster to calculate ECC. This is weird example,
- * but it real-life example. So, in this example, @vid_hdr_offer would be
- * 2KiB-64 bytes = 1984. Note, that this position is not even 512-bytes
- * aligned, which is OK, as UBI is clever enough to realize this is 4th sub-page
- * of the first page and add needed padding.
- */
-struct ubi_attach_req {
- int32_t ubi_num;
- int32_t mtd_num;
- int32_t vid_hdr_offset;
- uint8_t padding[12];
-};
-
-/**
- * struct ubi_mkvol_req - volume description data structure used in
- * volume creation requests.
- * @vol_id: volume number
- * @alignment: volume alignment
- * @bytes: volume size in bytes
- * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME)
- * @padding1: reserved for future, not used, has to be zeroed
- * @name_len: volume name length
- * @padding2: reserved for future, not used, has to be zeroed
- * @name: volume name
- *
- * This structure is used by user-space programs when creating new volumes. The
- * @used_bytes field is only necessary when creating static volumes.
- *
- * The @alignment field specifies the required alignment of the volume logical
- * eraseblock. This means, that the size of logical eraseblocks will be aligned
- * to this number, i.e.,
- * (UBI device logical eraseblock size) mod (@alignment) = 0.
- *
- * To put it differently, the logical eraseblock of this volume may be slightly
- * shortened in order to make it properly aligned. The alignment has to be
- * multiple of the flash minimal input/output unit, or %1 to utilize the entire
- * available space of logical eraseblocks.
- *
- * The @alignment field may be useful, for example, when one wants to maintain
- * a block device on top of an UBI volume. In this case, it is desirable to fit
- * an integer number of blocks in logical eraseblocks of this UBI volume. With
- * alignment it is possible to update this volume using plane UBI volume image
- * BLOBs, without caring about how to properly align them.
- */
-struct ubi_mkvol_req {
- int32_t vol_id;
- int32_t alignment;
- int64_t bytes;
- int8_t vol_type;
- int8_t padding1;
- int16_t name_len;
- int8_t padding2[4];
- char name[UBI_MAX_VOLUME_NAME + 1];
-} __attribute__ ((packed));
-
-/**
- * struct ubi_rsvol_req - a data structure used in volume re-size requests.
- * @vol_id: ID of the volume to re-size
- * @bytes: new size of the volume in bytes
- *
- * Re-sizing is possible for both dynamic and static volumes. But while dynamic
- * volumes may be re-sized arbitrarily, static volumes cannot be made to be
- * smaller then the number of bytes they bear. To arbitrarily shrink a static
- * volume, it must be wiped out first (by means of volume update operation with
- * zero number of bytes).
- */
-struct ubi_rsvol_req {
- int64_t bytes;
- int32_t vol_id;
-} __attribute__ ((packed));
-
-/**
- * struct ubi_leb_change_req - a data structure used in atomic logical
- * eraseblock change requests.
- * @lnum: logical eraseblock number to change
- * @bytes: how many bytes will be written to the logical eraseblock
- * @dtype: data type (%UBI_LONGTERM, %UBI_SHORTTERM, %UBI_UNKNOWN)
- * @padding: reserved for future, not used, has to be zeroed
- */
-struct ubi_leb_change_req {
- int32_t lnum;
- int32_t bytes;
- uint8_t dtype;
- uint8_t padding[7];
-} __attribute__ ((packed));
-
-#endif /* __UBI_USER_H__ */