Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/x86 efi(4): Implement EFIIOC_GET_TABLE on x86.



details:   https://anonhg.NetBSD.org/src/rev/b7fb5c3b8ff8
branches:  trunk
changeset: 375944:b7fb5c3b8ff8
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon May 22 16:28:07 2023 +0000

description:
efi(4): Implement EFIIOC_GET_TABLE on x86.

PR kern/57076

XXX pullup-10

diffstat:

 sys/arch/x86/x86/efi_machdep.c |  21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diffs (48 lines):

diff -r a23727f1fb95 -r b7fb5c3b8ff8 sys/arch/x86/x86/efi_machdep.c
--- a/sys/arch/x86/x86/efi_machdep.c    Mon May 22 16:27:58 2023 +0000
+++ b/sys/arch/x86/x86/efi_machdep.c    Mon May 22 16:28:07 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: efi_machdep.c,v 1.5 2023/05/22 16:27:48 riastradh Exp $        */
+/*     $NetBSD: efi_machdep.c,v 1.6 2023/05/22 16:28:07 riastradh Exp $        */
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: efi_machdep.c,v 1.5 2023/05/22 16:27:48 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: efi_machdep.c,v 1.6 2023/05/22 16:28:07 riastradh Exp $");
 
 #include "efi.h"
 #include "opt_efi.h"
@@ -973,12 +973,29 @@ efi_runtime_setvar(efi_char *name, struc
        return status;
 }
 
+static efi_status
+efi_runtime_gettab(const struct uuid *vendor, uint64_t *addrp)
+{
+       struct efi_cfgtbl *cfgtbl = efi_getcfgtblhead();
+       paddr_t pa;
+
+       if (cfgtbl == NULL)
+               return EFI_UNSUPPORTED;
+
+       pa = efi_getcfgtblpa(vendor);
+       if (pa == 0)
+               return EFI_NOT_FOUND;
+       *addrp = pa;
+       return EFI_SUCCESS;
+}
+
 static struct efi_ops efi_runtime_ops = {
        .efi_gettime = efi_runtime_gettime,
        .efi_settime = efi_runtime_settime,
        .efi_getvar = efi_runtime_getvar,
        .efi_setvar = efi_runtime_setvar,
        .efi_nextvar = efi_runtime_nextvar,
+       .efi_gettab = efi_runtime_gettab,
 };
 
 #endif /* EFI_RUNTIME */



Home | Main Index | Thread Index | Old Index