blob: 14a247f5c5f8ce40668ae0faa4999518df8f12fc [file] [log] [blame]
Simon Glassc53fc492013-02-10 17:00:38 -08001/*
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
23typedef 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 Glass9ad06c12013-07-03 22:08:17 +090031/**
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 Ghoshd75cd672016-06-17 14:21:39 -070037int extract_regions(struct flashctx *flash);
Simon Glass9ad06c12013-07-03 22:08:17 +090038
David Hendricksa98dfd02016-09-12 20:45:45 -070039int specified_partition();
40int read_romlayout(char *name);
41int find_romentry(char *name);
David Hendricksc36685a2016-09-12 20:41:05 -070042int fill_romentry(romlayout_t *entry, int n);
David Hendricksa98dfd02016-09-12 20:45:45 -070043int handle_romentries(struct flashctx *flash, uint8_t *oldcontents, uint8_t *newcontents);
Vadim Bendeburycc9577d2018-05-09 11:52:00 -070044int get_fmap_entries(const char *filename, struct flashctx *flash);
David Hendricksa98dfd02016-09-12 20:45:45 -070045int get_num_include_args(void);
46int register_include_arg(char *name);
47int process_include_args(void);
48int num_include_files(void);
49int included_regions_overlap(void);
50int handle_romentries(struct flashctx *flash, uint8_t *oldcontents, uint8_t *newcontents);
51int 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. */
60int 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 Hendricksc36685a2016-09-12 20:41:05 -070067
Simon Glassc53fc492013-02-10 17:00:38 -080068#endif