mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-28 15:41:40 +00:00
Merge branch '2022-04-06-various-verified-boot-bugfixes'
To quote the author: This series collects together various misc patches that were needed when building mainline U-Boot against Chromium OS verified boot. Most of them fix minor bugs.
This commit is contained in:
commit
f75e5164c6
21 changed files with 312 additions and 32 deletions
|
@ -1412,6 +1412,7 @@ config TPL_POWER
|
|||
|
||||
config TPL_TEXT_BASE
|
||||
hex "Base address for the .text section of the TPL stage"
|
||||
default 0
|
||||
help
|
||||
The base address for the .text section of the TPL stage.
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
#ccflags-y += -DET_DEBUG -DDEBUG
|
||||
|
||||
obj-$(CONFIG_$(SPL_TPL_)PARTITIONS) += part.o
|
||||
obj-$(CONFIG_$(SPL_)MAC_PARTITION) += part_mac.o
|
||||
obj-$(CONFIG_$(SPL_)DOS_PARTITION) += part_dos.o
|
||||
obj-$(CONFIG_$(SPL_)ISO_PARTITION) += part_iso.o
|
||||
obj-$(CONFIG_$(SPL_)AMIGA_PARTITION) += part_amiga.o
|
||||
obj-$(CONFIG_$(SPL_)EFI_PARTITION) += part_efi.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)MAC_PARTITION) += part_mac.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)DOS_PARTITION) += part_dos.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ISO_PARTITION) += part_iso.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)AMIGA_PARTITION) += part_amiga.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)EFI_PARTITION) += part_efi.o
|
||||
|
|
|
@ -552,6 +552,30 @@ static int blk_flags_check(struct udevice *dev, enum blk_flag_t req_flags)
|
|||
return flags & req_flags ? 0 : 1;
|
||||
}
|
||||
|
||||
int blk_find_first(enum blk_flag_t flags, struct udevice **devp)
|
||||
{
|
||||
int ret;
|
||||
|
||||
for (ret = uclass_find_first_device(UCLASS_BLK, devp);
|
||||
*devp && !blk_flags_check(*devp, flags);
|
||||
ret = uclass_find_next_device(devp))
|
||||
return 0;
|
||||
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
int blk_find_next(enum blk_flag_t flags, struct udevice **devp)
|
||||
{
|
||||
int ret;
|
||||
|
||||
for (ret = uclass_find_next_device(devp);
|
||||
*devp && !blk_flags_check(*devp, flags);
|
||||
ret = uclass_find_next_device(devp))
|
||||
return 0;
|
||||
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
int blk_first_device_err(enum blk_flag_t flags, struct udevice **devp)
|
||||
{
|
||||
int ret;
|
||||
|
|
|
@ -929,7 +929,7 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr)
|
|||
|
||||
while (len) {
|
||||
WATCHDOG_RESET();
|
||||
if (ctrlc()) {
|
||||
if (!IS_ENABLED(CONFIG_SPL_BUILD) && ctrlc()) {
|
||||
addr_known = false;
|
||||
ret = -EINTR;
|
||||
goto erase_err;
|
||||
|
|
|
@ -731,6 +731,51 @@ int blk_first_device_err(enum blk_flag_t flags, struct udevice **devp);
|
|||
*/
|
||||
int blk_next_device_err(enum blk_flag_t flags, struct udevice **devp);
|
||||
|
||||
/**
|
||||
* blk_find_first() - Return the first matching block device
|
||||
* @flags: Indicates type of device to return
|
||||
* @devp: Returns pointer to device, or NULL on error
|
||||
*
|
||||
* The device is not prepared for use - this is an internal function.
|
||||
* The function uclass_get_device_tail() can be used to probe the device.
|
||||
*
|
||||
* Note that some devices are considered removable until they have been probed
|
||||
*
|
||||
* @return 0 if found, -ENODEV if not found
|
||||
*/
|
||||
int blk_find_first(enum blk_flag_t flags, struct udevice **devp);
|
||||
|
||||
/**
|
||||
* blk_find_next() - Return the next matching block device
|
||||
* @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 same uclass, or NULL if none
|
||||
*
|
||||
* The device is not prepared for use - this is an internal function.
|
||||
* The function uclass_get_device_tail() can be used to probe the device.
|
||||
*
|
||||
* Note that some devices are considered removable until they have been probed
|
||||
*
|
||||
* @return 0 if found, -ENODEV if not found
|
||||
*/
|
||||
int blk_find_next(enum blk_flag_t flags, struct udevice **devp);
|
||||
|
||||
/**
|
||||
* blk_foreach() - iterate through block devices
|
||||
*
|
||||
* This creates a for() loop which works through the available block devices in
|
||||
* order from start to end.
|
||||
*
|
||||
* If for some reason the uclass cannot be found, this does nothing.
|
||||
*
|
||||
* @_flags: Indicates type of device to return
|
||||
* @_pos: struct udevice * to hold the current device. Set to NULL when there
|
||||
* are no more devices.
|
||||
*/
|
||||
#define blk_foreach(_flags, _pos) \
|
||||
for (int _ret = blk_find_first(_flags, &_pos); !_ret && _pos; \
|
||||
_ret = blk_find_next(_flags, &_pos))
|
||||
|
||||
/**
|
||||
* blk_foreach_probe() - Helper function to iteration through block devices
|
||||
*
|
||||
|
|
|
@ -24,6 +24,8 @@ enum cbfs_filetype {
|
|||
CBFS_TYPE_CBFSHEADER = 0x02,
|
||||
CBFS_TYPE_STAGE = 0x10,
|
||||
CBFS_TYPE_PAYLOAD = 0x20,
|
||||
CBFS_TYPE_SELF = CBFS_TYPE_PAYLOAD,
|
||||
|
||||
CBFS_TYPE_FIT = 0x21,
|
||||
CBFS_TYPE_OPTIONROM = 0x30,
|
||||
CBFS_TYPE_BOOTSPLASH = 0x40,
|
||||
|
@ -120,6 +122,47 @@ struct cbfs_file_attr_hash {
|
|||
u8 hash_data[];
|
||||
} __packed;
|
||||
|
||||
/*** Component sub-headers ***/
|
||||
|
||||
/* Following are component sub-headers for the "standard" component types */
|
||||
|
||||
/**
|
||||
* struct cbfs_stage - sub-header for stage components
|
||||
*
|
||||
* Stages are loaded by coreboot during the normal boot process
|
||||
*/
|
||||
struct cbfs_stage {
|
||||
u32 compression; /** Compression type */
|
||||
u64 entry; /** entry point */
|
||||
u64 load; /** Where to load in memory */
|
||||
u32 len; /** length of data to load */
|
||||
u32 memlen; /** total length of object in memory */
|
||||
} __packed;
|
||||
|
||||
/**
|
||||
* struct cbfs_payload_segment - sub-header for payload components
|
||||
*
|
||||
* Payloads are loaded by coreboot at the end of the boot process
|
||||
*/
|
||||
struct cbfs_payload_segment {
|
||||
u32 type;
|
||||
u32 compression;
|
||||
u32 offset;
|
||||
u64 load_addr;
|
||||
u32 len;
|
||||
u32 mem_len;
|
||||
} __packed;
|
||||
|
||||
struct cbfs_payload {
|
||||
struct cbfs_payload_segment segments;
|
||||
};
|
||||
|
||||
#define PAYLOAD_SEGMENT_CODE 0x45444F43
|
||||
#define PAYLOAD_SEGMENT_DATA 0x41544144
|
||||
#define PAYLOAD_SEGMENT_BSS 0x20535342
|
||||
#define PAYLOAD_SEGMENT_PARAMS 0x41524150
|
||||
#define PAYLOAD_SEGMENT_ENTRY 0x52544E45
|
||||
|
||||
struct cbfs_cachenode {
|
||||
struct cbfs_cachenode *next;
|
||||
void *data;
|
||||
|
|
|
@ -648,6 +648,7 @@ int cros_ec_vstore_write(struct udevice *dev, int slot, const uint8_t *data,
|
|||
*
|
||||
* @dev: CROS-EC device
|
||||
* @chargep: Return battery-charge state as a percentage
|
||||
* Return: 0 if OK, -ve on error
|
||||
*/
|
||||
int cros_ec_read_batt_charge(struct udevice *dev, uint *chargep);
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <dm/ofnode.h>
|
||||
|
||||
struct device_node;
|
||||
struct driver_info;
|
||||
struct udevice;
|
||||
|
||||
/*
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
*
|
||||
* @_name: Name of the uclass. This must be a valid C identifier, used by the
|
||||
* linker_list
|
||||
* @returns struct uclass * for the device
|
||||
* Return: struct uclass * for the device
|
||||
*/
|
||||
#define DM_UCLASS_REF(_name) \
|
||||
ll_entry_ref(struct uclass, _name, uclass)
|
||||
|
@ -120,7 +120,7 @@ int dev_get_uclass_index(struct udevice *dev, struct uclass **ucp);
|
|||
* uclass_find_device() - Return n-th child of uclass
|
||||
* @id: Id number of the uclass
|
||||
* @index: Position of the child in uclass's list
|
||||
* #devp: Returns pointer to device, or NULL on error
|
||||
* @devp: Returns pointer to device, or NULL on error
|
||||
*
|
||||
* The device is not prepared for use - this is an internal function.
|
||||
* The function uclass_get_device_tail() can be used to probe the device.
|
||||
|
@ -133,7 +133,7 @@ int uclass_find_device(enum uclass_id id, int index, struct udevice **devp);
|
|||
/**
|
||||
* uclass_find_first_device() - Return the first device in a uclass
|
||||
* @id: Id number of the uclass
|
||||
* #devp: Returns pointer to device, or NULL on error
|
||||
* @devp: Returns pointer to device, or NULL on error
|
||||
*
|
||||
* The device is not prepared for use - this is an internal function.
|
||||
* The function uclass_get_device_tail() can be used to probe the device.
|
||||
|
@ -239,7 +239,7 @@ int uclass_find_device_by_phandle(enum uclass_id id, struct udevice *parent,
|
|||
* Connect the device into uclass's list of devices.
|
||||
*
|
||||
* @dev: Pointer to the device
|
||||
* #return 0 on success, -ve on error
|
||||
* Return: 0 on success, -ve on error
|
||||
*/
|
||||
int uclass_bind_device(struct udevice *dev);
|
||||
|
||||
|
@ -250,7 +250,7 @@ int uclass_bind_device(struct udevice *dev);
|
|||
* Call any handled needed before uclass_unbind_device() is called
|
||||
*
|
||||
* @dev: Pointer to the device
|
||||
* #return 0 on success, -ve on error
|
||||
* Return: 0 on success, -ve on error
|
||||
*/
|
||||
int uclass_pre_unbind_device(struct udevice *dev);
|
||||
|
||||
|
@ -260,7 +260,7 @@ int uclass_pre_unbind_device(struct udevice *dev);
|
|||
* Disconnect the device from uclass's list of devices.
|
||||
*
|
||||
* @dev: Pointer to the device
|
||||
* #return 0 on success, -ve on error
|
||||
* Return: 0 on success, -ve on error
|
||||
*/
|
||||
int uclass_unbind_device(struct udevice *dev);
|
||||
|
||||
|
@ -277,7 +277,7 @@ static inline int uclass_unbind_device(struct udevice *dev) { return 0; }
|
|||
* uclass' child_pre_probe() method.
|
||||
*
|
||||
* @dev: Pointer to the device
|
||||
* #return 0 on success, -ve on error
|
||||
* Return: 0 on success, -ve on error
|
||||
*/
|
||||
int uclass_pre_probe_device(struct udevice *dev);
|
||||
|
||||
|
@ -288,7 +288,7 @@ int uclass_pre_probe_device(struct udevice *dev);
|
|||
* uclass.
|
||||
*
|
||||
* @dev: Pointer to the device
|
||||
* #return 0 on success, -ve on error
|
||||
* Return: 0 on success, -ve on error
|
||||
*/
|
||||
int uclass_post_probe_device(struct udevice *dev);
|
||||
|
||||
|
@ -298,7 +298,7 @@ int uclass_post_probe_device(struct udevice *dev);
|
|||
* Perform any pre-processing of a device that is about to be removed.
|
||||
*
|
||||
* @dev: Pointer to the device
|
||||
* #return 0 on success, -ve on error
|
||||
* Return: 0 on success, -ve on error
|
||||
*/
|
||||
#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)
|
||||
int uclass_pre_remove_device(struct udevice *dev);
|
||||
|
|
|
@ -435,7 +435,7 @@ int uclass_probe_all(enum uclass_id id);
|
|||
int uclass_id_count(enum uclass_id id);
|
||||
|
||||
/**
|
||||
* uclass_id_foreach_dev() - Helper function to iteration through devices
|
||||
* uclass_id_foreach_dev() - iterate through devices of a given uclass ID
|
||||
*
|
||||
* This creates a for() loop which works through the available devices in
|
||||
* a uclass ID in order from start to end.
|
||||
|
@ -452,20 +452,20 @@ int uclass_id_count(enum uclass_id id);
|
|||
list_for_each_entry(pos, &uc->dev_head, uclass_node)
|
||||
|
||||
/**
|
||||
* uclass_foreach_dev() - Helper function to iteration through devices
|
||||
* uclass_foreach_dev() - iterate through devices of a given uclass
|
||||
*
|
||||
* This creates a for() loop which works through the available devices in
|
||||
* a uclass in order from start to end.
|
||||
*
|
||||
* @pos: struct udevice * to hold the current device. Set to NULL when there
|
||||
* are no more devices.
|
||||
* @uc: uclass to scan
|
||||
* @uc: uclass to scan (`struct uclass *`)
|
||||
*/
|
||||
#define uclass_foreach_dev(pos, uc) \
|
||||
list_for_each_entry(pos, &uc->dev_head, uclass_node)
|
||||
|
||||
/**
|
||||
* uclass_foreach_dev_safe() - Helper function to safely iteration through devs
|
||||
* uclass_foreach_dev_safe() - safely iterate through devices of a given uclass
|
||||
*
|
||||
* This creates a for() loop which works through the available devices in
|
||||
* a uclass in order from start to end. Inside the loop, it is safe to remove
|
||||
|
@ -474,14 +474,13 @@ int uclass_id_count(enum uclass_id id);
|
|||
* @pos: struct udevice * to hold the current device. Set to NULL when there
|
||||
* are no more devices.
|
||||
* @next: struct udevice * to hold the next next
|
||||
* @uc: uclass to scan
|
||||
* @uc: uclass to scan (`struct uclass *`)
|
||||
*/
|
||||
#define uclass_foreach_dev_safe(pos, next, uc) \
|
||||
list_for_each_entry_safe(pos, next, &uc->dev_head, uclass_node)
|
||||
|
||||
/**
|
||||
* uclass_foreach_dev_probe() - Helper function to iteration through devices
|
||||
* of given uclass
|
||||
* uclass_foreach_dev_probe() - iterate through devices of a given uclass ID
|
||||
*
|
||||
* 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,
|
||||
|
|
|
@ -25,7 +25,7 @@ extern int errno __errno_asm_label;
|
|||
* Return: string describing the error. If CONFIG_ERRNO_STR is not
|
||||
* defined an empty string is returned.
|
||||
*/
|
||||
#ifdef CONFIG_ERRNO_STR
|
||||
#if CONFIG_IS_ENABLED(ERRNO_STR)
|
||||
const char *errno_str(int errno);
|
||||
#else
|
||||
static const char error_message[] = "";
|
||||
|
|
|
@ -5,3 +5,10 @@
|
|||
*
|
||||
* U-Boot uses linux types (linux/types.h) so does not make use of stdint.h
|
||||
*/
|
||||
|
||||
#ifndef __UB_STDINT_H
|
||||
#define __UB_STDINT_H
|
||||
|
||||
#define UINT8_MAX 0xff
|
||||
|
||||
#endif
|
||||
|
|
|
@ -51,9 +51,11 @@ bool abuf_realloc(struct abuf *abuf, size_t new_size)
|
|||
/* not currently allocated and new size is larger. Alloc and
|
||||
* copy in data. The new space is not inited.
|
||||
*/
|
||||
ptr = memdup(abuf->data, new_size);
|
||||
ptr = malloc(new_size);
|
||||
if (!ptr)
|
||||
return false;
|
||||
if (abuf->size)
|
||||
memcpy(ptr, abuf->data, abuf->size);
|
||||
abuf->data = ptr;
|
||||
abuf->size = new_size;
|
||||
abuf->alloced = true;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
menuconfig ASYMMETRIC_KEY_TYPE
|
||||
bool "Asymmetric (public-key cryptographic) key Support"
|
||||
depends on FIT_SIGNATURE
|
||||
help
|
||||
This option provides support for a key type that holds the data for
|
||||
the asymmetric keys used for public key cryptographic operations such
|
||||
|
|
|
@ -1225,9 +1225,12 @@ static void *fdt_find_separate(void)
|
|||
{
|
||||
void *fdt_blob = NULL;
|
||||
|
||||
if (IS_ENABLED(CONFIG_SANDBOX))
|
||||
return NULL;
|
||||
|
||||
#ifdef CONFIG_SPL_BUILD
|
||||
/* FDT is at end of BSS unless it is in a different memory region */
|
||||
if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS))
|
||||
if (CONFIG_IS_ENABLED(SEPARATE_BSS))
|
||||
fdt_blob = (ulong *)&_image_binary_end;
|
||||
else
|
||||
fdt_blob = (ulong *)&__bss_end;
|
||||
|
|
|
@ -37,8 +37,8 @@
|
|||
static void *SzAlloc(void *p, size_t size) { return malloc(size); }
|
||||
static void SzFree(void *p, void *address) { free(address); }
|
||||
|
||||
int lzmaBuffToBuffDecompress (unsigned char *outStream, SizeT *uncompressedSize,
|
||||
unsigned char *inStream, SizeT length)
|
||||
int lzmaBuffToBuffDecompress(unsigned char *outStream, SizeT *uncompressedSize,
|
||||
const unsigned char *inStream, SizeT length)
|
||||
{
|
||||
int res = SZ_ERROR_DATA;
|
||||
int i;
|
||||
|
|
|
@ -13,6 +13,19 @@
|
|||
|
||||
#include <lzma/LzmaTypes.h>
|
||||
|
||||
extern int lzmaBuffToBuffDecompress (unsigned char *outStream, SizeT *uncompressedSize,
|
||||
unsigned char *inStream, SizeT length);
|
||||
/**
|
||||
* lzmaBuffToBuffDecompress() - Decompress LZMA data
|
||||
*
|
||||
* @outStream: output buffer
|
||||
* @uncompressedSize: On entry, the mnaximum uncompressed size of the data;
|
||||
* on exit, the actual uncompressed size after processing
|
||||
* @inStream: Compressed bytes to decompress
|
||||
* @length: Sizeof @inStream
|
||||
* @return 0 if OK, SZ_ERROR_DATA if the data is in a format that cannot be
|
||||
* decompressed; SZ_ERROR_OUTPUT_EOF if *uncompressedSize is too small;
|
||||
* see also other SZ_ERROR... values
|
||||
*/
|
||||
int lzmaBuffToBuffDecompress(unsigned char *outStream, SizeT *uncompressedSize,
|
||||
const unsigned char *inStream, SizeT length);
|
||||
|
||||
#endif
|
||||
|
|
111
test/dm/blk.c
111
test/dm/blk.c
|
@ -217,3 +217,114 @@ static int dm_test_blk_iter(struct unit_test_state *uts)
|
|||
return 0;
|
||||
}
|
||||
DM_TEST(dm_test_blk_iter, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
|
||||
|
||||
/* Test finding fixed/removable block devices */
|
||||
static int dm_test_blk_flags(struct unit_test_state *uts)
|
||||
{
|
||||
struct udevice *dev;
|
||||
|
||||
/* Iterate through devices without probing them */
|
||||
ut_assertok(blk_find_first(BLKF_BOTH, &dev));
|
||||
ut_assertnonnull(dev);
|
||||
ut_asserteq_str("mmc2.blk", dev->name);
|
||||
|
||||
ut_assertok(blk_find_next(BLKF_BOTH, &dev));
|
||||
ut_assertnonnull(dev);
|
||||
ut_asserteq_str("mmc1.blk", dev->name);
|
||||
|
||||
ut_assertok(blk_find_next(BLKF_BOTH, &dev));
|
||||
ut_assertnonnull(dev);
|
||||
ut_asserteq_str("mmc0.blk", dev->name);
|
||||
|
||||
ut_asserteq(-ENODEV, blk_find_next(BLKF_BOTH, &dev));
|
||||
ut_assertnull(dev);
|
||||
|
||||
/* All devices are removable until probed */
|
||||
ut_asserteq(-ENODEV, blk_find_first(BLKF_FIXED, &dev));
|
||||
|
||||
ut_assertok(blk_find_first(BLKF_REMOVABLE, &dev));
|
||||
ut_assertnonnull(dev);
|
||||
ut_asserteq_str("mmc2.blk", dev->name);
|
||||
|
||||
/* Now probe them and iterate again */
|
||||
ut_assertok(blk_first_device_err(BLKF_BOTH, &dev));
|
||||
ut_assertnonnull(dev);
|
||||
ut_asserteq_str("mmc2.blk", dev->name);
|
||||
|
||||
ut_assertok(blk_next_device_err(BLKF_BOTH, &dev));
|
||||
ut_assertnonnull(dev);
|
||||
ut_asserteq_str("mmc1.blk", dev->name);
|
||||
|
||||
ut_assertok(blk_next_device_err(BLKF_BOTH, &dev));
|
||||
ut_assertnonnull(dev);
|
||||
ut_asserteq_str("mmc0.blk", dev->name);
|
||||
|
||||
ut_asserteq(-ENODEV, blk_next_device_err(BLKF_BOTH, &dev));
|
||||
|
||||
/* Look only for fixed devices */
|
||||
ut_assertok(blk_first_device_err(BLKF_FIXED, &dev));
|
||||
ut_assertnonnull(dev);
|
||||
ut_asserteq_str("mmc2.blk", dev->name);
|
||||
|
||||
ut_asserteq(-ENODEV, blk_next_device_err(BLKF_FIXED, &dev));
|
||||
|
||||
/* Look only for removable devices */
|
||||
ut_assertok(blk_first_device_err(BLKF_REMOVABLE, &dev));
|
||||
ut_assertnonnull(dev);
|
||||
ut_asserteq_str("mmc1.blk", dev->name);
|
||||
|
||||
ut_assertok(blk_next_device_err(BLKF_REMOVABLE, &dev));
|
||||
ut_assertnonnull(dev);
|
||||
ut_asserteq_str("mmc0.blk", dev->name);
|
||||
|
||||
ut_asserteq(-ENODEV, blk_next_device_err(BLKF_REMOVABLE, &dev));
|
||||
|
||||
return 0;
|
||||
}
|
||||
DM_TEST(dm_test_blk_flags, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
|
||||
|
||||
/* Test blk_foreach() and friend */
|
||||
static int dm_test_blk_foreach(struct unit_test_state *uts)
|
||||
{
|
||||
struct udevice *dev;
|
||||
int found;
|
||||
|
||||
/* Test blk_foreach() - use the 3rd bytes of the name (0/1/2) */
|
||||
found = 0;
|
||||
blk_foreach(BLKF_BOTH, dev)
|
||||
found |= 1 << dectoul(&dev->name[3], NULL);
|
||||
ut_asserteq(7, found);
|
||||
|
||||
/* All devices are removable until probed */
|
||||
found = 0;
|
||||
blk_foreach(BLKF_FIXED, dev)
|
||||
found |= 1 << dectoul(&dev->name[3], NULL);
|
||||
ut_asserteq(0, found);
|
||||
|
||||
found = 0;
|
||||
blk_foreach(BLKF_REMOVABLE, dev)
|
||||
found |= 1 << dectoul(&dev->name[3], NULL);
|
||||
ut_asserteq(7, found);
|
||||
|
||||
/* Now try again with the probing functions */
|
||||
found = 0;
|
||||
blk_foreach_probe(BLKF_BOTH, dev)
|
||||
found |= 1 << dectoul(&dev->name[3], NULL);
|
||||
ut_asserteq(7, found);
|
||||
ut_asserteq(3, blk_count_devices(BLKF_BOTH));
|
||||
|
||||
found = 0;
|
||||
blk_foreach_probe(BLKF_FIXED, dev)
|
||||
found |= 1 << dectoul(&dev->name[3], NULL);
|
||||
ut_asserteq(4, found);
|
||||
ut_asserteq(1, blk_count_devices(BLKF_FIXED));
|
||||
|
||||
found = 0;
|
||||
blk_foreach_probe(BLKF_REMOVABLE, dev)
|
||||
found |= 1 << dectoul(&dev->name[3], NULL);
|
||||
ut_asserteq(3, found);
|
||||
ut_asserteq(2, blk_count_devices(BLKF_REMOVABLE));
|
||||
|
||||
return 0;
|
||||
}
|
||||
DM_TEST(dm_test_blk_foreach, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
|
||||
|
|
|
@ -126,6 +126,35 @@ static int lib_test_abuf_realloc(struct unit_test_state *uts)
|
|||
}
|
||||
LIB_TEST(lib_test_abuf_realloc, 0);
|
||||
|
||||
/* Test abuf_realloc() on an non-allocated buffer of zero size */
|
||||
static int lib_test_abuf_realloc_size(struct unit_test_state *uts)
|
||||
{
|
||||
struct abuf buf;
|
||||
ulong start;
|
||||
|
||||
start = ut_check_free();
|
||||
|
||||
abuf_init(&buf);
|
||||
|
||||
/* Allocate some space */
|
||||
ut_asserteq(true, abuf_realloc(&buf, TEST_DATA_LEN));
|
||||
ut_assertnonnull(buf.data);
|
||||
ut_asserteq(TEST_DATA_LEN, buf.size);
|
||||
ut_asserteq(true, buf.alloced);
|
||||
|
||||
/* Free it */
|
||||
ut_asserteq(true, abuf_realloc(&buf, 0));
|
||||
ut_assertnull(buf.data);
|
||||
ut_asserteq(0, buf.size);
|
||||
ut_asserteq(false, buf.alloced);
|
||||
|
||||
/* Check for memory leaks */
|
||||
ut_assertok(ut_check_delta(start));
|
||||
|
||||
return 0;
|
||||
}
|
||||
LIB_TEST(lib_test_abuf_realloc_size, 0);
|
||||
|
||||
/* Test handling of buffers that are too large */
|
||||
static int lib_test_abuf_large(struct unit_test_state *uts)
|
||||
{
|
||||
|
|
|
@ -106,7 +106,7 @@ class Bintoolfutility(bintool.Bintool):
|
|||
Returns:
|
||||
str: Tool output
|
||||
"""
|
||||
args = ['gbb_utility'
|
||||
args = ['gbb_utility',
|
||||
'-s',
|
||||
f'--hwid={hwid}',
|
||||
f'--rootkey={rootkey}',
|
||||
|
@ -139,7 +139,7 @@ class Bintoolfutility(bintool.Bintool):
|
|||
'--keyblock', keyblock,
|
||||
'--signprivate', signprivate,
|
||||
'--version', version,
|
||||
'--fw', firmware,
|
||||
'--fv', firmware,
|
||||
'--kernelkey', kernelkey,
|
||||
'--flags', flags
|
||||
]
|
||||
|
|
|
@ -73,7 +73,7 @@ class Entry_vblock(Entry_collection):
|
|||
vblock=output_fname,
|
||||
keyblock=prefix + self.keyblock,
|
||||
signprivate=prefix + self.signprivate,
|
||||
version=f'{self.version,}',
|
||||
version=f'{self.version:d}',
|
||||
firmware=input_fname,
|
||||
kernelkey=prefix + self.kernelkey,
|
||||
flags=f'{self.preamble_flags}')
|
||||
|
|
Loading…
Reference in a new issue