summaryrefslogtreecommitdiffstats
path: root/include/erasure_layout.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/erasure_layout.h')
-rw-r--r--include/erasure_layout.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/include/erasure_layout.h b/include/erasure_layout.h
new file mode 100644
index 000000000..b8b5f089a
--- /dev/null
+++ b/include/erasure_layout.h
@@ -0,0 +1,41 @@
+/*
+ * This file is part of the flashrom project.
+ *
+ * Copyright (C) 2022 Aarya Chaumal
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __ERASURE_LAYOUT_H__
+#define __ERASURE_LAYOUT_H__ 1
+
+struct eraseblock_data {
+ chipoff_t start_addr;
+ chipoff_t end_addr;
+ bool selected;
+ size_t block_num;
+ size_t first_sub_block_index;
+ size_t last_sub_block_index;
+};
+
+struct erase_layout {
+ struct eraseblock_data* layout_list;
+ size_t block_count;
+ const struct block_eraser *eraser;
+};
+
+void free_erase_layout(struct erase_layout *layout, unsigned int erasefn_count);
+int create_erase_layout(struct flashctx *const flashctx, struct erase_layout **erase_layout);
+int erase_write(struct flashctx *const flashctx, chipoff_t region_start, chipoff_t region_end,
+ uint8_t* curcontents, uint8_t* newcontents,
+ struct erase_layout *erase_layout, bool *all_skipped);
+
+#endif /* !__ERASURE_LAYOUT_H__ */