Author: kevans
Date: Mon Aug  6 03:58:56 2018
New Revision: 337370
URL: https://svnweb.freebsd.org/changeset/base/337370

Log:
  MFC r336919, r336924
  
  r336919:
  efirt: Add tunable to allow disabling EFI Runtime Services
  
  Leading up to enabling EFIRT in GENERIC, allow runtime services to be
  disabled with a new tunable: efi.rt_disabled. This makes it so that EFIRT
  can be disabled easily in case we run into some buggy UEFI implementation
  and fail to boot.
  
  r336924:
  Follow up to r336919 and r336921: s/efi.rt_disabled/efi.rt.disabled/
  
  The latter matches the rest of the tree better [0]. The UPDATING entry has
  been updated to reflect this, and the new tunable is now documented in
  loader(8) [1].
  
  Reported by:  imp [0], Shawn Webb [1]

Modified:
  stable/11/stand/man/loader.8
  stable/11/sys/dev/efidev/efirt.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/man/loader.8
==============================================================================
--- stable/11/stand/man/loader.8        Mon Aug  6 03:41:52 2018        
(r337369)
+++ stable/11/stand/man/loader.8        Mon Aug  6 03:58:56 2018        
(r337370)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 18, 2015
+.Dd July 30, 2018
 .Dt LOADER 8
 .Os
 .Sh NAME
@@ -588,6 +588,10 @@ explicitly.
 Other variables are used to override kernel tunable parameters.
 The following tunables are available:
 .Bl -tag -width Va
+.It Va efi.rt.disabled
+Disable UEFI runtime services in the kernel, if applicable.
+Runtime services are only available and used if the kernel is booted in a UEFI
+environment.
 .It Va hw.physmem
 Limit the amount of physical memory the system will use.
 By default the size is in bytes, but the

Modified: stable/11/sys/dev/efidev/efirt.c
==============================================================================
--- stable/11/sys/dev/efidev/efirt.c    Mon Aug  6 03:41:52 2018        
(r337369)
+++ stable/11/sys/dev/efidev/efirt.c    Mon Aug  6 03:58:56 2018        
(r337370)
@@ -133,7 +133,12 @@ efi_init(void)
        struct efi_md *map;
        caddr_t kmdp;
        size_t efisz;
+       int rt_disabled;
 
+       rt_disabled = 0;
+       TUNABLE_INT_FETCH("efi.rt.disabled", &rt_disabled);
+       if (rt_disabled == 1)
+               return (0);
        mtx_init(&efi_lock, "efi", NULL, MTX_DEF);
 
        if (efi_systbl_phys == 0) {
@@ -217,6 +222,9 @@ static void
 efi_uninit(void)
 {
 
+       /* Most likely disabled by tunable */
+       if (efi_runtime == NULL)
+               return;
        efi_destroy_1t1_map();
 
        efi_systbl = NULL;
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to