X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=include%2Fblk.h;h=abcd4bedbbbd3fae6620f39525c616ecb1b721cf;hb=559c99f62818749c77f9078af929b214a0a7f819;hp=636eed9de9125cb66f2490992fdbf2c8008f8fd5;hpb=34a5c4257a4f41675a3082df8c15444a1b9d58d7;p=oweals%2Fu-boot.git diff --git a/include/blk.h b/include/blk.h index 636eed9de9..abcd4bedbb 100644 --- a/include/blk.h +++ b/include/blk.h @@ -1,8 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * (C) Copyright 2000-2004 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * SPDX-License-Identifier: GPL-2.0+ */ #ifndef BLK_H @@ -34,6 +33,7 @@ enum if_type { IF_TYPE_HOST, IF_TYPE_NVME, IF_TYPE_EFI, + IF_TYPE_VIRTIO, IF_TYPE_COUNT, /* Number of interface types */ }; @@ -112,7 +112,13 @@ struct blk_desc { #define PAD_TO_BLOCKSIZE(size, blk_desc) \ (PAD_SIZE(size, blk_desc->blksz)) -#ifdef CONFIG_BLOCK_CACHE +#if CONFIG_IS_ENABLED(BLOCK_CACHE) + +/** + * blkcache_init() - initialize the block cache list pointers + */ +int blkcache_init(void); + /** * blkcache_read() - attempt to read a set of blocks from cache * @@ -123,7 +129,7 @@ struct blk_desc { * @param blksz - size in bytes of each block * @param buf - buffer to contain cached data * - * @return - '1' if block returned from cache, '0' otherwise. + * @return - 1 if block returned from cache, 0 otherwise. */ int blkcache_read(int iftype, int dev, lbaint_t start, lbaint_t blkcnt, @@ -357,16 +363,6 @@ int blk_create_devicef(struct udevice *parent, const char *drv_name, const char *name, int if_type, int devnum, int blksz, lbaint_t lba, struct udevice **devp); -/** - * blk_prepare_device() - Prepare a block device for use - * - * This reads partition information from the device if supported. - * - * @dev: Device to prepare - * @return 0 if ok, -ve on error - */ -int blk_prepare_device(struct udevice *dev); - /** * blk_unbind_all() - Unbind all device of the given interface type * @@ -389,6 +385,17 @@ int blk_unbind_all(int if_type); */ int blk_find_max_devnum(enum if_type if_type); +/** + * blk_next_free_devnum() - get the next device number for an interface type + * + * Finds the next number that is safe to use for a newly allocated device for + * an interface type @if_type. + * + * @if_type: Interface type to scan + * @return next device number safe to use, or -ve on error + */ +int blk_next_free_devnum(enum if_type if_type); + /** * blk_select_hwpart() - select a hardware partition * @@ -407,6 +414,15 @@ int blk_select_hwpart(struct udevice *dev, int hwpart); */ int blk_get_from_parent(struct udevice *parent, struct udevice **devp); +/** + * blk_get_by_device() - Get the block device descriptor for the given device + * @dev: Instance of a storage device + * + * Return: With block device descriptor on success , NULL if there is no such + * block device. + */ +struct blk_desc *blk_get_by_device(struct udevice *dev); + #else #include /* @@ -663,7 +679,7 @@ const char *blk_get_if_type_name(enum if_type if_type); * @cur_devnump: Current device number for this interface type * @return 0 if OK, CMD_RET_ERROR on error */ -int blk_common_cmd(int argc, char * const argv[], enum if_type if_type, +int blk_common_cmd(int argc, char *const argv[], enum if_type if_type, int *cur_devnump); #endif