dtoc improvements to show better warnings
minor test build fixes
sandbox fixes for SDL2 and running TPL
bloblist resize feature
binman multithreading
This commit is contained in:
Tom Rini
2021-07-22 11:15:52 -04:00
48 changed files with 1210 additions and 164 deletions

View File

@@ -19,6 +19,8 @@ typedef ulong lbaint_t;
#define LBAF "%" LBAFlength "x"
#define LBAFU "%" LBAFlength "u"
struct udevice;
/* Interface types: */
enum if_type {
IF_TYPE_UNKNOWN = 0,
@@ -683,4 +685,58 @@ const char *blk_get_if_type_name(enum if_type if_type);
int blk_common_cmd(int argc, char *const argv[], enum if_type if_type,
int *cur_devnump);
enum blk_flag_t {
BLKF_FIXED = 1 << 0,
BLKF_REMOVABLE = 1 << 1,
BLKF_BOTH = BLKF_FIXED | BLKF_REMOVABLE,
};
/**
* blk_first_device_err() - Get the first block device
*
* The device returned is probed if necessary, and ready for use
*
* @flags: Indicates type of device to return
* @devp: Returns pointer to the first device in that uclass, or NULL if none
* @return 0 if found, -ENODEV if not found, other -ve on error
*/
int blk_first_device_err(enum blk_flag_t flags, struct udevice **devp);
/**
* blk_next_device_err() - Get the next block device
*
* The device returned is probed if necessary, and ready for use
*
* @flags: Indicates type of device to return
* @devp: On entry, pointer to device to lookup. On exit, returns pointer
* to the next device in the uclass if no error occurred, or -ENODEV if
* there is no next device.
* @return 0 if found, -ENODEV if not found, other -ve on error
*/
int blk_next_device_err(enum blk_flag_t flags, struct udevice **devp);
/**
* blk_foreach_probe() - Helper function to iteration through block devices
*
* This creates a for() loop which works through the available devices in
* a uclass in order from start to end. Devices are probed if necessary,
* and ready for use.
*
* @flags: Indicates type of device to return
* @dev: struct udevice * to hold the current device. Set to NULL when there
* are no more devices.
*/
#define blk_foreach_probe(flags, pos) \
for (int _ret = blk_first_device_err(flags, &(pos)); \
!_ret && pos; \
_ret = blk_next_device_err(flags, &(pos)))
/**
* blk_count_devices() - count the number of devices of a particular type
*
* @flags: Indicates type of device to find
* @return number of devices matching those flags
*/
int blk_count_devices(enum blk_flag_t flag);
#endif

View File

@@ -64,10 +64,10 @@ enum bloblist_tag_t {
* first bloblist_rec starts at this offset from the start of the header
* @flags: Space for BLOBLISTF_... flags (none yet)
* @magic: BLOBLIST_MAGIC
* @size: Total size of all records (non-zero if valid) including this header.
* @size: Total size of the bloblist (non-zero if valid) including this header.
* The bloblist extends for this many bytes from the start of this header.
* @alloced: Total size allocated for this bloblist. When adding new records,
* the bloblist can grow up to this size. This starts out as
* 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
* sizeof(bloblist_hdr) since we need at least that much space to store a
* valid bloblist
* @spare: Spare space (for future use)
@@ -179,6 +179,19 @@ void *bloblist_ensure(uint tag, int size);
*/
int bloblist_ensure_size_ret(uint tag, int *sizep, void **blobp);
/**
* 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)
* @return 0 if OK, -ENOSPC if the bloblist does not have enough space, -ENOENT
* if the tag is not found
*/
int bloblist_resize(uint tag, int new_size);
/**
* bloblist_new() - Create a new, empty bloblist of a given size
*
@@ -217,6 +230,10 @@ int bloblist_finish(void);
* bloblist_get_stats() - Get information about the bloblist
*
* This returns useful information about the bloblist
*
* @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
*/
void bloblist_get_stats(ulong *basep, ulong *sizep, ulong *allocedp);

View File

@@ -198,15 +198,6 @@ int cros_ec_flash_protect(struct udevice *dev, uint32_t set_mask,
uint32_t set_flags,
struct ec_response_flash_protect *resp);
/**
* Notify EC of current boot mode
*
* @param dev CROS-EC device
* @param vboot_mode Verified boot mode
* @return 0 if ok, <0 on error
*/
int cros_ec_entering_mode(struct udevice *dev, int mode);
/**
* Run internal tests on the cros_ec interface.
*
@@ -652,4 +643,12 @@ int cros_ec_vstore_read(struct udevice *dev, int slot, uint8_t *data);
int cros_ec_vstore_write(struct udevice *dev, int slot, const uint8_t *data,
size_t size);
/**
* cros_ec_read_batt_charge() - Read the battery-charge state
*
* @dev: CROS-EC device
* @chargep: Return battery-charge state as a percentage
*/
int cros_ec_read_batt_charge(struct udevice *dev, uint *chargep);
#endif

View File

@@ -327,9 +327,12 @@ int os_jump_to_image(const void *dest, int size);
* @fname: place to put full path to U-Boot
* @maxlen: maximum size of @fname
* @use_img: select the 'u-boot.img' file instead of the 'u-boot' ELF file
* @cur_prefix: prefix of current executable, e.g. "spl" or "tpl"
* @next_prefix: prefix of executable to find, e.g. "spl" or ""
* Return: 0 if OK, -NOSPC if the filename is too large, -ENOENT if not found
*/
int os_find_u_boot(char *fname, int maxlen, bool use_img);
int os_find_u_boot(char *fname, int maxlen, bool use_img,
const char *cur_prefix, const char *next_prefix);
/**
* os_spl_to_uboot() - Run U-Boot proper

View File

@@ -176,6 +176,27 @@ static inline const char *spl_phase_name(enum u_boot_phase phase)
}
}
/**
* spl_phase_prefix() - Get the prefix of the current phase
*
* @phase: Phase to look up
* @return phase prefix ("spl", "tpl", etc.)
*/
static inline const char *spl_phase_prefix(enum u_boot_phase phase)
{
switch (phase) {
case PHASE_TPL:
return "tpl";
case PHASE_SPL:
return "spl";
case PHASE_BOARD_F:
case PHASE_BOARD_R:
return "";
default:
return "phase?";
}
}
/* A string name for SPL or TPL */
#ifdef CONFIG_SPL_BUILD
# ifdef CONFIG_TPL_BUILD
@@ -484,6 +505,16 @@ struct spl_image_loader {
struct spl_boot_device *bootdev);
};
/* Helper function for accessing the name */
static inline const char *spl_loader_name(const struct spl_image_loader *loader)
{
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
return loader->name;
#else
return NULL;
#endif
}
/* Declare an SPL image loader */
#define SPL_LOAD_IMAGE(__name) \
ll_entry_declare(struct spl_image_loader, __name, spl_image_loader)