diff options
| author | Mitsuru IWASAKI <iwasaki@FreeBSD.org> | 2002-07-09 17:54:02 +0000 |
|---|---|---|
| committer | Mitsuru IWASAKI <iwasaki@FreeBSD.org> | 2002-07-09 17:54:02 +0000 |
| commit | 98479b041be7f19337ddb26b39a446fe2d0a25bf (patch) | |
| tree | dfd1e75d9d7a42530736716ee1fc7c35f267f753 /sys/dev | |
| parent | 155ce7bfa36f5650520f1fd7343c3b7c3b559a19 (diff) | |
Notes
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/acpica/Osd/OsdTable.c | 71 | ||||
| -rw-r--r-- | sys/dev/acpica/acpi.c | 26 | ||||
| -rw-r--r-- | sys/dev/acpica/acpica_support.c | 45 |
3 files changed, 82 insertions, 60 deletions
diff --git a/sys/dev/acpica/Osd/OsdTable.c b/sys/dev/acpica/Osd/OsdTable.c new file mode 100644 index 0000000000000..a70e73e6b841f --- /dev/null +++ b/sys/dev/acpica/Osd/OsdTable.c @@ -0,0 +1,71 @@ +/*- + * Copyright (c) 2002 Mitsaru Iwasaki + * 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. + * + * $FreeBSD$ + */ + +/* + * ACPI Table interfaces + */ + +#include "acpi.h" + +#include <sys/kernel.h> +#include <sys/linker.h> + +#undef _COMPONENT +#define _COMPONENT ACPI_TABLES + +ACPI_STATUS +AcpiOsTableOverride ( + ACPI_TABLE_HEADER *ExistingTable, + ACPI_TABLE_HEADER **NewTable) +{ + caddr_t acpi_dsdt, p; + + if (NewTable == NULL) + { + return(AE_BAD_PARAMETER); + } + + (*NewTable) = NULL; + + if ((acpi_dsdt = preload_search_by_type("acpi_dsdt")) == NULL) + { + return(AE_OK); + } + + if ((p = preload_search_info(acpi_dsdt, MODINFO_ADDR)) == NULL) + { + return(AE_OK); + } + + (*NewTable) = *(void **)p; + + printf("ACPI: DSDT was overridden.\n"); + + return(AE_OK); +} + diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index eca16b3772e1d..7d24c2b949a1a 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -208,7 +208,6 @@ acpi_identify(driver_t *driver, device_t parent) { device_t child; int error; - caddr_t acpi_dsdt, p; #ifdef ENABLE_DEBUGGER char *debugpoint; #endif @@ -260,17 +259,6 @@ acpi_identify(driver_t *driver, device_t parent) } #endif - if ((acpi_dsdt = preload_search_by_type("acpi_dsdt")) != NULL) { - if ((p = preload_search_info(acpi_dsdt, MODINFO_ADDR)) != NULL) { - if (ACPI_FAILURE(error = AcpiSetDsdtTablePtr(*(void **)p))) { - printf("ACPI: DSDT overriding failed: %s\n", - AcpiFormatException(error)); - } else { - printf("ACPI: DSDT was overridden.\n"); - } - } - } - if (ACPI_FAILURE(error = AcpiLoadTables())) { printf("ACPI: table load failed: %s\n", AcpiFormatException(error)); return_VOID; @@ -1335,8 +1323,8 @@ acpi_SetSleepState(struct acpi_softc *sc, int state) case ACPI_STATE_S2: case ACPI_STATE_S3: case ACPI_STATE_S4: - if (ACPI_FAILURE(status = AcpiHwGetSleepTypeData((UINT8)state, &TypeA, &TypeB))) { - device_printf(sc->acpi_dev, "AcpiHwGetSleepTypeData failed - %s\n", AcpiFormatException(status)); + if (ACPI_FAILURE(status = AcpiGetSleepTypeData((UINT8)state, &TypeA, &TypeB))) { + device_printf(sc->acpi_dev, "AcpiGetSleepTypeData failed - %s\n", AcpiFormatException(status)); break; } @@ -1863,11 +1851,11 @@ static struct debugtag dbg_level[] = { {"ACPI_LV_MUTEX", ACPI_LV_MUTEX}, {"ACPI_LV_INIT", ACPI_LV_INIT}, {"ACPI_LV_ALL", ACPI_LV_ALL}, - {"ACPI_DB_AML_DISASSEMBLE", ACPI_DB_AML_DISASSEMBLE}, - {"ACPI_DB_VERBOSE_INFO", ACPI_DB_VERBOSE_INFO}, - {"ACPI_DB_FULL_TABLES", ACPI_DB_FULL_TABLES}, - {"ACPI_DB_EVENTS", ACPI_DB_EVENTS}, - {"ACPI_DB_VERBOSE", ACPI_DB_VERBOSE}, + {"ACPI_LV_AML_DISASSEMBLE", ACPI_LV_AML_DISASSEMBLE}, + {"ACPI_LV_VERBOSE_INFO", ACPI_LV_VERBOSE_INFO}, + {"ACPI_LV_FULL_TABLES", ACPI_LV_FULL_TABLES}, + {"ACPI_LV_EVENTS", ACPI_LV_EVENTS}, + {"ACPI_LV_VERBOSE", ACPI_LV_VERBOSE}, {NULL, 0} }; diff --git a/sys/dev/acpica/acpica_support.c b/sys/dev/acpica/acpica_support.c index f0ab3a1275522..7dfde3b74c311 100644 --- a/sys/dev/acpica/acpica_support.c +++ b/sys/dev/acpica/acpica_support.c @@ -58,6 +58,7 @@ AcpiEnterSleepStateS4Bios ( { ACPI_OBJECT_LIST ArgList; ACPI_OBJECT Arg; + UINT32 Value; ACPI_FUNCTION_TRACE ("AcpiEnterSleepStateS4Bios"); @@ -77,7 +78,7 @@ AcpiEnterSleepStateS4Bios ( /* clear wake status */ - AcpiHwBitRegisterWrite (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_LOCK); + AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_LOCK); ACPI_DISABLE_IRQS (); @@ -92,8 +93,9 @@ AcpiEnterSleepStateS4Bios ( { AcpiOsStall(1000000); AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, AcpiGbl_FADT->S4BiosReq, 8); + AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &Value, ACPI_MTX_LOCK); } - while (!AcpiHwBitRegisterRead (ACPI_BITREG_WAKE_STATUS, ACPI_MTX_LOCK)); + while (!Value); AcpiHwEnableNonWakeupGpes(); @@ -102,42 +104,3 @@ AcpiEnterSleepStateS4Bios ( return_ACPI_STATUS (AE_OK); } - -#undef _COMPONENT -#define _COMPONENT ACPI_TABLES - -/******************************************************************************* - * - * FUNCTION: AcpiSetDsdtTablePtr - * - * PARAMETERS: TablePtr - pointer to a buffer containing the entire - * DSDT table to override - * - * RETURN: Status - * - * DESCRIPTION: Set DSDT table ptr for DSDT overriding. This function should - * be called perior than AcpiLoadTables(). - * - ******************************************************************************/ - -ACPI_STATUS -AcpiSetDsdtTablePtr( - ACPI_TABLE_HEADER *TablePtr) -{ - ACPI_FUNCTION_TRACE ("AcpiSetDsdtTablePtr"); - - if (!TablePtr) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - if (AcpiGbl_AcpiTables[ACPI_TABLE_DSDT].LoadedIntoNamespace) - { - return_ACPI_STATUS (AE_ALREADY_EXISTS); - } - - AcpiGbl_DSDT = TablePtr; - - return_ACPI_STATUS (AE_OK); -} - |
