Imported Upstream version 3.4
[debian/elilo] / ia32 / 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 } ia32_global_config_t;
37
38
39 static ia32_global_config_t ia32_gconf;
40
41 static config_option_t sysdeps_global_options[]={
42         {OPT_BOOL,      OPT_GLOBAL, L"legacy-free",     NULL,   NULL,   &ia32_gconf.legacy_free_boot}
43 };
44
45
46 /*
47  * IA-32 operations that need to be done only once and just before 
48  * entering the main loop of the loader
49  * Return:
50  *       0 if sucessful
51  *      -1 otherwise (will abort execution)
52  */
53 INTN
54 sysdeps_preloop_actions(EFI_HANDLE dev, CHAR16 **argv, INTN argc, INTN index, EFI_HANDLE image)
55 {
56         return 0;
57 }
58         
59 #define IA32_CMDLINE_OPTIONS    L""
60
61 CHAR16 *
62 sysdeps_get_cmdline_opts(VOID)
63 {
64         return IA32_CMDLINE_OPTIONS;
65 }
66
67 INTN
68 sysdeps_getopt(INTN c, INTN optind, CHAR16 *optarg)
69 {
70         return -1;
71 }
72
73 VOID
74 sysdeps_print_cmdline_opts(VOID)
75 {
76 }
77
78
79 INTN
80 ia32_use_legacy_free_boot(VOID)
81 {
82         return ia32_gconf.legacy_free_boot ? 1 : 0;
83 }
84
85 INTN
86 sysdeps_register_options(VOID)
87 {
88         INTN ret;
89
90         ret = register_config_options(sysdeps_global_options, 
91                                       sizeof(sysdeps_global_options)/sizeof(config_option_t),
92                                       OPTIONS_GROUP_GLOBAL);
93 #if 0
94         /* no per image options yet */
95         if (ret == -1 ) return ret;
96
97         ret = register_config_options(sysdeps_image_options, 
98                                       sizeof(sysdeps_image_options)/sizeof(config_option_t),
99                                       OPTIONS_GROUP_IMAGE);
100 #endif
101
102         return ret;
103 }