1 /* SPDX-License-Identifier: GPL 2.0+ OR BSD-3-Clause */
3 * Copyright (c) Thomas Gleixner <tglx@linutronix.de>
5 #ifndef __UBOOT_UBISPL_H
6 #define __UBOOT_UBISPL_H
9 * The following CONFIG options are relevant for UBISPL
11 * #define CONFIG_SPL_UBI_MAX_VOL_LEBS 256
13 * Defines the maximum number of logical erase blocks per loadable
14 * (static) volume to size the ubispl internal arrays.
16 * #define CONFIG_SPL_UBI_MAX_PEB_SIZE (256*1024)
18 * Defines the maximum physical erase block size to size the fastmap
21 * #define CONFIG_SPL_UBI_MAX_PEBS 4096
23 * Define the maximum number of physical erase blocks to size the
24 * ubispl internal arrays.
26 * #define CONFIG_SPL_UBI_VOL_IDS 8
28 * Defines the maximum number of volumes in which UBISPL is
29 * interested. Limits the amount of memory for the scan data and
30 * speeds up the scan process as we simply ignore stuff which we dont
31 * want to load from the SPL anyway. So the volumes which can be
32 * loaded in the above example are ids 0 - 7
36 * The struct definition is in drivers/mtd/ubispl/ubispl.h. It does
37 * not fit into the BSS due to the large buffer requirement of the
38 * upstream fastmap code. So the caller of ubispl_load_volumes needs
39 * to hand in a pointer to a free memory area where ubispl will place
40 * its data. The area is not required to be initialized.
44 typedef int (*ubispl_read_flash)(int pnum, int offset, int len, void *dst);
47 * struct ubispl_info - description structure for fast ubi scan
48 * @ubi: Pointer to memory space for ubi scan info structure
49 * @peb_size: Physical erase block size
50 * @vid_offset: Offset of the VID header
51 * @leb_start: Start of the logical erase block, i.e. offset of data
52 * @peb_count: Number of physical erase blocks in the UBI FLASH area
54 * @peb_offset: Offset of PEB0 in the UBI FLASH area (aka MTD partition)
55 * to the real start of the FLASH in erase blocks.
56 * @fastmap: Enable fastmap attachment
57 * @read: Read function to access the flash
60 struct ubi_scan_info *ubi;
67 ubispl_read_flash read;
71 * struct ubispl_load - structure to describe a volume to load
73 * @load_addr: Load address of the volume
81 * ubispl_load_volumes - Scan flash and load volumes
82 * @info: Pointer to the ubi scan info structure
83 * @lovls: Pointer to array of volumes to load
84 * @nrvols: Array size of @lovls
86 int ubispl_load_volumes(struct ubispl_info *info,
87 struct ubispl_load *lvols, int nrvols);