blob: 1e5b83235ad5f8674857fc2ec8e76149355b1620 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Marek Behún21a14fa2017-09-03 17:00:28 +02002/*
3 * BTRFS filesystem implementation for U-Boot
4 *
5 * 2017 Marek Behun, CZ.NIC, marek.behun@nic.cz
Marek Behún21a14fa2017-09-03 17:00:28 +02006 */
7
8#include <common.h>
Simon Glasse6f6f9e2020-05-10 11:39:58 -06009#include <blk.h>
Marek Behún21a14fa2017-09-03 17:00:28 +020010#include <compiler.h>
11#include <fs_internal.h>
12
13struct blk_desc *btrfs_blk_desc;
Simon Glass05289792020-05-10 11:39:57 -060014struct disk_partition *btrfs_part_info;
Marek Behún21a14fa2017-09-03 17:00:28 +020015
16int btrfs_devread(u64 address, int byte_len, void *buf)
17{
18 lbaint_t sector;
19 int byte_offset;
20
21 sector = address >> btrfs_blk_desc->log2blksz;
22 byte_offset = address % btrfs_blk_desc->blksz;
23
24 return fs_devread(btrfs_blk_desc, btrfs_part_info, sector, byte_offset,
25 byte_len, buf);
26}