e8d46206b6fc43608cc32ad04bf3aa5d386ea774
[debian/elilo] / x86_64 / config.c
1 /*
2  *  Copyright (C) 2001-2003 Hewlett-Packard Co.
3  *      Contributed by Stephane Eranian <eranian@hpl.hp.com>
4  *      Contributed by Chris Ahna <christopher.j.ahna@intel.com>
5  *
6  * This file is part of the ELILO, the EFI Linux boot loader.
7  *
8  *  ELILO is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2, or (at your option)
11  *  any later version.
12  *
13  *  ELILO is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with ELILO; see the file COPYING.  If not, write to the Free
20  *  Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21  *  02111-1307, USA.
22  *
23  * Please check out the elilo.txt for complete documentation on how
24  * to use this program.
25  */
26
27 #include <efi.h>
28 #include <efilib.h>
29
30 #include "elilo.h"
31 #include "config.h"
32 #include "private.h"
33
34 typedef struct {
35         UINTN legacy_free_boot;
36 } x86_64_global_config_t;
37
38
39 static x86_64_global_config_t x86_64_gconf;
40
41 static config_option_t sysdeps_global_options[]={
42         {OPT_BOOL,      OPT_GLOBAL, L"legacy-free",     NULL,   NULL,   &x86_64_gconf.legacy_free_boot}
43 };
44
45 /*
46  * X86_64 operations that need to be done only once and just before 
47  * entering the main loop of the loader
48  * Return:
49  *       0 if sucessful
50  *      -1 otherwise (will abort execution)
51  */
52 INTN
53 sysdeps_preloop_actions(EFI_HANDLE dev, CHAR16 **argv, INTN argc, INTN index, EFI_HANDLE image)
54 {
55         return 0;
56 }
57         
58 #define X86_64_CMDLINE_OPTIONS  L""
59
60 CHAR16 *
61 sysdeps_get_cmdline_opts(VOID)
62 {
63         return X86_64_CMDLINE_OPTIONS;
64 }
65
66 INTN
67 sysdeps_getopt(INTN c, INTN optind, CHAR16 *optarg)
68 {
69         return -1;
70 }
71
72 VOID
73 sysdeps_print_cmdline_opts(VOID)
74 {
75 }
76
77
78 INTN
79 x86_64_use_legacy_free_boot(VOID)
80 {
81         return x86_64_gconf.legacy_free_boot ? 1 : 0;
82 }
83
84 INTN
85 sysdeps_register_options(VOID)
86 {
87         INTN ret;
88
89         ret = register_config_options(sysdeps_global_options, 
90                                       sizeof(sysdeps_global_options)/sizeof(config_option_t),
91                                       OPTIONS_GROUP_GLOBAL);
92 #if 0
93         /* no per image options yet */
94         if (ret == -1 ) return ret;
95
96         ret = register_config_options(sysdeps_image_options, 
97                                       sizeof(sysdeps_image_options)/sizeof(config_option_t),
98                                       OPTIONS_GROUP_IMAGE);
99 #endif
100
101         return ret;
102 }