0001-Add-runtime-option-etc-only-load-option-roms-load-bu.patch 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. From 69d303f3860b4127343613785ceb5d52fa715321 Mon Sep 17 00:00:00 2001
  2. From: Leah Rowe <leah@libreboot.org>
  3. Date: Sun, 16 May 2021 00:16:30 +0100
  4. Subject: [PATCH 1/1] Add runtime option: etc/only-load-option-roms (load, but
  5. don't run)
  6. From anecdotal reports, sometimes it is useful; I've heard of instances where
  7. certain Nvidia graphics cards can, if using the nouveau driver on a GNU+Linux
  8. system, be used without running any option ROM, but where the option ROM has
  9. certain data tables in it that the driver can use.
  10. If set to 1, this will disable *all* option ROM loading, even SeaVGABIOS. It
  11. also affects CSM. In practise, the only time someone would ever use this is if
  12. they were using a graphics card in the above scenario. Such a use-case is
  13. incredibly rare.
  14. If set to 0, the normal behaviour can be observed (load, and execute). The
  15. run time option etc/pci-optionrom-exec will still be in effect.
  16. Signed-off-by: Leah Rowe <leah@libreboot.org>
  17. ---
  18. src/optionroms.c | 6 +++++-
  19. 1 file changed, 5 insertions(+), 1 deletion(-)
  20. diff --git a/src/optionroms.c b/src/optionroms.c
  21. index e906ab9..db5e893 100644
  22. --- a/src/optionroms.c
  23. +++ b/src/optionroms.c
  24. @@ -23,7 +23,7 @@
  25. #include "util.h" // get_pnp_offset
  26. #include "tcgbios.h" // tpm_*
  27. -static int EnforceChecksum, S3ResumeVga, RunPCIroms;
  28. +static int EnforceChecksum, S3ResumeVga, RunPCIroms, OnlyLoadOptionRoms;
  29. /****************************************************************
  30. @@ -34,6 +34,9 @@ static int EnforceChecksum, S3ResumeVga, RunPCIroms;
  31. static void
  32. __callrom(struct rom_header *rom, u16 offset, u16 bdf)
  33. {
  34. + if (OnlyLoadOptionRoms)
  35. + return;
  36. +
  37. u16 seg = FLATPTR_TO_SEG(rom);
  38. dprintf(1, "Running option rom at %04x:%04x\n", seg, offset);
  39. @@ -461,6 +464,7 @@ vgarom_setup(void)
  40. EnforceChecksum = romfile_loadint("etc/optionroms-checksum", 1);
  41. S3ResumeVga = romfile_loadint("etc/s3-resume-vga-init", CONFIG_QEMU);
  42. RunPCIroms = romfile_loadint("etc/pci-optionrom-exec", 2);
  43. + OnlyLoadOptionRoms = romfile_loadint("etc/only-load-option-roms", 0);
  44. ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 1);
  45. // Clear option rom memory
  46. --
  47. 2.25.1