Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi Add helper functions for walking GTDT subtables.
details: https://anonhg.NetBSD.org/src/rev/2bf560e1f733
branches: trunk
changeset: 993948:2bf560e1f733
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Fri Oct 12 21:20:54 2018 +0000
description:
Add helper functions for walking GTDT subtables.
diffstat:
sys/dev/acpi/acpi.c | 47 +++++++++++++++++++++++++++++++++++++++++++++--
sys/dev/acpi/acpivar.h | 10 +++++++++-
2 files changed, 54 insertions(+), 3 deletions(-)
diffs (106 lines):
diff -r ad4be52d73bd -r 2bf560e1f733 sys/dev/acpi/acpi.c
--- a/sys/dev/acpi/acpi.c Fri Oct 12 21:19:11 2018 +0000
+++ b/sys/dev/acpi/acpi.c Fri Oct 12 21:20:54 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.272 2018/10/11 22:58:36 jmcneill Exp $ */
+/* $NetBSD: acpi.c,v 1.273 2018/10/12 21:20:54 jmcneill Exp $ */
/*-
* Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.272 2018/10/11 22:58:36 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.273 2018/10/12 21:20:54 jmcneill Exp $");
#include "pci.h"
#include "opt_acpi.h"
@@ -148,6 +148,7 @@
extern kmutex_t acpi_interrupt_list_mtx;
static ACPI_HANDLE acpi_scopes[4];
ACPI_TABLE_HEADER *madt_header;
+ACPI_TABLE_HEADER *gtdt_header;
/*
* This structure provides a context for the ACPI
@@ -1708,6 +1709,28 @@
madt_header = NULL;
}
+ACPI_STATUS
+acpi_gtdt_map(void)
+{
+ ACPI_STATUS rv;
+
+ if (gtdt_header != NULL)
+ return AE_ALREADY_EXISTS;
+
+ rv = AcpiGetTable(ACPI_SIG_GTDT, 1, >dt_header);
+
+ if (ACPI_FAILURE(rv))
+ return rv;
+
+ return AE_OK;
+}
+
+void
+acpi_gtdt_unmap(void)
+{
+ gtdt_header = NULL;
+}
+
/*
* XXX: Refactor to be a generic function that walks tables.
*/
@@ -1731,6 +1754,26 @@
}
}
+void
+acpi_gtdt_walk(ACPI_STATUS (*func)(ACPI_GTDT_HEADER *, void *), void *aux)
+{
+ ACPI_GTDT_HEADER *hdrp;
+ char *gtdtend, *where;
+
+ gtdtend = (char *)gtdt_header + gtdt_header->Length;
+ where = (char *)gtdt_header + sizeof (ACPI_TABLE_GTDT);
+
+ while (where < gtdtend) {
+
+ hdrp = (ACPI_GTDT_HEADER *)where;
+
+ if (ACPI_FAILURE(func(hdrp, aux)))
+ break;
+
+ where += hdrp->Length;
+ }
+}
+
/*
* Miscellaneous.
*/
diff -r ad4be52d73bd -r 2bf560e1f733 sys/dev/acpi/acpivar.h
--- a/sys/dev/acpi/acpivar.h Fri Oct 12 21:19:11 2018 +0000
+++ b/sys/dev/acpi/acpivar.h Fri Oct 12 21:20:54 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpivar.h,v 1.75 2018/05/05 17:16:23 christos Exp $ */
+/* $NetBSD: acpivar.h,v 1.76 2018/10/12 21:20:54 jmcneill Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -351,6 +351,14 @@
void *), void *);
/*
+ * GTDT.
+ */
+ACPI_STATUS acpi_gtdt_map(void);
+void acpi_gtdt_unmap(void);
+void acpi_gtdt_walk(ACPI_STATUS (*)(ACPI_GTDT_HEADER *,
+ void *), void *);
+
+/*
* Quirk handling.
*/
struct acpi_quirk {
Home |
Main Index |
Thread Index |
Old Index