Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi - Don't use ACPI CA internal functions



details:   https://anonhg.NetBSD.org/src/rev/49a0b8807fae
branches:  trunk
changeset: 559816:49a0b8807fae
user:      kochi <kochi%NetBSD.org@localhost>
date:      Wed Mar 24 12:49:45 2004 +0000

description:
- Don't use ACPI CA internal functions
- make MADT table pointer static

diffstat:

 sys/dev/acpi/acpi_madt.c |  59 +++++++++++++----------------------------------
 sys/dev/acpi/acpi_madt.h |   4 +--
 2 files changed, 18 insertions(+), 45 deletions(-)

diffs (135 lines):

diff -r 76bc7dc6e730 -r 49a0b8807fae sys/dev/acpi/acpi_madt.c
--- a/sys/dev/acpi/acpi_madt.c  Wed Mar 24 12:28:51 2004 +0000
+++ b/sys/dev/acpi/acpi_madt.c  Wed Mar 24 12:49:45 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_madt.c,v 1.10 2004/02/13 11:36:20 wiz Exp $       */
+/*     $NetBSD: acpi_madt.c,v 1.11 2004/03/24 12:49:45 kochi Exp $     */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_madt.c,v 1.10 2004/02/13 11:36:20 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_madt.c,v 1.11 2004/03/24 12:49:45 kochi Exp $");
 
 #include <sys/param.h>
 #include <sys/ioctl.h>
@@ -49,8 +49,6 @@
 #include <dev/acpi/acpireg.h>
 #include <dev/acpi/acpivar.h>
 #include <dev/acpi/acpi_osd.h>
-#include <dev/acpi/acpica/Subsystem/actables.h>
-#include <dev/acpi/acpica/Subsystem/acnamesp.h>
 #include <dev/acpi/acpi_madt.h>
 
 #ifdef ACPI_MADT_DEBUG
@@ -67,57 +65,34 @@
 static void acpi_print_platint(MADT_INTERRUPT_SOURCE *);
 #endif
 
-ACPI_TABLE_HEADER *AcpiGbl_MADT;
+static ACPI_TABLE_HEADER *madt_header;
 
 ACPI_STATUS
 acpi_madt_map(void)
 {
-       ACPI_TABLE_HEADER header;
-       XSDT_DESCRIPTOR *xp;
-       ACPI_POINTER Address;
-       ACPI_STATUS  Status = AE_OK;
-       int i, len;
+       ACPI_STATUS  rv;
 
-       if (AcpiGbl_XSDT == NULL)
-               return AE_NO_ACPI_TABLES;
-
-       if (AcpiGbl_MADT != NULL)
+       if (madt_header != NULL)
                return AE_ALREADY_EXISTS;
 
-       xp = AcpiGbl_XSDT;
+       rv = AcpiGetFirmwareTable(APIC_SIG, 1, ACPI_LOGICAL_ADDRESSING,
+           &madt_header);
 
-       Address.PointerType = AcpiGbl_TableFlags | ACPI_LOGICAL_ADDRESSING;
-
-       len = (xp->Length - sizeof (ACPI_TABLE_HEADER))
-               / sizeof (xp->TableOffsetEntry[0]);
+       if (ACPI_FAILURE(rv))
+               return rv;
 
-       for (i = 0; i < len; i++) {
-               Address.Pointer.Value =
-                   ACPI_GET_ADDRESS(AcpiGbl_XSDT->TableOffsetEntry[i]);
-               Status = AcpiTbGetTableHeader(&Address, &header);
-               if (ACPI_FAILURE (Status))
-                       return Status;
-               if (!strncmp(header.Signature, APIC_SIG, 4)) {
-                       Status = AcpiOsMapMemory(Address.Pointer.Value,
-                           (ACPI_SIZE)header.Length, (void *)&AcpiGbl_MADT);
-                       if (ACPI_FAILURE (Status))
-                               return Status;
-                       else
-                               break;
-               }
-       }
 #ifdef ACPI_MADT_DEBUG
-       if (AcpiGbl_MADT != NULL)
-               acpi_madt_print();
+       acpi_madt_print();
 #endif
-       return AcpiGbl_MADT != NULL ? AE_OK : AE_NOT_FOUND;
+
+       return AE_OK;
 }
 
 void
 acpi_madt_unmap(void)
 {
-       AcpiOsUnmapMemory(AcpiGbl_MADT, AcpiGbl_MADT->Length);
-       AcpiGbl_MADT = NULL;
+       AcpiOsUnmapMemory(madt_header, madt_header->Length);
+       madt_header = NULL;
 }
 
 #ifdef ACPI_MADT_DEBUG
@@ -192,8 +167,8 @@
        char *madtend, *where;
        APIC_HEADER *hdrp;
 
-       madtend = (char *)AcpiGbl_MADT + AcpiGbl_MADT->Length;
-       where = (char *)AcpiGbl_MADT + sizeof (MULTIPLE_APIC_TABLE);
+       madtend = (char *)madt_header + madt_header->Length;
+       where = (char *)madt_header + sizeof (MULTIPLE_APIC_TABLE);
        while (where < madtend) {
                hdrp = (APIC_HEADER *)where;
                if (func(hdrp, aux) != AE_OK)
@@ -208,7 +183,7 @@
 {
        MULTIPLE_APIC_TABLE *ap;
 
-       ap = (MULTIPLE_APIC_TABLE *)AcpiGbl_MADT;
+       ap = (MULTIPLE_APIC_TABLE *)madt_header;
        printf("\n\nACPI MADT table:\n");
        printf("default local APIC address: %x\n", ap->LocalApicAddress);
        printf("system dual 8259%s present\n",
diff -r 76bc7dc6e730 -r 49a0b8807fae sys/dev/acpi/acpi_madt.h
--- a/sys/dev/acpi/acpi_madt.h  Wed Mar 24 12:28:51 2004 +0000
+++ b/sys/dev/acpi/acpi_madt.h  Wed Mar 24 12:49:45 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_madt.h,v 1.4 2004/02/14 16:59:35 kochi Exp $      */
+/*     $NetBSD: acpi_madt.h,v 1.5 2004/03/24 12:49:45 kochi Exp $      */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -39,8 +39,6 @@
 #define ACPI_PLATFORM_INT_INIT 2
 #define ACPI_PLATFORM_INT_CERR 3
 
-extern ACPI_TABLE_HEADER *AcpiGbl_MADT;
-
 ACPI_STATUS acpi_madt_map(void);
 void acpi_madt_unmap(void);
 void acpi_madt_walk(ACPI_STATUS (*)(APIC_HEADER *, void *), void *);



Home | Main Index | Thread Index | Old Index