merging acpica-20090903 into trunk

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33140 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2009-09-14 22:18:58 +00:00
parent 1c7f3645ac
commit 80377d9af5
223 changed files with 14831 additions and 7697 deletions
+9 -3
View File
@@ -25,6 +25,8 @@ local hardware_src =
hwregs.c
hwsleep.c
hwtimer.c
hwvalid.c
hwxface.c
;
local debugger_src =
@@ -99,6 +101,8 @@ local namespace_src =
nsnames.c
nsobject.c
nsparse.c
nspredef.c
nsrepair.c
nssearch.c
nsutils.c
nswalk.c
@@ -140,7 +144,9 @@ local utilities_src =
utdelete.c
uteval.c
utglobal.c
utids.c
utinit.c
utlock.c
utmath.c
utmisc.c
utmutex.c
@@ -165,13 +171,13 @@ StaticLibrary libacpi_ca.a :
# this is a workaround for an optimization bug in our GCC4 with -O1 and -O2, this should be dropped when we upgrade
oldOPTIM = $(OPTIM) ;
OPTIM = -O3 ;
#oldOPTIM = $(OPTIM) ;
#OPTIM = -O3 ;
StaticLibrary libacpi_ca.a :
tbutils.c
;
OPTIM = $(oldOPTIM) ;
#OPTIM = $(oldOPTIM) ;
SEARCH on [ FGristFiles $(events_src) ] = [ FDirName $(HAIKU_TOP) src add-ons kernel bus_managers acpi events ] ;
SEARCH on [ FGristFiles $(hardware_src) ] = [ FDirName $(HAIKU_TOP) src add-ons kernel bus_managers acpi hardware ] ;
@@ -20,7 +20,7 @@
#include <safemode.h>
#include "acpi.h"
#include "acpixf.h"
#include "accommon.h"
#include "acpi_priv.h"
//#define TRACE_ACPI_BUS
@@ -32,6 +32,7 @@
#define ERROR(x...) dprintf("acpi: " x)
#define ACPI_DEVICE_ID_LENGTH 0x08
extern pci_module_info* gPCIManager;
@@ -541,11 +542,11 @@ reboot(void)
TRACE("reboot\n");
if (AcpiGbl_FADT.Flags & ACPI_FADT_RESET_REGISTER == 0)
if ((AcpiGbl_FADT.Flags & ACPI_FADT_RESET_REGISTER) == 0)
return B_UNSUPPORTED;
status = AcpiHwLowLevelWrite(AcpiGbl_FADT.ResetRegister.BitWidth,
AcpiGbl_FADT.ResetValue, &AcpiGbl_FADT.ResetRegister);
status = AcpiWrite(AcpiGbl_FADT.ResetValue,
&AcpiGbl_FADT.ResetRegister);
if (status != AE_OK) {
ERROR("Reset failed, status = %d\n", status);
@@ -1,962 +0,0 @@
/******************************************************************************
*
* Module Name: a16find - 16-bit (real mode) routines to find ACPI
* tables in memory
* $Revision: 1.43 $
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "acpi.h"
#include "amlcode.h"
#include "acparser.h"
#include "actables.h"
#include "16bit.h"
#define _COMPONENT ACPI_TABLES
ACPI_MODULE_NAME ("a16find")
/*
* This module finds ACPI tables located in memory.
* It is only generated for the 16-bit (real-mode) version of the utility.
*/
#define ACPI_TABLE_FILE_SUFFIX ".dat"
#if ACPI_MACHINE_WIDTH == 16
UINT32 ACPI_INTERNAL_VAR_XFACE dIn32 (UINT16 port);
void ACPI_INTERNAL_VAR_XFACE vOut32 (UINT16 port, UINT32 Val);
#define ACPI_ENABLE_HPET 0x00020000
char FilenameBuf[20];
ACPI_TABLE_HEADER AcpiTblHeader;
UINT32 TableSize;
UINT32 AcpiGbl_SystemFlags;
UINT32 AcpiGbl_RsdpOriginalLocation;
#if 0
/******************************************************************************
*
* FUNCTION: AfWriteBuffer
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION: Open a file and write out a single buffer
*
******************************************************************************/
ACPI_NATIVE_INT
AfWriteBuffer (
char *Filename,
char *Buffer,
UINT32 Length)
{
FILE *fp;
ACPI_NATIVE_INT Actual;
fp = fopen (Filename, "wb");
if (!fp)
{
printf ("Couldn't open %s\n", Filename);
return -1;
}
Actual = fwrite (Buffer, (size_t) Length, 1, fp);
fclose (fp);
return Actual;
}
/******************************************************************************
*
* FUNCTION: AfGenerateFilename
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION: Build an output filename from an ACPI table ID string
*
******************************************************************************/
char *
AfGenerateFilename (char *TableId)
{
UINT16 i;
for (i = 0; i < 8 && TableId[i] != ' ' && TableId[i] != 0; i++)
{
FilenameBuf [i] = TableId[i];
}
FilenameBuf [i] = 0;
strcat (FilenameBuf, ACPI_TABLE_FILE_SUFFIX);
return FilenameBuf;
}
/******************************************************************************
*
* FUNCTION: AfDumpTables
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION: Dump the loaded tables to a file (or files)
*
******************************************************************************/
void
AfDumpTables (void)
{
char *Filename;
if (!AcpiGbl_DSDT)
{
AcpiOsPrintf ("No DSDT!\n");
return;
}
Filename = AfGenerateFilename (AcpiGbl_DSDT->OemTableId);
AfWriteBuffer (Filename,
(char *) AcpiGbl_DSDT, AcpiGbl_DSDT->Length);
AcpiOsPrintf ("DSDT AML written to \"%s\"\n", Filename);
}
#endif
void pascal
cprint (
UINT32 value)
{
AcpiOsPrintf ("Seq: 0x%8.8X\n", value);
}
/******************************************************************************
*
* FUNCTION: CopyExtendedToReal
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION: Copy memory above 1meg
*
******************************************************************************/
int
CopyExtendedToReal (
void *Destination,
UINT32 PhysicalSource,
UINT32 Size)
{
int RetVal;
RetVal = FlatMove32 (GET_PHYSICAL_ADDRESS (Destination),
PhysicalSource, (UINT16) Size);
AcpiOsPrintf ("FlatMove return: 0x%hX From %X To %X Len %X\n",
(int) RetVal, PhysicalSource, GET_PHYSICAL_ADDRESS (Destination), Size);
return (RetVal);
}
/******************************************************************************
*
* FUNCTION: AfFindRsdp
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION: Scan memory to find the RSDP
*
******************************************************************************/
BOOLEAN
AfFindRsdp (RSDP_DESCRIPTOR **RSDP)
{
PTR_OVL Rove;
PTR_OVL_BUILD_PTR (Rove, 0, 0);
/* Scan low memory */
do
{
if (strncmp (Rove.ptr, ACPI_SIG_RSDP, (size_t) 8) == 0)
{
/* TBD: Checksum check is invalid for X descriptor */
/* if (AcpiTbSumTable (Rove.ptr, sizeof(RSDP_DESCRIPTOR)) != 0)
{
*/
AcpiOsPrintf ("RSDP found at %p (Lo block)\n", Rove.ptr);
*RSDP = Rove.ptr;
return (TRUE);
}
Rove.ovl.base++;
}
while (Rove.ovl.base < 0x3F);
/* Scan high memory */
PTR_OVL_BUILD_PTR (Rove, 0xE000, 0);
do
{
if (strncmp (Rove.ptr, ACPI_SIG_RSDP, (size_t) 8) == 0)
{
AcpiOsPrintf ("RSDP found at %p (Hi block)\n", Rove.ptr);
*RSDP = Rove.ptr;
return (TRUE);
}
Rove.ovl.base++;
}
while (Rove.ovl.base < 0xFFFF);
return (FALSE);
}
/******************************************************************************
*
* FUNCTION: AfRecognizeTable
*
* PARAMETERS: TablePtr - Input buffer pointer, optional
* TableInfo - Return value from AcpiTbGetTable
*
* RETURN: Status
*
* DESCRIPTION: Check a table signature for a match against known table types
*
******************************************************************************/
ACPI_STATUS
AfRecognizeTable (
char *TablePtr,
UINT32 PhysAddr,
ACPI_TABLE_DESC *TableInfo)
{
ACPI_TABLE_HEADER *TableHeader;
ACPI_STATUS Status;
ACPI_TABLE_TYPE TableType = 0;
void **TableGlobalPtr;
UINT32 i;
ACPI_FUNCTION_TRACE (AfRecognizeTable);
/* Ensure that we have a valid table pointer */
TableHeader = (ACPI_TABLE_HEADER *) TableInfo->Pointer;
if (!TableHeader)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Search for a signature match among the known table types */
Status = AE_SUPPORT;
for (i = 1; i < NUM_ACPI_TABLE_TYPES; i++) /* Start at one -> Skip RSDP */
{
if (!ACPI_STRNCMP (TableHeader->Signature,
AcpiGbl_TableData[i].Signature,
AcpiGbl_TableData[i].SigLength))
{
AcpiOsPrintf ("Found table [%s] Length 0x%X\n",
AcpiGbl_TableData[i].Signature, (UINT32) TableHeader->Length);
TableType = i;
TableGlobalPtr = AcpiGbl_TableData[i].GlobalPtr;
Status = AE_OK;
break;
}
}
/* Return the table type via the info struct */
TableInfo->Type = (UINT8) TableType;
TableInfo->Length = (ACPI_SIZE) TableHeader->Length;
/*
* An AE_SUPPORT means that the table was not recognized.
* We ignore this table; just print a debug message
*/
if (Status == AE_SUPPORT)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Unsupported table %s (Type %d) was found and discarded\n",
AcpiGbl_TableData[TableType].Name, (UINT32) TableType));
return_ACPI_STATUS (Status);
}
Status = AcpiTbValidateTableHeader (TableHeader);
if (ACPI_FAILURE (Status))
{
/* Table failed verification, map all errors to BAD_DATA */
ACPI_ERROR ((AE_INFO,
"Invalid table header found in table named %s (Type %d)",
AcpiGbl_TableData[TableType].Name, (UINT32) TableType));
return_ACPI_STATUS (AE_BAD_DATA);
}
/* Now get the rest of the table */
*TableGlobalPtr = ACPI_ALLOCATE (AcpiTblHeader.Length);
if (!*TableGlobalPtr)
{
AcpiOsPrintf (
"Could not allocate buffer for Acpi table of length 0x%X\n",
(UINT32) ((FACS_DESCRIPTOR *) &AcpiTblHeader)->Length);
return_ACPI_STATUS (AE_NO_MEMORY);
}
TableInfo->Pointer = *TableGlobalPtr;
CopyExtendedToReal (*TableGlobalPtr, PhysAddr, AcpiTblHeader.Length);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s=%p, (TableGlobalPtr=%p)\n",
AcpiGbl_TableData[TableType].Signature,
*TableGlobalPtr, TableGlobalPtr));
if (AcpiGbl_DbOpt_verbose)
{
AcpiUtDumpBuffer (*TableGlobalPtr, 48, 0, 0);
}
/*
* Validate checksum for _most_ tables,
* even the ones whose signature we don't recognize
*/
if (TableType != ACPI_TABLE_FACS)
{
/* But don't abort if the checksum is wrong */
/* TBD: make this a configuration option? */
AcpiTbVerifyTableChecksum (*TableGlobalPtr);
}
return_ACPI_STATUS (Status);
}
/******************************************************************************
*
* FUNCTION: AfGetAllTables
*
* PARAMETERS: Root - Root of the parse tree
*
* RETURN: None
*
* DESCRIPTION:
*
*****************************************************************************/
ACPI_STATUS
AfGetAllTables (
UINT32 NumberOfTables,
char *TablePtr)
{
ACPI_STATUS Status = AE_OK;
UINT32 Index;
ACPI_TABLE_DESC TableInfo;
ACPI_FUNCTION_TRACE (AfGetAllTables);
if (AcpiGbl_DbOpt_verbose)
{
AcpiOsPrintf ("Number of tables: %d\n", (UINT32) NumberOfTables);
}
/*
* Loop through all table pointers found in RSDT.
* This will NOT include the FACS and DSDT - we must get
* them after the loop
*/
for (Index = 0; Index < NumberOfTables; Index++)
{
/* Get the table via the RSDT */
CopyExtendedToReal (&AcpiTblHeader, ACPI_GET_ADDRESS (AcpiGbl_XSDT->TableOffsetEntry[Index]),
sizeof (ACPI_TABLE_HEADER));
TableInfo.Pointer = &AcpiTblHeader;
TableInfo.Length = (ACPI_SIZE) AcpiTblHeader.Length;
TableInfo.Allocation = ACPI_MEM_ALLOCATED;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Table pointer: %X\n",
(UINT32) ACPI_GET_ADDRESS (AcpiGbl_XSDT->TableOffsetEntry[Index])));
Status = AfRecognizeTable (NULL, ACPI_GET_ADDRESS (AcpiGbl_XSDT->TableOffsetEntry[Index]), &TableInfo);
if (ACPI_SUCCESS (Status))
{
AcpiTbInitTableDescriptor (TableInfo.Type, &TableInfo);
}
/* Ignore errors, just move on to next table */
}
if (!AcpiGbl_FADT)
{
AcpiOsPrintf ("FADT was not found, cannot obtain FACS and DSDT!\n");
return (AE_NO_ACPI_TABLES);
}
Status = AcpiTbConvertTableFadt ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* Get the FACS
*/
CopyExtendedToReal (&AcpiTblHeader, ACPI_GET_ADDRESS (AcpiGbl_FADT->XFirmwareCtrl),
sizeof (ACPI_TABLE_HEADER));
AcpiGbl_FACS = ACPI_ALLOCATE (AcpiTblHeader.Length);
if (!AcpiGbl_FACS)
{
AcpiOsPrintf ("Could not allocate buffer for FADT length 0x%X\n",
(UINT32) AcpiTblHeader.Length);
return_ACPI_STATUS (AE_NO_MEMORY);
}
CopyExtendedToReal (AcpiGbl_FACS, ACPI_GET_ADDRESS (AcpiGbl_FADT->XFirmwareCtrl), AcpiTblHeader.Length);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "FACS at %p (Phys %8.8X) length %X FADT at%p\n",
AcpiGbl_FACS, (UINT32) ACPI_GET_ADDRESS (AcpiGbl_FADT->XFirmwareCtrl),
(UINT32) AcpiTblHeader.Length, AcpiGbl_FADT));
if (AcpiGbl_DbOpt_verbose)
{
AcpiUtDumpBuffer ((char *) AcpiGbl_FADT, sizeof (ACPI_TABLE_HEADER), 0, 0);
}
TableInfo.Type = ACPI_TABLE_FADT;
TableInfo.Pointer = (void *) AcpiGbl_FADT;
TableInfo.Length = (ACPI_SIZE) AcpiTblHeader.Length;
TableInfo.Allocation = ACPI_MEM_ALLOCATED;
/* There is no checksum for the FACS, nothing to verify */
AcpiTbInitTableDescriptor (TableInfo.Type, &TableInfo);
AcpiTbBuildCommonFacs (&TableInfo);
/*
* Get the DSDT
*/
CopyExtendedToReal (&AcpiTblHeader, ACPI_GET_ADDRESS (AcpiGbl_FADT->XDsdt), sizeof (ACPI_TABLE_HEADER));
AcpiGbl_DSDT = ACPI_ALLOCATE (AcpiTblHeader.Length);
if (!AcpiGbl_DSDT)
{
AcpiOsPrintf ("Could not allocate buffer for DSDT length 0x%X\n", (UINT32) AcpiTblHeader.Length);
return_ACPI_STATUS (AE_NO_MEMORY);
}
CopyExtendedToReal (AcpiGbl_DSDT, ACPI_GET_ADDRESS (AcpiGbl_FADT->XDsdt), AcpiTblHeader.Length);
AcpiOsPrintf ("DSDT at %p (Phys %8.8X) length %X FADT at %p\n",
AcpiGbl_DSDT, (UINT32) ACPI_GET_ADDRESS (AcpiGbl_FADT->XDsdt),
(UINT32) AcpiTblHeader.Length, AcpiGbl_FADT);
if (AcpiGbl_DbOpt_verbose)
{
AcpiUtDumpBuffer ((char *) AcpiGbl_DSDT, sizeof (ACPI_TABLE_HEADER), 0, 0);
}
TableInfo.Type = ACPI_TABLE_DSDT;
TableInfo.Pointer = (void *) AcpiGbl_DSDT;
TableInfo.Length = (ACPI_SIZE) AcpiTblHeader.Length;
TableInfo.Allocation = ACPI_MEM_ALLOCATED;
AcpiTbInitTableDescriptor (TableInfo.Type, &TableInfo);
AcpiTbVerifyTableChecksum ((ACPI_TABLE_HEADER *) AcpiGbl_DSDT);
return_ACPI_STATUS (AE_OK);
}
ACPI_STATUS
AfGetRsdt (void)
{
BOOLEAN Found;
UINT32 PhysicalAddress;
UINT32 SignatureLength;
char *TableSignature;
ACPI_STATUS Status;
ACPI_TABLE_DESC TableInfo;
ACPI_FUNCTION_TRACE (AfGetRsdt);
if (AcpiGbl_XSDT)
{
return (AE_OK);
}
Found = AfFindRsdp (&AcpiGbl_RSDP);
if (!Found)
{
AcpiOsPrintf ("Could not find RSDP in the low megabyte\n");
return (AE_NO_ACPI_TABLES);
}
/* Use XSDT if it is present */
if ((AcpiGbl_RSDP->Revision >= 2) &&
ACPI_GET_ADDRESS (AcpiGbl_RSDP->XsdtPhysicalAddress))
{
PhysicalAddress = ACPI_GET_ADDRESS (AcpiGbl_RSDP->XsdtPhysicalAddress);
TableSignature = ACPI_SIG_XSDT;
SignatureLength = sizeof (ACPI_SIG_XSDT) -1;
AcpiGbl_RootTableType = ACPI_TABLE_TYPE_XSDT;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Found XSDT\n"));
}
else
{
/* No XSDT, use the RSDT */
PhysicalAddress = AcpiGbl_RSDP->RsdtPhysicalAddress;
TableSignature = ACPI_SIG_RSDT;
SignatureLength = sizeof (ACPI_SIG_RSDT) -1;
AcpiGbl_RootTableType = ACPI_TABLE_TYPE_RSDT;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Found RSDT\n"));
}
if (AcpiGbl_DbOpt_verbose)
{
AcpiUtDumpBuffer ((char *) AcpiGbl_RSDP, sizeof (RSDP_DESCRIPTOR), 0, ACPI_UINT32_MAX);
}
/* Get the RSDT/XSDT header to determine the table length */
CopyExtendedToReal (&AcpiTblHeader, PhysicalAddress, sizeof (ACPI_TABLE_HEADER));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDT/XSDT at %8.8X\n", (UINT32) PhysicalAddress));
if (AcpiGbl_DbOpt_verbose)
{
AcpiUtDumpBuffer ((char *) &AcpiTblHeader, sizeof (ACPI_TABLE_HEADER), 0, ACPI_UINT32_MAX);
}
/* Validate the table header */
Status = AcpiTbValidateTableHeader (&AcpiTblHeader);
if (ACPI_FAILURE (Status))
{
/* Table failed verification, map all errors to BAD_DATA */
ACPI_ERROR ((AE_INFO, "Invalid RSDT table header"));
return (AE_BAD_DATA);
}
/* Allocate a buffer for the entire table */
AcpiGbl_XSDT = (void *) malloc ((size_t) AcpiTblHeader.Length);
if (!AcpiGbl_XSDT)
{
AcpiOsPrintf ("Could not allocate buffer for RSDT length 0x%X\n",
(UINT32) AcpiTblHeader.Length);
return AE_NO_MEMORY;
}
/* Get the entire RSDT/XSDT */
CopyExtendedToReal (AcpiGbl_XSDT, PhysicalAddress, AcpiTblHeader.Length);
AcpiOsPrintf ("%s at %p (Phys %8.8X)\n",
TableSignature, AcpiGbl_XSDT, (UINT32) PhysicalAddress);
if (AcpiGbl_DbOpt_verbose)
{
AcpiUtDumpBuffer ((char *) &AcpiTblHeader, sizeof (ACPI_TABLE_HEADER), 0, 0);
}
/* Convert to common format XSDT */
TableInfo.Pointer = (ACPI_TABLE_HEADER *) AcpiGbl_XSDT;
TableInfo.Length = (ACPI_SIZE) AcpiTblHeader.Length;
TableInfo.Allocation = ACPI_MEM_ALLOCATED;
AcpiGbl_RsdtTableCount = AcpiTbGetTableCount (AcpiGbl_RSDP, TableInfo.Pointer);
Status = AcpiTbConvertToXsdt (&TableInfo);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
}
AcpiGbl_XSDT = (XSDT_DESCRIPTOR *) TableInfo.Pointer;
ErrorExit:
return (Status);
}
void
AfDumpRsdt (void)
{
UINT32 i;
UINT32 NumTables;
UINT32 PhysicalAddress;
ACPI_TABLE_HEADER **Table;
ACPI_TABLE_HEADER ThisTable;
NumTables = (AcpiGbl_XSDT->Length - sizeof (ACPI_TABLE_HEADER)) / 8;
AcpiOsPrintf ("%d Tables defined in RSDT/XSDT:\n", NumTables);
for (i = 0; i < NumTables; i++)
{
PhysicalAddress = (UINT32) AcpiGbl_XSDT->TableOffsetEntry[i].Lo;
CopyExtendedToReal (&ThisTable, PhysicalAddress, sizeof (ACPI_TABLE_HEADER));
AcpiOsPrintf ("[%4.4s] ", ThisTable.Signature);
((char *) Table) += 8;
}
AcpiOsPrintf ("\n");
}
ACPI_STATUS
AfGetTable (
ACPI_TABLE_HEADER *TableHeader,
UINT32 PhysicalAddress,
UINT8 **TablePtr)
{
/* Allocate a buffer for the entire table */
*TablePtr = (void *) malloc ((size_t) TableHeader->Length);
if (!*TablePtr)
{
AcpiOsPrintf ("Could not allocate buffer for table length 0x%X\n",
(UINT32) TableHeader->Length);
return AE_NO_MEMORY;
}
/* Get the entire table */
CopyExtendedToReal (*TablePtr, PhysicalAddress, TableHeader->Length);
AcpiOsPrintf ("%4.4s at %p (Phys %8.8X)\n",
TableHeader->Signature, *TablePtr, (UINT32) PhysicalAddress);
if (AcpiGbl_DbOpt_verbose)
{
AcpiUtDumpBuffer ((char *) TableHeader, sizeof (ACPI_TABLE_HEADER), 0, 0);
}
return (AE_OK);
}
ACPI_STATUS
AfGetTableFromXsdt (
char *TableName,
UINT8 **TablePtr)
{
UINT32 i;
UINT32 NumTables;
UINT32 PhysicalAddress;
ACPI_TABLE_HEADER ThisTable;
NumTables = (AcpiGbl_XSDT->Length - sizeof (ACPI_TABLE_HEADER)) / 8;
for (i = 0; i < NumTables; i++)
{
PhysicalAddress = (UINT32) AcpiGbl_XSDT->TableOffsetEntry[i].Lo;
CopyExtendedToReal (&ThisTable, PhysicalAddress, sizeof (ACPI_TABLE_HEADER));
if (ACPI_COMPARE_NAME (TableName, ThisTable.Signature))
{
AfGetTable (&ThisTable, PhysicalAddress, TablePtr);
return (AE_OK);
}
}
return (AE_NOT_FOUND);
}
/******************************************************************************
*
* FUNCTION: AfFindTable
*
* PARAMETERS:
*
* RETURN: Status
*
* DESCRIPTION: Load the DSDT from the file pointer
*
*****************************************************************************/
ACPI_STATUS
AfFindTable (
char *TableName,
UINT8 **TablePtr,
UINT32 *TableLength)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (AfFindTable);
if (!AcpiGbl_DSDT)
{
Status = AfGetRsdt ();
if (ACPI_FAILURE (Status))
{
return (Status);
}
AfDumpRsdt ();
/* Get the rest of the required tables (DSDT, FADT) */
Status = AfGetAllTables (AcpiGbl_RsdtTableCount, NULL);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
}
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n"));
}
if (ACPI_COMPARE_NAME (TableName, ACPI_SIG_DSDT))
{
*TablePtr = (UINT8 *) AcpiGbl_DSDT;
*TableLength = AcpiGbl_DSDT->Length;
}
else if (ACPI_COMPARE_NAME (TableName, ACPI_SIG_FADT))
{
*TablePtr = (UINT8 *) AcpiGbl_FADT;
*TableLength = AcpiGbl_FADT->Length;
}
else if (ACPI_COMPARE_NAME (TableName, ACPI_SIG_FACS))
{
*TablePtr = (UINT8 *) AcpiGbl_FACS;
*TableLength = AcpiGbl_FACS->Length;
}
else if (ACPI_COMPARE_NAME (TableName, ACPI_SIG_RSDT))
{
*TablePtr = (UINT8 *) AcpiGbl_XSDT;
*TableLength = AcpiGbl_XSDT->Length;
}
else if (ACPI_COMPARE_NAME (TableName, ACPI_SIG_SSDT))
{
AcpiOsPrintf ("Unsupported table signature: [%4.4s]\n", TableName);
*TablePtr = NULL;
return AE_SUPPORT;
}
else
{
Status = AfGetTableFromXsdt (TableName, TablePtr);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
}
*TableLength = (*((ACPI_TABLE_HEADER **)TablePtr))->Length;
}
return AE_OK;
ErrorExit:
ACPI_EXCEPTION ((AE_INFO, Status, "During ACPI Table initialization");
return (Status);
}
#ifdef _HPET
UINT8 Hbuf[1024];
void
AfGetHpet (void)
{
HPET_DESCRIPTION_TABLE *NewTable;
ACPI_TABLE_HEADER TableHeader;
ACPI_STATUS Status;
UINT16 i;
UINT32 Value;
UINT32 Value2;
/* Get HPET TEMP! */
ACPI_STRNCPY (TableHeader.Signature, "HPET", 4);
Status = AcpiOsTableOverride (&TableHeader, (ACPI_TABLE_HEADER **) &NewTable);
if (ACPI_FAILURE (Status))
{
return;
}
AcpiDbgLevel |= ACPI_LV_TABLES;
AcpiOsPrintf ("HPET table :\n");
AcpiUtDumpBuffer ((char *) NewTable, NewTable->Header.Length, DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
for (i = 0; i < 1024; i++)
{
Hbuf[i] = (UINT8) i;
}
/* enable HPET */
CopyExtendedToReal (&Value, 0xD0, 4);
AcpiOsPrintf ("Reg 0xD0: %8.8X\n", Value);
Value = dIn32 (0xD0);
AcpiOsPrintf ("Port 0xD0: %8.8X\n", Value);
Value |= ACPI_ENABLE_HPET;
vOut32 (0xD0, Value);
Value2 = dIn32 (0xD0);
AcpiOsPrintf ("Port 0xD0: Wrote: %8.8X got %8.8X\n", Value, Value2);
AcpiOsPrintf ("HPET block(at %8.8X):\n", NewTable->BaseAddress[2]);
CopyExtendedToReal (Hbuf, NewTable->BaseAddress[2], 1024);
AcpiUtDumpBuffer ((char *) Hbuf, 1024, DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
}
#endif /* _HPET */
#endif /* IA16 */
@@ -1,915 +0,0 @@
NAME BU_ASM
TITLE BU_ASM.ASM -- ASM support for DOS BU_LIB
;****************************************************************************
;* Copyright (C) Intel Corporation 1994-1999
;*
;* All rights reserved. No part of this program or publication
;* may be reproduced, transmitted, transcribed, stored in a
;* retrieval system, or translated into any language or computer
;* language, in any form or by any means, electronic, mechanical,
;* magnetic, optical, chemical, manual, or otherwise, without
;* the prior written permission of Intel Corporation.
;****************************************************************************
;
; To assemble with MASM61 -- ml /c a16utils.asm
;
;****************************************************************************
.286
.MODEL large, c
IFDEF MODEL_S
.MODEL small, c
ENDIF
IFDEF MODEL_M
.MODEL medium, c
ENDIF
IFDEF MODEL_L
.MODEL large, c
ENDIF
IFDEF MODEL_C
.MODEL compact, c
ENDIF
IFDEF MODEL_H
.MODEL huge, c
ENDIF
;--------------------------------------------------------------------
GOREAL MACRO
LOCAL here
mov eax, cr0
and eax, 0fffffffeh
mov cr0, eax
jmp here
here:
ENDM
;--------------------------------------------------------------------
GOPROT MACRO
LOCAL here
xor eax, eax
xor edx, edx
mov ax, ds
shl eax, 4
lea edx, _gdt
add eax, edx
mov [_gdt_ptr+2], ax
shr eax, 16
mov [_gdt_ptr+4], ax
lgdt FWORD PTR _gdt_ptr
mov eax, cr0
or eax, 1
mov cr0, eax
jmp here
here:
ENDM
;--------------------------------------------------------------------
.STACK
.DATA
PUBLIC _dAPAwake, _dAPDone, _dAPFuncPtr, _wProcNumber, _bSPValid
PUBLIC _wCSegDS, _wCSegES, _wCSegSS, _wCSegSP, _wASegDS, _wASegES
PUBLIC _dAPHltJmp
emsfilename DB 'EMMXXXX0',0
_dAPAwake DD 0
_dAPDone DD 0
_dAPFuncPtr DD 0
_wProcNumber DW 0
_bSPValid DB 0
_wASegDS DW 0
_wASegES DW 0
_wCSegDS DW 0
_wCSegES DW 0
_wCSegSS DW 0
_wCSegSP DW 0
_block DW 0
_gdt_ptr DW 23
DD 0
_gdt DD 0 ; NULL descriptor
DD 0 ; NULL descriptor
; 64K real mode style data segment
DD 0ffffh ; base 0, limit 0xffff
DD 00009200h ; data, CPL=0, 16-bit, 1 byte granularity, r/w
; 4G flat data segment
DD 0ffffh ; base 0, limit 0xfffff
DD 008f9200h ; data, CPL=0, 16-bit, 4K granularity, r/w
_old_es DW 0
_old_ds DW 0
_old_fs DW 0
_old_gs DW 0
_dAPHltJmp DD 0 ; jump to halt location
.CODE
EXTERNDEF pascal cprint:proc
PUBLIC ems_present
ems_present PROC C
mov ah,3dh ; open file
xor al,al ; read only operation
mov dx,offset emsfilename ; look for EMMXXXX0
int 21h
jc emserror1 ; if carry flag set, then no EMM driver
mov di,ax ; save file handle
mov bx,ax ; set up handle
mov ax,4400h ; get device (channel) info
int 21h
mov ah,3eh ; close file
mov bx,di ; close the file handle up
int 21h
jc emserror1 ; if carry flag set, then no driver is present
test dx,10000000b ; if bit 7 not set, then the channel is a file
jz emserror1 ; otherwise the channel is a device driver
mov ax,1 ; 1 = EMS present
ret
emserror1:
xor ax,ax ; 0 = EMS not present
ret
ems_present ENDP
PUBLIC vm86
vm86 PROC C
smsw ax
and ax, 1
ret
vm86 ENDP
PUBLIC _set_rows
_set_rows PROC C rows:WORD
cmp rows, 25
je set_25
cmp rows, 50
je set_50
cmp rows, 132
je set_132
jmp invalid_input
set_25:
mov ah, 00
mov al, 03
int 10h
mov ax, rows
jmp end_set_rows
set_50:
mov ah, 00
mov al, 03
int 10h
xor bx, bx
mov ah, 11h
mov al, 12h
int 10h
mov ax, rows
jmp end_set_rows
set_132:
mov ah, 00
mov al, 14h
int 10h
xor bx, bx
mov ah, 11h
mov al, 12h
int 10h
mov ax, rows
jmp end_set_rows
invalid_input:
xor ax, ax
jmp end_set_rows
end_set_rows:
ret
_set_rows ENDP
PUBLIC _cpuid_asm
_cpuid_asm PROC C hv:DWORD, regs:PTR DWORD
check_8086:
.8086
pushf
pop ax
mov cx, ax
and ax, 0fffh
push ax
popf
pushf
pop ax
and ax, 0f000h
cmp ax, 0f000h
mov ax, 10h
je end_cpuid
check_80286:
.286
or cx, 0f000h
push cx
popf
pushf
pop ax
and ax, 0f000h
mov ax, 20h
jz end_cpuid
check_80386:
.386
mov bx, sp
and sp, not 3
pushfd
pop eax
mov ecx, eax
xor eax, 40000h
push eax
popfd
pushfd
pop eax
cmp ecx, eax
jne check_80486
mov ax, 30h
mov sp, bx
jmp end_cpuid
check_80486:
.486
pushfd
pop ecx
mov ecx, eax
xor eax, 200000h
push eax
popfd
pushfd
pop eax
xor eax, ecx
mov ax, 40h
je end_cpuid
check_cpuid:
.586
mov eax, hv
cpuid
push ebx
IF @DataSize ; segment is far
les bx, regs
mov dword ptr es:[bx], eax
pop eax
mov dword ptr es:[bx + 4], eax
mov dword ptr es:[bx + 8], ecx
mov dword ptr es:[bx + 12], edx
ELSE ; segment is near
mov bx, regs
mov dword ptr [bx], eax
pop eax
mov dword ptr [bx + 4], eax
mov dword ptr [bx + 8], ecx
mov dword ptr [bx + 12], edx
ENDIF
mov ax, 5
end_cpuid:
ret
_cpuid_asm ENDP
.386p
;--------------------------------------------------------------------
; Pentium Pro MSRs - from Pentium Pro Developer's Manual
; January 1996 - Appendix C
;
; MTRRs: 200h - 20Fh, 250h, 258h - 259h, 268h - 26Fh, 2FFh
;--------------------------------------------------------------------
PUBLIC _read_msr
_read_msr PROC C dmsr:DWORD, pqmsr:PTR DWORD
pushad
mov ecx, dmsr
dw 320fh ; RDMSR
les bx, pqmsr
mov DWORD ptr es:[bx], eax
mov DWORD ptr es:[bx + 4], edx
popad
ret
_read_msr ENDP
;--------------------------------------------------------------------
PUBLIC _write_msr
_write_msr PROC C dmsr:DWORD, pqmsr:PTR DWORD
pushad
les bx, pqmsr
mov eax, DWORD ptr es:[bx]
mov edx, DWORD ptr es:[bx + 4]
mov ecx, dmsr
dw 300fh ; WRMSR
popad
ret
_write_msr ENDP
;----------------------------------------------------------------------------
; Procedure: dReadCR0 - Reads CR0 CPU Register
;
; Output: dx:ax and eax - Contents of CR0
;
; Registers: All registers preserved except EAX and EDX
;----------------------------------------------------------------------------
PUBLIC dReadCR0
dReadCR0 PROC C
mov eax, cr0
mov edx, eax
shr edx, 16 ; upper 16 bits in dx
ret
dReadCR0 ENDP
;----------------------------------------------------------------------------
; Procedure: dReadCR2 - Reads CR2 CPU Register
;
; Output: dx:ax and eax - Contents of CR2
;
; Registers: All registers preserved except EAX and EDX
;----------------------------------------------------------------------------
PUBLIC dReadCR2
dReadCR2 PROC C
mov eax, cr2
mov edx, eax
shr edx, 16 ; upper 16 bits in dx
ret
dReadCR2 ENDP
;----------------------------------------------------------------------------
; Procedure: dReadCR3 - Reads CR3 CPU Register
;
; Output: dx:ax and eax - Contents of CR3
;
; Registers: All registers preserved except EAX and EDX
;----------------------------------------------------------------------------
PUBLIC dReadCR3
dReadCR3 PROC C
mov eax, cr3
mov edx, eax
shr edx, 16 ; upper 16 bits in dx
ret
dReadCR3 ENDP
.586
;----------------------------------------------------------------------------
; Procedure: dGetProcUpdateRev_asm - Reads PPP Update Revision via an MSR
;
; Output: dx:ax and eax - PPP Update Revision
;
; Registers: All registers preserved except EAX, ECX, and EDX
;----------------------------------------------------------------------------
PUBLIC _dGetProcUpdateRev_asm
_dGetProcUpdateRev_asm PROC C
mov ecx, 08Bh ; model specific register to write
xor eax, eax
xor edx, edx
dw 300Fh ; WRMSR ==> load 0 to MSR at 8Bh
mov eax, 1
cpuid
mov ecx, 08Bh ; model specific register to read
dw 320Fh ; RDMSR ==> EDX = (read) MSR 8Bh
mov eax, edx ; return EAX
shr edx, 16 ; return DX:AX
ret
_dGetProcUpdateRev_asm ENDP
;--------------------------------------------------------------------
PUBLIC iInterruptFlagState
iInterruptFlagState PROC
pushf
pop ax
and ax, 200h
shr ax, 9
ret
iInterruptFlagState ENDP
;--------------------------------------------------------------------
.586P
PUBLIC vRealFsGs
vRealFsGs PROC C
; TBD: verify this on an AMD K6-2 266 MHz
; Assert A20M# via system control port A (This is a
; system dependent feature).
in al, 92h
and al, 0fdh
out 92h, al ; re-assert A20M#
GOPROT
mov ax, 8
mov gs, ax
GOREAL
mov ax, [_old_fs] ; restore original
mov fs, ax
mov ax, [_old_gs] ; restore original
mov gs, ax
sti
ret
vRealFsGs ENDP
;--------------------------------------------------------------------
PUBLIC vFlatFsGs
vFlatFsGs PROC C
cli
mov ax, fs
mov [_old_fs], ax ; save original fs
mov ax, gs
mov [_old_gs], ax ; save original gs
; Deassert A20M# via system control port A (This is a
; system dependent feature)
in al, 92h
or al, 2
out 92h, al ; de-assert A20M#
GOPROT
mov ax, 10h
mov fs, ax
mov gs, ax
GOREAL
ret
vFlatFsGs ENDP
PUBLIC vRealEsDs
vRealEsDs PROC C
; TBD: verify this on an AMD K6-2 266 MHz
; Assert A20M# via system control port A (This is a
; system dependent feature).
in al, 92h
and al, 0fdh
out 92h, al ; re-assert A20M#
GOPROT
mov ax, 8
mov gs, ax
GOREAL
mov ax, [_old_es] ; restore original
mov es, ax
mov ax, [_old_gs] ; restore original
mov gs, ax
sti
ret
vRealEsDs ENDP
;--------------------------------------------------------------------
PUBLIC vFlatEsDs
vFlatEsDs PROC C
cli
mov ax, es
mov [_old_es], ax ; save original
mov ax, gs
mov [_old_gs], ax ; save original
; Deassert A20M# via system control port A (This is a
; system dependent feature)
in al, 92h
or al, 2
out 92h, al ; de-assert A20M#
GOPROT
mov ax, 10h
mov es, ax
mov gs, ax
GOREAL
ret
vFlatEsDs ENDP
PUBLIC print
print PROC PASCAL Seq:DWORD
pushad
mov eax, Seq
push eax
call cprint
popad
ret
print ENDP
PUBLIC DoMove
DoMove PROC
push edx
; GOPROT
pop edx
mov ecx, edx
shr ecx, 2 ; byte count / 4 = dword count
cmp ecx, 0
je DoBytes
NextDword:
xor eax, eax
lock or eax, gs:[esi]
; mov eax, gs:[esi]
mov gs:[edi], eax
add esi, 4
add edi, 4
loop NextDword
DoBytes:
mov ecx, edx
and ecx, 3
cmp ecx, 0
je Exit ; no extra bytes to move
NextByte:
mov al, byte ptr gs:[esi]
mov byte ptr gs:[edi], al
inc esi
inc edi
loop NextByte
Exit:
; GOREAL
ret
DoMove ENDP
.586
;--------------------------------------------------------------------
PUBLIC _WriteApic
_WriteApic PROC C
call vFlatFsGs
xor ecx, ecx
xor edx, edx
mov cx, [esp+6] ; high word of apic address
shl ecx, 16
mov cx, [esp+4] ; low word of apic address
mov dx, [esp+10] ; high word of apic command
shl edx, 16
mov dx, [esp+8] ; low word of apic command
mov gs:[ecx], edx
call vRealFsGs
ret
_WriteApic ENDP
;--------------------------------------------------------------------
PUBLIC _ReadApic
_ReadApic PROC C
call vFlatFsGs
xor ecx, ecx
mov cx, [esp+6] ; low word of apic address
shl ecx, 16
mov cx, [esp+4] ; high word of apic address
mov eax, gs:[ecx]
push eax ; save eax
call vRealFsGs
pop eax ; restore eax
mov edx, eax
shr edx, 16
ret
_ReadApic ENDP
;--------------------------------------------------------------------
; Since the AP shares the BSP's stack, coordination is needed to avoid
; simultaneous usage by both processors, which would cause corruption.
;
; While the AP is executing here, the BSP is executing the code
; which follows the call to vAPStartupAll() or vAPStartupOne()
; in bu_apic.c:vExecuteOnAPs(). After disabling interrupts,
; the BSP stores the sp value in _wCSegSP, sets _bSPValid to 1,
; and spins while _dAPDone != _dAPAwake. (Both are initially zero;
; the code below increments _dAPAwake before spinning on _bSPValid.)
;
; XXX - There is a race condition here: if the BSP makes it all
; XXX - the way to its spin loop on _dAPDone != _dAPAwake before
; XXX - the AP increments _dAPAwake, the BSP will exit the spin
; XXX - loop without actually having waited for the AP to finish.
PUBLIC _vSetupAP
_vSetupAP PROC C
cli
mov ax, @data
mov ds, ax
mov esp, 0
lock inc dword ptr [_dAPAwake]
spin1:
mov al, [_bSPValid]
cmp al, 1
jne spin1
; XXX - The following line is supposed to provide some validity checking,
; XXX - but it does not entirely succeed. It is possible for > 1 AP to
; XXX - see _bSPValid == 1, and exit the spin1 loop just above, before
; XXX - the first one out has had time to decrement _bSPValid; this race
; XXX - defeats the purpose of decrementing it. The decrement is likely
; XXX - not needed anyway due to the exclusion provided by the spin2 loop
; XXX - below.
lock dec byte ptr[_bSPValid]
mov ax, [_wCSegSS]
mov ss, ax
mov sp, [_wCSegSP]
; critical section - determining unique cpu signatures
spin2:
mov eax, 1
; XXX - Should the following line have a 'lock' prefix?
xchg word ptr [_block], ax
test ax, ax
jne spin2
mov ax, ds ; Save ASM DS and ES in global vars
mov [_wASegDS], ax
mov ax, es
mov [_wASegES], ax
mov ax, [_wCSegES]
mov es, ax
mov ax, [_wCSegDS] ; Restore C DS and ES from global vars
mov ds, ax
; Update Current Processor Number. Mutual exclusion from other AP's is
; guaranteed by the spin2 loop above.
; Note that the "processor number" determined here represents the order
; in which the processors happened to get through the spin2 lock, and
; has nothing to do with APIC numbers. A system having > 1 AP will not
; necessarily number the AP's consistently from one run to the next.
mov eax, [_dAPDone]
inc eax
mov [_wProcNumber], ax
call [_dAPFuncPtr] ; _dAPFuncPtr needs to point to a void function
mov ax, [_wASegDS] ; Restore ASM DS and ES from global vars
mov ds, ax
mov ax, [_wASegES]
mov es, ax
lock inc dword ptr [_dAPDone]
lock inc byte ptr [_bSPValid]
xor eax, eax
; A simple 'mov' would serve as well as the following 'xchg'.
xchg word ptr [_block], ax
wbinvd
mov si, offset _dAPHltJmp
jmp dword ptr [si] ; Jump to HLT, JMP $-1 in F000 segment
hlt ; Should never get here
_vSetupAP ENDP
;--------------------------------------------------------------------
PUBLIC bIn8
bIn8 PROC C wPort:WORD
xor ax, ax
mov dx, wPort
in al, dx
ret
bIn8 ENDP
;--------------------------------------------------------------------
PUBLIC wIn16
wIn16 PROC C wPort:WORD
mov dx, wPort
in ax, dx
ret
wIn16 ENDP
;--------------------------------------------------------------------
PUBLIC dIn32
dIn32 PROC C wPort:WORD
mov dx, wPort
in eax, dx
mov edx, eax
shr edx, 16
ret
dIn32 ENDP
;--------------------------------------------------------------------
PUBLIC vOut8
vOut8 PROC C wPort:WORD, bValue:BYTE
mov dx, wPort
mov al, bValue
out dx, al
ret
vOut8 ENDP
;--------------------------------------------------------------------
PUBLIC vOut16
vOut16 PROC C wPort:WORD, wValue:WORD
mov dx, wPort
mov ax, wValue
out dx, ax
ret
vOut16 ENDP
;--------------------------------------------------------------------
PUBLIC vOut32
vOut32 PROC C wPort:WORD, dValue:DWORD
mov dx, wPort
mov eax, dValue
out dx, eax
ret
vOut32 ENDP
;--------------------------------------------------------------------
; int FlatMove (DWORD dPhysicalDestination, DWORD dPhysicalSource, size_t sSize)
PUBLIC FlatMoveX
FlatMoveX PROC C dDest:DWORD, dSrc:DWORD, sSize:WORD
call vm86 ; check if VM86 mode
cmp ax, 0
jne NotRealMode ; skip memory move if not in real mode
call vFlatFsGs ; set up FS and GS as 4GB limit selectors with
; base 0:0 and de-assert A20M#
movzx ecx, sSize
cmp ecx, 0
je SKipMemoryMove ; skip memory move if 0==sSize
mov eax, dDest
cmp eax, 400h
jbe SkipMemoryMove ; skip memory move if destination is 40:0
; BIOS Data Area or less (IVT)
mov ebx, dSrc
NextByte:
mov dl, gs:[ebx][ecx - 1]
mov gs:[eax][ecx - 1], dl
loop NextByte
call vRealFsGs
xor ax, ax
NotRealMode:
ret
SkipMemoryMove:
mov ax, 1 ; return error code
ret
FlatMoveX ENDP
; int FlatMove32 (DWORD dPhysicalDestination, DWORD dPhysicalSource, size_t sSize)
PUBLIC FlatMove32
FlatMove32 PROC C dDest:DWORD, dSrc:DWORD, sSize:WORD
call vm86 ; check if VM86 mode
cmp ax, 0
jne NotRealMode ; skip memory move if not in real mode
call vFlatFsGs ; set up FS and GS as 4GB limit selectors with
; base 0:0 and de-assert A20M#
movzx edx, sSize
mov esi, dSrc
mov edi, dDest
push edx
call print
push esi
call print
push edi
call print
cmp edx, 0
je SkipMemoryMove ; skip memory move if 0==sSize
cmp edi, 400h
jbe SkipMemoryMove ; skip memory move if destination is 40:0
; BIOS Data Area or less (IVT)
call DoMove ; edx=Count, esi=src, edi=dst
movzx ecx, sSize
shr ecx, 2
mov edi, dDest
PrintLoop:
mov eax, gs:[edi]
push eax
call print
add edi, 4
loop PrintLoop
call vRealFsGs
xor ax, ax
NotRealMode:
ret
SkipMemoryMove:
call print
call vRealEsDs
mov ax, 1 ; return error code
ret
FlatMove32 ENDP
; int FlatMove32 (DWORD dPhysicalDestination, DWORD dPhysicalSource, size_t sSize)
PUBLIC FlatMove32x
FlatMove32x PROC C dDest:DWORD, dSrc:DWORD, sSize:WORD
call vm86 ; check if VM86 mode
cmp ax, 0
jne NotRealMode ; skip memory move if not in real mode
call vFlatFsGs ; set up FS and GS as 4GB limit selectors with
; base 0:0 and de-assert A20M#
movzx ecx, sSize
cmp ecx, 0
je SKipMemoryMove ; skip memory move if 0==sSize
mov eax, dDest
cmp eax, 400h
jbe SkipMemoryMove ; skip memory move if destination is 40:0
; BIOS Data Area or less (IVT)
mov ebx, dSrc
mov esi, 0
push ecx
call print
push ebx
call print
push eax
call print
shr ecx, 2 ; byte count / 4 = dword count
cmp ecx, 0
je DoBytes
NextDword:
mov edx, dword ptr gs:[ebx][esi]
mov dword ptr gs:[eax][esi], edx
push edx
call print
add esi, 4
loop NextDword
DoBytes:
movzx ecx, sSize
and ecx, 3
cmp ecx, 0
je Exit ; no extra bytes to move
NextByte:
mov dl, gs:[ebx][esi]
mov gs:[eax][esi], dl
inc esi
loop NextByte
Exit:
call vRealFsGs
xor ax, ax
NotRealMode:
ret
SkipMemoryMove:
mov ax, 1 ; return error code
ret
FlatMove32x ENDP
END
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: adfile - Application-level disassembler file support routines
* $Revision: 1.4 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acapps.h"
#include <stdio.h>
@@ -125,6 +125,13 @@
#define _COMPONENT ACPI_TOOLS
ACPI_MODULE_NAME ("adfile")
/* Local prototypes */
INT32
AdWriteBuffer (
char *Filename,
char *Buffer,
UINT32 Length);
char FilenameBuf[20];
@@ -185,12 +192,12 @@ AdGenerateFilename (
INT32
AdWriteBuffer (
char *Filename,
char *Buffer,
UINT32 Length)
char *Filename,
char *Buffer,
UINT32 Length)
{
FILE *fp;
ACPI_SIZE Actual;
FILE *fp;
ACPI_SIZE Actual;
fp = fopen (Filename, "wb");
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: adisasm - Application-level disassembler routines
* $Revision: 1.112 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdebug.h"
@@ -153,7 +153,25 @@ void
AdDisassemblerHeader (
char *Filename);
ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot;
void
AdAddExternalsToNamespace (
void);
UINT32
AdMethodExternalCount (
void);
ACPI_STATUS
AdDeferredParse (
ACPI_PARSE_OBJECT *Op,
UINT8 *Aml,
UINT32 AmlLength);
ACPI_STATUS
AdParseDeferredOps (
ACPI_PARSE_OBJECT *Root);
ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot;
/* Stubs for ASL compiler */
@@ -245,18 +263,27 @@ AdInitialize (
/* ACPI CA subsystem initialization */
Status = AcpiOsInitialize ();
AcpiUtInitGlobals ();
if (ACPI_FAILURE (Status))
{
return (Status);
}
Status = AcpiUtInitGlobals ();
if (ACPI_FAILURE (Status))
{
return (Status);
}
Status = AcpiUtMutexInitialize ();
if (ACPI_FAILURE (Status))
{
return Status;
return (Status);
}
Status = AcpiNsRootInitialize ();
if (ACPI_FAILURE (Status))
{
return Status;
return (Status);
}
/* Setup the Table Manager (cheat - there is no RSDT) */
@@ -265,7 +292,7 @@ AdInitialize (
AcpiGbl_RootTableList.Count = 0;
AcpiGbl_RootTableList.Tables = LocalTables;
return Status;
return (Status);
}
@@ -275,7 +302,7 @@ AdInitialize (
*
* PARAMETERS:
*
* RETURN: Status
* RETURN: None
*
* DESCRIPTION:
*
@@ -371,14 +398,17 @@ AdAmlDisassemble (
{
ACPI_STATUS Status;
char *DisasmFilename = NULL;
char *ExternalFilename;
FILE *File = NULL;
ACPI_TABLE_HEADER *Table = NULL;
ACPI_TABLE_HEADER *ExternalTable;
ACPI_OWNER_ID OwnerId;
ACPI_EXTERNAL_LIST *NextExternal;
/*
* Input: AML Code from either a file,
* or via GetTables (memory or registry)
* Input: AML Code from either a file,
* or via GetTables (memory or registry)
*/
if (Filename)
{
@@ -388,12 +418,56 @@ AdAmlDisassemble (
return Status;
}
/*
* External filenames separated by commas
* Example: iasl -e file1,file2,file3 -d xxx.aml
*/
if (Gbl_ExternalFilename)
{
Status = AcpiDbGetTableFromFile (Gbl_ExternalFilename, &ExternalTable);
if (ACPI_FAILURE (Status))
ExternalFilename = strtok (Gbl_ExternalFilename, ",");
while (ExternalFilename)
{
return Status;
Status = AcpiDbGetTableFromFile (ExternalFilename, &ExternalTable);
if (ACPI_FAILURE (Status))
{
return Status;
}
/* Load external table for symbol resolution */
if (ExternalTable)
{
Status = AdParseTable (ExternalTable, &OwnerId, TRUE, TRUE);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not parse external ACPI tables, %s\n",
AcpiFormatException (Status));
return Status;
}
/*
* Load namespace from names created within control methods
* Set owner id of nodes in external table
*/
AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot,
AcpiGbl_RootNode, OwnerId);
AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot);
}
/* Next external file name */
ExternalFilename = strtok (NULL, ",");
}
/* Clear external list generated by Scope in external tables */
while (AcpiGbl_ExternalList)
{
NextExternal = AcpiGbl_ExternalList->Next;
ACPI_FREE (AcpiGbl_ExternalList->Path);
ACPI_FREE (AcpiGbl_ExternalList);
AcpiGbl_ExternalList = NextExternal;
}
}
}
@@ -470,7 +544,7 @@ AdAmlDisassemble (
{
/* Always parse the tables, only option is what to display */
Status = AdParseTable (Table, TRUE);
Status = AdParseTable (Table, &OwnerId, TRUE, FALSE);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not parse ACPI tables, %s\n",
@@ -490,12 +564,12 @@ AdAmlDisassemble (
/*
* Load namespace from names created within control methods
*/
AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode);
AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode, OwnerId);
/*
* Cross reference the namespace here, in order to generate External() statements
*/
AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode);
AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode, OwnerId);
if (AslCompilerdebug)
{
@@ -510,14 +584,6 @@ AdAmlDisassemble (
AcpiDmConvertResourceIndexes (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode);
if (AslCompilerdebug)
{
AcpiOsPrintf ("/**** After second load and resource conversion\n");
LsSetupNsList (File);
LsDisplayNamespace ();
AcpiOsPrintf ("*****/\n");
}
/*
* If we found any external control methods, we must reparse the entire
* tree with the new information (namely, the number of arguments per
@@ -549,7 +615,7 @@ AdAmlDisassemble (
/* Parse table. No need to reload it, however (FALSE) */
Status = AdParseTable (Table, FALSE);
Status = AdParseTable (Table, NULL, FALSE, FALSE);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not parse ACPI tables, %s\n",
@@ -559,6 +625,11 @@ AdAmlDisassemble (
if (AslCompilerdebug)
{
AcpiOsPrintf ("/**** After second load and resource conversion\n");
LsSetupNsList (File);
LsDisplayNamespace ();
AcpiOsPrintf ("*****/\n");
AcpiDmDumpTree (AcpiGbl_ParseOpRoot);
}
}
@@ -1015,6 +1086,11 @@ AdGetLocalTables (
fprintf (stderr, "Could not obtain RSDT\n");
return AE_NO_ACPI_TABLES;
}
else
{
AdWriteTable (NewTable, NewTable->Length,
ACPI_SIG_RSDT, NewTable->OemTableId);
}
if (ACPI_COMPARE_NAME (NewTable->Signature, ACPI_SIG_RSDT))
{
@@ -1094,6 +1170,9 @@ AdGetLocalTables (
* FUNCTION: AdParseTable
*
* PARAMETERS: Table - Pointer to the raw table
* OwnerId - Returned OwnerId of the table
* LoadTable - If add table to the global table list
* External - If this is an external table
*
* RETURN: Status
*
@@ -1104,7 +1183,9 @@ AdGetLocalTables (
ACPI_STATUS
AdParseTable (
ACPI_TABLE_HEADER *Table,
BOOLEAN LoadTable)
ACPI_OWNER_ID *OwnerId,
BOOLEAN LoadTable,
BOOLEAN External)
{
ACPI_STATUS Status = AE_OK;
ACPI_WALK_STATE *WalkState;
@@ -1158,6 +1239,10 @@ AdParseTable (
return Status;
}
/* If LoadTable is FALSE, we are parsing the last loaded table */
TableIndex = AcpiGbl_RootTableList.Count - 1;
/* Pass 2 */
if (LoadTable)
@@ -1168,16 +1253,36 @@ AdParseTable (
{
return Status;
}
Status = AcpiTbAllocateOwnerId (TableIndex);
if (ACPI_FAILURE (Status))
{
return Status;
}
if (OwnerId)
{
Status = AcpiTbGetOwnerId (TableIndex, OwnerId);
if (ACPI_FAILURE (Status))
{
return Status;
}
}
}
fprintf (stderr, "Pass 2 parse of [%4.4s]\n", (char *) Table->Signature);
Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, 0, NULL);
Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, TableIndex, NULL);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* No need to parse control methods of external table */
if (External)
{
return AE_OK;
}
/* Pass 3: Parse control methods and link their parse trees into the main parse tree */
Status = AdParseDeferredOps (AcpiGbl_ParseOpRoot);
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: adwalk - Application-level disassembler parse tree walk routines
* $Revision: 1.7 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdebug.h"
@@ -252,6 +252,7 @@ AcpiDmFindOrphanMethods (
*
* PARAMETERS: ParseTreeRoot - Root of the parse tree
* NamespaceRoot - Root of the internal namespace
* OwnerId - OwnerId of the table to be disassembled
*
* RETURN: None
*
@@ -263,7 +264,8 @@ AcpiDmFindOrphanMethods (
void
AcpiDmFinishNamespaceLoad (
ACPI_PARSE_OBJECT *ParseTreeRoot,
ACPI_NAMESPACE_NODE *NamespaceRoot)
ACPI_NAMESPACE_NODE *NamespaceRoot,
ACPI_OWNER_ID OwnerId)
{
ACPI_STATUS Status;
ACPI_OP_WALK_INFO Info;
@@ -277,7 +279,7 @@ AcpiDmFinishNamespaceLoad (
/* Create and initialize a new walk state */
WalkState = AcpiDsCreateWalkState (0, ParseTreeRoot, NULL, NULL);
WalkState = AcpiDsCreateWalkState (OwnerId, ParseTreeRoot, NULL, NULL);
if (!WalkState)
{
return;
@@ -304,6 +306,7 @@ AcpiDmFinishNamespaceLoad (
*
* PARAMETERS: ParseTreeRoot - Root of the parse tree
* NamespaceRoot - Root of the internal namespace
* OwnerId - OwnerId of the table to be disassembled
*
* RETURN: None
*
@@ -314,7 +317,8 @@ AcpiDmFinishNamespaceLoad (
void
AcpiDmCrossReferenceNamespace (
ACPI_PARSE_OBJECT *ParseTreeRoot,
ACPI_NAMESPACE_NODE *NamespaceRoot)
ACPI_NAMESPACE_NODE *NamespaceRoot,
ACPI_OWNER_ID OwnerId)
{
ACPI_STATUS Status;
ACPI_OP_WALK_INFO Info;
@@ -328,7 +332,7 @@ AcpiDmCrossReferenceNamespace (
/* Create and initialize a new walk state */
WalkState = AcpiDsCreateWalkState (0, ParseTreeRoot, NULL, NULL);
WalkState = AcpiDsCreateWalkState (OwnerId, ParseTreeRoot, NULL, NULL);
if (!WalkState)
{
return;
@@ -470,6 +474,9 @@ AcpiDmDumpDescending (
case AML_INT_NAMEDFIELD_OP:
AcpiOsPrintf ("%4.4s", &Op->Named.Name);
break;
default:
break;
}
AcpiOsPrintf ("\n");
@@ -618,6 +625,9 @@ AcpiDmFindOrphanDescending (
}
break;
default:
break;
}
return (AE_OK);
@@ -650,6 +660,9 @@ AcpiDmLoadDescendingOp (
char *Path = NULL;
ACPI_PARSE_OBJECT *NextOp;
ACPI_NAMESPACE_NODE *Node;
char FieldPath[5];
BOOLEAN PreDefined = FALSE;
UINT8 PreDefineIndex = 0;
WalkState = Info->WalkState;
@@ -672,6 +685,13 @@ AcpiDmLoadDescendingOp (
/* For all named operators, get the new name */
Path = (char *) Op->Named.Path;
if (!Path && Op->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
{
*ACPI_CAST_PTR (UINT32, &FieldPath[0]) = Op->Named.Name;
FieldPath[4] = 0;
Path = FieldPath;
}
}
else if (OpInfo->Flags & AML_CREATE)
{
@@ -699,6 +719,36 @@ AcpiDmLoadDescendingOp (
Op->Common.Node = Node;
if (ACPI_SUCCESS (Status))
{
/* Check if it's a predefined node */
while (AcpiGbl_PreDefinedNames[PreDefineIndex].Name)
{
if (!ACPI_STRNCMP (Node->Name.Ascii,
AcpiGbl_PreDefinedNames[PreDefineIndex].Name, 4))
{
PreDefined = TRUE;
break;
}
PreDefineIndex++;
}
/*
* Set node owner id if it satisfies all the following conditions:
* 1) Not a predefined node, _SB_ etc
* 2) Not the root node
* 3) Not a node created by Scope
*/
if (!PreDefined && Node != AcpiGbl_RootNode &&
Op->Common.AmlOpcode != AML_SCOPE_OP)
{
Node->OwnerId = WalkState->OwnerId;
}
}
Exit:
@@ -740,10 +790,12 @@ AcpiDmXrefDescendingOp (
const ACPI_OPCODE_INFO *OpInfo;
ACPI_WALK_STATE *WalkState;
ACPI_OBJECT_TYPE ObjectType;
ACPI_OBJECT_TYPE ObjectType2;
ACPI_STATUS Status;
char *Path = NULL;
ACPI_PARSE_OBJECT *NextOp;
ACPI_NAMESPACE_NODE *Node;
ACPI_OPERAND_OBJECT *Object;
WalkState = Info->WalkState;
@@ -819,6 +871,33 @@ AcpiDmXrefDescendingOp (
#endif
}
}
/*
* Found the node in external table, add it to external list
* Node->OwnerId == 0 indicates built-in ACPI Names, _OS_ etc
*/
else if (Node->OwnerId && WalkState->OwnerId != Node->OwnerId)
{
ObjectType2 = ObjectType;
Object = AcpiNsGetAttachedObject (Node);
if (Object)
{
ObjectType2 = Object->Common.Type;
}
if (ObjectType2 == ACPI_TYPE_METHOD)
{
AcpiDmAddToExternalList (Path, ACPI_TYPE_METHOD,
Object->Method.ParamCount);
}
else
{
AcpiDmAddToExternalList (Path, (UINT8) ObjectType2, 0);
}
Op->Common.Node = Node;
}
else
{
Op->Common.Node = Node;
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dmrestag - Add tags to resource descriptors (Application-level)
* $Revision: 1.12 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "acdisasm.h"
#include "acnamesp.h"
@@ -387,7 +387,7 @@ static ACPI_RESOURCE_TAG *AcpiGbl_ResourceTags [] =
static UINT32 AcpiGbl_NextResourceId = 0;
static UINT8 AcpiGbl_NextPrefix = 0;
static UINT8 AcpiGbl_Prefix[ACPI_NUM_RES_PREFIX] =
static char AcpiGbl_Prefix[ACPI_NUM_RES_PREFIX] =
{'Y','Z','J','K','X'};
@@ -636,13 +636,22 @@ AcpiGetTagPathname (
/* Get the full pathname to the parent buffer */
RequiredSize = AcpiNsGetPathnameLength (BufferNode);
if (!RequiredSize)
{
return (NULL);
}
Pathname = ACPI_ALLOCATE_ZEROED (RequiredSize + ACPI_PATH_SEGMENT_LENGTH);
if (!Pathname)
{
return (NULL);
}
AcpiNsBuildExternalPath (BufferNode, RequiredSize, Pathname);
Status = AcpiNsBuildExternalPath (BufferNode, RequiredSize, Pathname);
if (ACPI_FAILURE (Status))
{
return (NULL);
}
/*
* Create the full path to the resource and tag by: remove the buffer name,
@@ -720,7 +729,7 @@ AcpiDmUpdateResourceName (
/* Change the resource descriptor name */
ResourceNode->Name.Integer = *(UINT32 *) Name;
ResourceNode->Name.Integer = *ACPI_CAST_PTR (UINT32, &Name[0]);
}
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dmtable - Support for ACPI tables that contain no AML code
* $Revision: 1.16 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -115,6 +114,7 @@
*****************************************************************************/
#include "acpi.h"
#include "accommon.h"
#include "acdisasm.h"
#include "actables.h"
@@ -132,8 +132,13 @@ AcpiDmGetTableData (
static void
AcpiDmCheckAscii (
UINT8 *Target,
char *RepairedName,
UINT32 Count);
UINT8
AcpiTbGenerateChecksum (
ACPI_TABLE_HEADER *Table);
/* These tables map a subtable type to a description string */
@@ -152,20 +157,21 @@ static const char *AcpiDmDmarSubnames[] =
"Hardware Unit Definition",
"Reserved Memory Region",
"Root Port ATS Capability",
"Remapping Hardware Static Affinity",
"Unknown SubTable Type" /* Reserved */
};
static const char *AcpiDmHestSubnames[] =
{
"XPF Machine Check Exception",
"XPF Corrected Machine Check",
"NOT USED???",
"XPF Non-Maskable Interrupt",
"IPF Corrected Machine Check",
"IPF Corrected Platform Error",
"IA-32 Machine Check Exception",
"IA-32 Corrected Machine Check",
"IA-32 Non-Maskable Interrupt",
"Unknown SubTable Type", /* 3 - Reserved */
"Unknown SubTable Type", /* 4 - Reserved */
"Unknown SubTable Type", /* 5 - Reserved */
"PCI Express Root Port AER",
"PCI Express AER (AER Endpoint)",
"PCI Express/PCI-X Bridge AERn",
"PCI Express/PCI-X Bridge AER",
"Generic Hardware Error Source",
"Unknown SubTable Type" /* Reserved */
};
@@ -191,6 +197,8 @@ static const char *AcpiDmMadtSubnames[] =
"I/O SAPIC", /* ACPI_MADT_TYPE_IO_SAPIC */
"Local SAPIC", /* ACPI_MADT_TYPE_LOCAL_SAPIC */
"Platform Interrupt Sources", /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
"Processor Local x2APIC", /* ACPI_MADT_TYPE_LOCAL_X2APIC */
"Local x2APIC NMI", /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */
"Unknown SubTable Type" /* Reserved */
};
@@ -198,14 +206,40 @@ static const char *AcpiDmSratSubnames[] =
{
"Processor Local APIC/SAPIC Affinity",
"Memory Affinity",
"Processor Local x2APIC Affinity",
"Unknown SubTable Type" /* Reserved */
};
static const char *AcpiDmIvrsSubnames[] =
{
"Hardware Definition Block",
"Memory Definition Block",
"Unknown SubTable Type" /* Reserved */
};
#define ACPI_FADT_PM_RESERVED 8
static const char *AcpiDmFadtProfiles[] =
{
"Unspecified",
"Desktop",
"Mobile",
"Workstation",
"Enterprise Server",
"SOHO Server",
"Appliance PC",
"Performance Server",
"Unknown Profile Type"
};
/*******************************************************************************
*
* ACPI Table Data, indexed by signature.
*
* Each entry contains: Signature, Table Info, Handler, Description
*
* Simple tables have only a TableInfo structure, complex tables have a handler.
* This table must be NULL terminated. RSDP and FACS are special-cased
* elsewhere.
@@ -226,8 +260,10 @@ static ACPI_DMTABLE_DATA AcpiDmTableData[] =
{ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, "Fixed ACPI Description Table"},
{ACPI_SIG_HEST, NULL, AcpiDmDumpHest, "Hardware Error Source Table"},
{ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, "High Precision Event Timer table"},
{ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, "I/O Virtualization Reporting Structure"},
{ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, "Multiple APIC Description Table"},
{ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, "Memory Mapped Configuration table"},
{ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, "Maximum System Characteristics Table"},
{ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, "Root System Description Table"},
{ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, "Smart Battery Specification Table"},
{ACPI_SIG_SLIC, AcpiDmTableInfoSlic, NULL, "Software Licensing Description Table"},
@@ -236,6 +272,9 @@ static ACPI_DMTABLE_DATA AcpiDmTableData[] =
{ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, "Server Platform Management Interface table"},
{ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, "System Resource Affinity Table"},
{ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, "Trusted Computing Platform Alliance table"},
{ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, "UEFI Boot Optimization Table"},
{ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, "Windows ACPI Emulated Devices Table"},
{ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, "Watchdog Action Table"},
{ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, "Watchdog Resource Table"},
{ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, "Extended System Description Table"},
{NULL, NULL, NULL, NULL}
@@ -426,12 +465,12 @@ AcpiDmLineHeader (
if (ByteLength)
{
AcpiOsPrintf ("[%3.3Xh %3.3d% 3d] %28s : ",
AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %28s : ",
Offset, Offset, ByteLength, Name);
}
else
{
AcpiOsPrintf ("%42s : ",
AcpiOsPrintf ("%43s : ",
Name);
}
}
@@ -446,12 +485,12 @@ AcpiDmLineHeader2 (
if (ByteLength)
{
AcpiOsPrintf ("[%3.3Xh %3.3d% 3d] %24s % 3d : ",
AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %24s % 3d : ",
Offset, Offset, ByteLength, Name, Value);
}
else
{
AcpiOsPrintf ("[%3.3Xh %3.3d ] %24s % 3d : ",
AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s % 3d : ",
Offset, Offset, Name, Value);
}
}
@@ -488,7 +527,9 @@ AcpiDmDumpTable (
UINT8 Temp8;
UINT16 Temp16;
ACPI_DMTABLE_DATA *TableData;
const char *Name;
BOOLEAN LastOutputBlankLine = FALSE;
char RepairedName[8];
if (!Info)
@@ -524,10 +565,12 @@ AcpiDmDumpTable (
case ACPI_DMT_UINT8:
case ACPI_DMT_CHKSUM:
case ACPI_DMT_SPACEID:
case ACPI_DMT_IVRS:
case ACPI_DMT_MADT:
case ACPI_DMT_SRAT:
case ACPI_DMT_ASF:
case ACPI_DMT_HESTNTYP:
case ACPI_DMT_FADTPM:
ByteLength = 1;
break;
case ACPI_DMT_UINT16:
@@ -553,6 +596,9 @@ AcpiDmDumpTable (
case ACPI_DMT_NAME8:
ByteLength = 8;
break;
case ACPI_DMT_BUF16:
ByteLength = 16;
break;
case ACPI_DMT_STRING:
ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1;
break;
@@ -653,17 +699,28 @@ AcpiDmDumpTable (
ACPI_FORMAT_UINT64 (ACPI_GET64 (Target)));
break;
case ACPI_DMT_BUF16:
/* Buffer of length 16 */
for (Temp8 = 0; Temp8 < 16; Temp8++)
{
AcpiOsPrintf ("%2.2X,", Target[Temp8]);
}
AcpiOsPrintf ("\n");
break;
case ACPI_DMT_STRING:
AcpiOsPrintf ("%s\n", ACPI_CAST_PTR (char, Target));
AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target));
break;
/* Fixed length ASCII name fields */
case ACPI_DMT_SIG:
AcpiDmCheckAscii (Target, 4);
AcpiOsPrintf ("\"%4.4s\" ", Target);
AcpiDmCheckAscii (Target, RepairedName, 4);
AcpiOsPrintf ("\"%.4s\" ", RepairedName);
TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target));
if (TableData)
{
@@ -674,20 +731,20 @@ AcpiDmDumpTable (
case ACPI_DMT_NAME4:
AcpiDmCheckAscii (Target, 4);
AcpiOsPrintf ("\"%4.4s\"\n", Target);
AcpiDmCheckAscii (Target, RepairedName, 4);
AcpiOsPrintf ("\"%.4s\"\n", RepairedName);
break;
case ACPI_DMT_NAME6:
AcpiDmCheckAscii (Target, 6);
AcpiOsPrintf ("\"%6.6s\"\n", Target);
AcpiDmCheckAscii (Target, RepairedName, 6);
AcpiOsPrintf ("\"%.6s\"\n", RepairedName);
break;
case ACPI_DMT_NAME8:
AcpiDmCheckAscii (Target, 8);
AcpiOsPrintf ("\"%8.8s\"\n", Target);
AcpiDmCheckAscii (Target, RepairedName, 8);
AcpiOsPrintf ("\"%.8s\"\n", RepairedName);
break;
/* Special Data Types */
@@ -718,8 +775,8 @@ AcpiDmDumpTable (
/* Generic Address Structure */
AcpiOsPrintf ("<Generic Address Structure>\n");
AcpiDmDumpTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
CurrentOffset, Target, 0, AcpiDmTableInfoGas);
AcpiDmDumpTable (TableLength, CurrentOffset, Target,
sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
AcpiOsPrintf ("\n");
LastOutputBlankLine = TRUE;
break;
@@ -741,33 +798,33 @@ AcpiDmDumpTable (
/* DMAR subtable types */
Temp16 = *Target;
Temp16 = ACPI_GET16 (Target);
if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
{
Temp16 = ACPI_DMAR_TYPE_RESERVED;
}
AcpiOsPrintf ("%4.4X <%s>\n", *Target, AcpiDmDmarSubnames[Temp16]);
AcpiOsPrintf ("%4.4X <%s>\n", ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]);
break;
case ACPI_DMT_HEST:
/* HEST subtable types */
Temp16 = *Target;
Temp16 = ACPI_GET16 (Target);
if (Temp16 > ACPI_HEST_TYPE_RESERVED)
{
Temp16 = ACPI_HEST_TYPE_RESERVED;
}
AcpiOsPrintf ("%4.4X (%s)\n", *Target, AcpiDmHestSubnames[Temp16]);
AcpiOsPrintf ("%4.4X (%s)\n", ACPI_GET16 (Target), AcpiDmHestSubnames[Temp16]);
break;
case ACPI_DMT_HESTNTFY:
AcpiOsPrintf ("<Hardware Error Notification Structure>\n");
AcpiDmDumpTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
CurrentOffset, Target, 0, AcpiDmTableInfoHestNotify);
AcpiDmDumpTable (TableLength, CurrentOffset, Target,
sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
AcpiOsPrintf ("\n");
LastOutputBlankLine = TRUE;
break;
@@ -812,6 +869,44 @@ AcpiDmDumpTable (
AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmSratSubnames[Temp8]);
break;
case ACPI_DMT_FADTPM:
/* FADT Preferred PM Profile names */
Temp8 = *Target;
if (Temp8 > ACPI_FADT_PM_RESERVED)
{
Temp8 = ACPI_FADT_PM_RESERVED;
}
AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmFadtProfiles[Temp8]);
break;
case ACPI_DMT_IVRS:
/* IVRS subtable types */
Temp8 = *Target;
switch (Temp8)
{
case ACPI_IVRS_TYPE_HARDWARE:
Name = AcpiDmIvrsSubnames[0];
break;
case ACPI_IVRS_TYPE_MEMORY1:
case ACPI_IVRS_TYPE_MEMORY2:
case ACPI_IVRS_TYPE_MEMORY3:
Name = AcpiDmIvrsSubnames[1];
break;
default:
Name = AcpiDmIvrsSubnames[2];
break;
}
AcpiOsPrintf ("%2.2X <%s>\n", *Target, Name);
break;
case ACPI_DMT_EXIT:
return (AE_OK);
@@ -822,6 +917,14 @@ AcpiDmDumpTable (
}
}
if (TableOffset && !SubtableLength)
{
/* If this table is not the main table, subtable must have valid length */
AcpiOsPrintf ("Invalid zero length subtable\n");
return (AE_BAD_DATA);
}
return (AE_OK);
}
@@ -843,6 +946,7 @@ AcpiDmDumpTable (
static void
AcpiDmCheckAscii (
UINT8 *Name,
char *RepairedName,
UINT32 Count)
{
UINT32 i;
@@ -850,9 +954,15 @@ AcpiDmCheckAscii (
for (i = 0; i < Count; i++)
{
if (!Name[i] || !isprint (Name[i]))
RepairedName[i] = Name[i];
if (!Name[i])
{
Name[i] = ' ';
return;
}
if (!isprint (Name[i]))
{
RepairedName[i] = ' ';
}
}
}
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dmtbdump - Dump ACPI data tables that contain no AML code
* $Revision: 1.18 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -115,6 +114,7 @@
*****************************************************************************/
#include "acpi.h"
#include "accommon.h"
#include "acdisasm.h"
#include "actables.h"
@@ -260,13 +260,20 @@ AcpiDmDumpFadt (
AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1);
/* Check for ACPI 2.0+ extended data (cannot depend on Revision field) */
/* Check for ACPI 1.0B MS extensions (FADT revision 2) */
if (Table->Length >= sizeof (ACPI_TABLE_FADT))
if (Table->Revision == 2)
{
AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2);
}
/* Check for ACPI 2.0+ extended data (FADT revision 3+) */
else if (Table->Length >= sizeof (ACPI_TABLE_FADT))
{
AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3);
}
/* Validate various fields in the FADT, including length */
AcpiTbCreateLocalFadt (Table, Table->Length);
@@ -299,6 +306,7 @@ AcpiDmDumpAsf (
UINT32 DataLength = 0;
UINT32 DataOffset = 0;
UINT32 i;
UINT8 Type;
/* No main table, only sub-tables */
@@ -315,7 +323,11 @@ AcpiDmDumpAsf (
return;
}
switch (SubTable->Header.Type & 0x7F) /* Mask off top bit */
/* The actual type is the lower 7 bits of Type */
Type = (UINT8) (SubTable->Header.Type & 0x7F);
switch (Type)
{
case ACPI_ASF_TYPE_INFO:
InfoTable = AcpiDmTableInfoAsf0;
@@ -325,8 +337,8 @@ AcpiDmDumpAsf (
InfoTable = AcpiDmTableInfoAsf1;
DataInfoTable = AcpiDmTableInfoAsf1a;
DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ALERT));
DataCount = ((ACPI_ASF_ALERT *) SubTable)->Alerts;
DataLength = ((ACPI_ASF_ALERT *) SubTable)->DataLength;
DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->Alerts;
DataLength = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->DataLength;
DataOffset = Offset + sizeof (ACPI_ASF_ALERT);
break;
@@ -334,8 +346,8 @@ AcpiDmDumpAsf (
InfoTable = AcpiDmTableInfoAsf2;
DataInfoTable = AcpiDmTableInfoAsf2a;
DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_REMOTE));
DataCount = ((ACPI_ASF_REMOTE *) SubTable)->Controls;
DataLength = ((ACPI_ASF_REMOTE *) SubTable)->DataLength;
DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->Controls;
DataLength = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->DataLength;
DataOffset = Offset + sizeof (ACPI_ASF_REMOTE);
break;
@@ -346,7 +358,7 @@ AcpiDmDumpAsf (
case ACPI_ASF_TYPE_ADDRESS:
InfoTable = AcpiDmTableInfoAsf4;
DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ADDRESS));
DataLength = ((ACPI_ASF_ADDRESS *) SubTable)->Devices;
DataLength = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, SubTable)->Devices;
DataOffset = Offset + sizeof (ACPI_ASF_ADDRESS);
break;
@@ -364,7 +376,7 @@ AcpiDmDumpAsf (
/* Dump variable-length extra data */
switch (SubTable->Header.Type & 0x7F) /* Mask off top bit */
switch (Type)
{
case ACPI_ASF_TYPE_ALERT:
case ACPI_ASF_TYPE_CONTROL:
@@ -405,6 +417,9 @@ AcpiDmDumpAsf (
AcpiOsPrintf ("\n");
break;
default:
break;
}
AcpiOsPrintf ("\n");
@@ -461,7 +476,7 @@ AcpiDmDumpCpep (
{
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset, SubTable,
SubTable->Length, AcpiDmTableInfoCpep0);
SubTable->Header.Length, AcpiDmTableInfoCpep0);
if (ACPI_FAILURE (Status))
{
return;
@@ -469,8 +484,9 @@ AcpiDmDumpCpep (
/* Point to next sub-table */
Offset += SubTable->Length;
SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable, SubTable->Length);
Offset += SubTable->Header.Length;
SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable,
SubTable->Header.Length);
}
}
@@ -538,7 +554,11 @@ AcpiDmDumpDmar (
break;
case ACPI_DMAR_TYPE_ATSR:
InfoTable = AcpiDmTableInfoDmar2;
ScopeOffset = sizeof (ACPI_DMAR_TYPE_ATSR);
ScopeOffset = sizeof (ACPI_DMAR_ATSR);
break;
case ACPI_DMAR_HARDWARE_AFFINITY:
InfoTable = AcpiDmTableInfoDmar3;
ScopeOffset = sizeof (ACPI_DMAR_RHSA);
break;
default:
AcpiOsPrintf ("\n**** Unknown DMAR sub-table type %X\n\n", SubTable->Type);
@@ -636,7 +656,7 @@ AcpiDmDumpEinj (
{
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset, SubTable,
0, AcpiDmTableInfoEinj0);
sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0);
if (ACPI_FAILURE (Status))
{
return;
@@ -689,7 +709,7 @@ AcpiDmDumpErst (
{
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset, SubTable,
0, AcpiDmTableInfoEinj0);
sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0);
if (ACPI_FAILURE (Status))
{
return;
@@ -727,6 +747,8 @@ AcpiDmDumpHest (
UINT32 Offset = sizeof (ACPI_TABLE_HEST);
ACPI_DMTABLE_INFO *InfoTable;
UINT32 SubTableLength;
UINT32 BankCount;
ACPI_HEST_IA_ERROR_BANK *BankTable;
/* Main table */
@@ -742,36 +764,269 @@ AcpiDmDumpHest (
SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset);
while (Offset < Table->Length)
{
/* TBD: add new subtable types as examples become available */
BankCount = 0;
switch (SubTable->Type)
{
case ACPI_HEST_TYPE_GENERIC_HARDWARE_ERROR_SOURCE:
case ACPI_HEST_TYPE_IA32_CHECK:
InfoTable = AcpiDmTableInfoHest0;
SubTableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK);
BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK,
SubTable))->NumHardwareBanks;
break;
case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
InfoTable = AcpiDmTableInfoHest1;
SubTableLength = sizeof (ACPI_HEST_IA_CORRECTED);
BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED,
SubTable))->NumHardwareBanks;
break;
case ACPI_HEST_TYPE_IA32_NMI:
InfoTable = AcpiDmTableInfoHest2;
SubTableLength = sizeof (ACPI_HEST_IA_NMI);
break;
case ACPI_HEST_TYPE_AER_ROOT_PORT:
InfoTable = AcpiDmTableInfoHest6;
SubTableLength = sizeof (ACPI_HEST_AER_ROOT);
break;
case ACPI_HEST_TYPE_AER_ENDPOINT:
InfoTable = AcpiDmTableInfoHest7;
SubTableLength = sizeof (ACPI_HEST_AER);
break;
case ACPI_HEST_TYPE_AER_BRIDGE:
InfoTable = AcpiDmTableInfoHest8;
SubTableLength = sizeof (ACPI_HEST_AER_BRIDGE);
break;
case ACPI_HEST_TYPE_GENERIC_ERROR:
InfoTable = AcpiDmTableInfoHest9;
SubTableLength = sizeof (ACPI_HEST_GENERIC);
break;
default:
/* Cannot continue on unknown type - no length */
AcpiOsPrintf ("\n**** Unknown HEST sub-table type %X\n", SubTable->Type);
return;
}
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset, SubTable,
0, InfoTable);
SubTableLength, InfoTable);
if (ACPI_FAILURE (Status))
{
return;
}
/* Point to next sub-table (each subtable is of fixed length) */
/* Point to end of current subtable (each subtable above is of fixed length) */
Offset += SubTableLength;
/* If there are any (fixed-length) Error Banks from above, dump them now */
if (BankCount)
{
BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, SubTable, SubTableLength);
SubTableLength += BankCount * sizeof (ACPI_HEST_IA_ERROR_BANK);
while (BankCount)
{
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset, BankTable,
sizeof (ACPI_HEST_IA_ERROR_BANK), AcpiDmTableInfoHestBank);
if (ACPI_FAILURE (Status))
{
return;
}
Offset += sizeof (ACPI_HEST_IA_ERROR_BANK);
BankTable++;
BankCount--;
}
}
/* Point to next sub-table */
SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, SubTable, SubTableLength);
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDmDumpIvrs
*
* PARAMETERS: Table - A IVRS table
*
* RETURN: None
*
* DESCRIPTION: Format the contents of a IVRS
*
******************************************************************************/
static UINT8 EntrySizes[] = {4,8,16,32};
void
AcpiDmDumpIvrs (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
UINT32 Offset = sizeof (ACPI_TABLE_IVRS);
UINT32 EntryOffset;
UINT32 EntryLength;
UINT32 EntryType;
ACPI_IVRS_DE_HEADER *DeviceEntry;
ACPI_IVRS_HEADER *SubTable;
ACPI_DMTABLE_INFO *InfoTable;
/* Main table */
Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
if (ACPI_FAILURE (Status))
{
return;
}
/* Sub-tables */
SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
while (Offset < Table->Length)
{
/* Common sub-table header */
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
SubTable->Length, AcpiDmTableInfoIvrsHdr);
if (ACPI_FAILURE (Status))
{
return;
}
switch (SubTable->Type)
{
case ACPI_IVRS_TYPE_HARDWARE:
InfoTable = AcpiDmTableInfoIvrs0;
break;
case ACPI_IVRS_TYPE_MEMORY1:
case ACPI_IVRS_TYPE_MEMORY2:
case ACPI_IVRS_TYPE_MEMORY3:
InfoTable = AcpiDmTableInfoIvrs1;
break;
default:
AcpiOsPrintf ("\n**** Unknown IVRS sub-table type %X\n",
SubTable->Type);
/* Attempt to continue */
if (!SubTable->Length)
{
AcpiOsPrintf ("Invalid zero length subtable\n");
return;
}
goto NextSubTable;
}
/* Dump the subtable */
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
SubTable->Length, InfoTable);
if (ACPI_FAILURE (Status))
{
return;
}
/* The hardware subtable can contain multiple device entries */
if (SubTable->Type == ACPI_IVRS_TYPE_HARDWARE)
{
EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE);
DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, SubTable,
sizeof (ACPI_IVRS_HARDWARE));
while (EntryOffset < (Offset + SubTable->Length))
{
AcpiOsPrintf ("\n");
/*
* Upper 2 bits of Type encode the length of the device entry
*
* 00 = 4 byte
* 01 = 8 byte
* 10 = 16 byte - currently no entries defined
* 11 = 32 byte - currently no entries defined
*/
EntryType = DeviceEntry->Type;
EntryLength = EntrySizes [EntryType >> 6];
switch (EntryType)
{
/* 4-byte device entries */
case ACPI_IVRS_TYPE_PAD4:
case ACPI_IVRS_TYPE_ALL:
case ACPI_IVRS_TYPE_SELECT:
case ACPI_IVRS_TYPE_START:
case ACPI_IVRS_TYPE_END:
InfoTable = AcpiDmTableInfoIvrs4;
break;
/* 8-byte entries, type A */
case ACPI_IVRS_TYPE_ALIAS_SELECT:
case ACPI_IVRS_TYPE_ALIAS_START:
InfoTable = AcpiDmTableInfoIvrs8a;
break;
/* 8-byte entries, type B */
case ACPI_IVRS_TYPE_PAD8:
case ACPI_IVRS_TYPE_EXT_SELECT:
case ACPI_IVRS_TYPE_EXT_START:
InfoTable = AcpiDmTableInfoIvrs8b;
break;
/* 8-byte entries, type C */
case ACPI_IVRS_TYPE_SPECIAL:
InfoTable = AcpiDmTableInfoIvrs8c;
break;
default:
InfoTable = AcpiDmTableInfoIvrs4;
AcpiOsPrintf (
"\n**** Unknown IVRS device entry type/length: "
"%.2X/%X at offset %.4X: (header below)\n",
EntryType, EntryLength, EntryOffset);
break;
}
/* Dump the Device Entry */
Status = AcpiDmDumpTable (Table->Length, EntryOffset,
DeviceEntry, EntryLength, InfoTable);
EntryOffset += EntryLength;
DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry,
EntryLength);
}
}
NextSubTable:
/* Point to next sub-table */
Offset += SubTable->Length;
SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, SubTable, SubTable->Length);
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDmDumpMadt
@@ -848,9 +1103,23 @@ AcpiDmDumpMadt (
case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
InfoTable = AcpiDmTableInfoMadt8;
break;
case ACPI_MADT_TYPE_LOCAL_X2APIC:
InfoTable = AcpiDmTableInfoMadt9;
break;
case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
InfoTable = AcpiDmTableInfoMadt10;
break;
default:
AcpiOsPrintf ("\n**** Unknown MADT sub-table type %X\n\n", SubTable->Type);
return;
/* Attempt to continue */
if (!SubTable->Length)
{
AcpiOsPrintf ("Invalid zero length subtable\n");
return;
}
goto NextSubTable;
}
Status = AcpiDmDumpTable (Length, Offset, SubTable,
@@ -860,6 +1129,7 @@ AcpiDmDumpMadt (
return;
}
NextSubTable:
/* Point to next sub-table */
Offset += SubTable->Length;
@@ -910,7 +1180,8 @@ AcpiDmDumpMcfg (
}
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, 0, AcpiDmTableInfoMcfg0);
Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
if (ACPI_FAILURE (Status))
{
return;
@@ -925,6 +1196,58 @@ AcpiDmDumpMcfg (
}
/*******************************************************************************
*
* FUNCTION: AcpiDmDumpMsct
*
* PARAMETERS: Table - A MSCT table
*
* RETURN: None
*
* DESCRIPTION: Format the contents of a MSCT
*
******************************************************************************/
void
AcpiDmDumpMsct (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
UINT32 Offset = sizeof (ACPI_TABLE_MSCT);
ACPI_MSCT_PROXIMITY *SubTable;
/* Main table */
Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
if (ACPI_FAILURE (Status))
{
return;
}
/* Sub-tables */
SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
while (Offset < Table->Length)
{
/* Common sub-table header */
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
if (ACPI_FAILURE (Status))
{
return;
}
/* Point to next sub-table */
Offset += sizeof (ACPI_MSCT_PROXIMITY);
SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, SubTable, sizeof (ACPI_MSCT_PROXIMITY));
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDmDumpSlit
@@ -1033,6 +1356,16 @@ AcpiDmDumpSrat (
SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
while (Offset < Table->Length)
{
/* Common sub-table header */
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
SubTable->Length, AcpiDmTableInfoSratHdr);
if (ACPI_FAILURE (Status))
{
return;
}
switch (SubTable->Type)
{
case ACPI_SRAT_TYPE_CPU_AFFINITY:
@@ -1041,9 +1374,20 @@ AcpiDmDumpSrat (
case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
InfoTable = AcpiDmTableInfoSrat1;
break;
case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
InfoTable = AcpiDmTableInfoSrat2;
break;
default:
AcpiOsPrintf ("\n**** Unknown SRAT sub-table type %X\n", SubTable->Type);
return;
/* Attempt to continue */
if (!SubTable->Length)
{
AcpiOsPrintf ("Invalid zero length subtable\n");
return;
}
goto NextSubTable;
}
AcpiOsPrintf ("\n");
@@ -1054,6 +1398,7 @@ AcpiDmDumpSrat (
return;
}
NextSubTable:
/* Point to next sub-table */
Offset += SubTable->Length;
@@ -1061,3 +1406,54 @@ AcpiDmDumpSrat (
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDmDumpWdat
*
* PARAMETERS: Table - A WDAT table
*
* RETURN: None
*
* DESCRIPTION: Format the contents of a WDAT
*
******************************************************************************/
void
AcpiDmDumpWdat (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
UINT32 Offset = sizeof (ACPI_TABLE_WDAT);
ACPI_WDAT_ENTRY *SubTable;
/* Main table */
Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
if (ACPI_FAILURE (Status))
{
return;
}
/* Sub-tables */
SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
while (Offset < Table->Length)
{
/* Common sub-table header */
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
if (ACPI_FAILURE (Status))
{
return;
}
/* Point to next sub-table */
Offset += sizeof (ACPI_WDAT_ENTRY);
SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, SubTable, sizeof (ACPI_WDAT_ENTRY));
}
}
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dmtbinfo - Table info for non-AML tables
* $Revision: 1.17 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -115,6 +114,7 @@
*****************************************************************************/
#include "acpi.h"
#include "accommon.h"
#include "acdisasm.h"
/* This module used for application-level code only */
@@ -139,14 +139,19 @@
#define ACPI_ERST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_ERST,f)
#define ACPI_HEST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HEST,f)
#define ACPI_HPET_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HPET,f)
#define ACPI_IVRS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_IVRS,f)
#define ACPI_MADT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MADT,f)
#define ACPI_MCFG_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MCFG,f)
#define ACPI_MSCT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MSCT,f)
#define ACPI_SBST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SBST,f)
#define ACPI_SLIT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SLIT,f)
#define ACPI_SPCR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SPCR,f)
#define ACPI_SPMI_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SPMI,f)
#define ACPI_SRAT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SRAT,f)
#define ACPI_TCPA_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_TCPA,f)
#define ACPI_UEFI_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_UEFI,f)
#define ACPI_WAET_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WAET,f)
#define ACPI_WDAT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WDAT,f)
#define ACPI_WDRT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WDRT,f)
/* Subtables */
@@ -163,9 +168,24 @@
#define ACPI_DMAR0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_HARDWARE_UNIT,f)
#define ACPI_DMAR1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_RESERVED_MEMORY,f)
#define ACPI_DMAR2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_ATSR,f)
#define ACPI_DMAR3_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_RHSA,f)
#define ACPI_EINJ0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_WHEA_HEADER,f)
#define ACPI_HEST0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_MACHINE_CHECK,f)
#define ACPI_HEST1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_CORRECTED,f)
#define ACPI_HEST2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_NMI,f)
#define ACPI_HEST6_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_AER_ROOT,f)
#define ACPI_HEST7_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_AER,f)
#define ACPI_HEST8_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_AER_BRIDGE,f)
#define ACPI_HEST9_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_GENERIC,f)
#define ACPI_HESTN_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_NOTIFY,f)
#define ACPI_HESTB_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_ERROR_BANK,f)
#define ACPI_IVRSH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_HEADER,f)
#define ACPI_IVRS0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_HARDWARE,f)
#define ACPI_IVRS1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_MEMORY,f)
#define ACPI_IVRSD_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_DE_HEADER,f)
#define ACPI_IVRS8A_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_DEVICE8A,f)
#define ACPI_IVRS8B_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_DEVICE8B,f)
#define ACPI_IVRS8C_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_DEVICE8C,f)
#define ACPI_MADT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC,f)
#define ACPI_MADT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_IO_APIC,f)
#define ACPI_MADT2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f)
@@ -175,10 +195,16 @@
#define ACPI_MADT6_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_IO_SAPIC,f)
#define ACPI_MADT7_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_SAPIC,f)
#define ACPI_MADT8_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_INTERRUPT_SOURCE,f)
#define ACPI_MADT9_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_X2APIC,f)
#define ACPI_MADT10_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_X2APIC_NMI,f)
#define ACPI_MADTH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f)
#define ACPI_MCFG0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MCFG_ALLOCATION,f)
#define ACPI_MSCT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MSCT_PROXIMITY,f)
#define ACPI_SRATH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f)
#define ACPI_SRAT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_CPU_AFFINITY,f)
#define ACPI_SRAT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_MEM_AFFINITY,f)
#define ACPI_SRAT2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f)
#define ACPI_WDAT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_WDAT_ENTRY,f)
/*
* Simplify access to flag fields by breaking them up into bytes
@@ -192,6 +218,7 @@
#define ACPI_HPET_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_HPET,f,o)
#define ACPI_SRAT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_CPU_AFFINITY,f,o)
#define ACPI_SRAT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_MEM_AFFINITY,f,o)
#define ACPI_SRAT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f,o)
#define ACPI_MADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_MADT,f,o)
#define ACPI_MADT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_APIC,f,o)
#define ACPI_MADT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f,o)
@@ -199,6 +226,8 @@
#define ACPI_MADT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_APIC_NMI,f,o)
#define ACPI_MADT7_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_SAPIC,f,o)
#define ACPI_MADT8_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_INTERRUPT_SOURCE,f,o)
#define ACPI_MADT9_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_X2APIC,f,o)
#define ACPI_MADT10_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_X2APIC_NMI,f,o)
/*
@@ -284,12 +313,16 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[] =
{ACPI_DMT_NAME4, ACPI_FACS_OFFSET (Signature[0]), "Signature"},
{ACPI_DMT_UINT32, ACPI_FACS_OFFSET (Length), "Length"},
{ACPI_DMT_UINT32, ACPI_FACS_OFFSET (HardwareSignature), "Hardware Signature"},
{ACPI_DMT_UINT32, ACPI_FACS_OFFSET (FirmwareWakingVector), "Firmware Waking Vector(32)"},
{ACPI_DMT_UINT32, ACPI_FACS_OFFSET (FirmwareWakingVector), "32 Firmware Waking Vector"},
{ACPI_DMT_UINT32, ACPI_FACS_OFFSET (GlobalLock), "Global Lock"},
{ACPI_DMT_UINT32, ACPI_FACS_OFFSET (Flags), "Flags (decoded below)"},
{ACPI_DMT_FLAG0, ACPI_FACS_FLAG_OFFSET (Flags,0), "S4BIOS Support Present"},
{ACPI_DMT_UINT64, ACPI_FACS_OFFSET (XFirmwareWakingVector), "Firmware Waking Vector(64)"},
{ACPI_DMT_FLAG1, ACPI_FACS_FLAG_OFFSET (Flags,0), "64-bit Wake Supported (V2)"},
{ACPI_DMT_UINT64, ACPI_FACS_OFFSET (XFirmwareWakingVector), "64 Firmware Waking Vector"},
{ACPI_DMT_UINT8, ACPI_FACS_OFFSET (Version), "Version"},
{ACPI_DMT_UINT24, ACPI_FACS_OFFSET (Reserved[0]), "Reserved"},
{ACPI_DMT_UINT32, ACPI_FACS_OFFSET (OspmFlags), "OspmFlags (decoded below)"},
{ACPI_DMT_FLAG0, ACPI_FACS_FLAG_OFFSET (OspmFlags,0), "64-bit Wake Env Required (V2)"},
{ACPI_DMT_EXIT, 0, NULL}
};
@@ -300,12 +333,14 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[] =
*
******************************************************************************/
/* ACPI 1.0 FADT (Version 1) */
ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[] =
{
{ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Facs), "FACS Address"},
{ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Dsdt), "DSDT Address"},
{ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Model), "Model"},
{ACPI_DMT_UINT8, ACPI_FADT_OFFSET (PreferredProfile), "PM Profile"},
{ACPI_DMT_FADTPM, ACPI_FADT_OFFSET (PreferredProfile), "PM Profile"},
{ACPI_DMT_UINT16, ACPI_FADT_OFFSET (SciInterrupt), "SCI Interrupt"},
{ACPI_DMT_UINT32, ACPI_FADT_OFFSET (SmiCommand), "SMI Command Port"},
{ACPI_DMT_UINT8, ACPI_FADT_OFFSET (AcpiEnable), "ACPI Enable Value"},
@@ -337,46 +372,64 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[] =
{ACPI_DMT_UINT8, ACPI_FADT_OFFSET (DayAlarm), "RTC Day Alarm Index"},
{ACPI_DMT_UINT8, ACPI_FADT_OFFSET (MonthAlarm), "RTC Month Alarm Index"},
{ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Century), "RTC Century Index"},
{ACPI_DMT_UINT16, ACPI_FADT_OFFSET (BootFlags), "Boot Architecture Flags"},
{ACPI_DMT_UINT16, ACPI_FADT_OFFSET (BootFlags), "Boot Flags (decoded below)"},
/* Boot Architecture Flags byte 0 */
{ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "Legacy Devices Supported (V2)"},
{ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "8042 Present on ports 60/64 (V2)"},
{ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "VGA Not Present (V4)"},
{ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "MSI Not Supported (V4)"},
{ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "PCIe ASPM Not Supported (V4)"},
{ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Flags), "Flags (decoded below)"},
/* Flags byte 0 */
{ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD is operational"},
{ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD does not invalidate"},
{ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,0), "All CPUs support C1"},
{ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,0), "C2 works on MP system"},
{ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,0), "Power button is generic"},
{ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,0), "Sleep button is generic"},
{ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC wakeup not fixed"},
{ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC wakeup/S4 not possible"},
{ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD instruction is operational (V1)"},
{ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD flushes all caches (V1)"},
{ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,0), "All CPUs support C1 (V1)"},
{ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,0), "C2 works on MP system (V1)"},
{ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,0), "Control Method Power Button (V1)"},
{ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,0), "Control Method Sleep Button (V1)"},
{ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC wake not in fixed reg space (V1)"},
{ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC can wake system from S4 (V1)"},
/* Flags byte 1 */
{ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,1), "32-bit PM Timer"},
{ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,1), "Docking Supported"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* ACPI 2.0+ Extensions */
ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[] =
{
{ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,1), "Reset Register Supported"},
{ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,1), "Sealed Case"},
{ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,1), "Headless - No Video"},
{ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,1), "Native instr after SLP_TYP"},
{ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,1), "PCIEXP_WAK Supported"},
{ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,1), "Use Platform Timer"},
{ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,1), "32-bit PM Timer (V1)"},
{ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,1), "Docking Supported (V1)"},
{ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,1), "Reset Register Supported (V2)"},
{ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,1), "Sealed Case (V3)"},
{ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,1), "Headless - No Video (V3)"},
{ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,1), "Use native instr after SLP_TYPx (V3)"},
{ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,1), "PCIEXP_WAK Bits Supported (V4)"},
{ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,1), "Use Platform Timer (V4)"},
/* Flags byte 2 */
{ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,2), "RTC_STS valid after S4"},
{ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,2), "Remote Power-on capable"},
{ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,2), "APIC Cluster Model"},
{ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,2), "APIC Physical Dest Mode"},
{ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,2), "RTC_STS valid on S4 wake (V4)"},
{ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,2), "Remote Power-on capable (V4)"},
{ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,2), "Use APIC Cluster Model (V4)"},
{ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,2), "Use APIC Physical Destination Mode (V4)"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* ACPI 1.0 MS Extensions (FADT version 2) */
ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[] =
{
{ACPI_DMT_GAS, ACPI_FADT_OFFSET (ResetRegister), "Reset Register"},
{ACPI_DMT_UINT8, ACPI_FADT_OFFSET (ResetValue), "Value to cause reset"},
{ACPI_DMT_UINT24, ACPI_FADT_OFFSET (Reserved4[0]), "Reserved"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* ACPI 2.0+ Extensions (FADT version 3+) */
ACPI_DMTABLE_INFO AcpiDmTableInfoFadt3[] =
{
{ACPI_DMT_GAS, ACPI_FADT_OFFSET (ResetRegister), "Reset Register"},
{ACPI_DMT_UINT8, ACPI_FADT_OFFSET (ResetValue), "Value to cause reset"},
{ACPI_DMT_UINT24, ACPI_FADT_OFFSET (Reserved4[0]), "Reserved"},
@@ -419,9 +472,9 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoAsfHdr[] =
ACPI_DMTABLE_INFO AcpiDmTableInfoAsf0[] =
{
{ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (MinResetValue), "Minimum Reset Value"},
{ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (MinResetValue), "Minimum Polling Interval"},
{ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (MinPollInterval), "Minimum Polling Interval"},
{ACPI_DMT_UINT16, ACPI_ASF0_OFFSET (SystemId), "System ID"},
{ACPI_DMT_UINT32, ACPI_ASF0_OFFSET (SystemId), "Manufacturer ID"},
{ACPI_DMT_UINT32, ACPI_ASF0_OFFSET (MfgId), "Manufacturer ID"},
{ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Flags), "Flags"},
{ACPI_DMT_UINT24, ACPI_ASF0_OFFSET (Reserved2[0]), "Reserved"},
{ACPI_DMT_EXIT, 0, NULL}
@@ -544,8 +597,8 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoCpep[] =
ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[] =
{
{ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Type), "Subtable Type"},
{ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Length), "Length"},
{ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Header.Type), "Subtable Type"},
{ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Header.Length), "Length"},
{ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Id), "Processor ID"},
{ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Eid), "Processor EID"},
{ACPI_DMT_UINT32, ACPI_CPEP0_OFFSET (Interval), "Polling Interval"},
@@ -636,6 +689,16 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDmar2[] =
{ACPI_DMT_EXIT, 0, NULL}
};
/* 3: Remapping Hardware Static Affinity Structure */
ACPI_DMTABLE_INFO AcpiDmTableInfoDmar3[] =
{
{ACPI_DMT_UINT32, ACPI_DMAR3_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_UINT64, ACPI_DMAR3_OFFSET (BaseAddress), "Base Address"},
{ACPI_DMT_UINT32, ACPI_DMAR3_OFFSET (ProximityDomain), "Proximity Domain"},
{ACPI_DMT_EXIT, 0, NULL}
};
/*******************************************************************************
*
@@ -663,7 +726,8 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[] =
ACPI_DMTABLE_INFO AcpiDmTableInfoEinj[] =
{
{ACPI_DMT_UINT32, ACPI_EINJ_OFFSET (HeaderLength), "Injection Header Length"},
{ACPI_DMT_UINT32, ACPI_EINJ_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_UINT8, ACPI_EINJ_OFFSET (Flags), "Flags"},
{ACPI_DMT_UINT24, ACPI_EINJ_OFFSET (Reserved[0]), "Reserved"},
{ACPI_DMT_UINT32, ACPI_EINJ_OFFSET (Entries), "Injection Entry Count"},
{ACPI_DMT_EXIT, 0, NULL}
};
@@ -708,23 +772,126 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHest[] =
{ACPI_DMT_EXIT, 0, NULL}
};
/* Common HEST structures for subtables */
#define ACPI_DM_HEST_HEADER \
{ACPI_DMT_HEST, ACPI_HEST0_OFFSET (Header.Type), "Subtable Type"}, \
{ACPI_DMT_UINT16, ACPI_HEST0_OFFSET (Header.SourceId), "Source Id"}
#define ACPI_DM_HEST_AER \
{ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Reserved1), "Reserved"}, \
{ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Flags), "Flags"}, \
{ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Enabled), "Enabled"}, \
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.RecordsToPreallocate), "Records To Preallocate"}, \
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.MaxSectionsPerRecord), "Max Sections Per Record"}, \
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.Bus), "Bus"}, \
{ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Device), "Device"}, \
{ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Function), "Function"}, \
{ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.DeviceControl), "DeviceControl"}, \
{ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Reserved2), "Reserved"}, \
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableMask), "Uncorrectable Mask"}, \
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableSeverity), "Uncorrectable Severity"}, \
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.CorrectableMask), "Correctable Mask"}, \
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.AdvancedCapabilities), "Advanced Capabilities"}
/* HEST Subtables */
/* 0: IA32 Machine Check Exception */
ACPI_DMTABLE_INFO AcpiDmTableInfoHest0[] =
{
ACPI_DM_HEST_HEADER,
{ACPI_DMT_UINT16, ACPI_HEST0_OFFSET (Reserved1), "Reserved"},
{ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (Flags), "Flags"},
{ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (Enabled), "Enabled"},
{ACPI_DMT_UINT32, ACPI_HEST0_OFFSET (RecordsToPreallocate), "Records To Preallocate"},
{ACPI_DMT_UINT32, ACPI_HEST0_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record"},
{ACPI_DMT_UINT64, ACPI_HEST0_OFFSET (GlobalCapabilityData), "Global Capability Data"},
{ACPI_DMT_UINT64, ACPI_HEST0_OFFSET (GlobalControlData), "Global Control Data"},
{ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (NumHardwareBanks), "Num Hardware Banks"},
{ACPI_DMT_UINT56, ACPI_HEST0_OFFSET (Reserved3[0]), "Reserved"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* 1: IA32 Corrected Machine Check */
ACPI_DMTABLE_INFO AcpiDmTableInfoHest1[] =
{
ACPI_DM_HEST_HEADER,
{ACPI_DMT_UINT16, ACPI_HEST1_OFFSET (Reserved1), "Reserved"},
{ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (Flags), "Flags"},
{ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (Enabled), "Enabled"},
{ACPI_DMT_UINT32, ACPI_HEST1_OFFSET (RecordsToPreallocate), "Records To Preallocate"},
{ACPI_DMT_UINT32, ACPI_HEST1_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record"},
{ACPI_DMT_HESTNTFY, ACPI_HEST1_OFFSET (Notify), "Notify"},
{ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (NumHardwareBanks), "Num Hardware Banks"},
{ACPI_DMT_UINT24, ACPI_HEST1_OFFSET (Reserved2[0]), "Reserved"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* 2: IA32 Non-Maskable Interrupt */
ACPI_DMTABLE_INFO AcpiDmTableInfoHest2[] =
{
ACPI_DM_HEST_HEADER,
{ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (RecordsToPreallocate), "Records To Preallocate"},
{ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record"},
{ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (MaxRawDataLength), "Max Raw Data Length"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* 6: PCI Express Root Port AER */
ACPI_DMTABLE_INFO AcpiDmTableInfoHest6[] =
{
ACPI_DM_HEST_HEADER,
ACPI_DM_HEST_AER,
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (RootErrorCommand), "Root Error Command"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* 7: PCI Express AER (AER Endpoint) */
ACPI_DMTABLE_INFO AcpiDmTableInfoHest7[] =
{
ACPI_DM_HEST_HEADER,
ACPI_DM_HEST_AER,
{ACPI_DMT_EXIT, 0, NULL}
};
/* 8: PCI Express/PCI-X Bridge AER */
ACPI_DMTABLE_INFO AcpiDmTableInfoHest8[] =
{
ACPI_DM_HEST_HEADER,
ACPI_DM_HEST_AER,
{ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (UncorrectableMask2), "2nd Uncorrectable Mask"},
{ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (UncorrectableSeverity2), "2nd Uncorrectable Severity"},
{ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (AdvancedCapabilities2), "2nd Advanced Capabilities"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* 9: Generic Hardware Error Source */
ACPI_DMTABLE_INFO AcpiDmTableInfoHest9[] =
{
{ACPI_DMT_HEST, ACPI_HEST9_OFFSET (Header.Type), "Subtable Type"},
{ACPI_DMT_UINT16, ACPI_HEST9_OFFSET (SourceId), "Source Id"},
ACPI_DM_HEST_HEADER,
{ACPI_DMT_UINT16, ACPI_HEST9_OFFSET (RelatedSourceId), "Related Source Id"},
{ACPI_DMT_UINT8, ACPI_HEST9_OFFSET (ConfigWriteEnable), "Configuration Write Enable"},
{ACPI_DMT_UINT8, ACPI_HEST9_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_UINT8, ACPI_HEST9_OFFSET (Enabled), "Enabled"},
{ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (RecordsToPreAllocate), "Records To Preallocate"},
{ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (RecordsToPreallocate), "Records To Preallocate"},
{ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record"},
{ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (MaxRawDataLength), "Max Raw Data Length"},
{ACPI_DMT_GAS, ACPI_HEST9_OFFSET (ErrorStatusAddress), "Error Status Address"},
{ACPI_DMT_HESTNTFY, ACPI_HEST9_OFFSET (Notify), "Notify"},
{ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (ErrorStatusBlockLength), "Error Status Block Length"},
{ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (ErrorBlockLength), "Error Status Block Length"},
{ACPI_DMT_EXIT, 0, NULL}
};
ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[10] =
ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[] =
{
{ACPI_DMT_HESTNTYP, ACPI_HESTN_OFFSET (Type), "Notify Type"},
{ACPI_DMT_UINT8, ACPI_HESTN_OFFSET (Length), "Notify Length"},
@@ -739,6 +906,25 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[10] =
};
/*
* IA32 Error Bank(s) - Follows the ACPI_HEST_IA_MACHINE_CHECK and
* ACPI_HEST_IA_CORRECTED structures.
*/
ACPI_DMTABLE_INFO AcpiDmTableInfoHestBank[] =
{
{ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (BankNumber), "Bank Number"},
{ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (ClearStatusOnInit), "Clear Status On Init"},
{ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (StatusFormat), "Status Format"},
{ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (ControlRegister), "Control Register"},
{ACPI_DMT_UINT64, ACPI_HESTB_OFFSET (ControlData), "Control Data"},
{ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (StatusRegister), "Status Register"},
{ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (AddressRegister), "Address Register"},
{ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (MiscRegister), "Misc Register"},
{ACPI_DMT_EXIT, 0, NULL}
};
/*******************************************************************************
*
* HPET - High Precision Event Timer table
@@ -752,9 +938,104 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[] =
{ACPI_DMT_UINT8, ACPI_HPET_OFFSET (Sequence), "Sequence Number"},
{ACPI_DMT_UINT16, ACPI_HPET_OFFSET (MinimumTick), "Minimum Clock Ticks"},
{ACPI_DMT_UINT8, ACPI_HPET_OFFSET (Flags), "Flags (decoded below)"},
{ACPI_DMT_FLAG0, ACPI_HPET_FLAG_OFFSET (Flags,0), "Page Protect"},
{ACPI_DMT_FLAG1, ACPI_HPET_FLAG_OFFSET (Flags,0), "4K Page Protect"},
{ACPI_DMT_FLAG2, ACPI_HPET_FLAG_OFFSET (Flags,0), "64K Page Protect"},
{ACPI_DMT_FLAG0, ACPI_HPET_FLAG_OFFSET (Flags,0), "4K Page Protect"},
{ACPI_DMT_FLAG1, ACPI_HPET_FLAG_OFFSET (Flags,0), "64K Page Protect"},
{ACPI_DMT_EXIT, 0, NULL}
};
/*******************************************************************************
*
* IVRS - I/O Virtualization Reporting Structure
*
******************************************************************************/
ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs[] =
{
{ACPI_DMT_UINT32, ACPI_IVRS_OFFSET (Info), "Virtualization Info"},
{ACPI_DMT_UINT64, ACPI_IVRS_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* Common Subtable header (one per Subtable) */
ACPI_DMTABLE_INFO AcpiDmTableInfoIvrsHdr[] =
{
{ACPI_DMT_IVRS, ACPI_IVRSH_OFFSET (Type), "Subtable Type"},
{ACPI_DMT_UINT8, ACPI_IVRSH_OFFSET (Flags), "Flags"},
{ACPI_DMT_UINT16, ACPI_IVRSH_OFFSET (Length), "Length"},
{ACPI_DMT_UINT16, ACPI_IVRSH_OFFSET (DeviceId), "DeviceId"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* IVRS subtables */
/* 0x10: I/O Virtualization Hardware Definition (IVHD) Block */
ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs0[] =
{
{ACPI_DMT_UINT16, ACPI_IVRS0_OFFSET (CapabilityOffset), "Capability Offset"},
{ACPI_DMT_UINT64, ACPI_IVRS0_OFFSET (BaseAddress), "Base Address"},
{ACPI_DMT_UINT16, ACPI_IVRS0_OFFSET (PciSegmentGroup), "PCI Segment Group"},
{ACPI_DMT_UINT16, ACPI_IVRS0_OFFSET (Info), "Virtualization Info"},
{ACPI_DMT_UINT32, ACPI_IVRS0_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* 0x20, 0x21, 0x22: I/O Virtualization Memory Definition (IVMD) Block */
ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs1[] =
{
{ACPI_DMT_UINT16, ACPI_IVRS1_OFFSET (AuxData), "Auxiliary Data"},
{ACPI_DMT_UINT64, ACPI_IVRS1_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_UINT64, ACPI_IVRS1_OFFSET (StartAddress), "Start Address"},
{ACPI_DMT_UINT64, ACPI_IVRS1_OFFSET (MemoryLength), "Memory Length"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* Device entry header for IVHD block */
#define ACPI_DMT_IVRS_DE_HEADER \
{ACPI_DMT_UINT8, ACPI_IVRSD_OFFSET (Type), "Entry Type"}, \
{ACPI_DMT_UINT16, ACPI_IVRSD_OFFSET (Id), "Device ID"}, \
{ACPI_DMT_UINT8, ACPI_IVRSD_OFFSET (DataSetting), "Data Setting"}
/* 4-byte device entry */
ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs4[] =
{
ACPI_DMT_IVRS_DE_HEADER,
{ACPI_DMT_EXIT, 0, NULL}
};
/* 8-byte device entry */
ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8a[] =
{
ACPI_DMT_IVRS_DE_HEADER,
{ACPI_DMT_UINT8, ACPI_IVRS8A_OFFSET (Reserved1), "Reserved"},
{ACPI_DMT_UINT16, ACPI_IVRS8A_OFFSET (UsedId), "Source Used Device ID"},
{ACPI_DMT_UINT8, ACPI_IVRS8A_OFFSET (Reserved2), "Reserved"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* 8-byte device entry */
ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8b[] =
{
ACPI_DMT_IVRS_DE_HEADER,
{ACPI_DMT_UINT32, ACPI_IVRS8B_OFFSET (ExtendedData), "Extended Data"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* 8-byte device entry */
ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8c[] =
{
ACPI_DMT_IVRS_DE_HEADER,
{ACPI_DMT_UINT8, ACPI_IVRS8C_OFFSET (Handle), "Handle"},
{ACPI_DMT_UINT16, ACPI_IVRS8C_OFFSET (UsedId), "Source Used Device ID"},
{ACPI_DMT_UINT8, ACPI_IVRS8C_OFFSET (Variety), "Variety"},
{ACPI_DMT_EXIT, 0, NULL}
};
@@ -894,6 +1175,31 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt8[] =
{ACPI_DMT_EXIT, 0, NULL}
};
/* 9: Processor Local X2_APIC (ACPI 4.0) */
ACPI_DMTABLE_INFO AcpiDmTableInfoMadt9[] =
{
{ACPI_DMT_UINT16, ACPI_MADT9_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_UINT32, ACPI_MADT9_OFFSET (LocalApicId), "Processor x2Apic ID"},
{ACPI_DMT_UINT32, ACPI_MADT9_OFFSET (LapicFlags), "Flags (decoded below)"},
{ACPI_DMT_FLAG0, ACPI_MADT9_FLAG_OFFSET (LapicFlags,0), "Processor Enabled"},
{ACPI_DMT_UINT32, ACPI_MADT9_OFFSET (Uid), "Processor UID"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* 10: Local X2_APIC NMI (ACPI 4.0) */
ACPI_DMTABLE_INFO AcpiDmTableInfoMadt10[] =
{
{ACPI_DMT_UINT16, ACPI_MADT10_OFFSET (IntiFlags), "Flags (decoded below)"},
{ACPI_DMT_FLAGS0, ACPI_MADT10_FLAG_OFFSET (IntiFlags,0), "Polarity"},
{ACPI_DMT_FLAGS2, ACPI_MADT10_FLAG_OFFSET (IntiFlags,0), "Trigger Mode"},
{ACPI_DMT_UINT32, ACPI_MADT10_OFFSET (Uid), "Processor UID"},
{ACPI_DMT_UINT8, ACPI_MADT10_OFFSET (Lint), "Interrupt Input LINT"},
{ACPI_DMT_UINT24, ACPI_MADT10_OFFSET (Reserved[0]), "Reserved"},
{ACPI_DMT_EXIT, 0, NULL}
};
/*******************************************************************************
*
@@ -918,6 +1224,35 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[] =
};
/*******************************************************************************
*
* MSCT - Maximum System Characteristics Table (ACPI 4.0)
*
******************************************************************************/
ACPI_DMTABLE_INFO AcpiDmTableInfoMsct[] =
{
{ACPI_DMT_UINT32, ACPI_MSCT_OFFSET (ProximityOffset), "Proximity Offset"},
{ACPI_DMT_UINT32, ACPI_MSCT_OFFSET (MaxProximityDomains), "Max Proximity Domains"},
{ACPI_DMT_UINT32, ACPI_MSCT_OFFSET (MaxClockDomains), "Max Clock Domains"},
{ACPI_DMT_UINT64, ACPI_MSCT_OFFSET (MaxAddress), "Max Physical Address"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* Subtable - Maximum Proximity Domain Information. Version 1 */
ACPI_DMTABLE_INFO AcpiDmTableInfoMsct0[] =
{
{ACPI_DMT_UINT8, ACPI_MSCT0_OFFSET (Revision), "Revision"},
{ACPI_DMT_UINT8, ACPI_MSCT0_OFFSET (Length), "Length"},
{ACPI_DMT_UINT32, ACPI_MSCT0_OFFSET (RangeStart), "Domain Range Start"},
{ACPI_DMT_UINT32, ACPI_MSCT0_OFFSET (RangeEnd), "Domain Range End"},
{ACPI_DMT_UINT32, ACPI_MSCT0_OFFSET (ProcessorCapacity), "Processor Capacity"},
{ACPI_DMT_UINT64, ACPI_MSCT0_OFFSET (MemoryCapacity), "Memory Capacity"},
{ACPI_DMT_EXIT, 0, NULL}
};
/*******************************************************************************
*
* SBST - Smart Battery Specification Table
@@ -998,8 +1333,8 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSpcr[] =
ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[] =
{
{ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (InterfaceType), "Interface Type"},
{ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_UINT16, ACPI_SPMI_OFFSET (SpecRevision), "IPMI Spec Version"},
{ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (InterruptType), "Interrupt Type"},
{ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (GpeNumber), "GPE Number"},
@@ -1011,6 +1346,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[] =
{ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciBus), "PCI Bus"},
{ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciDevice), "PCI Device"},
{ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciFunction), "PCI Function"},
{ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved2), "Reserved"},
{ACPI_DMT_EXIT, 0, NULL}
};
@@ -1028,10 +1364,21 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat[] =
{ACPI_DMT_EXIT, 0, NULL}
};
/* Common Subtable header (one per Subtable) */
ACPI_DMTABLE_INFO AcpiDmTableInfoSratHdr[] =
{
{ACPI_DMT_SRAT, ACPI_SRATH_OFFSET (Type), "Subtable Type"},
{ACPI_DMT_UINT8, ACPI_SRATH_OFFSET (Length), "Length"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* SRAT Subtables */
/* 0: Processor Local APIC/SAPIC Affinity */
ACPI_DMTABLE_INFO AcpiDmTableInfoSrat0[] =
{
{ACPI_DMT_SRAT, ACPI_SRAT0_OFFSET (Header.Type), "Subtable Type"},
{ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (Header.Length), "Length"},
{ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (ProximityDomainLo), "Proximity Domain Low(8)"},
{ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (ApicId), "Apic ID"},
{ACPI_DMT_UINT32, ACPI_SRAT0_OFFSET (Flags), "Flags (decoded below)"},
@@ -1042,19 +1389,34 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat0[] =
{ACPI_DMT_EXIT, 0, NULL}
};
/* 1: Memory Affinity */
ACPI_DMTABLE_INFO AcpiDmTableInfoSrat1[] =
{
{ACPI_DMT_SRAT, ACPI_SRAT1_OFFSET (Header.Type), "Subtable Type"},
{ACPI_DMT_UINT8, ACPI_SRAT1_OFFSET (Header.Length), "Length"},
{ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (ProximityDomain), "Proximity Domain"},
{ACPI_DMT_UINT16, ACPI_SRAT1_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (BaseAddress), "Base Address"},
{ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Length), "Address Length"},
{ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (Reserved1), "Reserved"},
{ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (Flags), "Flags (decoded below)"},
{ACPI_DMT_FLAG0, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Enabled"},
{ACPI_DMT_FLAG1, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Hot Pluggable"},
{ACPI_DMT_FLAG2, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Non-Volatile"},
{ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Reserved1), "Reserved"},
{ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Reserved2), "Reserved"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* 2: Processor Local X2_APIC Affinity (ACPI 4.0) */
ACPI_DMTABLE_INFO AcpiDmTableInfoSrat2[] =
{
{ACPI_DMT_UINT16, ACPI_SRAT2_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ProximityDomain), "Proximity Domain"},
{ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ApicId), "Apic ID"},
{ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (Flags), "Flags (decoded below)"},
{ACPI_DMT_FLAG0, ACPI_SRAT2_FLAG_OFFSET (Flags,0), "Enabled"},
{ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ClockDomain), "Clock Domain"},
{ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (Reserved2), "Reserved"},
{ACPI_DMT_EXIT, 0, NULL}
};
@@ -1074,6 +1436,74 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[] =
};
/*******************************************************************************
*
* UEFI - UEFI Boot optimization Table
*
******************************************************************************/
ACPI_DMTABLE_INFO AcpiDmTableInfoUefi[] =
{
{ACPI_DMT_BUF16, ACPI_UEFI_OFFSET (Identifier[0]), "UUID Identifier"},
{ACPI_DMT_UINT16, ACPI_UEFI_OFFSET (DataOffset), "Data Offset"},
{ACPI_DMT_EXIT, 0, NULL}
};
/*******************************************************************************
*
* WAET - Windows ACPI Emulated devices Table
*
******************************************************************************/
ACPI_DMTABLE_INFO AcpiDmTableInfoWaet[] =
{
{ACPI_DMT_UINT32, ACPI_WAET_OFFSET (Flags), "Flags (decoded below)"},
{ACPI_DMT_FLAG0, ACPI_WAET_OFFSET (Flags), "RTC needs no INT ack"},
{ACPI_DMT_FLAG1, ACPI_WAET_OFFSET (Flags), "PM timer, one read only"},
{ACPI_DMT_EXIT, 0, NULL}
};
/*******************************************************************************
*
* WDAT - Watchdog Action Table
*
******************************************************************************/
ACPI_DMTABLE_INFO AcpiDmTableInfoWdat[] =
{
{ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (HeaderLength), "Header Length"},
{ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (PciSegment), "PCI Segment"},
{ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (PciBus), "PCI Bus"},
{ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (PciDevice), "PCI Device"},
{ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (PciFunction), "PCI Function"},
{ACPI_DMT_UINT24, ACPI_WDAT_OFFSET (Reserved[0]), "Reserved"},
{ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (TimerPeriod), "Timer Period"},
{ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (MaxCount), "Max Count"},
{ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (MinCount), "Min Count"},
{ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (Flags), "Flags (decoded below)"},
{ACPI_DMT_FLAG0, ACPI_WDAT_OFFSET (Flags), "Enabled"},
{ACPI_DMT_FLAG7, ACPI_WDAT_OFFSET (Flags), "Stopped When Asleep"},
{ACPI_DMT_UINT24, ACPI_WDAT_OFFSET (Reserved2[0]), "Reserved"},
{ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (Entries), "Watchdog Entry Count"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* WDAT Subtables - Watchdog Instruction Entries */
ACPI_DMTABLE_INFO AcpiDmTableInfoWdat0[] =
{
{ACPI_DMT_UINT8, ACPI_WDAT0_OFFSET (Action), "Watchdog Action"},
{ACPI_DMT_UINT8, ACPI_WDAT0_OFFSET (Instruction), "Instruction"},
{ACPI_DMT_UINT16, ACPI_WDAT0_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_GAS, ACPI_WDAT0_OFFSET (RegisterRegion), "Register Region"},
{ACPI_DMT_UINT32, ACPI_WDAT0_OFFSET (Value), "Value"},
{ACPI_DMT_UINT32, ACPI_WDAT0_OFFSET (Mask), "Register Mask"},
{ACPI_DMT_EXIT, 0, NULL}
};
/*******************************************************************************
*
* WDRT - Watchdog Resource Table
@@ -1082,19 +1512,16 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[] =
ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[] =
{
{ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (HeaderLength), "Header Length"},
{ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciSegment), "PCI Segment"},
{ACPI_DMT_GAS, ACPI_WDRT_OFFSET (ControlRegister), "Control Register"},
{ACPI_DMT_GAS, ACPI_WDRT_OFFSET (CountRegister), "Count Register"},
{ACPI_DMT_UINT16, ACPI_WDRT_OFFSET (PciDeviceId), "PCI Device ID"},
{ACPI_DMT_UINT16, ACPI_WDRT_OFFSET (PciVendorId), "PCI Vendor ID"},
{ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciBus), "PCI Bus"},
{ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciDevice), "PCI Device"},
{ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciFunction), "PCI Function"},
{ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (TimerPeriod), "Timer Period"},
{ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (MaxCount), "Max Count"},
{ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (MinCount), "Min Count"},
{ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (Flags), "Flags (decoded below)"},
{ACPI_DMT_FLAG0, ACPI_WDRT_OFFSET (Flags), "Enabled"},
{ACPI_DMT_FLAG7, ACPI_WDRT_OFFSET (Flags), "Stopped When Asleep"},
{ACPI_DMT_UINT24, ACPI_WDRT_OFFSET (Reserved[0]), "Reserved"},
{ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (Entries), "Watchdog Entries"},
{ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciSegment), "PCI Segment"},
{ACPI_DMT_UINT16, ACPI_WDRT_OFFSET (MaxCount), "Max Count"},
{ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (Units), "Counter Units"},
{ACPI_DMT_EXIT, 0, NULL}
};
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: getopt
* $Revision: 1.11 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,6 +117,9 @@
#include <stdio.h>
#include <string.h>
#include "acpi.h"
#include "accommon.h"
#include "acapps.h"
#define ERR(szz,czz) if(AcpiGbl_Opterr){fprintf(stderr,"%s%s%c\n",argv[0],szz,czz);}
@@ -14,6 +14,7 @@ SRCS= aslcompilerparse.c aslcompilerlex.c aslanalyze.c aslcodegen.c \
../utilities/utdelete.c \
../utilities/utglobal.c \
../utilities/utinit.c \
../utilities/utlock.c \
../utilities/utobject.c \
../utilities/utmisc.c \
../utilities/utmath.c \
@@ -105,6 +106,8 @@ YFLAGS+= -y -pAslCompiler
#CFLAGS+= -D_USE_BERKELEY_YACC
#.endif
LDLIBS = -lpthread -lrt
aslmain : $(patsubst %.c,%.o, $(SRCS))
$(CC) $(LDFLAGS) $(patsubst %.c,%.o, $(SRCS)) \
$(LOADLIBES) $(LDLIBS) -o iasl
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslanalyze.c - check for semantic errors
* $Revision: 1.118 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,8 +120,6 @@
#include "acparser.h"
#include "amlcode.h"
#include <ctype.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslanalyze")
@@ -179,6 +176,10 @@ static UINT32
AnGetInternalMethodReturnType (
ACPI_PARSE_OBJECT *Op);
BOOLEAN
AnIsResultUsed (
ACPI_PARSE_OBJECT *Op);
/*******************************************************************************
*
@@ -686,7 +687,15 @@ AnCheckForReservedName (
return (ACPI_NOT_RESERVED_NAME);
}
AslError (ASL_ERROR, ASL_MSG_RESERVED_WORD, Op, Op->Asl.ExternalName);
/*
* Was not actually emitted by the compiler. This is a special case,
* however. If the ASL code being compiled was the result of a
* dissasembly, it may possibly contain valid compiler-emitted names
* of the form "_T_x". We don't want to issue an error or even a
* warning and force the user to manually change the names. So, we
* will issue a remark instead.
*/
AslError (ASL_REMARK, ASL_MSG_COMPILER_RESERVED, Op, Op->Asl.ExternalName);
return (ACPI_COMPILER_RESERVED_NAME);
}
@@ -722,6 +731,8 @@ AnCheckForReservedMethod (
ASL_METHOD_INFO *MethodInfo)
{
UINT32 Index;
UINT32 RequiredArgsCurrent;
UINT32 RequiredArgsOld;
/* Check for a match against the reserved name list */
@@ -758,15 +769,23 @@ AnCheckForReservedMethod (
Gbl_ReservedMethods++;
/* Matched a reserved method name */
/*
* Matched a reserved method name
*
* Validate the ASL-defined argument count. Allow two different legal
* arg counts.
*/
RequiredArgsCurrent = ReservedMethods[Index].NumArguments & 0x0F;
RequiredArgsOld = ReservedMethods[Index].NumArguments >> 4;
if (MethodInfo->NumArguments != ReservedMethods[Index].NumArguments)
if ((MethodInfo->NumArguments != RequiredArgsCurrent) &&
(MethodInfo->NumArguments != RequiredArgsOld))
{
sprintf (MsgBuffer, "%s requires %d",
ReservedMethods[Index].Name,
ReservedMethods[Index].NumArguments);
RequiredArgsCurrent);
if (MethodInfo->NumArguments > ReservedMethods[Index].NumArguments)
if (MethodInfo->NumArguments > RequiredArgsCurrent)
{
AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op,
MsgBuffer);
@@ -1014,10 +1033,10 @@ AnMethodAnalysisWalkBegin (
if (!MethodInfo)
{
/*
* Probably was an error in the method declaration,
* no additional error here
* Local was used outside a control method, or there was an error
* in the method declaration.
*/
ACPI_WARNING ((AE_INFO, "%p, No parent method", Op));
AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName);
return (AE_ERROR);
}
@@ -1058,10 +1077,10 @@ AnMethodAnalysisWalkBegin (
if (!MethodInfo)
{
/*
* Probably was an error in the method declaration,
* no additional error here
* Arg was used outside a control method, or there was an error
* in the method declaration.
*/
ACPI_WARNING ((AE_INFO, "%p, No parent method", Op));
AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName);
return (AE_ERROR);
}
@@ -1709,6 +1728,30 @@ AnOperandTypecheckWalkEnd (
RuntimeArgTypes = OpInfo->RuntimeArgs;
OpcodeClass = OpInfo->Class;
#ifdef ASL_ERROR_NAMED_OBJECT_IN_WHILE
/*
* Update 11/2008: In practice, we can't perform this check. A simple
* analysis is not sufficient. Also, it can cause errors when compiling
* disassembled code because of the way Switch operators are implemented
* (a While(One) loop with a named temp variable created within.)
*/
/*
* If we are creating a named object, check if we are within a while loop
* by checking if the parent is a WHILE op. This is a simple analysis, but
* probably sufficient for many cases.
*
* Allow Scope(), Buffer(), and Package().
*/
if (((OpcodeClass == AML_CLASS_NAMED_OBJECT) && (Op->Asl.AmlOpcode != AML_SCOPE_OP)) ||
((OpcodeClass == AML_CLASS_CREATE) && (OpInfo->Flags & AML_NSNODE)))
{
if (Op->Asl.Parent->Asl.AmlOpcode == AML_WHILE_OP)
{
AslError (ASL_ERROR, ASL_MSG_NAMED_OBJECT_IN_WHILE, Op, NULL);
}
}
#endif
/*
* Special case for control opcodes IF/RETURN/WHILE since they
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslcodegen - AML code generation
* $Revision: 1.63 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -235,24 +234,24 @@ CgAmlWriteWalk (
DbgPrint (ASL_TREE_OUTPUT, " ");
}
DbgPrint (ASL_TREE_OUTPUT,
"%08X %04X %04X %01X %04X %04X %04X %04X %08X %08X %08X %08X %08X %04X %02d %02d\n",
/* 1 */ (UINT32) Op->Asl.Value.Integer,
/* 2 */ Op->Asl.ParseOpcode,
/* 3 */ Op->Asl.AmlOpcode,
/* 4 */ Op->Asl.AmlOpcodeLength,
/* 5 */ Op->Asl.AmlPkgLenBytes,
/* 6 */ Op->Asl.AmlLength,
/* 7 */ Op->Asl.AmlSubtreeLength,
/* 8 */ Op->Asl.Parent ? Op->Asl.Parent->Asl.AmlSubtreeLength : 0,
/* 9 */ Op,
/* 10 */ Op->Asl.Child,
/* 11 */ Op->Asl.Parent,
/* 12 */ Op->Asl.CompileFlags,
/* 13 */ Op->Asl.AcpiBtype,
/* 14 */ Op->Asl.FinalAmlLength,
/* 15 */ Op->Asl.Column,
/* 16 */ Op->Asl.LineNumber);
DbgPrint (ASL_TREE_OUTPUT,
"%08X %04X %04X %01X %04X %04X %04X %04X %08X %08X %08X %08X %08X %04X %02d %02d\n",
/* 1 */ (UINT32) Op->Asl.Value.Integer,
/* 2 */ Op->Asl.ParseOpcode,
/* 3 */ Op->Asl.AmlOpcode,
/* 4 */ Op->Asl.AmlOpcodeLength,
/* 5 */ Op->Asl.AmlPkgLenBytes,
/* 6 */ Op->Asl.AmlLength,
/* 7 */ Op->Asl.AmlSubtreeLength,
/* 8 */ Op->Asl.Parent ? Op->Asl.Parent->Asl.AmlSubtreeLength : 0,
/* 9 */ Op,
/* 10 */ Op->Asl.Child,
/* 11 */ Op->Asl.Parent,
/* 12 */ Op->Asl.CompileFlags,
/* 13 */ Op->Asl.AcpiBtype,
/* 14 */ Op->Asl.FinalAmlLength,
/* 15 */ Op->Asl.Column,
/* 16 */ Op->Asl.LineNumber);
/* Generate the AML for this node */
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslcompile - top level compile module
* $Revision: 1.99 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -132,6 +131,16 @@ static ACPI_STATUS
FlCheckForAscii (
ASL_FILE_INFO *FileInfo);
void
FlConsumeAnsiComment (
ASL_FILE_INFO *FileInfo,
ASL_FILE_STATUS *Status);
void
FlConsumeNewComment (
ASL_FILE_INFO *FileInfo,
ASL_FILE_STATUS *Status);
/*******************************************************************************
*
@@ -466,7 +475,7 @@ FlCheckForAscii (
/* Check for an ASCII character */
if (!isascii (Byte))
if (!ACPI_IS_ASCII (Byte))
{
if (BadBytes < 10)
{
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslcompiler.h - common include file for iASL
* $Revision: 1.151 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -140,6 +139,7 @@
#include "acpi.h"
#include "accommon.h"
#include "amlresrc.h"
#include "acdebug.h"
@@ -195,6 +195,10 @@ ACPI_STATUS
AslDoOnePathname (
char *Pathname);
ACPI_STATUS
AslDoOneFile (
char *Filename);
/*
* aslcompile - compile mainline
*/
@@ -551,6 +555,10 @@ void
AslAbort (
void);
void
FlAddIncludeDirectory (
char *Dir);
void
FlOpenIncludeFile (
ACPI_PARSE_OBJECT *Op);
@@ -3,7 +3,6 @@
/******************************************************************************
*
* Module Name: aslcompiler.l - Flex input file
* $Revision: 1.80 $
*
*****************************************************************************/
@@ -11,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -169,7 +168,8 @@ NamePathTail [.]{NameSeg}
%%
[ ] { count (0); }
[\n] { count (0); }
[\n] { count (0); } /* Handle files with both LF and CR/LF */
[\r] { count (0); } /* termination on both Unix and Windows */
[ \t] { count (0); }
@@ -386,6 +386,7 @@ NamePathTail [.]{NameSeg}
"SMBus" { count (0); return (PARSEOP_REGIONSPACE_SMBUS); }
"SystemCMOS" { count (0); return (PARSEOP_REGIONSPACE_CMOS); }
"PciBarTarget" { count (0); return (PARSEOP_REGIONSPACE_PCIBAR); }
"IPMI" { count (0); return (PARSEOP_REGIONSPACE_IPMI); }
"FFixedHW" { count (0); return (PARSEOP_ADDRESSSPACE_FFIXEDHW); }
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: asldefine.h - Common defines for the iASL compiler
* $Revision: 1.9 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -128,8 +127,8 @@
#define IntelAcpiCA "Intel ACPI Component Architecture"
#define CompilerId "ASL Optimizing Compiler"
#define DisassemblerId "AML Disassembler"
#define CompilerCopyright "Copyright (C) 2000 - 2008 Intel Corporation"
#define CompilerCompliance "Supports ACPI Specification Revision 3.0a"
#define CompilerCopyright "Copyright (C) 2000 - 2009 Intel Corporation"
#define CompilerCompliance "Supports ACPI Specification Revision 4.0"
#define CompilerName "iasl"
#define CompilerCreatorId "INTL"
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslerror - Error handling and statistics
* $Revision: 1.95 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -248,6 +247,11 @@ AePrintException (
FILE *SourceFile;
if (Gbl_NoErrors)
{
return;
}
/*
* Only listing files have a header, and remarks/optimizations
* are always output
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslfiles - file I/O suppoert
* $Revision: 1.56 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -129,10 +128,11 @@ FlOpenFile (
char *Filename,
char *Mode);
static FILE *
FlOpenLocalFile (
char *LocalName,
char *Mode);
FILE *
FlOpenIncludeWithPrefix (
char *PrefixDir,
char *Filename);
#ifdef ACPI_OBSOLETE_FUNCTIONS
ACPI_STATUS
@@ -171,34 +171,6 @@ AslAbort (
}
/*******************************************************************************
*
* FUNCTION: FlOpenLocalFile
*
* PARAMETERS: LocalName - Single filename (not a pathname)
* Mode - Open mode for fopen
*
* RETURN: File descriptor
*
* DESCRIPTION: Build a complete pathname for the input filename and open
* the file.
*
******************************************************************************/
static FILE *
FlOpenLocalFile (
char *LocalName,
char *Mode)
{
strcpy (StringBuffer, Gbl_DirectoryPath);
strcat (StringBuffer, LocalName);
DbgPrint (ASL_PARSE_OUTPUT, "FlOpenLocalFile: %s\n", StringBuffer);
return (fopen (StringBuffer, (const char *) Mode));
}
/*******************************************************************************
*
* FUNCTION: FlFileError
@@ -469,6 +441,122 @@ FlSetLineNumber (
}
/*******************************************************************************
*
* FUNCTION: FlAddIncludeDirectory
*
* PARAMETERS: Dir - Directory pathname string
*
* RETURN: None
*
* DESCRIPTION: Add a directory the list of include prefix directories.
*
******************************************************************************/
void
FlAddIncludeDirectory (
char *Dir)
{
ASL_INCLUDE_DIR *NewDir;
ASL_INCLUDE_DIR *NextDir;
ASL_INCLUDE_DIR *PrevDir = NULL;
UINT32 NeedsSeparator = 0;
size_t DirLength;
DirLength = strlen (Dir);
if (!DirLength)
{
return;
}
/* Make sure that the pathname ends with a path separator */
if ((Dir[DirLength-1] != '/') &&
(Dir[DirLength-1] != '\\'))
{
NeedsSeparator = 1;
}
NewDir = ACPI_ALLOCATE_ZEROED (sizeof (ASL_INCLUDE_DIR));
NewDir->Dir = ACPI_ALLOCATE (DirLength + 1 + NeedsSeparator);
strcpy (NewDir->Dir, Dir);
if (NeedsSeparator)
{
strcat (NewDir->Dir, "/");
}
/*
* Preserve command line ordering of -I options by adding new elements
* at the end of the list
*/
NextDir = Gbl_IncludeDirList;
while (NextDir)
{
PrevDir = NextDir;
NextDir = NextDir->Next;
}
if (PrevDir)
{
PrevDir->Next = NewDir;
}
else
{
Gbl_IncludeDirList = NewDir;
}
}
/*******************************************************************************
*
* FUNCTION: FlOpenIncludeWithPrefix
*
* PARAMETERS: PrefixDir - Prefix directory pathname. Can be a zero
* length string.
* Filename - The include filename from the source ASL.
*
* RETURN: Valid file descriptor if successful. Null otherwise.
*
* DESCRIPTION: Open an include file and push it on the input file stack.
*
******************************************************************************/
FILE *
FlOpenIncludeWithPrefix (
char *PrefixDir,
char *Filename)
{
FILE *IncludeFile;
char *Pathname;
/* Build the full pathname to the file */
Pathname = ACPI_ALLOCATE (strlen (PrefixDir) + strlen (Filename) + 1);
strcpy (Pathname, PrefixDir);
strcat (Pathname, Filename);
DbgPrint (ASL_PARSE_OUTPUT, "\nAttempt to open include file: path %s\n\n",
Pathname);
/* Attempt to open the file, push if successful */
IncludeFile = fopen (Pathname, "r");
if (IncludeFile)
{
/* Push the include file on the open input file stack */
AslPushInputFileStack (IncludeFile, Pathname);
return (IncludeFile);
}
ACPI_FREE (Pathname);
return (NULL);
}
/*******************************************************************************
*
* FUNCTION: FlOpenIncludeFile
@@ -485,7 +573,8 @@ void
FlOpenIncludeFile (
ACPI_PARSE_OBJECT *Op)
{
FILE *IncFile;
FILE *IncludeFile;
ASL_INCLUDE_DIR *NextDir;
/* Op must be valid */
@@ -508,21 +597,58 @@ FlOpenIncludeFile (
FlPrintFile (ASL_FILE_SOURCE_OUTPUT, "\n");
Gbl_CurrentLineOffset++;
/* Prepend the directory pathname and open the include file */
DbgPrint (ASL_PARSE_OUTPUT, "\nOpen include file: path %s\n\n",
Op->Asl.Value.String);
IncFile = FlOpenLocalFile (Op->Asl.Value.String, "r");
if (!IncFile)
/* Attempt to open the include file */
/* If the file specifies an absolute path, just open it */
if ((Op->Asl.Value.String[0] == '/') ||
(Op->Asl.Value.String[0] == '\\') ||
(Op->Asl.Value.String[1] == ':'))
{
sprintf (MsgBuffer, "%s (%s)", Op->Asl.Value.String, strerror (errno));
AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, Op, MsgBuffer);
IncludeFile = FlOpenIncludeWithPrefix ("", Op->Asl.Value.String);
if (!IncludeFile)
{
goto ErrorExit;
}
return;
}
/* Push the include file on the open input file stack */
/*
* The include filename is not an absolute path.
*
* First, search for the file within the "local" directory -- meaning
* the same directory that contains the source file.
*
* Construct the file pathname from the global directory name.
*/
IncludeFile = FlOpenIncludeWithPrefix (Gbl_DirectoryPath, Op->Asl.Value.String);
if (IncludeFile)
{
return;
}
AslPushInputFileStack (IncFile, Op->Asl.Value.String);
/*
* Second, search for the file within the (possibly multiple) directories
* specified by the -I option on the command line.
*/
NextDir = Gbl_IncludeDirList;
while (NextDir)
{
IncludeFile = FlOpenIncludeWithPrefix (NextDir->Dir, Op->Asl.Value.String);
if (IncludeFile)
{
return;
}
NextDir = NextDir->Next;
}
/* We could not open the include file after trying very hard */
ErrorExit:
sprintf (MsgBuffer, "%s, %s", Op->Asl.Value.String, strerror (errno));
AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, Op, MsgBuffer);
}
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslfold - Constant folding
* $Revision: 1.21 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -481,7 +480,7 @@ OpcAmlConstantWalk (
* Because we know we executed type 3/4/5 opcodes above, we know that
* the result must be either an Integer, String, or Buffer.
*/
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
@@ -3,7 +3,6 @@
/******************************************************************************
*
* Module Name: aslglobal.h - Global variable definitions
* $Revision: 1.58 $
*
*****************************************************************************/
@@ -11,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -149,7 +148,7 @@ extern char HexLookup[];
#define ASL_LINE_BUFFER_SIZE 512
#define ASL_MSG_BUFFER_SIZE 4096
#define HEX_TABLE_LINE_SIZE 8
#define HEX_LISTING_LINE_SIZE 16
#define HEX_LISTING_LINE_SIZE 8
/* Source code buffers and pointers for error reporting */
@@ -189,6 +188,7 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ParseOnlyFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileTimesFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_FoldConstants, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseErrors, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoErrors, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisasmFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_GetAllTables, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IntegerOptimizationFlag, TRUE);
@@ -212,6 +212,7 @@ ASL_EXTERN char *Gbl_DirectoryPath;
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_ExternalFilename, NULL);
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_IncludeFilename, NULL);
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_OutputFilenamePrefix, NULL);
ASL_EXTERN ASL_INCLUDE_DIR ASL_INIT_GLOBAL (*Gbl_IncludeDirList, NULL);
ASL_EXTERN char *Gbl_CurrentInputFilename;
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HasIncludeFiles, FALSE);
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: asllength - Tree walk to determine package and opcode lengths
* $Revision: 1.38 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: asllisting - Listing file generation
* $Revision: 1.64 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -199,6 +198,12 @@ static void
LsDoHexOutputAsm (
void);
ACPI_STATUS
LsTreeWriteWalk (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
/*******************************************************************************
*
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
* $Revision: 1.79 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -145,7 +144,13 @@ LdNamespace1Begin (
void *Context);
static ACPI_STATUS
LdNamespace1End (
LdNamespace2Begin (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
static ACPI_STATUS
LdCommonNamespaceEnd (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
@@ -160,7 +165,7 @@ LdNamespace1End (
* RETURN: Status
*
* DESCRIPTION: Perform a walk of the parse tree that in turn loads all of the
* named ASL/AML objects into the namespace. The namespace is
* named ASL/AML objects into the namespace. The namespace is
* constructed in order to resolve named references and references
* to named fields within resource templates/descriptors.
*
@@ -183,10 +188,15 @@ LdLoadNamespace (
return AE_NO_MEMORY;
}
/* Perform the walk of the parse tree */
/* Walk the entire parse tree, first pass */
TrWalkParseTree (RootOp, ASL_WALK_VISIT_TWICE, LdNamespace1Begin,
LdNamespace1End, WalkState);
LdCommonNamespaceEnd, WalkState);
/* Second pass to handle forward references */
TrWalkParseTree (RootOp, ASL_WALK_VISIT_TWICE, LdNamespace2Begin,
LdCommonNamespaceEnd, WalkState);
/* Dump the namespace if debug is enabled */
@@ -304,7 +314,7 @@ LdLoadFieldElements (
* DESCRIPTION: Enter the named elements of the resource descriptor (children
* of the parent) into the namespace.
*
* NOTE: In the real AML namespace, these named elements never exist. But
* NOTE: In the real AML namespace, these named elements never exist. But
* we simply use the namespace here as a symbol table so we can look
* them up as they are referenced.
*
@@ -343,6 +353,7 @@ LdLoadResourceElements (
Node->Value = (UINT32) Op->Asl.Value.Integer;
Node->Op = Op;
Op->Asl.Node = Node;
/*
* Now enter the predefined fields, for easy lookup when referenced
@@ -395,7 +406,7 @@ LdLoadResourceElements (
*
* RETURN: Status
*
* DESCRIPTION: Descending callback used during the parse tree walk. If this
* DESCRIPTION: Descending callback used during the parse tree walk. If this
* is a named AML opcode, enter into the namespace
*
******************************************************************************/
@@ -536,7 +547,7 @@ LdNamespace1Begin (
* The name referenced by Scope(Name) must already exist at this point.
* In other words, forward references for Scope() are not supported.
* The only real reason for this is that the MS interpreter cannot
* handle this case. Perhaps someday this case can go away.
* handle this case. Perhaps someday this case can go away.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
@@ -621,7 +632,7 @@ LdNamespace1Begin (
/*
* However, switch the type to be an actual scope so
* that compilation can continue without generating a whole
* cascade of additional errors. Open the new scope.
* cascade of additional errors. Open the new scope.
*/
Node->Type = ACPI_TYPE_LOCAL_SCOPE;
Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE,
@@ -652,8 +663,8 @@ LdNamespace1Begin (
Flags |= ACPI_NS_ERROR_IF_FOUND;
/*
* Enter the named type into the internal namespace. We enter the name
* as we go downward in the parse tree. Any necessary subobjects that
* Enter the named type into the internal namespace. We enter the name
* as we go downward in the parse tree. Any necessary subobjects that
* involve arguments to the opcode must be created as we go back up the
* parse tree later.
*/
@@ -753,7 +764,143 @@ Exit:
/*******************************************************************************
*
* FUNCTION: LdNamespace1End
* FUNCTION: LdNamespace2Begin
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Descending callback used during the pass 2 parse tree walk.
* Second pass resolves some forward references.
*
* Notes:
* Currently only needs to handle the Alias operator.
* Could be used to allow forward references from the Scope() operator, but
* the MS interpreter does not allow this, so this compiler does not either.
*
******************************************************************************/
static ACPI_STATUS
LdNamespace2Begin (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context;
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
ACPI_OBJECT_TYPE ObjectType;
BOOLEAN ForceNewScope = FALSE;
ACPI_PARSE_OBJECT *Arg;
char *Path;
ACPI_NAMESPACE_NODE *TargetNode;
ACPI_FUNCTION_NAME (LdNamespace2Begin);
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]\n",
Op, Op->Asl.ParseOpName));
/* Ignore Ops with no namespace node */
Node = Op->Asl.Node;
if (!Node)
{
return (AE_OK);
}
/* Get the type to determine if we should push the scope */
if ((Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) &&
(Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC))
{
ObjectType = ACPI_TYPE_LOCAL_RESOURCE;
}
else
{
ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
}
/* Push scope for Resource Templates */
if (Op->Asl.ParseOpcode == PARSEOP_NAME)
{
if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC)
{
ForceNewScope = TRUE;
}
}
/* Push the scope stack */
if (ForceNewScope || AcpiNsOpensScope (ObjectType))
{
Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
if (Op->Asl.ParseOpcode == PARSEOP_ALIAS)
{
/* Complete the alias node by getting and saving the target node */
/* First child is the alias target */
Arg = Op->Asl.Child;
/* Get the target pathname */
Path = Arg->Asl.Namepath;
if (!Path)
{
Status = UtInternalizeName (Arg->Asl.ExternalName, &Path);
if (ACPI_FAILURE (Status))
{
return (Status);
}
}
/* Get the NS node associated with the target. It must exist. */
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
WalkState, &TargetNode);
if (ACPI_FAILURE (Status))
{
if (Status == AE_NOT_FOUND)
{
AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op,
Op->Asl.ExternalName);
/*
* The name was not found, go ahead and create it.
* This prevents more errors later.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Path,
ACPI_TYPE_ANY,
ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH,
WalkState, &(Node));
return (AE_OK);
}
AslCoreSubsystemError (Op, Status, "Failure from lookup\n", FALSE);
return (AE_OK);
}
/* Save the target node within the alias node */
Node->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode);
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: LdCommonNamespaceEnd
*
* PARAMETERS: ASL_WALK_CALLBACK
*
@@ -765,7 +912,7 @@ Exit:
******************************************************************************/
static ACPI_STATUS
LdNamespace1End (
LdCommonNamespaceEnd (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
@@ -775,7 +922,7 @@ LdNamespace1End (
BOOLEAN ForceNewScope = FALSE;
ACPI_FUNCTION_NAME (LdNamespace1End);
ACPI_FUNCTION_NAME (LdCommonNamespaceEnd);
/* We are only interested in opcodes that have an associated name */
@@ -813,7 +960,6 @@ LdNamespace1End (
if (ForceNewScope || AcpiNsOpensScope (ObjectType))
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"(%s): Popping scope for Op [%s] %p\n",
AcpiUtGetTypeName (ObjectType), Op->Asl.ParseOpName, Op));
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: asllookup- Namespace lookup
* $Revision: 1.106 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -181,6 +180,14 @@ LsDoOnePathname (
void *Context,
void **ReturnValue);
void
LsSetupNsList (
void *Handle);
ACPI_PARSE_OBJECT *
LkGetNameOp (
ACPI_PARSE_OBJECT *Op);
/*******************************************************************************
*
@@ -436,7 +443,8 @@ LsDoOneNamespaceObject (
******************************************************************************/
void
LsSetupNsList (void * Handle)
LsSetupNsList (
void *Handle)
{
Gbl_NsOutputFlag = TRUE;
@@ -922,6 +930,17 @@ LkNamespaceLocateBegin (
return (AE_OK);
}
/*
* One special case: CondRefOf operator - we don't care if the name exists
* or not at this point, just ignore it, the point of the operator is to
* determine if the name exists at runtime.
*/
if ((Op->Asl.Parent) &&
(Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF))
{
return (AE_OK);
}
/*
* We must enable the "search-to-root" for single NameSegs, but
* we have to be very careful about opening up scopes
@@ -1010,14 +1029,6 @@ LkNamespaceLocateBegin (
{
/* The name doesn't exist, period */
if ((Op->Asl.Parent) &&
(Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF))
{
/* Ignore not found if parent is CondRefOf */
return (AE_OK);
}
AslError (ASL_ERROR, ASL_MSG_NOT_EXIST,
Op, Op->Asl.ExternalName);
}
@@ -1030,14 +1041,6 @@ LkNamespaceLocateBegin (
{
/* Gave full path, the object does not exist */
if ((Op->Asl.Parent) &&
(Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF))
{
/* Ignore not found if parent is CondRefOf */
return (AE_OK);
}
AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op,
Op->Asl.ExternalName);
}
@@ -1334,6 +1337,7 @@ LkNamespaceLocateBegin (
break;
case REGION_SMBUS:
case REGION_IPMI:
if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BUFFER)
{
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslmain - compiler main and utilities
* $Revision: 1.99 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -119,8 +118,6 @@
#define _DECLARE_GLOBALS
#include "aslcompiler.h"
#include "acnamesp.h"
#include "actables.h"
#include "acapps.h"
#ifdef _DEBUG
@@ -153,6 +150,28 @@ AslCommandLine (
int argc,
char **argv);
static int
AslDoOptions (
int argc,
char **argv,
BOOLEAN IsResponseFile);
static void
AslMergeOptionTokens (
char *InBuffer,
char *OutBuffer);
static int
AslDoResponseFile (
char *Filename);
extern int AcpiGbl_Opterr;
extern int AcpiGbl_Optind;
#define ASL_TOKEN_SEPARATORS " \t\n"
#define ASL_SUPPORTED_OPTIONS "@:2b:cd^e:fgh^i^I:l^o:p:r:s:t:v:w:x:"
/*******************************************************************************
*
@@ -171,8 +190,13 @@ Options (
void)
{
printf ("General Output:\n");
printf (" -p <prefix> Specify path/filename prefix for all output files\n");
printf ("Global:\n");
printf (" -@<file> Specify command file\n");
printf (" -I<dir> Specify additional include directory\n");
printf ("\nGeneral Output:\n");
printf (" -p<prefix> Specify path/filename prefix for all output files\n");
printf (" -va Disable all errors and warnings (summary only)\n");
printf (" -vi Less verbose errors and warnings for use with IDEs\n");
printf (" -vo Enable optimization comments\n");
printf (" -vr Disable remarks\n");
@@ -200,7 +224,7 @@ Options (
printf (" -d [file] Disassemble or decode binary ACPI table to file (*.dsl)\n");
printf (" -dc [file] Disassemble AML and immediately compile it\n");
printf (" (Obtain DSDT from current system if no input file)\n");
printf (" -e [file] Include ACPI table for external symbol resolution\n");
printf (" -e [f1,f2] Include ACPI table(s) for external symbol resolution\n");
printf (" -2 Emit ACPI 2.0 compatible ASL code\n");
printf (" -g Get ACPI tables and write to files (*.dat)\n");
@@ -312,39 +336,149 @@ AslInitialize (
/*******************************************************************************
*
* FUNCTION: AslCommandLine
* FUNCTION: AslMergeOptionTokens
*
* PARAMETERS: argc/argv
* PARAMETERS: InBuffer - Input containing an option string
* OutBuffer - Merged output buffer
*
* RETURN: None
*
* DESCRIPTION: Command line processing
* DESCRIPTION: Remove all whitespace from an option string.
*
******************************************************************************/
static void
AslMergeOptionTokens (
char *InBuffer,
char *OutBuffer)
{
char *Token;
*OutBuffer = 0;
Token = strtok (InBuffer, ASL_TOKEN_SEPARATORS);
while (Token)
{
strcat (OutBuffer, Token);
Token = strtok (NULL, ASL_TOKEN_SEPARATORS);
}
}
/*******************************************************************************
*
* FUNCTION: AslDoResponseFile
*
* PARAMETERS: Filename - Name of the response file
*
* RETURN: Status
*
* DESCRIPTION: Open a response file and process all options within.
*
******************************************************************************/
static int
AslCommandLine (
int argc,
char **argv)
AslDoResponseFile (
char *Filename)
{
char *argv = StringBuffer2;
FILE *ResponseFile;
int OptStatus = 0;
int Opterr;
int Optind;
ResponseFile = fopen (Filename, "r");
if (!ResponseFile)
{
printf ("Could not open command file %s, %s\n",
Filename, strerror (errno));
return -1;
}
/* Must save the current GetOpt globals */
Opterr = AcpiGbl_Opterr;
Optind = AcpiGbl_Optind;
/*
* Process all lines in the response file. There must be one complete
* option per line
*/
while (fgets (StringBuffer, ASL_MSG_BUFFER_SIZE, ResponseFile))
{
/* Compress all tokens, allowing us to use a single argv entry */
AslMergeOptionTokens (StringBuffer, StringBuffer2);
/* Process the option */
AcpiGbl_Opterr = 0;
AcpiGbl_Optind = 0;
OptStatus = AslDoOptions (1, &argv, TRUE);
if (OptStatus)
{
printf ("Invalid option in command file %s: %s\n",
Filename, StringBuffer);
break;
}
}
/* Restore the GetOpt globals */
AcpiGbl_Opterr = Opterr;
AcpiGbl_Optind = Optind;
fclose (ResponseFile);
return (OptStatus);
}
/*******************************************************************************
*
* FUNCTION: AslDoOptions
*
* PARAMETERS: argc/argv - Standard argc/argv
* IsResponseFile - TRUE if executing a response file.
*
* RETURN: Status
*
* DESCRIPTION: Command line option processing
*
******************************************************************************/
static int
AslDoOptions (
int argc,
char **argv,
BOOLEAN IsResponseFile)
{
BOOLEAN BadCommandLine = FALSE;
int j;
/* Minimum command line contains at least one option or an input file */
if (argc < 2)
{
AslCompilerSignon (ASL_FILE_STDOUT);
Usage ();
exit (1);
}
/* Get the command line options */
while ((j = AcpiGetopt (argc, argv, "2b:cd^e:fgh^i^l^o:p:r:s:t:v:w:x:")) != EOF) switch (j)
while ((j = AcpiGetopt (argc, argv, ASL_SUPPORTED_OPTIONS)) != EOF) switch (j)
{
case '@': /* Begin a response file */
if (IsResponseFile)
{
printf ("Nested command files are not supported\n");
return -1;
}
if (AslDoResponseFile (AcpiGbl_Optarg))
{
return -1;
}
break;
case '2':
Gbl_Acpi2 = TRUE;
break;
@@ -366,8 +500,7 @@ AslCommandLine (
default:
printf ("Unknown option: -b%s\n", AcpiGbl_Optarg);
BadCommandLine = TRUE;
break;
return (-1);
}
/* Produce debug output file */
@@ -396,8 +529,7 @@ AslCommandLine (
default:
printf ("Unknown option: -d%s\n", AcpiGbl_Optarg);
BadCommandLine = TRUE;
break;
return (-1);
}
Gbl_DisasmFlag = TRUE;
@@ -446,12 +578,17 @@ AslCommandLine (
default:
printf ("Unknown option: -h%s\n", AcpiGbl_Optarg);
BadCommandLine = TRUE;
break;
return (-1);
}
break;
case 'I': /* Add an include file search directory */
FlAddIncludeDirectory (AcpiGbl_Optarg);
break;
case 'i':
switch (AcpiGbl_Optarg[0])
@@ -472,8 +609,7 @@ AslCommandLine (
default:
printf ("Unknown option: -s%s\n", AcpiGbl_Optarg);
BadCommandLine = TRUE;
break;
return (-1);
}
break;
@@ -502,8 +638,7 @@ AslCommandLine (
default:
printf ("Unknown option: -l%s\n", AcpiGbl_Optarg);
BadCommandLine = TRUE;
break;
return (-1);
}
break;
@@ -551,8 +686,7 @@ AslCommandLine (
default:
printf ("Unknown option: -c%s\n", AcpiGbl_Optarg);
BadCommandLine = TRUE;
break;
return (-1);
}
break;
@@ -591,8 +725,7 @@ AslCommandLine (
default:
printf ("Unknown option: -s%s\n", AcpiGbl_Optarg);
BadCommandLine = TRUE;
break;
return (-1);
}
break;
@@ -613,8 +746,7 @@ AslCommandLine (
default:
printf ("Unknown option: -t%s\n", AcpiGbl_Optarg);
BadCommandLine = TRUE;
break;
return (-1);
}
break;
@@ -623,6 +755,12 @@ AslCommandLine (
switch (AcpiGbl_Optarg[0])
{
case 'a':
/* Disable All error/warning messages */
Gbl_NoErrors = TRUE;
break;
case 'i':
/* Less verbose error messages */
@@ -643,8 +781,7 @@ AslCommandLine (
default:
printf ("Unknown option: -v%s\n", AcpiGbl_Optarg);
BadCommandLine = TRUE;
break;
return (-1);
}
break;
@@ -667,8 +804,7 @@ AslCommandLine (
default:
printf ("Unknown option: -w%s\n", AcpiGbl_Optarg);
BadCommandLine = TRUE;
break;
return (-1);
}
break;
@@ -681,10 +817,46 @@ AslCommandLine (
default:
BadCommandLine = TRUE;
break;
return (-1);
}
return (0);
}
/*******************************************************************************
*
* FUNCTION: AslCommandLine
*
* PARAMETERS: argc/argv
*
* RETURN: Last argv index
*
* DESCRIPTION: Command line processing
*
******************************************************************************/
static int
AslCommandLine (
int argc,
char **argv)
{
int BadCommandLine = 0;
/* Minimum command line contains at least the command and an input file */
if (argc < 2)
{
AslCompilerSignon (ASL_FILE_STDOUT);
Usage ();
exit (1);
}
/* Process all command line options */
BadCommandLine = AslDoOptions (argc, argv, FALSE);
/* Next parameter must be the input filename */
if (!argv[AcpiGbl_Optind] &&
@@ -745,6 +917,18 @@ main (
AslInitialize ();
Index = AslCommandLine (argc, argv);
/* Options that have no additional parameters or pathnames */
if (Gbl_GetAllTables)
{
Status = AslDoOneFile (NULL);
if (ACPI_FAILURE (Status))
{
return (-1);
}
return (0);
}
/* Process each pathname/filename in the list, with possible wildcards */
while (argv[Index])
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslmap - parser to AML opcode mapping table
* $Revision: 1.88 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -205,7 +204,7 @@ MpDisplayReservedNames (
else
{
printf ("Method with %d arguments, ",
ReservedMethods[i].NumArguments);
ReservedMethods[i].NumArguments & 0x0F);
if (ReservedMethods[i].Flags & ASL_RSVD_RETURN_VALUE)
{
@@ -233,7 +232,8 @@ MpDisplayReservedNames (
*
* Name - The ACPI reserved name
* Args - Number of arguments to the method
* Flags - Whether this method must return a value or not
* Flags - Whether this method must return a value or not. Or if the
* name is a resource descriptor label.
*
******************************************************************************/
@@ -265,24 +265,30 @@ const ASL_RESERVED_INFO ReservedMethods[] = {
{"_ALP", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_ALR", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_ALT", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_ART", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_ASI", 0, ASL_RSVD_RESOURCE_NAME},
{"_ASZ", 0, ASL_RSVD_RESOURCE_NAME},
{"_BAS", 0, ASL_RSVD_RESOURCE_NAME},
{"_BBN", 0, ASL_RSVD_RETURN_VALUE},
{"_BCL", 0, ASL_RSVD_RETURN_VALUE},
{"_BCM", 1, 0},
{"_BCT", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_BDN", 0, ASL_RSVD_RETURN_VALUE},
{"_BFS", 1, 0},
{"_BIF", 0, ASL_RSVD_RETURN_VALUE},
{"_BIX", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_BLT", 3, 0}, /* Acpi 3.0 */
{"_BM_", 0, ASL_RSVD_RESOURCE_NAME},
{"_BMA", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_BMC", 1, 0}, /* Acpi 3.0 */
{"_BMD", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_BMS", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_BQC", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_BST", 0, ASL_RSVD_RETURN_VALUE},
{"_BTM", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_BTP", 1, 0},
{"_CBA", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_CDM", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_CID", 0, ASL_RSVD_RETURN_VALUE},
{"_CRS", 0, ASL_RSVD_RETURN_VALUE},
{"_CRT", 0, ASL_RSVD_RETURN_VALUE},
@@ -301,6 +307,7 @@ const ASL_RESERVED_INFO ReservedMethods[] = {
{"_DSM", 4, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_DSS", 1, 0},
{"_DSW", 3, 0}, /* Acpi 3.0 */
{"_DTI", 1, 0}, /* Acpi 4.0 */
{"_EC_", 0, ASL_RSVD_RETURN_VALUE},
{"_EDL", 0, ASL_RSVD_RETURN_VALUE},
{"_EJ0", 1, 0},
@@ -313,7 +320,13 @@ const ASL_RESERVED_INFO ReservedMethods[] = {
{"_FDE", 0, ASL_RSVD_RETURN_VALUE},
{"_FDI", 0, ASL_RSVD_RETURN_VALUE},
{"_FDM", 1, 0},
{"_FIF", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_FIX", 0, ASL_RSVD_RETURN_VALUE},
{"_FPS", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_FSL", 1, 0}, /* Acpi 4.0 */
{"_FST", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_GAI", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_GHL", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_GL_", 0, ASL_RSVD_RETURN_VALUE},
{"_GLK", 0, ASL_RSVD_RETURN_VALUE},
{"_GPD", 0, ASL_RSVD_RETURN_VALUE},
@@ -339,28 +352,39 @@ const ASL_RESERVED_INFO ReservedMethods[] = {
{"_MAF", 0, ASL_RSVD_RESOURCE_NAME},
{"_MAT", 0, ASL_RSVD_RETURN_VALUE},
{"_MAX", 0, ASL_RSVD_RESOURCE_NAME},
{"_MBM", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_MEM", 0, ASL_RSVD_RESOURCE_NAME},
{"_MIF", 0, ASL_RSVD_RESOURCE_NAME},
{"_MIN", 0, ASL_RSVD_RESOURCE_NAME},
{"_MLS", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_MSG", 1, 0},
{"_MSM", 4, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_MTP", 0, ASL_RSVD_RESOURCE_NAME},
{"_NTT", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_OFF", 0, 0},
{"_ON_", 0, 0},
{"_OS_", 0, ASL_RSVD_RETURN_VALUE},
{"_OSC", 4, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_OSI", 1, ASL_RSVD_RETURN_VALUE},
{"_OST", 3, 0}, /* Acpi 3.0 */
{"_PAI", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_PCL", 0, ASL_RSVD_RETURN_VALUE},
{"_PCT", 0, ASL_RSVD_RETURN_VALUE},
{"_PDC", 1, 0},
{"_PDL", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_PIC", 1, 0},
{"_PIF", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_PLD", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_PMC", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_PMD", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_PMM", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_PPC", 0, ASL_RSVD_RETURN_VALUE},
{"_PPE", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_PR0", 0, ASL_RSVD_RETURN_VALUE},
{"_PR1", 0, ASL_RSVD_RETURN_VALUE},
{"_PR2", 0, ASL_RSVD_RETURN_VALUE},
{"_PR3", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_PRL", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_PRS", 0, ASL_RSVD_RETURN_VALUE},
{"_PRT", 0, ASL_RSVD_RETURN_VALUE},
{"_PRW", 0, ASL_RSVD_RETURN_VALUE},
@@ -376,7 +400,9 @@ const ASL_RESERVED_INFO ReservedMethods[] = {
{"_PSV", 0, ASL_RSVD_RETURN_VALUE},
{"_PSW", 1, 0},
{"_PTC", 0, ASL_RSVD_RETURN_VALUE},
{"_PTP", 2, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_PTS", 1, 0},
{"_PUR", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_PXM", 0, ASL_RSVD_RETURN_VALUE},
{"_RBO", 0, ASL_RSVD_RESOURCE_NAME},
{"_RBW", 0, ASL_RSVD_RESOURCE_NAME},
@@ -405,9 +431,10 @@ const ASL_RESERVED_INFO ReservedMethods[] = {
{"_S4W", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_SB_", 0, ASL_RSVD_SCOPE},
{"_SBS", 0, ASL_RSVD_RETURN_VALUE},
{"_SCP", 1, 0},
{"_SCP", 0x13, 0}, /* Acpi 1.0 - one arg; Acpi 3.0 - three args */
{"_SDD", 1, 0}, /* Acpi 3.0 */
{"_SEG", 0, ASL_RSVD_RETURN_VALUE},
{"_SHL", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_SHR", 0, ASL_RSVD_RESOURCE_NAME},
{"_SI_", 0, ASL_RSVD_SCOPE},
{"_SIZ", 0, ASL_RSVD_RESOURCE_NAME},
@@ -418,12 +445,16 @@ const ASL_RESERVED_INFO ReservedMethods[] = {
{"_SST", 1, 0},
{"_STA", 0, ASL_RSVD_RETURN_VALUE},
{"_STM", 3, 0},
{"_STP", 2, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_STR", 0, ASL_RSVD_RETURN_VALUE},
{"_STV", 2, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_SUN", 0, ASL_RSVD_RETURN_VALUE},
{"_SWS", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_TC1", 0, ASL_RSVD_RETURN_VALUE},
{"_TC2", 0, ASL_RSVD_RETURN_VALUE},
{"_TDL", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0b */
{"_TIP", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_TIV", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */
{"_TMP", 0, ASL_RSVD_RETURN_VALUE},
{"_TPC", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_TPT", 1, 0}, /* Acpi 3.0 */
@@ -682,6 +713,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* REGIONSPACE_CMOS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_CMOS, 0, 0),
/* REGIONSPACE_EC */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_EC, 0, 0),
/* REGIONSPACE_IO */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_IO, 0, 0),
/* REGIONSPACE_IPMI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_IPMI, 0, 0),
/* REGIONSPACE_MEM */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_MEMORY, 0, 0),
/* REGIONSPACE_PCI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_PCI_CONFIG, 0, 0),
/* REGIONSPACE_PCIBAR */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_PCI_BAR, 0, 0),
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslopcode - AML opcode generation
* $Revision: 1.75 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: asloperands - AML operand processing
* $Revision: 1.64 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: aslopt- Compiler optimizations
* $Revision: 1.27 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -437,7 +436,7 @@ OptBuildShortestPath (
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS,
" NOT SHORTER (New %u old %u)",
ACPI_STRLEN (NewPath), AmlNameStringLength));
(UINT32) ACPI_STRLEN (NewPath), (UINT32) AmlNameStringLength));
ACPI_FREE (NewPathExternal);
return (AE_NOT_FOUND);
}
@@ -753,8 +752,8 @@ OptOptimizeNamePath (
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS,
"%37s (%2u) ==> %-32s(%2u) %-32s",
(char *) CurrentPath.Pointer, CurrentPath.Length,
(char *) TargetPath.Pointer, TargetPath.Length, ExternalNameString));
(char *) CurrentPath.Pointer, (UINT32) CurrentPath.Length,
(char *) TargetPath.Pointer, (UINT32) TargetPath.Length, ExternalNameString));
ACPI_FREE (ExternalNameString);
@@ -812,7 +811,7 @@ OptOptimizeNamePath (
OptTotal += HowMuchShorter;
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " REDUCED %2u (%u)",
HowMuchShorter, OptTotal));
(UINT32) HowMuchShorter, OptTotal));
if (Flags & AML_NAMED)
{
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslresource - Resource templates and descriptors
* $Revision: 1.44 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslrestype1 - Short (type1) resource templates and descriptors
* $Revision: 1.41 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslrestype2 - Long (type2) resource templates and descriptors
* $Revision: 1.52 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -2488,20 +2487,25 @@ RsDoInterruptDescriptor (
InitializerOp = Op->Asl.Child;
StringLength = RsGetStringDataLength (InitializerOp);
if (StringLength)
{
/* Make room for the ResourceSourceIndex */
OptionIndex++;
}
/* Count the interrupt numbers */
for (i = 0; InitializerOp; i++)
{
InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
if (i <= 6)
{
if (i == 3 &&
InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
/*
* ResourceSourceIndex was specified, always make room for
* it, even if the ResourceSource was omitted.
*/
OptionIndex++;
}
continue;
}
@@ -2636,6 +2640,14 @@ RsDoInterruptDescriptor (
if (i == 7)
{
if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
{
/* Must be at least one interrupt */
AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN,
InitializerOp, NULL);
}
/* Check now for duplicates in list */
RsCheckListForDuplicates (InitializerOp);
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslstartup - Compiler startup routines, called from main
* $Revision: 1.5 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,7 +116,6 @@
#include "aslcompiler.h"
#include "acnamesp.h"
#include "actables.h"
#include "acapps.h"
@@ -142,10 +140,6 @@ AsDoWildcard (
char *DirectoryPathname,
char *FileSpecifier);
static ACPI_STATUS
AslDoOneFile (
char *Filename);
/*******************************************************************************
*
@@ -275,7 +269,7 @@ AsDoWildcard (
*
******************************************************************************/
static ACPI_STATUS
ACPI_STATUS
AslDoOneFile (
char *Filename)
{
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslstubs - Stubs used to link to Aml interpreter
* $Revision: 1.23 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -115,12 +114,12 @@
*
*****************************************************************************/
#include <stdio.h>
#include "aslcompiler.h"
#include "acdispat.h"
#include "actables.h"
#include "acevents.h"
#include "acinterp.h"
#include "acnamesp.h"
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslstubs")
@@ -138,6 +137,30 @@ AeLocalGetRootPointer (
return 0;
}
void
AcpiNsExecModuleCodeList (
void)
{
}
ACPI_STATUS
AcpiHwReadPort (
ACPI_IO_ADDRESS Address,
UINT32 *Value,
UINT32 Width)
{
return (AE_OK);
}
ACPI_STATUS
AcpiHwWritePort (
ACPI_IO_ADDRESS Address,
UINT32 Value,
UINT32 Width)
{
return (AE_OK);
}
ACPI_STATUS
AcpiDsMethodError (
ACPI_STATUS Status,
@@ -148,7 +171,7 @@ AcpiDsMethodError (
ACPI_STATUS
AcpiDsMethodDataGetValue (
UINT16 Opcode,
UINT8 Type,
UINT32 Index,
ACPI_WALK_STATE *WalkState,
ACPI_OPERAND_OBJECT **DestDesc)
@@ -158,7 +181,7 @@ AcpiDsMethodDataGetValue (
ACPI_STATUS
AcpiDsMethodDataGetNode (
UINT16 Opcode,
UINT8 Type,
UINT32 Index,
ACPI_WALK_STATE *WalkState,
ACPI_NAMESPACE_NODE **Node)
@@ -168,7 +191,7 @@ AcpiDsMethodDataGetNode (
ACPI_STATUS
AcpiDsStoreObjectToLocal (
UINT16 Opcode,
UINT8 Type,
UINT32 Index,
ACPI_OPERAND_OBJECT *SrcDesc,
ACPI_WALK_STATE *WalkState)
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: asltransform - Parse tree transforms
* $Revision: 1.44 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -778,7 +777,7 @@ TrDoSwitch (
case ACPI_BTYPE_STRING:
NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL,
(ACPI_INTEGER) "");
(ACPI_INTEGER) ACPI_TO_INTEGER (""));
break;
case ACPI_BTYPE_BUFFER:
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: asltree - parse tree management
* $Revision: 1.65 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: asltypes.h - compiler data types and struct definitions
* $Revision: 1.91 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -256,6 +255,14 @@ typedef enum
#define ASL_NUM_FILES (ASL_MAX_FILE_TYPE + 1)
typedef struct asl_include_dir
{
char *Dir;
struct asl_include_dir *Next;
} ASL_INCLUDE_DIR;
/* An entry in the exception list, one for each error/warning */
typedef struct asl_error_msg
@@ -340,6 +347,7 @@ typedef enum
ASL_MSG_EARLY_EOF,
ASL_MSG_ENCODING_LENGTH,
ASL_MSG_EX_INTERRUPT_LIST,
ASL_MSG_EX_INTERRUPT_LIST_MIN,
ASL_MSG_EX_INTERRUPT_NUMBER,
ASL_MSG_FIELD_ACCESS_WIDTH,
ASL_MSG_FIELD_UNIT_ACCESS_WIDTH,
@@ -423,7 +431,10 @@ typedef enum
ASL_MSG_NOT_REFERENCED,
ASL_MSG_NON_ZERO,
ASL_MSG_STRING_LENGTH,
ASL_MSG_SERIALIZED
ASL_MSG_SERIALIZED,
ASL_MSG_COMPILER_RESERVED,
ASL_MSG_NAMED_OBJECT_IN_WHILE,
ASL_MSG_LOCAL_OUTSIDE_METHOD
} ASL_MESSAGE_IDS;
@@ -455,6 +466,7 @@ char *AslMessages [] = {
/* ASL_MSG_EARLY_EOF */ "Premature end-of-file reached",
/* ASL_MSG_ENCODING_LENGTH */ "Package length too long to encode",
/* ASL_MSG_EX_INTERRUPT_LIST */ "Too many interrupts (255 max)",
/* ASL_MSG_EX_INTERRUPT_LIST_MIN */ "Too few interrupts (1 minimum required)",
/* ASL_MSG_EX_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 32 bits)",
/* ASL_MSG_FIELD_ACCESS_WIDTH */ "Access width is greater than region size",
/* ASL_MSG_FIELD_UNIT_ACCESS_WIDTH */ "Access width of Field Unit extends beyond region limit",
@@ -511,7 +523,7 @@ char *AslMessages [] = {
/* ASL_MSG_RESERVED_OPERAND_TYPE */ "Invalid operand type for reserved name, must be",
/* ASL_MSG_RESERVED_RETURN_VALUE */ "Reserved method must return a value",
/* ASL_MSG_RESERVED_USE */ "Invalid use of reserved name",
/* ASL_MSG_RESERVED_WORD */ "Use of reserved word",
/* ASL_MSG_RESERVED_WORD */ "Use of reserved name",
/* ASL_MSG_RESOURCE_FIELD */ "Resource field name cannot be used as a target",
/* ASL_MSG_RESOURCE_INDEX */ "Missing ResourceSourceIndex (required)",
/* ASL_MSG_RESOURCE_LIST */ "Too many resource items (internal error)",
@@ -538,7 +550,10 @@ char *AslMessages [] = {
/* ASL_MSG_NOT_REFERENCED */ "Namespace object is not referenced",
/* ASL_MSG_NON_ZERO */ "Operand evaluates to zero",
/* ASL_MSG_STRING_LENGTH */ "String literal too long",
/* ASL_MSG_SERIALIZED */ "Control Method marked Serialized"
/* ASL_MSG_SERIALIZED */ "Control Method marked Serialized",
/* ASL_MSG_COMPILER_RESERVED */ "Use of compiler reserved name",
/* ASL_MSG_NAMED_OBJECT_IN_WHILE */ "Creating a named object in a While loop",
/* ASL_MSG_LOCAL_OUTSIDE_METHOD */ "Local or Arg used outside a control method"
};
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslutils -- compiler utilities
* $Revision: 1.74 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dbcmds - debug commands and output routines
* $Revision: 1.157 $
*
******************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,8 +115,8 @@
#include "acpi.h"
#include "accommon.h"
#include "acdispat.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acevents.h"
#include "acdebug.h"
@@ -387,6 +386,225 @@ AcpiDbFindReferences (
}
/*******************************************************************************
*
* FUNCTION: AcpiDbWalkForPredefinedNames
*
* PARAMETERS: Callback from WalkNamespace
*
* RETURN: Status
*
* DESCRIPTION: Detect and display predefined ACPI names (names that start with
* an underscore)
*
******************************************************************************/
static ACPI_STATUS
AcpiDbWalkForPredefinedNames (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue)
{
ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
UINT32 *Count = (UINT32 *) Context;
const ACPI_PREDEFINED_INFO *Predefined;
const ACPI_PREDEFINED_INFO *Package = NULL;
char *Pathname;
Predefined = AcpiNsCheckForPredefinedName (Node);
if (!Predefined)
{
return (AE_OK);
}
Pathname = AcpiNsGetExternalPathname (Node);
if (!Pathname)
{
return (AE_OK);
}
/* If method returns a package, the info is in the next table entry */
if (Predefined->Info.ExpectedBtypes & ACPI_BTYPE_PACKAGE)
{
Package = Predefined + 1;
}
AcpiOsPrintf ("%-32s arg %X ret %2.2X", Pathname,
Predefined->Info.ParamCount, Predefined->Info.ExpectedBtypes);
if (Package)
{
AcpiOsPrintf (" PkgType %2.2X ObjType %2.2X Count %2.2X",
Package->RetInfo.Type, Package->RetInfo.ObjectType1,
Package->RetInfo.Count1);
}
AcpiOsPrintf("\n");
AcpiNsCheckParameterCount (Pathname, Node, ACPI_UINT32_MAX, Predefined);
ACPI_FREE (Pathname);
(*Count)++;
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbCheckPredefinedNames
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Validate all predefined names in the namespace
*
******************************************************************************/
void
AcpiDbCheckPredefinedNames (
void)
{
UINT32 Count = 0;
/* Search all nodes in namespace */
(void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
AcpiDbWalkForPredefinedNames, (void *) &Count, NULL);
AcpiOsPrintf ("Found %d predefined names in the namespace\n", Count);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbWalkForExecute
*
* PARAMETERS: Callback from WalkNamespace
*
* RETURN: Status
*
* DESCRIPTION: Batch execution module. Currently only executes predefined
* ACPI names.
*
******************************************************************************/
static ACPI_STATUS
AcpiDbWalkForExecute (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue)
{
ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
UINT32 *Count = (UINT32 *) Context;
ACPI_BUFFER ReturnObj;
ACPI_STATUS Status;
char *Pathname;
UINT32 i;
ACPI_DEVICE_INFO *ObjInfo;
ACPI_OBJECT_LIST ParamObjects;
ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS];
const ACPI_PREDEFINED_INFO *Predefined;
Predefined = AcpiNsCheckForPredefinedName (Node);
if (!Predefined)
{
return (AE_OK);
}
if (Node->Type == ACPI_TYPE_LOCAL_SCOPE)
{
return (AE_OK);
}
Pathname = AcpiNsGetExternalPathname (Node);
if (!Pathname)
{
return (AE_OK);
}
/* Get the object info for number of method parameters */
Status = AcpiGetObjectInfo (ObjHandle, &ObjInfo);
if (ACPI_FAILURE (Status))
{
return (Status);
}
ParamObjects.Pointer = NULL;
ParamObjects.Count = 0;
if (ObjInfo->Type == ACPI_TYPE_METHOD)
{
/* Setup default parameters */
for (i = 0; i < ObjInfo->ParamCount; i++)
{
Params[i].Type = ACPI_TYPE_INTEGER;
Params[i].Integer.Value = 1;
}
ParamObjects.Pointer = Params;
ParamObjects.Count = ObjInfo->ParamCount;
}
ACPI_FREE (ObjInfo);
ReturnObj.Pointer = NULL;
ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
/* Do the actual method execution */
AcpiGbl_MethodExecuting = TRUE;
Status = AcpiEvaluateObject (Node, NULL, &ParamObjects, &ReturnObj);
AcpiOsPrintf ("%-32s returned %s\n", Pathname, AcpiFormatException (Status));
AcpiGbl_MethodExecuting = FALSE;
ACPI_FREE (Pathname);
(*Count)++;
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbBatchExecute
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Namespace batch execution.
*
******************************************************************************/
void
AcpiDbBatchExecute (
void)
{
UINT32 Count = 0;
/* Search all nodes in namespace */
(void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
AcpiDbWalkForExecute, (void *) &Count, NULL);
AcpiOsPrintf ("Executed %d predefined names in the namespace\n", Count);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayLocks
@@ -434,6 +652,7 @@ AcpiDbDisplayTableInfo (
{
UINT32 i;
ACPI_TABLE_DESC *TableDesc;
ACPI_STATUS Status;
/* Walk the entire root table list */
@@ -445,7 +664,11 @@ AcpiDbDisplayTableInfo (
/* Make sure that the table is mapped */
AcpiTbVerifyTable (TableDesc);
Status = AcpiTbVerifyTable (TableDesc);
if (ACPI_FAILURE (Status))
{
return;
}
/* Dump the table header */
@@ -943,7 +1166,7 @@ AcpiDbSetMethodData (
goto Cleanup;
}
Status = AcpiDsStoreObjectToLocal (AML_ARG_OP, Index, ObjDesc,
Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_ARG, Index, ObjDesc,
WalkState);
if (ACPI_FAILURE (Status))
{
@@ -966,7 +1189,7 @@ AcpiDbSetMethodData (
goto Cleanup;
}
Status = AcpiDsStoreObjectToLocal (AML_LOCAL_OP, Index, ObjDesc,
Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_LOCAL, Index, ObjDesc,
WalkState);
if (ACPI_FAILURE (Status))
{
@@ -1173,6 +1396,9 @@ ACPI_STATUS
AcpiDbFindNameInNamespace (
char *NameArg)
{
char AcpiName[5] = "____";
char *AcpiNamePtr = AcpiName;
if (ACPI_STRLEN (NameArg) > 4)
{
@@ -1180,11 +1406,20 @@ AcpiDbFindNameInNamespace (
return (AE_OK);
}
/* Walk the namespace from the root */
/* Pad out name with underscores as necessary to create a 4-char name */
AcpiUtStrupr (NameArg);
while (*NameArg)
{
*AcpiNamePtr = *NameArg;
AcpiNamePtr++;
NameArg++;
}
/* Walk the namespace from the root */
(void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
AcpiDbWalkAndMatchName, NameArg, NULL);
AcpiDbWalkAndMatchName, AcpiName, NULL);
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
return (AE_OK);
@@ -1755,12 +1990,17 @@ AcpiDbBusWalk (
ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
ACPI_STATUS Status;
ACPI_BUFFER Buffer;
ACPI_INTEGER ADR;
ACPI_DEVICE_ID Id;
ACPI_COMPATIBLE_ID_LIST *Cid;
ACPI_NAMESPACE_NODE *TempNode;
ACPI_DEVICE_INFO *Info;
UINT32 i;
if ((Node->Type != ACPI_TYPE_DEVICE) &&
(Node->Type != ACPI_TYPE_PROCESSOR))
{
return (AE_OK);
}
/* Exit if there is no _PRT under this device */
Status = AcpiGetHandle (Node, METHOD_NAME__PRT,
@@ -1780,57 +2020,70 @@ AcpiDbBusWalk (
return (AE_OK);
}
Status = AcpiGetObjectInfo (ObjHandle, &Info);
if (ACPI_FAILURE (Status))
{
return (AE_OK);
}
/* Display the full path */
AcpiOsPrintf ("%-32s", (char *) Buffer.Pointer);
AcpiOsPrintf ("%-32s Type %X", (char *) Buffer.Pointer, Node->Type);
ACPI_FREE (Buffer.Pointer);
if (Info->Flags & ACPI_PCI_ROOT_BRIDGE)
{
AcpiOsPrintf (" - Is PCI Root Bridge");
}
AcpiOsPrintf ("\n");
/* _PRT info */
AcpiOsPrintf ("_PRT=%p", TempNode);
AcpiOsPrintf ("_PRT: %p\n", TempNode);
/* Get the _ADR value */
/* Dump _ADR, _HID, _UID, _CID */
Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, Node, &ADR);
if (ACPI_FAILURE (Status))
if (Info->Valid & ACPI_VALID_ADR)
{
AcpiOsPrintf (" No _ADR ");
AcpiOsPrintf ("_ADR: %8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Info->Address));
}
else
{
AcpiOsPrintf (" _ADR=%8.8X", (UINT32) ADR);
AcpiOsPrintf ("_ADR: <Not Present>\n");
}
/* Get the _HID if present */
Status = AcpiUtExecute_HID (Node, &Id);
if (ACPI_SUCCESS (Status))
if (Info->Valid & ACPI_VALID_HID)
{
AcpiOsPrintf (" _HID=%s", Id.Value);
AcpiOsPrintf ("_HID: %s\n", Info->HardwareId.String);
}
else
{
AcpiOsPrintf (" ");
AcpiOsPrintf ("_HID: <Not Present>\n");
}
/* Get the _UID if present */
Status = AcpiUtExecute_UID (Node, &Id);
if (ACPI_SUCCESS (Status))
if (Info->Valid & ACPI_VALID_UID)
{
AcpiOsPrintf (" _UID=%s", Id.Value);
AcpiOsPrintf ("_UID: %s\n", Info->UniqueId.String);
}
/* Get the _CID if present */
Status = AcpiUtExecute_CID (Node, &Cid);
if (ACPI_SUCCESS (Status))
else
{
AcpiOsPrintf (" _CID=%s", Cid->Id[0].Value);
ACPI_FREE (Cid);
AcpiOsPrintf ("_UID: <Not Present>\n");
}
AcpiOsPrintf ("\n");
if (Info->Valid & ACPI_VALID_CID)
{
for (i = 0; i < Info->CompatibleIdList.Count; i++)
{
AcpiOsPrintf ("_CID: %s\n",
Info->CompatibleIdList.Ids[i].String);
}
}
else
{
AcpiOsPrintf ("_CID: <Not Present>\n");
}
ACPI_FREE (Info);
return (AE_OK);
}
@@ -1853,7 +2106,7 @@ AcpiDbGetBusInfo (
{
/* Search all nodes in namespace */
(void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
(void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
AcpiDbBusWalk, NULL, NULL);
}
@@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dbdisply - debug display commands
* $Revision: 1.121 $
*
******************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "amlcode.h"
#include "acdispat.h"
#include "acnamesp.h"
@@ -682,42 +682,52 @@ AcpiDbDisplayObjectType (
char *ObjectArg)
{
ACPI_HANDLE Handle;
ACPI_BUFFER Buffer;
ACPI_DEVICE_INFO *Info;
ACPI_STATUS Status;
UINT32 i;
Handle = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
Status = AcpiGetObjectInfo (Handle, &Buffer);
if (ACPI_SUCCESS (Status))
Status = AcpiGetObjectInfo (Handle, &Info);
if (ACPI_FAILURE (Status))
{
Info = Buffer.Pointer;
AcpiOsPrintf (
"S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X HID: %s, ADR: %8.8X%8.8X, Status %8.8X\n",
Info->HighestDstates[0], Info->HighestDstates[1],
Info->HighestDstates[2], Info->HighestDstates[3],
Info->HardwareId.Value,
ACPI_FORMAT_UINT64 (Info->Address),
Info->CurrentStatus);
AcpiOsPrintf ("Could not get object info, %s\n",
AcpiFormatException (Status));
return;
}
if (Info->Valid & ACPI_VALID_CID)
AcpiOsPrintf ("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n",
ACPI_FORMAT_UINT64 (Info->Address),
Info->CurrentStatus, Info->Flags);
AcpiOsPrintf ("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n",
Info->HighestDstates[0], Info->HighestDstates[1],
Info->HighestDstates[2], Info->HighestDstates[3]);
AcpiOsPrintf ("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n",
Info->LowestDstates[0], Info->LowestDstates[1],
Info->LowestDstates[2], Info->LowestDstates[3],
Info->LowestDstates[4]);
if (Info->Valid & ACPI_VALID_HID)
{
AcpiOsPrintf ("HID: %s\n", Info->HardwareId.String);
}
if (Info->Valid & ACPI_VALID_UID)
{
AcpiOsPrintf ("UID: %s\n", Info->UniqueId.String);
}
if (Info->Valid & ACPI_VALID_CID)
{
for (i = 0; i < Info->CompatibleIdList.Count; i++)
{
for (i = 0; i < Info->CompatibilityId.Count; i++)
{
AcpiOsPrintf ("CID #%d: %s\n", i,
Info->CompatibilityId.Id[i].Value);
}
AcpiOsPrintf ("CID %d: %s\n", i,
Info->CompatibleIdList.Ids[i].String);
}
}
ACPI_FREE (Info);
}
else
{
AcpiOsPrintf ("%s\n", AcpiFormatException (Status));
}
ACPI_FREE (Info);
}
@@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dbexec - debugger control method execution
* $Revision: 1.83 $
*
******************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acdebug.h"
#include "acnamesp.h"
@@ -176,7 +176,6 @@ AcpiDbExecuteMethod (
ACPI_OBJECT_LIST ParamObjects;
ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS];
ACPI_HANDLE Handle;
ACPI_BUFFER Buffer;
UINT32 i;
ACPI_DEVICE_INFO *ObjInfo;
@@ -196,14 +195,15 @@ AcpiDbExecuteMethod (
/* Get the object info for number of method parameters */
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
Status = AcpiGetObjectInfo (Handle, &Buffer);
Status = AcpiGetObjectInfo (Handle, &ObjInfo);
if (ACPI_FAILURE (Status))
{
return (Status);
}
ObjInfo = Buffer.Pointer;
ParamObjects.Pointer = NULL;
ParamObjects.Count = 0;
if (ObjInfo->Type == ACPI_TYPE_METHOD)
{
/* Are there arguments to the method? */
@@ -253,7 +253,7 @@ AcpiDbExecuteMethod (
}
}
ACPI_FREE (Buffer.Pointer);
ACPI_FREE (ObjInfo);
/* Prepare for a return object of arbitrary size */
@@ -548,25 +548,47 @@ AcpiDbMethodThread (
{
ACPI_STATUS Status;
ACPI_DB_METHOD_INFO *Info = Context;
ACPI_DB_METHOD_INFO LocalInfo;
UINT32 i;
UINT8 Allow;
ACPI_BUFFER ReturnObj;
/*
* AcpiGbl_DbMethodInfo.Arguments will be passed as method arguments.
* Prevent AcpiGbl_DbMethodInfo from being modified by multiple threads
* concurrently.
*
* Note: The arguments we are passing are used by the ASL test suite
* (aslts). Do not change them without updating the tests.
*/
(void) AcpiOsWaitSemaphore (Info->InfoGate, 1, ACPI_WAIT_FOREVER);
if (Info->InitArgs)
{
AcpiDbUInt32ToHexString (Info->NumCreated, Info->IndexOfThreadStr);
AcpiDbUInt32ToHexString ((UINT32) AcpiOsGetThreadId (), Info->IdOfThreadStr);
AcpiDbUInt32ToHexString (ACPI_TO_INTEGER (AcpiOsGetThreadId ()),
Info->IdOfThreadStr);
}
if (Info->Threads && (Info->NumCreated < Info->NumThreads))
{
Info->Threads[Info->NumCreated++] = (UINT32) AcpiOsGetThreadId();
Info->Threads[Info->NumCreated++] =
ACPI_TO_INTEGER (AcpiOsGetThreadId());
}
LocalInfo = *Info;
LocalInfo.Args = LocalInfo.Arguments;
LocalInfo.Arguments[0] = LocalInfo.NumThreadsStr;
LocalInfo.Arguments[1] = LocalInfo.IdOfThreadStr;
LocalInfo.Arguments[2] = LocalInfo.IndexOfThreadStr;
LocalInfo.Arguments[3] = NULL;
(void) AcpiOsSignalSemaphore (Info->InfoGate, 1);
for (i = 0; i < Info->NumLoops; i++)
{
Status = AcpiDbExecuteMethod (Info, &ReturnObj);
Status = AcpiDbExecuteMethod (&LocalInfo, &ReturnObj);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("%s During execution of %s at iteration %X\n",
@@ -645,6 +667,8 @@ AcpiDbCreateExecutionThreads (
UINT32 Size;
ACPI_MUTEX MainThreadGate;
ACPI_MUTEX ThreadCompleteGate;
ACPI_MUTEX InfoGate;
/* Get the arguments */
@@ -683,6 +707,16 @@ AcpiDbCreateExecutionThreads (
return;
}
Status = AcpiOsCreateSemaphore (1, 1, &InfoGate);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not create semaphore for synchronization of AcpiGbl_DbMethodInfo, %s\n",
AcpiFormatException (Status));
(void) AcpiOsDeleteSemaphore (ThreadCompleteGate);
(void) AcpiOsDeleteSemaphore (MainThreadGate);
return;
}
ACPI_MEMSET (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO));
/* Array to store IDs of threads */
@@ -695,6 +729,7 @@ AcpiDbCreateExecutionThreads (
AcpiOsPrintf ("No memory for thread IDs array\n");
(void) AcpiOsDeleteSemaphore (MainThreadGate);
(void) AcpiOsDeleteSemaphore (ThreadCompleteGate);
(void) AcpiOsDeleteSemaphore (InfoGate);
return;
}
ACPI_MEMSET (AcpiGbl_DbMethodInfo.Threads, 0, Size);
@@ -706,6 +741,7 @@ AcpiDbCreateExecutionThreads (
AcpiGbl_DbMethodInfo.NumLoops = NumLoops;
AcpiGbl_DbMethodInfo.MainThreadGate = MainThreadGate;
AcpiGbl_DbMethodInfo.ThreadCompleteGate = ThreadCompleteGate;
AcpiGbl_DbMethodInfo.InfoGate = InfoGate;
/* Init arguments to be passed to method */
@@ -746,6 +782,7 @@ AcpiDbCreateExecutionThreads (
(void) AcpiOsDeleteSemaphore (MainThreadGate);
(void) AcpiOsDeleteSemaphore (ThreadCompleteGate);
(void) AcpiOsDeleteSemaphore (InfoGate);
AcpiOsFree (AcpiGbl_DbMethodInfo.Threads);
AcpiGbl_DbMethodInfo.Threads = NULL;
@@ -1,8 +1,7 @@
/*******************************************************************************
*
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
* be used when running the debugger in Ring 0 (Kernel mode)
* $Revision: 1.96 $
*
******************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,6 +116,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acdebug.h"
#ifdef ACPI_APPLICATION
@@ -129,7 +129,7 @@
ACPI_MODULE_NAME ("dbfileio")
/*
* NOTE: this is here for lack of a better place. It is used in all
* NOTE: this is here for lack of a better place. It is used in all
* flavors of the debugger, need LCD file
*/
#ifdef ACPI_APPLICATION
@@ -264,7 +264,7 @@ AcpiDbCheckTextModeCorruption (
{
if (Table[i - 1] != 0x0D)
{
/* The LF does not have a preceeding CR, table not corrupted */
/* The LF does not have a preceding CR, table not corrupted */
return (AE_OK);
}
@@ -356,7 +356,7 @@ AcpiDbReadTable (
}
else
{
/* Read the table header */
/* Read the table header */
if (fread (&TableHeader, 1, sizeof (TableHeader), fp) !=
sizeof (ACPI_TABLE_HEADER))
@@ -463,8 +463,8 @@ AcpiDbReadTable (
* RETURN: Status
*
* DESCRIPTION: This function is called to load a table from the caller's
* buffer. The buffer must contain an entire ACPI Table including
* a valid header. The header fields will be verified, and if it
* buffer. The buffer must contain an entire ACPI Table including
* a valid header. The header fields will be verified, and if it
* is determined that the table is invalid, the call will fail.
*
******************************************************************************/
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dbhistry - debugger HISTORY command
* $Revision: 1.35 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acdebug.h"
#ifdef ACPI_DEBUGGER
@@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dbinput - user front-end to the AML debugger
* $Revision: 1.116 $
*
******************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acdebug.h"
@@ -160,6 +160,7 @@ enum AcpiExDebuggerCommands
CMD_ALLOCATIONS,
CMD_ARGS,
CMD_ARGUMENTS,
CMD_BATCH,
CMD_BREAKPOINT,
CMD_BUSINFO,
CMD_CALL,
@@ -194,6 +195,7 @@ enum AcpiExDebuggerCommands
CMD_OBJECT,
CMD_OPEN,
CMD_OWNER,
CMD_PREDEFINED,
CMD_PREFIX,
CMD_QUIT,
CMD_REFERENCES,
@@ -214,6 +216,9 @@ enum AcpiExDebuggerCommands
#define CMD_FIRST_VALID 2
/* Second parameter is the required argument count */
static const COMMAND_INFO AcpiGbl_DbCommands[] =
{
{"<NOT FOUND>", 0},
@@ -221,6 +226,7 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] =
{"ALLOCATIONS", 0},
{"ARGS", 0},
{"ARGUMENTS", 0},
{"BATCH", 0},
{"BREAKPOINT", 1},
{"BUSINFO", 0},
{"CALL", 0},
@@ -255,6 +261,7 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] =
{"OBJECT", 1},
{"OPEN", 1},
{"OWNER", 1},
{"PREDEFINED", 0},
{"PREFIX", 0},
{"QUIT", 0},
{"REFERENCES", 1},
@@ -360,6 +367,7 @@ AcpiDbDisplayHelp (
AcpiOsPrintf ("Notify <Object> <Value> Send a notification on Object\n");
AcpiOsPrintf ("Objects <ObjectType> Display all objects of the given type\n");
AcpiOsPrintf ("Owner <OwnerId> [Depth] Display loaded namespace by object owner\n");
AcpiOsPrintf ("Predefined Check all predefined names\n");
AcpiOsPrintf ("Prefix [<NamePath>] Set or Get current execution prefix\n");
AcpiOsPrintf ("References <Addr> Find all references to object at addr\n");
AcpiOsPrintf ("Resources <Device> Get and display Device resources\n");
@@ -635,6 +643,10 @@ AcpiDbCommandDispatch (
AcpiDbDisplayArguments ();
break;
case CMD_BATCH:
AcpiDbBatchExecute ();
break;
case CMD_BREAKPOINT:
AcpiDbSetMethodBreakpoint (AcpiGbl_DbArgs[1], WalkState, Op);
break;
@@ -812,6 +824,10 @@ AcpiDbCommandDispatch (
AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
break;
case CMD_PREDEFINED:
AcpiDbCheckPredefinedNames ();
break;
case CMD_PREFIX:
AcpiDbSetScope (AcpiGbl_DbArgs[1]);
break;
@@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dbstats - Generation and display of ACPI table statistics
* $Revision: 1.90 $
*
******************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acdebug.h"
#include "acnamesp.h"
@@ -276,18 +276,18 @@ AcpiDbEnumerateObject (
AcpiGbl_NumObjects++;
if (ACPI_GET_OBJECT_TYPE (ObjDesc) > ACPI_TYPE_NS_NODE_MAX)
if (ObjDesc->Common.Type > ACPI_TYPE_NS_NODE_MAX)
{
AcpiGbl_ObjTypeCountMisc++;
}
else
{
AcpiGbl_ObjTypeCount [ACPI_GET_OBJECT_TYPE (ObjDesc)]++;
AcpiGbl_ObjTypeCount [ObjDesc->Common.Type]++;
}
/* Count the sub-objects */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_PACKAGE:
@@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dbutils - AML debugger utilities
* $Revision: 1.87 $
*
******************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
#include "acdebug.h"
#include "acdisasm.h"
@@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dbxface - AML Debugger external interfaces
* $Revision: 1.79 $
*
******************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "amlcode.h"
#include "acdebug.h"
#include "acdisasm.h"
@@ -563,10 +563,6 @@ AcpiDbTerminate (
void)
{
if (AcpiGbl_DbTablePtr)
{
AcpiOsFree (AcpiGbl_DbTablePtr);
}
if (AcpiGbl_DbBuffer)
{
AcpiOsFree (AcpiGbl_DbBuffer);
@@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dmbuffer - AML disassembler, buffer and string support
* $Revision: 1.26 $
*
******************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acdisasm.h"
#include "acparser.h"
#include "amlcode.h"
@@ -132,6 +132,10 @@ static void
AcpiDmUnicode (
ACPI_PARSE_OBJECT *Op);
static void
AcpiDmIsEisaIdElement (
ACPI_PARSE_OBJECT *Op);
/*******************************************************************************
*
@@ -452,7 +456,7 @@ AcpiDmUnicode (
*
******************************************************************************/
void
static void
AcpiDmIsEisaIdElement (
ACPI_PARSE_OBJECT *Op)
{
@@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dmnames - AML disassembler, names, namestrings, pathnames
* $Revision: 1.19 $
*
******************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acnamesp.h"
@@ -159,7 +159,7 @@ AcpiDmDumpName (
/* Copy name locally in case the original name is not writeable */
*(UINT32 *) NewName = Name;
*ACPI_CAST_PTR (UINT32, &NewName[0]) = Name;
/* Ensure that the name is printable, even if we have to fix it */
@@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dmobject - ACPI object decode and display
* $Revision: 1.24 $
*
******************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,10 +115,9 @@
#include "acpi.h"
#include "amlcode.h"
#include "accommon.h"
#include "acnamesp.h"
#include "acdisasm.h"
#include "acparser.h"
#ifdef ACPI_DISASSEMBLER
@@ -280,7 +278,7 @@ AcpiDmDecodeInternalObject (
AcpiOsPrintf (" %s", AcpiUtGetObjectTypeName (ObjDesc));
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
@@ -418,7 +416,7 @@ AcpiDmDisplayInternalObject (
case ACPI_DESC_TYPE_OPERAND:
Type = ACPI_GET_OBJECT_TYPE (ObjDesc);
Type = ObjDesc->Common.Type;
if (Type > ACPI_TYPE_LOCAL_MAX)
{
AcpiOsPrintf (" Type %X [Invalid Type]", (UINT32) Type);
@@ -427,50 +425,48 @@ AcpiDmDisplayInternalObject (
/* Decode the ACPI object type */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_LOCAL_REFERENCE:
switch (ObjDesc->Reference.Opcode)
AcpiOsPrintf ("[%s] ", AcpiUtGetReferenceName (ObjDesc));
/* Decode the refererence */
switch (ObjDesc->Reference.Class)
{
case AML_LOCAL_OP:
case ACPI_REFCLASS_LOCAL:
AcpiOsPrintf ("[Local%d] ", ObjDesc->Reference.Offset);
AcpiOsPrintf ("%X ", ObjDesc->Reference.Value);
if (WalkState)
{
ObjDesc = WalkState->LocalVariables[
ObjDesc->Reference.Offset].Object;
ObjDesc = WalkState->LocalVariables
[ObjDesc->Reference.Value].Object;
AcpiOsPrintf ("%p", ObjDesc);
AcpiDmDecodeInternalObject (ObjDesc);
}
break;
case AML_ARG_OP:
case ACPI_REFCLASS_ARG:
AcpiOsPrintf ("[Arg%d] ", ObjDesc->Reference.Offset);
AcpiOsPrintf ("%X ", ObjDesc->Reference.Value);
if (WalkState)
{
ObjDesc = WalkState->Arguments[
ObjDesc->Reference.Offset].Object;
ObjDesc = WalkState->Arguments
[ObjDesc->Reference.Value].Object;
AcpiOsPrintf ("%p", ObjDesc);
AcpiDmDecodeInternalObject (ObjDesc);
}
break;
case AML_DEBUG_OP:
case ACPI_REFCLASS_INDEX:
AcpiOsPrintf ("[Debug] ");
break;
case AML_INDEX_OP:
AcpiOsPrintf ("[Index] ");
switch (ObjDesc->Reference.TargetType)
{
case ACPI_TYPE_BUFFER_FIELD:
AcpiOsPrintf ("%p", ObjDesc->Reference.Object);
AcpiDmDecodeInternalObject (ObjDesc->Reference.Object);
break;
@@ -480,7 +476,7 @@ AcpiDmDisplayInternalObject (
AcpiOsPrintf ("%p", ObjDesc->Reference.Where);
if (!ObjDesc->Reference.Where)
{
AcpiOsPrintf (" Uninitialized WHERE ptr");
AcpiOsPrintf (" Uninitialized WHERE pointer");
}
else
{
@@ -490,25 +486,18 @@ AcpiDmDisplayInternalObject (
break;
default:
AcpiOsPrintf ("Unknown index target type");
break;
}
break;
case AML_LOAD_OP:
AcpiOsPrintf ("[DdbHandle] ");
break;
case AML_REF_OF_OP:
AcpiOsPrintf ("[RefOf] ");
case ACPI_REFCLASS_REFOF:
if (!ObjDesc->Reference.Object)
{
AcpiOsPrintf ("Uninitialized reference subobject ptr");
AcpiOsPrintf ("Uninitialized reference subobject pointer");
break;
}
@@ -529,20 +518,28 @@ AcpiDmDisplayInternalObject (
}
break;
case AML_INT_NAMEPATH_OP:
case ACPI_REFCLASS_NAME:
AcpiDmDecodeNode (ObjDesc->Reference.Node);
break;
default:
AcpiOsPrintf ("Unknown Reference opcode %X (%s)\n",
ObjDesc->Reference.Opcode,
AcpiPsGetOpcodeName (ObjDesc->Reference.Opcode));
case ACPI_REFCLASS_DEBUG:
case ACPI_REFCLASS_TABLE:
AcpiOsPrintf ("\n");
break;
default: /* Unknown reference class */
AcpiOsPrintf ("%2.2X\n", ObjDesc->Reference.Class);
break;
}
break;
default:
AcpiOsPrintf ("<Obj> ");
@@ -555,7 +552,7 @@ AcpiDmDisplayInternalObject (
default:
AcpiOsPrintf ("<Not a valid ACPI Object Descriptor> [%s]",
AcpiUtGetDescriptorName (ObjDesc));
AcpiUtGetDescriptorName (ObjDesc));
break;
}
@@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dmopcode - AML disassembler, specific AML opcodes
* $Revision: 1.106 $
*
******************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -115,6 +114,7 @@
*****************************************************************************/
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdisasm.h"
@@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dmresrc.c - Resource Descriptor disassembly
* $Revision: 1.36 $
*
******************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "amlcode.h"
#include "acdisasm.h"
@@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dmresrcl.c - "Large" Resource Descriptor disassembly
* $Revision: 1.38 $
*
******************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acdisasm.h"
@@ -1026,7 +1026,7 @@ AcpiDmInterruptDescriptor (
*/
AcpiDmResourceSource (Resource,
sizeof (AML_RESOURCE_EXTENDED_IRQ) +
(Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),
((UINT32) Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),
Resource->ExtendedIrq.ResourceLength);
/* Insert a descriptor name */
@@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dmresrcs.c - "Small" Resource Descriptor disassembly
* $Revision: 1.17 $
*
******************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acdisasm.h"
@@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dmutils - AML disassembler utilities
* $Revision: 1.26 $
*
******************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "amlcode.h"
#include "acdisasm.h"
@@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dmwalk - AML disassembly tree walk
* $Revision: 1.35 $
*
******************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdisasm.h"
@@ -148,6 +148,69 @@ static UINT32
AcpiDmBlockType (
ACPI_PARSE_OBJECT *Op);
static const char *
AcpiDmGetObjectTypeName (
ACPI_OBJECT_TYPE Type);
/*
* This table maps ACPI_OBJECT_TYPEs to the corresponding ASL
* ObjectTypeKeyword. Used to generate typed external declarations
*/
static const char *AcpiGbl_DmTypeNames[] =
{
/* 00 */ "", /* Type ANY */
/* 01 */ ", IntObj",
/* 02 */ ", StrObj",
/* 03 */ ", BuffObj",
/* 04 */ ", PkgObj",
/* 05 */ ", FieldUnitObj",
/* 06 */ ", DeviceObj",
/* 07 */ ", EventObj",
/* 08 */ ", MethodObj",
/* 09 */ ", MutexObj",
/* 10 */ ", OpRegionObj",
/* 11 */ ", PowerResObj",
/* 12 */ ", ProcessorObj",
/* 13 */ ", ThermalZoneObj",
/* 14 */ ", BuffFieldObj",
/* 15 */ ", DDBHandleObj",
/* 16 */ "", /* Debug object */
/* 17 */ ", FieldUnitObj",
/* 18 */ ", FieldUnitObj",
/* 19 */ ", FieldUnitObj"
};
/*******************************************************************************
*
* FUNCTION: AcpiDmGetObjectTypeName
*
* PARAMETERS: Type - An ACPI_OBJECT_TYPE
*
* RETURN: Pointer to a string
*
* DESCRIPTION: Map an object type to the ASL object type string.
*
******************************************************************************/
static const char *
AcpiDmGetObjectTypeName (
ACPI_OBJECT_TYPE Type)
{
if (Type == ACPI_TYPE_LOCAL_SCOPE)
{
Type = ACPI_TYPE_DEVICE;
}
else if (Type > ACPI_TYPE_LOCAL_INDEX_FIELD)
{
return ("");
}
return (AcpiGbl_DmTypeNames[Type]);
}
/*******************************************************************************
*
@@ -499,28 +562,9 @@ AcpiDmDescendingOp (
*/
while (AcpiGbl_ExternalList)
{
AcpiOsPrintf (" External (%s",
AcpiGbl_ExternalList->Path);
/* TBD: should be a lookup table */
switch (AcpiGbl_ExternalList->Type)
{
case ACPI_TYPE_DEVICE:
AcpiOsPrintf (", DeviceObj");
break;
case ACPI_TYPE_METHOD:
AcpiOsPrintf (", MethodObj");
break;
case ACPI_TYPE_INTEGER:
AcpiOsPrintf (", IntObj");
break;
default:
break;
}
AcpiOsPrintf (" External (%s%s",
AcpiGbl_ExternalList->Path,
AcpiDmGetObjectTypeName (AcpiGbl_ExternalList->Type));
if (AcpiGbl_ExternalList->Type == ACPI_TYPE_METHOD)
{
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dsfield - Dispatcher field routines
* $Revision: 1.87 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,6 +116,7 @@
#define __DSFIELD_C__
#include "acpi.h"
#include "accommon.h"
#include "amlcode.h"
#include "acdispat.h"
#include "acinterp.h"
@@ -211,9 +211,12 @@ AcpiDsCreateBufferField (
Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
ACPI_NS_ERROR_IF_FOUND;
/* Mark node temporary if we are executing a method */
if (WalkState->MethodNode)
/*
* Mark node temporary if we are executing a normal control
* method. (Don't mark if this is a module-level code method)
*/
if (WalkState->MethodNode &&
!(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
{
Flags |= ACPI_NS_TEMPORARY;
}
@@ -566,9 +569,12 @@ AcpiDsInitFieldObjects (
Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
ACPI_NS_ERROR_IF_FOUND;
/* Mark node(s) temporary if we are executing a method */
if (WalkState->MethodNode)
/*
* Mark node(s) temporary if we are executing a normal control
* method. (Don't mark if this is a module-level code method)
*/
if (WalkState->MethodNode &&
!(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
{
Flags |= ACPI_NS_TEMPORARY;
}
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dsinit - Object initialization namespace walk
* $Revision: 1.29 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,6 +116,7 @@
#define __DSINIT_C__
#include "acpi.h"
#include "accommon.h"
#include "acdispat.h"
#include "acnamesp.h"
#include "actables.h"
@@ -272,12 +272,23 @@ AcpiDsInitializeObjects (
/* Walk entire namespace from the supplied root */
Status = AcpiWalkNamespace (ACPI_TYPE_ANY, StartNode, ACPI_UINT32_MAX,
AcpiDsInitOneObject, &Info, NULL);
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* We don't use AcpiWalkNamespace since we do not want to acquire
* the namespace reader lock.
*/
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, StartNode, ACPI_UINT32_MAX,
ACPI_NS_WALK_UNLOCK, AcpiDsInitOneObject, &Info, NULL);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace"));
}
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
Status = AcpiGetTableByIndex (TableIndex, &Table);
if (ACPI_FAILURE (Status))
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing
* $Revision: 1.140 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,6 +116,7 @@
#define __DSMETHOD_C__
#include "acpi.h"
#include "accommon.h"
#include "amlcode.h"
#include "acdispat.h"
#include "acinterp.h"
@@ -520,6 +520,10 @@ AcpiDsCallControlMethod (
if (ObjDesc->Method.MethodFlags & AML_METHOD_INTERNAL_ONLY)
{
Status = ObjDesc->Method.Implementation (NextWalkState);
if (Status == AE_OK)
{
Status = AE_CTRL_TERMINATE;
}
}
return_ACPI_STATUS (Status);
@@ -689,10 +693,15 @@ AcpiDsTerminateControlMethod (
}
/*
* Delete any namespace objects created anywhere within
* the namespace by the execution of this method
* Delete any namespace objects created anywhere within the
* namespace by the execution of this method. Unless this method
* is a module-level executable code method, in which case we
* want make the objects permanent.
*/
AcpiNsDeleteNamespaceByOwner (MethodDesc->Method.OwnerId);
if (!(MethodDesc->Method.Flags & AOPOBJ_MODULE_LEVEL))
{
AcpiNsDeleteNamespaceByOwner (MethodDesc->Method.OwnerId);
}
}
/* Decrement the thread count on the method */
@@ -741,7 +750,10 @@ AcpiDsTerminateControlMethod (
/* No more threads, we can free the OwnerId */
AcpiUtReleaseOwnerId (&MethodDesc->Method.OwnerId);
if (!(MethodDesc->Method.Flags & AOPOBJ_MODULE_LEVEL))
{
AcpiUtReleaseOwnerId (&MethodDesc->Method.OwnerId);
}
}
return_VOID;
@@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dsmthdat - control method arguments and local variables
* $Revision: 1.94 $
*
******************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,8 +116,8 @@
#define __DSMTHDAT_C__
#include "acpi.h"
#include "accommon.h"
#include "acdispat.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acinterp.h"
@@ -130,13 +129,13 @@
static void
AcpiDsMethodDataDeleteValue (
UINT16 Opcode,
UINT8 Type,
UINT32 Index,
ACPI_WALK_STATE *WalkState);
static ACPI_STATUS
AcpiDsMethodDataSetValue (
UINT16 Opcode,
UINT8 Type,
UINT32 Index,
ACPI_OPERAND_OBJECT *Object,
ACPI_WALK_STATE *WalkState);
@@ -263,8 +262,6 @@ AcpiDsMethodDataDeleteAll (
}
}
AcpiDsClearImplicitReturn (WalkState);
return_VOID;
}
@@ -315,7 +312,7 @@ AcpiDsMethodDataInitArgs (
* Store the argument in the method/walk descriptor.
* Do not copy the arg in order to implement call by reference
*/
Status = AcpiDsMethodDataSetValue (AML_ARG_OP, Index,
Status = AcpiDsMethodDataSetValue (ACPI_REFCLASS_ARG, Index,
Params[Index], WalkState);
if (ACPI_FAILURE (Status))
{
@@ -334,7 +331,8 @@ AcpiDsMethodDataInitArgs (
*
* FUNCTION: AcpiDsMethodDataGetNode
*
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or
* ACPI_REFCLASS_ARG
* Index - Which Local or Arg whose type to get
* WalkState - Current walk state object
* Node - Where the node is returned.
@@ -347,7 +345,7 @@ AcpiDsMethodDataInitArgs (
ACPI_STATUS
AcpiDsMethodDataGetNode (
UINT16 Opcode,
UINT8 Type,
UINT32 Index,
ACPI_WALK_STATE *WalkState,
ACPI_NAMESPACE_NODE **Node)
@@ -358,9 +356,9 @@ AcpiDsMethodDataGetNode (
/*
* Method Locals and Arguments are supported
*/
switch (Opcode)
switch (Type)
{
case AML_LOCAL_OP:
case ACPI_REFCLASS_LOCAL:
if (Index > ACPI_METHOD_MAX_LOCAL)
{
@@ -375,7 +373,7 @@ AcpiDsMethodDataGetNode (
*Node = &WalkState->LocalVariables[Index];
break;
case AML_ARG_OP:
case ACPI_REFCLASS_ARG:
if (Index > ACPI_METHOD_MAX_ARG)
{
@@ -391,8 +389,8 @@ AcpiDsMethodDataGetNode (
break;
default:
ACPI_ERROR ((AE_INFO, "Opcode %d is invalid", Opcode));
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
ACPI_ERROR ((AE_INFO, "Type %d is invalid", Type));
return_ACPI_STATUS (AE_TYPE);
}
return_ACPI_STATUS (AE_OK);
@@ -403,7 +401,8 @@ AcpiDsMethodDataGetNode (
*
* FUNCTION: AcpiDsMethodDataSetValue
*
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or
* ACPI_REFCLASS_ARG
* Index - Which Local or Arg to get
* Object - Object to be inserted into the stack entry
* WalkState - Current walk state object
@@ -417,7 +416,7 @@ AcpiDsMethodDataGetNode (
static ACPI_STATUS
AcpiDsMethodDataSetValue (
UINT16 Opcode,
UINT8 Type,
UINT32 Index,
ACPI_OPERAND_OBJECT *Object,
ACPI_WALK_STATE *WalkState)
@@ -430,13 +429,13 @@ AcpiDsMethodDataSetValue (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"NewObj %p Opcode %X, Refs=%d [%s]\n", Object,
Opcode, Object->Common.ReferenceCount,
"NewObj %p Type %2.2X, Refs=%d [%s]\n", Object,
Type, Object->Common.ReferenceCount,
AcpiUtGetTypeName (Object->Common.Type)));
/* Get the namespace node for the arg/local */
Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
Status = AcpiDsMethodDataGetNode (Type, Index, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -461,7 +460,8 @@ AcpiDsMethodDataSetValue (
*
* FUNCTION: AcpiDsMethodDataGetValue
*
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or
* ACPI_REFCLASS_ARG
* Index - Which localVar or argument to get
* WalkState - Current walk state object
* DestDesc - Where Arg or Local value is returned
@@ -475,7 +475,7 @@ AcpiDsMethodDataSetValue (
ACPI_STATUS
AcpiDsMethodDataGetValue (
UINT16 Opcode,
UINT8 Type,
UINT32 Index,
ACPI_WALK_STATE *WalkState,
ACPI_OPERAND_OBJECT **DestDesc)
@@ -498,7 +498,7 @@ AcpiDsMethodDataGetValue (
/* Get the namespace node for the arg/local */
Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
Status = AcpiDsMethodDataGetNode (Type, Index, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -536,9 +536,9 @@ AcpiDsMethodDataGetValue (
/* Otherwise, return the error */
else switch (Opcode)
else switch (Type)
{
case AML_ARG_OP:
case ACPI_REFCLASS_ARG:
ACPI_ERROR ((AE_INFO,
"Uninitialized Arg[%d] at node %p",
@@ -546,16 +546,17 @@ AcpiDsMethodDataGetValue (
return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
case AML_LOCAL_OP:
ACPI_ERROR ((AE_INFO,
"Uninitialized Local[%d] at node %p",
Index, Node));
case ACPI_REFCLASS_LOCAL:
/*
* No error message for this case, will be trapped again later to
* detect and ignore cases of Store(LocalX,LocalX)
*/
return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
default:
ACPI_ERROR ((AE_INFO, "Not a Arg/Local opcode: %X", Opcode));
ACPI_ERROR ((AE_INFO, "Not a Arg/Local opcode: %X", Type));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
}
@@ -575,7 +576,8 @@ AcpiDsMethodDataGetValue (
*
* FUNCTION: AcpiDsMethodDataDeleteValue
*
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or
* ACPI_REFCLASS_ARG
* Index - Which localVar or argument to delete
* WalkState - Current walk state object
*
@@ -588,7 +590,7 @@ AcpiDsMethodDataGetValue (
static void
AcpiDsMethodDataDeleteValue (
UINT16 Opcode,
UINT8 Type,
UINT32 Index,
ACPI_WALK_STATE *WalkState)
{
@@ -602,7 +604,7 @@ AcpiDsMethodDataDeleteValue (
/* Get the namespace node for the arg/local */
Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
Status = AcpiDsMethodDataGetNode (Type, Index, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
return_VOID;
@@ -638,7 +640,8 @@ AcpiDsMethodDataDeleteValue (
*
* FUNCTION: AcpiDsStoreObjectToLocal
*
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or
* ACPI_REFCLASS_ARG
* Index - Which Local or Arg to set
* ObjDesc - Value to be stored
* WalkState - Current walk state
@@ -653,7 +656,7 @@ AcpiDsMethodDataDeleteValue (
ACPI_STATUS
AcpiDsStoreObjectToLocal (
UINT16 Opcode,
UINT8 Type,
UINT32 Index,
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_WALK_STATE *WalkState)
@@ -665,8 +668,8 @@ AcpiDsStoreObjectToLocal (
ACPI_FUNCTION_TRACE (DsStoreObjectToLocal);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n",
Opcode, Index, ObjDesc));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Type=%2.2X Index=%d Obj=%p\n",
Type, Index, ObjDesc));
/* Parameter validation */
@@ -677,7 +680,7 @@ AcpiDsStoreObjectToLocal (
/* Get the namespace node for the arg/local */
Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
Status = AcpiDsMethodDataGetNode (Type, Index, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -732,7 +735,7 @@ AcpiDsStoreObjectToLocal (
*
* Weird, but true.
*/
if (Opcode == AML_ARG_OP)
if (Type == ACPI_REFCLASS_ARG)
{
/*
* If we have a valid reference object that came from RefOf(),
@@ -740,7 +743,7 @@ AcpiDsStoreObjectToLocal (
*/
if ((ACPI_GET_DESCRIPTOR_TYPE (CurrentObjDesc) == ACPI_DESC_TYPE_OPERAND) &&
(CurrentObjDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
(CurrentObjDesc->Reference.Opcode == AML_REF_OF_OP))
(CurrentObjDesc->Reference.Class == ACPI_REFCLASS_REFOF))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Arg (%p) is an ObjRef(Node), storing in node %p\n",
@@ -765,11 +768,9 @@ AcpiDsStoreObjectToLocal (
}
}
/*
* Delete the existing object
* before storing the new one
*/
AcpiDsMethodDataDeleteValue (Opcode, Index, WalkState);
/* Delete the existing object before storing the new one */
AcpiDsMethodDataDeleteValue (Type, Index, WalkState);
}
/*
@@ -777,7 +778,7 @@ AcpiDsStoreObjectToLocal (
* the descriptor for the Arg or Local.
* (increments the object reference count by one)
*/
Status = AcpiDsMethodDataSetValue (Opcode, Index, NewObjDesc, WalkState);
Status = AcpiDsMethodDataSetValue (Type, Index, NewObjDesc, WalkState);
/* Remove local reference if we copied the object above */
@@ -839,7 +840,7 @@ AcpiDsMethodDataGetType (
/* Get the object type */
return_VALUE (ACPI_GET_OBJECT_TYPE (Object));
return_VALUE (Object->Type);
}
#endif
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
* $Revision: 1.140 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,6 +116,7 @@
#define __DSOBJECT_C__
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdispat.h"
@@ -570,15 +570,28 @@ AcpiDsBuildInternalPackageObj (
{
/*
* NumElements was exhausted, but there are remaining elements in the
* PackageList.
* PackageList. Truncate the package to NumElements.
*
* Note: technically, this is an error, from ACPI spec: "It is an error
* for NumElements to be less than the number of elements in the
* PackageList". However, for now, we just print an error message and
* no exception is returned.
* PackageList". However, we just print an error message and
* no exception is returned. This provides Windows compatibility. Some
* BIOSs will alter the NumElements on the fly, creating this type
* of ill-formed package object.
*/
while (Arg)
{
/*
* We must delete any package elements that were created earlier
* and are not going to be used because of the package truncation.
*/
if (Arg->Common.Node)
{
AcpiUtRemoveReference (
ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node));
Arg->Common.Node = NULL;
}
/* Find out how many elements there really are */
i++;
@@ -586,7 +599,7 @@ AcpiDsBuildInternalPackageObj (
}
ACPI_ERROR ((AE_INFO,
"Package List length (%X) larger than NumElements count (%X), truncated\n",
"Package List length (0x%X) larger than NumElements count (0x%X), truncated\n",
i, ElementCount));
}
else if (i < ElementCount)
@@ -596,7 +609,7 @@ AcpiDsBuildInternalPackageObj (
* Note: this is not an error, the package is padded out with NULLs.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Package List length (%X) smaller than NumElements count (%X), padded with null elements\n",
"Package List length (0x%X) smaller than NumElements count (0x%X), padded with null elements\n",
i, ElementCount));
}
@@ -661,7 +674,7 @@ AcpiDsCreateNode (
/* Re-type the object according to its argument */
Node->Type = ACPI_GET_OBJECT_TYPE (ObjDesc);
Node->Type = ObjDesc->Common.Type;
/* Attach obj to node */
@@ -719,7 +732,7 @@ AcpiDsInitObjectFromOp (
/* Perform per-object initialization */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_BUFFER:
@@ -839,46 +852,59 @@ AcpiDsInitObjectFromOp (
{
case AML_TYPE_LOCAL_VARIABLE:
/* Split the opcode into a base opcode + offset */
/* Local ID (0-7) is (AML opcode - base AML_LOCAL_OP) */
ObjDesc->Reference.Opcode = AML_LOCAL_OP;
ObjDesc->Reference.Offset = Opcode - AML_LOCAL_OP;
ObjDesc->Reference.Value = ((UINT32) Opcode) - AML_LOCAL_OP;
ObjDesc->Reference.Class = ACPI_REFCLASS_LOCAL;
#ifndef ACPI_NO_METHOD_EXECUTION
Status = AcpiDsMethodDataGetNode (AML_LOCAL_OP,
ObjDesc->Reference.Offset,
WalkState,
(ACPI_NAMESPACE_NODE **) &ObjDesc->Reference.Object);
Status = AcpiDsMethodDataGetNode (ACPI_REFCLASS_LOCAL,
ObjDesc->Reference.Value, WalkState,
ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE,
&ObjDesc->Reference.Object));
#endif
break;
case AML_TYPE_METHOD_ARGUMENT:
/* Split the opcode into a base opcode + offset */
/* Arg ID (0-6) is (AML opcode - base AML_ARG_OP) */
ObjDesc->Reference.Opcode = AML_ARG_OP;
ObjDesc->Reference.Offset = Opcode - AML_ARG_OP;
ObjDesc->Reference.Value = ((UINT32) Opcode) - AML_ARG_OP;
ObjDesc->Reference.Class = ACPI_REFCLASS_ARG;
#ifndef ACPI_NO_METHOD_EXECUTION
Status = AcpiDsMethodDataGetNode (AML_ARG_OP,
ObjDesc->Reference.Offset,
WalkState,
(ACPI_NAMESPACE_NODE **) &ObjDesc->Reference.Object);
Status = AcpiDsMethodDataGetNode (ACPI_REFCLASS_ARG,
ObjDesc->Reference.Value, WalkState,
ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE,
&ObjDesc->Reference.Object));
#endif
break;
default: /* Other literals, etc.. */
default: /* Object name or Debug object */
if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
switch (Op->Common.AmlOpcode)
{
case AML_INT_NAMEPATH_OP:
/* Node was saved in Op */
ObjDesc->Reference.Node = Op->Common.Node;
ObjDesc->Reference.Object = Op->Common.Node->Object;
}
ObjDesc->Reference.Class = ACPI_REFCLASS_NAME;
break;
ObjDesc->Reference.Opcode = Opcode;
case AML_DEBUG_OP:
ObjDesc->Reference.Class = ACPI_REFCLASS_DEBUG;
break;
default:
ACPI_ERROR ((AE_INFO,
"Unimplemented reference type for AML opcode: %4.4X", Opcode));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
break;
}
break;
@@ -887,7 +913,7 @@ AcpiDsInitObjectFromOp (
default:
ACPI_ERROR ((AE_INFO, "Unimplemented data type: %X",
ACPI_GET_OBJECT_TYPE (ObjDesc)));
ObjDesc->Common.Type));
Status = AE_AML_OPERAND_TYPE;
break;
@@ -2,7 +2,6 @@
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
* $Revision: 1.115 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,6 +117,7 @@
#define __DSOPCODE_C__
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdispat.h"
@@ -507,28 +507,6 @@ AcpiDsGetRegionArguments (
Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node),
ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Validate the region address/length via the host OS */
Status = AcpiOsValidateAddress (ObjDesc->Region.SpaceId,
ObjDesc->Region.Address, (ACPI_SIZE) ObjDesc->Region.Length);
if (ACPI_FAILURE (Status))
{
/*
* Invalid address/length. We will emit an error message and mark
* the region as invalid, so that it will cause an additional error if
* it is ever used. Then return AE_OK.
*/
ACPI_EXCEPTION ((AE_INFO, Status,
"During address validation of OpRegion [%4.4s]", Node->Name.Ascii));
ObjDesc->Common.Flags |= AOPOBJ_INVALID;
Status = AE_OK;
}
return_ACPI_STATUS (Status);
}
@@ -600,7 +578,7 @@ AcpiDsInitBufferField (
/* Host object must be a Buffer */
if (ACPI_GET_OBJECT_TYPE (BufferDesc) != ACPI_TYPE_BUFFER)
if (BufferDesc->Common.Type != ACPI_TYPE_BUFFER)
{
ACPI_ERROR ((AE_INFO,
"Target of Create Field is not a Buffer object - %s",
@@ -1303,9 +1281,28 @@ AcpiDsExecBeginControlOp (
switch (Op->Common.AmlOpcode)
{
case AML_IF_OP:
case AML_WHILE_OP:
/*
* If this is an additional iteration of a while loop, continue.
* There is no need to allocate a new control state.
*/
if (WalkState->ControlState)
{
if (WalkState->ControlState->Control.AmlPredicateStart ==
(WalkState->ParserState.Aml - 1))
{
/* Reset the state to start-of-loop */
WalkState->ControlState->Common.State = ACPI_CONTROL_CONDITIONAL_EXECUTING;
break;
}
}
/*lint -fallthrough */
case AML_IF_OP:
/*
* IF/WHILE: Create a new control state to manage these
* constructs. We need to manage these as a stack, in order
@@ -1412,21 +1409,41 @@ AcpiDsExecEndControlOp (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", Op));
if (WalkState->ControlState->Common.Value)
ControlState = WalkState->ControlState;
if (ControlState->Common.Value)
{
/* Predicate was true, go back and evaluate it again! */
/* Predicate was true, the body of the loop was just executed */
/*
* This loop counter mechanism allows the interpreter to escape
* possibly infinite loops. This can occur in poorly written AML
* when the hardware does not respond within a while loop and the
* loop does not implement a timeout.
*/
ControlState->Control.LoopCount++;
if (ControlState->Control.LoopCount > ACPI_MAX_LOOP_ITERATIONS)
{
Status = AE_AML_INFINITE_LOOP;
break;
}
/*
* Go back and evaluate the predicate and maybe execute the loop
* another time
*/
Status = AE_CTRL_PENDING;
WalkState->AmlLastWhile = ControlState->Control.AmlPredicateStart;
break;
}
/* Predicate was false, terminate this while loop */
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"[WHILE_OP] termination! Op=%p\n",Op));
/* Pop this control state and free it */
ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
WalkState->AmlLastWhile = ControlState->Control.AmlPredicateStart;
AcpiUtDeleteGenericState (ControlState);
break;
@@ -1489,8 +1506,8 @@ AcpiDsExecEndControlOp (
* Allow references created by the Index operator to return unchanged.
*/
if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == ACPI_DESC_TYPE_OPERAND) &&
(ACPI_GET_OBJECT_TYPE (WalkState->Results->Results.ObjDesc [0]) == ACPI_TYPE_LOCAL_REFERENCE) &&
((WalkState->Results->Results.ObjDesc [0])->Reference.Opcode != AML_INDEX_OP))
((WalkState->Results->Results.ObjDesc [0])->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
((WalkState->Results->Results.ObjDesc [0])->Reference.Class != ACPI_REFCLASS_INDEX))
{
Status = AcpiExResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState);
if (ACPI_FAILURE (Status))
@@ -1534,12 +1551,20 @@ AcpiDsExecEndControlOp (
case AML_BREAK_POINT_OP:
/* Call up to the OS service layer to handle this */
/*
* Set the single-step flag. This will cause the debugger (if present)
* to break to the console within the AML debugger at the start of the
* next AML instruction.
*/
ACPI_DEBUGGER_EXEC (
AcpiGbl_CmSingleStep = TRUE);
ACPI_DEBUGGER_EXEC (
AcpiOsPrintf ("**break** Executed AML BreakPoint opcode\n"));
Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT, "Executed AML Breakpoint opcode");
/* If and when it returns, all done. */
/* Call to the OSL in case OS wants a piece of the action */
Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT,
"Executed AML Breakpoint opcode");
break;
@@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dsutils - Dispatcher utilities
* $Revision: 1.127 $
*
******************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,6 +116,7 @@
#define __DSUTILS_C__
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdispat.h"
@@ -953,7 +953,7 @@ AcpiDsEvaluateNamePath (
goto PushResult;
}
Type = ACPI_GET_OBJECT_TYPE (*Operand);
Type = (*Operand)->Common.Type;
Status = AcpiExResolveToValue (Operand, WalkState);
if (ACPI_FAILURE (Status))
@@ -2,7 +2,6 @@
*
* Module Name: dswexec - Dispatcher method execution callbacks;
* dispatch to interpreter.
* $Revision: 1.138 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,6 +117,7 @@
#define __DSWEXEC_C__
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdispat.h"
@@ -224,11 +224,11 @@ AcpiDsGetPredicateValue (
goto Cleanup;
}
if (ACPI_GET_OBJECT_TYPE (LocalObjDesc) != ACPI_TYPE_INTEGER)
if (LocalObjDesc->Common.Type != ACPI_TYPE_INTEGER)
{
ACPI_ERROR ((AE_INFO,
"Bad predicate (not an integer) ObjDesc=%p State=%p Type=%X",
ObjDesc, WalkState, ACPI_GET_OBJECT_TYPE (ObjDesc)));
ObjDesc, WalkState, ObjDesc->Common.Type));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
@@ -256,6 +256,10 @@ AcpiDsGetPredicateValue (
Status = AE_CTRL_FALSE;
}
/* Predicate can be used for an implicit return value */
(void) AcpiDsDoImplicitReturn (LocalObjDesc, WalkState, TRUE);
Cleanup:
@@ -536,10 +540,10 @@ AcpiDsExecEndOp (
(WalkState->Opcode == AML_STORE_OP) &&
(WalkState->Operands[0]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
(WalkState->Operands[1]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
(WalkState->Operands[0]->Reference.Opcode ==
WalkState->Operands[1]->Reference.Opcode) &&
(WalkState->Operands[0]->Reference.Offset ==
WalkState->Operands[1]->Reference.Offset))
(WalkState->Operands[0]->Reference.Class ==
WalkState->Operands[1]->Reference.Class) &&
(WalkState->Operands[0]->Reference.Value ==
WalkState->Operands[1]->Reference.Value))
{
Status = AE_OK;
}
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
* $Revision: 1.120 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,6 +116,7 @@
#define __DSWLOAD_C__
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdispat.h"
@@ -672,20 +672,6 @@ AcpiDsLoad2BeginOp (
(WalkState->Opcode != AML_INT_NAMEPATH_OP)) ||
(!(WalkState->OpInfo->Flags & AML_NAMED)))
{
#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE
if ((WalkState->OpInfo->Class == AML_CLASS_EXECUTE) ||
(WalkState->OpInfo->Class == AML_CLASS_CONTROL))
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Begin/EXEC: %s (fl %8.8X)\n", WalkState->OpInfo->Name,
WalkState->OpInfo->Flags));
/* Executing a type1 or type2 opcode outside of a method */
Status = AcpiDsExecBeginOp (WalkState, OutOp);
return_ACPI_STATUS (Status);
}
#endif
return_ACPI_STATUS (AE_OK);
}
@@ -862,7 +848,12 @@ AcpiDsLoad2BeginOp (
{
/* Execution mode, node cannot already exist, node is temporary */
Flags |= (ACPI_NS_ERROR_IF_FOUND | ACPI_NS_TEMPORARY);
Flags |= ACPI_NS_ERROR_IF_FOUND;
if (!(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
{
Flags |= ACPI_NS_TEMPORARY;
}
}
/* Add new entry or lookup existing entry */
@@ -952,24 +943,6 @@ AcpiDsLoad2EndOp (
if (!(WalkState->OpInfo->Flags & AML_NSOBJECT))
{
#ifndef ACPI_NO_METHOD_EXECUTION
#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE
/* No namespace object. Executable opcode? */
if ((WalkState->OpInfo->Class == AML_CLASS_EXECUTE) ||
(WalkState->OpInfo->Class == AML_CLASS_CONTROL))
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"End/EXEC: %s (fl %8.8X)\n", WalkState->OpInfo->Name,
WalkState->OpInfo->Flags));
/* Executing a type1 or type2 opcode outside of a method */
Status = AcpiDsExecEndOp (WalkState);
return_ACPI_STATUS (Status);
}
#endif
#endif
return_ACPI_STATUS (AE_OK);
}
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dswscope - Scope stack manipulation
* $Revision: 1.70 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,6 +116,7 @@
#define __DSWSCOPE_C__
#include "acpi.h"
#include "accommon.h"
#include "acdispat.h"
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dswstate - Dispatcher parse tree walk management routines
* $Revision: 1.105 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,6 +117,7 @@
#define __DSWSTATE_C__
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "acdispat.h"
#include "acnamesp.h"
@@ -189,7 +189,7 @@ AcpiDsResultPop (
/* Return object of the top element and clean that top element result stack */
WalkState->ResultCount--;
Index = WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM;
Index = (UINT32) WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM;
*Object = State->Results.ObjDesc [Index];
if (!*Object)
@@ -284,7 +284,7 @@ AcpiDsResultPush (
/* Assign the address of object to the top free element of result stack */
Index = WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM;
Index = (UINT32) WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM;
State->Results.ObjDesc [Index] = Object;
WalkState->ResultCount++;
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: evevent - Fixed Event handling and dispatch
* $Revision: 1.127 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -115,6 +114,7 @@
*****************************************************************************/
#include "acpi.h"
#include "accommon.h"
#include "acevents.h"
#define _COMPONENT ACPI_EVENTS
@@ -155,8 +155,8 @@ AcpiEvInitializeEvents (
/*
* Initialize the Fixed and General Purpose Events. This is done prior to
* enabling SCIs to prevent interrupts from occurring before the handlers are
* installed.
* enabling SCIs to prevent interrupts from occurring before the handlers
* are installed.
*/
Status = AcpiEvFixedEventInitialize ();
if (ACPI_FAILURE (Status))
@@ -281,7 +281,7 @@ AcpiEvInstallXruptHandlers (
*
* RETURN: Status
*
* DESCRIPTION: Install the fixed event handlers and enable the fixed events.
* DESCRIPTION: Install the fixed event handlers and disable all fixed events.
*
******************************************************************************/
@@ -294,20 +294,21 @@ AcpiEvFixedEventInitialize (
/*
* Initialize the structure that keeps track of fixed event handlers
* and enable the fixed events.
* Initialize the structure that keeps track of fixed event handlers and
* enable the fixed events.
*/
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
{
AcpiGbl_FixedEventHandlers[i].Handler = NULL;
AcpiGbl_FixedEventHandlers[i].Context = NULL;
/* Enable the fixed event */
/* Disable the fixed event */
if (AcpiGbl_FixedEventInfo[i].EnableRegisterId != 0xFF)
{
Status = AcpiSetRegister (
AcpiGbl_FixedEventInfo[i].EnableRegisterId, 0);
Status = AcpiWriteBitRegister (
AcpiGbl_FixedEventInfo[i].EnableRegisterId,
ACPI_DISABLE_EVENT);
if (ACPI_FAILURE (Status))
{
return (Status);
@@ -346,7 +347,7 @@ AcpiEvFixedEventDetect (
/*
* Read the fixed feature status and enable registers, as all the cases
* depend on their values. Ignore errors here.
* depend on their values. Ignore errors here.
*/
(void) AcpiHwRegisterRead (ACPI_REGISTER_PM1_STATUS, &FixedStatus);
(void) AcpiHwRegisterRead (ACPI_REGISTER_PM1_ENABLE, &FixedEnable);
@@ -399,15 +400,19 @@ AcpiEvFixedEventDispatch (
/* Clear the status bit */
(void) AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId, 1);
(void) AcpiWriteBitRegister (
AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
ACPI_CLEAR_STATUS);
/*
* Make sure we've got a handler. If not, report an error.
* The event is disabled to prevent further interrupts.
* Make sure we've got a handler. If not, report an error. The event is
* disabled to prevent further interrupts.
*/
if (NULL == AcpiGbl_FixedEventHandlers[Event].Handler)
{
(void) AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, 0);
(void) AcpiWriteBitRegister (
AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
ACPI_DISABLE_EVENT);
ACPI_ERROR ((AE_INFO,
"No installed handler for fixed event [%08X]",
@@ -419,7 +424,7 @@ AcpiEvFixedEventDispatch (
/* Invoke the Fixed Event handler */
return ((AcpiGbl_FixedEventHandlers[Event].Handler)(
AcpiGbl_FixedEventHandlers[Event].Context));
AcpiGbl_FixedEventHandlers[Event].Context));
}
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: evgpe - General Purpose Event handling and dispatch
* $Revision: 1.72 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -115,6 +114,7 @@
*****************************************************************************/
#include "acpi.h"
#include "accommon.h"
#include "acevents.h"
#include "acnamesp.h"
@@ -173,10 +173,10 @@ AcpiEvSetGpeType (
Status = AcpiEvDisableGpe (GpeEventInfo);
/* Type was validated above */
/* Clear the type bits and insert the new Type */
GpeEventInfo->Flags &= ~ACPI_GPE_TYPE_MASK; /* Clear type bits */
GpeEventInfo->Flags |= Type; /* Insert type */
GpeEventInfo->Flags &= ~ACPI_GPE_TYPE_MASK;
GpeEventInfo->Flags |= Type;
return_ACPI_STATUS (Status);
}
@@ -212,10 +212,11 @@ AcpiEvUpdateGpeEnableMasks (
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
RegisterBit = (UINT8)
(1 << (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber));
/* 1) Disable case. Simply clear all enable bits */
/* 1) Disable case. Simply clear all enable bits */
if (Type == ACPI_GPE_DISABLE)
{
@@ -224,7 +225,7 @@ AcpiEvUpdateGpeEnableMasks (
return_ACPI_STATUS (AE_OK);
}
/* 2) Enable case. Set/Clear the appropriate enable bits */
/* 2) Enable case. Set/Clear the appropriate enable bits */
switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK)
{
@@ -406,10 +407,10 @@ AcpiEvDisableGpe (
*
* FUNCTION: AcpiEvGetGpeEventInfo
*
* PARAMETERS: GpeDevice - Device node. NULL for GPE0/GPE1
* PARAMETERS: GpeDevice - Device node. NULL for GPE0/GPE1
* GpeNumber - Raw GPE number
*
* RETURN: A GPE EventInfo struct. NULL if not a valid GPE
* RETURN: A GPE EventInfo struct. NULL if not a valid GPE
*
* DESCRIPTION: Returns the EventInfo struct associated with this GPE.
* Validates the GpeBlock and the GpeNumber
@@ -488,7 +489,7 @@ AcpiEvGetGpeEventInfo (
*
* RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
*
* DESCRIPTION: Detect if any GP events have occurred. This function is
* DESCRIPTION: Detect if any GP events have occurred. This function is
* executed at interrupt level.
*
******************************************************************************/
@@ -520,8 +521,8 @@ AcpiEvGpeDetect (
/*
* We need to obtain the GPE lock for both the data structs and registers
* Note: Not necessary to obtain the hardware lock, since the GPE registers
* are owned by the GpeLock.
* Note: Not necessary to obtain the hardware lock, since the GPE
* registers are owned by the GpeLock.
*/
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
@@ -531,9 +532,8 @@ AcpiEvGpeDetect (
while (GpeBlock)
{
/*
* Read all of the 8-bit GPE status and enable registers
* in this GPE block, saving all of them.
* Find all currently active GP events.
* Read all of the 8-bit GPE status and enable registers in this GPE
* block, saving all of them. Find all currently active GP events.
*/
for (i = 0; i < GpeBlock->RegisterCount; i++)
{
@@ -543,8 +543,7 @@ AcpiEvGpeDetect (
/* Read the Status Register */
Status = AcpiHwLowLevelRead (ACPI_GPE_REGISTER_WIDTH, &StatusReg,
&GpeRegisterInfo->StatusAddress);
Status = AcpiHwRead (&StatusReg, &GpeRegisterInfo->StatusAddress);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
@@ -552,8 +551,7 @@ AcpiEvGpeDetect (
/* Read the Enable Register */
Status = AcpiHwLowLevelRead (ACPI_GPE_REGISTER_WIDTH, &EnableReg,
&GpeRegisterInfo->EnableAddress);
Status = AcpiHwRead (&EnableReg, &GpeRegisterInfo->EnableAddress);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
@@ -586,7 +584,8 @@ AcpiEvGpeDetect (
* or method.
*/
IntStatus |= AcpiEvGpeDispatch (
&GpeBlock->EventInfo[((ACPI_SIZE) i * ACPI_GPE_REGISTER_WIDTH) + j],
&GpeBlock->EventInfo[((ACPI_SIZE) i *
ACPI_GPE_REGISTER_WIDTH) + j],
j + GpeRegisterInfo->BaseGpeNumber);
}
}
@@ -660,8 +659,8 @@ AcpiEvAsynchExecuteGpeMethod (
(void) AcpiEvEnableGpe (GpeEventInfo, FALSE);
/*
* Take a snapshot of the GPE info for this level - we copy the
* info to prevent a race condition with RemoveHandler/RemoveBlock.
* Take a snapshot of the GPE info for this level - we copy the info to
* prevent a race condition with RemoveHandler/RemoveBlock.
*/
ACPI_MEMCPY (LocalGpeEventInfo, GpeEventInfo,
sizeof (ACPI_GPE_EVENT_INFO));
@@ -673,8 +672,8 @@ AcpiEvAsynchExecuteGpeMethod (
}
/*
* Must check for control method type dispatch one more
* time to avoid race with EvGpeInstallHandler
* Must check for control method type dispatch one more time to avoid a
* race with EvGpeInstallHandler
*/
if ((LocalGpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_METHOD)
@@ -744,8 +743,8 @@ AcpiEvAsynchEnableGpe (
ACPI_GPE_LEVEL_TRIGGERED)
{
/*
* GPE is level-triggered, we clear the GPE status bit after
* handling the event.
* GPE is level-triggered, we clear the GPE status bit after handling
* the event.
*/
Status = AcpiHwClearGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
@@ -794,7 +793,7 @@ AcpiEvGpeDispatch (
AcpiGpeCount++;
/*
* If edge-triggered, clear the GPE status bit now. Note that
* If edge-triggered, clear the GPE status bit now. Note that
* level-triggered events are cleared after the GPE is serviced.
*/
if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
@@ -809,18 +808,6 @@ AcpiEvGpeDispatch (
}
}
if (!AcpiGbl_SystemAwakeAndRunning)
{
/*
* We just woke up because of a wake GPE. Disable any further GPEs
* until we are fully up and running (Only wake GPEs should be enabled
* at this time, but we just brute-force disable them all.)
* 1) We must disable this particular wake GPE so it won't fire again
* 2) We want to disable all wake GPEs, since we are now awake
*/
(void) AcpiHwDisableAllGpes ();
}
/*
* Dispatch the GPE to either an installed handler, or the control method
* associated with this GPE (_Lxx or _Exx). If a handler exists, we invoke
@@ -834,7 +821,8 @@ AcpiEvGpeDispatch (
/*
* Invoke the installed handler (at interrupt level)
* Ignore return status for now. TBD: leave GPE disabled on error?
* Ignore return status for now.
* TBD: leave GPE disabled on error?
*/
(void) GpeEventInfo->Dispatch.Handler->Address (
GpeEventInfo->Dispatch.Handler->Context);
@@ -891,7 +879,7 @@ AcpiEvGpeDispatch (
GpeNumber));
/*
* Disable the GPE. The GPE will remain disabled until the ACPI
* Disable the GPE. The GPE will remain disabled until the ACPICA
* Core Subsystem is restarted, or a handler is installed.
*/
Status = AcpiEvDisableGpe (GpeEventInfo);
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: evgpeblk - GPE block creation and initialization.
* $Revision: 1.62 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -115,6 +114,7 @@
*****************************************************************************/
#include "acpi.h"
#include "accommon.h"
#include "acevents.h"
#include "acnamesp.h"
@@ -194,7 +194,8 @@ AcpiEvValidGpeEvent (
while (GpeBlock)
{
if ((&GpeBlock->EventInfo[0] <= GpeEventInfo) &&
(&GpeBlock->EventInfo[((ACPI_SIZE) GpeBlock->RegisterCount) * 8] > GpeEventInfo))
(&GpeBlock->EventInfo[((ACPI_SIZE)
GpeBlock->RegisterCount) * 8] > GpeEventInfo))
{
return (TRUE);
}
@@ -214,6 +215,7 @@ AcpiEvValidGpeEvent (
* FUNCTION: AcpiEvWalkGpeList
*
* PARAMETERS: GpeWalkCallback - Routine called for each GPE block
* Context - Value passed to callback
*
* RETURN: Status
*
@@ -223,7 +225,8 @@ AcpiEvValidGpeEvent (
ACPI_STATUS
AcpiEvWalkGpeList (
ACPI_GPE_CALLBACK GpeWalkCallback)
ACPI_GPE_CALLBACK GpeWalkCallback,
void *Context)
{
ACPI_GPE_BLOCK_INFO *GpeBlock;
ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
@@ -248,9 +251,13 @@ AcpiEvWalkGpeList (
{
/* One callback per GPE block */
Status = GpeWalkCallback (GpeXruptInfo, GpeBlock);
Status = GpeWalkCallback (GpeXruptInfo, GpeBlock, Context);
if (ACPI_FAILURE (Status))
{
if (Status == AE_CTRL_END) /* Callback abort */
{
Status = AE_OK;
}
goto UnlockAndExit;
}
@@ -283,7 +290,8 @@ UnlockAndExit:
ACPI_STATUS
AcpiEvDeleteGpeHandlers (
ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
ACPI_GPE_BLOCK_INFO *GpeBlock)
ACPI_GPE_BLOCK_INFO *GpeBlock,
void *Context)
{
ACPI_GPE_EVENT_INFO *GpeEventInfo;
UINT32 i;
@@ -301,7 +309,8 @@ AcpiEvDeleteGpeHandlers (
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
{
GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i * ACPI_GPE_REGISTER_WIDTH) + j];
GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i *
ACPI_GPE_REGISTER_WIDTH) + j];
if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_HANDLER)
@@ -387,7 +396,8 @@ AcpiEvSaveMethodInfo (
/* Unknown method type, just ignore it! */
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
"Ignoring unknown GPE method type: %s (name not of form _Lxx or _Exx)",
"Ignoring unknown GPE method type: %s "
"(name not of form _Lxx or _Exx)",
Name));
return_ACPI_STATUS (AE_OK);
}
@@ -400,7 +410,8 @@ AcpiEvSaveMethodInfo (
/* Conversion failed; invalid method, just ignore it */
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
"Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)",
"Could not extract GPE number from name: %s "
"(name is not of form _Lxx or _Exx)",
Name));
return_ACPI_STATUS (AE_OK);
}
@@ -408,20 +419,21 @@ AcpiEvSaveMethodInfo (
/* Ensure that we have a valid GPE number for this GPE block */
if ((GpeNumber < GpeBlock->BlockBaseNumber) ||
(GpeNumber >= (GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8))))
(GpeNumber >= (GpeBlock->BlockBaseNumber +
(GpeBlock->RegisterCount * 8))))
{
/*
* Not valid for this GPE block, just ignore it
* However, it may be valid for a different GPE block, since GPE0 and GPE1
* methods both appear under \_GPE.
* Not valid for this GPE block, just ignore it. However, it may be
* valid for a different GPE block, since GPE0 and GPE1 methods both
* appear under \_GPE.
*/
return_ACPI_STATUS (AE_OK);
}
/*
* Now we can add this information to the GpeEventInfo block
* for use during dispatch of this GPE. Default type is RUNTIME, although
* this may change when the _PRW methods are executed later.
* Now we can add this information to the GpeEventInfo block for use
* during dispatch of this GPE. Default type is RUNTIME, although this may
* change when the _PRW methods are executed later.
*/
GpeEventInfo = &GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber];
@@ -501,12 +513,12 @@ AcpiEvMatchPrwAndGpe (
GpeBlock = GpeInfo->GpeBlock;
/*
* The _PRW object must return a package, we are only interested
* in the first element
* The _PRW object must return a package, we are only interested in the
* first element
*/
ObjDesc = PkgDesc->Package.Elements[0];
if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER)
{
/* Use FADT-defined GPE device (from definition of _PRW) */
@@ -516,13 +528,15 @@ AcpiEvMatchPrwAndGpe (
GpeNumber = (UINT32) ObjDesc->Integer.Value;
}
else if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_PACKAGE)
else if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE)
{
/* Package contains a GPE reference and GPE number within a GPE block */
if ((ObjDesc->Package.Count < 2) ||
(ACPI_GET_OBJECT_TYPE (ObjDesc->Package.Elements[0]) != ACPI_TYPE_LOCAL_REFERENCE) ||
(ACPI_GET_OBJECT_TYPE (ObjDesc->Package.Elements[1]) != ACPI_TYPE_INTEGER))
((ObjDesc->Package.Elements[0])->Common.Type !=
ACPI_TYPE_LOCAL_REFERENCE) ||
((ObjDesc->Package.Elements[1])->Common.Type !=
ACPI_TYPE_INTEGER))
{
goto Cleanup;
}
@@ -542,16 +556,18 @@ AcpiEvMatchPrwAndGpe (
/*
* Is this GPE within this block?
*
* TRUE iff these conditions are true:
* TRUE if and only if these conditions are true:
* 1) The GPE devices match.
* 2) The GPE index(number) is within the range of the Gpe Block
* associated with the GPE device.
*/
if ((GpeDevice == TargetGpeDevice) &&
(GpeNumber >= GpeBlock->BlockBaseNumber) &&
(GpeNumber < GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8)))
(GpeNumber < GpeBlock->BlockBaseNumber +
(GpeBlock->RegisterCount * 8)))
{
GpeEventInfo = &GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber];
GpeEventInfo = &GpeBlock->EventInfo[GpeNumber -
GpeBlock->BlockBaseNumber];
/* Mark GPE for WAKE-ONLY but WAKE_DISABLED */
@@ -562,6 +578,7 @@ AcpiEvMatchPrwAndGpe (
{
goto Cleanup;
}
Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo, ACPI_GPE_DISABLE);
}
@@ -580,9 +597,9 @@ Cleanup:
* RETURN: A GPE interrupt block
*
* DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt
* block per unique interrupt level used for GPEs.
* Should be called only when the GPE lists are semaphore locked
* and not subject to change.
* block per unique interrupt level used for GPEs. Should be
* called only when the GPE lists are semaphore locked and not
* subject to change.
*
******************************************************************************/
@@ -733,8 +750,9 @@ AcpiEvDeleteGpeXrupt (
*
* FUNCTION: AcpiEvInstallGpeBlock
*
* PARAMETERS: GpeBlock - New GPE block
* InterruptNumber - Xrupt to be associated with this GPE block
* PARAMETERS: GpeBlock - New GPE block
* InterruptNumber - Xrupt to be associated with this
* GPE block
*
* RETURN: Status
*
@@ -802,7 +820,7 @@ UnlockAndExit:
*
* FUNCTION: AcpiEvDeleteGpeBlock
*
* PARAMETERS: GpeBlock - Existing GPE block
* PARAMETERS: GpeBlock - Existing GPE block
*
* RETURN: Status
*
@@ -829,7 +847,7 @@ AcpiEvDeleteGpeBlock (
/* Disable all GPEs in this block */
Status = AcpiHwDisableGpeBlock (GpeBlock->XruptBlock, GpeBlock);
Status = AcpiHwDisableGpeBlock (GpeBlock->XruptBlock, GpeBlock, NULL);
if (!GpeBlock->Previous && !GpeBlock->Next)
{
@@ -862,6 +880,8 @@ AcpiEvDeleteGpeBlock (
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
}
AcpiCurrentGpeCount -= GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH;
/* Free the GpeBlock */
ACPI_FREE (GpeBlock->RegisterInfo);
@@ -937,9 +957,9 @@ AcpiEvCreateGpeInfoBlocks (
/*
* Initialize the GPE Register and Event structures. A goal of these
* tables is to hide the fact that there are two separate GPE register sets
* in a given GPE hardware block, the status registers occupy the first half,
* and the enable registers occupy the second half.
* tables is to hide the fact that there are two separate GPE register
* sets in a given GPE hardware block, the status registers occupy the
* first half, and the enable registers occupy the second half.
*/
ThisRegister = GpeRegisterInfo;
ThisEvent = GpeEventInfo;
@@ -961,8 +981,8 @@ AcpiEvCreateGpeInfoBlocks (
ThisRegister->EnableAddress.SpaceId = GpeBlock->BlockAddress.SpaceId;
ThisRegister->StatusAddress.BitWidth = ACPI_GPE_REGISTER_WIDTH;
ThisRegister->EnableAddress.BitWidth = ACPI_GPE_REGISTER_WIDTH;
ThisRegister->StatusAddress.BitOffset = ACPI_GPE_REGISTER_WIDTH;
ThisRegister->EnableAddress.BitOffset = ACPI_GPE_REGISTER_WIDTH;
ThisRegister->StatusAddress.BitOffset = 0;
ThisRegister->EnableAddress.BitOffset = 0;
/* Init the EventInfo for each GPE within this register */
@@ -975,8 +995,7 @@ AcpiEvCreateGpeInfoBlocks (
/* Disable all GPEs within this register */
Status = AcpiHwLowLevelWrite (ACPI_GPE_REGISTER_WIDTH, 0x00,
&ThisRegister->EnableAddress);
Status = AcpiHwWrite (0x00, &ThisRegister->EnableAddress);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
@@ -984,8 +1003,7 @@ AcpiEvCreateGpeInfoBlocks (
/* Clear any pending GPE events within this register */
Status = AcpiHwLowLevelWrite (ACPI_GPE_REGISTER_WIDTH, 0xFF,
&ThisRegister->StatusAddress);
Status = AcpiHwWrite (0xFF, &ThisRegister->StatusAddress);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
@@ -1110,6 +1128,9 @@ AcpiEvCreateGpeBlock (
GpeBlock->RegisterCount,
InterruptNumber));
/* Update global count of currently available GPEs */
AcpiCurrentGpeCount += RegisterCount * ACPI_GPE_REGISTER_WIDTH;
return_ACPI_STATUS (AE_OK);
}
@@ -1179,8 +1200,8 @@ AcpiEvInitializeGpeBlock (
* 1) are "runtime" or "run/wake" GPEs, and
* 2) have a corresponding _Lxx or _Exx method
*
* Any other GPEs within this block must be enabled via the AcpiEnableGpe()
* external interface.
* Any other GPEs within this block must be enabled via the
* AcpiEnableGpe() external interface.
*/
WakeGpeCount = 0;
GpeEnabledCount = 0;
@@ -1191,9 +1212,11 @@ AcpiEvInitializeGpeBlock (
{
/* Get the info block for this particular GPE */
GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i * ACPI_GPE_REGISTER_WIDTH) + j];
GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i *
ACPI_GPE_REGISTER_WIDTH) + j];
if (((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_METHOD) &&
if (((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_METHOD) &&
(GpeEventInfo->Flags & ACPI_GPE_TYPE_RUNTIME))
{
GpeEnabledCount++;
@@ -1212,7 +1235,7 @@ AcpiEvInitializeGpeBlock (
/* Enable all valid runtime GPEs found above */
Status = AcpiHwEnableRuntimeGpeBlock (NULL, GpeBlock);
Status = AcpiHwEnableRuntimeGpeBlock (NULL, GpeBlock, NULL);
if (ACPI_FAILURE (Status))
{
ACPI_ERROR ((AE_INFO, "Could not enable GPEs in GpeBlock %p",
@@ -1257,8 +1280,8 @@ AcpiEvGpeInitialize (
/*
* Initialize the GPE Block(s) defined in the FADT
*
* Why the GPE register block lengths are divided by 2: From the ACPI Spec,
* section "General-Purpose Event Registers", we have:
* Why the GPE register block lengths are divided by 2: From the ACPI
* Spec, section "General-Purpose Event Registers", we have:
*
* "Each register block contains two registers of equal length
* GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the
@@ -1314,7 +1337,8 @@ AcpiEvGpeInitialize (
(GpeNumberMax >= AcpiGbl_FADT.Gpe1Base))
{
ACPI_ERROR ((AE_INFO,
"GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1",
"GPE0 block (GPE 0 to %d) overlaps the GPE1 block "
"(GPE %d to %d) - Ignoring GPE1",
GpeNumberMax, AcpiGbl_FADT.Gpe1Base,
AcpiGbl_FADT.Gpe1Base +
((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1)));
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: evmisc - Miscellaneous event manager support functions
* $Revision: 1.109 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -115,6 +114,7 @@
*****************************************************************************/
#include "acpi.h"
#include "accommon.h"
#include "acevents.h"
#include "acnamesp.h"
#include "acinterp.h"
@@ -123,10 +123,6 @@
ACPI_MODULE_NAME ("evmisc")
/* Pointer to FACS needed for the Global Lock */
static ACPI_TABLE_FACS *Facs = NULL;
/* Local prototypes */
static void ACPI_SYSTEM_XFACE
@@ -242,7 +238,9 @@ AcpiEvQueueNotifyRequest (
break;
default:
/* All other types are not supported */
return (AE_TYPE);
}
}
@@ -254,8 +252,10 @@ AcpiEvQueueNotifyRequest (
* 2) Global device notify handler
* 3) Per-device notify handler
*/
if ((AcpiGbl_SystemNotify.Handler && (NotifyValue <= ACPI_MAX_SYS_NOTIFY)) ||
(AcpiGbl_DeviceNotify.Handler && (NotifyValue > ACPI_MAX_SYS_NOTIFY)) ||
if ((AcpiGbl_SystemNotify.Handler &&
(NotifyValue <= ACPI_MAX_SYS_NOTIFY)) ||
(AcpiGbl_DeviceNotify.Handler &&
(NotifyValue > ACPI_MAX_SYS_NOTIFY)) ||
HandlerObj)
{
NotifyInfo = AcpiUtCreateGenericState ();
@@ -267,7 +267,8 @@ AcpiEvQueueNotifyRequest (
if (!HandlerObj)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Executing system notify handler for Notify (%4.4s, %X) node %p\n",
"Executing system notify handler for Notify (%4.4s, %X) "
"node %p\n",
AcpiUtGetNodeName (Node), NotifyValue, Node));
}
@@ -285,9 +286,8 @@ AcpiEvQueueNotifyRequest (
}
else
{
/*
* There is no notify handler (per-device or system) for this device.
*/
/* There is no notify handler (per-device or system) for this device */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"No notify handler for Notify (%4.4s, %X) node %p\n",
AcpiUtGetNodeName (Node), NotifyValue, Node));
@@ -324,9 +324,8 @@ AcpiEvNotifyDispatch (
/*
* We will invoke a global notify handler if installed.
* This is done _before_ we invoke the per-device handler attached
* to the device.
* We will invoke a global notify handler if installed. This is done
* _before_ we invoke the per-device handler attached to the device.
*/
if (NotifyInfo->Notify.Value <= ACPI_MAX_SYS_NOTIFY)
{
@@ -405,7 +404,7 @@ AcpiEvGlobalLockHandler (
* If we don't get it now, it will be marked pending and we will
* take another interrupt when it becomes free.
*/
ACPI_ACQUIRE_GLOBAL_LOCK (Facs, Acquired);
ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_FACS, Acquired);
if (Acquired)
{
/* Got the lock, now wake the thread waiting for it */
@@ -447,23 +446,16 @@ AcpiEvInitGlobalLockHandler (
ACPI_FUNCTION_TRACE (EvInitGlobalLockHandler);
Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS,
ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs));
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Attempt installation of the global lock handler */
AcpiGbl_GlobalLockPresent = TRUE;
Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL,
AcpiEvGlobalLockHandler, NULL);
/*
* If the global lock does not exist on this platform, the attempt
* to enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick)
* Map to AE_OK, but mark global lock as not present.
* Any attempt to actually use the global lock will be flagged
* with an error.
* If the global lock does not exist on this platform, the attempt to
* enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick).
* Map to AE_OK, but mark global lock as not present. Any attempt to
* actually use the global lock will be flagged with an error.
*/
if (Status == AE_NO_HARDWARE_RESPONSE)
{
@@ -471,9 +463,10 @@ AcpiEvInitGlobalLockHandler (
"No response from Global Lock hardware, disabling lock"));
AcpiGbl_GlobalLockPresent = FALSE;
Status = AE_OK;
return_ACPI_STATUS (AE_OK);
}
AcpiGbl_GlobalLockPresent = TRUE;
return_ACPI_STATUS (Status);
}
@@ -566,8 +559,8 @@ AcpiEvAcquireGlobalLock (
}
/*
* Make sure that a global lock actually exists. If not, just treat
* the lock as a standard mutex.
* Make sure that a global lock actually exists. If not, just treat the
* lock as a standard mutex.
*/
if (!AcpiGbl_GlobalLockPresent)
{
@@ -577,7 +570,7 @@ AcpiEvAcquireGlobalLock (
/* Attempt to acquire the actual hardware lock */
ACPI_ACQUIRE_GLOBAL_LOCK (Facs, Acquired);
ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_FACS, Acquired);
if (Acquired)
{
/* We got the lock */
@@ -641,7 +634,7 @@ AcpiEvReleaseGlobalLock (
{
/* Allow any thread to release the lock */
ACPI_RELEASE_GLOBAL_LOCK (Facs, Pending);
ACPI_RELEASE_GLOBAL_LOCK (AcpiGbl_FACS, Pending);
/*
* If the pending bit was set, we must write GBL_RLS to the control
@@ -649,8 +642,8 @@ AcpiEvReleaseGlobalLock (
*/
if (Pending)
{
Status = AcpiSetRegister (
ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1);
Status = AcpiWriteBitRegister (
ACPI_BITREG_GLOBAL_LOCK_RELEASE, ACPI_ENABLE_EVENT);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Released hardware Global Lock\n"));
@@ -691,8 +684,8 @@ AcpiEvTerminate (
if (AcpiGbl_EventsInitialized)
{
/*
* Disable all event-related functionality.
* In all cases, on error, print a message but obviously we don't abort.
* Disable all event-related functionality. In all cases, on error,
* print a message but obviously we don't abort.
*/
/* Disable all fixed events */
@@ -709,7 +702,7 @@ AcpiEvTerminate (
/* Disable all GPEs in all GPE blocks */
Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock);
Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL);
/* Remove SCI handler */
@@ -730,7 +723,7 @@ AcpiEvTerminate (
/* Deallocate all handler objects installed within GPE info structs */
Status = AcpiEvWalkGpeList (AcpiEvDeleteGpeHandlers);
Status = AcpiEvWalkGpeList (AcpiEvDeleteGpeHandlers, NULL);
/* Return to original mode if necessary */
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: evregion - ACPI AddressSpace (OpRegion) handler dispatch
* $Revision: 1.171 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,6 +117,7 @@
#define __EVREGION_C__
#include "acpi.h"
#include "accommon.h"
#include "acevents.h"
#include "acnamesp.h"
#include "acinterp.h"
@@ -125,15 +125,6 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evregion")
#define ACPI_NUM_DEFAULT_SPACES 4
static UINT8 AcpiGbl_DefaultAddressSpaces[ACPI_NUM_DEFAULT_SPACES] =
{
ACPI_ADR_SPACE_SYSTEM_MEMORY,
ACPI_ADR_SPACE_SYSTEM_IO,
ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_ADR_SPACE_DATA_TABLE
};
/* Local prototypes */
@@ -151,6 +142,18 @@ AcpiEvInstallHandler (
void *Context,
void **ReturnValue);
/* These are the address spaces that will get default handlers */
#define ACPI_NUM_DEFAULT_SPACES 4
static UINT8 AcpiGbl_DefaultAddressSpaces[ACPI_NUM_DEFAULT_SPACES] =
{
ACPI_ADR_SPACE_SYSTEM_MEMORY,
ACPI_ADR_SPACE_SYSTEM_IO,
ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_ADR_SPACE_DATA_TABLE
};
/*******************************************************************************
*
@@ -182,18 +185,19 @@ AcpiEvInstallRegionHandlers (
}
/*
* All address spaces (PCI Config, EC, SMBus) are scope dependent
* and registration must occur for a specific device.
* All address spaces (PCI Config, EC, SMBus) are scope dependent and
* registration must occur for a specific device.
*
* In the case of the system memory and IO address spaces there is currently
* no device associated with the address space. For these we use the root.
* In the case of the system memory and IO address spaces there is
* currently no device associated with the address space. For these we
* use the root.
*
* We install the default PCI config space handler at the root so
* that this space is immediately available even though the we have
* not enumerated all the PCI Root Buses yet. This is to conform
* to the ACPI specification which states that the PCI config
* space must be always available -- even though we are nowhere
* near ready to find the PCI root buses at this point.
* We install the default PCI config space handler at the root so that
* this space is immediately available even though the we have not
* enumerated all the PCI Root Buses yet. This is to conform to the ACPI
* specification which states that the PCI config space must be always
* available -- even though we are nowhere near ready to find the PCI root
* buses at this point.
*
* NOTE: We ignore AE_ALREADY_EXISTS because this means that a handler
* has already been installed (via AcpiInstallAddressSpaceHandler).
@@ -257,12 +261,12 @@ AcpiEvInitializeOpRegions (
return_ACPI_STATUS (Status);
}
/*
* Run the _REG methods for OpRegions in each default address space
*/
/* Run the _REG methods for OpRegions in each default address space */
for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++)
{
/* TBD: Make sure handler is the DEFAULT handler, otherwise
/*
* TBD: Make sure handler is the DEFAULT handler, otherwise
* _REG will have already been run.
*/
Status = AcpiEvExecuteRegMethods (AcpiGbl_RootNode,
@@ -378,7 +382,7 @@ Cleanup1:
*
* PARAMETERS: RegionObj - Internal region object
* Function - Read or Write operation
* Address - Where in the space to read or write
* RegionOffset - Where in the region to read or write
* BitWidth - Field width in bits (8, 16, 32, or 64)
* Value - Pointer to in or out value, must be
* full 64-bit ACPI_INTEGER
@@ -394,7 +398,7 @@ ACPI_STATUS
AcpiEvAddressSpaceDispatch (
ACPI_OPERAND_OBJECT *RegionObj,
UINT32 Function,
ACPI_PHYSICAL_ADDRESS Address,
UINT32 RegionOffset,
UINT32 BitWidth,
ACPI_INTEGER *Value)
{
@@ -429,14 +433,13 @@ AcpiEvAddressSpaceDispatch (
}
/*
* It may be the case that the region has never been initialized
* It may be the case that the region has never been initialized.
* Some types of regions require special init code
*/
if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE))
{
/*
* This region has not been initialized yet, do it
*/
/* This region has not been initialized yet, do it */
RegionSetup = HandlerDesc->AddressSpace.Setup;
if (!RegionSetup)
{
@@ -449,9 +452,9 @@ AcpiEvAddressSpaceDispatch (
}
/*
* We must exit the interpreter because the region
* setup will potentially execute control methods
* (e.g., _REG method for this region)
* We must exit the interpreter because the region setup will
* potentially execute control methods (for example, the _REG method
* for this region)
*/
AcpiExExitInterpreter ();
@@ -472,9 +475,8 @@ AcpiEvAddressSpaceDispatch (
return_ACPI_STATUS (Status);
}
/*
* Region initialization may have been completed by RegionSetup
*/
/* Region initialization may have been completed by RegionSetup */
if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE))
{
RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE;
@@ -503,7 +505,7 @@ AcpiEvAddressSpaceDispatch (
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Handler %p (@%p) Address %8.8X%8.8X [%s]\n",
&RegionObj->Region.Handler->AddressSpace, Handler,
ACPI_FORMAT_NATIVE_UINT (Address),
ACPI_FORMAT_NATIVE_UINT (RegionObj->Region.Address + RegionOffset),
AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
if (!(HandlerDesc->AddressSpace.HandlerFlags &
@@ -519,7 +521,8 @@ AcpiEvAddressSpaceDispatch (
/* Call the handler */
Status = Handler (Function, Address, BitWidth, Value,
Status = Handler (Function,
(RegionObj->Region.Address + RegionOffset), BitWidth, Value,
HandlerDesc->AddressSpace.Context, RegionObj2->Extra.RegionContext);
if (ACPI_FAILURE (Status))
@@ -608,7 +611,7 @@ AcpiEvDetachRegion(
/* This is it, remove it from the handler's list */
*LastObjPtr = ObjDesc->Region.Next;
ObjDesc->Region.Next = NULL; /* Must clear field */
ObjDesc->Region.Next = NULL; /* Must clear field */
if (AcpiNsIsLocked)
{
@@ -638,8 +641,8 @@ AcpiEvDetachRegion(
}
/*
* If the region has been activated, call the setup handler
* with the deactivate notification
* If the region has been activated, call the setup handler with
* the deactivate notification
*/
if (RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)
{
@@ -792,8 +795,8 @@ AcpiEvInstallHandler (
}
/*
* We only care about regions.and objects
* that are allowed to have address space handlers
* We only care about regions and objects that are allowed to have
* address space handlers
*/
if ((Node->Type != ACPI_TYPE_DEVICE) &&
(Node->Type != ACPI_TYPE_REGION) &&
@@ -814,7 +817,7 @@ AcpiEvInstallHandler (
/* Devices are handled different than regions */
if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_DEVICE)
if (ObjDesc->Common.Type == ACPI_TYPE_DEVICE)
{
/* Check if this Device already has a handler for this address space */
@@ -823,19 +826,21 @@ AcpiEvInstallHandler (
{
/* Found a handler, is it for the same address space? */
if (NextHandlerObj->AddressSpace.SpaceId == HandlerObj->AddressSpace.SpaceId)
if (NextHandlerObj->AddressSpace.SpaceId ==
HandlerObj->AddressSpace.SpaceId)
{
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Found handler for region [%s] in device %p(%p) handler %p\n",
"Found handler for region [%s] in device %p(%p) "
"handler %p\n",
AcpiUtGetRegionName (HandlerObj->AddressSpace.SpaceId),
ObjDesc, NextHandlerObj, HandlerObj));
/*
* Since the object we found it on was a device, then it
* means that someone has already installed a handler for
* the branch of the namespace from this device on. Just
* the branch of the namespace from this device on. Just
* bail out telling the walk routine to not traverse this
* branch. This preserves the scoping rule for handlers.
* branch. This preserves the scoping rule for handlers.
*/
return (AE_CTRL_DEPTH);
}
@@ -846,9 +851,8 @@ AcpiEvInstallHandler (
}
/*
* As long as the device didn't have a handler for this
* space we don't care about it. We just ignore it and
* proceed.
* As long as the device didn't have a handler for this space we
* don't care about it. We just ignore it and proceed.
*/
return (AE_OK);
}
@@ -857,16 +861,13 @@ AcpiEvInstallHandler (
if (ObjDesc->Region.SpaceId != HandlerObj->AddressSpace.SpaceId)
{
/*
* This region is for a different address space
* -- just ignore it
*/
/* This region is for a different address space, just ignore it */
return (AE_OK);
}
/*
* Now we have a region and it is for the handler's address
* space type.
* Now we have a region and it is for the handler's address space type.
*
* First disconnect region for any previous handler (if any)
*/
@@ -915,9 +916,8 @@ AcpiEvInstallSpaceHandler (
/*
* This registration is valid for only the types below
* and the root. This is where the default handlers
* get placed.
* This registration is valid for only the types below and the root. This
* is where the default handlers get placed.
*/
if ((Node->Type != ACPI_TYPE_DEVICE) &&
(Node->Type != ACPI_TYPE_PROCESSOR) &&
@@ -983,8 +983,8 @@ AcpiEvInstallSpaceHandler (
if (ObjDesc)
{
/*
* The attached device object already exists.
* Make sure the handler is not already installed.
* The attached device object already exists. Make sure the handler
* is not already installed.
*/
HandlerObj = ObjDesc->Device.Handler;
@@ -1000,8 +1000,8 @@ AcpiEvInstallSpaceHandler (
{
/*
* It is (relatively) OK to attempt to install the SAME
* handler twice. This can easily happen
* with PCI_Config space.
* handler twice. This can easily happen with the
* PCI_Config space.
*/
Status = AE_SAME_HANDLER;
goto UnlockAndExit;
@@ -1069,9 +1069,8 @@ AcpiEvInstallSpaceHandler (
/*
* Install the handler
*
* At this point there is no existing handler.
* Just allocate the object for the handler and link it
* into the list.
* At this point there is no existing handler. Just allocate the object
* for the handler and link it into the list.
*/
HandlerObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_ADDRESS_HANDLER);
if (!HandlerObj)
@@ -1147,11 +1146,10 @@ AcpiEvExecuteRegMethods (
/*
* Run all _REG methods for all Operation Regions for this
* space ID. This is a separate walk in order to handle any
* interdependencies between regions and _REG methods. (i.e. handlers
* must be installed for all regions of this Space ID before we
* can run any _REG methods)
* Run all _REG methods for all Operation Regions for this space ID. This
* is a separate walk in order to handle any interdependencies between
* regions and _REG methods. (i.e. handlers must be installed for all
* regions of this Space ID before we can run any _REG methods)
*/
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX,
ACPI_NS_WALK_UNLOCK, AcpiEvRegRun,
@@ -1195,8 +1193,8 @@ AcpiEvRegRun (
}
/*
* We only care about regions.and objects
* that are allowed to have address space handlers
* We only care about regions.and objects that are allowed to have address
* space handlers
*/
if ((Node->Type != ACPI_TYPE_REGION) &&
(Node != AcpiGbl_RootNode))
@@ -1218,10 +1216,8 @@ AcpiEvRegRun (
if (ObjDesc->Region.SpaceId != SpaceId)
{
/*
* This region is for a different address space
* -- just ignore it
*/
/* This region is for a different address space, just ignore it */
return (AE_OK);
}
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: evrgnini- ACPI AddressSpace (OpRegion) init
* $Revision: 1.89 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,6 +117,7 @@
#define __EVRGNINI_C__
#include "acpi.h"
#include "accommon.h"
#include "acevents.h"
#include "acnamesp.h"
@@ -126,10 +126,6 @@
/* Local prototypes */
static BOOLEAN
AcpiEvMatchPciRootBridge (
char *Id);
static BOOLEAN
AcpiEvIsPciRootBridge (
ACPI_NAMESPACE_NODE *Node);
@@ -335,16 +331,17 @@ AcpiEvPciConfigRegionSetup (
if (Status == AE_SAME_HANDLER)
{
/*
* It is OK if the handler is already installed on the root
* bridge. Still need to return a context object for the
* new PCI_Config operation region, however.
* It is OK if the handler is already installed on the
* root bridge. Still need to return a context object
* for the new PCI_Config operation region, however.
*/
Status = AE_OK;
}
else
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not install PciConfig handler for Root Bridge %4.4s",
"Could not install PciConfig handler "
"for Root Bridge %4.4s",
AcpiUtGetNodeName (PciRootNode)));
}
}
@@ -379,8 +376,8 @@ AcpiEvPciConfigRegionSetup (
}
/*
* For PCI_Config space access, we need the segment, bus,
* device and function numbers. Acquire them here.
* For PCI_Config space access, we need the segment, bus, device and
* function numbers. Acquire them here.
*
* Find the parent device object. (This allows the operation region to be
* within a subscope under the device, such as a control method.)
@@ -398,14 +395,15 @@ AcpiEvPciConfigRegionSetup (
}
/*
* Get the PCI device and function numbers from the _ADR object
* contained in the parent's scope.
* Get the PCI device and function numbers from the _ADR object contained
* in the parent's scope.
*/
Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, PciDeviceNode, &PciValue);
Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR,
PciDeviceNode, &PciValue);
/*
* The default is zero, and since the allocation above zeroed
* the data, just do nothing on failure.
* The default is zero, and since the allocation above zeroed the data,
* just do nothing on failure.
*/
if (ACPI_SUCCESS (Status))
{
@@ -415,7 +413,8 @@ AcpiEvPciConfigRegionSetup (
/* The PCI segment number comes from the _SEG method */
Status = AcpiUtEvaluateNumericObject (METHOD_NAME__SEG, PciRootNode, &PciValue);
Status = AcpiUtEvaluateNumericObject (METHOD_NAME__SEG,
PciRootNode, &PciValue);
if (ACPI_SUCCESS (Status))
{
PciId->Segment = ACPI_LOWORD (PciValue);
@@ -423,7 +422,8 @@ AcpiEvPciConfigRegionSetup (
/* The PCI bus number comes from the _BBN method */
Status = AcpiUtEvaluateNumericObject (METHOD_NAME__BBN, PciRootNode, &PciValue);
Status = AcpiUtEvaluateNumericObject (METHOD_NAME__BBN,
PciRootNode, &PciValue);
if (ACPI_SUCCESS (Status))
{
PciId->Bus = ACPI_LOWORD (PciValue);
@@ -438,42 +438,6 @@ AcpiEvPciConfigRegionSetup (
}
/*******************************************************************************
*
* FUNCTION: AcpiEvMatchPciRootBridge
*
* PARAMETERS: Id - The HID/CID in string format
*
* RETURN: TRUE if the Id is a match for a PCI/PCI-Express Root Bridge
*
* DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID.
*
******************************************************************************/
static BOOLEAN
AcpiEvMatchPciRootBridge (
char *Id)
{
/*
* Check if this is a PCI root.
* ACPI 3.0+: check for a PCI Express root also.
*/
if (!(ACPI_STRNCMP (Id,
PCI_ROOT_HID_STRING,
sizeof (PCI_ROOT_HID_STRING))) ||
!(ACPI_STRNCMP (Id,
PCI_EXPRESS_ROOT_HID_STRING,
sizeof (PCI_EXPRESS_ROOT_HID_STRING))))
{
return (TRUE);
}
return (FALSE);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvIsPciRootBridge
@@ -492,29 +456,30 @@ AcpiEvIsPciRootBridge (
ACPI_NAMESPACE_NODE *Node)
{
ACPI_STATUS Status;
ACPI_DEVICE_ID Hid;
ACPI_COMPATIBLE_ID_LIST *Cid;
ACPI_DEVICE_ID *Hid;
ACPI_DEVICE_ID_LIST *Cid;
UINT32 i;
BOOLEAN Match;
/*
* Get the _HID and check for a PCI Root Bridge
*/
/* Get the _HID and check for a PCI Root Bridge */
Status = AcpiUtExecute_HID (Node, &Hid);
if (ACPI_FAILURE (Status))
{
return (FALSE);
}
if (AcpiEvMatchPciRootBridge (Hid.Value))
Match = AcpiUtIsPciRootBridge (Hid->String);
ACPI_FREE (Hid);
if (Match)
{
return (TRUE);
}
/*
* The _HID did not match.
* Get the _CID and check for a PCI Root Bridge
*/
/* The _HID did not match. Get the _CID and check for a PCI Root Bridge */
Status = AcpiUtExecute_CID (Node, &Cid);
if (ACPI_FAILURE (Status))
{
@@ -525,7 +490,7 @@ AcpiEvIsPciRootBridge (
for (i = 0; i < Cid->Count; i++)
{
if (AcpiEvMatchPciRootBridge (Cid->Id[i].Value))
if (AcpiUtIsPciRootBridge (Cid->Ids[i].String))
{
ACPI_FREE (Cid);
return (TRUE);
@@ -652,9 +617,9 @@ AcpiEvDefaultRegionSetup (
* Get the appropriate address space handler for a newly
* created region.
*
* This also performs address space specific initialization. For
* This also performs address space specific initialization. For
* example, PCI regions must have an _ADR object that contains
* a PCI address in the scope of the definition. This address is
* a PCI address in the scope of the definition. This address is
* required to perform an access to PCI config space.
*
* MUTEX: Interpreter should be unlocked, because we may run the _REG
@@ -714,7 +679,7 @@ AcpiEvInitializeRegion (
{
/*
* The _REG method is optional and there can be only one per region
* definition. This will be executed when the handler is attached
* definition. This will be executed when the handler is attached
* or removed
*/
RegionObj2->Extra.Method_REG = MethodNode;
@@ -772,8 +737,8 @@ AcpiEvInitializeRegion (
AcpiNsLocked);
/*
* Tell all users that this region is usable by running the _REG
* method
* Tell all users that this region is usable by
* running the _REG method
*/
if (AcpiNsLocked)
{
@@ -804,10 +769,8 @@ AcpiEvInitializeRegion (
}
}
/*
* This node does not have the handler we need;
* Pop up one level
*/
/* This node does not have the handler we need; Pop up one level */
Node = AcpiNsGetParentNode (Node);
}
@@ -2,7 +2,6 @@
*
* Module Name: evsci - System Control Interrupt configuration and
* legacy to ACPI mode state transition functions
* $Revision: 1.104 $
*
******************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,6 +116,7 @@
*****************************************************************************/
#include "acpi.h"
#include "accommon.h"
#include "acevents.h"
@@ -204,10 +204,8 @@ AcpiEvGpeXruptHandler (
* if this interrupt handler is installed, ACPI is enabled.
*/
/*
* GPEs:
* Check for and dispatch any GPEs that have occurred
*/
/* GPEs: Check for and dispatch any GPEs that have occurred */
InterruptHandled |= AcpiEvGpeDetect (GpeXruptList);
return_UINT32 (InterruptHandled);
@@ -251,11 +249,11 @@ AcpiEvInstallSciHandler (
* RETURN: E_OK if handler uninstalled OK, E_ERROR if handler was not
* installed to begin with
*
* DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be
* DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be
* taken.
*
* Note: It doesn't seem important to disable all events or set the event
* enable registers to their original values. The OS should disable
* enable registers to their original values. The OS should disable
* the SCI interrupt level when the handler is removed, so no more
* events will come in.
*
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: evxface - External interfaces for ACPI events
* $Revision: 1.167 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,6 +117,7 @@
#define __EVXFACE_C__
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
#include "acevents.h"
#include "acinterp.h"
@@ -378,7 +378,7 @@ AcpiInstallNotifyHandler (
/*
* Root Object:
* Registering a notify handler on the root object indicates that the
* caller wishes to receive notifications for all objects. Note that
* 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)
@@ -727,7 +727,8 @@ AcpiInstallGpeHandler (
/* Make sure that there isn't a handler there already */
if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER)
if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_HANDLER)
{
Status = AE_ALREADY_EXISTS;
goto UnlockAndExit;
@@ -761,7 +762,7 @@ AcpiInstallGpeHandler (
/* Setup up dispatch flags to indicate handler (vs. method) */
GpeEventInfo->Flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); /* Clear bits */
GpeEventInfo->Flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK);
GpeEventInfo->Flags |= (UINT8) (Type | ACPI_GPE_DISPATCH_HANDLER);
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
@@ -829,7 +830,8 @@ AcpiRemoveGpeHandler (
/* Make sure that a handler is indeed installed */
if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) != ACPI_GPE_DISPATCH_HANDLER)
if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) !=
ACPI_GPE_DISPATCH_HANDLER)
{
Status = AE_NOT_EXIST;
goto UnlockAndExit;
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
* $Revision: 1.94 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,6 +117,7 @@
#define __EVXFEVNT_C__
#include "acpi.h"
#include "accommon.h"
#include "acevents.h"
#include "acnamesp.h"
#include "actables.h"
@@ -125,6 +125,14 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evxfevnt")
/* Local prototypes */
static ACPI_STATUS
AcpiEvGetGpeDevice (
ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
ACPI_GPE_BLOCK_INFO *GpeBlock,
void *Context);
/*******************************************************************************
*
@@ -264,10 +272,12 @@ AcpiEnableEvent (
}
/*
* Enable the requested fixed event (by writing a one to the
* enable register bit)
* Enable the requested fixed event (by writing a one to the enable
* register bit)
*/
Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, 1);
Status = AcpiWriteBitRegister (
AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
ACPI_ENABLE_EVENT);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -275,8 +285,8 @@ AcpiEnableEvent (
/* Make sure that the hardware responded */
Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
&Value);
Status = AcpiReadBitRegister (
AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &Value);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -504,17 +514,19 @@ AcpiDisableEvent (
}
/*
* Disable the requested fixed event (by writing a zero to the
* enable register bit)
* Disable the requested fixed event (by writing a zero to the enable
* register bit)
*/
Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, 0);
Status = AcpiWriteBitRegister (
AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
ACPI_DISABLE_EVENT);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
&Value);
Status = AcpiReadBitRegister (
AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &Value);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -563,10 +575,12 @@ AcpiClearEvent (
}
/*
* Clear the requested fixed event (By writing a one to the
* status register bit)
* Clear the requested fixed event (By writing a one to the status
* register bit)
*/
Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId, 1);
Status = AcpiWriteBitRegister (
AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
ACPI_CLEAR_STATUS);
return_ACPI_STATUS (Status);
}
@@ -673,8 +687,8 @@ AcpiGetEventStatus (
/* Get the status of the requested fixed event */
Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
EventStatus);
Status = AcpiReadBitRegister (
AcpiGbl_FixedEventInfo[Event].StatusRegisterId, EventStatus);
return_ACPI_STATUS (Status);
}
@@ -803,7 +817,7 @@ AcpiInstallGpeBlock (
* is always zero
*/
Status = AcpiEvCreateGpeBlock (Node, GpeBlockAddress, RegisterCount,
0, InterruptNumber, &GpeBlock);
0, InterruptNumber, &GpeBlock);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
@@ -922,3 +936,177 @@ UnlockAndExit:
ACPI_EXPORT_SYMBOL (AcpiRemoveGpeBlock)
/*******************************************************************************
*
* FUNCTION: AcpiGetGpeDevice
*
* PARAMETERS: Index - System GPE index (0-CurrentGpeCount)
* GpeDevice - Where the parent GPE Device is returned
*
* RETURN: Status
*
* DESCRIPTION: Obtain the GPE device associated with the input index. A NULL
* gpe device indicates that the gpe number is contained in one of
* the FADT-defined gpe blocks. Otherwise, the GPE block device.
*
******************************************************************************/
ACPI_STATUS
AcpiGetGpeDevice (
UINT32 Index,
ACPI_HANDLE *GpeDevice)
{
ACPI_GPE_DEVICE_INFO Info;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (AcpiGetGpeDevice);
if (!GpeDevice)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
if (Index >= AcpiCurrentGpeCount)
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
/* Setup and walk the GPE list */
Info.Index = Index;
Info.Status = AE_NOT_EXIST;
Info.GpeDevice = NULL;
Info.NextBlockBaseIndex = 0;
Status = AcpiEvWalkGpeList (AcpiEvGetGpeDevice, &Info);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
*GpeDevice = ACPI_CAST_PTR (ACPI_HANDLE, Info.GpeDevice);
return_ACPI_STATUS (Info.Status);
}
ACPI_EXPORT_SYMBOL (AcpiGetGpeDevice)
/*******************************************************************************
*
* FUNCTION: AcpiEvGetGpeDevice
*
* PARAMETERS: GPE_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Matches the input GPE index (0-CurrentGpeCount) with a GPE
* block device. NULL if the GPE is one of the FADT-defined GPEs.
*
******************************************************************************/
static ACPI_STATUS
AcpiEvGetGpeDevice (
ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
ACPI_GPE_BLOCK_INFO *GpeBlock,
void *Context)
{
ACPI_GPE_DEVICE_INFO *Info = Context;
/* Increment Index by the number of GPEs in this block */
Info->NextBlockBaseIndex +=
(GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH);
if (Info->Index < Info->NextBlockBaseIndex)
{
/*
* The GPE index is within this block, get the node. Leave the node
* NULL for the FADT-defined GPEs
*/
if ((GpeBlock->Node)->Type == ACPI_TYPE_DEVICE)
{
Info->GpeDevice = GpeBlock->Node;
}
Info->Status = AE_OK;
return (AE_CTRL_END);
}
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: AcpiDisableAllGpes
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Disable and clear all GPEs in all GPE blocks
*
******************************************************************************/
ACPI_STATUS
AcpiDisableAllGpes (
void)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (AcpiDisableAllGpes);
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
Status = AcpiHwDisableAllGpes ();
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (Status);
}
/******************************************************************************
*
* FUNCTION: AcpiEnableAllRuntimeGpes
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks
*
******************************************************************************/
ACPI_STATUS
AcpiEnableAllRuntimeGpes (
void)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (AcpiEnableAllRuntimeGpes);
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
Status = AcpiHwEnableAllRuntimeGpes ();
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (Status);
}
@@ -2,7 +2,6 @@
*
* Module Name: evxfregn - External Interfaces, ACPI Operation Regions and
* Address Spaces.
* $Revision: 1.71 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,6 +117,7 @@
#define __EVXFREGN_C__
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
#include "acevents.h"
@@ -285,7 +285,8 @@ AcpiRemoveAddressSpaceHandler (
/* Matched SpaceId, first dereference this in the Regions */
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Removing address handler %p(%p) for region %s on Device %p(%p)\n",
"Removing address handler %p(%p) for region %s "
"on Device %p(%p)\n",
HandlerObj, Handler, AcpiUtGetRegionName (SpaceId),
Node, ObjDesc));
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
* $Revision: 1.113 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,11 +117,12 @@
#define __EXCONFIG_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "actables.h"
#include "acdispat.h"
#include "acevents.h"
#define _COMPONENT ACPI_EXECUTER
@@ -136,6 +136,12 @@ AcpiExAddTable (
ACPI_NAMESPACE_NODE *ParentNode,
ACPI_OPERAND_OBJECT **DdbHandle);
static ACPI_STATUS
AcpiExRegionRead (
ACPI_OPERAND_OBJECT *ObjDesc,
UINT32 Length,
UINT8 *Buffer);
/*******************************************************************************
*
@@ -175,12 +181,13 @@ AcpiExAddTable (
/* Init the table handle */
ObjDesc->Reference.Opcode = AML_LOAD_OP;
ObjDesc->Common.Flags |= AOPOBJ_DATA_VALID;
ObjDesc->Reference.Class = ACPI_REFCLASS_TABLE;
*DdbHandle = ObjDesc;
/* Install the new table into the local data structures */
ObjDesc->Reference.Object = ACPI_TO_POINTER (TableIndex);
ObjDesc->Reference.Value = TableIndex;
/* Add the table to the namespace */
@@ -189,8 +196,15 @@ AcpiExAddTable (
{
AcpiUtRemoveReference (ObjDesc);
*DdbHandle = NULL;
return_ACPI_STATUS (Status);
}
/* Execute any module-level code that was found in the table */
AcpiExExitInterpreter ();
AcpiNsExecModuleCodeList ();
AcpiExEnterInterpreter ();
return_ACPI_STATUS (Status);
}
@@ -326,6 +340,8 @@ AcpiExLoadTableOp (
if (ACPI_FAILURE (Status))
{
(void) AcpiExUnloadTable (DdbHandle);
AcpiUtRemoveReference (DdbHandle);
return_ACPI_STATUS (Status);
}
}
@@ -351,6 +367,53 @@ AcpiExLoadTableOp (
}
/*******************************************************************************
*
* FUNCTION: AcpiExRegionRead
*
* PARAMETERS: ObjDesc - Region descriptor
* Length - Number of bytes to read
* Buffer - Pointer to where to put the data
*
* RETURN: Status
*
* DESCRIPTION: Read data from an operation region. The read starts from the
* beginning of the region.
*
******************************************************************************/
static ACPI_STATUS
AcpiExRegionRead (
ACPI_OPERAND_OBJECT *ObjDesc,
UINT32 Length,
UINT8 *Buffer)
{
ACPI_STATUS Status;
ACPI_INTEGER Value;
UINT32 RegionOffset = 0;
UINT32 i;
/* Bytewise reads */
for (i = 0; i < Length; i++)
{
Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ,
RegionOffset, 8, &Value);
if (ACPI_FAILURE (Status))
{
return (Status);
}
*Buffer = (UINT8) Value;
Buffer++;
RegionOffset++;
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiExLoadOp
@@ -393,7 +456,7 @@ AcpiExLoadOp (
/* Source Object can be either an OpRegion or a Buffer/Field */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_REGION:
@@ -420,19 +483,23 @@ AcpiExLoadOp (
}
}
/*
* Map the table header and get the actual table length. The region
* length is not guaranteed to be the same as the table length.
*/
Table = AcpiOsMapMemory (ObjDesc->Region.Address,
sizeof (ACPI_TABLE_HEADER));
/* Get the table header first so we can get the table length */
Table = ACPI_ALLOCATE (sizeof (ACPI_TABLE_HEADER));
if (!Table)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
Status = AcpiExRegionRead (ObjDesc, sizeof (ACPI_TABLE_HEADER),
ACPI_CAST_PTR (UINT8, Table));
Length = Table->Length;
AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER));
ACPI_FREE (Table);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Must have at least an ACPI table header */
@@ -442,10 +509,19 @@ AcpiExLoadOp (
}
/*
* The memory region is not guaranteed to remain stable and we must
* copy the table to a local buffer. For example, the memory region
* is corrupted after suspend on some machines. Dynamically loaded
* tables are usually small, so this overhead is minimal.
* The original implementation simply mapped the table, with no copy.
* However, the memory region is not guaranteed to remain stable and
* we must copy the table to a local buffer. For example, the memory
* region is corrupted after suspend on some machines. Dynamically
* loaded tables are usually small, so this overhead is minimal.
*
* The latest implementation (5/2009) does not use a mapping at all.
* We use the low-level operation region interface to read the table
* instead of the obvious optimization of using a direct mapping.
* This maintains a consistent use of operation regions across the
* entire subsystem. This is important if additional processing must
* be performed in the (possibly user-installed) operation region
* handler. For example, AcpiExec and ASLTS depend on this.
*/
/* Allocate a buffer for the table */
@@ -456,18 +532,16 @@ AcpiExLoadOp (
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Map the entire table and copy it */
/* Read the entire table */
Table = AcpiOsMapMemory (ObjDesc->Region.Address, Length);
if (!Table)
Status = AcpiExRegionRead (ObjDesc, Length,
ACPI_CAST_PTR (UINT8, TableDesc.Pointer));
if (ACPI_FAILURE (Status))
{
ACPI_FREE (TableDesc.Pointer);
return_ACPI_STATUS (AE_NO_MEMORY);
return_ACPI_STATUS (Status);
}
ACPI_MEMCPY (TableDesc.Pointer, Table, Length);
AcpiOsUnmapMemory (Table, Length);
TableDesc.Address = ObjDesc->Region.Address;
break;
@@ -569,6 +643,10 @@ AcpiExLoadOp (
return_ACPI_STATUS (Status);
}
/* Remove the reference by added by AcpiExStore above */
AcpiUtRemoveReference (DdbHandle);
/* Invoke table handler if present */
if (AcpiGbl_TableHandler)
@@ -615,20 +693,32 @@ AcpiExUnloadTable (
/*
* Validate the handle
* Although the handle is partially validated in AcpiExReconfiguration(),
* Although the handle is partially validated in AcpiExReconfiguration()
* when it calls AcpiExResolveOperands(), the handle is more completely
* validated here.
*
* Handle must be a valid operand object of type reference. Also, the
* DdbHandle must still be marked valid (table has not been previously
* unloaded)
*/
if ((!DdbHandle) ||
(ACPI_GET_DESCRIPTOR_TYPE (DdbHandle) != ACPI_DESC_TYPE_OPERAND) ||
(ACPI_GET_OBJECT_TYPE (DdbHandle) != ACPI_TYPE_LOCAL_REFERENCE))
(DdbHandle->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) ||
(!(DdbHandle->Common.Flags & AOPOBJ_DATA_VALID)))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Get the table index from the DdbHandle (ACPI_SIZE for 64-bit case) */
/* Get the table index from the DdbHandle */
TableIndex = (UINT32) (ACPI_SIZE) TableDesc->Reference.Object;
TableIndex = TableDesc->Reference.Value;
/* Ensure the table is still loaded */
if (!AcpiTbIsTableLoaded (TableIndex))
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
/* Invoke table handler if present */
@@ -642,18 +732,22 @@ AcpiExUnloadTable (
}
}
/*
* Delete the entire namespace under this table Node
* (Offset contains the TableId)
*/
AcpiTbDeleteNamespaceByOwner (TableIndex);
(void) AcpiTbReleaseOwnerId (TableIndex);
/* Delete the portion of the namespace owned by this table */
Status = AcpiTbDeleteNamespaceByOwner (TableIndex);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
(void) AcpiTbReleaseOwnerId (TableIndex);
AcpiTbSetTableLoadedFlag (TableIndex, FALSE);
/* Table unloaded, remove a reference to the DdbHandle object */
AcpiUtRemoveReference (DdbHandle);
/*
* Invalidate the handle. We do this because the handle may be stored
* in a named object and may not be actually deleted until much later.
*/
DdbHandle->Common.Flags &= ~AOPOBJ_DATA_VALID;
return_ACPI_STATUS (AE_OK);
}
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: exconvrt - Object conversion routines
* $Revision: 1.75 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,6 +117,7 @@
#define __EXCONVRT_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "amlcode.h"
@@ -139,7 +139,7 @@ AcpiExConvertToAscii (
*
* FUNCTION: AcpiExConvertToInteger
*
* PARAMETERS: ObjDesc - Object to be converted. Must be an
* PARAMETERS: ObjDesc - Object to be converted. Must be an
* Integer, Buffer, or String
* ResultDesc - Where the new Integer object is returned
* Flags - Used for string conversion
@@ -167,7 +167,7 @@ AcpiExConvertToInteger (
ACPI_FUNCTION_TRACE_PTR (ExConvertToInteger, ObjDesc);
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
@@ -190,7 +190,7 @@ AcpiExConvertToInteger (
}
/*
* Convert the buffer/string to an integer. Note that both buffers and
* 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.
*
@@ -202,13 +202,13 @@ AcpiExConvertToInteger (
/* String conversion is different than Buffer conversion */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_STRING:
/*
* Convert string to an integer - for most cases, the string must be
* hexadecimal as per the ACPI specification. The only exception (as
* hexadecimal as per the ACPI specification. The only exception (as
* of ACPI 3.0) is that the ToInteger() operator allows both decimal
* and hexadecimal strings (hex prefixed with "0x").
*/
@@ -253,6 +253,7 @@ AcpiExConvertToInteger (
default:
/* No other types can get here */
break;
}
@@ -281,7 +282,7 @@ AcpiExConvertToInteger (
*
* FUNCTION: AcpiExConvertToBuffer
*
* PARAMETERS: ObjDesc - Object to be converted. Must be an
* PARAMETERS: ObjDesc - Object to be converted. Must be an
* Integer, Buffer, or String
* ResultDesc - Where the new buffer object is returned
*
@@ -303,7 +304,7 @@ AcpiExConvertToBuffer (
ACPI_FUNCTION_TRACE_PTR (ExConvertToBuffer, ObjDesc);
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_BUFFER:
@@ -476,7 +477,7 @@ AcpiExConvertToAscii (
}
/*
* Since leading zeros are supressed, we must check for the case where
* Since leading zeros are suppressed, we must check for the case where
* the integer equals 0
*
* Finally, null terminate the string and return the length
@@ -496,7 +497,7 @@ AcpiExConvertToAscii (
*
* FUNCTION: AcpiExConvertToString
*
* PARAMETERS: ObjDesc - Object to be converted. Must be an
* PARAMETERS: ObjDesc - Object to be converted. Must be an
* Integer, Buffer, or String
* ResultDesc - Where the string object is returned
* Type - String flags (base and conversion type)
@@ -524,7 +525,7 @@ AcpiExConvertToString (
ACPI_FUNCTION_TRACE_PTR (ExConvertToString, ObjDesc);
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_STRING:
@@ -592,7 +593,7 @@ AcpiExConvertToString (
Base = 10;
/*
* Calculate the final string length. Individual string values
* Calculate the final string length. Individual string values
* are variable length (include separator for each)
*/
for (i = 0; i < ObjDesc->Buffer.Length; i++)
@@ -637,8 +638,14 @@ AcpiExConvertToString (
/*
* Create a new string object and string buffer
* (-1 because of extra separator included in StringLength from above)
* Allow creation of zero-length strings from zero-length buffers.
*/
ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) (StringLength - 1));
if (StringLength)
{
StringLength--;
}
ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) StringLength);
if (!ReturnDesc)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -662,7 +669,10 @@ AcpiExConvertToString (
* Null terminate the string
* (overwrites final comma/space from above)
*/
NewBuf--;
if (ObjDesc->Buffer.Length)
{
NewBuf--;
}
*NewBuf = 0;
break;
@@ -728,7 +738,7 @@ AcpiExConvertToTargetType (
default:
/* No conversion allowed for these types */
if (DestinationType != ACPI_GET_OBJECT_TYPE (SourceDesc))
if (DestinationType != SourceDesc->Common.Type)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Explicit operator, will store (%s) over existing type (%s)\n",
@@ -749,7 +759,7 @@ AcpiExConvertToTargetType (
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
/*
* These types require an Integer operand. We can convert
* These types require an Integer operand. We can convert
* a Buffer or a String to an Integer if necessary.
*/
Status = AcpiExConvertToInteger (SourceDesc, ResultDesc,
@@ -759,7 +769,7 @@ AcpiExConvertToTargetType (
case ACPI_TYPE_STRING:
/*
* The operand must be a String. We can convert an
* The operand must be a String. We can convert an
* Integer or Buffer if necessary
*/
Status = AcpiExConvertToString (SourceDesc, ResultDesc,
@@ -769,7 +779,7 @@ AcpiExConvertToTargetType (
case ACPI_TYPE_BUFFER:
/*
* The operand must be a Buffer. We can convert an
* The operand must be a Buffer. We can convert an
* Integer or String if necessary
*/
Status = AcpiExConvertToBuffer (SourceDesc, ResultDesc);
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: excreate - Named object creation
* $Revision: 1.117 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,6 +117,7 @@
#define __EXCREATE_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
@@ -614,7 +614,7 @@ AcpiExCreateMethod (
* ACPI 2.0: SyncLevel = SyncLevel in method declaration
*/
ObjDesc->Method.SyncLevel = (UINT8)
((MethodFlags & AML_METHOD_SYNCH_LEVEL) >> 4);
((MethodFlags & AML_METHOD_SYNC_LEVEL) >> 4);
}
/* Attach the new object to the method Node */
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: exdump - Interpreter debug output routines
* $Revision: 1.206 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,10 +116,11 @@
#define __EXDUMP_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acparser.h"
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exdump")
@@ -213,10 +213,11 @@ static ACPI_EXDUMP_INFO AcpiExDumpEvent[2] =
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Event.OsSemaphore), "OsSemaphore"}
};
static ACPI_EXDUMP_INFO AcpiExDumpMethod[8] =
static ACPI_EXDUMP_INFO AcpiExDumpMethod[9] =
{
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpMethod), NULL},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.ParamCount), "ParamCount"},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.MethodFlags), "Method Flags"},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.ParamCount), "Parameter Count"},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.SyncLevel), "Sync Level"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Method.Mutex), "Mutex"},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.OwnerId), "Owner Id"},
@@ -305,12 +306,12 @@ static ACPI_EXDUMP_INFO AcpiExDumpIndexField[5] =
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET (IndexField.DataObj), "Data Object"}
};
static ACPI_EXDUMP_INFO AcpiExDumpReference[7] =
static ACPI_EXDUMP_INFO AcpiExDumpReference[8] =
{
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpReference), NULL},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.Class), "Class"},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.TargetType), "Target Type"},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Reference.Offset), "Offset"},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Reference.Value), "Value"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Object), "Object Desc"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Node), "Node"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Where), "Where"},
@@ -345,7 +346,6 @@ static ACPI_EXDUMP_INFO AcpiExDumpCommon[4] =
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Common.Flags), "Flags"}
};
static ACPI_EXDUMP_INFO AcpiExDumpFieldCommon[7] =
{
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpFieldCommon), NULL},
@@ -449,6 +449,7 @@ AcpiExDumpObject (
break;
case ACPI_EXD_TYPE:
AcpiExOutString ("Type", AcpiUtGetObjectTypeName (ObjDesc));
break;
@@ -470,7 +471,7 @@ AcpiExDumpObject (
case ACPI_EXD_UINT64:
AcpiOsPrintf ("%20s : %8.8X%8.8X\n", "Value",
ACPI_FORMAT_UINT64 (ACPI_GET64 (Target)));
ACPI_FORMAT_UINT64 (ACPI_GET64 (Target)));
break;
case ACPI_EXD_POINTER:
@@ -505,13 +506,15 @@ AcpiExDumpObject (
case ACPI_EXD_REFERENCE:
AcpiExOutString ("Opcode",
(AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name);
AcpiExOutString ("Class Name",
ACPI_CAST_PTR (char, AcpiUtGetReferenceName (ObjDesc)));
AcpiExDumpReferenceObj (ObjDesc);
break;
default:
AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n", Info->Opcode);
AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n",
Info->Opcode);
return;
}
@@ -589,91 +592,57 @@ AcpiExDumpOperand (
/* Decode object type */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_LOCAL_REFERENCE:
switch (ObjDesc->Reference.Opcode)
AcpiOsPrintf ("Reference: [%s] ", AcpiUtGetReferenceName (ObjDesc));
switch (ObjDesc->Reference.Class)
{
case AML_DEBUG_OP:
AcpiOsPrintf ("Reference: Debug\n");
break;
case AML_INDEX_OP:
AcpiOsPrintf ("Reference: Index %p\n",
ObjDesc->Reference.Object);
break;
case AML_LOAD_OP:
AcpiOsPrintf ("Reference: [DdbHandle] TableIndex %p\n",
ObjDesc->Reference.Object);
break;
case AML_REF_OF_OP:
AcpiOsPrintf ("Reference: (RefOf) %p [%s]\n",
ObjDesc->Reference.Object,
AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *) ObjDesc->Reference.Object)->Common.Type));
break;
case AML_ARG_OP:
AcpiOsPrintf ("Reference: Arg%d",
ObjDesc->Reference.Offset);
if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
{
/* Value is an Integer */
AcpiOsPrintf (" value is [%8.8X%8.8x]",
ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
}
case ACPI_REFCLASS_DEBUG:
AcpiOsPrintf ("\n");
break;
case AML_LOCAL_OP:
case ACPI_REFCLASS_INDEX:
AcpiOsPrintf ("Reference: Local%d",
ObjDesc->Reference.Offset);
if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
{
/* Value is an Integer */
AcpiOsPrintf (" value is [%8.8X%8.8x]",
ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
}
AcpiOsPrintf ("\n");
AcpiOsPrintf ("%p\n", ObjDesc->Reference.Object);
break;
case AML_INT_NAMEPATH_OP:
case ACPI_REFCLASS_TABLE:
AcpiOsPrintf ("Reference: Namepath %X [%4.4s]\n",
ObjDesc->Reference.Node->Name.Integer,
ObjDesc->Reference.Node->Name.Ascii);
AcpiOsPrintf ("Table Index %X\n", ObjDesc->Reference.Value);
break;
default:
case ACPI_REFCLASS_REFOF:
/* Unknown opcode */
AcpiOsPrintf ("Unknown Reference opcode=%X\n",
ObjDesc->Reference.Opcode);
AcpiOsPrintf ("%p [%s]\n", ObjDesc->Reference.Object,
AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)
ObjDesc->Reference.Object)->Common.Type));
break;
case ACPI_REFCLASS_NAME:
AcpiOsPrintf ("- [%4.4s]\n", ObjDesc->Reference.Node->Name.Ascii);
break;
case ACPI_REFCLASS_ARG:
case ACPI_REFCLASS_LOCAL:
AcpiOsPrintf ("%X\n", ObjDesc->Reference.Value);
break;
default: /* Unknown reference class */
AcpiOsPrintf ("%2.2X\n", ObjDesc->Reference.Class);
break;
}
break;
@@ -683,7 +652,6 @@ AcpiExDumpOperand (
AcpiOsPrintf ("Buffer length %.2X @ %p\n",
ObjDesc->Buffer.Length, ObjDesc->Buffer.Pointer);
/* Debug only -- dump the buffer contents */
if (ObjDesc->Buffer.Pointer)
@@ -694,7 +662,8 @@ AcpiExDumpOperand (
Length = 128;
}
AcpiOsPrintf ("Buffer Contents: (displaying length 0x%.2X)\n", Length);
AcpiOsPrintf ("Buffer Contents: (displaying length 0x%.2X)\n",
Length);
ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, Length);
}
break;
@@ -770,8 +739,8 @@ AcpiExDumpOperand (
case ACPI_TYPE_LOCAL_REGION_FIELD:
AcpiOsPrintf (
"RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
AcpiOsPrintf ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at "
"byte=%X bit=%X of below:\n",
ObjDesc->Field.BitLength,
ObjDesc->Field.AccessByteWidth,
ObjDesc->Field.FieldFlags & AML_FIELD_LOCK_RULE_MASK,
@@ -791,8 +760,7 @@ AcpiExDumpOperand (
case ACPI_TYPE_BUFFER_FIELD:
AcpiOsPrintf (
"BufferField: %X bits at byte %X bit %X of\n",
AcpiOsPrintf ("BufferField: %X bits at byte %X bit %X of\n",
ObjDesc->BufferField.BitLength,
ObjDesc->BufferField.BaseByteOffset,
ObjDesc->BufferField.StartFieldBitOffset);
@@ -801,7 +769,7 @@ AcpiExDumpOperand (
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL*\n"));
}
else if (ACPI_GET_OBJECT_TYPE (ObjDesc->BufferField.BufferObj) !=
else if ((ObjDesc->BufferField.BufferObj)->Common.Type !=
ACPI_TYPE_BUFFER)
{
AcpiOsPrintf ("*not a Buffer*\n");
@@ -861,7 +829,7 @@ AcpiExDumpOperand (
default:
/* Unknown Type */
AcpiOsPrintf ("Unknown Type %X\n", ACPI_GET_OBJECT_TYPE (ObjDesc));
AcpiOsPrintf ("Unknown Type %X\n", ObjDesc->Common.Type);
break;
}
@@ -977,10 +945,10 @@ AcpiExDumpNamespaceNode (
}
}
AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node));
AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type));
AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node));
AcpiExOutPointer ("Parent", AcpiNsGetParentNode (Node));
AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node));
AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type));
AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node));
AcpiExOutPointer ("Parent", AcpiNsGetParentNode (Node));
AcpiExDumpObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node),
AcpiExDumpNode);
@@ -1007,9 +975,9 @@ AcpiExDumpReferenceObj (
RetBuf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
if (ObjDesc->Reference.Opcode == AML_INT_NAMEPATH_OP)
if (ObjDesc->Reference.Class == ACPI_REFCLASS_NAME)
{
AcpiOsPrintf (" Named Object %p ", ObjDesc->Reference.Node);
AcpiOsPrintf (" %p ", ObjDesc->Reference.Node);
Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node, &RetBuf);
if (ACPI_FAILURE (Status))
@@ -1027,25 +995,20 @@ AcpiExDumpReferenceObj (
if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND)
{
AcpiOsPrintf (" Target: %p", ObjDesc->Reference.Object);
if (ObjDesc->Reference.Opcode == AML_LOAD_OP)
if (ObjDesc->Reference.Class == ACPI_REFCLASS_TABLE)
{
/*
* For DDBHandle reference,
* ObjDesc->Reference.Object is the table index
*/
AcpiOsPrintf (" [DDBHandle]\n");
AcpiOsPrintf (" Table Index: %X\n", ObjDesc->Reference.Value);
}
else
{
AcpiOsPrintf (" [%s]\n",
AcpiOsPrintf (" Target: %p [%s]\n", ObjDesc->Reference.Object,
AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)
ObjDesc->Reference.Object)->Common.Type));
}
}
else
{
AcpiOsPrintf (" Target: %p\n",
ObjDesc->Reference.Object);
AcpiOsPrintf (" Target: %p\n", ObjDesc->Reference.Object);
}
}
}
@@ -1096,12 +1059,12 @@ AcpiExDumpPackageObj (
/* Packages may only contain a few object types */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
break;
@@ -1122,7 +1085,7 @@ AcpiExDumpPackageObj (
if (ObjDesc->Buffer.Length)
{
AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer),
ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
}
else
{
@@ -1134,7 +1097,7 @@ AcpiExDumpPackageObj (
case ACPI_TYPE_PACKAGE:
AcpiOsPrintf ("[Package] Contains %d Elements:\n",
ObjDesc->Package.Count);
ObjDesc->Package.Count);
for (i = 0; i < ObjDesc->Package.Count; i++)
{
@@ -1145,15 +1108,16 @@ AcpiExDumpPackageObj (
case ACPI_TYPE_LOCAL_REFERENCE:
AcpiOsPrintf ("[Object Reference] %s",
(AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name);
AcpiOsPrintf ("[Object Reference] Type [%s] %2.2X",
AcpiUtGetReferenceName (ObjDesc),
ObjDesc->Reference.Class);
AcpiExDumpReferenceObj (ObjDesc);
break;
default:
AcpiOsPrintf ("[Unknown Type] %X\n", ACPI_GET_OBJECT_TYPE (ObjDesc));
AcpiOsPrintf ("[Unknown Type] %X\n", ObjDesc->Common.Type);
break;
}
}
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: exfield - ACPI AML (p-code) execution - field manipulation
* $Revision: 1.133 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,6 +117,7 @@
#define __EXFIELD_C__
#include "acpi.h"
#include "accommon.h"
#include "acdispat.h"
#include "acinterp.h"
@@ -151,6 +151,7 @@ AcpiExReadDataFromField (
ACPI_OPERAND_OBJECT *BufferDesc;
ACPI_SIZE Length;
void *Buffer;
UINT32 Function;
ACPI_FUNCTION_TRACE_PTR (ExReadDataFromField, ObjDesc);
@@ -167,7 +168,7 @@ AcpiExReadDataFromField (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD)
if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD)
{
/*
* If the BufferField arguments have not been previously evaluated,
@@ -182,14 +183,28 @@ AcpiExReadDataFromField (
}
}
}
else if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_REGION_FIELD) &&
(ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS))
else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) &&
(ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS ||
ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI))
{
/*
* This is an SMBus read. We must create a buffer to hold the data
* and directly access the region handler.
* This is an SMBus or IPMI read. We must create a buffer to hold
* the data and then directly access the region handler.
*
* Note: Smbus protocol value is passed in upper 16-bits of Function
*/
BufferDesc = AcpiUtCreateBufferObject (ACPI_SMBUS_BUFFER_SIZE);
if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS)
{
Length = ACPI_SMBUS_BUFFER_SIZE;
Function = ACPI_READ | (ObjDesc->Field.Attribute << 16);
}
else /* IPMI */
{
Length = ACPI_IPMI_BUFFER_SIZE;
Function = ACPI_READ;
}
BufferDesc = AcpiUtCreateBufferObject (Length);
if (!BufferDesc)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -199,13 +214,11 @@ AcpiExReadDataFromField (
AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags);
/*
* Perform the read.
* Note: Smbus protocol value is passed in upper 16-bits of Function
*/
/* Call the region handler for the read */
Status = AcpiExAccessRegion (ObjDesc, 0,
ACPI_CAST_PTR (ACPI_INTEGER, BufferDesc->Buffer.Pointer),
ACPI_READ | (ObjDesc->Field.Attribute << 16));
Function);
AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags);
goto Exit;
}
@@ -249,7 +262,7 @@ AcpiExReadDataFromField (
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n",
ObjDesc, ACPI_GET_OBJECT_TYPE (ObjDesc), Buffer, (UINT32) Length));
ObjDesc, ObjDesc->Common.Type, Buffer, (UINT32) Length));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"FieldRead [FROM]: BitLen %X, BitOff %X, ByteOff %X\n",
ObjDesc->CommonField.BitLength,
@@ -304,6 +317,7 @@ AcpiExWriteDataToField (
UINT32 Length;
void *Buffer;
ACPI_OPERAND_OBJECT *BufferDesc;
UINT32 Function;
ACPI_FUNCTION_TRACE_PTR (ExWriteDataToField, ObjDesc);
@@ -316,7 +330,7 @@ AcpiExWriteDataToField (
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD)
if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD)
{
/*
* If the BufferField arguments have not been previously evaluated,
@@ -331,41 +345,60 @@ AcpiExWriteDataToField (
}
}
}
else if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_REGION_FIELD) &&
(ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS))
else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) &&
(ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS ||
ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI))
{
/*
* This is an SMBus write. We will bypass the entire field mechanism
* and handoff the buffer directly to the handler.
* This is an SMBus or IPMI write. We will bypass the entire field
* mechanism and handoff the buffer directly to the handler. For
* these address spaces, the buffer is bi-directional; on a write,
* return data is returned in the same buffer.
*
* Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE).
* Source must be a buffer of sufficient size:
* ACPI_SMBUS_BUFFER_SIZE or ACPI_IPMI_BUFFER_SIZE.
*
* Note: SMBus protocol type is passed in upper 16-bits of Function
*/
if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER)
if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER)
{
ACPI_ERROR ((AE_INFO, "SMBus write requires Buffer, found type %s",
ACPI_ERROR ((AE_INFO,
"SMBus or IPMI write requires Buffer, found type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
if (SourceDesc->Buffer.Length < ACPI_SMBUS_BUFFER_SIZE)
if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS)
{
Length = ACPI_SMBUS_BUFFER_SIZE;
Function = ACPI_WRITE | (ObjDesc->Field.Attribute << 16);
}
else /* IPMI */
{
Length = ACPI_IPMI_BUFFER_SIZE;
Function = ACPI_WRITE;
}
if (SourceDesc->Buffer.Length < Length)
{
ACPI_ERROR ((AE_INFO,
"SMBus write requires Buffer of length %X, found length %X",
ACPI_SMBUS_BUFFER_SIZE, SourceDesc->Buffer.Length));
"SMBus or IPMI write requires Buffer of length %X, found length %X",
Length, SourceDesc->Buffer.Length));
return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
}
BufferDesc = AcpiUtCreateBufferObject (ACPI_SMBUS_BUFFER_SIZE);
/* Create the bi-directional buffer */
BufferDesc = AcpiUtCreateBufferObject (Length);
if (!BufferDesc)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
Buffer = BufferDesc->Buffer.Pointer;
ACPI_MEMCPY (Buffer, SourceDesc->Buffer.Pointer,
ACPI_SMBUS_BUFFER_SIZE);
ACPI_MEMCPY (Buffer, SourceDesc->Buffer.Pointer, Length);
/* Lock entire transaction if requested */
@@ -374,11 +407,9 @@ AcpiExWriteDataToField (
/*
* Perform the write (returns status and perhaps data in the
* same buffer)
* Note: SMBus protocol type is passed in upper 16-bits of Function.
*/
Status = AcpiExAccessRegion (ObjDesc, 0,
(ACPI_INTEGER *) Buffer,
ACPI_WRITE | (ObjDesc->Field.Attribute << 16));
(ACPI_INTEGER *) Buffer, Function);
AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags);
*ResultDesc = BufferDesc;
@@ -387,7 +418,7 @@ AcpiExWriteDataToField (
/* Get a pointer to the data to be written */
switch (ACPI_GET_OBJECT_TYPE (SourceDesc))
switch (SourceDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
Buffer = &SourceDesc->Integer.Value;
@@ -410,13 +441,13 @@ AcpiExWriteDataToField (
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n",
SourceDesc, AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (SourceDesc)),
ACPI_GET_OBJECT_TYPE (SourceDesc), Buffer, Length));
SourceDesc, AcpiUtGetTypeName (SourceDesc->Common.Type),
SourceDesc->Common.Type, Buffer, Length));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"FieldWrite [TO]: Obj %p (%s:%X), BitLen %X, BitOff %X, ByteOff %X\n",
ObjDesc, AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (ObjDesc)),
ACPI_GET_OBJECT_TYPE (ObjDesc),
ObjDesc, AcpiUtGetTypeName (ObjDesc->Common.Type),
ObjDesc->Common.Type,
ObjDesc->CommonField.BitLength,
ObjDesc->CommonField.StartFieldBitOffset,
ObjDesc->CommonField.BaseByteOffset));
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: exfldio - Aml Field I/O
* $Revision: 1.131 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,6 +117,7 @@
#define __EXFLDIO_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acevents.h"
@@ -179,10 +179,10 @@ AcpiExSetupRegion (
/* We must have a valid region */
if (ACPI_GET_OBJECT_TYPE (RgnDesc) != ACPI_TYPE_REGION)
if (RgnDesc->Common.Type != ACPI_TYPE_REGION)
{
ACPI_ERROR ((AE_INFO, "Needed Region, found type %X (%s)",
ACPI_GET_OBJECT_TYPE (RgnDesc),
RgnDesc->Common.Type,
AcpiUtGetObjectTypeName (RgnDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -201,20 +201,14 @@ AcpiExSetupRegion (
}
}
/* Exit if Address/Length have been disallowed by the host OS */
if (RgnDesc->Common.Flags & AOPOBJ_INVALID)
{
return_ACPI_STATUS (AE_AML_ILLEGAL_ADDRESS);
}
/*
* Exit now for SMBus address space, it has a non-linear address space
* Exit now for SMBus or IPMI address space, it has a non-linear address space
* and the request cannot be directly validated
*/
if (RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_SMBUS)
if (RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_SMBUS ||
RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_IPMI)
{
/* SMBus has a non-linear address space */
/* SMBus or IPMI has a non-linear address space */
return_ACPI_STATUS (AE_OK);
}
@@ -321,7 +315,7 @@ AcpiExAccessRegion (
{
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *RgnDesc;
ACPI_PHYSICAL_ADDRESS Address;
UINT32 RegionOffset;
ACPI_FUNCTION_TRACE (ExAccessRegion);
@@ -345,9 +339,9 @@ AcpiExAccessRegion (
* 3) The current offset into the field
*/
RgnDesc = ObjDesc->CommonField.RegionObj;
Address = RgnDesc->Region.Address +
ObjDesc->CommonField.BaseByteOffset +
FieldDatumByteOffset;
RegionOffset =
ObjDesc->CommonField.BaseByteOffset +
FieldDatumByteOffset;
if ((Function & ACPI_IO_MASK) == ACPI_READ)
{
@@ -365,12 +359,11 @@ AcpiExAccessRegion (
ObjDesc->CommonField.AccessByteWidth,
ObjDesc->CommonField.BaseByteOffset,
FieldDatumByteOffset,
ACPI_CAST_PTR (void, Address)));
ACPI_CAST_PTR (void, (RgnDesc->Region.Address + RegionOffset))));
/* Invoke the appropriate AddressSpace/OpRegion handler */
Status = AcpiEvAddressSpaceDispatch (RgnDesc, Function,
Address,
Status = AcpiEvAddressSpaceDispatch (RgnDesc, Function, RegionOffset,
ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth), Value);
if (ACPI_FAILURE (Status))
@@ -499,7 +492,7 @@ AcpiExFieldDatumIo (
* IndexField - Write to an Index Register, then read/write from/to a
* Data Register
*/
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_BUFFER_FIELD:
/*
@@ -614,13 +607,13 @@ AcpiExFieldDatumIo (
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"I/O to Data Register: ValuePtr %p\n", Value));
if (ReadWrite == ACPI_READ)
{
/* Read the datum from the DataRegister */
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Read from Data Register\n"));
Status = AcpiExExtractFromField (ObjDesc->IndexField.DataObj,
Value, sizeof (ACPI_INTEGER));
}
@@ -628,6 +621,10 @@ AcpiExFieldDatumIo (
{
/* Write the datum to the DataRegister */
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Write to Data Register: Value %8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (*Value)));
Status = AcpiExInsertIntoField (ObjDesc->IndexField.DataObj,
Value, sizeof (ACPI_INTEGER));
}
@@ -637,7 +634,7 @@ AcpiExFieldDatumIo (
default:
ACPI_ERROR ((AE_INFO, "Wrong object type in field I/O %X",
ACPI_GET_OBJECT_TYPE (ObjDesc)));
ObjDesc->Common.Type));
Status = AE_AML_INTERNAL;
break;
}
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
* $Revision: 1.145 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -119,6 +118,7 @@
#define __EXMISC_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "amlcode.h"
#include "amlresrc.h"
@@ -162,7 +162,7 @@ AcpiExGetObjectReference (
{
case ACPI_DESC_TYPE_OPERAND:
if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_LOCAL_REFERENCE)
if (ObjDesc->Common.Type != ACPI_TYPE_LOCAL_REFERENCE)
{
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@@ -170,11 +170,11 @@ AcpiExGetObjectReference (
/*
* Must be a reference to a Local or Arg
*/
switch (ObjDesc->Reference.Opcode)
switch (ObjDesc->Reference.Class)
{
case AML_LOCAL_OP:
case AML_ARG_OP:
case AML_DEBUG_OP:
case ACPI_REFCLASS_LOCAL:
case ACPI_REFCLASS_ARG:
case ACPI_REFCLASS_DEBUG:
/* The referenced object is the pseudo-node for the local/arg */
@@ -183,8 +183,8 @@ AcpiExGetObjectReference (
default:
ACPI_ERROR ((AE_INFO, "Unknown Reference opcode %X",
ObjDesc->Reference.Opcode));
ACPI_ERROR ((AE_INFO, "Unknown Reference Class %2.2X",
ObjDesc->Reference.Class));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
break;
@@ -215,7 +215,7 @@ AcpiExGetObjectReference (
return_ACPI_STATUS (AE_NO_MEMORY);
}
ReferenceObj->Reference.Opcode = AML_REF_OF_OP;
ReferenceObj->Reference.Class = ACPI_REFCLASS_REFOF;
ReferenceObj->Reference.Object = ReferencedObj;
*ReturnDesc = ReferenceObj;
@@ -357,7 +357,7 @@ AcpiExDoConcatenate (
* guaranteed to be either Integer/String/Buffer by the operand
* resolution mechanism.
*/
switch (ACPI_GET_OBJECT_TYPE (Operand0))
switch (Operand0->Common.Type)
{
case ACPI_TYPE_INTEGER:
Status = AcpiExConvertToInteger (Operand1, &LocalOperand1, 16);
@@ -374,7 +374,7 @@ AcpiExDoConcatenate (
default:
ACPI_ERROR ((AE_INFO, "Invalid object type: %X",
ACPI_GET_OBJECT_TYPE (Operand0)));
Operand0->Common.Type));
Status = AE_AML_INTERNAL;
}
@@ -396,7 +396,7 @@ AcpiExDoConcatenate (
* 2) Two Strings concatenated to produce a new String
* 3) Two Buffers concatenated to produce a new Buffer
*/
switch (ACPI_GET_OBJECT_TYPE (Operand0))
switch (Operand0->Common.Type)
{
case ACPI_TYPE_INTEGER:
@@ -476,7 +476,7 @@ AcpiExDoConcatenate (
/* Invalid object type, should not happen here */
ACPI_ERROR ((AE_INFO, "Invalid object type: %X",
ACPI_GET_OBJECT_TYPE (Operand0)));
Operand0->Common.Type));
Status =AE_AML_INTERNAL;
goto Cleanup;
}
@@ -709,7 +709,7 @@ AcpiExDoLogicalOp (
* guaranteed to be either Integer/String/Buffer by the operand
* resolution mechanism.
*/
switch (ACPI_GET_OBJECT_TYPE (Operand0))
switch (Operand0->Common.Type)
{
case ACPI_TYPE_INTEGER:
Status = AcpiExConvertToInteger (Operand1, &LocalOperand1, 16);
@@ -737,7 +737,7 @@ AcpiExDoLogicalOp (
/*
* Two cases: 1) Both Integers, 2) Both Strings or Buffers
*/
if (ACPI_GET_OBJECT_TYPE (Operand0) == ACPI_TYPE_INTEGER)
if (Operand0->Common.Type == ACPI_TYPE_INTEGER)
{
/*
* 1) Both operands are of type integer
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exmutex - ASL Mutex Acquire/Release functions
* $Revision: 1.43 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,6 +117,7 @@
#define __EXMUTEX_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "acevents.h"
@@ -166,6 +166,15 @@ AcpiExUnlinkMutex (
if (ObjDesc->Mutex.Prev)
{
(ObjDesc->Mutex.Prev)->Mutex.Next = ObjDesc->Mutex.Next;
/*
* Migrate the previous sync level associated with this mutex to the
* previous mutex on the list so that it may be preserved. This handles
* the case where several mutexes have been acquired at the same level,
* but are not released in opposite order.
*/
(ObjDesc->Mutex.Prev)->Mutex.OriginalSyncLevel =
ObjDesc->Mutex.OriginalSyncLevel;
}
else
{
@@ -461,6 +470,7 @@ AcpiExReleaseMutex (
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status = AE_OK;
UINT8 PreviousSyncLevel;
ACPI_FUNCTION_TRACE (ExReleaseMutex);
@@ -488,10 +498,10 @@ AcpiExReleaseMutex (
(ObjDesc != AcpiGbl_GlobalLockMutex))
{
ACPI_ERROR ((AE_INFO,
"Thread %X cannot release Mutex [%4.4s] acquired by thread %X",
WalkState->Thread->ThreadId,
"Thread %p cannot release Mutex [%4.4s] acquired by thread %p",
ACPI_CAST_PTR (void, WalkState->Thread->ThreadId),
AcpiUtGetNodeName (ObjDesc->Mutex.Node),
ObjDesc->Mutex.OwnerThread->ThreadId));
ACPI_CAST_PTR (void, ObjDesc->Mutex.OwnerThread->ThreadId)));
return_ACPI_STATUS (AE_AML_NOT_OWNER);
}
@@ -505,10 +515,13 @@ AcpiExReleaseMutex (
}
/*
* The sync level of the mutex must be less than or equal to the current
* sync level
* The sync level of the mutex must be equal to the current sync level. In
* other words, the current level means that at least one mutex at that
* level is currently being held. Attempting to release a mutex of a
* different level can only mean that the mutex ordering rule is being
* violated. This behavior is clarified in ACPI 4.0 specification.
*/
if (ObjDesc->Mutex.SyncLevel > WalkState->Thread->CurrentSyncLevel)
if (ObjDesc->Mutex.SyncLevel != WalkState->Thread->CurrentSyncLevel)
{
ACPI_ERROR ((AE_INFO,
"Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d",
@@ -517,13 +530,25 @@ AcpiExReleaseMutex (
return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
}
/*
* Get the previous SyncLevel from the head of the acquired mutex list.
* This handles the case where several mutexes at the same level have been
* acquired, but are not released in reverse order.
*/
PreviousSyncLevel =
WalkState->Thread->AcquiredMutexList->Mutex.OriginalSyncLevel;
Status = AcpiExReleaseMutexObject (ObjDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
if (ObjDesc->Mutex.AcquisitionDepth == 0)
{
/* Restore the original SyncLevel */
/* Restore the previous SyncLevel */
WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel;
WalkState->Thread->CurrentSyncLevel = PreviousSyncLevel;
}
return_ACPI_STATUS (Status);
}
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exnames - interpreter/scanner name load/execute
* $Revision: 1.112 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,6 +117,7 @@
#define __EXNAMES_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "amlcode.h"
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exoparg1 - AML execution - opcodes with 1 argument
* $Revision: 1.186 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,6 +117,7 @@
#define __EXOPARG1_C__
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "acdispat.h"
#include "acinterp.h"
@@ -947,8 +947,8 @@ AcpiExOpcode_1A_0T_1R (
TempDesc = AcpiNsGetAttachedObject (
(ACPI_NAMESPACE_NODE *) Operand[0]);
if (TempDesc &&
((ACPI_GET_OBJECT_TYPE (TempDesc) == ACPI_TYPE_STRING) ||
(ACPI_GET_OBJECT_TYPE (TempDesc) == ACPI_TYPE_LOCAL_REFERENCE)))
((TempDesc->Common.Type == ACPI_TYPE_STRING) ||
(TempDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE)))
{
Operand[0] = TempDesc;
AcpiUtAddReference (TempDesc);
@@ -961,7 +961,7 @@ AcpiExOpcode_1A_0T_1R (
}
else
{
switch (ACPI_GET_OBJECT_TYPE (Operand[0]))
switch ((Operand[0])->Common.Type)
{
case ACPI_TYPE_LOCAL_REFERENCE:
/*
@@ -969,16 +969,16 @@ AcpiExOpcode_1A_0T_1R (
*
* Must resolve/dereference the local/arg reference first
*/
switch (Operand[0]->Reference.Opcode)
switch (Operand[0]->Reference.Class)
{
case AML_LOCAL_OP:
case AML_ARG_OP:
case ACPI_REFCLASS_LOCAL:
case ACPI_REFCLASS_ARG:
/* Set Operand[0] to the value of the local/arg */
Status = AcpiDsMethodDataGetValue (
Operand[0]->Reference.Opcode,
Operand[0]->Reference.Offset,
Operand[0]->Reference.Class,
Operand[0]->Reference.Value,
WalkState, &TempDesc);
if (ACPI_FAILURE (Status))
{
@@ -993,7 +993,7 @@ AcpiExOpcode_1A_0T_1R (
Operand[0] = TempDesc;
break;
case AML_REF_OF_OP:
case ACPI_REFCLASS_REFOF:
/* Get the object to which the reference refers */
@@ -1020,7 +1020,7 @@ AcpiExOpcode_1A_0T_1R (
if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) != ACPI_DESC_TYPE_NAMED)
{
if (ACPI_GET_OBJECT_TYPE (Operand[0]) == ACPI_TYPE_STRING)
if ((Operand[0])->Common.Type == ACPI_TYPE_STRING)
{
/*
* This is a DerefOf (String). The string is a reference
@@ -1068,9 +1068,9 @@ AcpiExOpcode_1A_0T_1R (
* This must be a reference object produced by either the
* Index() or RefOf() operator
*/
switch (Operand[0]->Reference.Opcode)
switch (Operand[0]->Reference.Class)
{
case AML_INDEX_OP:
case ACPI_REFCLASS_INDEX:
/*
* The target type for the Index operator must be
@@ -1103,7 +1103,7 @@ AcpiExOpcode_1A_0T_1R (
* reference to the buffer itself.
*/
ReturnDesc->Integer.Value =
TempDesc->Buffer.Pointer[Operand[0]->Reference.Offset];
TempDesc->Buffer.Pointer[Operand[0]->Reference.Value];
break;
@@ -1124,7 +1124,7 @@ AcpiExOpcode_1A_0T_1R (
default:
ACPI_ERROR ((AE_INFO,
"Unknown Index TargetType %X in obj %p",
"Unknown Index TargetType %X in reference object %p",
Operand[0]->Reference.TargetType, Operand[0]));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
@@ -1132,7 +1132,7 @@ AcpiExOpcode_1A_0T_1R (
break;
case AML_REF_OF_OP:
case ACPI_REFCLASS_REFOF:
ReturnDesc = Operand[0]->Reference.Object;
@@ -1151,8 +1151,8 @@ AcpiExOpcode_1A_0T_1R (
default:
ACPI_ERROR ((AE_INFO,
"Unknown opcode in reference(%p) - %X",
Operand[0], Operand[0]->Reference.Opcode));
"Unknown class in reference(%p) - %2.2X",
Operand[0], Operand[0]->Reference.Class));
Status = AE_TYPE;
goto Cleanup;
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: exoparg2 - AML execution - opcodes with 2 arguments
* $Revision: 1.146 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,6 +117,7 @@
#define __EXOPARG2_C__
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "acinterp.h"
#include "acevents.h"
@@ -504,14 +504,14 @@ AcpiExOpcode_2A_1T_1R (
/* Initialize the Index reference object */
Index = Operand[1]->Integer.Value;
ReturnDesc->Reference.Offset = (UINT32) Index;
ReturnDesc->Reference.Opcode = AML_INDEX_OP;
ReturnDesc->Reference.Value = (UINT32) Index;
ReturnDesc->Reference.Class = ACPI_REFCLASS_INDEX;
/*
* At this point, the Source operand is a String, Buffer, or Package.
* Verify that the index is within range.
*/
switch (ACPI_GET_OBJECT_TYPE (Operand[0]))
switch ((Operand[0])->Common.Type)
{
case ACPI_TYPE_STRING:
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exoparg3 - AML execution - opcodes with 3 arguments
* $Revision: 1.36 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -119,6 +118,7 @@
#define __EXOPARG3_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "acparser.h"
#include "amlcode.h"
@@ -256,7 +256,7 @@ AcpiExOpcode_3A_1T_1R (
* either a String or a Buffer, so just use its type.
*/
ReturnDesc = AcpiUtCreateInternalObject (
ACPI_GET_OBJECT_TYPE (Operand[0]));
(Operand[0])->Common.Type);
if (!ReturnDesc)
{
Status = AE_NO_MEMORY;
@@ -287,7 +287,7 @@ AcpiExOpcode_3A_1T_1R (
/* Strings always have a sub-pointer, not so for buffers */
switch (ACPI_GET_OBJECT_TYPE (Operand[0]))
switch ((Operand[0])->Common.Type)
{
case ACPI_TYPE_STRING:
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exoparg6 - AML execution - opcodes with 6 arguments
* $Revision: 1.30 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -119,6 +118,7 @@
#define __EXOPARG6_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "acparser.h"
#include "amlcode.h"
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
* $Revision: 1.144 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,6 +117,7 @@
#define __EXPREP_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
@@ -367,7 +367,7 @@ AcpiExDecodeFieldAccess (
return_UINT32 (0);
}
if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD)
if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD)
{
/*
* BufferField access can be on any byte boundary, so the
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exregion - ACPI default OpRegion (address space) handlers
* $Revision: 1.103 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -119,6 +118,7 @@
#define __EXREGION_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
@@ -384,14 +384,14 @@ AcpiExSystemIoSpaceHandler (
{
case ACPI_READ:
Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) Address,
Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) Address,
&Value32, BitWidth);
*Value = Value32;
break;
case ACPI_WRITE:
Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) Address,
Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) Address,
(UINT32) *Value, BitWidth);
break;
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exresnte - AML Interpreter object resolution
* $Revision: 1.78 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,11 +117,10 @@
#define __EXRESNTE_C__
#include "acpi.h"
#include "accommon.h"
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
#include "acparser.h"
#include "amlcode.h"
#define _COMPONENT ACPI_EXECUTER
@@ -222,7 +220,7 @@ AcpiExResolveNodeToValue (
{
case ACPI_TYPE_PACKAGE:
if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_PACKAGE)
if (SourceDesc->Common.Type != ACPI_TYPE_PACKAGE)
{
ACPI_ERROR ((AE_INFO, "Object not a Package, type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
@@ -242,7 +240,7 @@ AcpiExResolveNodeToValue (
case ACPI_TYPE_BUFFER:
if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER)
if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER)
{
ACPI_ERROR ((AE_INFO, "Object not a Buffer, type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
@@ -262,7 +260,7 @@ AcpiExResolveNodeToValue (
case ACPI_TYPE_STRING:
if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_STRING)
if (SourceDesc->Common.Type != ACPI_TYPE_STRING)
{
ACPI_ERROR ((AE_INFO, "Object not a String, type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
@@ -278,7 +276,7 @@ AcpiExResolveNodeToValue (
case ACPI_TYPE_INTEGER:
if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_INTEGER)
if (SourceDesc->Common.Type != ACPI_TYPE_INTEGER)
{
ACPI_ERROR ((AE_INFO, "Object not a Integer, type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
@@ -330,11 +328,11 @@ AcpiExResolveNodeToValue (
case ACPI_TYPE_LOCAL_REFERENCE:
switch (SourceDesc->Reference.Opcode)
switch (SourceDesc->Reference.Class)
{
case AML_LOAD_OP: /* This is a DdbHandle */
case AML_REF_OF_OP:
case AML_INDEX_OP:
case ACPI_REFCLASS_TABLE: /* This is a DdbHandle */
case ACPI_REFCLASS_REFOF:
case ACPI_REFCLASS_INDEX:
/* Return an additional reference to the object */
@@ -346,9 +344,8 @@ AcpiExResolveNodeToValue (
/* No named references are allowed here */
ACPI_ERROR ((AE_INFO,
"Unsupported Reference opcode %X (%s)",
SourceDesc->Reference.Opcode,
AcpiPsGetOpcodeName (SourceDesc->Reference.Opcode)));
"Unsupported Reference type %X",
SourceDesc->Reference.Class));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exresolv - AML Interpreter object resolution
* $Revision: 1.146 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,11 +117,11 @@
#define __EXRESOLV_C__
#include "acpi.h"
#include "accommon.h"
#include "amlcode.h"
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
#include "acparser.h"
#define _COMPONENT ACPI_EXECUTER
@@ -230,7 +229,7 @@ AcpiExResolveObjectToValue (
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *StackDesc;
ACPI_OPERAND_OBJECT *ObjDesc = NULL;
UINT16 Opcode;
UINT8 RefType;
ACPI_FUNCTION_TRACE (ExResolveObjectToValue);
@@ -240,30 +239,30 @@ AcpiExResolveObjectToValue (
/* This is an ACPI_OPERAND_OBJECT */
switch (ACPI_GET_OBJECT_TYPE (StackDesc))
switch (StackDesc->Common.Type)
{
case ACPI_TYPE_LOCAL_REFERENCE:
Opcode = StackDesc->Reference.Opcode;
RefType = StackDesc->Reference.Class;
switch (Opcode)
switch (RefType)
{
case AML_LOCAL_OP:
case AML_ARG_OP:
case ACPI_REFCLASS_LOCAL:
case ACPI_REFCLASS_ARG:
/*
* Get the local from the method's state info
* Note: this increments the local's object reference count
*/
Status = AcpiDsMethodDataGetValue (Opcode,
StackDesc->Reference.Offset, WalkState, &ObjDesc);
Status = AcpiDsMethodDataGetValue (RefType,
StackDesc->Reference.Value, WalkState, &ObjDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Arg/Local %X] ValueObj is %p\n",
StackDesc->Reference.Offset, ObjDesc));
StackDesc->Reference.Value, ObjDesc));
/*
* Now we can delete the original Reference Object and
@@ -274,7 +273,7 @@ AcpiExResolveObjectToValue (
break;
case AML_INDEX_OP:
case ACPI_REFCLASS_INDEX:
switch (StackDesc->Reference.TargetType)
{
@@ -335,15 +334,15 @@ AcpiExResolveObjectToValue (
break;
case AML_REF_OF_OP:
case AML_DEBUG_OP:
case AML_LOAD_OP:
case ACPI_REFCLASS_REFOF:
case ACPI_REFCLASS_DEBUG:
case ACPI_REFCLASS_TABLE:
/* Just leave the object as-is, do not dereference */
break;
case AML_INT_NAMEPATH_OP: /* Reference to a named object */
case ACPI_REFCLASS_NAME: /* Reference to a named object */
/* Dereference the name */
@@ -368,8 +367,7 @@ AcpiExResolveObjectToValue (
default:
ACPI_ERROR ((AE_INFO,
"Unknown Reference opcode %X (%s) in %p",
Opcode, AcpiPsGetOpcodeName (Opcode), StackDesc));
"Unknown Reference type %X in %p", RefType, StackDesc));
Status = AE_AML_INTERNAL;
break;
}
@@ -394,7 +392,7 @@ AcpiExResolveObjectToValue (
case ACPI_TYPE_LOCAL_INDEX_FIELD:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "FieldRead SourceDesc=%p Type=%X\n",
StackDesc, ACPI_GET_OBJECT_TYPE (StackDesc)));
StackDesc, StackDesc->Common.Type));
Status = AcpiExReadDataFromField (WalkState, StackDesc, &ObjDesc);
@@ -482,16 +480,16 @@ AcpiExResolveMultiple (
* specification of the ObjectType and SizeOf operators). This means
* traversing the list of possibly many nested references.
*/
while (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_REFERENCE)
while (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE)
{
switch (ObjDesc->Reference.Opcode)
switch (ObjDesc->Reference.Class)
{
case AML_REF_OF_OP:
case AML_INT_NAMEPATH_OP:
case ACPI_REFCLASS_REFOF:
case ACPI_REFCLASS_NAME:
/* Dereference the reference pointer */
if (ObjDesc->Reference.Opcode == AML_REF_OF_OP)
if (ObjDesc->Reference.Class == ACPI_REFCLASS_REFOF)
{
Node = ObjDesc->Reference.Object;
}
@@ -530,7 +528,7 @@ AcpiExResolveMultiple (
break;
case AML_INDEX_OP:
case ACPI_REFCLASS_INDEX:
/* Get the type of this reference (index into another object) */
@@ -558,19 +556,19 @@ AcpiExResolveMultiple (
break;
case AML_LOAD_OP:
case ACPI_REFCLASS_TABLE:
Type = ACPI_TYPE_DDB_HANDLE;
goto Exit;
case AML_LOCAL_OP:
case AML_ARG_OP:
case ACPI_REFCLASS_LOCAL:
case ACPI_REFCLASS_ARG:
if (ReturnDesc)
{
Status = AcpiDsMethodDataGetValue (ObjDesc->Reference.Opcode,
ObjDesc->Reference.Offset, WalkState, &ObjDesc);
Status = AcpiDsMethodDataGetValue (ObjDesc->Reference.Class,
ObjDesc->Reference.Value, WalkState, &ObjDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -579,8 +577,8 @@ AcpiExResolveMultiple (
}
else
{
Status = AcpiDsMethodDataGetNode (ObjDesc->Reference.Opcode,
ObjDesc->Reference.Offset, WalkState, &Node);
Status = AcpiDsMethodDataGetNode (ObjDesc->Reference.Class,
ObjDesc->Reference.Value, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -596,7 +594,7 @@ AcpiExResolveMultiple (
break;
case AML_DEBUG_OP:
case ACPI_REFCLASS_DEBUG:
/* The Debug Object is of type "DebugObject" */
@@ -607,8 +605,7 @@ AcpiExResolveMultiple (
default:
ACPI_ERROR ((AE_INFO,
"Unknown Reference subtype %X",
ObjDesc->Reference.Opcode));
"Unknown Reference Class %2.2X", ObjDesc->Reference.Class));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
}
@@ -617,7 +614,7 @@ AcpiExResolveMultiple (
* Now we are guaranteed to have an object that has not been created
* via the RefOf or Index operators.
*/
Type = ACPI_GET_OBJECT_TYPE (ObjDesc);
Type = ObjDesc->Common.Type;
Exit:
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exresop - AML Interpreter operand/object resolution
* $Revision: 1.96 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,6 +117,7 @@
#define __EXRESOP_C__
#include "acpi.h"
#include "accommon.h"
#include "amlcode.h"
#include "acparser.h"
#include "acinterp.h"
@@ -302,52 +302,48 @@ AcpiExResolveOperands (
/* ACPI internal object */
ObjectType = ACPI_GET_OBJECT_TYPE (ObjDesc);
ObjectType = ObjDesc->Common.Type;
/* Check for bad ACPI_OBJECT_TYPE */
if (!AcpiUtValidObjectType (ObjectType))
{
ACPI_ERROR ((AE_INFO,
"Bad operand object type [%X]",
ObjectType));
"Bad operand object type [%X]", ObjectType));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
if (ObjectType == (UINT8) ACPI_TYPE_LOCAL_REFERENCE)
{
/* Decode the Reference */
/* Validate the Reference */
OpInfo = AcpiPsGetOpcodeInfo (Opcode);
if (OpInfo->Class == AML_CLASS_UNKNOWN)
switch (ObjDesc->Reference.Class)
{
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}
case ACPI_REFCLASS_DEBUG:
switch (ObjDesc->Reference.Opcode)
{
case AML_DEBUG_OP:
TargetOp = AML_DEBUG_OP;
/*lint -fallthrough */
case AML_INDEX_OP:
case AML_REF_OF_OP:
case AML_ARG_OP:
case AML_LOCAL_OP:
case AML_LOAD_OP: /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */
case AML_INT_NAMEPATH_OP: /* Reference to a named object */
case ACPI_REFCLASS_ARG:
case ACPI_REFCLASS_LOCAL:
case ACPI_REFCLASS_INDEX:
case ACPI_REFCLASS_REFOF:
case ACPI_REFCLASS_TABLE: /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */
case ACPI_REFCLASS_NAME: /* Reference to a named object */
ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Operand is a Reference, RefOpcode [%s]\n",
(AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name)));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Operand is a Reference, Class [%s] %2.2X\n",
AcpiUtGetReferenceName (ObjDesc),
ObjDesc->Reference.Class));
break;
default:
ACPI_ERROR ((AE_INFO,
"Operand is a Reference, Unknown Reference Opcode: %X",
ObjDesc->Reference.Opcode));
"Unknown Reference Class %2.2X in %p",
ObjDesc->Reference.Class, ObjDesc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@@ -359,8 +355,7 @@ AcpiExResolveOperands (
/* Invalid descriptor */
ACPI_ERROR ((AE_INFO,
"Invalid descriptor %p [%s]",
ACPI_ERROR ((AE_INFO, "Invalid descriptor %p [%s]",
ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -380,7 +375,7 @@ AcpiExResolveOperands (
case ARGI_REF_OR_STRING: /* Can be a String or Reference */
if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) &&
(ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_STRING))
(ObjDesc->Common.Type == ACPI_TYPE_STRING))
{
/*
* String found - the string references a named object and
@@ -430,8 +425,8 @@ AcpiExResolveOperands (
* -- All others must be resolved below.
*/
if ((Opcode == AML_STORE_OP) &&
(ACPI_GET_OBJECT_TYPE (*StackPtr) == ACPI_TYPE_LOCAL_REFERENCE) &&
((*StackPtr)->Reference.Opcode == AML_INDEX_OP))
((*StackPtr)->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
((*StackPtr)->Reference.Class == ACPI_REFCLASS_INDEX))
{
goto NextOperand;
}
@@ -595,7 +590,7 @@ AcpiExResolveOperands (
/* Need an operand of type INTEGER, STRING or BUFFER */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING:
@@ -618,7 +613,7 @@ AcpiExResolveOperands (
/* Need an operand of type STRING or BUFFER */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
@@ -660,7 +655,7 @@ AcpiExResolveOperands (
* The only reference allowed here is a direct reference to
* a namespace node.
*/
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_PACKAGE:
case ACPI_TYPE_STRING:
@@ -684,7 +679,7 @@ AcpiExResolveOperands (
/* Need a buffer or package or (ACPI 2.0) String */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_PACKAGE:
case ACPI_TYPE_STRING:
@@ -707,7 +702,7 @@ AcpiExResolveOperands (
/* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_BUFFER:
case ACPI_TYPE_REGION:
@@ -729,7 +724,7 @@ AcpiExResolveOperands (
/* Used by the Store() operator only */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_PACKAGE:
@@ -789,7 +784,7 @@ AcpiExResolveOperands (
* required object type (Simple cases only).
*/
Status = AcpiExCheckObjectType (TypeNeeded,
ACPI_GET_OBJECT_TYPE (*StackPtr), *StackPtr);
(*StackPtr)->Common.Type, *StackPtr);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exstore - AML Interpreter object store support
* $Revision: 1.210 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,11 +117,11 @@
#define __EXSTORE_C__
#include "acpi.h"
#include "accommon.h"
#include "acdispat.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acparser.h"
#define _COMPONENT ACPI_EXECUTER
@@ -217,7 +216,7 @@ AcpiExDoDebugObject (
/* SourceDesc is of type ACPI_DESC_TYPE_OPERAND */
switch (ACPI_GET_OBJECT_TYPE (SourceDesc))
switch (SourceDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
@@ -265,22 +264,28 @@ AcpiExDoDebugObject (
case ACPI_TYPE_LOCAL_REFERENCE:
if (SourceDesc->Reference.Opcode == AML_INDEX_OP)
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s, 0x%X]\n",
AcpiPsGetOpcodeName (SourceDesc->Reference.Opcode),
SourceDesc->Reference.Offset));
}
else
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s]",
AcpiPsGetOpcodeName (SourceDesc->Reference.Opcode)));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s] ",
AcpiUtGetReferenceName (SourceDesc)));
if (SourceDesc->Reference.Opcode == AML_LOAD_OP) /* Load and LoadTable */
/* Decode the reference */
switch (SourceDesc->Reference.Class)
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
" Table OwnerId %p\n", SourceDesc->Reference.Object));
case ACPI_REFCLASS_INDEX:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%X\n",
SourceDesc->Reference.Value));
break;
case ACPI_REFCLASS_TABLE:
/* Case for DdbHandle */
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Table Index 0x%X\n",
SourceDesc->Reference.Value));
return;
default:
break;
}
@@ -407,7 +412,7 @@ AcpiExStore (
/* Destination object must be a Reference or a Constant object */
switch (ACPI_GET_OBJECT_TYPE (DestDesc))
switch (DestDesc->Common.Type)
{
case ACPI_TYPE_LOCAL_REFERENCE:
break;
@@ -435,16 +440,16 @@ AcpiExStore (
}
/*
* Examine the Reference opcode. These cases are handled:
* Examine the Reference class. 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
*/
switch (RefDesc->Reference.Opcode)
switch (RefDesc->Reference.Class)
{
case AML_REF_OF_OP:
case ACPI_REFCLASS_REFOF:
/* Storing an object into a Name "container" */
@@ -454,7 +459,7 @@ AcpiExStore (
break;
case AML_INDEX_OP:
case ACPI_REFCLASS_INDEX:
/* Storing to an Index (pointer into a packager or buffer) */
@@ -462,17 +467,17 @@ AcpiExStore (
break;
case AML_LOCAL_OP:
case AML_ARG_OP:
case ACPI_REFCLASS_LOCAL:
case ACPI_REFCLASS_ARG:
/* Store to a method local/arg */
Status = AcpiDsStoreObjectToLocal (RefDesc->Reference.Opcode,
RefDesc->Reference.Offset, SourceDesc, WalkState);
Status = AcpiDsStoreObjectToLocal (RefDesc->Reference.Class,
RefDesc->Reference.Value, SourceDesc, WalkState);
break;
case AML_DEBUG_OP:
case ACPI_REFCLASS_DEBUG:
/*
* Storing to the Debug object causes the value stored to be
@@ -488,9 +493,9 @@ AcpiExStore (
default:
ACPI_ERROR ((AE_INFO, "Unknown Reference opcode %X",
RefDesc->Reference.Opcode));
ACPI_DUMP_ENTRY (RefDesc, ACPI_LV_ERROR);
ACPI_ERROR ((AE_INFO, "Unknown Reference Class %2.2X",
RefDesc->Reference.Class));
ACPI_DUMP_ENTRY (RefDesc, ACPI_LV_INFO);
Status = AE_AML_INTERNAL;
break;
@@ -548,8 +553,8 @@ AcpiExStoreObjectToIndex (
*/
ObjDesc = *(IndexDesc->Reference.Where);
if (ACPI_GET_OBJECT_TYPE (SourceDesc) == ACPI_TYPE_LOCAL_REFERENCE &&
SourceDesc->Reference.Opcode == AML_LOAD_OP)
if (SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE &&
SourceDesc->Reference.Class == ACPI_REFCLASS_TABLE)
{
/* This is a DDBHandle, just add a reference to it */
@@ -612,8 +617,8 @@ AcpiExStoreObjectToIndex (
* by the INDEX_OP code.
*/
ObjDesc = IndexDesc->Reference.Object;
if ((ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_BUFFER) &&
(ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_STRING))
if ((ObjDesc->Common.Type != ACPI_TYPE_BUFFER) &&
(ObjDesc->Common.Type != ACPI_TYPE_STRING))
{
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@@ -622,7 +627,7 @@ AcpiExStoreObjectToIndex (
* The assignment of the individual elements will be slightly
* different for each source type.
*/
switch (ACPI_GET_OBJECT_TYPE (SourceDesc))
switch (SourceDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
@@ -651,7 +656,7 @@ AcpiExStoreObjectToIndex (
/* Store the source value into the target buffer byte */
ObjDesc->Buffer.Pointer[IndexDesc->Reference.Offset] = Value;
ObjDesc->Buffer.Pointer[IndexDesc->Reference.Value] = Value;
break;
@@ -807,7 +812,7 @@ AcpiExStoreObjectToNode (
/* No conversions for all other types. Just attach the source object */
Status = AcpiNsAttachObject (Node, SourceDesc,
ACPI_GET_OBJECT_TYPE (SourceDesc));
SourceDesc->Common.Type);
break;
}

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