summaryrefslogtreecommitdiffstats
path: root/src/roms/SLOF/romfs/tools/cfgparse.h
blob: ed5c8856d33966b31c88e7351178a7b9f8687e25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/******************************************************************************
 * Copyright (c) 2004, 2008 IBM Corporation
 * All rights reserved.
 * This program and the accompanying materials
 * are made available under the terms of the BSD License
 * which accompanies this distribution, and is available at
 * http://www.opensource.org/licenses/bsd-license.php
 *
 * Contributors:
 *     IBM Corporation - initial implementation
 *****************************************************************************/
#ifndef CFGPARSE_H
#define CFGPARSE_H

#include <byteswap.h>
#include <endian.h>

#if __BYTE_ORDER == __BIG_ENDIAN
#define cpu_to_be64(x)	(x)
#else
#define cpu_to_be64(x)	bswap_64(x)
#endif

struct ffs_chain_t {
	int count;
	unsigned int romfs_size;
	struct ffs_header_t *first;
};

#define FLAG_LLFW 1		/* low level firmware at fix offs in romfs */

#define needs_fix_offset(hdr) ((hdr)->flags & FLAG_LLFW)

struct ffs_header_t {
	unsigned long long flags;
	unsigned long long romaddr;
	char *token;
	char *imagefile;
	int imagefile_length;
	struct ffs_header_t *linked_to;
	struct ffs_header_t *next;
	unsigned long long save_data;
	unsigned long long save_data_len;
	int save_data_valid;

	unsigned long long addr;	/* tmp */
	int hdrsize;		/* tmp */
	int tokensize;		/* tmp */
	int ffsize;		/* tmp */
};

void dump_fs_contents(struct ffs_chain_t *chain);
void find_duplicates(struct ffs_chain_t *chain);
void free_chain_memory(struct ffs_chain_t *chain);

int read_config(int conf_file, struct ffs_chain_t *ffs_chain);
int reorder_ffs_chain(struct ffs_chain_t *fs);
int build_ffs(struct ffs_chain_t *fs, const char *outfile, int notime);
#endif
OpenPOWER on IntegriCloud