2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-18 18:23:53 +08:00
linux-next/arch/x86/boot
Matthew Garrett f8b8404337 Modify UEFI anti-bricking code
This patch reworks the UEFI anti-bricking code, including an effective
reversion of cc5a080c and 31ff2f20. It turns out that calling
QueryVariableInfo() from boot services results in some firmware
implementations jumping to physical addresses even after entering virtual
mode, so until we have 1:1 mappings for UEFI runtime space this isn't
going to work so well.

Reverting these gets us back to the situation where we'd refuse to create
variables on some systems because they classify deleted variables as "used"
until the firmware triggers a garbage collection run, which they won't do
until they reach a lower threshold. This results in it being impossible to
install a bootloader, which is unhelpful.

Feedback from Samsung indicates that the firmware doesn't need more than
5KB of storage space for its own purposes, so that seems like a reasonable
threshold. However, there's still no guarantee that a platform will attempt
garbage collection merely because it drops below this threshold. It seems
that this is often only triggered if an attempt to write generates a
genuine EFI_OUT_OF_RESOURCES error. We can force that by attempting to
create a variable larger than the remaining space. This should fail, but if
it somehow succeeds we can then immediately delete it.

I've tested this on the UEFI machines I have available, but I don't have
a Samsung and so can't verify that it avoids the bricking problem.

Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: Lee, Chun-Y <jlee@suse.com> [ dummy variable cleanup ]
Cc: <stable@vger.kernel.org>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-06-10 21:59:37 +01:00
..
compressed Modify UEFI anti-bricking code 2013-06-10 21:59:37 +01:00
tools x86, build: Dynamically find entry points in compressed startup code 2013-01-27 20:19:37 -08:00
.gitignore x86: remove offsets.h from .gitignore and dontdiff 2012-11-19 14:10:53 +01:00
a20.c
apm.c
bioscall.S
bitops.h
boot.h x86, boot: Pass cmd_line_ptr with unsigned long instead 2013-01-29 15:26:09 -08:00
cmdline.c x86, boot: Pass cmd_line_ptr with unsigned long instead 2013-01-29 15:26:09 -08:00
code16gcc.h
copy.S
cpu.c
cpucheck.c
ctype.h
early_serial_console.c
edd.c
header.S x86, boot: Support loading bzImage, boot_params and ramdisk above 4G 2013-01-29 19:32:33 -08:00
install.sh
main.c
Makefile x86, build: Dynamically find entry points in compressed startup code 2013-01-27 20:19:37 -08:00
mca.c
memory.c
mkcpustr.c
mtools.conf.in
pm.c
pmjump.S
printf.c
regs.c
setup.ld x86, boot: Define the 2.12 bzImage boot protocol 2013-01-27 15:56:37 -08:00
string.c
tty.c
version.c
vesa.h
video-bios.c
video-mode.c
video-vesa.c
video-vga.c
video.c
video.h