blob: d3d58a6dbd3ca037d3c6dbf1f10190dce8a01c26 [file] [log] [blame]
Uwe Hermann7eb845e2008-11-02 17:01:06 +00001/*
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#ifndef BAYOU_H_
21#define BAYOU_H_
22
23#include <libpayload.h>
24
25#define BAYOU_MAX_ENTRIES 10
26
27struct bpt_config {
28 u32 id;
29 u8 timeout;
30 u8 entries;
31 u8 padding[10];
32};
33
34struct bpt_pentry {
35 u8 index;
36 u8 parent;
37 u8 type;
38 u8 flags;
39 u8 title[64];
40 u8 nlen;
41};
42
43#define BPT_ID 0x30545042
44#define BPT_TYPE_CHOOSER 0x01
45#define BPT_TYPE_CHAIN 0x02
46#define BPT_TYPE_SUBCHAIN 0x03
47
48#define BPT_FLAG_DEFAULT 0x01
49#define BPT_FLAG_NOSHOW 0x02
50
51enum bayou_params {
52 BAYOU_PARAM_NAME = 0,
53 BAYOU_PARAM_LIST,
54 BAYOU_PARAM_DESC,
55 BAYOU_PARAMS_COUNT
56};
57
58struct payload {
59 struct bpt_pentry pentry;
60 struct larstat stat;
61 u8 *fptr;
62 char *params[BAYOU_PARAMS_COUNT];
63};
64
65struct bayoucfg {
66 u8 timeout;
67 int n_entries;
68 struct payload entries[BAYOU_MAX_ENTRIES];
69};
70
71extern struct bayoucfg bayoucfg;
72
73int verify_self(u8 *ptr);
74int self_get_params(u8 *fptr, u8 **params);
75int self_load_and_run(struct payload *p, int *ret);
76
77void menu(void);
78
79void run_payload(struct payload *p);
80char *payload_get_name(struct payload *p);
81struct payload *payload_get_default(void);
82void run_payload_timeout(struct payload *p, int timeout);
83void payload_parse_params(struct payload *pload, u8 *params, int len);
84
85int get_configuration(struct LAR *lar);
86
87#endif