]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
x86,efi: Implement efi_no_storage_paranoia parameter
authorRichard Weinberger <richard@nod.at>
Tue, 16 Apr 2013 23:00:53 +0000 (01:00 +0200)
committerMatt Fleming <matt.fleming@intel.com>
Wed, 17 Apr 2013 14:13:38 +0000 (15:13 +0100)
Using this parameter one can disable the storage_size/2 check if
he is really sure that the UEFI does sane gc and fulfills the spec.

This parameter is useful if a devices uses more than 50% of the
storage by default.
The Intel DQSW67 desktop board is such a sucker for exmaple.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Documentation/kernel-parameters.txt
arch/x86/platform/efi/efi.c

index 4609e81dbc37fc2dbfa005ff607890df3a8bbc6b..d1cc3a9fa14fd9c2b593ac551d80bd0d801bc1e9 100644 (file)
@@ -788,6 +788,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
        edd=            [EDD]
                        Format: {"off" | "on" | "skip[mbr]"}
 
+       efi_no_storage_paranoia [EFI; X86]
+                       Using this parameter you can use more than 50% of
+                       your efi variable storage. Use this parameter only if
+                       you are really sure that your UEFI does sane gc and
+                       fulfills the spec otherwise your board may brick.
+
        eisa_irq_edge=  [PARISC,HW]
                        See header of drivers/parisc/eisa.c.
 
index 4f364c7c6111fc9e06f74979774fff09890a4adc..e4a86a677ce163ec5f911fb14db65590d813aee1 100644 (file)
@@ -113,6 +113,15 @@ static int __init setup_add_efi_memmap(char *arg)
 }
 early_param("add_efi_memmap", setup_add_efi_memmap);
 
+static bool efi_no_storage_paranoia;
+
+static int __init setup_storage_paranoia(char *arg)
+{
+       efi_no_storage_paranoia = true;
+       return 0;
+}
+early_param("efi_no_storage_paranoia", setup_storage_paranoia);
+
 
 static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
 {
@@ -1137,7 +1146,10 @@ efi_status_t efi_query_variable_store(u32 attributes, unsigned long size)
         */
 
        if (!storage_size || size > remaining_size ||
-           (max_size && size > max_size) ||
+           (max_size && size > max_size))
+               return EFI_OUT_OF_RESOURCES;
+
+       if (!efi_no_storage_paranoia &&
            ((active_size + size + VAR_METADATA_SIZE > storage_size / 2) &&
             (remaining_size - size < storage_size / 2)))
                return EFI_OUT_OF_RESOURCES;