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