2022-01-13 02:26:25 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ BSD-3-Clause */
|
2018-11-16 01:43:50 +00:00
|
|
|
/*
|
|
|
|
* This provides a standard way of passing information between boot phases
|
|
|
|
* (TPL -> SPL -> U-Boot proper.)
|
|
|
|
*
|
2022-03-13 22:22:48 +00:00
|
|
|
* It consists of a list of blobs of data, tagged with their owner / contents.
|
|
|
|
* The list resides in memory and can be updated by SPL, U-Boot, etc.
|
|
|
|
*
|
|
|
|
* Design goals for bloblist:
|
|
|
|
*
|
|
|
|
* 1. Small and efficient structure. This avoids UUIDs or 16-byte name fields,
|
|
|
|
* since a 32-bit tag provides enough space for all the tags we will even need.
|
|
|
|
* If UUIDs are desired, they can be added inside a particular blob.
|
|
|
|
*
|
|
|
|
* 2. Avoids use of pointers, so the structure can be relocated in memory. The
|
|
|
|
* data in each blob is inline, rather than using pointers.
|
|
|
|
*
|
|
|
|
* 3. Bloblist is designed to start small in TPL or SPL, when only a few things
|
|
|
|
* are needed, like the memory size or whether console output should be enabled.
|
|
|
|
* Then it can grow in U-Boot proper, e.g. to include space for ACPI tables.
|
|
|
|
*
|
|
|
|
* 4. The bloblist structure is simple enough that it can be implemented in a
|
|
|
|
* small amount of C code. The API does not require use of strings or UUIDs,
|
|
|
|
* which would add to code size. For Thumb-2 the code size needed in SPL is
|
|
|
|
* approximately 940 bytes (e.g. for chromebook_bob).
|
|
|
|
*
|
|
|
|
* 5. Bloblist uses 16-byte alignment internally and is designed to start on a
|
|
|
|
* 16-byte boundary. Its headers are multiples of 16 bytes. This makes it easier
|
|
|
|
* to deal with data structures which need this level of alignment, such as ACPI
|
|
|
|
* tables. For use in SPL and TPL the alignment can be relaxed, since it can be
|
|
|
|
* relocated to an aligned address in U-Boot proper.
|
|
|
|
*
|
|
|
|
* 6. Bloblist is designed to be passed to Linux as reserved memory. While linux
|
|
|
|
* doesn't understand the bloblist header, it can be passed the indivdual blobs.
|
|
|
|
* For example, ACPI tables can reside in a blob and the address of those is
|
|
|
|
* passed to Linux, without Linux ever being away of the existence of a
|
|
|
|
* bloblist. Having all the blobs contiguous in memory simplifies the
|
|
|
|
* reserved-memory space.
|
|
|
|
*
|
|
|
|
* 7. Bloblist tags are defined in the enum below. There is an area for
|
|
|
|
* project-specific stuff (e.g. U-Boot, TF-A) and vendor-specific stuff, e.g.
|
|
|
|
* something used only on a particular SoC. There is also a private area for
|
|
|
|
* temporary, local use.
|
|
|
|
*
|
|
|
|
* 8. Bloblist includes a simple checksum, so that each boot phase can update
|
|
|
|
* this and allow the next phase to check that all is well. While the bloblist
|
|
|
|
* is small, this is quite cheap to calculate. When it grows (e.g. in U-Boot\
|
|
|
|
* proper), the CPU is likely running faster, so it is not prohibitive. Having
|
|
|
|
* said that, U-Boot is often the last phase that uses bloblist, so calculating
|
|
|
|
* the checksum there may not be necessary.
|
|
|
|
*
|
|
|
|
* 9. It would be possible to extend bloblist to support a non-contiguous
|
|
|
|
* structure, e.g. by creating a blob type that points to the next bloblist.
|
|
|
|
* This does not seem necessary for now. It adds complexity and code. We can
|
|
|
|
* always just copy it.
|
|
|
|
*
|
|
|
|
* 10. Bloblist is designed for simple structures, those that can be defined by
|
|
|
|
* a single C struct. More complex structures should be passed in a device tree.
|
|
|
|
* There are some exceptions, chiefly the various binary structures that Intel
|
|
|
|
* is fond of creating. But device tree provides a dictionary-type format which
|
|
|
|
* is fairly efficient (for use in U-Boot proper and Linux at least), along with
|
|
|
|
* a schema and a good set of tools. New formats should be designed around
|
|
|
|
* device tree rather than creating new binary formats, unless they are needed
|
|
|
|
* early in boot (where libfdt's 3KB of overhead is too large) and are trival
|
|
|
|
* enough to be described by a C struct.
|
2018-11-16 01:43:50 +00:00
|
|
|
*
|
|
|
|
* Copyright 2018 Google, Inc
|
|
|
|
* Written by Simon Glass <sjg@chromium.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __BLOBLIST_H
|
|
|
|
#define __BLOBLIST_H
|
|
|
|
|
2022-01-13 02:26:16 +00:00
|
|
|
#include <mapmem.h>
|
|
|
|
|
2018-11-16 01:43:50 +00:00
|
|
|
enum {
|
|
|
|
BLOBLIST_VERSION = 0,
|
|
|
|
BLOBLIST_MAGIC = 0xb00757a3,
|
|
|
|
BLOBLIST_ALIGN = 16,
|
|
|
|
};
|
|
|
|
|
2020-09-20 00:49:26 +00:00
|
|
|
/* Supported tags - add new ones to tag_name in bloblist.c */
|
2018-11-16 01:43:50 +00:00
|
|
|
enum bloblist_tag_t {
|
|
|
|
BLOBLISTT_NONE = 0,
|
|
|
|
|
2022-01-13 02:26:19 +00:00
|
|
|
/*
|
|
|
|
* Standard area to allocate blobs used across firmware components, for
|
|
|
|
* things that are very commonly used, particularly in multiple
|
|
|
|
* projects.
|
|
|
|
*/
|
|
|
|
BLOBLISTT_AREA_FIRMWARE_TOP = 0x1,
|
|
|
|
|
|
|
|
/* Standard area to allocate blobs used across firmware components */
|
|
|
|
BLOBLISTT_AREA_FIRMWARE = 0x100,
|
2020-09-22 18:44:55 +00:00
|
|
|
/*
|
|
|
|
* Advanced Configuration and Power Interface Global Non-Volatile
|
|
|
|
* Sleeping table. This forms part of the ACPI tables passed to Linux.
|
|
|
|
*/
|
2022-01-13 02:26:19 +00:00
|
|
|
BLOBLISTT_ACPI_GNVS = 0x100,
|
|
|
|
BLOBLISTT_INTEL_VBT = 0x101, /* Intel Video-BIOS table */
|
|
|
|
BLOBLISTT_TPM2_TCG_LOG = 0x102, /* TPM v2 log space */
|
|
|
|
BLOBLISTT_TCPA_LOG = 0x103, /* TPM log space */
|
|
|
|
BLOBLISTT_ACPI_TABLES = 0x104, /* ACPI tables for x86 */
|
|
|
|
BLOBLISTT_SMBIOS_TABLES = 0x105, /* SMBIOS tables for x86 */
|
|
|
|
BLOBLISTT_VBOOT_CTX = 0x106, /* Chromium OS verified boot context */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Project-specific tags are permitted here. Projects can be open source
|
|
|
|
* or not, but the format of the data must be fuily documented in an
|
|
|
|
* open source project, including all fields, bits, etc. Naming should
|
|
|
|
* be: BLOBLISTT_<project>_<purpose_here>
|
|
|
|
*/
|
|
|
|
BLOBLISTT_PROJECT_AREA = 0x8000,
|
|
|
|
BLOBLISTT_U_BOOT_SPL_HANDOFF = 0x8000, /* Hand-off info from SPL */
|
2022-10-21 00:23:18 +00:00
|
|
|
BLOBLISTT_VBE = 0x8001, /* VBE per-phase state */
|
2023-07-16 03:38:59 +00:00
|
|
|
BLOBLISTT_U_BOOT_VIDEO = 0x8002, /* Video information from SPL */
|
2022-01-13 02:26:19 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Vendor-specific tags are permitted here. Projects can be open source
|
|
|
|
* or not, but the format of the data must be fuily documented in an
|
|
|
|
* open source project, including all fields, bits, etc. Naming should
|
|
|
|
* be BLOBLISTT_<vendor>_<purpose_here>
|
|
|
|
*/
|
|
|
|
BLOBLISTT_VENDOR_AREA = 0xc000,
|
|
|
|
|
|
|
|
/* Tags after this are not allocated for now */
|
|
|
|
BLOBLISTT_EXPANSION = 0x10000,
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Tags from here are on reserved for private use within a single
|
|
|
|
* firmware binary (i.e. a single executable or phase of a project).
|
|
|
|
* These tags can be passed between binaries within a local
|
|
|
|
* implementation, but cannot be used in upstream code. Allocate a
|
|
|
|
* tag in one of the areas above if you want that.
|
|
|
|
*
|
|
|
|
* This area may move in future.
|
|
|
|
*/
|
|
|
|
BLOBLISTT_PRIVATE_AREA = 0xffff0000,
|
2018-11-16 01:43:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct bloblist_hdr - header for the bloblist
|
|
|
|
*
|
|
|
|
* This is stored at the start of the bloblist which is always on a 16-byte
|
|
|
|
* boundary. Records follow this header. The bloblist normally stays in the
|
|
|
|
* same place in memory as SPL and U-Boot execute, but it can be safely moved
|
|
|
|
* around.
|
|
|
|
*
|
2022-01-13 02:26:24 +00:00
|
|
|
* None of the bloblist headers themselves contain pointers but it is possible
|
|
|
|
* to put pointers inside a bloblist record if desired. This is not encouraged,
|
2018-11-16 01:43:50 +00:00
|
|
|
* since it can make part of the bloblist inaccessible if the pointer is
|
|
|
|
* no-longer valid. It is better to just store all the data inside a bloblist
|
|
|
|
* record.
|
|
|
|
*
|
|
|
|
* Each bloblist record is aligned to a 16-byte boundary and follows immediately
|
|
|
|
* from the last.
|
|
|
|
*
|
2022-01-13 02:26:16 +00:00
|
|
|
* @magic: BLOBLIST_MAGIC
|
2018-11-16 01:43:50 +00:00
|
|
|
* @version: BLOBLIST_VERSION
|
|
|
|
* @hdr_size: Size of this header, normally sizeof(struct bloblist_hdr). The
|
|
|
|
* first bloblist_rec starts at this offset from the start of the header
|
2022-01-13 02:26:24 +00:00
|
|
|
* @flags: Space for BLOBLISTF... flags (none yet)
|
2021-07-05 22:32:54 +00:00
|
|
|
* @size: Total size of the bloblist (non-zero if valid) including this header.
|
2018-11-16 01:43:50 +00:00
|
|
|
* The bloblist extends for this many bytes from the start of this header.
|
2021-07-05 22:32:54 +00:00
|
|
|
* When adding new records, the bloblist can grow up to this size.
|
|
|
|
* @alloced: Total size allocated so far for this bloblist. This starts out as
|
2018-11-16 01:43:50 +00:00
|
|
|
* sizeof(bloblist_hdr) since we need at least that much space to store a
|
|
|
|
* valid bloblist
|
2020-09-20 00:49:30 +00:00
|
|
|
* @spare: Spare space (for future use)
|
2018-11-16 01:43:50 +00:00
|
|
|
* @chksum: CRC32 for the entire bloblist allocated area. Since any of the
|
|
|
|
* blobs can be altered after being created, this checksum is only valid
|
|
|
|
* when the bloblist is finalised before jumping to the next stage of boot.
|
2022-01-13 02:26:24 +00:00
|
|
|
* Note that chksum is last to make it easier to exclude it from the
|
|
|
|
* checksum calculation.
|
2018-11-16 01:43:50 +00:00
|
|
|
*/
|
|
|
|
struct bloblist_hdr {
|
2022-01-13 02:26:16 +00:00
|
|
|
u32 magic;
|
2018-11-16 01:43:50 +00:00
|
|
|
u32 version;
|
|
|
|
u32 hdr_size;
|
|
|
|
u32 flags;
|
|
|
|
|
|
|
|
u32 size;
|
|
|
|
u32 alloced;
|
|
|
|
u32 spare;
|
|
|
|
u32 chksum;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct bloblist_rec - record for the bloblist
|
|
|
|
*
|
|
|
|
* The bloblist contains a number of records each consisting of this record
|
|
|
|
* structure followed by the data contained. Each records is 16-byte aligned.
|
|
|
|
*
|
2022-01-13 02:26:24 +00:00
|
|
|
* NOTE: Only exported for testing purposes. Do not use this struct.
|
|
|
|
*
|
2018-11-16 01:43:50 +00:00
|
|
|
* @tag: Tag indicating what the record contains
|
|
|
|
* @hdr_size: Size of this header, normally sizeof(struct bloblist_rec). The
|
|
|
|
* record's data starts at this offset from the start of the record
|
|
|
|
* @size: Size of record in bytes, excluding the header size. This does not
|
|
|
|
* need to be aligned (e.g. 3 is OK).
|
|
|
|
* @spare: Spare space for other things
|
|
|
|
*/
|
|
|
|
struct bloblist_rec {
|
|
|
|
u32 tag;
|
|
|
|
u32 hdr_size;
|
|
|
|
u32 size;
|
|
|
|
u32 spare;
|
|
|
|
};
|
|
|
|
|
2022-01-13 02:26:16 +00:00
|
|
|
/**
|
|
|
|
* bloblist_check_magic() - return a bloblist if the magic matches
|
|
|
|
*
|
|
|
|
* @addr: Address to check
|
2022-01-13 02:26:24 +00:00
|
|
|
* Return: pointer to bloblist, if the magic matches, else NULL
|
2022-01-13 02:26:16 +00:00
|
|
|
*/
|
|
|
|
static inline void *bloblist_check_magic(ulong addr)
|
|
|
|
{
|
|
|
|
u32 *ptr;
|
|
|
|
|
|
|
|
if (!addr)
|
|
|
|
return NULL;
|
|
|
|
ptr = map_sysmem(addr, 0);
|
|
|
|
if (*ptr != BLOBLIST_MAGIC)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return ptr;
|
|
|
|
}
|
|
|
|
|
2018-11-16 01:43:50 +00:00
|
|
|
/**
|
|
|
|
* bloblist_find() - Find a blob
|
|
|
|
*
|
|
|
|
* Searches the bloblist and returns the blob with the matching tag
|
|
|
|
*
|
|
|
|
* @tag: Tag to search for (enum bloblist_tag_t)
|
2020-09-20 00:49:30 +00:00
|
|
|
* @size: Expected size of the blob, or 0 for any size
|
2022-01-13 02:26:24 +00:00
|
|
|
* Return: pointer to blob if found, or NULL if not found, or a blob was found
|
|
|
|
* but it is the wrong size
|
2018-11-16 01:43:50 +00:00
|
|
|
*/
|
|
|
|
void *bloblist_find(uint tag, int size);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* bloblist_add() - Add a new blob
|
|
|
|
*
|
|
|
|
* Add a new blob to the bloblist
|
|
|
|
*
|
|
|
|
* This should only be called if you konw there is no existing blob for a
|
|
|
|
* particular tag. It is typically safe to call in the first phase of U-Boot
|
|
|
|
* (e.g. TPL or SPL). After that, bloblist_ensure() should be used instead.
|
|
|
|
*
|
|
|
|
* @tag: Tag to add (enum bloblist_tag_t)
|
|
|
|
* @size: Size of the blob
|
2020-09-20 00:49:29 +00:00
|
|
|
* @align: Alignment of the blob (in bytes), 0 for default
|
2022-01-13 02:26:24 +00:00
|
|
|
* Return: pointer to the newly added block, or NULL if there is not enough
|
|
|
|
* space for the blob
|
2018-11-16 01:43:50 +00:00
|
|
|
*/
|
2020-09-20 00:49:29 +00:00
|
|
|
void *bloblist_add(uint tag, int size, int align);
|
2018-11-16 01:43:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* bloblist_ensure_size() - Find or add a blob
|
|
|
|
*
|
|
|
|
* Find an existing blob, or add a new one if not found
|
|
|
|
*
|
|
|
|
* @tag: Tag to add (enum bloblist_tag_t)
|
|
|
|
* @size: Size of the blob
|
|
|
|
* @blobp: Returns a pointer to blob on success
|
2020-09-20 00:49:29 +00:00
|
|
|
* @align: Alignment of the blob (in bytes), 0 for default
|
2022-01-13 02:26:24 +00:00
|
|
|
* Return: 0 if OK, -ENOSPC if it is missing and could not be added due to lack
|
|
|
|
* of space, or -ESPIPE it exists but has the wrong size
|
2018-11-16 01:43:50 +00:00
|
|
|
*/
|
2020-09-20 00:49:29 +00:00
|
|
|
int bloblist_ensure_size(uint tag, int size, int align, void **blobp);
|
2018-11-16 01:43:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* bloblist_ensure() - Find or add a blob
|
|
|
|
*
|
|
|
|
* Find an existing blob, or add a new one if not found
|
|
|
|
*
|
|
|
|
* @tag: Tag to add (enum bloblist_tag_t)
|
|
|
|
* @size: Size of the blob
|
2022-01-13 02:26:24 +00:00
|
|
|
* Return: pointer to blob, or NULL if it is missing and could not be added due
|
|
|
|
* to lack of space, or it exists but has the wrong size
|
2018-11-16 01:43:50 +00:00
|
|
|
*/
|
|
|
|
void *bloblist_ensure(uint tag, int size);
|
|
|
|
|
2020-01-27 15:49:50 +00:00
|
|
|
/**
|
|
|
|
* bloblist_ensure_size_ret() - Find or add a blob
|
|
|
|
*
|
|
|
|
* Find an existing blob, or add a new one if not found
|
|
|
|
*
|
|
|
|
* @tag: Tag to add (enum bloblist_tag_t)
|
|
|
|
* @sizep: Size of the blob to create; returns size of actual blob
|
|
|
|
* @blobp: Returns a pointer to blob on success
|
2022-01-13 02:26:24 +00:00
|
|
|
* Return: 0 if OK, -ENOSPC if it is missing and could not be added due to lack
|
|
|
|
* of space
|
2020-01-27 15:49:50 +00:00
|
|
|
*/
|
|
|
|
int bloblist_ensure_size_ret(uint tag, int *sizep, void **blobp);
|
|
|
|
|
2021-07-05 22:32:53 +00:00
|
|
|
/**
|
|
|
|
* bloblist_resize() - resize a blob
|
|
|
|
*
|
|
|
|
* Any blobs above this one are relocated up or down. The resized blob remains
|
|
|
|
* in the same place.
|
|
|
|
*
|
|
|
|
* @tag: Tag to add (enum bloblist_tag_t)
|
|
|
|
* @new_size: New size of the blob (>0 to expand, <0 to contract)
|
2022-01-13 02:26:24 +00:00
|
|
|
* Return: 0 if OK, -ENOSPC if the bloblist does not have enough space, -ENOENT
|
|
|
|
* if the tag is not found
|
2021-07-05 22:32:53 +00:00
|
|
|
*/
|
|
|
|
int bloblist_resize(uint tag, int new_size);
|
|
|
|
|
2018-11-16 01:43:50 +00:00
|
|
|
/**
|
|
|
|
* bloblist_new() - Create a new, empty bloblist of a given size
|
|
|
|
*
|
|
|
|
* @addr: Address of bloblist
|
|
|
|
* @size: Initial size for bloblist
|
|
|
|
* @flags: Flags to use for bloblist
|
2022-01-13 02:26:24 +00:00
|
|
|
* Return: 0 if OK, -EFAULT if addr is not aligned correctly, -ENOSPC is the
|
|
|
|
* area is not large enough
|
2018-11-16 01:43:50 +00:00
|
|
|
*/
|
|
|
|
int bloblist_new(ulong addr, uint size, uint flags);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* bloblist_check() - Check if a bloblist exists
|
|
|
|
*
|
|
|
|
* @addr: Address of bloblist
|
|
|
|
* @size: Expected size of blobsize, or 0 to detect the size
|
2022-01-13 02:26:24 +00:00
|
|
|
* Return: 0 if OK, -ENOENT if the magic number doesn't match (indicating that
|
|
|
|
* there problem is no bloblist at the given address), -EPROTONOSUPPORT
|
|
|
|
* if the version does not match, -EIO if the checksum does not match,
|
|
|
|
* -EFBIG if the expected size does not match the detected size, -ENOSPC
|
|
|
|
* if the size is not large enough to hold the headers
|
2018-11-16 01:43:50 +00:00
|
|
|
*/
|
|
|
|
int bloblist_check(ulong addr, uint size);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* bloblist_finish() - Set up the bloblist for the next U-Boot part
|
|
|
|
*
|
|
|
|
* This sets the correct checksum for the bloblist. This ensures that the
|
|
|
|
* bloblist will be detected correctly by the next phase of U-Boot.
|
|
|
|
*
|
2022-01-13 02:26:24 +00:00
|
|
|
* Return: 0
|
2018-11-16 01:43:50 +00:00
|
|
|
*/
|
|
|
|
int bloblist_finish(void);
|
|
|
|
|
2020-09-20 00:49:26 +00:00
|
|
|
/**
|
|
|
|
* bloblist_get_stats() - Get information about the bloblist
|
|
|
|
*
|
|
|
|
* This returns useful information about the bloblist
|
2021-07-05 22:32:54 +00:00
|
|
|
*
|
|
|
|
* @basep: Returns base address of bloblist
|
|
|
|
* @sizep: Returns the number of bytes used in the bloblist
|
|
|
|
* @allocedp: Returns the total space allocated to the bloblist
|
2020-09-20 00:49:26 +00:00
|
|
|
*/
|
|
|
|
void bloblist_get_stats(ulong *basep, ulong *sizep, ulong *allocedp);
|
|
|
|
|
2022-01-13 02:26:23 +00:00
|
|
|
/**
|
|
|
|
* bloblist_get_base() - Get the base address of the bloblist
|
|
|
|
*
|
2022-01-13 02:26:24 +00:00
|
|
|
* Return: base address of bloblist
|
2022-01-13 02:26:23 +00:00
|
|
|
*/
|
|
|
|
ulong bloblist_get_base(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* bloblist_get_size() - Get the size of the bloblist
|
|
|
|
*
|
2022-01-13 02:26:24 +00:00
|
|
|
* Return: the size in bytes
|
2022-01-13 02:26:23 +00:00
|
|
|
*/
|
|
|
|
ulong bloblist_get_size(void);
|
|
|
|
|
2020-09-20 00:49:26 +00:00
|
|
|
/**
|
|
|
|
* bloblist_show_stats() - Show information about the bloblist
|
|
|
|
*
|
|
|
|
* This shows useful information about the bloblist on the console
|
|
|
|
*/
|
|
|
|
void bloblist_show_stats(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* bloblist_show_list() - Show a list of blobs in the bloblist
|
|
|
|
*
|
|
|
|
* This shows a list of blobs, showing their address, size and tag.
|
|
|
|
*/
|
|
|
|
void bloblist_show_list(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* bloblist_tag_name() - Get the name for a tag
|
|
|
|
*
|
|
|
|
* @tag: Tag to check
|
2022-01-13 02:26:24 +00:00
|
|
|
* Return: name of tag, or "invalid" if an invalid tag is provided
|
2020-09-20 00:49:26 +00:00
|
|
|
*/
|
|
|
|
const char *bloblist_tag_name(enum bloblist_tag_t tag);
|
|
|
|
|
2021-01-14 03:29:43 +00:00
|
|
|
/**
|
|
|
|
* bloblist_reloc() - Relocate the bloblist and optionally resize it
|
|
|
|
*
|
|
|
|
* @to: Pointer to new bloblist location (must not overlap old location)
|
2022-01-13 02:26:24 +00:00
|
|
|
* @to_size: New size for bloblist (must be larger than from_size)
|
2021-01-14 03:29:43 +00:00
|
|
|
* @from: Pointer to bloblist to relocate
|
|
|
|
* @from_size: Size of bloblist to relocate
|
|
|
|
*/
|
|
|
|
void bloblist_reloc(void *to, uint to_size, void *from, uint from_size);
|
|
|
|
|
2018-11-16 01:43:50 +00:00
|
|
|
/**
|
|
|
|
* bloblist_init() - Init the bloblist system with a single bloblist
|
|
|
|
*
|
2022-01-13 02:26:24 +00:00
|
|
|
* This locates and sets up the blocklist for use.
|
|
|
|
*
|
|
|
|
* If CONFIG_BLOBLIST_FIXED is selected, it uses CONFIG_BLOBLIST_ADDR and
|
|
|
|
* CONFIG_BLOBLIST_SIZE to set up a bloblist for use by U-Boot.
|
|
|
|
*
|
|
|
|
* If CONFIG_BLOBLIST_ALLOC is selected, it allocates memory for a bloblist of
|
|
|
|
* size CONFIG_BLOBLIST_SIZE.
|
|
|
|
*
|
|
|
|
* If CONFIG_BLOBLIST_PASSAGE is selected, it uses the bloblist in the incoming
|
|
|
|
* standard passage. The size is detected automatically so CONFIG_BLOBLIST_SIZE
|
|
|
|
* can be 0.
|
|
|
|
*
|
2023-09-26 14:14:51 +00:00
|
|
|
* Sets GD_FLG_BLOBLIST_READY in global_data flags on success
|
|
|
|
*
|
2022-01-13 02:26:24 +00:00
|
|
|
* Return: 0 if OK, -ve on error
|
2018-11-16 01:43:50 +00:00
|
|
|
*/
|
|
|
|
int bloblist_init(void);
|
|
|
|
|
2023-09-26 14:14:51 +00:00
|
|
|
#if CONFIG_IS_ENABLED(BLOBLIST)
|
|
|
|
/**
|
|
|
|
* bloblist_maybe_init() - Init the bloblist system if not already done
|
|
|
|
*
|
|
|
|
* Calls bloblist_init() if the GD_FLG_BLOBLIST_READY flag is not et
|
|
|
|
*
|
|
|
|
* Return: 0 if OK, -ve on error
|
|
|
|
*/
|
|
|
|
int bloblist_maybe_init(void);
|
|
|
|
#else
|
|
|
|
static inline int bloblist_maybe_init(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif /* BLOBLIST */
|
|
|
|
|
2018-11-16 01:43:50 +00:00
|
|
|
#endif /* __BLOBLIST_H */
|