summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2023-05-22 16:28:07 +0000
committerriastradh <riastradh@NetBSD.org>2023-05-22 16:28:07 +0000
commit9362bcd05ebc3cf67ead10d86cae7cf4e230d0ab (patch)
treec5e521127c902db9dd0fd0af023542b3f8cee805 /sys
parent7a20a79b976e40a8cd5ddbfc7d4515ec5b4432b3 (diff)
efi(4): Implement EFIIOC_GET_TABLE on x86.
PR kern/57076 XXX pullup-10
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/x86/x86/efi_machdep.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/sys/arch/x86/x86/efi_machdep.c b/sys/arch/x86/x86/efi_machdep.c
index 6e2b275529f..21586272764 100644
--- a/sys/arch/x86/x86/efi_machdep.c
+++ b/sys/arch/x86/x86/efi_machdep.c
@@ -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, struct uuid *vendor, uint32_t attrib,
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 */