Sat Aug 7 08:59:51 2010 UTC ()
Dump the whole FADT in ACPIVERBOSE.


(jruoho)
diff -r1.6 -r1.7 src/sys/dev/acpi/acpi_verbose.c

cvs diff -r1.6 -r1.7 src/sys/dev/acpi/acpi_verbose.c (expand / switch to unified diff)

--- src/sys/dev/acpi/acpi_verbose.c 2010/08/06 23:38:34 1.6
+++ src/sys/dev/acpi/acpi_verbose.c 2010/08/07 08:59:51 1.7
@@ -1,21 +1,21 @@ @@ -1,21 +1,21 @@
1/* $NetBSD: acpi_verbose.c,v 1.6 2010/08/06 23:38:34 jruoho Exp $ */ 1/* $NetBSD: acpi_verbose.c,v 1.7 2010/08/07 08:59:51 jruoho Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2003, 2007, 2010 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, and Jukka Ruohonen.
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.
15 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the 16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution. 17 * documentation and/or other materials provided with the distribution.
18 * 18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
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
@@ -55,40 +55,41 @@ @@ -55,40 +55,41 @@
55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
56 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 56 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
57 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 57 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
58 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 58 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
59 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 59 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
60 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 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 61 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
62 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 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 63 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
64 * POSSIBILITY OF SUCH DAMAGE. 64 * POSSIBILITY OF SUCH DAMAGE.
65 */ 65 */
66 66
67#include <sys/cdefs.h> 67#include <sys/cdefs.h>
68__KERNEL_RCSID(0, "$NetBSD: acpi_verbose.c,v 1.6 2010/08/06 23:38:34 jruoho Exp $"); 68__KERNEL_RCSID(0, "$NetBSD: acpi_verbose.c,v 1.7 2010/08/07 08:59:51 jruoho Exp $");
69 69
70#include <sys/param.h> 70#include <sys/param.h>
71#include <sys/device.h> 71#include <sys/device.h>
72#include <sys/kernel.h> 72#include <sys/kernel.h>
73#include <sys/systm.h> 73#include <sys/systm.h>
74#include <sys/module.h> 74#include <sys/module.h>
75 75
76#include <dev/acpi/acpireg.h> 76#include <dev/acpi/acpireg.h>
77#include <dev/acpi/acpivar.h> 77#include <dev/acpi/acpivar.h>
78#include <dev/acpi/acpidevs_data.h> 78#include <dev/acpi/acpidevs_data.h>
79 79
80void acpi_print_verbose_real(struct acpi_softc *); 80void acpi_print_verbose_real(struct acpi_softc *);
81void acpi_print_dev_real(const char *); 81void acpi_print_dev_real(const char *);
 82static void acpi_print_fadt(struct acpi_softc *);
82static void acpi_print_devnodes(struct acpi_softc *); 83static void acpi_print_devnodes(struct acpi_softc *);
83static void acpi_print_tree(struct acpi_devnode *, uint32_t); 84static void acpi_print_tree(struct acpi_devnode *, uint32_t);
84 85
85MODULE(MODULE_CLASS_MISC, acpiverbose, NULL); 86MODULE(MODULE_CLASS_MISC, acpiverbose, NULL);
86 87
87static int 88static int
88acpiverbose_modcmd(modcmd_t cmd, void *arg) 89acpiverbose_modcmd(modcmd_t cmd, void *arg)
89{ 90{
90 static void (*saved_print_verbose)(struct acpi_softc *); 91 static void (*saved_print_verbose)(struct acpi_softc *);
91 static void (*saved_print_dev)(const char *); 92 static void (*saved_print_dev)(const char *);
92 93
93 switch (cmd) { 94 switch (cmd) {
94 95
@@ -105,43 +106,144 @@ acpiverbose_modcmd(modcmd_t cmd, void *a @@ -105,43 +106,144 @@ acpiverbose_modcmd(modcmd_t cmd, void *a
105 acpi_print_dev = saved_print_dev; 106 acpi_print_dev = saved_print_dev;
106 acpi_verbose_loaded = 0; 107 acpi_verbose_loaded = 0;
107 return 0; 108 return 0;
108 109
109 default: 110 default:
110 return ENOTTY; 111 return ENOTTY;
111 } 112 }
112} 113}
113 114
114void 115void
115acpi_print_verbose_real(struct acpi_softc *sc) 116acpi_print_verbose_real(struct acpi_softc *sc)
116{ 117{
117 118
 119 acpi_print_fadt(sc);
118 acpi_print_devnodes(sc); 120 acpi_print_devnodes(sc);
119 acpi_print_tree(sc->sc_root, 0); 121 acpi_print_tree(sc->sc_root, 0);
120} 122}
121 123
122void 124void
123acpi_print_dev_real(const char *pnpstr) 125acpi_print_dev_real(const char *pnpstr)
124{ 126{
125 int i; 127 int i;
126 128
127 for (i = 0; i < __arraycount(acpi_knowndevs); i++) { 129 for (i = 0; i < __arraycount(acpi_knowndevs); i++) {
128 130
129 if (strcmp(acpi_knowndevs[i].pnp, pnpstr) == 0) 131 if (strcmp(acpi_knowndevs[i].pnp, pnpstr) == 0)
130 aprint_normal("[%s] ", acpi_knowndevs[i].str); 132 aprint_normal("[%s] ", acpi_knowndevs[i].str);
131 } 133 }
132} 134}
133 135
134static void 136static void
 137acpi_print_fadt(struct acpi_softc *sc)
 138{
 139 uint32_t i;
 140
 141 /*
 142 * See ACPI 4.0, section 5.2.9.
 143 */
 144 struct acpi_fadt {
 145 uint32_t fadt_offset;
 146 const char *fadt_name;
 147 uint64_t fadt_value;
 148 };
 149
 150 const struct acpi_fadt acpi_fadt_table[] = {
 151
 152 { 36, "FACS", AcpiGbl_FADT.Facs },
 153 { 40, "DSDT", AcpiGbl_FADT.Dsdt },
 154 { 44, "INT_MODEL", AcpiGbl_FADT.Model },
 155 { 45, "PM_PROFILE", AcpiGbl_FADT.PreferredProfile },
 156 { 46, "SCI_INT", AcpiGbl_FADT.SciInterrupt },
 157 { 48, "SMI_CMD", AcpiGbl_FADT.SmiCommand },
 158 { 52, "ACPI_ENABLE", AcpiGbl_FADT.AcpiEnable },
 159 { 53, "ACPI_DISABLE", AcpiGbl_FADT.AcpiDisable },
 160 { 54, "S4BIOS_REQ", AcpiGbl_FADT.S4BiosRequest },
 161 { 55, "PSTATE_CNT", AcpiGbl_FADT.PstateControl },
 162 { 56, "PM1a_EVT_BLK", AcpiGbl_FADT.Pm1aEventBlock },
 163 { 60, "PM1b_EVT_BLK", AcpiGbl_FADT.Pm1bEventBlock },
 164 { 64, "PM1a_CNT_BLK", AcpiGbl_FADT.Pm1aControlBlock },
 165 { 68, "PM1b_CNT_BLK", AcpiGbl_FADT.Pm1bControlBlock },
 166 { 72, "PM2_CNT_BLK", AcpiGbl_FADT.Pm2ControlBlock },
 167 { 76, "PM_TMR_BLK", AcpiGbl_FADT.PmTimerBlock },
 168 { 80, "GPE0_BLK", AcpiGbl_FADT.Gpe0Block },
 169 { 84, "GPE1_BLK", AcpiGbl_FADT.Gpe1Block },
 170 { 88, "PM1_EVT_LEN", AcpiGbl_FADT.Pm1EventLength },
 171 { 89, "PM1_CNT_LEN", AcpiGbl_FADT.Pm1ControlLength },
 172 { 90, "PM2_CNT_LEN", AcpiGbl_FADT.Pm2ControlLength },
 173 { 91, "PM_TMR_LEN", AcpiGbl_FADT.PmTimerLength },
 174 { 92, "GPE0_BLK_LEN", AcpiGbl_FADT.Gpe0BlockLength },
 175 { 93, "GPE1_BLK_LEN", AcpiGbl_FADT.Gpe1BlockLength },
 176 { 94, "GPE1_BASE", AcpiGbl_FADT.Gpe1Base },
 177 { 95, "CST_CNT", AcpiGbl_FADT.CstControl },
 178 { 96, "P_LVL2_LAT", AcpiGbl_FADT.C2Latency },
 179 { 98, "P_LVL3_LAT", AcpiGbl_FADT.C3Latency },
 180 { 100, "FLUSH_SIZE", AcpiGbl_FADT.FlushSize },
 181 { 102, "FLUSH_STRIDE", AcpiGbl_FADT.FlushStride },
 182 { 104, "DUTY_OFFSET", AcpiGbl_FADT.DutyOffset },
 183 { 105, "DUTY_WIDTH", AcpiGbl_FADT.DutyWidth },
 184 { 106, "DAY_ALRM", AcpiGbl_FADT.DayAlarm },
 185 { 107, "MON_ALRM", AcpiGbl_FADT.MonthAlarm },
 186 { 108, "CENTURY", AcpiGbl_FADT.Century },
 187 { 109, "IAPC_BOOT_ARCH",AcpiGbl_FADT.BootFlags },
 188 { 128, "RESET_VALUE", AcpiGbl_FADT.ResetValue },
 189 };
 190
 191 const struct acpi_fadt acpi_fadt_flags[] = {
 192
 193 { 0, "WBINVD", ACPI_FADT_WBINVD },
 194 { 1, "WBINVD_FLUSH", ACPI_FADT_WBINVD_FLUSH },
 195 { 2, "PROC_C1", ACPI_FADT_C1_SUPPORTED },
 196 { 3, "P_LVL2_UP", ACPI_FADT_C2_MP_SUPPORTED },
 197 { 4, "PWR_BUTTON", ACPI_FADT_POWER_BUTTON },
 198 { 5, "SLP_BUTTON", ACPI_FADT_SLEEP_BUTTON },
 199 { 6, "FIX_RTC", ACPI_FADT_FIXED_RTC },
 200 { 7, "RTC_S4", ACPI_FADT_S4_RTC_WAKE },
 201 { 8, "TMR_VAL_EXT", ACPI_FADT_32BIT_TIMER },
 202 { 9, "DCK_CAP", ACPI_FADT_DOCKING_SUPPORTED },
 203 { 10, "RESET_REG_SUP",ACPI_FADT_RESET_REGISTER },
 204 { 11, "SEALED_CASE", ACPI_FADT_SEALED_CASE },
 205 { 12, "HEADLESS", ACPI_FADT_HEADLESS },
 206 { 13, "CPU_SW_SLP", ACPI_FADT_SLEEP_TYPE },
 207 { 14, "PCI_EXP_WAK", ACPI_FADT_PCI_EXPRESS_WAKE },
 208 { 15, "PLATFORM_CLK", ACPI_FADT_PLATFORM_CLOCK },
 209 { 16, "S4_RTC_STS", ACPI_FADT_S4_RTC_VALID },
 210 { 17, "REMOTE_POWER", ACPI_FADT_REMOTE_POWER_ON },
 211 { 18, "APIC_CLUSTER", ACPI_FADT_APIC_CLUSTER },
 212 { 19, "APIC_PHYSICAL",ACPI_FADT_APIC_PHYSICAL },
 213 };
 214
 215 for (i = 0; i < __arraycount(acpi_fadt_table); i++) {
 216
 217 aprint_normal_dev(sc->sc_dev,
 218 "[FADT] %-15s: 0x%016" PRIX64"\n",
 219 acpi_fadt_table[i].fadt_name,
 220 acpi_fadt_table[i].fadt_value);
 221 }
 222
 223 for (i = 0; i < __arraycount(acpi_fadt_flags); i++) {
 224
 225 aprint_normal_dev(sc->sc_dev,
 226 "[FADT] %-15s: 0x%016" PRIX64"\n",
 227 acpi_fadt_flags[i].fadt_name, AcpiGbl_FADT.Flags &
 228 acpi_fadt_flags[i].fadt_value);
 229
 230 KASSERT(i == acpi_fadt_flags[i].fadt_offset);
 231 KASSERT(__BIT(acpi_fadt_flags[i].fadt_offset) ==
 232 acpi_fadt_flags[i].fadt_value);
 233 }
 234}
 235
 236static void
135acpi_print_devnodes(struct acpi_softc *sc) 237acpi_print_devnodes(struct acpi_softc *sc)
136{ 238{
137 struct acpi_devnode *ad; 239 struct acpi_devnode *ad;
138 ACPI_DEVICE_INFO *di; 240 ACPI_DEVICE_INFO *di;
139 241
140 SIMPLEQ_FOREACH(ad, &sc->ad_head, ad_list) { 242 SIMPLEQ_FOREACH(ad, &sc->ad_head, ad_list) {
141 243
142 di = ad->ad_devinfo; 244 di = ad->ad_devinfo;
143 aprint_normal_dev(sc->sc_dev, "%-5s ", ad->ad_name); 245 aprint_normal_dev(sc->sc_dev, "%-5s ", ad->ad_name);
144 246
145 aprint_normal("HID %-10s ", 247 aprint_normal("HID %-10s ",
146 ((di->Valid & ACPI_VALID_HID) != 0) ? 248 ((di->Valid & ACPI_VALID_HID) != 0) ?
147 di->HardwareId.String: "-"); 249 di->HardwareId.String: "-");