1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-26 22:52:34 +02:00

layout: Rename romimages to num_rom_entries

Since we are planning to support image files for rom entries, rename the
variable used to count the number of known rom entries to avoid confusion.
There is already num_include_args with similar semantics, hence we use
num_rom_entries.

Corresponding to flashrom svn r1731.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
This commit is contained in:
Stefan Tauner 2013-08-30 22:22:57 +00:00
parent 7562f7d7d5
commit c70bc8a3c6

View File

@ -25,8 +25,6 @@
#include "flash.h" #include "flash.h"
#include "programmer.h" #include "programmer.h"
static int romimages = 0;
#define MAX_ROMLAYOUT 32 #define MAX_ROMLAYOUT 32
typedef struct { typedef struct {
@ -36,13 +34,14 @@ typedef struct {
char name[256]; char name[256];
} romlayout_t; } romlayout_t;
/* include_args lists arguments specified at the command line with -i. They /* rom_entries store the entries specified in a layout file and associated run-time data */
* must be processed at some point so that desired regions are marked as
* "included" in the rom_entries list.
*/
static char *include_args[MAX_ROMLAYOUT];
static int num_include_args = 0; /* the number of valid entries. */
static romlayout_t rom_entries[MAX_ROMLAYOUT]; static romlayout_t rom_entries[MAX_ROMLAYOUT];
static int num_rom_entries = 0; /* the number of valid rom_entries */
/* include_args holds the arguments specified at the command line with -i. They must be processed at some point
* so that desired regions are marked as "included" in the rom_entries list. */
static char *include_args[MAX_ROMLAYOUT];
static int num_include_args = 0; /* the number of valid include_args. */
#ifndef __LIBPAYLOAD__ #ifndef __LIBPAYLOAD__
int read_romlayout(char *name) int read_romlayout(char *name)
@ -62,12 +61,12 @@ int read_romlayout(char *name)
while (!feof(romlayout)) { while (!feof(romlayout)) {
char *tstr1, *tstr2; char *tstr1, *tstr2;
if (romimages >= MAX_ROMLAYOUT) { if (num_rom_entries >= MAX_ROMLAYOUT) {
msg_gerr("Maximum number of ROM images (%i) in layout " msg_gerr("Maximum number of ROM images (%i) in layout "
"file reached.\n", MAX_ROMLAYOUT); "file reached.\n", MAX_ROMLAYOUT);
return 1; return 1;
} }
if (2 != fscanf(romlayout, "%s %s\n", tempstr, rom_entries[romimages].name)) if (2 != fscanf(romlayout, "%s %s\n", tempstr, rom_entries[num_rom_entries].name))
continue; continue;
#if 0 #if 0
// fscanf does not like arbitrary comments like that :( later // fscanf does not like arbitrary comments like that :( later
@ -82,13 +81,13 @@ int read_romlayout(char *name)
fclose(romlayout); fclose(romlayout);
return 1; return 1;
} }
rom_entries[romimages].start = strtol(tstr1, (char **)NULL, 16); rom_entries[num_rom_entries].start = strtol(tstr1, (char **)NULL, 16);
rom_entries[romimages].end = strtol(tstr2, (char **)NULL, 16); rom_entries[num_rom_entries].end = strtol(tstr2, (char **)NULL, 16);
rom_entries[romimages].included = 0; rom_entries[num_rom_entries].included = 0;
romimages++; num_rom_entries++;
} }
for (i = 0; i < romimages; i++) { for (i = 0; i < num_rom_entries; i++) {
msg_gdbg("romlayout %08x - %08x named %s\n", msg_gdbg("romlayout %08x - %08x named %s\n",
rom_entries[i].start, rom_entries[i].start,
rom_entries[i].end, rom_entries[i].name); rom_entries[i].end, rom_entries[i].name);
@ -139,11 +138,11 @@ static int find_romentry(char *name)
{ {
int i; int i;
if (!romimages) if (num_rom_entries == 0)
return -1; return -1;
msg_gspew("Looking for region \"%s\"... ", name); msg_gspew("Looking for region \"%s\"... ", name);
for (i = 0; i < romimages; i++) { for (i = 0; i < num_rom_entries; i++) {
if (!strcmp(rom_entries[i].name, name)) { if (!strcmp(rom_entries[i].name, name)) {
rom_entries[i].included = 1; rom_entries[i].included = 1;
msg_gspew("found.\n"); msg_gspew("found.\n");
@ -166,7 +165,7 @@ int process_include_args(void)
return 0; return 0;
/* User has specified an area, but no layout file is loaded. */ /* User has specified an area, but no layout file is loaded. */
if (!romimages) { if (num_rom_entries == 0) {
msg_gerr("Region requested (with -i \"%s\"), " msg_gerr("Region requested (with -i \"%s\"), "
"but no layout data is available.\n", "but no layout data is available.\n",
include_args[0]); include_args[0]);
@ -198,7 +197,7 @@ romlayout_t *get_next_included_romentry(unsigned int start)
romlayout_t *cur; romlayout_t *cur;
/* First come, first serve for overlapping regions. */ /* First come, first serve for overlapping regions. */
for (i = 0; i < romimages; i++) { for (i = 0; i < num_rom_entries; i++) {
cur = &rom_entries[i]; cur = &rom_entries[i];
if (!cur->included) if (!cur->included)
continue; continue;