Sat Aug 7 09:41:20 2010 UTC ()
Reorganize: also the APIC tables will be dumped in ACPIVERBOSE, and the
callback functions will be modified to be suitable also with other tables.


(jruoho)
diff -r1.88 -r1.89 src/sys/arch/x86/x86/mpacpi.c
diff -r1.211 -r1.212 src/sys/dev/acpi/acpi.c
diff -r1.21 -r0 src/sys/dev/acpi/acpi_madt.c
diff -r1.8 -r0 src/sys/dev/acpi/acpi_madt.h
diff -r1.59 -r1.60 src/sys/dev/acpi/acpivar.h
diff -r1.76 -r1.77 src/sys/dev/acpi/files.acpi

cvs diff -r1.88 -r1.89 src/sys/arch/x86/x86/mpacpi.c (expand / switch to unified diff)

--- src/sys/arch/x86/x86/mpacpi.c 2010/08/04 10:02:12 1.88
+++ src/sys/arch/x86/x86/mpacpi.c 2010/08/07 09:41:19 1.89
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mpacpi.c,v 1.88 2010/08/04 10:02:12 jruoho Exp $ */ 1/* $NetBSD: mpacpi.c,v 1.89 2010/08/07 09:41:19 jruoho Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2003 Wasabi Systems, Inc. 4 * Copyright (c) 2003 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Frank van der Linden for Wasabi Systems, Inc. 7 * Written by Frank van der Linden for Wasabi Systems, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -26,27 +26,27 @@ @@ -26,27 +26,27 @@
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE. 35 * POSSIBILITY OF SUCH DAMAGE.
36 */ 36 */
37 37
38#include <sys/cdefs.h> 38#include <sys/cdefs.h>
39__KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1.88 2010/08/04 10:02:12 jruoho Exp $"); 39__KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1.89 2010/08/07 09:41:19 jruoho Exp $");
40 40
41#include "acpica.h" 41#include "acpica.h"
42#include "opt_acpi.h" 42#include "opt_acpi.h"
43#include "opt_mpbios.h" 43#include "opt_mpbios.h"
44#include "opt_multiprocessor.h" 44#include "opt_multiprocessor.h"
45#include "pchb.h" 45#include "pchb.h"
46 46
47#include <sys/param.h> 47#include <sys/param.h>
48#include <sys/systm.h> 48#include <sys/systm.h>
49#include <sys/kernel.h> 49#include <sys/kernel.h>
50#include <sys/device.h> 50#include <sys/device.h>
51#include <sys/kmem.h> 51#include <sys/kmem.h>
52#include <sys/queue.h> 52#include <sys/queue.h>
@@ -61,27 +61,26 @@ __KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1 @@ -61,27 +61,26 @@ __KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1
61 61
62#include <machine/i82093reg.h> 62#include <machine/i82093reg.h>
63#include <machine/i82093var.h> 63#include <machine/i82093var.h>
64#include <machine/i82489reg.h> 64#include <machine/i82489reg.h>
65#include <machine/i82489var.h> 65#include <machine/i82489var.h>
66#include <dev/isa/isareg.h> 66#include <dev/isa/isareg.h>
67#include <dev/pci/pcivar.h> 67#include <dev/pci/pcivar.h>
68#include <dev/pci/pcidevs.h> 68#include <dev/pci/pcidevs.h>
69#include <dev/pci/ppbreg.h> 69#include <dev/pci/ppbreg.h>
70 70
71#include <dev/acpi/acpica.h> 71#include <dev/acpi/acpica.h>
72#include <dev/acpi/acpireg.h> 72#include <dev/acpi/acpireg.h>
73#include <dev/acpi/acpivar.h> 73#include <dev/acpi/acpivar.h>
74#include <dev/acpi/acpi_madt.h> 
75 74
76#include <dev/cons.h> 75#include <dev/cons.h>
77 76
78#define _COMPONENT ACPI_RESOURCE_COMPONENT 77#define _COMPONENT ACPI_RESOURCE_COMPONENT
79ACPI_MODULE_NAME ("mpacpi") 78ACPI_MODULE_NAME ("mpacpi")
80 79
81#include "pci.h" 80#include "pci.h"
82#include "ioapic.h" 81#include "ioapic.h"
83#include "lapic.h" 82#include "lapic.h"
84 83
85#include "locators.h" 84#include "locators.h"
86 85
87/* XXX room for PCI-to-PCI bus */ 86/* XXX room for PCI-to-PCI bus */
@@ -159,27 +158,27 @@ mpacpi_cpuprint(void *aux, const char *p @@ -159,27 +158,27 @@ mpacpi_cpuprint(void *aux, const char *p
159static int 158static int
160mpacpi_ioapicprint(void *aux, const char *pnp) 159mpacpi_ioapicprint(void *aux, const char *pnp)
161{ 160{
162 struct apic_attach_args *aaa = aux; 161 struct apic_attach_args *aaa = aux;
163 162
164 if (pnp) 163 if (pnp)
165 aprint_normal("ioapic at %s", pnp); 164 aprint_normal("ioapic at %s", pnp);
166 aprint_normal(" apid %d", aaa->apic_id); 165 aprint_normal(" apid %d", aaa->apic_id);
167 return (UNCONF); 166 return (UNCONF);
168} 167}
169 168
170/* 169/*
171 * Handle special interrupt sources and overrides from the MADT. 170 * Handle special interrupt sources and overrides from the MADT.
172 * This is a callback function for acpi_madt_walk(). 171 * This is a callback function for acpi_madt_walk() (see acpi.c).
173 */ 172 */
174static ACPI_STATUS 173static ACPI_STATUS
175mpacpi_nonpci_intr(ACPI_SUBTABLE_HEADER *hdrp, void *aux) 174mpacpi_nonpci_intr(ACPI_SUBTABLE_HEADER *hdrp, void *aux)
176{ 175{
177 int *index = aux, pin, lindex; 176 int *index = aux, pin, lindex;
178 struct mp_intr_map *mpi; 177 struct mp_intr_map *mpi;
179 ACPI_MADT_NMI_SOURCE *ioapic_nmi; 178 ACPI_MADT_NMI_SOURCE *ioapic_nmi;
180 ACPI_MADT_LOCAL_APIC_NMI *lapic_nmi; 179 ACPI_MADT_LOCAL_APIC_NMI *lapic_nmi;
181 ACPI_MADT_INTERRUPT_OVERRIDE *isa_ovr; 180 ACPI_MADT_INTERRUPT_OVERRIDE *isa_ovr;
182 ACPI_MADT_LOCAL_X2APIC_NMI *x2apic_nmi; 181 ACPI_MADT_LOCAL_X2APIC_NMI *x2apic_nmi;
183 struct pic *pic; 182 struct pic *pic;
184 extern struct acpi_softc *acpi_softc; /* XXX */ 183 extern struct acpi_softc *acpi_softc; /* XXX */
185 184

cvs diff -r1.211 -r1.212 src/sys/dev/acpi/acpi.c (expand / switch to unified diff)

--- src/sys/dev/acpi/acpi.c 2010/08/06 23:38:34 1.211
+++ src/sys/dev/acpi/acpi.c 2010/08/07 09:41:19 1.212
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: acpi.c,v 1.211 2010/08/06 23:38:34 jruoho Exp $ */ 1/* $NetBSD: acpi.c,v 1.212 2010/08/07 09:41:19 jruoho Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Charles M. Hannum of By Noon Software, Inc. 8 * by Charles M. Hannum of By Noon Software, Inc.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,26 +20,61 @@ @@ -20,26 +20,61 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32/* 32/*
 33 * Copyright (c) 2003 Wasabi Systems, Inc.
 34 * All rights reserved.
 35 *
 36 * Written by Frank van der Linden for Wasabi Systems, Inc.
 37 *
 38 * Redistribution and use in source and binary forms, with or without
 39 * modification, are permitted provided that the following conditions
 40 * are met:
 41 * 1. Redistributions of source code must retain the above copyright
 42 * notice, this list of conditions and the following disclaimer.
 43 * 2. Redistributions in binary form must reproduce the above copyright
 44 * notice, this list of conditions and the following disclaimer in the
 45 * documentation and/or other materials provided with the distribution.
 46 * 3. All advertising materials mentioning features or use of this software
 47 * must display the following acknowledgement:
 48 * This product includes software developed for the NetBSD Project by
 49 * Wasabi Systems, Inc.
 50 * 4. The name of Wasabi Systems, Inc. may not be used to endorse
 51 * or promote products derived from this software without specific prior
 52 * written permission.
 53 *
 54 * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
 55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 56 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 57 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
 58 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 59 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 60 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 61 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 62 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 63 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 64 * POSSIBILITY OF SUCH DAMAGE.
 65 */
 66
 67/*
33 * Copyright 2001, 2003 Wasabi Systems, Inc. 68 * Copyright 2001, 2003 Wasabi Systems, Inc.
34 * All rights reserved. 69 * All rights reserved.
35 * 70 *
36 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 71 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
37 * 72 *
38 * Redistribution and use in source and binary forms, with or without 73 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions 74 * modification, are permitted provided that the following conditions
40 * are met: 75 * are met:
41 * 1. Redistributions of source code must retain the above copyright 76 * 1. Redistributions of source code must retain the above copyright
42 * notice, this list of conditions and the following disclaimer. 77 * notice, this list of conditions and the following disclaimer.
43 * 2. Redistributions in binary form must reproduce the above copyright 78 * 2. Redistributions in binary form must reproduce the above copyright
44 * notice, this list of conditions and the following disclaimer in the 79 * notice, this list of conditions and the following disclaimer in the
45 * documentation and/or other materials provided with the distribution. 80 * documentation and/or other materials provided with the distribution.
@@ -55,27 +90,27 @@ @@ -55,27 +90,27 @@
55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 90 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
56 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 91 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
57 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 92 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
58 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 93 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
59 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 94 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
60 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 95 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
61 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 96 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
62 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 97 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
63 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 98 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
64 * POSSIBILITY OF SUCH DAMAGE. 99 * POSSIBILITY OF SUCH DAMAGE.
65 */ 100 */
66 101
67#include <sys/cdefs.h> 102#include <sys/cdefs.h>
68__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.211 2010/08/06 23:38:34 jruoho Exp $"); 103__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.212 2010/08/07 09:41:19 jruoho Exp $");
69 104
70#include "opt_acpi.h" 105#include "opt_acpi.h"
71#include "opt_pcifixup.h" 106#include "opt_pcifixup.h"
72 107
73#include <sys/param.h> 108#include <sys/param.h>
74#include <sys/device.h> 109#include <sys/device.h>
75#include <sys/kernel.h> 110#include <sys/kernel.h>
76#include <sys/malloc.h> 111#include <sys/malloc.h>
77#include <sys/module.h> 112#include <sys/module.h>
78#include <sys/mutex.h> 113#include <sys/mutex.h>
79#include <sys/sysctl.h> 114#include <sys/sysctl.h>
80#include <sys/systm.h> 115#include <sys/systm.h>
81#include <sys/timetc.h> 116#include <sys/timetc.h>
@@ -118,26 +153,27 @@ static int acpi_dbgr = 0x00; @@ -118,26 +153,27 @@ static int acpi_dbgr = 0x00;
118 * dependent code may wish to skip other steps (such as attaching 153 * dependent code may wish to skip other steps (such as attaching
119 * subsystems that ACPI supercedes) when ACPI is active. 154 * subsystems that ACPI supercedes) when ACPI is active.
120 */ 155 */
121int acpi_active; 156int acpi_active;
122int acpi_force_load; 157int acpi_force_load;
123int acpi_suspended = 0; 158int acpi_suspended = 0;
124int acpi_verbose_loaded = 0; 159int acpi_verbose_loaded = 0;
125 160
126struct acpi_softc *acpi_softc; 161struct acpi_softc *acpi_softc;
127static uint64_t acpi_root_pointer; 162static uint64_t acpi_root_pointer;
128extern kmutex_t acpi_interrupt_list_mtx; 163extern kmutex_t acpi_interrupt_list_mtx;
129extern struct cfdriver acpi_cd; 164extern struct cfdriver acpi_cd;
130static ACPI_HANDLE acpi_scopes[4]; 165static ACPI_HANDLE acpi_scopes[4];
 166static ACPI_TABLE_HEADER *madt_header;
131 167
132/* 168/*
133 * This structure provides a context for the ACPI 169 * This structure provides a context for the ACPI
134 * namespace walk performed in acpi_build_tree(). 170 * namespace walk performed in acpi_build_tree().
135 */ 171 */
136struct acpi_walkcontext { 172struct acpi_walkcontext {
137 struct acpi_softc *aw_sc; 173 struct acpi_softc *aw_sc;
138 struct acpi_devnode *aw_parent; 174 struct acpi_devnode *aw_parent;
139}; 175};
140 176
141/* 177/*
142 * Ignored HIDs. 178 * Ignored HIDs.
143 */ 179 */
@@ -1595,54 +1631,28 @@ sysctl_hw_acpi_sleepstates(SYSCTLFN_ARGS @@ -1595,54 +1631,28 @@ sysctl_hw_acpi_sleepstates(SYSCTLFN_ARGS
1595 1631
1596 node = *rnode; 1632 node = *rnode;
1597 node.sysctl_data = &t; 1633 node.sysctl_data = &t;
1598 1634
1599 err = sysctl_lookup(SYSCTLFN_CALL(&node)); 1635 err = sysctl_lookup(SYSCTLFN_CALL(&node));
1600 1636
1601 if (err || newp == NULL) 1637 if (err || newp == NULL)
1602 return err; 1638 return err;
1603 1639
1604 return 0; 1640 return 0;
1605} 1641}
1606 1642
1607/* 1643/*
1608 * Miscellaneous. 1644 * Tables.
1609 */ 1645 */
1610static bool 
1611acpi_is_scope(struct acpi_devnode *ad) 
1612{ 
1613 int i; 
1614 
1615 /* 
1616 * Return true if the node is a root scope. 
1617 */ 
1618 if (ad->ad_parent == NULL) 
1619 return false; 
1620 
1621 if (ad->ad_parent->ad_handle != ACPI_ROOT_OBJECT) 
1622 return false; 
1623 
1624 for (i = 0; i < __arraycount(acpi_scopes); i++) { 
1625 
1626 if (acpi_scopes[i] == NULL) 
1627 continue; 
1628 
1629 if (ad->ad_handle == acpi_scopes[i]) 
1630 return true; 
1631 } 
1632 
1633 return false; 
1634} 
1635 
1636ACPI_PHYSICAL_ADDRESS 1646ACPI_PHYSICAL_ADDRESS
1637acpi_OsGetRootPointer(void) 1647acpi_OsGetRootPointer(void)
1638{ 1648{
1639 ACPI_PHYSICAL_ADDRESS PhysicalAddress; 1649 ACPI_PHYSICAL_ADDRESS PhysicalAddress;
1640 1650
1641 /* 1651 /*
1642 * We let MD code handle this since there are multiple ways to do it: 1652 * We let MD code handle this since there are multiple ways to do it:
1643 * 1653 *
1644 * IA-32: Use AcpiFindRootPointer() to locate the RSDP. 1654 * IA-32: Use AcpiFindRootPointer() to locate the RSDP.
1645 * 1655 *
1646 * IA-64: Use the EFI. 1656 * IA-64: Use the EFI.
1647 */ 1657 */
1648 PhysicalAddress = acpi_md_OsGetRootPointer(); 1658 PhysicalAddress = acpi_md_OsGetRootPointer();
@@ -1680,26 +1690,103 @@ acpi_map_rsdt(void) @@ -1680,26 +1690,103 @@ acpi_map_rsdt(void)
1680} 1690}
1681 1691
1682static void 1692static void
1683acpi_unmap_rsdt(ACPI_TABLE_HEADER *rsdt) 1693acpi_unmap_rsdt(ACPI_TABLE_HEADER *rsdt)
1684{ 1694{
1685 1695
1686 if (rsdt == NULL) 1696 if (rsdt == NULL)
1687 return; 1697 return;
1688 1698
1689 AcpiOsUnmapMemory(rsdt, sizeof(ACPI_TABLE_HEADER)); 1699 AcpiOsUnmapMemory(rsdt, sizeof(ACPI_TABLE_HEADER));
1690} 1700}
1691 1701
1692/* 1702/*
 1703 * XXX: Refactor to be a generic function that maps tables.
 1704 */
 1705ACPI_STATUS
 1706acpi_madt_map(void)
 1707{
 1708 ACPI_STATUS rv;
 1709
 1710 if (madt_header != NULL)
 1711 return AE_ALREADY_EXISTS;
 1712
 1713 rv = AcpiGetTable(ACPI_SIG_MADT, 1, &madt_header);
 1714
 1715 if (ACPI_FAILURE(rv))
 1716 return rv;
 1717
 1718 return AE_OK;
 1719}
 1720
 1721void
 1722acpi_madt_unmap(void)
 1723{
 1724 madt_header = NULL;
 1725}
 1726
 1727/*
 1728 * XXX: Refactor to be a generic function that walks tables.
 1729 */
 1730void
 1731acpi_madt_walk(ACPI_STATUS (*func)(ACPI_SUBTABLE_HEADER *, void *), void *aux)
 1732{
 1733 ACPI_SUBTABLE_HEADER *hdrp;
 1734 char *madtend, *where;
 1735
 1736 madtend = (char *)madt_header + madt_header->Length;
 1737 where = (char *)madt_header + sizeof (ACPI_TABLE_MADT);
 1738
 1739 while (where < madtend) {
 1740
 1741 hdrp = (ACPI_SUBTABLE_HEADER *)where;
 1742
 1743 if (ACPI_FAILURE(func(hdrp, aux)))
 1744 break;
 1745
 1746 where += hdrp->Length;
 1747 }
 1748}
 1749
 1750/*
 1751 * Miscellaneous.
 1752 */
 1753static bool
 1754acpi_is_scope(struct acpi_devnode *ad)
 1755{
 1756 int i;
 1757
 1758 /*
 1759 * Return true if the node is a root scope.
 1760 */
 1761 if (ad->ad_parent == NULL)
 1762 return false;
 1763
 1764 if (ad->ad_parent->ad_handle != ACPI_ROOT_OBJECT)
 1765 return false;
 1766
 1767 for (i = 0; i < __arraycount(acpi_scopes); i++) {
 1768
 1769 if (acpi_scopes[i] == NULL)
 1770 continue;
 1771
 1772 if (ad->ad_handle == acpi_scopes[i])
 1773 return true;
 1774 }
 1775
 1776 return false;
 1777}
 1778
 1779/*
1693 * ACPIVERBOSE. 1780 * ACPIVERBOSE.
1694 */ 1781 */
1695void 1782void
1696acpi_load_verbose(void) 1783acpi_load_verbose(void)
1697{ 1784{
1698 1785
1699 if (acpi_verbose_loaded == 0) { 1786 if (acpi_verbose_loaded == 0) {
1700 mutex_enter(&module_lock); 1787 mutex_enter(&module_lock);
1701 module_autoload("acpiverbose", MODULE_CLASS_MISC); 1788 module_autoload("acpiverbose", MODULE_CLASS_MISC);
1702 mutex_exit(&module_lock); 1789 mutex_exit(&module_lock);
1703 } 1790 }
1704} 1791}
1705 1792

File Deleted: src/sys/dev/acpi/Attic/acpi_madt.c

File Deleted: src/sys/dev/acpi/Attic/acpi_madt.h

cvs diff -r1.59 -r1.60 src/sys/dev/acpi/acpivar.h (expand / switch to unified diff)

--- src/sys/dev/acpi/acpivar.h 2010/08/06 23:38:34 1.59
+++ src/sys/dev/acpi/acpivar.h 2010/08/07 09:41:19 1.60
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: acpivar.h,v 1.59 2010/08/06 23:38:34 jruoho Exp $ */ 1/* $NetBSD: acpivar.h,v 1.60 2010/08/07 09:41:19 jruoho Exp $ */
2 2
3/* 3/*
4 * Copyright 2001 Wasabi Systems, Inc. 4 * Copyright 2001 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 7 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -290,26 +290,38 @@ void acpi_pci_link_resume(void); @@ -290,26 +290,38 @@ void acpi_pci_link_resume(void);
290struct acpi_io *acpi_res_io(struct acpi_resources *, int); 290struct acpi_io *acpi_res_io(struct acpi_resources *, int);
291struct acpi_iorange *acpi_res_iorange(struct acpi_resources *, int); 291struct acpi_iorange *acpi_res_iorange(struct acpi_resources *, int);
292struct acpi_mem *acpi_res_mem(struct acpi_resources *, int); 292struct acpi_mem *acpi_res_mem(struct acpi_resources *, int);
293struct acpi_memrange *acpi_res_memrange(struct acpi_resources *, int); 293struct acpi_memrange *acpi_res_memrange(struct acpi_resources *, int);
294struct acpi_irq *acpi_res_irq(struct acpi_resources *, int); 294struct acpi_irq *acpi_res_irq(struct acpi_resources *, int);
295struct acpi_drq *acpi_res_drq(struct acpi_resources *, int); 295struct acpi_drq *acpi_res_drq(struct acpi_resources *, int);
296 296
297/* 297/*
298 * Sleep state transition. 298 * Sleep state transition.
299 */ 299 */
300void acpi_enter_sleep_state(struct acpi_softc *, int); 300void acpi_enter_sleep_state(struct acpi_softc *, int);
301 301
302/* 302/*
 303 * MADT.
 304 */
 305#define ACPI_PLATFORM_INT_PMI 1
 306#define ACPI_PLATFORM_INT_INIT 2
 307#define ACPI_PLATFORM_INT_CERR 3
 308
 309ACPI_STATUS acpi_madt_map(void);
 310void acpi_madt_unmap(void);
 311void acpi_madt_walk(ACPI_STATUS (*)(ACPI_SUBTABLE_HEADER *,
 312 void *), void *);
 313
 314/*
303 * Quirk handling. 315 * Quirk handling.
304 */ 316 */
305struct acpi_quirk { 317struct acpi_quirk {
306 const char *aq_tabletype; /* what type of table (FADT, DSDT, etc) */ 318 const char *aq_tabletype; /* what type of table (FADT, DSDT, etc) */
307 const char *aq_oemid; /* compared against the table OemId */ 319 const char *aq_oemid; /* compared against the table OemId */
308 int aq_oemrev; /* compared against the table OemRev */ 320 int aq_oemrev; /* compared against the table OemRev */
309 int aq_cmpop; /* how to compare the oemrev number */ 321 int aq_cmpop; /* how to compare the oemrev number */
310 const char *aq_tabid; /* compared against the table TableId */ 322 const char *aq_tabid; /* compared against the table TableId */
311 int aq_quirks; /* the actual quirks */ 323 int aq_quirks; /* the actual quirks */
312}; 324};
313 325
314#define ACPI_QUIRK_BROKEN 0x00000001 /* totally broken */ 326#define ACPI_QUIRK_BROKEN 0x00000001 /* totally broken */
315#define ACPI_QUIRK_BADPCI 0x00000002 /* bad PCI hierarchy */ 327#define ACPI_QUIRK_BADPCI 0x00000002 /* bad PCI hierarchy */

cvs diff -r1.76 -r1.77 src/sys/dev/acpi/files.acpi (expand / switch to unified diff)

--- src/sys/dev/acpi/files.acpi 2010/07/18 09:29:12 1.76
+++ src/sys/dev/acpi/files.acpi 2010/08/07 09:41:19 1.77
@@ -1,30 +1,29 @@ @@ -1,30 +1,29 @@
1# $NetBSD: files.acpi,v 1.76 2010/07/18 09:29:12 jruoho Exp $ 1# $NetBSD: files.acpi,v 1.77 2010/08/07 09:41:19 jruoho Exp $
2 2
3include "dev/acpi/acpica/files.acpica" 3include "dev/acpi/acpica/files.acpica"
4 4
5defflag opt_acpi.h ACPIVERBOSE ACPI_DEBUG ACPI_ACTIVATE_DEV 5defflag opt_acpi.h ACPIVERBOSE ACPI_DEBUG ACPI_ACTIVATE_DEV
6 ACPI_DSDT_OVERRIDE ACPI_SCANPCI ACPI_BREAKPOINT 6 ACPI_DSDT_OVERRIDE ACPI_SCANPCI ACPI_BREAKPOINT
7defparam opt_acpi.h ACPI_DSDT_FILE := "\"/dev/null\"" 7defparam opt_acpi.h ACPI_DSDT_FILE := "\"/dev/null\""
8 8
9define acpiapmbus { } 9define acpiapmbus { }
10define acpinodebus { } 10define acpinodebus { }
11define acpiecdtbus { } 11define acpiecdtbus { }
12 12
13device acpi: acpica, acpiapmbus, acpinodebus, acpiecdtbus, sysmon_power, sysmon_taskq 13device acpi: acpica, acpiapmbus, acpinodebus, acpiecdtbus, sysmon_power, sysmon_taskq
14attach acpi at acpibus 14attach acpi at acpibus
15file dev/acpi/acpi.c acpi 15file dev/acpi/acpi.c acpi
16file dev/acpi/acpi_debug.c acpi 16file dev/acpi/acpi_debug.c acpi
17file dev/acpi/acpi_madt.c acpi 
18file dev/acpi/acpi_pci.c acpi 17file dev/acpi/acpi_pci.c acpi
19file dev/acpi/acpi_pci_link.c acpi 18file dev/acpi/acpi_pci_link.c acpi
20file dev/acpi/acpi_power.c acpi 19file dev/acpi/acpi_power.c acpi
21file dev/acpi/acpi_quirks.c acpi 20file dev/acpi/acpi_quirks.c acpi
22file dev/acpi/acpi_resource.c acpi 21file dev/acpi/acpi_resource.c acpi
23file dev/acpi/acpi_srat.c acpi 22file dev/acpi/acpi_srat.c acpi
24file dev/acpi/acpi_slit.c acpi 23file dev/acpi/acpi_slit.c acpi
25file dev/acpi/acpi_timer.c acpi 24file dev/acpi/acpi_timer.c acpi
26file dev/acpi/acpi_util.c acpi 25file dev/acpi/acpi_util.c acpi
27file dev/acpi/acpi_wakedev.c acpi 26file dev/acpi/acpi_wakedev.c acpi
28file dev/acpi/acpi_verbose.c acpi & acpiverbose 27file dev/acpi/acpi_verbose.c acpi & acpiverbose
29 28
30# ACPI/apm emulation. 29# ACPI/apm emulation.