2 * Copyright (C) 2001-2003 Hewlett-Packard Co.
3 * Contributed by Stephane Eranian <eranian@hpl.hp.com>
5 * This file is part of the ELILO, the EFI Linux boot loader.
7 * ELILO is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * ELILO is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with ELILO; see the file COPYING. If not, write to the Free
19 * Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 * Please check out the elilo.txt for complete documentation on how
23 * to use this program.
36 CHAR16 fpswa[FILENAME_MAXLEN];
37 CHAR16 cmd_fpswa[FILENAME_MAXLEN];
38 UINTN allow_relocation;
39 } ia64_global_config_t;
41 #define ia64_opt_offsetof(option) (&((sys_img_options_t *)(0x0))->option)
43 static ia64_global_config_t ia64_gconf;
46 * No IA-64 specific options at this point
47 * The last entry in each table MUST be use the OPT_NULL type to terminate
50 config_option_t sysdeps_global_options[]={
51 {OPT_FILE, OPT_GLOBAL, L"fpswa", NULL, NULL, ia64_gconf.fpswa},
52 {OPT_BOOL, OPT_GLOBAL, L"relocatable", NULL, NULL, &ia64_gconf.allow_relocation},
55 config_option_t sysdeps_image_options[]={
56 {OPT_BOOL, OPT_IMAGE_SYS, L"relocatable", NULL, NULL, ia64_opt_offsetof(allow_relocation)},
61 * IA-64 operations that need to be done only once and just before
62 * entering the main loop of the loader
65 * -1 otherwise (will abort execution)
68 sysdeps_preloop_actions(EFI_HANDLE dev, CHAR16 **argv, INTN argc, INTN index, EFI_HANDLE image)
71 * we have separate string to make sure that the command line take precedence over
74 if (ia64_gconf.cmd_fpswa[0] != CHAR_NULL) {
75 check_fpswa(image, dev, ia64_gconf.cmd_fpswa);
76 } else if (ia64_gconf.fpswa[0] != CHAR_NULL)
77 check_fpswa(image, dev, ia64_gconf.fpswa);
79 check_fpswa(image, dev, NULL);
86 * 1: if image or global configuration allows relocation
89 * It is written has a function rather than a macro to avoid
90 * exposing config data structure to the rest of the code in ia64
93 ia64_can_relocate(VOID)
95 return ia64_gconf.allow_relocation == TRUE
96 || (elilo_opt.sys_img_opts && elilo_opt.sys_img_opts->allow_relocation ==TRUE) ? 1 : 0;
99 #define IA64_CMDLINE_OPTIONS L"rF:"
102 sysdeps_get_cmdline_opts(VOID)
104 return IA64_CMDLINE_OPTIONS;
108 sysdeps_getopt(INTN c, INTN optind, CHAR16 *optarg)
110 INTN ret = 0; /* let's be optimistic ! */
113 * XXX: for now these command line options have to be global
117 ia64_gconf.allow_relocation = 1;
120 if (StrLen(Optarg) >= FILENAME_MAXLEN) {
121 Print(L"FPSWA filename is limited to %d characters\n", FILENAME_MAXLEN);
124 StrCpy(ia64_gconf.cmd_fpswa, Optarg);
133 sysdeps_print_cmdline_opts(VOID)
135 Print(L"-r kernel image can be relocated if load address inexistent\n");
136 Print(L"-F file name of a specific FPSWA EFI driver to load\n");
140 sysdeps_register_options(VOID)
144 ret = register_config_options(sysdeps_global_options,
145 sizeof(sysdeps_global_options)/sizeof(config_option_t),
146 OPTIONS_GROUP_GLOBAL);
147 if (ret == -1 ) return ret;
149 ret = register_config_options(sysdeps_image_options,
150 sizeof(sysdeps_image_options)/sizeof(config_option_t),
151 OPTIONS_GROUP_IMAGE);