Module Name:    src
Committed By:   riastradh
Date:           Mon May 22 16:28:08 UTC 2023

Modified Files:
        src/sys/arch/x86/x86: efi_machdep.c

Log Message:
efi(4): Implement EFIIOC_GET_TABLE on x86.

PR kern/57076

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x86/x86/efi_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/efi_machdep.c
diff -u src/sys/arch/x86/x86/efi_machdep.c:1.5 src/sys/arch/x86/x86/efi_machdep.c:1.6
--- src/sys/arch/x86/x86/efi_machdep.c:1.5	Mon May 22 16:27:48 2023
+++ src/sys/arch/x86/x86/efi_machdep.c	Mon May 22 16:28:07 2023
@@ -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 */

Reply via email to