Libpayload: default DESTDIR for 'make install'
[coreboot.git] / payloads / bayou / util / pbuilder / pbuilder.h
1 /*
2  * This file is part of the bayou project.
3  *
4  * Copyright (C) 2008 Advanced Micro Devices, 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 version 2 as
8  * published by the Free Software Foundation.
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 #include <stdio.h>
21
22 #ifndef PBUILDER_H_
23 #define PBUILDER_H_
24
25 #include <stdint.h>
26 #include <stdio.h>
27
28 #define warn(fmt, args...) fprintf(stderr, fmt, ##args)
29 #define die(fmt, args...) \
30   do { fprintf(stderr, fmt, ##args); exit(-1); } \
31   while(0)
32
33 struct pentry {
34         uint8_t index;
35         uint8_t parent;
36         uint8_t type;
37         uint8_t flags;
38         uint8_t title[64];
39         char *file;
40         char *larname;
41 };
42
43 struct config {
44         int timeout;
45         int n_entries;
46         struct pentry **entries;
47 };
48
49 struct bpt_config {
50         uint32_t id;
51         uint8_t timeout;
52         uint8_t entries;
53         uint8_t padding[10];
54 };
55
56 struct bpt_pentry {
57         uint8_t index;
58         uint8_t parent;
59         uint8_t type;
60         uint8_t flags;
61         uint8_t title[64];
62         uint8_t nlen;
63 };
64
65 #define BPT_ID            0x30545042
66 #define BPT_TYPE_CHOOSER  0x01
67 #define BPT_TYPE_CHAIN    0x02
68 #define BPT_TYPE_SUBCHAIN 0x03
69
70 #define BPT_FLAG_DEFAULT  0x01
71 #define BPT_FLAG_NOSHOW   0x02
72
73 int pbuilder_show_lar(const char *input);
74 int create_lar_from_config(const char *input, const char *output);
75 void parseconfig(FILE * stream, struct config *config);
76
77 #endif