summaryrefslogtreecommitdiff
path: root/include/fb_block.h
blob: 189c708e2f0eaccf4871f68f93c8d38eabc4349a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/* SPDX-License-Identifier: GPL-2.0+ */
/*
 * Copyright (C) 2024 The Android Open Source Project
 */

#ifndef _FB_BLOCK_H_
#define _FB_BLOCK_H_

struct blk_desc;
struct disk_partition;

/**
 * fastboot_block_get_part_info() - Lookup block partition by name
 *
 * @part_name: Named partition to lookup
 * @dev_desc: Pointer to returned blk_desc pointer
 * @part_info: Pointer to returned struct disk_partition
 * @response: Pointer to fastboot response buffer
 * Return: 0 on success, -ve on error
 */
int fastboot_block_get_part_info(const char *part_name,
				 struct blk_desc **dev_desc,
				 struct disk_partition *part_info,
				 char *response);

/**
 * fastboot_block_raw_erase() - Erase raw block device partition
 *
 * @dev_desc: Block device we're going write to
 * @info: Partition we're going write to
 * @part_name: Name of partition we're going write to
 * @alignment: erase start and size alignment, specify 0 to ignore
 * @response: Pointer to fastboot response buffer
 */
void fastboot_block_raw_erase(struct blk_desc *dev_desc, struct disk_partition *info,
			      const char *part_name, uint alignment, char *response);

/**
 * fastboot_block_raw_erase_disk() - Erase raw block device
 *
 * @dev_desc: Block device we're going write to
 * @disk_name: Name of disk we're going write to
 * @response: Pointer to fastboot response buffer
 */
void fastboot_block_raw_erase_disk(struct blk_desc *dev_desc, const char *disk_name,
				   char *response);

/**
 * fastboot_block_erase() - Erase partition on block device for fastboot
 *
 * @part_name: Named partition to erase
 * @response: Pointer to fastboot response buffer
 */
void fastboot_block_erase(const char *part_name, char *response);

/**
 * fastboot_block_write_raw_disk() - Write raw image to block device
 *
 * @dev_desc: Block device we're going write to
 * @disk_name: Name of disk we're going write to
 * @buffer: Downloaded buffer pointer
 * @download_bytes: Size of content on downloaded buffer pointer
 * @response: Pointer to fastboot response buffer
 */
void fastboot_block_write_raw_disk(struct blk_desc *dev_desc, const char *disk_name,
				   void *buffer, u32 download_bytes, char *response);

/**
 * fastboot_block_write_raw_image() - Write raw image to block device partition
 *
 * @dev_desc: Block device we're going write to
 * @info: Partition we're going write to
 * @part_name: Name of partition we're going write to
 * @buffer: Downloaded buffer pointer
 * @download_bytes: Size of content on downloaded buffer pointer
 * @response: Pointer to fastboot response buffer
 */
void fastboot_block_write_raw_image(struct blk_desc *dev_desc,
				    struct disk_partition *info, const char *part_name,
				    void *buffer, u32 download_bytes, char *response);

/**
 * fastboot_block_write_sparse_image() - Write sparse image to block device partition
 *
 * @dev_desc: Block device we're going write to
 * @info: Partition we're going write to
 * @part_name: Name of partition we're going write to
 * @buffer: Downloaded buffer pointer
 * @response: Pointer to fastboot response buffer
 */
void fastboot_block_write_sparse_image(struct blk_desc *dev_desc, struct disk_partition *info,
				       const char *part_name, void *buffer, char *response);

/**
 * fastboot_block_flash_write() - Write image to block device for fastboot
 *
 * @part_name: Named partition to write image to
 * @download_buffer: Pointer to image data
 * @download_bytes: Size of image data
 * @response: Pointer to fastboot response buffer
 */
void fastboot_block_flash_write(const char *part_name, void *download_buffer,
				u32 download_bytes, char *response);

#endif // _FB_BLOCK_H_