Update to the 20010125 ACPI CA snapshot.

This commit is contained in:
Mike Smith 2001-01-31 09:17:50 +00:00
parent 68466b4675
commit 838fd87dd9
271 changed files with 7974 additions and 4556 deletions

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: cmalloc - local memory allocation routines
* $Revision: 80 $
* $Revision: 84 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -126,7 +126,8 @@
MODULE_NAME ("cmalloc")
#ifdef ACPI_DEBUG
#ifdef ACPI_DEBUG_TRACK_ALLOCATIONS
/*
* Most of this code is for tracking memory leaks in the subsystem, and it
* gets compiled out when the ACPI_DEBUG flag is not set.
@ -269,7 +270,8 @@ AcpiCmAddElementToAllocList (
Element = AcpiCmSearchAllocList (Address);
if (Element)
{
REPORT_ERROR (("CmAddElementToAllocList: Address already present in list!\n"));
REPORT_ERROR (("CmAddElementToAllocList: Address already present in list! (%p)\n",
Address));
DEBUG_PRINT (ACPI_ERROR, ("Element %p Address %p\n", Element, Address));
@ -613,11 +615,11 @@ AcpiCmDumpCurrentAllocations (
DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
("Total number of unfreed allocations = %d(%X)\n", i,i));
return_VOID;
}
#endif /* Debug routines for memory leak detection */
#endif /* #ifdef ACPI_DEBUG_TRACK_ALLOCATIONS */
/*****************************************************************************
*
@ -642,8 +644,6 @@ _CmAllocate (
UINT32 Line)
{
void *Address = NULL;
DEBUG_ONLY_MEMBERS (\
ACPI_STATUS Status)
FUNCTION_TRACE_U32 ("_CmAllocate", Size);
@ -669,10 +669,10 @@ _CmAllocate (
return_VALUE (NULL);
}
#ifdef ACPI_DEBUG
Status = AcpiCmAddElementToAllocList (Address, Size, MEM_MALLOC, Component,
Module, Line);
if (ACPI_FAILURE (Status))
#ifdef ACPI_DEBUG_TRACK_ALLOCATIONS
if (ACPI_FAILURE (AcpiCmAddElementToAllocList (Address, Size, MEM_MALLOC,
Component, Module, Line)))
{
AcpiOsFree (Address);
return_PTR (NULL);
@ -709,8 +709,6 @@ _CmCallocate (
UINT32 Line)
{
void *Address = NULL;
DEBUG_ONLY_MEMBERS (\
ACPI_STATUS Status)
FUNCTION_TRACE_U32 ("_CmCallocate", Size);
@ -737,10 +735,10 @@ _CmCallocate (
return_VALUE (NULL);
}
#ifdef ACPI_DEBUG
Status = AcpiCmAddElementToAllocList (Address, Size, MEM_CALLOC, Component,
Module, Line);
if (ACPI_FAILURE (Status))
#ifdef ACPI_DEBUG_TRACK_ALLOCATIONS
if (ACPI_FAILURE (AcpiCmAddElementToAllocList (Address, Size, MEM_CALLOC,
Component,Module, Line)))
{
AcpiOsFree (Address);
return_PTR (NULL);
@ -787,7 +785,7 @@ _CmFree (
return_VOID;
}
#ifdef ACPI_DEBUG
#ifdef ACPI_DEBUG_TRACK_ALLOCATIONS
AcpiCmDeleteElementFromAllocList (Address, Component, Module, Line);
#endif

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: cmclib - Local implementation of C library functions
* $Revision: 29 $
* $Revision: 32 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -454,7 +454,7 @@ AcpiCmMemcpy (
void *
AcpiCmMemset (
void *Dest,
UINT32 Value,
NATIVE_UINT Value,
NATIVE_UINT Count)
{
NATIVE_CHAR *New = (NATIVE_CHAR *) Dest;
@ -630,6 +630,7 @@ static const UINT8 _acpi_ctype[257] = {
#define IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
#define IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
#define IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
#define IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
/*******************************************************************************
@ -770,7 +771,7 @@ UINT32
AcpiCmStrtoul (
const NATIVE_CHAR *String,
NATIVE_CHAR **Terminator,
UINT32 Base)
NATIVE_UINT Base)
{
UINT32 converted = 0;
UINT32 index;

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: cmcopy - Internal to external object translation utilities
* $Revision: 61 $
* $Revision: 62 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -214,9 +214,9 @@ AcpiCmBuildExternalSimpleObject (
break;
case ACPI_TYPE_NUMBER:
case ACPI_TYPE_INTEGER:
ExternalObj->Number.Value= InternalObj->Number.Value;
ExternalObj->Integer.Value= InternalObj->Integer.Value;
break;
@ -584,11 +584,11 @@ AcpiCmBuildInternalSimpleObject (
break;
case ACPI_TYPE_NUMBER:
case ACPI_TYPE_INTEGER:
/*
* Number is included in the object itself
*/
InternalObj->Number.Value = ExternalObj->Number.Value;
InternalObj->Integer.Value = ExternalObj->Integer.Value;
break;

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: cmdebug - Debug print routines
* $Revision: 62 $
* $Revision: 64 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -373,7 +373,7 @@ FunctionValueExit (
UINT32 LineNumber,
UINT32 ComponentId,
NATIVE_CHAR *FunctionName,
NATIVE_UINT Value)
ACPI_INTEGER Value)
{
DebugPrint (ModuleName, LineNumber, ComponentId, TRACE_FUNCTIONS,

View file

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: cmdelete - object deletion and reference count utilities
* $Revision: 61 $
* $Revision: 62 $
*
******************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: cmeval - Object evaluation
* $Revision: 20 $
* $Revision: 21 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -189,7 +189,7 @@ AcpiCmEvaluateNumericObject (
/* Is the return object of the correct type? */
if (ObjDesc->Common.Type != ACPI_TYPE_NUMBER)
if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER)
{
Status = AE_TYPE;
DEBUG_PRINT (ACPI_ERROR,
@ -202,7 +202,7 @@ AcpiCmEvaluateNumericObject (
* Since the structure is a union, setting any field will set all
* of the variables in the union
*/
*Address = ObjDesc->Number.Value;
*Address = ObjDesc->Integer.Value;
}
/* On exit, we must delete the return object */
@ -278,7 +278,7 @@ AcpiCmExecute_HID (
* a string
*/
if ((ObjDesc->Common.Type != ACPI_TYPE_NUMBER) &&
if ((ObjDesc->Common.Type != ACPI_TYPE_INTEGER) &&
(ObjDesc->Common.Type != ACPI_TYPE_STRING))
{
Status = AE_TYPE;
@ -289,11 +289,11 @@ AcpiCmExecute_HID (
else
{
if (ObjDesc->Common.Type == ACPI_TYPE_NUMBER)
if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER)
{
/* Convert the Numeric HID to string */
AcpiAmlEisaIdToString ((UINT32) ObjDesc->Number.Value, Hid->Buffer);
AcpiAmlEisaIdToString ((UINT32) ObjDesc->Integer.Value, Hid->Buffer);
}
else
@ -375,7 +375,7 @@ AcpiCmExecute_UID (
* a string
*/
if ((ObjDesc->Common.Type != ACPI_TYPE_NUMBER) &&
if ((ObjDesc->Common.Type != ACPI_TYPE_INTEGER) &&
(ObjDesc->Common.Type != ACPI_TYPE_STRING))
{
Status = AE_TYPE;
@ -386,11 +386,11 @@ AcpiCmExecute_UID (
else
{
if (ObjDesc->Common.Type == ACPI_TYPE_NUMBER)
if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER)
{
/* Convert the Numeric UID to string */
AcpiAmlUnsignedIntegerToString (ObjDesc->Number.Value, Uid->Buffer);
AcpiAmlUnsignedIntegerToString (ObjDesc->Integer.Value, Uid->Buffer);
}
else
@ -470,7 +470,7 @@ AcpiCmExecute_STA (
/* Is the return object of the correct type? */
if (ObjDesc->Common.Type != ACPI_TYPE_NUMBER)
if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER)
{
Status = AE_TYPE;
DEBUG_PRINT (ACPI_ERROR,
@ -482,7 +482,7 @@ AcpiCmExecute_STA (
{
/* Extract the status flags */
*Flags = (UINT32) ObjDesc->Number.Value;
*Flags = (UINT32) ObjDesc->Integer.Value;
}
/* On exit, we must delete the return object */

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: cmglobal - Global variables for the ACPI subsystem
* $Revision: 113 $
* $Revision: 116 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -191,7 +191,7 @@ PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] =
{"_SB_", INTERNAL_TYPE_DEF_ANY},
{"_SI_", INTERNAL_TYPE_DEF_ANY},
{"_TZ_", INTERNAL_TYPE_DEF_ANY},
{"_REV", ACPI_TYPE_NUMBER, "2"},
{"_REV", ACPI_TYPE_INTEGER, "2"},
{"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
{"_GL_", ACPI_TYPE_MUTEX, "0"},
@ -248,6 +248,13 @@ UINT8 AcpiGbl_NsProperties[] =
};
/* Hex to ASCII conversion table */
NATIVE_CHAR AcpiGbl_HexToAscii[] =
{'0','1','2','3','4','5','6','7',
'8','9','A','B','C','D','E','F'};
/******************************************************************************
*
* Table globals
@ -328,7 +335,7 @@ static NATIVE_CHAR AcpiGbl_BadType[] = "UNDEFINED";
static NATIVE_CHAR *AcpiGbl_NsTypeNames[] = /* printable names of ACPI types */
{
/* 00 */ "Untyped",
/* 01 */ "Number",
/* 01 */ "Integer",
/* 02 */ "String",
/* 03 */ "Buffer",
/* 04 */ "Package",

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: cminit - Common ACPI subsystem initialization
* $Revision: 91 $
* $Revision: 93 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -128,6 +128,9 @@
MODULE_NAME ("cminit")
#define ACPI_OFFSET(d,o) ((UINT32) &(((d *)0)->o))
#define ACPI_FADT_OFFSET(o) ACPI_OFFSET (FADT_DESCRIPTOR, o)
/*******************************************************************************
*
* FUNCTION: AcpiCmFadtRegisterError
@ -146,12 +149,13 @@
static ACPI_STATUS
AcpiCmFadtRegisterError (
NATIVE_CHAR *RegisterName,
UINT32 Value)
UINT32 Value,
UINT32 Offset)
{
REPORT_ERROR (
("Invalid FADT register value, %s=%X (FADT=%p)\n",
RegisterName, Value, AcpiGbl_FADT));
("Invalid FADT value %s=%lX at offset %lX FADT=%p\n",
RegisterName, Value, Offset, AcpiGbl_FADT));
return (AE_BAD_VALUE);
@ -185,44 +189,47 @@ AcpiCmValidateFadt (
if (AcpiGbl_FADT->Pm1EvtLen < 4)
{
Status = AcpiCmFadtRegisterError ("PM1_EVT_LEN",
(UINT32) AcpiGbl_FADT->Pm1EvtLen);
(UINT32) AcpiGbl_FADT->Pm1EvtLen,
ACPI_FADT_OFFSET (Pm1EvtLen));
}
if (!AcpiGbl_FADT->Pm1CntLen)
{
Status = AcpiCmFadtRegisterError ("PM1_CNT_LEN",
0);
Status = AcpiCmFadtRegisterError ("PM1_CNT_LEN", 0,
ACPI_FADT_OFFSET (Pm1CntLen));
}
if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1aEvtBlk.Address))
{
Status = AcpiCmFadtRegisterError ("PM1a_EVT_BLK",
0);
Status = AcpiCmFadtRegisterError ("X_PM1a_EVT_BLK", 0,
ACPI_FADT_OFFSET (XPm1aEvtBlk.Address));
}
if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1aCntBlk.Address))
{
Status = AcpiCmFadtRegisterError ("PM1a_CNT_BLK",
0);
Status = AcpiCmFadtRegisterError ("X_PM1a_CNT_BLK", 0,
ACPI_FADT_OFFSET (XPm1aCntBlk.Address));
}
if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPmTmrBlk.Address))
{
Status = AcpiCmFadtRegisterError ("PM_TMR_BLK",
0);
Status = AcpiCmFadtRegisterError ("X_PM_TMR_BLK", 0,
ACPI_FADT_OFFSET (XPmTmrBlk.Address));
}
if ((ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address) &&
!AcpiGbl_FADT->Pm2CntLen))
{
Status = AcpiCmFadtRegisterError ("PM2_CNT_LEN",
(UINT32) AcpiGbl_FADT->Pm2CntLen);
(UINT32) AcpiGbl_FADT->Pm2CntLen,
ACPI_FADT_OFFSET (Pm2CntLen));
}
if (AcpiGbl_FADT->PmTmLen < 4)
{
Status = AcpiCmFadtRegisterError ("PM_TM_LEN",
(UINT32) AcpiGbl_FADT->PmTmLen);
(UINT32) AcpiGbl_FADT->PmTmLen,
ACPI_FADT_OFFSET (PmTmLen));
}
/* length of GPE blocks must be a multiple of 2 */
@ -231,15 +238,17 @@ AcpiCmValidateFadt (
if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) &&
(AcpiGbl_FADT->Gpe0BlkLen & 1))
{
Status = AcpiCmFadtRegisterError ("GPE0_BLK_LEN",
(UINT32) AcpiGbl_FADT->Gpe0BlkLen);
Status = AcpiCmFadtRegisterError ("(x)GPE0_BLK_LEN",
(UINT32) AcpiGbl_FADT->Gpe0BlkLen,
ACPI_FADT_OFFSET (Gpe0BlkLen));
}
if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) &&
(AcpiGbl_FADT->Gpe1BlkLen & 1))
{
Status = AcpiCmFadtRegisterError ("GPE1_BLK_LEN",
(UINT32) AcpiGbl_FADT->Gpe1BlkLen);
Status = AcpiCmFadtRegisterError ("(x)GPE1_BLK_LEN",
(UINT32) AcpiGbl_FADT->Gpe1BlkLen,
ACPI_FADT_OFFSET (Gpe1BlkLen));
}
return (Status);

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: cmobject - ACPI object create/delete/size/cache routines
* $Revision: 34 $
* $Revision: 35 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -586,7 +586,7 @@ AcpiCmGetSimpleObjectSize (
break;
case ACPI_TYPE_NUMBER:
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_PROCESSOR:
case ACPI_TYPE_POWER:

View file

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: cmutils - common utility procedures
* $Revision: 22 $
* $Revision: 23 $
*
******************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -814,18 +814,18 @@ AcpiCmResolvePackageReferences (
{
if (SubObject->Reference.OpCode == AML_ZERO_OP)
{
SubObject->Common.Type = ACPI_TYPE_NUMBER;
SubObject->Number.Value = 0;
SubObject->Common.Type = ACPI_TYPE_INTEGER;
SubObject->Integer.Value = 0;
}
else if (SubObject->Reference.OpCode == AML_ONE_OP)
{
SubObject->Common.Type = ACPI_TYPE_NUMBER;
SubObject->Number.Value = 1;
SubObject->Common.Type = ACPI_TYPE_INTEGER;
SubObject->Integer.Value = 1;
}
else if (SubObject->Reference.OpCode == AML_ONES_OP)
{
SubObject->Common.Type = ACPI_TYPE_NUMBER;
SubObject->Number.Value = ACPI_INTEGER_MAX;
SubObject->Common.Type = ACPI_TYPE_INTEGER;
SubObject->Integer.Value = ACPI_INTEGER_MAX;
}
}
}

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: cmxface - External interfaces for "global" ACPI functions
* $Revision: 57 $
* $Revision: 62 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -149,13 +149,8 @@ AcpiInitializeSubsystem (
{
ACPI_STATUS Status;
FUNCTION_TRACE ("AcpiInitializeSubsystem");
DEBUG_PRINT_RAW (ACPI_OK,
("ACPI: Core Subsystem version [%s]\n", ACPI_CA_VERSION));
DEBUG_PRINT (ACPI_INFO, ("Initializing ACPI Subsystem...\n"));
/* Initialize all globals used by the subsystem */
@ -442,16 +437,25 @@ AcpiGetSystemInfo (
OutBuffer->Length = sizeof (ACPI_SYSTEM_INFO);
InfoPtr = (ACPI_SYSTEM_INFO *) OutBuffer->Pointer;
/* TBD [Future]: need a version number, or use the version string */
InfoPtr->AcpiCaVersion = 0x1234;
InfoPtr->AcpiCaVersion = ACPI_CA_VERSION;
/* System flags (ACPI capabilities) */
InfoPtr->Flags = AcpiGbl_SystemFlags;
/* Timer resolution - 24 or 32 bits */
InfoPtr->TimerResolution = AcpiHwPmtResolution ();
if (!AcpiGbl_FADT)
{
InfoPtr->TimerResolution = 0;
}
else if (AcpiGbl_FADT->TmrValExt == 0)
{
InfoPtr->TimerResolution = 24;
}
else
{
InfoPtr->TimerResolution = 32;
}
/* Clear the reserved fields */

View file

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbcmds - debug commands and output routines
* $Revision: 43 $
* $Revision: 45 $
*
******************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -660,14 +660,14 @@ AcpiDbSetMethodData (
/* Create and initialize the new object */
ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_NUMBER);
ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
if (!ObjDesc)
{
AcpiOsPrintf ("Could not create an internal object\n");
return;
}
ObjDesc->Number.Value = Value;
ObjDesc->Integer.Value = Value;
/* Store the new object into the target */
@ -736,14 +736,15 @@ AcpiDbWalkForSpecificObjects (
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status;
UINT32 BufSize;
NATIVE_CHAR buffer[64];
NATIVE_CHAR Buffer[64];
ObjDesc = ((ACPI_NAMESPACE_NODE *)ObjHandle)->Object;
BufSize = sizeof (Buffer) / sizeof (*Buffer);
/* Get and display the full pathname to this object */
Status = AcpiNsHandleToPathname (ObjHandle, &BufSize, buffer);
Status = AcpiNsHandleToPathname (ObjHandle, &BufSize, Buffer);
if (ACPI_FAILURE (Status))
{
@ -751,7 +752,7 @@ AcpiDbWalkForSpecificObjects (
return (AE_OK);
}
AcpiOsPrintf ("%32s", buffer);
AcpiOsPrintf ("%32s", Buffer);
/* Display short information about the object */
@ -764,8 +765,8 @@ AcpiDbWalkForSpecificObjects (
AcpiOsPrintf (" #Args %d Concurrency %X", ObjDesc->Method.ParamCount, ObjDesc->Method.Concurrency);
break;
case ACPI_TYPE_NUMBER:
AcpiOsPrintf (" Value %X", ObjDesc->Number.Value);
case ACPI_TYPE_INTEGER:
AcpiOsPrintf (" Value %X", ObjDesc->Integer.Value);
break;
case ACPI_TYPE_STRING:
@ -899,7 +900,7 @@ AcpiDbWalkAndMatchName (
/* Get the full pathname to this object */
BufSize = sizeof (Buffer);
BufSize = sizeof (Buffer) / sizeof (*Buffer);
Status = AcpiNsHandleToPathname (ObjHandle, &BufSize, Buffer);
if (ACPI_FAILURE (Status))

View file

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbdisasm - parser op tree display routines
* $Revision: 35 $
* $Revision: 37 $
*
******************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -773,7 +773,7 @@ AcpiDbDisplayOpcode (
/* Just get the opcode name and print it */
Opc = AcpiPsGetOpcodeInfo (Op->Opcode);
DEBUG_ONLY_MEMBERS ((AcpiOsPrintf ("%s", Opc->Name)));
AcpiOsPrintf ("%s", Opc->Name);
#ifndef PARSER_ONLY

View file

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbdisply - debug display commands
* $Revision: 39 $
* $Revision: 41 $
*
******************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -399,22 +399,33 @@ void
AcpiDbDecodeInternalObject (
ACPI_OPERAND_OBJECT *ObjDesc)
{
UINT32 i;
if (!ObjDesc)
{
return;
}
AcpiOsPrintf (" %9.9s ", AcpiCmGetTypeName (ObjDesc->Common.Type));
AcpiOsPrintf (" %s", AcpiCmGetTypeName (ObjDesc->Common.Type));
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_NUMBER:
AcpiOsPrintf ("%.8X", ObjDesc->Number.Value);
case ACPI_TYPE_INTEGER:
AcpiOsPrintf (" %.8X", ObjDesc->Integer.Value);
break;
case ACPI_TYPE_STRING:
AcpiOsPrintf ("\"%.16s\"...", ObjDesc->String.Pointer);
AcpiOsPrintf ("(%d) \"%.16s\"...",
ObjDesc->String.Length, ObjDesc->String.Pointer);
break;
case ACPI_TYPE_BUFFER:
AcpiOsPrintf ("(%d)", ObjDesc->Buffer.Length);
for (i = 0; (i < 8) && (i < ObjDesc->Buffer.Length); i++)
{
AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]);
}
break;
}
}
@ -502,7 +513,7 @@ AcpiDbDisplayInternalObject (
break;
case AML_LOCAL_OP:
AcpiOsPrintf ("[Local%d]", ObjDesc->Reference.Offset);
AcpiOsPrintf ("[Local%d] ", ObjDesc->Reference.Offset);
if (WalkState)
{
ObjDesc = WalkState->LocalVariables[ObjDesc->Reference.Offset].Object;
@ -511,7 +522,7 @@ AcpiDbDisplayInternalObject (
break;
case AML_ARG_OP:
AcpiOsPrintf ("[Arg%d] ", ObjDesc->Reference.Offset);
AcpiOsPrintf ("[Arg%d] ", ObjDesc->Reference.Offset);
if (WalkState)
{
ObjDesc = WalkState->Arguments[ObjDesc->Reference.Offset].Object;
@ -524,7 +535,7 @@ AcpiDbDisplayInternalObject (
break;
case AML_INDEX_OP:
AcpiOsPrintf ("[Index] ");
AcpiOsPrintf ("[Index] ");
AcpiDbDecodeInternalObject (ObjDesc->Reference.Object);
break;
@ -535,7 +546,7 @@ AcpiDbDisplayInternalObject (
break;
default:
AcpiOsPrintf (" ");
AcpiOsPrintf (" ");
AcpiDbDecodeInternalObject (ObjDesc);
break;
}

View file

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbexec - debugger control method execution
* $Revision: 20 $
* $Revision: 21 $
*
******************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -182,8 +182,8 @@ AcpiDbExecuteMethod (
{
for (i = 0; Info->Args[i] && i < MTH_NUM_ARGS; i++)
{
Params[i].Type = ACPI_TYPE_NUMBER;
Params[i].Number.Value = STRTOUL (Info->Args[i], NULL, 16);
Params[i].Type = ACPI_TYPE_INTEGER;
Params[i].Integer.Value = STRTOUL (Info->Args[i], NULL, 16);
}
ParamObjects.Pointer = Params;
@ -194,8 +194,8 @@ AcpiDbExecuteMethod (
{
/* Setup default parameters */
Params[0].Type = ACPI_TYPE_NUMBER;
Params[0].Number.Value = 0x01020304;
Params[0].Type = ACPI_TYPE_INTEGER;
Params[0].Integer.Value = 0x01020304;
Params[1].Type = ACPI_TYPE_STRING;
Params[1].String.Length = 12;

View file

@ -2,7 +2,7 @@
*
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
* be used when running the debugger in Ring 0 (Kernel mode)
* $Revision: 35 $
* $Revision: 37 $
*
******************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -286,7 +286,7 @@ AcpiDbLoadTable(
Status = AcpiTbValidateTableHeader (&TableHeader);
if ((ACPI_FAILURE (Status)) ||
(TableHeader.Length > (1024 * 1024)))
(TableHeader.Length > 524288)) /* 1/2 Mbyte should be enough */
{
AcpiOsPrintf ("Table header is invalid!\n");
return (AE_ERROR);

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dbhistry - debugger HISTORY command
* $Revision: 16 $
* $Revision: 17 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbinput - user front-end to the AML debugger
* $Revision: 53 $
* $Revision: 54 $
*
******************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbstats - Generation and display of ACPI table statistics
* $Revision: 36 $
* $Revision: 37 $
*
******************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -508,7 +508,7 @@ AcpiDbDisplayStatistics (
AcpiOsPrintf ("\nInternal object sizes:\n\n");
AcpiOsPrintf ("Common %3d\n", sizeof (ACPI_OBJECT_COMMON));
AcpiOsPrintf ("Number %3d\n", sizeof (ACPI_OBJECT_NUMBER));
AcpiOsPrintf ("Number %3d\n", sizeof (ACPI_OBJECT_INTEGER));
AcpiOsPrintf ("String %3d\n", sizeof (ACPI_OBJECT_STRING));
AcpiOsPrintf ("Buffer %3d\n", sizeof (ACPI_OBJECT_BUFFER));
AcpiOsPrintf ("Package %3d\n", sizeof (ACPI_OBJECT_PACKAGE));

View file

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbutils - AML debugger utilities
* $Revision: 34 $
* $Revision: 35 $
*
******************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -230,8 +230,8 @@ AcpiDbDumpObject (
break;
case ACPI_TYPE_NUMBER:
AcpiOsPrintf ("[Number] Value: %ld (%lX)\n", ObjDesc->Number.Value, ObjDesc->Number.Value);
case ACPI_TYPE_INTEGER:
AcpiOsPrintf ("[Number] Value: %ld (%lX)\n", ObjDesc->Integer.Value, ObjDesc->Integer.Value);
break;

View file

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbxface - AML Debugger external interfaces
* $Revision: 33 $
* $Revision: 34 $
*
******************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsfield - Dispatcher field routines
* $Revision: 30 $
* $Revision: 31 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing
* $Revision: 54 $
* $Revision: 56 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -544,8 +544,9 @@ AcpiDsRestartControlMethod (
}
DEBUG_PRINT (TRACE_DISPATCH,
("DsRestart: Method=%p Return=%p State=%p\n",
WalkState->MethodCallOp, ReturnDesc, WalkState));
("DsRestart: Method=%p Return=%p ReturnUsed?=%X ResStack=%p State=%p\n",
WalkState->MethodCallOp, ReturnDesc, WalkState->ReturnUsed,
WalkState->Results, WalkState));
return_ACPI_STATUS (AE_OK);

View file

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dsmthdat - control method arguments and local variables
* $Revision: 37 $
* $Revision: 39 $
*
******************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -132,7 +132,7 @@
*
* FUNCTION: AcpiDsMethodDataInit
*
* PARAMETERS: *ObjDesc
* PARAMETERS: WalkState - Current walk state object
*
* RETURN: Status
*
@ -193,7 +193,7 @@ AcpiDsMethodDataInit (
*
* FUNCTION: AcpiDsMethodDataDeleteAll
*
* PARAMETERS: None
* PARAMETERS: WalkState - Current walk state object
*
* RETURN: Status
*
@ -268,7 +268,9 @@ AcpiDsMethodDataDeleteAll (
*
* FUNCTION: AcpiDsMethodDataInitArgs
*
* PARAMETERS: None
* PARAMETERS: *Params - Pointer to a parameter list for the method
* MaxParamCount - The arg count for this method
* WalkState - Current walk state object
*
* RETURN: Status
*
@ -340,6 +342,7 @@ AcpiDsMethodDataInitArgs (
* Index - Which localVar or argument to get
* Entry - Pointer to where a pointer to the stack
* entry is returned.
* WalkState - Current walk state object
*
* RETURN: Status
*
@ -415,6 +418,7 @@ AcpiDsMethodDataGetEntry (
* PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG
* Index - Which localVar or argument to get
* Object - Object to be inserted into the stack entry
* WalkState - Current walk state object
*
* RETURN: Status
*
@ -462,6 +466,7 @@ AcpiDsMethodDataSetEntry (
* PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG
* Index - Which localVar or argument whose type
* to get
* WalkState - Current walk state object
*
* RETURN: Data type of selected Arg or Local
* Used only in ExecMonadic2()/TypeOp.
@ -513,6 +518,7 @@ AcpiDsMethodDataGetType (
* PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG
* Index - Which localVar or argument whose type
* to get
* WalkState - Current walk state object
*
* RETURN: Get the Node associated with a local or arg.
*
@ -579,7 +585,8 @@ AcpiDsMethodDataGetNte (
*
* PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG
* Index - Which localVar or argument to get
* *DestDesc - Descriptor into which selected Arg
* WalkState - Current walk state object
* *DestDesc - Ptr to Descriptor into which selected Arg
* or Local value should be copied
*
* RETURN: Status
@ -643,16 +650,20 @@ AcpiDsMethodDataGetValue (
switch (Type)
{
case MTH_TYPE_ARG:
DEBUG_PRINT (ACPI_ERROR,
("DsMethodDataGetValue: Uninitialized Arg[%d] at entry %p\n",
Index, Entry));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
break;
case MTH_TYPE_LOCAL:
DEBUG_PRINT (ACPI_ERROR,
("DsMethodDataGetValue: Uninitialized Local[%d] at entry %p\n",
Index, Entry));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
break;
}
@ -677,6 +688,7 @@ AcpiDsMethodDataGetValue (
*
* PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG
* Index - Which localVar or argument to delete
* WalkState - Current walk state object
*
* RETURN: Status
*
@ -727,7 +739,6 @@ AcpiDsMethodDataDeleteValue (
* Decrement the reference count by one to balance the
* increment when the object was stored in the slot.
*/
AcpiCmRemoveReference (Object);
}
@ -742,18 +753,14 @@ AcpiDsMethodDataDeleteValue (
*
* PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG
* Index - Which localVar or argument to set
* *SrcDesc - Value to be stored
* *DestDesc - Descriptor into which *SrcDesc
* can be copied, or NULL if one must
* be allocated for the purpose. If
* provided, this descriptor will be
* used for the new value.
* SrcDesc - Value to be stored
* WalkState - Current walk state
*
* RETURN: Status
*
* DESCRIPTION: Store a value in an Arg or Local. The SrcDesc is installed
* as the new value for the Arg or Local and the reference count
* is incremented.
* for SrcDesc is incremented.
*
******************************************************************************/
@ -840,7 +847,6 @@ AcpiDsMethodDataSetValue (
* Store this object into the Node
* (do the indirect store)
*/
Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) *Entry, SrcDesc,
SrcDesc->Common.Type);
return_ACPI_STATUS (Status);
@ -848,10 +854,19 @@ AcpiDsMethodDataSetValue (
/*
* Otherwise, just delete the existing object
* Perform "Implicit conversion" of the new object to the type of the
* existing object
*/
Status = AcpiAmlConvertToTargetType ((*Entry)->Common.Type, &SrcDesc, WalkState);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
/*
* Delete the existing object
* before storing the new one
*/
AcpiDsMethodDataDeleteValue (Type, Index, WalkState);
}
@ -862,7 +877,6 @@ AcpiDsMethodDataSetValue (
* Install the new object in the stack entry
* (increments the object reference count by one)
*/
Status = AcpiDsMethodDataSetEntry (Type, Index, SrcDesc, WalkState);
if (ACPI_FAILURE (Status))
{

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
* $Revision: 54 $
* $Revision: 56 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -364,7 +364,7 @@ AcpiDsInitObjectFromOp (
/* We are expecting a number */
if (ArgDesc->Common.Type != ACPI_TYPE_NUMBER)
if (ArgDesc->Common.Type != ACPI_TYPE_INTEGER)
{
DEBUG_PRINT (ACPI_ERROR,
("InitObject: Expecting number, got obj: %p type %X\n",
@ -375,7 +375,7 @@ AcpiDsInitObjectFromOp (
/* Get the value, delete the internal object */
(*ObjDesc)->Buffer.Length = (UINT32) ArgDesc->Number.Value;
(*ObjDesc)->Buffer.Length = (UINT32) ArgDesc->Integer.Value;
AcpiCmRemoveReference (ArgDesc);
/* Allocate the buffer */
@ -439,8 +439,8 @@ AcpiDsInitObjectFromOp (
Status = AcpiDsBuildInternalObject (WalkState, Op, ObjDesc);
break;
case ACPI_TYPE_NUMBER:
(*ObjDesc)->Number.Value = Op->Value.Integer;
case ACPI_TYPE_INTEGER:
(*ObjDesc)->Integer.Value = Op->Value.Integer;
break;
@ -559,19 +559,22 @@ AcpiDsBuildInternalSimpleObj (
if (Name)
{
REPORT_WARNING (("Reference %s AML %X not found\n",
REPORT_WARNING (("Reference %s at AML %X not found\n",
Name, Op->AmlOffset));
AcpiCmFree (Name);
}
else
{
REPORT_WARNING (("Reference %s AML %X not found\n",
REPORT_WARNING (("Reference %s at AML %X not found\n",
Op->Value.String, Op->AmlOffset));
}
*ObjDescPtr = NULL;
}
return_ACPI_STATUS (Status);
else
{
return_ACPI_STATUS (Status);
}
}
}

View file

@ -2,7 +2,7 @@
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
* $Revision: 29 $
* $Revision: 30 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -485,7 +485,7 @@ AcpiDsEvalFieldUnitOperands (
}
Offset = (UINT32) OffDesc->Number.Value;
Offset = (UINT32) OffDesc->Integer.Value;
/*
@ -562,7 +562,7 @@ AcpiDsEvalFieldUnitOperands (
/* Offset is in bits, count is in bits */
BitOffset = Offset;
BitCount = (UINT16) CntDesc->Number.Value;
BitCount = (UINT16) CntDesc->Integer.Value;
break;
@ -753,7 +753,7 @@ AcpiDsEvalRegionOperands (
*/
OperandDesc = WalkState->Operands[WalkState->NumOperands - 1];
ObjDesc->Region.Length = (UINT32) OperandDesc->Number.Value;
ObjDesc->Region.Length = (UINT32) OperandDesc->Integer.Value;
AcpiCmRemoveReference (OperandDesc);
/*
@ -762,7 +762,7 @@ AcpiDsEvalRegionOperands (
*/
OperandDesc = WalkState->Operands[WalkState->NumOperands - 2];
ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) OperandDesc->Number.Value;
ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) OperandDesc->Integer.Value;
AcpiCmRemoveReference (OperandDesc);

View file

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dsutils - Dispatcher utilities
* $Revision: 51 $
* $Revision: 52 $
*
******************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -744,7 +744,7 @@ AcpiDsMapOpcodeToDataType (
case AML_WORD_OP:
case AML_DWORD_OP:
DataType = ACPI_TYPE_NUMBER;
DataType = ACPI_TYPE_INTEGER;
break;

View file

@ -2,7 +2,7 @@
*
* Module Name: dswexec - Dispatcher method execution callbacks;
* dispatch to interpreter.
* $Revision: 51 $
* $Revision: 55 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -138,7 +138,7 @@
*
* RETURN: Status
*
* DESCRIPTION:
* DESCRIPTION: Get the result of a predicate evaluation
*
****************************************************************************/
@ -163,7 +163,7 @@ AcpiDsGetPredicateValue (
if (ACPI_FAILURE (Status))
{
DEBUG_PRINT (ACPI_ERROR,
("DsGetPredicateValue: Missing or null operand, %s\n",
("DsGetPredicateValue: Could not get result from predicate evaluation, %s\n",
AcpiCmFormatException (Status)));
return_ACPI_STATUS (Status);
@ -202,7 +202,7 @@ AcpiDsGetPredicateValue (
* be a number
*/
if (ObjDesc->Common.Type != ACPI_TYPE_NUMBER)
if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER)
{
DEBUG_PRINT (ACPI_ERROR,
("ExecEndOp: Bad predicate (not a number) ObjDesc=%X State=%X Type=%X\n",
@ -213,16 +213,16 @@ AcpiDsGetPredicateValue (
}
/* TBD: 64/32-bit */
/* Truncate the predicate to 32-bits if necessary */
ObjDesc->Number.Value &= (UINT64) 0x00000000FFFFFFFF;
AcpiAmlTruncateFor32bitTable (ObjDesc, WalkState);
/*
* Save the result of the predicate evaluation on
* the control stack
*/
if (ObjDesc->Number.Value)
if (ObjDesc->Integer.Value)
{
WalkState->ControlState->Common.Value = TRUE;
}
@ -471,6 +471,8 @@ AcpiDsExecEndOp (
WalkState->NumOperands = 0;
WalkState->ReturnDesc = NULL;
WalkState->OpInfo = OpInfo;
WalkState->Opcode = Opcode;
/* Call debugger for single step support (DEBUG build only) */

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
* $Revision: 25 $
* $Revision: 26 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswscope - Scope stack manipulation
* $Revision: 41 $
* $Revision: 42 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswstate - Dispatcher parse tree walk management routines
* $Revision: 36 $
* $Revision: 38 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -128,30 +128,6 @@
MODULE_NAME ("dswstate")
/*******************************************************************************
*
* FUNCTION: AcpiDsResultStackClear
*
* PARAMETERS: WalkState - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Reset this walk's result stack pointers to zero, thus setting
* the stack to zero.
*
******************************************************************************/
ACPI_STATUS
xxxAcpiDsResultStackClear (
ACPI_WALK_STATE *WalkState)
{
/*
WalkState->NumResults = 0;
WalkState->CurrentResult = 0;
*/
return (AE_OK);
}
/*******************************************************************************
*
@ -259,7 +235,7 @@ AcpiDsResultRemove (
DEBUG_PRINT (ACPI_ERROR,
("DsResultStackRemove: Null operand! State=%p #Ops=%X, Index=%X\n",
WalkState, State->Results.NumResults, Index));
return (AE_AML_NO_OPERAND);
return (AE_AML_NO_RETURN_VALUE);
}
/* Remove the object */
@ -311,9 +287,9 @@ AcpiDsResultPop (
if (!State->Results.NumResults)
{
DEBUG_PRINT (ACPI_ERROR,
("DsResultPop: No result objects! State=%p\n",
("DsResultPop: Result stack is empty! State=%p\n",
WalkState));
return (AE_STACK_UNDERFLOW);
return (AE_AML_NO_RETURN_VALUE);
}
/* Remove top element */
@ -342,12 +318,12 @@ AcpiDsResultPop (
DEBUG_PRINT (ACPI_ERROR,
("DsResultPop: No result objects! State=%p\n",
WalkState));
return (AE_STACK_UNDERFLOW);
return (AE_AML_NO_RETURN_VALUE);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsResultPop
* FUNCTION: AcpiDsResultPopFromBottom
*
* PARAMETERS: Object - Where to return the popped object
* WalkState - Current Walk state
@ -383,7 +359,7 @@ AcpiDsResultPopFromBottom (
DEBUG_PRINT (ACPI_ERROR,
("DsResultPopFromBottom: No result objects! State=%p\n",
WalkState));
return (AE_STACK_UNDERFLOW);
return (AE_AML_NO_RETURN_VALUE);
}
/* Remove Bottom element */
@ -407,7 +383,7 @@ AcpiDsResultPopFromBottom (
DEBUG_PRINT (ACPI_ERROR,
("DsResultPopFromBottom: Null operand! State=%p #Ops=%X, Index=%X\n",
WalkState, State->Results.NumResults, Index));
return (AE_AML_NO_OPERAND);
return (AE_AML_NO_RETURN_VALUE);
}
DEBUG_PRINT (TRACE_EXEC,
@ -422,15 +398,14 @@ AcpiDsResultPopFromBottom (
/*******************************************************************************
*
* FUNCTION: AcpiDsResultPop
* FUNCTION: AcpiDsResultPush
*
* PARAMETERS: Object - Where to return the popped object
* WalkState - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Pop an object off the bottom of this walk's result stack. In
* other words, this is a FIFO.
* DESCRIPTION: Push an object onto the current result stack
*
******************************************************************************/
@ -445,7 +420,9 @@ AcpiDsResultPush (
State = WalkState->Results;
if (!State)
{
return (AE_OK);
DEBUG_PRINT (ACPI_ERROR,
("DsResultPush: No result stack frame\n"));
return (AE_AML_INTERNAL);
}
if (State->Results.NumResults == OBJ_NUM_OPERANDS)
@ -964,6 +941,7 @@ AcpiDsCreateWalkState (
ACPI_WALK_LIST *WalkList)
{
ACPI_WALK_STATE *WalkState;
ACPI_STATUS Status;
FUNCTION_TRACE ("DsCreateWalkState");
@ -987,7 +965,7 @@ AcpiDsCreateWalkState (
DEBUG_PRINT (TRACE_EXEC, ("DsCreateWalkState: State %p from cache\n", WalkState));
AcpiCmReleaseMutex (ACPI_MTX_CACHES);
}
}
else
{
@ -1015,6 +993,15 @@ AcpiDsCreateWalkState (
AcpiDsMethodDataInit (WalkState);
#endif
/* Create an initial result stack entry */
Status = AcpiDsResultStackPush (WalkState);
if (ACPI_FAILURE (Status))
{
return_VALUE (NULL);
}
/* Put the new state at the head of the walk list */
AcpiDsPushWalkState (WalkState, WalkList);

View file

@ -2,7 +2,7 @@
*
* Module Name: evevent - Fixed and General Purpose AcpiEvent
* handling and dispatch
* $Revision: 32 $
* $Revision: 33 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -2,7 +2,7 @@
*
* Module Name: evmisc - ACPI device notification handler dispatch
* and ACPI Global Lock support
* $Revision: 21 $
* $Revision: 22 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evregion - ACPI AddressSpace (OpRegion) handler dispatch
* $Revision: 93 $
* $Revision: 94 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -217,8 +217,8 @@ AcpiEvExecuteRegMethod (
UINT32 Function)
{
ACPI_OPERAND_OBJECT *Params[3];
ACPI_OPERAND_OBJECT SpaceID_Obj;
ACPI_OPERAND_OBJECT Function_Obj;
ACPI_OPERAND_OBJECT SpaceIdDesc;
ACPI_OPERAND_OBJECT FunctionDesc;
ACPI_STATUS Status;
@ -240,24 +240,24 @@ AcpiEvExecuteRegMethod (
* Passed as a parameter
*/
AcpiCmInitStaticObject (&SpaceID_Obj);
AcpiCmInitStaticObject (&Function_Obj);
AcpiCmInitStaticObject (&SpaceIdDesc);
AcpiCmInitStaticObject (&FunctionDesc);
/*
* Method requires two parameters.
*/
Params [0] = &SpaceID_Obj;
Params [1] = &Function_Obj;
Params [0] = &SpaceIdDesc;
Params [1] = &FunctionDesc;
Params [2] = NULL;
/*
* Set up the parameter objects
*/
SpaceID_Obj.Common.Type = ACPI_TYPE_NUMBER;
SpaceID_Obj.Number.Value = RegionObj->Region.SpaceId;
SpaceIdDesc.Common.Type = ACPI_TYPE_INTEGER;
SpaceIdDesc.Integer.Value = RegionObj->Region.SpaceId;
Function_Obj.Common.Type = ACPI_TYPE_NUMBER;
Function_Obj.Number.Value = Function;
FunctionDesc.Common.Type = ACPI_TYPE_INTEGER;
FunctionDesc.Integer.Value = Function;
/*
* Execute the method, no return value

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evrgnini- ACPI AddressSpace (OpRegion) init
* $Revision: 32 $
* $Revision: 33 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -2,7 +2,7 @@
*
* Module Name: evsci - System Control Interrupt configuration and
* legacy to ACPI mode state transition functions
* $Revision: 68 $
* $Revision: 69 $
*
******************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evxface - External interfaces for ACPI events
* $Revision: 98 $
* $Revision: 101 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -304,10 +304,10 @@ AcpiInstallNotifyHandler (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Convert and validate the device handle */
AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
/* Convert and validate the device handle */
DeviceNode = AcpiNsConvertHandleToEntry (Device);
if (!DeviceNode)
{
@ -315,17 +315,16 @@ AcpiInstallNotifyHandler (
goto UnlockAndExit;
}
/*
* Support for global notify handlers. These handlers are invoked for
* every notifiy of the type specifiec
* Root Object:
* ------------
* Registering a notify handler on the root object indicates that the
* caller wishes to receive notifications for all objects. Note that
* only one <external> global handler can be regsitered (per notify type).
*/
if (Device == ACPI_ROOT_OBJECT)
{
/*
* Make sure the handler is not already installed.
*/
/* Make sure the handler is not already installed */
if (((HandlerType == ACPI_SYSTEM_NOTIFY) &&
AcpiGbl_SysNotify.Handler) ||
@ -342,103 +341,98 @@ AcpiInstallNotifyHandler (
AcpiGbl_SysNotify.Handler = Handler;
AcpiGbl_SysNotify.Context = Context;
}
else
else /* ACPI_DEVICE_NOTIFY */
{
AcpiGbl_DrvNotify.Node = DeviceNode;
AcpiGbl_DrvNotify.Handler = Handler;
AcpiGbl_DrvNotify.Context = Context;
}
/* Global notify handler installed */
goto UnlockAndExit;
}
/*
* These are the ONLY objects that can receive ACPI notifications
* Other Objects:
* --------------
* Caller will only receive notifications specific to the target object.
* Note that only certain object types can receive notifications.
*/
if ((DeviceNode->Type != ACPI_TYPE_DEVICE) &&
(DeviceNode->Type != ACPI_TYPE_PROCESSOR) &&
(DeviceNode->Type != ACPI_TYPE_POWER) &&
(DeviceNode->Type != ACPI_TYPE_THERMAL))
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
/* Check for an existing internal object */
ObjDesc = AcpiNsGetAttachedObject ((ACPI_HANDLE) DeviceNode);
if (ObjDesc)
{
else {
/*
* The object exists.
* Make sure the handler is not already installed.
* These are the ONLY objects that can receive ACPI notifications
*/
if (((HandlerType == ACPI_SYSTEM_NOTIFY) &&
ObjDesc->Device.SysHandler) ||
((HandlerType == ACPI_DEVICE_NOTIFY) &&
ObjDesc->Device.DrvHandler))
if ((DeviceNode->Type != ACPI_TYPE_DEVICE) &&
(DeviceNode->Type != ACPI_TYPE_PROCESSOR) &&
(DeviceNode->Type != ACPI_TYPE_POWER) &&
(DeviceNode->Type != ACPI_TYPE_THERMAL))
{
Status = AE_EXIST;
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
}
else
{
/* Create a new object */
/* Check for an existing internal object */
ObjDesc = AcpiCmCreateInternalObject (DeviceNode->Type);
if (!ObjDesc)
ObjDesc = AcpiNsGetAttachedObject ((ACPI_HANDLE) DeviceNode);
if (ObjDesc)
{
/* Object exists - make sure there's no handler */
if (((HandlerType == ACPI_SYSTEM_NOTIFY) &&
ObjDesc->Device.SysHandler) ||
((HandlerType == ACPI_DEVICE_NOTIFY) &&
ObjDesc->Device.DrvHandler))
{
Status = AE_EXIST;
goto UnlockAndExit;
}
}
else
{
/* Create a new object */
ObjDesc = AcpiCmCreateInternalObject (DeviceNode->Type);
if (!ObjDesc)
{
Status = AE_NO_MEMORY;
goto UnlockAndExit;
}
/* Attach new object to the Node */
Status = AcpiNsAttachObject (Device, ObjDesc, (UINT8) DeviceNode->Type);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
}
/* Install the handler */
NotifyObj = AcpiCmCreateInternalObject (INTERNAL_TYPE_NOTIFY);
if (!NotifyObj)
{
Status = AE_NO_MEMORY;
goto UnlockAndExit;
}
/* Attach new object to the Node */
NotifyObj->NotifyHandler.Node = DeviceNode;
NotifyObj->NotifyHandler.Handler = Handler;
NotifyObj->NotifyHandler.Context = Context;
Status = AcpiNsAttachObject (Device, ObjDesc, (UINT8) DeviceNode->Type);
if (ACPI_FAILURE (Status))
if (HandlerType == ACPI_SYSTEM_NOTIFY)
{
goto UnlockAndExit;
ObjDesc->Device.SysHandler = NotifyObj;
}
else /* ACPI_DEVICE_NOTIFY */
{
ObjDesc->Device.DrvHandler = NotifyObj;
}
}
/*
* If we get here, we know that there is no handler installed
* so let's party
*/
NotifyObj = AcpiCmCreateInternalObject (INTERNAL_TYPE_NOTIFY);
if (!NotifyObj)
{
Status = AE_NO_MEMORY;
goto UnlockAndExit;
}
NotifyObj->NotifyHandler.Node = DeviceNode;
NotifyObj->NotifyHandler.Handler = Handler;
NotifyObj->NotifyHandler.Context = Context;
if (HandlerType == ACPI_SYSTEM_NOTIFY)
{
ObjDesc->Device.SysHandler = NotifyObj;
}
else
{
ObjDesc->Device.DrvHandler = NotifyObj;
}
UnlockAndExit:
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
@ -471,10 +465,8 @@ AcpiRemoveNotifyHandler (
ACPI_NAMESPACE_NODE *DeviceNode;
ACPI_STATUS Status = AE_OK;
FUNCTION_TRACE ("AcpiRemoveNotifyHandler");
/* Parameter validation */
if ((!Handler) ||
@ -495,68 +487,99 @@ AcpiRemoveNotifyHandler (
}
/*
* These are the ONLY objects that can receive ACPI notifications
* Root Object:
* ------------
*/
if (Device == ACPI_ROOT_OBJECT) {
if ((DeviceNode->Type != ACPI_TYPE_DEVICE) &&
(DeviceNode->Type != ACPI_TYPE_PROCESSOR) &&
(DeviceNode->Type != ACPI_TYPE_POWER) &&
(DeviceNode->Type != ACPI_TYPE_THERMAL))
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
DEBUG_PRINT(ACPI_INFO, ("Removing notify handler for ROOT object.\n"));
/* Check for an existing internal object */
if (((HandlerType == ACPI_SYSTEM_NOTIFY) &&
!AcpiGbl_SysNotify.Handler) ||
((HandlerType == ACPI_DEVICE_NOTIFY) &&
!AcpiGbl_DrvNotify.Handler))
{
Status = AE_NOT_EXIST;
goto UnlockAndExit;
}
ObjDesc = AcpiNsGetAttachedObject ((ACPI_HANDLE) DeviceNode);
if (!ObjDesc)
{
Status = AE_NOT_EXIST;
goto UnlockAndExit;
if (HandlerType == ACPI_SYSTEM_NOTIFY) {
AcpiGbl_SysNotify.Node = NULL;
AcpiGbl_SysNotify.Handler = NULL;
AcpiGbl_SysNotify.Context = NULL;
}
else {
AcpiGbl_DrvNotify.Node = NULL;
AcpiGbl_DrvNotify.Handler = NULL;
AcpiGbl_DrvNotify.Context = NULL;
}
}
/*
* The object exists.
*
* Make sure the handler is installed.
* Other Objects:
* --------------
*/
else {
/*
* These are the ONLY objects that can receive ACPI notifications
*/
if ((DeviceNode->Type != ACPI_TYPE_DEVICE) &&
(DeviceNode->Type != ACPI_TYPE_PROCESSOR) &&
(DeviceNode->Type != ACPI_TYPE_POWER) &&
(DeviceNode->Type != ACPI_TYPE_THERMAL))
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
if (HandlerType == ACPI_SYSTEM_NOTIFY)
{
NotifyObj = ObjDesc->Device.SysHandler;
}
else
{
NotifyObj = ObjDesc->Device.DrvHandler;
/* Check for an existing internal object */
ObjDesc = AcpiNsGetAttachedObject ((ACPI_HANDLE) DeviceNode);
if (!ObjDesc)
{
Status = AE_NOT_EXIST;
goto UnlockAndExit;
}
/* Object exists - make sure there's an existing handler */
if (HandlerType == ACPI_SYSTEM_NOTIFY)
{
NotifyObj = ObjDesc->Device.SysHandler;
}
else
{
NotifyObj = ObjDesc->Device.DrvHandler;
}
if ((!NotifyObj) ||
(NotifyObj->NotifyHandler.Handler != Handler))
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
/* Remove the handler */
if (HandlerType == ACPI_SYSTEM_NOTIFY)
{
ObjDesc->Device.SysHandler = NULL;
}
else
{
ObjDesc->Device.DrvHandler = NULL;
}
AcpiCmRemoveReference (NotifyObj);
}
if ((!NotifyObj) ||
(NotifyObj->NotifyHandler.Handler != Handler))
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
/*
* Now we can remove the handler
*/
if (HandlerType == ACPI_SYSTEM_NOTIFY)
{
ObjDesc->Device.SysHandler = NULL;
}
else
{
ObjDesc->Device.DrvHandler = NULL;
}
AcpiCmRemoveReference (NotifyObj);
UnlockAndExit:
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
/******************************************************************************
*
* FUNCTION: AcpiInstallGpeHandler

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
* $Revision: 27 $
* $Revision: 28 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -2,7 +2,7 @@
*
* Module Name: evxfregn - External Interfaces, ACPI Operation Regions and
* Address Spaces.
* $Revision: 26 $
* $Revision: 27 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,8 @@
/******************************************************************************
*
* Module Name: hwacpi - ACPI hardware functions - mode and timer
* $Revision: 34 $
* Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface
* $Revision: 36 $
*
*****************************************************************************/
@ -9,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -239,7 +240,7 @@ AcpiHwInitialize (
* block is not fixed, so the buffer must be allocated with malloc
*/
if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) &&
if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) &&
AcpiGbl_FADT->Gpe0BlkLen)
{
/* GPE0 specified in FADT */
@ -265,7 +266,7 @@ AcpiHwInitialize (
AcpiGbl_Gpe0EnableRegisterSave = NULL;
}
if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) &&
if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) &&
AcpiGbl_FADT->Gpe1BlkLen)
{
/* GPE1 defined */
@ -443,53 +444,3 @@ AcpiHwGetModeCapabilities (void)
}
/******************************************************************************
*
* FUNCTION: AcpiHwPmtTicks
*
* PARAMETERS: none
*
* RETURN: Current value of the ACPI PMT (timer)
*
* DESCRIPTION: Obtains current value of ACPI PMT
*
******************************************************************************/
UINT32
AcpiHwPmtTicks (void)
{
UINT32 Ticks;
FUNCTION_TRACE ("AcpiPmtTicks");
Ticks = AcpiOsIn32 ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (AcpiGbl_FADT->XPmTmrBlk.Address));
return_VALUE (Ticks);
}
/******************************************************************************
*
* FUNCTION: AcpiHwPmtResolution
*
* PARAMETERS: none
*
* RETURN: Number of bits of resolution in the PMT (either 24 or 32)
*
* DESCRIPTION: Obtains resolution of the ACPI PMT (either 24bit or 32bit)
*
******************************************************************************/
UINT32
AcpiHwPmtResolution (void)
{
FUNCTION_TRACE ("AcpiPmtResolution");
if (0 == AcpiGbl_FADT->TmrValExt)
{
return_VALUE (24);
}
return_VALUE (32);
}

View file

@ -1,7 +1,8 @@
/******************************************************************************
*
* Module Name: hwgpe - Low level GPE enable/disable/clear functions
* $Revision: 26 $
* $Revision: 28 $
*
*****************************************************************************/
@ -9,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -3,7 +3,7 @@
*
* Module Name: hwregs - Read/write access functions for the various ACPI
* control and status registers.
* $Revision: 86 $
* $Revision: 88 $
*
******************************************************************************/
@ -11,7 +11,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -129,7 +129,7 @@
/* This matches the #defines in actypes.h. */
NATIVE_CHAR *SleepStateTable[] = {"\\_S0_","\\_S1_","\\_S2_","\\_S3_",
"\\_S4_","\\_S4B","\\_S5_"};
"\\_S4_","\\_S5_","\\_S4B"};
/*******************************************************************************
@ -145,7 +145,7 @@ NATIVE_CHAR *SleepStateTable[] = {"\\_S0_","\\_S1_","\\_S2_","\\
*
******************************************************************************/
static UINT32
UINT32
AcpiHwGetBitShift (
UINT32 Mask)
{
@ -300,9 +300,9 @@ AcpiHwObtainSleepTypeRegisterData (
}
else if (((ObjDesc->Package.Elements[0])->Common.Type !=
ACPI_TYPE_NUMBER) ||
ACPI_TYPE_INTEGER) ||
((ObjDesc->Package.Elements[1])->Common.Type !=
ACPI_TYPE_NUMBER))
ACPI_TYPE_INTEGER))
{
/* Must have two */
@ -315,9 +315,9 @@ AcpiHwObtainSleepTypeRegisterData (
/*
* Valid _Sx_ package size, type, and value
*/
*Slp_TypA = (UINT8) (ObjDesc->Package.Elements[0])->Number.Value;
*Slp_TypA = (UINT8) (ObjDesc->Package.Elements[0])->Integer.Value;
*Slp_TypB = (UINT8) (ObjDesc->Package.Elements[1])->Number.Value;
*Slp_TypB = (UINT8) (ObjDesc->Package.Elements[1])->Integer.Value;
}
@ -733,15 +733,8 @@ AcpiHwRegisterRead (
case PM1_CONTROL: /* 16-bit access */
if (RegisterId != SLP_TYPE_B)
{
Value |= AcpiHwLowLevelRead (16, &AcpiGbl_FADT->XPm1aCntBlk, 0);
}
if (RegisterId != SLP_TYPE_A)
{
Value |= AcpiHwLowLevelRead (16, &AcpiGbl_FADT->XPm1bCntBlk, 0);
}
Value = AcpiHwLowLevelRead (16, &AcpiGbl_FADT->XPm1aCntBlk, 0);
Value |= AcpiHwLowLevelRead (16, &AcpiGbl_FADT->XPm1bCntBlk, 0);
break;
@ -854,35 +847,20 @@ AcpiHwRegisterWrite (
case PM1_CONTROL: /* 16-bit access */
/*
* If SLP_TYP_A or SLP_TYP_B, only write to one reg block.
* Otherwise, write to both.
*/
if (RegisterId == SLP_TYPE_A)
{
AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aCntBlk, 0);
}
else if (RegisterId == SLP_TYPE_B)
{
AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bCntBlk, 0);
}
else
{
/* disable/re-enable interrupts if sleeping */
if (RegisterId == SLP_EN)
{
disable();
}
AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aCntBlk, 0);
AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bCntBlk, 0);
break;
AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aCntBlk, 0);
AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bCntBlk, 0);
if (RegisterId == SLP_EN)
{
enable();
}
}
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;

View file

@ -0,0 +1,296 @@
/******************************************************************************
*
* Name: hwsleep.c - ACPI Hardware Sleep/Wake 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 "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));
/* the old version was disabling interrupts. let's try it without
* and see how that works
*/
/*disable();*/
AcpiHwRegisterWrite(ACPI_MTX_LOCK, PM1A_CONTROL, PM1AControl);
AcpiHwRegisterWrite(ACPI_MTX_LOCK, PM1B_CONTROL, PM1BControl);
/*enable();*/
return_ACPI_STATUS (AE_OK);
}

View file

@ -0,0 +1,302 @@
/******************************************************************************
*
* Name: hwtimer.c - ACPI Power Management Timer Interface
* $Revision: 4 $
*
*****************************************************************************/
/******************************************************************************
*
* 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 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;
}
/* 32-bit Timer */
else
{
DeltaTicks = (0xFFFFFFFF - StartTicks) + EndTicks;
}
}
/*
* 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);
}

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: accommon.h -- prototypes for the common (subsystem-wide) procedures
* $Revision: 83 $
* $Revision: 87 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -191,6 +191,8 @@ AcpiCmAllocateOwnerId (
* CmClib - Local implementations of C library functions
*/
#ifndef ACPI_USE_SYSTEM_CLIBRARY
NATIVE_UINT
AcpiCmStrlen (
const NATIVE_CHAR *String);
@ -232,7 +234,7 @@ UINT32
AcpiCmStrtoul (
const NATIVE_CHAR *String,
NATIVE_CHAR **Terminator,
UINT32 Base);
NATIVE_UINT Base);
NATIVE_CHAR *
AcpiCmStrstr (
@ -252,7 +254,7 @@ AcpiCmMemcpy (
void *
AcpiCmMemset (
void *Dest,
UINT32 Value,
NATIVE_UINT Value,
NATIVE_UINT Count);
UINT32
@ -263,6 +265,7 @@ UINT32
AcpiCmToLower (
UINT32 c);
#endif /* ACPI_USE_SYSTEM_CLIBRARY */
/*
* CmCopy - Object construction and conversion interfaces
@ -388,7 +391,7 @@ FunctionValueExit (
UINT32 LineNumber,
UINT32 ComponentId,
NATIVE_CHAR *FunctionName,
NATIVE_UINT Value);
ACPI_INTEGER Value);
void
FunctionPtrExit (
@ -687,7 +690,7 @@ AcpiCmInitStaticObject (
#define AcpiCmCallocate(a) _CmCallocate(a, _COMPONENT,_THIS_MODULE,__LINE__)
#define AcpiCmFree(a) _CmFree(a,_COMPONENT,_THIS_MODULE,__LINE__)
#ifndef ACPI_DEBUG
#ifndef ACPI_DEBUG_TRACK_ALLOCATIONS
#define AcpiCmAddElementToAllocList(a,b,c,d,e,f)
#define AcpiCmDeleteElementFromAllocList(a,b,c,d)

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
* $Revision: 49 $
* $Revision: 53 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -144,7 +144,7 @@
/* Version string */
#define ACPI_CA_VERSION __DATE__
#define ACPI_CA_VERSION 0x20010125
/* Maximum objects in the various object caches */
@ -213,6 +213,10 @@
#define MTH_NUM_ARGS 7
#define MTH_MAX_ARG 6
/* Maximum length of resulting string when converting from a buffer */
#define ACPI_MAX_STRING_CONVERSION 200
/*
* Operand Stack (in WALK_STATE), Must be large enough to contain MTH_MAX_ARG
*/

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdebug.h - ACPI/AML debugger
* $Revision: 38 $
* $Revision: 39 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdispat.h - dispatcher (parser to interpreter interface)
* $Revision: 34 $
* $Revision: 35 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acefi.h - OS specific defines, etc.
* $Revision: 5 $
* $Revision: 6 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acenv.h - Generation environment specific items
* $Revision: 66 $
* $Revision: 70 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -119,7 +119,7 @@
/*
* Configuration for ACPI Utilities
* Configuration for ACPI tools and utilities
*/
#ifdef _ACPI_DUMP_APP
@ -146,6 +146,16 @@
#define ACPI_USE_SYSTEM_CLIBRARY
#endif
/*
* Memory allocation tracking. Used only if
* 1) This is the debug version
* 2) This is NOT a 16-bit version of the code (not enough real-mode memory)
*/
#ifdef ACPI_DEBUG
#ifndef _IA16
#define ACPI_DEBUG_TRACK_ALLOCATIONS
#endif
#endif
/*
* Environment configuration. The purpose of this file is to interface to the
@ -245,17 +255,17 @@
#define STRUPR(s) strupr((s))
#define STRLEN(s) strlen((s))
#define STRCPY(d,s) strcpy((d), (s))
#define STRNCPY(d,s,n) strncpy((d), (s), (n))
#define STRNCMP(d,s,n) strncmp((d), (s), (n))
#define STRNCPY(d,s,n) strncpy((d), (s), (NATIVE_INT)(n))
#define STRNCMP(d,s,n) strncmp((d), (s), (NATIVE_INT)(n))
#define STRCMP(d,s) strcmp((d), (s))
#define STRCAT(d,s) strcat((d), (s))
#define STRNCAT(d,s,n) strncat((d), (s), (n))
#define STRTOUL(d,s,n) strtoul((d), (s), (n))
#define MEMCPY(d,s,n) memcpy((d), (s), (n))
#define MEMSET(d,s,n) memset((d), (s), (n))
#define STRNCAT(d,s,n) strncat((d), (s), (NATIVE_INT)(n))
#define STRTOUL(d,s,n) strtoul((d), (s), (NATIVE_INT)(n))
#define MEMCPY(d,s,n) memcpy((d), (s), (NATIVE_INT)(n))
#define MEMSET(d,s,n) memset((d), (s), (NATIVE_INT)(n))
#define TOUPPER toupper
#define TOLOWER tolower
#define IS_XDIGIT isxdigit
/******************************************************************************
*

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acevents.h - Event subcomponent prototypes and defines
* $Revision: 62 $
* $Revision: 63 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acexcep.h - Exception codes returned by the ACPI subsystem
* $Revision: 38 $
* $Revision: 41 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -207,8 +207,10 @@
#define AE_AML_NAME_NOT_FOUND (ACPI_STATUS) (0x0010 | AE_CODE_AML)
#define AE_AML_INTERNAL (ACPI_STATUS) (0x0011 | AE_CODE_AML)
#define AE_AML_INVALID_SPACE_ID (ACPI_STATUS) (0x0012 | AE_CODE_AML)
#define AE_AML_STRING_LIMIT (ACPI_STATUS) (0x0013 | AE_CODE_AML)
#define AE_AML_NO_RETURN_VALUE (ACPI_STATUS) (0x0014 | AE_CODE_AML)
#define AE_CODE_AML_MAX 0x0012
#define AE_CODE_AML_MAX 0x0014
/*
* Internal exceptions used for control
@ -293,6 +295,8 @@ static NATIVE_CHAR *AcpiGbl_ExceptionNames_Aml[] =
"AE_AML_NAME_NOT_FOUND",
"AE_AML_INTERNAL",
"AE_AML_INVALID_SPACE_ID",
"AE_AML_STRING_LIMIT",
"AE_AML_NO_RETURN_VALUE",
};
static NATIVE_CHAR *AcpiGbl_ExceptionNames_Ctrl[] =

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acfreebsd.h - OS specific defines, etc.
* $Revision: 2 $
* $Revision: 4 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acgcc.h - GCC specific defines, etc.
* $Revision: 3 $
* $Revision: 4 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acglobal.h - Declarations for global variables
* $Revision: 93 $
* $Revision: 96 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -245,7 +245,6 @@ ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockSet; /* TBD: [Restruct
ACPI_EXTERN BOOLEAN AcpiGbl_StepToNextCall;
ACPI_EXTERN BOOLEAN AcpiGbl_AcpiHardwarePresent;
ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_DrvNotify;
ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_SysNotify;
@ -253,7 +252,8 @@ ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_SysNotify;
extern BOOLEAN AcpiGbl_Shutdown;
extern UINT32 AcpiGbl_SystemFlags;
extern UINT32 AcpiGbl_StartupFlags;
extern UINT8 AcpiGbl_DecodeTo8bit[];
extern UINT8 AcpiGbl_DecodeTo8bit[8];
extern NATIVE_CHAR AcpiGbl_HexToAscii[];
/*****************************************************************************

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: achware.h -- hardware specific interfaces
* $Revision: 49 $
* $Revision: 53 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,6 +118,10 @@
#define __ACHWARE_H__
/* PM Timer ticks per second (HZ) */
#define PM_TIMER_FREQUENCY 3579545
/* Prototypes */
@ -183,6 +187,11 @@ void
AcpiHwClearAcpiStatus (
void);
UINT32
AcpiHwGetBitShift (
UINT32 Mask);
/* GPE support */
@ -212,89 +221,21 @@ AcpiHwObtainSleepTypeRegisterData (
UINT8 *Slp_TypB);
/* Cx State Prototypes */
ACPI_STATUS
AcpiHwEnterC1(
ACPI_IO_ADDRESS PblkAddress,
UINT32 *PmTimerTicks);
ACPI_STATUS
AcpiHwEnterC2(
ACPI_IO_ADDRESS PblkAddress,
UINT32 *PmTimerTicks);
ACPI_STATUS
AcpiHwEnterC3(
ACPI_IO_ADDRESS PblkAddress,
UINT32 *PmTimerTicks);
ACPI_STATUS
AcpiHwEnterCx (
ACPI_IO_ADDRESS PblkAddress,
UINT32 *PmTimerTicks);
ACPI_STATUS
AcpiHwSetCx (
UINT32 CxState);
ACPI_STATUS
AcpiHwGetCxInfo (
UINT32 CxStates[]);
ACPI_STATUS
AcpiHwGetCxHandler (
UINT32 CxState,
ACPI_C_STATE_HANDLER *Handler);
ACPI_STATUS
AcpiHwSetCxHandler (
UINT32 CxState,
ACPI_C_STATE_HANDLER Handler);
/* Throttling Prototypes */
void
AcpiHwEnableThrottling (
ACPI_IO_ADDRESS PblkAddress);
void
AcpiHwDisableThrottling (
ACPI_IO_ADDRESS PblkAddress);
UINT32
AcpiHwGetDutyCycle (
UINT8 DutyOffset,
ACPI_IO_ADDRESS PblkAddress,
UINT32 NumThrottleStates);
void
AcpiHwProgramDutyCycle (
UINT8 DutyOffset,
UINT32 DutyCycle,
ACPI_IO_ADDRESS PblkAddress,
UINT32 NumThrottleStates);
NATIVE_UINT
AcpiHwLocalPow (
NATIVE_UINT x,
NATIVE_UINT y);
/* ACPI Timer prototypes */
UINT32
AcpiHwPmtTicks (
void);
UINT32
AcpiHwPmtResolution (
void);
ACPI_STATUS
AcpiGetTimerResolution (
UINT32 *Resolution);
ACPI_STATUS
AcpiGetTimer (
UINT32 *OutTicks);
UINT32 *Ticks);
ACPI_STATUS
AcpiGetTimerDuration (
UINT32 StartTicks,
UINT32 EndTicks,
UINT32 *TimeElapsed);
#endif /* __ACHWARE_H__ */

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acinterp.h - Interpreter subcomponent prototypes and defines
* $Revision: 87 $
* $Revision: 91 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -138,6 +138,7 @@
#define METHOD_DELETE_AT_COMPLETION 0x2
ACPI_STATUS
AcpiAmlResolveOperands (
UINT16 Opcode,
@ -161,9 +162,34 @@ AcpiAmlExecuteMethod (
/*
* amfield - ACPI AML (p-code) execution - field manipulation
* amconvrt - object conversion
*/
ACPI_STATUS
AcpiAmlConvertToInteger (
ACPI_OPERAND_OBJECT **ObjDesc,
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
AcpiAmlConvertToBuffer (
ACPI_OPERAND_OBJECT **ObjDesc,
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
AcpiAmlConvertToString (
ACPI_OPERAND_OBJECT **ObjDesc,
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
AcpiAmlConvertToTargetType (
OBJECT_TYPE_INTERNAL DestinationType,
ACPI_OPERAND_OBJECT **ObjDesc,
ACPI_WALK_STATE *WalkState);
/*
* amfield - ACPI AML (p-code) execution - field manipulation
*/
ACPI_STATUS
AcpiAmlReadField (
@ -510,17 +536,75 @@ AcpiAmlExecStore (
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
AcpiAmlStoreObjectToObject (
AcpiAmlStoreObjectToIndex (
ACPI_OPERAND_OBJECT *ValDesc,
ACPI_OPERAND_OBJECT *DestDesc,
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
AcpiAmlStoreObjectToNode (
ACPI_OPERAND_OBJECT *ValDesc,
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_NAMESPACE_NODE *Node,
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
AcpiAmlStoreObjectToObject (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *DestDesc,
ACPI_WALK_STATE *WalkState);
/*
*
*/
ACPI_STATUS
AcpiAmlResolveObject (
ACPI_OPERAND_OBJECT **SourceDescPtr,
OBJECT_TYPE_INTERNAL TargetType,
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
AcpiAmlStoreObject (
ACPI_OPERAND_OBJECT *SourceDesc,
OBJECT_TYPE_INTERNAL TargetType,
ACPI_OPERAND_OBJECT **TargetDescPtr,
ACPI_WALK_STATE *WalkState);
/*
* amcopy - object copy
*/
ACPI_STATUS
AcpiAmlCopyBufferToBuffer (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *TargetDesc);
ACPI_STATUS
AcpiAmlCopyStringToString (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *TargetDesc);
ACPI_STATUS
AcpiAmlCopyIntegerToIndexField (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *TargetDesc);
ACPI_STATUS
AcpiAmlCopyIntegerToBankField (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *TargetDesc);
ACPI_STATUS
AcpiAmlCopyDataToNamedField (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_NAMESPACE_NODE *Node);
ACPI_STATUS
AcpiAmlCopyIntegerToFieldUnit (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *TargetDesc);
/*
* amutils - interpreter/scanner utilities

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: aclinux.h - OS specific defines, etc.
* $Revision: 6 $
* $Revision: 7 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
* $Revision: 94 $
* $Revision: 100 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -165,7 +165,7 @@ typedef UINT32 ACPI_MUTEX_HANDLE;
#define NUM_MTX MAX_MTX+1
#ifdef ACPI_DEBUG
#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
#ifdef DEFINE_ACPI_GLOBALS
/* Names for the mutexes used in the subsystem */
@ -269,8 +269,11 @@ typedef struct acpi_node
#define ANOBJ_AML_ATTACHMENT 0x01
#define ANOBJ_END_OF_PEER_LIST 0x02
#define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */
#define ANOBJ_METHOD_ARG 0x40
#define ANOBJ_METHOD_LOCAL 0x80
#define ANOBJ_METHOD_ARG 0x08
#define ANOBJ_METHOD_LOCAL 0x10
#define ANOBJ_METHOD_NO_RETVAL 0x20
#define ANOBJ_METHOD_SOME_NO_RETVAL 0x40
/*
* ACPI Table Descriptor. One per ACPI table
@ -564,7 +567,9 @@ typedef struct acpi_opcode_info
UINT32 ParseArgs; /* Grammar/Parse time arguments */
UINT32 RuntimeArgs; /* Interpret time arguments */
DEBUG_ONLY_MEMBERS (NATIVE_CHAR *Name) /* op name (debug only) */
#ifdef _OPCODE_NAMES
NATIVE_CHAR *Name; /* op name (debug only) */
#endif
} ACPI_OPCODE_INFO;
@ -679,6 +684,7 @@ typedef struct acpi_walk_state
ACPI_GENERIC_STATE *ScopeInfo; /* Stack of nested scopes */
ACPI_PARSE_STATE *ParserState; /* Current state of parser */
UINT8 *AmlLastWhile;
ACPI_OPCODE_INFO *OpInfo; /* Info on current opcode */
ACPI_PARSE_DOWNWARDS DescendingCallback;
ACPI_PARSE_UPWARDS AscendingCallback;
@ -693,6 +699,7 @@ typedef struct acpi_walk_state
UINT32 ParseFlags;
UINT8 WalkType;
UINT8 ReturnUsed;
UINT16 Opcode; /* Current AML opcode */
UINT32 PrevArgTypes;
/* Debug support */
@ -816,14 +823,16 @@ typedef struct acpi_get_devices_info
#define PM1_STS 0x0100
#define PM1_EN 0x0200
#define PM1_CONTROL 0x0300
#define PM2_CONTROL 0x0400
#define PM_TIMER 0x0500
#define PROCESSOR_BLOCK 0x0600
#define GPE0_STS_BLOCK 0x0700
#define GPE0_EN_BLOCK 0x0800
#define GPE1_STS_BLOCK 0x0900
#define GPE1_EN_BLOCK 0x0A00
#define SMI_CMD_BLOCK 0x0B00
#define PM1A_CONTROL 0x0400
#define PM1B_CONTROL 0x0500
#define PM2_CONTROL 0x0600
#define PM_TIMER 0x0700
#define PROCESSOR_BLOCK 0x0800
#define GPE0_STS_BLOCK 0x0900
#define GPE0_EN_BLOCK 0x0A00
#define GPE1_STS_BLOCK 0x0B00
#define GPE1_EN_BLOCK 0x0C00
#define SMI_CMD_BLOCK 0x0D00
/*
* Address space bitmasks for mmio or io spaces
@ -839,66 +848,66 @@ typedef struct acpi_get_devices_info
/*
* Control bit definitions
*/
#define TMR_STS (PM1_STS | 0x01)
#define BM_STS (PM1_STS | 0x02)
#define GBL_STS (PM1_STS | 0x03)
#define PWRBTN_STS (PM1_STS | 0x04)
#define SLPBTN_STS (PM1_STS | 0x05)
#define RTC_STS (PM1_STS | 0x06)
#define WAK_STS (PM1_STS | 0x07)
#define TMR_STS (PM1_STS | 0x01)
#define BM_STS (PM1_STS | 0x02)
#define GBL_STS (PM1_STS | 0x03)
#define PWRBTN_STS (PM1_STS | 0x04)
#define SLPBTN_STS (PM1_STS | 0x05)
#define RTC_STS (PM1_STS | 0x06)
#define WAK_STS (PM1_STS | 0x07)
#define TMR_EN (PM1_EN | 0x01)
/* no BM_EN */
#define GBL_EN (PM1_EN | 0x03)
#define PWRBTN_EN (PM1_EN | 0x04)
#define SLPBTN_EN (PM1_EN | 0x05)
#define RTC_EN (PM1_EN | 0x06)
#define WAK_EN (PM1_EN | 0x07)
#define TMR_EN (PM1_EN | 0x01)
/* no BM_EN */
#define GBL_EN (PM1_EN | 0x03)
#define PWRBTN_EN (PM1_EN | 0x04)
#define SLPBTN_EN (PM1_EN | 0x05)
#define RTC_EN (PM1_EN | 0x06)
#define WAK_EN (PM1_EN | 0x07)
#define SCI_EN (PM1_CONTROL | 0x01)
#define BM_RLD (PM1_CONTROL | 0x02)
#define GBL_RLS (PM1_CONTROL | 0x03)
#define SLP_TYPE_A (PM1_CONTROL | 0x04)
#define SLP_TYPE_B (PM1_CONTROL | 0x05)
#define SLP_EN (PM1_CONTROL | 0x06)
#define SCI_EN (PM1_CONTROL | 0x01)
#define BM_RLD (PM1_CONTROL | 0x02)
#define GBL_RLS (PM1_CONTROL | 0x03)
#define SLP_TYPE_A (PM1_CONTROL | 0x04)
#define SLP_TYPE_B (PM1_CONTROL | 0x05)
#define SLP_EN (PM1_CONTROL | 0x06)
#define ARB_DIS (PM2_CONTROL | 0x01)
#define ARB_DIS (PM2_CONTROL | 0x01)
#define TMR_VAL (PM_TIMER | 0x01)
#define TMR_VAL (PM_TIMER | 0x01)
#define GPE0_STS (GPE0_STS_BLOCK | 0x01)
#define GPE0_EN (GPE0_EN_BLOCK | 0x01)
#define GPE0_STS (GPE0_STS_BLOCK | 0x01)
#define GPE0_EN (GPE0_EN_BLOCK | 0x01)
#define GPE1_STS (GPE1_STS_BLOCK | 0x01)
#define GPE1_EN (GPE1_EN_BLOCK | 0x01)
#define GPE1_STS (GPE1_STS_BLOCK | 0x01)
#define GPE1_EN (GPE1_EN_BLOCK | 0x01)
#define TMR_STS_MASK 0x0001
#define BM_STS_MASK 0x0010
#define GBL_STS_MASK 0x0020
#define PWRBTN_STS_MASK 0x0100
#define SLPBTN_STS_MASK 0x0200
#define RTC_STS_MASK 0x0400
#define WAK_STS_MASK 0x8000
#define TMR_STS_MASK 0x0001
#define BM_STS_MASK 0x0010
#define GBL_STS_MASK 0x0020
#define PWRBTN_STS_MASK 0x0100
#define SLPBTN_STS_MASK 0x0200
#define RTC_STS_MASK 0x0400
#define WAK_STS_MASK 0x8000
#define ALL_FIXED_STS_BITS (TMR_STS_MASK | BM_STS_MASK | GBL_STS_MASK \
| PWRBTN_STS_MASK | SLPBTN_STS_MASK \
| RTC_STS_MASK | WAK_STS_MASK)
#define ALL_FIXED_STS_BITS (TMR_STS_MASK | BM_STS_MASK | GBL_STS_MASK \
| PWRBTN_STS_MASK | SLPBTN_STS_MASK \
| RTC_STS_MASK | WAK_STS_MASK)
#define TMR_EN_MASK 0x0001
#define GBL_EN_MASK 0x0020
#define PWRBTN_EN_MASK 0x0100
#define SLPBTN_EN_MASK 0x0200
#define RTC_EN_MASK 0x0400
#define TMR_EN_MASK 0x0001
#define GBL_EN_MASK 0x0020
#define PWRBTN_EN_MASK 0x0100
#define SLPBTN_EN_MASK 0x0200
#define RTC_EN_MASK 0x0400
#define SCI_EN_MASK 0x0001
#define BM_RLD_MASK 0x0002
#define GBL_RLS_MASK 0x0004
#define SLP_TYPE_X_MASK 0x1C00
#define SLP_EN_MASK 0x2000
#define SCI_EN_MASK 0x0001
#define BM_RLD_MASK 0x0002
#define GBL_RLS_MASK 0x0004
#define SLP_TYPE_X_MASK 0x1C00
#define SLP_EN_MASK 0x2000
#define ARB_DIS_MASK 0x0001
#define TMR_VAL_MASK 0xFFFFFFFF
#define ARB_DIS_MASK 0x0001
#define TMR_VAL_MASK 0xFFFFFFFF
#define GPE0_STS_MASK
#define GPE0_EN_MASK
@ -907,8 +916,8 @@ typedef struct acpi_get_devices_info
#define GPE1_EN_MASK
#define ACPI_READ 1
#define ACPI_WRITE 2
#define ACPI_READ 1
#define ACPI_WRITE 2
/* Plug and play */

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acmacros.h - C macros for the entire subsystem.
* $Revision: 59 $
* $Revision: 62 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -121,6 +121,14 @@
* Data manipulation macros
*/
#ifndef LODWORD
#define LODWORD(l) ((UINT32)(UINT64)(l))
#endif
#ifndef HIDWORD
#define HIDWORD(l) ((UINT32)((((UINT64)(l)) >> 32) & 0xFFFFFFFF))
#endif
#ifndef LOWORD
#define LOWORD(l) ((UINT16)(NATIVE_UINT)(l))
#endif
@ -155,10 +163,18 @@
#ifdef _IA16
/*
* For 16-bit addresses, we have to assume that the upper 32 bits
* are zero.
*/
#define ACPI_GET_ADDRESS(a) ((a).Lo)
#define ACPI_STORE_ADDRESS(a,b) {(a).Hi=0;(a).Lo=(b);}
#define ACPI_VALID_ADDRESS(a) ((a).Hi && (a).Lo)
#define ACPI_VALID_ADDRESS(a) ((a).Hi | (a).Lo)
#else
/*
* Full 64-bit address on 32-bit and 64-bit platforms
*/
#define ACPI_GET_ADDRESS(a) (a)
#define ACPI_STORE_ADDRESS(a,b) ((a)=(b))
#define ACPI_VALID_ADDRESS(a) (a)
@ -426,7 +442,7 @@
*/
#define return_VOID {FunctionExit(_THIS_MODULE,__LINE__,_COMPONENT,_ProcName);return;}
#define return_ACPI_STATUS(s) {FunctionStatusExit(_THIS_MODULE,__LINE__,_COMPONENT,_ProcName,s);return(s);}
#define return_VALUE(s) {FunctionValueExit(_THIS_MODULE,__LINE__,_COMPONENT,_ProcName,(NATIVE_UINT)s);return(s);}
#define return_VALUE(s) {FunctionValueExit(_THIS_MODULE,__LINE__,_COMPONENT,_ProcName,(ACPI_INTEGER)s);return(s);}
#define return_PTR(s) {FunctionPtrExit(_THIS_MODULE,__LINE__,_COMPONENT,_ProcName,(UINT8 *)s);return(s);}
@ -437,6 +453,8 @@
#define DEBUG_DEFINE(a) a;
#define DEBUG_ONLY_MEMBERS(a) a;
#define _OPCODE_NAMES
#define _VERBOSE_STRUCTURES
/* Stack and buffer dumping */
@ -549,9 +567,8 @@
*/
#ifdef _IA16
#undef DEBUG_ONLY_MEMBERS
#undef _VERBOSE_STRUCTURES
#define DEBUG_ONLY_MEMBERS(a)
#undef OP_INFO_ENTRY
#define OP_INFO_ENTRY(Flags,Name,PArgs,IArgs) {Flags,PArgs,IArgs}
#endif

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acmsvc.h - VC specific defines, etc.
* $Revision: 3 $
* $Revision: 4 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acnamesp.h - Namespace subcomponent prototypes and defines
* $Revision: 99 $
* $Revision: 101 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -147,6 +147,7 @@
#define NS_SEARCH_PARENT 0x01
#define NS_DONT_OPEN_SCOPE 0x02
#define NS_NO_PEER_SEARCH 0x04
#define NS_ERROR_IF_FOUND 0x08
#define NS_WALK_UNLOCK TRUE
#define NS_WALK_NO_UNLOCK FALSE

View file

@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only)
* $Revision: 76 $
* $Revision: 78 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -204,10 +204,10 @@ typedef struct /* NUMBER - has value */
ACPI_INTEGER Value;
} ACPI_OBJECT_NUMBER;
} ACPI_OBJECT_INTEGER;
typedef struct /* STRING - has length and pointer */
typedef struct /* STRING - has length and pointer - Null terminated, ASCII characters only */
{
ACPI_OBJECT_COMMON_HEADER
@ -217,13 +217,11 @@ typedef struct /* STRING - has length and pointer */
} ACPI_OBJECT_STRING;
typedef struct /* BUFFER - has length, sequence, and pointer */
typedef struct /* BUFFER - has length and pointer - not null terminated */
{
ACPI_OBJECT_COMMON_HEADER
UINT32 Length;
UINT32 Sequence; /* Sequential count of buffers created */
UINT8 *Pointer; /* points to the buffer in allocated space */
} ACPI_OBJECT_BUFFER;
@ -489,7 +487,7 @@ typedef union acpi_operand_obj
{
ACPI_OBJECT_COMMON Common;
ACPI_OBJECT_CACHE_LIST Cache;
ACPI_OBJECT_NUMBER Number;
ACPI_OBJECT_INTEGER Integer;
ACPI_OBJECT_STRING String;
ACPI_OBJECT_BUFFER Buffer;
ACPI_OBJECT_PACKAGE Package;

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acoutput.h -- debug output
* $Revision: 67 $
* $Revision: 69 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -149,6 +149,7 @@
#define BATTERY 0x00040000
#define DEBUGGER 0x00100000
#define COMPILER 0x00200000
#define ALL_COMPONENTS 0x001FFFFF
#define COMPONENT_DEFAULT (ALL_COMPONENTS)

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: acparser.h - AML Parser subcomponent prototypes and defines
* $Revision: 48 $
* $Revision: 49 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acpi.h - Master include file, Publics and external data.
* $Revision: 49 $
* $Revision: 50 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -12,7 +12,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -212,6 +212,10 @@ AcpiOsUnmapMemory (
void *LogicalAddress,
UINT32 Length);
ACPI_STATUS
AcpiOsGetPhysicalAddress (
void *LogicalAddress,
ACPI_PHYSICAL_ADDRESS *PhysicalAddress);
/*
* Interrupt handlers

View file

@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -375,6 +375,10 @@ ACPI_STATUS
AcpiGetFirmwareWakingVector (
ACPI_PHYSICAL_ADDRESS *PhysicalAddress);
ACPI_STATUS
AcpiEnterSleepState (
UINT8 SleepState);
ACPI_STATUS
AcpiGetProcessorThrottlingInfo (
ACPI_HANDLE ProcessorHandle,

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acresrc.h - Resource Manager function prototypes
* $Revision: 21 $
* $Revision: 22 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actables.h - ACPI table management
* $Revision: 28 $
* $Revision: 29 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actbl.h - Table data structures defined in ACPI specification
* $Revision: 44 $
* $Revision: 45 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actbl1.h - ACPI 1.0 tables
* $Revision: 16 $
* $Revision: 17 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actbl2.h - ACPI Specification Revision 2.0 Tables
* $Revision: 20 $
* $Revision: 21 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -3,7 +3,7 @@
* Name: actbl71.h - IA-64 Extensions to the ACPI Spec Rev. 0.71
* This file includes tables specific to this
* specification revision.
* $Revision: 8 $
* $Revision: 9 $
*
*****************************************************************************/
@ -11,7 +11,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actypes.h - Common data types for the entire ACPI subsystem
* $Revision: 159 $
* $Revision: 163 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -176,7 +176,7 @@ typedef long INT32;
typedef int INT16;
typedef unsigned long UINT32;
typedef struct
typedef struct
{
UINT32 Lo;
UINT32 Hi;
@ -188,7 +188,7 @@ typedef INT16 NATIVE_INT;
typedef UINT32 ACPI_TBLPTR;
typedef UINT32 ACPI_IO_ADDRESS;
typedef void *ACPI_PHYSICAL_ADDRESS;
typedef char *ACPI_PHYSICAL_ADDRESS;
#define ALIGNED_ADDRESS_BOUNDARY 0x00000002
#define _HW_ALIGNMENT_SUPPORT
@ -340,8 +340,9 @@ typedef UINT64 ACPI_INTEGER;
#define ACPI_STATE_S2 (UINT8) 2
#define ACPI_STATE_S3 (UINT8) 3
#define ACPI_STATE_S4 (UINT8) 4
#define ACPI_STATE_S4BIOS (UINT8) 5
#define ACPI_STATE_S5 (UINT8) 6
#define ACPI_STATE_S5 (UINT8) 5
/* let's pretend S4BIOS didn't exist for now. ASG */
#define ACPI_STATE_S4BIOS (UINT8) 6
#define ACPI_S_STATES_MAX ACPI_STATE_S5
@ -375,8 +376,37 @@ typedef UINT32 ACPI_TABLE_TYPE;
typedef UINT32 ACPI_OBJECT_TYPE;
typedef UINT8 OBJECT_TYPE_INTERNAL;
#define ACPI_BTYPE_ANY 0x00000000
#define ACPI_BTYPE_INTEGER 0x00000001
#define ACPI_BTYPE_STRING 0x00000002
#define ACPI_BTYPE_BUFFER 0x00000004
#define ACPI_BTYPE_PACKAGE 0x00000008
#define ACPI_BTYPE_FIELD_UNIT 0x00000010
#define ACPI_BTYPE_DEVICE 0x00000020
#define ACPI_BTYPE_EVENT 0x00000040
#define ACPI_BTYPE_METHOD 0x00000080
#define ACPI_BTYPE_MUTEX 0x00000100
#define ACPI_BTYPE_REGION 0x00000200
#define ACPI_BTYPE_POWER 0x00000400
#define ACPI_BTYPE_PROCESSOR 0x00000800
#define ACPI_BTYPE_THERMAL 0x00001000
#define ACPI_BTYPE_BUFFER_FIELD 0x00002000
#define ACPI_BTYPE_DDB_HANDLE 0x00004000
#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000
#define ACPI_BTYPE_REFERENCE 0x00010000
#define ACPI_BTYPE_RESOURCE 0x00020000
#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE)
#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
#define ACPI_BTYPE_OBJECTS_AND_REFS 0x00017FFF /* ARG or LOCAL */
#define ACPI_BTYPE_ALL_OBJECTS 0x00007FFF
#define ACPI_TYPE_ANY 0 /* 0x00 */
#define ACPI_TYPE_NUMBER 1 /* 0x01 Byte/Word/Dword/Zero/One/Ones */
#define ACPI_TYPE_INTEGER 1 /* 0x01 Byte/Word/Dword/Zero/One/Ones */
#define ACPI_TYPE_STRING 2 /* 0x02 */
#define ACPI_TYPE_BUFFER 3 /* 0x03 */
#define ACPI_TYPE_PACKAGE 4 /* 0x04 ByteConst, multiple DataTerm/Constant/SuperName */
@ -523,7 +553,7 @@ typedef union AcpiObj
{
ACPI_OBJECT_TYPE Type;
ACPI_INTEGER Value; /* The actual number */
} Number;
} Integer;
struct
{

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acwin.h - OS specific defines, etc.
* $Revision: 2 $
* $Revision: 3 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -3,7 +3,7 @@
* Name: amlcode.h - Definitions for AML, as included in "definition blocks"
* Declarations and definitions contained herein are derived
* directly from the ACPI specification.
* $Revision: 43 $
* $Revision: 46 $
*
*****************************************************************************/
@ -11,7 +11,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -302,27 +302,42 @@
#define ARGP_TERMARG 0x0E
#define ARGP_TERMLIST 0x0F
#define ARGP_WORDDATA 0x10
#define ARGP_QWORDDATA 0x11
#define ARGP_SIMPLENAME 0x12
/*
* Resolved argument types for the AML Interpreter
* Each field in the ArgTypes UINT32 is 5 bits, allowing for a maximum of 6 arguments.
* There can be up to 31 unique argument types
* There can be up to 31 unique argument types (0 is end-of-arg-list indicator)
*/
#define ARGI_ANYTYPE 0x01
#define ARGI_TARGETREF 0x02
#define ARGI_REFERENCE 0x03
#define ARGI_IF 0x04
#define ARGI_NUMBER 0x05
#define ARGI_STRING 0x06
#define ARGI_BUFFER 0x07
#define ARGI_PACKAGE 0x08
#define ARGI_DATAOBJECT 0x09 /* Buffer, string, package or reference to a Node - Used only by SizeOf operator*/
#define ARGI_COMPLEXOBJ 0x0A /* Buffer or package */
#define ARGI_MUTEX 0x0B
#define ARGI_EVENT 0x0C
#define ARGI_REGION 0x0D
#define ARGI_DDBHANDLE 0x0E
/* "Standard" ACPI types are 1-15 (0x0F) */
#define ARGI_INTEGER ACPI_TYPE_INTEGER /* 1 */
#define ARGI_STRING ACPI_TYPE_STRING /* 2 */
#define ARGI_BUFFER ACPI_TYPE_BUFFER /* 3 */
#define ARGI_PACKAGE ACPI_TYPE_PACKAGE /* 4 */
#define ARGI_EVENT ACPI_TYPE_EVENT
#define ARGI_MUTEX ACPI_TYPE_MUTEX
#define ARGI_REGION ACPI_TYPE_REGION
#define ARGI_DDBHANDLE ACPI_TYPE_DDB_HANDLE
/* Custom types are 0x10 through 0x1F */
#define ARGI_IF 0x10
#define ARGI_ANYOBJECT 0x11
#define ARGI_ANYTYPE 0x12
#define ARGI_COMPUTEDATA 0x13 /* Buffer, String, or Integer */
#define ARGI_DATAOBJECT 0x14 /* Buffer, string, package or reference to a Node - Used only by SizeOf operator*/
#define ARGI_COMPLEXOBJ 0x15 /* Buffer or package */
#define ARGI_INTEGER_REF 0x16
#define ARGI_OBJECT_REF 0x17
#define ARGI_DEVICE_REF 0x18
#define ARGI_REFERENCE 0x19
#define ARGI_TARGETREF 0x1A /* Target, subject to implicit conversion */
#define ARGI_FIXED_TARGET 0x1B /* Target, no implicit conversion */
#define ARGI_SIMPLE_TARGET 0x1C /* Name, Local, Arg -- no implicit conversion */
#define ARGI_BUFFERSTRING 0x1D
#define ARGI_INVALID_OPCODE 0xFFFFFFFF

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: amconfig - Namespace reconfiguration (Load/Unload opcodes)
* $Revision: 27 $
* $Revision: 29 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -169,7 +169,8 @@ AcpiAmlExecLoadTable (
for (i = 0; i < sizeof (ACPI_TABLE_HEADER); i++)
{
Status = AcpiEvAddressSpaceDispatch (RgnDesc, ADDRESS_SPACE_READ,
i, 8, (UINT32 *) ((UINT8 *) &TableHeader + i));
(ACPI_PHYSICAL_ADDRESS) i, 8,
(UINT32 *) ((UINT8 *) &TableHeader + i));
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -195,7 +196,8 @@ AcpiAmlExecLoadTable (
for (i = 0; i < TableHeader.Length; i++)
{
Status = AcpiEvAddressSpaceDispatch (RgnDesc, ADDRESS_SPACE_READ,
i, 8, (UINT32 *) (TableDataPtr + i));
(ACPI_PHYSICAL_ADDRESS)i, 8,
(UINT32 *) (TableDataPtr + i));
if (ACPI_FAILURE (Status))
{
goto Cleanup;

View file

@ -0,0 +1,653 @@
/******************************************************************************
*
* Module Name: amconvrt - Object conversion routines
* $Revision: 3 $
*
*****************************************************************************/
/******************************************************************************
*
* 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 __AMCONVRT_C__
#include "acpi.h"
#include "acparser.h"
#include "acnamesp.h"
#include "acinterp.h"
#include "acevents.h"
#include "amlcode.h"
#include "acdispat.h"
#define _COMPONENT INTERPRETER
MODULE_NAME ("amconvrt")
/*******************************************************************************
*
* FUNCTION: AcpiAmlConvertToTargetType
*
* PARAMETERS: *ObjDesc - Object to be converted.
* WalkState - Current method state
*
* RETURN: Status
*
* DESCRIPTION:
*
******************************************************************************/
ACPI_STATUS
AcpiAmlConvertToTargetType (
OBJECT_TYPE_INTERNAL DestinationType,
ACPI_OPERAND_OBJECT **ObjDesc,
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status = AE_OK;
FUNCTION_TRACE ("AmlConvertToTargetType");
/*
* If required by the target,
* perform implicit conversion on the source before we store it.
*/
switch (GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs))
{
case ARGI_SIMPLE_TARGET:
case ARGI_FIXED_TARGET:
case ARGI_INTEGER_REF: /* Handles Increment, Decrement cases */
switch (DestinationType)
{
case INTERNAL_TYPE_DEF_FIELD:
/*
* Named field can always handle conversions
*/
break;
default:
/* No conversion allowed for these types */
if (DestinationType != (*ObjDesc)->Common.Type)
{
DEBUG_PRINT (ACPI_ERROR,
("AmlConvertToTargetType: Target does not allow conversion of type %s to %s\n",
AcpiCmGetTypeName ((*ObjDesc)->Common.Type),
AcpiCmGetTypeName (DestinationType)));
Status = AE_TYPE;
}
}
break;
case ARGI_TARGETREF:
switch (DestinationType)
{
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_FIELD_UNIT:
case INTERNAL_TYPE_BANK_FIELD:
case INTERNAL_TYPE_INDEX_FIELD:
/*
* These types require an Integer operand. We can convert
* a Buffer or a String to an Integer if necessary.
*/
Status = AcpiAmlConvertToInteger (ObjDesc, WalkState);
break;
case ACPI_TYPE_STRING:
/*
* The operand must be a String. We can convert an
* Integer or Buffer if necessary
*/
Status = AcpiAmlConvertToString (ObjDesc, WalkState);
break;
case ACPI_TYPE_BUFFER:
/*
* The operand must be a String. We can convert an
* Integer or Buffer if necessary
*/
Status = AcpiAmlConvertToBuffer (ObjDesc, WalkState);
break;
}
break;
case ARGI_REFERENCE:
/*
* CreateXxxxField cases - we are storing the field object into the name
*/
break;
default:
DEBUG_PRINT (ACPI_ERROR,
("AmlConvertToTargetType: Unknown Target type ID 0x%X Op %s DestType %s\n",
GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs),
WalkState->OpInfo->Name,
AcpiCmGetTypeName (DestinationType)));
Status = AE_AML_INTERNAL;
}
/*
* Source-to-Target conversion semantics:
*
* If conversion to the target type cannot be performed, then simply
* overwrite the target with the new object and type.
*/
if (Status == AE_TYPE)
{
Status = AE_OK;
}
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiAmlConvertToInteger
*
* PARAMETERS: *ObjDesc - Object to be converted. Must be an
* Integer, Buffer, or String
* WalkState - Current method state
*
* RETURN: Status
*
* DESCRIPTION: Convert an ACPI Object to an integer.
*
******************************************************************************/
ACPI_STATUS
AcpiAmlConvertToInteger (
ACPI_OPERAND_OBJECT **ObjDesc,
ACPI_WALK_STATE *WalkState)
{
UINT32 i;
ACPI_OPERAND_OBJECT *RetDesc;
UINT32 Count;
char *Pointer;
ACPI_INTEGER Result;
UINT32 IntegerSize = sizeof (ACPI_INTEGER);
switch ((*ObjDesc)->Common.Type)
{
case ACPI_TYPE_INTEGER:
return (AE_OK);
case ACPI_TYPE_STRING:
Pointer = (*ObjDesc)->String.Pointer;
Count = (*ObjDesc)->String.Length;
break;
case ACPI_TYPE_BUFFER:
Pointer = (char *) (*ObjDesc)->Buffer.Pointer;
Count = (*ObjDesc)->Buffer.Length;
break;
default:
return (AE_TYPE);
}
/*
* Create a new integer
*/
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
if (!RetDesc)
{
return (AE_NO_MEMORY);
}
/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32)
{
/*
* We are running a method that exists in a 32-bit ACPI table.
* Truncate the value to 32 bits by zeroing out the upper 32-bit field
*/
IntegerSize = sizeof (UINT32);
}
/*
* Convert the buffer/string to an integer. Note that both buffers and
* strings are treated as raw data - we don't convert ascii to hex for
* strings.
*
* There are two terminating conditions for the loop:
* 1) The size of an integer has been reached, or
* 2) The end of the buffer or string has been reached
*/
Result = 0;
/* Transfer no more than an integer's worth of data */
if (Count > IntegerSize)
{
Count = IntegerSize;
}
/*
* String conversion is different than Buffer conversion
*/
switch ((*ObjDesc)->Common.Type)
{
case ACPI_TYPE_STRING:
/* TBD: Need to use 64-bit STRTOUL */
/*
* Convert string to an integer
* String must be hexadecimal as per the ACPI specification
*/
Result = STRTOUL (Pointer, NULL, 16);
break;
case ACPI_TYPE_BUFFER:
/*
* Buffer conversion - we simply grab enough raw data from the
* buffer to fill an integer
*/
for (i = 0; i < Count; i++)
{
/*
* Get next byte and shift it into the Result.
* Little endian is used, meaning that the first byte of the buffer
* is the LSB of the integer
*/
Result |= (((ACPI_INTEGER) Pointer[i]) << (i * 8));
}
break;
}
/* Save the Result, delete original descriptor, store new descriptor */
RetDesc->Integer.Value = Result;
if (WalkState->Opcode != AML_STORE_OP)
{
AcpiCmRemoveReference (*ObjDesc);
}
*ObjDesc = RetDesc;
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiAmlConvertToBuffer
*
* PARAMETERS: *ObjDesc - Object to be converted. Must be an
* Integer, Buffer, or String
* WalkState - Current method state
*
* RETURN: Status
*
* DESCRIPTION: Convert an ACPI Object to an Buffer
*
******************************************************************************/
ACPI_STATUS
AcpiAmlConvertToBuffer (
ACPI_OPERAND_OBJECT **ObjDesc,
ACPI_WALK_STATE *WalkState)
{
ACPI_OPERAND_OBJECT *RetDesc;
UINT32 i;
UINT32 IntegerSize = sizeof (ACPI_INTEGER);
UINT8 *NewBuf;
switch ((*ObjDesc)->Common.Type)
{
case ACPI_TYPE_INTEGER:
/*
* Create a new Buffer
*/
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_BUFFER);
if (!RetDesc)
{
return (AE_NO_MEMORY);
}
/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32)
{
/*
* We are running a method that exists in a 32-bit ACPI table.
* Truncate the value to 32 bits by zeroing out the upper
* 32-bit field
*/
IntegerSize = sizeof (UINT32);
}
/* Need enough space for one integers */
RetDesc->Buffer.Length = IntegerSize;
NewBuf = AcpiCmCallocate (IntegerSize);
if (!NewBuf)
{
REPORT_ERROR
(("AmlExecDyadic2R/ConcatOp: Buffer allocation failure\n"));
AcpiCmRemoveReference (RetDesc);
return (AE_NO_MEMORY);
}
/* Copy the integer to the buffer */
for (i = 0; i < IntegerSize; i++)
{
NewBuf[i] = (UINT8) ((*ObjDesc)->Integer.Value >> (i * 8));
}
RetDesc->Buffer.Pointer = NewBuf;
/* Return the new buffer descriptor */
if (WalkState->Opcode != AML_STORE_OP)
{
AcpiCmRemoveReference (*ObjDesc);
}
*ObjDesc = RetDesc;
break;
case ACPI_TYPE_STRING:
break;
case ACPI_TYPE_BUFFER:
break;
default:
return (AE_TYPE);
break;
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiAmlConvertToString
*
* PARAMETERS: *ObjDesc - Object to be converted. Must be an
* Integer, Buffer, or String
* WalkState - Current method state
*
* RETURN: Status
*
* DESCRIPTION: Convert an ACPI Object to a string
*
******************************************************************************/
ACPI_STATUS
AcpiAmlConvertToString (
ACPI_OPERAND_OBJECT **ObjDesc,
ACPI_WALK_STATE *WalkState)
{
ACPI_OPERAND_OBJECT *RetDesc;
UINT32 i;
UINT32 Index;
UINT32 IntegerSize = sizeof (ACPI_INTEGER);
UINT8 *NewBuf;
UINT8 *Pointer;
switch ((*ObjDesc)->Common.Type)
{
case ACPI_TYPE_INTEGER:
/*
* Create a new String
*/
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_STRING);
if (!RetDesc)
{
return (AE_NO_MEMORY);
}
/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32)
{
/*
* We are running a method that exists in a 32-bit ACPI table.
* Truncate the value to 32 bits by zeroing out the upper
* 32-bit field
*/
IntegerSize = sizeof (UINT32);
}
/* Need enough space for one ASCII integer plus null terminator */
RetDesc->String.Length = (IntegerSize * 2) + 1;
NewBuf = AcpiCmCallocate (RetDesc->String.Length);
if (!NewBuf)
{
REPORT_ERROR
(("AmlExecDyadic2R/ConcatOp: Buffer allocation failure\n"));
AcpiCmRemoveReference (RetDesc);
return (AE_NO_MEMORY);
}
/* Copy the integer to the buffer */
for (i = 0; i < (IntegerSize * 2); i++)
{
NewBuf[i] = AcpiGbl_HexToAscii [((*ObjDesc)->Integer.Value >> (i * 4)) & 0xF];
}
/* Null terminate */
NewBuf [i] = 0;
RetDesc->Buffer.Pointer = NewBuf;
/* Return the new buffer descriptor */
if (WalkState->Opcode != AML_STORE_OP)
{
AcpiCmRemoveReference (*ObjDesc);
}
*ObjDesc = RetDesc;
return (AE_OK);
case ACPI_TYPE_BUFFER:
if (((*ObjDesc)->Buffer.Length * 3) > ACPI_MAX_STRING_CONVERSION)
{
return (AE_AML_STRING_LIMIT);
}
/*
* Create a new String
*/
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_STRING);
if (!RetDesc)
{
return (AE_NO_MEMORY);
}
/* Need enough space for one ASCII integer plus null terminator */
RetDesc->String.Length = (*ObjDesc)->Buffer.Length * 3;
NewBuf = AcpiCmCallocate (RetDesc->String.Length + 1);
if (!NewBuf)
{
REPORT_ERROR
(("AmlExecDyadic2R/ConcatOp: Buffer allocation failure\n"));
AcpiCmRemoveReference (RetDesc);
return (AE_NO_MEMORY);
}
/*
* Convert each byte of the buffer to two ASCII characters plus a space.
*/
Pointer = (*ObjDesc)->Buffer.Pointer;
Index = 0;
for (i = 0; i < (*ObjDesc)->Buffer.Length; i++)
{
NewBuf[Index + 0] = AcpiGbl_HexToAscii [Pointer[i] & 0x0F];
NewBuf[Index + 1] = AcpiGbl_HexToAscii [(Pointer[i] >> 4) & 0x0F];
NewBuf[Index + 2] = ' ';
Index += 3;
}
/* Null terminate */
NewBuf [Index] = 0;
RetDesc->Buffer.Pointer = NewBuf;
/* Return the new buffer descriptor */
if (WalkState->Opcode != AML_STORE_OP)
{
AcpiCmRemoveReference (*ObjDesc);
}
*ObjDesc = RetDesc;
break;
case ACPI_TYPE_STRING:
break;
default:
return (AE_TYPE);
break;
}
return (AE_OK);
}

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: amcreate - Named object creation
* $Revision: 52 $
* $Revision: 53 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -477,7 +477,7 @@ AcpiAmlExecCreateMutex (
goto Cleanup;
}
ObjDesc->Mutex.SyncLevel = (UINT8) SyncDesc->Number.Value;
ObjDesc->Mutex.SyncLevel = (UINT8) SyncDesc->Integer.Value;
/* ObjDesc was on the stack top, and the name is below it */

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: amdump - Interpreter debug output routines
* $Revision: 97 $
* $Revision: 100 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -130,7 +130,7 @@
* The following routines are used for debug output only
*/
#ifdef ACPI_DEBUG
#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
/*****************************************************************************
*
@ -334,12 +334,12 @@ AcpiAmlDumpOperand (
DEBUG_PRINT_RAW (ACPI_INFO, ("Reference: Arg%d",
EntryDesc->Reference.Offset));
if (ACPI_TYPE_NUMBER == EntryDesc->Common.Type)
if (ACPI_TYPE_INTEGER == EntryDesc->Common.Type)
{
/* Value is a Number */
DEBUG_PRINT_RAW (ACPI_INFO, (" value is [%ld]",
EntryDesc->Number.Value));
EntryDesc->Integer.Value));
}
DEBUG_PRINT_RAW (ACPI_INFO, ("\n"));
@ -351,13 +351,13 @@ AcpiAmlDumpOperand (
DEBUG_PRINT_RAW (ACPI_INFO, ("Reference: Local%d",
EntryDesc->Reference.Offset));
if (ACPI_TYPE_NUMBER == EntryDesc->Common.Type)
if (ACPI_TYPE_INTEGER == EntryDesc->Common.Type)
{
/* Value is a Number */
DEBUG_PRINT_RAW (ACPI_INFO, (" value is [%ld]",
EntryDesc->Number.Value));
EntryDesc->Integer.Value));
}
DEBUG_PRINT_RAW (ACPI_INFO, ("\n"));
@ -412,24 +412,24 @@ AcpiAmlDumpOperand (
break;
case ACPI_TYPE_NUMBER:
case ACPI_TYPE_INTEGER:
DEBUG_PRINT_RAW (ACPI_INFO, ("Number %lX\n",
EntryDesc->Number.Value));
EntryDesc->Integer.Value));
break;
case INTERNAL_TYPE_IF:
DEBUG_PRINT_RAW (ACPI_INFO, ("If [Number] %lX\n",
EntryDesc->Number.Value));
EntryDesc->Integer.Value));
break;
case INTERNAL_TYPE_WHILE:
DEBUG_PRINT_RAW (ACPI_INFO, ("While [Number] %lX\n",
EntryDesc->Number.Value));
EntryDesc->Integer.Value));
break;
@ -763,10 +763,10 @@ AcpiAmlDumpObjectDescriptor (
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_NUMBER:
case ACPI_TYPE_INTEGER:
AcpiOsPrintf ("%20s : %s\n", "Type", "Number");
AcpiOsPrintf ("%20s : %X\n", "Value", ObjDesc->Number.Value);
AcpiOsPrintf ("%20s : %X\n", "Value", ObjDesc->Integer.Value);
break;
@ -782,7 +782,6 @@ AcpiAmlDumpObjectDescriptor (
AcpiOsPrintf ("%20s : %s\n", "Type", "Buffer");
AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->Buffer.Length);
AcpiOsPrintf ("%20s : %X\n", "Sequence", ObjDesc->Buffer.Sequence);
AcpiOsPrintf ("%20s : %p\n", "Pointer", ObjDesc->Buffer.Pointer);
break;

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: amdyadic - ACPI AML (p-code) execution for dyadic operators
* $Revision: 69 $
* $Revision: 71 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -130,7 +130,183 @@
MODULE_NAME ("amdyadic")
/*****************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiAmlDoConcatenate
*
* PARAMETERS: *ObjDesc - Object to be converted. Must be an
* Integer, Buffer, or String
*
* RETURN: Status
*
* DESCRIPTION: Concatenate two objects OF THE SAME TYPE.
*
******************************************************************************/
ACPI_STATUS
AcpiAmlDoConcatenate (
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_OPERAND_OBJECT *ObjDesc2,
ACPI_OPERAND_OBJECT **ActualRetDesc,
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status;
UINT32 i;
ACPI_INTEGER ThisInteger;
ACPI_OPERAND_OBJECT *RetDesc;
NATIVE_CHAR *NewBuf;
UINT32 IntegerSize = sizeof (ACPI_INTEGER);
/*
* There are three cases to handle:
* 1) Two Integers concatenated to produce a buffer
* 2) Two Strings concatenated to produce a string
* 3) Two Buffers concatenated to produce a buffer
*/
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32)
{
/*
* We are running a method that exists in a 32-bit ACPI table.
* Truncate the value to 32 bits by zeroing out the upper
* 32-bit field
*/
IntegerSize = sizeof (UINT32);
}
/* Result of two integers is a buffer */
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_BUFFER);
if (!RetDesc)
{
return (AE_NO_MEMORY);
}
/* Need enough space for two integers */
RetDesc->Buffer.Length = IntegerSize * 2;
NewBuf = AcpiCmCallocate (RetDesc->Buffer.Length);
if (!NewBuf)
{
REPORT_ERROR
(("AmlExecDyadic2R/ConcatOp: Buffer allocation failure\n"));
Status = AE_NO_MEMORY;
goto Cleanup;
}
RetDesc->Buffer.Pointer = (UINT8 *) NewBuf;
/* Convert the first integer */
ThisInteger = ObjDesc->Integer.Value;
for (i = 0; i < IntegerSize; i++)
{
NewBuf[i] = (UINT8) ThisInteger;
ThisInteger >>= 8;
}
/* Convert the second integer */
ThisInteger = ObjDesc2->Integer.Value;
for (; i < (IntegerSize * 2); i++)
{
NewBuf[i] = (UINT8) ThisInteger;
ThisInteger >>= 8;
}
break;
case ACPI_TYPE_STRING:
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_STRING);
if (!RetDesc)
{
return (AE_NO_MEMORY);
}
/* Operand1 is string */
NewBuf = AcpiCmAllocate (ObjDesc->String.Length +
ObjDesc2->String.Length + 1);
if (!NewBuf)
{
REPORT_ERROR
(("AmlExecDyadic2R/ConcatOp: String allocation failure\n"));
Status = AE_NO_MEMORY;
goto Cleanup;
}
STRCPY (NewBuf, ObjDesc->String.Pointer);
STRCPY (NewBuf + ObjDesc->String.Length,
ObjDesc2->String.Pointer);
/* Point the return object to the new string */
RetDesc->String.Pointer = NewBuf;
RetDesc->String.Length = ObjDesc->String.Length +=
ObjDesc2->String.Length;
break;
case ACPI_TYPE_BUFFER:
/* Operand1 is a buffer */
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_BUFFER);
if (!RetDesc)
{
return (AE_NO_MEMORY);
}
NewBuf = AcpiCmAllocate (ObjDesc->Buffer.Length +
ObjDesc2->Buffer.Length);
if (!NewBuf)
{
REPORT_ERROR
(("AmlExecDyadic2R/ConcatOp: Buffer allocation failure\n"));
Status = AE_NO_MEMORY;
goto Cleanup;
}
MEMCPY (NewBuf, ObjDesc->Buffer.Pointer,
ObjDesc->Buffer.Length);
MEMCPY (NewBuf + ObjDesc->Buffer.Length, ObjDesc2->Buffer.Pointer,
ObjDesc2->Buffer.Length);
/*
* Point the return object to the new buffer
*/
RetDesc->Buffer.Pointer = (UINT8 *) NewBuf;
RetDesc->Buffer.Length = ObjDesc->Buffer.Length +
ObjDesc2->Buffer.Length;
break;
default:
Status = AE_AML_INTERNAL;
RetDesc = NULL;
}
*ActualRetDesc = RetDesc;
return (AE_OK);
Cleanup:
AcpiCmRemoveReference (RetDesc);
return (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiAmlExecDyadic1
*
@ -143,7 +319,7 @@
*
* ALLOCATION: Deletes both operands
*
****************************************************************************/
******************************************************************************/
ACPI_STATUS
AcpiAmlExecDyadic1 (
@ -211,7 +387,7 @@ AcpiAmlExecDyadic1 (
/* Dispatch the notify to the appropriate handler */
AcpiEvNotifyDispatch (Node, (UINT32) ValDesc->Number.Value);
AcpiEvNotifyDispatch (Node, (UINT32) ValDesc->Integer.Value);
break;
default:
@ -244,7 +420,7 @@ Cleanup:
}
/*****************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiAmlExecDyadic2R
*
@ -257,7 +433,7 @@ Cleanup:
*
* ALLOCATION: Deletes one operand descriptor -- other remains on stack
*
****************************************************************************/
******************************************************************************/
ACPI_STATUS
AcpiAmlExecDyadic2R (
@ -273,7 +449,6 @@ AcpiAmlExecDyadic2R (
ACPI_OPERAND_OBJECT *RetDesc2 = NULL;
ACPI_STATUS Status = AE_OK;
UINT32 NumOperands = 3;
NATIVE_CHAR *NewBuf;
FUNCTION_TRACE_U32 ("AmlExecDyadic2R", Opcode);
@ -322,7 +497,7 @@ AcpiAmlExecDyadic2R (
case AML_SHIFT_RIGHT_OP:
case AML_SUBTRACT_OP:
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_NUMBER);
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
if (!RetDesc)
{
Status = AE_NO_MEMORY;
@ -344,8 +519,8 @@ AcpiAmlExecDyadic2R (
case AML_ADD_OP:
RetDesc->Number.Value = ObjDesc->Number.Value +
ObjDesc2->Number.Value;
RetDesc->Integer.Value = ObjDesc->Integer.Value +
ObjDesc2->Integer.Value;
break;
@ -353,8 +528,8 @@ AcpiAmlExecDyadic2R (
case AML_BIT_AND_OP:
RetDesc->Number.Value = ObjDesc->Number.Value &
ObjDesc2->Number.Value;
RetDesc->Integer.Value = ObjDesc->Integer.Value &
ObjDesc2->Integer.Value;
break;
@ -362,8 +537,8 @@ AcpiAmlExecDyadic2R (
case AML_BIT_NAND_OP:
RetDesc->Number.Value = ~(ObjDesc->Number.Value &
ObjDesc2->Number.Value);
RetDesc->Integer.Value = ~(ObjDesc->Integer.Value &
ObjDesc2->Integer.Value);
break;
@ -371,8 +546,8 @@ AcpiAmlExecDyadic2R (
case AML_BIT_OR_OP:
RetDesc->Number.Value = ObjDesc->Number.Value |
ObjDesc2->Number.Value;
RetDesc->Integer.Value = ObjDesc->Integer.Value |
ObjDesc2->Integer.Value;
break;
@ -380,8 +555,8 @@ AcpiAmlExecDyadic2R (
case AML_BIT_NOR_OP:
RetDesc->Number.Value = ~(ObjDesc->Number.Value |
ObjDesc2->Number.Value);
RetDesc->Integer.Value = ~(ObjDesc->Integer.Value |
ObjDesc2->Integer.Value);
break;
@ -389,16 +564,16 @@ AcpiAmlExecDyadic2R (
case AML_BIT_XOR_OP:
RetDesc->Number.Value = ObjDesc->Number.Value ^
ObjDesc2->Number.Value;
RetDesc->Integer.Value = ObjDesc->Integer.Value ^
ObjDesc2->Integer.Value;
break;
/* DefDivide := DivideOp Dividend Divisor Remainder Quotient */
/* DefDivide := DivideOp Dividend Divisor Remainder Quotient */
case AML_DIVIDE_OP:
if (!ObjDesc2->Number.Value)
if (!ObjDesc2->Integer.Value)
{
REPORT_ERROR
(("AmlExecDyadic2R/DivideOp: Divide by zero\n"));
@ -407,7 +582,7 @@ AcpiAmlExecDyadic2R (
goto Cleanup;
}
RetDesc2 = AcpiCmCreateInternalObject (ACPI_TYPE_NUMBER);
RetDesc2 = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
if (!RetDesc2)
{
Status = AE_NO_MEMORY;
@ -416,13 +591,13 @@ AcpiAmlExecDyadic2R (
/* Remainder (modulo) */
RetDesc->Number.Value = ACPI_MODULO (ObjDesc->Number.Value,
ObjDesc2->Number.Value);
RetDesc->Integer.Value = ACPI_MODULO (ObjDesc->Integer.Value,
ObjDesc2->Integer.Value);
/* Result (what we used to call the quotient) */
RetDesc2->Number.Value = ACPI_DIVIDE (ObjDesc->Number.Value,
ObjDesc2->Number.Value);
RetDesc2->Integer.Value = ACPI_DIVIDE (ObjDesc->Integer.Value,
ObjDesc2->Integer.Value);
break;
@ -430,8 +605,8 @@ AcpiAmlExecDyadic2R (
case AML_MULTIPLY_OP:
RetDesc->Number.Value = ObjDesc->Number.Value *
ObjDesc2->Number.Value;
RetDesc->Integer.Value = ObjDesc->Integer.Value *
ObjDesc2->Integer.Value;
break;
@ -439,8 +614,8 @@ AcpiAmlExecDyadic2R (
case AML_SHIFT_LEFT_OP:
RetDesc->Number.Value = ObjDesc->Number.Value <<
ObjDesc2->Number.Value;
RetDesc->Integer.Value = ObjDesc->Integer.Value <<
ObjDesc2->Integer.Value;
break;
@ -448,8 +623,8 @@ AcpiAmlExecDyadic2R (
case AML_SHIFT_RIGHT_OP:
RetDesc->Number.Value = ObjDesc->Number.Value >>
ObjDesc2->Number.Value;
RetDesc->Integer.Value = ObjDesc->Integer.Value >>
ObjDesc2->Integer.Value;
break;
@ -457,8 +632,8 @@ AcpiAmlExecDyadic2R (
case AML_SUBTRACT_OP:
RetDesc->Number.Value = ObjDesc->Number.Value -
ObjDesc2->Number.Value;
RetDesc->Integer.Value = ObjDesc->Integer.Value -
ObjDesc2->Integer.Value;
break;
@ -466,89 +641,56 @@ AcpiAmlExecDyadic2R (
case AML_CONCAT_OP:
if (ObjDesc2->Common.Type != ObjDesc->Common.Type)
/*
* Convert the second operand if necessary. The first operand
* determines the type of the second operand, (See the Data Types
* section of the ACPI specification.) Both object types are
* guaranteed to be either Integer/String/Buffer by the operand
* resolution mechanism above.
*/
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
Status = AcpiAmlConvertToInteger (&ObjDesc2, WalkState);
break;
case ACPI_TYPE_STRING:
Status = AcpiAmlConvertToString (&ObjDesc2, WalkState);
break;
case ACPI_TYPE_BUFFER:
Status = AcpiAmlConvertToBuffer (&ObjDesc2, WalkState);
break;
default:
Status = AE_AML_INTERNAL;
}
if (ACPI_FAILURE (Status))
{
DEBUG_PRINT (ACPI_ERROR,
("AmlExecDyadic2R/ConcatOp: operand type mismatch %X != %X\n",
ObjDesc->Common.Type, ObjDesc2->Common.Type));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
}
/* Both operands are now known to be the same */
if (ACPI_TYPE_STRING == ObjDesc->Common.Type)
/*
* Both operands are now known to be the same object type
* (Both are Integer, String, or Buffer), and we can now perform the
* concatenation.
*/
Status = AcpiAmlDoConcatenate (ObjDesc, ObjDesc2, &RetDesc, WalkState);
if (ACPI_FAILURE (Status))
{
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_STRING);
if (!RetDesc)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
/* Operand1 is string */
NewBuf = AcpiCmAllocate (ObjDesc->String.Length +
ObjDesc2->String.Length + 1);
if (!NewBuf)
{
REPORT_ERROR
(("AmlExecDyadic2R/ConcatOp: String allocation failure\n"));
Status = AE_NO_MEMORY;
goto Cleanup;
}
STRCPY (NewBuf, ObjDesc->String.Pointer);
STRCPY (NewBuf + ObjDesc->String.Length,
ObjDesc2->String.Pointer);
/* Point the return object to the new string */
RetDesc->String.Pointer = NewBuf;
RetDesc->String.Length = ObjDesc->String.Length +=
ObjDesc2->String.Length;
}
else
{
/* Operand1 is not a string ==> must be a buffer */
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_BUFFER);
if (!RetDesc)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
NewBuf = AcpiCmAllocate (ObjDesc->Buffer.Length +
ObjDesc2->Buffer.Length);
if (!NewBuf)
{
REPORT_ERROR
(("AmlExecDyadic2R/ConcatOp: Buffer allocation failure\n"));
Status = AE_NO_MEMORY;
goto Cleanup;
}
MEMCPY (NewBuf, ObjDesc->Buffer.Pointer,
ObjDesc->Buffer.Length);
MEMCPY (NewBuf + ObjDesc->Buffer.Length, ObjDesc2->Buffer.Pointer,
ObjDesc2->Buffer.Length);
/*
* Point the return object to the new buffer
*/
RetDesc->Buffer.Pointer = (UINT8 *) NewBuf;
RetDesc->Buffer.Length = ObjDesc->Buffer.Length +
ObjDesc2->Buffer.Length;
goto Cleanup;
}
break;
default:
REPORT_ERROR (("AcpiAmlExecDyadic2R: Unknown dyadic opcode %X\n", Opcode));
REPORT_ERROR (("AcpiAmlExecDyadic2R: Unknown dyadic opcode %X\n",
Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
}
@ -612,7 +754,7 @@ Cleanup:
}
/*****************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiAmlExecDyadic2S
*
@ -624,7 +766,7 @@ Cleanup:
*
* ALLOCATION: Deletes one operand descriptor -- other remains on stack
*
****************************************************************************/
******************************************************************************/
ACPI_STATUS
AcpiAmlExecDyadic2S (
@ -665,7 +807,7 @@ AcpiAmlExecDyadic2S (
/* Create the internal return object */
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_NUMBER);
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
if (!RetDesc)
{
Status = AE_NO_MEMORY;
@ -674,7 +816,7 @@ AcpiAmlExecDyadic2S (
/* Default return value is FALSE, operation did not time out */
RetDesc->Number.Value = 0;
RetDesc->Integer.Value = 0;
/* Examine the opcode */
@ -713,7 +855,7 @@ AcpiAmlExecDyadic2S (
if (Status == AE_TIME)
{
RetDesc->Number.Value = ACPI_INTEGER_MAX; /* TRUE, op timed out */
RetDesc->Integer.Value = ACPI_INTEGER_MAX; /* TRUE, op timed out */
Status = AE_OK;
}
@ -742,7 +884,7 @@ Cleanup:
}
/*****************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiAmlExecDyadic2
*
@ -756,7 +898,7 @@ Cleanup:
* ALLOCATION: Deletes one operand descriptor -- other remains on stack
* containing result value
*
****************************************************************************/
******************************************************************************/
ACPI_STATUS
AcpiAmlExecDyadic2 (
@ -798,7 +940,7 @@ AcpiAmlExecDyadic2 (
/* Create the internal return object */
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_NUMBER);
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
if (!RetDesc)
{
Status = AE_NO_MEMORY;
@ -817,8 +959,8 @@ AcpiAmlExecDyadic2 (
case AML_LAND_OP:
Lboolean = (BOOLEAN) (ObjDesc->Number.Value &&
ObjDesc2->Number.Value);
Lboolean = (BOOLEAN) (ObjDesc->Integer.Value &&
ObjDesc2->Integer.Value);
break;
@ -826,8 +968,8 @@ AcpiAmlExecDyadic2 (
case AML_LEQUAL_OP:
Lboolean = (BOOLEAN) (ObjDesc->Number.Value ==
ObjDesc2->Number.Value);
Lboolean = (BOOLEAN) (ObjDesc->Integer.Value ==
ObjDesc2->Integer.Value);
break;
@ -835,8 +977,8 @@ AcpiAmlExecDyadic2 (
case AML_LGREATER_OP:
Lboolean = (BOOLEAN) (ObjDesc->Number.Value >
ObjDesc2->Number.Value);
Lboolean = (BOOLEAN) (ObjDesc->Integer.Value >
ObjDesc2->Integer.Value);
break;
@ -844,8 +986,8 @@ AcpiAmlExecDyadic2 (
case AML_LLESS_OP:
Lboolean = (BOOLEAN) (ObjDesc->Number.Value <
ObjDesc2->Number.Value);
Lboolean = (BOOLEAN) (ObjDesc->Integer.Value <
ObjDesc2->Integer.Value);
break;
@ -853,8 +995,8 @@ AcpiAmlExecDyadic2 (
case AML_LOR_OP:
Lboolean = (BOOLEAN) (ObjDesc->Number.Value ||
ObjDesc2->Number.Value);
Lboolean = (BOOLEAN) (ObjDesc->Integer.Value ||
ObjDesc2->Integer.Value);
break;
@ -871,11 +1013,11 @@ AcpiAmlExecDyadic2 (
if (Lboolean)
{
RetDesc->Number.Value = ACPI_INTEGER_MAX;
RetDesc->Integer.Value = ACPI_INTEGER_MAX;
}
else
{
RetDesc->Number.Value = 0;
RetDesc->Integer.Value = 0;
}

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: amfield - ACPI AML (p-code) execution - field manipulation
* $Revision: 75 $
* $Revision: 77 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -293,7 +293,8 @@ AcpiAmlAccessNamedField (
FUNCTION_TRACE_PTR ("AmlAccessNamedField", NamedField);
/* Basic data checking */
/* Parameter validation */
if ((!NamedField) || (ACPI_READ == Mode && !Buffer))
{
DEBUG_PRINT (ACPI_ERROR,
@ -375,7 +376,7 @@ AcpiAmlAccessNamedField (
/* TBD: should these round down to a power of 2? */
if (DIV_8(BitGranularity) > ByteFieldLength)
if (DIV_8 (BitGranularity) > ByteFieldLength)
{
DEBUG_PRINT (ACPI_INFO,
("AmlAccessNamedField: Bit granularity %X truncated to %X\n",

View file

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: amfldio - Aml Field I/O
* $Revision: 33 $
* $Revision: 37 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -254,7 +254,7 @@ AcpiAmlReadField (
UINT32 ThisFieldByteOffset;
UINT32 ThisFieldDatumOffset;
UINT32 PreviousRawDatum;
UINT32 ThisRawDatum;
UINT32 ThisRawDatum = 0;
UINT32 ValidFieldBits;
UINT32 Mask;
UINT32 MergedDatum = 0;
@ -331,32 +331,46 @@ AcpiAmlReadField (
while (ThisFieldDatumOffset < DatumLength)
{
/*
* Get the next raw datum, it contains bits of the current
* field datum
* If the field is aligned on a byte boundary, we don't want
* to perform a final read, since this would potentially read
* past the end of the region.
*
* TBD: [Investigate] It may make more sense to just split the aligned
* and non-aligned cases since the aligned case is so very simple,
*/
Status = AcpiAmlReadFieldData (ObjDesc,
ThisFieldByteOffset + ByteGranularity,
BitGranularity, &ThisRawDatum);
if (ACPI_FAILURE (Status))
if ((ObjDesc->Field.BitOffset != 0) ||
((ObjDesc->Field.BitOffset == 0) &&
(ThisFieldDatumOffset < (DatumLength -1))))
{
goto Cleanup;
/*
* Get the next raw datum, it contains some or all bits
* of the current field datum
*/
Status = AcpiAmlReadFieldData (ObjDesc,
ThisFieldByteOffset + ByteGranularity,
BitGranularity, &ThisRawDatum);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
/* Before merging the data, make sure the unused bits are clear */
switch (ByteGranularity)
{
case 1:
ThisRawDatum &= 0x000000FF;
PreviousRawDatum &= 0x000000FF;
break;
case 2:
ThisRawDatum &= 0x0000FFFF;
PreviousRawDatum &= 0x0000FFFF;
break;
}
}
/* Before merging the data, make sure the unused bits are clear */
switch (ByteGranularity)
{
case 1:
ThisRawDatum &= 0x000000FF;
PreviousRawDatum &= 0x000000FF;
break;
case 2:
ThisRawDatum &= 0x0000FFFF;
PreviousRawDatum &= 0x0000FFFF;
break;
}
/*
* Put together bits of the two raw data to make a complete
@ -547,7 +561,6 @@ AcpiAmlWriteFieldDataWithUpdateRule (
MergedValue = FieldValue;
/* Check if update rule needs to be applied (not if mask is all ones) */
/* Decode the update rule */
@ -557,13 +570,18 @@ AcpiAmlWriteFieldDataWithUpdateRule (
case UPDATE_PRESERVE:
/*
* Read the current contents of the byte/word/dword containing
* the field, and merge with the new field value.
*/
Status = AcpiAmlReadFieldData (ObjDesc, ThisFieldByteOffset,
BitGranularity, &CurrentValue);
MergedValue |= (CurrentValue & ~Mask);
/* Check if update rule needs to be applied (not if mask is all ones) */
if (((1 << BitGranularity) -1) & ~Mask)
{
/*
* Read the current contents of the byte/word/dword containing
* the field, and merge with the new field value.
*/
Status = AcpiAmlReadFieldData (ObjDesc, ThisFieldByteOffset,
BitGranularity, &CurrentValue);
MergedValue |= (CurrentValue & ~Mask);
}
break;

View file

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: ammisc - ACPI AML (p-code) execution - specific opcodes
* $Revision: 72 $
* $Revision: 73 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -190,7 +190,7 @@ AcpiAmlExecFatal (
DEBUG_PRINT (ACPI_INFO,
("FatalOp: Type %x Code %x Arg %x <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
TypeDesc->Number.Value, CodeDesc->Number.Value, ArgDesc->Number.Value));
TypeDesc->Integer.Value, CodeDesc->Integer.Value, ArgDesc->Integer.Value));
/*
@ -296,7 +296,7 @@ AcpiAmlExecIndex (
{
/* Object to be indexed is a Package */
if (IdxDesc->Number.Value >= ObjDesc->Package.Count)
if (IdxDesc->Integer.Value >= ObjDesc->Package.Count)
{
DEBUG_PRINT (ACPI_ERROR,
("AmlExecIndex: Index value out of range\n"));
@ -323,7 +323,7 @@ AcpiAmlExecIndex (
* we are after.
*/
TmpDesc = ObjDesc->Package.Elements[IdxDesc->Number.Value];
TmpDesc = ObjDesc->Package.Elements[IdxDesc->Integer.Value];
RetDesc->Reference.OpCode = AML_INDEX_OP;
RetDesc->Reference.TargetType = TmpDesc->Common.Type;
RetDesc->Reference.Object = TmpDesc;
@ -338,14 +338,14 @@ AcpiAmlExecIndex (
*/
RetDesc->Reference.OpCode = AML_INDEX_OP;
RetDesc->Reference.TargetType = ACPI_TYPE_PACKAGE;
RetDesc->Reference.Where = &ObjDesc->Package.Elements[IdxDesc->Number.Value];
RetDesc->Reference.Where = &ObjDesc->Package.Elements[IdxDesc->Integer.Value];
}
else
{
/* Object to be indexed is a Buffer */
if (IdxDesc->Number.Value >= ObjDesc->Buffer.Length)
if (IdxDesc->Integer.Value >= ObjDesc->Buffer.Length)
{
DEBUG_PRINT (ACPI_ERROR,
("AmlExecIndex: Index value out of range\n"));
@ -356,7 +356,7 @@ AcpiAmlExecIndex (
RetDesc->Reference.OpCode = AML_INDEX_OP;
RetDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD;
RetDesc->Reference.Object = ObjDesc;
RetDesc->Reference.Offset = (UINT32) IdxDesc->Number.Value;
RetDesc->Reference.Offset = (UINT32) IdxDesc->Integer.Value;
Status = AcpiAmlExecStore (RetDesc, ResDesc, WalkState);
}
@ -460,8 +460,8 @@ AcpiAmlExecMatch (
/* Validate match comparison sub-opcodes */
if ((Op1Desc->Number.Value > MAX_MATCH_OPERATOR) ||
(Op2Desc->Number.Value > MAX_MATCH_OPERATOR))
if ((Op1Desc->Integer.Value > MAX_MATCH_OPERATOR) ||
(Op2Desc->Integer.Value > MAX_MATCH_OPERATOR))
{
DEBUG_PRINT (ACPI_ERROR,
("AmlExecMatch: operation encoding out of range\n"));
@ -469,7 +469,7 @@ AcpiAmlExecMatch (
goto Cleanup;
}
Index = (UINT32) StartDesc->Number.Value;
Index = (UINT32) StartDesc->Integer.Value;
if (Index >= (UINT32) PkgDesc->Package.Count)
{
DEBUG_PRINT (ACPI_ERROR,
@ -478,7 +478,7 @@ AcpiAmlExecMatch (
goto Cleanup;
}
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_NUMBER);
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
if (!RetDesc)
{
Status = AE_NO_MEMORY;
@ -504,7 +504,7 @@ AcpiAmlExecMatch (
* should we examine its value?
*/
if (!PkgDesc->Package.Elements[Index] ||
ACPI_TYPE_NUMBER != PkgDesc->Package.Elements[Index]->Common.Type)
ACPI_TYPE_INTEGER != PkgDesc->Package.Elements[Index]->Common.Type)
{
continue;
}
@ -515,7 +515,7 @@ AcpiAmlExecMatch (
* "continue" (proceed to next iteration of enclosing
* "for" loop) signifies a non-match.
*/
switch (Op1Desc->Number.Value)
switch (Op1Desc->Integer.Value)
{
case MATCH_MTR: /* always true */
@ -525,8 +525,8 @@ AcpiAmlExecMatch (
case MATCH_MEQ: /* true if equal */
if (PkgDesc->Package.Elements[Index]->Number.Value
!= V1Desc->Number.Value)
if (PkgDesc->Package.Elements[Index]->Integer.Value
!= V1Desc->Integer.Value)
{
continue;
}
@ -535,8 +535,8 @@ AcpiAmlExecMatch (
case MATCH_MLE: /* true if less than or equal */
if (PkgDesc->Package.Elements[Index]->Number.Value
> V1Desc->Number.Value)
if (PkgDesc->Package.Elements[Index]->Integer.Value
> V1Desc->Integer.Value)
{
continue;
}
@ -545,8 +545,8 @@ AcpiAmlExecMatch (
case MATCH_MLT: /* true if less than */
if (PkgDesc->Package.Elements[Index]->Number.Value
>= V1Desc->Number.Value)
if (PkgDesc->Package.Elements[Index]->Integer.Value
>= V1Desc->Integer.Value)
{
continue;
}
@ -555,8 +555,8 @@ AcpiAmlExecMatch (
case MATCH_MGE: /* true if greater than or equal */
if (PkgDesc->Package.Elements[Index]->Number.Value
< V1Desc->Number.Value)
if (PkgDesc->Package.Elements[Index]->Integer.Value
< V1Desc->Integer.Value)
{
continue;
}
@ -565,8 +565,8 @@ AcpiAmlExecMatch (
case MATCH_MGT: /* true if greater than */
if (PkgDesc->Package.Elements[Index]->Number.Value
<= V1Desc->Number.Value)
if (PkgDesc->Package.Elements[Index]->Integer.Value
<= V1Desc->Integer.Value)
{
continue;
}
@ -579,7 +579,7 @@ AcpiAmlExecMatch (
}
switch(Op2Desc->Number.Value)
switch(Op2Desc->Integer.Value)
{
case MATCH_MTR:
@ -589,8 +589,8 @@ AcpiAmlExecMatch (
case MATCH_MEQ:
if (PkgDesc->Package.Elements[Index]->Number.Value
!= V2Desc->Number.Value)
if (PkgDesc->Package.Elements[Index]->Integer.Value
!= V2Desc->Integer.Value)
{
continue;
}
@ -599,8 +599,8 @@ AcpiAmlExecMatch (
case MATCH_MLE:
if (PkgDesc->Package.Elements[Index]->Number.Value
> V2Desc->Number.Value)
if (PkgDesc->Package.Elements[Index]->Integer.Value
> V2Desc->Integer.Value)
{
continue;
}
@ -609,8 +609,8 @@ AcpiAmlExecMatch (
case MATCH_MLT:
if (PkgDesc->Package.Elements[Index]->Number.Value
>= V2Desc->Number.Value)
if (PkgDesc->Package.Elements[Index]->Integer.Value
>= V2Desc->Integer.Value)
{
continue;
}
@ -619,8 +619,8 @@ AcpiAmlExecMatch (
case MATCH_MGE:
if (PkgDesc->Package.Elements[Index]->Number.Value
< V2Desc->Number.Value)
if (PkgDesc->Package.Elements[Index]->Integer.Value
< V2Desc->Integer.Value)
{
continue;
}
@ -629,8 +629,8 @@ AcpiAmlExecMatch (
case MATCH_MGT:
if (PkgDesc->Package.Elements[Index]->Number.Value
<= V2Desc->Number.Value)
if (PkgDesc->Package.Elements[Index]->Integer.Value
<= V2Desc->Integer.Value)
{
continue;
}
@ -650,7 +650,7 @@ AcpiAmlExecMatch (
/* MatchValue is the return value */
RetDesc->Number.Value = MatchValue;
RetDesc->Integer.Value = MatchValue;
Cleanup:

View file

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: ammonad - ACPI AML (p-code) execution for monadic operators
* $Revision: 88 $
* $Revision: 89 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -296,7 +296,7 @@ AcpiAmlExecMonadic1 (
case AML_SLEEP_OP:
AcpiAmlSystemDoSuspend ((UINT32) ObjDesc->Number.Value);
AcpiAmlSystemDoSuspend ((UINT32) ObjDesc->Integer.Value);
break;
@ -304,7 +304,7 @@ AcpiAmlExecMonadic1 (
case AML_STALL_OP:
AcpiAmlSystemDoStall ((UINT32) ObjDesc->Number.Value);
AcpiAmlSystemDoStall ((UINT32) ObjDesc->Integer.Value);
break;
@ -395,7 +395,7 @@ AcpiAmlExecMonadic2R (
case AML_TO_BCD_OP:
case AML_COND_REF_OF_OP:
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_NUMBER);
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
if (!RetDesc)
{
Status = AE_NO_MEMORY;
@ -412,7 +412,7 @@ AcpiAmlExecMonadic2R (
case AML_BIT_NOT_OP:
RetDesc->Number.Value = ~ObjDesc->Number.Value;
RetDesc->Integer.Value = ~ObjDesc->Integer.Value;
break;
@ -420,18 +420,18 @@ AcpiAmlExecMonadic2R (
case AML_FIND_SET_LEFT_BIT_OP:
RetDesc->Number.Value = ObjDesc->Number.Value;
RetDesc->Integer.Value = ObjDesc->Integer.Value;
/*
* Acpi specification describes Integer type as a little
* endian unsigned value, so this boundry condition is valid.
*/
for (ResVal = 0; RetDesc->Number.Value && ResVal < ACPI_INTEGER_BIT_SIZE; ++ResVal)
for (ResVal = 0; RetDesc->Integer.Value && ResVal < ACPI_INTEGER_BIT_SIZE; ++ResVal)
{
RetDesc->Number.Value >>= 1;
RetDesc->Integer.Value >>= 1;
}
RetDesc->Number.Value = ResVal;
RetDesc->Integer.Value = ResVal;
break;
@ -439,20 +439,20 @@ AcpiAmlExecMonadic2R (
case AML_FIND_SET_RIGHT_BIT_OP:
RetDesc->Number.Value = ObjDesc->Number.Value;
RetDesc->Integer.Value = ObjDesc->Integer.Value;
/*
* Acpi specification describes Integer type as a little
* endian unsigned value, so this boundry condition is valid.
*/
for (ResVal = 0; RetDesc->Number.Value && ResVal < ACPI_INTEGER_BIT_SIZE; ++ResVal)
for (ResVal = 0; RetDesc->Integer.Value && ResVal < ACPI_INTEGER_BIT_SIZE; ++ResVal)
{
RetDesc->Number.Value <<= 1;
RetDesc->Integer.Value <<= 1;
}
/* Since returns must be 1-based, subtract from 33 (65) */
RetDesc->Number.Value = ResVal == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - ResVal;
RetDesc->Integer.Value = ResVal == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - ResVal;
break;
@ -463,12 +463,12 @@ AcpiAmlExecMonadic2R (
/*
* The 64-bit ACPI integer can hold 16 4-bit BCD integers
*/
RetDesc->Number.Value = 0;
RetDesc->Integer.Value = 0;
for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++)
{
/* Get one BCD digit */
Digit = (ACPI_INTEGER) ((ObjDesc->Number.Value >> (i * 4)) & 0xF);
Digit = (ACPI_INTEGER) ((ObjDesc->Integer.Value >> (i * 4)) & 0xF);
/* Check the range of the digit */
@ -490,7 +490,7 @@ AcpiAmlExecMonadic2R (
Digit *= 10;
}
RetDesc->Number.Value += Digit;
RetDesc->Integer.Value += Digit;
}
}
break;
@ -501,20 +501,20 @@ AcpiAmlExecMonadic2R (
case AML_TO_BCD_OP:
if (ObjDesc->Number.Value > ACPI_MAX_BCD_VALUE)
if (ObjDesc->Integer.Value > ACPI_MAX_BCD_VALUE)
{
DEBUG_PRINT (ACPI_ERROR, ("Monadic2R/ToBCDOp: BCD overflow: %d\n",
ObjDesc->Number.Value));
ObjDesc->Integer.Value));
Status = AE_AML_NUMERIC_OVERFLOW;
goto Cleanup;
}
RetDesc->Number.Value = 0;
RetDesc->Integer.Value = 0;
for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++)
{
/* Divide by nth factor of 10 */
Digit = ObjDesc->Number.Value;
Digit = ObjDesc->Integer.Value;
for (j = 0; j < i; j++)
{
Digit /= 10;
@ -524,7 +524,7 @@ AcpiAmlExecMonadic2R (
if (Digit > 0)
{
RetDesc->Number.Value += (ACPI_MODULO (Digit, 10) << (i * 4));
RetDesc->Integer.Value += (ACPI_MODULO (Digit, 10) << (i * 4));
}
}
break;
@ -547,7 +547,7 @@ AcpiAmlExecMonadic2R (
* return FALSE
*/
RetDesc->Number.Value = 0;
RetDesc->Integer.Value = 0;
/*
* Must delete the result descriptor since there is no reference
@ -570,7 +570,7 @@ AcpiAmlExecMonadic2R (
/* The object exists in the namespace, return TRUE */
RetDesc->Number.Value = ACPI_INTEGER_MAX;
RetDesc->Integer.Value = ACPI_INTEGER_MAX;
goto Cleanup;
break;
@ -750,14 +750,14 @@ AcpiAmlExecMonadic2 (
case AML_LNOT_OP:
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_NUMBER);
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
if (!RetDesc)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
RetDesc->Number.Value = !ObjDesc->Number.Value;
RetDesc->Integer.Value = !ObjDesc->Integer.Value;
break;
@ -819,11 +819,11 @@ AcpiAmlExecMonadic2 (
if (AML_INCREMENT_OP == Opcode)
{
RetDesc->Number.Value++;
RetDesc->Integer.Value++;
}
else
{
RetDesc->Number.Value--;
RetDesc->Integer.Value--;
}
/* Store the result back in the original descriptor */
@ -855,7 +855,7 @@ AcpiAmlExecMonadic2 (
/* Constants are of type Number */
Type = ACPI_TYPE_NUMBER;
Type = ACPI_TYPE_INTEGER;
break;
@ -918,14 +918,14 @@ AcpiAmlExecMonadic2 (
/* Allocate a descriptor to hold the type. */
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_NUMBER);
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
if (!RetDesc)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
RetDesc->Number.Value = Type;
RetDesc->Integer.Value = Type;
break;
@ -985,14 +985,14 @@ AcpiAmlExecMonadic2 (
* object to hold the value
*/
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_NUMBER);
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
if (!RetDesc)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
RetDesc->Number.Value = Value;
RetDesc->Integer.Value = Value;
break;
@ -1112,7 +1112,7 @@ AcpiAmlExecMonadic2 (
* sub-buffer of the main buffer, it is only a pointer to a
* single element (byte) of the buffer!
*/
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_NUMBER);
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
if (!RetDesc)
{
Status = AE_NO_MEMORY;
@ -1120,7 +1120,7 @@ AcpiAmlExecMonadic2 (
}
TmpDesc = ObjDesc->Reference.Object;
RetDesc->Number.Value =
RetDesc->Integer.Value =
TmpDesc->Buffer.Pointer[ObjDesc->Reference.Offset];
/* TBD: [Investigate] (see below) Don't add an additional

View file

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: amnames - interpreter/scanner name load/execute
* $Revision: 72 $
* $Revision: 73 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: amprep - ACPI AML (p-code) execution - field prep utilities
* $Revision: 72 $
* $Revision: 73 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: amregion - ACPI default OpRegion (address space) handlers
* $Revision: 42 $
* $Revision: 44 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -198,8 +198,8 @@ AcpiAmlSystemMemorySpaceHandler (
*/
if ((Address < MemInfo->MappedPhysicalAddress) ||
((Address + Length) >
(MemInfo->MappedPhysicalAddress + MemInfo->MappedLength)))
(((ACPI_INTEGER) Address + Length) >
((ACPI_INTEGER) MemInfo->MappedPhysicalAddress + MemInfo->MappedLength)))
{
/*
* The request cannot be resolved by the current memory mapping;
@ -240,7 +240,7 @@ AcpiAmlSystemMemorySpaceHandler (
/* TBD: should these pointers go to 64-bit in all cases ? */
LogicalAddrPtr = MemInfo->MappedLogicalAddress +
(Address - MemInfo->MappedPhysicalAddress);
((ACPI_INTEGER) Address - (ACPI_INTEGER) MemInfo->MappedPhysicalAddress);
/* Perform the memory read or write */

View file

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: amresnte - AML Interpreter object resolution
* $Revision: 26 $
* $Revision: 27 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -147,7 +147,7 @@
* can be either a pointer to an actual internal object or a pointer into the
* AML stream itself. These types are currently:
*
* ACPI_TYPE_NUMBER
* ACPI_TYPE_INTEGER
* ACPI_TYPE_STRING
* ACPI_TYPE_BUFFER
* ACPI_TYPE_MUTEX
@ -335,7 +335,7 @@ AcpiAmlResolveNodeToValue (
break;
case ACPI_TYPE_NUMBER:
case ACPI_TYPE_INTEGER:
DEBUG_PRINT (TRACE_EXEC, ("AmlResolveEntryToValue: case Number \n"));
@ -344,7 +344,7 @@ AcpiAmlResolveNodeToValue (
* number
*/
if (ACPI_TYPE_NUMBER != ValDesc->Common.Type)
if (ACPI_TYPE_INTEGER != ValDesc->Common.Type)
{
DEBUG_PRINT (ACPI_ERROR,
("AmlResolveToValue: Object not a Number, type %X\n",
@ -379,7 +379,7 @@ AcpiAmlResolveNodeToValue (
}
else
{
ObjectType = ACPI_TYPE_NUMBER;
ObjectType = ACPI_TYPE_INTEGER;
}
/*
@ -423,7 +423,7 @@ AcpiAmlResolveNodeToValue (
return_ACPI_STATUS (Status);
}
ObjDesc->Number.Value = TempVal;
ObjDesc->Integer.Value = TempVal;
}
@ -484,13 +484,13 @@ AcpiAmlResolveNodeToValue (
/* Create an object for the result */
ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_NUMBER);
ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
if (!ObjDesc)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
ObjDesc->Number.Value = TempVal;
ObjDesc->Integer.Value = TempVal;
break;
@ -542,13 +542,13 @@ AcpiAmlResolveNodeToValue (
/* Create an object for the result */
ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_NUMBER);
ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
if (!ObjDesc)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
ObjDesc->Number.Value = TempVal;
ObjDesc->Integer.Value = TempVal;
break;
@ -660,13 +660,13 @@ AcpiAmlResolveNodeToValue (
/* Create object for result */
ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_NUMBER);
ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
if (!ObjDesc)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
ObjDesc->Number.Value = TempVal;
ObjDesc->Integer.Value = TempVal;
/* Truncate value if we are executing from a 32-bit ACPI table */

View file

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: amresolv - AML Interpreter object resolution
* $Revision: 79 $
* $Revision: 81 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -230,19 +230,19 @@ AcpiAmlGetFieldUnitValue (
Mask = ACPI_UINT32_MAX;
}
ResultDesc->Number.Type = (UINT8) ACPI_TYPE_NUMBER;
ResultDesc->Integer.Type = (UINT8) ACPI_TYPE_INTEGER;
/* Get the 32 bit value at the location */
MOVE_UNALIGNED32_TO_32 (&ResultDesc->Number.Value, Location);
MOVE_UNALIGNED32_TO_32 (&ResultDesc->Integer.Value, Location);
/*
* Shift the 32-bit word containing the field, and mask off the
* resulting value
*/
ResultDesc->Number.Value =
(ResultDesc->Number.Value >> FieldDesc->FieldUnit.BitOffset) & Mask;
ResultDesc->Integer.Value =
(ResultDesc->Integer.Value >> FieldDesc->FieldUnit.BitOffset) & Mask;
DEBUG_PRINT (ACPI_INFO,
("** Read from buffer %p byte %ld bit %d width %d addr %p mask %08lx val %08lx\n",
@ -250,7 +250,7 @@ AcpiAmlGetFieldUnitValue (
FieldDesc->FieldUnit.Offset,
FieldDesc->FieldUnit.BitOffset,
FieldDesc->FieldUnit.Length,
Location, Mask, ResultDesc->Number.Value));
Location, Mask, ResultDesc->Integer.Value));
/* Release global lock if we acquired it earlier */
@ -270,7 +270,7 @@ AcpiAmlGetFieldUnitValue (
*
* RETURN: Status
*
* DESCRIPTION: Convert Reference entries on ObjStack to Rvalues
* DESCRIPTION: Convert Reference objects to values
*
******************************************************************************/
@ -419,13 +419,13 @@ AcpiAmlResolveObjectToValue (
("AmlResolveObjectToValue: [Local%d] ValueObj is %p\n",
Index, ObjDesc));
if (ACPI_TYPE_NUMBER == ObjDesc->Common.Type)
if (ACPI_TYPE_INTEGER == ObjDesc->Common.Type)
{
/* Value is a Number */
DEBUG_PRINT (ACPI_INFO,
("AmlResolveObjectToValue: [Local%d] value=%X \n",
Index, ObjDesc->Number.Value));
Index, ObjDesc->Integer.Value));
}
break;
@ -460,13 +460,13 @@ AcpiAmlResolveObjectToValue (
("AmlResolveObjectToValue: [Arg%d] ValueObj is %p\n",
Index, ObjDesc));
if (ACPI_TYPE_NUMBER == ObjDesc->Common.Type)
if (ACPI_TYPE_INTEGER == ObjDesc->Common.Type)
{
/* Value is a Number */
DEBUG_PRINT (ACPI_INFO,
("AmlResolveObjectToValue: [Arg%d] value=%X\n",
Index, ObjDesc->Number.Value));
Index, ObjDesc->Integer.Value));
}
break;
@ -479,22 +479,22 @@ AcpiAmlResolveObjectToValue (
case AML_ZERO_OP:
StackDesc->Common.Type = (UINT8) ACPI_TYPE_NUMBER;
StackDesc->Number.Value = 0;
StackDesc->Common.Type = (UINT8) ACPI_TYPE_INTEGER;
StackDesc->Integer.Value = 0;
break;
case AML_ONE_OP:
StackDesc->Common.Type = (UINT8) ACPI_TYPE_NUMBER;
StackDesc->Number.Value = 1;
StackDesc->Common.Type = (UINT8) ACPI_TYPE_INTEGER;
StackDesc->Integer.Value = 1;
break;
case AML_ONES_OP:
StackDesc->Common.Type = (UINT8) ACPI_TYPE_NUMBER;
StackDesc->Number.Value = ACPI_INTEGER_MAX;
StackDesc->Common.Type = (UINT8) ACPI_TYPE_INTEGER;
StackDesc->Integer.Value = ACPI_INTEGER_MAX;
/* Truncate value if we are executing from a 32-bit ACPI table */

View file

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: amresop - AML Interpreter operand/object resolution
* $Revision: 19 $
* $Revision: 22 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -350,8 +350,13 @@ AcpiAmlResolveOperands (
switch (ThisArgType)
{
case ARGI_REFERENCE: /* Reference */
case ARGI_TARGETREF:
case ARGI_REFERENCE: /* References */
case ARGI_INTEGER_REF:
case ARGI_OBJECT_REF:
case ARGI_DEVICE_REF:
case ARGI_TARGETREF: /* TBD: must implement implicit conversion rules before store */
case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */
/* Need an operand of type INTERNAL_TYPE_REFERENCE */
@ -423,20 +428,6 @@ AcpiAmlResolveOperands (
* For the simple cases, only one type of resolved object
* is allowed
*/
case ARGI_NUMBER: /* Number */
/* Need an operand of type ACPI_TYPE_NUMBER */
TypeNeeded = ACPI_TYPE_NUMBER;
break;
case ARGI_BUFFER:
/* Need an operand of type ACPI_TYPE_BUFFER */
TypeNeeded = ACPI_TYPE_BUFFER;
break;
case ARGI_MUTEX:
/* Need an operand of type ACPI_TYPE_MUTEX */
@ -484,15 +475,91 @@ AcpiAmlResolveOperands (
* The more complex cases allow multiple resolved object types
*/
case ARGI_INTEGER: /* Number */
/*
* Need an operand of type ACPI_TYPE_INTEGER,
* But we can implicitly convert from a STRING or BUFFER
*/
Status = AcpiAmlConvertToInteger (StackPtr, WalkState);
if (ACPI_FAILURE (Status))
{
if (Status == AE_TYPE)
{
DEBUG_PRINT (ACPI_INFO,
("AmlResolveOperands: Needed [Integer/String/Buffer], found [%s] %p\n",
AcpiCmGetTypeName ((*StackPtr)->Common.Type), *StackPtr));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
return_ACPI_STATUS (Status);
}
goto NextOperand;
break;
case ARGI_BUFFER:
/*
* Need an operand of type ACPI_TYPE_BUFFER,
* But we can implicitly convert from a STRING or INTEGER
*/
Status = AcpiAmlConvertToBuffer (StackPtr, WalkState);
if (ACPI_FAILURE (Status))
{
if (Status == AE_TYPE)
{
DEBUG_PRINT (ACPI_INFO,
("AmlResolveOperands: Needed [Integer/String/Buffer], found [%s] %p\n",
AcpiCmGetTypeName ((*StackPtr)->Common.Type), *StackPtr));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
return_ACPI_STATUS (Status);
}
goto NextOperand;
break;
case ARGI_STRING:
/* Need an operand of type ACPI_TYPE_STRING or ACPI_TYPE_BUFFER */
/*
* Need an operand of type ACPI_TYPE_STRING,
* But we can implicitly convert from a BUFFER or INTEGER
*/
Status = AcpiAmlConvertToString (StackPtr, WalkState);
if (ACPI_FAILURE (Status))
{
if (Status == AE_TYPE)
{
DEBUG_PRINT (ACPI_INFO,
("AmlResolveOperands: Needed [Integer/String/Buffer], found [%s] %p\n",
AcpiCmGetTypeName ((*StackPtr)->Common.Type), *StackPtr));
if ((ACPI_TYPE_STRING != (*StackPtr)->Common.Type) &&
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
return_ACPI_STATUS (Status);
}
goto NextOperand;
break;
case ARGI_COMPUTEDATA:
/* Need an operand of type INTEGER, STRING or BUFFER */
if ((ACPI_TYPE_INTEGER != (*StackPtr)->Common.Type) &&
(ACPI_TYPE_STRING != (*StackPtr)->Common.Type) &&
(ACPI_TYPE_BUFFER != (*StackPtr)->Common.Type))
{
DEBUG_PRINT (ACPI_INFO,
("AmlResolveOperands: Needed [String or Buffer], found [%s] %p\n",
("AmlResolveOperands: Needed [Integer/String/Buffer], found [%s] %p\n",
AcpiCmGetTypeName ((*StackPtr)->Common.Type), *StackPtr));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);

View file

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: amstore - AML Interpreter object store support
* $Revision: 118 $
* $Revision: 121 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -130,6 +130,10 @@
MODULE_NAME ("amstore")
/*******************************************************************************
*
* FUNCTION: AcpiAmlExecStore
@ -156,18 +160,10 @@ AcpiAmlExecStore (
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *DeleteDestDesc = NULL;
ACPI_OPERAND_OBJECT *TmpDesc;
ACPI_NAMESPACE_NODE *Node = NULL;
UINT8 Value = 0;
UINT32 Length;
UINT32 i;
ACPI_OPERAND_OBJECT *RefDesc = DestDesc;
FUNCTION_TRACE ("AmlExecStore");
DEBUG_PRINT (ACPI_INFO, ("entered AcpiAmlExecStore: Val=%p, Dest=%p\n",
ValDesc, DestDesc));
FUNCTION_TRACE_PTR ("AmlExecStore", DestDesc);
/* Validate parameters */
@ -179,80 +175,185 @@ AcpiAmlExecStore (
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
/* Examine the datatype of the DestDesc */
/* DestDesc can be either a namespace node or an ACPI object */
if (VALID_DESCRIPTOR_TYPE (DestDesc, ACPI_DESC_TYPE_NAMED))
{
/* Dest is an ACPI_HANDLE, create a new object */
/*
* Dest is a namespace node,
* Storing an object into a Name "container"
*/
Status = AcpiAmlStoreObjectToNode (ValDesc,
(ACPI_NAMESPACE_NODE *) DestDesc, WalkState);
Node = (ACPI_NAMESPACE_NODE *) DestDesc;
DestDesc = AcpiCmCreateInternalObject (INTERNAL_TYPE_REFERENCE);
if (!DestDesc)
{
/* Allocation failure */
/* All done, that's it */
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Build a new Reference wrapper around the handle */
DestDesc->Reference.OpCode = AML_NAME_OP;
DestDesc->Reference.Object = Node;
return_ACPI_STATUS (Status);
}
else
{
DEBUG_PRINT (ACPI_INFO,
("AmlExecStore: Dest is object (not handle) - may be deleted!\n"));
}
/* Destination object must be of type Reference */
/* Destination object must be an object of type Reference */
if (DestDesc->Common.Type != INTERNAL_TYPE_REFERENCE)
{
/* Destination is not an Reference */
DEBUG_PRINT (ACPI_ERROR,
("AmlExecStore: Destination is not an Reference [%p]\n", DestDesc));
("AmlExecStore: Destination is not a ReferenceObj [%p]\n", DestDesc));
DUMP_STACK_ENTRY (ValDesc);
DUMP_STACK_ENTRY (DestDesc);
DUMP_OPERANDS (&DestDesc, IMODE_EXECUTE, "AmlExecStore",
2, "target not Reference");
2, "Target is not a ReferenceObj");
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/* Examine the Reference opcode */
switch (DestDesc->Reference.OpCode)
/*
* Examine the Reference opcode. These cases are handled:
*
* 1) Store to Name (Change the object associated with a name)
* 2) Store to an indexed area of a Buffer or Package
* 3) Store to a Method Local or Arg
* 4) Store to the debug object
* 5) Store to a constant -- a noop
*/
switch (RefDesc->Reference.OpCode)
{
case AML_NAME_OP:
/*
* Storing into a Name
*/
DeleteDestDesc = DestDesc;
Status = AcpiAmlStoreObjectToNode (ValDesc, DestDesc->Reference.Object,
WalkState);
/* Storing an object into a Name "container" */
break; /* Case NameOp */
Status = AcpiAmlStoreObjectToNode (ValDesc, RefDesc->Reference.Object,
WalkState);
break;
case AML_INDEX_OP:
DeleteDestDesc = DestDesc;
/* Storing to an Index (pointer into a packager or buffer) */
Status = AcpiAmlStoreObjectToIndex (ValDesc, RefDesc, WalkState);
break;
case AML_LOCAL_OP:
Status = AcpiDsMethodDataSetValue (MTH_TYPE_LOCAL,
(RefDesc->Reference.Offset), ValDesc, WalkState);
break;
case AML_ARG_OP:
Status = AcpiDsMethodDataSetValue (MTH_TYPE_ARG,
(RefDesc->Reference.Offset), ValDesc, WalkState);
break;
case AML_DEBUG_OP:
/*
* Valid source value and destination reference pointer.
* Storing to the Debug object causes the value stored to be
* displayed and otherwise has no effect -- see ACPI Specification
*
* ACPI Specification 1.0B section 15.2.3.4.2.13:
* Destination should point to either a buffer or a package
* TBD: print known object types "prettier".
*/
DEBUG_PRINT (ACPI_INFO, ("**** Write to Debug Object: ****: \n"));
if (ValDesc->Common.Type == ACPI_TYPE_STRING)
{
DEBUG_PRINT (ACPI_INFO, ("%s\n", ValDesc->String.Pointer));
}
else
{
DUMP_STACK_ENTRY (ValDesc);
}
break;
case AML_ZERO_OP:
case AML_ONE_OP:
case AML_ONES_OP:
/*
* Actually, storing to a package is not so simple. The source must be
* Storing to a constant is a no-op -- see ACPI Specification
* Delete the reference descriptor, however
*/
break;
default:
DEBUG_PRINT (ACPI_ERROR,
("AmlExecStore: Internal error - Unknown Reference subtype %02x\n",
RefDesc->Reference.OpCode));
/* TBD: [Restructure] use object dump routine !! */
DUMP_BUFFER (RefDesc, sizeof (ACPI_OPERAND_OBJECT));
Status = AE_AML_INTERNAL;
break;
} /* switch (RefDesc->Reference.OpCode) */
/* Always delete the reference descriptor object */
if (RefDesc)
{
AcpiCmRemoveReference (RefDesc);
}
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiAmlStoreObjectToIndex
*
* PARAMETERS: *ValDesc - Value to be stored
* *Node - Named object to recieve the value
*
* RETURN: Status
*
* DESCRIPTION: Store the object to the named object.
*
******************************************************************************/
ACPI_STATUS
AcpiAmlStoreObjectToIndex (
ACPI_OPERAND_OBJECT *ValDesc,
ACPI_OPERAND_OBJECT *DestDesc,
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *ObjDesc;
UINT32 Length;
UINT32 i;
UINT8 Value = 0;
FUNCTION_TRACE ("AcpiAmlStoreObjectToIndex");
/*
* Destination must be a reference pointer, and
* must point to either a buffer or a package
*/
switch (DestDesc->Reference.TargetType)
{
case ACPI_TYPE_PACKAGE:
/*
* Storing to a package element is not simple. The source must be
* evaluated and converted to the type of the destination and then the
* source is copied into the destination - we can't just point to the
* source object.
@ -263,8 +364,8 @@ AcpiAmlExecStore (
* The object at *(DestDesc->Reference.Where) is the
* element within the package that is to be modified.
*/
TmpDesc = *(DestDesc->Reference.Where);
if (TmpDesc)
ObjDesc = *(DestDesc->Reference.Where);
if (ObjDesc)
{
/*
* If the Destination element is a package, we will delete
@ -274,46 +375,44 @@ AcpiAmlExecStore (
* to be packages?
* && (ValDesc->Common.Type == ACPI_TYPE_PACKAGE)
*/
if (TmpDesc->Common.Type == ACPI_TYPE_PACKAGE)
if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE)
{
/*
* Take away the reference for being part of a package and
* delete
*/
AcpiCmRemoveReference (TmpDesc);
AcpiCmRemoveReference (TmpDesc);
AcpiCmRemoveReference (ObjDesc);
AcpiCmRemoveReference (ObjDesc);
TmpDesc = NULL;
ObjDesc = NULL;
}
}
if (!TmpDesc)
if (!ObjDesc)
{
/*
* If the TmpDesc is NULL, that means an uninitialized package
* has been used as a destination, therefore, we must create
* the destination element to match the type of the source
* element NOTE: ValDesc can be of any type.
* If the ObjDesc is NULL, it means that an uninitialized package
* element has been used as a destination (this is OK), therefore,
* we must create the destination element to match the type of the
* source element NOTE: ValDesc can be of any type.
*/
TmpDesc = AcpiCmCreateInternalObject (ValDesc->Common.Type);
if (!TmpDesc)
ObjDesc = AcpiCmCreateInternalObject (ValDesc->Common.Type);
if (!ObjDesc)
{
Status = AE_NO_MEMORY;
goto Cleanup;
return_ACPI_STATUS (AE_NO_MEMORY);
}
/*
* If the source is a package, copy the source to the new dest
*/
if (ACPI_TYPE_PACKAGE == TmpDesc->Common.Type)
if (ACPI_TYPE_PACKAGE == ObjDesc->Common.Type)
{
Status = AcpiAmlBuildCopyInternalPackageObject (
ValDesc, TmpDesc, WalkState);
ValDesc, ObjDesc, WalkState);
if (ACPI_FAILURE (Status))
{
AcpiCmRemoveReference (TmpDesc);
TmpDesc = NULL;
goto Cleanup;
AcpiCmRemoveReference (ObjDesc);
return_ACPI_STATUS (Status);
}
}
@ -323,18 +422,18 @@ AcpiAmlExecStore (
* part of the parent package
*/
*(DestDesc->Reference.Where) = TmpDesc;
AcpiCmAddReference (TmpDesc);
*(DestDesc->Reference.Where) = ObjDesc;
AcpiCmAddReference (ObjDesc);
}
if (ACPI_TYPE_PACKAGE != TmpDesc->Common.Type)
if (ACPI_TYPE_PACKAGE != ObjDesc->Common.Type)
{
/*
* The destination element is not a package, so we need to
* convert the contents of the source (ValDesc) and copy into
* the destination (TmpDesc)
* the destination (ObjDesc)
*/
Status = AcpiAmlStoreObjectToObject (ValDesc, TmpDesc,
Status = AcpiAmlStoreObjectToObject (ValDesc, ObjDesc,
WalkState);
if (ACPI_FAILURE (Status))
{
@ -344,22 +443,14 @@ AcpiAmlExecStore (
*/
DEBUG_PRINT (ACPI_ERROR,
("AmlExecStore/Index: Unable to copy the internal object\n"));
Status = AE_AML_OPERAND_TYPE;
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
}
break;
}
break;
/*
* Check that the destination is a Buffer Field type
*/
if (DestDesc->Reference.TargetType != ACPI_TYPE_BUFFER_FIELD)
{
Status = AE_AML_OPERAND_TYPE;
break;
}
case ACPI_TYPE_BUFFER_FIELD:
/*
* Storing into a buffer at a location defined by an Index.
*
@ -368,14 +459,12 @@ AcpiAmlExecStore (
*/
/*
* Set the TmpDesc to the destination object and type check.
* Set the ObjDesc to the destination object and type check.
*/
TmpDesc = DestDesc->Reference.Object;
if (TmpDesc->Common.Type != ACPI_TYPE_BUFFER)
ObjDesc = DestDesc->Reference.Object;
if (ObjDesc->Common.Type != ACPI_TYPE_BUFFER)
{
Status = AE_AML_OPERAND_TYPE;
break;
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/*
@ -386,16 +475,16 @@ AcpiAmlExecStore (
switch (ValDesc->Common.Type)
{
/*
* If the type is Integer, the Length is 4.
* If the type is Integer, assign bytewise
* This loop to assign each of the elements is somewhat
* backward because of the Big Endian-ness of IA-64
* backward because of the Big Endian-ness of IA-64
*/
case ACPI_TYPE_NUMBER:
Length = 4;
case ACPI_TYPE_INTEGER:
Length = sizeof (ACPI_INTEGER);
for (i = Length; i != 0; i--)
{
Value = (UINT8)(ValDesc->Number.Value >> (MUL_8 (i - 1)));
TmpDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value;
Value = (UINT8)(ValDesc->Integer.Value >> (MUL_8 (i - 1)));
ObjDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value;
}
break;
@ -408,7 +497,7 @@ AcpiAmlExecStore (
for (i = 0; i < Length; i++)
{
Value = *(ValDesc->Buffer.Pointer + i);
TmpDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value;
ObjDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value;
}
break;
@ -421,7 +510,7 @@ AcpiAmlExecStore (
for (i = 0; i < Length; i++)
{
Value = *(ValDesc->String.Pointer + i);
TmpDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value;
ObjDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value;
}
break;
@ -435,97 +524,242 @@ AcpiAmlExecStore (
Status = AE_AML_OPERAND_TYPE;
break;
}
/*
* If we had an error, break out of this case statement.
*/
if (ACPI_FAILURE (Status))
{
break;
}
/*
* Set the return pointer
*/
DestDesc = TmpDesc;
break;
case AML_ZERO_OP:
case AML_ONE_OP:
case AML_ONES_OP:
/*
* Storing to a constant is a no-op -- see ACPI Specification
* Delete the result descriptor.
*/
DeleteDestDesc = DestDesc;
break;
case AML_LOCAL_OP:
Status = AcpiDsMethodDataSetValue (MTH_TYPE_LOCAL,
(DestDesc->Reference.Offset), ValDesc, WalkState);
DeleteDestDesc = DestDesc;
break;
case AML_ARG_OP:
Status = AcpiDsMethodDataSetValue (MTH_TYPE_ARG,
(DestDesc->Reference.Offset), ValDesc, WalkState);
DeleteDestDesc = DestDesc;
break;
case AML_DEBUG_OP:
/*
* Storing to the Debug object causes the value stored to be
* displayed and otherwise has no effect -- see ACPI Specification
*/
DEBUG_PRINT (ACPI_INFO, ("**** Write to Debug Object: ****: \n"));
if (ValDesc->Common.Type == ACPI_TYPE_STRING)
{
DEBUG_PRINT (ACPI_INFO, ("%s\n", ValDesc->String.Pointer));
}
else
{
DUMP_STACK_ENTRY (ValDesc);
}
DeleteDestDesc = DestDesc;
break;
default:
DEBUG_PRINT (ACPI_ERROR,
("AmlExecStore: Internal error - Unknown Reference subtype %02x\n",
DestDesc->Reference.OpCode));
/* TBD: [Restructure] use object dump routine !! */
DUMP_BUFFER (DestDesc, sizeof (ACPI_OPERAND_OBJECT));
DeleteDestDesc = DestDesc;
Status = AE_AML_INTERNAL;
} /* switch(DestDesc->Reference.OpCode) */
Cleanup:
/* Cleanup and exit*/
if (DeleteDestDesc)
{
AcpiCmRemoveReference (DeleteDestDesc);
("AmlExecStoreIndex: Target is not a Package or BufferField\n"));
Status = AE_AML_OPERAND_TYPE;
break;
}
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiAmlStoreObjectToNode
*
* PARAMETERS: *SourceDesc - Value to be stored
* *Node - Named object to recieve the value
*
* RETURN: Status
*
* DESCRIPTION: Store the object to the named object.
*
* The Assignment of an object to a named object is handled here
* The val passed in will replace the current value (if any)
* with the input value.
*
* When storing into an object the data is converted to the
* target object type then stored in the object. This means
* that the target object type (for an initialized target) will
* not be changed by a store operation.
*
* NOTE: the global lock is acquired early. This will result
* in the global lock being held a bit longer. Also, if the
* function fails during set up we may get the lock when we
* don't really need it. I don't think we care.
*
******************************************************************************/
ACPI_STATUS
AcpiAmlStoreObjectToNode (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_NAMESPACE_NODE *Node,
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *TargetDesc;
OBJECT_TYPE_INTERNAL TargetType = ACPI_TYPE_ANY;
FUNCTION_TRACE ("AmlStoreObjectToNode");
/*
* Assuming the parameters were already validated
*/
ACPI_ASSERT((Node) && (SourceDesc));
/*
* Get current type of the node, and object attached to Node
*/
TargetType = AcpiNsGetType (Node);
TargetDesc = AcpiNsGetAttachedObject (Node);
DEBUG_PRINT (ACPI_INFO, ("AmlStoreObjectToNode: Storing %p(%s) into node %p(%s)\n",
Node, AcpiCmGetTypeName (SourceDesc->Common.Type),
SourceDesc, AcpiCmGetTypeName (TargetType)));
/*
* Resolve the source object to an actual value
* (If it is a reference object)
*/
Status = AcpiAmlResolveObject (&SourceDesc, TargetType, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* Do the actual store operation
*/
switch (TargetType)
{
case INTERNAL_TYPE_DEF_FIELD:
/* Raw data copy for target types Integer/String/Buffer */
Status = AcpiAmlCopyDataToNamedField (SourceDesc, Node);
break;
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
case INTERNAL_TYPE_BANK_FIELD:
case INTERNAL_TYPE_INDEX_FIELD:
case ACPI_TYPE_FIELD_UNIT:
/*
* These target types are all of type Integer/String/Buffer, and
* therefore support implicit conversion before the store.
*
* Copy and/or convert the source object to a new target object
*/
Status = AcpiAmlStoreObject (SourceDesc, TargetType, &TargetDesc, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* Store the new TargetDesc as the new value of the Name, and set
* the Name's type to that of the value being stored in it.
* SourceDesc reference count is incremented by AttachObject.
*/
Status = AcpiNsAttachObject (Node, TargetDesc, TargetType);
DEBUG_PRINT (ACPI_INFO,
("AmlStoreObjectToNode: Store %s into %s via Convert/Attach\n",
AcpiCmGetTypeName (TargetDesc->Common.Type),
AcpiCmGetTypeName (TargetType)));
break;
default:
/* No conversions for all other types. Just attach the source object */
Status = AcpiNsAttachObject (Node, SourceDesc, SourceDesc->Common.Type);
DEBUG_PRINT (ACPI_INFO,
("AmlStoreObjectToNode: Store %s into %s via Attach only\n",
AcpiCmGetTypeName (SourceDesc->Common.Type),
AcpiCmGetTypeName (SourceDesc->Common.Type)));
break;
}
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiAmlStoreObjectToObject
*
* PARAMETERS: *SourceDesc - Value to be stored
* *DestDesc - Object to receive the value
*
* RETURN: Status
*
* DESCRIPTION: Store an object to another object.
*
* The Assignment of an object to another (not named) object
* is handled here.
* The val passed in will replace the current value (if any)
* with the input value.
*
* When storing into an object the data is converted to the
* target object type then stored in the object. This means
* that the target object type (for an initialized target) will
* not be changed by a store operation.
*
* This module allows destination types of Number, String,
* and Buffer.
*
******************************************************************************/
ACPI_STATUS
AcpiAmlStoreObjectToObject (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *DestDesc,
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status = AE_OK;
OBJECT_TYPE_INTERNAL DestinationType = DestDesc->Common.Type;
FUNCTION_TRACE ("AmlStoreObjectToObject");
/*
* Assuming the parameters are valid!
*/
ACPI_ASSERT((DestDesc) && (SourceDesc));
DEBUG_PRINT (ACPI_INFO, ("AmlStoreObjectToObject: Storing %p(%s) to (%p)%s\n",
SourceDesc, AcpiCmGetTypeName (SourceDesc->Common.Type),
DestDesc, AcpiCmGetTypeName (DestDesc->Common.Type)));
/*
* From this interface, we only support Integers/Strings/Buffers
*/
switch (DestinationType)
{
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
break;
default:
DEBUG_PRINT (ACPI_WARN,
("AmlStoreObjectToObject: Store into %s not implemented\n",
AcpiCmGetTypeName (DestDesc->Common.Type)));
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
}
/*
* Resolve the source object to an actual value
* (If it is a reference object)
*/
Status = AcpiAmlResolveObject (&SourceDesc, DestinationType, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* Copy and/or convert the source object to the destination object
*/
Status = AcpiAmlStoreObject (SourceDesc, DestinationType, &DestDesc, WalkState);
return_ACPI_STATUS (Status);
}

View file

@ -2,8 +2,8 @@
/******************************************************************************
*
* Module Name: amstoren - AML Interpreter object store support,
* Store to Node (namespace object)
* $Revision: 25 $
* Store to Node (namespace object)
* $Revision: 28 $
*
*****************************************************************************/
@ -11,7 +11,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -131,587 +131,245 @@
MODULE_NAME ("amstoren")
/*******************************************************************************
*
* FUNCTION: AcpiAmlStoreObjectToNode
* FUNCTION: AcpiAmlResolveObject
*
* PARAMETERS: *ValDesc - Value to be stored
* *Node - Named object to recieve the value
* PARAMETERS: SourceDescPtr - Pointer to the source object
* TargetType - Current type of the target
* WalkState - Current walk state
*
* RETURN: Status
* RETURN: Status, resolved object in SourceDescPtr.
*
* DESCRIPTION: Store the object to the named object.
*
* The Assignment of an object to a named object is handled here
* The val passed in will replace the current value (if any)
* with the input value.
*
* When storing into an object the data is converted to the
* target object type then stored in the object. This means
* that the target object type (for an initialized target) will
* not be changed by a store operation.
*
* NOTE: the global lock is acquired early. This will result
* in the global lock being held a bit longer. Also, if the
* function fails during set up we may get the lock when we
* don't really need it. I don't think we care.
* DESCRIPTION: Resolve an object. If the object is a reference, dereference
* it and return the actual object in the SourceDescPtr.
*
******************************************************************************/
ACPI_STATUS
AcpiAmlStoreObjectToNode (
ACPI_OPERAND_OBJECT *ValDesc,
ACPI_NAMESPACE_NODE *Node,
AcpiAmlResolveObject (
ACPI_OPERAND_OBJECT **SourceDescPtr,
OBJECT_TYPE_INTERNAL TargetType,
ACPI_WALK_STATE *WalkState)
{
ACPI_OPERAND_OBJECT *SourceDesc = *SourceDescPtr;
ACPI_STATUS Status = AE_OK;
UINT8 *Buffer = NULL;
UINT32 Length = 0;
UINT32 Mask;
UINT32 NewValue;
BOOLEAN Locked = FALSE;
UINT8 *Location=NULL;
ACPI_OPERAND_OBJECT *DestDesc;
OBJECT_TYPE_INTERNAL DestinationType = ACPI_TYPE_ANY;
FUNCTION_TRACE ("AmlStoreObjectToNte");
FUNCTION_TRACE ("AmlResolveObject");
DEBUG_PRINT (ACPI_INFO,
("entered AcpiAmlStoreObjectToNode: NamedObj=%p, Obj=%p\n",
Node, ValDesc));
/*
* Assuming the parameters are valid!!!
* Ensure we have a Source that can be stored in the target
*/
ACPI_ASSERT((Node) && (ValDesc));
DestinationType = AcpiNsGetType (Node);
DEBUG_PRINT (ACPI_INFO, ("AmlStoreObjectToNte: Storing %s into %s\n",
AcpiCmGetTypeName (ValDesc->Common.Type),
AcpiCmGetTypeName (DestinationType)));
/*
* First ensure we have a value that can be stored in the target
*/
switch (DestinationType)
switch (TargetType)
{
/* Type of Name's existing value */
/* This case handles the "interchangeable" types Integer, String, and Buffer. */
/*
* These cases all require only Integers or values that
* can be converted to Integers (Strings or Buffers)
*/
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_FIELD_UNIT:
case INTERNAL_TYPE_BANK_FIELD:
case INTERNAL_TYPE_INDEX_FIELD:
/*
* Stores into a Field/Region or into a Buffer/String
* are all essentially the same.
*/
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
case INTERNAL_TYPE_DEF_FIELD:
/*
* If SourceDesc is not a valid type, try to resolve it to one.
*/
if ((SourceDesc->Common.Type != ACPI_TYPE_INTEGER) &&
(SourceDesc->Common.Type != ACPI_TYPE_BUFFER) &&
(SourceDesc->Common.Type != ACPI_TYPE_STRING))
{
/*
* Initially not a valid type, convert
*/
Status = AcpiAmlResolveToValue (SourceDescPtr, WalkState);
if (ACPI_SUCCESS (Status) &&
(SourceDesc->Common.Type != ACPI_TYPE_INTEGER) &&
(SourceDesc->Common.Type != ACPI_TYPE_BUFFER) &&
(SourceDesc->Common.Type != ACPI_TYPE_STRING))
{
/*
* Conversion successful but still not a valid type
*/
DEBUG_PRINT (ACPI_ERROR,
("AmlResolveObject: Cannot assign type %s to %s (must be type Int/Str/Buf)\n",
AcpiCmGetTypeName ((*SourceDescPtr)->Common.Type),
AcpiCmGetTypeName (TargetType)));
Status = AE_AML_OPERAND_TYPE;
}
}
break;
case INTERNAL_TYPE_ALIAS:
/*
* Aliases are resolved by AcpiAmlPrepOperands
* Aliases are resolved by AcpiAmlPrepOperands
*/
DEBUG_PRINT (ACPI_WARN,
("AmlStoreObjectToNte: Store into Alias - should never happen\n"));
("AmlResolveObject: Store into Alias - should never happen\n"));
Status = AE_AML_INTERNAL;
break;
case INTERNAL_TYPE_BANK_FIELD:
case INTERNAL_TYPE_INDEX_FIELD:
case ACPI_TYPE_FIELD_UNIT:
case ACPI_TYPE_NUMBER:
/*
* These cases all require only number values or values that
* can be converted to numbers.
*
* If value is not a Number, try to resolve it to one.
*/
if (ValDesc->Common.Type != ACPI_TYPE_NUMBER)
{
/*
* Initially not a number, convert
*/
Status = AcpiAmlResolveToValue (&ValDesc, WalkState);
if (ACPI_SUCCESS (Status) &&
(ValDesc->Common.Type != ACPI_TYPE_NUMBER))
{
/*
* Conversion successful but still not a number
*/
DEBUG_PRINT (ACPI_ERROR,
("AmlStoreObjectToNte: Value assigned to %s must be Number, not %s\n",
AcpiCmGetTypeName (DestinationType),
AcpiCmGetTypeName (ValDesc->Common.Type)));
Status = AE_AML_OPERAND_TYPE;
}
}
break;
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
case INTERNAL_TYPE_DEF_FIELD:
/*
* Storing into a Field in a region or into a buffer or into
* a string all is essentially the same.
*
* If value is not a valid type, try to resolve it to one.
*/
if ((ValDesc->Common.Type != ACPI_TYPE_NUMBER) &&
(ValDesc->Common.Type != ACPI_TYPE_BUFFER) &&
(ValDesc->Common.Type != ACPI_TYPE_STRING))
{
/*
* Initially not a valid type, convert
*/
Status = AcpiAmlResolveToValue (&ValDesc, WalkState);
if (ACPI_SUCCESS (Status) &&
(ValDesc->Common.Type != ACPI_TYPE_NUMBER) &&
(ValDesc->Common.Type != ACPI_TYPE_BUFFER) &&
(ValDesc->Common.Type != ACPI_TYPE_STRING))
{
/*
* Conversion successful but still not a valid type
*/
DEBUG_PRINT (ACPI_ERROR,
("AmlStoreObjectToNte: Assign wrong type %s to %s (must be type Num/Str/Buf)\n",
AcpiCmGetTypeName (ValDesc->Common.Type),
AcpiCmGetTypeName (DestinationType)));
Status = AE_AML_OPERAND_TYPE;
}
}
break;
case ACPI_TYPE_PACKAGE:
/*
* TBD: [Unhandled] Not real sure what to do here
*/
Status = AE_NOT_IMPLEMENTED;
break;
default:
/*
* All other types than Alias and the various Fields come here.
* Store ValDesc as the new value of the Name, and set
* the Name's type to that of the value being stored in it.
* ValDesc reference count is incremented by AttachObject.
* All other types than Alias and the various Fields come here,
* including the untyped case - ACPI_TYPE_ANY.
*/
Status = AcpiNsAttachObject (Node, ValDesc, ValDesc->Common.Type);
DEBUG_PRINT (ACPI_INFO,
("AmlStoreObjectToNte: Store %s into %s via Attach\n",
AcpiCmGetTypeName (ValDesc->Common.Type),
AcpiCmGetTypeName (DestinationType)));
goto CleanUpAndBailOut;
break;
}
/* Exit now if failure above */
if (ACPI_FAILURE (Status))
{
goto CleanUpAndBailOut;
}
/*
* Get descriptor for object attached to Node
*/
DestDesc = AcpiNsGetAttachedObject (Node);
if (!DestDesc)
{
/*
* There is no existing object attached to this Node
*/
DEBUG_PRINT (ACPI_ERROR,
("AmlStoreObjectToNte: Internal error - no destination object for %4.4s type %X\n",
&Node->Name, DestinationType));
Status = AE_AML_INTERNAL;
goto CleanUpAndBailOut;
}
/*
* Make sure the destination Object is the same as the Node
*/
if (DestDesc->Common.Type != (UINT8) DestinationType)
{
DEBUG_PRINT (ACPI_ERROR,
("AmlStoreObjectToNte: Internal error - Name %4.4s type %X does not match value-type %X at %p\n",
&Node->Name, AcpiNsGetType (Node),
DestDesc->Common.Type, DestDesc));
Status = AE_AML_INTERNAL;
goto CleanUpAndBailOut;
}
/*
* AcpiEverything is ready to execute now, We have
* a value we can handle, just perform the update
*/
switch (DestinationType)
{
/* Type of Name's existing value */
case INTERNAL_TYPE_BANK_FIELD:
/*
* Get the global lock if needed
*/
Locked = AcpiAmlAcquireGlobalLock (DestDesc->BankField.LockRule);
/*
* Set Bank value to select proper Bank
* Perform the update (Set Bank Select)
*/
Status = AcpiAmlAccessNamedField (ACPI_WRITE,
DestDesc->BankField.BankSelect,
&DestDesc->BankField.Value,
sizeof (DestDesc->BankField.Value));
if (ACPI_SUCCESS (Status))
{
/* Set bank select successful, set data value */
Status = AcpiAmlAccessNamedField (ACPI_WRITE,
DestDesc->BankField.BankSelect,
&ValDesc->BankField.Value,
sizeof (ValDesc->BankField.Value));
}
break;
case INTERNAL_TYPE_DEF_FIELD:
/*
* Get the global lock if needed
*/
Locked = AcpiAmlAcquireGlobalLock (ValDesc->Field.LockRule);
/*
* Perform the update
*/
switch (ValDesc->Common.Type)
{
case ACPI_TYPE_NUMBER:
Buffer = (UINT8 *) &ValDesc->Number.Value;
Length = sizeof (ValDesc->Number.Value);
break;
case ACPI_TYPE_BUFFER:
Buffer = (UINT8 *) ValDesc->Buffer.Pointer;
Length = ValDesc->Buffer.Length;
break;
case ACPI_TYPE_STRING:
Buffer = (UINT8 *) ValDesc->String.Pointer;
Length = ValDesc->String.Length;
break;
}
Status = AcpiAmlAccessNamedField (ACPI_WRITE,
Node, Buffer, Length);
break; /* Global Lock released below */
case ACPI_TYPE_STRING:
/*
* Perform the update
*/
switch (ValDesc->Common.Type)
{
case ACPI_TYPE_NUMBER:
Buffer = (UINT8 *) &ValDesc->Number.Value;
Length = sizeof (ValDesc->Number.Value);
break;
case ACPI_TYPE_BUFFER:
Buffer = (UINT8 *) ValDesc->Buffer.Pointer;
Length = ValDesc->Buffer.Length;
break;
case ACPI_TYPE_STRING:
Buffer = (UINT8 *) ValDesc->String.Pointer;
Length = ValDesc->String.Length;
break;
}
/*
* Setting a string value replaces the old string
*/
if (Length < DestDesc->String.Length)
{
/*
* Zero fill, not willing to do pointer arithmetic for
* archetecture independance. Just clear the whole thing
*/
MEMSET(DestDesc->String.Pointer, 0, DestDesc->String.Length);
MEMCPY(DestDesc->String.Pointer, Buffer, Length);
}
else
{
/*
* Free the current buffer, then allocate a buffer
* large enough to hold the value
*/
if ( DestDesc->String.Pointer &&
!AcpiTbSystemTablePointer (DestDesc->String.Pointer))
{
/*
* Only free if not a pointer into the DSDT
*/
AcpiCmFree(DestDesc->String.Pointer);
}
DestDesc->String.Pointer = AcpiCmAllocate (Length + 1);
DestDesc->String.Length = Length;
if (!DestDesc->String.Pointer)
{
Status = AE_NO_MEMORY;
goto CleanUpAndBailOut;
}
MEMCPY(DestDesc->String.Pointer, Buffer, Length);
}
break;
case ACPI_TYPE_BUFFER:
/*
* Perform the update to the buffer
*/
switch (ValDesc->Common.Type)
{
case ACPI_TYPE_NUMBER:
Buffer = (UINT8 *) &ValDesc->Number.Value;
Length = sizeof (ValDesc->Number.Value);
break;
case ACPI_TYPE_BUFFER:
Buffer = (UINT8 *) ValDesc->Buffer.Pointer;
Length = ValDesc->Buffer.Length;
break;
case ACPI_TYPE_STRING:
Buffer = (UINT8 *) ValDesc->String.Pointer;
Length = ValDesc->String.Length;
break;
}
/*
* Buffer is a static allocation,
* only place what will fit in the buffer.
*/
if (Length <= DestDesc->Buffer.Length)
{
/*
* Zero fill first, not willing to do pointer arithmetic for
* archetecture independence. Just clear the whole thing
*/
MEMSET(DestDesc->Buffer.Pointer, 0, DestDesc->Buffer.Length);
MEMCPY(DestDesc->Buffer.Pointer, Buffer, Length);
}
else
{
/*
* truncate, copy only what will fit
*/
MEMCPY(DestDesc->Buffer.Pointer, Buffer, DestDesc->Buffer.Length);
DEBUG_PRINT (ACPI_INFO,
("AmlStoreObjectToNte: Truncating src buffer from %X to %X\n",
Length, DestDesc->Buffer.Length));
}
break;
case INTERNAL_TYPE_INDEX_FIELD:
/*
* Get the global lock if needed
*/
Locked = AcpiAmlAcquireGlobalLock (DestDesc->IndexField.LockRule);
/*
* Set Index value to select proper Data register
* perform the update (Set index)
*/
Status = AcpiAmlAccessNamedField (ACPI_WRITE,
DestDesc->IndexField.Index,
&DestDesc->IndexField.Value,
sizeof (DestDesc->IndexField.Value));
DEBUG_PRINT (ACPI_INFO,
("AmlStoreObjectToNte: IndexField: set index returned %s\n",
AcpiCmFormatException (Status)));
if (ACPI_SUCCESS (Status))
{
/* set index successful, next set Data value */
Status = AcpiAmlAccessNamedField (ACPI_WRITE,
DestDesc->IndexField.Data,
&ValDesc->Number.Value,
sizeof (ValDesc->Number.Value));
DEBUG_PRINT (ACPI_INFO,
("AmlStoreObjectToNte: IndexField: set data returned %s\n",
AcpiCmFormatException (Status)));
}
break;
case ACPI_TYPE_FIELD_UNIT:
/*
* If the Field Buffer and Index have not been previously evaluated,
* evaluate them and save the results.
*/
if (!(DestDesc->Common.Flags & AOPOBJ_DATA_VALID))
{
Status = AcpiDsGetFieldUnitArguments (DestDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
if ((!DestDesc->FieldUnit.Container ||
ACPI_TYPE_BUFFER != DestDesc->FieldUnit.Container->Common.Type))
{
DUMP_PATHNAME (Node,
"AmlStoreObjectToNte: FieldUnit: Bad container in ",
ACPI_ERROR, _COMPONENT);
DUMP_ENTRY (Node, ACPI_ERROR);
DEBUG_PRINT (ACPI_ERROR,
("Container: %p", DestDesc->FieldUnit.Container));
if (DestDesc->FieldUnit.Container)
{
DEBUG_PRINT_RAW (ACPI_ERROR, (" Type %X",
DestDesc->FieldUnit.Container->Common.Type));
}
DEBUG_PRINT_RAW (ACPI_ERROR, ("\n"));
Status = AE_AML_INTERNAL;
goto CleanUpAndBailOut;
}
/*
* Get the global lock if needed
*/
Locked = AcpiAmlAcquireGlobalLock (DestDesc->FieldUnit.LockRule);
/*
* TBD: [Unhandled] REMOVE this limitation
* Make sure the operation is within the limits of our implementation
* this is not a Spec limitation!!
*/
if (DestDesc->FieldUnit.Length + DestDesc->FieldUnit.BitOffset > 32)
{
DEBUG_PRINT (ACPI_ERROR,
("AmlStoreObjectToNte: FieldUnit: Implementation limitation - Field exceeds UINT32\n"));
Status = AE_NOT_IMPLEMENTED;
goto CleanUpAndBailOut;
}
/* Field location is (base of buffer) + (byte offset) */
Location = DestDesc->FieldUnit.Container->Buffer.Pointer
+ DestDesc->FieldUnit.Offset;
/*
* Construct Mask with 1 bits where the field is,
* 0 bits elsewhere
*/
Mask = ((UINT32) 1 << DestDesc->FieldUnit.Length) - ((UINT32)1
<< DestDesc->FieldUnit.BitOffset);
DEBUG_PRINT (TRACE_EXEC,
("** Store %lx in buffer %p byte %ld bit %X width %d addr %p mask %08lx\n",
ValDesc->Number.Value,
DestDesc->FieldUnit.Container->Buffer.Pointer,
DestDesc->FieldUnit.Offset, DestDesc->FieldUnit.BitOffset,
DestDesc->FieldUnit.Length,Location, Mask));
/* Zero out the field in the buffer */
MOVE_UNALIGNED32_TO_32 (&NewValue, Location);
NewValue &= ~Mask;
/*
* Shift and mask the new value into position,
* and or it into the buffer.
*/
NewValue |= (ValDesc->Number.Value << DestDesc->FieldUnit.BitOffset) &
Mask;
/* Store back the value */
MOVE_UNALIGNED32_TO_32 (Location, &NewValue);
DEBUG_PRINT (TRACE_EXEC, ("New Field value %08lx\n", NewValue));
break;
case ACPI_TYPE_NUMBER:
DestDesc->Number.Value = ValDesc->Number.Value;
/* Truncate value if we are executing from a 32-bit ACPI table */
AcpiAmlTruncateFor32bitTable (DestDesc, WalkState);
break;
case ACPI_TYPE_PACKAGE:
/*
* TBD: [Unhandled] Not real sure what to do here
*/
Status = AE_NOT_IMPLEMENTED;
break;
default:
/*
* All other types than Alias and the various Fields come here.
* Store ValDesc as the new value of the Name, and set
* the Name's type to that of the value being stored in it.
* ValDesc reference count is incremented by AttachObject.
*/
DEBUG_PRINT (ACPI_WARN,
("AmlStoreObjectToNte: Store into %s not implemented\n",
AcpiCmGetTypeName (AcpiNsGetType (Node))));
Status = AE_NOT_IMPLEMENTED;
break;
}
CleanUpAndBailOut:
/*
* Release global lock if we acquired it earlier
*/
AcpiAmlReleaseGlobalLock (Locked);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiAmlStoreObject
*
* PARAMETERS: SourceDesc - Object to store
* TargetType - Current type of the target
* TargetDescPtr - Pointer to the target
* WalkState - Current walk state
*
* RETURN: Status
*
* DESCRIPTION: "Store" an object to another object. This may include
* converting the source type to the target type (implicit
* conversion), and a copy of the value of the source to
* the target.
*
******************************************************************************/
ACPI_STATUS
AcpiAmlStoreObject (
ACPI_OPERAND_OBJECT *SourceDesc,
OBJECT_TYPE_INTERNAL TargetType,
ACPI_OPERAND_OBJECT **TargetDescPtr,
ACPI_WALK_STATE *WalkState)
{
ACPI_OPERAND_OBJECT *TargetDesc = *TargetDescPtr;
ACPI_STATUS Status;
FUNCTION_TRACE ("AmlStoreObject");
/*
* Perform the "implicit conversion" of the source to the current type
* of the target - As per the ACPI specification.
*
* If no conversion performed, SourceDesc is left alone, otherwise it
* is updated with a new object.
*/
Status = AcpiAmlConvertToTargetType (TargetType, &SourceDesc, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* We now have two objects of identical types, and we can perform a
* copy of the *value* of the source object.
*/
switch (TargetType)
{
case ACPI_TYPE_ANY:
case INTERNAL_TYPE_DEF_ANY:
/*
* The target namespace node is uninitialized (has no target object),
* and will take on the type of the source object
*/
*TargetDescPtr = SourceDesc;
break;
case ACPI_TYPE_INTEGER:
TargetDesc->Integer.Value = SourceDesc->Integer.Value;
/* Truncate value if we are executing from a 32-bit ACPI table */
AcpiAmlTruncateFor32bitTable (TargetDesc, WalkState);
break;
case ACPI_TYPE_FIELD_UNIT:
Status = AcpiAmlCopyIntegerToFieldUnit (SourceDesc, TargetDesc);
break;
case INTERNAL_TYPE_BANK_FIELD:
Status = AcpiAmlCopyIntegerToBankField (SourceDesc, TargetDesc);
break;
case INTERNAL_TYPE_INDEX_FIELD:
Status = AcpiAmlCopyIntegerToIndexField (SourceDesc, TargetDesc);
break;
case ACPI_TYPE_STRING:
Status = AcpiAmlCopyStringToString (SourceDesc, TargetDesc);
break;
case ACPI_TYPE_BUFFER:
Status = AcpiAmlCopyBufferToBuffer (SourceDesc, TargetDesc);
break;
case ACPI_TYPE_PACKAGE:
/*
* TBD: [Unhandled] Not real sure what to do here
*/
Status = AE_NOT_IMPLEMENTED;
break;
default:
/*
* All other types come here.
*/
DEBUG_PRINT (ACPI_WARN,
("AmlStoreObject: Store into type %s not implemented\n",
AcpiCmGetTypeName (TargetType)));
Status = AE_NOT_IMPLEMENTED;
break;
}
return_ACPI_STATUS (Status);
}

View file

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: amstorob - AML Interpreter object store support, store to object
* $Revision: 19 $
* $Revision: 22 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -130,317 +130,452 @@
MODULE_NAME ("amstorob")
/*******************************************************************************
*
* FUNCTION: AcpiAmlStoreObjectToObject
* FUNCTION: AcpiAmlCopyBufferToBuffer
*
* PARAMETERS: *ValDesc - Value to be stored
* *DestDesc - Object to receive the value
* PARAMETERS: SourceDesc - Source object to copy
* TargetDesc - Destination object of the copy
*
* RETURN: Status
*
* DESCRIPTION: Store an object to another object.
*
* The Assignment of an object to another (not named) object
* is handled here.
* The val passed in will replace the current value (if any)
* with the input value.
*
* When storing into an object the data is converted to the
* target object type then stored in the object. This means
* that the target object type (for an initialized target) will
* not be changed by a store operation.
*
* This module allows destination types of Number, String,
* and Buffer.
* DESCRIPTION: Copy a buffer object to another buffer object.
*
******************************************************************************/
ACPI_STATUS
AcpiAmlStoreObjectToObject (
ACPI_OPERAND_OBJECT *ValDesc,
ACPI_OPERAND_OBJECT *DestDesc,
ACPI_WALK_STATE *WalkState)
AcpiAmlCopyBufferToBuffer (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *TargetDesc)
{
ACPI_STATUS Status = AE_OK;
UINT8 *Buffer = NULL;
UINT32 Length = 0;
OBJECT_TYPE_INTERNAL DestinationType = DestDesc->Common.Type;
FUNCTION_TRACE ("AmlStoreObjectToObject");
DEBUG_PRINT (ACPI_INFO,
("entered AcpiAmlStoreObjectToObject: Dest=%p, Val=%p\n",
DestDesc, ValDesc));
UINT32 Length;
UINT8 *Buffer;
/*
* We know that SourceDesc is a buffer by now
*/
Buffer = (UINT8 *) SourceDesc->Buffer.Pointer;
Length = SourceDesc->Buffer.Length;
/*
* Assuming the parameters are valid!!!
* Buffer is a static allocation,
* only place what will fit in the buffer.
*/
ACPI_ASSERT((DestDesc) && (ValDesc));
DEBUG_PRINT (ACPI_INFO, ("AmlStoreObjectToObject: Storing %s into %s\n",
AcpiCmGetTypeName (ValDesc->Common.Type),
AcpiCmGetTypeName (DestDesc->Common.Type)));
/*
* First ensure we have a value that can be stored in the target
*/
switch (DestinationType)
if (Length <= TargetDesc->Buffer.Length)
{
/* Type of Name's existing value */
/* Clear existing buffer and copy in the new one */
case ACPI_TYPE_NUMBER:
/*
* These cases all require only number values or values that
* can be converted to numbers.
*
* If value is not a Number, try to resolve it to one.
*/
if (ValDesc->Common.Type != ACPI_TYPE_NUMBER)
{
/*
* Initially not a number, convert
*/
Status = AcpiAmlResolveToValue (&ValDesc, WalkState);
if (ACPI_SUCCESS (Status) &&
(ValDesc->Common.Type != ACPI_TYPE_NUMBER))
{
/*
* Conversion successful but still not a number
*/
DEBUG_PRINT (ACPI_ERROR,
("AmlStoreObjectToObject: Value assigned to %s must be Number, not %s\n",
AcpiCmGetTypeName (DestinationType),
AcpiCmGetTypeName (ValDesc->Common.Type)));
Status = AE_AML_OPERAND_TYPE;
}
}
break;
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
/*
* Storing into a Field in a region or into a buffer or into
* a string all is essentially the same.
*
* If value is not a valid type, try to resolve it to one.
*/
if ((ValDesc->Common.Type != ACPI_TYPE_NUMBER) &&
(ValDesc->Common.Type != ACPI_TYPE_BUFFER) &&
(ValDesc->Common.Type != ACPI_TYPE_STRING))
{
/*
* Initially not a valid type, convert
*/
Status = AcpiAmlResolveToValue (&ValDesc, WalkState);
if (ACPI_SUCCESS (Status) &&
(ValDesc->Common.Type != ACPI_TYPE_NUMBER) &&
(ValDesc->Common.Type != ACPI_TYPE_BUFFER) &&
(ValDesc->Common.Type != ACPI_TYPE_STRING))
{
/*
* Conversion successful but still not a valid type
*/
DEBUG_PRINT (ACPI_ERROR,
("AmlStoreObjectToObject: Assign wrong type %s to %s (must be type Num/Str/Buf)\n",
AcpiCmGetTypeName (ValDesc->Common.Type),
AcpiCmGetTypeName (DestinationType)));
Status = AE_AML_OPERAND_TYPE;
}
}
break;
default:
/*
* TBD: [Unhandled] What other combinations must be implemented?
*/
Status = AE_NOT_IMPLEMENTED;
break;
MEMSET(TargetDesc->Buffer.Pointer, 0, TargetDesc->Buffer.Length);
MEMCPY(TargetDesc->Buffer.Pointer, Buffer, Length);
}
/* Exit now if failure above */
if (ACPI_FAILURE (Status))
else
{
goto CleanUpAndBailOut;
/*
* Truncate the source, copy only what will fit
*/
MEMCPY(TargetDesc->Buffer.Pointer, Buffer, TargetDesc->Buffer.Length);
DEBUG_PRINT (ACPI_INFO,
("AmlStoreObjectToNode: Truncating src buffer from %X to %X\n",
Length, TargetDesc->Buffer.Length));
}
/*
* AcpiEverything is ready to execute now, We have
* a value we can handle, just perform the update
*/
switch (DestinationType)
{
case ACPI_TYPE_STRING:
/*
* Perform the update
*/
switch (ValDesc->Common.Type)
{
case ACPI_TYPE_NUMBER:
Buffer = (UINT8 *) &ValDesc->Number.Value;
Length = sizeof (ValDesc->Number.Value);
break;
case ACPI_TYPE_BUFFER:
Buffer = (UINT8 *) ValDesc->Buffer.Pointer;
Length = ValDesc->Buffer.Length;
break;
case ACPI_TYPE_STRING:
Buffer = (UINT8 *) ValDesc->String.Pointer;
Length = ValDesc->String.Length;
break;
}
/*
* Setting a string value replaces the old string
*/
if (Length < DestDesc->String.Length)
{
/*
* Zero fill, not willing to do pointer arithmetic for
* architecture independence. Just clear the whole thing
*/
MEMSET(DestDesc->String.Pointer, 0, DestDesc->String.Length);
MEMCPY(DestDesc->String.Pointer, Buffer, Length);
}
else
{
/*
* Free the current buffer, then allocate a buffer
* large enough to hold the value
*/
if ( DestDesc->String.Pointer &&
!AcpiTbSystemTablePointer (DestDesc->String.Pointer))
{
/*
* Only free if not a pointer into the DSDT
*/
AcpiCmFree(DestDesc->String.Pointer);
}
DestDesc->String.Pointer = AcpiCmAllocate (Length + 1);
DestDesc->String.Length = Length;
if (!DestDesc->String.Pointer)
{
Status = AE_NO_MEMORY;
goto CleanUpAndBailOut;
}
MEMCPY(DestDesc->String.Pointer, Buffer, Length);
}
break;
case ACPI_TYPE_BUFFER:
/*
* Perform the update to the buffer
*/
switch (ValDesc->Common.Type)
{
case ACPI_TYPE_NUMBER:
Buffer = (UINT8 *) &ValDesc->Number.Value;
Length = sizeof (ValDesc->Number.Value);
break;
case ACPI_TYPE_BUFFER:
Buffer = (UINT8 *) ValDesc->Buffer.Pointer;
Length = ValDesc->Buffer.Length;
break;
case ACPI_TYPE_STRING:
Buffer = (UINT8 *) ValDesc->String.Pointer;
Length = ValDesc->String.Length;
break;
}
/*
* If the buffer is uninitialized,
* memory needs to be allocated for the copy.
*/
if(0 == DestDesc->Buffer.Length)
{
DestDesc->Buffer.Pointer = AcpiCmCallocate(Length);
DestDesc->Buffer.Length = Length;
if (!DestDesc->Buffer.Pointer)
{
Status = AE_NO_MEMORY;
goto CleanUpAndBailOut;
}
}
/*
* Buffer is a static allocation,
* only place what will fit in the buffer.
*/
if (Length <= DestDesc->Buffer.Length)
{
/*
* Zero fill first, not willing to do pointer arithmetic for
* architecture independence. Just clear the whole thing
*/
MEMSET(DestDesc->Buffer.Pointer, 0, DestDesc->Buffer.Length);
MEMCPY(DestDesc->Buffer.Pointer, Buffer, Length);
}
else
{
/*
* truncate, copy only what will fit
*/
MEMCPY(DestDesc->Buffer.Pointer, Buffer, DestDesc->Buffer.Length);
DEBUG_PRINT (ACPI_INFO,
("AmlStoreObjectToObject: Truncating src buffer from %X to %X\n",
Length, DestDesc->Buffer.Length));
}
break;
case ACPI_TYPE_NUMBER:
DestDesc->Number.Value = ValDesc->Number.Value;
/* Truncate value if we are executing from a 32-bit ACPI table */
AcpiAmlTruncateFor32bitTable (DestDesc, WalkState);
break;
default:
/*
* All other types than Alias and the various Fields come here.
* Store ValDesc as the new value of the Name, and set
* the Name's type to that of the value being stored in it.
* ValDesc reference count is incremented by AttachObject.
*/
DEBUG_PRINT (ACPI_WARN,
("AmlStoreObjectToObject: Store into %s not implemented\n",
AcpiCmGetTypeName (DestDesc->Common.Type)));
Status = AE_NOT_IMPLEMENTED;
break;
}
CleanUpAndBailOut:
return_ACPI_STATUS (Status);
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiAmlCopyStringToString
*
* PARAMETERS: SourceDesc - Source object to copy
* TargetDesc - Destination object of the copy
*
* RETURN: Status
*
* DESCRIPTION: Copy a String object to another String object
*
******************************************************************************/
ACPI_STATUS
AcpiAmlCopyStringToString (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *TargetDesc)
{
UINT32 Length;
UINT8 *Buffer;
/*
* We know that SourceDesc is a string by now.
*/
Buffer = (UINT8 *) SourceDesc->String.Pointer;
Length = SourceDesc->String.Length;
/*
* Setting a string value replaces the old string
*/
if (Length < TargetDesc->String.Length)
{
/* Clear old string and copy in the new one */
MEMSET(TargetDesc->String.Pointer, 0, TargetDesc->String.Length);
MEMCPY(TargetDesc->String.Pointer, Buffer, Length);
}
else
{
/*
* Free the current buffer, then allocate a buffer
* large enough to hold the value
*/
if (TargetDesc->String.Pointer &&
!AcpiTbSystemTablePointer (TargetDesc->String.Pointer))
{
/*
* Only free if not a pointer into the DSDT
*/
AcpiCmFree(TargetDesc->String.Pointer);
}
TargetDesc->String.Pointer = AcpiCmAllocate (Length + 1);
TargetDesc->String.Length = Length;
if (!TargetDesc->String.Pointer)
{
return (AE_NO_MEMORY);
}
MEMCPY(TargetDesc->String.Pointer, Buffer, Length);
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiAmlCopyIntegerToIndexField
*
* PARAMETERS: SourceDesc - Source object to copy
* TargetDesc - Destination object of the copy
*
* RETURN: Status
*
* DESCRIPTION: Write an Integer to an Index Field
*
******************************************************************************/
ACPI_STATUS
AcpiAmlCopyIntegerToIndexField (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *TargetDesc)
{
ACPI_STATUS Status;
BOOLEAN Locked;
/*
* Get the global lock if needed
*/
Locked = AcpiAmlAcquireGlobalLock (TargetDesc->IndexField.LockRule);
/*
* Set Index value to select proper Data register
* perform the update (Set index)
*/
Status = AcpiAmlAccessNamedField (ACPI_WRITE,
TargetDesc->IndexField.Index,
&TargetDesc->IndexField.Value,
sizeof (TargetDesc->IndexField.Value));
if (ACPI_SUCCESS (Status))
{
/* SetIndex was successful, next set Data value */
Status = AcpiAmlAccessNamedField (ACPI_WRITE,
TargetDesc->IndexField.Data,
&SourceDesc->Integer.Value,
sizeof (SourceDesc->Integer.Value));
DEBUG_PRINT (ACPI_INFO,
("AmlStoreObjectToNode: IndexField: set data returned %s\n",
AcpiCmFormatException (Status)));
}
else
{
DEBUG_PRINT (ACPI_INFO,
("AmlStoreObjectToNode: IndexField: set index returned %s\n",
AcpiCmFormatException (Status)));
}
/*
* Release global lock if we acquired it earlier
*/
AcpiAmlReleaseGlobalLock (Locked);
return (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiAmlCopyIntegerToBankField
*
* PARAMETERS: SourceDesc - Source object to copy
* TargetDesc - Destination object of the copy
*
* RETURN: Status
*
* DESCRIPTION: Write an Integer to a Bank Field
*
******************************************************************************/
ACPI_STATUS
AcpiAmlCopyIntegerToBankField (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *TargetDesc)
{
ACPI_STATUS Status;
BOOLEAN Locked;
/*
* Get the global lock if needed
*/
Locked = AcpiAmlAcquireGlobalLock (TargetDesc->IndexField.LockRule);
/*
* Set Bank value to select proper Bank
* Perform the update (Set Bank Select)
*/
Status = AcpiAmlAccessNamedField (ACPI_WRITE,
TargetDesc->BankField.BankSelect,
&TargetDesc->BankField.Value,
sizeof (TargetDesc->BankField.Value));
if (ACPI_SUCCESS (Status))
{
/* Set bank select successful, set data value */
Status = AcpiAmlAccessNamedField (ACPI_WRITE,
TargetDesc->BankField.BankSelect,
&SourceDesc->BankField.Value,
sizeof (SourceDesc->BankField.Value));
}
else
{
DEBUG_PRINT (ACPI_INFO,
("AmlStoreObjectToNode: BankField: set bakn returned %s\n",
AcpiCmFormatException (Status)));
}
/*
* Release global lock if we acquired it earlier
*/
AcpiAmlReleaseGlobalLock (Locked);
return (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiAmlCopyDataToNamedField
*
* PARAMETERS: SourceDesc - Source object to copy
* Node - Destination Namespace node
*
* RETURN: Status
*
* DESCRIPTION: Copy raw data to a Named Field. No implicit conversion
* is performed on the source object
*
******************************************************************************/
ACPI_STATUS
AcpiAmlCopyDataToNamedField (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_NAMESPACE_NODE *Node)
{
ACPI_STATUS Status;
BOOLEAN Locked;
UINT32 Length;
UINT8 *Buffer;
/*
* Named fields (CreateXxxField) - We don't perform any conversions on the
* source operand, just use the raw data
*/
switch (SourceDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
Buffer = (UINT8 *) &SourceDesc->Integer.Value;
Length = sizeof (SourceDesc->Integer.Value);
break;
case ACPI_TYPE_BUFFER:
Buffer = (UINT8 *) SourceDesc->Buffer.Pointer;
Length = SourceDesc->Buffer.Length;
break;
case ACPI_TYPE_STRING:
Buffer = (UINT8 *) SourceDesc->String.Pointer;
Length = SourceDesc->String.Length;
break;
default:
return (AE_TYPE);
}
/*
* Get the global lock if needed before the update
* TBD: not needed!
*/
Locked = AcpiAmlAcquireGlobalLock (SourceDesc->Field.LockRule);
Status = AcpiAmlAccessNamedField (ACPI_WRITE,
Node, Buffer, Length);
AcpiAmlReleaseGlobalLock (Locked);
return (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiAmlCopyIntegerToFieldUnit
*
* PARAMETERS: SourceDesc - Source object to copy
* TargetDesc - Destination object of the copy
*
* RETURN: Status
*
* DESCRIPTION: Write an Integer to a Field Unit.
*
******************************************************************************/
ACPI_STATUS
AcpiAmlCopyIntegerToFieldUnit (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *TargetDesc)
{
ACPI_STATUS Status = AE_OK;
UINT8 *Location = NULL;
UINT32 Mask;
UINT32 NewValue;
BOOLEAN Locked = FALSE;
FUNCTION_TRACE ("AmlCopyIntegerToFieldUnit");
/*
* If the Field Buffer and Index have not been previously evaluated,
* evaluate them and save the results.
*/
if (!(TargetDesc->Common.Flags & AOPOBJ_DATA_VALID))
{
Status = AcpiDsGetFieldUnitArguments (TargetDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
if ((!TargetDesc->FieldUnit.Container ||
ACPI_TYPE_BUFFER != TargetDesc->FieldUnit.Container->Common.Type))
{
DEBUG_PRINT (ACPI_ERROR,
("Null Container or wrong type: %p", TargetDesc->FieldUnit.Container));
if (TargetDesc->FieldUnit.Container)
{
DEBUG_PRINT_RAW (ACPI_ERROR, (" Type %X",
TargetDesc->FieldUnit.Container->Common.Type));
}
DEBUG_PRINT_RAW (ACPI_ERROR, ("\n"));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
/*
* Get the global lock if needed
*/
Locked = AcpiAmlAcquireGlobalLock (TargetDesc->FieldUnit.LockRule);
/*
* TBD: [Unhandled] REMOVE this limitation
* Make sure the operation is within the limits of our implementation
* this is not a Spec limitation!!
*/
if (TargetDesc->FieldUnit.Length + TargetDesc->FieldUnit.BitOffset > 32)
{
DEBUG_PRINT (ACPI_ERROR,
("AmlCopyIntegerToFieldUnit: FieldUnit: Implementation limitation - Field exceeds UINT32\n"));
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
}
/* Field location is (base of buffer) + (byte offset) */
Location = TargetDesc->FieldUnit.Container->Buffer.Pointer
+ TargetDesc->FieldUnit.Offset;
/*
* Construct Mask with 1 bits where the field is,
* 0 bits elsewhere
*/
Mask = ((UINT32) 1 << TargetDesc->FieldUnit.Length) - ((UINT32)1
<< TargetDesc->FieldUnit.BitOffset);
DEBUG_PRINT (TRACE_EXEC,
("** Store %lx in buffer %p byte %ld bit %X width %d addr %p mask %08lx\n",
SourceDesc->Integer.Value,
TargetDesc->FieldUnit.Container->Buffer.Pointer,
TargetDesc->FieldUnit.Offset, TargetDesc->FieldUnit.BitOffset,
TargetDesc->FieldUnit.Length,Location, Mask));
/* Zero out the field in the buffer */
MOVE_UNALIGNED32_TO_32 (&NewValue, Location);
NewValue &= ~Mask;
/*
* Shift and mask the new value into position,
* and or it into the buffer.
*/
NewValue |= (SourceDesc->Integer.Value << TargetDesc->FieldUnit.BitOffset) &
Mask;
/* Store back the value */
MOVE_UNALIGNED32_TO_32 (Location, &NewValue);
DEBUG_PRINT (TRACE_EXEC, ("New Field value %08lx\n", NewValue));
return_ACPI_STATUS (AE_OK);
}

View file

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: amsystem - Interface to OS services
* $Revision: 53 $
* $Revision: 54 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -307,7 +307,7 @@ AcpiAmlSystemAcquireMutex (
}
Status = AcpiAmlSystemWaitSemaphore (ObjDesc->Mutex.Semaphore,
(UINT32) TimeDesc->Number.Value);
(UINT32) TimeDesc->Integer.Value);
return_ACPI_STATUS (Status);
}
@ -417,7 +417,7 @@ AcpiAmlSystemWaitEvent (
if (ObjDesc)
{
Status = AcpiAmlSystemWaitSemaphore (ObjDesc->Event.Semaphore,
(UINT32) TimeDesc->Number.Value);
(UINT32) TimeDesc->Integer.Value);
}

View file

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: amutils - interpreter/scanner utilities
* $Revision: 66 $
* $Revision: 68 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -138,14 +138,11 @@ typedef struct Internal_Search_st
/* Used to traverse nested packages when copying*/
/* TBD: This must be removed! */
INTERNAL_PKG_SEARCH_INFO CopyLevel[MAX_PACKAGE_DEPTH];
static NATIVE_CHAR hex[] =
{'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
/*******************************************************************************
*
* FUNCTION: AcpiAmlEnterInterpreter
@ -252,7 +249,7 @@ AcpiAmlTruncateFor32bitTable (
*/
if ((!ObjDesc) ||
(ObjDesc->Common.Type != ACPI_TYPE_NUMBER) ||
(ObjDesc->Common.Type != ACPI_TYPE_INTEGER) ||
(!WalkState->MethodNode))
{
return;
@ -264,7 +261,7 @@ AcpiAmlTruncateFor32bitTable (
* We are running a method that exists in a 32-bit ACPI table.
* Truncate the value to 32 bits by zeroing out the upper 32-bit field
*/
ObjDesc->Number.Value &= (ACPI_INTEGER) ACPI_UINT32_MAX;
ObjDesc->Integer.Value &= (ACPI_INTEGER) ACPI_UINT32_MAX;
}
}
@ -463,10 +460,10 @@ AcpiAmlEisaIdToString (
OutString[0] = (char) ('@' + ((id >> 26) & 0x1f));
OutString[1] = (char) ('@' + ((id >> 21) & 0x1f));
OutString[2] = (char) ('@' + ((id >> 16) & 0x1f));
OutString[3] = hex[(id >> 12) & 0xf];
OutString[4] = hex[(id >> 8) & 0xf];
OutString[5] = hex[(id >> 4) & 0xf];
OutString[6] = hex[id & 0xf];
OutString[3] = AcpiGbl_HexToAscii[(id >> 12) & 0xf];
OutString[4] = AcpiGbl_HexToAscii[(id >> 8) & 0xf];
OutString[5] = AcpiGbl_HexToAscii[(id >> 4) & 0xf];
OutString[6] = AcpiGbl_HexToAscii[id & 0xf];
OutString[7] = 0;
return (AE_OK);

View file

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: amxface - External interpreter interfaces
* $Revision: 23 $
* $Revision: 24 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

View file

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nsaccess - Top-level functions for accessing ACPI namespace
* $Revision: 116 $
* $Revision: 119 $
*
******************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -225,9 +225,9 @@ AcpiNsRootInitialize (void)
switch (InitVal->Type)
{
case ACPI_TYPE_NUMBER:
case ACPI_TYPE_INTEGER:
ObjDesc->Number.Value =
ObjDesc->Integer.Value =
(ACPI_INTEGER) STRTOUL (InitVal->Val, NULL, 10);
break;
@ -322,14 +322,14 @@ UnlockAndExit:
*
* FUNCTION: AcpiNsLookup
*
* PARAMETERS: PrefixNode - Search scope if name is not fully qualified
* PARAMETERS: PrefixNode - Search scope if name is not fully qualified
* Pathname - Search pathname, in internal format
* (as represented in the AML stream)
* Type - Type associated with name
* InterpreterMode - IMODE_LOAD_PASS2 => add name if not found
* Flags - Flags describing the search restrictions
* WalkState - Current state of the walk
* ReturnNode - Where the Node is placed (if found
* ReturnNode - Where the Node is placed (if found
* or created successfully)
*
* RETURN: Status
@ -352,7 +352,7 @@ AcpiNsLookup (
ACPI_NAMESPACE_NODE **ReturnNode)
{
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *PrefixNode;
ACPI_NAMESPACE_NODE *PrefixNode;
ACPI_NAMESPACE_NODE *CurrentNode = NULL;
ACPI_NAMESPACE_NODE *ScopeToPush = NULL;
ACPI_NAMESPACE_NODE *ThisNode = NULL;
@ -361,8 +361,9 @@ AcpiNsLookup (
BOOLEAN NullNamePath = FALSE;
OBJECT_TYPE_INTERNAL TypeToCheckFor;
OBJECT_TYPE_INTERNAL ThisSearchType;
UINT32 LocalFlags = Flags & ~NS_ERROR_IF_FOUND;
DEBUG_ONLY_MEMBERS (UINT32 i)
DEBUG_EXEC (UINT32 i;)
FUNCTION_TRACE ("NsLookup");
@ -605,6 +606,7 @@ AcpiNsLookup (
if (!NumSegments)
{
ThisSearchType = Type;
LocalFlags = Flags;
}
/* Pluck one ACPI name from the front of the pathname */
@ -615,7 +617,7 @@ AcpiNsLookup (
Status = AcpiNsSearchAndEnter (SimpleName, WalkState,
CurrentNode, InterpreterMode,
ThisSearchType, Flags,
ThisSearchType, LocalFlags,
&ThisNode);
if (ACPI_FAILURE (Status))

View file

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nsalloc - Namespace allocation and deletion utilities
* $Revision: 44 $
* $Revision: 45 $
*
******************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License

Some files were not shown because too many files have changed in this diff Show more