Lines Matching +full:cache +full:- +full:block

1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * (C) Copyright 2000-2004
78 unsigned long blksz; /* block size */
111 #define BLOCK_CNT(size, blk_desc) (PAD_COUNT(size, blk_desc->blksz))
113 (PAD_SIZE(size, blk_desc->blksz))
117 * blkcache_read() - attempt to read a set of blocks from cache
119 * @param iftype - IF_TYPE_x for type of device
120 * @param dev - device index of particular type
121 * @param start - starting block number
122 * @param blkcnt - number of blocks to read
123 * @param blksz - size in bytes of each block
124 * @param buf - buffer to contain cached data
126 * @return - '1' if block returned from cache, '0' otherwise.
133 * blkcache_fill() - make data read from a block device available
134 * to the block cache
136 * @param iftype - IF_TYPE_x for type of device
137 * @param dev - device index of particular type
138 * @param start - starting block number
139 * @param blkcnt - number of blocks available
140 * @param blksz - size in bytes of each block
141 * @param buf - buffer containing data to cache
149 * blkcache_invalidate() - discard the cache for a set of blocks
152 * @param iftype - IF_TYPE_x for type of device
153 * @param dev - device index of particular type
158 * blkcache_configure() - configure block cache
160 * @param blocks - maximum blocks per entry
161 * @param entries - maximum entries in cache
166 * statistics of the block cache
177 * get_blkcache_stats() - return statistics and reset
179 * @param stats - statistics are copied here
203 /* Operations on block devices */
206 * read() - read from a block device
209 * @start: Start block number to read (0=first)
212 * @return number of blocks read, or -ve error number (see the
219 * write() - write to a block device
222 * @start: Start block number to write (0=first)
225 * @return number of blocks written, or -ve error number (see the
232 * erase() - erase a section of a block device
235 * @start: Start block number to erase (0=first)
237 * @return number of blocks erased, or -ve error number (see the
244 * select_hwpart() - select a particular hardware partition
248 * software-based partitions. MMC hardware partitions must be
253 * rpmb (3), and up to 4 addition general-purpose partitions (4-7).
255 * @desc: Block device to update
258 * @return 0 if OK, -ve on error
263 #define blk_get_ops(dev) ((struct blk_ops *)(dev)->driver->ops)
279 * blk_find_device() - Find a block device
287 * @return 0 if found, -ENODEV if no device found, or other -ve error value
292 * blk_get_device() - Find and probe a block device ready for use
297 * @return 0 if found, -ENODEV if no device found, or other -ve error value
302 * blk_first_device() - Find the first device for a given interface
308 * @return 0 if found, -ENODEV if no device, or other -ve error value
313 * blk_next_device() - Find the next device for a given interface
322 * @return 0 if found, -ENODEV if no device, or other -ve error value
327 * blk_create_device() - Create a new block device
330 * @drv_name: Driver name to use for the block device
333 * @devnum: Device number, specific to the interface type, or -1 to
335 * @blksz: Block size of the device in bytes (typically 512)
344 * blk_create_devicef() - Create a new named block device
347 * @drv_name: Driver name to use for the block device
350 * @devnum: Device number, specific to the interface type, or -1 to
352 * @blksz: Block size of the device in bytes (typically 512)
361 * blk_unbind_all() - Unbind all device of the given interface type
366 * @return 0 if OK, -ve on error
371 * blk_find_max_devnum() - find the maximum device number for an interface type
377 * @return maximum device number found, or -ENODEV if none, or other -ve on
383 * blk_next_free_devnum() - get the next device number for an interface type
389 * @return next device number safe to use, or -ve on error
394 * blk_select_hwpart() - select a hardware partition
400 * @return 0 if OK, -ve on error
405 * blk_get_from_parent() - obtain a block device by looking up its parent
412 * blk_get_by_device() - Get the block device descriptor for the given device
415 * Return: With block device descriptor on success , NULL if there is no such
416 * block device.
432 if (blkcache_read(block_dev->if_type, block_dev->devnum, in blk_dread()
433 start, blkcnt, block_dev->blksz, buffer)) in blk_dread()
437 * We could check if block_read is NULL and return -ENOSYS. But this in blk_dread()
441 blks_read = block_dev->block_read(block_dev, start, blkcnt, buffer); in blk_dread()
443 blkcache_fill(block_dev->if_type, block_dev->devnum, in blk_dread()
444 start, blkcnt, block_dev->blksz, buffer); in blk_dread()
452 blkcache_invalidate(block_dev->if_type, block_dev->devnum); in blk_dwrite()
453 return block_dev->block_write(block_dev, start, blkcnt, buffer); in blk_dwrite()
459 blkcache_invalidate(block_dev->if_type, block_dev->devnum); in blk_derase()
460 return block_dev->block_erase(block_dev, start, blkcnt); in blk_derase()
464 * struct blk_driver - Driver for block interface types
466 * This provides access to the block devices for each interface type. One
482 * get_dev() - get a pointer to a block device given its number
486 * There is no global numbering for block devices. This method allows
491 * @descp: Returns pointer to the block device on success
492 * @return 0 if OK, -ve on error
497 * select_hwpart() - Select a hardware partition
501 * software-based partitions. MMC hardware partitions must be
506 * rpmb (3), and up to 4 addition general-purpose partitions (4-7).
507 * Partition 0 is the main user-data partition.
509 * @desc: Block device descriptor
511 * user-data partition, 1 is the first partition, 2 is
519 * Declare a new U-Boot legacy block driver. New drivers should use driver
530 * blk_get_devnum_by_typename() - Get a block device by type and number
532 * This looks through the available block devices of the given type, returning
535 * @if_type: Block device type
537 * @return point to block device descriptor, or NULL if not found
542 * blk_get_devnum_by_type() - Get a block device by type name, and number
544 * This looks up the block device type based on @if_typename, then calls
547 * @if_typename: Block device type name
549 * @return point to block device descriptor, or NULL if not found
555 * blk_dselect_hwpart() - select a hardware partition
557 * This selects a hardware partition (such as is supported by MMC). The block
558 * device size may change as this effectively points the block device to a
561 * @desc: Block device descriptor for the device to select
563 * @return 0 if OK, -ve on error
568 * blk_list_part() - list the partitions for block devices of a given type
570 * This looks up the partition type for each block device of type @if_type,
573 * @if_type: Block device type
574 * @return 0 if OK, -ENODEV if there is none of that type
579 * blk_list_devices() - list the block devices of a given type
581 * This lists each block device of the type @if_type, showing the capacity
582 * as well as type-specific information.
584 * @if_type: Block device type
589 * blk_show_device() - show information about a given block device
591 * This shows the block device capacity as well as type-specific information.
593 * @if_type: Block device type
595 * @return 0 if OK, -ENODEV for invalid device number
600 * blk_print_device_num() - show information about a given block device
602 * This is similar to blk_show_device() but returns an error if the block
605 * @if_type: Block device type
607 * @return 0 if OK, -ENODEV for invalid device number, -ENOENT if the block
613 * blk_print_part_devnum() - print the partition information for a device
615 * @if_type: Block device type
617 * @return 0 if OK, -ENOENT if the block device is not connected, -ENOSYS if
618 * the interface type is not supported, other -ve on other error
623 * blk_read_devnum() - read blocks from a device
625 * @if_type: Block device type
629 * @return number of blocks read, or -ve error number on error
635 * blk_write_devnum() - write blocks to a device
637 * @if_type: Block device type
641 * @return number of blocks written, or -ve error number on error
647 * blk_select_hwpart_devnum() - select a hardware partition
652 * @if_type: Block device type
655 * @return 0 if OK, -ve on error
660 * blk_get_if_type_name() - Get the name of an interface type
668 * blk_common_cmd() - handle common commands with block devices