aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2013-04-16 19:00:53 -0400
committerMatt Fleming <matt.fleming@intel.com>2013-04-17 10:13:38 -0400
commit8c58bf3eec3b8fc8162fe557e9361891c20758f2 (patch)
treec88b22186b51a1fe78d4d6ffcbea058e27063e21
parent3668011d4ad556224f7c012c1e870a6eaa0e59da (diff)
x86,efi: Implement efi_no_storage_paranoia parameter
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>
-rw-r--r--Documentation/kernel-parameters.txt6
-rw-r--r--arch/x86/platform/efi/efi.c14
2 files changed, 19 insertions, 1 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 4609e81dbc37..d1cc3a9fa14f 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -788,6 +788,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
788 edd= [EDD] 788 edd= [EDD]
789 Format: {"off" | "on" | "skip[mbr]"} 789 Format: {"off" | "on" | "skip[mbr]"}
790 790
791 efi_no_storage_paranoia [EFI; X86]
792 Using this parameter you can use more than 50% of
793 your efi variable storage. Use this parameter only if
794 you are really sure that your UEFI does sane gc and
795 fulfills the spec otherwise your board may brick.
796
791 eisa_irq_edge= [PARISC,HW] 797 eisa_irq_edge= [PARISC,HW]
792 See header of drivers/parisc/eisa.c. 798 See header of drivers/parisc/eisa.c.
793 799
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 4f364c7c6111..e4a86a677ce1 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -113,6 +113,15 @@ static int __init setup_add_efi_memmap(char *arg)
113} 113}
114early_param("add_efi_memmap", setup_add_efi_memmap); 114early_param("add_efi_memmap", setup_add_efi_memmap);
115 115
116static bool efi_no_storage_paranoia;
117
118static int __init setup_storage_paranoia(char *arg)
119{
120 efi_no_storage_paranoia = true;
121 return 0;
122}
123early_param("efi_no_storage_paranoia", setup_storage_paranoia);
124
116 125
117static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) 126static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
118{ 127{
@@ -1137,7 +1146,10 @@ efi_status_t efi_query_variable_store(u32 attributes, unsigned long size)
1137 */ 1146 */
1138 1147
1139 if (!storage_size || size > remaining_size || 1148 if (!storage_size || size > remaining_size ||
1140 (max_size && size > max_size) || 1149 (max_size && size > max_size))
1150 return EFI_OUT_OF_RESOURCES;
1151
1152 if (!efi_no_storage_paranoia &&
1141 ((active_size + size + VAR_METADATA_SIZE > storage_size / 2) && 1153 ((active_size + size + VAR_METADATA_SIZE > storage_size / 2) &&
1142 (remaining_size - size < storage_size / 2))) 1154 (remaining_size - size < storage_size / 2)))
1143 return EFI_OUT_OF_RESOURCES; 1155 return EFI_OUT_OF_RESOURCES;