Lines Matching refs:bdev
48 bdev_t bdev; member
56 static ssize_t spiflash_bdev_read(struct bdev *, void *buf, off_t offset, size_t len);
57 static ssize_t spiflash_bdev_read_block(struct bdev *, void *buf, bnum_t block, uint count);
58 static ssize_t spiflash_bdev_write_block(struct bdev *, const void *buf, bnum_t block, uint count);
59 static ssize_t spiflash_bdev_erase(struct bdev *, off_t offset, size_t len);
60 static int spiflash_ioctl(struct bdev *, int request, void *argp);
286 bio_initialize_bdev(&flash.bdev, "spi0", in spiflash_detect()
291 flash.bdev.read = &spiflash_bdev_read; in spiflash_detect()
292 flash.bdev.read_block = &spiflash_bdev_read_block; in spiflash_detect()
294 flash.bdev.write_block = &spiflash_bdev_write_block; in spiflash_detect()
295 flash.bdev.erase = &spiflash_bdev_erase; in spiflash_detect()
296 flash.bdev.ioctl = &spiflash_ioctl; in spiflash_detect()
299 flash.bdev.erase_byte = 0xff; in spiflash_detect()
301 bio_register_device(&flash.bdev); in spiflash_detect()
317 static ssize_t spiflash_bdev_read(struct bdev *bdev, void *buf, off_t offset, size_t len) { in spiflash_bdev_read() argument
318 LTRACEF("dev %p, buf %p, offset 0x%llx, len 0x%zx\n", bdev, buf, offset, len); in spiflash_bdev_read()
322 len = bio_trim_range(bdev, offset, len); in spiflash_bdev_read()
332 static ssize_t spiflash_bdev_read_block(struct bdev *bdev, void *buf, bnum_t block, uint count) { in spiflash_bdev_read_block() argument
333 LTRACEF("dev %p, buf %p, block 0x%x, count %u\n", bdev, buf, block, count); in spiflash_bdev_read_block()
335 count = bio_trim_block_range(bdev, block, count); in spiflash_bdev_read_block()
339 return spiflash_bdev_read(bdev, buf, block << bdev->block_shift, count << bdev->block_shift); in spiflash_bdev_read_block()
342 static ssize_t spiflash_bdev_write_block(struct bdev *bdev, const void *_buf, bnum_t block, uint co… in spiflash_bdev_write_block() argument
343 LTRACEF("dev %p, buf %p, block 0x%x, count %u\n", bdev, _buf, block, count); in spiflash_bdev_write_block()
345 DEBUG_ASSERT(bdev->block_size == PAGE_PROGRAM_SIZE); in spiflash_bdev_write_block()
347 count = bio_trim_block_range(bdev, block, count); in spiflash_bdev_write_block()
368 static ssize_t spiflash_bdev_erase(struct bdev *bdev, off_t offset, size_t len) { in spiflash_bdev_erase() argument
369 LTRACEF("dev %p, offset 0x%llx, len 0x%zx\n", bdev, offset, len); in spiflash_bdev_erase()
371 len = bio_trim_range(bdev, offset, len); in spiflash_bdev_erase()
388 static int spiflash_ioctl(struct bdev *bdev, int request, void *argp) { in spiflash_ioctl() argument
389 LTRACEF("dev %p, request %d, argp %p\n", bdev, request, argp); in spiflash_ioctl()