summaryrefslogtreecommitdiff
path: root/sys/contrib/dev/acpica/Subsystem/Hardware
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/Subsystem/Hardware')
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Hardware/hwacpi.c446
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Hardware/hwcpu32.c837
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Hardware/hwgpe.c301
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Hardware/hwregs.c1140
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Hardware/hwsleep.c295
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Hardware/hwtimer.c307
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Hardware/hwxface.c737
7 files changed, 0 insertions, 4063 deletions
diff --git a/sys/contrib/dev/acpica/Subsystem/Hardware/hwacpi.c b/sys/contrib/dev/acpica/Subsystem/Hardware/hwacpi.c
deleted file mode 100644
index d8b5f10f4182a..0000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Hardware/hwacpi.c
+++ /dev/null
@@ -1,446 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface
- * $Revision: 36 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 1. Copyright Notice
- *
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
- * All rights reserved.
- *
- * 2. License
- *
- * 2.1. This is your license from Intel Corp. under its intellectual property
- * rights. You may have additional license terms from the party that provided
- * you this software, covering your right to use that party's intellectual
- * property rights.
- *
- * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
- * copy of the source code appearing in this file ("Covered Code") an
- * irrevocable, perpetual, worldwide license under Intel's copyrights in the
- * base code distributed originally by Intel ("Original Intel Code") to copy,
- * make derivatives, distribute, use and display any portion of the Covered
- * Code in any form, with the right to sublicense such rights; and
- *
- * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
- * license (with the right to sublicense), under only those claims of Intel
- * patents that are infringed by the Original Intel Code, to make, use, sell,
- * offer to sell, and import the Covered Code and derivative works thereof
- * solely to the minimum extent necessary to exercise the above copyright
- * license, and in no event shall the patent license extend to any additions
- * to or modifications of the Original Intel Code. No other license or right
- * is granted directly or by implication, estoppel or otherwise;
- *
- * The above copyright and patent license is granted only if the following
- * conditions are met:
- *
- * 3. Conditions
- *
- * 3.1. Redistribution of Source with Rights to Further Distribute Source.
- * Redistribution of source code of any substantial portion of the Covered
- * Code or modification with rights to further distribute source must include
- * the above Copyright Notice, the above License, this list of Conditions,
- * and the following Disclaimer and Export Compliance provision. In addition,
- * Licensee must cause all Covered Code to which Licensee contributes to
- * contain a file documenting the changes Licensee made to create that Covered
- * Code and the date of any change. Licensee must include in that file the
- * documentation of any changes made by any predecessor Licensee. Licensee
- * must include a prominent statement that the modification is derived,
- * directly or indirectly, from Original Intel Code.
- *
- * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
- * Redistribution of source code of any substantial portion of the Covered
- * Code or modification without rights to further distribute source must
- * include the following Disclaimer and Export Compliance provision in the
- * documentation and/or other materials provided with distribution. In
- * addition, Licensee may not authorize further sublicense of source of any
- * portion of the Covered Code, and must include terms to the effect that the
- * license from Licensee to its licensee is limited to the intellectual
- * property embodied in the software Licensee provides to its licensee, and
- * not to intellectual property embodied in modifications its licensee may
- * make.
- *
- * 3.3. Redistribution of Executable. Redistribution in executable form of any
- * substantial portion of the Covered Code or modification must reproduce the
- * above Copyright Notice, and the following Disclaimer and Export Compliance
- * provision in the documentation and/or other materials provided with the
- * distribution.
- *
- * 3.4. Intel retains all right, title, and interest in and to the Original
- * Intel Code.
- *
- * 3.5. Neither the name Intel nor any other trademark owned or controlled by
- * Intel shall be used in advertising or otherwise to promote the sale, use or
- * other dealings in products derived from or relating to the Covered Code
- * without prior written authorization from Intel.
- *
- * 4. Disclaimer and Export Compliance
- *
- * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
- * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
- * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
- * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
- * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
- * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
- * PARTICULAR PURPOSE.
- *
- * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
- * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
- * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
- * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
- * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
- * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
- * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
- * LIMITED REMEDY.
- *
- * 4.3. Licensee shall not export, either directly or indirectly, any of this
- * software or system incorporating such software without first obtaining any
- * required license or other approval from the U. S. Department of Commerce or
- * any other agency or department of the United States Government. In the
- * event Licensee exports any such software from the United States or
- * re-exports any such software from a foreign destination, Licensee shall
- * ensure that the distribution and export/re-export of the software is in
- * compliance with all laws, regulations, orders, or other restrictions of the
- * U.S. Export Administration Regulations. Licensee agrees that neither it nor
- * any of its subsidiaries will export/re-export any technical data, process,
- * software, or service, directly or indirectly, to any country for which the
- * United States government or any agency thereof requires an export license,
- * other governmental approval, or letter of assurance, without first obtaining
- * such license, approval or letter.
- *
- *****************************************************************************/
-
-#define __HWACPI_C__
-
-#include "acpi.h"
-#include "achware.h"
-
-
-#define _COMPONENT HARDWARE
- MODULE_NAME ("hwacpi")
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiHwInitialize
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Initialize and validate various ACPI registers
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiHwInitialize (
- void)
-{
- ACPI_STATUS Status = AE_OK;
- UINT32 Index;
-
-
- FUNCTION_TRACE ("HwInitialize");
-
-
- /* We must have the ACPI tables by the time we get here */
-
- if (!AcpiGbl_FADT)
- {
- AcpiGbl_RestoreAcpiChipset = FALSE;
-
- DEBUG_PRINT (ACPI_ERROR, ("HwInitialize: No FADT!\n"));
-
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
- }
-
- /* Must support *some* mode! */
-/*
- if (!(SystemFlags & SYS_MODES_MASK))
- {
- RestoreAcpiChipset = FALSE;
-
- DEBUG_PRINT (ACPI_ERROR,
- ("CmHardwareInitialize: Supported modes uninitialized!\n"));
- return_ACPI_STATUS (AE_ERROR);
- }
-
-*/
-
-
- switch (AcpiGbl_SystemFlags & SYS_MODES_MASK)
- {
- /* Identify current ACPI/legacy mode */
-
- case (SYS_MODE_ACPI):
-
- AcpiGbl_OriginalMode = SYS_MODE_ACPI;
- DEBUG_PRINT (ACPI_INFO, ("System supports ACPI mode only.\n"));
- break;
-
-
- case (SYS_MODE_LEGACY):
-
- AcpiGbl_OriginalMode = SYS_MODE_LEGACY;
- DEBUG_PRINT (ACPI_INFO,
- ("Tables loaded from buffer, hardware assumed to support LEGACY mode only.\n"));
- break;
-
-
- case (SYS_MODE_ACPI | SYS_MODE_LEGACY):
-
- if (AcpiHwGetMode () == SYS_MODE_ACPI)
- {
- AcpiGbl_OriginalMode = SYS_MODE_ACPI;
- }
- else
- {
- AcpiGbl_OriginalMode = SYS_MODE_LEGACY;
- }
-
- DEBUG_PRINT (ACPI_INFO,
- ("System supports both ACPI and LEGACY modes.\n"));
-
- DEBUG_PRINT (ACPI_INFO,
- ("System is currently in %s mode.\n",
- (AcpiGbl_OriginalMode == SYS_MODE_ACPI) ? "ACPI" : "LEGACY"));
- break;
- }
-
-
- if (AcpiGbl_SystemFlags & SYS_MODE_ACPI)
- {
- /* Target system supports ACPI mode */
-
- /*
- * The purpose of this code is to save the initial state
- * of the ACPI event enable registers. An exit function will be
- * registered which will restore this state when the application
- * exits. The exit function will also clear all of the ACPI event
- * status bits prior to restoring the original mode.
- *
- * The location of the PM1aEvtBlk enable registers is defined as the
- * base of PM1aEvtBlk + DIV_2(PM1aEvtBlkLength). Since the spec further
- * fully defines the PM1aEvtBlk to be a total of 4 bytes, the offset
- * for the enable registers is always 2 from the base. It is hard
- * coded here. If this changes in the spec, this code will need to
- * be modified. The PM1bEvtBlk behaves as expected.
- */
-
- AcpiGbl_Pm1EnableRegisterSave = (UINT16) AcpiHwRegisterRead (ACPI_MTX_LOCK, PM1_EN);
-
-
- /*
- * The GPEs behave similarly, except that the length of the register
- * block is not fixed, so the buffer must be allocated with malloc
- */
-
- if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) &&
- AcpiGbl_FADT->Gpe0BlkLen)
- {
- /* GPE0 specified in FADT */
-
- AcpiGbl_Gpe0EnableRegisterSave =
- AcpiCmAllocate (DIV_2 (AcpiGbl_FADT->Gpe0BlkLen));
- if (!AcpiGbl_Gpe0EnableRegisterSave)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* Save state of GPE0 enable bits */
-
- for (Index = 0; Index < DIV_2 (AcpiGbl_FADT->Gpe0BlkLen); Index++)
- {
- AcpiGbl_Gpe0EnableRegisterSave[Index] =
- (UINT8) AcpiHwRegisterRead (ACPI_MTX_LOCK, GPE0_EN_BLOCK | Index);
- }
- }
-
- else
- {
- AcpiGbl_Gpe0EnableRegisterSave = NULL;
- }
-
- if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) &&
- AcpiGbl_FADT->Gpe1BlkLen)
- {
- /* GPE1 defined */
-
- AcpiGbl_Gpe1EnableRegisterSave =
- AcpiCmAllocate (DIV_2 (AcpiGbl_FADT->Gpe1BlkLen));
- if (!AcpiGbl_Gpe1EnableRegisterSave)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* save state of GPE1 enable bits */
-
- for (Index = 0; Index < DIV_2 (AcpiGbl_FADT->Gpe1BlkLen); Index++)
- {
- AcpiGbl_Gpe1EnableRegisterSave[Index] =
- (UINT8) AcpiHwRegisterRead (ACPI_MTX_LOCK, GPE1_EN_BLOCK | Index);
- }
- }
-
- else
- {
- AcpiGbl_Gpe1EnableRegisterSave = NULL;
- }
- }
-
- return_ACPI_STATUS (Status);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiHwSetMode
- *
- * PARAMETERS: Mode - SYS_MODE_ACPI or SYS_MODE_LEGACY
- *
- * RETURN: Status
- *
- * DESCRIPTION: Transitions the system into the requested mode or does nothing
- * if the system is already in that mode.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiHwSetMode (
- UINT32 Mode)
-{
-
- ACPI_STATUS Status = AE_ERROR;
-
- FUNCTION_TRACE ("HwSetMode");
-
-
- if (Mode == SYS_MODE_ACPI)
- {
- /* BIOS should have disabled ALL fixed and GP events */
-
- AcpiOsOut8 (AcpiGbl_FADT->SmiCmd, AcpiGbl_FADT->AcpiEnable);
- DEBUG_PRINT (ACPI_INFO, ("Attempting to enable ACPI mode\n"));
- }
-
- else if (Mode == SYS_MODE_LEGACY)
- {
- /*
- * BIOS should clear all fixed status bits and restore fixed event
- * enable bits to default
- */
-
- AcpiOsOut8 (AcpiGbl_FADT->SmiCmd, AcpiGbl_FADT->AcpiDisable);
- DEBUG_PRINT (ACPI_INFO,
- ("Attempting to enable Legacy (non-ACPI) mode\n"));
- }
-
- if (AcpiHwGetMode () == Mode)
- {
- DEBUG_PRINT (ACPI_INFO, ("Mode %X successfully enabled\n", Mode));
- Status = AE_OK;
- }
-
- return_ACPI_STATUS (Status);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiHwGetMode
- *
- * PARAMETERS: none
- *
- * RETURN: SYS_MODE_ACPI or SYS_MODE_LEGACY
- *
- * DESCRIPTION: Return current operating state of system. Determined by
- * querying the SCI_EN bit.
- *
- ******************************************************************************/
-
-UINT32
-AcpiHwGetMode (void)
-{
-
- FUNCTION_TRACE ("HwGetMode");
-
-
- if (AcpiHwRegisterBitAccess (ACPI_READ, ACPI_MTX_LOCK, SCI_EN))
- {
- return_VALUE (SYS_MODE_ACPI);
- }
- else
- {
- return_VALUE (SYS_MODE_LEGACY);
- }
-}
-
-/******************************************************************************
- *
- * FUNCTION: AcpiHwGetModeCapabilities
- *
- * PARAMETERS: none
- *
- * RETURN: logical OR of SYS_MODE_ACPI and SYS_MODE_LEGACY determined at initial
- * system state.
- *
- * DESCRIPTION: Returns capablities of system
- *
- ******************************************************************************/
-
-UINT32
-AcpiHwGetModeCapabilities (void)
-{
-
- FUNCTION_TRACE ("HwGetModeCapabilities");
-
-
- if (!(AcpiGbl_SystemFlags & SYS_MODES_MASK))
- {
- if (AcpiHwGetMode () == SYS_MODE_LEGACY)
- {
- /*
- * Assume that if this call is being made, AcpiInit has been called
- * and ACPI support has been established by the presence of the
- * tables. Therefore since we're in SYS_MODE_LEGACY, the system
- * must support both modes
- */
-
- AcpiGbl_SystemFlags |= (SYS_MODE_ACPI | SYS_MODE_LEGACY);
- }
-
- else
- {
- /* TBD: [Investigate] !!! this may be unsafe... */
- /*
- * system is is ACPI mode, so try to switch back to LEGACY to see if
- * it is supported
- */
- AcpiHwSetMode (SYS_MODE_LEGACY);
-
- if (AcpiHwGetMode () == SYS_MODE_LEGACY)
- {
- /* Now in SYS_MODE_LEGACY, so both are supported */
-
- AcpiGbl_SystemFlags |= (SYS_MODE_ACPI | SYS_MODE_LEGACY);
- AcpiHwSetMode (SYS_MODE_ACPI);
- }
-
- else
- {
- /* Still in SYS_MODE_ACPI so this must be an ACPI only system */
-
- AcpiGbl_SystemFlags |= SYS_MODE_ACPI;
- }
- }
- }
-
- return_VALUE (AcpiGbl_SystemFlags & SYS_MODES_MASK);
-}
-
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Hardware/hwcpu32.c b/sys/contrib/dev/acpica/Subsystem/Hardware/hwcpu32.c
deleted file mode 100644
index 8401061621cd1..0000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Hardware/hwcpu32.c
+++ /dev/null
@@ -1,837 +0,0 @@
-/******************************************************************************
- *
- * Name: hwcpu32.c - CPU support for IA32 (Throttling, CxStates)
- * $Revision: 40 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 1. Copyright Notice
- *
- * Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
- * All rights reserved.
- *
- * 2. License
- *
- * 2.1. This is your license from Intel Corp. under its intellectual property
- * rights. You may have additional license terms from the party that provided
- * you this software, covering your right to use that party's intellectual
- * property rights.
- *
- * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
- * copy of the source code appearing in this file ("Covered Code") an
- * irrevocable, perpetual, worldwide license under Intel's copyrights in the
- * base code distributed originally by Intel ("Original Intel Code") to copy,
- * make derivatives, distribute, use and display any portion of the Covered
- * Code in any form, with the right to sublicense such rights; and
- *
- * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
- * license (with the right to sublicense), under only those claims of Intel
- * patents that are infringed by the Original Intel Code, to make, use, sell,
- * offer to sell, and import the Covered Code and derivative works thereof
- * solely to the minimum extent necessary to exercise the above copyright
- * license, and in no event shall the patent license extend to any additions
- * to or modifications of the Original Intel Code. No other license or right
- * is granted directly or by implication, estoppel or otherwise;
- *
- * The above copyright and patent license is granted only if the following
- * conditions are met:
- *
- * 3. Conditions
- *
- * 3.1. Redistribution of Source with Rights to Further Distribute Source.
- * Redistribution of source code of any substantial portion of the Covered
- * Code or modification with rights to further distribute source must include
- * the above Copyright Notice, the above License, this list of Conditions,
- * and the following Disclaimer and Export Compliance provision. In addition,
- * Licensee must cause all Covered Code to which Licensee contributes to
- * contain a file documenting the changes Licensee made to create that Covered
- * Code and the date of any change. Licensee must include in that file the
- * documentation of any changes made by any predecessor Licensee. Licensee
- * must include a prominent statement that the modification is derived,
- * directly or indirectly, from Original Intel Code.
- *
- * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
- * Redistribution of source code of any substantial portion of the Covered
- * Code or modification without rights to further distribute source must
- * include the following Disclaimer and Export Compliance provision in the
- * documentation and/or other materials provided with distribution. In
- * addition, Licensee may not authorize further sublicense of source of any
- * portion of the Covered Code, and must include terms to the effect that the
- * license from Licensee to its licensee is limited to the intellectual
- * property embodied in the software Licensee provides to its licensee, and
- * not to intellectual property embodied in modifications its licensee may
- * make.
- *
- * 3.3. Redistribution of Executable. Redistribution in executable form of any
- * substantial portion of the Covered Code or modification must reproduce the
- * above Copyright Notice, and the following Disclaimer and Export Compliance
- * provision in the documentation and/or other materials provided with the
- * distribution.
- *
- * 3.4. Intel retains all right, title, and interest in and to the Original
- * Intel Code.
- *
- * 3.5. Neither the name Intel nor any other trademark owned or controlled by
- * Intel shall be used in advertising or otherwise to promote the sale, use or
- * other dealings in products derived from or relating to the Covered Code
- * without prior written authorization from Intel.
- *
- * 4. Disclaimer and Export Compliance
- *
- * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
- * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
- * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
- * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
- * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
- * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
- * PARTICULAR PURPOSE.
- *
- * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
- * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
- * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
- * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
- * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
- * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
- * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
- * LIMITED REMEDY.
- *
- * 4.3. Licensee shall not export, either directly or indirectly, any of this
- * software or system incorporating such software without first obtaining any
- * required license or other approval from the U. S. Department of Commerce or
- * any other agency or department of the United States Government. In the
- * event Licensee exports any such software from the United States or
- * re-exports any such software from a foreign destination, Licensee shall
- * ensure that the distribution and export/re-export of the software is in
- * compliance with all laws, regulations, orders, or other restrictions of the
- * U.S. Export Administration Regulations. Licensee agrees that neither it nor
- * any of its subsidiaries will export/re-export any technical data, process,
- * software, or service, directly or indirectly, to any country for which the
- * United States government or any agency thereof requires an export license,
- * other governmental approval, or letter of assurance, without first obtaining
- * such license, approval or letter.
- *
- *****************************************************************************/
-
-#include "acpi.h"
-#include "acnamesp.h"
-#include "achware.h"
-
-#define _COMPONENT HARDWARE
- MODULE_NAME ("Hwcpu32")
-
-
-#define BIT_4 0x10 /* TBD: [investigate] is this correct? */
-
-
-/****************************************************************************
- *
- * FUNCTION: AcpiHwEnterC1
- *
- * PARAMETERS: PblkAddress - Address of the processor control block
- * PmTimerTicks - Number of PM timer ticks elapsed while asleep
- *
- * RETURN: Function status.
- *
- * DESCRIPTION: Set C1 state on IA32 processor (halt)
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiHwEnterC1(
- ACPI_IO_ADDRESS PblkAddress,
- UINT32 *PmTimerTicks)
-{
- UINT32 Timer = 0;
-
-
- if (!PmTimerTicks)
- {
- /*
- * Enter C1:
- * ---------
- */
- enable();
- halt();
- *PmTimerTicks = ACPI_UINT32_MAX;
- }
- else
- {
- Timer = AcpiHwPmtTicks ();
-
- /*
- * Enter C1:
- * ---------
- */
- enable ();
- halt ();
-
- /*
- * Compute Time in C1:
- * -------------------
- */
- Timer = AcpiHwPmtTicks () - Timer;
-
- *PmTimerTicks = Timer;
- }
-
- return (AE_OK);
-}
-
-
-/****************************************************************************
- *
- * FUNCTION: AcpiHwEnterC2
- *
- * PARAMETERS: PblkAddress - Address of the processor control block
- * PmTimerTicks - Number of PM timer ticks elapsed while asleep
- *
- * RETURN: <none>
- *
- * DESCRIPTION: Set C2 state on IA32 processor
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiHwEnterC2(
- ACPI_IO_ADDRESS PblkAddress,
- UINT32 *PmTimerTicks)
-{
- UINT32 Timer = 0;
-
-
- if (!PblkAddress || !PmTimerTicks)
- {
- return (AE_BAD_PARAMETER);
- }
-
- /*
- * Disable interrupts before all C2/C3 transitions.
- */
- disable ();
-
- Timer = AcpiHwPmtTicks ();
-
- /*
- * Enter C2:
- * ---------
- * Read from the P_LVL2 (P_BLK+4) register to invoke a C2 transition.
- */
- AcpiOsIn8 ((ACPI_IO_ADDRESS) (PblkAddress + 4));
-
- /*
- * Perform Dummy Op:
- * -----------------
- * We have to do something useless after reading LVL2 because chipsets
- * cannot guarantee that STPCLK# gets asserted in time to freeze execution.
- */
- AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, PM2_CONTROL);
-
- /*
- * Compute Time in C2:
- * -------------------
- */
- Timer = AcpiHwPmtTicks () - Timer;
-
- *PmTimerTicks = Timer;
-
- /*
- * Re-enable interrupts after coming out of C2/C3.
- */
- enable ();
-
- return (AE_OK);
-}
-
-
-/****************************************************************************
- *
- * FUNCTION: AcpiHwEnterC3
- *
- * PARAMETERS: PblkAddress - Address of the processor control block
- * PmTimerTicks - Number of PM timer ticks elapsed while asleep
- *
- * RETURN: Status of function
- *
- * DESCRIPTION: Set C3 state on IA32 processor (UP only, cache coherency via
- * disabling bus mastering)
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiHwEnterC3(
- ACPI_IO_ADDRESS PblkAddress,
- UINT32 *PmTimerTicks)
-{
- UINT32 Timer = 0;
- UINT32 BusMasterStatus = 0;
-
-
- if (!PblkAddress || !PmTimerTicks)
- {
- return (AE_BAD_PARAMETER);
- }
-
- /*
- * Check the BM_STS bit, if it is set, do not enter C3
- * but clear the bit (with a write) and exit, telling
- * the calling module that we spent zero time in C3.
- * If bus mastering continues, this action should
- * eventually cause a demotion to C2
- */
- if (1 == (BusMasterStatus =
- AcpiHwRegisterBitAccess (ACPI_READ, ACPI_MTX_LOCK, BM_STS)))
- {
- /*
- * Clear the BM_STS bit by setting it.
- */
- AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_LOCK, BM_STS, 1);
- *PmTimerTicks = 0;
- return (AE_OK);
- }
-
- /*
- * Disable interrupts before all C2/C3 transitions.
- */
- disable();
-
- /*
- * Disable Bus Mastering:
- * ----------------------
- * Set the PM2_CNT.ARB_DIS bit (bit #0), preserving all other bits.
- */
- AcpiHwRegisterBitAccess(ACPI_WRITE, ACPI_MTX_LOCK, ARB_DIS, 1);
-
- /*
- * Get the timer base before entering C state
- */
- Timer = AcpiHwPmtTicks ();
-
- /*
- * Enter C3:
- * ---------
- * Read from the P_LVL3 (P_BLK+5) register to invoke a C3 transition.
- */
- AcpiOsIn8 ((ACPI_IO_ADDRESS)(PblkAddress + 5));
-
- /*
- * Perform Dummy Op:
- * -----------------
- * We have to do something useless after reading LVL3 because chipsets
- * cannot guarantee that STPCLK# gets asserted in time to freeze execution.
- */
- AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, PM2_CONTROL);
- /*
- * Immediately compute the time in the C state
- */
- Timer = AcpiHwPmtTicks() - Timer;
-
- /*
- * Re-Enable Bus Mastering:
- * ------------------------
- * Clear the PM2_CNT.ARB_DIS bit (bit #0), preserving all other bits.
- */
- AcpiHwRegisterBitAccess(ACPI_WRITE, ACPI_MTX_LOCK, ARB_DIS, 0);
-
- /* TBD: [Unhandled]: Support 24-bit timers (this algorithm assumes 32-bit) */
-
- *PmTimerTicks = Timer;
-
- /*
- * Re-enable interrupts after coming out of C2/C3.
- */
- enable();
-
- return (AE_OK);
-}
-
-
-/****************************************************************************
- *
- * FUNCTION: AcpiHwEnterCx
- *
- * PARAMETERS: ProcessorHandle - handle of the processor
- *
- * RETURN: Status of function
- *
- * DESCRIPTION: Invoke the currently active processor Cx handler to put this
- * processor to sleep.
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiHwEnterCx (
- ACPI_IO_ADDRESS PblkAddress,
- UINT32 *PmTimerTicks)
-{
-
- if (!AcpiHwCxHandlers[AcpiHwActiveCxState])
- {
- return (AE_SUPPORT);
- }
-
- return (AcpiHwCxHandlers[AcpiHwActiveCxState] (PblkAddress, PmTimerTicks));
-}
-
-
-/****************************************************************************
- *
- * FUNCTION: AcpiHwSetCx
- *
- * PARAMETERS: State - value (1-3) of the Cx state to 'make active'
- *
- * RETURN: Function status.
- *
- * DESCRIPTION: Sets the state to use during calls to AcpiHwEnterCx().
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiHwSetCx (
- UINT32 CxState)
-{
- /*
- * Supported State?
- * ----------------
- */
- if ((CxState < 1) || (CxState > 3))
- {
- return (AE_BAD_PARAMETER);
- }
-
- if (!AcpiHwCxHandlers[CxState])
- {
- return (AE_SUPPORT);
- }
-
- /*
- * New Cx State?
- * -------------
- * We only care when moving from one state to another...
- */
- if (AcpiHwActiveCxState == CxState)
- {
- return (AE_OK);
- }
-
- /*
- * Prepare to Use New State:
- * -------------------------
- * If the new CxState is C3, the BM_RLD bit must be set to allow
- * the generation of a bus master requets to cause the processor
- * in the C3 state to transition to the C0 state.
- */
- switch (CxState)
- {
- case 3:
- AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_LOCK, BM_RLD, 1);
- break;
- }
-
- /*
- * Clean up from Old State:
- * ------------------------
- * If the old CxState was C3, the BM_RLD bit is reset. When the
- * bit is reset, the generation of a bus master request does not
- * effect any processor in the C3 state.
- */
- switch (AcpiHwActiveCxState)
- {
- case 3:
- AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_LOCK, BM_RLD, 0);
- break;
- }
-
- /*
- * Enable:
- * -------
- */
- AcpiHwActiveCxState = CxState;
-
- return (AE_OK);
-}
-
-
-/****************************************************************************
- *
- * FUNCTION: AcpiHwGetCxInfo
- *
- * PARAMETERS: CxStates - Information (latencies) on all Cx states
- *
- * RETURN: Status of function
- *
- * DESCRIPTION: This function is called both to initialize Cx handling
- * and retrieve the current Cx information (latency values).
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiHwGetCxInfo (
- UINT32 CxStates[])
-{
- BOOLEAN SMP_system = FALSE;
-
-
- FUNCTION_TRACE("HwGetCxInfo");
-
-
- if (!CxStates)
- {
- return_ACPI_STATUS(AE_BAD_PARAMETER);
- }
-
- /*
- * TBD: [Unhandled] need to init SMP_system using info from the MAPIC
- * table.
- */
-
- /*
- * Set Defaults:
- * -------------
- * C0 and C1 support is implied (but what about that PROC_C1 register
- * in the FADT?!?!). Set C2/C3 to max. latency (not supported until
- * proven otherwise).
- */
- CxStates[0] = 0;
- CxStates[1] = 0;
- CxStates[2] = MAX_CX_STATE_LATENCY;
- CxStates[3] = MAX_CX_STATE_LATENCY;
-
- /*
- * C2 Supported?
- * -------------
- * We're only supporting C2 when the latency is <= 100 microseconds,
- * and on SMP systems when P_LVL2_UP (which indicates C2 only on UP)
- * is not set.
- */
- if (AcpiGbl_FADT->Plvl2Lat <= 100)
- {
- if (!SMP_system)
- {
- AcpiHwCxHandlers[2] = AcpiHwEnterC2;
- CxStates[2] = AcpiGbl_FADT->Plvl2Lat;
- }
-
- else if (!AcpiGbl_FADT->Plvl2Up)
- {
- AcpiHwCxHandlers[2] = AcpiHwEnterC2;
- CxStates[2] = AcpiGbl_FADT->Plvl2Lat;
- }
- }
-
- /*
- * C3 Supported?
- * -------------
- * We're only supporting C3 on UP systems when the latency is
- * <= 1000 microseconds and that include the ability to disable
- * Bus Mastering while in C3 (ARB_DIS) but allows Bus Mastering
- * requests to wake the system from C3 (BM_RLD). Note his method
- * of maintaining cache coherency (disabling of bus mastering)
- * cannot be used on SMP systems, and flushing caches (e.g. WBINVD)
- * is simply too costly (at this time).
- */
- if (AcpiGbl_FADT->Plvl3Lat <= 1000)
- {
- if (!SMP_system && (AcpiGbl_FADT->XPm2CntBlk.Address &&
- AcpiGbl_FADT->Pm2CntLen))
- {
- AcpiHwCxHandlers[3] = AcpiHwEnterC3;
- CxStates[3] = AcpiGbl_FADT->Plvl3Lat;
- }
- }
-
- return_ACPI_STATUS(AE_OK);
-}
-
-
-/****************************************************************************
- *
- * FUNCTION: AcpiHwGetCxHandler
- *
- * PARAMETERS: State - the Cx state
- * Handler - pointer to location for the returned handler
- *
- * RETURN: Status of function
- *
- * DESCRIPTION: This function is called to get an installed Cx state handler.
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiHwGetCxHandler (
- UINT32 CxState,
- ACPI_C_STATE_HANDLER *Handler)
-{
- FUNCTION_TRACE ("HwGetCxHandler");
-
-
- if ((CxState == 0) || (CxState >= MAX_CX_STATES) || !Handler)
- {
- return_ACPI_STATUS(AE_BAD_PARAMETER);
- }
-
- *Handler = AcpiHwCxHandlers[CxState];
-
- return_ACPI_STATUS(AE_OK);
-}
-
-
-/****************************************************************************
- *
- * FUNCTION: AcpiHwSetCxHandler
- *
- * PARAMETERS: CxState - the Cx state
- * Handler - new Cx state handler
- *
- * RETURN: Status of function
- *
- * DESCRIPTION: This function is called to install a new Cx state handler.
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiHwSetCxHandler (
- UINT32 CxState,
- ACPI_C_STATE_HANDLER Handler)
-{
- FUNCTION_TRACE ("HwSetCxHandler");
-
-
- if ((CxState == 0) || (CxState >= MAX_CX_STATES) || !Handler)
- {
- return_ACPI_STATUS(AE_BAD_PARAMETER);
- }
-
- AcpiHwCxHandlers[CxState] = Handler;
-
- return_ACPI_STATUS(AE_OK);
-}
-
-
-/**************************************************************************
- *
- * FUNCTION: AcpiHwLocalPow
- *
- * PARAMETERS: x,y operands
- *
- * RETURN: result
- *
- * DESCRIPTION: Compute x ^ y
- *
- *************************************************************************/
-
-NATIVE_UINT
-AcpiHwLocalPow (
- NATIVE_UINT x,
- NATIVE_UINT y)
-{
- NATIVE_UINT i;
- NATIVE_UINT Result = 1;
-
-
- for (i = 0; i < y; i++)
- {
- Result = Result * x;
- }
-
- return (Result);
-}
-
-
-/**************************************************************************
- *
- * FUNCTION: AcpiHwEnableThrottling
- *
- * PARAMETERS: PblkAddress - Address of Pcnt (Processor Control)
- * register
- *
- * RETURN: none
- *
- * DESCRIPTION: Enable throttling by setting the THT_EN bit.
- *
- *************************************************************************/
-
-void
-AcpiHwEnableThrottling (
- ACPI_IO_ADDRESS PblkAddress)
-{
- UINT32 PblkValue;
-
-
- FUNCTION_TRACE ("EnableThrottling");
-
-
- PblkValue = AcpiOsIn32 (PblkAddress);
- PblkValue = PblkValue | BIT_4;
- AcpiOsOut32 (PblkAddress, PblkValue);
-
- return_VOID;
-}
-
-
-/**************************************************************************
- *
- * FUNCTION: AcpiHwDisableThrottling
- *
- * PARAMETERS: PblkAddress - Address of Pcnt (Processor Control)
- * register
- *
- * RETURN: none
- *
- * DESCRIPTION:Disable throttling by clearing the THT_EN bit
- *
- *************************************************************************/
-
-void
-AcpiHwDisableThrottling (
- ACPI_IO_ADDRESS PblkAddress)
-{
- UINT32 PblkValue;
-
-
- FUNCTION_TRACE ("DisableThrottling");
-
-
- PblkValue = AcpiOsIn32 (PblkAddress);
- PblkValue = PblkValue & (~(UINT32)BIT_4);
- AcpiOsOut32 (PblkAddress, PblkValue);
-
- return_VOID;
-}
-
-
-/**************************************************************************
- *
- * FUNCTION: AcpiHwGetDutyCycle
- *
- * PARAMETERS: DutyOffset Pcnt register duty cycle field offset
- * PblkAddress Pcnt register address in chipset
- * NumThrottleStates # of CPU throttle states this system
- * supports
- *
- * RETURN: none
- *
- * DESCRIPTION: Get the duty cycle from the chipset
- *
- *************************************************************************/
-
-UINT32
-AcpiHwGetDutyCycle (
- UINT8 DutyOffset,
- ACPI_IO_ADDRESS PblkAddress,
- UINT32 NumThrottleStates)
-{
- NATIVE_UINT Index;
- UINT32 Duty32Value;
- UINT32 PcntMaskOffDutyField;
-
-
- FUNCTION_TRACE ("GetDutyCycle");
-
-
- /*
- * Use NumThrottleStates - 1 as mask [ex. 8 - 1 = 7 (Fh)]
- * and then shift it into the right position
- */
- PcntMaskOffDutyField = NumThrottleStates - 1;
-
- /*
- * Read in the current value from the port
- */
- Duty32Value = AcpiOsIn32 ((ACPI_IO_ADDRESS) PblkAddress);
-
- /*
- * Shift the the value to LSB
- */
- for (Index = 0; Index < (NATIVE_UINT) DutyOffset; Index++)
- {
- Duty32Value = Duty32Value >> 1;
- }
-
- /*
- * Get the duty field only
- */
- Duty32Value = Duty32Value & PcntMaskOffDutyField;
-
- return_VALUE ((UINT32) Duty32Value);
-}
-
-
-/**************************************************************************
- *
- * FUNCTION: AcpiHwProgramDutyCycle
- *
- * PARAMETERS: DutyOffset Pcnt register duty cycle field offset
- * DutyCycle duty cycle to program into chipset
- * PblkAddress Pcnt register address in chipset
- * NumThrottleStates # of CPU throttle states this system
- * supports
- *
- * RETURN: none
- *
- * DESCRIPTION: Program chipset with specified duty cycle by bit-shifting the
- * duty cycle bits to the appropriate offset, reading the duty
- * cycle register, OR-ing in the duty cycle, and writing it to
- * the Pcnt register.
- *
- *************************************************************************/
-
-void
-AcpiHwProgramDutyCycle (
- UINT8 DutyOffset,
- UINT32 DutyCycle,
- ACPI_IO_ADDRESS PblkAddress,
- UINT32 NumThrottleStates)
-{
- NATIVE_UINT Index;
- UINT32 Duty32Value;
- UINT32 PcntMaskOffDutyField;
- UINT32 PortValue;
-
-
- FUNCTION_TRACE ("HwProgramDutyCycle");
-
-
- /*
- * valid DutyCycle passed
- */
- Duty32Value = DutyCycle;
-
- /*
- * use NumThrottleStates - 1 as mask [ex. 8 - 1 = 7 (Fh)]
- * and then shift it into the right position
- */
- PcntMaskOffDutyField = NumThrottleStates - 1;
-
- /*
- * Shift the mask
- */
- for (Index = 0; Index < (NATIVE_UINT) DutyOffset; Index++)
- {
- PcntMaskOffDutyField = PcntMaskOffDutyField << 1;
- Duty32Value = Duty32Value << 1;
- }
-
- /*
- * Read in the current value from the port
- */
- PortValue = AcpiOsIn32 ((ACPI_IO_ADDRESS) PblkAddress);
-
- /*
- * Mask off the duty field so we don't OR in junk!
- */
- PortValue = PortValue & (~PcntMaskOffDutyField);
-
- /*
- * OR in the bits we want to write out to the port
- */
- PortValue = (PortValue | Duty32Value) & (~(UINT32)BIT_4);
-
- /*
- * write it to the port
- */
- AcpiOsOut32 ((ACPI_IO_ADDRESS) PblkAddress, PortValue);
-
- return_VOID;
-}
diff --git a/sys/contrib/dev/acpica/Subsystem/Hardware/hwgpe.c b/sys/contrib/dev/acpica/Subsystem/Hardware/hwgpe.c
deleted file mode 100644
index 52851fa9fb45a..0000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Hardware/hwgpe.c
+++ /dev/null
@@ -1,301 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: hwgpe - Low level GPE enable/disable/clear functions
- * $Revision: 28 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 1. Copyright Notice
- *
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
- * All rights reserved.
- *
- * 2. License
- *
- * 2.1. This is your license from Intel Corp. under its intellectual property
- * rights. You may have additional license terms from the party that provided
- * you this software, covering your right to use that party's intellectual
- * property rights.
- *
- * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
- * copy of the source code appearing in this file ("Covered Code") an
- * irrevocable, perpetual, worldwide license under Intel's copyrights in the
- * base code distributed originally by Intel ("Original Intel Code") to copy,
- * make derivatives, distribute, use and display any portion of the Covered
- * Code in any form, with the right to sublicense such rights; and
- *
- * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
- * license (with the right to sublicense), under only those claims of Intel
- * patents that are infringed by the Original Intel Code, to make, use, sell,
- * offer to sell, and import the Covered Code and derivative works thereof
- * solely to the minimum extent necessary to exercise the above copyright
- * license, and in no event shall the patent license extend to any additions
- * to or modifications of the Original Intel Code. No other license or right
- * is granted directly or by implication, estoppel or otherwise;
- *
- * The above copyright and patent license is granted only if the following
- * conditions are met:
- *
- * 3. Conditions
- *
- * 3.1. Redistribution of Source with Rights to Further Distribute Source.
- * Redistribution of source code of any substantial portion of the Covered
- * Code or modification with rights to further distribute source must include
- * the above Copyright Notice, the above License, this list of Conditions,
- * and the following Disclaimer and Export Compliance provision. In addition,
- * Licensee must cause all Covered Code to which Licensee contributes to
- * contain a file documenting the changes Licensee made to create that Covered
- * Code and the date of any change. Licensee must include in that file the
- * documentation of any changes made by any predecessor Licensee. Licensee
- * must include a prominent statement that the modification is derived,
- * directly or indirectly, from Original Intel Code.
- *
- * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
- * Redistribution of source code of any substantial portion of the Covered
- * Code or modification without rights to further distribute source must
- * include the following Disclaimer and Export Compliance provision in the
- * documentation and/or other materials provided with distribution. In
- * addition, Licensee may not authorize further sublicense of source of any
- * portion of the Covered Code, and must include terms to the effect that the
- * license from Licensee to its licensee is limited to the intellectual
- * property embodied in the software Licensee provides to its licensee, and
- * not to intellectual property embodied in modifications its licensee may
- * make.
- *
- * 3.3. Redistribution of Executable. Redistribution in executable form of any
- * substantial portion of the Covered Code or modification must reproduce the
- * above Copyright Notice, and the following Disclaimer and Export Compliance
- * provision in the documentation and/or other materials provided with the
- * distribution.
- *
- * 3.4. Intel retains all right, title, and interest in and to the Original
- * Intel Code.
- *
- * 3.5. Neither the name Intel nor any other trademark owned or controlled by
- * Intel shall be used in advertising or otherwise to promote the sale, use or
- * other dealings in products derived from or relating to the Covered Code
- * without prior written authorization from Intel.
- *
- * 4. Disclaimer and Export Compliance
- *
- * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
- * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
- * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
- * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
- * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
- * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
- * PARTICULAR PURPOSE.
- *
- * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
- * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
- * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
- * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
- * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
- * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
- * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
- * LIMITED REMEDY.
- *
- * 4.3. Licensee shall not export, either directly or indirectly, any of this
- * software or system incorporating such software without first obtaining any
- * required license or other approval from the U. S. Department of Commerce or
- * any other agency or department of the United States Government. In the
- * event Licensee exports any such software from the United States or
- * re-exports any such software from a foreign destination, Licensee shall
- * ensure that the distribution and export/re-export of the software is in
- * compliance with all laws, regulations, orders, or other restrictions of the
- * U.S. Export Administration Regulations. Licensee agrees that neither it nor
- * any of its subsidiaries will export/re-export any technical data, process,
- * software, or service, directly or indirectly, to any country for which the
- * United States government or any agency thereof requires an export license,
- * other governmental approval, or letter of assurance, without first obtaining
- * such license, approval or letter.
- *
- *****************************************************************************/
-
-#include "acpi.h"
-#include "achware.h"
-#include "acnamesp.h"
-#include "acevents.h"
-
-#define _COMPONENT HARDWARE
- MODULE_NAME ("hwgpe")
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiHwEnableGpe
- *
- * PARAMETERS: GpeNumber - The GPE
- *
- * RETURN: None
- *
- * DESCRIPTION: Enable a single GPE.
- *
- ******************************************************************************/
-
-void
-AcpiHwEnableGpe (
- UINT32 GpeNumber)
-{
- UINT8 InByte;
- UINT32 RegisterIndex;
- UINT8 BitMask;
-
- /*
- * Translate GPE number to index into global registers array.
- */
- RegisterIndex = AcpiGbl_GpeValid[GpeNumber];
-
- /*
- * Figure out the bit offset for this GPE within the target register.
- */
- BitMask = AcpiGbl_DecodeTo8bit [MOD_8 (GpeNumber)];
-
- /*
- * Read the current value of the register, set the appropriate bit
- * to enable the GPE, and write out the new register.
- */
- InByte = AcpiOsIn8 (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr);
- AcpiOsOut8 (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr,
- (UINT8)(InByte | BitMask));
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiHwDisableGpe
- *
- * PARAMETERS: GpeNumber - The GPE
- *
- * RETURN: None
- *
- * DESCRIPTION: Disable a single GPE.
- *
- ******************************************************************************/
-
-void
-AcpiHwDisableGpe (
- UINT32 GpeNumber)
-{
- UINT8 InByte;
- UINT32 RegisterIndex;
- UINT8 BitMask;
-
- /*
- * Translate GPE number to index into global registers array.
- */
- RegisterIndex = AcpiGbl_GpeValid[GpeNumber];
-
- /*
- * Figure out the bit offset for this GPE within the target register.
- */
- BitMask = AcpiGbl_DecodeTo8bit [MOD_8 (GpeNumber)];
-
- /*
- * Read the current value of the register, clear the appropriate bit,
- * and write out the new register value to disable the GPE.
- */
- InByte = AcpiOsIn8 (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr);
- AcpiOsOut8 (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr,
- (UINT8)(InByte & ~BitMask));
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiHwClearGpe
- *
- * PARAMETERS: GpeNumber - The GPE
- *
- * RETURN: None
- *
- * DESCRIPTION: Clear a single GPE.
- *
- ******************************************************************************/
-
-void
-AcpiHwClearGpe (
- UINT32 GpeNumber)
-{
- UINT32 RegisterIndex;
- UINT8 BitMask;
-
- /*
- * Translate GPE number to index into global registers array.
- */
- RegisterIndex = AcpiGbl_GpeValid[GpeNumber];
-
- /*
- * Figure out the bit offset for this GPE within the target register.
- */
- BitMask = AcpiGbl_DecodeTo8bit [MOD_8 (GpeNumber)];
-
- /*
- * Write a one to the appropriate bit in the status register to
- * clear this GPE.
- */
- AcpiOsOut8 (AcpiGbl_GpeRegisters[RegisterIndex].StatusAddr, BitMask);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiHwGetGpeStatus
- *
- * PARAMETERS: GpeNumber - The GPE
- *
- * RETURN: None
- *
- * DESCRIPTION: Return the status of a single GPE.
- *
- ******************************************************************************/
-
-void
-AcpiHwGetGpeStatus (
- UINT32 GpeNumber,
- ACPI_EVENT_STATUS *EventStatus)
-{
- UINT8 InByte = 0;
- UINT32 RegisterIndex = 0;
- UINT8 BitMask = 0;
-
- if (!EventStatus)
- {
- return;
- }
-
- (*EventStatus) = 0;
-
- /*
- * Translate GPE number to index into global registers array.
- */
- RegisterIndex = AcpiGbl_GpeValid[GpeNumber];
-
- /*
- * Figure out the bit offset for this GPE within the target register.
- */
- BitMask = AcpiGbl_DecodeTo8bit [MOD_8 (GpeNumber)];
-
- /*
- * Enabled?:
- */
- InByte = AcpiOsIn8 (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr);
-
- if (BitMask & InByte)
- {
- (*EventStatus) |= ACPI_EVENT_FLAG_ENABLED;
- }
-
- /*
- * Set?
- */
- InByte = AcpiOsIn8 (AcpiGbl_GpeRegisters[RegisterIndex].StatusAddr);
-
- if (BitMask & InByte)
- {
- (*EventStatus) |= ACPI_EVENT_FLAG_SET;
- }
-}
diff --git a/sys/contrib/dev/acpica/Subsystem/Hardware/hwregs.c b/sys/contrib/dev/acpica/Subsystem/Hardware/hwregs.c
deleted file mode 100644
index 1c47c67d6d9cb..0000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Hardware/hwregs.c
+++ /dev/null
@@ -1,1140 +0,0 @@
-
-/*******************************************************************************
- *
- * Module Name: hwregs - Read/write access functions for the various ACPI
- * control and status registers.
- * $Revision: 88 $
- *
- ******************************************************************************/
-
-/******************************************************************************
- *
- * 1. Copyright Notice
- *
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
- * All rights reserved.
- *
- * 2. License
- *
- * 2.1. This is your license from Intel Corp. under its intellectual property
- * rights. You may have additional license terms from the party that provided
- * you this software, covering your right to use that party's intellectual
- * property rights.
- *
- * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
- * copy of the source code appearing in this file ("Covered Code") an
- * irrevocable, perpetual, worldwide license under Intel's copyrights in the
- * base code distributed originally by Intel ("Original Intel Code") to copy,
- * make derivatives, distribute, use and display any portion of the Covered
- * Code in any form, with the right to sublicense such rights; and
- *
- * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
- * license (with the right to sublicense), under only those claims of Intel
- * patents that are infringed by the Original Intel Code, to make, use, sell,
- * offer to sell, and import the Covered Code and derivative works thereof
- * solely to the minimum extent necessary to exercise the above copyright
- * license, and in no event shall the patent license extend to any additions
- * to or modifications of the Original Intel Code. No other license or right
- * is granted directly or by implication, estoppel or otherwise;
- *
- * The above copyright and patent license is granted only if the following
- * conditions are met:
- *
- * 3. Conditions
- *
- * 3.1. Redistribution of Source with Rights to Further Distribute Source.
- * Redistribution of source code of any substantial portion of the Covered
- * Code or modification with rights to further distribute source must include
- * the above Copyright Notice, the above License, this list of Conditions,
- * and the following Disclaimer and Export Compliance provision. In addition,
- * Licensee must cause all Covered Code to which Licensee contributes to
- * contain a file documenting the changes Licensee made to create that Covered
- * Code and the date of any change. Licensee must include in that file the
- * documentation of any changes made by any predecessor Licensee. Licensee
- * must include a prominent statement that the modification is derived,
- * directly or indirectly, from Original Intel Code.
- *
- * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
- * Redistribution of source code of any substantial portion of the Covered
- * Code or modification without rights to further distribute source must
- * include the following Disclaimer and Export Compliance provision in the
- * documentation and/or other materials provided with distribution. In
- * addition, Licensee may not authorize further sublicense of source of any
- * portion of the Covered Code, and must include terms to the effect that the
- * license from Licensee to its licensee is limited to the intellectual
- * property embodied in the software Licensee provides to its licensee, and
- * not to intellectual property embodied in modifications its licensee may
- * make.
- *
- * 3.3. Redistribution of Executable. Redistribution in executable form of any
- * substantial portion of the Covered Code or modification must reproduce the
- * above Copyright Notice, and the following Disclaimer and Export Compliance
- * provision in the documentation and/or other materials provided with the
- * distribution.
- *
- * 3.4. Intel retains all right, title, and interest in and to the Original
- * Intel Code.
- *
- * 3.5. Neither the name Intel nor any other trademark owned or controlled by
- * Intel shall be used in advertising or otherwise to promote the sale, use or
- * other dealings in products derived from or relating to the Covered Code
- * without prior written authorization from Intel.
- *
- * 4. Disclaimer and Export Compliance
- *
- * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
- * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
- * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
- * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
- * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
- * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
- * PARTICULAR PURPOSE.
- *
- * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
- * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
- * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
- * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
- * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
- * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
- * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
- * LIMITED REMEDY.
- *
- * 4.3. Licensee shall not export, either directly or indirectly, any of this
- * software or system incorporating such software without first obtaining any
- * required license or other approval from the U. S. Department of Commerce or
- * any other agency or department of the United States Government. In the
- * event Licensee exports any such software from the United States or
- * re-exports any such software from a foreign destination, Licensee shall
- * ensure that the distribution and export/re-export of the software is in
- * compliance with all laws, regulations, orders, or other restrictions of the
- * U.S. Export Administration Regulations. Licensee agrees that neither it nor
- * any of its subsidiaries will export/re-export any technical data, process,
- * software, or service, directly or indirectly, to any country for which the
- * United States government or any agency thereof requires an export license,
- * other governmental approval, or letter of assurance, without first obtaining
- * such license, approval or letter.
- *
- *****************************************************************************/
-
-#define __HWREGS_C__
-
-#include "acpi.h"
-#include "achware.h"
-#include "acnamesp.h"
-
-#define _COMPONENT HARDWARE
- MODULE_NAME ("hwregs")
-
-
-/* This matches the #defines in actypes.h. */
-
-NATIVE_CHAR *SleepStateTable[] = {"\\_S0_","\\_S1_","\\_S2_","\\_S3_",
- "\\_S4_","\\_S5_","\\_S4B"};
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiHwGetBitShift
- *
- * PARAMETERS: Mask - Input mask to determine bit shift from.
- * Must have at least 1 bit set.
- *
- * RETURN: Bit location of the lsb of the mask
- *
- * DESCRIPTION: Returns the bit number for the low order bit that's set.
- *
- ******************************************************************************/
-
-UINT32
-AcpiHwGetBitShift (
- UINT32 Mask)
-{
- UINT32 Shift;
-
-
- FUNCTION_TRACE ("HwGetBitShift");
-
-
- for (Shift = 0; ((Mask >> Shift) & 1) == 0; Shift++)
- { ; }
-
- return_VALUE (Shift);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiHwClearAcpiStatus
- *
- * PARAMETERS: none
- *
- * RETURN: none
- *
- * DESCRIPTION: Clears all fixed and general purpose status bits
- *
- ******************************************************************************/
-
-void
-AcpiHwClearAcpiStatus (void)
-{
- UINT16 GpeLength;
- UINT16 Index;
-
-
- FUNCTION_TRACE ("HwClearAcpiStatus");
-
-
- DEBUG_PRINT (TRACE_IO, ("About to write %04X to %04X\n",
- ALL_FIXED_STS_BITS,
- (UINT16) ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm1aEvtBlk.Address)));
-
-
- AcpiCmAcquireMutex (ACPI_MTX_HARDWARE);
-
- AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, PM1_STS, ALL_FIXED_STS_BITS);
-
-
- if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1bEvtBlk.Address))
- {
- AcpiOsOut16 ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm1bEvtBlk.Address),
- (UINT16) ALL_FIXED_STS_BITS);
- }
-
- /* now clear the GPE Bits */
-
- if (AcpiGbl_FADT->Gpe0BlkLen)
- {
- GpeLength = (UINT16) DIV_2 (AcpiGbl_FADT->Gpe0BlkLen);
-
- for (Index = 0; Index < GpeLength; Index++)
- {
- AcpiOsOut8 ((ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) + Index),
- (UINT8) 0xff);
- }
- }
-
- if (AcpiGbl_FADT->Gpe1BlkLen)
- {
- GpeLength = (UINT16) DIV_2 (AcpiGbl_FADT->Gpe1BlkLen);
-
- for (Index = 0; Index < GpeLength; Index++)
- {
- AcpiOsOut8 ((ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) + Index),
- (UINT8) 0xff);
- }
- }
-
- AcpiCmReleaseMutex (ACPI_MTX_HARDWARE);
- return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiHwObtainSleepTypeRegisterData
- *
- * PARAMETERS: SleepState - Numeric state requested
- * *Slp_TypA - Pointer to byte to receive SLP_TYPa value
- * *Slp_TypB - Pointer to byte to receive SLP_TYPb value
- *
- * RETURN: Status - ACPI status
- *
- * DESCRIPTION: AcpiHwObtainSleepTypeRegisterData() obtains the SLP_TYP and
- * SLP_TYPb values for the sleep state requested.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiHwObtainSleepTypeRegisterData (
- UINT8 SleepState,
- UINT8 *Slp_TypA,
- UINT8 *Slp_TypB)
-{
- ACPI_STATUS Status = AE_OK;
- ACPI_OPERAND_OBJECT *ObjDesc;
-
-
- FUNCTION_TRACE ("HwObtainSleepTypeRegisterData");
-
-
- /*
- * Validate parameters
- */
-
- if ((SleepState > ACPI_S_STATES_MAX) ||
- !Slp_TypA || !Slp_TypB)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- /*
- * AcpiEvaluate the namespace object containing the values for this state
- */
-
- Status = AcpiNsEvaluateByName (SleepStateTable[SleepState], NULL, &ObjDesc);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- if (!ObjDesc)
- {
- REPORT_ERROR (("Missing Sleep State object\n"));
- return_ACPI_STATUS (AE_NOT_EXIST);
- }
-
- /*
- * We got something, now ensure it is correct. The object must
- * be a package and must have at least 2 numeric values as the
- * two elements
- */
-
- Status = AcpiCmResolvePackageReferences(ObjDesc);
-
- if (ObjDesc->Package.Count < 2)
- {
- /* Must have at least two elements */
-
- REPORT_ERROR (("Sleep State package does not have at least two elements\n"));
- Status = AE_ERROR;
- }
-
- else if (((ObjDesc->Package.Elements[0])->Common.Type !=
- ACPI_TYPE_INTEGER) ||
- ((ObjDesc->Package.Elements[1])->Common.Type !=
- ACPI_TYPE_INTEGER))
- {
- /* Must have two */
-
- REPORT_ERROR (("Sleep State package elements are not both of type Number\n"));
- Status = AE_ERROR;
- }
-
- else
- {
- /*
- * Valid _Sx_ package size, type, and value
- */
- *Slp_TypA = (UINT8) (ObjDesc->Package.Elements[0])->Integer.Value;
-
- *Slp_TypB = (UINT8) (ObjDesc->Package.Elements[1])->Integer.Value;
- }
-
-
- if (ACPI_FAILURE (Status))
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("SleepTypeRegisterData: Bad Sleep object %p type %X\n",
- ObjDesc, ObjDesc->Common.Type));
- }
-
- AcpiCmRemoveReference (ObjDesc);
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiHwRegisterBitAccess
- *
- * PARAMETERS: ReadWrite - Either ACPI_READ or ACPI_WRITE.
- * UseLock - Lock the hardware
- * RegisterId - index of ACPI Register to access
- * Value - (only used on write) value to write to the
- * Register. Shifted all the way right.
- *
- * RETURN: Value written to or read from specified Register. This value
- * is shifted all the way right.
- *
- * DESCRIPTION: Generic ACPI Register read/write function.
- *
- ******************************************************************************/
-
-UINT32
-AcpiHwRegisterBitAccess (
- NATIVE_UINT ReadWrite,
- BOOLEAN UseLock,
- UINT32 RegisterId,
- ...) /* Value (only used on write) */
-{
- UINT32 RegisterValue = 0;
- UINT32 Mask = 0;
- UINT32 Value = 0;
-
- FUNCTION_TRACE ("HwRegisterBitAccess");
-
-
- if (ReadWrite == ACPI_WRITE)
- {
- va_list marker;
-
- va_start (marker, RegisterId);
- Value = va_arg (marker, UINT32);
- va_end (marker);
- }
-
- if (ACPI_MTX_LOCK == UseLock) {
- AcpiCmAcquireMutex (ACPI_MTX_HARDWARE);
- }
-
- /*
- * Decode the Register ID
- * Register id = Register block id | bit id
- *
- * Check bit id to fine locate Register offset.
- * check Mask to determine Register offset, and then read-write.
- */
-
- switch (REGISTER_BLOCK_ID(RegisterId))
- {
- case PM1_STS:
-
- switch (RegisterId)
- {
- case TMR_STS:
- Mask = TMR_STS_MASK;
- break;
-
- case BM_STS:
- Mask = BM_STS_MASK;
- break;
-
- case GBL_STS:
- Mask = GBL_STS_MASK;
- break;
-
- case PWRBTN_STS:
- Mask = PWRBTN_STS_MASK;
- break;
-
- case SLPBTN_STS:
- Mask = SLPBTN_STS_MASK;
- break;
-
- case RTC_STS:
- Mask = RTC_STS_MASK;
- break;
-
- case WAK_STS:
- Mask = WAK_STS_MASK;
- break;
-
- default:
- Mask = 0;
- break;
- }
-
- RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, PM1_STS);
-
- if (ReadWrite == ACPI_WRITE)
- {
- /*
- * Status Registers are different from the rest. Clear by
- * writing 1, writing 0 has no effect. So, the only relevent
- * information is the single bit we're interested in, all
- * others should be written as 0 so they will be left
- * unchanged
- */
-
- Value <<= AcpiHwGetBitShift (Mask);
- Value &= Mask;
-
- if (Value)
- {
- AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, PM1_STS, (UINT16) Value);
-
- RegisterValue = 0;
- }
- }
-
- break;
-
-
- case PM1_EN:
-
- switch (RegisterId)
- {
- case TMR_EN:
- Mask = TMR_EN_MASK;
- break;
-
- case GBL_EN:
- Mask = GBL_EN_MASK;
- break;
-
- case PWRBTN_EN:
- Mask = PWRBTN_EN_MASK;
- break;
-
- case SLPBTN_EN:
- Mask = SLPBTN_EN_MASK;
- break;
-
- case RTC_EN:
- Mask = RTC_EN_MASK;
- break;
-
- default:
- Mask = 0;
- break;
- }
-
- RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, PM1_EN);
-
- if (ReadWrite == ACPI_WRITE)
- {
- RegisterValue &= ~Mask;
- Value <<= AcpiHwGetBitShift (Mask);
- Value &= Mask;
- RegisterValue |= Value;
-
- AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, PM1_EN, (UINT16) RegisterValue);
- }
-
- break;
-
-
- case PM1_CONTROL:
-
- switch (RegisterId)
- {
- case SCI_EN:
- Mask = SCI_EN_MASK;
- break;
-
- case BM_RLD:
- Mask = BM_RLD_MASK;
- break;
-
- case GBL_RLS:
- Mask = GBL_RLS_MASK;
- break;
-
- case SLP_TYPE_A:
- case SLP_TYPE_B:
- Mask = SLP_TYPE_X_MASK;
- break;
-
- case SLP_EN:
- Mask = SLP_EN_MASK;
- break;
-
- default:
- Mask = 0;
- break;
- }
-
-
- /*
- * Read the PM1 Control register.
- * Note that at this level, the fact that there are actually TWO
- * registers (A and B) and that B may not exist, are abstracted.
- */
- RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, PM1_CONTROL);
-
- DEBUG_PRINT (TRACE_IO, ("PM1 control: Read %X\n", RegisterValue));
-
- if (ReadWrite == ACPI_WRITE)
- {
- RegisterValue &= ~Mask;
- Value <<= AcpiHwGetBitShift (Mask);
- Value &= Mask;
- RegisterValue |= Value;
-
- /*
- * SLP_TYPE_x Registers are written differently
- * than any other control Registers with
- * respect to A and B Registers. The value
- * for A may be different than the value for B
- *
- * Therefore, pass the RegisterId, not just generic PM1_CONTROL,
- * because we need to do different things. Yuck.
- */
-
- AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
- RegisterId, (UINT16) RegisterValue);
- }
- break;
-
-
- case PM2_CONTROL:
-
- switch (RegisterId)
- {
- case ARB_DIS:
- Mask = ARB_DIS_MASK;
- break;
-
- default:
- Mask = 0;
- break;
- }
-
- RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, PM2_CONTROL);
-
- DEBUG_PRINT (TRACE_IO, ("PM2 control: Read %X from %p\n",
- RegisterValue, ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address)));
-
- if (ReadWrite == ACPI_WRITE)
- {
- RegisterValue &= ~Mask;
- Value <<= AcpiHwGetBitShift (Mask);
- Value &= Mask;
- RegisterValue |= Value;
-
- DEBUG_PRINT (TRACE_IO,
- ("About to write %04X to %p\n", RegisterValue,
- AcpiGbl_FADT->XPm2CntBlk.Address));
-
- AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
- PM2_CONTROL, (UINT8) (RegisterValue));
- }
- break;
-
-
- case PM_TIMER:
-
- Mask = TMR_VAL_MASK;
- RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK,
- PM_TIMER);
- DEBUG_PRINT (TRACE_IO, ("PM_TIMER: Read %X from %p\n",
- RegisterValue, ACPI_GET_ADDRESS (AcpiGbl_FADT->XPmTmrBlk.Address)));
-
- break;
-
-
- case GPE1_EN_BLOCK:
- case GPE1_STS_BLOCK:
- case GPE0_EN_BLOCK:
- case GPE0_STS_BLOCK:
-
- /* Determine the bit to be accessed
- *
- * (UINT32) RegisterId:
- * 31 24 16 8 0
- * +--------+--------+--------+--------+
- * | gpe_block_id | gpe_bit_number |
- * +--------+--------+--------+--------+
- *
- * gpe_block_id is one of GPE[01]_EN_BLOCK and GPE[01]_STS_BLOCK
- * gpe_bit_number is relative from the gpe_block (0x00~0xFF)
- */
-
- Mask = REGISTER_BIT_ID(RegisterId); /* gpe_bit_number */
- RegisterId = REGISTER_BLOCK_ID(RegisterId) | (Mask >> 3);
- Mask = AcpiGbl_DecodeTo8bit [Mask % 8];
-
- /*
- * The base address of the GPE 0 Register Block
- * Plus 1/2 the length of the GPE 0 Register Block
- * The enable Register is the Register following the Status Register
- * and each Register is defined as 1/2 of the total Register Block
- */
-
- /*
- * This sets the bit within EnableBit that needs to be written to
- * the Register indicated in Mask to a 1, all others are 0
- */
-
- /* Now get the current Enable Bits in the selected Reg */
-
- RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, RegisterId);
- DEBUG_PRINT (TRACE_IO, ("GPE Enable bits: Read %X from %X\n",
- RegisterValue, RegisterId));
-
- if (ReadWrite == ACPI_WRITE)
- {
- RegisterValue &= ~Mask;
- Value <<= AcpiHwGetBitShift (Mask);
- Value &= Mask;
- RegisterValue |= Value;
-
- /* This write will put the Action state into the General Purpose */
- /* Enable Register indexed by the value in Mask */
-
- DEBUG_PRINT (TRACE_IO, ("About to write %04X to %04X\n",
- RegisterValue, RegisterId));
- AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
- RegisterId, (UINT8) RegisterValue);
- RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, RegisterId);
- }
- break;
-
-
- case SMI_CMD_BLOCK:
- case PROCESSOR_BLOCK:
- /* not used */
- default:
-
- Mask = 0;
- break;
- }
-
- if (ACPI_MTX_LOCK == UseLock) {
- AcpiCmReleaseMutex (ACPI_MTX_HARDWARE);
- }
-
-
- RegisterValue &= Mask;
- RegisterValue >>= AcpiHwGetBitShift (Mask);
-
- DEBUG_PRINT (TRACE_IO, ("Register I/O: returning %X\n", RegisterValue));
- return_VALUE (RegisterValue);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiHwRegisterRead
- *
- * PARAMETERS: UseLock - Mutex hw access.
- * RegisterId - RegisterID + Offset.
- *
- * RETURN: Value read or written.
- *
- * DESCRIPTION: Acpi register read function. Registers are read at the
- * given offset.
- *
- ******************************************************************************/
-
-UINT32
-AcpiHwRegisterRead (
- BOOLEAN UseLock,
- UINT32 RegisterId)
-{
- UINT32 Value = 0;
- UINT32 BankOffset;
-
- FUNCTION_TRACE ("AcpiHwRegisterRead");
-
- if (ACPI_MTX_LOCK == UseLock)
- {
- AcpiCmAcquireMutex (ACPI_MTX_HARDWARE);
- }
-
-
- switch (REGISTER_BLOCK_ID(RegisterId))
- {
- case PM1_STS: /* 16-bit access */
-
- Value = AcpiHwLowLevelRead (16, &AcpiGbl_FADT->XPm1aEvtBlk, 0);
- Value |= AcpiHwLowLevelRead (16, &AcpiGbl_FADT->XPm1bEvtBlk, 0);
- break;
-
-
- case PM1_EN: /* 16-bit access*/
-
- BankOffset = DIV_2 (AcpiGbl_FADT->Pm1EvtLen);
- Value = AcpiHwLowLevelRead (16, &AcpiGbl_FADT->XPm1aEvtBlk, BankOffset);
- Value |= AcpiHwLowLevelRead (16, &AcpiGbl_FADT->XPm1bEvtBlk, BankOffset);
- break;
-
-
- case PM1_CONTROL: /* 16-bit access */
-
- Value = AcpiHwLowLevelRead (16, &AcpiGbl_FADT->XPm1aCntBlk, 0);
- Value |= AcpiHwLowLevelRead (16, &AcpiGbl_FADT->XPm1bCntBlk, 0);
- break;
-
-
- case PM2_CONTROL: /* 8-bit access */
-
- Value = AcpiHwLowLevelRead (8, &AcpiGbl_FADT->XPm2CntBlk, 0);
- break;
-
-
- case PM_TIMER: /* 32-bit access */
-
- Value = AcpiHwLowLevelRead (32, &AcpiGbl_FADT->XPmTmrBlk, 0);
- break;
-
-
- case GPE0_STS_BLOCK: /* 8-bit access */
-
- Value = AcpiHwLowLevelRead (8, &AcpiGbl_FADT->XGpe0Blk, 0);
- break;
-
-
- case GPE0_EN_BLOCK: /* 8-bit access */
-
- BankOffset = DIV_2 (AcpiGbl_FADT->Gpe0BlkLen);
- Value = AcpiHwLowLevelRead (8, &AcpiGbl_FADT->XGpe0Blk, BankOffset);
- break;
-
-
- case GPE1_STS_BLOCK: /* 8-bit access */
-
- Value = AcpiHwLowLevelRead (8, &AcpiGbl_FADT->XGpe1Blk, 0);
- break;
-
-
- case GPE1_EN_BLOCK: /* 8-bit access */
-
- BankOffset = DIV_2 (AcpiGbl_FADT->Gpe1BlkLen);
- Value = AcpiHwLowLevelRead (8, &AcpiGbl_FADT->XGpe1Blk, BankOffset);
- break;
-
-
- case SMI_CMD_BLOCK: /* 8bit */
-
- Value = (UINT32) AcpiOsIn8 (AcpiGbl_FADT->SmiCmd);
- break;
-
-
- default:
- Value = 0;
- break;
- }
-
-
- if (ACPI_MTX_LOCK == UseLock)
- {
- AcpiCmReleaseMutex (ACPI_MTX_HARDWARE);
- }
-
- return_VALUE (Value);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiHwRegisterWrite
- *
- * PARAMETERS: UseLock - Mutex hw access.
- * RegisterId - RegisterID + Offset.
- *
- * RETURN: Value read or written.
- *
- * DESCRIPTION: Acpi register Write function. Registers are written at the
- * given offset.
- *
- ******************************************************************************/
-
-void
-AcpiHwRegisterWrite (
- BOOLEAN UseLock,
- UINT32 RegisterId,
- UINT32 Value)
-{
- UINT32 BankOffset;
-
- FUNCTION_TRACE ("AcpiHwRegisterWrite");
-
-
- if (ACPI_MTX_LOCK == UseLock)
- {
- AcpiCmAcquireMutex (ACPI_MTX_HARDWARE);
- }
-
-
- switch (REGISTER_BLOCK_ID (RegisterId))
- {
- case PM1_STS: /* 16-bit access */
-
- AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aEvtBlk, 0);
- AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bEvtBlk, 0);
- break;
-
-
- case PM1_EN: /* 16-bit access*/
-
- BankOffset = DIV_2 (AcpiGbl_FADT->Pm1EvtLen);
- AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aEvtBlk, BankOffset);
- AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bEvtBlk, BankOffset);
- break;
-
-
- case PM1_CONTROL: /* 16-bit access */
-
- AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aCntBlk, 0);
- AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bCntBlk, 0);
- break;
-
-
- case PM1A_CONTROL: /* 16-bit access */
-
- AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aCntBlk, 0);
- break;
-
-
- case PM1B_CONTROL: /* 16-bit access */
-
- AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bCntBlk, 0);
- break;
-
-
- case PM2_CONTROL: /* 8-bit access */
-
- AcpiHwLowLevelWrite (8, Value, &AcpiGbl_FADT->XPm2CntBlk, 0);
- break;
-
-
- case PM_TIMER: /* 32-bit access */
-
- AcpiHwLowLevelWrite (32, Value, &AcpiGbl_FADT->XPmTmrBlk, 0);
- break;
-
-
- case GPE0_STS_BLOCK: /* 8-bit access */
-
- AcpiHwLowLevelWrite (8, Value, &AcpiGbl_FADT->XGpe0Blk, 0);
- break;
-
-
- case GPE0_EN_BLOCK: /* 8-bit access */
-
- BankOffset = DIV_2 (AcpiGbl_FADT->Gpe0BlkLen);
- AcpiHwLowLevelWrite (8, Value, &AcpiGbl_FADT->XGpe0Blk, BankOffset);
- break;
-
-
- case GPE1_STS_BLOCK: /* 8-bit access */
-
- AcpiHwLowLevelWrite (8, Value, &AcpiGbl_FADT->XGpe1Blk, 0);
- break;
-
-
- case GPE1_EN_BLOCK: /* 8-bit access */
-
- BankOffset = DIV_2 (AcpiGbl_FADT->Gpe1BlkLen);
- AcpiHwLowLevelWrite (8, Value, &AcpiGbl_FADT->XGpe1Blk, BankOffset);
- break;
-
-
- case SMI_CMD_BLOCK: /* 8bit */
-
- /* For 2.0, SMI_CMD is always in IO space */
- /* TBD: what about 1.0? 0.71? */
-
- AcpiOsOut8 (AcpiGbl_FADT->SmiCmd, (UINT8) Value);
- break;
-
-
- default:
- Value = 0;
- break;
- }
-
-
- if (ACPI_MTX_LOCK == UseLock)
- {
- AcpiCmReleaseMutex (ACPI_MTX_HARDWARE);
- }
-
- return_VOID;
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiHwLowLevelRead
- *
- * PARAMETERS: Register - GAS register structure
- * Offset - Offset from the base address in the GAS
- * Width - 8, 16, or 32
- *
- * RETURN: Value read
- *
- * DESCRIPTION: Read from either memory, IO, or PCI config space.
- *
- ******************************************************************************/
-
-UINT32
-AcpiHwLowLevelRead (
- UINT32 Width,
- ACPI_GAS *Reg,
- UINT32 Offset)
-{
- UINT32 Value = 0;
- ACPI_PHYSICAL_ADDRESS MemAddress;
- ACPI_IO_ADDRESS IoAddress;
- UINT32 PciRegister;
- UINT32 PciDevFunc;
-
-
- /*
- * Must have a valid pointer to a GAS structure, and
- * a non-zero address within
- */
- if ((!Reg) ||
- (!ACPI_VALID_ADDRESS (Reg->Address)))
- {
- return 0;
- }
-
-
- /*
- * Three address spaces supported:
- * Memory, Io, or PCI config.
- */
-
- switch (Reg->AddressSpaceId)
- {
- case ADDRESS_SPACE_SYSTEM_MEMORY:
-
- MemAddress = (ACPI_PHYSICAL_ADDRESS) (ACPI_GET_ADDRESS (Reg->Address) + Offset);
-
- switch (Width)
- {
- case 8:
- Value = AcpiOsMemIn8 (MemAddress);
- break;
- case 16:
- Value = AcpiOsMemIn16 (MemAddress);
- break;
- case 32:
- Value = AcpiOsMemIn32 (MemAddress);
- break;
- }
- break;
-
-
- case ADDRESS_SPACE_SYSTEM_IO:
-
- IoAddress = (ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (Reg->Address) + Offset);
-
- switch (Width)
- {
- case 8:
- Value = AcpiOsIn8 (IoAddress);
- break;
- case 16:
- Value = AcpiOsIn16 (IoAddress);
- break;
- case 32:
- Value = AcpiOsIn32 (IoAddress);
- break;
- }
- break;
-
-
- case ADDRESS_SPACE_PCI_CONFIG:
-
- PciDevFunc = ACPI_PCI_DEVFUN (ACPI_GET_ADDRESS (Reg->Address));
- PciRegister = ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (Reg->Address)) + Offset;
-
- switch (Width)
- {
- case 8:
- AcpiOsReadPciCfgByte (0, PciDevFunc, PciRegister, (UINT8 *) &Value);
- break;
- case 16:
- AcpiOsReadPciCfgWord (0, PciDevFunc, PciRegister, (UINT16 *) &Value);
- break;
- case 32:
- AcpiOsReadPciCfgDword (0, PciDevFunc, PciRegister, (UINT32 *) &Value);
- break;
- }
- break;
- }
-
- return Value;
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiHwLowLevelWrite
- *
- * PARAMETERS: Width - 8, 16, or 32
- * Value - To be written
- * Register - GAS register structure
- * Offset - Offset from the base address in the GAS
- *
- *
- * RETURN: Value read
- *
- * DESCRIPTION: Read from either memory, IO, or PCI config space.
- *
- ******************************************************************************/
-
-void
-AcpiHwLowLevelWrite (
- UINT32 Width,
- UINT32 Value,
- ACPI_GAS *Reg,
- UINT32 Offset)
-{
- ACPI_PHYSICAL_ADDRESS MemAddress;
- ACPI_IO_ADDRESS IoAddress;
- UINT32 PciRegister;
- UINT32 PciDevFunc;
-
-
- /*
- * Must have a valid pointer to a GAS structure, and
- * a non-zero address within
- */
- if ((!Reg) ||
- (!ACPI_VALID_ADDRESS (Reg->Address)))
- {
- return;
- }
-
-
- /*
- * Three address spaces supported:
- * Memory, Io, or PCI config.
- */
-
- switch (Reg->AddressSpaceId)
- {
- case ADDRESS_SPACE_SYSTEM_MEMORY:
-
- MemAddress = (ACPI_PHYSICAL_ADDRESS) (ACPI_GET_ADDRESS (Reg->Address) + Offset);
-
- switch (Width)
- {
- case 8:
- AcpiOsMemOut8 (MemAddress, (UINT8) Value);
- break;
- case 16:
- AcpiOsMemOut16 (MemAddress, (UINT16) Value);
- break;
- case 32:
- AcpiOsMemOut32 (MemAddress, (UINT32) Value);
- break;
- }
- break;
-
-
- case ADDRESS_SPACE_SYSTEM_IO:
-
- IoAddress = (ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (Reg->Address) + Offset);
-
- switch (Width)
- {
- case 8:
- AcpiOsOut8 (IoAddress, (UINT8) Value);
- break;
- case 16:
- AcpiOsOut16 (IoAddress, (UINT16) Value);
- break;
- case 32:
- AcpiOsOut32 (IoAddress, (UINT32) Value);
- break;
- }
- break;
-
-
- case ADDRESS_SPACE_PCI_CONFIG:
-
- PciDevFunc = ACPI_PCI_DEVFUN (ACPI_GET_ADDRESS (Reg->Address));
- PciRegister = ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (Reg->Address)) + Offset;
-
- switch (Width)
- {
- case 8:
- AcpiOsWritePciCfgByte (0, PciDevFunc, PciRegister, (UINT8) Value);
- break;
- case 16:
- AcpiOsWritePciCfgWord (0, PciDevFunc, PciRegister, (UINT16) Value);
- break;
- case 32:
- AcpiOsWritePciCfgDword (0, PciDevFunc, PciRegister, (UINT32) Value);
- break;
- }
- break;
- }
-}
diff --git a/sys/contrib/dev/acpica/Subsystem/Hardware/hwsleep.c b/sys/contrib/dev/acpica/Subsystem/Hardware/hwsleep.c
deleted file mode 100644
index ba7b341e74d23..0000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Hardware/hwsleep.c
+++ /dev/null
@@ -1,295 +0,0 @@
-
-/******************************************************************************
- *
- * Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
- * $Revision: 7 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 1. Copyright Notice
- *
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
- * All rights reserved.
- *
- * 2. License
- *
- * 2.1. This is your license from Intel Corp. under its intellectual property
- * rights. You may have additional license terms from the party that provided
- * you this software, covering your right to use that party's intellectual
- * property rights.
- *
- * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
- * copy of the source code appearing in this file ("Covered Code") an
- * irrevocable, perpetual, worldwide license under Intel's copyrights in the
- * base code distributed originally by Intel ("Original Intel Code") to copy,
- * make derivatives, distribute, use and display any portion of the Covered
- * Code in any form, with the right to sublicense such rights; and
- *
- * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
- * license (with the right to sublicense), under only those claims of Intel
- * patents that are infringed by the Original Intel Code, to make, use, sell,
- * offer to sell, and import the Covered Code and derivative works thereof
- * solely to the minimum extent necessary to exercise the above copyright
- * license, and in no event shall the patent license extend to any additions
- * to or modifications of the Original Intel Code. No other license or right
- * is granted directly or by implication, estoppel or otherwise;
- *
- * The above copyright and patent license is granted only if the following
- * conditions are met:
- *
- * 3. Conditions
- *
- * 3.1. Redistribution of Source with Rights to Further Distribute Source.
- * Redistribution of source code of any substantial portion of the Covered
- * Code or modification with rights to further distribute source must include
- * the above Copyright Notice, the above License, this list of Conditions,
- * and the following Disclaimer and Export Compliance provision. In addition,
- * Licensee must cause all Covered Code to which Licensee contributes to
- * contain a file documenting the changes Licensee made to create that Covered
- * Code and the date of any change. Licensee must include in that file the
- * documentation of any changes made by any predecessor Licensee. Licensee
- * must include a prominent statement that the modification is derived,
- * directly or indirectly, from Original Intel Code.
- *
- * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
- * Redistribution of source code of any substantial portion of the Covered
- * Code or modification without rights to further distribute source must
- * include the following Disclaimer and Export Compliance provision in the
- * documentation and/or other materials provided with distribution. In
- * addition, Licensee may not authorize further sublicense of source of any
- * portion of the Covered Code, and must include terms to the effect that the
- * license from Licensee to its licensee is limited to the intellectual
- * property embodied in the software Licensee provides to its licensee, and
- * not to intellectual property embodied in modifications its licensee may
- * make.
- *
- * 3.3. Redistribution of Executable. Redistribution in executable form of any
- * substantial portion of the Covered Code or modification must reproduce the
- * above Copyright Notice, and the following Disclaimer and Export Compliance
- * provision in the documentation and/or other materials provided with the
- * distribution.
- *
- * 3.4. Intel retains all right, title, and interest in and to the Original
- * Intel Code.
- *
- * 3.5. Neither the name Intel nor any other trademark owned or controlled by
- * Intel shall be used in advertising or otherwise to promote the sale, use or
- * other dealings in products derived from or relating to the Covered Code
- * without prior written authorization from Intel.
- *
- * 4. Disclaimer and Export Compliance
- *
- * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
- * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
- * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
- * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
- * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
- * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
- * PARTICULAR PURPOSE.
- *
- * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
- * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
- * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
- * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
- * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
- * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
- * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
- * LIMITED REMEDY.
- *
- * 4.3. Licensee shall not export, either directly or indirectly, any of this
- * software or system incorporating such software without first obtaining any
- * required license or other approval from the U. S. Department of Commerce or
- * any other agency or department of the United States Government. In the
- * event Licensee exports any such software from the United States or
- * re-exports any such software from a foreign destination, Licensee shall
- * ensure that the distribution and export/re-export of the software is in
- * compliance with all laws, regulations, orders, or other restrictions of the
- * U.S. Export Administration Regulations. Licensee agrees that neither it nor
- * any of its subsidiaries will export/re-export any technical data, process,
- * software, or service, directly or indirectly, to any country for which the
- * United States government or any agency thereof requires an export license,
- * other governmental approval, or letter of assurance, without first obtaining
- * such license, approval or letter.
- *
- *****************************************************************************/
-
-#include "acpi.h"
-#include "acnamesp.h"
-#include "achware.h"
-
-#define _COMPONENT HARDWARE
- MODULE_NAME ("hwsleep")
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiSetFirmwareWakingVector
- *
- * PARAMETERS: PhysicalAddress - Physical address of ACPI real mode
- * entry point.
- *
- * RETURN: AE_OK or AE_ERROR
- *
- * DESCRIPTION: Access function for dFirmwareWakingVector field in FACS
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiSetFirmwareWakingVector (
- ACPI_PHYSICAL_ADDRESS PhysicalAddress)
-{
-
- FUNCTION_TRACE ("AcpiSetFirmwareWakingVector");
-
-
- /* Make sure that we have an FACS */
-
- if (!AcpiGbl_FACS)
- {
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
- }
-
- /* Set the vector */
-
- if (AcpiGbl_FACS->VectorWidth == 32)
- {
- * (UINT32 *) AcpiGbl_FACS->FirmwareWakingVector = (UINT32) PhysicalAddress;
- }
- else
- {
- *AcpiGbl_FACS->FirmwareWakingVector = PhysicalAddress;
- }
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiGetFirmwareWakingVector
- *
- * PARAMETERS: *PhysicalAddress - Output buffer where contents of
- * the FirmwareWakingVector field of
- * the FACS will be stored.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Access function for dFirmwareWakingVector field in FACS
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiGetFirmwareWakingVector (
- ACPI_PHYSICAL_ADDRESS *PhysicalAddress)
-{
-
- FUNCTION_TRACE ("AcpiGetFirmwareWakingVector");
-
-
- if (!PhysicalAddress)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- /* Make sure that we have an FACS */
-
- if (!AcpiGbl_FACS)
- {
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
- }
-
- /* Get the vector */
-
- if (AcpiGbl_FACS->VectorWidth == 32)
- {
- *PhysicalAddress = * (UINT32 *) AcpiGbl_FACS->FirmwareWakingVector;
- }
- else
- {
- *PhysicalAddress = *AcpiGbl_FACS->FirmwareWakingVector;
- }
-
- return_ACPI_STATUS (AE_OK);
-}
-
-/******************************************************************************
- *
- * FUNCTION: AcpiEnterSleepState
- *
- * PARAMETERS: SleepState - Which sleep state to enter
- *
- * RETURN: Status
- *
- * DESCRIPTION: Enter a system sleep state (see ACPI 2.0 spec p 231)
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiEnterSleepState (
- UINT8 SleepState)
-{
- ACPI_STATUS Status;
- ACPI_OBJECT_LIST ArgList;
- ACPI_OBJECT Arg;
- UINT8 TypeA;
- UINT8 TypeB;
- UINT16 PM1AControl;
- UINT16 PM1BControl;
-
- FUNCTION_TRACE ("AcpiEnterSleepState");
-
- /*
- * _PSW methods could be run here to enable wake-on keyboard, LAN, etc.
- */
-
- Status = AcpiHwObtainSleepTypeRegisterData(SleepState, &TypeA, &TypeB);
-
- if (!ACPI_SUCCESS(Status))
- {
- return Status;
- }
-
- /* run the _PTS and _GTS methods */
- MEMSET(&ArgList, 0, sizeof(ArgList));
- ArgList.Count = 1;
- ArgList.Pointer = &Arg;
-
- MEMSET(&Arg, 0, sizeof(Arg));
- Arg.Type = ACPI_TYPE_INTEGER;
- Arg.Integer.Value = SleepState;
-
- AcpiEvaluateObject(NULL, "\\_PTS", &ArgList, NULL);
- AcpiEvaluateObject(NULL, "\\_GTS", &ArgList, NULL);
-
- /* clear wake status */
- AcpiHwRegisterBitAccess(ACPI_WRITE, ACPI_MTX_LOCK, WAK_STS, 1);
-
- PM1AControl = (UINT16) AcpiHwRegisterRead(ACPI_MTX_LOCK, PM1_CONTROL);
-
- /* mask off SLP_EN and SLP_TYP fields */
- PM1AControl &= 0xC3FF;
-
- /* mask in SLP_EN */
- PM1AControl |= (1 << AcpiHwGetBitShift (SLP_EN_MASK));
-
- PM1BControl = PM1AControl;
-
- /* mask in SLP_TYP */
- PM1AControl |= (TypeA << AcpiHwGetBitShift (SLP_TYPE_X_MASK));
- PM1BControl |= (TypeB << AcpiHwGetBitShift (SLP_TYPE_X_MASK));
-
- DEBUG_PRINT(ACPI_OK, ("Entering S%d\n", SleepState));
-
- disable();
-
- AcpiHwRegisterWrite(ACPI_MTX_LOCK, PM1A_CONTROL, PM1AControl);
- AcpiHwRegisterWrite(ACPI_MTX_LOCK, PM1B_CONTROL, PM1BControl);
- AcpiHwRegisterWrite(ACPI_MTX_LOCK, PM1_CONTROL,
- (1 << AcpiHwGetBitShift (SLP_EN_MASK)));
-
- enable();
-
- return_ACPI_STATUS (AE_OK);
-}
diff --git a/sys/contrib/dev/acpica/Subsystem/Hardware/hwtimer.c b/sys/contrib/dev/acpica/Subsystem/Hardware/hwtimer.c
deleted file mode 100644
index 52139ed6a25b4..0000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Hardware/hwtimer.c
+++ /dev/null
@@ -1,307 +0,0 @@
-
-/******************************************************************************
- *
- * Name: hwtimer.c - ACPI Power Management Timer Interface
- * $Revision: 5 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 1. Copyright Notice
- *
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
- * All rights reserved.
- *
- * 2. License
- *
- * 2.1. This is your license from Intel Corp. under its intellectual property
- * rights. You may have additional license terms from the party that provided
- * you this software, covering your right to use that party's intellectual
- * property rights.
- *
- * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
- * copy of the source code appearing in this file ("Covered Code") an
- * irrevocable, perpetual, worldwide license under Intel's copyrights in the
- * base code distributed originally by Intel ("Original Intel Code") to copy,
- * make derivatives, distribute, use and display any portion of the Covered
- * Code in any form, with the right to sublicense such rights; and
- *
- * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
- * license (with the right to sublicense), under only those claims of Intel
- * patents that are infringed by the Original Intel Code, to make, use, sell,
- * offer to sell, and import the Covered Code and derivative works thereof
- * solely to the minimum extent necessary to exercise the above copyright
- * license, and in no event shall the patent license extend to any additions
- * to or modifications of the Original Intel Code. No other license or right
- * is granted directly or by implication, estoppel or otherwise;
- *
- * The above copyright and patent license is granted only if the following
- * conditions are met:
- *
- * 3. Conditions
- *
- * 3.1. Redistribution of Source with Rights to Further Distribute Source.
- * Redistribution of source code of any substantial portion of the Covered
- * Code or modification with rights to further distribute source must include
- * the above Copyright Notice, the above License, this list of Conditions,
- * and the following Disclaimer and Export Compliance provision. In addition,
- * Licensee must cause all Covered Code to which Licensee contributes to
- * contain a file documenting the changes Licensee made to create that Covered
- * Code and the date of any change. Licensee must include in that file the
- * documentation of any changes made by any predecessor Licensee. Licensee
- * must include a prominent statement that the modification is derived,
- * directly or indirectly, from Original Intel Code.
- *
- * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
- * Redistribution of source code of any substantial portion of the Covered
- * Code or modification without rights to further distribute source must
- * include the following Disclaimer and Export Compliance provision in the
- * documentation and/or other materials provided with distribution. In
- * addition, Licensee may not authorize further sublicense of source of any
- * portion of the Covered Code, and must include terms to the effect that the
- * license from Licensee to its licensee is limited to the intellectual
- * property embodied in the software Licensee provides to its licensee, and
- * not to intellectual property embodied in modifications its licensee may
- * make.
- *
- * 3.3. Redistribution of Executable. Redistribution in executable form of any
- * substantial portion of the Covered Code or modification must reproduce the
- * above Copyright Notice, and the following Disclaimer and Export Compliance
- * provision in the documentation and/or other materials provided with the
- * distribution.
- *
- * 3.4. Intel retains all right, title, and interest in and to the Original
- * Intel Code.
- *
- * 3.5. Neither the name Intel nor any other trademark owned or controlled by
- * Intel shall be used in advertising or otherwise to promote the sale, use or
- * other dealings in products derived from or relating to the Covered Code
- * without prior written authorization from Intel.
- *
- * 4. Disclaimer and Export Compliance
- *
- * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
- * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
- * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
- * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
- * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
- * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
- * PARTICULAR PURPOSE.
- *
- * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
- * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
- * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
- * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
- * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
- * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
- * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
- * LIMITED REMEDY.
- *
- * 4.3. Licensee shall not export, either directly or indirectly, any of this
- * software or system incorporating such software without first obtaining any
- * required license or other approval from the U. S. Department of Commerce or
- * any other agency or department of the United States Government. In the
- * event Licensee exports any such software from the United States or
- * re-exports any such software from a foreign destination, Licensee shall
- * ensure that the distribution and export/re-export of the software is in
- * compliance with all laws, regulations, orders, or other restrictions of the
- * U.S. Export Administration Regulations. Licensee agrees that neither it nor
- * any of its subsidiaries will export/re-export any technical data, process,
- * software, or service, directly or indirectly, to any country for which the
- * United States government or any agency thereof requires an export license,
- * other governmental approval, or letter of assurance, without first obtaining
- * such license, approval or letter.
- *
- *****************************************************************************/
-
-#include "acpi.h"
-#include "achware.h"
-
-#define _COMPONENT HARDWARE
- MODULE_NAME ("hwtimer")
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiGetTimerResolution
- *
- * PARAMETERS: none
- *
- * RETURN: Number of bits of resolution in the PM Timer (24 or 32).
- *
- * DESCRIPTION: Obtains resolution of the ACPI PM Timer.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiGetTimerResolution (
- UINT32 *Resolution)
-{
- FUNCTION_TRACE ("AcpiGetTimerResolution");
-
- if (!Resolution)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- if (0 == AcpiGbl_FADT->TmrValExt)
- {
- *Resolution = 24;
- }
- else
- {
- *Resolution = 32;
- }
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiGetTimer
- *
- * PARAMETERS: none
- *
- * RETURN: Current value of the ACPI PM Timer (in ticks).
- *
- * DESCRIPTION: Obtains current value of ACPI PM Timer.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiGetTimer (
- UINT32 *Ticks)
-{
- FUNCTION_TRACE ("AcpiGetTimer");
-
- if (!Ticks)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- *Ticks = AcpiOsIn32 ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (AcpiGbl_FADT->XPmTmrBlk.Address));
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiGetTimerDuration
- *
- * PARAMETERS: StartTicks
- * EndTicks
- * TimeElapsed
- *
- * RETURN: TimeElapsed
- *
- * DESCRIPTION: Computes the time elapsed (in microseconds) between two
- * PM Timer time stamps, taking into account the possibility of
- * rollovers, the timer resolution, and timer frequency.
- *
- * The PM Timer's clock ticks at roughly 3.6 times per
- * _microsecond_, and its clock continues through Cx state
- * transitions (unlike many CPU timestamp counters) -- making it
- * a versatile and accurate timer.
- *
- * Note that this function accomodates only a single timer
- * rollover. Thus for 24-bit timers, this function should only
- * be used for calculating durations less than ~4.6 seconds
- * (~20 hours for 32-bit timers).
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiGetTimerDuration (
- UINT32 StartTicks,
- UINT32 EndTicks,
- UINT32 *TimeElapsed)
-{
- UINT32 DeltaTicks = 0;
- UINT32 Seconds = 0;
- UINT32 Milliseconds = 0;
- UINT32 Microseconds = 0;
- UINT32 Remainder = 0;
-
- FUNCTION_TRACE ("AcpiGetTimerDuration");
-
- if (!TimeElapsed)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- /*
- * Compute Tick Delta:
- * -------------------
- * Handle (max one) timer rollovers on 24- versus 32-bit timers.
- */
- if (StartTicks < EndTicks)
- {
- DeltaTicks = EndTicks - StartTicks;
- }
- else if (StartTicks > EndTicks)
- {
- /* 24-bit Timer */
- if (0 == AcpiGbl_FADT->TmrValExt)
- {
- DeltaTicks = (((0x00FFFFFF - StartTicks) + EndTicks) & 0x00FFFFFF);
- }
- /* 32-bit Timer */
- else
- {
- DeltaTicks = (0xFFFFFFFF - StartTicks) + EndTicks;
- }
- }
- else
- {
- *TimeElapsed = 0;
- return_ACPI_STATUS (AE_OK);
- }
-
- /*
- * Compute Duration:
- * -----------------
- * Since certain compilers (gcc/Linux, argh!) don't support 64-bit
- * divides in kernel-space we have to do some trickery to preserve
- * accuracy while using 32-bit math.
- *
- * TODO: Change to use 64-bit math when supported.
- *
- * The process is as follows:
- * 1. Compute the number of seconds by dividing Delta Ticks by
- * the timer frequency.
- * 2. Compute the number of milliseconds in the remainder from step #1
- * by multiplying by 1000 and then dividing by the timer frequency.
- * 3. Compute the number of microseconds in the remainder from step #2
- * by multiplying by 1000 and then dividing by the timer frequency.
- * 4. Add the results from steps 1, 2, and 3 to get the total duration.
- *
- * Example: The time elapsed for DeltaTicks = 0xFFFFFFFF should be
- * 1199864031 microseconds. This is computed as follows:
- * Step #1: Seconds = 1199; Remainder = 3092840
- * Step #2: Milliseconds = 864; Remainder = 113120
- * Step #3: Microseconds = 31; Remainder = <don't care!>
- */
-
- /* Step #1 */
- Seconds = DeltaTicks / PM_TIMER_FREQUENCY;
- Remainder = DeltaTicks % PM_TIMER_FREQUENCY;
-
- /* Step #2 */
- Milliseconds = (Remainder * 1000) / PM_TIMER_FREQUENCY;
- Remainder = (Remainder * 1000) % PM_TIMER_FREQUENCY;
-
- /* Step #3 */
- Microseconds = (Remainder * 1000) / PM_TIMER_FREQUENCY;
-
- /* Step #4 */
- *TimeElapsed = Seconds * 1000000;
- *TimeElapsed += Milliseconds * 1000;
- *TimeElapsed += Microseconds;
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Hardware/hwxface.c b/sys/contrib/dev/acpica/Subsystem/Hardware/hwxface.c
deleted file mode 100644
index 3bece9a0a1f3f..0000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Hardware/hwxface.c
+++ /dev/null
@@ -1,737 +0,0 @@
-
-/******************************************************************************
- *
- * Name: hwxface.c - Hardware access external interfaces
- * $Revision: 37 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 1. Copyright Notice
- *
- * Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
- * All rights reserved.
- *
- * 2. License
- *
- * 2.1. This is your license from Intel Corp. under its intellectual property
- * rights. You may have additional license terms from the party that provided
- * you this software, covering your right to use that party's intellectual
- * property rights.
- *
- * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
- * copy of the source code appearing in this file ("Covered Code") an
- * irrevocable, perpetual, worldwide license under Intel's copyrights in the
- * base code distributed originally by Intel ("Original Intel Code") to copy,
- * make derivatives, distribute, use and display any portion of the Covered
- * Code in any form, with the right to sublicense such rights; and
- *
- * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
- * license (with the right to sublicense), under only those claims of Intel
- * patents that are infringed by the Original Intel Code, to make, use, sell,
- * offer to sell, and import the Covered Code and derivative works thereof
- * solely to the minimum extent necessary to exercise the above copyright
- * license, and in no event shall the patent license extend to any additions
- * to or modifications of the Original Intel Code. No other license or right
- * is granted directly or by implication, estoppel or otherwise;
- *
- * The above copyright and patent license is granted only if the following
- * conditions are met:
- *
- * 3. Conditions
- *
- * 3.1. Redistribution of Source with Rights to Further Distribute Source.
- * Redistribution of source code of any substantial portion of the Covered
- * Code or modification with rights to further distribute source must include
- * the above Copyright Notice, the above License, this list of Conditions,
- * and the following Disclaimer and Export Compliance provision. In addition,
- * Licensee must cause all Covered Code to which Licensee contributes to
- * contain a file documenting the changes Licensee made to create that Covered
- * Code and the date of any change. Licensee must include in that file the
- * documentation of any changes made by any predecessor Licensee. Licensee
- * must include a prominent statement that the modification is derived,
- * directly or indirectly, from Original Intel Code.
- *
- * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
- * Redistribution of source code of any substantial portion of the Covered
- * Code or modification without rights to further distribute source must
- * include the following Disclaimer and Export Compliance provision in the
- * documentation and/or other materials provided with distribution. In
- * addition, Licensee may not authorize further sublicense of source of any
- * portion of the Covered Code, and must include terms to the effect that the
- * license from Licensee to its licensee is limited to the intellectual
- * property embodied in the software Licensee provides to its licensee, and
- * not to intellectual property embodied in modifications its licensee may
- * make.
- *
- * 3.3. Redistribution of Executable. Redistribution in executable form of any
- * substantial portion of the Covered Code or modification must reproduce the
- * above Copyright Notice, and the following Disclaimer and Export Compliance
- * provision in the documentation and/or other materials provided with the
- * distribution.
- *
- * 3.4. Intel retains all right, title, and interest in and to the Original
- * Intel Code.
- *
- * 3.5. Neither the name Intel nor any other trademark owned or controlled by
- * Intel shall be used in advertising or otherwise to promote the sale, use or
- * other dealings in products derived from or relating to the Covered Code
- * without prior written authorization from Intel.
- *
- * 4. Disclaimer and Export Compliance
- *
- * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
- * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
- * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
- * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
- * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
- * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
- * PARTICULAR PURPOSE.
- *
- * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
- * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
- * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
- * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
- * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
- * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
- * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
- * LIMITED REMEDY.
- *
- * 4.3. Licensee shall not export, either directly or indirectly, any of this
- * software or system incorporating such software without first obtaining any
- * required license or other approval from the U. S. Department of Commerce or
- * any other agency or department of the United States Government. In the
- * event Licensee exports any such software from the United States or
- * re-exports any such software from a foreign destination, Licensee shall
- * ensure that the distribution and export/re-export of the software is in
- * compliance with all laws, regulations, orders, or other restrictions of the
- * U.S. Export Administration Regulations. Licensee agrees that neither it nor
- * any of its subsidiaries will export/re-export any technical data, process,
- * software, or service, directly or indirectly, to any country for which the
- * United States government or any agency thereof requires an export license,
- * other governmental approval, or letter of assurance, without first obtaining
- * such license, approval or letter.
- *
- *****************************************************************************/
-
-#include "acpi.h"
-#include "acnamesp.h"
-#include "achware.h"
-
-#define _COMPONENT HARDWARE
- MODULE_NAME ("hwxface")
-
-
-/******************************************************************************
- *
- * Hardware globals
- *
- ******************************************************************************/
-
-
-ACPI_C_STATE_HANDLER AcpiHwCxHandlers[MAX_CX_STATES] =
- {NULL, AcpiHwEnterC1, NULL, NULL};
-
-UINT32 AcpiHwActiveCxState = 1;
-
-
-/****************************************************************************
- *
- * FUNCTION: AcpiGetProcessorThrottlingInfo
- *
- * PARAMETERS: ProcessorHandle - handle for the cpu to get info about
- * UserBuffer - caller supplied buffer
- *
- * RETURN: Status of function
- *
- * DESCRIPTION: Get throttling capabilities for the processor, this routine
- * builds the data directly into the callers buffer
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiGetProcessorThrottlingInfo (
- ACPI_HANDLE ProcessorHandle,
- ACPI_BUFFER *UserBuffer)
-{
- NATIVE_UINT PercentStep;
- NATIVE_UINT NextPercent;
- NATIVE_UINT NumThrottleStates;
- NATIVE_UINT BufferSpaceNeeded;
- NATIVE_UINT i;
- UINT8 DutyWidth;
- ACPI_NAMESPACE_NODE *CpuNode;
- ACPI_OPERAND_OBJECT *CpuObj;
- ACPI_CPU_THROTTLING_STATE *StatePtr;
-
-
- FUNCTION_TRACE ("AcpiGetProcessorThrottlingInfo");
-
-
- /*
- * Have to at least have a buffer to return info in
- */
- if (!UserBuffer)
- {
- return_ACPI_STATUS(AE_BAD_PARAMETER);
- }
-
- /*
- * Convert and validate the device handle
- */
-
- CpuNode = AcpiNsConvertHandleToEntry (ProcessorHandle);
- if (!CpuNode)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- /*
- * Check for an existing internal object
- */
-
- CpuObj = AcpiNsGetAttachedObject ((ACPI_HANDLE) CpuNode);
- if (!CpuObj)
- {
- return_ACPI_STATUS (AE_NOT_FOUND);
- }
-
- /*
- * (Duty Width on IA-64 is zero)
- */
- DutyWidth = AcpiGbl_FADT->DutyWidth;
-
- /*
- * P0 must always have a P_BLK all others may be null
- * in either case, we can't throttle a processor that has no P_BLK
- *
- * Also if no Duty width, one state and it is 100%
- *
- */
- if (!CpuObj->Processor.Length || !DutyWidth ||
- (ACPI_UINT16_MAX < CpuObj->Processor.Address))
- {
- /*
- * AcpiEven though we can't throttle, we still have one state (100%)
- */
- NumThrottleStates = 1;
- }
-
- else
- {
- NumThrottleStates = (int) AcpiHwLocalPow (2,DutyWidth);
- }
-
- BufferSpaceNeeded = NumThrottleStates * sizeof (ACPI_CPU_THROTTLING_STATE);
-
- if ((UserBuffer->Length < BufferSpaceNeeded) || !UserBuffer->Pointer)
- {
- UserBuffer->Length = BufferSpaceNeeded;
- return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
- }
-
- UserBuffer->Length = BufferSpaceNeeded;
- StatePtr = (ACPI_CPU_THROTTLING_STATE *) UserBuffer->Pointer;
- PercentStep = 1000 / NumThrottleStates;
-
- /*
- * Build each entry in the buffer. Note that we're using the value
- * 1000 and dividing each state by 10 to better avoid round-off
- * accumulation. Also note that the throttling STATES are ordered
- * sequentially from 100% (state 0) on down (e.g. 87.5% = state 1),
- * which is exactly opposite from duty cycle values (12.5% = state 1).
- */
- for (i = 0, NextPercent = 1000; i < NumThrottleStates; i++)
- {
- StatePtr[i].StateNumber = i;
- StatePtr[i].PercentOfClock = NextPercent / 10;
- NextPercent -= PercentStep;
- }
-
- return_ACPI_STATUS(AE_OK);
-}
-
-
-/****************************************************************************
- *
- * FUNCTION: AcpiGetProcessorThrottlingState
- *
- * PARAMETERS: ProcessorHandle - handle for the cpu to throttle
- * ThrottleState - throttling state to enter
- *
- * RETURN: Status of function
- *
- * DESCRIPTION: Get current hardware throttling state
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiGetProcessorThrottlingState (
- ACPI_HANDLE ProcessorHandle,
- UINT32 *ThrottleState)
-{
- ACPI_NAMESPACE_NODE *CpuNode;
- ACPI_OPERAND_OBJECT *CpuObj;
- UINT32 NumThrottleStates;
- UINT32 DutyCycle;
- UINT8 DutyOffset;
- UINT8 DutyWidth;
-
-
- FUNCTION_TRACE ("AcpiGetProcessorThrottlingState");
-
-
- /* Convert and validate the device handle */
-
- CpuNode = AcpiNsConvertHandleToEntry (ProcessorHandle);
- if (!CpuNode || !ThrottleState)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- /* Check for an existing internal object */
-
- CpuObj = AcpiNsGetAttachedObject ((ACPI_HANDLE) CpuNode);
- if (!CpuObj)
- {
- return_ACPI_STATUS (AE_NOT_FOUND);
- }
-
- /*
- * No Duty fields in IA64 tables
- */
- DutyOffset = AcpiGbl_FADT->DutyOffset;
- DutyWidth = AcpiGbl_FADT->DutyWidth;
-
- /*
- * Must have a valid P_BLK P0 must have a P_BLK all others may be null
- * in either case, we can't thottle a processor that has no P_BLK
- * that means we are in the only supported state (0 - 100%)
- *
- * also, if DutyWidth is zero there are no additional states
- */
- if (!CpuObj->Processor.Length || !DutyWidth ||
- (ACPI_UINT16_MAX < CpuObj->Processor.Address))
- {
- *ThrottleState = 0;
- return_ACPI_STATUS(AE_OK);
- }
-
- NumThrottleStates = (UINT32) AcpiHwLocalPow (2,DutyWidth);
-
- /*
- * Get the current duty cycle value.
- */
- DutyCycle = AcpiHwGetDutyCycle (DutyOffset,
- CpuObj->Processor.Address,
- NumThrottleStates);
-
- /*
- * Convert duty cycle to throttling state (invert).
- */
- if (DutyCycle == 0)
- {
- *ThrottleState = 0;
- }
-
- else
- {
- *ThrottleState = NumThrottleStates - DutyCycle;
- }
-
- return_ACPI_STATUS(AE_OK);
-}
-
-
-/****************************************************************************
- *
- * FUNCTION: AcpiSetProcessorThrottlingState
- *
- * PARAMETERS: ProcessorHandle - handle for the cpu to throttle
- * ThrottleState - throttling state to enter
- *
- * RETURN: Status of function
- *
- * DESCRIPTION: Set hardware into requested throttling state, the handle
- * passed in must have a valid P_BLK
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiSetProcessorThrottlingState (
- ACPI_HANDLE ProcessorHandle,
- UINT32 ThrottleState)
-{
- ACPI_NAMESPACE_NODE *CpuNode;
- ACPI_OPERAND_OBJECT *CpuObj;
- UINT32 NumThrottleStates = 0;
- UINT8 DutyOffset;
- UINT8 DutyWidth;
- UINT32 DutyCycle = 0;
-
-
- FUNCTION_TRACE ("AcpiSetProcessorThrottlingState");
-
-
- /* Convert and validate the device handle */
-
- CpuNode = AcpiNsConvertHandleToEntry (ProcessorHandle);
- if (!CpuNode)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- /* Check for an existing internal object */
-
- CpuObj = AcpiNsGetAttachedObject ((ACPI_HANDLE) CpuNode);
- if (!CpuObj)
- {
- return_ACPI_STATUS (AE_NOT_FOUND);
- }
-
- /*
- * No Duty fields in IA64 tables
- */
- DutyOffset = AcpiGbl_FADT->DutyOffset;
- DutyWidth = AcpiGbl_FADT->DutyWidth;
-
- /*
- * Must have a valid P_BLK P0 must have a P_BLK all others may be null
- * in either case, we can't thottle a processor that has no P_BLK
- * that means we are in the only supported state (0 - 100%)
- *
- * also, if DutyWidth is zero there are no additional states
- */
- if (!CpuObj->Processor.Length || !DutyWidth ||
- (ACPI_UINT16_MAX < CpuObj->Processor.Address))
- {
- /*
- * If caller wants to set the state to the only state we handle
- * we're done.
- */
- if (ThrottleState == 0)
- {
- return_ACPI_STATUS (AE_OK);
- }
-
- /*
- * Can't set this state
- */
- return_ACPI_STATUS (AE_SUPPORT);
- }
-
- NumThrottleStates = (UINT32) AcpiHwLocalPow (2,DutyWidth);
-
- /*
- * Convert throttling state to duty cycle (invert).
- */
- if (ThrottleState > 0)
- {
- DutyCycle = NumThrottleStates - ThrottleState;
- }
-
- /*
- * Turn off throttling (don't muck with the h/w while throttling).
- */
- AcpiHwDisableThrottling (CpuObj->Processor.Address);
-
- /*
- * Program the throttling state.
- */
- AcpiHwProgramDutyCycle (DutyOffset, DutyCycle,
- CpuObj->Processor.Address, NumThrottleStates);
-
- /*
- * Only enable throttling for non-zero states (0 - 100%)
- */
- if (ThrottleState)
- {
- AcpiHwEnableThrottling (CpuObj->Processor.Address);
- }
-
- return_ACPI_STATUS(AE_OK);
-}
-
-
-/****************************************************************************
- *
- * FUNCTION: AcpiGetProcessorCxInfo
- *
- * PARAMETERS: ProcessorHandle - handle for the cpu return info about
- * UserBuffer - caller supplied buffer
- *
- * RETURN: Status of function
- *
- * DESCRIPTION: Get Cx state latencies, this routine
- * builds the data directly into the callers buffer
- *
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiGetProcessorCxInfo (
- ACPI_HANDLE ProcessorHandle,
- ACPI_BUFFER *UserBuffer)
-{
- ACPI_STATUS Status = AE_OK;
- UINT32 CxStateLatencies[4] = {0, 0, 0, 0};
- NATIVE_UINT BufferSpaceNeeded = 0;
- ACPI_CX_STATE *StatePtr = NULL;
- NATIVE_UINT i = 0;
-
-
- FUNCTION_TRACE ("AcpiGetProcessorCxInfo");
-
-
- /*
- * Have to at least have a buffer to return info in
- */
- if (!UserBuffer)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- Status = AcpiHwGetCxInfo (CxStateLatencies);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- BufferSpaceNeeded = 4 * sizeof (ACPI_CX_STATE);
-
- if ((UserBuffer->Length < BufferSpaceNeeded) || !UserBuffer->Pointer)
- {
- UserBuffer->Length = BufferSpaceNeeded;
- return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
- }
-
- UserBuffer->Length = BufferSpaceNeeded;
-
- StatePtr = (ACPI_CX_STATE *) UserBuffer->Pointer;
-
- for (i = 0; i < 4; i++)
- {
- StatePtr[i].StateNumber = i;
- StatePtr[i].Latency = CxStateLatencies[i];
- }
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/****************************************************************************
- *
- * FUNCTION: AcpiSetProcessorSleepState
- *
- * PARAMETERS: ProcessorHandle - handle for the cpu return info about
- * CxState - the Cx sleeping state (C1-C3) to make
- * 'active'
- *
- * RETURN: Status of function
- *
- * DESCRIPTION: Sets which Cx state will be used during calls to
- * AcpiProcessorSleep ()
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiSetProcessorSleepState (
- ACPI_HANDLE ProcessorHandle,
- UINT32 CxState)
-{
- ACPI_STATUS Status;
-
-
- FUNCTION_TRACE ("AcpiSetProcessorSleepState");
-
-
- Status = AcpiHwSetCx (CxState);
-
- return_ACPI_STATUS (Status);
-}
-
-
-/****************************************************************************
- *
- * FUNCTION: AcpiProcessorSleep
- *
- * PARAMETERS: ProcessorHandle - handle for the cpu to put to sleep (Cx)
- * TimeSleeping - time (in microseconds) elapsed while
- * sleeping
- *
- * RETURN: Status of function
- *
- * DESCRIPTION: Puts the processor into the currently active sleep state (Cx)
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiProcessorSleep (
- ACPI_HANDLE ProcessorHandle,
- UINT32 *PmTimerTicks)
-{
- ACPI_NAMESPACE_NODE *CpuNode = NULL;
- ACPI_OPERAND_OBJECT *CpuObj = NULL;
- ACPI_IO_ADDRESS Address = 0;
-
-
- /*
- * Convert ProcessorHandle to PblkAddres...
- */
-
- /* Convert and validate the device handle */
-
- CpuNode = AcpiNsConvertHandleToEntry (ProcessorHandle);
- if (!CpuNode)
- {
- return (AE_BAD_PARAMETER);
- }
-
- /* Check for an existing internal object */
-
- CpuObj = AcpiNsGetAttachedObject ((ACPI_HANDLE) CpuNode);
- if (!CpuObj)
- {
- return (AE_NOT_FOUND);
- }
-
- /* Get the processor register block (P_BLK) address */
-
- Address = CpuObj->Processor.Address;
- if (!CpuObj->Processor.Length)
- {
- /* Ensure a NULL addresss (note that P_BLK isn't required for C1) */
-
- Address = 0;
- }
-
- /*
- * Enter the currently active Cx sleep state.
- */
- return (AcpiHwEnterCx (Address, PmTimerTicks));
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiGetTimer
- *
- * PARAMETERS: none
- *
- * RETURN: Current value of the ACPI PMT (timer)
- *
- * DESCRIPTION: Obtains current value of ACPI PMT
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiGetTimer (
- UINT32 *OutTicks)
-{
- FUNCTION_TRACE ("AcpiGetTimer");
-
-
- if (!OutTicks)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- *OutTicks = AcpiHwPmtTicks ();
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiSetFirmwareWakingVector
- *
- * PARAMETERS: PhysicalAddress - Physical address of ACPI real mode
- * entry point.
- *
- * RETURN: AE_OK or AE_ERROR
- *
- * DESCRIPTION: Access function for dFirmwareWakingVector field in FACS
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiSetFirmwareWakingVector (
- ACPI_PHYSICAL_ADDRESS PhysicalAddress)
-{
-
- FUNCTION_TRACE ("AcpiSetFirmwareWakingVector");
-
-
- /* Make sure that we have an FACS */
-
- if (!AcpiGbl_FACS)
- {
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
- }
-
- /* Set the vector */
-
- if (AcpiGbl_FACS->VectorWidth == 32)
- {
- * (UINT32 *) AcpiGbl_FACS->FirmwareWakingVector = (UINT32) PhysicalAddress;
- }
- else
- {
- *AcpiGbl_FACS->FirmwareWakingVector = PhysicalAddress;
- }
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiGetFirmwareWakingVector
- *
- * PARAMETERS: *PhysicalAddress - Output buffer where contents of
- * the FirmwareWakingVector field of
- * the FACS will be stored.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Access function for dFirmwareWakingVector field in FACS
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiGetFirmwareWakingVector (
- ACPI_PHYSICAL_ADDRESS *PhysicalAddress)
-{
-
- FUNCTION_TRACE ("AcpiGetFirmwareWakingVector");
-
-
- if (!PhysicalAddress)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- /* Make sure that we have an FACS */
-
- if (!AcpiGbl_FACS)
- {
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
- }
-
- /* Get the vector */
-
- if (AcpiGbl_FACS->VectorWidth == 32)
- {
- *PhysicalAddress = * (UINT32 *) AcpiGbl_FACS->FirmwareWakingVector;
- }
- else
- {
- *PhysicalAddress = *AcpiGbl_FACS->FirmwareWakingVector;
- }
-
- return_ACPI_STATUS (AE_OK);
-}
-
-