+2007-07-19 Jason Fleischli <jason.fleischli@hp.com>
+ * Integrated x86_64 support patches from Chandramouli Narayanan
+ <mouli@linux.intel.com> changes summarized in following bullets.
+ * alloc.c -- adds patch contributors credit to copyright
+ * alloc.c -- adds uefi_call_wrapper around BS->function calls
+ * alloc.c -- adds call to Print on VERB_PRT
+ * alternate.c -- adds patch contributors credit around copyright
+ * alternate.c -- adds uefi_call_wrapper around RT->function calls
+ * simple.c -- adds patch contributors credit to copyright
+ * simple.c -- adds uefi_call_wrapper around ip->ReadKeyStroke
+ * textmenu.c -- adds patch contributors credit to copyright
+ * textmenu.c -- adds uefi_call_wrapper around ClearScreen &
+ SetTextAttr
+ * textmenu.c -- adds uefi_call_wrapper around ip->ReadKeyStroke
+ * elilo.c -- adds patch contributors credit to copyright
+ * elilo.c -- fixes version number for ELILO_VERSION macro to current
+ * elilo.c -- adds uefi_call_wrapper around BS->function calls
+ * elilo.c -- adds uefi_call_wrapper around RT->function calls
+ * fileops.c -- adds patch contributors credit to copyright
+ * fileops.c -- adds uefi_call_wrapper around BS->function calls
+ * fileops.c -- adds uefi_call_wrapper around RT->function calls
+ * fileops.c -- adds uefi_call_wrapper around blkio->function calls
+ * localfs.c -- adds patch contributors credit to copyright
+ * localfs.c -- changed EFI_HANDLE *dev declaration to non-pointer type
+ * localfs.c -- adds uefi_call_wrapper around lfs->volume->functions
+ * localfs.c -- adds uefi_call_wrapper around BS->function calls
+ * netfs.c -- adds patch contributors credit to copyright
+ * netfs.c -- adds uefi_call_wrapper around nfs->pxe->function calls
+ * netfs.c -- adds uefi_call_wrapper around BS->function calls
+ * getopt.c -- changed int to char in StrChr() function
+ * Make.defaults -- adds patch contributors credit to copyright
+ * Make.defaults -- adds cflag for efi function wrapper
+ * Makefile -- adds patch contributors credit to copyright
+ * Makefile -- x86_64 subdir and a new rule for .S
+ * util.c -- adds patch contributors credit to copyright
+ * util.c -- adds uefi_call_wrapper to systab->functions
+ * util.c -- adds uefi_call_wrapper to conin->functions
+ * util.c -- adds uefi_call_wrapper to BS->functions
+ * util.c -- doubles ELILO_MEMMAP_SIZE_DEFAULT in get_memmap() function
+ * bootparams.c -- uses ia32 params for x86_64 addition.. hmmmm?
+ * config.c -- adds patch contributors credit to copyright
+ * config.c -- adds define reference for x86_64.conf
+ * config.c -- in config_error() removes use of va_list which maps to
+ the gnu C-lib iface __gnuc_va_list. Replaces the use of _IPrint on
+ the va_list with direct use of IPrint(systab->ConOut, msg);
+ *maintainer note, this probably introduces a bug, in light of this
+ note from the patch submitter --> "On some x86_64 systems with
+ EFI1.10 firmware I tested, early boot messages did not appear on console.
+ However, I didn't encounter this behavior on x86_64 systems with UEFI2.0
+ firmware"
+ * elf.h -- adds #def for x86_64
+ * glue_netfs.c -- adds patch contributors credit to copyright
+ * glue_netfs.c -- adds define for x86_64.conf
+ * sysdeps.h -- adds patch contributors credit to copyright
+ * sysdeps.h -- add include reference for new x86_64 subdir
+ * x86_64/ -- new subdir - all based on elilo/ia32 subdir
+ * x86_64/bin_to_h.c -- new file, stream fed binary to hex converter
+ * x86_64/bzimage.c -- new file, binary compressed kernel support
+ * x86_64/gzip.c -- new file, embedded gzip
+ * x86_64/gzip_loader.c -- new file, embedded gzip
+ * x86_64/gzip.h -- new file, embedded gzip
+ * x86_64/inflate.c -- new file, a pkzip method 8 embedded decompressor
+ * x86_64/Makefile -- new file
+ * x86_64/plain_loader.c -- new file, for loading non-compressed kernels
+ * x86_64/private.h -- new file
+ * x86_64/rmswitch.S -- new file, RealMode assembly module
+ * x86_64/sysdeps.h -- new file, system stuff for x86_64, e820 mapping
+ added.
+ * x86_64/sysdeps.c -- new file, system stuff for x86_64
+ * elilo.txt -- documentation update, add Intel to copyright
+ * README.gnu-efi -- documentation update for x86_64
+2006-01-27 Alex Williamson <alex.williamson@hp.com>
+ * Found a couple more places where vmcode isn't zeroed, causing the
+ option to get carried over to labels it shouldn't.
2006-01-09 Brett Johnson <brett@hp.com>
* Released 3.6
2005-12-22 Alex Williamson <alex.williamson@hp.com>
#
# Copyright (C) 2001-2003 Hewlett-Packard Co.
# Contributed by Stephane Eranian <eranian@hpl.hp.com>
+# Contributed by Chandramouli Narayanan<mouli@linux.intel.com>
#
# This file is part of ELILO, the LINUX EFI boot loader.
#
# They are installed as part of the GNU-EFI package installation
#
EFIINC = /usr/include/efi
-GNUEFILIB = /usr/lib
+GNUEFILIB = /usr/lib
EFILIB = /usr/lib
EFICRT0 = /usr/lib
OPTIMFLAGS = -O2
DEBUGFLAGS = -Wall
-CFLAGS = $(OPTIMFLAGS) -fpic -fshort-wchar $(DEBUGFLAGS)
+CFLAGS = $(OPTIMFLAGS) -fpic -fshort-wchar $(DEBUGFLAGS)
LDFLAGS = -nostdlib -znocombreloc
INSTALL = install
RANLIB = $(prefix)ranlib
OBJCOPY = $(prefix)objcopy
+# Use Modified binutils that supports x86_64 using UEFI ABI
+ifeq ($(ARCH), x86_64)
+ CFLAGS += -DEFI_FUNCTION_WRAPPER
+ OBJCOPY = /usr/bin/objcopy
+endif
+
ifeq ($(ARCH),ia64)
GCC_VERSION=$(shell $(CROSS_COMPILE)$(CC) -v 2>&1 | fgrep 'gcc version' | cut -f3 -d' ' | cut -f1 -d'.')
/*
* Copyright (C) 2001-2003 Hewlett-Packard Co.
* Contributed by Stephane Eranian <eranian@hpl.hp.com>
+ * Copyright (C) 2006-2009 Intel Corporation
+ * Contributed by Fenghua Yu <fenghua.yu@intel.com>
+ * Contributed by Bibo Mao <bibo.mao@intel.com>
+ * Contributed by Chandramouli Narayanan <mouli@linux.intel.com>
*
* This file is part of the ELILO, the EFI Linux boot loader.
*
first_time = 0;
for (;;) {
- while ((status=ip->ReadKeyStroke(ip, &key)) == EFI_NOT_READY);
+ while ((status = uefi_call_wrapper(ip->ReadKeyStroke, 2, ip, &key))
+ == EFI_NOT_READY);
if (EFI_ERROR(status)) {
ERR_PRT((L"select_kernel readkey: %r", status));
return -1;
/*
* Copyright (C) 2001-2003 Hewlett-Packard Co.
* Contributed by Richard Hirst <rhirst@linuxcare.com>
+ * Copyright (C) 2006-2009 Intel Corporation
+ * Contributed by Fenghua Yu <fenghua.yu@intel.com>
+ * Contributed by Bibo Mao <bibo.mao@intel.com>
+ * Contributed by Chandramouli Narayanan <mouli@linux.intel.com>
*
* This file is part of the ELILO, the EFI Linux boot loader.
*
#define DEF_ATTR EFI_TEXT_ATTR(EFI_LIGHTGRAY,EFI_BLACK)
-#define ClearScreen() ST->ConOut->ClearScreen(ST->ConOut)
-#define SetTextAttr(a) ST->ConOut->SetAttribute(ST->ConOut, a)
+#define ClearScreen() uefi_call_wrapper(ST->ConOut->ClearScreen, 1, ST->ConOut)
+#define SetTextAttr(a) uefi_call_wrapper(ST->ConOut->SetAttribute, 2, ST->ConOut, a)
static INTN
tohex(INTN c)
SetTextAttr(CurrentAttr);
for (;;) {
- while ((status=ip->ReadKeyStroke(ip, &key)) == EFI_NOT_READY);
+ while ((status = uefi_call_wrapper(ip->ReadKeyStroke, 2, ip, &key))
+ == EFI_NOT_READY);
if (EFI_ERROR(status)) {
SetTextAttr(EFI_TEXT_ATTR(EFI_LIGHTGRAY,EFI_BLACK));
ClearScreen();
if (i) {
msgbuf[i] = 0;
paint_msg(msgbuf);
- while ((status=ip->ReadKeyStroke(ip, &key)) == EFI_NOT_READY);
+ while ((status= uefi_call_wrapper(ip->ReadKeyStroke, 2, ip, &key)) == EFI_NOT_READY);
goto reprint;
}
}
/*
* Copyright (C) 2001-2003 Hewlett-Packard Co.
* Contributed by Stephane Eranian <eranian@hpl.hp.com>
+ * Contributed by Fenghua Yu <fenghua.yu@intel.com>
+ * Contributed by Bibo Mao <bibo.mao@intel.com>
+ * Contributed by Chandramouli Narayanan <mouli@linux.intel.com>
*
* This file is part of the ELILO, the EFI Linux boot loader.
*
#define ELILO_ARCH_DEFAULT_CONFIG L"elilo-ia64.conf"
#elif defined (CONFIG_ia32)
#define ELILO_ARCH_DEFAULT_CONFIG L"elilo-ia32.conf"
+#elif defined (CONFIG_x86_64)
+#define ELILO_ARCH_DEFAULT_CONFIG L"elilo-x86_64.conf"
#else
#error "You need to specfy your default arch config file"
#endif
static VOID
config_error(CHAR16 *msg,...)
{
- va_list ap;
- extern UINTN _IPrint (UINTN, UINTN, SIMPLE_TEXT_OUTPUT_INTERFACE *, CHAR16 *, CHAR8 *, va_list);
-
Print(L"near line %d: ",line_num);
-
- va_start(ap,msg);
- _IPrint((UINTN)-1, (UINTN)-1, systab->ConOut, msg, NULL, ap);
- va_end(ap);
+ IPrint(systab->ConOut, msg);
Print(L"\n");
}
* - TOK_ERR: in case of (parsing) error
*/
static token_t
-get_token(CHAR16 *str, UINTN maxlen)
+get_token_core(CHAR16 *str, UINTN maxlen, BOOLEAN rhs)
{
INTN ch, escaped;
CHAR16 *here;
while ((ch = next()), ch != '\n') if (ch == CHAR_EOF) return TOK_EOF;
line_num++;
}
- if (ch == '=') return TOK_EQUAL;
+ if (ch == '=' && !rhs) return TOK_EQUAL;
if (ch == '"') {
here = str;
}
else {
if (ch == ' ' || ch == '\t' || ch == '\n' || ch == '#' ||
- ch == '=' || ch == CHAR_EOF) {
+ ch == CHAR_EOF || (ch == '=' && !rhs)) {
again(ch);
*here = 0;
return TOK_STR;
return TOK_ERR;
}
+static token_t
+get_token(CHAR16 *str, UINTN maxlen)
+{
+ return get_token_core(str, maxlen, FALSE);
+}
+
+static token_t
+get_token_rhs(CHAR16 *str, UINTN maxlen)
+{
+ return get_token_core(str, maxlen, TRUE);
+}
+
static INTN
image_check(boot_image_t *img)
{
/*
* now get the value
*/
- tok = get_token(str, maxlen);
+ tok = get_token_rhs(str, maxlen);
if (tok != TOK_STR) {
config_error(L"Option %s expects %s", p->name, msg);
return -1;
return NULL;
}
+static void
+add_root_to_options(CHAR16 *options, CHAR16 *root, CHAR16 *vmcode)
+{
+ CHAR16 *o, ko[CMDLINE_MAXLEN];
+
+ if (vmcode[0]) {
+ for (o = options; *o; o++) {
+ if (*o == '-' && *(o+1) == '-')
+ break;
+ }
+ if (! *o) {
+ /* no separator found, add one */
+ StrCpy(o, L" -- ");
+ o++;
+ }
+
+ /* advance past separator and whitespace */
+ o += 2;
+ while (*o == ' ') o++;
+ } else {
+ o = options;
+ }
+
+ /* insert root param at this point */
+ StrCpy(ko, o);
+ StrCpy(o, L"root=");
+ StrCat(o, root);
+ StrCat(o, L" ");
+ StrCat(o, ko);
+}
+
INTN
find_label(CHAR16 *label, CHAR16 *kname, CHAR16 *options, CHAR16 *initrd, CHAR16 *vmcode)
{
/*
* when the label does not exist, we still propagate the global options
*/
- if (global_config.root[0]) {
- StrCpy(options, L" root=");
- StrCat(options, global_config.root);
- }
-
if (global_config.options[0]) {
StrCat(options, L" ");
StrCat(options, global_config.options);
}
+ if (global_config.root[0])
+ add_root_to_options(options, global_config.root, global_config.vmcode);
if (global_config.readonly) StrCat(options, L" ro");
if (global_config.initrd[0]) StrCpy(initrd, global_config.initrd);
found:
StrCpy(kname, img->kname);
+ /* per image initrd has precedence over global initrd */
+ if (img->initrd[0])
+ StrCpy(initrd, img->initrd);
+ else
+ StrCpy(initrd, global_config.initrd);
+
+ /* per image vmcode has precedence over global vmcode */
+ if (img->vmcode[0])
+ StrCpy(vmcode, img->vmcode);
+ else
+ StrCpy(vmcode, global_config.vmcode);
+
/*
* literal option overrides any other image-based or global option
*
* In any case, the image option has priority over the global option
*/
if (img->literal == 0) {
- if (img->root[0] || global_config.root[0]) {
- StrCat(options, L"root=");
- StrCat(options, img->root[0] ? img->root : global_config.root);
- }
/* XXX: check max length */
if (img->options[0] || global_config.options[0]) {
StrCat(options, L" ");
StrCat(options, img->options[0] ? img->options: global_config.options);
}
+ if (img->root[0] || global_config.root[0]) {
+ add_root_to_options(options, img->root[0]
+ ? img->root : global_config.root, vmcode);
+ }
if (img->readonly || global_config.readonly) {
StrCat(options, L" ro");
}
StrCpy(options, img->options);
}
- /* per image initrd has precedence over global initrd */
- if (img->initrd[0])
- StrCpy(initrd, img->initrd);
- else if (global_config.initrd[0])
- StrCpy(initrd, global_config.initrd);
-
- if (img->vmcode[0])
- StrCpy(vmcode, img->vmcode);
- else if (global_config.vmcode[0])
- StrCpy(vmcode, global_config.vmcode);
-
/*
* point to architecture dependent options for this image
*/
+elilo (3.7-2) unstable; urgency=low
+
+ * fix ugly merge problem I caused while preparing 3.7-1
+ * apply patches from Aron Griffis accepted by upstream but not in a released
+ tarball yet
+
+ -- Bdale Garbee <bdale@gag.com> Wed, 05 Sep 2007 16:38:41 +0100
+
elilo (3.7-1) unstable; urgency=low
* new upstream version
/*
- * elilo.c - IA-64/IA-32 EFI Linux loader
+ * elilo.c - IA-64/IA-32/x86_64 EFI Linux loader
*
* Copyright (C) 1999-2003 Hewlett-Packard Co.
* Contributed by David Mosberger <davidm@hpl.hp.com>.
* Copyright (C) 1999-2000 VA Linux Systems
* Contributed by Johannes Erdfelt <jerdfelt@valinux.com>.
*
+ * Copyright (C) 2006-2009 Intel Corporation
+ * Contributed by Fenghua Yu <fenghua.yu@intel.com>
+ * Contributed by Bibo Mao <bibo.mao@intel.com>
+ * Contributed by Chandramouli Narayanan <mouli@linux.intel.com>
+ *
* This file is part of the ELILO, the EFI Linux boot loader.
*
* ELILO is free software; you can redistribute it and/or modify
#include "loader.h"
#include "config.h" /* for config_init() */
-#define ELILO_VERSION L"3.4"
+#define ELILO_VERSION L"3.7"
#define ELILO_SHARED_CMDLINE_OPTS L"pPMC:aDhd:i:vVc:E"
elilo_config_t elilo_opt;
if ((bp=create_boot_params(cmdline, &imem, &mmem, &cookie)) == 0) goto error;
/* terminate bootservices */
- status = BS->ExitBootServices(image, cookie);
+ status = uefi_call_wrapper(BS->ExitBootServices, 2, image, cookie);
if (EFI_ERROR(status)) goto bad_exit;
start_kernel(kd.kentry, bp);
#define FAKE_ELILONAME L"elilo-forced"
- status = BS->HandleProtocol (info->DeviceHandle, &PxeBaseCodeProtocol, (VOID **)&pxe);
+ status = uefi_call_wrapper(BS->HandleProtocol, 3, info->DeviceHandle, &PxeBaseCodeProtocol, (VOID **)&pxe);
if (EFI_ERROR(status)) return;
default_load_options = info->LoadOptions;
UINT8 bool = FALSE;
INTN ret = -1;
- status = RT->GetVariable(L"EDD30", &edd30_guid, NULL, &l, &bool);
+ status = uefi_call_wrapper(RT->GetVariable, 5, L"EDD30", &edd30_guid, NULL, &l, &bool);
if (status == EFI_BUFFER_TOO_SMALL || (bool != TRUE && bool != FALSE)) {
ERR_PRT((L"Warning: EDD30 EFI variable is not boolean value: forcing it to TRUE"));
return -1;
UINT8 bool;
bool = TRUE;
- status = RT->SetVariable(L"EDD30", &edd30_guid, EDD30_ATTR, l, &bool);
+ status = uefi_call_wrapper(RT->SetVariable, 5, L"EDD30", &edd30_guid, EDD30_ATTR, l, &bool);
if (EFI_ERROR(status)) {
ERR_PRT((L"can't set EDD30 variable: ignoring it"));
return -1;
* mode.
* XXX: clean this up !
*/
- BS->SetWatchdogTimer(0, 0x0, 0, NULL);
+ uefi_call_wrapper(BS->SetWatchdogTimer, 4, 0, 0x0, 0, NULL);
/* initialize memory allocator */
if (alloc_init() == -1) return EFI_LOAD_ERROR;
- status = BS->HandleProtocol(image, &LoadedImageProtocol, (VOID **) &info);
+ status = uefi_call_wrapper(BS->HandleProtocol, 3, image, &LoadedImageProtocol, (VOID **) &info);
if (EFI_ERROR(status)) {
ERR_PRT((L"image handle does not support LOADED_IMAGE protocol"));
return EFI_LOAD_ERROR;
}
VERB_PRT(5,Print(L"Loaded at 0x%lx size=%d bytes code=%d data=%d\n", info->ImageBase, info->ImageSize, info->ImageCodeType, info->ImageDataType));
-
/*
* verify EDD3.0 status. Users may have to reboot
*/
/*
* Copyright (C) 2001-2003 Hewlett-Packard Co.
* Contributed by Stephane Eranian <eranian@hpl.hp.com>
+ * Contributed by Fenghua Yu <fenghua.yu@intel.com>
+ * Contributed by Bibo Mao <bibo.mao@intel.com>
+ * Contributed by Chandramouli Narayanan <mouli@linux.intel.com>
*
* This file is part of the ELILO, the EFI Linux boot loader.
*
VOID *intf = NULL;
EFI_STATUS status;
- status = BS->HandleProtocol(dev, proto, &intf);
+ status = uefi_call_wrapper(BS->HandleProtocol, 3, dev, proto, &intf);
if (EFI_ERROR(status)) {
ERR_PRT((L"unable to locate %g: should not happen", proto));
return NULL; /* should not happen */
#define FILEOPS_ARCH_DEFAULT_CONFIG L"elilo-ia64.conf"
#elif defined (CONFIG_ia32)
#define FILEOPS_ARCH_DEFAULT_CONFIG L"elilo-ia32.conf"
+#elif defined (CONFIG_x86_64)
+#define FILEOPS_ARCH_DEFAULT_CONFIG L"elilo-x86_64.conf"
#else
#error "You need to specfy your default arch config file"
#endif
/*
* get the actual device handles now
*/
- status = BS->LocateHandle(ByProtocol, proto, NULL, &size, tab);
+ status = uefi_call_wrapper(BS->LocateHandle, 5, ByProtocol, proto, NULL, &size, tab);
if (status != EFI_SUCCESS) {
ERR_PRT((L"failed to get handles for proto %g size=%d: %r", proto, size, status));
free(tab);
*/
for(fs = fs_tab; *fs; fs++) {
size = 0;
- BS->LocateHandle(ByProtocol, &(*fs)->proto, NULL, &size, NULL);
+ uefi_call_wrapper(BS->LocateHandle, 5, ByProtocol, &(*fs)->proto, NULL, &size, NULL);
total += size;
}
if (total == 0) {
for(fs = fs_tab; *fs; fs++) {
size = 0;
- BS->LocateHandle(ByProtocol, &(*fs)->proto, NULL, &size, NULL);
+ uefi_call_wrapper(BS->LocateHandle, 5, ByProtocol, &(*fs)->proto, NULL, &size, NULL);
if (size == 0) continue;
add_dev_tab(&(*fs)->proto, boot_handle, size, (*fs)->glue);
/*
* Copyright (C) 2001-2003 Hewlett-Packard Co.
* Contributed by Stephane Eranian <eranian@hpl.hp.com>
+ * Copyright (C) 2006-2009 Intel Corporation
+ * Contributed by Fenghua Yu <fenghua.yu@intel.com>
+ * Contributed by Bibo Mao <bibo.mao@intel.com>
+ * Contributed by Chandramouli Narayanan <mouli@linux.intel.com>
*
* This file is part of the ELILO, the EFI Linux boot loader.
*
# define CONFIG_ARCH_EXTENSION L"-ia64.conf\0"
# elif defined (CONFIG_ia32)
# define CONFIG_ARCH_EXTENSION L"-ia64.conf\0"
+# elif defined (CONFIG_x86_64)
+# define CONFIG_ARCH_EXTENSION L"-x86_64.conf\0"
# else
# error "You need to specfy your default arch config file"
# endif
* be run by root.
*/
#include <sys/types.h>
-#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#define ELILOALT_VERSION "0.02"
#define ELILO_ALT_NAME "EliloAlt"
-#define OLDEFIVAR_DIR "/proc/efi/vars"
-#define NEWEFIVAR_DIR "/sys/firmware/efi/vars"
-#define ELILO_ALTVAR ELILO_ALT_NAME"-00000000-0000-0000-0000-000000000000"
+#define EFIVAR_DIR "/proc/efi/vars"
+#define ELILO_ALTVAR EFIVAR_DIR"/"ELILO_ALT_NAME"-00000000-0000-0000-0000-000000000000"
#define EFI_VARIABLE_NON_VOLATILE 0x0000000000000001
#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002
} __attribute__((packed)) efi_variable_t;
static char *elilo_alt_name = ELILO_ALT_NAME;
-static char *efi_vars_dir = NULL;
-static char *elilo_altvar = NULL;
-static char *elilo_newvar = NULL;
-static char *elilo_delvar = NULL;
-unsigned char efivars_version = -1;
static struct option cmd_options[]={
{ "version", 0, 0, 1},
if (getuid() != 0) {
fatal_error("This program must be run as root\n");
}
- efi_vars = opendir(efi_vars_dir);
+ efi_vars = opendir(EFIVAR_DIR);
if (efi_vars == NULL) {
- fatal_error("Cannot access %s\n", efi_vars_dir);
+ fatal_error("Cannot access %s\n", EFIVAR_DIR);
}
if (!find_entry) {
closedir(efi_vars);
break;
}
if (entry == NULL) {
- fatal_error("Cannot find entry in %s\n", efi_vars_dir);
+ fatal_error("Cannot find entry in %s\n", EFIVAR_DIR);
}
- sprintf(name, "%s/%s", efi_vars_dir, entry->d_name);
+ sprintf(name, "%s/%s", EFIVAR_DIR, entry->d_name);
closedir(efi_vars);
return name;
}
int fd, r, i;
check_proc_efi(0);
-
- if (efivars_version == 1) {
- fd = open(elilo_altvar, O_WRONLY);
- if (fd == -1) {
- fatal_error("variable not defined\n");
- }
- } else {
- fd = open(elilo_delvar, O_WRONLY);
- if (fd == -1) {
- fatal_error("can't open %s\n", elilo_delvar);
- }
+
+ fd = open(ELILO_ALTVAR, O_WRONLY);
+ if (fd == -1) {
+ fatal_error("variable not defined\n");
}
memset(&var, 0, sizeof(var));
r = write(fd, &var, sizeof(var));
if (r != sizeof(var)) {
- fatal_error("Variable %s defined but invalid content\n", elilo_altvar);
+ fatal_error("Variable %s defined but invalid content\n", ELILO_ALTVAR);
}
close(fd);
}
check_proc_efi(0);
- fd = open(elilo_altvar, O_RDONLY);
+ fd = open(ELILO_ALTVAR, O_RDONLY);
if (fd == -1) {
fatal_error("variable not defined\n");
}
r = read(fd, &var, sizeof(var));
if (r != sizeof(var)) {
- fatal_error("Variable %s defined but invalid content\n", elilo_altvar);
+ fatal_error("Variable %s defined but invalid content\n", ELILO_ALTVAR);
}
printf("EliloAlt=\"");
for(i=0; i < var.datasize; i+=1){
fatal_error("Variable content is too long, must be <= 512 characters\n");
}
- if (efivars_version == 1) {
- fd = open(name, O_WRONLY);
- if (fd == -1) {
- fatal_error("can't open %s: %s\n", name,
- strerror(errno));
- }
- } else {
- fd = open(elilo_newvar, O_WRONLY);
- if (fd == -1) {
- fatal_error("can't open %s: %s\n", elilo_newvar,
- strerror(errno));
- }
+ fd = open(name, O_WRONLY);
+ if (fd == -1) {
+ fatal_error("can't open %s: %s\n", ELILO_ALTVAR, strerror(errno));
}
+
memset(&var, 0, sizeof(var));
for (i=0; i < sizeof(elilo_alt_name); i++) {
r = write(fd, &var, sizeof(var));
if (r != sizeof(var)) {
- fatal_error("Variable %s defined but invalid content %d\n", elilo_altvar, r);
+ fatal_error("Variable %s defined but invalid content %d\n", ELILO_ALTVAR, r);
}
close(fd);
main(int argc, char **argv)
{
int c;
- struct stat statbuf;
-
- if (stat(OLDEFIVAR_DIR, &statbuf) == 0) {
- efi_vars_dir = strdup(OLDEFIVAR_DIR);
- efivars_version = 1;
- } else if (stat(NEWEFIVAR_DIR, &statbuf) == 0) {
- efi_vars_dir = strdup(NEWEFIVAR_DIR);
- elilo_newvar = malloc(strlen(efi_vars_dir) +
- strlen("new_var") + 2);
- sprintf(elilo_newvar, "%s/%s", efi_vars_dir, "new_var");
- elilo_delvar = malloc(strlen(efi_vars_dir) +
- strlen("del_var") + 2);
- sprintf(elilo_delvar, "%s/%s", efi_vars_dir, "del_var");
- efivars_version = 2;
- } else {
- fatal_error("No EFI vars dir found\n\ttried:\n\t%s\n\t%s",
- OLDEFIVAR_DIR, NEWEFIVAR_DIR);
- }
- elilo_altvar = malloc(strlen(efi_vars_dir)+strlen(ELILO_ALTVAR)+2);
- sprintf(elilo_altvar, "%s/%s", efi_vars_dir, ELILO_ALTVAR);
while ((c=getopt_long(argc, argv,"hdps:", cmd_options, 0)) != -1) {
switch(c) {
* Copyright (C) 2001 Silicon Graphics, Inc.
* Contributed by Brent Casavant <bcasavan@sgi.com>
*
+ * Copyright (C) 2006-2009 Intel Corporation
+ * Contributed by Fenghua Yu <fenghua.yu@intel.com>
+ * Contributed by Bibo Mao <bibo.mao@intel.com>
+ * Contributed by Chandramouli Narayanan <mouli@linux.intel.com>
+ *
* This file is part of the ELILO, the EFI Linux boot loader.
*
* ELILO is free software; you can redistribute it and/or modify
static INTN
read_keypress(EFI_INPUT_KEY *key)
{
- return systab->ConIn->ReadKeyStroke(systab->ConIn, key);
+ return uefi_call_wrapper(systab->ConIn->ReadKeyStroke,
+ 2,
+ systab->ConIn,
+ key);
}
inline VOID
reset_input(VOID)
{
- systab->ConIn->Reset(systab->ConIn, 1);
+ uefi_call_wrapper(systab->ConIn->Reset,
+ 2,
+ systab->ConIn,
+ 1);
}
#if 0
Print(L"Hit ENTER to continue or ANY other key to cancel");
/* cleanup buffer first */
- while (conin->ReadKeyStroke(conin, &key) == EFI_SUCCESS);
+ while (uefi_call_wrapper(conin->ReadKeyStroke, 2, conin, &key) == EFI_SUCCESS);
- while ((status=conin->ReadKeyStroke(conin, &key)) == EFI_NOT_READY );
+ while ((status=uefi_call_wrapper(conin->ReadKeyStroke,2, conin, &key)) == EFI_NOT_READY );
if (EFI_ERROR(status)) return ELILO_LOAD_ERROR;
if (timeout == 0) return 0;
/* Create a timeout timer */
- status = BS->CreateEvent(EVT_TIMER, 0, NULL, NULL, &timer);
+ status = uefi_call_wrapper(BS->CreateEvent, 5, EVT_TIMER, 0, NULL, NULL, &timer);
if (EFI_ERROR(status)) {
ERR_PRT((L" waitkey CreateEvent failed %r", status));
return -1;
}
/* In 100ns increments */
- status = BS->SetTimer(timer, TimerPeriodic, TENTH_SEC);
+ status = uefi_call_wrapper(BS->SetTimer, 3, timer, TimerPeriodic, TENTH_SEC);
if (EFI_ERROR(status)) {
ERR_PRT((L"waitkey SetTimer failed %r", status));
return -1;
list[1] = systab->ConIn->WaitForKey;
do {
- status = BS->WaitForEvent(2, list, &idx);
+ status = uefi_call_wrapper(BS->WaitForEvent, 3, 2, list, &idx);
if (EFI_ERROR(status)) {
ERR_PRT((L"waitkey WaitForEvent failed %r", status));
return -1;
* SetTimer(timer, TimerCancel, 0) is causing problems on IA-32 and gcc3
* I do not know why it dies with EFI12.35. So let's fake a key stroke.
*/
- status = BS->SetTimer(timer, TimerCancel, 0);
+ status = uefi_call_wrapper(BS->SetTimer, 3, timer, TimerCancel, 0);
if (EFI_ERROR(status)) {
ERR_PRT((L"waitkey SetTimer(TimerCancel) failed %r", status));
return -1;
}
- BS->CloseEvent(timer);
+ uefi_call_wrapper(BS->CloseEvent, 1, timer);
return idx ? 1 : 0;
}
INTN
get_memmap(mmap_desc_t *desc)
{
-#define ELILO_MEMMAP_SIZE_DEFAULT EFI_PAGE_SIZE
+#define ELILO_MEMMAP_SIZE_DEFAULT (EFI_PAGE_SIZE*2)
#define ELILO_MEMMAP_INC (sizeof(EFI_MEMORY_DESCRIPTOR)<<1)
EFI_STATUS status;
ERR_PRT((L"failed to allocate memory map buffer"));
return -1;
}
- status = (*BS->GetMemoryMap)(&desc->map_size, desc->md, &desc->cookie, &desc->desc_size, &desc->desc_version);
+ status = uefi_call_wrapper(BS->GetMemoryMap, 5, &desc->map_size, desc->md,
+ &desc->cookie, &desc->desc_size, &desc->desc_version);
if (status == EFI_SUCCESS) break;
free(desc->md);