/*
* 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 */
}
EFI_STATUS
-fops_setdefaults(CHAR16 *config, CHAR16 *kname, UINTN maxlen, CHAR16 *devpath)
+fops_setdefaults(struct config_file *defconf, CHAR16 *kname, UINTN maxlen, CHAR16 *devpath)
{
+ INTN i;
+
+/*
+ * The first default config file is architecture dependent. This is useful
+ * in case of network booting where the server is used for both types of
+ * architectures.
+ */
+#if defined(CONFIG_ia64)
+#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
+
+/*
+ * last resort config file. Common to all architectures
+ */
+#define FILEOPS_DEFAULT_CONFIG L"elilo.conf"
+
#define FILEOPS_DEFAULT_KERNEL L"vmlinux"
-#define FILEOPS_DEFAULT_CONFIG L"elilo.conf"
- if (config == NULL || kname == NULL) return EFI_INVALID_PARAMETER;
+#ifdef ELILO_DEBUG
+ if (defconf == NULL || kname == NULL) return EFI_INVALID_PARAMETER;
+#endif
+
+ for (i=0; i<MAX_DEFAULT_CONFIGS; i++) {
+ defconf[i].fname[0] = CHAR_NULL;
+ }
if (boot_dev == NULL || boot_dev->fops == NULL) {
if (boot_dev == NULL)
Print(L"Using builtin defaults for kernel and config file\n");
- StrnCpy(config, FILEOPS_DEFAULT_CONFIG, maxlen-1);
StrnCpy(kname, FILEOPS_DEFAULT_KERNEL, maxlen-1);
-
- return EFI_UNSUPPORTED;
}
-
- return boot_dev->fops->setdefaults(boot_dev->fops->intf, config, kname, maxlen, devpath);
+ else {
+ boot_dev->fops->setdefaults(boot_dev->fops->intf, defconf, kname, maxlen, devpath);
+ }
+ i=0; while (i<MAX_DEFAULT_CONFIGS && defconf[i].fname[0] != CHAR_NULL) i += 1;
+#ifdef ELILO_DEBUG
+ if ((i+3) >= MAX_DEFAULT_CONFIGS) {
+ Print(L"ERROR: i = %d, MAX_DEFAULT_CONFIGS is not large enough\n", i);
+ return EFI_INVALID_PARAMETER;
+ }
+#endif
+ StrnCpy(defconf[i].fname, FILEOPS_ARCH_DEFAULT_CONFIG, maxlen-1);
+ StrnCpy(defconf[i+1].fname, FILEOPS_DEFAULT_CONFIG, maxlen-1);
+
+#ifdef ELILO_DEBUG
+ VERB_PRT(3,Print(L"Default config filename list:\n"));
+ for (i=0; i<MAX_DEFAULT_CONFIGS; i++) {
+ if (defconf[i].fname[0] == CHAR_NULL) { break; }
+ VERB_PRT(3,Print(L"\t%s\n", defconf[i].fname));
+ }
+#endif
+
+ return EFI_SUCCESS;
}
EFI_STATUS
/*
* 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);
str2 = str == NULL ? L"Unknown" : str;
- DBG_PRT((L"%s : %-8s : %s\n", dev_tab[idx].name,
+ DBG_PRT((L"%s : %-8s : %s", dev_tab[idx].name,
(dev_tab[idx].fops ? dev_tab[idx].fops->name: L"N/A"), str2));
if (str) FreePool(str);
*/
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);