Source-Changes-HG archive

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

[src/trunk]: src/sys Reorganize: also the APIC tables will be dumped in ACPIV...



details:   https://anonhg.NetBSD.org/src/rev/e059d08a51f1
branches:  trunk
changeset: 756900:e059d08a51f1
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Sat Aug 07 09:41:19 2010 +0000

description:
Reorganize: also the APIC tables will be dumped in ACPIVERBOSE, and the
callback functions will be modified to be suitable also with other tables.

diffstat:

 sys/arch/x86/x86/mpacpi.c |    7 +-
 sys/dev/acpi/acpi.c       |  145 +++++++++++++++++++++++-----
 sys/dev/acpi/acpi_madt.c  |  225 ----------------------------------------------
 sys/dev/acpi/acpi_madt.h  |   49 ----------
 sys/dev/acpi/acpivar.h    |   14 ++-
 sys/dev/acpi/files.acpi   |    3 +-
 6 files changed, 133 insertions(+), 310 deletions(-)

diffs (truncated from 550 to 300 lines):

diff -r 2bb3b2c1bf74 -r e059d08a51f1 sys/arch/x86/x86/mpacpi.c
--- a/sys/arch/x86/x86/mpacpi.c Sat Aug 07 08:59:51 2010 +0000
+++ b/sys/arch/x86/x86/mpacpi.c Sat Aug 07 09:41:19 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mpacpi.c,v 1.88 2010/08/04 10:02:12 jruoho Exp $       */
+/*     $NetBSD: mpacpi.c,v 1.89 2010/08/07 09:41:19 jruoho Exp $       */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1.88 2010/08/04 10:02:12 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1.89 2010/08/07 09:41:19 jruoho Exp $");
 
 #include "acpica.h"
 #include "opt_acpi.h"
@@ -71,7 +71,6 @@
 #include <dev/acpi/acpica.h>
 #include <dev/acpi/acpireg.h>
 #include <dev/acpi/acpivar.h>
-#include <dev/acpi/acpi_madt.h>
 
 #include <dev/cons.h>
 
@@ -169,7 +168,7 @@
 
 /*
  * Handle special interrupt sources and overrides from the MADT.
- * This is a callback function for acpi_madt_walk().
+ * This is a callback function for acpi_madt_walk() (see acpi.c).
  */
 static ACPI_STATUS
 mpacpi_nonpci_intr(ACPI_SUBTABLE_HEADER *hdrp, void *aux)
diff -r 2bb3b2c1bf74 -r e059d08a51f1 sys/dev/acpi/acpi.c
--- a/sys/dev/acpi/acpi.c       Sat Aug 07 08:59:51 2010 +0000
+++ b/sys/dev/acpi/acpi.c       Sat Aug 07 09:41:19 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi.c,v 1.211 2010/08/06 23:38:34 jruoho Exp $        */
+/*     $NetBSD: acpi.c,v 1.212 2010/08/07 09:41:19 jruoho Exp $        */
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -30,6 +30,41 @@
  */
 
 /*
+ * Copyright (c) 2003 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Frank van der Linden for Wasabi Systems, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed for the NetBSD Project by
+ *      Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
  * Copyright 2001, 2003 Wasabi Systems, Inc.
  * All rights reserved.
  *
@@ -65,7 +100,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.211 2010/08/06 23:38:34 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.212 2010/08/07 09:41:19 jruoho Exp $");
 
 #include "opt_acpi.h"
 #include "opt_pcifixup.h"
@@ -128,6 +163,7 @@
 extern kmutex_t                 acpi_interrupt_list_mtx;
 extern struct           cfdriver acpi_cd;
 static ACPI_HANDLE      acpi_scopes[4];
+static ACPI_TABLE_HEADER *madt_header;
 
 /*
  * This structure provides a context for the ACPI
@@ -1605,34 +1641,8 @@
 }
 
 /*
- * Miscellaneous.
+ * Tables.
  */
-static bool
-acpi_is_scope(struct acpi_devnode *ad)
-{
-       int i;
-
-       /*
-        * Return true if the node is a root scope.
-        */
-       if (ad->ad_parent == NULL)
-               return false;
-
-       if (ad->ad_parent->ad_handle != ACPI_ROOT_OBJECT)
-               return false;
-
-       for (i = 0; i < __arraycount(acpi_scopes); i++) {
-
-               if (acpi_scopes[i] == NULL)
-                       continue;
-
-               if (ad->ad_handle == acpi_scopes[i])
-                       return true;
-       }
-
-       return false;
-}
-
 ACPI_PHYSICAL_ADDRESS
 acpi_OsGetRootPointer(void)
 {
@@ -1690,6 +1700,83 @@
 }
 
 /*
+ * XXX: Refactor to be a generic function that maps tables.
+ */
+ACPI_STATUS
+acpi_madt_map(void)
+{
+       ACPI_STATUS  rv;
+
+       if (madt_header != NULL)
+               return AE_ALREADY_EXISTS;
+
+       rv = AcpiGetTable(ACPI_SIG_MADT, 1, &madt_header);
+
+       if (ACPI_FAILURE(rv))
+               return rv;
+
+       return AE_OK;
+}
+
+void
+acpi_madt_unmap(void)
+{
+       madt_header = NULL;
+}
+
+/*
+ * XXX: Refactor to be a generic function that walks tables.
+ */
+void
+acpi_madt_walk(ACPI_STATUS (*func)(ACPI_SUBTABLE_HEADER *, void *), void *aux)
+{
+       ACPI_SUBTABLE_HEADER *hdrp;
+       char *madtend, *where;
+
+       madtend = (char *)madt_header + madt_header->Length;
+       where = (char *)madt_header + sizeof (ACPI_TABLE_MADT);
+
+       while (where < madtend) {
+
+               hdrp = (ACPI_SUBTABLE_HEADER *)where;
+
+               if (ACPI_FAILURE(func(hdrp, aux)))
+                       break;
+
+               where += hdrp->Length;
+       }
+}
+
+/*
+ * Miscellaneous.
+ */
+static bool
+acpi_is_scope(struct acpi_devnode *ad)
+{
+       int i;
+
+       /*
+        * Return true if the node is a root scope.
+        */
+       if (ad->ad_parent == NULL)
+               return false;
+
+       if (ad->ad_parent->ad_handle != ACPI_ROOT_OBJECT)
+               return false;
+
+       for (i = 0; i < __arraycount(acpi_scopes); i++) {
+
+               if (acpi_scopes[i] == NULL)
+                       continue;
+
+               if (ad->ad_handle == acpi_scopes[i])
+                       return true;
+       }
+
+       return false;
+}
+
+/*
  * ACPIVERBOSE.
  */
 void
diff -r 2bb3b2c1bf74 -r e059d08a51f1 sys/dev/acpi/acpi_madt.c
--- a/sys/dev/acpi/acpi_madt.c  Sat Aug 07 08:59:51 2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,225 +0,0 @@
-/*     $NetBSD: acpi_madt.c,v 1.21 2010/03/05 14:00:17 jruoho Exp $    */
-
-/*
- * Copyright (c) 2003 Wasabi Systems, Inc.
- * All rights reserved.
- *
- * Written by Frank van der Linden for Wasabi Systems, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed for the NetBSD Project by
- *      Wasabi Systems, Inc.
- * 4. The name of Wasabi Systems, Inc. may not be used to endorse
- *    or promote products derived from this software without specific prior
- *    written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_madt.c,v 1.21 2010/03/05 14:00:17 jruoho Exp $");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-
-#include <dev/acpi/acpivar.h>
-#include <dev/acpi/acpi_madt.h>
-
-#ifdef ACPI_MADT_DEBUG
-static void acpi_madt_print(void);
-static ACPI_STATUS acpi_madt_print_entry(ACPI_SUBTABLE_HEADER *, void *);
-static void acpi_print_lapic(ACPI_MADT_LOCAL_APIC *);
-static void acpi_print_ioapic(ACPI_MADT_IO_APIC *);
-static void acpi_print_intsrc_ovr(ACPI_MADT_INTERRUPT_OVERRIDE *);
-static void acpi_print_intsrc_nmi(ACPI_MADT_NMI_SOURCE *);
-static void acpi_print_lapic_nmi(ACPI_MADT_LOCAL_APIC_NMI *);
-static void acpi_print_lapic_ovr(ACPI_MADT_LOCAL_APIC_OVERRIDE *);
-static void acpi_print_iosapic(ACPI_MADT_IO_SAPIC *);
-static void acpi_print_local_sapic(ACPI_MADT_LOCAL_SAPIC *);
-static void acpi_print_platint(ACPI_MADT_INTERRUPT_SOURCE *);
-#endif
-
-static ACPI_TABLE_HEADER *madt_header;
-
-ACPI_STATUS
-acpi_madt_map(void)
-{
-       ACPI_STATUS  rv;
-
-       if (madt_header != NULL)
-               return AE_ALREADY_EXISTS;
-
-       rv = AcpiGetTable(ACPI_SIG_MADT, 1, &madt_header);
-
-       if (ACPI_FAILURE(rv))



Home | Main Index | Thread Index | Old Index