Debian Codegraph @

include/erasure_layout.h

raw
1 /*
2 * This file is part of the flashrom project.
3 *
4 * Copyright (C) 2022 Aarya Chaumal
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17 #ifndef __ERASURE_LAYOUT_H__
18 #define __ERASURE_LAYOUT_H__ 1
19
20 struct eraseblock_data {
21 chipoff_t start_addr;
22 chipoff_t end_addr;
23 bool selected;
24 size_t block_num;
25 size_t first_sub_block_index;
26 size_t last_sub_block_index;
27 };
28
29 struct erase_layout {
30 struct eraseblock_data* layout_list;
31 size_t block_count;
32 const struct block_eraser *eraser;
33 };
34
35 void free_erase_layout(struct erase_layout *layout, unsigned int erasefn_count);
36 int create_erase_layout(struct flashctx *const flashctx, struct erase_layout **erase_layout);
37 int erase_write(struct flashctx *const flashctx, chipoff_t region_start, chipoff_t region_end,
38 uint8_t* curcontents, uint8_t* newcontents,
39 struct erase_layout *erase_layout, bool *all_skipped);
40
41 #endif /* !__ERASURE_LAYOUT_H__ */