blob: fd1049d83e5d722611f9aea633b45fb5ec967657 [file] [log] [blame]
Nico Huber3a9939b2016-04-27 15:56:14 +02001/*
2 * This file is part of the flashrom project.
3 *
4 * Copyright (C) 2005-2008 coresystems GmbH
5 * (Written by Stefan Reinauer <stepan@coresystems.de> for coresystems GmbH)
6 * Copyright (C) 2011-2013 Stefan Tauner
7 * Copyright (C) 2016 secunet Security Networks AG
8 * (Written by Nico Huber <nico.huber@secunet.com> for secunet)
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 */
24
25#ifndef __LAYOUT_H__
26#define __LAYOUT_H__ 1
27
28#include <stddef.h>
29#include <stdint.h>
30
31/* Types and macros regarding the maximum flash space size supported by generic code. */
32typedef uint32_t chipoff_t; /* Able to store any addressable offset within a supported flash memory. */
33typedef uint32_t chipsize_t; /* Able to store the number of bytes of any supported flash memory. */
34#define FL_MAX_CHIPOFF_BITS (24)
35#define FL_MAX_CHIPOFF ((chipoff_t)(1ULL<<FL_MAX_CHIPOFF_BITS)-1)
36#define PRIxCHIPOFF "06"PRIx32
37#define PRIuCHIPSIZE PRIu32
38
39#define MAX_ROMLAYOUT 32
40
41struct romentry {
42 chipoff_t start;
43 chipoff_t end;
44 bool included;
45 char name[256];
46};
47
48struct flashrom_layout {
49 /* entries store the entries specified in a layout file and associated run-time data */
50 struct romentry *entries;
51 /* the number of successfully parsed entries */
52 size_t num_entries;
53};
54
55struct single_layout {
56 struct flashrom_layout base;
57 struct romentry entry;
58};
59
Nico Huber305f4172013-06-14 11:55:26 +020060struct flashrom_layout *get_global_layout(void);
dhendrixbeaefe02017-09-03 18:06:53 -070061struct flashrom_flashctx;
62const struct flashrom_layout *get_layout(const struct flashrom_flashctx *const flashctx);
Nico Huber305f4172013-06-14 11:55:26 +020063
64int process_include_args(struct flashrom_layout *);
Nico Huber3a9939b2016-04-27 15:56:14 +020065
66#endif /* !__LAYOUT_H__ */