Commit becbd660 authored by H. Peter Anvin's avatar H. Peter Anvin

Merge tag 'efi-for-3.8' into x86/efi

Various urgent EFI fixes and some warning cleanups for v3.8

  * EFI boot stub fix for Macbook Pro's from Maarten Lankhorst
  * Fix an oops in efivarfs from Lingzhu Xiang
  * 32-bit warning cleanups from Jan Beulich
  * Patch to Boot on >512GB RAM systems from Nathan Zimmer
  * Set efi.runtime_version correctly
  * efivarfs updates
Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
parents 99f857db 73970188
...@@ -256,10 +256,10 @@ static efi_status_t setup_efi_pci(struct boot_params *params) ...@@ -256,10 +256,10 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
int i; int i;
struct setup_data *data; struct setup_data *data;
data = (struct setup_data *)params->hdr.setup_data; data = (struct setup_data *)(unsigned long)params->hdr.setup_data;
while (data && data->next) while (data && data->next)
data = (struct setup_data *)data->next; data = (struct setup_data *)(unsigned long)data->next;
status = efi_call_phys5(sys_table->boottime->locate_handle, status = efi_call_phys5(sys_table->boottime->locate_handle,
EFI_LOCATE_BY_PROTOCOL, &pci_proto, EFI_LOCATE_BY_PROTOCOL, &pci_proto,
...@@ -307,9 +307,6 @@ static efi_status_t setup_efi_pci(struct boot_params *params) ...@@ -307,9 +307,6 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
if (status != EFI_SUCCESS) if (status != EFI_SUCCESS)
continue; continue;
if (!(attributes & EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM))
continue;
if (!pci->romimage || !pci->romsize) if (!pci->romimage || !pci->romsize)
continue; continue;
...@@ -350,9 +347,9 @@ static efi_status_t setup_efi_pci(struct boot_params *params) ...@@ -350,9 +347,9 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
memcpy(rom->romdata, pci->romimage, pci->romsize); memcpy(rom->romdata, pci->romimage, pci->romsize);
if (data) if (data)
data->next = (uint64_t)rom; data->next = (unsigned long)rom;
else else
params->hdr.setup_data = (uint64_t)rom; params->hdr.setup_data = (unsigned long)rom;
data = (struct setup_data *)rom; data = (struct setup_data *)rom;
......
...@@ -941,7 +941,7 @@ void __init efi_enter_virtual_mode(void) ...@@ -941,7 +941,7 @@ void __init efi_enter_virtual_mode(void)
* *
* Call EFI services through wrapper functions. * Call EFI services through wrapper functions.
*/ */
efi.runtime_version = efi_systab.fw_revision; efi.runtime_version = efi_systab.hdr.revision;
efi.get_time = virt_efi_get_time; efi.get_time = virt_efi_get_time;
efi.set_time = virt_efi_set_time; efi.set_time = virt_efi_set_time;
efi.get_wakeup_time = virt_efi_get_wakeup_time; efi.get_wakeup_time = virt_efi_get_wakeup_time;
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/fixmap.h> #include <asm/fixmap.h>
static pgd_t save_pgd __initdata; static pgd_t *save_pgd __initdata;
static unsigned long efi_flags __initdata; static unsigned long efi_flags __initdata;
static void __init early_code_mapping_set_exec(int executable) static void __init early_code_mapping_set_exec(int executable)
...@@ -61,12 +61,20 @@ static void __init early_code_mapping_set_exec(int executable) ...@@ -61,12 +61,20 @@ static void __init early_code_mapping_set_exec(int executable)
void __init efi_call_phys_prelog(void) void __init efi_call_phys_prelog(void)
{ {
unsigned long vaddress; unsigned long vaddress;
int pgd;
int n_pgds;
early_code_mapping_set_exec(1); early_code_mapping_set_exec(1);
local_irq_save(efi_flags); local_irq_save(efi_flags);
vaddress = (unsigned long)__va(0x0UL);
save_pgd = *pgd_offset_k(0x0UL); n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE);
set_pgd(pgd_offset_k(0x0UL), *pgd_offset_k(vaddress)); save_pgd = kmalloc(n_pgds * sizeof(pgd_t), GFP_KERNEL);
for (pgd = 0; pgd < n_pgds; pgd++) {
save_pgd[pgd] = *pgd_offset_k(pgd * PGDIR_SIZE);
vaddress = (unsigned long)__va(pgd * PGDIR_SIZE);
set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), *pgd_offset_k(vaddress));
}
__flush_tlb_all(); __flush_tlb_all();
} }
...@@ -75,7 +83,11 @@ void __init efi_call_phys_epilog(void) ...@@ -75,7 +83,11 @@ void __init efi_call_phys_epilog(void)
/* /*
* After the lock is released, the original page table is restored. * After the lock is released, the original page table is restored.
*/ */
set_pgd(pgd_offset_k(0x0UL), save_pgd); int pgd;
int n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT) , PGDIR_SIZE);
for (pgd = 0; pgd < n_pgds; pgd++)
set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), save_pgd[pgd]);
kfree(save_pgd);
__flush_tlb_all(); __flush_tlb_all();
local_irq_restore(efi_flags); local_irq_restore(efi_flags);
early_code_mapping_set_exec(0); early_code_mapping_set_exec(0);
......
...@@ -674,7 +674,7 @@ static int efi_status_to_err(efi_status_t status) ...@@ -674,7 +674,7 @@ static int efi_status_to_err(efi_status_t status)
err = -EACCES; err = -EACCES;
break; break;
case EFI_NOT_FOUND: case EFI_NOT_FOUND:
err = -ENOENT; err = -EIO;
break; break;
default: default:
err = -EINVAL; err = -EINVAL;
...@@ -793,6 +793,7 @@ static ssize_t efivarfs_file_write(struct file *file, ...@@ -793,6 +793,7 @@ static ssize_t efivarfs_file_write(struct file *file,
spin_unlock(&efivars->lock); spin_unlock(&efivars->lock);
efivar_unregister(var); efivar_unregister(var);
drop_nlink(inode); drop_nlink(inode);
d_delete(file->f_dentry);
dput(file->f_dentry); dput(file->f_dentry);
} else { } else {
...@@ -994,7 +995,7 @@ static int efivarfs_unlink(struct inode *dir, struct dentry *dentry) ...@@ -994,7 +995,7 @@ static int efivarfs_unlink(struct inode *dir, struct dentry *dentry)
list_del(&var->list); list_del(&var->list);
spin_unlock(&efivars->lock); spin_unlock(&efivars->lock);
efivar_unregister(var); efivar_unregister(var);
drop_nlink(dir); drop_nlink(dentry->d_inode);
dput(dentry); dput(dentry);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment