blob: e27a032c9f69252d0fbafa551e252641e9d474dc [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Marek Behún29387542017-09-03 17:00:28 +02002/*
3 * BTRFS filesystem implementation for U-Boot
4 *
Marek Behúnd63726e2022-06-01 17:17:06 +02005 * 2017 Marek Behún, CZ.NIC, kabel@kernel.org
Marek Behún29387542017-09-03 17:00:28 +02006 */
7
Simon Glass655306c2020-05-10 11:39:58 -06008#include <blk.h>
Marek Behún29387542017-09-03 17:00:28 +02009#include <compiler.h>
10#include <fs_internal.h>
11
12struct blk_desc *btrfs_blk_desc;
Simon Glassc1c4a8f2020-05-10 11:39:57 -060013struct disk_partition *btrfs_part_info;
Marek Behún29387542017-09-03 17:00:28 +020014
15int btrfs_devread(u64 address, int byte_len, void *buf)
16{
17 lbaint_t sector;
18 int byte_offset;
19
20 sector = address >> btrfs_blk_desc->log2blksz;
21 byte_offset = address % btrfs_blk_desc->blksz;
22
23 return fs_devread(btrfs_blk_desc, btrfs_part_info, sector, byte_offset,
24 byte_len, buf);
25}