Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8c58bf3

Browse files
richardweinbergerMatt Fleming
authored andcommitted
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 <[email protected]> Signed-off-by: Matt Fleming <[email protected]>
1 parent 3668011 commit 8c58bf3

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

Documentation/kernel-parameters.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
788788
edd= [EDD]
789789
Format: {"off" | "on" | "skip[mbr]"}
790790

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+
791797
eisa_irq_edge= [PARISC,HW]
792798
See header of drivers/parisc/eisa.c.
793799

arch/x86/platform/efi/efi.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@ static int __init setup_add_efi_memmap(char *arg)
113113
}
114114
early_param("add_efi_memmap", setup_add_efi_memmap);
115115

116+
static bool efi_no_storage_paranoia;
117+
118+
static int __init setup_storage_paranoia(char *arg)
119+
{
120+
efi_no_storage_paranoia = true;
121+
return 0;
122+
}
123+
early_param("efi_no_storage_paranoia", setup_storage_paranoia);
124+
116125

117126
static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
118127
{
@@ -1137,7 +1146,10 @@ efi_status_t efi_query_variable_store(u32 attributes, unsigned long size)
11371146
*/
11381147

11391148
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 &&
11411153
((active_size + size + VAR_METADATA_SIZE > storage_size / 2) &&
11421154
(remaining_size - size < storage_size / 2)))
11431155
return EFI_OUT_OF_RESOURCES;

0 commit comments

Comments
 (0)