Simon Glass | c53fc49 | 2013-02-10 17:00:38 -0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the flashrom project. |
| 3 | * |
| 4 | * Copyright (C) 2013 Google Inc. |
| 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; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #ifndef FLASHMAP_LIB_LAYOUT_H__ |
| 21 | #define FLASHMAP_LIB_LAYOUT_H__ |
| 22 | |
| 23 | typedef struct romlayout { |
| 24 | unsigned int start; |
| 25 | unsigned int end; |
| 26 | unsigned int included; |
| 27 | char name[256]; |
| 28 | char file[256]; /* file[0]=='\0' means not specified. */ |
| 29 | } romlayout_t; |
| 30 | |
Simon Glass | 9ad06c1 | 2013-07-03 22:08:17 +0900 | [diff] [blame] | 31 | /** |
| 32 | * Extract regions to current directory |
| 33 | * |
| 34 | * @flash: Information about flash chip to access |
| 35 | * @return 0 if OK, non-zero on error |
| 36 | */ |
Souvik Ghosh | d75cd67 | 2016-06-17 14:21:39 -0700 | [diff] [blame] | 37 | int extract_regions(struct flashctx *flash); |
Simon Glass | 9ad06c1 | 2013-07-03 22:08:17 +0900 | [diff] [blame] | 38 | |
David Hendricks | a98dfd0 | 2016-09-12 20:45:45 -0700 | [diff] [blame^] | 39 | int specified_partition(); |
| 40 | int read_romlayout(char *name); |
| 41 | int find_romentry(char *name); |
David Hendricks | c36685a | 2016-09-12 20:41:05 -0700 | [diff] [blame] | 42 | int fill_romentry(romlayout_t *entry, int n); |
David Hendricks | a98dfd0 | 2016-09-12 20:45:45 -0700 | [diff] [blame^] | 43 | int handle_romentries(struct flashctx *flash, uint8_t *oldcontents, uint8_t *newcontents); |
| 44 | int add_fmap_entries(struct flashctx *flash); |
| 45 | int get_num_include_args(void); |
| 46 | int register_include_arg(char *name); |
| 47 | int process_include_args(void); |
| 48 | int num_include_files(void); |
| 49 | int included_regions_overlap(void); |
| 50 | int handle_romentries(struct flashctx *flash, uint8_t *oldcontents, uint8_t *newcontents); |
| 51 | int handle_partial_read( |
| 52 | struct flashctx *flash, |
| 53 | uint8_t *buf, |
| 54 | int (*read) (struct flashctx *flash, uint8_t *buf, |
| 55 | unsigned int start, unsigned int len), |
| 56 | int write_to_file); |
| 57 | /* RETURN: the number of partitions that have beenpartial read. |
| 58 | * ==0 means no partition is specified. |
| 59 | * < 0 means writing file error. */ |
| 60 | int handle_partial_verify( |
| 61 | struct flashctx *flash, |
| 62 | uint8_t *buf, |
| 63 | int (*verify) (struct flashctx *flash, uint8_t *buf, unsigned int start, |
| 64 | unsigned int len, const char* message)); |
| 65 | /* RETURN: ==0 means all identical. |
| 66 | !=0 means buf and flash are different. */ |
David Hendricks | c36685a | 2016-09-12 20:41:05 -0700 | [diff] [blame] | 67 | |
Simon Glass | c53fc49 | 2013-02-10 17:00:38 -0800 | [diff] [blame] | 68 | #endif |