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 quirk support for _OSI strings introduced i...
details: https://anonhg.NetBSD.org/src/rev/87001f3d50ad
branches: trunk
changeset: 762359:87001f3d50ad
user: jruoho <jruoho%NetBSD.org@localhost>
date: Sun Feb 20 06:45:32 2011 +0000
description:
Add quirk support for _OSI strings introduced in ACPICA 20110211. While
here, clean up acpi_probe() and the quirk code. Remove #ifdef ACPI_DEBUGGER.
diffstat:
sys/dev/acpi/acpi.c | 115 ++++++------------------
sys/dev/acpi/acpi_quirks.c | 206 ++++++++++++++++++++++++++++++++------------
sys/dev/acpi/acpivar.h | 20 ++-
3 files changed, 194 insertions(+), 147 deletions(-)
diffs (truncated from 558 to 300 lines):
diff -r 7cb04922ce9c -r 87001f3d50ad sys/dev/acpi/acpi.c
--- a/sys/dev/acpi/acpi.c Sun Feb 20 06:09:16 2011 +0000
+++ b/sys/dev/acpi/acpi.c Sun Feb 20 06:45:32 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.237 2011/02/19 09:52:32 jruoho Exp $ */
+/* $NetBSD: acpi.c,v 1.238 2011/02/20 06:45:32 jruoho 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.237 2011/02/19 09:52:32 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.238 2011/02/20 06:45:32 jruoho Exp $");
#include "opt_acpi.h"
#include "opt_pcifixup.h"
@@ -138,16 +138,6 @@
#include <machine/acpi_machdep.h>
-#ifdef ACPI_DEBUGGER
-#define ACPI_DBGR_INIT 0x01
-#define ACPI_DBGR_TABLES 0x02
-#define ACPI_DBGR_ENABLE 0x04
-#define ACPI_DBGR_PROBE 0x08
-#define ACPI_DBGR_RUNNING 0x10
-
-static int acpi_dbgr = 0x00;
-#endif
-
/*
* The acpi_active variable is set when the ACPI subsystem is active.
* Machine-dependent code may wish to skip other steps (such as attaching
@@ -159,7 +149,7 @@
int acpi_force_load = 0;
int acpi_verbose_loaded = 0;
-struct acpi_softc *acpi_softc;
+struct acpi_softc *acpi_softc = NULL;
static uint64_t acpi_root_pointer;
extern kmutex_t acpi_interrupt_list_mtx;
extern struct cfdriver acpi_cd;
@@ -260,42 +250,25 @@
acpi_probe(void)
{
ACPI_TABLE_HEADER *rsdt;
- const char *func;
- static int once;
- bool initialized;
ACPI_STATUS rv;
+ int quirks;
- if (once != 0)
+ if (acpi_softc != NULL)
panic("%s: already probed", __func__);
- once = 1;
- func = NULL;
- acpi_softc = NULL;
- initialized = false;
-
mutex_init(&acpi_interrupt_list_mtx, MUTEX_DEFAULT, IPL_NONE);
/*
* Start up ACPICA.
*/
-#ifdef ACPI_DEBUGGER
- if (acpi_dbgr & ACPI_DBGR_INIT)
- acpi_osd_debugger();
-#endif
-
- CTASSERT(TRUE == true);
- CTASSERT(FALSE == false);
-
AcpiGbl_AllMethodsSerialized = false;
AcpiGbl_EnableInterpreterSlack = true;
rv = AcpiInitializeSubsystem();
- if (ACPI_SUCCESS(rv))
- initialized = true;
- else {
- func = "AcpiInitializeSubsystem()";
- goto fail;
+ if (ACPI_FAILURE(rv)) {
+ aprint_error("%s: failed to initialize subsystem\n", __func__);
+ return 0;
}
/*
@@ -305,49 +278,47 @@
rv = AcpiInitializeTables(NULL, 2, true);
if (ACPI_FAILURE(rv)) {
- func = "AcpiInitializeTables()";
+ aprint_error("%s: failed to initialize tables\n", __func__);
goto fail;
}
-#ifdef ACPI_DEBUGGER
- if (acpi_dbgr & ACPI_DBGR_TABLES)
- acpi_osd_debugger();
-#endif
-
rv = AcpiLoadTables();
if (ACPI_FAILURE(rv)) {
- func = "AcpiLoadTables()";
+ aprint_error("%s: failed to load tables\n", __func__);
goto fail;
}
rsdt = acpi_map_rsdt();
if (rsdt == NULL) {
- func = "acpi_map_rsdt()";
- rv = AE_ERROR;
+ aprint_error("%s: failed to map RSDT\n", __func__);
goto fail;
}
- if (acpi_force_load == 0 && (acpi_find_quirks() & ACPI_QUIRK_BROKEN)) {
+ quirks = acpi_find_quirks();
+
+ if (acpi_force_load == 0 && (quirks & ACPI_QUIRK_BROKEN) != 0) {
+
aprint_normal("ACPI: BIOS is listed as broken:\n");
aprint_normal("ACPI: X/RSDT: OemId <%6.6s,%8.8s,%08x>, "
- "AslId <%4.4s,%08x>\n",
- rsdt->OemId, rsdt->OemTableId,
- rsdt->OemRevision,
- rsdt->AslCompilerId,
+ "AslId <%4.4s,%08x>\n", rsdt->OemId, rsdt->OemTableId,
+ rsdt->OemRevision, rsdt->AslCompilerId,
rsdt->AslCompilerRevision);
aprint_normal("ACPI: Not used. Set acpi_force_load to use.\n");
+
acpi_unmap_rsdt(rsdt);
- AcpiTerminate();
- return 0;
+ goto fail;
}
- if (acpi_force_load == 0 && (acpi_find_quirks() & ACPI_QUIRK_OLDBIOS)) {
- aprint_normal("ACPI: BIOS is too old (%s). Set acpi_force_load to use.\n",
+
+ if (acpi_force_load == 0 && (quirks & ACPI_QUIRK_OLDBIOS) != 0) {
+
+ aprint_normal("ACPI: BIOS is too old (%s). "
+ "Set acpi_force_load to use.\n",
pmf_get_platform("firmware-date"));
+
acpi_unmap_rsdt(rsdt);
- AcpiTerminate();
- return 0;
+ goto fail;
}
acpi_unmap_rsdt(rsdt);
@@ -355,24 +326,14 @@
rv = AcpiEnableSubsystem(~(ACPI_NO_HARDWARE_INIT|ACPI_NO_ACPI_ENABLE));
if (ACPI_FAILURE(rv)) {
- func = "AcpiEnableSubsystem()";
+ aprint_error("%s: failed to enable subsystem\n", __func__);
goto fail;
}
- /*
- * Looks like we have ACPI!
- */
return 1;
fail:
- KASSERT(rv != AE_OK);
- KASSERT(func != NULL);
-
- aprint_error("%s: failed to probe ACPI: %s\n",
- func, AcpiFormatException(rv));
-
- if (initialized != false)
- (void)AcpiTerminate();
+ (void)AcpiTerminate();
return 0;
}
@@ -468,13 +429,8 @@
aprint_error_dev(self, "couldn't establish power handler\n");
/*
- * Bring ACPI on-line.
+ * Bring ACPICA on-line.
*/
-#ifdef ACPI_DEBUGGER
- if (acpi_dbgr & ACPI_DBGR_ENABLE)
- acpi_osd_debugger();
-#endif
-
#define ACPI_ENABLE_PHASE1 \
(ACPI_NO_HANDLER_INIT | ACPI_NO_EVENT_INIT)
#define ACPI_ENABLE_PHASE2 \
@@ -532,22 +488,12 @@
acpitimer_init(sc);
-#ifdef ACPI_DEBUGGER
- if (acpi_dbgr & ACPI_DBGR_PROBE)
- acpi_osd_debugger();
-#endif
-
/*
* Scan the namespace and build our device tree.
*/
acpi_build_tree(sc);
acpi_sleep_init(sc);
-#ifdef ACPI_DEBUGGER
- if (acpi_dbgr & ACPI_DBGR_RUNNING)
- acpi_osd_debugger();
-#endif
-
#ifdef ACPI_DEBUG
acpi_debug_init();
#endif
@@ -1659,6 +1605,9 @@
return AcpiOsMapMemory(paddr, sizeof(ACPI_TABLE_HEADER));
}
+/*
+ * XXX: Refactor to be a generic function that unmaps tables.
+ */
static void
acpi_unmap_rsdt(ACPI_TABLE_HEADER *rsdt)
{
diff -r 7cb04922ce9c -r 87001f3d50ad sys/dev/acpi/acpi_quirks.c
--- a/sys/dev/acpi/acpi_quirks.c Sun Feb 20 06:09:16 2011 +0000
+++ b/sys/dev/acpi/acpi_quirks.c Sun Feb 20 06:45:32 2011 +0000
@@ -1,4 +1,31 @@
-/* $NetBSD: acpi_quirks.c,v 1.18 2010/09/06 15:54:27 jmcneill Exp $ */
+/* $NetBSD: acpi_quirks.c,v 1.19 2011/02/20 06:45:32 jruoho Exp $ */
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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 2002 Wasabi Systems, Inc.
@@ -37,27 +64,26 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_quirks.c,v 1.18 2010/09/06 15:54:27 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_quirks.c,v 1.19 2011/02/20 06:45:32 jruoho Exp $");
#include "opt_acpi.h"
#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
+#include <dev/acpi/acpireg.h>
#include <dev/acpi/acpivar.h>
+#define _COMPONENT ACPI_UTILITIES
+ACPI_MODULE_NAME ("acpi_quirks")
+
#define AQ_GT 0 /* > */
#define AQ_LT 1 /* < */
#define AQ_GTE 2 /* >= */
#define AQ_LTE 3 /* <= */
#define AQ_EQ 4 /* == */
-static int acpi_rev_cmp(uint32_t, uint32_t, int);
+static int acpi_quirks_revcmp(uint32_t, uint32_t, int);
-/*
Home |
Main Index |
Thread Index |
Old Index